commit a71eb8c994d98d55b6cf5e5c7d9f78c6442c1291 Author: Nicolas Bally Date: Mon Aug 23 10:26:02 2021 +0200 first commit diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 0000000..e94f814 --- /dev/null +++ b/.browserslistrc @@ -0,0 +1 @@ +defaults diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce3c4a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# If you find yourself ignoring temporary files generated by your text editor +# or operating system, you probably want to add a global ignore instead: +# git config --global core.excludesfile '~/.gitignore_global' + +/.DS_Store +.DS_Store + +# Ignore bundler config. +/.bundle + +# Ignore the default SQLite database. +/db/*.sqlite3 +/db/*.sqlite3-journal + +# Ignore all logfiles and tempfiles. +/log/* +/tmp/* +!/log/.keep +!/tmp/.keep + +# Ignore uploaded files in development. +/storage/* +!/storage/.keep + +/public/assets +.byebug_history + +# Ignore master key for decrypting credentials and more. +/config/master.key + +/public/packs +/public/packs-test +/node_modules +/yarn-error.log +yarn-debug.log* +.yarn-integrity + +/private_medias/* +/public/public_medias/* +/pdf/* + +/.sass_cache/* + + +.sass-cache/551e35054e425f73ddd32ae49561eb1470a73e50/ diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..dd6df73 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.6.0 diff --git a/.sass-cache/083c2e2370a05c14b1772ce91712d5bdc574d11c/(__TEMPLATE__)c b/.sass-cache/083c2e2370a05c14b1772ce91712d5bdc574d11c/(__TEMPLATE__)c new file mode 100644 index 0000000..75e9d48 Binary files /dev/null and b/.sass-cache/083c2e2370a05c14b1772ce91712d5bdc574d11c/(__TEMPLATE__)c differ diff --git a/.sass-cache/12286a77b671be4a784e66d0af7d319dfe0da3d0/(__TEMPLATE__)c b/.sass-cache/12286a77b671be4a784e66d0af7d319dfe0da3d0/(__TEMPLATE__)c new file mode 100644 index 0000000..92e5d77 Binary files /dev/null and b/.sass-cache/12286a77b671be4a784e66d0af7d319dfe0da3d0/(__TEMPLATE__)c differ diff --git a/.sass-cache/75c0cfb58d7aee0ebe1fb068575138394d6376f3/(__TEMPLATE__)c b/.sass-cache/75c0cfb58d7aee0ebe1fb068575138394d6376f3/(__TEMPLATE__)c new file mode 100644 index 0000000..2a97762 Binary files /dev/null and b/.sass-cache/75c0cfb58d7aee0ebe1fb068575138394d6376f3/(__TEMPLATE__)c differ diff --git a/.sass-cache/accb782d69d9fd8c453650a043b164b752f3f6a6/(__TEMPLATE__)c b/.sass-cache/accb782d69d9fd8c453650a043b164b752f3f6a6/(__TEMPLATE__)c new file mode 100644 index 0000000..f8424f5 Binary files /dev/null and b/.sass-cache/accb782d69d9fd8c453650a043b164b752f3f6a6/(__TEMPLATE__)c differ diff --git a/.sass-cache/d2df996b559cfe4c43d9dd69abc335b2f901b334/(__TEMPLATE__)c b/.sass-cache/d2df996b559cfe4c43d9dd69abc335b2f901b334/(__TEMPLATE__)c new file mode 100644 index 0000000..c17a9cb Binary files /dev/null and b/.sass-cache/d2df996b559cfe4c43d9dd69abc335b2f901b334/(__TEMPLATE__)c differ diff --git a/.sass-cache/e504ced00b4e84edba0f02520bbd4def6a0b496b/(__TEMPLATE__)c b/.sass-cache/e504ced00b4e84edba0f02520bbd4def6a0b496b/(__TEMPLATE__)c new file mode 100644 index 0000000..63d5871 Binary files /dev/null and b/.sass-cache/e504ced00b4e84edba0f02520bbd4def6a0b496b/(__TEMPLATE__)c differ diff --git a/.sass-cache/f090293a1eb35754a3fca8ac7a1d953139c610b9/(__TEMPLATE__)c b/.sass-cache/f090293a1eb35754a3fca8ac7a1d953139c610b9/(__TEMPLATE__)c new file mode 100644 index 0000000..7d12e66 Binary files /dev/null and b/.sass-cache/f090293a1eb35754a3fca8ac7a1d953139c610b9/(__TEMPLATE__)c differ diff --git a/Capfile b/Capfile new file mode 100644 index 0000000..53de04b --- /dev/null +++ b/Capfile @@ -0,0 +1,41 @@ +# Load DSL and set up stages +require "capistrano/setup" + +# Include default deployment tasks +require "capistrano/deploy" + +# Load the SCM plugin appropriate to your project: +# +# require "capistrano/scm/hg" +# install_plugin Capistrano::SCM::Hg +# or +# require "capistrano/scm/svn" +# install_plugin Capistrano::SCM::Svn +# or +require "capistrano/scm/git" +install_plugin Capistrano::SCM::Git + +# Include tasks from other gems included in your Gemfile +# +# For documentation on these, see for example: +# +# https://github.com/capistrano/rvm +# https://github.com/capistrano/rbenv +# https://github.com/capistrano/chruby +# https://github.com/capistrano/bundler +# https://github.com/capistrano/rails +# https://github.com/capistrano/passenger +# +require "capistrano/rvm" +# require "capistrano/rbenv" +# require "capistrano/chruby" +require "capistrano/rails/assets" +#require 'capistrano/nginx' +require "capistrano/bundler" +require "capistrano/rails/migrations" +# require "capistrano/passenger" + + + +# Load custom tasks from `lib/capistrano/tasks` if you have any defined +Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r } diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..f4aa40b --- /dev/null +++ b/Gemfile @@ -0,0 +1,116 @@ +source 'https://rubygems.org' +git_source(:github) { |repo| "https://github.com/#{repo}.git" } + +ruby '2.6.0' + +# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' +gem 'rails', '6.0.3.4' +# Use sqlite3 as the database for Active Record +gem 'mysql2' +# Use Puma as the app server + +# Use SCSS for stylesheets +gem 'sass-rails', '~> 5' +# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker +#gem 'webpacker', '~> 4.0' +gem 'jquery-rails' +gem 'sprockets' #, '~> 4.0' + + +# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks +gem 'turbolinks', '~> 5' +# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder +gem 'jbuilder', '~> 2.5' +# Use Redis adapter to run Action Cable in production +# gem 'redis', '~> 4.0' +# Use Active Model has_secure_password +gem 'bcrypt', '~> 3.1.7' + + +gem 'coffee-rails' + +# Use Active Storage variant +# gem 'image_processing', '~> 1.2' + +# Reduces boot times through caching; required in config/boot.rb +gem 'bootsnap', '>= 1.4.2', require: false + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] + + +end + +group :production do + gem 'unicorn' +end + +group :development do + + gem 'puma', '~> 3.11' + # Access an interactive console on exception pages or by calling 'console' anywhere in the code. + gem 'web-console', '>= 3.3.0' + gem 'listen', '>= 3.0.5', '< 3.2' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' + gem 'spring-watcher-listen', '~> 2.0.0' +end + +group :test do + # Adds support for Capybara system testing and selenium driver + gem 'capybara', '>= 2.15' + gem 'selenium-webdriver' + # Easy installation and use of web drivers to run system tests with browsers + gem 'webdrivers' +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] + + +gem 'carrierwave' +gem 'rmagick'#, :require => 'RMagick' + + +gem 'acts_as_tree' +gem 'formtastic', "2.3.0" +gem "twitter-bootstrap-rails" +gem 'formtastic-bootstrap' +gem 'acts_as_commentable' +gem 'gravatar_image_tag' +gem 'kaminari-bootstrap' +gem 'fastimage' +#gem 'ogone-rails' +gem "geocoder" +gem "iban-tools" +gem "nokogiri" +gem 'searchkick' + + + + +gem 'truncate_html' +gem "posix-spawn" +gem "country_select" +gem 'haml-rails' +gem 'rails_autolink' + + +group :development do + gem "capistrano", "~> 3.10", require: false + gem 'capistrano-rails', '~> 1.1', require: false + gem 'capistrano-bundler', '~> 1.1', require: false + gem "capistrano-rvm", group: :development + gem 'capistrano3-nginx', '~> 2.0', group: :development + +end + +gem 'zip-zip' + +gem "tiny_tds", "1.3.0" + +gem 'axlsx', '3.0.0.pre' +gem 'axlsx_rails' + +gem 'mimemagic', "0.3.10" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..d04e35e --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,413 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.3.4) + actionpack (= 6.0.3.4) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.3.4) + actionpack (= 6.0.3.4) + activejob (= 6.0.3.4) + activerecord (= 6.0.3.4) + activestorage (= 6.0.3.4) + activesupport (= 6.0.3.4) + mail (>= 2.7.1) + actionmailer (6.0.3.4) + actionpack (= 6.0.3.4) + actionview (= 6.0.3.4) + activejob (= 6.0.3.4) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.3.4) + actionview (= 6.0.3.4) + activesupport (= 6.0.3.4) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.3.4) + actionpack (= 6.0.3.4) + activerecord (= 6.0.3.4) + activestorage (= 6.0.3.4) + activesupport (= 6.0.3.4) + nokogiri (>= 1.8.5) + actionview (6.0.3.4) + activesupport (= 6.0.3.4) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.3.4) + activesupport (= 6.0.3.4) + globalid (>= 0.3.6) + activemodel (6.0.3.4) + activesupport (= 6.0.3.4) + activerecord (6.0.3.4) + activemodel (= 6.0.3.4) + activesupport (= 6.0.3.4) + activestorage (6.0.3.4) + actionpack (= 6.0.3.4) + activejob (= 6.0.3.4) + activerecord (= 6.0.3.4) + marcel (~> 0.3.1) + activesupport (6.0.3.4) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2, >= 2.2.2) + acts_as_commentable (4.0.2) + acts_as_tree (2.9.0) + activerecord (>= 3.0.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + airbrussh (1.3.3) + sshkit (>= 1.6.1, != 1.7.0) + axlsx (3.0.0.pre) + htmlentities (~> 4.3, >= 4.3.4) + mimemagic (~> 0.3) + nokogiri (~> 1.8, >= 1.8.2) + rubyzip (~> 1.2, >= 1.2.1) + axlsx_rails (0.5.2) + actionpack (>= 3.1) + axlsx (>= 2.0.1) + bcrypt (3.1.16) + bindex (0.8.1) + bootsnap (1.4.5) + msgpack (~> 1.0) + builder (3.2.4) + byebug (11.0.1) + capistrano (3.11.1) + airbrussh (>= 1.0.0) + i18n + rake (>= 10.0.0) + sshkit (>= 1.9.0) + capistrano-bundler (1.6.0) + capistrano (~> 3.1) + capistrano-rails (1.4.0) + capistrano (~> 3.1) + capistrano-bundler (~> 1.1) + capistrano-rvm (0.1.2) + capistrano (~> 3.0) + sshkit (~> 1.2) + capistrano3-nginx (2.1.6) + capistrano (>= 3.0.0) + capybara (3.28.0) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) + carrierwave (2.0.1) + activemodel (>= 5.0.0) + activesupport (>= 5.0.0) + addressable (~> 2.6) + image_processing (~> 1.1) + mimemagic (>= 0.3.0) + mini_mime (>= 0.1.3) + childprocess (1.0.1) + rake (< 13.0) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + commonjs (0.2.7) + concurrent-ruby (1.1.7) + countries (3.0.0) + i18n_data (~> 0.8.0) + sixarm_ruby_unaccent (~> 1.1) + unicode_utils (~> 1.4) + country_select (4.0.0) + countries (~> 3.0) + sort_alphabetical (~> 1.0) + crass (1.0.6) + elasticsearch (7.3.0) + elasticsearch-api (= 7.3.0) + elasticsearch-transport (= 7.3.0) + elasticsearch-api (7.3.0) + multi_json + elasticsearch-transport (7.3.0) + faraday + multi_json + erubi (1.9.0) + erubis (2.7.0) + execjs (2.7.0) + faraday (0.15.4) + multipart-post (>= 1.2, < 3) + fastimage (2.1.5) + ffi (1.11.1) + formtastic (2.3.0) + actionpack (>= 3.0) + formtastic-bootstrap (3.0.0) + formtastic (>= 2.2) + geocoder (1.5.1) + globalid (0.4.2) + activesupport (>= 4.2.0) + gravatar_image_tag (1.2.0) + haml (5.1.2) + temple (>= 0.8.0) + tilt + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) + haml (>= 4.0.6, < 6.0) + html2haml (>= 1.0.1) + railties (>= 5.1) + hashie (3.6.0) + html2haml (2.2.0) + erubis (~> 2.7.0) + haml (>= 4.0, < 6) + nokogiri (>= 1.6.0) + ruby_parser (~> 3.5) + htmlentities (4.3.4) + i18n (1.8.5) + concurrent-ruby (~> 1.0) + i18n_data (0.8.0) + iban-tools (1.1.0) + image_processing (1.9.3) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.13, < 3) + jbuilder (2.9.1) + activesupport (>= 4.2.0) + jquery-rails (4.3.5) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + kaminari (1.1.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) + actionview + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) + activerecord + kaminari-core (= 1.1.1) + kaminari-bootstrap (3.0.1) + kaminari (>= 0.13.0) + rails + kaminari-core (1.1.1) + kgio (2.11.2) + less (2.6.0) + commonjs (~> 0.2.7) + less-rails (4.0.0) + actionpack (>= 4) + less (~> 2.6.0) + sprockets (>= 2) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) + loofah (2.7.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mimemagic (0.3.10) + nokogiri (~> 1) + rake + mini_magick (4.9.5) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.2) + msgpack (1.3.1) + multi_json (1.13.1) + multipart-post (2.1.1) + mysql2 (0.5.2) + net-scp (2.0.0) + net-ssh (>= 2.6.5, < 6.0.0) + net-ssh (5.2.0) + nio4r (2.5.4) + nokogiri (1.10.10) + mini_portile2 (~> 2.4.0) + posix-spawn (0.3.13) + public_suffix (4.0.1) + puma (3.12.1) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.3.4) + actioncable (= 6.0.3.4) + actionmailbox (= 6.0.3.4) + actionmailer (= 6.0.3.4) + actionpack (= 6.0.3.4) + actiontext (= 6.0.3.4) + actionview (= 6.0.3.4) + activejob (= 6.0.3.4) + activemodel (= 6.0.3.4) + activerecord (= 6.0.3.4) + activestorage (= 6.0.3.4) + activesupport (= 6.0.3.4) + bundler (>= 1.3.0) + railties (= 6.0.3.4) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + rails_autolink (1.1.6) + rails (> 3.1) + railties (6.0.3.4) + actionpack (= 6.0.3.4) + activesupport (= 6.0.3.4) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + raindrops (0.19.0) + rake (12.3.3) + rb-fsevent (0.10.3) + rb-inotify (0.10.0) + ffi (~> 1.0) + regexp_parser (1.6.0) + rmagick (4.0.0) + ruby-vips (2.0.14) + ffi (~> 1.9) + ruby_dep (1.5.0) + ruby_parser (3.13.1) + sexp_processor (~> 4.9) + rubyzip (1.2.3) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + sass-rails (5.1.0) + railties (>= 5.2.0) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + searchkick (4.1.0) + activemodel (>= 5) + elasticsearch (>= 6) + hashie + selenium-webdriver (3.142.3) + childprocess (>= 0.5, < 2.0) + rubyzip (~> 1.2, >= 1.2.2) + sexp_processor (4.12.1) + sixarm_ruby_unaccent (1.2.0) + sort_alphabetical (1.1.0) + unicode_utils (>= 1.2.2) + spring (2.1.0) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.2) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sshkit (1.20.0) + net-scp (>= 1.1.2) + net-ssh (>= 2.8.0) + temple (0.8.1) + thor (1.0.1) + thread_safe (0.3.6) + tilt (2.0.9) + tiny_tds (1.3.0) + mini_portile2 (~> 2.0) + truncate_html (0.9.3) + turbolinks (5.2.0) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + twitter-bootstrap-rails (3.2.2) + actionpack (>= 3.1) + execjs (>= 2.2.2, >= 2.2) + less-rails (>= 2.5.0) + railties (>= 3.1) + tzinfo (1.2.7) + thread_safe (~> 0.1) + unicode_utils (1.4.0) + unicorn (5.5.1) + kgio (~> 2.6) + raindrops (~> 0.7) + web-console (4.0.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + webdrivers (4.1.2) + nokogiri (~> 1.6) + rubyzip (~> 1.0) + selenium-webdriver (>= 3.0, < 4.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.4.0) + zip-zip (0.3) + rubyzip (>= 1.0.0) + +PLATFORMS + ruby + +DEPENDENCIES + acts_as_commentable + acts_as_tree + axlsx (= 3.0.0.pre) + axlsx_rails + bcrypt (~> 3.1.7) + bootsnap (>= 1.4.2) + byebug + capistrano (~> 3.10) + capistrano-bundler (~> 1.1) + capistrano-rails (~> 1.1) + capistrano-rvm + capistrano3-nginx (~> 2.0) + capybara (>= 2.15) + carrierwave + coffee-rails + country_select + fastimage + formtastic (= 2.3.0) + formtastic-bootstrap + geocoder + gravatar_image_tag + haml-rails + iban-tools + jbuilder (~> 2.5) + jquery-rails + kaminari-bootstrap + listen (>= 3.0.5, < 3.2) + mimemagic (= 0.3.10) + mysql2 + nokogiri + posix-spawn + puma (~> 3.11) + rails (= 6.0.3.4) + rails_autolink + rmagick + sass-rails (~> 5) + searchkick + selenium-webdriver + spring + spring-watcher-listen (~> 2.0.0) + sprockets + tiny_tds (= 1.3.0) + truncate_html + turbolinks (~> 5) + twitter-bootstrap-rails + tzinfo-data + unicorn + web-console (>= 3.3.0) + webdrivers + zip-zip + +RUBY VERSION + ruby 2.6.0p0 + +BUNDLED WITH + 1.17.3 diff --git a/README.md b/README.md new file mode 100644 index 0000000..7db80e4 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..e85f913 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative 'config/application' + +Rails.application.load_tasks diff --git a/app/assets/config/manifest.js b/app/assets/config/manifest.js new file mode 100644 index 0000000..5918193 --- /dev/null +++ b/app/assets/config/manifest.js @@ -0,0 +1,2 @@ +//= link_tree ../images +//= link_directory ../stylesheets .css diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/images/admin/content_type/type_AgirContent.png b/app/assets/images/admin/content_type/type_AgirContent.png new file mode 100644 index 0000000..3bb977b Binary files /dev/null and b/app/assets/images/admin/content_type/type_AgirContent.png differ diff --git a/app/assets/images/admin/content_type/type_ArticleindexsContent.png b/app/assets/images/admin/content_type/type_ArticleindexsContent.png new file mode 100644 index 0000000..aa5bc50 Binary files /dev/null and b/app/assets/images/admin/content_type/type_ArticleindexsContent.png differ diff --git a/app/assets/images/admin/content_type/type_BlockContent.png b/app/assets/images/admin/content_type/type_BlockContent.png new file mode 100644 index 0000000..dc03b17 Binary files /dev/null and b/app/assets/images/admin/content_type/type_BlockContent.png differ diff --git a/app/assets/images/admin/content_type/type_BreakContent.png b/app/assets/images/admin/content_type/type_BreakContent.png new file mode 100644 index 0000000..6f099c4 Binary files /dev/null and b/app/assets/images/admin/content_type/type_BreakContent.png differ diff --git a/app/assets/images/admin/content_type/type_DownloadContent.png b/app/assets/images/admin/content_type/type_DownloadContent.png new file mode 100644 index 0000000..55e03b2 Binary files /dev/null and b/app/assets/images/admin/content_type/type_DownloadContent.png differ diff --git a/app/assets/images/admin/content_type/type_DynamicContent.png b/app/assets/images/admin/content_type/type_DynamicContent.png new file mode 100644 index 0000000..ba3ea99 Binary files /dev/null and b/app/assets/images/admin/content_type/type_DynamicContent.png differ diff --git a/app/assets/images/admin/content_type/type_EventContent.png b/app/assets/images/admin/content_type/type_EventContent.png new file mode 100644 index 0000000..38813d5 Binary files /dev/null and b/app/assets/images/admin/content_type/type_EventContent.png differ diff --git a/app/assets/images/admin/content_type/type_GalleryContent.png b/app/assets/images/admin/content_type/type_GalleryContent.png new file mode 100644 index 0000000..3fb094d Binary files /dev/null and b/app/assets/images/admin/content_type/type_GalleryContent.png differ diff --git a/app/assets/images/admin/content_type/type_HtmlContent.png b/app/assets/images/admin/content_type/type_HtmlContent.png new file mode 100644 index 0000000..4e5a2c0 Binary files /dev/null and b/app/assets/images/admin/content_type/type_HtmlContent.png differ diff --git a/app/assets/images/admin/content_type/type_ImageContent.png b/app/assets/images/admin/content_type/type_ImageContent.png new file mode 100644 index 0000000..c95ef84 Binary files /dev/null and b/app/assets/images/admin/content_type/type_ImageContent.png differ diff --git a/app/assets/images/admin/content_type/type_ImgLinkContent.png b/app/assets/images/admin/content_type/type_ImgLinkContent.png new file mode 100644 index 0000000..2cbb5b7 Binary files /dev/null and b/app/assets/images/admin/content_type/type_ImgLinkContent.png differ diff --git a/app/assets/images/admin/content_type/type_KeynumberContent.png b/app/assets/images/admin/content_type/type_KeynumberContent.png new file mode 100644 index 0000000..101cd65 Binary files /dev/null and b/app/assets/images/admin/content_type/type_KeynumberContent.png differ diff --git a/app/assets/images/admin/content_type/type_LinkContent.png b/app/assets/images/admin/content_type/type_LinkContent.png new file mode 100644 index 0000000..8a357c6 Binary files /dev/null and b/app/assets/images/admin/content_type/type_LinkContent.png differ diff --git a/app/assets/images/admin/content_type/type_MapContent.png b/app/assets/images/admin/content_type/type_MapContent.png new file mode 100644 index 0000000..9abe801 Binary files /dev/null and b/app/assets/images/admin/content_type/type_MapContent.png differ diff --git a/app/assets/images/admin/content_type/type_MenuItemLinkContent.png b/app/assets/images/admin/content_type/type_MenuItemLinkContent.png new file mode 100644 index 0000000..11c0288 Binary files /dev/null and b/app/assets/images/admin/content_type/type_MenuItemLinkContent.png differ diff --git a/app/assets/images/admin/content_type/type_PetitionContent.png b/app/assets/images/admin/content_type/type_PetitionContent.png new file mode 100644 index 0000000..b5eb123 Binary files /dev/null and b/app/assets/images/admin/content_type/type_PetitionContent.png differ diff --git a/app/assets/images/admin/content_type/type_QuoteContent.png b/app/assets/images/admin/content_type/type_QuoteContent.png new file mode 100644 index 0000000..bddecd0 Binary files /dev/null and b/app/assets/images/admin/content_type/type_QuoteContent.png differ diff --git a/app/assets/images/admin/content_type/type_ShareContent.png b/app/assets/images/admin/content_type/type_ShareContent.png new file mode 100644 index 0000000..a006618 Binary files /dev/null and b/app/assets/images/admin/content_type/type_ShareContent.png differ diff --git a/app/assets/images/admin/content_type/type_SlideContent.png b/app/assets/images/admin/content_type/type_SlideContent.png new file mode 100644 index 0000000..4df772d Binary files /dev/null and b/app/assets/images/admin/content_type/type_SlideContent.png differ diff --git a/app/assets/images/admin/content_type/type_TableContent.png b/app/assets/images/admin/content_type/type_TableContent.png new file mode 100644 index 0000000..730de83 Binary files /dev/null and b/app/assets/images/admin/content_type/type_TableContent.png differ diff --git a/app/assets/images/admin/content_type/type_TextContent.png b/app/assets/images/admin/content_type/type_TextContent.png new file mode 100644 index 0000000..bafd8ff Binary files /dev/null and b/app/assets/images/admin/content_type/type_TextContent.png differ diff --git a/app/assets/images/admin/content_type/type_TimeContent.png b/app/assets/images/admin/content_type/type_TimeContent.png new file mode 100644 index 0000000..975def5 Binary files /dev/null and b/app/assets/images/admin/content_type/type_TimeContent.png differ diff --git a/app/assets/images/admin/content_type/type_TitleContent.png b/app/assets/images/admin/content_type/type_TitleContent.png new file mode 100644 index 0000000..df0eb52 Binary files /dev/null and b/app/assets/images/admin/content_type/type_TitleContent.png differ diff --git a/app/assets/images/admin/content_type/type_VideoContent.png b/app/assets/images/admin/content_type/type_VideoContent.png new file mode 100644 index 0000000..28d9375 Binary files /dev/null and b/app/assets/images/admin/content_type/type_VideoContent.png differ diff --git a/app/assets/images/admin/default_image.png b/app/assets/images/admin/default_image.png new file mode 100644 index 0000000..a89151e Binary files /dev/null and b/app/assets/images/admin/default_image.png differ diff --git a/app/assets/images/file_types/1358029801_css.png b/app/assets/images/file_types/1358029801_css.png new file mode 100644 index 0000000..42b4528 Binary files /dev/null and b/app/assets/images/file_types/1358029801_css.png differ diff --git a/app/assets/images/file_types/1358029807_docx.png b/app/assets/images/file_types/1358029807_docx.png new file mode 100644 index 0000000..7aa40bc Binary files /dev/null and b/app/assets/images/file_types/1358029807_docx.png differ diff --git a/app/assets/images/file_types/1358029820_psd.png b/app/assets/images/file_types/1358029820_psd.png new file mode 100644 index 0000000..4cdf434 Binary files /dev/null and b/app/assets/images/file_types/1358029820_psd.png differ diff --git a/app/assets/images/file_types/1358029824_jpg.png b/app/assets/images/file_types/1358029824_jpg.png new file mode 100644 index 0000000..943858c Binary files /dev/null and b/app/assets/images/file_types/1358029824_jpg.png differ diff --git a/app/assets/images/file_types/1358029827_generic.png b/app/assets/images/file_types/1358029827_generic.png new file mode 100644 index 0000000..b91b1be Binary files /dev/null and b/app/assets/images/file_types/1358029827_generic.png differ diff --git a/app/assets/images/file_types/1358029830_doc.png b/app/assets/images/file_types/1358029830_doc.png new file mode 100644 index 0000000..983cc8a Binary files /dev/null and b/app/assets/images/file_types/1358029830_doc.png differ diff --git a/app/assets/images/file_types/1358029834_aac.png b/app/assets/images/file_types/1358029834_aac.png new file mode 100644 index 0000000..4d32144 Binary files /dev/null and b/app/assets/images/file_types/1358029834_aac.png differ diff --git a/app/assets/images/file_types/1358029839_wmv.png b/app/assets/images/file_types/1358029839_wmv.png new file mode 100644 index 0000000..27d2d25 Binary files /dev/null and b/app/assets/images/file_types/1358029839_wmv.png differ diff --git a/app/assets/images/file_types/1358029845_raw.png b/app/assets/images/file_types/1358029845_raw.png new file mode 100644 index 0000000..5fd1b19 Binary files /dev/null and b/app/assets/images/file_types/1358029845_raw.png differ diff --git a/app/assets/images/file_types/1358029848_tar.png b/app/assets/images/file_types/1358029848_tar.png new file mode 100644 index 0000000..34f0d31 Binary files /dev/null and b/app/assets/images/file_types/1358029848_tar.png differ diff --git a/app/assets/images/file_types/1358029854_tiff.png b/app/assets/images/file_types/1358029854_tiff.png new file mode 100644 index 0000000..f5c07d1 Binary files /dev/null and b/app/assets/images/file_types/1358029854_tiff.png differ diff --git a/app/assets/images/file_types/1358029858_rtf.png b/app/assets/images/file_types/1358029858_rtf.png new file mode 100644 index 0000000..7fe2fe3 Binary files /dev/null and b/app/assets/images/file_types/1358029858_rtf.png differ diff --git a/app/assets/images/file_types/1358029860_rtf.png b/app/assets/images/file_types/1358029860_rtf.png new file mode 100644 index 0000000..7fe2fe3 Binary files /dev/null and b/app/assets/images/file_types/1358029860_rtf.png differ diff --git a/app/assets/images/file_types/1358029868_js.png b/app/assets/images/file_types/1358029868_js.png new file mode 100644 index 0000000..6fed77c Binary files /dev/null and b/app/assets/images/file_types/1358029868_js.png differ diff --git a/app/assets/images/file_types/1358029872_gif.png b/app/assets/images/file_types/1358029872_gif.png new file mode 100644 index 0000000..c3940d2 Binary files /dev/null and b/app/assets/images/file_types/1358029872_gif.png differ diff --git a/app/assets/images/file_types/1358029874_aiff.png b/app/assets/images/file_types/1358029874_aiff.png new file mode 100644 index 0000000..721a436 Binary files /dev/null and b/app/assets/images/file_types/1358029874_aiff.png differ diff --git a/app/assets/images/file_types/1358029878_gzip.png b/app/assets/images/file_types/1358029878_gzip.png new file mode 100644 index 0000000..af4ece5 Binary files /dev/null and b/app/assets/images/file_types/1358029878_gzip.png differ diff --git a/app/assets/images/file_types/1358029881_ma.png b/app/assets/images/file_types/1358029881_ma.png new file mode 100644 index 0000000..fc4af76 Binary files /dev/null and b/app/assets/images/file_types/1358029881_ma.png differ diff --git a/app/assets/images/file_types/1358029885_mp.png b/app/assets/images/file_types/1358029885_mp.png new file mode 100644 index 0000000..122aa42 Binary files /dev/null and b/app/assets/images/file_types/1358029885_mp.png differ diff --git a/app/assets/images/file_types/1358029888_php.png b/app/assets/images/file_types/1358029888_php.png new file mode 100644 index 0000000..18b1e1d Binary files /dev/null and b/app/assets/images/file_types/1358029888_php.png differ diff --git a/app/assets/images/file_types/1358029892_mpeg.png b/app/assets/images/file_types/1358029892_mpeg.png new file mode 100644 index 0000000..1e072fb Binary files /dev/null and b/app/assets/images/file_types/1358029892_mpeg.png differ diff --git a/app/assets/images/file_types/1358029894_mov.png b/app/assets/images/file_types/1358029894_mov.png new file mode 100644 index 0000000..0d04088 Binary files /dev/null and b/app/assets/images/file_types/1358029894_mov.png differ diff --git a/app/assets/images/file_types/1358029899_html.png b/app/assets/images/file_types/1358029899_html.png new file mode 100644 index 0000000..6699269 Binary files /dev/null and b/app/assets/images/file_types/1358029899_html.png differ diff --git a/app/assets/images/file_types/1358029903_avi.png b/app/assets/images/file_types/1358029903_avi.png new file mode 100644 index 0000000..233252f Binary files /dev/null and b/app/assets/images/file_types/1358029903_avi.png differ diff --git a/app/assets/images/file_types/1358029912_wav.png b/app/assets/images/file_types/1358029912_wav.png new file mode 100644 index 0000000..07bd3b4 Binary files /dev/null and b/app/assets/images/file_types/1358029912_wav.png differ diff --git a/app/assets/images/file_types/1358029916_generic.png b/app/assets/images/file_types/1358029916_generic.png new file mode 100644 index 0000000..b91b1be Binary files /dev/null and b/app/assets/images/file_types/1358029916_generic.png differ diff --git a/app/assets/images/file_types/_blank.png b/app/assets/images/file_types/_blank.png new file mode 100755 index 0000000..ceebb42 Binary files /dev/null and b/app/assets/images/file_types/_blank.png differ diff --git a/app/assets/images/file_types/_page.png b/app/assets/images/file_types/_page.png new file mode 100755 index 0000000..349e29f Binary files /dev/null and b/app/assets/images/file_types/_page.png differ diff --git a/app/assets/images/file_types/aac.png b/app/assets/images/file_types/aac.png new file mode 100755 index 0000000..a0720ca Binary files /dev/null and b/app/assets/images/file_types/aac.png differ diff --git a/app/assets/images/file_types/ai.png b/app/assets/images/file_types/ai.png new file mode 100644 index 0000000..f28c86a Binary files /dev/null and b/app/assets/images/file_types/ai.png differ diff --git a/app/assets/images/file_types/bmp.png b/app/assets/images/file_types/bmp.png new file mode 100644 index 0000000..bb852d2 Binary files /dev/null and b/app/assets/images/file_types/bmp.png differ diff --git a/app/assets/images/file_types/eps.png b/app/assets/images/file_types/eps.png new file mode 100644 index 0000000..26ad468 Binary files /dev/null and b/app/assets/images/file_types/eps.png differ diff --git a/app/assets/images/file_types/gif.png b/app/assets/images/file_types/gif.png new file mode 100644 index 0000000..c02d274 Binary files /dev/null and b/app/assets/images/file_types/gif.png differ diff --git a/app/assets/images/file_types/icns.png b/app/assets/images/file_types/icns.png new file mode 100644 index 0000000..a2a36a6 Binary files /dev/null and b/app/assets/images/file_types/icns.png differ diff --git a/app/assets/images/file_types/ico.png b/app/assets/images/file_types/ico.png new file mode 100644 index 0000000..7b3e4ca Binary files /dev/null and b/app/assets/images/file_types/ico.png differ diff --git a/app/assets/images/file_types/jpeg.png b/app/assets/images/file_types/jpeg.png new file mode 100644 index 0000000..a5c596e Binary files /dev/null and b/app/assets/images/file_types/jpeg.png differ diff --git a/app/assets/images/file_types/jpg.png b/app/assets/images/file_types/jpg.png new file mode 100644 index 0000000..a5c596e Binary files /dev/null and b/app/assets/images/file_types/jpg.png differ diff --git a/app/assets/images/file_types/key.png b/app/assets/images/file_types/key.png new file mode 100644 index 0000000..d2f6a06 Binary files /dev/null and b/app/assets/images/file_types/key.png differ diff --git a/app/assets/images/file_types/kth.png b/app/assets/images/file_types/kth.png new file mode 100644 index 0000000..28acd08 Binary files /dev/null and b/app/assets/images/file_types/kth.png differ diff --git a/app/assets/images/file_types/m4v.png b/app/assets/images/file_types/m4v.png new file mode 100644 index 0000000..ede0b74 Binary files /dev/null and b/app/assets/images/file_types/m4v.png differ diff --git a/app/assets/images/file_types/md.png b/app/assets/images/file_types/md.png new file mode 100644 index 0000000..f931895 Binary files /dev/null and b/app/assets/images/file_types/md.png differ diff --git a/app/assets/images/file_types/mpg.png b/app/assets/images/file_types/mpg.png new file mode 100644 index 0000000..b1582c6 Binary files /dev/null and b/app/assets/images/file_types/mpg.png differ diff --git a/app/assets/images/file_types/nmbtemplate.png b/app/assets/images/file_types/nmbtemplate.png new file mode 100644 index 0000000..3daa184 Binary files /dev/null and b/app/assets/images/file_types/nmbtemplate.png differ diff --git a/app/assets/images/file_types/numbers.png b/app/assets/images/file_types/numbers.png new file mode 100644 index 0000000..d3d4332 Binary files /dev/null and b/app/assets/images/file_types/numbers.png differ diff --git a/app/assets/images/file_types/odf.png b/app/assets/images/file_types/odf.png new file mode 100755 index 0000000..4739952 Binary files /dev/null and b/app/assets/images/file_types/odf.png differ diff --git a/app/assets/images/file_types/ods.png b/app/assets/images/file_types/ods.png new file mode 100755 index 0000000..5f09b0c Binary files /dev/null and b/app/assets/images/file_types/ods.png differ diff --git a/app/assets/images/file_types/odt.png b/app/assets/images/file_types/odt.png new file mode 100755 index 0000000..607bae5 Binary files /dev/null and b/app/assets/images/file_types/odt.png differ diff --git a/app/assets/images/file_types/otp.png b/app/assets/images/file_types/otp.png new file mode 100755 index 0000000..655bc83 Binary files /dev/null and b/app/assets/images/file_types/otp.png differ diff --git a/app/assets/images/file_types/ots.png b/app/assets/images/file_types/ots.png new file mode 100755 index 0000000..c59ad95 Binary files /dev/null and b/app/assets/images/file_types/ots.png differ diff --git a/app/assets/images/file_types/ott.png b/app/assets/images/file_types/ott.png new file mode 100755 index 0000000..18dd9fa Binary files /dev/null and b/app/assets/images/file_types/ott.png differ diff --git a/app/assets/images/file_types/pages.png b/app/assets/images/file_types/pages.png new file mode 100644 index 0000000..1317892 Binary files /dev/null and b/app/assets/images/file_types/pages.png differ diff --git a/app/assets/images/file_types/pdf.png b/app/assets/images/file_types/pdf.png new file mode 100644 index 0000000..098355b Binary files /dev/null and b/app/assets/images/file_types/pdf.png differ diff --git a/app/assets/images/file_types/php.png b/app/assets/images/file_types/php.png new file mode 100755 index 0000000..144b543 Binary files /dev/null and b/app/assets/images/file_types/php.png differ diff --git a/app/assets/images/file_types/png.png b/app/assets/images/file_types/png.png new file mode 100644 index 0000000..b9876ba Binary files /dev/null and b/app/assets/images/file_types/png.png differ diff --git a/app/assets/images/file_types/psd.png b/app/assets/images/file_types/psd.png new file mode 100644 index 0000000..5ae881d Binary files /dev/null and b/app/assets/images/file_types/psd.png differ diff --git a/app/assets/images/file_types/sql.png b/app/assets/images/file_types/sql.png new file mode 100644 index 0000000..3f53116 Binary files /dev/null and b/app/assets/images/file_types/sql.png differ diff --git a/app/assets/images/file_types/tar.gz.png b/app/assets/images/file_types/tar.gz.png new file mode 100644 index 0000000..d9deafa Binary files /dev/null and b/app/assets/images/file_types/tar.gz.png differ diff --git a/app/assets/images/file_types/tar.png b/app/assets/images/file_types/tar.png new file mode 100644 index 0000000..d9deafa Binary files /dev/null and b/app/assets/images/file_types/tar.png differ diff --git a/app/assets/images/file_types/template.png b/app/assets/images/file_types/template.png new file mode 100644 index 0000000..e34f334 Binary files /dev/null and b/app/assets/images/file_types/template.png differ diff --git a/app/assets/images/file_types/tiff.png b/app/assets/images/file_types/tiff.png new file mode 100644 index 0000000..f84bfcd Binary files /dev/null and b/app/assets/images/file_types/tiff.png differ diff --git a/app/assets/images/file_types/txt.png b/app/assets/images/file_types/txt.png new file mode 100644 index 0000000..98058ea Binary files /dev/null and b/app/assets/images/file_types/txt.png differ diff --git a/app/assets/images/file_types/zip.png b/app/assets/images/file_types/zip.png new file mode 100644 index 0000000..d9deafa Binary files /dev/null and b/app/assets/images/file_types/zip.png differ diff --git a/app/assets/images/fond.jpg b/app/assets/images/fond.jpg new file mode 100644 index 0000000..142b5ea Binary files /dev/null and b/app/assets/images/fond.jpg differ diff --git a/app/assets/images/front/cc-licenses-terms.png b/app/assets/images/front/cc-licenses-terms.png new file mode 100644 index 0000000..072f8cd Binary files /dev/null and b/app/assets/images/front/cc-licenses-terms.png differ diff --git a/app/assets/images/front/default_avatar.jpg b/app/assets/images/front/default_avatar.jpg new file mode 100644 index 0000000..c177b99 Binary files /dev/null and b/app/assets/images/front/default_avatar.jpg differ diff --git a/app/assets/images/front/facebook.png b/app/assets/images/front/facebook.png new file mode 100755 index 0000000..05279fd Binary files /dev/null and b/app/assets/images/front/facebook.png differ diff --git a/app/assets/images/front/facebook_active.png b/app/assets/images/front/facebook_active.png new file mode 100644 index 0000000..1e38d9c Binary files /dev/null and b/app/assets/images/front/facebook_active.png differ diff --git a/app/assets/images/front/facebook_bw.png b/app/assets/images/front/facebook_bw.png new file mode 100755 index 0000000..11df6cb Binary files /dev/null and b/app/assets/images/front/facebook_bw.png differ diff --git a/app/assets/images/front/facebook_dark.png b/app/assets/images/front/facebook_dark.png new file mode 100644 index 0000000..800136d Binary files /dev/null and b/app/assets/images/front/facebook_dark.png differ diff --git a/app/assets/images/front/fond.jpg b/app/assets/images/front/fond.jpg new file mode 100644 index 0000000..23856bc Binary files /dev/null and b/app/assets/images/front/fond.jpg differ diff --git a/app/assets/images/front/in_active.png b/app/assets/images/front/in_active.png new file mode 100644 index 0000000..657aa62 Binary files /dev/null and b/app/assets/images/front/in_active.png differ diff --git a/app/assets/images/front/in_dark.png b/app/assets/images/front/in_dark.png new file mode 100644 index 0000000..2ad4f5b Binary files /dev/null and b/app/assets/images/front/in_dark.png differ diff --git a/app/assets/images/front/linkedin.png b/app/assets/images/front/linkedin.png new file mode 100755 index 0000000..f5b369c Binary files /dev/null and b/app/assets/images/front/linkedin.png differ diff --git a/app/assets/images/front/linkedin_bw.png b/app/assets/images/front/linkedin_bw.png new file mode 100755 index 0000000..fb9bd2c Binary files /dev/null and b/app/assets/images/front/linkedin_bw.png differ diff --git a/app/assets/images/front/logo copie.png b/app/assets/images/front/logo copie.png new file mode 100644 index 0000000..cf0b428 Binary files /dev/null and b/app/assets/images/front/logo copie.png differ diff --git a/app/assets/images/front/logo.png b/app/assets/images/front/logo.png new file mode 100644 index 0000000..9d8b017 Binary files /dev/null and b/app/assets/images/front/logo.png differ diff --git a/app/assets/images/front/nicolasbally.jpg b/app/assets/images/front/nicolasbally.jpg new file mode 100644 index 0000000..8ce541e Binary files /dev/null and b/app/assets/images/front/nicolasbally.jpg differ diff --git a/app/assets/images/front/stumbleupon_active.png b/app/assets/images/front/stumbleupon_active.png new file mode 100644 index 0000000..4003d21 Binary files /dev/null and b/app/assets/images/front/stumbleupon_active.png differ diff --git a/app/assets/images/front/stumbleupon_dark.png b/app/assets/images/front/stumbleupon_dark.png new file mode 100644 index 0000000..a6b3021 Binary files /dev/null and b/app/assets/images/front/stumbleupon_dark.png differ diff --git a/app/assets/images/front/top.png b/app/assets/images/front/top.png new file mode 100644 index 0000000..4299088 Binary files /dev/null and b/app/assets/images/front/top.png differ diff --git a/app/assets/images/front/tumblr_active.png b/app/assets/images/front/tumblr_active.png new file mode 100644 index 0000000..33d9caa Binary files /dev/null and b/app/assets/images/front/tumblr_active.png differ diff --git a/app/assets/images/front/tumblr_dark.png b/app/assets/images/front/tumblr_dark.png new file mode 100644 index 0000000..1380063 Binary files /dev/null and b/app/assets/images/front/tumblr_dark.png differ diff --git a/app/assets/images/front/twitter_active.png b/app/assets/images/front/twitter_active.png new file mode 100644 index 0000000..a04904e Binary files /dev/null and b/app/assets/images/front/twitter_active.png differ diff --git a/app/assets/images/front/twitter_bw.png b/app/assets/images/front/twitter_bw.png new file mode 100755 index 0000000..9b7bf62 Binary files /dev/null and b/app/assets/images/front/twitter_bw.png differ diff --git a/app/assets/images/front/twitter_dark.png b/app/assets/images/front/twitter_dark.png new file mode 100644 index 0000000..4a25b32 Binary files /dev/null and b/app/assets/images/front/twitter_dark.png differ diff --git a/app/assets/images/front/viadeo.png b/app/assets/images/front/viadeo.png new file mode 100755 index 0000000..d1e84b6 Binary files /dev/null and b/app/assets/images/front/viadeo.png differ diff --git a/app/assets/images/front/viadeo_active.png b/app/assets/images/front/viadeo_active.png new file mode 100644 index 0000000..6e84e90 Binary files /dev/null and b/app/assets/images/front/viadeo_active.png differ diff --git a/app/assets/images/front/viadeo_dark.png b/app/assets/images/front/viadeo_dark.png new file mode 100644 index 0000000..e22c1e3 Binary files /dev/null and b/app/assets/images/front/viadeo_dark.png differ diff --git a/app/assets/images/front/web.jpg b/app/assets/images/front/web.jpg new file mode 100644 index 0000000..5d46b05 Binary files /dev/null and b/app/assets/images/front/web.jpg differ diff --git a/app/assets/images/nb.png b/app/assets/images/nb.png new file mode 100644 index 0000000..48cdbd6 Binary files /dev/null and b/app/assets/images/nb.png differ diff --git a/app/assets/images/vendor/select2-spinner.gif b/app/assets/images/vendor/select2-spinner.gif new file mode 100755 index 0000000..5b33f7e Binary files /dev/null and b/app/assets/images/vendor/select2-spinner.gif differ diff --git a/app/assets/images/vendor/select2.png b/app/assets/images/vendor/select2.png new file mode 100755 index 0000000..1d804ff Binary files /dev/null and b/app/assets/images/vendor/select2.png differ diff --git a/app/assets/images/vendor/select2x2.png b/app/assets/images/vendor/select2x2.png new file mode 100755 index 0000000..4bdd5c9 Binary files /dev/null and b/app/assets/images/vendor/select2x2.png differ diff --git a/app/assets/javascripts/Chart.js b/app/assets/javascripts/Chart.js new file mode 100755 index 0000000..c264262 --- /dev/null +++ b/app/assets/javascripts/Chart.js @@ -0,0 +1,3477 @@ +/*! + * Chart.js + * http://chartjs.org/ + * Version: 1.0.2 + * + * Copyright 2015 Nick Downie + * Released under the MIT license + * https://github.com/nnnick/Chart.js/blob/master/LICENSE.md + */ + + +(function(){ + + "use strict"; + + //Declare root variable - window in the browser, global on the server + var root = this, + previous = root.Chart; + + //Occupy the global variable of Chart, and create a simple base class + var Chart = function(context){ + var chart = this; + this.canvas = context.canvas; + + this.ctx = context; + + //Variables global to the chart + var computeDimension = function(element,dimension) + { + if (element['offset'+dimension]) + { + return element['offset'+dimension]; + } + else + { + return document.defaultView.getComputedStyle(element).getPropertyValue(dimension); + } + } + + var width = this.width = computeDimension(context.canvas,'Width'); + var height = this.height = computeDimension(context.canvas,'Height'); + + // Firefox requires this to work correctly + context.canvas.width = width; + context.canvas.height = height; + + var width = this.width = context.canvas.width; + var height = this.height = context.canvas.height; + this.aspectRatio = this.width / this.height; + //High pixel density displays - multiply the size of the canvas height/width by the device pixel ratio, then scale. + helpers.retinaScale(this); + + return this; + }; + //Globally expose the defaults to allow for user updating/changing + Chart.defaults = { + global: { + // Boolean - Whether to animate the chart + animation: true, + + // Number - Number of animation steps + animationSteps: 60, + + // String - Animation easing effect + animationEasing: "easeOutQuart", + + // Boolean - If we should show the scale at all + showScale: true, + + // Boolean - If we want to override with a hard coded scale + scaleOverride: false, + + // ** Required if scaleOverride is true ** + // Number - The number of steps in a hard coded scale + scaleSteps: null, + // Number - The value jump in the hard coded scale + scaleStepWidth: null, + // Number - The scale starting value + scaleStartValue: null, + + // String - Colour of the scale line + scaleLineColor: "rgba(0,0,0,.1)", + + // Number - Pixel width of the scale line + scaleLineWidth: 1, + + // Boolean - Whether to show labels on the scale + scaleShowLabels: true, + + // Interpolated JS string - can access value + scaleLabel: "<%=value%>", + + // Boolean - Whether the scale should stick to integers, and not show any floats even if drawing space is there + scaleIntegersOnly: true, + + // Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value + scaleBeginAtZero: false, + + // String - Scale label font declaration for the scale label + scaleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + + // Number - Scale label font size in pixels + scaleFontSize: 12, + + // String - Scale label font weight style + scaleFontStyle: "normal", + + // String - Scale label font colour + scaleFontColor: "#666", + + // Boolean - whether or not the chart should be responsive and resize when the browser does. + responsive: false, + + // Boolean - whether to maintain the starting aspect ratio or not when responsive, if set to false, will take up entire container + maintainAspectRatio: true, + + // Boolean - Determines whether to draw tooltips on the canvas or not - attaches events to touchmove & mousemove + showTooltips: true, + + // Boolean - Determines whether to draw built-in tooltip or call custom tooltip function + customTooltips: false, + + // Array - Array of string names to attach tooltip events + tooltipEvents: ["mousemove", "touchstart", "touchmove", "mouseout"], + + // String - Tooltip background colour + tooltipFillColor: "rgba(0,0,0,0.8)", + + // String - Tooltip label font declaration for the scale label + tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + + // Number - Tooltip label font size in pixels + tooltipFontSize: 14, + + // String - Tooltip font weight style + tooltipFontStyle: "normal", + + // String - Tooltip label font colour + tooltipFontColor: "#fff", + + // String - Tooltip title font declaration for the scale label + tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif", + + // Number - Tooltip title font size in pixels + tooltipTitleFontSize: 14, + + // String - Tooltip title font weight style + tooltipTitleFontStyle: "bold", + + // String - Tooltip title font colour + tooltipTitleFontColor: "#fff", + + // Number - pixel width of padding around tooltip text + tooltipYPadding: 6, + + // Number - pixel width of padding around tooltip text + tooltipXPadding: 6, + + // Number - Size of the caret on the tooltip + tooltipCaretSize: 8, + + // Number - Pixel radius of the tooltip border + tooltipCornerRadius: 6, + + // Number - Pixel offset from point x to tooltip edge + tooltipXOffset: 10, + + // String - Template string for single tooltips + tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>", + + // String - Template string for single tooltips + multiTooltipTemplate: "<%= value %>", + + // String - Colour behind the legend colour block + multiTooltipKeyBackground: '#fff', + + // Function - Will fire on animation progression. + onAnimationProgress: function(){}, + + // Function - Will fire on animation completion. + onAnimationComplete: function(){} + + } + }; + + //Create a dictionary of chart types, to allow for extension of existing types + Chart.types = {}; + + //Global Chart helpers object for utility methods and classes + var helpers = Chart.helpers = {}; + + //-- Basic js utility methods + var each = helpers.each = function(loopable,callback,self){ + var additionalArgs = Array.prototype.slice.call(arguments, 3); + // Check to see if null or undefined firstly. + if (loopable){ + if (loopable.length === +loopable.length){ + var i; + for (i=0; i= 0; i--) { + var currentItem = arrayToSearch[i]; + if (filterCallback(currentItem)){ + return currentItem; + } + } + }, + inherits = helpers.inherits = function(extensions){ + //Basic javascript inheritance based on the model created in Backbone.js + var parent = this; + var ChartElement = (extensions && extensions.hasOwnProperty("constructor")) ? extensions.constructor : function(){ return parent.apply(this, arguments); }; + + var Surrogate = function(){ this.constructor = ChartElement;}; + Surrogate.prototype = parent.prototype; + ChartElement.prototype = new Surrogate(); + + ChartElement.extend = inherits; + + if (extensions) extend(ChartElement.prototype, extensions); + + ChartElement.__super__ = parent.prototype; + + return ChartElement; + }, + noop = helpers.noop = function(){}, + uid = helpers.uid = (function(){ + var id=0; + return function(){ + return "chart-" + id++; + }; + })(), + warn = helpers.warn = function(str){ + //Method for warning of errors + if (window.console && typeof window.console.warn == "function") console.warn(str); + }, + amd = helpers.amd = (typeof define == 'function' && define.amd), + //-- Math methods + isNumber = helpers.isNumber = function(n){ + return !isNaN(parseFloat(n)) && isFinite(n); + }, + max = helpers.max = function(array){ + return Math.max.apply( Math, array ); + }, + min = helpers.min = function(array){ + return Math.min.apply( Math, array ); + }, + cap = helpers.cap = function(valueToCap,maxValue,minValue){ + if(isNumber(maxValue)) { + if( valueToCap > maxValue ) { + return maxValue; + } + } + else if(isNumber(minValue)){ + if ( valueToCap < minValue ){ + return minValue; + } + } + return valueToCap; + }, + getDecimalPlaces = helpers.getDecimalPlaces = function(num){ + if (num%1!==0 && isNumber(num)){ + return num.toString().split(".")[1].length; + } + else { + return 0; + } + }, + toRadians = helpers.radians = function(degrees){ + return degrees * (Math.PI/180); + }, + // Gets the angle from vertical upright to the point about a centre. + getAngleFromPoint = helpers.getAngleFromPoint = function(centrePoint, anglePoint){ + var distanceFromXCenter = anglePoint.x - centrePoint.x, + distanceFromYCenter = anglePoint.y - centrePoint.y, + radialDistanceFromCenter = Math.sqrt( distanceFromXCenter * distanceFromXCenter + distanceFromYCenter * distanceFromYCenter); + + + var angle = Math.PI * 2 + Math.atan2(distanceFromYCenter, distanceFromXCenter); + + //If the segment is in the top left quadrant, we need to add another rotation to the angle + if (distanceFromXCenter < 0 && distanceFromYCenter < 0){ + angle += Math.PI*2; + } + + return { + angle: angle, + distance: radialDistanceFromCenter + }; + }, + aliasPixel = helpers.aliasPixel = function(pixelWidth){ + return (pixelWidth % 2 === 0) ? 0 : 0.5; + }, + splineCurve = helpers.splineCurve = function(FirstPoint,MiddlePoint,AfterPoint,t){ + //Props to Rob Spencer at scaled innovation for his post on splining between points + //http://scaledinnovation.com/analytics/splines/aboutSplines.html + var d01=Math.sqrt(Math.pow(MiddlePoint.x-FirstPoint.x,2)+Math.pow(MiddlePoint.y-FirstPoint.y,2)), + d12=Math.sqrt(Math.pow(AfterPoint.x-MiddlePoint.x,2)+Math.pow(AfterPoint.y-MiddlePoint.y,2)), + fa=t*d01/(d01+d12),// scaling factor for triangle Ta + fb=t*d12/(d01+d12); + return { + inner : { + x : MiddlePoint.x-fa*(AfterPoint.x-FirstPoint.x), + y : MiddlePoint.y-fa*(AfterPoint.y-FirstPoint.y) + }, + outer : { + x: MiddlePoint.x+fb*(AfterPoint.x-FirstPoint.x), + y : MiddlePoint.y+fb*(AfterPoint.y-FirstPoint.y) + } + }; + }, + calculateOrderOfMagnitude = helpers.calculateOrderOfMagnitude = function(val){ + return Math.floor(Math.log(val) / Math.LN10); + }, + calculateScaleRange = helpers.calculateScaleRange = function(valuesArray, drawingSize, textSize, startFromZero, integersOnly){ + + //Set a minimum step of two - a point at the top of the graph, and a point at the base + var minSteps = 2, + maxSteps = Math.floor(drawingSize/(textSize * 1.5)), + skipFitting = (minSteps >= maxSteps); + + var maxValue = max(valuesArray), + minValue = min(valuesArray); + + // We need some degree of seperation here to calculate the scales if all the values are the same + // Adding/minusing 0.5 will give us a range of 1. + if (maxValue === minValue){ + maxValue += 0.5; + // So we don't end up with a graph with a negative start value if we've said always start from zero + if (minValue >= 0.5 && !startFromZero){ + minValue -= 0.5; + } + else{ + // Make up a whole number above the values + maxValue += 0.5; + } + } + + var valueRange = Math.abs(maxValue - minValue), + rangeOrderOfMagnitude = calculateOrderOfMagnitude(valueRange), + graphMax = Math.ceil(maxValue / (1 * Math.pow(10, rangeOrderOfMagnitude))) * Math.pow(10, rangeOrderOfMagnitude), + graphMin = (startFromZero) ? 0 : Math.floor(minValue / (1 * Math.pow(10, rangeOrderOfMagnitude))) * Math.pow(10, rangeOrderOfMagnitude), + graphRange = graphMax - graphMin, + stepValue = Math.pow(10, rangeOrderOfMagnitude), + numberOfSteps = Math.round(graphRange / stepValue); + + //If we have more space on the graph we'll use it to give more definition to the data + while((numberOfSteps > maxSteps || (numberOfSteps * 2) < maxSteps) && !skipFitting) { + if(numberOfSteps > maxSteps){ + stepValue *=2; + numberOfSteps = Math.round(graphRange/stepValue); + // Don't ever deal with a decimal number of steps - cancel fitting and just use the minimum number of steps. + if (numberOfSteps % 1 !== 0){ + skipFitting = true; + } + } + //We can fit in double the amount of scale points on the scale + else{ + //If user has declared ints only, and the step value isn't a decimal + if (integersOnly && rangeOrderOfMagnitude >= 0){ + //If the user has said integers only, we need to check that making the scale more granular wouldn't make it a float + if(stepValue/2 % 1 === 0){ + stepValue /=2; + numberOfSteps = Math.round(graphRange/stepValue); + } + //If it would make it a float break out of the loop + else{ + break; + } + } + //If the scale doesn't have to be an int, make the scale more granular anyway. + else{ + stepValue /=2; + numberOfSteps = Math.round(graphRange/stepValue); + } + + } + } + + if (skipFitting){ + numberOfSteps = minSteps; + stepValue = graphRange / numberOfSteps; + } + + return { + steps : numberOfSteps, + stepValue : stepValue, + min : graphMin, + max : graphMin + (numberOfSteps * stepValue) + }; + + }, + /* jshint ignore:start */ + // Blows up jshint errors based on the new Function constructor + //Templating methods + //Javascript micro templating by John Resig - source at http://ejohn.org/blog/javascript-micro-templating/ + template = helpers.template = function(templateString, valuesObject){ + + // If templateString is function rather than string-template - call the function for valuesObject + + if(templateString instanceof Function){ + return templateString(valuesObject); + } + + var cache = {}; + function tmpl(str, data){ + // Figure out if we're getting a template, or if we need to + // load the template - and be sure to cache the result. + var fn = !/\W/.test(str) ? + cache[str] = cache[str] : + + // Generate a reusable function that will serve as a template + // generator (and which will be cached). + new Function("obj", + "var p=[],print=function(){p.push.apply(p,arguments);};" + + + // Introduce the data as local variables using with(){} + "with(obj){p.push('" + + + // Convert the template into pure JavaScript + str + .replace(/[\r\t\n]/g, " ") + .split("<%").join("\t") + .replace(/((^|%>)[^\t]*)'/g, "$1\r") + .replace(/\t=(.*?)%>/g, "',$1,'") + .split("\t").join("');") + .split("%>").join("p.push('") + .split("\r").join("\\'") + + "');}return p.join('');" + ); + + // Provide some basic currying to the user + return data ? fn( data ) : fn; + } + return tmpl(templateString,valuesObject); + }, + /* jshint ignore:end */ + generateLabels = helpers.generateLabels = function(templateString,numberOfSteps,graphMin,stepValue){ + var labelsArray = new Array(numberOfSteps); + if (labelTemplateString){ + each(labelsArray,function(val,index){ + labelsArray[index] = template(templateString,{value: (graphMin + (stepValue*(index+1)))}); + }); + } + return labelsArray; + }, + //--Animation methods + //Easing functions adapted from Robert Penner's easing equations + //http://www.robertpenner.com/easing/ + easingEffects = helpers.easingEffects = { + linear: function (t) { + return t; + }, + easeInQuad: function (t) { + return t * t; + }, + easeOutQuad: function (t) { + return -1 * t * (t - 2); + }, + easeInOutQuad: function (t) { + if ((t /= 1 / 2) < 1) return 1 / 2 * t * t; + return -1 / 2 * ((--t) * (t - 2) - 1); + }, + easeInCubic: function (t) { + return t * t * t; + }, + easeOutCubic: function (t) { + return 1 * ((t = t / 1 - 1) * t * t + 1); + }, + easeInOutCubic: function (t) { + if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t; + return 1 / 2 * ((t -= 2) * t * t + 2); + }, + easeInQuart: function (t) { + return t * t * t * t; + }, + easeOutQuart: function (t) { + return -1 * ((t = t / 1 - 1) * t * t * t - 1); + }, + easeInOutQuart: function (t) { + if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t * t; + return -1 / 2 * ((t -= 2) * t * t * t - 2); + }, + easeInQuint: function (t) { + return 1 * (t /= 1) * t * t * t * t; + }, + easeOutQuint: function (t) { + return 1 * ((t = t / 1 - 1) * t * t * t * t + 1); + }, + easeInOutQuint: function (t) { + if ((t /= 1 / 2) < 1) return 1 / 2 * t * t * t * t * t; + return 1 / 2 * ((t -= 2) * t * t * t * t + 2); + }, + easeInSine: function (t) { + return -1 * Math.cos(t / 1 * (Math.PI / 2)) + 1; + }, + easeOutSine: function (t) { + return 1 * Math.sin(t / 1 * (Math.PI / 2)); + }, + easeInOutSine: function (t) { + return -1 / 2 * (Math.cos(Math.PI * t / 1) - 1); + }, + easeInExpo: function (t) { + return (t === 0) ? 1 : 1 * Math.pow(2, 10 * (t / 1 - 1)); + }, + easeOutExpo: function (t) { + return (t === 1) ? 1 : 1 * (-Math.pow(2, -10 * t / 1) + 1); + }, + easeInOutExpo: function (t) { + if (t === 0) return 0; + if (t === 1) return 1; + if ((t /= 1 / 2) < 1) return 1 / 2 * Math.pow(2, 10 * (t - 1)); + return 1 / 2 * (-Math.pow(2, -10 * --t) + 2); + }, + easeInCirc: function (t) { + if (t >= 1) return t; + return -1 * (Math.sqrt(1 - (t /= 1) * t) - 1); + }, + easeOutCirc: function (t) { + return 1 * Math.sqrt(1 - (t = t / 1 - 1) * t); + }, + easeInOutCirc: function (t) { + if ((t /= 1 / 2) < 1) return -1 / 2 * (Math.sqrt(1 - t * t) - 1); + return 1 / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1); + }, + easeInElastic: function (t) { + var s = 1.70158; + var p = 0; + var a = 1; + if (t === 0) return 0; + if ((t /= 1) == 1) return 1; + if (!p) p = 1 * 0.3; + if (a < Math.abs(1)) { + a = 1; + s = p / 4; + } else s = p / (2 * Math.PI) * Math.asin(1 / a); + return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p)); + }, + easeOutElastic: function (t) { + var s = 1.70158; + var p = 0; + var a = 1; + if (t === 0) return 0; + if ((t /= 1) == 1) return 1; + if (!p) p = 1 * 0.3; + if (a < Math.abs(1)) { + a = 1; + s = p / 4; + } else s = p / (2 * Math.PI) * Math.asin(1 / a); + return a * Math.pow(2, -10 * t) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) + 1; + }, + easeInOutElastic: function (t) { + var s = 1.70158; + var p = 0; + var a = 1; + if (t === 0) return 0; + if ((t /= 1 / 2) == 2) return 1; + if (!p) p = 1 * (0.3 * 1.5); + if (a < Math.abs(1)) { + a = 1; + s = p / 4; + } else s = p / (2 * Math.PI) * Math.asin(1 / a); + if (t < 1) return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p)); + return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * 1 - s) * (2 * Math.PI) / p) * 0.5 + 1; + }, + easeInBack: function (t) { + var s = 1.70158; + return 1 * (t /= 1) * t * ((s + 1) * t - s); + }, + easeOutBack: function (t) { + var s = 1.70158; + return 1 * ((t = t / 1 - 1) * t * ((s + 1) * t + s) + 1); + }, + easeInOutBack: function (t) { + var s = 1.70158; + if ((t /= 1 / 2) < 1) return 1 / 2 * (t * t * (((s *= (1.525)) + 1) * t - s)); + return 1 / 2 * ((t -= 2) * t * (((s *= (1.525)) + 1) * t + s) + 2); + }, + easeInBounce: function (t) { + return 1 - easingEffects.easeOutBounce(1 - t); + }, + easeOutBounce: function (t) { + if ((t /= 1) < (1 / 2.75)) { + return 1 * (7.5625 * t * t); + } else if (t < (2 / 2.75)) { + return 1 * (7.5625 * (t -= (1.5 / 2.75)) * t + 0.75); + } else if (t < (2.5 / 2.75)) { + return 1 * (7.5625 * (t -= (2.25 / 2.75)) * t + 0.9375); + } else { + return 1 * (7.5625 * (t -= (2.625 / 2.75)) * t + 0.984375); + } + }, + easeInOutBounce: function (t) { + if (t < 1 / 2) return easingEffects.easeInBounce(t * 2) * 0.5; + return easingEffects.easeOutBounce(t * 2 - 1) * 0.5 + 1 * 0.5; + } + }, + //Request animation polyfill - http://www.paulirish.com/2011/requestanimationframe-for-smart-animating/ + requestAnimFrame = helpers.requestAnimFrame = (function(){ + return window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function(callback) { + return window.setTimeout(callback, 1000 / 60); + }; + })(), + cancelAnimFrame = helpers.cancelAnimFrame = (function(){ + return window.cancelAnimationFrame || + window.webkitCancelAnimationFrame || + window.mozCancelAnimationFrame || + window.oCancelAnimationFrame || + window.msCancelAnimationFrame || + function(callback) { + return window.clearTimeout(callback, 1000 / 60); + }; + })(), + animationLoop = helpers.animationLoop = function(callback,totalSteps,easingString,onProgress,onComplete,chartInstance){ + + var currentStep = 0, + easingFunction = easingEffects[easingString] || easingEffects.linear; + + var animationFrame = function(){ + currentStep++; + var stepDecimal = currentStep/totalSteps; + var easeDecimal = easingFunction(stepDecimal); + + callback.call(chartInstance,easeDecimal,stepDecimal, currentStep); + onProgress.call(chartInstance,easeDecimal,stepDecimal); + if (currentStep < totalSteps){ + chartInstance.animationFrame = requestAnimFrame(animationFrame); + } else{ + onComplete.apply(chartInstance); + } + }; + requestAnimFrame(animationFrame); + }, + //-- DOM methods + getRelativePosition = helpers.getRelativePosition = function(evt){ + var mouseX, mouseY; + var e = evt.originalEvent || evt, + canvas = evt.currentTarget || evt.srcElement, + boundingRect = canvas.getBoundingClientRect(); + + if (e.touches){ + mouseX = e.touches[0].clientX - boundingRect.left; + mouseY = e.touches[0].clientY - boundingRect.top; + + } + else{ + mouseX = e.clientX - boundingRect.left; + mouseY = e.clientY - boundingRect.top; + } + + return { + x : mouseX, + y : mouseY + }; + + }, + addEvent = helpers.addEvent = function(node,eventType,method){ + if (node.addEventListener){ + node.addEventListener(eventType,method); + } else if (node.attachEvent){ + node.attachEvent("on"+eventType, method); + } else { + node["on"+eventType] = method; + } + }, + removeEvent = helpers.removeEvent = function(node, eventType, handler){ + if (node.removeEventListener){ + node.removeEventListener(eventType, handler, false); + } else if (node.detachEvent){ + node.detachEvent("on"+eventType,handler); + } else{ + node["on" + eventType] = noop; + } + }, + bindEvents = helpers.bindEvents = function(chartInstance, arrayOfEvents, handler){ + // Create the events object if it's not already present + if (!chartInstance.events) chartInstance.events = {}; + + each(arrayOfEvents,function(eventName){ + chartInstance.events[eventName] = function(){ + handler.apply(chartInstance, arguments); + }; + addEvent(chartInstance.chart.canvas,eventName,chartInstance.events[eventName]); + }); + }, + unbindEvents = helpers.unbindEvents = function (chartInstance, arrayOfEvents) { + each(arrayOfEvents, function(handler,eventName){ + removeEvent(chartInstance.chart.canvas, eventName, handler); + }); + }, + getMaximumWidth = helpers.getMaximumWidth = function(domNode){ + var container = domNode.parentNode; + // TODO = check cross browser stuff with this. + return container.clientWidth; + }, + getMaximumHeight = helpers.getMaximumHeight = function(domNode){ + var container = domNode.parentNode; + // TODO = check cross browser stuff with this. + return container.clientHeight; + }, + getMaximumSize = helpers.getMaximumSize = helpers.getMaximumWidth, // legacy support + retinaScale = helpers.retinaScale = function(chart){ + var ctx = chart.ctx, + width = chart.canvas.width, + height = chart.canvas.height; + + if (window.devicePixelRatio) { + ctx.canvas.style.width = width + "px"; + ctx.canvas.style.height = height + "px"; + ctx.canvas.height = height * window.devicePixelRatio; + ctx.canvas.width = width * window.devicePixelRatio; + ctx.scale(window.devicePixelRatio, window.devicePixelRatio); + } + }, + //-- Canvas methods + clear = helpers.clear = function(chart){ + chart.ctx.clearRect(0,0,chart.width,chart.height); + }, + fontString = helpers.fontString = function(pixelSize,fontStyle,fontFamily){ + return fontStyle + " " + pixelSize+"px " + fontFamily; + }, + longestText = helpers.longestText = function(ctx,font,arrayOfStrings){ + ctx.font = font; + var longest = 0; + each(arrayOfStrings,function(string){ + var textWidth = ctx.measureText(string).width; + longest = (textWidth > longest) ? textWidth : longest; + }); + return longest; + }, + drawRoundedRectangle = helpers.drawRoundedRectangle = function(ctx,x,y,width,height,radius){ + ctx.beginPath(); + ctx.moveTo(x + radius, y); + ctx.lineTo(x + width - radius, y); + ctx.quadraticCurveTo(x + width, y, x + width, y + radius); + ctx.lineTo(x + width, y + height - radius); + ctx.quadraticCurveTo(x + width, y + height, x + width - radius, y + height); + ctx.lineTo(x + radius, y + height); + ctx.quadraticCurveTo(x, y + height, x, y + height - radius); + ctx.lineTo(x, y + radius); + ctx.quadraticCurveTo(x, y, x + radius, y); + ctx.closePath(); + }; + + + //Store a reference to each instance - allowing us to globally resize chart instances on window resize. + //Destroy method on the chart will remove the instance of the chart from this reference. + Chart.instances = {}; + + Chart.Type = function(data,options,chart){ + this.options = options; + this.chart = chart; + this.id = uid(); + //Add the chart instance to the global namespace + Chart.instances[this.id] = this; + + // Initialize is always called when a chart type is created + // By default it is a no op, but it should be extended + if (options.responsive){ + this.resize(); + } + this.initialize.call(this,data); + }; + + //Core methods that'll be a part of every chart type + extend(Chart.Type.prototype,{ + initialize : function(){return this;}, + clear : function(){ + clear(this.chart); + return this; + }, + stop : function(){ + // Stops any current animation loop occuring + cancelAnimFrame(this.animationFrame); + return this; + }, + resize : function(callback){ + this.stop(); + var canvas = this.chart.canvas, + newWidth = getMaximumWidth(this.chart.canvas), + newHeight = this.options.maintainAspectRatio ? newWidth / this.chart.aspectRatio : getMaximumHeight(this.chart.canvas); + + canvas.width = this.chart.width = newWidth; + canvas.height = this.chart.height = newHeight; + + retinaScale(this.chart); + + if (typeof callback === "function"){ + callback.apply(this, Array.prototype.slice.call(arguments, 1)); + } + return this; + }, + reflow : noop, + render : function(reflow){ + if (reflow){ + this.reflow(); + } + if (this.options.animation && !reflow){ + helpers.animationLoop( + this.draw, + this.options.animationSteps, + this.options.animationEasing, + this.options.onAnimationProgress, + this.options.onAnimationComplete, + this + ); + } + else{ + this.draw(); + this.options.onAnimationComplete.call(this); + } + return this; + }, + generateLegend : function(){ + return template(this.options.legendTemplate,this); + }, + destroy : function(){ + this.clear(); + unbindEvents(this, this.events); + var canvas = this.chart.canvas; + + // Reset canvas height/width attributes starts a fresh with the canvas context + canvas.width = this.chart.width; + canvas.height = this.chart.height; + + // < IE9 doesn't support removeProperty + if (canvas.style.removeProperty) { + canvas.style.removeProperty('width'); + canvas.style.removeProperty('height'); + } else { + canvas.style.removeAttribute('width'); + canvas.style.removeAttribute('height'); + } + + delete Chart.instances[this.id]; + }, + showTooltip : function(ChartElements, forceRedraw){ + // Only redraw the chart if we've actually changed what we're hovering on. + if (typeof this.activeElements === 'undefined') this.activeElements = []; + + var isChanged = (function(Elements){ + var changed = false; + + if (Elements.length !== this.activeElements.length){ + changed = true; + return changed; + } + + each(Elements, function(element, index){ + if (element !== this.activeElements[index]){ + changed = true; + } + }, this); + return changed; + }).call(this, ChartElements); + + if (!isChanged && !forceRedraw){ + return; + } + else{ + this.activeElements = ChartElements; + } + this.draw(); + if(this.options.customTooltips){ + this.options.customTooltips(false); + } + if (ChartElements.length > 0){ + // If we have multiple datasets, show a MultiTooltip for all of the data points at that index + if (this.datasets && this.datasets.length > 1) { + var dataArray, + dataIndex; + + for (var i = this.datasets.length - 1; i >= 0; i--) { + dataArray = this.datasets[i].points || this.datasets[i].bars || this.datasets[i].segments; + dataIndex = indexOf(dataArray, ChartElements[0]); + if (dataIndex !== -1){ + break; + } + } + var tooltipLabels = [], + tooltipColors = [], + medianPosition = (function(index) { + + // Get all the points at that particular index + var Elements = [], + dataCollection, + xPositions = [], + yPositions = [], + xMax, + yMax, + xMin, + yMin; + helpers.each(this.datasets, function(dataset){ + dataCollection = dataset.points || dataset.bars || dataset.segments; + if (dataCollection[dataIndex] && dataCollection[dataIndex].hasValue()){ + Elements.push(dataCollection[dataIndex]); + } + }); + + helpers.each(Elements, function(element) { + xPositions.push(element.x); + yPositions.push(element.y); + + + //Include any colour information about the element + tooltipLabels.push(helpers.template(this.options.multiTooltipTemplate, element)); + tooltipColors.push({ + fill: element._saved.fillColor || element.fillColor, + stroke: element._saved.strokeColor || element.strokeColor + }); + + }, this); + + yMin = min(yPositions); + yMax = max(yPositions); + + xMin = min(xPositions); + xMax = max(xPositions); + + return { + x: (xMin > this.chart.width/2) ? xMin : xMax, + y: (yMin + yMax)/2 + }; + }).call(this, dataIndex); + + new Chart.MultiTooltip({ + x: medianPosition.x, + y: medianPosition.y, + xPadding: this.options.tooltipXPadding, + yPadding: this.options.tooltipYPadding, + xOffset: this.options.tooltipXOffset, + fillColor: this.options.tooltipFillColor, + textColor: this.options.tooltipFontColor, + fontFamily: this.options.tooltipFontFamily, + fontStyle: this.options.tooltipFontStyle, + fontSize: this.options.tooltipFontSize, + titleTextColor: this.options.tooltipTitleFontColor, + titleFontFamily: this.options.tooltipTitleFontFamily, + titleFontStyle: this.options.tooltipTitleFontStyle, + titleFontSize: this.options.tooltipTitleFontSize, + cornerRadius: this.options.tooltipCornerRadius, + labels: tooltipLabels, + legendColors: tooltipColors, + legendColorBackground : this.options.multiTooltipKeyBackground, + title: ChartElements[0].label, + chart: this.chart, + ctx: this.chart.ctx, + custom: this.options.customTooltips + }).draw(); + + } else { + each(ChartElements, function(Element) { + var tooltipPosition = Element.tooltipPosition(); + new Chart.Tooltip({ + x: Math.round(tooltipPosition.x), + y: Math.round(tooltipPosition.y), + xPadding: this.options.tooltipXPadding, + yPadding: this.options.tooltipYPadding, + fillColor: this.options.tooltipFillColor, + textColor: this.options.tooltipFontColor, + fontFamily: this.options.tooltipFontFamily, + fontStyle: this.options.tooltipFontStyle, + fontSize: this.options.tooltipFontSize, + caretHeight: this.options.tooltipCaretSize, + cornerRadius: this.options.tooltipCornerRadius, + text: template(this.options.tooltipTemplate, Element), + chart: this.chart, + custom: this.options.customTooltips + }).draw(); + }, this); + } + } + return this; + }, + toBase64Image : function(){ + return this.chart.canvas.toDataURL.apply(this.chart.canvas, arguments); + } + }); + + Chart.Type.extend = function(extensions){ + + var parent = this; + + var ChartType = function(){ + return parent.apply(this,arguments); + }; + + //Copy the prototype object of the this class + ChartType.prototype = clone(parent.prototype); + //Now overwrite some of the properties in the base class with the new extensions + extend(ChartType.prototype, extensions); + + ChartType.extend = Chart.Type.extend; + + if (extensions.name || parent.prototype.name){ + + var chartName = extensions.name || parent.prototype.name; + //Assign any potential default values of the new chart type + + //If none are defined, we'll use a clone of the chart type this is being extended from. + //I.e. if we extend a line chart, we'll use the defaults from the line chart if our new chart + //doesn't define some defaults of their own. + + var baseDefaults = (Chart.defaults[parent.prototype.name]) ? clone(Chart.defaults[parent.prototype.name]) : {}; + + Chart.defaults[chartName] = extend(baseDefaults,extensions.defaults); + + Chart.types[chartName] = ChartType; + + //Register this new chart type in the Chart prototype + Chart.prototype[chartName] = function(data,options){ + var config = merge(Chart.defaults.global, Chart.defaults[chartName], options || {}); + return new ChartType(data,config,this); + }; + } else{ + warn("Name not provided for this chart, so it hasn't been registered"); + } + return parent; + }; + + Chart.Element = function(configuration){ + extend(this,configuration); + this.initialize.apply(this,arguments); + this.save(); + }; + extend(Chart.Element.prototype,{ + initialize : function(){}, + restore : function(props){ + if (!props){ + extend(this,this._saved); + } else { + each(props,function(key){ + this[key] = this._saved[key]; + },this); + } + return this; + }, + save : function(){ + this._saved = clone(this); + delete this._saved._saved; + return this; + }, + update : function(newProps){ + each(newProps,function(value,key){ + this._saved[key] = this[key]; + this[key] = value; + },this); + return this; + }, + transition : function(props,ease){ + each(props,function(value,key){ + this[key] = ((value - this._saved[key]) * ease) + this._saved[key]; + },this); + return this; + }, + tooltipPosition : function(){ + return { + x : this.x, + y : this.y + }; + }, + hasValue: function(){ + return isNumber(this.value); + } + }); + + Chart.Element.extend = inherits; + + + Chart.Point = Chart.Element.extend({ + display: true, + inRange: function(chartX,chartY){ + var hitDetectionRange = this.hitDetectionRadius + this.radius; + return ((Math.pow(chartX-this.x, 2)+Math.pow(chartY-this.y, 2)) < Math.pow(hitDetectionRange,2)); + }, + draw : function(){ + if (this.display){ + var ctx = this.ctx; + ctx.beginPath(); + + ctx.arc(this.x, this.y, this.radius, 0, Math.PI*2); + ctx.closePath(); + + ctx.strokeStyle = this.strokeColor; + ctx.lineWidth = this.strokeWidth; + + ctx.fillStyle = this.fillColor; + + ctx.fill(); + ctx.stroke(); + } + + + //Quick debug for bezier curve splining + //Highlights control points and the line between them. + //Handy for dev - stripped in the min version. + + // ctx.save(); + // ctx.fillStyle = "black"; + // ctx.strokeStyle = "black" + // ctx.beginPath(); + // ctx.arc(this.controlPoints.inner.x,this.controlPoints.inner.y, 2, 0, Math.PI*2); + // ctx.fill(); + + // ctx.beginPath(); + // ctx.arc(this.controlPoints.outer.x,this.controlPoints.outer.y, 2, 0, Math.PI*2); + // ctx.fill(); + + // ctx.moveTo(this.controlPoints.inner.x,this.controlPoints.inner.y); + // ctx.lineTo(this.x, this.y); + // ctx.lineTo(this.controlPoints.outer.x,this.controlPoints.outer.y); + // ctx.stroke(); + + // ctx.restore(); + + + + } + }); + + Chart.Arc = Chart.Element.extend({ + inRange : function(chartX,chartY){ + + var pointRelativePosition = helpers.getAngleFromPoint(this, { + x: chartX, + y: chartY + }); + + //Check if within the range of the open/close angle + var betweenAngles = (pointRelativePosition.angle >= this.startAngle && pointRelativePosition.angle <= this.endAngle), + withinRadius = (pointRelativePosition.distance >= this.innerRadius && pointRelativePosition.distance <= this.outerRadius); + + return (betweenAngles && withinRadius); + //Ensure within the outside of the arc centre, but inside arc outer + }, + tooltipPosition : function(){ + var centreAngle = this.startAngle + ((this.endAngle - this.startAngle) / 2), + rangeFromCentre = (this.outerRadius - this.innerRadius) / 2 + this.innerRadius; + return { + x : this.x + (Math.cos(centreAngle) * rangeFromCentre), + y : this.y + (Math.sin(centreAngle) * rangeFromCentre) + }; + }, + draw : function(animationPercent){ + + var easingDecimal = animationPercent || 1; + + var ctx = this.ctx; + + ctx.beginPath(); + + ctx.arc(this.x, this.y, this.outerRadius, this.startAngle, this.endAngle); + + ctx.arc(this.x, this.y, this.innerRadius, this.endAngle, this.startAngle, true); + + ctx.closePath(); + ctx.strokeStyle = this.strokeColor; + ctx.lineWidth = this.strokeWidth; + + ctx.fillStyle = this.fillColor; + + ctx.fill(); + ctx.lineJoin = 'bevel'; + + if (this.showStroke){ + ctx.stroke(); + } + } + }); + + Chart.Rectangle = Chart.Element.extend({ + draw : function(){ + var ctx = this.ctx, + halfWidth = this.width/2, + leftX = this.x - halfWidth, + rightX = this.x + halfWidth, + top = this.base - (this.base - this.y), + halfStroke = this.strokeWidth / 2; + + // Canvas doesn't allow us to stroke inside the width so we can + // adjust the sizes to fit if we're setting a stroke on the line + if (this.showStroke){ + leftX += halfStroke; + rightX -= halfStroke; + top += halfStroke; + } + + ctx.beginPath(); + + ctx.fillStyle = this.fillColor; + ctx.strokeStyle = this.strokeColor; + ctx.lineWidth = this.strokeWidth; + + // It'd be nice to keep this class totally generic to any rectangle + // and simply specify which border to miss out. + ctx.moveTo(leftX, this.base); + ctx.lineTo(leftX, top); + ctx.lineTo(rightX, top); + ctx.lineTo(rightX, this.base); + ctx.fill(); + if (this.showStroke){ + ctx.stroke(); + } + }, + height : function(){ + return this.base - this.y; + }, + inRange : function(chartX,chartY){ + return (chartX >= this.x - this.width/2 && chartX <= this.x + this.width/2) && (chartY >= this.y && chartY <= this.base); + } + }); + + Chart.Tooltip = Chart.Element.extend({ + draw : function(){ + + var ctx = this.chart.ctx; + + ctx.font = fontString(this.fontSize,this.fontStyle,this.fontFamily); + + this.xAlign = "center"; + this.yAlign = "above"; + + //Distance between the actual element.y position and the start of the tooltip caret + var caretPadding = this.caretPadding = 2; + + var tooltipWidth = ctx.measureText(this.text).width + 2*this.xPadding, + tooltipRectHeight = this.fontSize + 2*this.yPadding, + tooltipHeight = tooltipRectHeight + this.caretHeight + caretPadding; + + if (this.x + tooltipWidth/2 >this.chart.width){ + this.xAlign = "left"; + } else if (this.x - tooltipWidth/2 < 0){ + this.xAlign = "right"; + } + + if (this.y - tooltipHeight < 0){ + this.yAlign = "below"; + } + + + var tooltipX = this.x - tooltipWidth/2, + tooltipY = this.y - tooltipHeight; + + ctx.fillStyle = this.fillColor; + + // Custom Tooltips + if(this.custom){ + this.custom(this); + } + else{ + switch(this.yAlign) + { + case "above": + //Draw a caret above the x/y + ctx.beginPath(); + ctx.moveTo(this.x,this.y - caretPadding); + ctx.lineTo(this.x + this.caretHeight, this.y - (caretPadding + this.caretHeight)); + ctx.lineTo(this.x - this.caretHeight, this.y - (caretPadding + this.caretHeight)); + ctx.closePath(); + ctx.fill(); + break; + case "below": + tooltipY = this.y + caretPadding + this.caretHeight; + //Draw a caret below the x/y + ctx.beginPath(); + ctx.moveTo(this.x, this.y + caretPadding); + ctx.lineTo(this.x + this.caretHeight, this.y + caretPadding + this.caretHeight); + ctx.lineTo(this.x - this.caretHeight, this.y + caretPadding + this.caretHeight); + ctx.closePath(); + ctx.fill(); + break; + } + + switch(this.xAlign) + { + case "left": + tooltipX = this.x - tooltipWidth + (this.cornerRadius + this.caretHeight); + break; + case "right": + tooltipX = this.x - (this.cornerRadius + this.caretHeight); + break; + } + + drawRoundedRectangle(ctx,tooltipX,tooltipY,tooltipWidth,tooltipRectHeight,this.cornerRadius); + + ctx.fill(); + + ctx.fillStyle = this.textColor; + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; + ctx.fillText(this.text, tooltipX + tooltipWidth/2, tooltipY + tooltipRectHeight/2); + } + } + }); + + Chart.MultiTooltip = Chart.Element.extend({ + initialize : function(){ + this.font = fontString(this.fontSize,this.fontStyle,this.fontFamily); + + this.titleFont = fontString(this.titleFontSize,this.titleFontStyle,this.titleFontFamily); + + this.height = (this.labels.length * this.fontSize) + ((this.labels.length-1) * (this.fontSize/2)) + (this.yPadding*2) + this.titleFontSize *1.5; + + this.ctx.font = this.titleFont; + + var titleWidth = this.ctx.measureText(this.title).width, + //Label has a legend square as well so account for this. + labelWidth = longestText(this.ctx,this.font,this.labels) + this.fontSize + 3, + longestTextWidth = max([labelWidth,titleWidth]); + + this.width = longestTextWidth + (this.xPadding*2); + + + var halfHeight = this.height/2; + + //Check to ensure the height will fit on the canvas + if (this.y - halfHeight < 0 ){ + this.y = halfHeight; + } else if (this.y + halfHeight > this.chart.height){ + this.y = this.chart.height - halfHeight; + } + + //Decide whether to align left or right based on position on canvas + if (this.x > this.chart.width/2){ + this.x -= this.xOffset + this.width; + } else { + this.x += this.xOffset; + } + + + }, + getLineHeight : function(index){ + var baseLineHeight = this.y - (this.height/2) + this.yPadding, + afterTitleIndex = index-1; + + //If the index is zero, we're getting the title + if (index === 0){ + return baseLineHeight + this.titleFontSize/2; + } else{ + return baseLineHeight + ((this.fontSize*1.5*afterTitleIndex) + this.fontSize/2) + this.titleFontSize * 1.5; + } + + }, + draw : function(){ + // Custom Tooltips + if(this.custom){ + this.custom(this); + } + else{ + drawRoundedRectangle(this.ctx,this.x,this.y - this.height/2,this.width,this.height,this.cornerRadius); + var ctx = this.ctx; + ctx.fillStyle = this.fillColor; + ctx.fill(); + ctx.closePath(); + + ctx.textAlign = "left"; + ctx.textBaseline = "middle"; + ctx.fillStyle = this.titleTextColor; + ctx.font = this.titleFont; + + ctx.fillText(this.title,this.x + this.xPadding, this.getLineHeight(0)); + + ctx.font = this.font; + helpers.each(this.labels,function(label,index){ + ctx.fillStyle = this.textColor; + ctx.fillText(label,this.x + this.xPadding + this.fontSize + 3, this.getLineHeight(index + 1)); + + //A bit gnarly, but clearing this rectangle breaks when using explorercanvas (clears whole canvas) + //ctx.clearRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize); + //Instead we'll make a white filled block to put the legendColour palette over. + + ctx.fillStyle = this.legendColorBackground; + ctx.fillRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize); + + ctx.fillStyle = this.legendColors[index].fill; + ctx.fillRect(this.x + this.xPadding, this.getLineHeight(index + 1) - this.fontSize/2, this.fontSize, this.fontSize); + + + },this); + } + } + }); + + Chart.Scale = Chart.Element.extend({ + initialize : function(){ + this.fit(); + }, + buildYLabels : function(){ + this.yLabels = []; + + var stepDecimalPlaces = getDecimalPlaces(this.stepValue); + + for (var i=0; i<=this.steps; i++){ + this.yLabels.push(template(this.templateString,{value:(this.min + (i * this.stepValue)).toFixed(stepDecimalPlaces)})); + } + this.yLabelWidth = (this.display && this.showLabels) ? longestText(this.ctx,this.font,this.yLabels) : 0; + }, + addXLabel : function(label){ + this.xLabels.push(label); + this.valuesCount++; + this.fit(); + }, + removeXLabel : function(){ + this.xLabels.shift(); + this.valuesCount--; + this.fit(); + }, + // Fitting loop to rotate x Labels and figure out what fits there, and also calculate how many Y steps to use + fit: function(){ + // First we need the width of the yLabels, assuming the xLabels aren't rotated + + // To do that we need the base line at the top and base of the chart, assuming there is no x label rotation + this.startPoint = (this.display) ? this.fontSize : 0; + this.endPoint = (this.display) ? this.height - (this.fontSize * 1.5) - 5 : this.height; // -5 to pad labels + + // Apply padding settings to the start and end point. + this.startPoint += this.padding; + this.endPoint -= this.padding; + + // Cache the starting height, so can determine if we need to recalculate the scale yAxis + var cachedHeight = this.endPoint - this.startPoint, + cachedYLabelWidth; + + // Build the current yLabels so we have an idea of what size they'll be to start + /* + * This sets what is returned from calculateScaleRange as static properties of this class: + * + this.steps; + this.stepValue; + this.min; + this.max; + * + */ + this.calculateYRange(cachedHeight); + + // With these properties set we can now build the array of yLabels + // and also the width of the largest yLabel + this.buildYLabels(); + + this.calculateXLabelRotation(); + + while((cachedHeight > this.endPoint - this.startPoint)){ + cachedHeight = this.endPoint - this.startPoint; + cachedYLabelWidth = this.yLabelWidth; + + this.calculateYRange(cachedHeight); + this.buildYLabels(); + + // Only go through the xLabel loop again if the yLabel width has changed + if (cachedYLabelWidth < this.yLabelWidth){ + this.calculateXLabelRotation(); + } + } + + }, + calculateXLabelRotation : function(){ + //Get the width of each grid by calculating the difference + //between x offsets between 0 and 1. + + this.ctx.font = this.font; + + var firstWidth = this.ctx.measureText(this.xLabels[0]).width, + lastWidth = this.ctx.measureText(this.xLabels[this.xLabels.length - 1]).width, + firstRotated, + lastRotated; + + + this.xScalePaddingRight = lastWidth/2 + 3; + this.xScalePaddingLeft = (firstWidth/2 > this.yLabelWidth + 10) ? firstWidth/2 : this.yLabelWidth + 10; + + this.xLabelRotation = 0; + if (this.display){ + var originalLabelWidth = longestText(this.ctx,this.font,this.xLabels), + cosRotation, + firstRotatedWidth; + this.xLabelWidth = originalLabelWidth; + //Allow 3 pixels x2 padding either side for label readability + var xGridWidth = Math.floor(this.calculateX(1) - this.calculateX(0)) - 6; + + //Max label rotate should be 90 - also act as a loop counter + while ((this.xLabelWidth > xGridWidth && this.xLabelRotation === 0) || (this.xLabelWidth > xGridWidth && this.xLabelRotation <= 90 && this.xLabelRotation > 0)){ + cosRotation = Math.cos(toRadians(this.xLabelRotation)); + + firstRotated = cosRotation * firstWidth; + lastRotated = cosRotation * lastWidth; + + // We're right aligning the text now. + if (firstRotated + this.fontSize / 2 > this.yLabelWidth + 8){ + this.xScalePaddingLeft = firstRotated + this.fontSize / 2; + } + this.xScalePaddingRight = this.fontSize/2; + + + this.xLabelRotation++; + this.xLabelWidth = cosRotation * originalLabelWidth; + + } + if (this.xLabelRotation > 0){ + this.endPoint -= Math.sin(toRadians(this.xLabelRotation))*originalLabelWidth + 3; + } + } + else{ + this.xLabelWidth = 0; + this.xScalePaddingRight = this.padding; + this.xScalePaddingLeft = this.padding; + } + + }, + // Needs to be overidden in each Chart type + // Otherwise we need to pass all the data into the scale class + calculateYRange: noop, + drawingArea: function(){ + return this.startPoint - this.endPoint; + }, + calculateY : function(value){ + var scalingFactor = this.drawingArea() / (this.min - this.max); + return this.endPoint - (scalingFactor * (value - this.min)); + }, + calculateX : function(index){ + var isRotated = (this.xLabelRotation > 0), + // innerWidth = (this.offsetGridLines) ? this.width - offsetLeft - this.padding : this.width - (offsetLeft + halfLabelWidth * 2) - this.padding, + innerWidth = this.width - (this.xScalePaddingLeft + this.xScalePaddingRight), + valueWidth = innerWidth/Math.max((this.valuesCount - ((this.offsetGridLines) ? 0 : 1)), 1), + valueOffset = (valueWidth * index) + this.xScalePaddingLeft; + + if (this.offsetGridLines){ + valueOffset += (valueWidth/2); + } + + return Math.round(valueOffset); + }, + update : function(newProps){ + helpers.extend(this, newProps); + this.fit(); + }, + draw : function(){ + var ctx = this.ctx, + yLabelGap = (this.endPoint - this.startPoint) / this.steps, + xStart = Math.round(this.xScalePaddingLeft); + if (this.display){ + ctx.fillStyle = this.textColor; + ctx.font = this.font; + each(this.yLabels,function(labelString,index){ + var yLabelCenter = this.endPoint - (yLabelGap * index), + linePositionY = Math.round(yLabelCenter), + drawHorizontalLine = this.showHorizontalLines; + + ctx.textAlign = "right"; + ctx.textBaseline = "middle"; + if (this.showLabels){ + ctx.fillText(labelString,xStart - 10,yLabelCenter); + } + + // This is X axis, so draw it + if (index === 0 && !drawHorizontalLine){ + drawHorizontalLine = true; + } + + if (drawHorizontalLine){ + ctx.beginPath(); + } + + if (index > 0){ + // This is a grid line in the centre, so drop that + ctx.lineWidth = this.gridLineWidth; + ctx.strokeStyle = this.gridLineColor; + } else { + // This is the first line on the scale + ctx.lineWidth = this.lineWidth; + ctx.strokeStyle = this.lineColor; + } + + linePositionY += helpers.aliasPixel(ctx.lineWidth); + + if(drawHorizontalLine){ + ctx.moveTo(xStart, linePositionY); + ctx.lineTo(this.width, linePositionY); + ctx.stroke(); + ctx.closePath(); + } + + ctx.lineWidth = this.lineWidth; + ctx.strokeStyle = this.lineColor; + ctx.beginPath(); + ctx.moveTo(xStart - 5, linePositionY); + ctx.lineTo(xStart, linePositionY); + ctx.stroke(); + ctx.closePath(); + + },this); + + each(this.xLabels,function(label,index){ + var xPos = this.calculateX(index) + aliasPixel(this.lineWidth), + // Check to see if line/bar here and decide where to place the line + linePos = this.calculateX(index - (this.offsetGridLines ? 0.5 : 0)) + aliasPixel(this.lineWidth), + isRotated = (this.xLabelRotation > 0), + drawVerticalLine = this.showVerticalLines; + + // This is Y axis, so draw it + if (index === 0 && !drawVerticalLine){ + drawVerticalLine = true; + } + + if (drawVerticalLine){ + ctx.beginPath(); + } + + if (index > 0){ + // This is a grid line in the centre, so drop that + ctx.lineWidth = this.gridLineWidth; + ctx.strokeStyle = this.gridLineColor; + } else { + // This is the first line on the scale + ctx.lineWidth = this.lineWidth; + ctx.strokeStyle = this.lineColor; + } + + if (drawVerticalLine){ + ctx.moveTo(linePos,this.endPoint); + ctx.lineTo(linePos,this.startPoint - 3); + ctx.stroke(); + ctx.closePath(); + } + + + ctx.lineWidth = this.lineWidth; + ctx.strokeStyle = this.lineColor; + + + // Small lines at the bottom of the base grid line + ctx.beginPath(); + ctx.moveTo(linePos,this.endPoint); + ctx.lineTo(linePos,this.endPoint + 5); + ctx.stroke(); + ctx.closePath(); + + ctx.save(); + ctx.translate(xPos,(isRotated) ? this.endPoint + 12 : this.endPoint + 8); + ctx.rotate(toRadians(this.xLabelRotation)*-1); + ctx.font = this.font; + ctx.textAlign = (isRotated) ? "right" : "center"; + ctx.textBaseline = (isRotated) ? "middle" : "top"; + ctx.fillText(label, 0, 0); + ctx.restore(); + },this); + + } + } + + }); + + Chart.RadialScale = Chart.Element.extend({ + initialize: function(){ + this.size = min([this.height, this.width]); + this.drawingArea = (this.display) ? (this.size/2) - (this.fontSize/2 + this.backdropPaddingY) : (this.size/2); + }, + calculateCenterOffset: function(value){ + // Take into account half font size + the yPadding of the top value + var scalingFactor = this.drawingArea / (this.max - this.min); + + return (value - this.min) * scalingFactor; + }, + update : function(){ + if (!this.lineArc){ + this.setScaleSize(); + } else { + this.drawingArea = (this.display) ? (this.size/2) - (this.fontSize/2 + this.backdropPaddingY) : (this.size/2); + } + this.buildYLabels(); + }, + buildYLabels: function(){ + this.yLabels = []; + + var stepDecimalPlaces = getDecimalPlaces(this.stepValue); + + for (var i=0; i<=this.steps; i++){ + this.yLabels.push(template(this.templateString,{value:(this.min + (i * this.stepValue)).toFixed(stepDecimalPlaces)})); + } + }, + getCircumference : function(){ + return ((Math.PI*2) / this.valuesCount); + }, + setScaleSize: function(){ + /* + * Right, this is really confusing and there is a lot of maths going on here + * The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9 + * + * Reaction: https://dl.dropboxusercontent.com/u/34601363/toomuchscience.gif + * + * Solution: + * + * We assume the radius of the polygon is half the size of the canvas at first + * at each index we check if the text overlaps. + * + * Where it does, we store that angle and that index. + * + * After finding the largest index and angle we calculate how much we need to remove + * from the shape radius to move the point inwards by that x. + * + * We average the left and right distances to get the maximum shape radius that can fit in the box + * along with labels. + * + * Once we have that, we can find the centre point for the chart, by taking the x text protrusion + * on each side, removing that from the size, halving it and adding the left x protrusion width. + * + * This will mean we have a shape fitted to the canvas, as large as it can be with the labels + * and position it in the most space efficient manner + * + * https://dl.dropboxusercontent.com/u/34601363/yeahscience.gif + */ + + + // Get maximum radius of the polygon. Either half the height (minus the text width) or half the width. + // Use this to calculate the offset + change. - Make sure L/R protrusion is at least 0 to stop issues with centre points + var largestPossibleRadius = min([(this.height/2 - this.pointLabelFontSize - 5), this.width/2]), + pointPosition, + i, + textWidth, + halfTextWidth, + furthestRight = this.width, + furthestRightIndex, + furthestRightAngle, + furthestLeft = 0, + furthestLeftIndex, + furthestLeftAngle, + xProtrusionLeft, + xProtrusionRight, + radiusReductionRight, + radiusReductionLeft, + maxWidthRadius; + this.ctx.font = fontString(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily); + for (i=0;i furthestRight) { + furthestRight = pointPosition.x + halfTextWidth; + furthestRightIndex = i; + } + if (pointPosition.x - halfTextWidth < furthestLeft) { + furthestLeft = pointPosition.x - halfTextWidth; + furthestLeftIndex = i; + } + } + else if (i < this.valuesCount/2) { + // Less than half the values means we'll left align the text + if (pointPosition.x + textWidth > furthestRight) { + furthestRight = pointPosition.x + textWidth; + furthestRightIndex = i; + } + } + else if (i > this.valuesCount/2){ + // More than half the values means we'll right align the text + if (pointPosition.x - textWidth < furthestLeft) { + furthestLeft = pointPosition.x - textWidth; + furthestLeftIndex = i; + } + } + } + + xProtrusionLeft = furthestLeft; + + xProtrusionRight = Math.ceil(furthestRight - this.width); + + furthestRightAngle = this.getIndexAngle(furthestRightIndex); + + furthestLeftAngle = this.getIndexAngle(furthestLeftIndex); + + radiusReductionRight = xProtrusionRight / Math.sin(furthestRightAngle + Math.PI/2); + + radiusReductionLeft = xProtrusionLeft / Math.sin(furthestLeftAngle + Math.PI/2); + + // Ensure we actually need to reduce the size of the chart + radiusReductionRight = (isNumber(radiusReductionRight)) ? radiusReductionRight : 0; + radiusReductionLeft = (isNumber(radiusReductionLeft)) ? radiusReductionLeft : 0; + + this.drawingArea = largestPossibleRadius - (radiusReductionLeft + radiusReductionRight)/2; + + //this.drawingArea = min([maxWidthRadius, (this.height - (2 * (this.pointLabelFontSize + 5)))/2]) + this.setCenterPoint(radiusReductionLeft, radiusReductionRight); + + }, + setCenterPoint: function(leftMovement, rightMovement){ + + var maxRight = this.width - rightMovement - this.drawingArea, + maxLeft = leftMovement + this.drawingArea; + + this.xCenter = (maxLeft + maxRight)/2; + // Always vertically in the centre as the text height doesn't change + this.yCenter = (this.height/2); + }, + + getIndexAngle : function(index){ + var angleMultiplier = (Math.PI * 2) / this.valuesCount; + // Start from the top instead of right, so remove a quarter of the circle + + return index * angleMultiplier - (Math.PI/2); + }, + getPointPosition : function(index, distanceFromCenter){ + var thisAngle = this.getIndexAngle(index); + return { + x : (Math.cos(thisAngle) * distanceFromCenter) + this.xCenter, + y : (Math.sin(thisAngle) * distanceFromCenter) + this.yCenter + }; + }, + draw: function(){ + if (this.display){ + var ctx = this.ctx; + each(this.yLabels, function(label, index){ + // Don't draw a centre value + if (index > 0){ + var yCenterOffset = index * (this.drawingArea/this.steps), + yHeight = this.yCenter - yCenterOffset, + pointPosition; + + // Draw circular lines around the scale + if (this.lineWidth > 0){ + ctx.strokeStyle = this.lineColor; + ctx.lineWidth = this.lineWidth; + + if(this.lineArc){ + ctx.beginPath(); + ctx.arc(this.xCenter, this.yCenter, yCenterOffset, 0, Math.PI*2); + ctx.closePath(); + ctx.stroke(); + } else{ + ctx.beginPath(); + for (var i=0;i= 0; i--) { + if (this.angleLineWidth > 0){ + var outerPosition = this.getPointPosition(i, this.calculateCenterOffset(this.max)); + ctx.beginPath(); + ctx.moveTo(this.xCenter, this.yCenter); + ctx.lineTo(outerPosition.x, outerPosition.y); + ctx.stroke(); + ctx.closePath(); + } + // Extra 3px out for some label spacing + var pointLabelPosition = this.getPointPosition(i, this.calculateCenterOffset(this.max) + 5); + ctx.font = fontString(this.pointLabelFontSize,this.pointLabelFontStyle,this.pointLabelFontFamily); + ctx.fillStyle = this.pointLabelFontColor; + + var labelsCount = this.labels.length, + halfLabelsCount = this.labels.length/2, + quarterLabelsCount = halfLabelsCount/2, + upperHalf = (i < quarterLabelsCount || i > labelsCount - quarterLabelsCount), + exactQuarter = (i === quarterLabelsCount || i === labelsCount - quarterLabelsCount); + if (i === 0){ + ctx.textAlign = 'center'; + } else if(i === halfLabelsCount){ + ctx.textAlign = 'center'; + } else if (i < halfLabelsCount){ + ctx.textAlign = 'left'; + } else { + ctx.textAlign = 'right'; + } + + // Set the correct text baseline based on outer positioning + if (exactQuarter){ + ctx.textBaseline = 'middle'; + } else if (upperHalf){ + ctx.textBaseline = 'bottom'; + } else { + ctx.textBaseline = 'top'; + } + + ctx.fillText(this.labels[i], pointLabelPosition.x, pointLabelPosition.y); + } + } + } + } + }); + + // Attach global event to resize each chart instance when the browser resizes + helpers.addEvent(window, "resize", (function(){ + // Basic debounce of resize function so it doesn't hurt performance when resizing browser. + var timeout; + return function(){ + clearTimeout(timeout); + timeout = setTimeout(function(){ + each(Chart.instances,function(instance){ + // If the responsive flag is set in the chart instance config + // Cascade the resize event down to the chart. + if (instance.options.responsive){ + instance.resize(instance.render, true); + } + }); + }, 50); + }; + })()); + + + if (amd) { + define(function(){ + return Chart; + }); + } else if (typeof module === 'object' && module.exports) { + module.exports = Chart; + } + + root.Chart = Chart; + + Chart.noConflict = function(){ + root.Chart = previous; + return Chart; + }; + +}).call(this); + +(function(){ + "use strict"; + + var root = this, + Chart = root.Chart, + helpers = Chart.helpers; + + + var defaultConfig = { + //Boolean - Whether the scale should start at zero, or an order of magnitude down from the lowest value + scaleBeginAtZero : true, + + //Boolean - Whether grid lines are shown across the chart + scaleShowGridLines : true, + + //String - Colour of the grid lines + scaleGridLineColor : "rgba(0,0,0,.05)", + + //Number - Width of the grid lines + scaleGridLineWidth : 1, + + //Boolean - Whether to show horizontal lines (except X axis) + scaleShowHorizontalLines: true, + + //Boolean - Whether to show vertical lines (except Y axis) + scaleShowVerticalLines: true, + + //Boolean - If there is a stroke on each bar + barShowStroke : true, + + //Number - Pixel width of the bar stroke + barStrokeWidth : 2, + + //Number - Spacing between each of the X value sets + barValueSpacing : 5, + + //Number - Spacing between data sets within X values + barDatasetSpacing : 1, + + //String - A legend template + legendTemplate : "
    -legend\"><% for (var i=0; i
  • \"><%if(datasets[i].label){%><%=datasets[i].label%><%}%>
  • <%}%>
" + + }; + + + Chart.Type.extend({ + name: "Bar", + defaults : defaultConfig, + initialize: function(data){ + + //Expose options as a scope variable here so we can access it in the ScaleClass + var options = this.options; + + this.ScaleClass = Chart.Scale.extend({ + offsetGridLines : true, + calculateBarX : function(datasetCount, datasetIndex, barIndex){ + //Reusable method for calculating the xPosition of a given bar based on datasetIndex & width of the bar + var xWidth = this.calculateBaseWidth(), + xAbsolute = this.calculateX(barIndex) - (xWidth/2), + barWidth = this.calculateBarWidth(datasetCount); + + return xAbsolute + (barWidth * datasetIndex) + (datasetIndex * options.barDatasetSpacing) + barWidth/2; + }, + calculateBaseWidth : function(){ + return (this.calculateX(1) - this.calculateX(0)) - (2*options.barValueSpacing); + }, + calculateBarWidth : function(datasetCount){ + //The padding between datasets is to the right of each bar, providing that there are more than 1 dataset + var baseWidth = this.calculateBaseWidth() - ((datasetCount - 1) * options.barDatasetSpacing); + + return (baseWidth / datasetCount); + } + }); + + this.datasets = []; + + //Set up tooltip events on the chart + if (this.options.showTooltips){ + helpers.bindEvents(this, this.options.tooltipEvents, function(evt){ + var activeBars = (evt.type !== 'mouseout') ? this.getBarsAtEvent(evt) : []; + + this.eachBars(function(bar){ + bar.restore(['fillColor', 'strokeColor']); + }); + helpers.each(activeBars, function(activeBar){ + activeBar.fillColor = activeBar.highlightFill; + activeBar.strokeColor = activeBar.highlightStroke; + }); + this.showTooltip(activeBars); + }); + } + + //Declare the extension of the default point, to cater for the options passed in to the constructor + this.BarClass = Chart.Rectangle.extend({ + strokeWidth : this.options.barStrokeWidth, + showStroke : this.options.barShowStroke, + ctx : this.chart.ctx + }); + + //Iterate through each of the datasets, and build this into a property of the chart + helpers.each(data.datasets,function(dataset,datasetIndex){ + + var datasetObject = { + label : dataset.label || null, + fillColor : dataset.fillColor, + strokeColor : dataset.strokeColor, + bars : [] + }; + + this.datasets.push(datasetObject); + + helpers.each(dataset.data,function(dataPoint,index){ + //Add a new point for each piece of data, passing any required data to draw. + datasetObject.bars.push(new this.BarClass({ + value : dataPoint, + label : data.labels[index], + datasetLabel: dataset.label, + strokeColor : dataset.strokeColor, + fillColor : dataset.fillColor, + highlightFill : dataset.highlightFill || dataset.fillColor, + highlightStroke : dataset.highlightStroke || dataset.strokeColor + })); + },this); + + },this); + + this.buildScale(data.labels); + + this.BarClass.prototype.base = this.scale.endPoint; + + this.eachBars(function(bar, index, datasetIndex){ + helpers.extend(bar, { + width : this.scale.calculateBarWidth(this.datasets.length), + x: this.scale.calculateBarX(this.datasets.length, datasetIndex, index), + y: this.scale.endPoint + }); + bar.save(); + }, this); + + this.render(); + }, + update : function(){ + this.scale.update(); + // Reset any highlight colours before updating. + helpers.each(this.activeElements, function(activeElement){ + activeElement.restore(['fillColor', 'strokeColor']); + }); + + this.eachBars(function(bar){ + bar.save(); + }); + this.render(); + }, + eachBars : function(callback){ + helpers.each(this.datasets,function(dataset, datasetIndex){ + helpers.each(dataset.bars, callback, this, datasetIndex); + },this); + }, + getBarsAtEvent : function(e){ + var barsArray = [], + eventPosition = helpers.getRelativePosition(e), + datasetIterator = function(dataset){ + barsArray.push(dataset.bars[barIndex]); + }, + barIndex; + + for (var datasetIndex = 0; datasetIndex < this.datasets.length; datasetIndex++) { + for (barIndex = 0; barIndex < this.datasets[datasetIndex].bars.length; barIndex++) { + if (this.datasets[datasetIndex].bars[barIndex].inRange(eventPosition.x,eventPosition.y)){ + helpers.each(this.datasets, datasetIterator); + return barsArray; + } + } + } + + return barsArray; + }, + buildScale : function(labels){ + var self = this; + + var dataTotal = function(){ + var values = []; + self.eachBars(function(bar){ + values.push(bar.value); + }); + return values; + }; + + var scaleOptions = { + templateString : this.options.scaleLabel, + height : this.chart.height, + width : this.chart.width, + ctx : this.chart.ctx, + textColor : this.options.scaleFontColor, + fontSize : this.options.scaleFontSize, + fontStyle : this.options.scaleFontStyle, + fontFamily : this.options.scaleFontFamily, + valuesCount : labels.length, + beginAtZero : this.options.scaleBeginAtZero, + integersOnly : this.options.scaleIntegersOnly, + calculateYRange: function(currentHeight){ + var updatedRanges = helpers.calculateScaleRange( + dataTotal(), + currentHeight, + this.fontSize, + this.beginAtZero, + this.integersOnly + ); + helpers.extend(this, updatedRanges); + }, + xLabels : labels, + font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily), + lineWidth : this.options.scaleLineWidth, + lineColor : this.options.scaleLineColor, + showHorizontalLines : this.options.scaleShowHorizontalLines, + showVerticalLines : this.options.scaleShowVerticalLines, + gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0, + gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)", + padding : (this.options.showScale) ? 0 : (this.options.barShowStroke) ? this.options.barStrokeWidth : 0, + showLabels : this.options.scaleShowLabels, + display : this.options.showScale + }; + + if (this.options.scaleOverride){ + helpers.extend(scaleOptions, { + calculateYRange: helpers.noop, + steps: this.options.scaleSteps, + stepValue: this.options.scaleStepWidth, + min: this.options.scaleStartValue, + max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth) + }); + } + + this.scale = new this.ScaleClass(scaleOptions); + }, + addData : function(valuesArray,label){ + //Map the values array for each of the datasets + helpers.each(valuesArray,function(value,datasetIndex){ + //Add a new point for each piece of data, passing any required data to draw. + this.datasets[datasetIndex].bars.push(new this.BarClass({ + value : value, + label : label, + x: this.scale.calculateBarX(this.datasets.length, datasetIndex, this.scale.valuesCount+1), + y: this.scale.endPoint, + width : this.scale.calculateBarWidth(this.datasets.length), + base : this.scale.endPoint, + strokeColor : this.datasets[datasetIndex].strokeColor, + fillColor : this.datasets[datasetIndex].fillColor + })); + },this); + + this.scale.addXLabel(label); + //Then re-render the chart. + this.update(); + }, + removeData : function(){ + this.scale.removeXLabel(); + //Then re-render the chart. + helpers.each(this.datasets,function(dataset){ + dataset.bars.shift(); + },this); + this.update(); + }, + reflow : function(){ + helpers.extend(this.BarClass.prototype,{ + y: this.scale.endPoint, + base : this.scale.endPoint + }); + var newScaleProps = helpers.extend({ + height : this.chart.height, + width : this.chart.width + }); + this.scale.update(newScaleProps); + }, + draw : function(ease){ + var easingDecimal = ease || 1; + this.clear(); + + var ctx = this.chart.ctx; + + this.scale.draw(easingDecimal); + + //Draw all the bars for each dataset + helpers.each(this.datasets,function(dataset,datasetIndex){ + helpers.each(dataset.bars,function(bar,index){ + if (bar.hasValue()){ + bar.base = this.scale.endPoint; + //Transition then draw + bar.transition({ + x : this.scale.calculateBarX(this.datasets.length, datasetIndex, index), + y : this.scale.calculateY(bar.value), + width : this.scale.calculateBarWidth(this.datasets.length) + }, easingDecimal).draw(); + } + },this); + + },this); + } + }); + + +}).call(this); + +(function(){ + "use strict"; + + var root = this, + Chart = root.Chart, + //Cache a local reference to Chart.helpers + helpers = Chart.helpers; + + var defaultConfig = { + //Boolean - Whether we should show a stroke on each segment + segmentShowStroke : true, + + //String - The colour of each segment stroke + segmentStrokeColor : "#fff", + + //Number - The width of each segment stroke + segmentStrokeWidth : 2, + + //The percentage of the chart that we cut out of the middle. + percentageInnerCutout : 50, + + //Number - Amount of animation steps + animationSteps : 100, + + //String - Animation easing effect + animationEasing : "easeOutBounce", + + //Boolean - Whether we animate the rotation of the Doughnut + animateRotate : true, + + //Boolean - Whether we animate scaling the Doughnut from the centre + animateScale : false, + + //String - A legend template + legendTemplate : "
    -legend\"><% for (var i=0; i
  • \"><%if(segments[i].label){%><%=segments[i].label%><%}%>
  • <%}%>
" + + }; + + + Chart.Type.extend({ + //Passing in a name registers this chart in the Chart namespace + name: "Doughnut", + //Providing a defaults will also register the deafults in the chart namespace + defaults : defaultConfig, + //Initialize is fired when the chart is initialized - Data is passed in as a parameter + //Config is automatically merged by the core of Chart.js, and is available at this.options + initialize: function(data){ + + //Declare segments as a static property to prevent inheriting across the Chart type prototype + this.segments = []; + this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2; + + this.SegmentArc = Chart.Arc.extend({ + ctx : this.chart.ctx, + x : this.chart.width/2, + y : this.chart.height/2 + }); + + //Set up tooltip events on the chart + if (this.options.showTooltips){ + helpers.bindEvents(this, this.options.tooltipEvents, function(evt){ + var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : []; + + helpers.each(this.segments,function(segment){ + segment.restore(["fillColor"]); + }); + helpers.each(activeSegments,function(activeSegment){ + activeSegment.fillColor = activeSegment.highlightColor; + }); + this.showTooltip(activeSegments); + }); + } + this.calculateTotal(data); + + helpers.each(data,function(datapoint, index){ + this.addData(datapoint, index, true); + },this); + + this.render(); + }, + getSegmentsAtEvent : function(e){ + var segmentsArray = []; + + var location = helpers.getRelativePosition(e); + + helpers.each(this.segments,function(segment){ + if (segment.inRange(location.x,location.y)) segmentsArray.push(segment); + },this); + return segmentsArray; + }, + addData : function(segment, atIndex, silent){ + var index = atIndex || this.segments.length; + this.segments.splice(index, 0, new this.SegmentArc({ + value : segment.value, + outerRadius : (this.options.animateScale) ? 0 : this.outerRadius, + innerRadius : (this.options.animateScale) ? 0 : (this.outerRadius/100) * this.options.percentageInnerCutout, + fillColor : segment.color, + highlightColor : segment.highlight || segment.color, + showStroke : this.options.segmentShowStroke, + strokeWidth : this.options.segmentStrokeWidth, + strokeColor : this.options.segmentStrokeColor, + startAngle : Math.PI * 1.5, + circumference : (this.options.animateRotate) ? 0 : this.calculateCircumference(segment.value), + label : segment.label + })); + if (!silent){ + this.reflow(); + this.update(); + } + }, + calculateCircumference : function(value){ + return (Math.PI*2)*(Math.abs(value) / this.total); + }, + calculateTotal : function(data){ + this.total = 0; + helpers.each(data,function(segment){ + this.total += Math.abs(segment.value); + },this); + }, + update : function(){ + this.calculateTotal(this.segments); + + // Reset any highlight colours before updating. + helpers.each(this.activeElements, function(activeElement){ + activeElement.restore(['fillColor']); + }); + + helpers.each(this.segments,function(segment){ + segment.save(); + }); + this.render(); + }, + + removeData: function(atIndex){ + var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length-1; + this.segments.splice(indexToDelete, 1); + this.reflow(); + this.update(); + }, + + reflow : function(){ + helpers.extend(this.SegmentArc.prototype,{ + x : this.chart.width/2, + y : this.chart.height/2 + }); + this.outerRadius = (helpers.min([this.chart.width,this.chart.height]) - this.options.segmentStrokeWidth/2)/2; + helpers.each(this.segments, function(segment){ + segment.update({ + outerRadius : this.outerRadius, + innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout + }); + }, this); + }, + draw : function(easeDecimal){ + var animDecimal = (easeDecimal) ? easeDecimal : 1; + this.clear(); + helpers.each(this.segments,function(segment,index){ + segment.transition({ + circumference : this.calculateCircumference(segment.value), + outerRadius : this.outerRadius, + innerRadius : (this.outerRadius/100) * this.options.percentageInnerCutout + },animDecimal); + + segment.endAngle = segment.startAngle + segment.circumference; + + segment.draw(); + if (index === 0){ + segment.startAngle = Math.PI * 1.5; + } + //Check to see if it's the last segment, if not get the next and update the start angle + if (index < this.segments.length-1){ + this.segments[index+1].startAngle = segment.endAngle; + } + },this); + + } + }); + + Chart.types.Doughnut.extend({ + name : "Pie", + defaults : helpers.merge(defaultConfig,{percentageInnerCutout : 0}) + }); + +}).call(this); +(function(){ + "use strict"; + + var root = this, + Chart = root.Chart, + helpers = Chart.helpers; + + var defaultConfig = { + + ///Boolean - Whether grid lines are shown across the chart + scaleShowGridLines : true, + + //String - Colour of the grid lines + scaleGridLineColor : "rgba(0,0,0,.05)", + + //Number - Width of the grid lines + scaleGridLineWidth : 1, + + //Boolean - Whether to show horizontal lines (except X axis) + scaleShowHorizontalLines: true, + + //Boolean - Whether to show vertical lines (except Y axis) + scaleShowVerticalLines: true, + + //Boolean - Whether the line is curved between points + bezierCurve : true, + + //Number - Tension of the bezier curve between points + bezierCurveTension : 0.4, + + //Boolean - Whether to show a dot for each point + pointDot : true, + + //Number - Radius of each point dot in pixels + pointDotRadius : 4, + + //Number - Pixel width of point dot stroke + pointDotStrokeWidth : 1, + + //Number - amount extra to add to the radius to cater for hit detection outside the drawn point + pointHitDetectionRadius : 20, + + //Boolean - Whether to show a stroke for datasets + datasetStroke : true, + + //Number - Pixel width of dataset stroke + datasetStrokeWidth : 2, + + //Boolean - Whether to fill the dataset with a colour + datasetFill : true, + + //String - A legend template + legendTemplate : "
    -legend\"><% for (var i=0; i
  • \"><%if(datasets[i].label){%><%=datasets[i].label%><%}%>
  • <%}%>
" + + }; + + + Chart.Type.extend({ + name: "Line", + defaults : defaultConfig, + initialize: function(data){ + //Declare the extension of the default point, to cater for the options passed in to the constructor + this.PointClass = Chart.Point.extend({ + strokeWidth : this.options.pointDotStrokeWidth, + radius : this.options.pointDotRadius, + display: this.options.pointDot, + hitDetectionRadius : this.options.pointHitDetectionRadius, + ctx : this.chart.ctx, + inRange : function(mouseX){ + return (Math.pow(mouseX-this.x, 2) < Math.pow(this.radius + this.hitDetectionRadius,2)); + } + }); + + this.datasets = []; + + //Set up tooltip events on the chart + if (this.options.showTooltips){ + helpers.bindEvents(this, this.options.tooltipEvents, function(evt){ + var activePoints = (evt.type !== 'mouseout') ? this.getPointsAtEvent(evt) : []; + this.eachPoints(function(point){ + point.restore(['fillColor', 'strokeColor']); + }); + helpers.each(activePoints, function(activePoint){ + activePoint.fillColor = activePoint.highlightFill; + activePoint.strokeColor = activePoint.highlightStroke; + }); + this.showTooltip(activePoints); + }); + } + + //Iterate through each of the datasets, and build this into a property of the chart + helpers.each(data.datasets,function(dataset){ + + var datasetObject = { + label : dataset.label || null, + fillColor : dataset.fillColor, + strokeColor : dataset.strokeColor, + pointColor : dataset.pointColor, + pointStrokeColor : dataset.pointStrokeColor, + points : [] + }; + + this.datasets.push(datasetObject); + + + helpers.each(dataset.data,function(dataPoint,index){ + //Add a new point for each piece of data, passing any required data to draw. + datasetObject.points.push(new this.PointClass({ + value : dataPoint, + label : data.labels[index], + datasetLabel: dataset.label, + strokeColor : dataset.pointStrokeColor, + fillColor : dataset.pointColor, + highlightFill : dataset.pointHighlightFill || dataset.pointColor, + highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor + })); + },this); + + this.buildScale(data.labels); + + + this.eachPoints(function(point, index){ + helpers.extend(point, { + x: this.scale.calculateX(index), + y: this.scale.endPoint + }); + point.save(); + }, this); + + },this); + + + this.render(); + }, + update : function(){ + this.scale.update(); + // Reset any highlight colours before updating. + helpers.each(this.activeElements, function(activeElement){ + activeElement.restore(['fillColor', 'strokeColor']); + }); + this.eachPoints(function(point){ + point.save(); + }); + this.render(); + }, + eachPoints : function(callback){ + helpers.each(this.datasets,function(dataset){ + helpers.each(dataset.points,callback,this); + },this); + }, + getPointsAtEvent : function(e){ + var pointsArray = [], + eventPosition = helpers.getRelativePosition(e); + helpers.each(this.datasets,function(dataset){ + helpers.each(dataset.points,function(point){ + if (point.inRange(eventPosition.x,eventPosition.y)) pointsArray.push(point); + }); + },this); + return pointsArray; + }, + buildScale : function(labels){ + var self = this; + + var dataTotal = function(){ + var values = []; + self.eachPoints(function(point){ + values.push(point.value); + }); + + return values; + }; + + var scaleOptions = { + templateString : this.options.scaleLabel, + height : this.chart.height, + width : this.chart.width, + ctx : this.chart.ctx, + textColor : this.options.scaleFontColor, + fontSize : this.options.scaleFontSize, + fontStyle : this.options.scaleFontStyle, + fontFamily : this.options.scaleFontFamily, + valuesCount : labels.length, + beginAtZero : this.options.scaleBeginAtZero, + integersOnly : this.options.scaleIntegersOnly, + calculateYRange : function(currentHeight){ + var updatedRanges = helpers.calculateScaleRange( + dataTotal(), + currentHeight, + this.fontSize, + this.beginAtZero, + this.integersOnly + ); + helpers.extend(this, updatedRanges); + }, + xLabels : labels, + font : helpers.fontString(this.options.scaleFontSize, this.options.scaleFontStyle, this.options.scaleFontFamily), + lineWidth : this.options.scaleLineWidth, + lineColor : this.options.scaleLineColor, + showHorizontalLines : this.options.scaleShowHorizontalLines, + showVerticalLines : this.options.scaleShowVerticalLines, + gridLineWidth : (this.options.scaleShowGridLines) ? this.options.scaleGridLineWidth : 0, + gridLineColor : (this.options.scaleShowGridLines) ? this.options.scaleGridLineColor : "rgba(0,0,0,0)", + padding: (this.options.showScale) ? 0 : this.options.pointDotRadius + this.options.pointDotStrokeWidth, + showLabels : this.options.scaleShowLabels, + display : this.options.showScale + }; + + if (this.options.scaleOverride){ + helpers.extend(scaleOptions, { + calculateYRange: helpers.noop, + steps: this.options.scaleSteps, + stepValue: this.options.scaleStepWidth, + min: this.options.scaleStartValue, + max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth) + }); + } + + + this.scale = new Chart.Scale(scaleOptions); + }, + addData : function(valuesArray,label){ + //Map the values array for each of the datasets + + helpers.each(valuesArray,function(value,datasetIndex){ + //Add a new point for each piece of data, passing any required data to draw. + this.datasets[datasetIndex].points.push(new this.PointClass({ + value : value, + label : label, + x: this.scale.calculateX(this.scale.valuesCount+1), + y: this.scale.endPoint, + strokeColor : this.datasets[datasetIndex].pointStrokeColor, + fillColor : this.datasets[datasetIndex].pointColor + })); + },this); + + this.scale.addXLabel(label); + //Then re-render the chart. + this.update(); + }, + removeData : function(){ + this.scale.removeXLabel(); + //Then re-render the chart. + helpers.each(this.datasets,function(dataset){ + dataset.points.shift(); + },this); + this.update(); + }, + reflow : function(){ + var newScaleProps = helpers.extend({ + height : this.chart.height, + width : this.chart.width + }); + this.scale.update(newScaleProps); + }, + draw : function(ease){ + var easingDecimal = ease || 1; + this.clear(); + + var ctx = this.chart.ctx; + + // Some helper methods for getting the next/prev points + var hasValue = function(item){ + return item.value !== null; + }, + nextPoint = function(point, collection, index){ + return helpers.findNextWhere(collection, hasValue, index) || point; + }, + previousPoint = function(point, collection, index){ + return helpers.findPreviousWhere(collection, hasValue, index) || point; + }; + + this.scale.draw(easingDecimal); + + + helpers.each(this.datasets,function(dataset){ + var pointsWithValues = helpers.where(dataset.points, hasValue); + + //Transition each point first so that the line and point drawing isn't out of sync + //We can use this extra loop to calculate the control points of this dataset also in this loop + + helpers.each(dataset.points, function(point, index){ + if (point.hasValue()){ + point.transition({ + y : this.scale.calculateY(point.value), + x : this.scale.calculateX(index) + }, easingDecimal); + } + },this); + + + // Control points need to be calculated in a seperate loop, because we need to know the current x/y of the point + // This would cause issues when there is no animation, because the y of the next point would be 0, so beziers would be skewed + if (this.options.bezierCurve){ + helpers.each(pointsWithValues, function(point, index){ + var tension = (index > 0 && index < pointsWithValues.length - 1) ? this.options.bezierCurveTension : 0; + point.controlPoints = helpers.splineCurve( + previousPoint(point, pointsWithValues, index), + point, + nextPoint(point, pointsWithValues, index), + tension + ); + + // Prevent the bezier going outside of the bounds of the graph + + // Cap puter bezier handles to the upper/lower scale bounds + if (point.controlPoints.outer.y > this.scale.endPoint){ + point.controlPoints.outer.y = this.scale.endPoint; + } + else if (point.controlPoints.outer.y < this.scale.startPoint){ + point.controlPoints.outer.y = this.scale.startPoint; + } + + // Cap inner bezier handles to the upper/lower scale bounds + if (point.controlPoints.inner.y > this.scale.endPoint){ + point.controlPoints.inner.y = this.scale.endPoint; + } + else if (point.controlPoints.inner.y < this.scale.startPoint){ + point.controlPoints.inner.y = this.scale.startPoint; + } + },this); + } + + + //Draw the line between all the points + ctx.lineWidth = this.options.datasetStrokeWidth; + ctx.strokeStyle = dataset.strokeColor; + ctx.beginPath(); + + helpers.each(pointsWithValues, function(point, index){ + if (index === 0){ + ctx.moveTo(point.x, point.y); + } + else{ + if(this.options.bezierCurve){ + var previous = previousPoint(point, pointsWithValues, index); + + ctx.bezierCurveTo( + previous.controlPoints.outer.x, + previous.controlPoints.outer.y, + point.controlPoints.inner.x, + point.controlPoints.inner.y, + point.x, + point.y + ); + } + else{ + ctx.lineTo(point.x,point.y); + } + } + }, this); + + ctx.stroke(); + + if (this.options.datasetFill && pointsWithValues.length > 0){ + //Round off the line by going to the base of the chart, back to the start, then fill. + ctx.lineTo(pointsWithValues[pointsWithValues.length - 1].x, this.scale.endPoint); + ctx.lineTo(pointsWithValues[0].x, this.scale.endPoint); + ctx.fillStyle = dataset.fillColor; + ctx.closePath(); + ctx.fill(); + } + + //Now draw the points over the line + //A little inefficient double looping, but better than the line + //lagging behind the point positions + helpers.each(pointsWithValues,function(point){ + point.draw(); + }); + },this); + } + }); + + +}).call(this); + +(function(){ + "use strict"; + + var root = this, + Chart = root.Chart, + //Cache a local reference to Chart.helpers + helpers = Chart.helpers; + + var defaultConfig = { + //Boolean - Show a backdrop to the scale label + scaleShowLabelBackdrop : true, + + //String - The colour of the label backdrop + scaleBackdropColor : "rgba(255,255,255,0.75)", + + // Boolean - Whether the scale should begin at zero + scaleBeginAtZero : true, + + //Number - The backdrop padding above & below the label in pixels + scaleBackdropPaddingY : 2, + + //Number - The backdrop padding to the side of the label in pixels + scaleBackdropPaddingX : 2, + + //Boolean - Show line for each value in the scale + scaleShowLine : true, + + //Boolean - Stroke a line around each segment in the chart + segmentShowStroke : true, + + //String - The colour of the stroke on each segement. + segmentStrokeColor : "#fff", + + //Number - The width of the stroke value in pixels + segmentStrokeWidth : 2, + + //Number - Amount of animation steps + animationSteps : 100, + + //String - Animation easing effect. + animationEasing : "easeOutBounce", + + //Boolean - Whether to animate the rotation of the chart + animateRotate : true, + + //Boolean - Whether to animate scaling the chart from the centre + animateScale : false, + + //String - A legend template + legendTemplate : "
    -legend\"><% for (var i=0; i
  • \"><%if(segments[i].label){%><%=segments[i].label%><%}%>
  • <%}%>
" + }; + + + Chart.Type.extend({ + //Passing in a name registers this chart in the Chart namespace + name: "PolarArea", + //Providing a defaults will also register the deafults in the chart namespace + defaults : defaultConfig, + //Initialize is fired when the chart is initialized - Data is passed in as a parameter + //Config is automatically merged by the core of Chart.js, and is available at this.options + initialize: function(data){ + this.segments = []; + //Declare segment class as a chart instance specific class, so it can share props for this instance + this.SegmentArc = Chart.Arc.extend({ + showStroke : this.options.segmentShowStroke, + strokeWidth : this.options.segmentStrokeWidth, + strokeColor : this.options.segmentStrokeColor, + ctx : this.chart.ctx, + innerRadius : 0, + x : this.chart.width/2, + y : this.chart.height/2 + }); + this.scale = new Chart.RadialScale({ + display: this.options.showScale, + fontStyle: this.options.scaleFontStyle, + fontSize: this.options.scaleFontSize, + fontFamily: this.options.scaleFontFamily, + fontColor: this.options.scaleFontColor, + showLabels: this.options.scaleShowLabels, + showLabelBackdrop: this.options.scaleShowLabelBackdrop, + backdropColor: this.options.scaleBackdropColor, + backdropPaddingY : this.options.scaleBackdropPaddingY, + backdropPaddingX: this.options.scaleBackdropPaddingX, + lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0, + lineColor: this.options.scaleLineColor, + lineArc: true, + width: this.chart.width, + height: this.chart.height, + xCenter: this.chart.width/2, + yCenter: this.chart.height/2, + ctx : this.chart.ctx, + templateString: this.options.scaleLabel, + valuesCount: data.length + }); + + this.updateScaleRange(data); + + this.scale.update(); + + helpers.each(data,function(segment,index){ + this.addData(segment,index,true); + },this); + + //Set up tooltip events on the chart + if (this.options.showTooltips){ + helpers.bindEvents(this, this.options.tooltipEvents, function(evt){ + var activeSegments = (evt.type !== 'mouseout') ? this.getSegmentsAtEvent(evt) : []; + helpers.each(this.segments,function(segment){ + segment.restore(["fillColor"]); + }); + helpers.each(activeSegments,function(activeSegment){ + activeSegment.fillColor = activeSegment.highlightColor; + }); + this.showTooltip(activeSegments); + }); + } + + this.render(); + }, + getSegmentsAtEvent : function(e){ + var segmentsArray = []; + + var location = helpers.getRelativePosition(e); + + helpers.each(this.segments,function(segment){ + if (segment.inRange(location.x,location.y)) segmentsArray.push(segment); + },this); + return segmentsArray; + }, + addData : function(segment, atIndex, silent){ + var index = atIndex || this.segments.length; + + this.segments.splice(index, 0, new this.SegmentArc({ + fillColor: segment.color, + highlightColor: segment.highlight || segment.color, + label: segment.label, + value: segment.value, + outerRadius: (this.options.animateScale) ? 0 : this.scale.calculateCenterOffset(segment.value), + circumference: (this.options.animateRotate) ? 0 : this.scale.getCircumference(), + startAngle: Math.PI * 1.5 + })); + if (!silent){ + this.reflow(); + this.update(); + } + }, + removeData: function(atIndex){ + var indexToDelete = (helpers.isNumber(atIndex)) ? atIndex : this.segments.length-1; + this.segments.splice(indexToDelete, 1); + this.reflow(); + this.update(); + }, + calculateTotal: function(data){ + this.total = 0; + helpers.each(data,function(segment){ + this.total += segment.value; + },this); + this.scale.valuesCount = this.segments.length; + }, + updateScaleRange: function(datapoints){ + var valuesArray = []; + helpers.each(datapoints,function(segment){ + valuesArray.push(segment.value); + }); + + var scaleSizes = (this.options.scaleOverride) ? + { + steps: this.options.scaleSteps, + stepValue: this.options.scaleStepWidth, + min: this.options.scaleStartValue, + max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth) + } : + helpers.calculateScaleRange( + valuesArray, + helpers.min([this.chart.width, this.chart.height])/2, + this.options.scaleFontSize, + this.options.scaleBeginAtZero, + this.options.scaleIntegersOnly + ); + + helpers.extend( + this.scale, + scaleSizes, + { + size: helpers.min([this.chart.width, this.chart.height]), + xCenter: this.chart.width/2, + yCenter: this.chart.height/2 + } + ); + + }, + update : function(){ + this.calculateTotal(this.segments); + + helpers.each(this.segments,function(segment){ + segment.save(); + }); + + this.reflow(); + this.render(); + }, + reflow : function(){ + helpers.extend(this.SegmentArc.prototype,{ + x : this.chart.width/2, + y : this.chart.height/2 + }); + this.updateScaleRange(this.segments); + this.scale.update(); + + helpers.extend(this.scale,{ + xCenter: this.chart.width/2, + yCenter: this.chart.height/2 + }); + + helpers.each(this.segments, function(segment){ + segment.update({ + outerRadius : this.scale.calculateCenterOffset(segment.value) + }); + }, this); + + }, + draw : function(ease){ + var easingDecimal = ease || 1; + //Clear & draw the canvas + this.clear(); + helpers.each(this.segments,function(segment, index){ + segment.transition({ + circumference : this.scale.getCircumference(), + outerRadius : this.scale.calculateCenterOffset(segment.value) + },easingDecimal); + + segment.endAngle = segment.startAngle + segment.circumference; + + // If we've removed the first segment we need to set the first one to + // start at the top. + if (index === 0){ + segment.startAngle = Math.PI * 1.5; + } + + //Check to see if it's the last segment, if not get the next and update the start angle + if (index < this.segments.length - 1){ + this.segments[index+1].startAngle = segment.endAngle; + } + segment.draw(); + }, this); + this.scale.draw(); + } + }); + +}).call(this); +(function(){ + "use strict"; + + var root = this, + Chart = root.Chart, + helpers = Chart.helpers; + + + + Chart.Type.extend({ + name: "Radar", + defaults:{ + //Boolean - Whether to show lines for each scale point + scaleShowLine : true, + + //Boolean - Whether we show the angle lines out of the radar + angleShowLineOut : true, + + //Boolean - Whether to show labels on the scale + scaleShowLabels : false, + + // Boolean - Whether the scale should begin at zero + scaleBeginAtZero : true, + + //String - Colour of the angle line + angleLineColor : "rgba(0,0,0,.1)", + + //Number - Pixel width of the angle line + angleLineWidth : 1, + + //String - Point label font declaration + pointLabelFontFamily : "'Arial'", + + //String - Point label font weight + pointLabelFontStyle : "normal", + + //Number - Point label font size in pixels + pointLabelFontSize : 10, + + //String - Point label font colour + pointLabelFontColor : "#666", + + //Boolean - Whether to show a dot for each point + pointDot : true, + + //Number - Radius of each point dot in pixels + pointDotRadius : 3, + + //Number - Pixel width of point dot stroke + pointDotStrokeWidth : 1, + + //Number - amount extra to add to the radius to cater for hit detection outside the drawn point + pointHitDetectionRadius : 20, + + //Boolean - Whether to show a stroke for datasets + datasetStroke : true, + + //Number - Pixel width of dataset stroke + datasetStrokeWidth : 2, + + //Boolean - Whether to fill the dataset with a colour + datasetFill : true, + + //String - A legend template + legendTemplate : "
    -legend\"><% for (var i=0; i
  • \"><%if(datasets[i].label){%><%=datasets[i].label%><%}%>
  • <%}%>
" + + }, + + initialize: function(data){ + this.PointClass = Chart.Point.extend({ + strokeWidth : this.options.pointDotStrokeWidth, + radius : this.options.pointDotRadius, + display: this.options.pointDot, + hitDetectionRadius : this.options.pointHitDetectionRadius, + ctx : this.chart.ctx + }); + + this.datasets = []; + + this.buildScale(data); + + //Set up tooltip events on the chart + if (this.options.showTooltips){ + helpers.bindEvents(this, this.options.tooltipEvents, function(evt){ + var activePointsCollection = (evt.type !== 'mouseout') ? this.getPointsAtEvent(evt) : []; + + this.eachPoints(function(point){ + point.restore(['fillColor', 'strokeColor']); + }); + helpers.each(activePointsCollection, function(activePoint){ + activePoint.fillColor = activePoint.highlightFill; + activePoint.strokeColor = activePoint.highlightStroke; + }); + + this.showTooltip(activePointsCollection); + }); + } + + //Iterate through each of the datasets, and build this into a property of the chart + helpers.each(data.datasets,function(dataset){ + + var datasetObject = { + label: dataset.label || null, + fillColor : dataset.fillColor, + strokeColor : dataset.strokeColor, + pointColor : dataset.pointColor, + pointStrokeColor : dataset.pointStrokeColor, + points : [] + }; + + this.datasets.push(datasetObject); + + helpers.each(dataset.data,function(dataPoint,index){ + //Add a new point for each piece of data, passing any required data to draw. + var pointPosition; + if (!this.scale.animation){ + pointPosition = this.scale.getPointPosition(index, this.scale.calculateCenterOffset(dataPoint)); + } + datasetObject.points.push(new this.PointClass({ + value : dataPoint, + label : data.labels[index], + datasetLabel: dataset.label, + x: (this.options.animation) ? this.scale.xCenter : pointPosition.x, + y: (this.options.animation) ? this.scale.yCenter : pointPosition.y, + strokeColor : dataset.pointStrokeColor, + fillColor : dataset.pointColor, + highlightFill : dataset.pointHighlightFill || dataset.pointColor, + highlightStroke : dataset.pointHighlightStroke || dataset.pointStrokeColor + })); + },this); + + },this); + + this.render(); + }, + eachPoints : function(callback){ + helpers.each(this.datasets,function(dataset){ + helpers.each(dataset.points,callback,this); + },this); + }, + + getPointsAtEvent : function(evt){ + var mousePosition = helpers.getRelativePosition(evt), + fromCenter = helpers.getAngleFromPoint({ + x: this.scale.xCenter, + y: this.scale.yCenter + }, mousePosition); + + var anglePerIndex = (Math.PI * 2) /this.scale.valuesCount, + pointIndex = Math.round((fromCenter.angle - Math.PI * 1.5) / anglePerIndex), + activePointsCollection = []; + + // If we're at the top, make the pointIndex 0 to get the first of the array. + if (pointIndex >= this.scale.valuesCount || pointIndex < 0){ + pointIndex = 0; + } + + if (fromCenter.distance <= this.scale.drawingArea){ + helpers.each(this.datasets, function(dataset){ + activePointsCollection.push(dataset.points[pointIndex]); + }); + } + + return activePointsCollection; + }, + + buildScale : function(data){ + this.scale = new Chart.RadialScale({ + display: this.options.showScale, + fontStyle: this.options.scaleFontStyle, + fontSize: this.options.scaleFontSize, + fontFamily: this.options.scaleFontFamily, + fontColor: this.options.scaleFontColor, + showLabels: this.options.scaleShowLabels, + showLabelBackdrop: this.options.scaleShowLabelBackdrop, + backdropColor: this.options.scaleBackdropColor, + backdropPaddingY : this.options.scaleBackdropPaddingY, + backdropPaddingX: this.options.scaleBackdropPaddingX, + lineWidth: (this.options.scaleShowLine) ? this.options.scaleLineWidth : 0, + lineColor: this.options.scaleLineColor, + angleLineColor : this.options.angleLineColor, + angleLineWidth : (this.options.angleShowLineOut) ? this.options.angleLineWidth : 0, + // Point labels at the edge of each line + pointLabelFontColor : this.options.pointLabelFontColor, + pointLabelFontSize : this.options.pointLabelFontSize, + pointLabelFontFamily : this.options.pointLabelFontFamily, + pointLabelFontStyle : this.options.pointLabelFontStyle, + height : this.chart.height, + width: this.chart.width, + xCenter: this.chart.width/2, + yCenter: this.chart.height/2, + ctx : this.chart.ctx, + templateString: this.options.scaleLabel, + labels: data.labels, + valuesCount: data.datasets[0].data.length + }); + + this.scale.setScaleSize(); + this.updateScaleRange(data.datasets); + this.scale.buildYLabels(); + }, + updateScaleRange: function(datasets){ + var valuesArray = (function(){ + var totalDataArray = []; + helpers.each(datasets,function(dataset){ + if (dataset.data){ + totalDataArray = totalDataArray.concat(dataset.data); + } + else { + helpers.each(dataset.points, function(point){ + totalDataArray.push(point.value); + }); + } + }); + return totalDataArray; + })(); + + + var scaleSizes = (this.options.scaleOverride) ? + { + steps: this.options.scaleSteps, + stepValue: this.options.scaleStepWidth, + min: this.options.scaleStartValue, + max: this.options.scaleStartValue + (this.options.scaleSteps * this.options.scaleStepWidth) + } : + helpers.calculateScaleRange( + valuesArray, + helpers.min([this.chart.width, this.chart.height])/2, + this.options.scaleFontSize, + this.options.scaleBeginAtZero, + this.options.scaleIntegersOnly + ); + + helpers.extend( + this.scale, + scaleSizes + ); + + }, + addData : function(valuesArray,label){ + //Map the values array for each of the datasets + this.scale.valuesCount++; + helpers.each(valuesArray,function(value,datasetIndex){ + var pointPosition = this.scale.getPointPosition(this.scale.valuesCount, this.scale.calculateCenterOffset(value)); + this.datasets[datasetIndex].points.push(new this.PointClass({ + value : value, + label : label, + x: pointPosition.x, + y: pointPosition.y, + strokeColor : this.datasets[datasetIndex].pointStrokeColor, + fillColor : this.datasets[datasetIndex].pointColor + })); + },this); + + this.scale.labels.push(label); + + this.reflow(); + + this.update(); + }, + removeData : function(){ + this.scale.valuesCount--; + this.scale.labels.shift(); + helpers.each(this.datasets,function(dataset){ + dataset.points.shift(); + },this); + this.reflow(); + this.update(); + }, + update : function(){ + this.eachPoints(function(point){ + point.save(); + }); + this.reflow(); + this.render(); + }, + reflow: function(){ + helpers.extend(this.scale, { + width : this.chart.width, + height: this.chart.height, + size : helpers.min([this.chart.width, this.chart.height]), + xCenter: this.chart.width/2, + yCenter: this.chart.height/2 + }); + this.updateScaleRange(this.datasets); + this.scale.setScaleSize(); + this.scale.buildYLabels(); + }, + draw : function(ease){ + var easeDecimal = ease || 1, + ctx = this.chart.ctx; + this.clear(); + this.scale.draw(); + + helpers.each(this.datasets,function(dataset){ + + //Transition each point first so that the line and point drawing isn't out of sync + helpers.each(dataset.points,function(point,index){ + if (point.hasValue()){ + point.transition(this.scale.getPointPosition(index, this.scale.calculateCenterOffset(point.value)), easeDecimal); + } + },this); + + + + //Draw the line between all the points + ctx.lineWidth = this.options.datasetStrokeWidth; + ctx.strokeStyle = dataset.strokeColor; + ctx.beginPath(); + helpers.each(dataset.points,function(point,index){ + if (index === 0){ + ctx.moveTo(point.x,point.y); + } + else{ + ctx.lineTo(point.x,point.y); + } + },this); + ctx.closePath(); + ctx.stroke(); + + ctx.fillStyle = dataset.fillColor; + ctx.fill(); + + //Now draw the points over the line + //A little inefficient double looping, but better than the line + //lagging behind the point positions + helpers.each(dataset.points,function(point){ + if (point.hasValue()){ + point.draw(); + } + }); + + },this); + + } + + }); + + + + + +}).call(this); \ No newline at end of file diff --git a/app/assets/javascripts/admin.coffee b/app/assets/javascripts/admin.coffee new file mode 100644 index 0000000..7a571ec --- /dev/null +++ b/app/assets/javascripts/admin.coffee @@ -0,0 +1,861 @@ +#= require app +#= require jquery_ujs +#= require vendor/jquery-ui +# require turbolinks + +#= require event_form + + +# require vendor/jquery-sortable + +#= require vendor/bootstrap-slider +#= require vendor/jquery.ui.widget +#= require vendor/tmpl.min +#= require vendor/jquery.iframe-transport +#= require vendor/jquery.fileupload +#= require vendor/jquery.fileupload-ui +#= require vendor/jquery.fileupload-process +#= require vendor/select2.min +#= require vendor/accounting +#= require vendor/jquery.mask +#= require vendor/datatables.min +#= require vendor/jszip.min +#= require vendor/dataTables.buttons +#= require vendor/buttons.bootstrap.min +#= require vendor/buttons.bootstrap4.min +#= require vendor/buttons.colVis.min +#= require vendor/buttons.flash.min +#= require vendor/buttons.html5.min +#= require vendor/buttons.print.min +#= require vendor/buttons.semanticui.min + + + +#= require dropzone + + +#= require bootstrap/datetimepicker + +#= require manager +#= require image_files + +#= require pane_hover + + +#= require redactor +#= require_tree ./redactor_plugins + +#= require nested_fields +#= require Chart + +#= require admin/trunk8.js + + + +#= require vendor/Chart.bundle + +#= require freeze-table + + + + + +active_timer_watcher = true + +idleTime = 0 + +timerIncrement = -> + + idleTime = idleTime + 1 + if idleTime > 20 + active_timer_watcher = false + else + active_timer_watcher = true + return + + + + +@timer_watcher = (p_customer_id, admin_space, element_type, element_id, key) -> + + + if active_timer_watcher + $.ajax + url:"/admin/timer_watchers.js", + type : "POST", + data : {timer_watcher : {'p_customer_id' : p_customer_id,'admin_space' : admin_space,'element_type' : element_type, 'element_id' : element_id, 'key' : key}} + + + + + +@set_table_header = -> + header_size = $("#qi_header_wrapper").outerHeight() + + header_size = header_size - 4 + + + + +$ -> + + #$('.data_table').DataTable + # info: false + # scrollX: true + #scrollY: "800px" + # scrollCollapse: false + # paging: false + # ordering: false + # keys: true + # fixedHeader: true + # searching: false + # colReorder: true + + #fixedColumns: + # leftColumns: 2 + # rightColumns: 1 + + + $(window).on "resize", -> + resize() + set_table_header() + + + + + + + + + + resize() + set_table_header() + + + +@resize = () -> + header_size = $("#admin_nav").outerHeight() + + header_size = $("#qi_header_wrapper").outerHeight() + + $("body").css("padding-top", header_size+"px") + + table_size = ($(window).height() - $("#qi_header_wrapper").outerHeight() - 100)+"px" + + + + + +portlet_to_move = false +content_type_to_move =false +window.disable_portlet_select = false +window.portlet_change = false + + +@edit_watcher = (element_type, element_id, key) -> + + $.ajax + url:"/admin/edit_watchers.js", + type : "POST", + data : {edit_watcher : {'element_type' : element_type, 'element_id' : element_id, 'key' : key}} + + +@init_form_change = -> + window.disable_portlet_select = true + window.portlet_change = true + + + +$(window).on 'beforeunload', -> + if window.portlet_change == true + return 'Les modifications que vous avez apportées ne seront peut-être pas enregistrées, avez-vous bien enregistré votre modification ?' + + + + +@reset_form_change = -> + window.disable_portlet_select = false + window.portlet_change = false + +@open_collapse3 = -> + $("#collapse3 .panel").show() + $("#collapse3").show() + +@reset_edit_pane = -> + $("#element_form").html() + $("#collapse3").hide() + +@unselect_portlet = -> + $(".portlet.active").removeClass("active") + reset_edit_pane() + +@cancel_move_portlet = -> + $(".move_message").show() + $(".cancel_message").hide() + + $(".move").removeClass("move") + $(".portlet_placeholder").remove() + portlet_to_move = false + +@adjust_trunk = -> + #$('.trunk').trunk8(); + + + + +@init_video_files_drag = -> + video_to_drag_id = null + $( "#video_files .video_file").draggable + containment: "document", + appendTo: "body", + revert : "invalid", + cursor: "move", + cursorAt: { top: -2, left: -8 }, + + + drag: ( event, ui ) -> + multiple_ids = multiple_selection_ids() + + video_to_drag_id = $(this).data("id") + + nbr = 1 #multiple_ids.length + if nbr > 1 + ui.helper.html(nbr+" videos") + else + ui.helper.html(nbr+" video") + + start: ( event, ui ) -> + $(this).addClass("active") + $( ".selector" ).draggable( "option", "helper", "clone" ); + $( "#video_files .active").css("opacity", "0.5"); + + stop: ( event, ui ) -> + $(this).addClass("active") + $( ".selector" ).draggable( "option", "helper", "clone" ); + $( "#video_files .active").css("opacity", "1"); + + helper: (event) -> + + multiple_ids = multiple_selection_ids() + nbr = multiple_ids.length + + if nbr > 1 + return $( "
"+nbr+" images
" ) + else + return $( "
"+nbr+" image
" ) + + $( ".video_file_receptable" ).droppable({ + accept: ".video_file", + drop: ( event, ui ) -> + video_folder_id = $(this).data("video_folder_id") + + + $.ajax + url:"/admin/video_folders/"+video_folder_id+"/change_video_folder.js", + type : "GET", + data : {video_files_id : [video_to_drag_id]}, + success : (code_html, statut) -> + $("#video_files .active").remove() + update_multiple_selection_text(); + + $("#video_files .active").remove() + update_multiple_selection_text(); + $(this).removeClass("hover") + + + + over: ( event, ui ) -> + $(this).addClass("hover") + out: ( event, ui ) -> + $(this).removeClass("hover") + + }); + + +@init_image_files_drag = -> + + $( "#image_files .image_file").draggable + containment: "document", + appendTo: "body", + revert : "invalid", + cursor: "move", + cursorAt: { top: -2, left: -8 }, + + + drag: ( event, ui ) -> + multiple_ids = multiple_selection_ids() + nbr = multiple_ids.length + if nbr > 1 + ui.helper.html(nbr+" images") + else + ui.helper.html(nbr+" image") + + start: ( event, ui ) -> + $(this).addClass("active") + $( ".selector" ).draggable( "option", "helper", "clone" ); + $( "#image_files .active").css("opacity", "0.5"); + + stop: ( event, ui ) -> + $(this).addClass("active") + $( ".selector" ).draggable( "option", "helper", "clone" ); + $( "#image_files .active").css("opacity", "1"); + + helper: (event) -> + + multiple_ids = multiple_selection_ids() + nbr = multiple_ids.length + + if nbr > 1 + return $( "
"+nbr+" images
" ) + else + return $( "
"+nbr+" image
" ) + + $( ".image_file_receptable" ).droppable({ + accept: ".image_file", + drop: ( event, ui ) -> + album_id = $(this).attr("data_album_id") + images_id = multiple_selection_ids() + + $.ajax + url:"/admin/albums/"+album_id+"/change_album.js", + type : "GET", + data : {image_files_id : images_id}, + success : (code_html, statut) -> + alert("t") + $("#image_files .active").remove() + update_multiple_selection_text(); + + $("#image_files .active").remove() + update_multiple_selection_text(); + $(this).removeClass("hover") + + + + over: ( event, ui ) -> + $(this).addClass("hover") + out: ( event, ui ) -> + $(this).removeClass("hover") + + }); + + +$(document).ready -> + adjust_trunk() + + $(document).on 'click', 'input.datepicker', -> + $(this).datetimepicker( + language: 'fr' + pickTime: false + ).focus(); + + $(document).on 'click', 'input.datetimepicker', -> + $(this).datetimepicker( + use24hours: true + format: 'DD/MM/YYYY HH:mm' + minuteStepping:15 + language: 'fr' + ).focus(); + + + $(document).on 'click', 'input.timepicker', -> + $(this).datetimepicker( + use24hours: true + format: 'DD/MM/YYYY hh:mm' + minuteStepping:15 + pickDate: false + language: 'fr' + ).focus(); + + + + + + + $(document).on "click", ".portlet", (event) -> + if !$(this).hasClass("active") and portlet_to_move == false and window.disable_portlet_select == false + + $(".portlet.active").removeClass("active") + $(this).addClass("active") + + + $.ajax({url : $(this).data("edit-link"), type: "GET"}); + $("#collapse3 .trash").attr("href", $(this).data("show-link")); + + event.stopPropagation(); + + $(document).on "click", ".block_portlets", (event) -> + if portlet_to_move == false and window.disable_portlet_select == false + portlet_to_move = false + content_type_to_move = false + $("#element_form").html("") + + $(".portlet.active").removeClass("active") + reset_edit_pane() + + + + + + $(document).on "change", "#element_form form", -> + init_form_change() + + $(document).on "keydown", "#element_form form", -> + init_form_change() + + + $(document).on "keyup", "#element_form form", -> + init_form_change() + + + + $(document).on "click", "#content_types .content_type", -> + if window.portlet_change == false + cancel_move_portlet() + unselect_portlet() + reset_edit_pane() + window.disable_portlet_select = true + + + type = $(this).data("type") + content_type_to_move = type + init_portlets_place_holder() + $(this).addClass("move") + false + + + + $(document).on "click", ".portlet_handle", -> + if portlet_to_move == false + + $(".move_message").hide() + $(".cancel_message").show() + + + id = $(this).data("portlet-id") + portlet_to_move = $("#portlet_"+id) + init_portlets_place_holder() + portlet_to_move.addClass("move") + false + else + cancel_move_portlet() + + false + + $(document).on "click", ".portlet_placeholder", -> + if portlet_to_move != false + $(this).after portlet_to_move + $(".move").removeClass("move") + $(".portlet_placeholder").remove() + update_block_portlet_order(portlet_to_move.closest(".block_portlets").data("block_id")) + cancel_move_portlet() + else + window.portlet_change = true + #alert window.portlet_change + block_id = $(this).closest(".block_portlets").data("block_id") + + + $(this).replaceWith('
'); + + $.ajax({ + url:"/portlet/portlets/new.js", + type: "GET", + data: { + block_id : block_id, + position : $(this).attr("data_position"), + content_type : content_type_to_move + } + + }) + content_type_to_move = false + $(".portlet_placeholder").remove() + + + + +@init_portlets_place_holder = -> + placeholder = '
' + $(".block_portlets").each -> + $(this).find(".portlet_placeholder").remove() + $(this).prepend(placeholder) + $(this).find(".portlet").each -> + $(this).after(placeholder) + + + + +@flash_delay = -> + $("#flashs").find(".alert").each -> + + if !$(this).hasClass("delay") + $(this).addClass("delay") + $(this).delay(3000).fadeOut(); + + + +@init_menu_items_list = -> + + oldContainer = "" + + dropped = false; + draggable_sibling = ""; + + $("#sortable_menu_item").sortable + handle : ".handle" + containment: "document", + tolerance: 'intersect' + start: (event, ui)-> + dropped = false + true + stop: (event, ui) -> + if dropped == false + sortable_data = {parent_id :$("#sortable_menu_item").data("parent-id"), menu_id :$("#sortable_menu_item").data("menu-id") , menu_items_ids : []} + + $("#sortable_menu_item").find(".menu_item_row").each -> + sortable_data.menu_items_ids.push $(this).data("menu-item-id") + + + $.ajax({url : "/admin/menu_items/reorder", data : sortable_data, type: "POST"}); + + + + + + $(".receptable").droppable + #activeClass: 'active', + hoverClass:'hovered', + tolerance: 'pointer', + greedy: true, + over: (event,ui) -> + $(".ui-sortable-placeholder").remove() + drop: (event,ui) -> + dropped = true; + + parent_id = $(this).data("parent-id") + menu_id = $(this).data("menu-id") + id = ui.draggable.data("menu-item-id") + + $.ajax({ + url:"/admin/menu_items/"+id+".js", + type: "PUT", + data: { + reorder : true, + menu_item : { + parent_id : parent_id, + menu_id : menu_id + } + }, + success : -> + #f + + + + }) + ui.draggable.remove() + + + + + + +@init_investigation_cats_list = -> + + oldContainer = "" + + dropped = false; + draggable_sibling = ""; + + $("#sortable_investigation_cat").sortable + handle : ".handle" + containment: "document", + tolerance: 'intersect' + start: (event, ui)-> + dropped = false + true + stop: (event, ui) -> + if dropped == false + sortable_data = {parent_id :$("#sortable_investigation_cat").data("parent-id"), menu_id :$("#sortable_investigation_cat").data("menu-id") , investigation_cats_ids : []} + + $("#sortable_investigation_cat").find(".investigation_cat_row").each -> + sortable_data.investigation_cats_ids.push $(this).data("menu-item-id") + + + $.ajax({url : "/admin/investigation_cats/reorder", data : sortable_data, type: "POST"}); + + + + + + $(".receptable").droppable + #activeClass: 'active', + hoverClass:'hovered', + tolerance: 'pointer', + greedy: true, + over: (event,ui) -> + $(".ui-sortable-placeholder").remove() + drop: (event,ui) -> + dropped = true; + + parent_id = $(this).data("parent-id") + menu_id = $(this).data("menu-id") + id = ui.draggable.data("menu-item-id") + + $.ajax({ + url:"/admin/investigation_cats/"+id+".js", + type: "PUT", + data: { + reorder : true, + investigation_cat : { + parent_id : parent_id, + menu_id : menu_id + } + }, + success : -> + #f + + + + }) + ui.draggable.remove() + + + + + +@update_block_portlet_order = (block_portlet_id) -> + return_order = [] + + block_portlet = $("#block_portlet_"+block_portlet_id) + + block_data = {block_id : block_portlet.data('block_id'), block_portlet_ids : []} + + block_portlet.children('.portlet').each -> + if $(this).data('portlet_id') + block_data.block_portlet_ids.push($(this).data('portlet_id')) + + + + return_order.push(block_data); + + + + $.ajax({url : "/portlet/portlets/reorder", data : {blocks:return_order}, type: "POST"}) + + +jQuery -> + + $(".inline-contenteditable").keypress (e) -> + if e.which == 13 + false + else + $(this).html($(this).text()) + return true + + + $(document).on 'click', ".portlet_title_content .inline-contenteditable", () -> + + $.ajax + url : "/portlet/title_contents/"+$(this).data("title-id")+"/edit.js", + type: "GET", + + $(document).on 'blur keyup paste', ".portlet_title_content .inline-contenteditable", () -> + $(this).html($(this).text()) + $.ajax + url : "/portlet/title_contents/"+$(this).data("title-id"), + type: "PUT", + data : + title_content : + content : $(this).html() + + + + + $(".sortable").sortable({ + + containerSelector :".block", + itemSelector:".portlet", + handle: ".handle", + nested:true, + placeholder:"
" + + }) + + + + + + flash_delay(); + + + item_catched = "" + + + adjustment = "" + + $("#menu_item_inspector_container").sortable({ + + + itemSelector:"#menu_item_informations", + pullPlaceholder :false, + placeholder : "", + handle: ".inspector_handle", + onDragStart: ($item, container, _super) -> + $item.css({ + height: $item.height(), + width: $item.width() + }) + + $("body").addClass("dragging") + + offset = $item.offset() + pointer = container.rootGroup.pointer + adjustment = { + left: pointer.left - offset.left, + top: pointer.top - offset.top + } + + onCancel : ($item, container, _super) -> + $item.css(position) + $item.removeClass("dragged") + $("body").removeClass("dragging") + + onDrag: ($item, position, _super) -> + + $item.css({ + left: position.left - adjustment.left, + top: position.top - adjustment.top - $(window).scrollTop() + }) + + + + + + }) + + + + +$ -> + $(window).on "resize", -> + resize() + + + + resize() + +$(document).on "scroll", () -> + + if( $(this).scrollTop() <= 52 ) + top = 52 - $(this).scrollTop() + else + top = 0 + + $("#toolbar-text, #menu_item_informations").css + top : top + +$(document).on "click", "#menu_item_informations .save", -> + $(this).closest(".panel").find("form").submit() + return false + +$(document).on "click", "#menu_item_informations h4", -> + $(this).next(".panel").toggle() + return false + + + +@init_p_product_sub_cats_list = -> + + oldContainer = "" + + dropped = false; + draggable_sibling = ""; + + $("#sortable_p_product_sub_cat").sortable + handle : ".handle" + containment: "document", + tolerance: 'intersect' + start: (event, ui)-> + dropped = false + true + stop: (event, ui) -> + if dropped == false + sortable_data = {parent_id :$("#sortable_p_product_sub_cat").data("parent-id"), menu_id :$("#sortable_p_product_sub_cat").data("menu-id") , p_product_sub_cats_ids : []} + + $("#sortable_p_product_sub_cat").find(".p_product_sub_cat_row").each -> + sortable_data.p_product_sub_cats_ids.push $(this).data("menu-item-id") + + + $.ajax({url : "/admin/p_product_sub_cats/reorder", data : sortable_data, type: "POST"}); + + + + + + $(".receptable").droppable + #activeClass: 'active', + hoverClass:'hovered', + tolerance: 'pointer', + greedy: true, + over: (event,ui) -> + $(".ui-sortable-placeholder").remove() + drop: (event,ui) -> + dropped = true; + + parent_id = $(this).data("parent-id") + menu_id = $(this).data("menu-id") + id = ui.draggable.data("menu-item-id") + + $.ajax({ + url:"/admin/p_product_sub_cats/"+id+".js", + type: "PUT", + data: { + reorder : true, + p_product_sub_cat : { + parent_id : parent_id, + menu_id : menu_id + } + }, + success : -> + #f + + + + }) + ui.draggable.remove() + +$(".datepicker").autocomplete({ + disabled: true + }); + +$(document).on 'click', '.datepicker', (e) -> + $(this).attr("autocomplete", "off") + + + + +@qi_autocomplete = (autocomplete_object) -> + + $('.' + autocomplete_object + '_autocomplete_input').autocomplete + source: (request, response) -> + $.ajax + url: '/admin/' + autocomplete_object + 's/autocomplete.json' + dataType: 'json' + data: search: request.term + success: (data) -> + arr = jQuery.map(data, (item) -> + { + label: item.member_label + value: item.member_label + id: item.id + } + ) + response arr + return + return + minLength: 2 + select: (event, ui) -> + $(this).next('.' + autocomplete_object + '_id').val ui.item.id + return + return + + + diff --git a/app/assets/javascripts/admin/donators.coffee b/app/assets/javascripts/admin/donators.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/admin/donators.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/javascripts/admin/trunk8.js b/app/assets/javascripts/admin/trunk8.js new file mode 100644 index 0000000..7d546b1 --- /dev/null +++ b/app/assets/javascripts/admin/trunk8.js @@ -0,0 +1,270 @@ +/**! + * trunk8 v1.3.2 + * https://github.com/rviscomi/trunk8 + * + * Copyright 2012 Rick Viscomi + * Released under the MIT License. + * + * Date: October 21, 2012 + */ + +(function ($) { + var methods, + utils, + SIDES = { + /* cen...ter */ + center: 'center', + /* ...left */ + left: 'left', + /* right... */ + right: 'right' + }, + WIDTH = { + auto: 'auto' + }; + + function trunk8(element) { + this.$element = $(element); + this.original_text = this.$element.html(); + this.settings = $.extend({}, $.fn.trunk8.defaults); + } + + trunk8.prototype.updateSettings = function (options) { + this.settings = $.extend(this.settings, options); + }; + + function truncate() { + var data = this.data('trunk8'), + settings = data.settings, + width = settings.width, + side = settings.side, + fill = settings.fill, + line_height = utils.getLineHeight(this) * settings.lines, + str = data.original_text, + length = str.length, + max_bite = '', + lower, upper, + bite_size, + bite; + + /* Reset the field to the original string. */ + this.html(str); + + if (width === WIDTH.auto) { + /* Assuming there is no "overflow: hidden". */ + if (this.height() <= line_height) { + /* Text is already at the optimal trunkage. */ + return; + } + + /* Binary search technique for finding the optimal trunkage. */ + /* Find the maximum bite without overflowing. */ + lower = 0; + upper = length - 1; + + while (lower <= upper) { + bite_size = lower + ((upper - lower) >> 1); + + bite = utils.eatStr(str, side, length - bite_size, fill); + + this.html(bite); + + /* Check for overflow. */ + if (this.height() > line_height) { + upper = bite_size - 1; + } + else { + lower = bite_size + 1; + + /* Save the bigger bite. */ + max_bite = (max_bite.length > bite.length) ? max_bite : bite; + } + } + + /* Reset the content to eliminate possible existing scroll bars. */ + this.html(''); + + /* Display the biggest bite. */ + this.html(max_bite); + + if (settings.tooltip) { + this.attr('title', str); + } + } + else if (!isNaN(width)) { + bite_size = length - width; + + bite = utils.eatStr(str, side, bite_size, fill); + + this.html(bite); + + if (settings.tooltip) { + this.attr('title', str); + } + } + else { + $.error('Invalid width "' + width + '".'); + } + } + + methods = { + init: function (options) { + return this.each(function () { + var $this = $(this), + data = $this.data('trunk8'); + + if (!data) { + $this.data('trunk8', (data = new trunk8(this))); + } + + data.updateSettings(options); + + truncate.call($this); + }); + }, + + /** Updates the text value of the elements while maintaining truncation. */ + update: function (new_string) { + return this.each(function () { + var $this = $(this); + + /* Update text. */ + if (new_string) { + $this.data('trunk8').original_text = new_string; + } + + /* Truncate accordingly. */ + truncate.call($this); + }); + }, + + revert: function () { + return this.each(function () { + /* Get original text. */ + var text = $(this).data('trunk8').original_text; + + /* Revert element to original text. */ + $(this).html(text); + }); + }, + + /** Returns this instance's settings object. NOT CHAINABLE. */ + getSettings: function () { + return this.get(0).data('trunk8').settings; + } + }; + + utils = { + /** Replaces [bite_size] [side]-most chars in [str] with [fill]. */ + eatStr: function (str, side, bite_size, fill) { + var length = str.length, + key = utils.eatStr.generateKey.apply(null, arguments), + half_length, + half_bite_size; + + /* If the result is already in the cache, return it. */ + if (utils.eatStr.cache[key]) { + return utils.eatStr.cache[key]; + } + + /* Common error handling. */ + if ((typeof str !== 'string') || (length === 0)) { + $.error('Invalid source string "' + str + '".'); + } + if ((bite_size < 0) || (bite_size > length)) { + $.error('Invalid bite size "' + bite_size + '".'); + } + else if (bite_size === 0) { + /* No bite should show no truncation. */ + return str; + } + if (typeof (fill + '') !== 'string') { + $.error('Fill unable to be converted to a string.'); + } + + /* Compute the result, store it in the cache, and return it. */ + switch (side) { + case SIDES.right: + /* str... */ + return utils.eatStr.cache[key] = + $.trim(str.substr(0, length - bite_size)) + fill; + + case SIDES.left: + /* ...str */ + return utils.eatStr.cache[key] = + fill + $.trim(str.substr(bite_size)); + + case SIDES.center: + /* Bit-shift to the right by one === Math.floor(x / 2) */ + half_length = length >> 1; // halve the length + half_bite_size = bite_size >> 1; // halve the bite_size + + /* st...r */ + return utils.eatStr.cache[key] = + $.trim(utils.eatStr(str.substr(0, length - half_length), SIDES.right, bite_size - half_bite_size, '')) + + fill + + $.trim(utils.eatStr(str.substr(length - half_length), SIDES.left, half_bite_size, '')); + + default: + $.error('Invalid side "' + side + '".'); + } + }, + + getLineHeight: function (elem) { + var $elem = $(elem), + floats = $elem.css('float'), + position = $elem.css('position'), + html = $elem.html(), + wrapper_id = 'line-height-test', + line_height; + + if (floats !== 'none') { + $elem.css('float', 'none'); + } + + if (position === 'absolute') { + $elem.css('position', 'static'); + } + + /* Set the content to a small single character and wrap. */ + $elem.html('i').wrap('
'); + + /* Calculate the line height by measuring the wrapper.*/ + line_height = $('#' + wrapper_id).innerHeight(); + + /* Remove the wrapper and reset the style/content. */ + $elem.html(html).css({ + 'float': floats, + 'position': position + }).unwrap(); + + return line_height; + } + }; + + utils.eatStr.cache = {}; + utils.eatStr.generateKey = function () { + return Array.prototype.join.call(arguments, ''); + }; + + $.fn.trunk8 = function (method) { + if (methods[method]) { + return methods[method].apply(this, Array.prototype.slice.call(arguments, 1)); + } + else if (typeof method === 'object' || !method) { + return methods.init.apply(this, arguments); + } + else { + $.error('Method ' + method + ' does not exist on jQuery.trunk8'); + } + }; + + /* Default trunk8 settings. */ + $.fn.trunk8.defaults = { + fill: '…', + lines: 1, + side: SIDES.right, + tooltip: true, + width: WIDTH.auto + }; +})(jQuery); diff --git a/app/assets/javascripts/app.js b/app/assets/javascripts/app.js new file mode 100644 index 0000000..78d2430 --- /dev/null +++ b/app/assets/javascripts/app.js @@ -0,0 +1,3 @@ +/*! For license information please see app.js.LICENSE.txt */ +!function(t){var e={};function n(l){if(e[l])return e[l].exports;var a=e[l]={i:l,l:!1,exports:{}};return t[l].call(a.exports,a,a.exports,n),a.l=!0,a.exports}n.m=t,n.c=e,n.d=function(t,e,l){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:l})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var l=Object.create(null);if(n.r(l),Object.defineProperty(l,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)n.d(l,a,function(e){return t[e]}.bind(null,a));return l},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=137)}([function(t,e){t.exports=function(t){function e(t){"undefined"!=typeof console&&(console.error||console.log)("[Script Loader]",t)}try{"undefined"!=typeof execScript&&"undefined"!=typeof attachEvent&&"undefined"==typeof addEventListener?execScript(t):"undefined"!=typeof eval?eval.call(null,t):e("EvalError: No eval function available")}catch(t){e(t)}}},function(t,e,n){(function(e){t.exports=e.jQuery=n(50)}).call(this,n(4))},function(t,e,n){var l=n(5);t.exports=function(t){if(!l(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e,n){var l=n(16)("wks"),a=n(17),i=n(3).Symbol,r="function"==typeof i;(t.exports=function(t){return l[t]||(l[t]=r&&i[t]||(r?i:a)("Symbol."+t))}).store=l},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e){var n=t.exports={version:"2.6.11"};"number"==typeof __e&&(__e=n)},function(t,e,n){"use strict";var l,a,i=n(28),r=RegExp.prototype.exec,o=String.prototype.replace,s=r,c=(l=/a/,a=/b*/g,r.call(l,"a"),r.call(a,"a"),0!==l.lastIndex||0!==a.lastIndex),d=void 0!==/()??/.exec("")[1];(c||d)&&(s=function(t){var e,n,l,a,s=this;return d&&(n=new RegExp("^"+s.source+"$(?!\\s)",i.call(s))),c&&(e=s.lastIndex),l=r.call(s,t),c&&l&&(s.lastIndex=s.global?l.index+l[0].length:e),d&&l&&l.length>1&&o.call(l[0],n,(function(){for(a=1;a0?l:n)(t)}},function(t,e,n){"use strict";var l=n(25),a=RegExp.prototype.exec;t.exports=function(t,e){var n=t.exec;if("function"==typeof n){var i=n.call(t,e);if("object"!=typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==l(t))throw new TypeError("RegExp#exec called on incompatible receiver");return a.call(t,e)}},function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},function(t,e,n){var l=n(8),a=n(3),i=a["__core-js_shared__"]||(a["__core-js_shared__"]={});(t.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:l.version,mode:n(26)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,e){var n=0,l=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+l).toString(36))}},function(t,e,n){"use strict";n(27);var l=n(19),a=n(10),i=n(7),r=n(12),o=n(6),s=n(9),c=o("species"),d=!i((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")})),u=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2===n.length&&"a"===n[0]&&"b"===n[1]}();t.exports=function(t,e,n){var h=o(t),p=!i((function(){var e={};return e[h]=function(){return 7},7!=""[t](e)})),f=p?!i((function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[c]=function(){return n}),n[h](""),!e})):void 0;if(!p||!f||"replace"===t&&!d||"split"===t&&!u){var g=/./[h],m=n(r,h,""[t],(function(t,e,n,l,a){return e.exec===s?p&&!a?{done:!0,value:g.call(e,n,l)}:{done:!0,value:t.call(n,e,l)}:{done:!1}})),v=m[0],b=m[1];l(String.prototype,t,v),a(RegExp.prototype,h,2==e?function(t,e){return b.call(t,this,e)}:function(t){return b.call(t,this)})}}},function(t,e,n){var l=n(3),a=n(10),i=n(35),r=n(17)("src"),o=n(36),s=(""+o).split("toString");n(8).inspectSource=function(t){return o.call(t)},(t.exports=function(t,e,n,o){var c="function"==typeof n;c&&(i(n,"name")||a(n,"name",e)),t[e]!==n&&(c&&(i(n,r)||a(n,r,t[e]?""+t[e]:s.join(String(e)))),t===l?t[e]=n:o?t[e]?t[e]=n:a(t,e,n):(delete t[e],a(t,e,n)))})(Function.prototype,"toString",(function(){return"function"==typeof this&&this[r]||o.call(this)}))},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,n){var l=n(13),a=Math.min;t.exports=function(t){return t>0?a(l(t),9007199254740991):0}},function(t,e,n){"use strict";var l=n(24)(!0);t.exports=function(t,e,n){return e+(n?l(t,e).length:1)}},function(t,e,n){(function(t){t.exports=function(){"use strict";var e,n;function l(){return e.apply(null,arguments)}function a(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function i(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function o(t){if(Object.getOwnPropertyNames)return 0===Object.getOwnPropertyNames(t).length;var e;for(e in t)if(r(t,e))return!1;return!0}function s(t){return void 0===t}function c(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function d(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function u(t,e){var n,l=[];for(n=0;n>>0;for(e=0;e0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+l}l.suppressDeprecationWarnings=!1,l.deprecationHandler=null,C=Object.keys?Object.keys:function(t){var e,n=[];for(e in t)r(t,e)&&n.push(e);return n};var I=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,R=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,P={},j={};function O(t,e,n,l){var a=l;"string"==typeof l&&(a=function(){return this[l]()}),t&&(j[t]=a),e&&(j[e[0]]=function(){return A(a.apply(this,arguments),e[1],e[2])}),n&&(j[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),t)})}function N(t,e){return t.isValid()?(e=L(e,t.localeData()),P[e]=P[e]||function(t){var e,n,l,a=t.match(I);for(e=0,n=a.length;e=0&&R.test(t);)t=t.replace(R,l),R.lastIndex=0,n-=1;return t}var F={};function B(t,e){var n=t.toLowerCase();F[n]=F[n+"s"]=F[e]=t}function H(t){return"string"==typeof t?F[t]||F[t.toLowerCase()]:void 0}function q(t){var e,n,l={};for(n in t)r(t,n)&&(e=H(n))&&(l[e]=t[n]);return l}var z={};function Z(t,e){z[t]=e}function $(t){return t%4==0&&t%100!=0||t%400==0}function W(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function V(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=W(e)),n}function Y(t,e){return function(n){return null!=n?(G(this,t,n),l.updateOffset(this,e),this):U(this,t)}}function U(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function G(t,e,n){t.isValid()&&!isNaN(n)&&("FullYear"===e&&$(t.year())&&1===t.month()&&29===t.date()?(n=V(n),t._d["set"+(t._isUTC?"UTC":"")+e](n,t.month(),_t(n,t.month()))):t._d["set"+(t._isUTC?"UTC":"")+e](n))}var X,K=/\d/,Q=/\d\d/,J=/\d{3}/,tt=/\d{4}/,et=/[+-]?\d{6}/,nt=/\d\d?/,lt=/\d\d\d\d?/,at=/\d\d\d\d\d\d?/,it=/\d{1,3}/,rt=/\d{1,4}/,ot=/[+-]?\d{1,6}/,st=/\d+/,ct=/[+-]?\d+/,dt=/Z|[+-]\d\d:?\d\d/gi,ut=/Z|[+-]\d\d(?::?\d\d)?/gi,ht=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function pt(t,e,n){X[t]=T(e)?e:function(t,l){return t&&n?n:e}}function ft(t,e){return r(X,t)?X[t](e._strict,e._locale):new RegExp(gt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(t,e,n,l,a){return e||n||l||a}))))}function gt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}X={};var mt,vt={};function bt(t,e){var n,l=e;for("string"==typeof t&&(t=[t]),c(e)&&(l=function(t,n){n[e]=V(t)}),n=0;n68?1900:2e3)};var Rt=Y("FullYear",!0);function Pt(t,e,n,l,a,i,r){var o;return t<100&&t>=0?(o=new Date(t+400,e,n,l,a,i,r),isFinite(o.getFullYear())&&o.setFullYear(t)):o=new Date(t,e,n,l,a,i,r),o}function jt(t){var e,n;return t<100&&t>=0?((n=Array.prototype.slice.call(arguments))[0]=t+400,e=new Date(Date.UTC.apply(null,n)),isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t)):e=new Date(Date.UTC.apply(null,arguments)),e}function Ot(t,e,n){var l=7+e-n;return-(7+jt(t,0,l).getUTCDay()-e)%7+l-1}function Nt(t,e,n,l,a){var i,r,o=1+7*(e-1)+(7+n-l)%7+Ot(t,l,a);return o<=0?r=It(i=t-1)+o:o>It(t)?(i=t+1,r=o-It(t)):(i=t,r=o),{year:i,dayOfYear:r}}function Lt(t,e,n){var l,a,i=Ot(t.year(),e,n),r=Math.floor((t.dayOfYear()-i-1)/7)+1;return r<1?l=r+Ft(a=t.year()-1,e,n):r>Ft(t.year(),e,n)?(l=r-Ft(t.year(),e,n),a=t.year()+1):(a=t.year(),l=r),{week:l,year:a}}function Ft(t,e,n){var l=Ot(t,e,n),a=Ot(t+1,e,n);return(It(t)-l+a)/7}function Bt(t,e){return t.slice(e,7).concat(t.slice(0,e))}O("w",["ww",2],"wo","week"),O("W",["WW",2],"Wo","isoWeek"),B("week","w"),B("isoWeek","W"),Z("week",5),Z("isoWeek",5),pt("w",nt),pt("ww",nt,Q),pt("W",nt),pt("WW",nt,Q),yt(["w","ww","W","WW"],(function(t,e,n,l){e[l.substr(0,1)]=V(t)})),O("d",0,"do","day"),O("dd",0,0,(function(t){return this.localeData().weekdaysMin(this,t)})),O("ddd",0,0,(function(t){return this.localeData().weekdaysShort(this,t)})),O("dddd",0,0,(function(t){return this.localeData().weekdays(this,t)})),O("e",0,0,"weekday"),O("E",0,0,"isoWeekday"),B("day","d"),B("weekday","e"),B("isoWeekday","E"),Z("day",11),Z("weekday",11),Z("isoWeekday",11),pt("d",nt),pt("e",nt),pt("E",nt),pt("dd",(function(t,e){return e.weekdaysMinRegex(t)})),pt("ddd",(function(t,e){return e.weekdaysShortRegex(t)})),pt("dddd",(function(t,e){return e.weekdaysRegex(t)})),yt(["dd","ddd","dddd"],(function(t,e,n,l){var a=n._locale.weekdaysParse(t,l,n._strict);null!=a?e.d=a:f(n).invalidWeekday=t})),yt(["d","e","E"],(function(t,e,n,l){e[l]=V(t)}));var Ht="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),qt="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),zt="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Zt=ht,$t=ht,Wt=ht;function Vt(t,e,n){var l,a,i,r=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],l=0;l<7;++l)i=p([2e3,1]).day(l),this._minWeekdaysParse[l]=this.weekdaysMin(i,"").toLocaleLowerCase(),this._shortWeekdaysParse[l]=this.weekdaysShort(i,"").toLocaleLowerCase(),this._weekdaysParse[l]=this.weekdays(i,"").toLocaleLowerCase();return n?"dddd"===e?-1!==(a=mt.call(this._weekdaysParse,r))?a:null:"ddd"===e?-1!==(a=mt.call(this._shortWeekdaysParse,r))?a:null:-1!==(a=mt.call(this._minWeekdaysParse,r))?a:null:"dddd"===e?-1!==(a=mt.call(this._weekdaysParse,r))||-1!==(a=mt.call(this._shortWeekdaysParse,r))||-1!==(a=mt.call(this._minWeekdaysParse,r))?a:null:"ddd"===e?-1!==(a=mt.call(this._shortWeekdaysParse,r))||-1!==(a=mt.call(this._weekdaysParse,r))||-1!==(a=mt.call(this._minWeekdaysParse,r))?a:null:-1!==(a=mt.call(this._minWeekdaysParse,r))||-1!==(a=mt.call(this._weekdaysParse,r))||-1!==(a=mt.call(this._shortWeekdaysParse,r))?a:null}function Yt(){function t(t,e){return e.length-t.length}var e,n,l,a,i,r=[],o=[],s=[],c=[];for(e=0;e<7;e++)n=p([2e3,1]).day(e),l=gt(this.weekdaysMin(n,"")),a=gt(this.weekdaysShort(n,"")),i=gt(this.weekdays(n,"")),r.push(l),o.push(a),s.push(i),c.push(l),c.push(a),c.push(i);r.sort(t),o.sort(t),s.sort(t),c.sort(t),this._weekdaysRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+o.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+r.join("|")+")","i")}function Ut(){return this.hours()%12||12}function Gt(t,e){O(t,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)}))}function Xt(t,e){return e._meridiemParse}O("H",["HH",2],0,"hour"),O("h",["hh",2],0,Ut),O("k",["kk",2],0,(function(){return this.hours()||24})),O("hmm",0,0,(function(){return""+Ut.apply(this)+A(this.minutes(),2)})),O("hmmss",0,0,(function(){return""+Ut.apply(this)+A(this.minutes(),2)+A(this.seconds(),2)})),O("Hmm",0,0,(function(){return""+this.hours()+A(this.minutes(),2)})),O("Hmmss",0,0,(function(){return""+this.hours()+A(this.minutes(),2)+A(this.seconds(),2)})),Gt("a",!0),Gt("A",!1),B("hour","h"),Z("hour",13),pt("a",Xt),pt("A",Xt),pt("H",nt),pt("h",nt),pt("k",nt),pt("HH",nt,Q),pt("hh",nt,Q),pt("kk",nt,Q),pt("hmm",lt),pt("hmmss",at),pt("Hmm",lt),pt("Hmmss",at),bt(["H","HH"],3),bt(["k","kk"],(function(t,e,n){var l=V(t);e[3]=24===l?0:l})),bt(["a","A"],(function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t})),bt(["h","hh"],(function(t,e,n){e[3]=V(t),f(n).bigHour=!0})),bt("hmm",(function(t,e,n){var l=t.length-2;e[3]=V(t.substr(0,l)),e[4]=V(t.substr(l)),f(n).bigHour=!0})),bt("hmmss",(function(t,e,n){var l=t.length-4,a=t.length-2;e[3]=V(t.substr(0,l)),e[4]=V(t.substr(l,2)),e[5]=V(t.substr(a)),f(n).bigHour=!0})),bt("Hmm",(function(t,e,n){var l=t.length-2;e[3]=V(t.substr(0,l)),e[4]=V(t.substr(l))})),bt("Hmmss",(function(t,e,n){var l=t.length-4,a=t.length-2;e[3]=V(t.substr(0,l)),e[4]=V(t.substr(l,2)),e[5]=V(t.substr(a))}));var Kt,Qt=Y("Hours",!0),Jt={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:wt,monthsShort:St,week:{dow:0,doy:6},weekdays:Ht,weekdaysMin:zt,weekdaysShort:qt,meridiemParse:/[ap]\.?m?\.?/i},te={},ee={};function ne(t,e){var n,l=Math.min(t.length,e.length);for(n=0;n0;){if(l=ae(a.slice(0,e).join("-")))return l;if(n&&n.length>=e&&ne(a,n)>=e-1)break;e--}i++}return Kt}(t)}function se(t){var e,n=t._a;return n&&-2===f(t).overflow&&(e=n[1]<0||n[1]>11?1:n[2]<1||n[2]>_t(n[0],n[1])?2:n[3]<0||n[3]>24||24===n[3]&&(0!==n[4]||0!==n[5]||0!==n[6])?3:n[4]<0||n[4]>59?4:n[5]<0||n[5]>59?5:n[6]<0||n[6]>999?6:-1,f(t)._overflowDayOfYear&&(e<0||e>2)&&(e=2),f(t)._overflowWeeks&&-1===e&&(e=7),f(t)._overflowWeekday&&-1===e&&(e=8),f(t).overflow=e),t}var ce=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,de=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,ue=/Z|[+-]\d\d(?::?\d\d)?/,he=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],pe=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],fe=/^\/?Date\((-?\d+)/i,ge=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,me={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function ve(t){var e,n,l,a,i,r,o=t._i,s=ce.exec(o)||de.exec(o);if(s){for(f(t).iso=!0,e=0,n=he.length;e7)&&(s=!0)):(i=t._locale._week.dow,r=t._locale._week.doy,c=Lt(ke(),i,r),n=xe(e.gg,t._a[0],c.year),l=xe(e.w,c.week),null!=e.d?((a=e.d)<0||a>6)&&(s=!0):null!=e.e?(a=e.e+i,(e.e<0||e.e>6)&&(s=!0)):a=i),l<1||l>Ft(n,i,r)?f(t)._overflowWeeks=!0:null!=s?f(t)._overflowWeekday=!0:(o=Nt(n,l,a,i,r),t._a[0]=o.year,t._dayOfYear=o.dayOfYear)}(t),null!=t._dayOfYear&&(r=xe(t._a[0],a[0]),(t._dayOfYear>It(r)||0===t._dayOfYear)&&(f(t)._overflowDayOfYear=!0),n=jt(r,0,t._dayOfYear),t._a[1]=n.getUTCMonth(),t._a[2]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=o[e]=a[e];for(;e<7;e++)t._a[e]=o[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[3]&&0===t._a[4]&&0===t._a[5]&&0===t._a[6]&&(t._nextDay=!0,t._a[3]=0),t._d=(t._useUTC?jt:Pt).apply(null,o),i=t._useUTC?t._d.getUTCDay():t._d.getDay(),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[3]=24),t._w&&void 0!==t._w.d&&t._w.d!==i&&(f(t).weekdayMismatch=!0)}}function we(t){if(t._f!==l.ISO_8601)if(t._f!==l.RFC_2822){t._a=[],f(t).empty=!0;var e,n,a,i,r,o,s=""+t._i,c=s.length,d=0;for(a=L(t._f,t._locale).match(I)||[],e=0;e0&&f(t).unusedInput.push(r),s=s.slice(s.indexOf(n)+n.length),d+=n.length),j[i]?(n?f(t).empty=!1:f(t).unusedTokens.push(i),xt(i,n,t)):t._strict&&!n&&f(t).unusedTokens.push(i);f(t).charsLeftOver=c-d,s.length>0&&f(t).unusedInput.push(s),t._a[3]<=12&&!0===f(t).bigHour&&t._a[3]>0&&(f(t).bigHour=void 0),f(t).parsedDateParts=t._a.slice(0),f(t).meridiem=t._meridiem,t._a[3]=function(t,e,n){var l;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?((l=t.isPM(n))&&e<12&&(e+=12),l||12!==e||(e=0),e):e}(t._locale,t._a[3],t._meridiem),null!==(o=f(t).era)&&(t._a[0]=t._locale.erasConvertYear(o,t._a[0])),_e(t),se(t)}else ye(t);else ve(t)}function Se(t){var e=t._i,n=t._f;return t._locale=t._locale||oe(t._l),null===e||void 0===n&&""===e?m({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),_(e)?new x(se(e)):(d(e)?t._d=e:a(n)?function(t){var e,n,l,a,i,r,o=!1;if(0===t._f.length)return f(t).invalidFormat=!0,void(t._d=new Date(NaN));for(a=0;athis?this:t:m()}));function Ee(t,e){var n,l;if(1===e.length&&a(e[0])&&(e=e[0]),!e.length)return ke();for(n=e[0],l=1;l=0?new Date(t+400,e,n)-126227808e5:new Date(t,e,n).valueOf()}function ln(t,e,n){return t<100&&t>=0?Date.UTC(t+400,e,n)-126227808e5:Date.UTC(t,e,n)}function an(t,e){return e.erasAbbrRegex(t)}function rn(){var t,e,n=[],l=[],a=[],i=[],r=this.eras();for(t=0,e=r.length;t(i=Ft(t,l,a))&&(e=i),cn.call(this,t,e,n,l,a))}function cn(t,e,n,l,a){var i=Nt(t,e,n,l,a),r=jt(i.year,0,i.dayOfYear);return this.year(r.getUTCFullYear()),this.month(r.getUTCMonth()),this.date(r.getUTCDate()),this}O("N",0,0,"eraAbbr"),O("NN",0,0,"eraAbbr"),O("NNN",0,0,"eraAbbr"),O("NNNN",0,0,"eraName"),O("NNNNN",0,0,"eraNarrow"),O("y",["y",1],"yo","eraYear"),O("y",["yy",2],0,"eraYear"),O("y",["yyy",3],0,"eraYear"),O("y",["yyyy",4],0,"eraYear"),pt("N",an),pt("NN",an),pt("NNN",an),pt("NNNN",(function(t,e){return e.erasNameRegex(t)})),pt("NNNNN",(function(t,e){return e.erasNarrowRegex(t)})),bt(["N","NN","NNN","NNNN","NNNNN"],(function(t,e,n,l){var a=n._locale.erasParse(t,l,n._strict);a?f(n).era=a:f(n).invalidEra=t})),pt("y",st),pt("yy",st),pt("yyy",st),pt("yyyy",st),pt("yo",(function(t,e){return e._eraYearOrdinalRegex||st})),bt(["y","yy","yyy","yyyy"],0),bt(["yo"],(function(t,e,n,l){var a;n._locale._eraYearOrdinalRegex&&(a=t.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?e[0]=n._locale.eraYearOrdinalParse(t,a):e[0]=parseInt(t,10)})),O(0,["gg",2],0,(function(){return this.weekYear()%100})),O(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),on("gggg","weekYear"),on("ggggg","weekYear"),on("GGGG","isoWeekYear"),on("GGGGG","isoWeekYear"),B("weekYear","gg"),B("isoWeekYear","GG"),Z("weekYear",1),Z("isoWeekYear",1),pt("G",ct),pt("g",ct),pt("GG",nt,Q),pt("gg",nt,Q),pt("GGGG",rt,tt),pt("gggg",rt,tt),pt("GGGGG",ot,et),pt("ggggg",ot,et),yt(["gggg","ggggg","GGGG","GGGGG"],(function(t,e,n,l){e[l.substr(0,2)]=V(t)})),yt(["gg","GG"],(function(t,e,n,a){e[a]=l.parseTwoDigitYear(t)})),O("Q",0,"Qo","quarter"),B("quarter","Q"),Z("quarter",7),pt("Q",K),bt("Q",(function(t,e){e[1]=3*(V(t)-1)})),O("D",["DD",2],"Do","date"),B("date","D"),Z("date",9),pt("D",nt),pt("DD",nt,Q),pt("Do",(function(t,e){return t?e._dayOfMonthOrdinalParse||e._ordinalParse:e._dayOfMonthOrdinalParseLenient})),bt(["D","DD"],2),bt("Do",(function(t,e){e[2]=V(t.match(nt)[0])}));var dn=Y("Date",!0);O("DDD",["DDDD",3],"DDDo","dayOfYear"),B("dayOfYear","DDD"),Z("dayOfYear",4),pt("DDD",it),pt("DDDD",J),bt(["DDD","DDDD"],(function(t,e,n){n._dayOfYear=V(t)})),O("m",["mm",2],0,"minute"),B("minute","m"),Z("minute",14),pt("m",nt),pt("mm",nt,Q),bt(["m","mm"],4);var un=Y("Minutes",!1);O("s",["ss",2],0,"second"),B("second","s"),Z("second",15),pt("s",nt),pt("ss",nt,Q),bt(["s","ss"],5);var hn,pn,fn=Y("Seconds",!1);for(O("S",0,0,(function(){return~~(this.millisecond()/100)})),O(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),O(0,["SSS",3],0,"millisecond"),O(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),O(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),O(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),O(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),O(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),O(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),B("millisecond","ms"),Z("millisecond",16),pt("S",it,K),pt("SS",it,Q),pt("SSS",it,J),hn="SSSS";hn.length<=9;hn+="S")pt(hn,st);function gn(t,e){e[6]=V(1e3*("0."+t))}for(hn="S";hn.length<=9;hn+="S")bt(hn,gn);pn=Y("Milliseconds",!1),O("z",0,0,"zoneAbbr"),O("zz",0,0,"zoneName");var mn=x.prototype;function vn(t){return t}mn.add=Ve,mn.calendar=function(t,e){1===arguments.length&&(Ge(arguments[0])?(t=arguments[0],e=void 0):Xe(arguments[0])&&(e=arguments[0],t=void 0));var n=t||ke(),a=Ne(n,this).startOf("day"),i=l.calendarFormat(this,a)||"sameElse",r=e&&(T(e[i])?e[i].call(this,n):e[i]);return this.format(r||this.localeData().calendar(i,this,ke(n)))},mn.clone=function(){return new x(this)},mn.diff=function(t,e,n){var l,a,i;if(!this.isValid())return NaN;if(!(l=Ne(t,this)).isValid())return NaN;switch(a=6e4*(l.utcOffset()-this.utcOffset()),e=H(e)){case"year":i=Ke(this,l)/12;break;case"month":i=Ke(this,l);break;case"quarter":i=Ke(this,l)/3;break;case"second":i=(this-l)/1e3;break;case"minute":i=(this-l)/6e4;break;case"hour":i=(this-l)/36e5;break;case"day":i=(this-l-a)/864e5;break;case"week":i=(this-l-a)/6048e5;break;default:i=this-l}return n?i:W(i)},mn.endOf=function(t){var e,n;if(void 0===(t=H(t))||"millisecond"===t||!this.isValid())return this;switch(n=this._isUTC?ln:nn,t){case"year":e=n(this.year()+1,0,1)-1;break;case"quarter":e=n(this.year(),this.month()-this.month()%3+3,1)-1;break;case"month":e=n(this.year(),this.month()+1,1)-1;break;case"week":e=n(this.year(),this.month(),this.date()-this.weekday()+7)-1;break;case"isoWeek":e=n(this.year(),this.month(),this.date()-(this.isoWeekday()-1)+7)-1;break;case"day":case"date":e=n(this.year(),this.month(),this.date()+1)-1;break;case"hour":e=this._d.valueOf(),e+=36e5-en(e+(this._isUTC?0:6e4*this.utcOffset()),36e5)-1;break;case"minute":e=this._d.valueOf(),e+=6e4-en(e,6e4)-1;break;case"second":e=this._d.valueOf(),e+=1e3-en(e,1e3)-1}return this._d.setTime(e),l.updateOffset(this,!0),this},mn.format=function(t){t||(t=this.isUtc()?l.defaultFormatUtc:l.defaultFormat);var e=N(this,t);return this.localeData().postformat(e)},mn.from=function(t,e){return this.isValid()&&(_(t)&&t.isValid()||ke(t).isValid())?qe({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},mn.fromNow=function(t){return this.from(ke(),t)},mn.to=function(t,e){return this.isValid()&&(_(t)&&t.isValid()||ke(t).isValid())?qe({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()},mn.toNow=function(t){return this.to(ke(),t)},mn.get=function(t){return T(this[t=H(t)])?this[t]():this},mn.invalidAt=function(){return f(this).overflow},mn.isAfter=function(t,e){var n=_(t)?t:ke(t);return!(!this.isValid()||!n.isValid())&&("millisecond"===(e=H(e)||"millisecond")?this.valueOf()>n.valueOf():n.valueOf()9999?N(n,e?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):T(Date.prototype.toISOString)?e?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",N(n,"Z")):N(n,e?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},mn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t,e,n,l="moment",a="";return this.isLocal()||(l=0===this.utcOffset()?"moment.utc":"moment.parseZone",a="Z"),t="["+l+'("]',e=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=a+'[")]',this.format(t+e+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!=typeof Symbol&&null!=Symbol.for&&(mn[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),mn.toJSON=function(){return this.isValid()?this.toISOString():null},mn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},mn.unix=function(){return Math.floor(this.valueOf()/1e3)},mn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},mn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},mn.eraName=function(){var t,e,n,l=this.localeData().eras();for(t=0,e=l.length;tthis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},mn.isLocal=function(){return!!this.isValid()&&!this._isUTC},mn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},mn.isUtc=Fe,mn.isUTC=Fe,mn.zoneAbbr=function(){return this._isUTC?"UTC":""},mn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},mn.dates=S("dates accessor is deprecated. Use date instead.",dn),mn.months=S("months accessor is deprecated. Use month instead",Mt),mn.years=S("years accessor is deprecated. Use year instead",Rt),mn.zone=S("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()})),mn.isDSTShifted=S("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var t,e={};return y(e,this),(e=Se(e))._a?(t=e._isUTC?p(e._a):ke(e._a),this._isDSTShifted=this.isValid()&&function(t,e,n){var l,a=Math.min(t.length,e.length),i=Math.abs(t.length-e.length),r=0;for(l=0;l0):this._isDSTShifted=!1,this._isDSTShifted}));var bn=M.prototype;function yn(t,e,n,l){var a=oe(),i=p().set(l,e);return a[n](i,t)}function xn(t,e,n){if(c(t)&&(e=t,t=void 0),t=t||"",null!=e)return yn(t,e,n,"month");var l,a=[];for(l=0;l<12;l++)a[l]=yn(t,l,n,"month");return a}function _n(t,e,n,l){"boolean"==typeof t?(c(e)&&(n=e,e=void 0),e=e||""):(n=e=t,t=!1,c(e)&&(n=e,e=void 0),e=e||"");var a,i=oe(),r=t?i._week.dow:0,o=[];if(null!=n)return yn(e,(n+r)%7,l,"day");for(a=0;a<7;a++)o[a]=yn(e,(a+r)%7,l,"day");return o}bn.calendar=function(t,e,n){var l=this._calendar[t]||this._calendar.sameElse;return T(l)?l.call(e,n):l},bn.longDateFormat=function(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.match(I).map((function(t){return"MMMM"===t||"MM"===t||"DD"===t||"dddd"===t?t.slice(1):t})).join(""),this._longDateFormat[t])},bn.invalidDate=function(){return this._invalidDate},bn.ordinal=function(t){return this._ordinal.replace("%d",t)},bn.preparse=vn,bn.postformat=vn,bn.relativeTime=function(t,e,n,l){var a=this._relativeTime[n];return T(a)?a(t,e,n,l):a.replace(/%d/i,t)},bn.pastFuture=function(t,e){var n=this._relativeTime[t>0?"future":"past"];return T(n)?n(e):n.replace(/%s/i,e)},bn.set=function(t){var e,n;for(n in t)r(t,n)&&(T(e=t[n])?this[n]=e:this["_"+n]=e);this._config=t,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},bn.eras=function(t,e){var n,a,i,r=this._eras||oe("en")._eras;for(n=0,a=r.length;n=0)return s[l]},bn.erasConvertYear=function(t,e){var n=t.since<=t.until?1:-1;return void 0===e?l(t.since).year():l(t.since).year()+(e-t.offset)*n},bn.erasAbbrRegex=function(t){return r(this,"_erasAbbrRegex")||rn.call(this),t?this._erasAbbrRegex:this._erasRegex},bn.erasNameRegex=function(t){return r(this,"_erasNameRegex")||rn.call(this),t?this._erasNameRegex:this._erasRegex},bn.erasNarrowRegex=function(t){return r(this,"_erasNarrowRegex")||rn.call(this),t?this._erasNarrowRegex:this._erasRegex},bn.months=function(t,e){return t?a(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||Ct).test(e)?"format":"standalone"][t.month()]:a(this._months)?this._months:this._months.standalone},bn.monthsShort=function(t,e){return t?a(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[Ct.test(e)?"format":"standalone"][t.month()]:a(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},bn.monthsParse=function(t,e,n){var l,a,i;if(this._monthsParseExact)return Tt.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),l=0;l<12;l++){if(a=p([2e3,l]),n&&!this._longMonthsParse[l]&&(this._longMonthsParse[l]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[l]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),n||this._monthsParse[l]||(i="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[l]=new RegExp(i.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[l].test(t))return l;if(n&&"MMM"===e&&this._shortMonthsParse[l].test(t))return l;if(!n&&this._monthsParse[l].test(t))return l}},bn.monthsRegex=function(t){return this._monthsParseExact?(r(this,"_monthsRegex")||At.call(this),t?this._monthsStrictRegex:this._monthsRegex):(r(this,"_monthsRegex")||(this._monthsRegex=Dt),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)},bn.monthsShortRegex=function(t){return this._monthsParseExact?(r(this,"_monthsRegex")||At.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(r(this,"_monthsShortRegex")||(this._monthsShortRegex=kt),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)},bn.week=function(t){return Lt(t,this._week.dow,this._week.doy).week},bn.firstDayOfYear=function(){return this._week.doy},bn.firstDayOfWeek=function(){return this._week.dow},bn.weekdays=function(t,e){var n=a(this._weekdays)?this._weekdays:this._weekdays[t&&!0!==t&&this._weekdays.isFormat.test(e)?"format":"standalone"];return!0===t?Bt(n,this._week.dow):t?n[t.day()]:n},bn.weekdaysMin=function(t){return!0===t?Bt(this._weekdaysMin,this._week.dow):t?this._weekdaysMin[t.day()]:this._weekdaysMin},bn.weekdaysShort=function(t){return!0===t?Bt(this._weekdaysShort,this._week.dow):t?this._weekdaysShort[t.day()]:this._weekdaysShort},bn.weekdaysParse=function(t,e,n){var l,a,i;if(this._weekdaysParseExact)return Vt.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),l=0;l<7;l++){if(a=p([2e3,1]).day(l),n&&!this._fullWeekdaysParse[l]&&(this._fullWeekdaysParse[l]=new RegExp("^"+this.weekdays(a,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[l]=new RegExp("^"+this.weekdaysShort(a,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[l]=new RegExp("^"+this.weekdaysMin(a,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[l]||(i="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[l]=new RegExp(i.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[l].test(t))return l;if(n&&"ddd"===e&&this._shortWeekdaysParse[l].test(t))return l;if(n&&"dd"===e&&this._minWeekdaysParse[l].test(t))return l;if(!n&&this._weekdaysParse[l].test(t))return l}},bn.weekdaysRegex=function(t){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Yt.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(r(this,"_weekdaysRegex")||(this._weekdaysRegex=Zt),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)},bn.weekdaysShortRegex=function(t){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Yt.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(r(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=$t),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},bn.weekdaysMinRegex=function(t){return this._weekdaysParseExact?(r(this,"_weekdaysRegex")||Yt.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(r(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Wt),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},bn.isPM=function(t){return"p"===(t+"").toLowerCase().charAt(0)},bn.meridiem=function(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"},ie("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10;return t+(1===V(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th")}}),l.lang=S("moment.lang is deprecated. Use moment.locale instead.",ie),l.langData=S("moment.langData is deprecated. Use moment.localeData instead.",oe);var wn=Math.abs;function Sn(t,e,n,l){var a=qe(e,n);return t._milliseconds+=l*a._milliseconds,t._days+=l*a._days,t._months+=l*a._months,t._bubble()}function Cn(t){return t<0?Math.floor(t):Math.ceil(t)}function kn(t){return 4800*t/146097}function Dn(t){return 146097*t/4800}function Tn(t){return function(){return this.as(t)}}var En=Tn("ms"),Mn=Tn("s"),An=Tn("m"),In=Tn("h"),Rn=Tn("d"),Pn=Tn("w"),jn=Tn("M"),On=Tn("Q"),Nn=Tn("y");function Ln(t){return function(){return this.isValid()?this._data[t]:NaN}}var Fn=Ln("milliseconds"),Bn=Ln("seconds"),Hn=Ln("minutes"),qn=Ln("hours"),zn=Ln("days"),Zn=Ln("months"),$n=Ln("years"),Wn=Math.round,Vn={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function Yn(t,e,n,l,a){return a.relativeTime(e||1,!!n,t,l)}var Un=Math.abs;function Gn(t){return(t>0)-(t<0)||+t}function Xn(){if(!this.isValid())return this.localeData().invalidDate();var t,e,n,l,a,i,r,o,s=Un(this._milliseconds)/1e3,c=Un(this._days),d=Un(this._months),u=this.asSeconds();return u?(t=W(s/60),e=W(t/60),s%=60,t%=60,n=W(d/12),d%=12,l=s?s.toFixed(3).replace(/\.?0+$/,""):"",a=u<0?"-":"",i=Gn(this._months)!==Gn(u)?"-":"",r=Gn(this._days)!==Gn(u)?"-":"",o=Gn(this._milliseconds)!==Gn(u)?"-":"",a+"P"+(n?i+n+"Y":"")+(d?i+d+"M":"")+(c?r+c+"D":"")+(e||t||s?"T":"")+(e?o+e+"H":"")+(t?o+t+"M":"")+(s?o+l+"S":"")):"P0D"}var Kn=Ae.prototype;return Kn.isValid=function(){return this._isValid},Kn.abs=function(){var t=this._data;return this._milliseconds=wn(this._milliseconds),this._days=wn(this._days),this._months=wn(this._months),t.milliseconds=wn(t.milliseconds),t.seconds=wn(t.seconds),t.minutes=wn(t.minutes),t.hours=wn(t.hours),t.months=wn(t.months),t.years=wn(t.years),this},Kn.add=function(t,e){return Sn(this,t,e,1)},Kn.subtract=function(t,e){return Sn(this,t,e,-1)},Kn.as=function(t){if(!this.isValid())return NaN;var e,n,l=this._milliseconds;if("month"===(t=H(t))||"quarter"===t||"year"===t)switch(e=this._days+l/864e5,n=this._months+kn(e),t){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(e=this._days+Math.round(Dn(this._months)),t){case"week":return e/7+l/6048e5;case"day":return e+l/864e5;case"hour":return 24*e+l/36e5;case"minute":return 1440*e+l/6e4;case"second":return 86400*e+l/1e3;case"millisecond":return Math.floor(864e5*e)+l;default:throw new Error("Unknown unit "+t)}},Kn.asMilliseconds=En,Kn.asSeconds=Mn,Kn.asMinutes=An,Kn.asHours=In,Kn.asDays=Rn,Kn.asWeeks=Pn,Kn.asMonths=jn,Kn.asQuarters=On,Kn.asYears=Nn,Kn.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*V(this._months/12):NaN},Kn._bubble=function(){var t,e,n,l,a,i=this._milliseconds,r=this._days,o=this._months,s=this._data;return i>=0&&r>=0&&o>=0||i<=0&&r<=0&&o<=0||(i+=864e5*Cn(Dn(o)+r),r=0,o=0),s.milliseconds=i%1e3,t=W(i/1e3),s.seconds=t%60,e=W(t/60),s.minutes=e%60,n=W(e/60),s.hours=n%24,r+=W(n/24),a=W(kn(r)),o+=a,r-=Cn(Dn(a)),l=W(o/12),o%=12,s.days=r,s.months=o,s.years=l,this},Kn.clone=function(){return qe(this)},Kn.get=function(t){return t=H(t),this.isValid()?this[t+"s"]():NaN},Kn.milliseconds=Fn,Kn.seconds=Bn,Kn.minutes=Hn,Kn.hours=qn,Kn.days=zn,Kn.weeks=function(){return W(this.days()/7)},Kn.months=Zn,Kn.years=$n,Kn.humanize=function(t,e){if(!this.isValid())return this.localeData().invalidDate();var n,l,a=!1,i=Vn;return"object"==typeof t&&(e=t,t=!1),"boolean"==typeof t&&(a=t),"object"==typeof e&&(i=Object.assign({},Vn,e),null!=e.s&&null==e.ss&&(i.ss=e.s-1)),n=this.localeData(),l=function(t,e,n,l){var a=qe(t).abs(),i=Wn(a.as("s")),r=Wn(a.as("m")),o=Wn(a.as("h")),s=Wn(a.as("d")),c=Wn(a.as("M")),d=Wn(a.as("w")),u=Wn(a.as("y")),h=i<=n.ss&&["s",i]||i0,h[4]=l,Yn.apply(null,h)}(this,!a,i,n),a&&(l=n.pastFuture(+this,l)),n.postformat(l)},Kn.toISOString=Xn,Kn.toString=Xn,Kn.toJSON=Xn,Kn.locale=Qe,Kn.localeData=tn,Kn.toIsoString=S("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Xn),Kn.lang=Je,O("X",0,0,"unix"),O("x",0,0,"valueOf"),pt("x",ct),pt("X",/[+-]?\d+(\.\d{1,3})?/),bt("X",(function(t,e,n){n._d=new Date(1e3*parseFloat(t))})),bt("x",(function(t,e,n){n._d=new Date(V(t))})),l.version="2.27.0",e=ke,l.fn=mn,l.min=function(){var t=[].slice.call(arguments,0);return Ee("isBefore",t)},l.max=function(){var t=[].slice.call(arguments,0);return Ee("isAfter",t)},l.now=function(){return Date.now?Date.now():+new Date},l.utc=p,l.unix=function(t){return ke(1e3*t)},l.months=function(t,e){return xn(t,e,"months")},l.isDate=d,l.locale=ie,l.invalid=m,l.duration=qe,l.isMoment=_,l.weekdays=function(t,e,n){return _n(t,e,n,"weekdays")},l.parseZone=function(){return ke.apply(null,arguments).parseZone()},l.localeData=oe,l.isDuration=Ie,l.monthsShort=function(t,e){return xn(t,e,"monthsShort")},l.weekdaysMin=function(t,e,n){return _n(t,e,n,"weekdaysMin")},l.defineLocale=re,l.updateLocale=function(t,e){if(null!=e){var n,l,a=Jt;null!=te[t]&&null!=te[t].parentLocale?te[t].set(E(te[t]._config,e)):(null!=(l=ae(t))&&(a=l._config),e=E(a,e),null==l&&(e.abbr=t),(n=new M(e)).parentLocale=te[t],te[t]=n),ie(t)}else null!=te[t]&&(null!=te[t].parentLocale?(te[t]=te[t].parentLocale,t===ie()&&ie(t)):null!=te[t]&&delete te[t]);return te[t]},l.locales=function(){return C(te)},l.weekdaysShort=function(t,e,n){return _n(t,e,n,"weekdaysShort")},l.normalizeUnits=H,l.relativeTimeRounding=function(t){return void 0===t?Wn:"function"==typeof t&&(Wn=t,!0)},l.relativeTimeThreshold=function(t,e){return void 0!==Vn[t]&&(void 0===e?Vn[t]:(Vn[t]=e,"s"===t&&(Vn.ss=e-1),!0))},l.calendarFormat=function(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},l.prototype=mn,l.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},l}()}).call(this,n(59)(t))},function(t,e,n){var l=n(13),a=n(12);t.exports=function(t){return function(e,n){var i,r,o=String(a(e)),s=l(n),c=o.length;return s<0||s>=c?t?"":void 0:(i=o.charCodeAt(s))<55296||i>56319||s+1===c||(r=o.charCodeAt(s+1))<56320||r>57343?t?o.charAt(s):i:t?o.slice(s,s+2):r-56320+(i-55296<<10)+65536}}},function(t,e,n){var l=n(15),a=n(6)("toStringTag"),i="Arguments"==l(function(){return arguments}());t.exports=function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),a))?n:i?l(e):"Object"==(r=l(e))&&"function"==typeof e.callee?"Arguments":r}},function(t,e){t.exports=!1},function(t,e,n){"use strict";var l=n(9);n(29)({target:"RegExp",proto:!0,forced:l!==/./.exec},{exec:l})},function(t,e,n){"use strict";var l=n(2);t.exports=function(){var t=l(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},function(t,e,n){var l=n(3),a=n(8),i=n(10),r=n(19),o=n(37),s=function(t,e,n){var c,d,u,h,p=t&s.F,f=t&s.G,g=t&s.S,m=t&s.P,v=t&s.B,b=f?l:g?l[e]||(l[e]={}):(l[e]||{}).prototype,y=f?a:a[e]||(a[e]={}),x=y.prototype||(y.prototype={});for(c in f&&(n=e),n)u=((d=!p&&b&&void 0!==b[c])?b:n)[c],h=v&&d?o(u,l):m&&"function"==typeof u?o(Function.call,u):u,b&&r(b,c,u,t&s.U),y[c]!=u&&i(y,c,h),m&&x[c]!=u&&(x[c]=u)};l.core=a,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},function(t,e,n){var l=n(2),a=n(31),i=n(33),r=Object.defineProperty;e.f=n(11)?Object.defineProperty:function(t,e,n){if(l(t),e=i(e,!0),l(n),a)try{return r(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){t.exports=!n(11)&&!n(7)((function(){return 7!=Object.defineProperty(n(32)("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var l=n(5),a=n(3).document,i=l(a)&&l(a.createElement);t.exports=function(t){return i?a.createElement(t):{}}},function(t,e,n){var l=n(5);t.exports=function(t,e){if(!l(t))return t;var n,a;if(e&&"function"==typeof(n=t.toString)&&!l(a=n.call(t)))return a;if("function"==typeof(n=t.valueOf)&&!l(a=n.call(t)))return a;if(!e&&"function"==typeof(n=t.toString)&&!l(a=n.call(t)))return a;throw TypeError("Can't convert object to primitive value")}},function(t,e){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},function(t,e,n){t.exports=n(16)("native-function-to-string",Function.toString)},function(t,e,n){var l=n(20);t.exports=function(t,e,n){if(l(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,l){return t.call(e,n,l)};case 3:return function(n,l,a){return t.call(e,n,l,a)}}return function(){return t.apply(e,arguments)}}},function(t,e,n){"use strict";var l=n(39),a=n(2),i=n(40),r=n(22),o=n(21),s=n(14),c=n(9),d=n(7),u=Math.min,h=[].push,p="length",f=!d((function(){RegExp(4294967295,"y")}));n(18)("split",2,(function(t,e,n,d){var g;return g="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1)[p]||2!="ab".split(/(?:ab)*/)[p]||4!=".".split(/(.?)(.?)/)[p]||".".split(/()()/)[p]>1||"".split(/.?/)[p]?function(t,e){var a=String(this);if(void 0===t&&0===e)return[];if(!l(t))return n.call(a,t,e);for(var i,r,o,s=[],d=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),u=0,f=void 0===e?4294967295:e>>>0,g=new RegExp(t.source,d+"g");(i=c.call(g,a))&&!((r=g.lastIndex)>u&&(s.push(a.slice(u,i.index)),i[p]>1&&i.index=f));)g.lastIndex===i.index&&g.lastIndex++;return u===a[p]?!o&&g.test("")||s.push(""):s.push(a.slice(u)),s[p]>f?s.slice(0,f):s}:"0".split(void 0,0)[p]?function(t,e){return void 0===t&&0===e?[]:n.call(this,t,e)}:n,[function(n,l){var a=t(this),i=null==n?void 0:n[e];return void 0!==i?i.call(n,a,l):g.call(String(a),n,l)},function(t,e){var l=d(g,t,this,e,g!==n);if(l.done)return l.value;var c=a(t),h=String(this),p=i(c,RegExp),m=c.unicode,v=(c.ignoreCase?"i":"")+(c.multiline?"m":"")+(c.unicode?"u":"")+(f?"y":"g"),b=new p(f?c:"^(?:"+c.source+")",v),y=void 0===e?4294967295:e>>>0;if(0===y)return[];if(0===h.length)return null===s(b,h)?[h]:[];for(var x=0,_=0,w=[];_1)for(var n=1;n").attr("name",n.submitButton.name).val(t(n.submitButton).val()).appendTo(n.currentForm)),!(n.settings.submitHandler&&!n.settings.debug)||(a=n.settings.submitHandler.call(n,n.currentForm,e),l&&l.remove(),void 0!==a&&a)}return n.settings.debug&&e.preventDefault(),n.cancelSubmit?(n.cancelSubmit=!1,l()):n.form()?n.pendingRequest?(n.formSubmitted=!0,!1):l():(n.focusInvalid(),!1)}))),n)}e&&e.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing.")},valid:function(){var e,n,l;return t(this[0]).is("form")?e=this.validate().form():(l=[],e=!0,n=t(this[0].form).validate(),this.each((function(){(e=n.element(this)&&e)||(l=l.concat(n.errorList))})),n.errorList=l),e},rules:function(e,n){var l,a,i,r,o,s,c=this[0],d=void 0!==this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=c&&(!c.form&&d&&(c.form=this.closest("form")[0],c.name=this.attr("name")),null!=c.form)){if(e)switch(a=(l=t.data(c.form,"validator").settings).rules,i=t.validator.staticRules(c),e){case"add":t.extend(i,t.validator.normalizeRule(n)),delete i.messages,a[c.name]=i,n.messages&&(l.messages[c.name]=t.extend(l.messages[c.name],n.messages));break;case"remove":return n?(s={},t.each(n.split(/\s/),(function(t,e){s[e]=i[e],delete i[e]})),s):(delete a[c.name],i)}return(r=t.validator.normalizeRules(t.extend({},t.validator.classRules(c),t.validator.attributeRules(c),t.validator.dataRules(c),t.validator.staticRules(c)),c)).required&&(o=r.required,delete r.required,r=t.extend({required:o},r)),r.remote&&(o=r.remote,delete r.remote,r=t.extend(r,{remote:o})),r}}});var e,n=function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};t.extend(t.expr.pseudos||t.expr[":"],{blank:function(e){return!n(""+t(e).val())},filled:function(e){var l=t(e).val();return null!==l&&!!n(""+l)},unchecked:function(e){return!t(e).prop("checked")}}),t.validator=function(e,n){this.settings=t.extend(!0,{},t.validator.defaults,e),this.currentForm=n,this.init()},t.validator.format=function(e,n){return 1===arguments.length?function(){var n=t.makeArray(arguments);return n.unshift(e),t.validator.format.apply(this,n)}:(void 0===n||(arguments.length>2&&n.constructor!==Array&&(n=t.makeArray(arguments).slice(1)),n.constructor!==Array&&(n=[n]),t.each(n,(function(t,n){e=e.replace(new RegExp("\\{"+t+"\\}","g"),(function(){return n}))}))),e)},t.extend(t.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:t([]),errorLabelContainer:t([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(t){this.lastActive=t,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,t,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(t)))},onfocusout:function(t){this.checkable(t)||!(t.name in this.submitted)&&this.optional(t)||this.element(t)},onkeyup:function(e,n){9===n.which&&""===this.elementValue(e)||-1!==t.inArray(n.keyCode,[16,17,18,20,35,36,37,38,39,40,45,144,225])||(e.name in this.submitted||e.name in this.invalid)&&this.element(e)},onclick:function(t){t.name in this.submitted?this.element(t):t.parentNode.name in this.submitted&&this.element(t.parentNode)},highlight:function(e,n,l){"radio"===e.type?this.findByName(e.name).addClass(n).removeClass(l):t(e).addClass(n).removeClass(l)},unhighlight:function(e,n,l){"radio"===e.type?this.findByName(e.name).removeClass(n).addClass(l):t(e).removeClass(n).addClass(l)}},setDefaults:function(e){t.extend(t.validator.defaults,e)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:t.validator.format("Please enter no more than {0} characters."),minlength:t.validator.format("Please enter at least {0} characters."),rangelength:t.validator.format("Please enter a value between {0} and {1} characters long."),range:t.validator.format("Please enter a value between {0} and {1}."),max:t.validator.format("Please enter a value less than or equal to {0}."),min:t.validator.format("Please enter a value greater than or equal to {0}."),step:t.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){this.labelContainer=t(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||t(this.currentForm),this.containers=t(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var e,n=this.currentForm,l=this.groups={};function a(e){var l=void 0!==t(this).attr("contenteditable")&&"false"!==t(this).attr("contenteditable");if(!this.form&&l&&(this.form=t(this).closest("form")[0],this.name=t(this).attr("name")),n===this.form){var a=t.data(this.form,"validator"),i="on"+e.type.replace(/^validate/,""),r=a.settings;r[i]&&!t(this).is(r.ignore)&&r[i].call(a,this,e)}}t.each(this.settings.groups,(function(e,n){"string"==typeof n&&(n=n.split(/\s/)),t.each(n,(function(t,n){l[n]=e}))})),e=this.settings.rules,t.each(e,(function(n,l){e[n]=t.validator.normalizeRule(l)})),t(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",a).on("click.validate","select, option, [type='radio'], [type='checkbox']",a),this.settings.invalidHandler&&t(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),t.extend(this.submitted,this.errorMap),this.invalid=t.extend({},this.errorMap),this.valid()||t(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var t=0,e=this.currentElements=this.elements();e[t];t++)this.check(e[t]);return this.valid()},element:function(e){var n,l,a=this.clean(e),i=this.validationTargetFor(a),r=this,o=!0;return void 0===i?delete this.invalid[a.name]:(this.prepareElement(i),this.currentElements=t(i),(l=this.groups[i.name])&&t.each(this.groups,(function(t,e){e===l&&t!==i.name&&(a=r.validationTargetFor(r.clean(r.findByName(t))))&&a.name in r.invalid&&(r.currentElements.push(a),o=r.check(a)&&o)})),n=!1!==this.check(i),o=o&&n,this.invalid[i.name]=!n,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),t(e).attr("aria-invalid",!n)),o},showErrors:function(e){if(e){var n=this;t.extend(this.errorMap,e),this.errorList=t.map(this.errorMap,(function(t,e){return{message:t,element:n.findByName(e)[0]}})),this.successList=t.grep(this.successList,(function(t){return!(t.name in e)}))}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){t.fn.resetForm&&t(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var e=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(e)},resetElements:function(t){var e;if(this.settings.unhighlight)for(e=0;t[e];e++)this.settings.unhighlight.call(this,t[e],this.settings.errorClass,""),this.findByName(t[e].name).removeClass(this.settings.validClass);else t.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(t){var e,n=0;for(e in t)void 0!==t[e]&&null!==t[e]&&!1!==t[e]&&n++;return n},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(t){t.not(this.containers).text(""),this.addWrapper(t).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{t(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(t){}},findLastActive:function(){var e=this.lastActive;return e&&1===t.grep(this.errorList,(function(t){return t.element.name===e.name})).length&&e},elements:function(){var e=this,n={};return t(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter((function(){var l=this.name||t(this).attr("name"),a=void 0!==t(this).attr("contenteditable")&&"false"!==t(this).attr("contenteditable");return!l&&e.settings.debug&&window.console&&console.error("%o has no name assigned",this),a&&(this.form=t(this).closest("form")[0],this.name=l),!(this.form!==e.currentForm||l in n||!e.objectLength(t(this).rules())||(n[l]=!0,0))}))},clean:function(e){return t(e)[0]},errors:function(){var e=this.settings.errorClass.split(" ").join(".");return t(this.settings.errorElement+"."+e,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=t([]),this.toHide=t([])},reset:function(){this.resetInternals(),this.currentElements=t([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(t){this.reset(),this.toHide=this.errorsFor(t)},elementValue:function(e){var n,l,a=t(e),i=e.type,r=void 0!==a.attr("contenteditable")&&"false"!==a.attr("contenteditable");return"radio"===i||"checkbox"===i?this.findByName(e.name).filter(":checked").val():"number"===i&&void 0!==e.validity?e.validity.badInput?"NaN":a.val():(n=r?a.text():a.val(),"file"===i?"C:\\fakepath\\"===n.substr(0,12)?n.substr(12):(l=n.lastIndexOf("/"))>=0||(l=n.lastIndexOf("\\"))>=0?n.substr(l+1):n:"string"==typeof n?n.replace(/\r/g,""):n)},check:function(e){e=this.validationTargetFor(this.clean(e));var n,l,a,i,r=t(e).rules(),o=t.map(r,(function(t,e){return e})).length,s=!1,c=this.elementValue(e);for(l in"function"==typeof r.normalizer?i=r.normalizer:"function"==typeof this.settings.normalizer&&(i=this.settings.normalizer),i&&(c=i.call(e,c),delete r.normalizer),r){a={method:l,parameters:r[l]};try{if("dependency-mismatch"===(n=t.validator.methods[l].call(this,c,e,a.parameters))&&1===o){s=!0;continue}if(s=!1,"pending"===n)return void(this.toHide=this.toHide.not(this.errorsFor(e)));if(!n)return this.formatAndAdd(e,a),!1}catch(t){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+e.id+", check the '"+a.method+"' method.",t),t instanceof TypeError&&(t.message+=". Exception occurred when checking element "+e.id+", check the '"+a.method+"' method."),t}}if(!s)return this.objectLength(r)&&this.successList.push(e),!0},customDataMessage:function(e,n){return t(e).data("msg"+n.charAt(0).toUpperCase()+n.substring(1).toLowerCase())||t(e).data("msg")},customMessage:function(t,e){var n=this.settings.messages[t];return n&&(n.constructor===String?n:n[e])},findDefined:function(){for(var t=0;tWarning: No message defined for "+e.name+""),a=/\$?\{(\d+)\}/g;return"function"==typeof l?l=l.call(this,n.parameters,e):a.test(l)&&(l=t.validator.format(l.replace(a,"{$1}"),n.parameters)),l},formatAndAdd:function(t,e){var n=this.defaultMessage(t,e);this.errorList.push({message:n,element:t,method:e.method}),this.errorMap[t.name]=n,this.submitted[t.name]=n},addWrapper:function(t){return this.settings.wrapper&&(t=t.add(t.parent(this.settings.wrapper))),t},defaultShowErrors:function(){var t,e,n;for(t=0;this.errorList[t];t++)n=this.errorList[t],this.settings.highlight&&this.settings.highlight.call(this,n.element,this.settings.errorClass,this.settings.validClass),this.showLabel(n.element,n.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(t=0;this.successList[t];t++)this.showLabel(this.successList[t]);if(this.settings.unhighlight)for(t=0,e=this.validElements();e[t];t++)this.settings.unhighlight.call(this,e[t],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return t(this.errorList).map((function(){return this.element}))},showLabel:function(e,n){var l,a,i,r,o=this.errorsFor(e),s=this.idOrName(e),c=t(e).attr("aria-describedby");o.length?(o.removeClass(this.settings.validClass).addClass(this.settings.errorClass),o.html(n)):(l=o=t("<"+this.settings.errorElement+">").attr("id",s+"-error").addClass(this.settings.errorClass).html(n||""),this.settings.wrapper&&(l=o.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(l):this.settings.errorPlacement?this.settings.errorPlacement.call(this,l,t(e)):l.insertAfter(e),o.is("label")?o.attr("for",s):0===o.parents("label[for='"+this.escapeCssMeta(s)+"']").length&&(i=o.attr("id"),c?c.match(new RegExp("\\b"+this.escapeCssMeta(i)+"\\b"))||(c+=" "+i):c=i,t(e).attr("aria-describedby",c),(a=this.groups[e.name])&&(r=this,t.each(r.groups,(function(e,n){n===a&&t("[name='"+r.escapeCssMeta(e)+"']",r.currentForm).attr("aria-describedby",o.attr("id"))}))))),!n&&this.settings.success&&(o.text(""),"string"==typeof this.settings.success?o.addClass(this.settings.success):this.settings.success(o,e)),this.toShow=this.toShow.add(o)},errorsFor:function(e){var n=this.escapeCssMeta(this.idOrName(e)),l=t(e).attr("aria-describedby"),a="label[for='"+n+"'], label[for='"+n+"'] *";return l&&(a=a+", #"+this.escapeCssMeta(l).replace(/\s+/g,", #")),this.errors().filter(a)},escapeCssMeta:function(t){return t.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(t){return this.groups[t.name]||(this.checkable(t)?t.name:t.id||t.name)},validationTargetFor:function(e){return this.checkable(e)&&(e=this.findByName(e.name)),t(e).not(this.settings.ignore)[0]},checkable:function(t){return/radio|checkbox/i.test(t.type)},findByName:function(e){return t(this.currentForm).find("[name='"+this.escapeCssMeta(e)+"']")},getLength:function(e,n){switch(n.nodeName.toLowerCase()){case"select":return t("option:selected",n).length;case"input":if(this.checkable(n))return this.findByName(n.name).filter(":checked").length}return e.length},depend:function(t,e){return!this.dependTypes[typeof t]||this.dependTypes[typeof t](t,e)},dependTypes:{boolean:function(t){return t},string:function(e,n){return!!t(e,n.form).length},function:function(t,e){return t(e)}},optional:function(e){var n=this.elementValue(e);return!t.validator.methods.required.call(this,n,e)&&"dependency-mismatch"},startRequest:function(e){this.pending[e.name]||(this.pendingRequest++,t(e).addClass(this.settings.pendingClass),this.pending[e.name]=!0)},stopRequest:function(e,n){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[e.name],t(e).removeClass(this.settings.pendingClass),n&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(t(this.currentForm).submit(),this.submitButton&&t("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!n&&0===this.pendingRequest&&this.formSubmitted&&(t(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(e,n){return n="string"==typeof n&&n||"remote",t.data(e,"previousValue")||t.data(e,"previousValue",{old:null,valid:!0,message:this.defaultMessage(e,{method:n})})},destroy:function(){this.resetForm(),t(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(e,n){e.constructor===String?this.classRuleSettings[e]=n:t.extend(this.classRuleSettings,e)},classRules:function(e){var n={},l=t(e).attr("class");return l&&t.each(l.split(" "),(function(){this in t.validator.classRuleSettings&&t.extend(n,t.validator.classRuleSettings[this])})),n},normalizeAttributeRule:function(t,e,n,l){/min|max|step/.test(n)&&(null===e||/number|range|text/.test(e))&&(l=Number(l),isNaN(l)&&(l=void 0)),l||0===l?t[n]=l:e===n&&"range"!==e&&(t[n]=!0)},attributeRules:function(e){var n,l,a={},i=t(e),r=e.getAttribute("type");for(n in t.validator.methods)"required"===n?(""===(l=e.getAttribute(n))&&(l=!0),l=!!l):l=i.attr(n),this.normalizeAttributeRule(a,r,n,l);return a.maxlength&&/-1|2147483647|524288/.test(a.maxlength)&&delete a.maxlength,a},dataRules:function(e){var n,l,a={},i=t(e),r=e.getAttribute("type");for(n in t.validator.methods)""===(l=i.data("rule"+n.charAt(0).toUpperCase()+n.substring(1).toLowerCase()))&&(l=!0),this.normalizeAttributeRule(a,r,n,l);return a},staticRules:function(e){var n={},l=t.data(e.form,"validator");return l.settings.rules&&(n=t.validator.normalizeRule(l.settings.rules[e.name])||{}),n},normalizeRules:function(e,n){return t.each(e,(function(l,a){if(!1!==a){if(a.param||a.depends){var i=!0;switch(typeof a.depends){case"string":i=!!t(a.depends,n.form).length;break;case"function":i=a.depends.call(n,n)}i?e[l]=void 0===a.param||a.param:(t.data(n.form,"validator").resetElements(t(n)),delete e[l])}}else delete e[l]})),t.each(e,(function(l,a){e[l]=t.isFunction(a)&&"normalizer"!==l?a(n):a})),t.each(["minlength","maxlength"],(function(){e[this]&&(e[this]=Number(e[this]))})),t.each(["rangelength","range"],(function(){var n;e[this]&&(t.isArray(e[this])?e[this]=[Number(e[this][0]),Number(e[this][1])]:"string"==typeof e[this]&&(n=e[this].replace(/[\[\]]/g,"").split(/[\s,]+/),e[this]=[Number(n[0]),Number(n[1])]))})),t.validator.autoCreateRanges&&(null!=e.min&&null!=e.max&&(e.range=[e.min,e.max],delete e.min,delete e.max),null!=e.minlength&&null!=e.maxlength&&(e.rangelength=[e.minlength,e.maxlength],delete e.minlength,delete e.maxlength)),e},normalizeRule:function(e){if("string"==typeof e){var n={};t.each(e.split(/\s/),(function(){n[this]=!0})),e=n}return e},addMethod:function(e,n,l){t.validator.methods[e]=n,t.validator.messages[e]=void 0!==l?l:t.validator.messages[e],n.length<3&&t.validator.addClassRules(e,t.validator.normalizeRule(e))},methods:{required:function(e,n,l){if(!this.depend(l,n))return"dependency-mismatch";if("select"===n.nodeName.toLowerCase()){var a=t(n).val();return a&&a.length>0}return this.checkable(n)?this.getLength(e,n)>0:null!=e&&e.length>0},email:function(t,e){return this.optional(e)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(t)},url:function(t,e){return this.optional(e)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(t)},date:(e=!1,function(t,n){return e||(e=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(n)||!/Invalid|NaN/.test(new Date(t).toString())}),dateISO:function(t,e){return this.optional(e)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(t)},number:function(t,e){return this.optional(e)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(t)},digits:function(t,e){return this.optional(e)||/^\d+$/.test(t)},minlength:function(e,n,l){var a=t.isArray(e)?e.length:this.getLength(e,n);return this.optional(n)||a>=l},maxlength:function(e,n,l){var a=t.isArray(e)?e.length:this.getLength(e,n);return this.optional(n)||a<=l},rangelength:function(e,n,l){var a=t.isArray(e)?e.length:this.getLength(e,n);return this.optional(n)||a>=l[0]&&a<=l[1]},min:function(t,e,n){return this.optional(e)||t>=n},max:function(t,e,n){return this.optional(e)||t<=n},range:function(t,e,n){return this.optional(e)||t>=n[0]&&t<=n[1]},step:function(e,n,l){var a,i=t(n).attr("type"),r="Step attribute on input type "+i+" is not supported.",o=new RegExp("\\b"+i+"\\b"),s=function(t){var e=(""+t).match(/(?:\.(\d+))?$/);return e&&e[1]?e[1].length:0},c=function(t){return Math.round(t*Math.pow(10,a))},d=!0;if(i&&!o.test(["text","number","range"].join()))throw new Error(r);return a=s(l),(s(e)>a||c(e)%c(l)!=0)&&(d=!1),this.optional(n)||d},equalTo:function(e,n,l){var a=t(l);return this.settings.onfocusout&&a.not(".validate-equalTo-blur").length&&a.addClass("validate-equalTo-blur").on("blur.validate-equalTo",(function(){t(n).valid()})),e===a.val()},remote:function(e,n,l,a){if(this.optional(n))return"dependency-mismatch";a="string"==typeof a&&a||"remote";var i,r,o,s=this.previousValue(n,a);return this.settings.messages[n.name]||(this.settings.messages[n.name]={}),s.originalMessage=s.originalMessage||this.settings.messages[n.name][a],this.settings.messages[n.name][a]=s.message,l="string"==typeof l&&{url:l}||l,o=t.param(t.extend({data:e},l.data)),s.old===o?s.valid:(s.old=o,i=this,this.startRequest(n),(r={})[n.name]=e,t.ajax(t.extend(!0,{mode:"abort",port:"validate"+n.name,dataType:"json",data:r,context:i.currentForm,success:function(t){var l,r,o,c=!0===t||"true"===t;i.settings.messages[n.name][a]=s.originalMessage,c?(o=i.formSubmitted,i.resetInternals(),i.toHide=i.errorsFor(n),i.formSubmitted=o,i.successList.push(n),i.invalid[n.name]=!1,i.showErrors()):(l={},r=t||i.defaultMessage(n,{method:a,parameters:e}),l[n.name]=s.message=r,i.invalid[n.name]=!0,i.showErrors(l)),s.valid=c,i.stopRequest(n,c)}},l)),"pending")}}});var l,a={};return t.ajaxPrefilter?t.ajaxPrefilter((function(t,e,n){var l=t.port;"abort"===t.mode&&(a[l]&&a[l].abort(),a[l]=n)})):(l=t.ajax,t.ajax=function(e){var n=("mode"in e?e:t.ajaxSettings).mode,i=("port"in e?e:t.ajaxSettings).port;return"abort"===n?(a[i]&&a[i].abort(),a[i]=l.apply(this,arguments),a[i]):l.apply(this,arguments)}),t})?l.apply(e,a):l)||(t.exports=i)},function(t,e,n){var l;"undefined"!=typeof self&&self,l=function(){return function(t){var e={};function n(l){if(e[l])return e[l].exports;var a=e[l]={i:l,l:!1,exports:{}};return t[l].call(a.exports,a,a.exports,n),a.l=!0,a.exports}return n.m=t,n.c=e,n.d=function(t,e,l){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:l})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}({"./dist/icons.json":function(t){t.exports={activity:'',airplay:'',"alert-circle":'',"alert-octagon":'',"alert-triangle":'',"align-center":'',"align-justify":'',"align-left":'',"align-right":'',anchor:'',aperture:'',archive:'',"arrow-down-circle":'',"arrow-down-left":'',"arrow-down-right":'',"arrow-down":'',"arrow-left-circle":'',"arrow-left":'',"arrow-right-circle":'',"arrow-right":'',"arrow-up-circle":'',"arrow-up-left":'',"arrow-up-right":'',"arrow-up":'',"at-sign":'',award:'',"bar-chart-2":'',"bar-chart":'',"battery-charging":'',battery:'',"bell-off":'',bell:'',bluetooth:'',bold:'',"book-open":'',book:'',bookmark:'',box:'',briefcase:'',calendar:'',"camera-off":'',camera:'',cast:'',"check-circle":'',"check-square":'',check:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"chevrons-down":'',"chevrons-left":'',"chevrons-right":'',"chevrons-up":'',chrome:'',circle:'',clipboard:'',clock:'',"cloud-drizzle":'',"cloud-lightning":'',"cloud-off":'',"cloud-rain":'',"cloud-snow":'',cloud:'',code:'',codepen:'',codesandbox:'',coffee:'',columns:'',command:'',compass:'',copy:'',"corner-down-left":'',"corner-down-right":'',"corner-left-down":'',"corner-left-up":'',"corner-right-down":'',"corner-right-up":'',"corner-up-left":'',"corner-up-right":'',cpu:'',"credit-card":'',crop:'',crosshair:'',database:'',delete:'',disc:'',"divide-circle":'',"divide-square":'',divide:'',"dollar-sign":'',"download-cloud":'',download:'',dribbble:'',droplet:'',"edit-2":'',"edit-3":'',edit:'',"external-link":'',"eye-off":'',eye:'',facebook:'',"fast-forward":'',feather:'',figma:'',"file-minus":'',"file-plus":'',"file-text":'',file:'',film:'',filter:'',flag:'',"folder-minus":'',"folder-plus":'',folder:'',framer:'',frown:'',gift:'',"git-branch":'',"git-commit":'',"git-merge":'',"git-pull-request":'',github:'',gitlab:'',globe:'',grid:'',"hard-drive":'',hash:'',headphones:'',heart:'',"help-circle":'',hexagon:'',home:'',image:'',inbox:'',info:'',instagram:'',italic:'',key:'',layers:'',layout:'',"life-buoy":'',"link-2":'',link:'',linkedin:'',list:'',loader:'',lock:'',"log-in":'',"log-out":'',mail:'',"map-pin":'',map:'',"maximize-2":'',maximize:'',meh:'',menu:'',"message-circle":'',"message-square":'',"mic-off":'',mic:'',"minimize-2":'',minimize:'',"minus-circle":'',"minus-square":'',minus:'',monitor:'',moon:'',"more-horizontal":'',"more-vertical":'',"mouse-pointer":'',move:'',music:'',"navigation-2":'',navigation:'',octagon:'',package:'',paperclip:'',"pause-circle":'',pause:'',"pen-tool":'',percent:'',"phone-call":'',"phone-forwarded":'',"phone-incoming":'',"phone-missed":'',"phone-off":'',"phone-outgoing":'',phone:'',"pie-chart":'',"play-circle":'',play:'',"plus-circle":'',"plus-square":'',plus:'',pocket:'',power:'',printer:'',radio:'',"refresh-ccw":'',"refresh-cw":'',repeat:'',rewind:'',"rotate-ccw":'',"rotate-cw":'',rss:'',save:'',scissors:'',search:'',send:'',server:'',settings:'',"share-2":'',share:'',"shield-off":'',shield:'',"shopping-bag":'',"shopping-cart":'',shuffle:'',sidebar:'',"skip-back":'',"skip-forward":'',slack:'',slash:'',sliders:'',smartphone:'',smile:'',speaker:'',square:'',star:'',"stop-circle":'',sun:'',sunrise:'',sunset:'',tablet:'',tag:'',target:'',terminal:'',thermometer:'',"thumbs-down":'',"thumbs-up":'',"toggle-left":'',"toggle-right":'',tool:'',"trash-2":'',trash:'',trello:'',"trending-down":'',"trending-up":'',triangle:'',truck:'',tv:'',twitch:'',twitter:'',type:'',umbrella:'',underline:'',unlock:'',"upload-cloud":'',upload:'',"user-check":'',"user-minus":'',"user-plus":'',"user-x":'',user:'',users:'',"video-off":'',video:'',voicemail:'',"volume-1":'',"volume-2":'',"volume-x":'',volume:'',watch:'',"wifi-off":'',wifi:'',wind:'',"x-circle":'',"x-octagon":'',"x-square":'',x:'',youtube:'',"zap-off":'',zap:'',"zoom-in":'',"zoom-out":''}},"./node_modules/classnames/dedupe.js":function(t,e,n){var l;!function(){"use strict";var n=function(){function t(){}function e(t,e){for(var n=e.length,l=0;l1?arguments[1]:void 0,m=void 0!==g,v=0,b=c(h);if(m&&(g=l(g,f>2?arguments[2]:void 0,2)),null==b||p==Array&&r(b))for(n=new p(e=o(h.length));e>v;v++)s(n,v,m?g(h[v],v):h[v]);else for(u=b.call(h),n=new p;!(d=u.next()).done;v++)s(n,v,m?i(u,g,[d.value,v],!0):d.value);return n.length=v,n}},"./node_modules/core-js/internals/array-includes.js":function(t,e,n){var l=n("./node_modules/core-js/internals/to-indexed-object.js"),a=n("./node_modules/core-js/internals/to-length.js"),i=n("./node_modules/core-js/internals/to-absolute-index.js");t.exports=function(t){return function(e,n,r){var o,s=l(e),c=a(s.length),d=i(r,c);if(t&&n!=n){for(;c>d;)if((o=s[d++])!=o)return!0}else for(;c>d;d++)if((t||d in s)&&s[d]===n)return t||d||0;return!t&&-1}}},"./node_modules/core-js/internals/bind-context.js":function(t,e,n){var l=n("./node_modules/core-js/internals/a-function.js");t.exports=function(t,e,n){if(l(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,l){return t.call(e,n,l)};case 3:return function(n,l,a){return t.call(e,n,l,a)}}return function(){return t.apply(e,arguments)}}},"./node_modules/core-js/internals/call-with-safe-iteration-closing.js":function(t,e,n){var l=n("./node_modules/core-js/internals/an-object.js");t.exports=function(t,e,n,a){try{return a?e(l(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&l(i.call(t)),e}}},"./node_modules/core-js/internals/check-correctness-of-iteration.js":function(t,e,n){var l=n("./node_modules/core-js/internals/well-known-symbol.js")("iterator"),a=!1;try{var i=0,r={next:function(){return{done:!!i++}},return:function(){a=!0}};r[l]=function(){return this},Array.from(r,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!a)return!1;var n=!1;try{var i={};i[l]=function(){return{next:function(){return{done:n=!0}}}},t(i)}catch(t){}return n}},"./node_modules/core-js/internals/classof-raw.js":function(t,e){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},"./node_modules/core-js/internals/classof.js":function(t,e,n){var l=n("./node_modules/core-js/internals/classof-raw.js"),a=n("./node_modules/core-js/internals/well-known-symbol.js")("toStringTag"),i="Arguments"==l(function(){return arguments}());t.exports=function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),a))?n:i?l(e):"Object"==(r=l(e))&&"function"==typeof e.callee?"Arguments":r}},"./node_modules/core-js/internals/copy-constructor-properties.js":function(t,e,n){var l=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/own-keys.js"),i=n("./node_modules/core-js/internals/object-get-own-property-descriptor.js"),r=n("./node_modules/core-js/internals/object-define-property.js");t.exports=function(t,e){for(var n=a(e),o=r.f,s=i.f,c=0;cdocument.F=Object<\/script>"),t.close(),u=t.F;n--;)delete u.prototype[i[n]];return u()};t.exports=Object.create||function(t,e){var n;return null!==t?(d.prototype=l(t),n=new d,d.prototype=null,n[c]=t):n=u(),void 0===e?n:a(n,e)},r[c]=!0},"./node_modules/core-js/internals/object-define-properties.js":function(t,e,n){var l=n("./node_modules/core-js/internals/descriptors.js"),a=n("./node_modules/core-js/internals/object-define-property.js"),i=n("./node_modules/core-js/internals/an-object.js"),r=n("./node_modules/core-js/internals/object-keys.js");t.exports=l?Object.defineProperties:function(t,e){i(t);for(var n,l=r(e),o=l.length,s=0;o>s;)a.f(t,n=l[s++],e[n]);return t}},"./node_modules/core-js/internals/object-define-property.js":function(t,e,n){var l=n("./node_modules/core-js/internals/descriptors.js"),a=n("./node_modules/core-js/internals/ie8-dom-define.js"),i=n("./node_modules/core-js/internals/an-object.js"),r=n("./node_modules/core-js/internals/to-primitive.js"),o=Object.defineProperty;e.f=l?o:function(t,e,n){if(i(t),e=r(e,!0),i(n),a)try{return o(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},"./node_modules/core-js/internals/object-get-own-property-descriptor.js":function(t,e,n){var l=n("./node_modules/core-js/internals/descriptors.js"),a=n("./node_modules/core-js/internals/object-property-is-enumerable.js"),i=n("./node_modules/core-js/internals/create-property-descriptor.js"),r=n("./node_modules/core-js/internals/to-indexed-object.js"),o=n("./node_modules/core-js/internals/to-primitive.js"),s=n("./node_modules/core-js/internals/has.js"),c=n("./node_modules/core-js/internals/ie8-dom-define.js"),d=Object.getOwnPropertyDescriptor;e.f=l?d:function(t,e){if(t=r(t),e=o(e,!0),c)try{return d(t,e)}catch(t){}if(s(t,e))return i(!a.f.call(t,e),t[e])}},"./node_modules/core-js/internals/object-get-own-property-names.js":function(t,e,n){var l=n("./node_modules/core-js/internals/object-keys-internal.js"),a=n("./node_modules/core-js/internals/enum-bug-keys.js").concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return l(t,a)}},"./node_modules/core-js/internals/object-get-own-property-symbols.js":function(t,e){e.f=Object.getOwnPropertySymbols},"./node_modules/core-js/internals/object-get-prototype-of.js":function(t,e,n){var l=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/to-object.js"),i=n("./node_modules/core-js/internals/shared-key.js"),r=n("./node_modules/core-js/internals/correct-prototype-getter.js"),o=i("IE_PROTO"),s=Object.prototype;t.exports=r?Object.getPrototypeOf:function(t){return t=a(t),l(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},"./node_modules/core-js/internals/object-keys-internal.js":function(t,e,n){var l=n("./node_modules/core-js/internals/has.js"),a=n("./node_modules/core-js/internals/to-indexed-object.js"),i=n("./node_modules/core-js/internals/array-includes.js"),r=n("./node_modules/core-js/internals/hidden-keys.js"),o=i(!1);t.exports=function(t,e){var n,i=a(t),s=0,c=[];for(n in i)!l(r,n)&&l(i,n)&&c.push(n);for(;e.length>s;)l(i,n=e[s++])&&(~o(c,n)||c.push(n));return c}},"./node_modules/core-js/internals/object-keys.js":function(t,e,n){var l=n("./node_modules/core-js/internals/object-keys-internal.js"),a=n("./node_modules/core-js/internals/enum-bug-keys.js");t.exports=Object.keys||function(t){return l(t,a)}},"./node_modules/core-js/internals/object-property-is-enumerable.js":function(t,e,n){"use strict";var l={}.propertyIsEnumerable,a=Object.getOwnPropertyDescriptor,i=a&&!l.call({1:2},1);e.f=i?function(t){var e=a(this,t);return!!e&&e.enumerable}:l},"./node_modules/core-js/internals/object-set-prototype-of.js":function(t,e,n){var l=n("./node_modules/core-js/internals/validate-set-prototype-of-arguments.js");t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(n,[]),e=n instanceof Array}catch(t){}return function(n,a){return l(n,a),e?t.call(n,a):n.__proto__=a,n}}():void 0)},"./node_modules/core-js/internals/own-keys.js":function(t,e,n){var l=n("./node_modules/core-js/internals/global.js"),a=n("./node_modules/core-js/internals/object-get-own-property-names.js"),i=n("./node_modules/core-js/internals/object-get-own-property-symbols.js"),r=n("./node_modules/core-js/internals/an-object.js"),o=l.Reflect;t.exports=o&&o.ownKeys||function(t){var e=a.f(r(t)),n=i.f;return n?e.concat(n(t)):e}},"./node_modules/core-js/internals/path.js":function(t,e,n){t.exports=n("./node_modules/core-js/internals/global.js")},"./node_modules/core-js/internals/redefine.js":function(t,e,n){var l=n("./node_modules/core-js/internals/global.js"),a=n("./node_modules/core-js/internals/shared.js"),i=n("./node_modules/core-js/internals/hide.js"),r=n("./node_modules/core-js/internals/has.js"),o=n("./node_modules/core-js/internals/set-global.js"),s=n("./node_modules/core-js/internals/function-to-string.js"),c=n("./node_modules/core-js/internals/internal-state.js"),d=c.get,u=c.enforce,h=String(s).split("toString");a("inspectSource",(function(t){return s.call(t)})),(t.exports=function(t,e,n,a){var s=!!a&&!!a.unsafe,c=!!a&&!!a.enumerable,d=!!a&&!!a.noTargetGet;"function"==typeof n&&("string"!=typeof e||r(n,"name")||i(n,"name",e),u(n).source=h.join("string"==typeof e?e:"")),t!==l?(s?!d&&t[e]&&(c=!0):delete t[e],c?t[e]=n:i(t,e,n)):c?t[e]=n:o(e,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&d(this).source||s.call(this)}))},"./node_modules/core-js/internals/require-object-coercible.js":function(t,e){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},"./node_modules/core-js/internals/set-global.js":function(t,e,n){var l=n("./node_modules/core-js/internals/global.js"),a=n("./node_modules/core-js/internals/hide.js");t.exports=function(t,e){try{a(l,t,e)}catch(n){l[t]=e}return e}},"./node_modules/core-js/internals/set-to-string-tag.js":function(t,e,n){var l=n("./node_modules/core-js/internals/object-define-property.js").f,a=n("./node_modules/core-js/internals/has.js"),i=n("./node_modules/core-js/internals/well-known-symbol.js")("toStringTag");t.exports=function(t,e,n){t&&!a(t=n?t:t.prototype,i)&&l(t,i,{configurable:!0,value:e})}},"./node_modules/core-js/internals/shared-key.js":function(t,e,n){var l=n("./node_modules/core-js/internals/shared.js"),a=n("./node_modules/core-js/internals/uid.js"),i=l("keys");t.exports=function(t){return i[t]||(i[t]=a(t))}},"./node_modules/core-js/internals/shared.js":function(t,e,n){var l=n("./node_modules/core-js/internals/global.js"),a=n("./node_modules/core-js/internals/set-global.js"),i=n("./node_modules/core-js/internals/is-pure.js"),r=l["__core-js_shared__"]||a("__core-js_shared__",{});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.1.3",mode:i?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},"./node_modules/core-js/internals/string-at.js":function(t,e,n){var l=n("./node_modules/core-js/internals/to-integer.js"),a=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(t,e,n){var i,r,o=String(a(t)),s=l(e),c=o.length;return s<0||s>=c?n?"":void 0:(i=o.charCodeAt(s))<55296||i>56319||s+1===c||(r=o.charCodeAt(s+1))<56320||r>57343?n?o.charAt(s):i:n?o.slice(s,s+2):r-56320+(i-55296<<10)+65536}},"./node_modules/core-js/internals/to-absolute-index.js":function(t,e,n){var l=n("./node_modules/core-js/internals/to-integer.js"),a=Math.max,i=Math.min;t.exports=function(t,e){var n=l(t);return n<0?a(n+e,0):i(n,e)}},"./node_modules/core-js/internals/to-indexed-object.js":function(t,e,n){var l=n("./node_modules/core-js/internals/indexed-object.js"),a=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(t){return l(a(t))}},"./node_modules/core-js/internals/to-integer.js":function(t,e){var n=Math.ceil,l=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?l:n)(t)}},"./node_modules/core-js/internals/to-length.js":function(t,e,n){var l=n("./node_modules/core-js/internals/to-integer.js"),a=Math.min;t.exports=function(t){return t>0?a(l(t),9007199254740991):0}},"./node_modules/core-js/internals/to-object.js":function(t,e,n){var l=n("./node_modules/core-js/internals/require-object-coercible.js");t.exports=function(t){return Object(l(t))}},"./node_modules/core-js/internals/to-primitive.js":function(t,e,n){var l=n("./node_modules/core-js/internals/is-object.js");t.exports=function(t,e){if(!l(t))return t;var n,a;if(e&&"function"==typeof(n=t.toString)&&!l(a=n.call(t)))return a;if("function"==typeof(n=t.valueOf)&&!l(a=n.call(t)))return a;if(!e&&"function"==typeof(n=t.toString)&&!l(a=n.call(t)))return a;throw TypeError("Can't convert object to primitive value")}},"./node_modules/core-js/internals/uid.js":function(t,e){var n=0,l=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+l).toString(36))}},"./node_modules/core-js/internals/validate-set-prototype-of-arguments.js":function(t,e,n){var l=n("./node_modules/core-js/internals/is-object.js"),a=n("./node_modules/core-js/internals/an-object.js");t.exports=function(t,e){if(a(t),!l(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype")}},"./node_modules/core-js/internals/well-known-symbol.js":function(t,e,n){var l=n("./node_modules/core-js/internals/global.js"),a=n("./node_modules/core-js/internals/shared.js"),i=n("./node_modules/core-js/internals/uid.js"),r=n("./node_modules/core-js/internals/native-symbol.js"),o=l.Symbol,s=a("wks");t.exports=function(t){return s[t]||(s[t]=r&&o[t]||(r?o:i)("Symbol."+t))}},"./node_modules/core-js/modules/es.array.from.js":function(t,e,n){var l=n("./node_modules/core-js/internals/export.js"),a=n("./node_modules/core-js/internals/array-from.js");l({target:"Array",stat:!0,forced:!n("./node_modules/core-js/internals/check-correctness-of-iteration.js")((function(t){Array.from(t)}))},{from:a})},"./node_modules/core-js/modules/es.string.iterator.js":function(t,e,n){"use strict";var l=n("./node_modules/core-js/internals/string-at.js"),a=n("./node_modules/core-js/internals/internal-state.js"),i=n("./node_modules/core-js/internals/define-iterator.js"),r=a.set,o=a.getterFor("String Iterator");i(String,"String",(function(t){r(this,{type:"String Iterator",string:String(t),index:0})}),(function(){var t,e=o(this),n=e.string,a=e.index;return a>=n.length?{value:void 0,done:!0}:(t=l(n,a,!0),e.index+=t.length,{value:t,done:!1})}))},"./node_modules/webpack/buildin/global.js":function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},"./src/default-attrs.json":function(t){t.exports={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"}},"./src/icon.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=Object.assign||function(t){for(var e=1;e2&&void 0!==arguments[2]?arguments[2]:[];s(this,t),this.name=e,this.contents=n,this.tags=a,this.attrs=l({},r.default,{class:"feather feather-"+e})}return a(t,[{key:"toSvg",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=l({},this.attrs,t,{class:(0,i.default)(this.attrs.class,t.class)});return""+this.contents+""}},{key:"toString",value:function(){return this.contents}}]),t}();function d(t){return Object.keys(t).map((function(e){return e+'="'+t[e]+'"'})).join(" ")}e.default=c},"./src/icons.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=r(n("./src/icon.js")),a=r(n("./dist/icons.json")),i=r(n("./src/tags.json"));function r(t){return t&&t.__esModule?t:{default:t}}e.default=Object.keys(a.default).map((function(t){return new l.default(t,a.default[t],i.default[t])})).reduce((function(t,e){return t[e.name]=e,t}),{})},"./src/index.js":function(t,e,n){"use strict";var l=r(n("./src/icons.js")),a=r(n("./src/to-svg.js")),i=r(n("./src/replace.js"));function r(t){return t&&t.__esModule?t:{default:t}}t.exports={icons:l.default,toSvg:a.default,replace:i.default}},"./src/replace.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l=Object.assign||function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{},n=s(t),r=n["data-feather"];delete n["data-feather"];var o=i.default[r].toSvg(l({},e,n,{class:(0,a.default)(e.class,n.class)})),c=(new DOMParser).parseFromString(o,"image/svg+xml"),d=c.querySelector("svg");t.parentNode.replaceChild(d,t)}function s(t){return Array.from(t.attributes).reduce((function(t,e){return t[e.name]=e.value,t}),{})}e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if("undefined"==typeof document)throw new Error("`feather.replace()` only works in a browser environment.");var e=document.querySelectorAll("[data-feather]");Array.from(e).forEach((function(e){return o(e,t)}))}},"./src/tags.json":function(t){t.exports={activity:["pulse","health","action","motion"],airplay:["stream","cast","mirroring"],"alert-circle":["warning","alert","danger"],"alert-octagon":["warning","alert","danger"],"alert-triangle":["warning","alert","danger"],"align-center":["text alignment","center"],"align-justify":["text alignment","justified"],"align-left":["text alignment","left"],"align-right":["text alignment","right"],anchor:[],archive:["index","box"],"at-sign":["mention","at","email","message"],award:["achievement","badge"],aperture:["camera","photo"],"bar-chart":["statistics","diagram","graph"],"bar-chart-2":["statistics","diagram","graph"],battery:["power","electricity"],"battery-charging":["power","electricity"],bell:["alarm","notification","sound"],"bell-off":["alarm","notification","silent"],bluetooth:["wireless"],"book-open":["read","library"],book:["read","dictionary","booklet","magazine","library"],bookmark:["read","clip","marker","tag"],box:["cube"],briefcase:["work","bag","baggage","folder"],calendar:["date"],camera:["photo"],cast:["chromecast","airplay"],circle:["off","zero","record"],clipboard:["copy"],clock:["time","watch","alarm"],"cloud-drizzle":["weather","shower"],"cloud-lightning":["weather","bolt"],"cloud-rain":["weather"],"cloud-snow":["weather","blizzard"],cloud:["weather"],codepen:["logo"],codesandbox:["logo"],code:["source","programming"],coffee:["drink","cup","mug","tea","cafe","hot","beverage"],columns:["layout"],command:["keyboard","cmd","terminal","prompt"],compass:["navigation","safari","travel","direction"],copy:["clone","duplicate"],"corner-down-left":["arrow","return"],"corner-down-right":["arrow"],"corner-left-down":["arrow"],"corner-left-up":["arrow"],"corner-right-down":["arrow"],"corner-right-up":["arrow"],"corner-up-left":["arrow"],"corner-up-right":["arrow"],cpu:["processor","technology"],"credit-card":["purchase","payment","cc"],crop:["photo","image"],crosshair:["aim","target"],database:["storage","memory"],delete:["remove"],disc:["album","cd","dvd","music"],"dollar-sign":["currency","money","payment"],droplet:["water"],edit:["pencil","change"],"edit-2":["pencil","change"],"edit-3":["pencil","change"],eye:["view","watch"],"eye-off":["view","watch","hide","hidden"],"external-link":["outbound"],facebook:["logo","social"],"fast-forward":["music"],figma:["logo","design","tool"],"file-minus":["delete","remove","erase"],"file-plus":["add","create","new"],"file-text":["data","txt","pdf"],film:["movie","video"],filter:["funnel","hopper"],flag:["report"],"folder-minus":["directory"],"folder-plus":["directory"],folder:["directory"],framer:["logo","design","tool"],frown:["emoji","face","bad","sad","emotion"],gift:["present","box","birthday","party"],"git-branch":["code","version control"],"git-commit":["code","version control"],"git-merge":["code","version control"],"git-pull-request":["code","version control"],github:["logo","version control"],gitlab:["logo","version control"],globe:["world","browser","language","translate"],"hard-drive":["computer","server","memory","data"],hash:["hashtag","number","pound"],headphones:["music","audio","sound"],heart:["like","love","emotion"],"help-circle":["question mark"],hexagon:["shape","node.js","logo"],home:["house","living"],image:["picture"],inbox:["email"],instagram:["logo","camera"],key:["password","login","authentication","secure"],layers:["stack"],layout:["window","webpage"],"life-bouy":["help","life ring","support"],link:["chain","url"],"link-2":["chain","url"],linkedin:["logo","social media"],list:["options"],lock:["security","password","secure"],"log-in":["sign in","arrow","enter"],"log-out":["sign out","arrow","exit"],mail:["email","message"],"map-pin":["location","navigation","travel","marker"],map:["location","navigation","travel"],maximize:["fullscreen"],"maximize-2":["fullscreen","arrows","expand"],meh:["emoji","face","neutral","emotion"],menu:["bars","navigation","hamburger"],"message-circle":["comment","chat"],"message-square":["comment","chat"],"mic-off":["record","sound","mute"],mic:["record","sound","listen"],minimize:["exit fullscreen","close"],"minimize-2":["exit fullscreen","arrows","close"],minus:["subtract"],monitor:["tv","screen","display"],moon:["dark","night"],"more-horizontal":["ellipsis"],"more-vertical":["ellipsis"],"mouse-pointer":["arrow","cursor"],move:["arrows"],music:["note"],navigation:["location","travel"],"navigation-2":["location","travel"],octagon:["stop"],package:["box","container"],paperclip:["attachment"],pause:["music","stop"],"pause-circle":["music","audio","stop"],"pen-tool":["vector","drawing"],percent:["discount"],"phone-call":["ring"],"phone-forwarded":["call"],"phone-incoming":["call"],"phone-missed":["call"],"phone-off":["call","mute"],"phone-outgoing":["call"],phone:["call"],play:["music","start"],"pie-chart":["statistics","diagram"],"play-circle":["music","start"],plus:["add","new"],"plus-circle":["add","new"],"plus-square":["add","new"],pocket:["logo","save"],power:["on","off"],printer:["fax","office","device"],radio:["signal"],"refresh-cw":["synchronise","arrows"],"refresh-ccw":["arrows"],repeat:["loop","arrows"],rewind:["music"],"rotate-ccw":["arrow"],"rotate-cw":["arrow"],rss:["feed","subscribe"],save:["floppy disk"],scissors:["cut"],search:["find","magnifier","magnifying glass"],send:["message","mail","email","paper airplane","paper aeroplane"],settings:["cog","edit","gear","preferences"],"share-2":["network","connections"],shield:["security","secure"],"shield-off":["security","insecure"],"shopping-bag":["ecommerce","cart","purchase","store"],"shopping-cart":["ecommerce","cart","purchase","store"],shuffle:["music"],"skip-back":["music"],"skip-forward":["music"],slack:["logo"],slash:["ban","no"],sliders:["settings","controls"],smartphone:["cellphone","device"],smile:["emoji","face","happy","good","emotion"],speaker:["audio","music"],star:["bookmark","favorite","like"],"stop-circle":["media","music"],sun:["brightness","weather","light"],sunrise:["weather","time","morning","day"],sunset:["weather","time","evening","night"],tablet:["device"],tag:["label"],target:["logo","bullseye"],terminal:["code","command line","prompt"],thermometer:["temperature","celsius","fahrenheit","weather"],"thumbs-down":["dislike","bad","emotion"],"thumbs-up":["like","good","emotion"],"toggle-left":["on","off","switch"],"toggle-right":["on","off","switch"],tool:["settings","spanner"],trash:["garbage","delete","remove","bin"],"trash-2":["garbage","delete","remove","bin"],triangle:["delta"],truck:["delivery","van","shipping","transport","lorry"],tv:["television","stream"],twitch:["logo"],twitter:["logo","social"],type:["text"],umbrella:["rain","weather"],unlock:["security"],"user-check":["followed","subscribed"],"user-minus":["delete","remove","unfollow","unsubscribe"],"user-plus":["new","add","create","follow","subscribe"],"user-x":["delete","remove","unfollow","unsubscribe","unavailable"],user:["person","account"],users:["group"],"video-off":["camera","movie","film"],video:["camera","movie","film"],voicemail:["phone"],volume:["music","sound","mute"],"volume-1":["music","sound"],"volume-2":["music","sound"],"volume-x":["music","sound","mute"],watch:["clock","time"],"wifi-off":["disabled"],wifi:["connection","signal","wireless"],wind:["weather","air"],"x-circle":["cancel","close","delete","remove","times","clear"],"x-octagon":["delete","stop","alert","warning","times","clear"],"x-square":["cancel","close","delete","remove","times","clear"],x:["cancel","close","delete","remove","times","clear"],youtube:["logo","video","play"],"zap-off":["flash","camera","lightning"],zap:["flash","camera","lightning"],"zoom-in":["magnifying glass"],"zoom-out":["magnifying glass"]}},"./src/to-svg.js":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var l,a=n("./src/icons.js"),i=(l=a)&&l.__esModule?l:{default:l};e.default=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(console.warn("feather.toSvg() is deprecated. Please use feather.icons[name].toSvg() instead."),!t)throw new Error("The required `key` (icon name) parameter is missing.");if(!i.default[t])throw new Error("No icon matching '"+t+"'. See the complete list of icons at https://feathericons.com");return i.default[t].toSvg(e)}},0:function(t,e,n){n("./node_modules/core-js/es/array/from.js"),t.exports=n("./src/index.js")}})},t.exports=l()},function(t,e,n){var l,a;n(63),l=[n(1)],void 0===(a=function(t){return function(){var e,n,l,a=0,i="error",r="info",o="success",s="warning",c={clear:function(n,l){var a=f();e||d(a),u(n,a,l)||function(n){for(var l=e.children(),a=l.length-1;a>=0;a--)u(t(l[a]),n)}(a)},remove:function(n){var l=f();e||d(l),n&&0===t(":focus",n).length?g(n):e.children().length&&e.remove()},error:function(t,e,n){return p({type:i,iconClass:f().iconClasses.error,message:t,optionsOverride:n,title:e})},getContainer:d,info:function(t,e,n){return p({type:r,iconClass:f().iconClasses.info,message:t,optionsOverride:n,title:e})},options:{},subscribe:function(t){n=t},success:function(t,e,n){return p({type:o,iconClass:f().iconClasses.success,message:t,optionsOverride:n,title:e})},version:"2.1.4",warning:function(t,e,n){return p({type:s,iconClass:f().iconClasses.warning,message:t,optionsOverride:n,title:e})}};return c;function d(n,l){return n||(n=f()),(e=t("#"+n.containerId)).length||l&&(e=function(n){return(e=t("
").attr("id",n.containerId).addClass(n.positionClass)).appendTo(t(n.target)),e}(n)),e}function u(e,n,l){var a=!(!l||!l.force)&&l.force;return!(!e||!a&&0!==t(":focus",e).length||(e[n.hideMethod]({duration:n.hideDuration,easing:n.hideEasing,complete:function(){g(e)}}),0))}function h(t){n&&n(t)}function p(n){var i=f(),r=n.iconClass||i.iconClass;if(void 0!==n.optionsOverride&&(i=t.extend(i,n.optionsOverride),r=n.optionsOverride.iconClass||r),!function(t,e){if(t.preventDuplicates){if(e.message===l)return!0;l=e.message}return!1}(i,n)){a++,e=d(i,!0);var o=null,s=t("
"),c=t("
"),u=t("
"),p=t("
"),m=t(i.closeHtml),v={intervalId:null,hideEta:null,maxHideTime:null},b={toastId:a,state:"visible",startTime:new Date,options:i,map:n};return n.iconClass&&s.addClass(i.toastClass).addClass(r),function(){if(n.title){var t=n.title;i.escapeHtml&&(t=y(n.title)),c.append(t).addClass(i.titleClass),s.append(c)}}(),function(){if(n.message){var t=n.message;i.escapeHtml&&(t=y(n.message)),u.append(t).addClass(i.messageClass),s.append(u)}}(),i.closeButton&&(m.addClass(i.closeClass).attr("role","button"),s.prepend(m)),i.progressBar&&(p.addClass(i.progressClass),s.prepend(p)),i.rtl&&s.addClass("rtl"),i.newestOnTop?e.prepend(s):e.append(s),function(){var t="";switch(n.iconClass){case"toast-success":case"toast-info":t="polite";break;default:t="assertive"}s.attr("aria-live",t)}(),s.hide(),s[i.showMethod]({duration:i.showDuration,easing:i.showEasing,complete:i.onShown}),i.timeOut>0&&(o=setTimeout(x,i.timeOut),v.maxHideTime=parseFloat(i.timeOut),v.hideEta=(new Date).getTime()+v.maxHideTime,i.progressBar&&(v.intervalId=setInterval(S,10))),i.closeOnHover&&s.hover(w,_),!i.onclick&&i.tapToDismiss&&s.click(x),i.closeButton&&m&&m.click((function(t){t.stopPropagation?t.stopPropagation():void 0!==t.cancelBubble&&!0!==t.cancelBubble&&(t.cancelBubble=!0),i.onCloseClick&&i.onCloseClick(t),x(!0)})),i.onclick&&s.click((function(t){i.onclick(t),x()})),h(b),i.debug&&console&&console.log(b),s}function y(t){return null==t&&(t=""),t.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}function x(e){var n=e&&!1!==i.closeMethod?i.closeMethod:i.hideMethod,l=e&&!1!==i.closeDuration?i.closeDuration:i.hideDuration,a=e&&!1!==i.closeEasing?i.closeEasing:i.hideEasing;if(!t(":focus",s).length||e)return clearTimeout(v.intervalId),s[n]({duration:l,easing:a,complete:function(){g(s),clearTimeout(o),i.onHidden&&"hidden"!==b.state&&i.onHidden(),b.state="hidden",b.endTime=new Date,h(b)}})}function _(){(i.timeOut>0||i.extendedTimeOut>0)&&(o=setTimeout(x,i.extendedTimeOut),v.maxHideTime=parseFloat(i.extendedTimeOut),v.hideEta=(new Date).getTime()+v.maxHideTime)}function w(){clearTimeout(o),v.hideEta=0,s.stop(!0,!0)[i.showMethod]({duration:i.showDuration,easing:i.showEasing})}function S(){var t=(v.hideEta-(new Date).getTime())/v.maxHideTime*100;p.width(t+"%")}}function f(){return t.extend({},{tapToDismiss:!0,toastClass:"toast",containerId:"toast-container",debug:!1,showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1e3,hideEasing:"swing",onHidden:void 0,closeMethod:!1,closeDuration:!1,closeEasing:!1,closeOnHover:!0,extendedTimeOut:1e3,iconClasses:{error:"toast-error",info:"toast-info",success:"toast-success",warning:"toast-warning"},iconClass:"toast-info",positionClass:"toast-top-right",timeOut:5e3,titleClass:"toast-title",messageClass:"toast-message",escapeHtml:!1,target:"body",closeHtml:'',closeClass:"toast-close-button",newestOnTop:!0,preventDuplicates:!1,progressBar:!1,progressClass:"toast-progress",rtl:!1},c.options)}function g(t){e||(e=d()),t.is(":visible")||(t.remove(),t=null,0===e.children().length&&(e.remove(),l=void 0))}}()}.apply(e,l))||(t.exports=a)},function(t,e,n){"use strict";(function(e){var l=n(65),a=n(71),i=n(74),r=document,o=r.documentElement;function s(t,n,l,i){e.navigator.pointerEnabled?a[n](t,{mouseup:"pointerup",mousedown:"pointerdown",mousemove:"pointermove"}[l],i):e.navigator.msPointerEnabled?a[n](t,{mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"}[l],i):(a[n](t,{mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"}[l],i),a[n](t,l,i))}function c(t){if(void 0!==t.touches)return t.touches.length;if(void 0!==t.which&&0!==t.which)return t.which;if(void 0!==t.buttons)return t.buttons;var e=t.button;return void 0!==e?1&e?1:2&e?3:4&e?2:0:void 0}function d(t){var e=t.getBoundingClientRect();return{left:e.left+u("scrollLeft","pageXOffset"),top:e.top+u("scrollTop","pageYOffset")}}function u(t,n){return void 0!==e[n]?e[n]:o.clientHeight?o[t]:r.body[t]}function h(t,e,n){var l,a=t||{},i=a.className;return a.className+=" gu-hide",l=r.elementFromPoint(e,n),a.className=i,l}function p(){return!1}function f(){return!0}function g(t){return t.width||t.right-t.left}function m(t){return t.height||t.bottom-t.top}function v(t){return t.parentNode===r?null:t.parentNode}function b(t){return"INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||function t(e){if(!e)return!1;if("false"===e.contentEditable)return!1;if("true"===e.contentEditable)return!0;return t(v(e))}(t)}function y(t){return t.nextElementSibling||function(){var e=t;do{e=e.nextSibling}while(e&&1!==e.nodeType);return e}()}function x(t,e){var n=function(t){return t.targetTouches&&t.targetTouches.length?t.targetTouches[0]:t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t}(e),l={pageX:"clientX",pageY:"clientY"};return t in l&&!(t in n)&&l[t]in n&&(t=l[t]),n[t]}t.exports=function(t,e){var n,u,_,w,S,C,k,D,T,E,M,A=arguments.length;1===A&&!1===Array.isArray(t)&&(e=t,t=[]);var I,R=null,P=e||{};void 0===P.moves&&(P.moves=f),void 0===P.accepts&&(P.accepts=f),void 0===P.invalid&&(P.invalid=Y),void 0===P.containers&&(P.containers=t||[]),void 0===P.isContainer&&(P.isContainer=p),void 0===P.copy&&(P.copy=!1),void 0===P.copySortSource&&(P.copySortSource=!1),void 0===P.revertOnSpill&&(P.revertOnSpill=!1),void 0===P.removeOnSpill&&(P.removeOnSpill=!1),void 0===P.direction&&(P.direction="vertical"),void 0===P.ignoreInputTextSelection&&(P.ignoreInputTextSelection=!0),void 0===P.mirrorContainer&&(P.mirrorContainer=r.body);var j=l({containers:P.containers,start:W,end:U,cancel:J,remove:Q,destroy:B,canMove:$,dragging:!1});return!0===P.removeOnSpill&&j.on("over",at).on("out",it),N(),j;function O(t){return-1!==j.containers.indexOf(t)||P.isContainer(t)}function N(t){var e=t?"remove":"add";s(o,e,"mousedown",q),s(o,e,"mouseup",X)}function L(t){s(o,t?"remove":"add","mousemove",z)}function F(t){var e=t?"remove":"add";a[e](o,"selectstart",H),a[e](o,"click",H)}function B(){N(!0),X({})}function H(t){I&&t.preventDefault()}function q(t){if(C=t.clientX,k=t.clientY,!(1!==c(t)||t.metaKey||t.ctrlKey)){var e=t.target,n=Z(e);n&&(I=n,L(),"mousedown"===t.type&&(b(e)?e.focus():t.preventDefault()))}}function z(t){if(I)if(0!==c(t)){if(void 0===t.clientX||t.clientX!==C||void 0===t.clientY||t.clientY!==k){if(P.ignoreInputTextSelection){var e=x("clientX",t),n=x("clientY",t);if(b(r.elementFromPoint(e,n)))return}var l=I;L(!0),F(),U(),V(l);var a=d(_);w=x("pageX",t)-a.left,S=x("pageY",t)-a.top,i.add(E||_,"gu-transit"),rt(),lt(t)}}else X({})}function Z(t){if(!(j.dragging&&n||O(t))){for(var e=t;v(t)&&!1===O(v(t));){if(P.invalid(t,e))return;if(!(t=v(t)))return}var l=v(t);if(l)if(!P.invalid(t,e))if(P.moves(t,l,e,y(t)))return{item:t,source:l}}}function $(t){return!!Z(t)}function W(t){var e=Z(t);e&&V(e)}function V(t){dt(t.item,t.source)&&(E=t.item.cloneNode(!0),j.emit("cloned",E,t.item,"copy")),u=t.source,_=t.item,D=T=y(t.item),j.dragging=!0,j.emit("drag",_,u)}function Y(){return!1}function U(){if(j.dragging){var t=E||_;K(t,v(t))}}function G(){I=!1,L(!0),F(!0)}function X(t){if(G(),j.dragging){var e=E||_,l=x("clientX",t),a=x("clientY",t),i=nt(h(n,l,a),l,a);i&&(E&&P.copySortSource||!E||i!==u)?K(e,i):P.removeOnSpill?Q():J()}}function K(t,e){var n=v(t);E&&P.copySortSource&&e===u&&n.removeChild(_),et(e)?j.emit("cancel",t,u,u):j.emit("drop",t,e,u,T),tt()}function Q(){if(j.dragging){var t=E||_,e=v(t);e&&e.removeChild(t),j.emit(E?"cancel":"remove",t,e,u),tt()}}function J(t){if(j.dragging){var e=arguments.length>0?t:P.revertOnSpill,n=E||_,l=v(n),a=et(l);!1===a&&e&&(E?l&&l.removeChild(E):u.insertBefore(n,D)),a||e?j.emit("cancel",n,u,u):j.emit("drop",n,l,u,T),tt()}}function tt(){var t=E||_;G(),ot(),t&&i.rm(t,"gu-transit"),M&&clearTimeout(M),j.dragging=!1,R&&j.emit("out",t,R,u),j.emit("dragend",t),u=_=E=D=T=M=R=null}function et(t,e){var l;return l=void 0!==e?e:n?T:y(E||_),t===u&&l===D}function nt(t,e,n){for(var l=t;l&&!a();)l=v(l);return l;function a(){if(!1===O(l))return!1;var a=st(l,t),i=ct(l,a,e,n);return!!et(l,i)||P.accepts(_,l,u,i)}}function lt(t){if(n){t.preventDefault();var e=x("clientX",t),l=x("clientY",t),a=e-w,i=l-S;n.style.left=a+"px",n.style.top=i+"px";var r=E||_,o=h(n,e,l),s=nt(o,e,l),c=null!==s&&s!==R;(c||null===s)&&(R&&g("out"),R=s,c&&g("over"));var d=v(r);if(s!==u||!E||P.copySortSource){var p,f=st(s,o);if(null!==f)p=ct(s,f,e,l);else{if(!0!==P.revertOnSpill||E)return void(E&&d&&d.removeChild(r));p=D,s=u}(null===p&&c||p!==r&&p!==y(r))&&(T=p,s.insertBefore(r,p),j.emit("shadow",r,s,u))}else d&&d.removeChild(r)}function g(t){j.emit(t,r,R,u)}}function at(t){i.rm(t,"gu-hide")}function it(t){j.dragging&&i.add(t,"gu-hide")}function rt(){if(!n){var t=_.getBoundingClientRect();(n=_.cloneNode(!0)).style.width=g(t)+"px",n.style.height=m(t)+"px",i.rm(n,"gu-transit"),i.add(n,"gu-mirror"),P.mirrorContainer.appendChild(n),s(o,"add","mousemove",lt),i.add(P.mirrorContainer,"gu-unselectable"),j.emit("cloned",n,_,"mirror")}}function ot(){n&&(i.rm(P.mirrorContainer,"gu-unselectable"),s(o,"remove","mousemove",lt),v(n).removeChild(n),n=null)}function st(t,e){for(var n=e;n!==t&&v(n)!==t;)n=v(n);return n===o?null:n}function ct(t,e,n,l){var a="horizontal"===P.direction;return e!==t?function(){var t=e.getBoundingClientRect();if(a)return i(n>t.left+g(t)/2);return i(l>t.top+m(t)/2)}():function(){var e,i,r,o=t.children.length;for(e=0;en)return i;if(!a&&r.top+r.height/2>l)return i}return null}();function i(t){return t?y(e):e}}function dt(t,e){return"boolean"==typeof P.copy?P.copy:P.copy(t,e)}}}).call(this,n(4))},function(t,e,n){t.exports=function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},n=function(t,e){return t(e={exports:{}},e.exports),e.exports}((function(t){var n={};for(var l in e)e.hasOwnProperty(l)&&(n[e[l]]=l);var a=t.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var i in a)if(a.hasOwnProperty(i)){if(!("channels"in a[i]))throw new Error("missing channels property: "+i);if(!("labels"in a[i]))throw new Error("missing channel labels property: "+i);if(a[i].labels.length!==a[i].channels)throw new Error("channel and label counts mismatch: "+i);var r=a[i].channels,o=a[i].labels;delete a[i].channels,delete a[i].labels,Object.defineProperty(a[i],"channels",{value:r}),Object.defineProperty(a[i],"labels",{value:o})}a.rgb.hsl=function(t){var e,n,l=t[0]/255,a=t[1]/255,i=t[2]/255,r=Math.min(l,a,i),o=Math.max(l,a,i),s=o-r;return o===r?e=0:l===o?e=(a-i)/s:a===o?e=2+(i-l)/s:i===o&&(e=4+(l-a)/s),(e=Math.min(60*e,360))<0&&(e+=360),n=(r+o)/2,[e,100*(o===r?0:n<=.5?s/(o+r):s/(2-o-r)),100*n]},a.rgb.hsv=function(t){var e,n,l,a,i,r=t[0]/255,o=t[1]/255,s=t[2]/255,c=Math.max(r,o,s),d=c-Math.min(r,o,s),u=function(t){return(c-t)/6/d+.5};return 0===d?a=i=0:(i=d/c,e=u(r),n=u(o),l=u(s),r===c?a=l-n:o===c?a=1/3+e-l:s===c&&(a=2/3+n-e),a<0?a+=1:a>1&&(a-=1)),[360*a,100*i,100*c]},a.rgb.hwb=function(t){var e=t[0],n=t[1],l=t[2];return[a.rgb.hsl(t)[0],1/255*Math.min(e,Math.min(n,l))*100,100*(l=1-1/255*Math.max(e,Math.max(n,l)))]},a.rgb.cmyk=function(t){var e,n=t[0]/255,l=t[1]/255,a=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-l,1-a)))/(1-e)||0),100*((1-l-e)/(1-e)||0),100*((1-a-e)/(1-e)||0),100*e]},a.rgb.keyword=function(t){var l=n[t];if(l)return l;var a,i,r,o=1/0;for(var s in e)if(e.hasOwnProperty(s)){var c=e[s],d=(i=t,r=c,Math.pow(i[0]-r[0],2)+Math.pow(i[1]-r[1],2)+Math.pow(i[2]-r[2],2));d.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(l=l>.04045?Math.pow((l+.055)/1.055,2.4):l/12.92)),100*(.2126*e+.7152*n+.0722*l),100*(.0193*e+.1192*n+.9505*l)]},a.rgb.lab=function(t){var e=a.rgb.xyz(t),n=e[0],l=e[1],i=e[2];return l/=100,i/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(l=l>.008856?Math.pow(l,1/3):7.787*l+16/116)-16,500*(n-l),200*(l-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},a.hsl.rgb=function(t){var e,n,l,a,i,r=t[0]/360,o=t[1]/100,s=t[2]/100;if(0===o)return[i=255*s,i,i];e=2*s-(n=s<.5?s*(1+o):s+o-s*o),a=[0,0,0];for(var c=0;c<3;c++)(l=r+1/3*-(c-1))<0&&l++,l>1&&l--,i=6*l<1?e+6*(n-e)*l:2*l<1?n:3*l<2?e+(n-e)*(2/3-l)*6:e,a[c]=255*i;return a},a.hsl.hsv=function(t){var e=t[0],n=t[1]/100,l=t[2]/100,a=n,i=Math.max(l,.01);return n*=(l*=2)<=1?l:2-l,a*=i<=1?i:2-i,[e,100*(0===l?2*a/(i+a):2*n/(l+n)),(l+n)/2*100]},a.hsv.rgb=function(t){var e=t[0]/60,n=t[1]/100,l=t[2]/100,a=Math.floor(e)%6,i=e-Math.floor(e),r=255*l*(1-n),o=255*l*(1-n*i),s=255*l*(1-n*(1-i));switch(l*=255,a){case 0:return[l,s,r];case 1:return[o,l,r];case 2:return[r,l,s];case 3:return[r,o,l];case 4:return[s,r,l];case 5:return[l,r,o]}},a.hsv.hsl=function(t){var e,n,l,a=t[0],i=t[1]/100,r=t[2]/100,o=Math.max(r,.01);return l=(2-i)*r,n=i*o,[a,100*(n=(n/=(e=(2-i)*o)<=1?e:2-e)||0),100*(l/=2)]},a.hwb.rgb=function(t){var e,n,l,a,i,r,o,s=t[0]/360,c=t[1]/100,d=t[2]/100,u=c+d;switch(u>1&&(c/=u,d/=u),l=6*s-(e=Math.floor(6*s)),0!=(1&e)&&(l=1-l),a=c+l*((n=1-d)-c),e){default:case 6:case 0:i=n,r=a,o=c;break;case 1:i=a,r=n,o=c;break;case 2:i=c,r=n,o=a;break;case 3:i=c,r=a,o=n;break;case 4:i=a,r=c,o=n;break;case 5:i=n,r=c,o=a}return[255*i,255*r,255*o]},a.cmyk.rgb=function(t){var e=t[0]/100,n=t[1]/100,l=t[2]/100,a=t[3]/100;return[255*(1-Math.min(1,e*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a)),255*(1-Math.min(1,l*(1-a)+a))]},a.xyz.rgb=function(t){var e,n,l,a=t[0]/100,i=t[1]/100,r=t[2]/100;return n=-.9689*a+1.8758*i+.0415*r,l=.0557*a+-.204*i+1.057*r,e=(e=3.2406*a+-1.5372*i+-.4986*r)>.0031308?1.055*Math.pow(e,1/2.4)-.055:12.92*e,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,l=l>.0031308?1.055*Math.pow(l,1/2.4)-.055:12.92*l,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(l=Math.min(Math.max(0,l),1))]},a.xyz.lab=function(t){var e=t[0],n=t[1],l=t[2];return n/=100,l/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(l=l>.008856?Math.pow(l,1/3):7.787*l+16/116))]},a.lab.xyz=function(t){var e,n,l,a=t[0];e=t[1]/500+(n=(a+16)/116),l=n-t[2]/200;var i=Math.pow(n,3),r=Math.pow(e,3),o=Math.pow(l,3);return n=i>.008856?i:(n-16/116)/7.787,e=r>.008856?r:(e-16/116)/7.787,l=o>.008856?o:(l-16/116)/7.787,[e*=95.047,n*=100,l*=108.883]},a.lab.lch=function(t){var e,n=t[0],l=t[1],a=t[2];return(e=360*Math.atan2(a,l)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(l*l+a*a),e]},a.lch.lab=function(t){var e,n=t[0],l=t[1];return e=t[2]/360*2*Math.PI,[n,l*Math.cos(e),l*Math.sin(e)]},a.rgb.ansi16=function(t){var e=t[0],n=t[1],l=t[2],i=1 in arguments?arguments[1]:a.rgb.hsv(t)[2];if(0===(i=Math.round(i/50)))return 30;var r=30+(Math.round(l/255)<<2|Math.round(n/255)<<1|Math.round(e/255));return 2===i&&(r+=60),r},a.hsv.ansi16=function(t){return a.rgb.ansi16(a.hsv.rgb(t),t[2])},a.rgb.ansi256=function(t){var e=t[0],n=t[1],l=t[2];return e===n&&n===l?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(n/255*5)+Math.round(l/255*5)},a.ansi16.rgb=function(t){var e=t%10;if(0===e||7===e)return t>50&&(e+=3.5),[e=e/10.5*255,e,e];var n=.5*(1+~~(t>50));return[(1&e)*n*255,(e>>1&1)*n*255,(e>>2&1)*n*255]},a.ansi256.rgb=function(t){if(t>=232){var e=10*(t-232)+8;return[e,e,e]}var n;return t-=16,[Math.floor(t/36)/5*255,Math.floor((n=t%36)/6)/5*255,n%6/5*255]},a.rgb.hex=function(t){var e=(((255&Math.round(t[0]))<<16)+((255&Math.round(t[1]))<<8)+(255&Math.round(t[2]))).toString(16).toUpperCase();return"000000".substring(e.length)+e},a.hex.rgb=function(t){var e=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];var n=e[0];3===e[0].length&&(n=n.split("").map((function(t){return t+t})).join(""));var l=parseInt(n,16);return[l>>16&255,l>>8&255,255&l]},a.rgb.hcg=function(t){var e,n=t[0]/255,l=t[1]/255,a=t[2]/255,i=Math.max(Math.max(n,l),a),r=Math.min(Math.min(n,l),a),o=i-r;return e=o<=0?0:i===n?(l-a)/o%6:i===l?2+(a-n)/o:4+(n-l)/o+4,e/=6,[360*(e%=1),100*o,100*(o<1?r/(1-o):0)]},a.hsl.hcg=function(t){var e=t[1]/100,n=t[2]/100,l=1,a=0;return(l=n<.5?2*e*n:2*e*(1-n))<1&&(a=(n-.5*l)/(1-l)),[t[0],100*l,100*a]},a.hsv.hcg=function(t){var e=t[1]/100,n=t[2]/100,l=e*n,a=0;return l<1&&(a=(n-l)/(1-l)),[t[0],100*l,100*a]},a.hcg.rgb=function(t){var e=t[0]/360,n=t[1]/100,l=t[2]/100;if(0===n)return[255*l,255*l,255*l];var a,i=[0,0,0],r=e%1*6,o=r%1,s=1-o;switch(Math.floor(r)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return a=(1-n)*l,[255*(n*i[0]+a),255*(n*i[1]+a),255*(n*i[2]+a)]},a.hcg.hsv=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e),l=0;return n>0&&(l=e/n),[t[0],100*l,100*n]},a.hcg.hsl=function(t){var e=t[1]/100,n=t[2]/100*(1-e)+.5*e,l=0;return n>0&&n<.5?l=e/(2*n):n>=.5&&n<1&&(l=e/(2*(1-n))),[t[0],100*l,100*n]},a.hcg.hwb=function(t){var e=t[1]/100,n=e+t[2]/100*(1-e);return[t[0],100*(n-e),100*(1-n)]},a.hwb.hcg=function(t){var e=t[1]/100,n=1-t[2]/100,l=n-e,a=0;return l<1&&(a=(n-l)/(1-l)),[t[0],100*l,100*a]},a.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]},a.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]},a.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]},a.gray.hsl=a.gray.hsv=function(t){return[0,0,t[0]]},a.gray.hwb=function(t){return[0,100,t[0]]},a.gray.cmyk=function(t){return[0,0,0,t[0]]},a.gray.lab=function(t){return[t[0],0,0]},a.gray.hex=function(t){var e=255&Math.round(t[0]/100*255),n=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(n.length)+n},a.rgb.gray=function(t){return[(t[0]+t[1]+t[2])/3/255*100]}}));function l(t){var e=function(){for(var t={},e=Object.keys(n),l=e.length,a=0;a1&&(e=Array.prototype.slice.call(arguments));var n=t(e);if("object"==typeof n)for(var l=n.length,a=0;a1&&(e=Array.prototype.slice.call(arguments)),t(e))};return"conversion"in t&&(e.conversion=t.conversion),e}(l)}))}));var o=r,s={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},c={getRgba:d,getHsla:u,getRgb:function(t){var e=d(t);return e&&e.slice(0,3)},getHsl:function(t){var e=u(t);return e&&e.slice(0,3)},getHwb:h,getAlpha:function(t){var e=d(t);return e||(e=u(t))||(e=h(t))?e[3]:void 0},hexString:function(t,e){return e=void 0!==e&&3===t.length?e:t[3],"#"+v(t[0])+v(t[1])+v(t[2])+(e>=0&&e<1?v(Math.round(255*e)):"")},rgbString:function(t,e){return e<1||t[3]&&t[3]<1?p(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"},rgbaString:p,percentString:function(t,e){if(e<1||t[3]&&t[3]<1)return f(t,e);var n=Math.round(t[0]/255*100),l=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgb("+n+"%, "+l+"%, "+a+"%)"},percentaString:f,hslString:function(t,e){return e<1||t[3]&&t[3]<1?g(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"},hslaString:g,hwbString:function(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"},keyword:function(t){return b[t.slice(0,3)]}};function d(t){if(t){var e=[0,0,0],n=1,l=t.match(/^#([a-fA-F0-9]{3,4})$/i),a="";if(l){a=(l=l[1])[3];for(var i=0;in?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb;return(299*t[0]+587*t[1]+114*t[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=t,l=void 0===e?.5:e,a=2*l-1,i=this.alpha()-n.alpha(),r=((a*i==-1?a:(a+i)/(1+a*i))+1)/2,o=1-r;return this.rgb(r*this.red()+o*n.red(),r*this.green()+o*n.green(),r*this.blue()+o*n.blue()).alpha(this.alpha()*l+n.alpha()*(1-l))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new x,l=this.values,a=n.values;for(var i in l)l.hasOwnProperty(i)&&(t=l[i],"[object Array]"===(e={}.toString.call(t))?a[i]=t.slice(0):"[object Number]"===e?a[i]=t:console.error("unexpected color value:",t));return n}},x.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},x.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},x.prototype.getValues=function(t){for(var e=this.values,n={},l=0;l=0;a--)e.call(n,t[a],a);else for(a=0;a=1?t:-(Math.sqrt(1-t*t)-1)},easeOutCirc:function(t){return Math.sqrt(1-(t-=1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,l=1;return 0===t?0:1===t?1:(n||(n=.3),l<1?(l=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/l),-l*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n))},easeOutElastic:function(t){var e=1.70158,n=0,l=1;return 0===t?0:1===t?1:(n||(n=.3),l<1?(l=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/l),l*Math.pow(2,-10*t)*Math.sin((t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,l=1;return 0===t?0:2==(t/=.5)?1:(n||(n=.45),l<1?(l=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/l),t<1?l*Math.pow(2,10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*-.5:l*Math.pow(2,-10*(t-=1))*Math.sin((t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;return t*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?t*t*((1+(e*=1.525))*t-e)*.5:.5*((t-=2)*t*((1+(e*=1.525))*t+e)+2)},easeInBounce:function(t){return 1-k.easeOutBounce(1-t)},easeOutBounce:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},easeInOutBounce:function(t){return t<.5?.5*k.easeInBounce(2*t):.5*k.easeOutBounce(2*t-1)+.5}},D={effects:k};C.easingEffects=k;var T=Math.PI,E=T/180,M=2*T,A=T/2,I=T/4,R=2*T/3,P={clear:function(t){t.ctx.clearRect(0,0,t.width,t.height)},roundedRect:function(t,e,n,l,a,i){if(i){var r=Math.min(i,a/2,l/2),o=e+r,s=n+r,c=e+l-r,d=n+a-r;t.moveTo(e,s),oe.left-1e-6&&t.xe.top-1e-6&&t.y0&&this.requestAnimationFrame()},advance:function(){for(var t,e,n,l,a=this.animations,i=0;i=n?(q.callback(t.onAnimationComplete,[t],e),e.animating=!1,a.splice(i,1)):++i}},Q=q.options.resolve,J=["push","pop","shift","splice","unshift"];function tt(t,e){var n=t._chartjs;if(n){var l=n.listeners,a=l.indexOf(e);-1!==a&&l.splice(a,1),l.length>0||(J.forEach((function(e){delete t[e]})),delete t._chartjs)}}var et=function(t,e){this.initialize(t,e)};q.extend(et.prototype,{datasetElementType:null,dataElementType:null,_datasetElementOptions:["backgroundColor","borderCapStyle","borderColor","borderDash","borderDashOffset","borderJoinStyle","borderWidth"],_dataElementOptions:["backgroundColor","borderColor","borderWidth","pointStyle"],initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements(),n._type=n.getMeta().type},updateIndex:function(t){this.index=t},linkScales:function(){var t=this.getMeta(),e=this.chart,n=e.scales,l=this.getDataset(),a=e.options.scales;null!==t.xAxisID&&t.xAxisID in n&&!l.xAxisID||(t.xAxisID=l.xAxisID||a.xAxes[0].id),null!==t.yAxisID&&t.yAxisID in n&&!l.yAxisID||(t.yAxisID=l.yAxisID||a.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},_getValueScaleId:function(){return this.getMeta().yAxisID},_getIndexScaleId:function(){return this.getMeta().xAxisID},_getValueScale:function(){return this.getScaleForId(this._getValueScaleId())},_getIndexScale:function(){return this.getScaleForId(this._getIndexScaleId())},reset:function(){this._update(!0)},destroy:function(){this._data&&tt(this._data,this)},createMetaDataset:function(){var t=this.datasetElementType;return t&&new t({_chart:this.chart,_datasetIndex:this.index})},createMetaData:function(t){var e=this.dataElementType;return e&&new e({_chart:this.chart,_datasetIndex:this.index,_index:t})},addElements:function(){var t,e,n=this.getMeta(),l=this.getDataset().data||[],a=n.data;for(t=0,e=l.length;tn&&this.insertElements(n,l-n)},insertElements:function(t,e){for(var n=0;na?(i=a/e.innerRadius,t.arc(r,o,e.innerRadius-a,l+i,n-i,!0)):t.arc(r,o,a,l+Math.PI/2,n-Math.PI/2),t.closePath(),t.clip()}function it(t,e,n){var l="inner"===e.borderAlign;l?(t.lineWidth=2*e.borderWidth,t.lineJoin="round"):(t.lineWidth=e.borderWidth,t.lineJoin="bevel"),n.fullCircles&&function(t,e,n,l){var a,i=n.endAngle;for(l&&(n.endAngle=n.startAngle+lt,at(t,n),n.endAngle=i,n.endAngle===n.startAngle&&n.fullCircles&&(n.endAngle+=lt,n.fullCircles--)),t.beginPath(),t.arc(n.x,n.y,n.innerRadius,n.startAngle+lt,n.startAngle,!0),a=0;ao;)a-=lt;for(;a=r&&a<=o,c=i>=n.innerRadius&&i<=n.outerRadius;return s&&c}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t,e=this._chart.ctx,n=this._view,l="inner"===n.borderAlign?.33:0,a={x:n.x,y:n.y,innerRadius:n.innerRadius,outerRadius:Math.max(n.outerRadius-l,0),pixelMargin:l,startAngle:n.startAngle,endAngle:n.endAngle,fullCircles:Math.floor(n.circumference/lt)};if(e.save(),e.fillStyle=n.backgroundColor,e.strokeStyle=n.borderColor,a.fullCircles){for(a.endAngle=a.startAngle+lt,e.beginPath(),e.arc(a.x,a.y,a.outerRadius,a.startAngle,a.endAngle),e.arc(a.x,a.y,a.innerRadius,a.endAngle,a.startAngle,!0),e.closePath(),t=0;tt.x&&(e=vt(e,"left","right")):t.basen?n:l,r:s.right||a<0?0:a>e?e:a,b:s.bottom||i<0?0:i>n?n:i,l:s.left||r<0?0:r>e?e:r}}function yt(t,e,n){var l=null===e,a=null===n,i=!(!t||l&&a)&&mt(t);return i&&(l||e>=i.left&&e<=i.right)&&(a||n>=i.top&&n<=i.bottom)}N._set("global",{elements:{rectangle:{backgroundColor:ft,borderColor:ft,borderSkipped:"bottom",borderWidth:0}}});var xt=U.extend({_type:"rectangle",draw:function(){var t=this._chart.ctx,e=this._view,n=function(t){var e=mt(t),n=e.right-e.left,l=e.bottom-e.top,a=bt(t,n/2,l/2);return{outer:{x:e.left,y:e.top,w:n,h:l},inner:{x:e.left+a.l,y:e.top+a.t,w:n-a.l-a.r,h:l-a.t-a.b}}}(e),l=n.outer,a=n.inner;t.fillStyle=e.backgroundColor,t.fillRect(l.x,l.y,l.w,l.h),l.w===a.w&&l.h===a.h||(t.save(),t.beginPath(),t.rect(l.x,l.y,l.w,l.h),t.clip(),t.fillStyle=e.borderColor,t.rect(a.x,a.y,a.w,a.h),t.fill("evenodd"),t.restore())},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){return yt(this._view,t,e)},inLabelRange:function(t,e){var n=this._view;return gt(n)?yt(n,t,null):yt(n,null,e)},inXRange:function(t){return yt(this._view,t,null)},inYRange:function(t){return yt(this._view,null,t)},getCenterPoint:function(){var t,e,n=this._view;return gt(n)?(t=n.x,e=(n.y+n.base)/2):(t=(n.x+n.base)/2,e=n.y),{x:t,y:e}},getArea:function(){var t=this._view;return gt(t)?t.width*Math.abs(t.y-t.base):t.height*Math.abs(t.x-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}}),_t={},wt=rt,St=ct,Ct=pt,kt=xt;_t.Arc=wt,_t.Line=St,_t.Point=Ct,_t.Rectangle=kt;var Dt=q._deprecated,Tt=q.valueOrDefault;function Et(t,e,n){var l,a,i=n.barThickness,r=e.stackCount,o=e.pixels[t],s=q.isNullOrUndef(i)?function(t,e){var n,l,a,i,r=t._length;for(a=1,i=e.length;a0?Math.min(r,Math.abs(l-n)):r,n=l;return r}(e.scale,e.pixels):-1;return q.isNullOrUndef(i)?(l=s*n.categoryPercentage,a=n.barPercentage):(l=i*r,a=1),{chunk:l/r,ratio:a,start:o-l/2}}N._set("bar",{hover:{mode:"label"},scales:{xAxes:[{type:"category",offset:!0,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}}),N._set("global",{datasets:{bar:{categoryPercentage:.8,barPercentage:.9}}});var Mt=nt.extend({dataElementType:_t.Rectangle,_dataElementOptions:["backgroundColor","borderColor","borderSkipped","borderWidth","barPercentage","barThickness","categoryPercentage","maxBarThickness","minBarLength"],initialize:function(){var t,e,n=this;nt.prototype.initialize.apply(n,arguments),(t=n.getMeta()).stack=n.getDataset().stack,t.bar=!0,e=n._getIndexScale().options,Dt("bar chart",e.barPercentage,"scales.[x/y]Axes.barPercentage","dataset.barPercentage"),Dt("bar chart",e.barThickness,"scales.[x/y]Axes.barThickness","dataset.barThickness"),Dt("bar chart",e.categoryPercentage,"scales.[x/y]Axes.categoryPercentage","dataset.categoryPercentage"),Dt("bar chart",n._getValueScale().options.minBarLength,"scales.[x/y]Axes.minBarLength","dataset.minBarLength"),Dt("bar chart",e.maxBarThickness,"scales.[x/y]Axes.maxBarThickness","dataset.maxBarThickness")},update:function(t){var e,n,l=this.getMeta().data;for(this._ruler=this.getRuler(),e=0,n=l.length;e=0&&g.min>=0?g.min:g.max,x=void 0===g.start?g.end:g.max>=0&&g.min>=0?g.max-g.min:g.min-g.max,_=f.length;if(v||void 0===v&&void 0!==b)for(l=0;l<_&&(a=f[l]).index!==t;++l)a.stack===b&&(i=void 0===(c=u._parseValue(p[a.index].data[e])).start?c.end:c.min>=0&&c.max>=0?c.max:c.min,(g.min<0&&i<0||g.max>=0&&i>0)&&(y+=i));return r=u.getPixelForValue(y),s=(o=u.getPixelForValue(y+x))-r,void 0!==m&&Math.abs(s)=0&&!h||x<0&&h?r-m:r+m),{size:s,base:r,head:o,center:o+s/2}},calculateBarIndexPixels:function(t,e,n,l){var a="flex"===l.barThickness?function(t,e,n){var l,a=e.pixels,i=a[t],r=t>0?a[t-1]:null,o=t=jt?-Ot:b<-jt?Ot:0)+m,x=Math.cos(b),_=Math.sin(b),w=Math.cos(y),S=Math.sin(y),C=b<=0&&y>=0||y>=Ot,k=b<=Nt&&y>=Nt||y>=Ot+Nt,D=b<=-Nt&&y>=-Nt||y>=jt+Nt,T=b===-jt||y>=jt?-1:Math.min(x,x*g,w,w*g),E=D?-1:Math.min(_,_*g,S,S*g),M=C?1:Math.max(x,x*g,w,w*g),A=k?1:Math.max(_,_*g,S,S*g);c=(M-T)/2,d=(A-E)/2,u=-(M+T)/2,h=-(A+E)/2}for(l=0,a=f.length;l0&&!isNaN(t)?Ot*(Math.abs(t)/e):0},getMaxBorderWidth:function(t){var e,n,l,a,i,r,o,s,c=0,d=this.chart;if(!t)for(e=0,n=d.data.datasets.length;e(c=o>c?o:c)?s:c);return c},setHoverStyle:function(t){var e=t._model,n=t._options,l=q.getHoverColor;t.$previousStyle={backgroundColor:e.backgroundColor,borderColor:e.borderColor,borderWidth:e.borderWidth},e.backgroundColor=Pt(n.hoverBackgroundColor,l(n.backgroundColor)),e.borderColor=Pt(n.hoverBorderColor,l(n.borderColor)),e.borderWidth=Pt(n.hoverBorderWidth,n.borderWidth)},_getRingWeightOffset:function(t){for(var e=0,n=0;n0&&qt(s[t-1]._model,o)&&(n.controlPointPreviousX=c(n.controlPointPreviousX,o.left,o.right),n.controlPointPreviousY=c(n.controlPointPreviousY,o.top,o.bottom)),t0&&(i=t.getDatasetMeta(i[0]._datasetIndex).data),i},"x-axis":function(t,e){return le(t,e,{intersect:!1})},point:function(t,e){return te(t,Qt(e,t))},nearest:function(t,e,n){var l=Qt(e,t);n.axis=n.axis||"xy";var a=ne(n.axis);return ee(t,l,n.intersect,a)},x:function(t,e,n){var l=Qt(e,t),a=[],i=!1;return Jt(t,(function(t){t.inXRange(l.x)&&a.push(t),t.inRange(l.x,l.y)&&(i=!0)})),n.intersect&&!i&&(a=[]),a},y:function(t,e,n){var l=Qt(e,t),a=[],i=!1;return Jt(t,(function(t){t.inYRange(l.y)&&a.push(t),t.inRange(l.x,l.y)&&(i=!0)})),n.intersect&&!i&&(a=[]),a}}},ie=q.extend;function re(t,e){return q.where(t,(function(t){return t.pos===e}))}function oe(t,e){return t.sort((function(t,n){var l=e?n:t,a=e?t:n;return l.weight===a.weight?l.index-a.index:l.weight-a.weight}))}function se(t,e,n,l){return Math.max(t[n],e[n])+Math.max(t[l],e[l])}function ce(t,e,n){var l,a,i=n.box,r=t.maxPadding;if(n.size&&(t[n.pos]-=n.size),n.size=n.horizontal?i.height:i.width,t[n.pos]+=n.size,i.getPadding){var o=i.getPadding();r.top=Math.max(r.top,o.top),r.left=Math.max(r.left,o.left),r.bottom=Math.max(r.bottom,o.bottom),r.right=Math.max(r.right,o.right)}if(l=e.outerWidth-se(r,t,"left","right"),a=e.outerHeight-se(r,t,"top","bottom"),l!==t.w||a!==t.h)return t.w=l,t.h=a,n.horizontal?l!==t.w:a!==t.h}function de(t,e){var n=e.maxPadding;function l(t){var l={left:0,top:0,right:0,bottom:0};return t.forEach((function(t){l[t]=Math.max(e[t],n[t])})),l}return l(t?["left","right"]:["top","bottom"])}function ue(t,e,n){var l,a,i,r,o,s,c=[];for(l=0,a=t.length;l div {\n\tposition: absolute;\n\twidth: 1000000px;\n\theight: 1000000px;\n\tleft: 0;\n\ttop: 0;\n}\n\n.chartjs-size-monitor-shrink > div {\n\tposition: absolute;\n\twidth: 200%;\n\theight: 200%;\n\tleft: 0;\n\ttop: 0;\n}\n"}))&&pe.default||pe,me=["animationstart","webkitAnimationStart"],ve={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};function be(t,e){var n=q.getStyle(t,e),l=n&&n.match(/^(\d+)(\.\d+)?px$/);return l?Number(l[1]):void 0}var ye=!!function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("e",null,e)}catch(t){}return t}()&&{passive:!0};function xe(t,e,n){t.addEventListener(e,n,ye)}function _e(t,e,n){t.removeEventListener(e,n,ye)}function we(t,e,n,l,a){return{type:t,chart:e,native:a||null,x:void 0!==n?n:null,y:void 0!==l?l:null}}function Se(t){var e=document.createElement("div");return e.className=t||"",e}function Ce(t,e,n){var l,a,i,r,o=t.$chartjs||(t.$chartjs={}),s=o.resizer=function(t){var e=Se("chartjs-size-monitor"),n=Se("chartjs-size-monitor-expand"),l=Se("chartjs-size-monitor-shrink");n.appendChild(Se()),l.appendChild(Se()),e.appendChild(n),e.appendChild(l),e._reset=function(){n.scrollLeft=1e6,n.scrollTop=1e6,l.scrollLeft=1e6,l.scrollTop=1e6};var a=function(){e._reset(),t()};return xe(n,"scroll",a.bind(n,"expand")),xe(l,"scroll",a.bind(l,"shrink")),e}((l=function(){if(o.resizer){var l=n.options.maintainAspectRatio&&t.parentNode,a=l?l.clientWidth:0;e(we("resize",n)),l&&l.clientWidth0){var i=t[0];i.label?n=i.label:i.xLabel?n=i.xLabel:a>0&&i.index-1?t.split("\n"):t}function Ne(t){var e=N.global;return{xPadding:t.xPadding,yPadding:t.yPadding,xAlign:t.xAlign,yAlign:t.yAlign,rtl:t.rtl,textDirection:t.textDirection,bodyFontColor:t.bodyFontColor,_bodyFontFamily:Ie(t.bodyFontFamily,e.defaultFontFamily),_bodyFontStyle:Ie(t.bodyFontStyle,e.defaultFontStyle),_bodyAlign:t.bodyAlign,bodyFontSize:Ie(t.bodyFontSize,e.defaultFontSize),bodySpacing:t.bodySpacing,titleFontColor:t.titleFontColor,_titleFontFamily:Ie(t.titleFontFamily,e.defaultFontFamily),_titleFontStyle:Ie(t.titleFontStyle,e.defaultFontStyle),titleFontSize:Ie(t.titleFontSize,e.defaultFontSize),_titleAlign:t.titleAlign,titleSpacing:t.titleSpacing,titleMarginBottom:t.titleMarginBottom,footerFontColor:t.footerFontColor,_footerFontFamily:Ie(t.footerFontFamily,e.defaultFontFamily),_footerFontStyle:Ie(t.footerFontStyle,e.defaultFontStyle),footerFontSize:Ie(t.footerFontSize,e.defaultFontSize),_footerAlign:t.footerAlign,footerSpacing:t.footerSpacing,footerMarginTop:t.footerMarginTop,caretSize:t.caretSize,cornerRadius:t.cornerRadius,backgroundColor:t.backgroundColor,opacity:0,legendColorBackground:t.multiKeyBackground,displayColors:t.displayColors,borderColor:t.borderColor,borderWidth:t.borderWidth}}function Le(t,e){return"center"===e?t.x+t.width/2:"right"===e?t.x+t.width-t.xPadding:t.x+t.xPadding}function Fe(t){return je([],Oe(t))}var Be=U.extend({initialize:function(){this._model=Ne(this._options),this._lastActive=[]},getTitle:function(){var t=this,e=t._options,n=e.callbacks,l=n.beforeTitle.apply(t,arguments),a=n.title.apply(t,arguments),i=n.afterTitle.apply(t,arguments),r=[];return r=je(r,Oe(l)),r=je(r,Oe(a)),r=je(r,Oe(i))},getBeforeBody:function(){return Fe(this._options.callbacks.beforeBody.apply(this,arguments))},getBody:function(t,e){var n=this,l=n._options.callbacks,a=[];return q.each(t,(function(t){var i={before:[],lines:[],after:[]};je(i.before,Oe(l.beforeLabel.call(n,t,e))),je(i.lines,l.label.call(n,t,e)),je(i.after,Oe(l.afterLabel.call(n,t,e))),a.push(i)})),a},getAfterBody:function(){return Fe(this._options.callbacks.afterBody.apply(this,arguments))},getFooter:function(){var t=this,e=t._options.callbacks,n=e.beforeFooter.apply(t,arguments),l=e.footer.apply(t,arguments),a=e.afterFooter.apply(t,arguments),i=[];return i=je(i,Oe(n)),i=je(i,Oe(l)),i=je(i,Oe(a))},update:function(t){var e,n,l,a,i,r,o,s,c,d,u=this,h=u._options,p=u._model,f=u._model=Ne(h),g=u._active,m=u._data,v={xAlign:p.xAlign,yAlign:p.yAlign},b={x:p.x,y:p.y},y={width:p.width,height:p.height},x={x:p.caretX,y:p.caretY};if(g.length){f.opacity=1;var _=[],w=[];x=Pe[h.position].call(u,g,u._eventPosition);var S=[];for(e=0,n=g.length;el.width&&(a=l.width-e.width),a<0&&(a=0)),"top"===d?i+=u:i-="bottom"===d?e.height+u:e.height/2,"center"===d?"left"===c?a+=u:"right"===c&&(a-=u):"left"===c?a-=h:"right"===c&&(a+=h),{x:a,y:i}}(f,y,v=function(t,e){var n,l,a,i,r,o=t._model,s=t._chart,c=t._chart.chartArea,d="center",u="center";o.ys.height-e.height&&(u="bottom");var h=(c.left+c.right)/2,p=(c.top+c.bottom)/2;"center"===u?(n=function(t){return t<=h},l=function(t){return t>h}):(n=function(t){return t<=e.width/2},l=function(t){return t>=s.width-e.width/2}),a=function(t){return t+e.width+o.caretSize+o.caretPadding>s.width},i=function(t){return t-e.width-o.caretSize-o.caretPadding<0},r=function(t){return t<=p?"top":"bottom"},n(o.x)?(d="left",a(o.x)&&(d="center",u=r(o.y))):l(o.x)&&(d="right",i(o.x)&&(d="center",u=r(o.y)));var f=t._options;return{xAlign:f.xAlign?f.xAlign:d,yAlign:f.yAlign?f.yAlign:u}}(this,y),u._chart)}else f.opacity=0;return f.xAlign=v.xAlign,f.yAlign=v.yAlign,f.x=b.x,f.y=b.y,f.width=y.width,f.height=y.height,f.caretX=x.x,f.caretY=x.y,u._model=f,t&&h.custom&&h.custom.call(u,f),u},drawCaret:function(t,e){var n=this._chart.ctx,l=this._view,a=this.getCaretPosition(t,e,l);n.lineTo(a.x1,a.y1),n.lineTo(a.x2,a.y2),n.lineTo(a.x3,a.y3)},getCaretPosition:function(t,e,n){var l,a,i,r,o,s,c=n.caretSize,d=n.cornerRadius,u=n.xAlign,h=n.yAlign,p=t.x,f=t.y,g=e.width,m=e.height;if("center"===h)o=f+m/2,"left"===u?(a=(l=p)-c,i=l,r=o+c,s=o-c):(a=(l=p+g)+c,i=l,r=o-c,s=o+c);else if("left"===u?(l=(a=p+d+c)-c,i=a+c):"right"===u?(l=(a=p+g-d-c)-c,i=a+c):(l=(a=n.caretX)-c,i=a+c),"top"===h)o=(r=f)-c,s=r;else{o=(r=f+m)+c,s=r;var v=i;i=l,l=v}return{x1:l,x2:a,x3:i,y1:r,y2:o,y3:s}},drawTitle:function(t,e,n){var l,a,i,r=e.title,o=r.length;if(o){var s=Re(e.rtl,e.x,e.width);for(t.x=Le(e,e._titleAlign),n.textAlign=s.textAlign(e._titleAlign),n.textBaseline="middle",l=e.titleFontSize,a=e.titleSpacing,n.fillStyle=e.titleFontColor,n.font=q.fontString(l,e._titleFontStyle,e._titleFontFamily),i=0;i0&&n.stroke()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},l={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity,i=e.title.length||e.beforeBody.length||e.body.length||e.afterBody.length||e.footer.length;this._options.enabled&&i&&(t.save(),t.globalAlpha=a,this.drawBackground(l,e,t,n),l.y+=e.yPadding,q.rtl.overrideTextDirection(t,e.textDirection),this.drawTitle(l,e,t),this.drawBody(l,e,t),this.drawFooter(l,e,t),q.rtl.restoreTextDirection(t,e.textDirection),t.restore())}},handleEvent:function(t){var e,n=this,l=n._options;return n._lastActive=n._lastActive||[],"mouseout"===t.type?n._active=[]:(n._active=n._chart.getElementsAtEventForMode(t,l.mode,l),l.reverse&&n._active.reverse()),(e=!q.arrayEquals(n._active,n._lastActive))&&(n._lastActive=n._active,(l.enabled||l.custom)&&(n._eventPosition={x:t.x,y:t.y},n.update(!0),n.pivot())),e}}),He=Pe,qe=Be;qe.positioners=He;var ze=q.valueOrDefault;function Ze(){return q.merge({},[].slice.call(arguments),{merger:function(t,e,n,l){if("xAxes"===t||"yAxes"===t){var a,i,r,o=n[t].length;for(e[t]||(e[t]=[]),a=0;a=e[t].length&&e[t].push({}),!e[t][a].type||r.type&&r.type!==e[t][a].type?q.merge(e[t][a],[Ae.getScaleDefaults(i),r]):q.merge(e[t][a],r)}else q._merger(t,e,n,l)}})}function $e(){return q.merge({},[].slice.call(arguments),{merger:function(t,e,n,l){var a=e[t]||{},i=n[t];"scales"===t?e[t]=Ze(a,i):"scale"===t?e[t]=q.merge(a,[Ae.getScaleDefaults(i.type),i]):q._merger(t,e,n,l)}})}function We(t){var e=t.options;q.each(t.scales,(function(e){fe.removeBox(t,e)})),e=$e(N.global,N[t.config.type],e),t.options=t.config.options=e,t.ensureScalesHaveIDs(),t.buildOrUpdateScales(),t.tooltip._options=e.tooltips,t.tooltip.initialize()}function Ve(t,e,n){var l,a=function(t){return t.id===l};do{l=e+n++}while(q.findIndex(t,a)>=0);return l}function Ye(t){return"top"===t||"bottom"===t}function Ue(t,e){return function(n,l){return n[t]===l[t]?n[e]-l[e]:n[t]-l[t]}}N._set("global",{elements:{},events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,maintainAspectRatio:!0,responsive:!0,responsiveAnimationDuration:0});var Ge=function(t,e){return this.construct(t,e),this};q.extend(Ge.prototype,{construct:function(t,e){var n=this;e=function(t){var e=(t=t||{}).data=t.data||{};return e.datasets=e.datasets||[],e.labels=e.labels||[],t.options=$e(N.global,N[t.type],t.options||{}),t}(e);var l=Ee.acquireContext(t,e),a=l&&l.canvas,i=a&&a.height,r=a&&a.width;n.id=q.uid(),n.ctx=l,n.canvas=a,n.config=e,n.width=r,n.height=i,n.aspectRatio=i?r/i:null,n.options=e.options,n._bufferedRender=!1,n._layers=[],n.chart=n,n.controller=n,Ge.instances[n.id]=n,Object.defineProperty(n,"data",{get:function(){return n.config.data},set:function(t){n.config.data=t}}),l&&a?(n.initialize(),n.update()):console.error("Failed to create chart: can't acquire context from the given item")},initialize:function(){var t=this;return Me.notify(t,"beforeInit"),q.retinaScale(t,t.options.devicePixelRatio),t.bindEvents(),t.options.responsive&&t.resize(!0),t.initToolTip(),Me.notify(t,"afterInit"),t},clear:function(){return q.canvas.clear(this),this},stop:function(){return K.cancelAnimation(this),this},resize:function(t){var e=this,n=e.options,l=e.canvas,a=n.maintainAspectRatio&&e.aspectRatio||null,i=Math.max(0,Math.floor(q.getMaximumWidth(l))),r=Math.max(0,Math.floor(a?i/a:q.getMaximumHeight(l)));if((e.width!==i||e.height!==r)&&(l.width=e.width=i,l.height=e.height=r,l.style.width=i+"px",l.style.height=r+"px",q.retinaScale(e,n.devicePixelRatio),!t)){var o={width:i,height:r};Me.notify(e,"resize",[o]),n.onResize&&n.onResize(e,o),e.stop(),e.update({duration:n.responsiveAnimationDuration})}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;q.each(e.xAxes,(function(t,n){t.id||(t.id=Ve(e.xAxes,"x-axis-",n))})),q.each(e.yAxes,(function(t,n){t.id||(t.id=Ve(e.yAxes,"y-axis-",n))})),n&&(n.id=n.id||"scale")},buildOrUpdateScales:function(){var t=this,e=t.options,n=t.scales||{},l=[],a=Object.keys(n).reduce((function(t,e){return t[e]=!1,t}),{});e.scales&&(l=l.concat((e.scales.xAxes||[]).map((function(t){return{options:t,dtype:"category",dposition:"bottom"}})),(e.scales.yAxes||[]).map((function(t){return{options:t,dtype:"linear",dposition:"left"}})))),e.scale&&l.push({options:e.scale,dtype:"radialLinear",isDefault:!0,dposition:"chartArea"}),q.each(l,(function(e){var l=e.options,i=l.id,r=ze(l.type,e.dtype);Ye(l.position)!==Ye(e.dposition)&&(l.position=e.dposition),a[i]=!0;var o=null;if(i in n&&n[i].type===r)(o=n[i]).options=l,o.ctx=t.ctx,o.chart=t;else{var s=Ae.getScaleConstructor(r);if(!s)return;o=new s({id:i,type:r,options:l,ctx:t.ctx,chart:t}),n[o.id]=o}o.mergeTicksOptions(),e.isDefault&&(t.scale=o)})),q.each(a,(function(t,e){t||delete n[e]})),t.scales=n,Ae.addScalesToLayout(this)},buildOrUpdateControllers:function(){var t,e,n=this,l=[],a=n.data.datasets;for(t=0,e=a.length;t=0;--n)this.drawDataset(e[n],t);Me.notify(this,"afterDatasetsDraw",[t])}},drawDataset:function(t,e){var n={meta:t,index:t.index,easingValue:e};!1!==Me.notify(this,"beforeDatasetDraw",[n])&&(t.controller.draw(e),Me.notify(this,"afterDatasetDraw",[n]))},_drawTooltip:function(t){var e=this.tooltip,n={tooltip:e,easingValue:t};!1!==Me.notify(this,"beforeTooltipDraw",[n])&&(e.draw(),Me.notify(this,"afterTooltipDraw",[n]))},getElementAtEvent:function(t){return ae.modes.single(this,t)},getElementsAtEvent:function(t){return ae.modes.label(this,t,{intersect:!0})},getElementsAtXAxis:function(t){return ae.modes["x-axis"](this,t,{intersect:!0})},getElementsAtEventForMode:function(t,e,n){var l=ae.modes[e];return"function"==typeof l?l(this,t,n):[]},getDatasetAtEvent:function(t){return ae.modes.dataset(this,t,{intersect:!0})},getDatasetMeta:function(t){var e=this.data.datasets[t];e._meta||(e._meta={});var n=e._meta[this.id];return n||(n=e._meta[this.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null,order:e.order||0,index:t}),n},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e3?n[2]-n[1]:n[1]-n[0];Math.abs(l)>1&&t!==Math.floor(t)&&(l=t-Math.floor(t));var a=q.log10(Math.abs(l)),i="";if(0!==t)if(Math.max(Math.abs(n[0]),Math.abs(n[n.length-1]))<1e-4){var r=q.log10(Math.abs(t)),o=Math.floor(r)-Math.floor(a);o=Math.max(Math.min(o,20),0),i=t.toExponential(o)}else{var s=-1*Math.floor(a);s=Math.max(Math.min(s,20),0),i=t.toFixed(s)}else i="0";return i},logarithmic:function(t,e,n){var l=t/Math.pow(10,Math.floor(q.log10(t)));return 0===t?"0":1===l||2===l||5===l||0===e||e===n.length-1?t.toExponential():""}}},en=q.isArray,nn=q.isNullOrUndef,ln=q.valueOrDefault,an=q.valueAtIndexOrDefault;function rn(t,e,n){var l,a=t.getTicks().length,i=Math.min(e,a-1),r=t.getPixelForTick(i),o=t._startPixel,s=t._endPixel;if(!(n&&(l=1===a?Math.max(r-o,s-r):0===e?(t.getPixelForTick(1)-r)/2:(r-t.getPixelForTick(i-1))/2,(r+=is+1e-6)))return r}function on(t,e,n,l){var a,i,r,o,s,c,d,u,h,p,f,g,m,v=n.length,b=[],y=[],x=[];for(a=0;ae){for(n=0;n=h||d<=1||!o.isHorizontal()?o.labelRotation=u:(e=(t=o._getLabelSizes()).widest.width,n=t.highest.height-t.highest.offset,l=Math.min(o.maxWidth,o.chart.width-e),e+6>(a=s.offset?o.maxWidth/d:l/(d-1))&&(a=l/(d-(s.offset?.5:1)),i=o.maxHeight-sn(s.gridLines)-c.padding-cn(s.scaleLabel),r=Math.sqrt(e*e+n*n),p=q.toDegrees(Math.min(Math.asin(Math.min((t.highest.height+6)/a,1)),Math.asin(Math.min(i/r,1))-Math.asin(n/r))),p=Math.max(u,Math.min(h,p))),o.labelRotation=p)},afterCalculateTickRotation:function(){q.callback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){q.callback(this.options.beforeFit,[this])},fit:function(){var t=this,e=t.minSize={width:0,height:0},n=t.chart,l=t.options,a=l.ticks,i=l.scaleLabel,r=l.gridLines,o=t._isVisible(),s="bottom"===l.position,c=t.isHorizontal();if(c?e.width=t.maxWidth:o&&(e.width=sn(r)+cn(i)),c?o&&(e.height=sn(r)+cn(i)):e.height=t.maxHeight,a.display&&o){var d=un(a),u=t._getLabelSizes(),h=u.first,p=u.last,f=u.widest,g=u.highest,m=.4*d.minor.lineHeight,v=a.padding;if(c){var b=0!==t.labelRotation,y=q.toRadians(t.labelRotation),x=Math.cos(y),_=Math.sin(y),w=_*f.width+x*(g.height-(b?g.offset:0))+(b?0:m);e.height=Math.min(t.maxHeight,e.height+w+v);var S,C,k=t.getPixelForTick(0)-t.left,D=t.right-t.getPixelForTick(t.getTicks().length-1);b?(S=s?x*h.width+_*h.offset:_*(h.height-h.offset),C=s?_*(p.height-p.offset):x*p.width+_*p.offset):(S=h.width/2,C=p.width/2),t.paddingLeft=Math.max((S-k)*t.width/(t.width-k),0)+3,t.paddingRight=Math.max((C-D)*t.width/(t.width-D),0)+3}else{var T=a.mirror?0:f.width+v+m;e.width=Math.min(t.maxWidth,e.width+T),t.paddingTop=h.height/2,t.paddingBottom=p.height/2}}t.handleMargins(),c?(t.width=t._length=n.width-t.margins.left-t.margins.right,t.height=e.height):(t.width=e.width,t.height=t._length=n.height-t.margins.top-t.margins.bottom)},handleMargins:function(){var t=this;t.margins&&(t.margins.left=Math.max(t.paddingLeft,t.margins.left),t.margins.top=Math.max(t.paddingTop,t.margins.top),t.margins.right=Math.max(t.paddingRight,t.margins.right),t.margins.bottom=Math.max(t.paddingBottom,t.margins.bottom))},afterFit:function(){q.callback(this.options.afterFit,[this])},isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){if(nn(t))return NaN;if(("number"==typeof t||t instanceof Number)&&!isFinite(t))return NaN;if(t)if(this.isHorizontal()){if(void 0!==t.x)return this.getRightValue(t.x)}else if(void 0!==t.y)return this.getRightValue(t.y);return t},_convertTicksToLabels:function(t){var e,n,l,a=this;for(a.ticks=t.map((function(t){return t.value})),a.beforeTickToLabelConversion(),e=a.convertTicksToLabels(t)||a.ticks,a.afterTickToLabelConversion(),n=0,l=t.length;nn-1?null:this.getPixelForDecimal(t*l+(e?l/2:0))},getPixelForDecimal:function(t){return this._reversePixels&&(t=1-t),this._startPixel+t*this._length},getDecimalForPixel:function(t){var e=(t-this._startPixel)/this._length;return this._reversePixels?1-e:e},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this.min,e=this.max;return this.beginAtZero?0:t<0&&e<0?e:t>0&&e>0?t:0},_autoSkip:function(t){var e,n,l,a,i=this.options.ticks,r=this._length,o=i.maxTicksLimit||r/this._tickSize()+1,s=i.major.enabled?function(t){var e,n,l=[];for(e=0,n=t.length;eo)return function(t,e,n){var l,a,i=0,r=e[0];for(n=Math.ceil(n),l=0;lc)return i;return Math.max(c,1)}(s,t,0,o),c>0){for(e=0,n=c-1;e1?(u-d)/(c-1):null,pn(t,l,q.isNullOrUndef(a)?0:d-a,d),pn(t,l,u,q.isNullOrUndef(a)?t.length:u+a),hn(t)}return pn(t,l),hn(t)},_tickSize:function(){var t=this.options.ticks,e=q.toRadians(this.labelRotation),n=Math.abs(Math.cos(e)),l=Math.abs(Math.sin(e)),a=this._getLabelSizes(),i=t.autoSkipPadding||0,r=a?a.widest.width+i:0,o=a?a.highest.height+i:0;return this.isHorizontal()?o*n>r*l?r/n:o/l:o*l=0&&(r=t),void 0!==i&&(t=n.indexOf(i))>=0&&(o=t),e.minIndex=r,e.maxIndex=o,e.min=n[r],e.max=n[o]},buildTicks:function(){var t=this._getLabels(),e=this.minIndex,n=this.maxIndex;this.ticks=0===e&&n===t.length-1?t:t.slice(e,n+1)},getLabelForIndex:function(t,e){var n=this.chart;return n.getDatasetMeta(e).controller._getValueScaleId()===this.id?this.getRightValue(n.data.datasets[e].data[t]):this._getLabels()[t]},_configure:function(){var t=this,e=t.options.offset,n=t.ticks;gn.prototype._configure.call(t),t.isHorizontal()||(t._reversePixels=!t._reversePixels),n&&(t._startValue=t.minIndex-(e?.5:0),t._valueRange=Math.max(n.length-(e?0:1),1))},getPixelForValue:function(t,e,n){var l,a,i,r=this;return mn(e)||mn(n)||(t=r.chart.data.datasets[n].data[e]),mn(t)||(l=r.isHorizontal()?t.x:t.y),(void 0!==l||void 0!==t&&isNaN(e))&&(a=r._getLabels(),t=q.valueOrDefault(l,t),e=-1!==(i=a.indexOf(t))?i:e,isNaN(e)&&(e=t)),r.getPixelForDecimal((e-r._startValue)/r._valueRange)},getPixelForTick:function(t){var e=this.ticks;return t<0||t>e.length-1?null:this.getPixelForValue(e[t],t+this.minIndex)},getValueForPixel:function(t){var e=Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange);return Math.min(Math.max(e,0),this.ticks.length-1)},getBasePixel:function(){return this.bottom}}),bn={position:"bottom"};vn._defaults=bn;var yn=q.noop,xn=q.isNullOrUndef,_n=gn.extend({getRightValue:function(t){return"string"==typeof t?+t:gn.prototype.getRightValue.call(this,t)},handleTickRangeOptions:function(){var t=this,e=t.options.ticks;if(e.beginAtZero){var n=q.sign(t.min),l=q.sign(t.max);n<0&&l<0?t.max=0:n>0&&l>0&&(t.min=0)}var a=void 0!==e.min||void 0!==e.suggestedMin,i=void 0!==e.max||void 0!==e.suggestedMax;void 0!==e.min?t.min=e.min:void 0!==e.suggestedMin&&(null===t.min?t.min=e.suggestedMin:t.min=Math.min(t.min,e.suggestedMin)),void 0!==e.max?t.max=e.max:void 0!==e.suggestedMax&&(null===t.max?t.max=e.suggestedMax:t.max=Math.max(t.max,e.suggestedMax)),a!==i&&t.min>=t.max&&(a?t.max=t.min+1:t.min=t.max-1),t.min===t.max&&(t.max++,e.beginAtZero||t.min--)},getTickLimit:function(){var t,e=this.options.ticks,n=e.stepSize,l=e.maxTicksLimit;return n?t=Math.ceil(this.max/n)-Math.floor(this.min/n)+1:(t=this._computeTickLimit(),l=l||11),l&&(t=Math.min(l,t)),t},_computeTickLimit:function(){return Number.POSITIVE_INFINITY},handleDirectionalChanges:yn,buildTicks:function(){var t=this,e=t.options.ticks,n=t.getTickLimit(),l={maxTicks:n=Math.max(2,n),min:e.min,max:e.max,precision:e.precision,stepSize:q.valueOrDefault(e.fixedStepSize,e.stepSize)},a=t.ticks=function(t,e){var n,l,a,i,r=[],o=t.stepSize,s=o||1,c=t.maxTicks-1,d=t.min,u=t.max,h=t.precision,p=e.min,f=e.max,g=q.niceNum((f-p)/c/s)*s;if(g<1e-14&&xn(d)&&xn(u))return[p,f];(i=Math.ceil(f/g)-Math.floor(p/g))>c&&(g=q.niceNum(i*g/c/s)*s),o||xn(h)?n=Math.pow(10,q._decimalPlaces(g)):(n=Math.pow(10,h),g=Math.ceil(g*n)/n),l=Math.floor(p/g)*g,a=Math.ceil(f/g)*g,o&&(!xn(d)&&q.almostWhole(d/g,g/1e3)&&(l=d),!xn(u)&&q.almostWhole(u/g,g/1e3)&&(a=u)),i=(a-l)/g,i=q.almostEquals(i,Math.round(i),g/1e3)?Math.round(i):Math.ceil(i),l=Math.round(l*n)/n,a=Math.round(a*n)/n,r.push(xn(d)?l:d);for(var m=1;me.length-1?null:this.getPixelForValue(e[t])}}),Dn=wn;kn._defaults=Dn;var Tn=q.valueOrDefault,En=q.math.log10,Mn={position:"left",ticks:{callback:tn.formatters.logarithmic}};function An(t,e){return q.isFinite(t)&&t>=0?t:e}var In=gn.extend({determineDataLimits:function(){var t,e,n,l,a,i,r=this,o=r.options,s=r.chart,c=s.data.datasets,d=r.isHorizontal();function u(t){return d?t.xAxisID===r.id:t.yAxisID===r.id}r.min=Number.POSITIVE_INFINITY,r.max=Number.NEGATIVE_INFINITY,r.minNotZero=Number.POSITIVE_INFINITY;var h=o.stacked;if(void 0===h)for(t=0;t0){var e=q.min(t),n=q.max(t);r.min=Math.min(r.min,e),r.max=Math.max(r.max,n)}}))}else for(t=0;t0?t.minNotZero=t.min:t.max<1?t.minNotZero=Math.pow(10,Math.floor(En(t.max))):t.minNotZero=1)},buildTicks:function(){var t=this,e=t.options.ticks,n=!t.isHorizontal(),l={min:An(e.min),max:An(e.max)},a=t.ticks=function(t,e){var n,l,a=[],i=Tn(t.min,Math.pow(10,Math.floor(En(e.min)))),r=Math.floor(En(e.max)),o=Math.ceil(e.max/Math.pow(10,r));0===i?(n=Math.floor(En(e.minNotZero)),l=Math.floor(e.minNotZero/Math.pow(10,n)),a.push(i),i=l*Math.pow(10,n)):(n=Math.floor(En(i)),l=Math.floor(i/Math.pow(10,n)));var s=n<0?Math.pow(10,Math.abs(n)):1;do{a.push(i),10==++l&&(l=1,s=++n>=0?1:s),i=Math.round(l*Math.pow(10,n)*s)/s}while(ne.length-1?null:this.getPixelForValue(e[t])},_getFirstTickValue:function(t){var e=Math.floor(En(t));return Math.floor(t/Math.pow(10,e))*Math.pow(10,e)},_configure:function(){var t=this,e=t.min,n=0;gn.prototype._configure.call(t),0===e&&(e=t._getFirstTickValue(t.minNotZero),n=Tn(t.options.ticks.fontSize,N.global.defaultFontSize)/t._length),t._startValue=En(e),t._valueOffset=n,t._valueRange=(En(t.max)-En(e))/(1-n)},getPixelForValue:function(t){var e=this,n=0;return(t=+e.getRightValue(t))>e.min&&t>0&&(n=(En(t)-e._startValue)/e._valueRange+e._valueOffset),e.getPixelForDecimal(n)},getValueForPixel:function(t){var e=this,n=e.getDecimalForPixel(t);return 0===n&&0===e.min?0:Math.pow(10,e._startValue+(n-e._valueOffset)*e._valueRange)}}),Rn=Mn;In._defaults=Rn;var Pn=q.valueOrDefault,jn=q.valueAtIndexOrDefault,On=q.options.resolve,Nn={display:!0,animate:!0,position:"chartArea",angleLines:{display:!0,color:"rgba(0,0,0,0.1)",lineWidth:1,borderDash:[],borderDashOffset:0},gridLines:{circular:!1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:tn.formatters.linear},pointLabels:{display:!0,fontSize:10,callback:function(t){return t}}};function Ln(t){var e=t.ticks;return e.display&&t.display?Pn(e.fontSize,N.global.defaultFontSize)+2*e.backdropPaddingY:0}function Fn(t,e,n,l,a){return t===l||t===a?{start:e-n/2,end:e+n/2}:ta?{start:e-n,end:e}:{start:e,end:e+n}}function Bn(t){return 0===t||180===t?"center":t<180?"left":"right"}function Hn(t,e,n,l){var a,i,r=n.y+l/2;if(q.isArray(e))for(a=0,i=e.length;a270||t<90)&&(n.y-=e.h)}function zn(t){return q.isNumber(t)?t:0}var Zn=_n.extend({setDimensions:function(){var t=this;t.width=t.maxWidth,t.height=t.maxHeight,t.paddingTop=Ln(t.options)/2,t.xCenter=Math.floor(t.width/2),t.yCenter=Math.floor((t.height-t.paddingTop)/2),t.drawingArea=Math.min(t.height-t.paddingTop,t.width)/2},determineDataLimits:function(){var t=this,e=t.chart,n=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;q.each(e.data.datasets,(function(a,i){if(e.isDatasetVisible(i)){var r=e.getDatasetMeta(i);q.each(a.data,(function(e,a){var i=+t.getRightValue(e);isNaN(i)||r.data[a].hidden||(n=Math.min(i,n),l=Math.max(i,l))}))}})),t.min=n===Number.POSITIVE_INFINITY?0:n,t.max=l===Number.NEGATIVE_INFINITY?0:l,t.handleTickRangeOptions()},_computeTickLimit:function(){return Math.ceil(this.drawingArea/Ln(this.options))},convertTicksToLabels:function(){var t=this;_n.prototype.convertTicksToLabels.call(t),t.pointLabels=t.chart.data.labels.map((function(){var e=q.callback(t.options.pointLabels.callback,arguments,t);return e||0===e?e:""}))},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){var t=this.options;t.display&&t.pointLabels.display?function(t){var e,n,l,a=q.options._parseFont(t.options.pointLabels),i={l:0,r:t.width,t:0,b:t.height-t.paddingTop},r={};t.ctx.font=a.string,t._pointLabelSizes=[];var o,s,c,d=t.chart.data.labels.length;for(e=0;ei.r&&(i.r=p.end,r.r=u),f.starti.b&&(i.b=f.end,r.b=u)}t.setReductions(t.drawingArea,i,r)}(this):this.setCenterPoint(0,0,0,0)},setReductions:function(t,e,n){var l=this,a=e.l/Math.sin(n.l),i=Math.max(e.r-l.width,0)/Math.sin(n.r),r=-e.t/Math.cos(n.t),o=-Math.max(e.b-(l.height-l.paddingTop),0)/Math.cos(n.b);a=zn(a),i=zn(i),r=zn(r),o=zn(o),l.drawingArea=Math.min(Math.floor(t-(a+i)/2),Math.floor(t-(r+o)/2)),l.setCenterPoint(a,i,r,o)},setCenterPoint:function(t,e,n,l){var a=this,i=a.width-e-a.drawingArea,r=t+a.drawingArea,o=n+a.drawingArea,s=a.height-a.paddingTop-l-a.drawingArea;a.xCenter=Math.floor((r+i)/2+a.left),a.yCenter=Math.floor((o+s)/2+a.top+a.paddingTop)},getIndexAngle:function(t){var e=this.chart,n=(t*(360/e.data.labels.length)+((e.options||{}).startAngle||0))%360;return(n<0?n+360:n)*Math.PI*2/360},getDistanceFromCenterForValue:function(t){var e=this;if(q.isNullOrUndef(t))return NaN;var n=e.drawingArea/(e.max-e.min);return e.options.ticks.reverse?(e.max-t)*n:(t-e.min)*n},getPointPosition:function(t,e){var n=this.getIndexAngle(t)-Math.PI/2;return{x:Math.cos(n)*e+this.xCenter,y:Math.sin(n)*e+this.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(t){var e=this.min,n=this.max;return this.getPointPositionForValue(t||0,this.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0)},_drawGrid:function(){var t,e,n,l=this,a=l.ctx,i=l.options,r=i.gridLines,o=i.angleLines,s=Pn(o.lineWidth,r.lineWidth),c=Pn(o.color,r.color);if(i.pointLabels.display&&function(t){var e=t.ctx,n=t.options,l=n.pointLabels,a=Ln(n),i=t.getDistanceFromCenterForValue(n.ticks.reverse?t.min:t.max),r=q.options._parseFont(l);e.save(),e.font=r.string,e.textBaseline="middle";for(var o=t.chart.data.labels.length-1;o>=0;o--){var s=0===o?a/2:0,c=t.getPointPosition(o,i+s+5),d=jn(l.fontColor,o,N.global.defaultFontColor);e.fillStyle=d;var u=t.getIndexAngle(o),h=q.toDegrees(u);e.textAlign=Bn(h),qn(h,t._pointLabelSizes[o],c),Hn(e,t.pointLabels[o],c,r.lineHeight)}e.restore()}(l),r.display&&q.each(l.ticks,(function(t,n){0!==n&&(e=l.getDistanceFromCenterForValue(l.ticksAsNumbers[n]),function(t,e,n,l){var a,i=t.ctx,r=e.circular,o=t.chart.data.labels.length,s=jn(e.color,l-1),c=jn(e.lineWidth,l-1);if((r||o)&&s&&c){if(i.save(),i.strokeStyle=s,i.lineWidth=c,i.setLineDash&&(i.setLineDash(e.borderDash||[]),i.lineDashOffset=e.borderDashOffset||0),i.beginPath(),r)i.arc(t.xCenter,t.yCenter,n,0,2*Math.PI);else{a=t.getPointPosition(0,n),i.moveTo(a.x,a.y);for(var d=1;d=0;t--)e=l.getDistanceFromCenterForValue(i.ticks.reverse?l.min:l.max),n=l.getPointPosition(t,e),a.beginPath(),a.moveTo(l.xCenter,l.yCenter),a.lineTo(n.x,n.y),a.stroke();a.restore()}},_drawLabels:function(){var t=this,e=t.ctx,n=t.options.ticks;if(n.display){var l,a,i=t.getIndexAngle(0),r=q.options._parseFont(n),o=Pn(n.fontColor,N.global.defaultFontColor);e.save(),e.font=r.string,e.translate(t.xCenter,t.yCenter),e.rotate(i),e.textAlign="center",e.textBaseline="middle",q.each(t.ticks,(function(i,s){(0!==s||n.reverse)&&(l=t.getDistanceFromCenterForValue(t.ticksAsNumbers[s]),n.showLabelBackdrop&&(a=e.measureText(i).width,e.fillStyle=n.backdropColor,e.fillRect(-a/2-n.backdropPaddingX,-l-r.size/2-n.backdropPaddingY,a+2*n.backdropPaddingX,r.size+2*n.backdropPaddingY)),e.fillStyle=o,e.fillText(i,0,-l))})),e.restore()}},_drawTitle:q.noop}),$n=Nn;Zn._defaults=$n;var Wn=q._deprecated,Vn=q.options.resolve,Yn=q.valueOrDefault,Un=Number.MIN_SAFE_INTEGER||-9007199254740991,Gn=Number.MAX_SAFE_INTEGER||9007199254740991,Xn={millisecond:{common:!0,size:1,steps:1e3},second:{common:!0,size:1e3,steps:60},minute:{common:!0,size:6e4,steps:60},hour:{common:!0,size:36e5,steps:24},day:{common:!0,size:864e5,steps:30},week:{common:!1,size:6048e5,steps:4},month:{common:!0,size:2628e6,steps:12},quarter:{common:!1,size:7884e6,steps:4},year:{common:!0,size:3154e7}},Kn=Object.keys(Xn);function Qn(t,e){return t-e}function Jn(t){return q.valueOrDefault(t.time.min,t.ticks.min)}function tl(t){return q.valueOrDefault(t.time.max,t.ticks.max)}function el(t,e,n,l){var a=function(t,e,n){for(var l,a,i,r=0,o=t.length-1;r>=0&&r<=o;){if(a=t[(l=r+o>>1)-1]||null,i=t[l],!a)return{lo:null,hi:i};if(i[e]n))return{lo:a,hi:i};o=l-1}}return{lo:i,hi:null}}(t,e,n),i=a.lo?a.hi?a.lo:t[t.length-2]:t[0],r=a.lo?a.hi?a.hi:t[t.length-1]:t[1],o=r[e]-i[e],s=o?(n-i[e])/o:0,c=(r[l]-i[l])*s;return i[l]+c}function nl(t,e){var n=t._adapter,l=t.options.time,a=l.parser,i=a||l.format,r=e;return"function"==typeof a&&(r=a(r)),q.isFinite(r)||(r="string"==typeof i?n.parse(r,i):n.parse(r)),null!==r?+r:(a||"function"!=typeof i||(r=i(e),q.isFinite(r)||(r=n.parse(r))),r)}function ll(t,e){if(q.isNullOrUndef(e))return null;var n=t.options.time,l=nl(t,t.getRightValue(e));return null===l||n.round&&(l=+t._adapter.startOf(l,n.round)),l}function al(t,e,n,l){var a,i,r,o=Kn.length;for(a=Kn.indexOf(t);a=0&&(e[i].major=!0);return e}(t,i,r,n):i}var rl=gn.extend({initialize:function(){this.mergeTicksOptions(),gn.prototype.initialize.call(this)},update:function(){var t=this,e=t.options,n=e.time||(e.time={}),l=t._adapter=new Je._date(e.adapters.date);return Wn("time scale",n.format,"time.format","time.parser"),Wn("time scale",n.min,"time.min","ticks.min"),Wn("time scale",n.max,"time.max","ticks.max"),q.mergeIf(n.displayFormats,l.formats()),gn.prototype.update.apply(t,arguments)},getRightValue:function(t){return t&&void 0!==t.t&&(t=t.t),gn.prototype.getRightValue.call(this,t)},determineDataLimits:function(){var t,e,n,l,a,i,r,o=this,s=o.chart,c=o._adapter,d=o.options,u=d.time.unit||"day",h=Gn,p=Un,f=[],g=[],m=[],v=o._getLabels();for(t=0,n=v.length;t1?function(t){var e,n,l,a={},i=[];for(e=0,n=t.length;e1e5*c)throw e+" and "+n+" are too far apart with stepSize of "+c+" "+s;for(a=u;a=a&&n<=i&&d.push(n);return l.min=a,l.max=i,l._unit=s.unit||(o.autoSkip?al(s.minUnit,l.min,l.max,u):function(t,e,n,l,a){var i,r;for(i=Kn.length-1;i>=Kn.indexOf(n);i--)if(r=Kn[i],Xn[r].common&&t._adapter.diff(a,l,r)>=e-1)return r;return Kn[n?Kn.indexOf(n):0]}(l,d.length,s.minUnit,l.min,l.max)),l._majorUnit=o.major.enabled&&"year"!==l._unit?function(t){for(var e=Kn.indexOf(t)+1,n=Kn.length;ee&&o=0&&t0?o:1}}),ol={position:"bottom",distribution:"linear",bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{autoSkip:!1,source:"auto",major:{enabled:!1}}};rl._defaults=ol;var sl={category:vn,linear:kn,logarithmic:In,radialLinear:Zn,time:rl},cl={datetime:"MMM D, YYYY, h:mm:ss a",millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm a",hour:"hA",day:"MMM D",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"};Je._date.override("function"==typeof t?{_id:"moment",formats:function(){return cl},parse:function(e,n){return"string"==typeof e&&"string"==typeof n?e=t(e,n):e instanceof t||(e=t(e)),e.isValid()?e.valueOf():null},format:function(e,n){return t(e).format(n)},add:function(e,n,l){return t(e).add(n,l).valueOf()},diff:function(e,n,l){return t(e).diff(t(n),l)},startOf:function(e,n,l){return e=t(e),"isoWeek"===n?e.isoWeekday(l).valueOf():e.startOf(n).valueOf()},endOf:function(e,n){return t(e).endOf(n).valueOf()},_create:function(e){return t(e)}}:{}),N._set("global",{plugins:{filler:{propagate:!0}}});var dl={dataset:function(t){var e=t.fill,n=t.chart,l=n.getDatasetMeta(e),a=l&&n.isDatasetVisible(e)&&l.dataset._children||[],i=a.length||0;return i?function(t,e){return e=n)&&l;switch(i){case"bottom":return"start";case"top":return"end";case"zero":return"origin";case"origin":case"start":case"end":return i;default:return!1}}function hl(t){return(t.el._scale||{}).getPointPositionForValue?function(t){var e,n,l,a,i,r=t.el._scale,o=r.options,s=r.chart.data.labels.length,c=t.fill,d=[];if(!s)return null;for(e=o.ticks.reverse?r.max:r.min,n=o.ticks.reverse?r.min:r.max,l=r.getPointPositionForValue(0,e),a=0;a0;--i)q.canvas.lineTo(t,n[i],n[i-1],!0);else for(r=n[0].cx,o=n[0].cy,s=Math.sqrt(Math.pow(n[0].x-r,2)+Math.pow(n[0].y-o,2)),i=a-1;i>0;--i)t.arc(r,o,s,n[i].angle,n[i-1].angle,!0)}}function vl(t,e,n,l,a,i){var r,o,s,c,d,u,h,p,f=e.length,g=l.spanGaps,m=[],v=[],b=0,y=0;for(t.beginPath(),r=0,o=f;r=0;--n)(e=s[n].$filler)&&e.visible&&(a=(l=e.el)._view,i=l._children||[],r=e.mapper,o=a.backgroundColor||N.global.defaultColor,r&&o&&i.length&&(q.canvas.clipArea(c,t.chartArea),vl(c,i,r,a,o,l._loop),q.canvas.unclipArea(c)))}},yl=q.rtl.getRtlAdapter,xl=q.noop,_l=q.valueOrDefault;function wl(t,e){return t.usePointStyle&&t.boxWidth>e?e:t.boxWidth}N._set("global",{legend:{display:!0,position:"top",align:"center",fullWidth:!0,reverse:!1,weight:1e3,onClick:function(t,e){var n=e.datasetIndex,l=this.chart,a=l.getDatasetMeta(n);a.hidden=null===a.hidden?!l.data.datasets[n].hidden:null,l.update()},onHover:null,onLeave:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data.datasets,n=t.options.legend||{},l=n.labels&&n.labels.usePointStyle;return t._getSortedDatasetMetas().map((function(n){var a=n.controller.getStyle(l?0:void 0);return{text:e[n.index].label,fillStyle:a.backgroundColor,hidden:!t.isDatasetVisible(n.index),lineCap:a.borderCapStyle,lineDash:a.borderDash,lineDashOffset:a.borderDashOffset,lineJoin:a.borderJoinStyle,lineWidth:a.borderWidth,strokeStyle:a.borderColor,pointStyle:a.pointStyle,rotation:a.rotation,datasetIndex:n.index}}),this)}}},legendCallback:function(t){var e,n,l,a=document.createElement("ul"),i=t.data.datasets;for(a.setAttribute("class",t.id+"-legend"),e=0,n=i.length;es.width)&&(u+=r+n.padding,d[d.length-(e>0?0:1)]=0),o[e]={left:0,top:0,width:l,height:r},d[d.length-1]+=l+n.padding})),s.height+=u}else{var h=n.padding,p=t.columnWidths=[],f=t.columnHeights=[],g=n.padding,m=0,v=0;q.each(t.legendItems,(function(t,e){var l=wl(n,r)+r/2+a.measureText(t.text).width;e>0&&v+r+2*h>s.height&&(g+=m+n.padding,p.push(m),f.push(v),m=0,v=0),m=Math.max(m,l),v+=r+h,o[e]={left:0,top:0,width:l,height:r}})),g+=m,p.push(m),f.push(v),s.width+=g}t.width=s.width,t.height=s.height}else t.width=s.width=t.height=s.height=0},afterFit:xl,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var t=this,e=t.options,n=e.labels,l=N.global,a=l.defaultColor,i=l.elements.line,r=t.height,o=t.columnHeights,s=t.width,c=t.lineWidths;if(e.display){var d,u=yl(e.rtl,t.left,t.minSize.width),h=t.ctx,p=_l(n.fontColor,l.defaultFontColor),f=q.options._parseFont(n),g=f.size;h.textAlign=u.textAlign("left"),h.textBaseline="middle",h.lineWidth=.5,h.strokeStyle=p,h.fillStyle=p,h.font=f.string;var m=wl(n,g),v=t.legendHitBoxes,b=function(t,l){switch(e.align){case"start":return n.padding;case"end":return t-l;default:return(t-l+n.padding)/2}},y=t.isHorizontal();d=y?{x:t.left+b(s,c[0]),y:t.top+n.padding,line:0}:{x:t.left+n.padding,y:t.top+b(r,o[0]),line:0},q.rtl.overrideTextDirection(t.ctx,e.textDirection);var x=g+n.padding;q.each(t.legendItems,(function(e,l){var p=h.measureText(e.text).width,f=m+g/2+p,_=d.x,w=d.y;u.setWidth(t.minSize.width),y?l>0&&_+f+n.padding>t.left+t.minSize.width&&(w=d.y+=x,d.line++,_=d.x=t.left+b(s,c[d.line])):l>0&&w+x>t.top+t.minSize.height&&(_=d.x=_+t.columnWidths[d.line]+n.padding,d.line++,w=d.y=t.top+b(r,o[d.line]));var S=u.x(_);!function(t,e,l){if(!(isNaN(m)||m<=0)){h.save();var r=_l(l.lineWidth,i.borderWidth);if(h.fillStyle=_l(l.fillStyle,a),h.lineCap=_l(l.lineCap,i.borderCapStyle),h.lineDashOffset=_l(l.lineDashOffset,i.borderDashOffset),h.lineJoin=_l(l.lineJoin,i.borderJoinStyle),h.lineWidth=r,h.strokeStyle=_l(l.strokeStyle,a),h.setLineDash&&h.setLineDash(_l(l.lineDash,i.borderDash)),n&&n.usePointStyle){var o=m*Math.SQRT2/2,s=u.xPlus(t,m/2),c=e+g/2;q.canvas.drawPoint(h,l.pointStyle,o,s,c,l.rotation)}else h.fillRect(u.leftForLtr(t,m),e,m,g),0!==r&&h.strokeRect(u.leftForLtr(t,m),e,m,g);h.restore()}}(S,w,e),v[l].left=u.leftForLtr(S,v[l].width),v[l].top=w,function(t,e,n,l){var a=g/2,i=u.xPlus(t,m+a),r=e+a;h.fillText(n.text,i,r),n.hidden&&(h.beginPath(),h.lineWidth=2,h.moveTo(i,r),h.lineTo(u.xPlus(i,l),r),h.stroke())}(S,w,e,p),y?d.x+=f+n.padding:d.y+=x})),q.rtl.restoreTextDirection(t.ctx,e.textDirection)}},_getLegendItemAt:function(t,e){var n,l,a,i=this;if(t>=i.left&&t<=i.right&&e>=i.top&&e<=i.bottom)for(a=i.legendHitBoxes,n=0;n=(l=a[n]).left&&t<=l.left+l.width&&e>=l.top&&e<=l.top+l.height)return i.legendItems[n];return null},handleEvent:function(t){var e,n=this,l=n.options,a="mouseup"===t.type?"click":t.type;if("mousemove"===a){if(!l.onHover&&!l.onLeave)return}else{if("click"!==a)return;if(!l.onClick)return}e=n._getLegendItemAt(t.x,t.y),"click"===a?e&&l.onClick&&l.onClick.call(n,t.native,e):(l.onLeave&&e!==n._hoveredItem&&(n._hoveredItem&&l.onLeave.call(n,t.native,n._hoveredItem),n._hoveredItem=e),l.onHover&&e&&l.onHover.call(n,t.native,e))}});function Cl(t,e){var n=new Sl({ctx:t.ctx,options:e,chart:t});fe.configure(t,n,e),fe.addBox(t,n),t.legend=n}var kl={id:"legend",_element:Sl,beforeInit:function(t){var e=t.options.legend;e&&Cl(t,e)},beforeUpdate:function(t){var e=t.options.legend,n=t.legend;e?(q.mergeIf(e,N.global.legend),n?(fe.configure(t,n,e),n.options=e):Cl(t,e)):n&&(fe.removeBox(t,n),delete t.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}},Dl=q.noop;N._set("global",{title:{display:!1,fontStyle:"bold",fullWidth:!0,padding:10,position:"top",text:"",weight:2e3}});var Tl=U.extend({initialize:function(t){q.extend(this,t),this.legendHitBoxes=[]},beforeUpdate:Dl,update:function(t,e,n){var l=this;return l.beforeUpdate(),l.maxWidth=t,l.maxHeight=e,l.margins=n,l.beforeSetDimensions(),l.setDimensions(),l.afterSetDimensions(),l.beforeBuildLabels(),l.buildLabels(),l.afterBuildLabels(),l.beforeFit(),l.fit(),l.afterFit(),l.afterUpdate(),l.minSize},afterUpdate:Dl,beforeSetDimensions:Dl,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:Dl,beforeBuildLabels:Dl,buildLabels:Dl,afterBuildLabels:Dl,beforeFit:Dl,fit:function(){var t,e=this,n=e.options,l=e.minSize={},a=e.isHorizontal();n.display?(t=(q.isArray(n.text)?n.text.length:1)*q.options._parseFont(n).lineHeight+2*n.padding,e.width=l.width=a?e.maxWidth:t,e.height=l.height=a?t:e.maxHeight):e.width=l.width=e.height=l.height=0},afterFit:Dl,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var t=this,e=t.ctx,n=t.options;if(n.display){var l,a,i,r=q.options._parseFont(n),o=r.lineHeight,s=o/2+n.padding,c=0,d=t.top,u=t.left,h=t.bottom,p=t.right;e.fillStyle=q.valueOrDefault(n.fontColor,N.global.defaultFontColor),e.font=r.string,t.isHorizontal()?(a=u+(p-u)/2,i=d+s,l=p-u):(a="left"===n.position?u+s:p-s,i=d+(h-d)/2,l=h-d,c=Math.PI*("left"===n.position?-.5:.5)),e.save(),e.translate(a,i),e.rotate(c),e.textAlign="center",e.textBaseline="middle";var f=n.text;if(q.isArray(f))for(var g=0,m=0;m=0;l--){var a=t[l];if(e(a))return a}},q.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},q.almostEquals=function(t,e,n){return Math.abs(t-e)=t},q.max=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.max(t,e)}),Number.NEGATIVE_INFINITY)},q.min=function(t){return t.reduce((function(t,e){return isNaN(e)?t:Math.min(t,e)}),Number.POSITIVE_INFINITY)},q.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return 0==(t=+t)||isNaN(t)?t:t>0?1:-1},q.toRadians=function(t){return t*(Math.PI/180)},q.toDegrees=function(t){return t*(180/Math.PI)},q._decimalPlaces=function(t){if(q.isFinite(t)){for(var e=1,n=0;Math.round(t*e)/e!==t;)e*=10,n++;return n}},q.getAngleFromPoint=function(t,e){var n=e.x-t.x,l=e.y-t.y,a=Math.sqrt(n*n+l*l),i=Math.atan2(l,n);return i<-.5*Math.PI&&(i+=2*Math.PI),{angle:i,distance:a}},q.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},q.aliasPixel=function(t){return t%2==0?0:.5},q._alignPixel=function(t,e,n){var l=t.currentDevicePixelRatio,a=n/2;return Math.round((e-a)*l)/l+a},q.splineCurve=function(t,e,n,l){var a=t.skip?e:t,i=e,r=n.skip?e:n,o=Math.sqrt(Math.pow(i.x-a.x,2)+Math.pow(i.y-a.y,2)),s=Math.sqrt(Math.pow(r.x-i.x,2)+Math.pow(r.y-i.y,2)),c=o/(o+s),d=s/(o+s),u=l*(c=isNaN(c)?0:c),h=l*(d=isNaN(d)?0:d);return{previous:{x:i.x-u*(r.x-a.x),y:i.y-u*(r.y-a.y)},next:{x:i.x+h*(r.x-a.x),y:i.y+h*(r.y-a.y)}}},q.EPSILON=Number.EPSILON||1e-14,q.splineCurveMonotone=function(t){var e,n,l,a,i,r,o,s,c,d=(t||[]).map((function(t){return{model:t._model,deltaK:0,mK:0}})),u=d.length;for(e=0;e0?d[e-1]:null,(a=e0?d[e-1]:null,a=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},q.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},q.niceNum=function(t,e){var n=Math.floor(q.log10(t)),l=t/Math.pow(10,n);return(e?l<1.5?1:l<3?2:l<7?5:10:l<=1?1:l<=2?2:l<=5?5:10)*Math.pow(10,n)},q.requestAnimFrame="undefined"==typeof window?function(t){t()}:window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)},q.getRelativePosition=function(t,e){var n,l,a=t.originalEvent||t,i=t.target||t.srcElement,r=i.getBoundingClientRect(),o=a.touches;o&&o.length>0?(n=o[0].clientX,l=o[0].clientY):(n=a.clientX,l=a.clientY);var s=parseFloat(q.getStyle(i,"padding-left")),c=parseFloat(q.getStyle(i,"padding-top")),d=parseFloat(q.getStyle(i,"padding-right")),u=parseFloat(q.getStyle(i,"padding-bottom")),h=r.right-r.left-s-d,p=r.bottom-r.top-c-u;return{x:n=Math.round((n-r.left-s)/h*i.width/e.currentDevicePixelRatio),y:l=Math.round((l-r.top-c)/p*i.height/e.currentDevicePixelRatio)}},q.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},q.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},q._calculatePadding=function(t,e,n){return(e=q.getStyle(t,e)).indexOf("%")>-1?n*parseInt(e,10)/100:parseInt(e,10)},q._getParentNode=function(t){var e=t.parentNode;return e&&"[object ShadowRoot]"===e.toString()&&(e=e.host),e},q.getMaximumWidth=function(t){var e=q._getParentNode(t);if(!e)return t.clientWidth;var n=e.clientWidth,l=n-q._calculatePadding(e,"padding-left",n)-q._calculatePadding(e,"padding-right",n),a=q.getConstraintWidth(t);return isNaN(a)?l:Math.min(l,a)},q.getMaximumHeight=function(t){var e=q._getParentNode(t);if(!e)return t.clientHeight;var n=e.clientHeight,l=n-q._calculatePadding(e,"padding-top",n)-q._calculatePadding(e,"padding-bottom",n),a=q.getConstraintHeight(t);return isNaN(a)?l:Math.min(l,a)},q.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},q.retinaScale=function(t,e){var n=t.currentDevicePixelRatio=e||"undefined"!=typeof window&&window.devicePixelRatio||1;if(1!==n){var l=t.canvas,a=t.height,i=t.width;l.height=a*n,l.width=i*n,t.ctx.scale(n,n),l.style.height||l.style.width||(l.style.height=a+"px",l.style.width=i+"px")}},q.fontString=function(t,e,n){return e+" "+t+"px "+n},q.longestText=function(t,e,n,l){var a=(l=l||{}).data=l.data||{},i=l.garbageCollect=l.garbageCollect||[];l.font!==e&&(a=l.data={},i=l.garbageCollect=[],l.font=e),t.font=e;var r,o,s,c,d,u=0,h=n.length;for(r=0;rn.length){for(r=0;rl&&(l=i),l},q.numberOfLabelLines=function(t){var e=1;return q.each(t,(function(t){q.isArray(t)&&t.length>e&&(e=t.length)})),e},q.color=w?function(t){return t instanceof CanvasGradient&&(t=N.global.defaultColor),w(t)}:function(t){return console.error("Color.js not found!"),t},q.getHoverColor=function(t){return t instanceof CanvasPattern||t instanceof CanvasGradient?t:q.color(t).saturate(.5).darken(.1).rgbString()}}(),Xe._adapters=Je,Xe.Animation=X,Xe.animationService=K,Xe.controllers=Kt,Xe.DatasetController=nt,Xe.defaults=N,Xe.Element=U,Xe.elements=_t,Xe.Interaction=ae,Xe.layouts=fe,Xe.platform=Ee,Xe.plugins=Me,Xe.Scale=gn,Xe.scaleService=Ae,Xe.Ticks=tn,Xe.Tooltip=qe,Xe.helpers.each(sl,(function(t,e){Xe.scaleService.registerScaleType(e,t,t._defaults)})),Ml)Ml.hasOwnProperty(Pl)&&Xe.plugins.register(Ml[Pl]);Xe.platform.initialize();var jl=Xe;return"undefined"!=typeof window&&(window.Chart=Xe),Xe.Chart=Xe,Xe.Legend=Ml.legend._element,Xe.Title=Ml.title._element,Xe.pluginService=Xe.plugins,Xe.PluginBase=Xe.Element.extend({}),Xe.canvasHelpers=Xe.helpers.canvas,Xe.layoutService=Xe.layouts,Xe.LinearScaleBase=_n,Xe.helpers.each(["Bar","Bubble","Doughnut","Line","PolarArea","Radar","Scatter"],(function(t){Xe[t]=function(e,n){return new Xe(e,Xe.helpers.merge(n||{},{type:t.charAt(0).toLowerCase()+t.slice(1)}))}})),jl}(function(){try{return n(23)}catch(t){}}())},function(t,e,n){"use strict";var l;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,l=new Array(e);n>16,r=n>>8&255,o=255&n;return"#"+(16777216+65536*(Math.round((l-i)*a)+i)+256*(Math.round((l-r)*a)+r)+(Math.round((l-o)*a)+o)).toString(16).slice(1)}},{key:"shadeColor",value:function(e,n){return t.isColorHex(n)?this.shadeHexColor(e,n):this.shadeRGBColor(e,n)}}],[{key:"bind",value:function(t,e){return function(){return t.apply(e,arguments)}}},{key:"isObject",value:function(t){return t&&"object"===a(t)&&!Array.isArray(t)&&null!=t}},{key:"listToArray",value:function(t){var e,n=[];for(e=0;ee.length?t:e}))),t.length>e.length?t:e}),0)}},{key:"hexToRgba",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"#999999",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.6;"#"!==t.substring(0,1)&&(t="#999999");var n=t.replace("#","");n=n.match(new RegExp("(.{"+n.length/3+"})","g"));for(var l=0;l1&&void 0!==arguments[1]?arguments[1]:"x",n=t.toString().slice();return n.replace(/[` ~!@#$%^&*()_|+\-=?;:'",.<>{}[\]\\/]/gi,e)}},{key:"negToZero",value:function(t){return t<0?0:t}},{key:"moveIndexInArray",value:function(t,e,n){if(n>=t.length)for(var l=n-t.length+1;l--;)t.push(void 0);return t.splice(n,0,t.splice(e,1)[0]),t}},{key:"extractNumber",value:function(t){return parseFloat(t.replace(/[^\d.]*/g,""))}},{key:"findAncestor",value:function(t,e){for(;(t=t.parentElement)&&!t.classList.contains(e););return t}},{key:"setELstyles",value:function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t.style.key=e[n])}},{key:"isNumber",value:function(t){return!isNaN(t)&&parseFloat(Number(t))===t&&!isNaN(parseInt(t,10))}},{key:"isFloat",value:function(t){return Number(t)===t&&t%1!=0}},{key:"isSafari",value:function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}},{key:"isFirefox",value:function(){return navigator.userAgent.toLowerCase().indexOf("firefox")>-1}},{key:"isIE11",value:function(){if(-1!==window.navigator.userAgent.indexOf("MSIE")||window.navigator.appVersion.indexOf("Trident/")>-1)return!0}},{key:"isIE",value:function(){var t=window.navigator.userAgent,e=t.indexOf("MSIE ");if(e>0)return parseInt(t.substring(e+5,t.indexOf(".",e)),10);if(t.indexOf("Trident/")>0){var n=t.indexOf("rv:");return parseInt(t.substring(n+3,t.indexOf(".",n)),10)}var l=t.indexOf("Edge/");return l>0&&parseInt(t.substring(l+5,t.indexOf(".",l)),10)}}]),t}(),x=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"getDefaultFilter",value:function(t,e){var n=this.w;t.unfilter(!0),(new window.SVG.Filter).size("120%","180%","-5%","-40%"),"none"!==n.config.states.normal.filter?this.applyFilter(t,e,n.config.states.normal.filter.type,n.config.states.normal.filter.value):n.config.chart.dropShadow.enabled&&this.dropShadow(t,n.config.chart.dropShadow,e)}},{key:"addNormalFilter",value:function(t,e){var n=this.w;n.config.chart.dropShadow.enabled&&!t.node.classList.contains("apexcharts-marker")&&this.dropShadow(t,n.config.chart.dropShadow,e)}},{key:"addLightenFilter",value:function(t,e,n){var l=this,a=this.w,i=n.intensity;y.isFirefox()||(t.unfilter(!0),new window.SVG.Filter,t.filter((function(t){var n=a.config.chart.dropShadow;(n.enabled?l.addShadow(t,e,n):t).componentTransfer({rgb:{type:"linear",slope:1.5,intercept:i}})})),t.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(t.filterer.node))}},{key:"addDarkenFilter",value:function(t,e,n){var l=this,a=this.w,i=n.intensity;y.isFirefox()||(t.unfilter(!0),new window.SVG.Filter,t.filter((function(t){var n=a.config.chart.dropShadow;(n.enabled?l.addShadow(t,e,n):t).componentTransfer({rgb:{type:"linear",slope:i}})})),t.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(t.filterer.node))}},{key:"applyFilter",value:function(t,e,n){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;switch(n){case"none":this.addNormalFilter(t,e);break;case"lighten":this.addLightenFilter(t,e,{intensity:l});break;case"darken":this.addDarkenFilter(t,e,{intensity:l})}}},{key:"addShadow",value:function(t,e,n){var l=n.blur,a=n.top,i=n.left,r=n.color,o=n.opacity,s=t.flood(Array.isArray(r)?r[e]:r,o).composite(t.sourceAlpha,"in").offset(i,a).gaussianBlur(l).merge(t.source);return t.blend(t.source,s)}},{key:"dropShadow",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=e.top,a=e.left,i=e.blur,r=e.color,o=e.opacity,s=e.noUserSpaceOnUse,c=this.w;return t.unfilter(!0),y.isIE()&&"radialBar"===c.config.chart.type||(r=Array.isArray(r)?r[n]:r,t.filter((function(t){var e;e=y.isSafari()||y.isFirefox()||y.isIE()?t.flood(r,o).composite(t.sourceAlpha,"in").offset(a,l).gaussianBlur(i):t.flood(r,o).composite(t.sourceAlpha,"in").offset(a,l).gaussianBlur(i).merge(t.source),t.blend(t.source,e)})),s||t.filterer.node.setAttribute("filterUnits","userSpaceOnUse"),this._scaleFilterSize(t.filterer.node)),t}},{key:"setSelectionFilter",value:function(t,e,n){var l=this.w;if(void 0!==l.globals.selectedDataPoints[e]&&l.globals.selectedDataPoints[e].indexOf(n)>-1){t.node.setAttribute("selected",!0);var a=l.config.states.active.filter;"none"!==a&&this.applyFilter(t,e,a.type,a.value)}}},{key:"_scaleFilterSize",value:function(t){!function(e){for(var n in e)e.hasOwnProperty(n)&&t.setAttribute(n,e[n])}({width:"200%",height:"200%",x:"-50%",y:"-50%"})}}]),t}(),_=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.setEasingFunctions()}return o(t,[{key:"setEasingFunctions",value:function(){var t;if(!this.w.globals.easing){switch(this.w.config.chart.animations.easing){case"linear":t="-";break;case"easein":t="<";break;case"easeout":t=">";break;case"easeinout":t="<>";break;case"swing":t=function(t){var e=1.70158;return(t-=1)*t*((e+1)*t+e)+1};break;case"bounce":t=function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375};break;case"elastic":t=function(t){return t===!!t?t:Math.pow(2,-10*t)*Math.sin((t-.075)*(2*Math.PI)/.3)+1};break;default:t="<>"}this.w.globals.easing=t}}},{key:"animateLine",value:function(t,e,n,l){t.attr(e).animate(l).attr(n)}},{key:"animateCircleRadius",value:function(t,e,n,l,a,i){e||(e=0),t.attr({r:e}).animate(l,a).attr({r:n}).afterAll((function(){i()}))}},{key:"animateCircle",value:function(t,e,n,l,a){t.attr({r:e.r,cx:e.cx,cy:e.cy}).animate(l,a).attr({r:n.r,cx:n.cx,cy:n.cy})}},{key:"animateRect",value:function(t,e,n,l,a){t.attr(e).animate(l).attr(n).afterAll((function(){return a()}))}},{key:"animatePathsGradually",value:function(t){var e=t.el,n=t.realIndex,l=t.j,a=t.fill,i=t.pathFrom,r=t.pathTo,o=t.speed,s=t.delay,c=this.w,d=0;c.config.chart.animations.animateGradually.enabled&&(d=c.config.chart.animations.animateGradually.delay),c.config.chart.animations.dynamicAnimation.enabled&&c.globals.dataChanged&&"bar"!==c.config.chart.type&&(d=0),this.morphSVG(e,n,l,"line"!==c.config.chart.type||c.globals.comboCharts?a:"stroke",i,r,o,s*d)}},{key:"showDelayedElements",value:function(){this.w.globals.delayedElements.forEach((function(t){t.el.classList.remove("apexcharts-element-hidden")}))}},{key:"animationCompleted",value:function(t){var e=this.w;e.globals.animationEnded||(e.globals.animationEnded=!0,this.showDelayedElements(),"function"==typeof e.config.chart.events.animationEnd&&e.config.chart.events.animationEnd(this.ctx,{el:t,w:e}))}},{key:"morphSVG",value:function(t,e,n,l,a,i,r,o){var s=this,c=this.w;a||(a=t.attr("pathFrom")),i||(i=t.attr("pathTo"));var d=function(t){return"radar"===c.config.chart.type&&(r=1),"M 0 ".concat(c.globals.gridHeight)};(!a||a.indexOf("undefined")>-1||a.indexOf("NaN")>-1)&&(a=d()),(!i||i.indexOf("undefined")>-1||i.indexOf("NaN")>-1)&&(i=d()),c.globals.shouldAnimate||(r=1),t.plot(a).animate(1,c.globals.easing,o).plot(a).animate(r,c.globals.easing,o).plot(i).afterAll((function(){y.isNumber(n)?n===c.globals.series[c.globals.maxValsInArrayIndex].length-2&&c.globals.shouldAnimate&&s.animationCompleted(t):"none"!==l&&c.globals.shouldAnimate&&(!c.globals.comboCharts&&e===c.globals.series.length-1||c.globals.comboCharts)&&s.animationCompleted(t),s.showDelayedElements()}))}}]),t}(),w=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"drawLine",value:function(t,e,n,l){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"#a8a8a8",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,o=this.w,s=o.globals.dom.Paper.line().attr({x1:t,y1:e,x2:n,y2:l,stroke:a,"stroke-dasharray":i,"stroke-width":r});return s}},{key:"drawRect",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"#fefefe",r=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,s=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,c=arguments.length>9&&void 0!==arguments[9]?arguments[9]:0,d=this.w,u=d.globals.dom.Paper.rect();return u.attr({x:t,y:e,width:n>0?n:0,height:l>0?l:0,rx:a,ry:a,opacity:r,"stroke-width":null!==o?o:0,stroke:null!==s?s:"none","stroke-dasharray":c}),u.node.setAttribute("fill",i),u}},{key:"drawPolygon",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"#e1e1e1",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"none",a=this.w,i=a.globals.dom.Paper.polygon(t).attr({fill:l,stroke:e,"stroke-width":n});return i}},{key:"drawCircle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.w,l=n.globals.dom.Paper.circle(2*t);return null!==e&&l.attr(e),l}},{key:"drawPath",value:function(t){var e=t.d,n=void 0===e?"":e,l=t.stroke,a=void 0===l?"#a8a8a8":l,i=t.strokeWidth,r=void 0===i?1:i,o=t.fill,s=t.fillOpacity,c=void 0===s?1:s,d=t.strokeOpacity,u=void 0===d?1:d,h=t.classes,p=t.strokeLinecap,f=void 0===p?null:p,g=t.strokeDashArray,m=void 0===g?0:g,v=this.w;return null===f&&(f=v.config.stroke.lineCap),(n.indexOf("undefined")>-1||n.indexOf("NaN")>-1)&&(n="M 0 ".concat(v.globals.gridHeight)),v.globals.dom.Paper.path(n).attr({fill:o,"fill-opacity":c,stroke:a,"stroke-opacity":u,"stroke-linecap":f,"stroke-width":r,"stroke-dasharray":m,class:h})}},{key:"group",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w,n=e.globals.dom.Paper.group();return null!==t&&n.attr(t),n}},{key:"move",value:function(t,e){return["M",t,e].join(" ")}},{key:"line",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=null;return null===n?l=["L",t,e].join(" "):"H"===n?l=["H",t].join(" "):"V"===n&&(l=["V",e].join(" ")),l}},{key:"curve",value:function(t,e,n,l,a,i){return["C",t,e,n,l,a,i].join(" ")}},{key:"quadraticCurve",value:function(t,e,n,l){return["Q",t,e,n,l].join(" ")}},{key:"arc",value:function(t,e,n,l,a,i,r){var o=arguments.length>7&&void 0!==arguments[7]&&arguments[7],s="A";o&&(s="a");var c=[s,t,e,n,l,a,i,r].join(" ");return c}},{key:"renderPaths",value:function(t){var e,n=t.j,l=t.realIndex,a=t.pathFrom,i=t.pathTo,r=t.stroke,o=t.strokeWidth,s=t.strokeLinecap,c=t.fill,u=t.animationDelay,h=t.initialSpeed,p=t.dataChangeSpeed,f=t.className,g=t.shouldClipToGrid,m=void 0===g||g,v=t.bindEventsOnPaths,b=void 0===v||v,y=t.drawShadow,w=void 0===y||y,S=this.w,C=new x(this.ctx),k=new _(this.ctx),D=this.w.config.chart.animations.enabled,T=D&&this.w.config.chart.animations.dynamicAnimation.enabled,E=!!(D&&!S.globals.resized||T&&S.globals.dataChanged&&S.globals.shouldAnimate);E?e=a:(e=i,S.globals.animationEnded=!0);var M,A=S.config.stroke.dashArray;M=Array.isArray(A)?A[l]:S.config.stroke.dashArray;var I=this.drawPath({d:e,stroke:r,strokeWidth:o,fill:c,fillOpacity:1,classes:f,strokeLinecap:s,strokeDashArray:M});if(I.attr("index",l),m&&I.attr({"clip-path":"url(#gridRectMask".concat(S.globals.cuid,")")}),"none"!==S.config.states.normal.filter.type)C.getDefaultFilter(I,l);else if(S.config.chart.dropShadow.enabled&&w&&(!S.config.chart.dropShadow.enabledOnSeries||S.config.chart.dropShadow.enabledOnSeries&&-1!==S.config.chart.dropShadow.enabledOnSeries.indexOf(l))){var R=S.config.chart.dropShadow;C.dropShadow(I,R,l)}b&&(I.node.addEventListener("mouseenter",this.pathMouseEnter.bind(this,I)),I.node.addEventListener("mouseleave",this.pathMouseLeave.bind(this,I)),I.node.addEventListener("mousedown",this.pathMouseDown.bind(this,I))),I.attr({pathTo:i,pathFrom:a});var P={el:I,j:n,realIndex:l,pathFrom:a,pathTo:i,fill:c,strokeWidth:o,delay:u};return!D||S.globals.resized||S.globals.dataChanged?!S.globals.resized&&S.globals.dataChanged||k.showDelayedElements():k.animatePathsGradually(d(d({},P),{},{speed:h})),S.globals.dataChanged&&T&&E&&k.animatePathsGradually(d(d({},P),{},{speed:p})),I}},{key:"drawPattern",value:function(t,e,n){var l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#a8a8a8",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this.w,r=i.globals.dom.Paper.pattern(e,n,(function(i){"horizontalLines"===t?i.line(0,0,n,0).stroke({color:l,width:a+1}):"verticalLines"===t?i.line(0,0,0,e).stroke({color:l,width:a+1}):"slantedLines"===t?i.line(0,0,e,n).stroke({color:l,width:a}):"squares"===t?i.rect(e,n).fill("none").stroke({color:l,width:a}):"circles"===t&&i.circle(e).fill("none").stroke({color:l,width:a})}));return r}},{key:"drawGradient",value:function(t,e,n,l,a){var i,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0,d=this.w;e.length<9&&0===e.indexOf("#")&&(e=y.hexToRgba(e,l)),n.length<9&&0===n.indexOf("#")&&(n=y.hexToRgba(n,a));var u=0,h=1,p=1,f=null;null!==o&&(u=void 0!==o[0]?o[0]/100:0,h=void 0!==o[1]?o[1]/100:1,p=void 0!==o[2]?o[2]/100:1,f=void 0!==o[3]?o[3]/100:null);var g=!("donut"!==d.config.chart.type&&"pie"!==d.config.chart.type&&"polarArea"!==d.config.chart.type&&"bubble"!==d.config.chart.type);if(i=null===s||0===s.length?d.globals.dom.Paper.gradient(g?"radial":"linear",(function(t){t.at(u,e,l),t.at(h,n,a),t.at(p,n,a),null!==f&&t.at(f,e,l)})):d.globals.dom.Paper.gradient(g?"radial":"linear",(function(t){(Array.isArray(s[c])?s[c]:s).forEach((function(e){t.at(e.offset/100,e.color,e.opacity)}))})),g){var m=d.globals.gridWidth/2,v=d.globals.gridHeight/2;"bubble"!==d.config.chart.type?i.attr({gradientUnits:"userSpaceOnUse",cx:m,cy:v,r:r}):i.attr({cx:.5,cy:.5,r:.8,fx:.2,fy:.2})}else"vertical"===t?i.from(0,0).to(0,1):"diagonal"===t?i.from(0,0).to(1,1):"horizontal"===t?i.from(0,1).to(1,1):"diagonal2"===t&&i.from(1,0).to(0,1);return i}},{key:"drawText",value:function(t){var e,n=t.x,l=t.y,a=t.text,i=t.textAnchor,r=t.fontSize,o=t.fontFamily,s=t.fontWeight,c=t.foreColor,d=t.opacity,u=t.cssClass,h=void 0===u?"":u,p=t.isPlainText,f=void 0===p||p,g=this.w;return void 0===a&&(a=""),i||(i="start"),c&&c.length||(c=g.config.chart.foreColor),o=o||g.config.chart.fontFamily,s=s||"regular",(e=Array.isArray(a)?g.globals.dom.Paper.text((function(t){for(var e=0;e-1){var o=n.globals.selectedDataPoints[a].indexOf(i);n.globals.selectedDataPoints[a].splice(o,1)}}else{if(!n.config.states.active.allowMultipleDataPointsSelection&&n.globals.selectedDataPoints.length>0){n.globals.selectedDataPoints=[];var s=n.globals.dom.Paper.select(".apexcharts-series path").members,c=n.globals.dom.Paper.select(".apexcharts-series circle, .apexcharts-series rect").members,d=function(t){Array.prototype.forEach.call(t,(function(t){t.node.setAttribute("selected","false"),l.getDefaultFilter(t,a)}))};d(s),d(c)}t.node.setAttribute("selected","true"),r="true",void 0===n.globals.selectedDataPoints[a]&&(n.globals.selectedDataPoints[a]=[]),n.globals.selectedDataPoints[a].push(i)}if("true"===r){var u=n.config.states.active.filter;"none"!==u&&l.applyFilter(t,a,u.type,u.value)}else"none"!==n.config.states.active.filter.type&&l.getDefaultFilter(t,a);"function"==typeof n.config.chart.events.dataPointSelection&&n.config.chart.events.dataPointSelection(e,this.ctx,{selectedDataPoints:n.globals.selectedDataPoints,seriesIndex:a,dataPointIndex:i,w:n}),e&&this.ctx.events.fireEvent("dataPointSelection",[e,this.ctx,{selectedDataPoints:n.globals.selectedDataPoints,seriesIndex:a,dataPointIndex:i,w:n}])}},{key:"rotateAroundCenter",value:function(t){var e=t.getBBox();return{x:e.x+e.width/2,y:e.y+e.height/2}}},{key:"getTextRects",value:function(t,e,n,l){var a=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=this.w,r=this.drawText({x:-200,y:-200,text:t,textAnchor:"start",fontSize:e,fontFamily:n,foreColor:"#fff",opacity:0});l&&r.attr("transform",l),i.globals.dom.Paper.add(r);var o=r.bbox();return a||(o=r.node.getBoundingClientRect()),r.remove(),{width:o.width,height:o.height}}},{key:"placeTextWithEllipsis",value:function(t,e,n){if("function"==typeof t.getComputedTextLength&&(t.textContent=e,e.length>0&&t.getComputedTextLength()>=n/.8)){for(var l=e.length-3;l>0;l-=3)if(t.getSubStringLength(0,l)<=n/.8)return void(t.textContent=e.substring(0,l)+"...");t.textContent="."}}}],[{key:"setAttrs",value:function(t,e){for(var n in e)e.hasOwnProperty(n)&&t.setAttribute(n,e[n])}}]),t}(),S=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e}return o(t,[{key:"setOrientations",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.w;if("vertical"===t.label.orientation){var l=null!==e?e:0,a=n.globals.dom.baseEl.querySelector(".apexcharts-xaxis-annotations .apexcharts-xaxis-annotation-label[rel='".concat(l,"']"));if(null!==a){var i=a.getBoundingClientRect();a.setAttribute("x",parseFloat(a.getAttribute("x"))-i.height+4),"top"===t.label.position?a.setAttribute("y",parseFloat(a.getAttribute("y"))+i.width):a.setAttribute("y",parseFloat(a.getAttribute("y"))-i.width);var r=this.annoCtx.graphics.rotateAroundCenter(a),o=r.x,s=r.y;a.setAttribute("transform","rotate(-90 ".concat(o," ").concat(s,")"))}}}},{key:"addBackgroundToAnno",value:function(t,e){var n=this.w;if(!e.label.text||e.label.text&&!e.label.text.trim())return null;var l=n.globals.dom.baseEl.querySelector(".apexcharts-grid").getBoundingClientRect(),a=t.getBoundingClientRect(),i=e.label.style.padding.left,r=e.label.style.padding.right,o=e.label.style.padding.top,s=e.label.style.padding.bottom;"vertical"===e.label.orientation&&(o=e.label.style.padding.left,s=e.label.style.padding.right,i=e.label.style.padding.top,r=e.label.style.padding.bottom);var c=a.left-l.left-i,d=a.top-l.top-o,u=this.annoCtx.graphics.drawRect(c-n.globals.barPadForNumericAxis,d,a.width+i+r,a.height+o+s,e.label.borderRadius,e.label.style.background,1,e.label.borderWidth,e.label.borderColor,0);return e.id&&u.node.classList.add(e.id),u}},{key:"annotationsBackground",value:function(){var t=this,e=this.w,n=function(n,l,a){var i=e.globals.dom.baseEl.querySelector(".apexcharts-".concat(a,"-annotations .apexcharts-").concat(a,"-annotation-label[rel='").concat(l,"']"));if(i){var r=i.parentNode,o=t.addBackgroundToAnno(i,n);o&&r.insertBefore(o.node,i)}};e.config.annotations.xaxis.map((function(t,e){n(t,e,"xaxis")})),e.config.annotations.yaxis.map((function(t,e){n(t,e,"yaxis")})),e.config.annotations.points.map((function(t,e){n(t,e,"point")}))}},{key:"getStringX",value:function(t){var e=this.w,n=t;e.config.xaxis.convertedCatToNumeric&&e.globals.categoryLabels.length&&(t=e.globals.categoryLabels.indexOf(t)+1);var l=e.globals.labels.indexOf(t),a=e.globals.dom.baseEl.querySelector(".apexcharts-xaxis-texts-g text:nth-child("+(l+1)+")");return a&&(n=parseFloat(a.getAttribute("x"))),n}}]),t}(),C=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e,this.invertAxis=this.annoCtx.invertAxis}return o(t,[{key:"addXaxisAnnotation",value:function(t,e,n){var l=this.w,a=this.invertAxis?l.globals.minY:l.globals.minX,i=this.invertAxis?l.globals.maxY:l.globals.maxX,r=this.invertAxis?l.globals.yRange[0]:l.globals.xRange,o=(t.x-a)/(r/l.globals.gridWidth);this.annoCtx.inversedReversedAxis&&(o=(i-t.x)/(r/l.globals.gridWidth));var s=t.label.text;"category"!==l.config.xaxis.type&&!l.config.xaxis.convertedCatToNumeric||this.invertAxis||l.globals.dataFormatXNumeric||(o=this.annoCtx.helpers.getStringX(t.x));var c=t.strokeDashArray;if(y.isNumber(o)){if(null===t.x2||void 0===t.x2){var d=this.annoCtx.graphics.drawLine(o+t.offsetX,0+t.offsetY,o+t.offsetX,l.globals.gridHeight+t.offsetY,t.borderColor,c,t.borderWidth);e.appendChild(d.node),t.id&&d.node.classList.add(t.id)}else{var u=(t.x2-a)/(r/l.globals.gridWidth);if(this.annoCtx.inversedReversedAxis&&(u=(i-t.x2)/(r/l.globals.gridWidth)),"category"!==l.config.xaxis.type&&!l.config.xaxis.convertedCatToNumeric||this.invertAxis||l.globals.dataFormatXNumeric||(u=this.annoCtx.helpers.getStringX(t.x2)),u0&&void 0!==arguments[0]?arguments[0]:null;return null===t?this.w.config.series.reduce((function(t,e){return t+e}),0):this.w.globals.series[t].reduce((function(t,e){return t+e}),0)}},{key:"isSeriesNull",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return 0===(null===t?this.w.config.series.filter((function(t){return null!==t})):this.w.config.series[t].data.filter((function(t){return null!==t}))).length}},{key:"seriesHaveSameValues",value:function(t){return this.w.globals.series[t].every((function(t,e,n){return t===n[0]}))}},{key:"getCategoryLabels",value:function(t){var e=this.w,n=t.slice();return e.config.xaxis.convertedCatToNumeric&&(n=t.map((function(t){return e.config.xaxis.labels.formatter(t-e.globals.minX+1)}))),n}},{key:"getLargestSeries",value:function(){var t=this.w;t.globals.maxValsInArrayIndex=t.globals.series.map((function(t){return t.length})).indexOf(Math.max.apply(Math,t.globals.series.map((function(t){return t.length}))))}},{key:"getLargestMarkerSize",value:function(){var t=this.w,e=0;return t.globals.markers.size.forEach((function(t){e=Math.max(e,t)})),t.globals.markers.largestSize=e,e}},{key:"getSeriesTotals",value:function(){var t=this.w;t.globals.seriesTotals=t.globals.series.map((function(t,e){var n=0;if(Array.isArray(t))for(var l=0;lt&&n.globals.seriesX[a][r]r){var c=r;r=l,l=c}var d=this.annoCtx.graphics.drawRect(0+t.offsetX,l+t.offsetY,a.globals.gridWidth+t.offsetX,r-l,0,t.fillColor,t.opacity,1,t.borderColor,i);d.node.classList.add("apexcharts-annotation-rect"),d.attr("clip-path","url(#gridRectMask".concat(a.globals.cuid,")")),e.appendChild(d.node),t.id&&d.node.classList.add(t.id)}var u="right"===t.label.position?a.globals.gridWidth:0,h=this.annoCtx.graphics.drawText({x:u+t.label.offsetX,y:(l||r)+t.label.offsetY-3,text:o,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-yaxis-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});h.attr({rel:n}),e.appendChild(h.node)}},{key:"_getY1Y2",value:function(t,e){var n,l="y1"===t?e.y:e.y2,a=this.w;if(this.annoCtx.invertAxis){var i=a.globals.labels.indexOf(l);a.config.xaxis.convertedCatToNumeric&&(i=a.globals.categoryLabels.indexOf(l));var r=a.globals.dom.baseEl.querySelector(".apexcharts-yaxis-texts-g text:nth-child("+(i+1)+")");r&&(n=parseFloat(r.getAttribute("y")))}else{var o;o=a.config.yaxis[e.yAxisIndex].logarithmic?(l=new k(this.annoCtx.ctx).getLogVal(l,e.yAxisIndex))/a.globals.yLogRatio[e.yAxisIndex]:(l-a.globals.minYArr[e.yAxisIndex])/(a.globals.yRange[e.yAxisIndex]/a.globals.gridHeight),n=a.globals.gridHeight-o,a.config.yaxis[e.yAxisIndex]&&a.config.yaxis[e.yAxisIndex].reversed&&(n=o)}return n}},{key:"drawYAxisAnnotations",value:function(){var t=this,e=this.w,n=this.annoCtx.graphics.group({class:"apexcharts-yaxis-annotations"});return e.config.annotations.yaxis.map((function(e,l){t.addYaxisAnnotation(e,n.node,l)})),n}}]),t}(),T=function(){function t(e){i(this,t),this.w=e.w,this.annoCtx=e}return o(t,[{key:"addPointAnnotation",value:function(t,e,n){var l=this.w,a=0,i=0,r=0;this.annoCtx.invertAxis&&console.warn("Point annotation is not supported in horizontal bar charts.");var o,s=parseFloat(t.y);if("string"==typeof t.x){var c=l.globals.labels.indexOf(t.x);l.config.xaxis.convertedCatToNumeric&&(c=l.globals.categoryLabels.indexOf(t.x)),a=this.annoCtx.helpers.getStringX(t.x),null===t.y&&(s=l.globals.series[t.seriesIndex][c])}else a=(t.x-l.globals.minX)/(l.globals.xRange/l.globals.gridWidth);if(o=l.config.yaxis[t.yAxisIndex].logarithmic?(s=new k(this.annoCtx.ctx).getLogVal(s,t.yAxisIndex))/l.globals.yLogRatio[t.yAxisIndex]:(s-l.globals.minYArr[t.yAxisIndex])/(l.globals.yRange[t.yAxisIndex]/l.globals.gridHeight),i=l.globals.gridHeight-o-parseFloat(t.label.style.fontSize)-t.marker.size,r=l.globals.gridHeight-o,l.config.yaxis[t.yAxisIndex]&&l.config.yaxis[t.yAxisIndex].reversed&&(i=o+parseFloat(t.label.style.fontSize)+t.marker.size,r=o),y.isNumber(a)){var d={pSize:t.marker.size,pWidth:t.marker.strokeWidth,pointFillColor:t.marker.fillColor,pointStrokeColor:t.marker.strokeColor,shape:t.marker.shape,pRadius:t.marker.radius,class:"apexcharts-point-annotation-marker ".concat(t.marker.cssClass," ").concat(t.id?t.id:"")},u=this.annoCtx.graphics.drawMarker(a+t.marker.offsetX,r+t.marker.offsetY,d);e.appendChild(u.node);var h=t.label.text?t.label.text:"",p=this.annoCtx.graphics.drawText({x:a+t.label.offsetX,y:i+t.label.offsetY,text:h,textAnchor:t.label.textAnchor,fontSize:t.label.style.fontSize,fontFamily:t.label.style.fontFamily,fontWeight:t.label.style.fontWeight,foreColor:t.label.style.color,cssClass:"apexcharts-point-annotation-label ".concat(t.label.style.cssClass," ").concat(t.id?t.id:"")});if(p.attr({rel:n}),e.appendChild(p.node),t.customSVG.SVG){var f=this.annoCtx.graphics.group({class:"apexcharts-point-annotations-custom-svg "+t.customSVG.cssClass});f.attr({transform:"translate(".concat(a+t.customSVG.offsetX,", ").concat(i+t.customSVG.offsetY,")")}),f.node.innerHTML=t.customSVG.SVG,e.appendChild(f.node)}if(t.image.path){var g=t.image.width?t.image.width:20,m=t.image.height?t.image.height:20;this.annoCtx.addImage({x:a+t.image.offsetX-g/2,y:i+t.image.offsetY-m/2,width:g,height:m,path:t.image.path,appendTo:".apexcharts-point-annotations"})}}}},{key:"drawPointAnnotations",value:function(){var t=this,e=this.w,n=this.annoCtx.graphics.group({class:"apexcharts-point-annotations"});return e.config.annotations.points.map((function(e,l){t.addPointAnnotation(e,n.node,l)})),n}}]),t}(),E={name:"en",options:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],toolbar:{exportToSVG:"Download SVG",exportToPNG:"Download PNG",exportToCSV:"Download CSV",menu:"Menu",selection:"Selection",selectionZoom:"Selection Zoom",zoomIn:"Zoom In",zoomOut:"Zoom Out",pan:"Panning",reset:"Reset Zoom"}}},M=function(){function t(){i(this,t),this.yAxis={show:!0,showAlways:!1,showForNullSeries:!0,seriesName:void 0,opposite:!1,reversed:!1,logarithmic:!1,tickAmount:void 0,forceNiceScale:!1,max:void 0,min:void 0,floating:!1,decimalsInFloat:void 0,labels:{show:!0,minWidth:0,maxWidth:160,offsetX:0,offsetY:0,align:void 0,rotate:0,padding:20,style:{colors:[],fontSize:"11px",fontWeight:400,fontFamily:void 0,cssClass:""},formatter:void 0},axisBorder:{show:!1,color:"#e0e0e0",width:1,offsetX:0,offsetY:0},axisTicks:{show:!1,color:"#e0e0e0",width:6,offsetX:0,offsetY:0},title:{text:void 0,rotate:-90,offsetY:0,offsetX:0,style:{color:void 0,fontSize:"11px",fontWeight:900,fontFamily:void 0,cssClass:""}},tooltip:{enabled:!1,offsetX:0},crosshairs:{show:!0,position:"front",stroke:{color:"#b6b6b6",width:1,dashArray:0}}},this.pointAnnotation={x:0,y:null,yAxisIndex:0,seriesIndex:0,marker:{size:4,fillColor:"#fff",strokeWidth:2,strokeColor:"#333",shape:"circle",offsetX:0,offsetY:0,radius:2,cssClass:""},label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",offsetX:0,offsetY:0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}},customSVG:{SVG:void 0,cssClass:void 0,offsetX:0,offsetY:0},image:{path:void 0,width:20,height:20,offsetX:0,offsetY:0}},this.yAxisAnnotation={y:0,y2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,yAxisIndex:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"end",position:"right",offsetX:0,offsetY:-3,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.xAxisAnnotation={x:0,x2:null,strokeDashArray:1,fillColor:"#c2c2c2",borderColor:"#c2c2c2",borderWidth:1,opacity:.3,offsetX:0,offsetY:0,label:{borderColor:"#c2c2c2",borderWidth:1,borderRadius:2,text:void 0,textAnchor:"middle",orientation:"vertical",position:"top",offsetX:0,offsetY:0,style:{background:"#fff",color:void 0,fontSize:"11px",fontFamily:void 0,fontWeight:400,cssClass:"",padding:{left:5,right:5,top:2,bottom:2}}}},this.text={x:0,y:0,text:"",textAnchor:"start",foreColor:void 0,fontSize:"13px",fontFamily:void 0,fontWeight:400,appendTo:".apexcharts-annotations",backgroundColor:"transparent",borderColor:"#c2c2c2",borderRadius:0,borderWidth:0,paddingLeft:4,paddingRight:4,paddingTop:2,paddingBottom:2}}return o(t,[{key:"init",value:function(){return{annotations:{position:"front",yaxis:[this.yAxisAnnotation],xaxis:[this.xAxisAnnotation],points:[this.pointAnnotation],texts:[],images:[],shapes:[]},chart:{animations:{enabled:!0,easing:"easeinout",speed:800,animateGradually:{delay:150,enabled:!0},dynamicAnimation:{enabled:!0,speed:350}},background:"transparent",locales:[E],defaultLocale:"en",dropShadow:{enabled:!1,enabledOnSeries:void 0,top:2,left:2,blur:4,color:"#000",opacity:.35},events:{animationEnd:void 0,beforeMount:void 0,mounted:void 0,updated:void 0,click:void 0,mouseMove:void 0,legendClick:void 0,markerClick:void 0,selection:void 0,dataPointSelection:void 0,dataPointMouseEnter:void 0,dataPointMouseLeave:void 0,beforeZoom:void 0,zoomed:void 0,scrolled:void 0},foreColor:"#373d3f",fontFamily:"Helvetica, Arial, sans-serif",height:"auto",parentHeightOffset:15,redrawOnParentResize:!0,id:void 0,group:void 0,offsetX:0,offsetY:0,selection:{enabled:!1,type:"x",fill:{color:"#24292e",opacity:.1},stroke:{width:1,color:"#24292e",opacity:.4,dashArray:3},xaxis:{min:void 0,max:void 0},yaxis:{min:void 0,max:void 0}},sparkline:{enabled:!1},brush:{enabled:!1,autoScaleYaxis:!0,target:void 0},stacked:!1,stackType:"normal",toolbar:{show:!0,offsetX:0,offsetY:0,tools:{download:!0,selection:!0,zoom:!0,zoomin:!0,zoomout:!0,pan:!0,reset:!0,customIcons:[]},export:{csv:{filename:void 0,columnDelimiter:",",headerCategory:"category",headerValue:"value",dateFormatter:function(t){return new Date(t).toDateString()}}},autoSelected:"zoom"},type:"line",width:"100%",zoom:{enabled:!0,type:"x",autoScaleYaxis:!1,zoomedArea:{fill:{color:"#90CAF9",opacity:.4},stroke:{color:"#0D47A1",opacity:.4,width:1}}}},plotOptions:{area:{fillTo:"origin"},bar:{horizontal:!1,columnWidth:"70%",barHeight:"70%",distributed:!1,startingShape:"flat",endingShape:"flat",rangeBarOverlap:!0,colors:{ranges:[],backgroundBarColors:[],backgroundBarOpacity:1,backgroundBarRadius:0},dataLabels:{position:"top",maxItems:100,hideOverflowingLabels:!0,orientation:"horizontal"}},bubble:{minBubbleRadius:void 0,maxBubbleRadius:void 0},candlestick:{colors:{upward:"#00B746",downward:"#EF403C"},wick:{useFillColor:!0}},heatmap:{radius:2,enableShades:!0,shadeIntensity:.5,reverseNegativeShade:!1,distributed:!1,useFillColorAsStroke:!1,colorScale:{inverse:!1,ranges:[],min:void 0,max:void 0}},radialBar:{inverseOrder:!1,startAngle:0,endAngle:360,offsetX:0,offsetY:0,hollow:{margin:5,size:"50%",background:"transparent",image:void 0,imageWidth:150,imageHeight:150,imageOffsetX:0,imageOffsetY:0,imageClipped:!0,position:"front",dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},track:{show:!0,startAngle:void 0,endAngle:void 0,background:"#f2f2f2",strokeWidth:"97%",opacity:1,margin:5,dropShadow:{enabled:!1,top:0,left:0,blur:3,color:"#000",opacity:.5}},dataLabels:{show:!0,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:0,formatter:function(t){return t}},value:{show:!0,fontSize:"14px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:16,formatter:function(t){return t+"%"}},total:{show:!1,label:"Total",fontSize:"16px",fontWeight:600,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)/t.globals.series.length+"%"}}}},pie:{customScale:1,offsetX:0,offsetY:0,startAngle:0,expandOnClick:!0,dataLabels:{offset:0,minAngleToShowLabel:10},donut:{size:"65%",background:"transparent",labels:{show:!1,name:{show:!0,fontSize:"16px",fontFamily:void 0,fontWeight:600,color:void 0,offsetY:-10,formatter:function(t){return t}},value:{show:!0,fontSize:"20px",fontFamily:void 0,fontWeight:400,color:void 0,offsetY:10,formatter:function(t){return t}},total:{show:!1,showAlways:!1,label:"Total",fontSize:"16px",fontWeight:400,fontFamily:void 0,color:void 0,formatter:function(t){return t.globals.seriesTotals.reduce((function(t,e){return t+e}),0)}}}}},polarArea:{rings:{strokeWidth:1,strokeColor:"#e8e8e8"}},radar:{size:void 0,offsetX:0,offsetY:0,polygons:{strokeWidth:1,strokeColors:"#e8e8e8",connectorColors:"#e8e8e8",fill:{colors:void 0}}}},colors:void 0,dataLabels:{enabled:!0,enabledOnSeries:void 0,formatter:function(t){return null!==t?t:""},textAnchor:"middle",distributed:!1,offsetX:0,offsetY:0,style:{fontSize:"12px",fontFamily:void 0,fontWeight:600,colors:void 0},background:{enabled:!0,foreColor:"#fff",borderRadius:2,padding:4,opacity:.9,borderWidth:1,borderColor:"#fff",dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.45}},dropShadow:{enabled:!1,top:1,left:1,blur:1,color:"#000",opacity:.45}},fill:{type:"solid",colors:void 0,opacity:.85,gradient:{shade:"dark",type:"horizontal",shadeIntensity:.5,gradientToColors:void 0,inverseColors:!0,opacityFrom:1,opacityTo:1,stops:[0,50,100],colorStops:[]},image:{src:[],width:void 0,height:void 0},pattern:{style:"squares",width:6,height:6,strokeWidth:2}},grid:{show:!0,borderColor:"#e0e0e0",strokeDashArray:0,position:"back",xaxis:{lines:{show:!1}},yaxis:{lines:{show:!0}},row:{colors:void 0,opacity:.5},column:{colors:void 0,opacity:.5},padding:{top:0,right:10,bottom:0,left:12}},labels:[],legend:{show:!0,showForSingleSeries:!1,showForNullSeries:!0,showForZeroSeries:!0,floating:!1,position:"bottom",horizontalAlign:"center",inverseOrder:!1,fontSize:"12px",fontFamily:void 0,fontWeight:400,width:void 0,height:void 0,formatter:void 0,tooltipHoverFormatter:void 0,offsetX:-20,offsetY:4,labels:{colors:void 0,useSeriesColors:!1},markers:{width:12,height:12,strokeWidth:0,fillColors:void 0,strokeColor:"#fff",radius:12,customHTML:void 0,offsetX:0,offsetY:0,onClick:void 0},itemMargin:{horizontal:5,vertical:2},onItemClick:{toggleDataSeries:!0},onItemHover:{highlightDataSeries:!0}},markers:{discrete:[],size:0,colors:void 0,strokeColors:"#fff",strokeWidth:2,strokeOpacity:.9,strokeDashArray:0,fillOpacity:1,shape:"circle",radius:2,offsetX:0,offsetY:0,onClick:void 0,onDblClick:void 0,showNullDataPoints:!0,hover:{size:void 0,sizeOffset:3}},noData:{text:void 0,align:"center",verticalAlign:"middle",offsetX:0,offsetY:0,style:{color:void 0,fontSize:"14px",fontFamily:void 0}},responsive:[],series:void 0,states:{normal:{filter:{type:"none",value:0}},hover:{filter:{type:"lighten",value:.15}},active:{allowMultipleDataPointsSelection:!1,filter:{type:"darken",value:.65}}},title:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:0,floating:!1,style:{fontSize:"14px",fontWeight:900,fontFamily:void 0,color:void 0}},subtitle:{text:void 0,align:"left",margin:5,offsetX:0,offsetY:30,floating:!1,style:{fontSize:"12px",fontWeight:400,fontFamily:void 0,color:void 0}},stroke:{show:!0,curve:"smooth",lineCap:"butt",width:2,colors:void 0,dashArray:0},tooltip:{enabled:!0,enabledOnSeries:void 0,shared:!0,followCursor:!1,intersect:!1,inverseOrder:!1,custom:void 0,fillSeriesColor:!1,theme:"light",style:{fontSize:"12px",fontFamily:void 0},onDatasetHover:{highlightDataSeries:!1},x:{show:!0,format:"dd MMM",formatter:void 0},y:{formatter:void 0,title:{formatter:function(t){return t+": "}}},z:{formatter:void 0,title:"Size: "},marker:{show:!0,fillColors:void 0},items:{display:"flex"},fixed:{enabled:!1,position:"topRight",offsetX:0,offsetY:0}},xaxis:{type:"category",categories:[],convertedCatToNumeric:!1,sorted:!1,offsetX:0,offsetY:0,labels:{show:!0,rotate:-45,rotateAlways:!1,hideOverlappingLabels:!0,trim:!1,minHeight:void 0,maxHeight:120,showDuplicates:!0,style:{colors:[],fontSize:"12px",fontWeight:400,fontFamily:void 0,cssClass:""},offsetX:0,offsetY:0,format:void 0,formatter:void 0,datetimeUTC:!0,datetimeFormatter:{year:"yyyy",month:"MMM 'yy",day:"dd MMM",hour:"HH:mm",minute:"HH:mm:ss"}},axisBorder:{show:!0,color:"#e0e0e0",width:"100%",height:1,offsetX:0,offsetY:0},axisTicks:{show:!0,color:"#e0e0e0",height:6,offsetX:0,offsetY:0},tickAmount:void 0,tickPlacement:"on",min:void 0,max:void 0,range:void 0,floating:!1,position:"bottom",title:{text:void 0,offsetX:0,offsetY:0,style:{color:void 0,fontSize:"12px",fontWeight:900,fontFamily:void 0,cssClass:""}},crosshairs:{show:!0,width:1,position:"back",opacity:.9,stroke:{color:"#b6b6b6",width:1,dashArray:3},fill:{type:"solid",color:"#B1B9C4",gradient:{colorFrom:"#D8E3F0",colorTo:"#BED1E6",stops:[0,100],opacityFrom:.4,opacityTo:.5}},dropShadow:{enabled:!1,left:0,top:0,blur:1,opacity:.4}},tooltip:{enabled:!0,offsetY:0,formatter:void 0,style:{fontSize:"12px",fontFamily:void 0}}},yaxis:this.yAxis,theme:{mode:"light",palette:"palette1",monochrome:{enabled:!1,color:"#008FFB",shadeTo:"light",shadeIntensity:.65}}}}}]),t}(),A=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.graphics=new w(this.ctx),this.w.globals.isBarHorizontal&&(this.invertAxis=!0),this.helpers=new S(this),this.xAxisAnnotations=new C(this),this.yAxisAnnotations=new D(this),this.pointsAnnotations=new T(this),this.w.globals.isBarHorizontal&&this.w.config.yaxis[0].reversed&&(this.inversedReversedAxis=!0),this.xDivision=this.w.globals.gridWidth/this.w.globals.dataPoints}return o(t,[{key:"drawAxesAnnotations",value:function(){var t=this.w;if(t.globals.axisCharts){for(var e=this.yAxisAnnotations.drawYAxisAnnotations(),n=this.xAxisAnnotations.drawXAxisAnnotations(),l=this.pointsAnnotations.drawPointAnnotations(),a=t.config.chart.animations.enabled,i=[e,n,l],r=[n.node,e.node,l.node],o=0;o<3;o++)t.globals.dom.elGraphical.add(i[o]),!a||t.globals.resized||t.globals.dataChanged||"scatter"!==t.config.chart.type&&"bubble"!==t.config.chart.type&&t.globals.dataPoints>1&&r[o].classList.add("apexcharts-element-hidden"),t.globals.delayedElements.push({el:r[o],index:0});this.helpers.annotationsBackground()}}},{key:"drawImageAnnos",value:function(){var t=this;this.w.config.annotations.images.map((function(e,n){t.addImage(e,n)}))}},{key:"drawTextAnnos",value:function(){var t=this;this.w.config.annotations.texts.map((function(e,n){t.addText(e,n)}))}},{key:"addXaxisAnnotation",value:function(t,e,n){this.xAxisAnnotations.addXaxisAnnotation(t,e,n)}},{key:"addYaxisAnnotation",value:function(t,e,n){this.yAxisAnnotations.addYaxisAnnotation(t,e,n)}},{key:"addPointAnnotation",value:function(t,e,n){this.pointsAnnotations.addPointAnnotation(t,e,n)}},{key:"addText",value:function(t,e){var n=t.x,l=t.y,a=t.text,i=t.textAnchor,r=t.foreColor,o=t.fontSize,s=t.fontFamily,c=t.fontWeight,d=t.cssClass,u=t.backgroundColor,h=t.borderWidth,p=t.strokeDashArray,f=t.borderRadius,g=t.borderColor,m=t.appendTo,v=void 0===m?".apexcharts-annotations":m,b=t.paddingLeft,y=void 0===b?4:b,x=t.paddingRight,_=void 0===x?4:x,w=t.paddingBottom,S=void 0===w?2:w,C=t.paddingTop,k=void 0===C?2:C,D=this.w,T=this.graphics.drawText({x:n,y:l,text:a,textAnchor:i||"start",fontSize:o||"12px",fontWeight:c||"regular",fontFamily:s||D.config.chart.fontFamily,foreColor:r||D.config.chart.foreColor,cssClass:d}),E=D.globals.dom.baseEl.querySelector(v);E&&E.appendChild(T.node);var M=T.bbox();if(a){var A=this.graphics.drawRect(M.x-y,M.y-k,M.width+y+_,M.height+S+k,f,u||"transparent",1,h,g,p);E.insertBefore(A.node,T.node)}}},{key:"addImage",value:function(t,e){var n=this.w,l=t.path,a=t.x,i=void 0===a?0:a,r=t.y,o=void 0===r?0:r,s=t.width,c=void 0===s?20:s,d=t.height,u=void 0===d?20:d,h=t.appendTo,p=void 0===h?".apexcharts-annotations":h,f=n.globals.dom.Paper.image(l);f.size(c,u).move(i,o);var g=n.globals.dom.baseEl.querySelector(p);g&&g.appendChild(f.node)}},{key:"addXaxisAnnotationExternal",value:function(t,e,n){return this.addAnnotationExternal({params:t,pushToMemory:e,context:n,type:"xaxis",contextMethod:n.addXaxisAnnotation}),n}},{key:"addYaxisAnnotationExternal",value:function(t,e,n){return this.addAnnotationExternal({params:t,pushToMemory:e,context:n,type:"yaxis",contextMethod:n.addYaxisAnnotation}),n}},{key:"addPointAnnotationExternal",value:function(t,e,n){return void 0===this.invertAxis&&(this.invertAxis=n.w.globals.isBarHorizontal),this.addAnnotationExternal({params:t,pushToMemory:e,context:n,type:"point",contextMethod:n.addPointAnnotation}),n}},{key:"addAnnotationExternal",value:function(t){var e=t.params,n=t.pushToMemory,l=t.context,a=t.type,i=t.contextMethod,r=l,o=r.w,s=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(a,"-annotations")),c=s.childNodes.length+1,d=new M,u=Object.assign({},"xaxis"===a?d.xAxisAnnotation:"yaxis"===a?d.yAxisAnnotation:d.pointAnnotation),h=y.extend(u,e);switch(a){case"xaxis":this.addXaxisAnnotation(h,s,c);break;case"yaxis":this.addYaxisAnnotation(h,s,c);break;case"point":this.addPointAnnotation(h,s,c)}var p=o.globals.dom.baseEl.querySelector(".apexcharts-".concat(a,"-annotations .apexcharts-").concat(a,"-annotation-label[rel='").concat(c,"']")),f=this.helpers.addBackgroundToAnno(p,h);return f&&s.insertBefore(f.node,p),n&&o.globals.memory.methodsToExec.push({context:r,id:h.id?h.id:y.randomId(),method:i,label:"addAnnotation",params:e}),l}},{key:"clearAnnotations",value:function(t){var e=t.w,n=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis-annotations, .apexcharts-xaxis-annotations, .apexcharts-point-annotations");e.globals.memory.methodsToExec.map((function(t,n){"addText"!==t.label&&"addAnnotation"!==t.label||e.globals.memory.methodsToExec.splice(n,1)})),n=y.listToArray(n),Array.prototype.forEach.call(n,(function(t){for(;t.firstChild;)t.removeChild(t.firstChild)}))}},{key:"removeAnnotation",value:function(t,e){var n=t.w,l=n.globals.dom.baseEl.querySelectorAll(".".concat(e));l&&(n.globals.memory.methodsToExec.map((function(t,l){t.id===e&&n.globals.memory.methodsToExec.splice(l,1)})),Array.prototype.forEach.call(l,(function(t){t.parentElement.removeChild(t)})))}}]),t}(),I=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.opts=null,this.seriesIndex=0}return o(t,[{key:"clippedImgArea",value:function(t){var e=this.w,n=e.config,l=parseInt(e.globals.gridWidth,10),a=parseInt(e.globals.gridHeight,10),i=l>a?l:a,r=t.image,o=0,s=0;void 0===t.width&&void 0===t.height?void 0!==n.fill.image.width&&void 0!==n.fill.image.height?(o=n.fill.image.width+1,s=n.fill.image.height):(o=i+1,s=i):(o=t.width,s=t.height);var c=document.createElementNS(e.globals.SVGNS,"pattern");w.setAttrs(c,{id:t.patternID,patternUnits:t.patternUnits?t.patternUnits:"userSpaceOnUse",width:o+"px",height:s+"px"});var d=document.createElementNS(e.globals.SVGNS,"image");c.appendChild(d),d.setAttributeNS(window.SVG.xlink,"href",r),w.setAttrs(d,{x:0,y:0,preserveAspectRatio:"none",width:o+"px",height:s+"px"}),d.style.opacity=t.opacity,e.globals.dom.elDefs.node.appendChild(c)}},{key:"getSeriesIndex",value:function(t){var e=this.w;return("bar"===e.config.chart.type||"rangeBar"===e.config.chart.type)&&e.config.plotOptions.bar.distributed||"heatmap"===e.config.chart.type?this.seriesIndex=t.seriesNumber:this.seriesIndex=t.seriesNumber%e.globals.series.length,this.seriesIndex}},{key:"fillPath",value:function(t){var e=this.w;this.opts=t;var n,l,a,i=this.w.config;this.seriesIndex=this.getSeriesIndex(t);var r=this.getFillColors()[this.seriesIndex];void 0!==e.globals.seriesColors[this.seriesIndex]&&(r=e.globals.seriesColors[this.seriesIndex]),"function"==typeof r&&(r=r({seriesIndex:this.seriesIndex,dataPointIndex:t.dataPointIndex,value:t.value,w:e}));var o=this.getFillType(this.seriesIndex),s=Array.isArray(i.fill.opacity)?i.fill.opacity[this.seriesIndex]:i.fill.opacity,c=r;if(t.color&&(r=t.color),-1===r.indexOf("rgb")?r.length<9&&(c=y.hexToRgba(r,s)):r.indexOf("rgba")>-1&&(s=y.getOpacityFromRGBA(r)),t.opacity&&(s=t.opacity),"pattern"===o&&(l=this.handlePatternFill(l,r,s,c)),"gradient"===o&&(a=this.handleGradientFill(r,s,this.seriesIndex)),"image"===o){var d=i.fill.image.src,u=t.patternID?t.patternID:"";this.clippedImgArea({opacity:s,image:Array.isArray(d)?t.seriesNumber-1&&(d=y.getOpacityFromRGBA(c));var u=void 0===a.fill.gradient.opacityTo?e:Array.isArray(a.fill.gradient.opacityTo)?a.fill.gradient.opacityTo[n]:a.fill.gradient.opacityTo;if(void 0===a.fill.gradient.gradientToColors||0===a.fill.gradient.gradientToColors.length)l="dark"===a.fill.gradient.shade?o.shadeColor(-1*parseFloat(a.fill.gradient.shadeIntensity),t.indexOf("rgb")>-1?y.rgb2hex(t):t):o.shadeColor(parseFloat(a.fill.gradient.shadeIntensity),t.indexOf("rgb")>-1?y.rgb2hex(t):t);else{var h=a.fill.gradient.gradientToColors[i.seriesNumber];l=h,h.indexOf("rgba")>-1&&(u=y.getOpacityFromRGBA(h))}if(a.fill.gradient.inverseColors){var p=c;c=l,l=p}return c.indexOf("rgb")>-1&&(c=y.rgb2hex(c)),l.indexOf("rgb")>-1&&(l=y.rgb2hex(l)),r.drawGradient(s,c,l,d,u,i.size,a.fill.gradient.stops,a.fill.gradient.colorStops,n)}}]),t}(),R=function(){function t(e,n){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"setGlobalMarkerSize",value:function(){var t=this.w;if(t.globals.markers.size=Array.isArray(t.config.markers.size)?t.config.markers.size:[t.config.markers.size],t.globals.markers.size.length>0){if(t.globals.markers.size.length4&&void 0!==arguments[4]&&arguments[4],r=this.w,o=e,s=t,c=null,d=new w(this.ctx);if((r.globals.markers.size[e]>0||i)&&(c=d.group({class:i?"":"apexcharts-series-markers"})).attr("clip-path","url(#gridRectMarkerMask".concat(r.globals.cuid,")")),Array.isArray(s.x))for(var u=0;u0:r.config.markers.size>0;if(f||i){y.isNumber(s.y[u])?p+=" w".concat(y.randomId()):p="apexcharts-nullpoint";var g=this.getMarkerConfig(p,e,h);r.config.series[o].data[h]&&(r.config.series[o].data[h].fillColor&&(g.pointFillColor=r.config.series[o].data[h].fillColor),r.config.series[o].data[h].strokeColor&&(g.pointStrokeColor=r.config.series[o].data[h].strokeColor)),l&&(g.pSize=l),(a=d.drawMarker(s.x[u],s.y[u],g)).attr("rel",h),a.attr("j",h),a.attr("index",e),a.node.setAttribute("default-marker-size",g.pSize);var m=new x(this.ctx);m.setSelectionFilter(a,e,h),this.addEvents(a),c&&c.add(a)}else void 0===r.globals.pointsArray[e]&&(r.globals.pointsArray[e]=[]),r.globals.pointsArray[e].push([s.x[u],s.y[u]])}return c}},{key:"getMarkerConfig",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=this.w,a=this.getMarkerStyle(e),i=l.globals.markers.size[e],r=l.config.markers;return null!==n&&r.discrete.length&&r.discrete.map((function(t){t.seriesIndex===e&&t.dataPointIndex===n&&(a.pointStrokeColor=t.strokeColor,a.pointFillColor=t.fillColor,i=t.size)})),{pSize:i,pRadius:r.radius,pWidth:Array.isArray(r.strokeWidth)?r.strokeWidth[e]:r.strokeWidth,pointStrokeColor:a.pointStrokeColor,pointFillColor:a.pointFillColor,shape:Array.isArray(r.shape)?r.shape[e]:r.shape,class:t,pointStrokeOpacity:Array.isArray(r.strokeOpacity)?r.strokeOpacity[e]:r.strokeOpacity,pointStrokeDashArray:Array.isArray(r.strokeDashArray)?r.strokeDashArray[e]:r.strokeDashArray,pointFillOpacity:Array.isArray(r.fillOpacity)?r.fillOpacity[e]:r.fillOpacity,seriesIndex:e}}},{key:"addEvents",value:function(t){var e=this.w,n=new w(this.ctx);t.node.addEventListener("mouseenter",n.pathMouseEnter.bind(this.ctx,t)),t.node.addEventListener("mouseleave",n.pathMouseLeave.bind(this.ctx,t)),t.node.addEventListener("mousedown",n.pathMouseDown.bind(this.ctx,t)),t.node.addEventListener("click",e.config.markers.onClick),t.node.addEventListener("dblclick",e.config.markers.onDblClick),t.node.addEventListener("touchstart",n.pathMouseDown.bind(this.ctx,t),{passive:!0})}},{key:"getMarkerStyle",value:function(t){var e=this.w,n=e.globals.markers.colors,l=e.config.markers.strokeColor||e.config.markers.strokeColors;return{pointStrokeColor:Array.isArray(l)?l[t]:l,pointFillColor:Array.isArray(n)?n[t]:n}}}]),t}(),P=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled}return o(t,[{key:"draw",value:function(t,e,n){var l=this.w,a=new w(this.ctx),i=n.realIndex,r=n.pointsPos,o=n.zRatio,s=n.elParent,c=a.group({class:"apexcharts-series-markers apexcharts-series-".concat(l.config.chart.type)});if(c.attr("clip-path","url(#gridRectMarkerMask".concat(l.globals.cuid,")")),Array.isArray(r.x))for(var d=0;dg.maxBubbleRadius&&(f=g.maxBubbleRadius)}l.config.chart.animations.enabled||(p=f);var m=r.x[d],v=r.y[d];if(p=p||0,null!==v&&void 0!==l.globals.series[i][u]||(h=!1),h){var b=this.drawPoint(m,v,p,f,i,u,e);c.add(b)}s.add(c)}}},{key:"drawPoint",value:function(t,e,n,l,a,i,r){var o=this.w,s=a,c=new _(this.ctx),d=new x(this.ctx),u=new I(this.ctx),h=new R(this.ctx),p=new w(this.ctx),f=h.getMarkerConfig("apexcharts-marker",s),g=u.fillPath({seriesNumber:a,dataPointIndex:i,patternUnits:"objectBoundingBox",value:o.globals.series[a][r]}),m=p.drawCircle(n);if(o.config.series[s].data[i]&&o.config.series[s].data[i].fillColor&&(g=o.config.series[s].data[i].fillColor),m.attr({cx:t,cy:e,fill:g,stroke:f.pointStrokeColor,r:l,"stroke-width":f.pWidth,"stroke-dasharray":f.pointStrokeDashArray,"stroke-opacity":f.pointStrokeOpacity}),o.config.chart.dropShadow.enabled){var v=o.config.chart.dropShadow;d.dropShadow(m,v,a)}if(this.initialAnim&&!o.globals.dataChanged&&!o.globals.resized){var b=o.config.chart.animations.speed;c.animateCircleRadius(m,0,l,b,o.globals.easing,(function(){window.setTimeout((function(){c.animationCompleted(m)}),100)}))}if(o.globals.dataChanged)if(this.dynamicAnim){var y,S,C,k,D=o.config.chart.animations.dynamicAnimation.speed;null!=(k=o.globals.previousPaths[a]&&o.globals.previousPaths[a][r])&&(y=k.x,S=k.y,C=void 0!==k.r?k.r:l);for(var T=0;Tf.x+f.width+2||e>f.y+f.height+2||t+d4&&void 0!==arguments[4]?arguments[4]:2,i=this.w,r=new w(this.ctx),o=i.config.dataLabels,s=0,c=0,d=n,u=null;if(!o.enabled||!Array.isArray(t.x))return u;u=r.group({class:"apexcharts-data-labels"});for(var h=0;he.globals.gridWidth+20)&&(o="");var g=e.globals.dataLabels.style.colors[i];(("bar"===e.config.chart.type||"rangeBar"===e.config.chart.type)&&e.config.plotOptions.bar.distributed||e.config.dataLabels.distributed)&&(g=e.globals.dataLabels.style.colors[r]),u&&(g=u);var m=d.offsetX,v=d.offsetY;if("bar"!==e.config.chart.type&&"rangeBar"!==e.config.chart.type||(m=0,v=0),f.drawnextLabel){var b=n.drawText({width:100,height:parseInt(d.style.fontSize,10),x:l+m,y:a+v,foreColor:g,textAnchor:s||d.textAnchor,text:o,fontSize:d.style.fontSize,fontFamily:d.style.fontFamily,fontWeight:d.style.fontWeight||"normal"});if(b.attr({class:"apexcharts-datalabel",cx:l,cy:a}),d.dropShadow.enabled){var y=d.dropShadow;new x(this.ctx).dropShadow(b,y)}c.add(b),void 0===e.globals.lastDrawnDataLabelsIndexes[i]&&(e.globals.lastDrawnDataLabelsIndexes[i]=[]),e.globals.lastDrawnDataLabelsIndexes[i].push(r)}}}},{key:"addBackgroundToDataLabel",value:function(t,e){var n=this.w,l=n.config.dataLabels.background,a=l.padding,i=l.padding/2,r=e.width,o=e.height,s=new w(this.ctx).drawRect(e.x-a,e.y-i/2,r+2*a,o+i,l.borderRadius,"transparent"===n.config.chart.background?"#fff":n.config.chart.background,l.opacity,l.borderWidth,l.borderColor);return l.dropShadow.enabled&&new x(this.ctx).dropShadow(s,l.dropShadow),s}},{key:"dataLabelsBackground",value:function(){var t=this.w;if("bubble"!==t.config.chart.type)for(var e=t.globals.dom.baseEl.querySelectorAll(".apexcharts-datalabels text"),n=0;nString(f.globals.maxY).length?f.globals.minY:f.globals.maxY;T=g.getTextRects(f.globals.yLabelFormatters[0](E),parseFloat(S.style.fontSize))}var M={x:e,y:n,i:i,j:r,renderedPath:p,bcx:v,bcy:b,barHeight:c,barWidth:d,textRects:T,strokeWidth:m,dataLabelsX:x,dataLabelsY:_,barDataLabelsConfig:C,offX:k,offY:D};return y=this.barCtx.isHorizontal?this.calculateBarsDataLabelsPosition(M):this.calculateColumnsDataLabelsPosition(M),p.attr({cy:y.bcy,cx:y.bcx,j:r,val:s[i][r],barHeight:c,barWidth:d}),this.drawCalculatedDataLabels({x:y.dataLabelsX,y:y.dataLabelsY,val:this.barCtx.isTimelineBar?[l,a]:s[i][r],i:o,j:r,barWidth:d,barHeight:c,textRects:T,dataLabelsConfig:S})}},{key:"calculateColumnsDataLabelsPosition",value:function(t){var e,n=this.w,l=t.i,a=t.j,i=t.y,r=t.bcx,o=t.barWidth,s=t.barHeight,c=t.textRects,d=t.dataLabelsY,u=t.barDataLabelsConfig,h=t.strokeWidth,p=t.offX,f=t.offY;s=Math.abs(s);var g="vertical"===n.config.plotOptions.bar.dataLabels.orientation;r-=h/2;var m=n.globals.gridWidth/n.globals.dataPoints;e=n.globals.isXNumeric?r-o/2+p:r-m+o/2+p,g&&(e=e+c.height/2-h/2-2);var v=this.barCtx.series[l][a]<0,b=i;switch(this.barCtx.isReversed&&(b=i-s+(v?2*s:0),i-=s),u.position){case"center":d=g?v?b+s/2+f:b+s/2-f:v?b-s/2+c.height/2+f:b+s/2+c.height/2-f;break;case"bottom":d=g?v?b+s+f:b+s-f:v?b-s+c.height+h+f:b+s-c.height/2+h-f;break;case"top":d=g?v?b+f:b-f:v?b-c.height/2-f:b+c.height+f}return n.config.chart.stacked||(d<0?d=0+h:d+c.height/3>n.globals.gridHeight&&(d=n.globals.gridHeight-h)),{bcx:r,bcy:i,dataLabelsX:e,dataLabelsY:d}}},{key:"calculateBarsDataLabelsPosition",value:function(t){var e=this.w,n=t.x,l=t.i,a=t.j,i=t.bcy,r=t.barHeight,o=t.barWidth,s=t.textRects,c=t.dataLabelsX,d=t.strokeWidth,u=t.barDataLabelsConfig,h=t.offX,p=t.offY,f=e.globals.gridHeight/e.globals.dataPoints;o=Math.abs(o);var g=i-(this.barCtx.isTimelineBar?0:f)+r/2+s.height/2+p-3,m=this.barCtx.series[l][a]<0,v=n;switch(this.barCtx.isReversed&&(v=n+o-(m?2*o:0),n=e.globals.gridWidth-o),u.position){case"center":c=m?v+o/2-h:v-o/2+h;break;case"bottom":c=m?v+o-d-Math.round(s.width/2)-h:v-o+d+Math.round(s.width/2)+h;break;case"top":c=m?v-d+Math.round(s.width/2)-h:v-d-Math.round(s.width/2)+h}return e.config.chart.stacked||(c<0?c=c+s.width+d:c+s.width/2>e.globals.gridWidth&&(c=e.globals.gridWidth-s.width-d)),{bcx:n,bcy:i,dataLabelsX:c,dataLabelsY:g}}},{key:"drawCalculatedDataLabels",value:function(t){var e=t.x,n=t.y,l=t.val,a=t.i,i=t.j,r=t.textRects,o=t.barHeight,s=t.barWidth,c=t.dataLabelsConfig,u=this.w,h="rotate(0)";"vertical"===u.config.plotOptions.bar.dataLabels.orientation&&(h="rotate(-90, ".concat(e,", ").concat(n,")"));var p=new j(this.barCtx.ctx),f=new w(this.barCtx.ctx),g=c.formatter,m=null,v=u.globals.collapsedSeriesIndices.indexOf(a)>-1;if(c.enabled&&!v){m=f.group({class:"apexcharts-data-labels",transform:h});var b="";void 0!==l&&(b=g(l,{seriesIndex:a,dataPointIndex:i,w:u})),0===l&&u.config.chart.stacked&&(b="");var y=u.globals.series[a][i]<=0,x=u.config.plotOptions.bar.dataLabels.position;"vertical"===u.config.plotOptions.bar.dataLabels.orientation&&("top"===x&&(c.textAnchor=y?"end":"start"),"center"===x&&(c.textAnchor="middle"),"bottom"===x&&(c.textAnchor=y?"end":"start")),this.barCtx.isTimelineBar&&this.barCtx.barOptions.dataLabels.hideOverflowingLabels&&s0&&r.width/1.6>s||s<0&&r.width/1.6o&&(b="")));var _=d({},c);this.barCtx.isHorizontal&&l<0&&("start"===c.textAnchor?_.textAnchor="end":"end"===c.textAnchor&&(_.textAnchor="start")),p.plotDataLabelsText({x:e,y:n,text:b,i:a,j:i,parent:m,dataLabelsConfig:_,alwaysDrawDataLabel:!0,offsetCorrection:!0})}return m}}]),t}(),N=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.legendInactiveClass="legend-mouseover-inactive"}return o(t,[{key:"getAllSeriesEls",value:function(){return this.w.globals.dom.baseEl.getElementsByClassName("apexcharts-series")}},{key:"getSeriesByName",value:function(t){return this.w.globals.dom.baseEl.querySelector("[seriesName='".concat(y.escapeString(t),"']"))}},{key:"isSeriesHidden",value:function(t){var e=this.getSeriesByName(t),n=parseInt(e.getAttribute("data:realIndex"),10);return{isHidden:e.classList.contains("apexcharts-series-collapsed"),realIndex:n}}},{key:"addCollapsedClassToSeries",value:function(t,e){var n=this.w;function l(n){for(var l=0;l0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],l=this.w,a=y.clone(l.globals.initialSeries);l.globals.previousPaths=[],n?(l.globals.collapsedSeries=[],l.globals.ancillaryCollapsedSeries=[],l.globals.collapsedSeriesIndices=[],l.globals.ancillaryCollapsedSeriesIndices=[]):a=this.emptyCollapsedSeries(a),l.config.series=a,t&&(e&&(l.globals.zoomed=!1,this.ctx.updateHelpers.revertDefaultAxisMinMax()),this.ctx.updateHelpers._updateSeries(a,l.config.chart.animations.dynamicAnimation.enabled))}},{key:"emptyCollapsedSeries",value:function(t){for(var e=this.w,n=0;n-1&&(t[n].data=[]);return t}},{key:"toggleSeriesOnHover",value:function(t,e){var n=this.w,l=n.globals.dom.baseEl.querySelectorAll(".apexcharts-series, .apexcharts-datalabels");if("mousemove"===t.type){var a=parseInt(e.getAttribute("rel"),10)-1,i=null,r=null;n.globals.axisCharts||"radialBar"===n.config.chart.type?n.globals.axisCharts?(i=n.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(a,"']")),r=n.globals.dom.baseEl.querySelector(".apexcharts-datalabels[data\\:realIndex='".concat(a,"']"))):i=n.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"']")):i=n.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(a+1,"'] path"));for(var o=0;o=t.from&&l<=t.to&&a[e].classList.remove(n.legendInactiveClass)}}(l.config.plotOptions.heatmap.colorScale.ranges[r])}else"mouseout"===t.type&&i("remove")}},{key:"getActiveConfigSeriesIndex",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=this.w,n=0;if(e.config.series.length>1)for(var l=e.config.series.map((function(n,l){var a=!1;return t&&(a="bar"===e.config.series[l].type||"column"===e.config.series[l].type),n.data&&n.data.length>0&&!a?l:-1})),a=0;a0)for(var l=0;l0)for(var l=0;l0?t:[]}))}}]),t}(),L=function(){function t(e){i(this,t),this.w=e.w,this.barCtx=e}return o(t,[{key:"initVariables",value:function(t){var e=this.w;this.barCtx.series=t,this.barCtx.totalItems=0,this.barCtx.seriesLen=0,this.barCtx.visibleI=-1,this.barCtx.visibleItems=1;for(var n=0;n0&&(this.barCtx.seriesLen=this.barCtx.seriesLen+1,this.barCtx.totalItems+=t[n].length),e.globals.isXNumeric)for(var l=0;le.globals.minX&&e.globals.seriesX[n][l]0&&(l=s.globals.minXDiff/d),(i=l/this.barCtx.seriesLen*parseInt(this.barCtx.barOptions.columnWidth,10)/100)<1&&(i=1)}r=s.globals.gridHeight-this.barCtx.baseLineY[this.barCtx.yaxisIndex]-(this.barCtx.isReversed?s.globals.gridHeight:0)+(this.barCtx.isReversed?2*this.barCtx.baseLineY[this.barCtx.yaxisIndex]:0),t=s.globals.padHorizontal+(l-i*this.barCtx.seriesLen)/2}return{x:t,y:e,yDivision:n,xDivision:l,barHeight:a,barWidth:i,zeroH:r,zeroW:o}}},{key:"getPathFillColor",value:function(t,e,n,l){var a=this.w,i=new I(this.barCtx.ctx),r=null,o=this.barCtx.barOptions.distributed?n:e;return this.barCtx.barOptions.colors.ranges.length>0&&this.barCtx.barOptions.colors.ranges.map((function(l){t[e][n]>=l.from&&t[e][n]<=l.to&&(r=l.color)})),a.config.series[e].data[n]&&a.config.series[e].data[n].fillColor&&(r=a.config.series[e].data[n].fillColor),i.fillPath({seriesNumber:this.barCtx.barOptions.distributed?o:l,dataPointIndex:n,color:r,value:t[e][n]})}},{key:"getStrokeWidth",value:function(t,e,n){var l=0,a=this.w;return void 0===this.barCtx.series[t][e]||null===this.barCtx.series[t][e]?this.barCtx.isNullValue=!0:this.barCtx.isNullValue=!1,a.config.stroke.show&&(this.barCtx.isNullValue||(l=Array.isArray(this.barCtx.strokeWidth)?this.barCtx.strokeWidth[n]:this.barCtx.strokeWidth)),l}},{key:"barBackground",value:function(t){var e=t.j,n=t.i,l=t.x1,a=t.x2,i=t.y1,r=t.y2,o=t.elSeries,s=this.w,c=new w(this.barCtx.ctx),d=new N(this.barCtx.ctx).getActiveConfigSeriesIndex();if(this.barCtx.barOptions.colors.backgroundBarColors.length>0&&d===n){e>=this.barCtx.barOptions.colors.backgroundBarColors.length&&(e-=this.barCtx.barOptions.colors.backgroundBarColors.length);var u=this.barCtx.barOptions.colors.backgroundBarColors[e],h=c.drawRect(void 0!==l?l:0,void 0!==i?i:0,void 0!==a?a:s.globals.gridWidth,void 0!==r?r:s.globals.gridHeight,this.barCtx.barOptions.colors.backgroundBarRadius,u,this.barCtx.barOptions.colors.backgroundBarOpacity);o.add(h),h.node.classList.add("apexcharts-backgroundBar")}}},{key:"getColumnPaths",value:function(t){var e=t.barWidth,n=t.barXPosition,l=t.yRatio,a=t.y1,i=t.y2,r=t.strokeWidth,o=t.series,s=t.realIndex,c=t.i,d=t.j,u=t.w,h=new w(this.barCtx.ctx);(r=Array.isArray(r)?r[s]:r)||(r=0);var p={barWidth:e,strokeWidth:r,yRatio:l,barXPosition:n,y1:a,y2:i},f=this.getRoundedBars(u,p,o,c,d),g=n,m=n+e,v=h.move(g,f.y1),b=h.move(g,f.y1);return u.globals.previousPaths.length>0&&(b=this.barCtx.getPreviousPath(s,d,!1)),{pathTo:v=v+h.line(g,f.y2)+f.endingPath+h.line(m-r,f.y2)+h.line(m-r,f.y1)+f.startingPath+"z",pathFrom:b=b+h.line(g,a)+h.line(m-r,a)+h.line(m-r,a)+h.line(m-r,a)+h.line(g,a)}}},{key:"getBarpaths",value:function(t){var e=t.barYPosition,n=t.barHeight,l=t.x1,a=t.x2,i=t.strokeWidth,r=t.series,o=t.realIndex,s=t.i,c=t.j,d=t.w,u=new w(this.barCtx.ctx);(i=Array.isArray(i)?i[o]:i)||(i=0);var h={barHeight:n,strokeWidth:i,barYPosition:e,x2:a,x1:l},p=this.getRoundedBars(d,h,r,s,c),f=u.move(p.x1,e),g=u.move(p.x1,e);d.globals.previousPaths.length>0&&(g=this.barCtx.getPreviousPath(o,c,!1));var m=e,v=e+n;return{pathTo:f=f+u.line(p.x2,m)+p.endingPath+u.line(p.x2,v-i)+u.line(p.x1,v-i)+p.startingPath+"z",pathFrom:g=g+u.line(l,m)+u.line(l,v-i)+u.line(l,v-i)+u.line(l,v-i)+u.line(l,m)}}},{key:"getRoundedBars",value:function(t,e,n,l,a){var i=new w(this.barCtx.ctx),r=Array.isArray(e.strokeWidth)?e.strokeWidth[l]:e.strokeWidth;if(r||(r=0),this.barCtx.isHorizontal){var o=null,s="",c=e.x2,d=e.x1;if(void 0!==n[l][a]||null!==n[l][a]){var u=n[l][a]<0,h=e.barHeight/2-r;switch(u&&(h=-e.barHeight/2-r),h>Math.abs(c-d)&&(h=Math.abs(c-d)),"rounded"===this.barCtx.barOptions.endingShape&&(c=e.x2-h/2),"rounded"===this.barCtx.barOptions.startingShape&&(d=e.x1+h/2),this.barCtx.barOptions.endingShape){case"flat":o=i.line(c,e.barYPosition+e.barHeight-r);break;case"rounded":o=i.quadraticCurve(c+h,e.barYPosition+(e.barHeight-r)/2,c,e.barYPosition+e.barHeight-r)}switch(this.barCtx.barOptions.startingShape){case"flat":s=i.line(d,e.barYPosition+e.barHeight-r);break;case"rounded":s=i.quadraticCurve(d-h,e.barYPosition+e.barHeight/2,d,e.barYPosition)}}return{endingPath:o,startingPath:s,x2:c,x1:d}}var p=null,f="",g=e.y2,m=e.y1;if(void 0!==n[l][a]||null!==n[l][a]){var v=n[l][a]<0,b=e.barWidth/2-r;switch(v&&(b=-e.barWidth/2-r),b>Math.abs(g-m)&&(b=Math.abs(g-m)),"rounded"===this.barCtx.barOptions.endingShape&&(g+=b/2),"rounded"===this.barCtx.barOptions.startingShape&&(m-=b/2),this.barCtx.barOptions.endingShape){case"flat":p=i.line(e.barXPosition+e.barWidth-r,g);break;case"rounded":p=i.quadraticCurve(e.barXPosition+(e.barWidth-r)/2,g-b,e.barXPosition+e.barWidth-r,g)}switch(this.barCtx.barOptions.startingShape){case"flat":f=i.line(e.barXPosition+e.barWidth-r,m);break;case"rounded":f=i.quadraticCurve(e.barXPosition+(e.barWidth-r)/2,m+b,e.barXPosition,m)}}return{endingPath:p,startingPath:f,y2:g,y1:m}}}]),t}(),F=function(){function t(e,n){i(this,t),this.ctx=e,this.w=e.w;var l=this.w;this.barOptions=l.config.plotOptions.bar,this.isHorizontal=this.barOptions.horizontal,this.strokeWidth=l.config.stroke.width,this.isNullValue=!1,this.isTimelineBar="datetime"===l.config.xaxis.type&&l.globals.seriesRangeBarTimeline.length,this.xyRatios=n,null!==this.xyRatios&&(this.xRatio=n.xRatio,this.initialXRatio=n.initialXRatio,this.yRatio=n.yRatio,this.invertedXRatio=n.invertedXRatio,this.invertedYRatio=n.invertedYRatio,this.baseLineY=n.baseLineY,this.baseLineInvertedY=n.baseLineInvertedY),this.yaxisIndex=0,this.seriesLen=0,this.barHelpers=new L(this)}return o(t,[{key:"draw",value:function(t,e){var n=this.w,l=new w(this.ctx),a=new k(this.ctx,n);t=a.getLogSeries(t),this.series=t,this.yRatio=a.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);var i=l.group({class:"apexcharts-bar-series apexcharts-plot-series"});n.config.dataLabels.enabled&&this.totalItems>this.barOptions.dataLabels.maxItems&&console.warn("WARNING: DataLabels are enabled but there are too many to display. This may cause performance issue when rendering.");for(var r=0,o=0;r0&&(this.visibleI=this.visibleI+1);var x=0,_=0;this.yRatio.length>1&&(this.yaxisIndex=v),this.isReversed=n.config.yaxis[this.yaxisIndex]&&n.config.yaxis[this.yaxisIndex].reversed;var S=this.barHelpers.initialPositions();f=S.y,x=S.barHeight,c=S.yDivision,h=S.zeroW,p=S.x,_=S.barWidth,s=S.xDivision,u=S.zeroH,this.horizontal||m.push(p+_/2);for(var C=l.group({class:"apexcharts-datalabels","data:realIndex":v}),D=0;D0&&m.push(p+_/2),g.push(f);var A=this.barHelpers.getPathFillColor(t,r,D,v);this.renderSeries({realIndex:v,pathFill:A,j:D,i:r,pathFrom:E.pathFrom,pathTo:E.pathTo,strokeWidth:T,elSeries:b,x:p,y:f,series:t,barHeight:x,barWidth:_,elDataLabelsWrap:C,visibleSeries:this.visibleI,type:"bar"})}n.globals.seriesXvalues[v]=m,n.globals.seriesYvalues[v]=g,i.add(b)}return i}},{key:"renderSeries",value:function(t){var e=t.realIndex,n=t.pathFill,l=t.lineFill,a=t.j,i=t.i,r=t.pathFrom,o=t.pathTo,s=t.strokeWidth,c=t.elSeries,d=t.x,u=t.y,h=t.y1,p=t.y2,f=t.series,g=t.barHeight,m=t.barWidth,v=t.barYPosition,b=t.elDataLabelsWrap,y=t.visibleSeries,_=t.type,S=this.w,C=new w(this.ctx);l||(l=this.barOptions.distributed?S.globals.stroke.colors[a]:S.globals.stroke.colors[e]),S.config.series[i].data[a]&&S.config.series[i].data[a].strokeColor&&(l=S.config.series[i].data[a].strokeColor),this.isNullValue&&(n="none");var k=a/S.config.chart.animations.animateGradually.delay*(S.config.chart.animations.speed/S.globals.dataPoints)/2.4,D=C.renderPaths({i:i,j:a,realIndex:e,pathFrom:r,pathTo:o,stroke:l,strokeWidth:s,strokeLineCap:S.config.stroke.lineCap,fill:n,animationDelay:k,initialSpeed:S.config.chart.animations.speed,dataChangeSpeed:S.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(_,"-area")});D.attr("clip-path","url(#gridRectMask".concat(S.globals.cuid,")")),void 0!==h&&void 0!==p&&(D.attr("data-range-y1",h),D.attr("data-range-y2",p)),new x(this.ctx).setSelectionFilter(D,e,a),c.add(D);var T=new O(this).handleBarDataLabels({x:d,y:u,y1:h,y2:p,i:i,j:a,series:f,realIndex:e,barHeight:g,barWidth:m,barYPosition:v,renderedPath:D,visibleSeries:y});return null!==T&&b.add(T),c.add(b),c}},{key:"drawBarPaths",value:function(t){var e=t.indexes,n=t.barHeight,l=t.strokeWidth,a=t.zeroW,i=t.x,r=t.y,o=t.yDivision,s=t.elSeries,c=this.w,d=e.i,u=e.j;c.globals.isXNumeric&&(r=(c.globals.seriesX[d][u]-c.globals.minX)/this.invertedXRatio-n);var h=r+n*this.visibleI;i=void 0===this.series[d][u]||null===this.series[d][u]?a:a+this.series[d][u]/this.invertedYRatio-2*(this.isReversed?this.series[d][u]/this.invertedYRatio:0);var p=this.barHelpers.getBarpaths({barYPosition:h,barHeight:n,x1:a,x2:i,strokeWidth:l,series:this.series,realIndex:e.realIndex,i:d,j:u,w:c});return c.globals.isXNumeric||(r+=o),this.barHelpers.barBackground({j:u,i:d,y1:h-n*this.visibleI,y2:n*this.seriesLen,elSeries:s}),{pathTo:p.pathTo,pathFrom:p.pathFrom,x:i,y:r,barYPosition:h}}},{key:"drawColumnPaths",value:function(t){var e=t.indexes,n=t.x,l=t.y,a=t.xDivision,i=t.barWidth,r=t.zeroH,o=t.strokeWidth,s=t.elSeries,c=this.w,d=e.i,u=e.j,h=e.bc;if(c.globals.isXNumeric){var p=d;c.globals.seriesX[d].length||(p=c.globals.maxValsInArrayIndex),n=(c.globals.seriesX[p][u]-c.globals.minX)/this.xRatio-i*this.seriesLen/2}var f=n+i*this.visibleI;l=void 0===this.series[d][u]||null===this.series[d][u]?r:r-this.series[d][u]/this.yRatio[this.yaxisIndex]+2*(this.isReversed?this.series[d][u]/this.yRatio[this.yaxisIndex]:0);var g=this.barHelpers.getColumnPaths({barXPosition:f,barWidth:i,y1:r,y2:l,strokeWidth:o,series:this.series,realIndex:e.realIndex,i:d,j:u,w:c});return c.globals.isXNumeric||(n+=a),this.barHelpers.barBackground({bc:h,j:u,i:d,x1:f-o/2-i*this.visibleI,x2:i*this.seriesLen+o/2,elSeries:s}),{pathTo:g.pathTo,pathFrom:g.pathFrom,x:n,y:l,barXPosition:f}}},{key:"getPreviousPath",value:function(t,e){for(var n,l=this.w,a=0;a0&&parseInt(i.realIndex,10)===parseInt(t,10)&&void 0!==l.globals.previousPaths[a].paths[e]&&(n=l.globals.previousPaths[a].paths[e].d)}return n}}]),t}(),B=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.months31=[1,3,5,7,8,10,12],this.months30=[2,4,6,9,11],this.daysCntOfYear=[0,31,59,90,120,151,181,212,243,273,304,334]}return o(t,[{key:"isValidDate",value:function(t){return!isNaN(this.parseDate(t))}},{key:"getTimeStamp",value:function(t){return Date.parse(t)?this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(t).toISOString().substr(0,25)).getTime():new Date(t).getTime():t}},{key:"getDate",value:function(t){return this.w.config.xaxis.labels.datetimeUTC?new Date(new Date(t).toUTCString()):new Date(t)}},{key:"parseDate",value:function(t){var e=Date.parse(t);if(!isNaN(e))return this.getTimeStamp(t);var n=Date.parse(t.replace(/-/g,"/").replace(/[a-z]+/gi," "));return this.getTimeStamp(n)}},{key:"parseDateWithTimezone",value:function(t){return Date.parse(t.replace(/-/g,"/").replace(/[a-z]+/gi," "))}},{key:"formatDate",value:function(t,e){var n=this.w.globals.locale,l=this.w.config.xaxis.labels.datetimeUTC,a=["\0"].concat(g(n.months)),i=[""].concat(g(n.shortMonths)),r=[""].concat(g(n.days)),o=[""].concat(g(n.shortDays));function s(t,e){var n=t+"";for(e=e||2;n.length12?h-12:0===h?12:h;e=(e=(e=(e=e.replace(/(^|[^\\])HH+/g,"$1"+s(h))).replace(/(^|[^\\])H/g,"$1"+h)).replace(/(^|[^\\])hh+/g,"$1"+s(p))).replace(/(^|[^\\])h/g,"$1"+p);var f=l?t.getUTCMinutes():t.getMinutes();e=(e=e.replace(/(^|[^\\])mm+/g,"$1"+s(f))).replace(/(^|[^\\])m/g,"$1"+f);var m=l?t.getUTCSeconds():t.getSeconds();e=(e=e.replace(/(^|[^\\])ss+/g,"$1"+s(m))).replace(/(^|[^\\])s/g,"$1"+m);var v=l?t.getUTCMilliseconds():t.getMilliseconds();e=e.replace(/(^|[^\\])fff+/g,"$1"+s(v,3)),v=Math.round(v/10),e=e.replace(/(^|[^\\])ff/g,"$1"+s(v)),v=Math.round(v/10);var b=h<12?"AM":"PM";e=(e=(e=e.replace(/(^|[^\\])f/g,"$1"+v)).replace(/(^|[^\\])TT+/g,"$1"+b)).replace(/(^|[^\\])T/g,"$1"+b.charAt(0));var y=b.toLowerCase();e=(e=e.replace(/(^|[^\\])tt+/g,"$1"+y)).replace(/(^|[^\\])t/g,"$1"+y.charAt(0));var x=-t.getTimezoneOffset(),_=l||!x?"Z":x>0?"+":"-";if(!l){var w=(x=Math.abs(x))%60;_+=s(Math.floor(x/60))+":"+s(w)}e=e.replace(/(^|[^\\])K/g,"$1"+_);var S=(l?t.getUTCDay():t.getDay())+1;return(e=(e=(e=(e=e.replace(new RegExp(r[0],"g"),r[S])).replace(new RegExp(o[0],"g"),o[S])).replace(new RegExp(a[0],"g"),a[d])).replace(new RegExp(i[0],"g"),i[d])).replace(/\\(.)/g,"$1")}},{key:"getTimeUnitsfromTimestamp",value:function(t,e,n){var l=this.w;void 0!==l.config.xaxis.min&&(t=l.config.xaxis.min),void 0!==l.config.xaxis.max&&(e=l.config.xaxis.max);var a=this.getDate(t),i=this.getDate(e),r=this.formatDate(a,"yyyy MM dd HH mm").split(" "),o=this.formatDate(i,"yyyy MM dd HH mm").split(" ");return{minMinute:parseInt(r[4],10),maxMinute:parseInt(o[4],10),minHour:parseInt(r[3],10),maxHour:parseInt(o[3],10),minDate:parseInt(r[2],10),maxDate:parseInt(o[2],10),minMonth:parseInt(r[1],10)-1,maxMonth:parseInt(o[1],10)-1,minYear:parseInt(r[0],10),maxYear:parseInt(o[0],10)}}},{key:"isLeapYear",value:function(t){return t%4==0&&t%100!=0||t%400==0}},{key:"calculcateLastDaysOfMonth",value:function(t,e,n){return this.determineDaysOfMonths(t,e)-n}},{key:"determineDaysOfYear",value:function(t){var e=365;return this.isLeapYear(t)&&(e=366),e}},{key:"determineRemainingDaysOfYear",value:function(t,e,n){var l=this.daysCntOfYear[e]+n;return e>1&&this.isLeapYear()&&l++,l}},{key:"determineDaysOfMonths",value:function(t,e){var n=30;switch(t=y.monthMod(t),!0){case this.months30.indexOf(t)>-1:2===t&&(n=this.isLeapYear(e)?29:28);break;case this.months31.indexOf(t)>-1:default:n=31}return n}}]),t}(),H=function(t){u(n,F);var e=f(n);function n(){return i(this,n),e.apply(this,arguments)}return o(n,[{key:"draw",value:function(t,e){var n=this.w,l=new w(this.ctx);this.rangeBarOptions=this.w.config.plotOptions.rangeBar,this.series=t,this.seriesRangeStart=n.globals.seriesRangeStart,this.seriesRangeEnd=n.globals.seriesRangeEnd,this.barHelpers.initVariables(t);for(var a=l.group({class:"apexcharts-rangebar-series apexcharts-plot-series"}),i=0;i0&&(this.visibleI=this.visibleI+1);var g=0,m=0;this.yRatio.length>1&&(this.yaxisIndex=p);var v=this.barHelpers.initialPositions();u=v.y,s=v.zeroW,c=v.x,m=v.barWidth,r=v.xDivision,o=v.zeroH;for(var b=l.group({class:"apexcharts-datalabels","data:realIndex":p}),x=0;x0}));return l=a+i*this.visibleI+r*h,p>-1&&!s.config.plotOptions.bar.rangeBarOverlap&&(c=s.globals.seriesRangeBarTimeline[e][p].overlaps).indexOf(d)>-1&&(l=(i=o.barHeight/c.length)*this.visibleI+r*(100-parseInt(this.barOptions.barHeight,10))/100/2+i*(this.visibleI+c.indexOf(d))+r*h),{barYPosition:l,barHeight:i}}},{key:"drawRangeColumnPaths",value:function(t){var e=t.indexes,n=t.x,l=(t.strokeWidth,t.xDivision),a=t.barWidth,i=t.zeroH,r=this.w,o=e.i,s=e.j,c=this.yRatio[this.yaxisIndex],d=e.realIndex,u=this.getRangeValue(d,s),h=Math.min(u.start,u.end),p=Math.max(u.start,u.end);r.globals.isXNumeric&&(n=(r.globals.seriesX[o][s]-r.globals.minX)/this.xRatio-a/2);var f=n+a*this.visibleI;void 0===this.series[o][s]||null===this.series[o][s]?h=i:(h=i-h/c,p=i-p/c);var g=Math.abs(p-h),m=this.barHelpers.getColumnPaths({barXPosition:f,barWidth:a,y1:h,y2:p,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:d,j:s,w:r});return r.globals.isXNumeric||(n+=l),{pathTo:m.pathTo,pathFrom:m.pathFrom,barHeight:g,x:n,y:p,barXPosition:f}}},{key:"drawRangeBarPaths",value:function(t){var e=t.indexes,n=t.y,l=t.y1,a=t.y2,i=t.yDivision,r=t.barHeight,o=t.barYPosition,s=t.zeroW,c=this.w,d=s+l/this.invertedYRatio,u=s+a/this.invertedYRatio,h=Math.abs(u-d),p=this.barHelpers.getBarpaths({barYPosition:o,barHeight:r,x1:d,x2:u,strokeWidth:this.strokeWidth,series:this.seriesRangeEnd,i:e.realIndex,j:e.j,w:c});return c.globals.isXNumeric||(n+=i),{pathTo:p.pathTo,pathFrom:p.pathFrom,barWidth:h,x:u,y:n}}},{key:"getRangeValue",value:function(t,e){var n=this.w;return{start:n.globals.seriesRangeStart[t][e],end:n.globals.seriesRangeEnd[t][e]}}},{key:"getTooltipValues",value:function(t){var e=t.ctx,n=t.seriesIndex,l=t.dataPointIndex,a=t.y1,i=t.y2,r=t.w,o=r.globals.seriesRangeStart[n][l],s=r.globals.seriesRangeEnd[n][l],c=r.globals.labels[l],d=r.config.series[n].name,u=r.config.tooltip.y.formatter,h=r.config.tooltip.y.title.formatter,p={w:r,seriesIndex:n,dataPointIndex:l};"function"==typeof h&&(d=h(d,p)),a&&i&&(o=a,s=i,r.config.series[n].data[l].x&&(c=r.config.series[n].data[l].x+":"),"function"==typeof u&&(c=u(c,p)));var f="",g="",m=r.globals.colors[n];if(void 0===r.config.tooltip.x.formatter)if("datetime"===r.config.xaxis.type){var v=new B(e);f=v.formatDate(v.getDate(o),r.config.tooltip.x.format),g=v.formatDate(v.getDate(s),r.config.tooltip.x.format)}else f=o,g=s;else f=r.config.tooltip.x.formatter(o),g=r.config.tooltip.x.formatter(s);return{start:o,end:s,startVal:f,endVal:g,ylabel:c,color:m,seriesName:d}}},{key:"buildCustomTooltipHTML",value:function(t){return'
'+(t.seriesName||"")+'
'+t.ylabel+' '+t.start+' - '+t.end+"
"}}]),n}(),q=function(){function t(e){i(this,t),this.opts=e}return o(t,[{key:"line",value:function(){return{chart:{animations:{easing:"swing"}},dataLabels:{enabled:!1},stroke:{width:5,curve:"straight"},markers:{size:0,hover:{sizeOffset:6}},xaxis:{crosshairs:{width:1}}}}},{key:"sparkline",value:function(t){return this.opts.yaxis[0].show=!1,this.opts.yaxis[0].title.text="",this.opts.yaxis[0].axisBorder.show=!1,this.opts.yaxis[0].axisTicks.show=!1,this.opts.yaxis[0].floating=!0,y.extend(t,{grid:{show:!1,padding:{left:0,right:0,top:0,bottom:0}},legend:{show:!1},xaxis:{labels:{show:!1},tooltip:{enabled:!1},axisBorder:{show:!1},axisTicks:{show:!1}},chart:{toolbar:{show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1}})}},{key:"bar",value:function(){return{chart:{stacked:!1,animations:{easing:"swing"}},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{style:{colors:["#fff"]},background:{enabled:!1}},stroke:{width:0,lineCap:"square"},fill:{opacity:.85},legend:{markers:{shape:"square",radius:2,size:8}},tooltip:{shared:!1},xaxis:{tooltip:{enabled:!1},tickPlacement:"between",crosshairs:{width:"barWidth",position:"back",fill:{type:"gradient"},dropShadow:{enabled:!1},stroke:{width:0}}}}}},{key:"candlestick",value:function(){return{stroke:{width:1,colors:["#333"]},fill:{opacity:1},dataLabels:{enabled:!1},tooltip:{shared:!0,custom:function(t){var e=t.seriesIndex,n=t.dataPointIndex,l=t.w;return'
Open: '+l.globals.seriesCandleO[e][n]+'
High: '+l.globals.seriesCandleH[e][n]+'
Low: '+l.globals.seriesCandleL[e][n]+'
Close: '+l.globals.seriesCandleC[e][n]+"
"}},states:{active:{filter:{type:"none"}}},xaxis:{crosshairs:{width:1}}}}},{key:"rangeBar",value:function(){return{stroke:{width:0,lineCap:"square"},plotOptions:{bar:{dataLabels:{position:"center"}}},dataLabels:{enabled:!1,formatter:function(t,e){e.ctx;var n=e.seriesIndex,l=e.dataPointIndex,a=e.w,i=a.globals.seriesRangeStart[n][l];return a.globals.seriesRangeEnd[n][l]-i},background:{enabled:!1},style:{colors:["#fff"]}},tooltip:{shared:!1,followCursor:!0,custom:function(t){return t.w.config.plotOptions&&t.w.config.plotOptions.bar&&t.w.config.plotOptions.bar.horizontal?function(t){var e=new H(t.ctx,null),n=e.getTooltipValues(t),l=n.color,a=n.seriesName,i=n.ylabel,r=n.startVal,o=n.endVal;return e.buildCustomTooltipHTML({color:l,seriesName:a,ylabel:i,start:r,end:o})}(t):function(t){var e=new H(t.ctx,null),n=e.getTooltipValues(t),l=n.color,a=n.seriesName,i=n.ylabel,r=n.start,o=n.end;return e.buildCustomTooltipHTML({color:l,seriesName:a,ylabel:i,start:r,end:o})}(t)}},xaxis:{tickPlacement:"between",tooltip:{enabled:!1},crosshairs:{stroke:{width:0}}}}}},{key:"area",value:function(){return{stroke:{width:4},fill:{type:"gradient",gradient:{inverseColors:!1,shade:"light",type:"vertical",opacityFrom:.65,opacityTo:.5,stops:[0,100,100]}},markers:{size:0,hover:{sizeOffset:6}},tooltip:{followCursor:!1}}}},{key:"brush",value:function(t){return y.extend(t,{chart:{toolbar:{autoSelected:"selection",show:!1},zoom:{enabled:!1}},dataLabels:{enabled:!1},stroke:{width:1},tooltip:{enabled:!1},xaxis:{tooltip:{enabled:!1}}})}},{key:"stacked100",value:function(t){t.dataLabels=t.dataLabels||{},t.dataLabels.formatter=t.dataLabels.formatter||void 0;var e=t.dataLabels.formatter;return t.yaxis.forEach((function(e,n){t.yaxis[n].min=0,t.yaxis[n].max=100})),"bar"===t.chart.type&&(t.dataLabels.formatter=e||function(t){return"number"==typeof t&&t?t.toFixed(0)+"%":t}),t}},{key:"convertCatToNumeric",value:function(t){return t.xaxis.convertedCatToNumeric=!0,t}},{key:"convertCatToNumericXaxis",value:function(t,e,n){t.xaxis.type="numeric",t.xaxis.labels=t.xaxis.labels||{},t.xaxis.labels.formatter=t.xaxis.labels.formatter||function(t){return y.isNumber(t)?Math.floor(t):t};var l=t.xaxis.labels.formatter,a=t.xaxis.categories&&t.xaxis.categories.length?t.xaxis.categories:t.labels;return n&&n.length&&(a=n.map((function(t){return t.toString()}))),a&&a.length&&(t.xaxis.labels.formatter=function(t){return y.isNumber(t)?l(a[Math.floor(t)-1]):l(t)}),t.xaxis.categories=[],t.labels=[],t.xaxis.tickAmount=t.xaxis.tickAmount||"dataPoints",t}},{key:"bubble",value:function(){return{dataLabels:{style:{colors:["#fff"]}},tooltip:{shared:!1,intersect:!0},xaxis:{crosshairs:{width:0}},fill:{type:"solid",gradient:{shade:"light",inverse:!0,shadeIntensity:.55,opacityFrom:.4,opacityTo:.8}}}}},{key:"scatter",value:function(){return{dataLabels:{enabled:!1},tooltip:{shared:!1,intersect:!0},markers:{size:6,strokeWidth:1,hover:{sizeOffset:2}}}}},{key:"heatmap",value:function(){return{chart:{stacked:!1},fill:{opacity:1},dataLabels:{style:{colors:["#fff"]}},stroke:{colors:["#fff"]},tooltip:{followCursor:!0,marker:{show:!1},x:{show:!1}},legend:{position:"top",markers:{shape:"square",size:10,offsetY:2}},grid:{padding:{right:20}}}}},{key:"pie",value:function(){return{chart:{toolbar:{show:!1}},plotOptions:{pie:{donut:{labels:{show:!1}}}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",stops:[0,100]}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"}}}},{key:"donut",value:function(){return{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},style:{colors:["#fff"]},background:{enabled:!1},dropShadow:{enabled:!0}},stroke:{colors:["#fff"]},fill:{opacity:1,gradient:{shade:"light",shadeIntensity:.35,stops:[80,100],opacityFrom:1,opacityTo:1}},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"}}}},{key:"polarArea",value:function(){return this.opts.yaxis[0].tickAmount=this.opts.yaxis[0].tickAmount?this.opts.yaxis[0].tickAmount:6,{chart:{toolbar:{show:!1}},dataLabels:{formatter:function(t){return t.toFixed(1)+"%"},enabled:!1},stroke:{show:!0,width:2},fill:{opacity:.7},tooltip:{theme:"dark",fillSeriesColor:!0},legend:{position:"right"}}}},{key:"radar",value:function(){return this.opts.yaxis[0].labels.offsetY=this.opts.yaxis[0].labels.offsetY?this.opts.yaxis[0].labels.offsetY:6,{dataLabels:{enabled:!1,style:{fontSize:"11px"}},stroke:{width:2},markers:{size:3,strokeWidth:1,strokeOpacity:1},fill:{opacity:.2},tooltip:{shared:!1,intersect:!0,followCursor:!0},grid:{show:!1},xaxis:{labels:{formatter:function(t){return t},style:{colors:["#a8a8a8"],fontSize:"11px"}},tooltip:{enabled:!1},crosshairs:{show:!1}}}}},{key:"radialBar",value:function(){return{chart:{animations:{dynamicAnimation:{enabled:!0,speed:800}},toolbar:{show:!1}},fill:{gradient:{shade:"dark",shadeIntensity:.4,inverseColors:!1,type:"diagonal2",opacityFrom:1,opacityTo:1,stops:[70,98,100]}},legend:{show:!1,position:"right"},tooltip:{enabled:!1,fillSeriesColor:!0}}}}]),t}(),z=function(){function t(e){i(this,t),this.opts=e}return o(t,[{key:"init",value:function(t){var e=t.responsiveOverride,n=this.opts,l=new M,i=new q(n);this.chartType=n.chart.type,"histogram"===this.chartType&&(n.chart.type="bar",n=y.extend({plotOptions:{bar:{columnWidth:"99.99%"}}},n)),n=this.extendYAxis(n),n=this.extendAnnotations(n);var r=l.init(),o={};if(n&&"object"===a(n)){var s={};s=-1!==["line","area","bar","candlestick","rangeBar","histogram","bubble","scatter","heatmap","pie","polarArea","donut","radar","radialBar"].indexOf(n.chart.type)?i[n.chart.type]():i.line(),n.chart.brush&&n.chart.brush.enabled&&(s=i.brush(s)),n.chart.stacked&&"100%"===n.chart.stackType&&(n=i.stacked100(n)),this.checkForDarkTheme(window.Apex),this.checkForDarkTheme(n),n.xaxis=n.xaxis||window.Apex.xaxis||{},e||(n.xaxis.convertedCatToNumeric=!1),((n=this.checkForCatToNumericXAxis(this.chartType,s,n)).chart.sparkline&&n.chart.sparkline.enabled||window.Apex.chart&&window.Apex.chart.sparkline&&window.Apex.chart.sparkline.enabled)&&(s=i.sparkline(s)),o=y.extend(r,s)}var c=y.extend(o,window.Apex);return r=y.extend(c,n),this.handleUserInputErrors(r)}},{key:"checkForCatToNumericXAxis",value:function(t,e,n){var l=new q(n),a="bar"===t&&n.plotOptions&&n.plotOptions.bar&&n.plotOptions.bar.horizontal,i="pie"===t||"polarArea"===t||"donut"===t||"radar"===t||"radialBar"===t||"heatmap"===t,r="datetime"!==n.xaxis.type&&"numeric"!==n.xaxis.type,o=n.xaxis.tickPlacement?n.xaxis.tickPlacement:e.xaxis&&e.xaxis.tickPlacement;return a||i||!r||"between"===o||(n=l.convertCatToNumeric(n)),n}},{key:"extendYAxis",value:function(t,e){var n=new M;(void 0===t.yaxis||!t.yaxis||Array.isArray(t.yaxis)&&0===t.yaxis.length)&&(t.yaxis={}),t.yaxis.constructor!==Array&&window.Apex.yaxis&&window.Apex.yaxis.constructor!==Array&&(t.yaxis=y.extend(t.yaxis,window.Apex.yaxis)),t.yaxis.constructor!==Array?t.yaxis=[y.extend(n.yAxis,t.yaxis)]:t.yaxis=y.extendArray(t.yaxis,n.yAxis);var l=!1;t.yaxis.forEach((function(t){t.logarithmic&&(l=!0)}));var a=t.series;return e&&!a&&(a=e.config.series),l&&a.length!==t.yaxis.length&&a.length&&(t.yaxis=a.map((function(e,l){if(e.name||(a[l].name="series-".concat(l+1)),t.yaxis[l])return t.yaxis[l].seriesName=a[l].name,t.yaxis[l];var i=y.extend(n.yAxis,t.yaxis[0]);return i.show=!1,i}))),l&&a.length>1&&a.length!==t.yaxis.length&&console.warn("A multi-series logarithmic chart should have equal number of series and y-axes. Please make sure to equalize both."),t}},{key:"extendAnnotations",value:function(t){return void 0===t.annotations&&(t.annotations={},t.annotations.yaxis=[],t.annotations.xaxis=[],t.annotations.points=[]),t=this.extendYAxisAnnotations(t),t=this.extendXAxisAnnotations(t),this.extendPointAnnotations(t)}},{key:"extendYAxisAnnotations",value:function(t){var e=new M;return t.annotations.yaxis=y.extendArray(void 0!==t.annotations.yaxis?t.annotations.yaxis:[],e.yAxisAnnotation),t}},{key:"extendXAxisAnnotations",value:function(t){var e=new M;return t.annotations.xaxis=y.extendArray(void 0!==t.annotations.xaxis?t.annotations.xaxis:[],e.xAxisAnnotation),t}},{key:"extendPointAnnotations",value:function(t){var e=new M;return t.annotations.points=y.extendArray(void 0!==t.annotations.points?t.annotations.points:[],e.pointAnnotation),t}},{key:"checkForDarkTheme",value:function(t){t.theme&&"dark"===t.theme.mode&&(t.tooltip||(t.tooltip={}),"light"!==t.tooltip.theme&&(t.tooltip.theme="dark"),t.chart.foreColor||(t.chart.foreColor="#f6f7f8"),t.chart.background||(t.chart.background="#424242"),t.theme.palette||(t.theme.palette="palette4"))}},{key:"handleUserInputErrors",value:function(t){var e=t;if(e.tooltip.shared&&e.tooltip.intersect)throw new Error("tooltip.shared cannot be enabled when tooltip.intersect is true. Turn off any other option by setting it to false.");if(("bar"===e.chart.type||"rangeBar"===e.chart.type)&&e.plotOptions.bar.horizontal){if(e.yaxis.length>1)throw new Error("Multiple Y Axis for bars are not supported. Switch to column chart by setting plotOptions.bar.horizontal=false");e.yaxis[0].reversed&&(e.yaxis[0].opposite=!0),e.xaxis.tooltip.enabled=!1,e.yaxis[0].tooltip.enabled=!1,e.chart.zoom.enabled=!1}return"bar"!==e.chart.type&&"rangeBar"!==e.chart.type||e.tooltip.shared&&("barWidth"===e.xaxis.crosshairs.width&&e.series.length>1&&(console.warn('crosshairs.width = "barWidth" is only supported in single series, not in a multi-series barChart.'),e.xaxis.crosshairs.width="tickWidth"),e.plotOptions.bar.horizontal&&(e.states.hover.type="none",e.tooltip.shared=!1),e.tooltip.followCursor||(console.warn("followCursor option in shared columns cannot be turned off. Please set %ctooltip.followCursor: true","color: blue;"),e.tooltip.followCursor=!0)),"candlestick"===e.chart.type&&e.yaxis[0].reversed&&(console.warn("Reversed y-axis in candlestick chart is not supported."),e.yaxis[0].reversed=!1),e.chart.group&&0===e.yaxis[0].labels.minWidth&&console.warn("It looks like you have multiple charts in synchronization. You must provide yaxis.labels.minWidth which must be EQUAL for all grouped charts to prevent incorrect behaviour."),Array.isArray(e.stroke.width)&&"line"!==e.chart.type&&"area"!==e.chart.type&&(console.warn("stroke.width option accepts array only for line and area charts. Reverted back to Number"),e.stroke.width=e.stroke.width[0]),e}}]),t}(),Z=function(){function t(){i(this,t)}return o(t,[{key:"initGlobalVars",value:function(t){t.series=[],t.seriesCandleO=[],t.seriesCandleH=[],t.seriesCandleL=[],t.seriesCandleC=[],t.seriesRangeStart=[],t.seriesRangeEnd=[],t.seriesRangeBarTimeline=[],t.seriesPercent=[],t.seriesX=[],t.seriesZ=[],t.seriesNames=[],t.seriesTotals=[],t.seriesLog=[],t.seriesColors=[],t.stackedSeriesTotals=[],t.seriesXvalues=[],t.seriesYvalues=[],t.labels=[],t.categoryLabels=[],t.timescaleLabels=[],t.noLabelsProvided=!1,t.resizeTimer=null,t.selectionResizeTimer=null,t.delayedElements=[],t.pointsArray=[],t.dataLabelsRects=[],t.isXNumeric=!1,t.xaxisLabelsCount=0,t.skipLastTimelinelabel=!1,t.skipFirstTimelinelabel=!1,t.isDataXYZ=!1,t.isMultiLineX=!1,t.isMultipleYAxis=!1,t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE,t.minYArr=[],t.maxYArr=[],t.maxX=-Number.MAX_VALUE,t.minX=Number.MAX_VALUE,t.initialMaxX=-Number.MAX_VALUE,t.initialMinX=Number.MAX_VALUE,t.maxDate=0,t.minDate=Number.MAX_VALUE,t.minZ=Number.MAX_VALUE,t.maxZ=-Number.MAX_VALUE,t.minXDiff=Number.MAX_VALUE,t.yAxisScale=[],t.xAxisScale=null,t.xAxisTicksPositions=[],t.yLabelsCoords=[],t.yTitleCoords=[],t.barPadForNumericAxis=0,t.padHorizontal=0,t.xRange=0,t.yRange=[],t.zRange=0,t.dataPoints=0,t.xTickAmount=0}},{key:"globalVars",value:function(t){return{chartID:null,cuid:null,events:{beforeMount:[],mounted:[],updated:[],clicked:[],selection:[],dataPointSelection:[],zoomed:[],scrolled:[]},colors:[],clientX:null,clientY:null,fill:{colors:[]},stroke:{colors:[]},dataLabels:{style:{colors:[]}},radarPolygons:{fill:{colors:[]}},markers:{colors:[],size:t.markers.size,largestSize:0},animationEnded:!1,isTouchDevice:"ontouchstart"in window||navigator.msMaxTouchPoints,isDirty:!1,isExecCalled:!1,initialConfig:null,initialSeries:[],lastXAxis:[],lastYAxis:[],columnSeries:null,labels:[],timescaleLabels:[],noLabelsProvided:!1,allSeriesCollapsed:!1,collapsedSeries:[],collapsedSeriesIndices:[],ancillaryCollapsedSeries:[],ancillaryCollapsedSeriesIndices:[],risingSeries:[],dataFormatXNumeric:!1,capturedSeriesIndex:-1,capturedDataPointIndex:-1,selectedDataPoints:[],goldenPadding:35,invalidLogScale:!1,ignoreYAxisIndexes:[],yAxisSameScaleIndices:[],maxValsInArrayIndex:0,radialSize:0,selection:void 0,zoomEnabled:"zoom"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.zoom&&t.chart.zoom.enabled,panEnabled:"pan"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.pan,selectionEnabled:"selection"===t.chart.toolbar.autoSelected&&t.chart.toolbar.tools.selection,yaxis:null,mousedown:!1,lastClientPosition:{},visibleXRange:void 0,yValueDecimal:0,total:0,SVGNS:"http://www.w3.org/2000/svg",svgWidth:0,svgHeight:0,noData:!1,locale:{},dom:{},memory:{methodsToExec:[]},shouldAnimate:!0,skipLastTimelinelabel:!1,skipFirstTimelinelabel:!1,delayedElements:[],axisCharts:!0,isDataXYZ:!1,resized:!1,resizeTimer:null,comboCharts:!1,dataChanged:!1,previousPaths:[],allSeriesHasEqualX:!0,pointsArray:[],dataLabelsRects:[],lastDrawnDataLabelsIndexes:[],hasNullValues:!1,easing:null,zoomed:!1,gridWidth:0,gridHeight:0,rotateXLabels:!1,defaultLabels:!1,xLabelFormatter:void 0,yLabelFormatters:[],xaxisTooltipFormatter:void 0,ttKeyFormatter:void 0,ttVal:void 0,ttZFormatter:void 0,LINE_HEIGHT_RATIO:1.618,xAxisLabelsHeight:0,xAxisLabelsWidth:0,yAxisLabelsWidth:0,scaleX:1,scaleY:1,translateX:0,translateY:0,translateYAxisX:[],yAxisWidths:[],translateXAxisY:0,translateXAxisX:0,tooltip:null}}},{key:"init",value:function(t){var e=this.globalVars(t);return this.initGlobalVars(e),e.initialConfig=y.extend({},t),e.initialSeries=y.clone(t.series),e.lastXAxis=y.clone(e.initialConfig.xaxis),e.lastYAxis=y.clone(e.initialConfig.yaxis),e}}]),t}(),$=function(){function t(e){i(this,t),this.opts=e}return o(t,[{key:"init",value:function(){var t=new z(this.opts).init({responsiveOverride:!1});return{config:t,globals:(new Z).init(t)}}}]),t}(),W=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.twoDSeries=[],this.threeDSeries=[],this.twoDSeriesX=[],this.coreUtils=new k(this.ctx)}return o(t,[{key:"isMultiFormat",value:function(){return this.isFormatXY()||this.isFormat2DArray()}},{key:"isFormatXY",value:function(){var t=this.w.config.series.slice(),e=new N(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&null!==t[this.activeSeriesIndex].data[0]&&void 0!==t[this.activeSeriesIndex].data[0].x&&null!==t[this.activeSeriesIndex].data[0])return!0}},{key:"isFormat2DArray",value:function(){var t=this.w.config.series.slice(),e=new N(this.ctx);if(this.activeSeriesIndex=e.getActiveConfigSeriesIndex(),void 0!==t[this.activeSeriesIndex].data&&t[this.activeSeriesIndex].data.length>0&&void 0!==t[this.activeSeriesIndex].data[0]&&null!==t[this.activeSeriesIndex].data[0]&&t[this.activeSeriesIndex].data[0].constructor===Array)return!0}},{key:"handleFormat2DArray",value:function(t,e){var n=this.w.config,l=this.w.globals;n.xaxis.sorted&&("datetime"===n.xaxis.type?t[e].data.sort((function(t,e){return new Date(t[0]).getTime()-new Date(e[0]).getTime()})):"numeric"===n.xaxis.type&&t[e].data.sort((function(t,e){return t[0]-e[0]})));for(var a=0;a-1&&(i=this.activeSeriesIndex),n.xaxis.sorted&&("datetime"===n.xaxis.type?t[e].data.sort((function(t,e){return new Date(t.x).getTime()-new Date(e.x).getTime()})):"numeric"===n.xaxis.type&&t[e].data.sort((function(t,e){return t.x-e.x})));for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:this.ctx,l=this.w.config,a=this.w.globals,i=new B(n),r=l.labels.length>0?l.labels.slice():l.xaxis.categories.slice(),o=function(){for(var t=0;t0&&(this.twoDSeriesX=r,a.seriesX.push(this.twoDSeriesX))),a.labels.push(this.twoDSeriesX);var c=t[s].data.map((function(t){return y.parseNumber(t)}));a.series.push(c)}a.seriesZ.push(this.threeDSeries),void 0!==t[s].name?a.seriesNames.push(t[s].name):a.seriesNames.push("series-"+parseInt(s+1,10)),void 0!==t[s].color?a.seriesColors.push(t[s].color):a.seriesColors.push(void 0)}return this.w}},{key:"parseDataNonAxisCharts",value:function(t){var e=this.w.globals,n=this.w.config;e.series=t.slice(),e.seriesNames=n.labels.slice();for(var l=0;l0?n.labels=e.xaxis.categories:e.labels.length>0?n.labels=e.labels.slice():this.fallbackToCategory?(n.labels=n.labels[0],n.seriesRangeBarTimeline.length&&(n.seriesRangeBarTimeline.map((function(t){t.forEach((function(t){n.labels.indexOf(t.x)<0&&t.x&&n.labels.push(t.x)}))})),n.labels=n.labels.filter((function(t,e,n){return n.indexOf(t)===e}))),e.xaxis.convertedCatToNumeric&&(new q(e).convertCatToNumericXaxis(e,this.ctx,n.seriesX[0]),this._generateExternalLabels(t))):this._generateExternalLabels(t)}},{key:"_generateExternalLabels",value:function(t){var e=this.w.globals,n=this.w.config,l=[];if(e.axisCharts){if(e.series.length>0)for(var a=0;ae.length?t:e}),0);t.globals.yAxisScale[0].niceMax=e,t.globals.yAxisScale[0].niceMin=e}}}]),t}(),Y=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"getLabel",value:function(t,e,n,l){var a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"12px",r=this.w,o=void 0===t[l]?"":t[l],s=o,c=r.globals.xLabelFormatter,d=r.config.xaxis.labels.formatter,u=!1,h=new V(this.ctx),p=o;s=h.xLabelFormat(c,o,p),void 0!==d&&(s=d(o,t[l],l));var f=function(t){var n=null;return e.forEach((function(t){"month"===t.unit?n="year":"day"===t.unit?n="month":"hour"===t.unit?n="day":"minute"===t.unit&&(n="hour")})),n===t};e.length>0?(u=f(e[l].unit),n=e[l].position,s=e[l].value):"datetime"===r.config.xaxis.type&&void 0===d&&(s=""),void 0===s&&(s=""),s=Array.isArray(s)?s:s.toString();var g=new w(this.ctx),m={};return m=r.globals.rotateXLabels?g.getTextRects(s,parseInt(i,10),null,"rotate(".concat(r.config.xaxis.labels.rotate," 0 0)"),!1):g.getTextRects(s,parseInt(i,10)),!Array.isArray(s)&&(0===s.indexOf("NaN")||0===s.toLowerCase().indexOf("invalid")||s.toLowerCase().indexOf("infinity")>=0||a.indexOf(s)>=0&&!r.config.xaxis.labels.showDuplicates&&"hours"!==this.ctx.timeScale.tickInterval&&"minutes"!==this.ctx.timeScale.tickInterval)&&(s=""),{x:n,text:s,textRect:m,isBold:u}}},{key:"checkForOverflowingLabels",value:function(t,e,n,l,a){var i=this.w;if(0===t&&i.globals.skipFirstTimelinelabel&&(e.text=""),t===n-1&&i.globals.skipLastTimelinelabel&&(e.text=""),i.config.xaxis.labels.hideOverlappingLabels&&l.length>0){var r=a[a.length-1];e.x0){!0===o.config.yaxis[a].opposite&&(t+=l.width);for(var d=e;d>=0;d--){var u=c+e/10+o.config.yaxis[a].labels.offsetY-1;o.globals.isBarHorizontal&&(u=i*d),"heatmap"===o.config.chart.type&&(u+=i/2);var h=s.drawLine(t+n.offsetX-l.width+l.offsetX,u+l.offsetY,t+n.offsetX+l.offsetX,u+l.offsetY,l.color);r.add(h),c+=i}}}}]),t}(),U=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"fixSvgStringForIe11",value:function(t){if(!y.isIE11())return t;var e=0,n=t.replace(/xmlns="http:\/\/www.w3.org\/2000\/svg"/g,(function(t){return 2==++e?'xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.com/svgjs"':t}));return(n=n.replace(/xmlns:NS\d+=""/g,"")).replace(/NS\d+:(\w+:\w+=")/g,"$1")}},{key:"getSvgString",value:function(){var t=this.w.globals.dom.Paper.svg();return this.fixSvgStringForIe11(t)}},{key:"cleanup",value:function(){var t=this.w,e=t.globals.dom.baseEl.getElementsByClassName("apexcharts-xcrosshairs"),n=t.globals.dom.baseEl.getElementsByClassName("apexcharts-ycrosshairs"),l=t.globals.dom.baseEl.querySelectorAll(".apexcharts-zoom-rect, .apexcharts-selection-rect");Array.prototype.forEach.call(l,(function(t){t.setAttribute("width",0)})),e&&e[0]&&(e[0].setAttribute("x",-500),e[0].setAttribute("x1",-500),e[0].setAttribute("x2",-500)),n&&n[0]&&(n[0].setAttribute("y",-100),n[0].setAttribute("y1",-100),n[0].setAttribute("y2",-100))}},{key:"svgUrl",value:function(){this.cleanup();var t=this.getSvgString(),e=new Blob([t],{type:"image/svg+xml;charset=utf-8"});return URL.createObjectURL(e)}},{key:"dataURI",value:function(){var t=this;return new Promise((function(e){var n=t.w;t.cleanup();var l=document.createElement("canvas");l.width=n.globals.svgWidth,l.height=parseInt(n.globals.dom.elWrap.style.height,10);var a="transparent"===n.config.chart.background?"#fff":n.config.chart.background,i=l.getContext("2d");i.fillStyle=a,i.fillRect(0,0,l.width,l.height);var r=t.getSvgString();if(window.canvg&&y.isIE11()){var o=window.canvg.Canvg.fromString(i,r,{ignoreClear:!0,ignoreDimensions:!0});o.start();var s=l.msToBlob();o.stop(),e({blob:s})}else{var c="data:image/svg+xml,"+encodeURIComponent(r),d=new Image;d.crossOrigin="anonymous",d.onload=function(){if(i.drawImage(d,0,0),l.msToBlob){var t=l.msToBlob();e({blob:t})}else{var n=l.toDataURL("image/png");e({imgURI:n})}},d.src=c}}))}},{key:"exportToSVG",value:function(){this.triggerDownload(this.svgUrl(),null,".svg")}},{key:"exportToPng",value:function(){var t=this;this.dataURI().then((function(e){var n=e.imgURI,l=e.blob;l?navigator.msSaveOrOpenBlob(l,t.w.globals.chartID+".png"):t.triggerDownload(n,null,".png")}))}},{key:"exportToCSV",value:function(t){var e=this,n=t.series,l=t.columnDelimiter,a=t.lineDelimiter,i=void 0===a?"\n":a,r=this.w,o=[],s=[],c="data:text/csv;charset=utf-8,",d=new W(this.ctx),u=new Y(this.ctx),h=function(t){var n="";if(r.globals.axisCharts){if("category"===r.config.xaxis.type||r.config.xaxis.convertedCatToNumeric)if(r.globals.isBarHorizontal){var l=r.globals.yLabelFormatters[0],a=new N(e.ctx).getActiveConfigSeriesIndex();n=l(r.globals.labels[t],{seriesIndex:a,dataPointIndex:t,w:r})}else n=u.getLabel(r.globals.labels,r.globals.timescaleLabels,0,t).text;"datetime"===r.config.xaxis.type&&(r.config.xaxis.categories.length?n=r.config.xaxis.categories[t]:r.config.labels.length&&(n=r.config.labels[t]))}else n=r.config.labels[t];return n};o.push(r.config.chart.toolbar.export.csv.headerCategory),n.map((function(t,e){r.globals.axisCharts&&o.push(t.name?t.name:"series-".concat(e))})),r.globals.axisCharts||(o.push(r.config.chart.toolbar.export.csv.headerValue),s.push(o.join(l))),n.map((function(t,e){r.globals.axisCharts?function(t,e){if(o.length&&0===e&&s.push(o.join(l)),t.data&&t.data.length)for(var a=0;a=10?r.config.chart.toolbar.export.csv.dateFormatter(i):i));for(var c=0;c0&&!n.globals.isBarHorizontal&&(this.xaxisLabels=n.globals.timescaleLabels.slice()),this.drawnLabels=[],this.drawnLabelsRects=[],"top"===n.config.xaxis.position?this.offY=0:this.offY=n.globals.gridHeight+1,this.offY=this.offY+n.config.xaxis.axisBorder.offsetY,this.isCategoryBarHorizontal="bar"===n.config.chart.type&&n.config.plotOptions.bar.horizontal,this.xaxisFontSize=n.config.xaxis.labels.style.fontSize,this.xaxisFontFamily=n.config.xaxis.labels.style.fontFamily,this.xaxisForeColors=n.config.xaxis.labels.style.colors,this.xaxisBorderWidth=n.config.xaxis.axisBorder.width,this.isCategoryBarHorizontal&&(this.xaxisBorderWidth=n.config.yaxis[0].axisBorder.width.toString()),this.xaxisBorderWidth.indexOf("%")>-1?this.xaxisBorderWidth=n.globals.gridWidth*parseInt(this.xaxisBorderWidth,10)/100:this.xaxisBorderWidth=parseInt(this.xaxisBorderWidth,10),this.xaxisBorderHeight=n.config.xaxis.axisBorder.height,this.yaxis=n.config.yaxis[0]}return o(t,[{key:"drawXaxis",value:function(){var t,e=this,n=this.w,l=new w(this.ctx),a=l.group({class:"apexcharts-xaxis",transform:"translate(".concat(n.config.xaxis.offsetX,", ").concat(n.config.xaxis.offsetY,")")}),i=l.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(n.globals.translateXAxisX,", ").concat(n.globals.translateXAxisY,")")});a.add(i);for(var r=n.globals.padHorizontal,o=[],s=0;s1?c-1:c;t=n.globals.gridWidth/d,r=r+t/2+n.config.xaxis.labels.offsetX}else t=n.globals.gridWidth/o.length,r=r+t+n.config.xaxis.labels.offsetX;if(n.config.xaxis.labels.show)for(var u=function(a){var s=r-t/2+n.config.xaxis.labels.offsetX;0===a&&1===c&&t/2===r&&1===n.globals.dataPoints&&(s=n.globals.gridWidth/2);var d=e.axesUtils.getLabel(o,n.globals.timescaleLabels,s,a,e.drawnLabels,e.xaxisFontSize),u=28;n.globals.rotateXLabels&&(u=22),(d=e.axesUtils.checkForOverflowingLabels(a,d,c,e.drawnLabels,e.drawnLabelsRects)).text&&n.globals.xaxisLabelsCount++;var h=l.drawText({x:d.x,y:e.offY+n.config.xaxis.labels.offsetY+u-("top"===n.config.xaxis.position?n.globals.xAxisHeight+n.config.xaxis.axisTicks.height-2:0),text:d.text,textAnchor:"middle",fontWeight:d.isBold?600:n.config.xaxis.labels.style.fontWeight,fontSize:e.xaxisFontSize,fontFamily:e.xaxisFontFamily,foreColor:Array.isArray(e.xaxisForeColors)?n.config.xaxis.convertedCatToNumeric?e.xaxisForeColors[n.globals.minX+a-1]:e.xaxisForeColors[a]:e.xaxisForeColors,isPlainText:!1,cssClass:"apexcharts-xaxis-label "+n.config.xaxis.labels.style.cssClass});i.add(h);var p=document.createElementNS(n.globals.SVGNS,"title");p.textContent=Array.isArray(d.text)?d.text.join(" "):d.text,h.node.appendChild(p),""!==d.text&&(e.drawnLabels.push(d.text),e.drawnLabelsRects.push(d)),r+=t},h=0;h<=c-1;h++)u(h);if(void 0!==n.config.xaxis.title.text){var p=l.group({class:"apexcharts-xaxis-title"}),f=l.drawText({x:n.globals.gridWidth/2+n.config.xaxis.title.offsetX,y:this.offY-parseFloat(this.xaxisFontSize)+n.globals.xAxisLabelsHeight+n.config.xaxis.title.offsetY,text:n.config.xaxis.title.text,textAnchor:"middle",fontSize:n.config.xaxis.title.style.fontSize,fontFamily:n.config.xaxis.title.style.fontFamily,fontWeight:n.config.xaxis.title.style.fontWeight,foreColor:n.config.xaxis.title.style.color,cssClass:"apexcharts-xaxis-title-text "+n.config.xaxis.title.style.cssClass});p.add(f),a.add(p)}if(n.config.xaxis.axisBorder.show){var g=n.globals.barPadForNumericAxis,m=l.drawLine(n.globals.padHorizontal+n.config.xaxis.axisBorder.offsetX-g,this.offY,this.xaxisBorderWidth+g,this.offY,n.config.xaxis.axisBorder.color,0,this.xaxisBorderHeight);a.add(m)}return a}},{key:"drawXaxisInversed",value:function(t){var e,n,l=this.w,a=new w(this.ctx),i=l.config.yaxis[0].opposite?l.globals.translateYAxisX[t]:0,r=a.group({class:"apexcharts-yaxis apexcharts-xaxis-inversed",rel:t}),o=a.group({class:"apexcharts-yaxis-texts-g apexcharts-xaxis-inversed-texts-g",transform:"translate("+i+", 0)"});r.add(o);var s=[];if(l.config.yaxis[t].show)for(var c=0;cn.globals.gridWidth)){var a=this.offY+n.config.xaxis.axisTicks.offsetY,i=a+n.config.xaxis.axisTicks.height;if("top"===n.config.xaxis.position&&(i=a-n.config.xaxis.axisTicks.height),n.config.xaxis.axisTicks.show){var r=new w(this.ctx).drawLine(t+n.config.xaxis.axisTicks.offsetX,a+n.config.xaxis.offsetY,l+n.config.xaxis.axisTicks.offsetX,i+n.config.xaxis.offsetY,n.config.xaxis.axisTicks.color);e.add(r),r.node.classList.add("apexcharts-xaxis-tick")}}}},{key:"getXAxisTicksPositions",value:function(){var t=this.w,e=[],n=this.xaxisLabels.length,l=t.globals.padHorizontal;if(t.globals.timescaleLabels.length>0)for(var a=0;a0){var c=a[a.length-1].getBBox(),d=a[0].getBBox();c.x<-20&&a[a.length-1].parentNode.removeChild(a[a.length-1]),d.x+d.width>t.globals.gridWidth&&!t.globals.isBarHorizontal&&a[0].parentNode.removeChild(a[0]);for(var u=0;u0&&(this.xaxisLabels=n.globals.timescaleLabels.slice())}return o(t,[{key:"drawGridArea",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=this.w,n=new w(this.ctx);null===t&&(t=n.group({class:"apexcharts-grid"}));var l=n.drawLine(e.globals.padHorizontal,1,e.globals.padHorizontal,e.globals.gridHeight,"transparent"),a=n.drawLine(e.globals.padHorizontal,e.globals.gridHeight,e.globals.gridWidth,e.globals.gridHeight,"transparent");return t.add(a),t.add(l),t}},{key:"drawGrid",value:function(){var t=null;return this.w.globals.axisCharts&&(t=this.renderGrid(),this.drawGridArea(t.el)),t}},{key:"createGridMask",value:function(){var t=this.w,e=t.globals,n=new w(this.ctx),l=Array.isArray(t.config.stroke.width)?0:t.config.stroke.width;if(Array.isArray(t.config.stroke.width)){var a=0;t.config.stroke.width.forEach((function(t){a=Math.max(a,t)})),l=a}e.dom.elGridRectMask=document.createElementNS(e.SVGNS,"clipPath"),e.dom.elGridRectMask.setAttribute("id","gridRectMask".concat(e.cuid)),e.dom.elGridRectMarkerMask=document.createElementNS(e.SVGNS,"clipPath"),e.dom.elGridRectMarkerMask.setAttribute("id","gridRectMarkerMask".concat(e.cuid));var i=t.config.chart.type,r=0,o=0;("bar"===i||"rangeBar"===i||t.globals.comboBarCount>0)&&t.globals.isXNumeric&&!t.globals.isBarHorizontal&&(r=t.config.grid.padding.left,o=t.config.grid.padding.right,e.barPadForNumericAxis>r&&(r=e.barPadForNumericAxis,o=e.barPadForNumericAxis)),e.dom.elGridRect=n.drawRect(-l/2-r-2,-l/2,e.gridWidth+l+o+r+4,e.gridHeight+l,0,"#fff"),new k(this).getLargestMarkerSize();var s=t.globals.markers.largestSize+1;e.dom.elGridRectMarker=n.drawRect(2*-s,2*-s,e.gridWidth+4*s,e.gridHeight+4*s,0,"#fff"),e.dom.elGridRectMask.appendChild(e.dom.elGridRect.node),e.dom.elGridRectMarkerMask.appendChild(e.dom.elGridRectMarker.node);var c=e.dom.baseEl.querySelector("defs");c.appendChild(e.dom.elGridRectMask),c.appendChild(e.dom.elGridRectMarkerMask)}},{key:"_drawGridLines",value:function(t){var e=t.i,n=t.x1,l=t.y1,a=t.x2,i=t.y2,r=t.xCount,o=t.parent,s=this.w;0===e&&s.globals.skipFirstTimelinelabel||e===r-1&&s.globals.skipLastTimelinelabel&&!s.config.xaxis.labels.formatter||"radar"===s.config.chart.type||(s.config.grid.xaxis.lines.show&&this._drawGridLine({x1:n,y1:l,x2:a,y2:i,parent:o}),new G(this.ctx).drawXaxisTicks(n,this.elg))}},{key:"_drawGridLine",value:function(t){var e=t.x1,n=t.y1,l=t.x2,a=t.y2,i=t.parent,r=this.w,o=i.node.classList.contains("apexcharts-gridlines-horizontal"),s=r.config.grid.strokeDashArray,c=r.globals.barPadForNumericAxis,d=new w(this).drawLine(e-(o?c:0),n,l+(o?c:0),a,r.config.grid.borderColor,s);d.node.classList.add("apexcharts-gridline"),i.add(d)}},{key:"_drawGridBandRect",value:function(t){var e=t.c,n=t.x1,l=t.y1,a=t.x2,i=t.y2,r=t.type,o=this.w,s=new w(this.ctx),c=o.globals.barPadForNumericAxis;if("column"!==r||"datetime"!==o.config.xaxis.type){var d=o.config.grid[r].colors[e],u=s.drawRect(n-("row"===r?c:0),l,a+("row"===r?2*c:0),i,0,d,o.config.grid[r].opacity);this.elg.add(u),u.attr("clip-path","url(#gridRectMask".concat(o.globals.cuid,")")),u.node.classList.add("apexcharts-grid-".concat(r))}}},{key:"_drawXYLines",value:function(t){var e=this,n=t.xCount,l=t.tickAmount,a=this.w;if(a.config.grid.xaxis.lines.show||a.config.xaxis.axisTicks.show){var i=a.globals.padHorizontal,r=a.globals.gridHeight;a.globals.timescaleLabels.length?function(t){for(var l=t.xC,a=t.x1,i=t.y1,r=t.x2,o=t.y2,s=0;s2));a++);return!t.globals.isBarHorizontal||this.isTimelineBar?(n=this.xaxisLabels.length,this.isTimelineBar&&(l=t.globals.labels.length,t.config.xaxis.tickAmount&&t.config.xaxis.labels.formatter&&(n=t.config.xaxis.tickAmount)),this._drawXYLines({xCount:n,tickAmount:l})):(n=l,l=t.globals.xTickAmount,this._drawInvertedXYLines({xCount:n,tickAmount:l})),this.drawGridBands(n,l),{el:this.elg,xAxisTickWidth:t.globals.gridWidth/n}}},{key:"drawGridBands",value:function(t,e){var n=this.w;if(void 0!==n.config.grid.row.colors&&n.config.grid.row.colors.length>0)for(var l=0,a=n.globals.gridHeight/e,i=n.globals.gridWidth,r=0,o=0;r=n.config.grid.row.colors.length&&(o=0),this._drawGridBandRect({c:o,x1:0,y1:l,x2:i,y2:a,type:"row"}),l+=n.globals.gridHeight/e;if(void 0!==n.config.grid.column.colors&&n.config.grid.column.colors.length>0)for(var s=n.globals.isBarHorizontal||"category"!==n.config.xaxis.type&&!n.config.xaxis.convertedCatToNumeric?t:t-1,c=n.globals.padHorizontal,d=n.globals.padHorizontal+n.globals.gridWidth/s,u=n.globals.gridHeight,h=0,p=0;h=n.config.grid.column.colors.length&&(p=0),this._drawGridBandRect({c:p,x1:c,y1:0,x2:d,y2:u,type:"column"}),c+=n.globals.gridWidth/s}}]),t}(),K=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"niceScale",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4?arguments[4]:void 0,i=this.w;if("dataPoints"===n&&(n=i.globals.dataPoints-1),t===Number.MIN_VALUE&&0===e||!y.isNumber(t)&&!y.isNumber(e)||t===Number.MIN_VALUE&&e===-Number.MAX_VALUE){t=0,e=n;var r=this.linearScale(t,e,n);return r}t>e?(console.warn("axis.min cannot be greater than axis.max"),e=t+.1):t===e&&(t=0===t?0:t-.5,e=0===e?2:e+.5);var o=[],s=Math.abs(e-t);s<1&&a&&("candlestick"===i.config.chart.type||"candlestick"===i.config.series[l].type||i.globals.isRangeData)&&(e*=1.01);var c=n+1;c<2?c=2:c>2&&(c-=2);var d=s/c,u=Math.floor(y.log10(d)),h=Math.pow(10,u),p=Math.round(d/h);p<1&&(p=1);var f=p*h,g=f*Math.floor(t/f),m=f*Math.ceil(e/f),v=g;if(a&&s>2){for(;o.push(v),!((v+=f)>m););return{result:o,niceMin:o[0],niceMax:o[o.length-1]}}var b=t;(o=[]).push(b);for(var x=Math.abs(e-t)/n,_=0;_<=n;_++)b+=x,o.push(b);return o[o.length-2]>=e&&o.pop(),{result:o,niceMin:o[0],niceMax:o[o.length-1]}}},{key:"linearScale",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,l=Math.abs(e-t),a=l/n;n===Number.MAX_VALUE&&(n=10,a=1);for(var i=[],r=t;n>=0;)i.push(r),r+=a,n-=1;return{result:i,niceMin:i[0],niceMax:i[i.length-1]}}},{key:"logarithmicScale",value:function(t,e,n,l){(e<=0||e===Number.MIN_VALUE)&&(e=.01);for(var a=Math.log(e)/Math.log(10),i=Math.log(n)/Math.log(10),r=Math.abs(n-e)/l,o=[],s=e;l>=0;)o.push(s),s+=r,l-=1;var c=o.map((function(t,l){t<=0&&(t=.01);var r=(i-a)/(n-e),o=Math.pow(10,a+r*(t-a));return Math.round(o/y.roundToBase(o,10))*y.roundToBase(o,10)}));return 0===c[0]&&(c[0]=1),{result:c,niceMin:c[0],niceMax:c[c.length-1]}}},{key:"setYScaleForIndex",value:function(t,e,n){var l=this.w.globals,a=this.w.config,i=l.isBarHorizontal?a.xaxis:a.yaxis[t];void 0===l.yAxisScale[t]&&(l.yAxisScale[t]=[]);var r=Math.abs(n-e);if(i.logarithmic&&r<=5&&(l.invalidLogScale=!0),i.logarithmic&&r>5)l.allSeriesCollapsed=!1,l.yAxisScale[t]=this.logarithmicScale(t,e,n,i.tickAmount?i.tickAmount:Math.floor(Math.log10(n)));else if(n!==-Number.MAX_VALUE&&y.isNumber(n))if(l.allSeriesCollapsed=!1,void 0===i.min&&void 0===i.max||i.forceNiceScale){var o=void 0===a.yaxis[t].max&&void 0===a.yaxis[t].min||a.yaxis[t].forceNiceScale;l.yAxisScale[t]=this.niceScale(e,n,i.tickAmount?i.tickAmount:r<5&&r>1?r+1:5,t,o)}else l.yAxisScale[t]=this.linearScale(e,n,i.tickAmount);else l.yAxisScale[t]=this.linearScale(0,5,5)}},{key:"setXScale",value:function(t,e){var n=this.w,l=n.globals,a=n.config.xaxis,i=Math.abs(e-t);return e!==-Number.MAX_VALUE&&y.isNumber(e)?l.xAxisScale=this.niceScale(t,e,a.tickAmount?a.tickAmount:i<5&&i>1?i+1:5,0):l.xAxisScale=this.linearScale(0,5,5),l.xAxisScale}},{key:"setMultipleYScales",value:function(){var t=this,e=this.w.globals,n=this.w.config,l=e.minYArr.concat([]),a=e.maxYArr.concat([]),i=[];n.yaxis.forEach((function(e,r){var o=r;n.series.forEach((function(t,n){t.name===e.seriesName&&(o=n,r!==n?i.push({index:n,similarIndex:r,alreadyExists:!0}):i.push({index:n}))}));var s=l[o],c=a[o];t.setYScaleForIndex(r,s,c)})),this.sameScaleInMultipleAxes(l,a,i)}},{key:"sameScaleInMultipleAxes",value:function(t,e,n){var l=this,a=this.w.config,i=this.w.globals,r=[];n.forEach((function(t){t.alreadyExists&&(void 0===r[t.index]&&(r[t.index]=[]),r[t.index].push(t.index),r[t.index].push(t.similarIndex))})),i.yAxisSameScaleIndices=r,r.forEach((function(t,e){r.forEach((function(n,l){var a,i;e!==l&&(a=t,i=n,a.filter((function(t){return-1!==i.indexOf(t)}))).length>0&&(r[e]=r[e].concat(r[l]))}))}));var o=r.map((function(t){return t.filter((function(e,n){return t.indexOf(e)===n}))})).map((function(t){return t.sort()}));r=r.filter((function(t){return!!t}));var s=o.slice(),c=s.map((function(t){return JSON.stringify(t)}));s=s.filter((function(t,e){return c.indexOf(JSON.stringify(t))===e}));var d=[],u=[];t.forEach((function(t,n){s.forEach((function(l,a){l.indexOf(n)>-1&&(void 0===d[a]&&(d[a]=[],u[a]=[]),d[a].push({key:n,value:t}),u[a].push({key:n,value:e[n]}))}))}));var h=Array.apply(null,Array(s.length)).map(Number.prototype.valueOf,Number.MIN_VALUE),p=Array.apply(null,Array(s.length)).map(Number.prototype.valueOf,-Number.MAX_VALUE);d.forEach((function(t,e){t.forEach((function(t,n){h[e]=Math.min(t.value,h[e])}))})),u.forEach((function(t,e){t.forEach((function(t,n){p[e]=Math.max(t.value,p[e])}))})),t.forEach((function(t,e){u.forEach((function(t,n){var r=h[n],o=p[n];a.chart.stacked&&(o=0,t.forEach((function(t,e){t.value!==-Number.MAX_VALUE&&(o+=t.value),r!==Number.MIN_VALUE&&(r+=d[n][e].value)}))),t.forEach((function(n,s){t[s].key===e&&(void 0!==a.yaxis[e].min&&(r="function"==typeof a.yaxis[e].min?a.yaxis[e].min(i.minY):a.yaxis[e].min),void 0!==a.yaxis[e].max&&(o="function"==typeof a.yaxis[e].max?a.yaxis[e].max(i.maxY):a.yaxis[e].max),l.setYScaleForIndex(e,r,o))}))}))}))}},{key:"autoScaleY",value:function(t,e,n){t||(t=this);var l=t.w;if(l.globals.isMultipleYAxis||l.globals.collapsedSeries.length)return console.warn("autoScaleYaxis is not supported in a multi-yaxis chart."),e;var a=l.globals.seriesX[0],i=l.config.chart.stacked;return e.forEach((function(t,r){for(var o=0,s=0;s=n.xaxis.min){o=s;break}var c,d,u=l.globals.minYArr[r],h=l.globals.maxYArr[r],p=l.globals.stackedSeriesTotals;l.globals.series.forEach((function(r,s){var f=r[o];i?(f=p[o],c=d=f,p.forEach((function(t,e){a[e]<=n.xaxis.max&&a[e]>=n.xaxis.min&&(t>d&&null!==t&&(d=t),r[e]=n.xaxis.min){var i=t,r=t;l.globals.series.forEach((function(n,l){null!==t&&(i=Math.min(n[e],i),r=Math.max(n[e],r))})),r>d&&null!==r&&(d=r),iu&&(c=u),e.length>1?(e[s].min=void 0===t.min?c:t.min,e[s].max=void 0===t.max?d:t.max):(e[0].min=void 0===t.min?c:t.min,e[0].max=void 0===t.max?d:t.max)}))})),e}}]),t}(),Q=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.scales=new K(e)}return o(t,[{key:"init",value:function(){this.setYRange(),this.setXRange(),this.setZRange()}},{key:"getMinYMaxY",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-Number.MAX_VALUE,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=this.w.config,i=this.w.globals,r=-Number.MAX_VALUE,o=Number.MIN_VALUE;null===l&&(l=t+1);var s=i.series,c=s,d=s;"candlestick"===a.chart.type?(c=i.seriesCandleL,d=i.seriesCandleH):i.isRangeData&&(c=i.seriesRangeStart,d=i.seriesRangeEnd);for(var u=t;uc[u][h]&&c[u][h]<0&&(o=c[u][h])):i.hasNullValues=!0}}return"rangeBar"===a.chart.type&&i.seriesRangeStart.length&&i.isBarHorizontal&&"datetime"===a.xaxis.type&&(o=e),"bar"===a.chart.type&&(o<0&&r<0&&(r=0),o===Number.MIN_VALUE&&(o=0)),{minY:o,maxY:r,lowestY:e,highestY:n}}},{key:"setYRange",value:function(){var t=this.w.globals,e=this.w.config;t.maxY=-Number.MAX_VALUE,t.minY=Number.MIN_VALUE;var n=Number.MAX_VALUE;if(t.isMultipleYAxis)for(var l=0;l=0&&n<=10&&(r=0),t.minY=n-5*r/100,n>0&&t.minY<0&&(t.minY=0),t.maxY=t.maxY+5*r/100}return e.yaxis.forEach((function(e,n){void 0!==e.max&&("number"==typeof e.max?t.maxYArr[n]=e.max:"function"==typeof e.max&&(t.maxYArr[n]=e.max(t.maxY)),t.maxY=t.maxYArr[n]),void 0!==e.min&&("number"==typeof e.min?t.minYArr[n]=e.min:"function"==typeof e.min&&(t.minYArr[n]=e.min(t.minY)),t.minY=t.minYArr[n])})),t.isBarHorizontal&&["min","max"].forEach((function(n){void 0!==e.xaxis[n]&&"number"==typeof e.xaxis[n]&&("min"===n?t.minY=e.xaxis[n]:t.maxY=e.xaxis[n])})),t.isMultipleYAxis?(this.scales.setMultipleYScales(),t.minY=n,t.yAxisScale.forEach((function(e,n){t.minYArr[n]=e.niceMin,t.maxYArr[n]=e.niceMax}))):(this.scales.setYScaleForIndex(0,t.minY,t.maxY),t.minY=t.yAxisScale[0].niceMin,t.maxY=t.yAxisScale[0].niceMax,t.minYArr[0]=t.yAxisScale[0].niceMin,t.maxYArr[0]=t.yAxisScale[0].niceMax),{minY:t.minY,maxY:t.maxY,minYArr:t.minYArr,maxYArr:t.maxYArr}}},{key:"setXRange",value:function(){var t=this.w.globals,e=this.w.config,n="numeric"===e.xaxis.type||"datetime"===e.xaxis.type||"category"===e.xaxis.type&&!t.noLabelsProvided||t.noLabelsProvided||t.isXNumeric;if(t.isXNumeric&&function(){for(var e=0;et.dataPoints&&0!==t.dataPoints&&(l=t.dataPoints-1)):"dataPoints"===e.xaxis.tickAmount?(t.series.length>1&&(l=t.series[t.maxValsInArrayIndex].length-1),t.isXNumeric&&(l=t.maxX-t.minX-1)):l=e.xaxis.tickAmount,t.xTickAmount=l,void 0!==e.xaxis.max&&"number"==typeof e.xaxis.max&&(t.maxX=e.xaxis.max),void 0!==e.xaxis.min&&"number"==typeof e.xaxis.min&&(t.minX=e.xaxis.min),void 0!==e.xaxis.range&&(t.minX=t.maxX-e.xaxis.range),t.minX!==Number.MAX_VALUE&&t.maxX!==-Number.MAX_VALUE)if(e.xaxis.convertedCatToNumeric&&!t.dataFormatXNumeric){for(var a=[],i=t.minX-1;i0&&(t.xAxisScale=this.scales.linearScale(1,t.labels.length,l-1),t.seriesX=t.labels.slice());n&&(t.labels=t.xAxisScale.result.slice())}return t.isBarHorizontal&&t.labels.length&&(t.xTickAmount=t.labels.length),this._handleSingleDataPoint(),this._getMinXDiff(),{minX:t.minX,maxX:t.maxX}}},{key:"setZRange",value:function(){var t=this.w.globals;if(t.isDataXYZ)for(var e=0;e0){var a=e-t.seriesX[n][l-1];a>0&&(t.minXDiff=Math.min(a,t.minXDiff))}})),1===t.dataPoints&&t.minXDiff===Number.MAX_VALUE&&(t.minXDiff=.5)}))}},{key:"_setStackedMinMax",value:function(){var t=this.w.globals,e=[],n=[];if(t.series.length)for(var l=0;l0?a=a+parseFloat(t.series[r][l])+1e-4:i+=parseFloat(t.series[r][l])),r===t.series.length-1&&(e.push(a),n.push(i));for(var o=0;o=0;m--)g(m);if(void 0!==e.config.yaxis[t].title.text){var v=n.group({class:"apexcharts-yaxis-title"}),b=0;e.config.yaxis[t].opposite&&(b=e.globals.translateYAxisX[t]);var y=n.drawText({x:b,y:e.globals.gridHeight/2+e.globals.translateY+e.config.yaxis[t].title.offsetY,text:e.config.yaxis[t].title.text,textAnchor:"end",foreColor:e.config.yaxis[t].title.style.color,fontSize:e.config.yaxis[t].title.style.fontSize,fontWeight:e.config.yaxis[t].title.style.fontWeight,fontFamily:e.config.yaxis[t].title.style.fontFamily,cssClass:"apexcharts-yaxis-title-text "+e.config.yaxis[t].title.style.cssClass});v.add(y),o.add(v)}var x=e.config.yaxis[t].axisBorder,_=31+x.offsetX;if(e.config.yaxis[t].opposite&&(_=-31-x.offsetX),x.show){var S=n.drawLine(_,e.globals.translateY+x.offsetY-2,_,e.globals.gridHeight+e.globals.translateY+x.offsetY+2,x.color,0,x.width);o.add(S)}return e.config.yaxis[t].axisTicks.show&&this.axesUtils.drawYAxisTicks(_,c,x,e.config.yaxis[t].axisTicks,t,d,o),o}},{key:"drawYaxisInversed",value:function(t){var e=this.w,n=new w(this.ctx),l=n.group({class:"apexcharts-xaxis apexcharts-yaxis-inversed"}),a=n.group({class:"apexcharts-xaxis-texts-g",transform:"translate(".concat(e.globals.translateXAxisX,", ").concat(e.globals.translateXAxisY,")")});l.add(a);var i=e.globals.yAxisScale[t].result.length-1,r=e.globals.gridWidth/i+.1,o=r+e.config.xaxis.labels.offsetX,s=e.globals.xLabelFormatter,c=e.globals.yAxisScale[t].result.slice(),d=e.globals.timescaleLabels;d.length>0&&(this.xaxisLabels=d.slice(),i=(c=d.slice()).length),c=this.axesUtils.checkForReversedLabels(t,c);var u=d.length;if(e.config.xaxis.labels.show)for(var h=u?0:i;u?h=0;u?h++:h--){var p=c[h];p=s(p,h);var f=e.globals.gridWidth+e.globals.padHorizontal-(o-r+e.config.xaxis.labels.offsetX);if(d.length){var g=this.axesUtils.getLabel(c,d,f,h,this.drawnLabels,this.xaxisFontSize);f=g.x,p=g.text,this.drawnLabels.push(g.text),0===h&&e.globals.skipFirstTimelinelabel&&(p=""),h===c.length-1&&e.globals.skipLastTimelinelabel&&(p="")}var m=n.drawText({x:f,y:this.xAxisoffX+e.config.xaxis.labels.offsetY+30-("top"===e.config.xaxis.position?e.globals.xAxisHeight+e.config.xaxis.axisTicks.height-2:0),text:p,textAnchor:"middle",foreColor:Array.isArray(this.xaxisForeColors)?this.xaxisForeColors[t]:this.xaxisForeColors,fontSize:this.xaxisFontSize,fontFamily:this.xaxisFontFamily,fontWeight:e.config.xaxis.labels.style.fontWeight,isPlainText:!1,cssClass:"apexcharts-xaxis-label "+e.config.xaxis.labels.style.cssClass});a.add(m),m.tspan(p);var v=document.createElementNS(e.globals.SVGNS,"title");v.textContent=p,m.node.appendChild(v),o+=r}return this.inversedYAxisTitleText(l),this.inversedYAxisBorder(l),l}},{key:"inversedYAxisBorder",value:function(t){var e=this.w,n=new w(this.ctx),l=e.config.xaxis.axisBorder;if(l.show){var a=0;"bar"===e.config.chart.type&&e.globals.isXNumeric&&(a-=15);var i=n.drawLine(e.globals.padHorizontal+a+l.offsetX,this.xAxisoffX,e.globals.gridWidth,this.xAxisoffX,l.color,0,l.height);t.add(i)}}},{key:"inversedYAxisTitleText",value:function(t){var e=this.w,n=new w(this.ctx);if(void 0!==e.config.xaxis.title.text){var l=n.group({class:"apexcharts-xaxis-title apexcharts-yaxis-title-inversed"}),a=n.drawText({x:e.globals.gridWidth/2+e.config.xaxis.title.offsetX,y:this.xAxisoffX+parseFloat(this.xaxisFontSize)+parseFloat(e.config.xaxis.title.style.fontSize)+e.config.xaxis.title.offsetY+20,text:e.config.xaxis.title.text,textAnchor:"middle",fontSize:e.config.xaxis.title.style.fontSize,fontFamily:e.config.xaxis.title.style.fontFamily,fontWeight:e.config.xaxis.title.style.fontWeight,cssClass:"apexcharts-xaxis-title-text "+e.config.xaxis.title.style.cssClass});l.add(a),t.add(l)}}},{key:"yAxisTitleRotate",value:function(t,e){var n=this.w,l=new w(this.ctx),a={width:0,height:0},i={width:0,height:0},r=n.globals.dom.baseEl.querySelector(" .apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-texts-g"));null!==r&&(a=r.getBoundingClientRect());var o=n.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(t,"'] .apexcharts-yaxis-title text"));if(null!==o&&(i=o.getBoundingClientRect()),null!==o){var s=this.xPaddingForYAxisTitle(t,a,i,e);o.setAttribute("x",s.xPos-(e?10:0))}if(null!==o){var c=l.rotateAroundCenter(o);o.setAttribute("transform","rotate(".concat(e?-1*n.config.yaxis[t].title.rotate:n.config.yaxis[t].title.rotate," ").concat(c.x," ").concat(c.y,")"))}}},{key:"xPaddingForYAxisTitle",value:function(t,e,n,l){var a=this.w,i=0,r=0,o=10;return void 0===a.config.yaxis[t].title.text||t<0?{xPos:r,padd:0}:(l?(r=e.width+a.config.yaxis[t].title.offsetX+n.width/2+o/2,0===(i+=1)&&(r-=o/2)):(r=-1*e.width+a.config.yaxis[t].title.offsetX+o/2+n.width/2,a.globals.isBarHorizontal&&(o=25,r=-1*e.width-a.config.yaxis[t].title.offsetX-o)),{xPos:r,padd:o})}},{key:"setYAxisXPosition",value:function(t,e){var n=this.w,l=0,a=0,i=18,r=1;n.config.yaxis.length>1&&(this.multipleYs=!0),n.config.yaxis.map((function(o,s){var c=n.globals.ignoreYAxisIndexes.indexOf(s)>-1||!o.show||o.floating||0===t[s].width,d=t[s].width+e[s].width;o.opposite?n.globals.isBarHorizontal?(a=n.globals.gridWidth+n.globals.translateX-1,n.globals.translateYAxisX[s]=a-o.labels.offsetX):(a=n.globals.gridWidth+n.globals.translateX+r,c||(r=r+d+20),n.globals.translateYAxisX[s]=a-o.labels.offsetX+20):(l=n.globals.translateX-i,c||(i=i+d+20),n.globals.translateYAxisX[s]=l+o.labels.offsetX)}))}},{key:"setYAxisTextAlignments",value:function(){var t=this.w,e=t.globals.dom.baseEl.getElementsByClassName("apexcharts-yaxis");(e=y.listToArray(e)).forEach((function(e,n){var l=t.config.yaxis[n];if(void 0!==l.labels.align){var a=t.globals.dom.baseEl.querySelector(".apexcharts-yaxis[rel='".concat(n,"'] .apexcharts-yaxis-texts-g")),i=t.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxis[rel='".concat(n,"'] .apexcharts-yaxis-label"));i=y.listToArray(i);var r=a.getBoundingClientRect();"left"===l.labels.align?(i.forEach((function(t,e){t.setAttribute("text-anchor","start")})),l.opposite||a.setAttribute("transform","translate(-".concat(r.width,", 0)"))):"center"===l.labels.align?(i.forEach((function(t,e){t.setAttribute("text-anchor","middle")})),a.setAttribute("transform","translate(".concat(r.width/2*(l.opposite?1:-1),", 0)"))):"right"===l.labels.align&&(i.forEach((function(t,e){t.setAttribute("text-anchor","end")})),l.opposite&&a.setAttribute("transform","translate(".concat(r.width,", 0)")))}}))}}]),t}(),tt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.documentEvent=y.bind(this.documentEvent,this)}return o(t,[{key:"addEventListener",value:function(t,e){var n=this.w;n.globals.events.hasOwnProperty(t)?n.globals.events[t].push(e):n.globals.events[t]=[e]}},{key:"removeEventListener",value:function(t,e){var n=this.w;if(n.globals.events.hasOwnProperty(t)){var l=n.globals.events[t].indexOf(e);-1!==l&&n.globals.events[t].splice(l,1)}}},{key:"fireEvent",value:function(t,e){var n=this.w;if(n.globals.events.hasOwnProperty(t)){e&&e.length||(e=[]);for(var l=n.globals.events[t],a=l.length,i=0;i0&&(e=this.w.config.chart.locales.concat(window.Apex.chart.locales));var n=e.filter((function(e){return e.name===t}))[0];if(!n)throw new Error("Wrong locale name provided. Please make sure you set the correct locale name in options");var l=y.extend(E,n);this.w.globals.locale=l.options}}]),t}(),nt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"drawAxis",value:function(t,e){var n,l,a=this.w.globals,i=this.w.config,r=new G(this.ctx),o=new J(this.ctx);a.axisCharts&&"radar"!==t&&(a.isBarHorizontal?(l=o.drawYaxisInversed(0),n=r.drawXaxisInversed(0),a.dom.elGraphical.add(n),a.dom.elGraphical.add(l)):(n=r.drawXaxis(),a.dom.elGraphical.add(n),i.yaxis.map((function(t,e){-1===a.ignoreYAxisIndexes.indexOf(e)&&(l=o.drawYaxis(e),a.dom.Paper.add(l))})))),i.yaxis.map((function(t,e){-1===a.ignoreYAxisIndexes.indexOf(e)&&o.yAxisTitleRotate(e,t.opposite)}))}}]),t}(),lt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"drawXCrosshairs",value:function(){var t=this.w,e=new w(this.ctx),n=new x(this.ctx),l=t.config.xaxis.crosshairs.fill.gradient,a=t.config.xaxis.crosshairs.dropShadow,i=t.config.xaxis.crosshairs.fill.type,r=l.colorFrom,o=l.colorTo,s=l.opacityFrom,c=l.opacityTo,d=l.stops,u=a.enabled,h=a.left,p=a.top,f=a.blur,g=a.color,m=a.opacity,v=t.config.xaxis.crosshairs.fill.color;if(t.config.xaxis.crosshairs.show){"gradient"===i&&(v=e.drawGradient("vertical",r,o,s,c,null,d,null));var b=e.drawRect();1===t.config.xaxis.crosshairs.width&&(b=e.drawLine()),b.attr({class:"apexcharts-xcrosshairs",x:0,y:0,y2:t.globals.gridHeight,width:y.isNumber(t.config.xaxis.crosshairs.width)?t.config.xaxis.crosshairs.width:0,height:t.globals.gridHeight,fill:v,filter:"none","fill-opacity":t.config.xaxis.crosshairs.opacity,stroke:t.config.xaxis.crosshairs.stroke.color,"stroke-width":t.config.xaxis.crosshairs.stroke.width,"stroke-dasharray":t.config.xaxis.crosshairs.stroke.dashArray}),u&&(b=n.dropShadow(b,{left:h,top:p,blur:f,color:g,opacity:m})),t.globals.dom.elGraphical.add(b)}}},{key:"drawYCrosshairs",value:function(){var t=this.w,e=new w(this.ctx),n=t.config.yaxis[0].crosshairs,l=t.globals.barPadForNumericAxis;if(t.config.yaxis[0].crosshairs.show){var a=e.drawLine(-l,0,t.globals.gridWidth+l,0,n.stroke.color,n.stroke.dashArray,n.stroke.width);a.attr({class:"apexcharts-ycrosshairs"}),t.globals.dom.elGraphical.add(a)}var i=e.drawLine(-l,0,t.globals.gridWidth+l,0,n.stroke.color,0,0);i.attr({class:"apexcharts-ycrosshairs-hidden"}),t.globals.dom.elGraphical.add(i)}}]),t}(),at=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"checkResponsiveConfig",value:function(t){var e=this,n=this.w,l=n.config;if(0!==l.responsive.length){var a=l.responsive.slice();a.sort((function(t,e){return t.breakpoint>e.breakpoint?1:e.breakpoint>t.breakpoint?-1:0})).reverse();var i=new z({}),r=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=a[0].breakpoint,r=window.innerWidth>0?window.innerWidth:screen.width;if(r>l){var o=k.extendArrayProps(i,n.globals.initialConfig,n);t=y.extend(o,t),t=y.extend(n.config,t),e.overrideResponsiveOptions(t)}else for(var s=0;s0&&"function"==typeof e.config.colors[0]&&(e.globals.colors=e.config.series.map((function(n,l){var a=e.config.colors[l];return a||(a=e.config.colors[0]),"function"==typeof a?(t.isColorFn=!0,a({value:e.globals.axisCharts?e.globals.series[l][0]?e.globals.series[l][0]:0:e.globals.series[l],seriesIndex:l,dataPointIndex:l,w:e})):a})))),e.globals.seriesColors.map((function(t,n){t&&(e.globals.colors[n]=t)})),e.config.theme.monochrome.enabled){var l=[],a=e.globals.series.length;this.isBarDistributed&&(a=e.globals.series[0].length*e.globals.series.length);for(var i=e.config.theme.monochrome.color,r=1/(a/e.config.theme.monochrome.shadeIntensity),o=e.config.theme.monochrome.shadeTo,s=0,c=0;c2&&void 0!==arguments[2]?arguments[2]:null,l=this.w,a=e||l.globals.series.length;if(null===n&&(n=this.isBarDistributed||"heatmap"===l.config.chart.type&&l.config.plotOptions.heatmap.colorScale.inverse),n&&(a=l.globals.series[0].length*l.globals.series.length),t.lengtht.globals.svgWidth&&(this.dCtx.lgRect.width=t.globals.svgWidth/1.5),this.dCtx.lgRect}},{key:"getLargestStringFromMultiArr",value:function(t,e){var n=t;if(this.w.globals.isMultiLineX){var l=e.map((function(t,e){return Array.isArray(t)?t.length:1})),a=Math.max.apply(Math,g(l));n=e[l.indexOf(a)]}return n}}]),t}(),st=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return o(t,[{key:"getxAxisLabelsCoords",value:function(){var t,e=this.w,n=e.globals.labels.slice();if(e.config.xaxis.convertedCatToNumeric&&0===n.length&&(n=e.globals.categoryLabels),e.globals.timescaleLabels.length>0){var l=this.getxAxisTimeScaleLabelsCoords();t={width:l.width,height:l.height},e.globals.rotateXLabels=!1}else{this.dCtx.lgWidthForSideLegends="left"!==e.config.legend.position&&"right"!==e.config.legend.position||e.config.legend.floating?0:this.dCtx.lgRect.width;var a=e.globals.xLabelFormatter,i=y.getLargestStringFromArr(n),r=this.dCtx.dimHelpers.getLargestStringFromMultiArr(i,n);e.globals.isBarHorizontal&&(r=i=e.globals.yAxisScale[0].result.reduce((function(t,e){return t.length>e.length?t:e}),0));var o=new V(this.dCtx.ctx),s=i;i=o.xLabelFormat(a,i,s),r=o.xLabelFormat(a,r,s),(e.config.xaxis.convertedCatToNumeric&&void 0===i||""===String(i).trim())&&(r=i="1");var c=new w(this.dCtx.ctx),d=c.getTextRects(i,e.config.xaxis.labels.style.fontSize),u=d;if(i!==r&&(u=c.getTextRects(r,e.config.xaxis.labels.style.fontSize)),(t={width:d.width>=u.width?d.width:u.width,height:d.height>=u.height?d.height:u.height}).width*n.length>e.globals.svgWidth-this.dCtx.lgWidthForSideLegends-this.dCtx.yAxisWidth-this.dCtx.gridPad.left-this.dCtx.gridPad.right&&0!==e.config.xaxis.labels.rotate||e.config.xaxis.labels.rotateAlways){if(!e.globals.isBarHorizontal){e.globals.rotateXLabels=!0;var h=function(t){return c.getTextRects(t,e.config.xaxis.labels.style.fontSize,e.config.xaxis.labels.style.fontFamily,"rotate(".concat(e.config.xaxis.labels.rotate," 0 0)"),!1)};d=h(i),i!==r&&(u=h(r)),t.height=(d.height>u.height?d.height:u.height)/1.5,t.width=d.width>u.width?d.width:u.width}}else e.globals.rotateXLabels=!1}return e.config.xaxis.labels.show||(t={width:0,height:0}),{width:t.width,height:t.height}}},{key:"getxAxisTitleCoords",value:function(){var t=this.w,e=0,n=0;if(void 0!==t.config.xaxis.title.text){var l=new w(this.dCtx.ctx).getTextRects(t.config.xaxis.title.text,t.config.xaxis.title.style.fontSize);e=l.width,n=l.height}return{width:e,height:n}}},{key:"getxAxisTimeScaleLabelsCoords",value:function(){var t,e=this.w;this.dCtx.timescaleLabels=e.globals.timescaleLabels.slice();var n=this.dCtx.timescaleLabels.map((function(t){return t.value})),l=n.reduce((function(t,e){return void 0===t?(console.error("You have possibly supplied invalid Date format. Please supply a valid JavaScript Date"),0):t.length>e.length?t:e}),0);return 1.05*(t=new w(this.dCtx.ctx).getTextRects(l,e.config.xaxis.labels.style.fontSize)).width*n.length>e.globals.gridWidth&&0!==e.config.xaxis.labels.rotate&&(e.globals.overlappingXLabels=!0),t}},{key:"additionalPaddingXLabels",value:function(t){var e=this,n=this.w,l=n.globals,a=n.config,i=a.xaxis.type,r=t.width;l.skipLastTimelinelabel=!1,l.skipFirstTimelinelabel=!1;var o=n.config.yaxis[0].opposite&&n.globals.isBarHorizontal,s=function(t,o){(function(t){return-1!==l.collapsedSeriesIndices.indexOf(t)})(o)||("datetime"!==i&&e.dCtx.gridPad.leftl.gridWidth&&(l.skipLastTimelinelabel=!0),s<0&&(l.skipFirstTimelinelabel=!0)}else"datetime"===i?e.dCtx.gridPad.rightString(o.niceMax).length?o.niceMin:o.niceMax,d=s(c,{seriesIndex:r,dataPointIndex:-1,w:e}),u=d;if(void 0!==d&&0!==d.length||(d=c),e.globals.isBarHorizontal){l=0;var h=e.globals.labels.slice();d=s(d=y.getLargestStringFromArr(h),{seriesIndex:r,dataPointIndex:-1,w:e}),u=t.dCtx.dimHelpers.getLargestStringFromMultiArr(d,h)}var p=new w(t.dCtx.ctx),f=p.getTextRects(d,i.labels.style.fontSize),g=f;d!==u&&(g=p.getTextRects(u,i.labels.style.fontSize)),n.push({width:(g.width>f.width?g.width:f.width)+l,height:g.height>f.height?g.height:f.height})}else n.push({width:0,height:0})})),n}},{key:"getyAxisTitleCoords",value:function(){var t=this,e=this.w,n=[];return e.config.yaxis.map((function(e,l){if(e.show&&void 0!==e.title.text){var a=new w(t.dCtx.ctx).getTextRects(e.title.text,e.title.style.fontSize,e.title.style.fontFamily,"rotate(-90 0 0)",!1);n.push({width:a.width,height:a.height})}else n.push({width:0,height:0})})),n}},{key:"getTotalYAxisWidth",value:function(){var t=this.w,e=0,n=0,l=0,a=t.globals.yAxisScale.length>1?10:0,i=new Y(this.dCtx.ctx),r=function(r,o){var s=t.config.yaxis[o].floating,c=0;r.width>0&&!s?(c=r.width+a,function(e){return t.globals.ignoreYAxisIndexes.indexOf(e)>-1}(o)&&(c=c-r.width-a)):c=s||i.isYAxisHidden(o)?0:5,t.config.yaxis[o].opposite?l+=c:n+=c,e+=c};return t.globals.yLabelsCoords.map((function(t,e){r(t,e)})),t.globals.yTitleCoords.map((function(t,e){r(t,e)})),t.globals.isBarHorizontal&&(e=t.globals.yLabelsCoords[0].width+t.globals.yTitleCoords[0].width+15),this.dCtx.yAxisWidthLeft=n,this.dCtx.yAxisWidthRight=l,e}}]),t}(),dt=function(){function t(e){i(this,t),this.w=e.w,this.dCtx=e}return o(t,[{key:"gridPadForColumnsInNumericAxis",value:function(t){var e=this.w;if(e.globals.noData||e.globals.allSeriesCollapsed)return 0;var n=e.config.chart.type,l=0,a="bar"===n||"rangeBar"===n?e.config.series.length:1;if(e.globals.comboBarCount>0&&(a=e.globals.comboBarCount),e.globals.collapsedSeries.forEach((function(t){"bar"!==t.type&&"rangeBar"!==t.type||(a-=1)})),e.config.chart.stacked&&(a=1),("bar"===n||"rangeBar"===n||e.globals.comboBarCount>0)&&e.globals.isXNumeric&&!e.globals.isBarHorizontal&&a>0){var i,r,o=Math.abs(e.globals.initialMaxX-e.globals.initialMinX);o<=3&&(o=e.globals.dataPoints),i=o/t,e.globals.minXDiff&&e.globals.minXDiff/i>0&&(r=e.globals.minXDiff/i),r>t/2&&(r/=2),(l=r/a*parseInt(e.config.plotOptions.bar.columnWidth,10)/100)<1&&(l=1),l=l/(a>1?1:1.5)+5,e.globals.barPadForNumericAxis=l}return l}},{key:"gridPadFortitleSubtitle",value:function(){var t=this,e=this.w,n=e.globals,l=this.dCtx.isSparkline||!e.globals.axisCharts?0:10;["title","subtitle"].forEach((function(n){void 0!==e.config[n].text?l+=e.config[n].margin:l+=t.dCtx.isSparkline||!e.globals.axisCharts?0:5})),!e.config.legend.show||"bottom"!==e.config.legend.position||e.config.legend.floating||e.globals.axisCharts||(l+=10);var a=this.dCtx.dimHelpers.getTitleSubtitleCoords("title"),i=this.dCtx.dimHelpers.getTitleSubtitleCoords("subtitle");n.gridHeight=n.gridHeight-a.height-i.height-l,n.translateY=n.translateY+a.height+i.height+l}},{key:"setGridXPosForDualYAxis",value:function(t,e){var n=this.w,l=new Y(this.dCtx.ctx);n.config.yaxis.map((function(a,i){-1!==n.globals.ignoreYAxisIndexes.indexOf(i)||a.floating||l.isYAxisHidden(i)||(a.opposite&&(n.globals.translateX=n.globals.translateX-(e[i].width+t[i].width)-parseInt(n.config.yaxis[i].labels.style.fontSize,10)/1.2-12),n.globals.translateX<2&&(n.globals.translateX=2))}))}}]),t}(),ut=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.lgRect={},this.yAxisWidth=0,this.yAxisWidthLeft=0,this.yAxisWidthRight=0,this.xAxisHeight=0,this.isSparkline=this.w.config.chart.sparkline.enabled,this.dimHelpers=new ot(this),this.dimYAxis=new ct(this),this.dimXAxis=new st(this),this.dimGrid=new dt(this),this.lgWidthForSideLegends=0,this.gridPad=this.w.config.grid.padding,this.xPadRight=0,this.xPadLeft=0}return o(t,[{key:"plotCoords",value:function(){var t=this.w.globals;this.lgRect=this.dimHelpers.getLegendsRect(),t.axisCharts?this.setDimensionsForAxisCharts():this.setDimensionsForNonAxisCharts(),this.dimGrid.gridPadFortitleSubtitle(),t.gridHeight=t.gridHeight-this.gridPad.top-this.gridPad.bottom,t.gridWidth=t.gridWidth-this.gridPad.left-this.gridPad.right-this.xPadRight-this.xPadLeft;var e=this.dimGrid.gridPadForColumnsInNumericAxis(t.gridWidth);t.gridWidth=t.gridWidth-2*e,t.translateX=t.translateX+this.gridPad.left+this.xPadLeft+(e>0?e+4:0),t.translateY=t.translateY+this.gridPad.top}},{key:"setDimensionsForAxisCharts",value:function(){var t=this,e=this.w,n=e.globals,l=this.dimYAxis.getyAxisLabelsCoords(),a=this.dimYAxis.getyAxisTitleCoords();e.globals.yLabelsCoords=[],e.globals.yTitleCoords=[],e.config.yaxis.map((function(t,n){e.globals.yLabelsCoords.push({width:l[n].width,index:n}),e.globals.yTitleCoords.push({width:a[n].width,index:n})})),this.yAxisWidth=this.dimYAxis.getTotalYAxisWidth();var i=this.dimXAxis.getxAxisLabelsCoords(),r=this.dimXAxis.getxAxisTitleCoords();this.conditionalChecksForAxisCoords(i,r),n.translateXAxisY=e.globals.rotateXLabels?this.xAxisHeight/8:-4,n.translateXAxisX=e.globals.rotateXLabels&&e.globals.isXNumeric&&e.config.xaxis.labels.rotate<=-45?-this.xAxisWidth/4:0,e.globals.isBarHorizontal&&(n.rotateXLabels=!1,n.translateXAxisY=parseInt(e.config.xaxis.labels.style.fontSize,10)/1.5*-1),n.translateXAxisY=n.translateXAxisY+e.config.xaxis.labels.offsetY,n.translateXAxisX=n.translateXAxisX+e.config.xaxis.labels.offsetX;var o=this.yAxisWidth,s=this.xAxisHeight;n.xAxisLabelsHeight=this.xAxisHeight,n.xAxisLabelsWidth=this.xAxisWidth,n.xAxisHeight=this.xAxisHeight;var c=10;("radar"===e.config.chart.type||this.isSparkline)&&(o=0,s=n.goldenPadding),this.isSparkline&&(this.lgRect={height:0,width:0},s=0,o=0,c=0),this.dimXAxis.additionalPaddingXLabels(i);var d=function(){n.translateX=o,n.gridHeight=n.svgHeight-t.lgRect.height-s-(t.isSparkline?0:e.globals.rotateXLabels?10:15),n.gridWidth=n.svgWidth-o};switch("top"===e.config.xaxis.position&&(c=n.xAxisHeight-e.config.xaxis.axisTicks.height-5),e.config.legend.position){case"bottom":n.translateY=c,d();break;case"top":n.translateY=this.lgRect.height+c,d();break;case"left":n.translateY=c,n.translateX=this.lgRect.width+o,n.gridHeight=n.svgHeight-s-12,n.gridWidth=n.svgWidth-this.lgRect.width-o;break;case"right":n.translateY=c,n.translateX=o,n.gridHeight=n.svgHeight-s-12,n.gridWidth=n.svgWidth-this.lgRect.width-o-5;break;default:throw new Error("Legend position not supported")}this.dimGrid.setGridXPosForDualYAxis(a,l),new J(this.ctx).setYAxisXPosition(l,a)}},{key:"setDimensionsForNonAxisCharts",value:function(){var t=this.w,e=t.globals,n=t.config,l=0;t.config.legend.show&&!t.config.legend.floating&&(l=20);var a="pie"===n.chart.type||"polarArea"===n.chart.type||"donut"===n.chart.type?"pie":"radialBar",i=n.plotOptions[a].offsetY,r=n.plotOptions[a].offsetX;if(!n.legend.show||n.legend.floating)return e.gridHeight=e.svgHeight-n.grid.padding.left+n.grid.padding.right,e.gridWidth=e.gridHeight,e.translateY=i,void(e.translateX=r+(e.svgWidth-e.gridWidth)/2);switch(n.legend.position){case"bottom":e.gridHeight=e.svgHeight-this.lgRect.height-e.goldenPadding,e.gridWidth=e.gridHeight,e.translateY=i-10,e.translateX=r+(e.svgWidth-e.gridWidth)/2;break;case"top":e.gridHeight=e.svgHeight-this.lgRect.height-e.goldenPadding,e.gridWidth=e.gridHeight,e.translateY=this.lgRect.height+i+10,e.translateX=r+(e.svgWidth-e.gridWidth)/2;break;case"left":e.gridWidth=e.svgWidth-this.lgRect.width-l,e.gridHeight="auto"!==n.chart.height?e.svgHeight:e.gridWidth,e.translateY=i,e.translateX=r+this.lgRect.width+l;break;case"right":e.gridWidth=e.svgWidth-this.lgRect.width-l-5,e.gridHeight="auto"!==n.chart.height?e.svgHeight:e.gridWidth,e.translateY=i,e.translateX=r+10;break;default:throw new Error("Legend position not supported")}}},{key:"conditionalChecksForAxisCoords",value:function(t,e){var n=this.w;this.xAxisHeight=(t.height+e.height)*(n.globals.isMultiLineX?1.2:n.globals.LINE_HEIGHT_RATIO)+(n.globals.rotateXLabels?22:10),this.xAxisWidth=t.width,this.xAxisHeight-e.height>n.config.xaxis.labels.maxHeight&&(this.xAxisHeight=n.config.xaxis.labels.maxHeight),n.config.xaxis.labels.minHeight&&this.xAxisHeighta&&(this.yAxisWidth=a)}}]),t}(),ht=function(){function t(e){i(this,t),this.w=e.w,this.lgCtx=e}return o(t,[{key:"getLegendStyles",value:function(){var t=document.createElement("style");t.setAttribute("type","text/css");var e=document.createTextNode("\t\n \t\n .apexcharts-legend {\t\n display: flex;\t\n overflow: auto;\t\n padding: 0 10px;\t\n }\t\n .apexcharts-legend.position-bottom, .apexcharts-legend.position-top {\t\n flex-wrap: wrap\t\n }\t\n .apexcharts-legend.position-right, .apexcharts-legend.position-left {\t\n flex-direction: column;\t\n bottom: 0;\t\n }\t\n .apexcharts-legend.position-bottom.apexcharts-align-left, .apexcharts-legend.position-top.apexcharts-align-left, .apexcharts-legend.position-right, .apexcharts-legend.position-left {\t\n justify-content: flex-start;\t\n }\t\n .apexcharts-legend.position-bottom.apexcharts-align-center, .apexcharts-legend.position-top.apexcharts-align-center {\t\n justify-content: center; \t\n }\t\n .apexcharts-legend.position-bottom.apexcharts-align-right, .apexcharts-legend.position-top.apexcharts-align-right {\t\n justify-content: flex-end;\t\n }\t\n .apexcharts-legend-series {\t\n cursor: pointer;\t\n line-height: normal;\t\n }\t\n .apexcharts-legend.position-bottom .apexcharts-legend-series, .apexcharts-legend.position-top .apexcharts-legend-series{\t\n display: flex;\t\n align-items: center;\t\n }\t\n .apexcharts-legend-text {\t\n position: relative;\t\n font-size: 14px;\t\n }\t\n .apexcharts-legend-text *, .apexcharts-legend-marker * {\t\n pointer-events: none;\t\n }\t\n .apexcharts-legend-marker {\t\n position: relative;\t\n display: inline-block;\t\n cursor: pointer;\t\n margin-right: 3px;\t\n border-style: solid;\n }\t\n \t\n .apexcharts-legend.apexcharts-align-right .apexcharts-legend-series, .apexcharts-legend.apexcharts-align-left .apexcharts-legend-series{\t\n display: inline-block;\t\n }\t\n .apexcharts-legend-series.apexcharts-no-click {\t\n cursor: auto;\t\n }\t\n .apexcharts-legend .apexcharts-hidden-zero-series, .apexcharts-legend .apexcharts-hidden-null-series {\t\n display: none !important;\t\n }\t\n .apexcharts-inactive-legend {\t\n opacity: 0.45;\t\n }");return t.appendChild(e),t}},{key:"getLegendBBox",value:function(){var t=this.w.globals.dom.baseEl.querySelector(".apexcharts-legend").getBoundingClientRect(),e=t.width;return{clwh:t.height,clww:e}}},{key:"appendToForeignObject",value:function(){var t=this.w.globals;t.dom.elLegendForeign=document.createElementNS(t.SVGNS,"foreignObject");var e=t.dom.elLegendForeign;e.setAttribute("x",0),e.setAttribute("y",0),e.setAttribute("width",t.svgWidth),e.setAttribute("height",t.svgHeight),t.dom.elLegendWrap.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),e.appendChild(t.dom.elLegendWrap),e.appendChild(this.getLegendStyles()),t.dom.Paper.node.insertBefore(e,t.dom.elGraphical.node)}},{key:"toggleDataSeries",value:function(t,e){var n=this,l=this.w;if(l.globals.axisCharts||"radialBar"===l.config.chart.type){l.globals.resized=!0;var a=null,i=null;l.globals.risingSeries=[],l.globals.axisCharts?(a=l.globals.dom.baseEl.querySelector(".apexcharts-series[data\\:realIndex='".concat(t,"']")),i=parseInt(a.getAttribute("data:realIndex"),10)):(a=l.globals.dom.baseEl.querySelector(".apexcharts-series[rel='".concat(t+1,"']")),i=parseInt(a.getAttribute("rel"),10)-1),e?[{cs:l.globals.collapsedSeries,csi:l.globals.collapsedSeriesIndices},{cs:l.globals.ancillaryCollapsedSeries,csi:l.globals.ancillaryCollapsedSeriesIndices}].forEach((function(t){n.riseCollapsedSeries(t.cs,t.csi,i)})):this.hideSeries({seriesEl:a,realIndex:i})}else{var r=l.globals.dom.Paper.select(" .apexcharts-series[rel='".concat(t+1,"'] path")),o=l.config.chart.type;if("pie"===o||"polarArea"===o||"donut"===o){var s=l.config.plotOptions.pie.donut.labels;new w(this.lgCtx.ctx).pathMouseDown(r.members[0],null),this.lgCtx.ctx.pie.printDataLabelsInner(r.members[0].node,s)}r.fire("click")}}},{key:"hideSeries",value:function(t){var e=t.seriesEl,n=t.realIndex,l=this.w,a=y.clone(l.config.series);if(l.globals.axisCharts){var i=!1;if(l.config.yaxis[n]&&l.config.yaxis[n].show&&l.config.yaxis[n].showAlways&&(i=!0,l.globals.ancillaryCollapsedSeriesIndices.indexOf(n)<0&&(l.globals.ancillaryCollapsedSeries.push({index:n,data:a[n].data.slice(),type:e.parentNode.className.baseVal.split("-")[1]}),l.globals.ancillaryCollapsedSeriesIndices.push(n))),!i){l.globals.collapsedSeries.push({index:n,data:a[n].data.slice(),type:e.parentNode.className.baseVal.split("-")[1]}),l.globals.collapsedSeriesIndices.push(n);var r=l.globals.risingSeries.indexOf(n);l.globals.risingSeries.splice(r,1)}}else l.globals.collapsedSeries.push({index:n,data:a[n]}),l.globals.collapsedSeriesIndices.push(n);for(var o=e.childNodes,s=0;s0){for(var i=0;i-1&&(t[l].data=[])})):t.forEach((function(n,l){e.globals.collapsedSeriesIndices.indexOf(l)>-1&&(t[l]=0)})),t}}]),t}(),pt=function(){function t(e,n){i(this,t),this.ctx=e,this.w=e.w,this.onLegendClick=this.onLegendClick.bind(this),this.onLegendHovered=this.onLegendHovered.bind(this),this.isBarsDistributed="bar"===this.w.config.chart.type&&this.w.config.plotOptions.bar.distributed&&1===this.w.config.series.length,this.legendHelpers=new ht(this)}return o(t,[{key:"init",value:function(){var t=this.w,e=t.globals,n=t.config;if((n.legend.showForSingleSeries&&1===e.series.length||this.isBarsDistributed||e.series.length>1||!e.axisCharts)&&n.legend.show){for(;e.dom.elLegendWrap.firstChild;)e.dom.elLegendWrap.removeChild(e.dom.elLegendWrap.firstChild);this.drawLegends(),y.isIE11()?document.getElementsByTagName("head")[0].appendChild(this.legendHelpers.getLegendStyles()):this.legendHelpers.appendToForeignObject(),"bottom"===n.legend.position||"top"===n.legend.position?this.legendAlignHorizontal():"right"!==n.legend.position&&"left"!==n.legend.position||this.legendAlignVertical()}}},{key:"drawLegends",value:function(){var t=this.w,e=t.config.legend.fontFamily,n=t.globals.seriesNames,l=t.globals.colors.slice();if("heatmap"===t.config.chart.type){var a=t.config.plotOptions.heatmap.colorScale.ranges;n=a.map((function(t){return t.name?t.name:t.from+" - "+t.to})),l=a.map((function(t){return t.color}))}else this.isBarsDistributed&&(n=t.globals.labels.slice());for(var i=t.globals.legendFormatter,r=t.config.legend.inverseOrder,o=r?n.length-1:0;r?o>=0:o<=n.length-1;r?o--:o++){var s=i(n[o],{seriesIndex:o,w:t}),c=!1,d=!1;if(t.globals.collapsedSeries.length>0)for(var u=0;u0)for(var h=0;h0?s-10:0)+(c>0?c-10:0)}l.style.position="absolute",i=i+t+n.config.legend.offsetX,r=r+e+n.config.legend.offsetY,l.style.left=i+"px",l.style.top=r+"px","bottom"===n.config.legend.position?(l.style.top="auto",l.style.bottom=5-n.config.legend.offsetY+"px"):"right"===n.config.legend.position&&(l.style.left="auto",l.style.right=25+n.config.legend.offsetX+"px"),["width","height"].forEach((function(t){l.style[t]&&(l.style[t]=parseInt(n.config.legend[t],10)+"px")}))}},{key:"legendAlignHorizontal",value:function(){var t=this.w;t.globals.dom.baseEl.querySelector(".apexcharts-legend").style.right=0;var e=this.legendHelpers.getLegendBBox(),n=new ut(this.ctx),l=n.dimHelpers.getTitleSubtitleCoords("title"),a=n.dimHelpers.getTitleSubtitleCoords("subtitle"),i=0;"bottom"===t.config.legend.position?i=-e.clwh/1.8:"top"===t.config.legend.position&&(i=l.height+a.height+t.config.title.margin+t.config.subtitle.margin-10),this.setLegendWrapXY(20,i)}},{key:"legendAlignVertical",value:function(){var t=this.w,e=this.legendHelpers.getLegendBBox(),n=0;"left"===t.config.legend.position&&(n=20),"right"===t.config.legend.position&&(n=t.globals.svgWidth-e.clww-10),this.setLegendWrapXY(n,20)}},{key:"onLegendHovered",value:function(t){var e=this.w,n=t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker");if("heatmap"===e.config.chart.type||this.isBarsDistributed){if(n){var l=parseInt(t.target.getAttribute("rel"),10)-1;this.ctx.events.fireEvent("legendHover",[this.ctx,l,this.w]),new N(this.ctx).highlightRangeInSeries(t,t.target)}}else!t.target.classList.contains("apexcharts-inactive-legend")&&n&&new N(this.ctx).toggleSeriesOnHover(t,t.target)}},{key:"onLegendClick",value:function(t){if(t.target.classList.contains("apexcharts-legend-text")||t.target.classList.contains("apexcharts-legend-marker")){var e=parseInt(t.target.getAttribute("rel"),10)-1,n="true"===t.target.getAttribute("data:collapsed"),l=this.w.config.chart.events.legendClick;"function"==typeof l&&l(this.ctx,e,this.w),this.ctx.events.fireEvent("legendClick",[this.ctx,e,this.w]);var a=this.w.config.legend.markers.onClick;"function"==typeof a&&t.target.classList.contains("apexcharts-legend-marker")&&(a(this.ctx,e,this.w),this.ctx.events.fireEvent("legendMarkerClick",[this.ctx,e,this.w])),this.legendHelpers.toggleDataSeries(e,n)}}}]),t}(),ft=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.ev=this.w.config.chart.events,this.selectedClass="apexcharts-selected",this.localeValues=this.w.globals.locale.toolbar}return o(t,[{key:"createToolbar",value:function(){var t=this,e=this.w,n=function(){return document.createElement("div")},l=n();if(l.setAttribute("class","apexcharts-toolbar"),l.style.top=e.config.chart.toolbar.offsetY+"px",l.style.right=3-e.config.chart.toolbar.offsetX+"px",e.globals.dom.elWrap.appendChild(l),this.elZoom=n(),this.elZoomIn=n(),this.elZoomOut=n(),this.elPan=n(),this.elSelection=n(),this.elZoomReset=n(),this.elMenuIcon=n(),this.elMenu=n(),this.elCustomIcons=[],this.t=e.config.chart.toolbar.tools,Array.isArray(this.t.customIcons))for(var a=0;a\n \n \n\n'),r("zoomOut",this.elZoomOut,'\n \n \n\n');var o=function(n){t.t[n]&&e.config.chart[n].enabled&&i.push({el:"zoom"===n?t.elZoom:t.elSelection,icon:"string"==typeof t.t[n]?t.t[n]:"zoom"===n?'\n \n \n \n':'\n \n \n',title:t.localeValues["zoom"===n?"selectionZoom":"selection"],class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-".concat(n,"-icon")})};o("zoom"),o("selection"),this.t.pan&&e.config.chart.zoom.enabled&&i.push({el:this.elPan,icon:"string"==typeof this.t.pan?this.t.pan:'\n \n \n \n \n \n \n \n',title:this.localeValues.pan,class:e.globals.isTouchDevice?"apexcharts-element-hidden":"apexcharts-pan-icon"}),r("reset",this.elZoomReset,'\n \n \n'),this.t.download&&i.push({el:this.elMenuIcon,icon:"string"==typeof this.t.download?this.t.download:'',title:this.localeValues.menu,class:"apexcharts-menu-icon"});for(var s=0;s0&&e.height>0&&this.slDraggableRect.selectize({points:"l, r",pointSize:8,pointType:"rect"}).resize({constraint:{minX:0,minY:0,maxX:t.globals.gridWidth,maxY:t.globals.gridHeight}}).on("resizing",this.selectionDragging.bind(this,"resizing"))}}},{key:"preselectedSelection",value:function(){var t=this.w,e=this.xyRatios;if(!t.globals.zoomEnabled)if(void 0!==t.globals.selection&&null!==t.globals.selection)this.drawSelectionRect(t.globals.selection);else if(void 0!==t.config.chart.selection.xaxis.min&&void 0!==t.config.chart.selection.xaxis.max){var n=(t.config.chart.selection.xaxis.min-t.globals.minX)/e.xRatio,l={x:n,y:0,width:t.globals.gridWidth-(t.globals.maxX-t.config.chart.selection.xaxis.max)/e.xRatio-n,height:t.globals.gridHeight,translateX:0,translateY:0,selectionEnabled:!0};this.drawSelectionRect(l),this.makeSelectionRectDraggable(),"function"==typeof t.config.chart.events.selection&&t.config.chart.events.selection(this.ctx,{xaxis:{min:t.config.chart.selection.xaxis.min,max:t.config.chart.selection.xaxis.max},yaxis:{}})}}},{key:"drawSelectionRect",value:function(t){var e=t.x,n=t.y,l=t.width,a=t.height,i=t.translateX,r=void 0===i?0:i,o=t.translateY,s=void 0===o?0:o,c=this.w,d=this.zoomRect,u=this.selectionRect;if(this.dragged||null!==c.globals.selection){var h={transform:"translate("+r+", "+s+")"};c.globals.zoomEnabled&&this.dragged&&(l<0&&(l=1),d.attr({x:e,y:n,width:l,height:a,fill:c.config.chart.zoom.zoomedArea.fill.color,"fill-opacity":c.config.chart.zoom.zoomedArea.fill.opacity,stroke:c.config.chart.zoom.zoomedArea.stroke.color,"stroke-width":c.config.chart.zoom.zoomedArea.stroke.width,"stroke-opacity":c.config.chart.zoom.zoomedArea.stroke.opacity}),w.setAttrs(d.node,h)),c.globals.selectionEnabled&&(u.attr({x:e,y:n,width:l>0?l:0,height:a>0?a:0,fill:c.config.chart.selection.fill.color,"fill-opacity":c.config.chart.selection.fill.opacity,stroke:c.config.chart.selection.stroke.color,"stroke-width":c.config.chart.selection.stroke.width,"stroke-dasharray":c.config.chart.selection.stroke.dashArray,"stroke-opacity":c.config.chart.selection.stroke.opacity}),w.setAttrs(u.node,h))}}},{key:"hideSelectionRect",value:function(t){t&&t.attr({x:0,y:0,width:0,height:0})}},{key:"selectionDrawing",value:function(t){var e,n=t.context,l=t.zoomtype,a=this.w,i=n,r=this.gridRect.getBoundingClientRect(),o=i.startX-1,s=i.startY,c=!1,d=!1,u=i.clientX-r.left-o,h=i.clientY-r.top-s;return Math.abs(u+o)>a.globals.gridWidth?u=a.globals.gridWidth-o:i.clientX-r.left<0&&(u=o),o>i.clientX-r.left&&(c=!0,u=Math.abs(u)),s>i.clientY-r.top&&(d=!0,h=Math.abs(h)),e="x"===l?{x:c?o-u:o,y:0,width:u,height:a.globals.gridHeight}:"y"===l?{x:0,y:d?s-h:s,width:a.globals.gridWidth,height:h}:{x:c?o-u:o,y:d?s-h:s,width:u,height:h},i.drawSelectionRect(e),i.selectionDragging("resizing"),e}},{key:"selectionDragging",value:function(t,e){var n=this,l=this.w,a=this.xyRatios,i=this.selectionRect,r=0;"resizing"===t&&(r=30);var o=function(t){return parseFloat(i.node.getAttribute(t))},s={x:o("x"),y:o("y"),width:o("width"),height:o("height")};l.globals.selection=s,"function"==typeof l.config.chart.events.selection&&l.globals.selectionEnabled&&(clearTimeout(this.w.globals.selectionResizeTimer),this.w.globals.selectionResizeTimer=window.setTimeout((function(){var t=n.gridRect.getBoundingClientRect(),e=i.node.getBoundingClientRect(),r=l.globals.xAxisScale.niceMin+(e.left-t.left)*a.xRatio,o=l.globals.xAxisScale.niceMin+(e.right-t.left)*a.xRatio,s=l.globals.yAxisScale[0].niceMin+(t.bottom-e.bottom)*a.yRatio[0],c=l.globals.yAxisScale[0].niceMax-(e.top-t.top)*a.yRatio[0];l.config.chart.events.selection(n.ctx,{xaxis:{min:r,max:o},yaxis:{min:s,max:c}})}),r))}},{key:"selectionDrawn",value:function(t){var e=t.context,n=t.zoomtype,l=this.w,a=e,i=this.xyRatios,r=this.ctx.toolbar;if(a.startX>a.endX){var o=a.startX;a.startX=a.endX,a.endX=o}if(a.startY>a.endY){var s=a.startY;a.startY=a.endY,a.endY=s}var c=l.globals.xAxisScale.niceMin+a.startX*i.xRatio,d=l.globals.xAxisScale.niceMin+a.endX*i.xRatio,u=[],h=[];if(l.config.yaxis.forEach((function(t,e){u.push(l.globals.yAxisScale[e].niceMax-i.yRatio[e]*a.startY),h.push(l.globals.yAxisScale[e].niceMax-i.yRatio[e]*a.endY)})),a.dragged&&(a.dragX>10||a.dragY>10)&&c!==d)if(l.globals.zoomEnabled){var p=y.clone(l.globals.initialConfig.yaxis),f=y.clone(l.globals.initialConfig.xaxis);if(l.globals.zoomed=!0,l.config.xaxis.convertedCatToNumeric&&(c=Math.floor(c),d=Math.floor(d),c<1&&(c=1,d=l.globals.dataPoints),d-c<2&&(d=c+1)),"xy"!==n&&"x"!==n||(f={min:c,max:d}),"xy"!==n&&"y"!==n||p.forEach((function(t,e){p[e].min=h[e],p[e].max=u[e]})),l.config.chart.zoom.autoScaleYaxis){var g=new K(a.ctx);p=g.autoScaleY(a.ctx,p,{xaxis:f})}if(r){var m=r.getBeforeZoomRange(f,p);m&&(f=m.xaxis?m.xaxis:f,p=m.yaxis?m.yaxis:p)}var v={xaxis:f};l.config.chart.group||(v.yaxis=p),a.ctx.updateHelpers._updateOptions(v,!1,a.w.config.chart.animations.dynamicAnimation.enabled),"function"==typeof l.config.chart.events.zoomed&&r.zoomCallback(f,p)}else if(l.globals.selectionEnabled){var b,x=null;b={min:c,max:d},"xy"!==n&&"y"!==n||(x=y.clone(l.config.yaxis)).forEach((function(t,e){x[e].min=h[e],x[e].max=u[e]})),l.globals.selection=a.selection,"function"==typeof l.config.chart.events.selection&&l.config.chart.events.selection(a.ctx,{xaxis:b,yaxis:x})}}},{key:"panDragging",value:function(t){var e=t.context,n=this.w,l=e;if(void 0!==n.globals.lastClientPosition.x){var a=n.globals.lastClientPosition.x-l.clientX,i=n.globals.lastClientPosition.y-l.clientY;Math.abs(a)>Math.abs(i)&&a>0?this.moveDirection="left":Math.abs(a)>Math.abs(i)&&a<0?this.moveDirection="right":Math.abs(i)>Math.abs(a)&&i>0?this.moveDirection="up":Math.abs(i)>Math.abs(a)&&i<0&&(this.moveDirection="down")}n.globals.lastClientPosition={x:l.clientX,y:l.clientY};var r=n.globals.minX,o=n.globals.maxX;n.config.xaxis.convertedCatToNumeric||l.panScrolled(r,o)}},{key:"delayedPanScrolled",value:function(){var t=this.w,e=t.globals.minX,n=t.globals.maxX,l=(t.globals.maxX-t.globals.minX)/2;"left"===this.moveDirection?(e=t.globals.minX+l,n=t.globals.maxX+l):"right"===this.moveDirection&&(e=t.globals.minX-l,n=t.globals.maxX-l),e=Math.floor(e),n=Math.floor(n),this.updateScrolledChart({xaxis:{min:e,max:n}},e,n)}},{key:"panScrolled",value:function(t,e){var n=this.w,l=this.xyRatios,a=y.clone(n.globals.initialConfig.yaxis);"left"===this.moveDirection?(t=n.globals.minX+n.globals.gridWidth/15*l.xRatio,e=n.globals.maxX+n.globals.gridWidth/15*l.xRatio):"right"===this.moveDirection&&(t=n.globals.minX-n.globals.gridWidth/15*l.xRatio,e=n.globals.maxX-n.globals.gridWidth/15*l.xRatio),(tn.globals.initialMaxX)&&(t=n.globals.minX,e=n.globals.maxX);var i={min:t,max:e};n.config.chart.zoom.autoScaleYaxis&&(a=new K(this.ctx).autoScaleY(this.ctx,a,{xaxis:i}));var r={xaxis:{min:t,max:e}};n.config.chart.group||(r.yaxis=a),this.updateScrolledChart(r,t,e)}},{key:"updateScrolledChart",value:function(t,e,n){var l=this.w;this.ctx.updateHelpers._updateOptions(t,!1,!1),"function"==typeof l.config.chart.events.scrolled&&l.config.chart.events.scrolled(this.ctx,{xaxis:{min:e,max:n}})}}]),n}(),mt=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx}return o(t,[{key:"getNearestValues",value:function(t){var e=t.hoverArea,n=t.elGrid,l=t.clientX,a=t.clientY,i=this.w,r=i.globals.gridWidth,o=r/(i.globals.dataPoints-1),s=n.getBoundingClientRect(),c=this.hasBars();!i.globals.comboCharts&&!c||i.config.xaxis.convertedCatToNumeric||(o=r/i.globals.dataPoints);var d=l-s.left-i.globals.barPadForNumericAxis,u=a-s.top;d<0||u<0||d>i.globals.gridWidth||u>i.globals.gridHeight?(e.classList.remove("hovering-zoom"),e.classList.remove("hovering-pan")):i.globals.zoomEnabled?(e.classList.remove("hovering-pan"),e.classList.add("hovering-zoom")):i.globals.panEnabled&&(e.classList.remove("hovering-zoom"),e.classList.add("hovering-pan"));var h=Math.round(d/o);c&&!i.config.xaxis.convertedCatToNumeric&&(h=Math.ceil(d/o),h-=1);for(var p,f=null,g=null,m=[],v=0;v1?i=this.getFirstActiveXArray(n):r=0;var s=l[i][0],c=n[i][0],d=Math.abs(t-c),u=Math.abs(e-s),h=u+d;return l.map((function(a,i){a.map((function(a,s){var c=Math.abs(e-l[i][s]),p=Math.abs(t-n[i][s]),f=p+c;f0?e:-1})),l=0;l0)for(var l=0;l0}},{key:"getElBars",value:function(){return this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-bar-series, .apexcharts-candlestick-series, .apexcharts-rangebar-series")}},{key:"hasBars",value:function(){return this.getElBars().length>0}},{key:"getHoverMarkerSize",value:function(t){var e=this.w,n=e.config.markers.hover.size;return void 0===n&&(n=e.globals.markers.size[t]+e.config.markers.hover.sizeOffset),n}},{key:"toggleAllTooltipSeriesGroups",value:function(t){var e=this.w,n=this.ttCtx;0===n.allTooltipSeriesGroups.length&&(n.allTooltipSeriesGroups=e.globals.dom.baseEl.querySelectorAll(".apexcharts-tooltip-series-group"));for(var l=n.allTooltipSeriesGroups,a=0;a-1?p[0].parentNode.style.display="none":p[0].parentNode.style.display=o.config.tooltip.items.display)}},{key:"toggleActiveInactiveSeries",value:function(t){var e=this.w;if(t)this.tooltipUtil.toggleAllTooltipSeriesGroups("enable");else{this.tooltipUtil.toggleAllTooltipSeriesGroups("disable");var n=e.globals.dom.baseEl.querySelector(".apexcharts-tooltip-series-group");n&&(n.classList.add("apexcharts-active"),n.style.display=e.config.tooltip.items.display)}}},{key:"getValuesToPrint",value:function(t){var e=t.i,n=t.j,l=this.w,a=this.ctx.series.filteredSeriesX(),i="",r="",o=null,s=null,c={series:l.globals.series,seriesIndex:e,dataPointIndex:n,w:l},d=l.globals.ttZFormatter;null===n?s=l.globals.series[e]:l.globals.isXNumeric?(i=a[e][n],0===a[e].length&&(i=a[this.tooltipUtil.getFirstActiveXArray(a)][n])):i=void 0!==l.globals.labels[n]?l.globals.labels[n]:"";var u=i;return l.globals.isXNumeric&&"datetime"===l.config.xaxis.type?i=new V(this.ctx).xLabelFormat(l.globals.ttKeyFormatter,u,u):l.globals.isBarHorizontal||(i=l.globals.xLabelFormatter(u,c)),void 0!==l.config.tooltip.x.formatter&&(i=l.globals.ttKeyFormatter(u,c)),l.globals.seriesZ.length>0&&l.globals.seriesZ[0].length>0&&(o=d(l.globals.seriesZ[e][n],l)),r="function"==typeof l.config.xaxis.tooltip.formatter?l.globals.xaxisTooltipFormatter(u,c):i,{val:Array.isArray(s)?s.join(" "):s,xVal:Array.isArray(i)?i.join(" "):i,xAxisTTVal:Array.isArray(r)?r.join(" "):r,zVal:o}}},{key:"handleCustomTooltip",value:function(t){var e=t.i,n=t.j,l=t.y1,a=t.y2,i=t.w,r=this.ttCtx.getElTooltip(),o=i.config.tooltip.custom;Array.isArray(o)&&o[e]&&(o=o[e]),r.innerHTML=o({ctx:this.ctx,series:i.globals.series,seriesIndex:e,dataPointIndex:n,y1:l,y2:a,w:i})}}]),t}(),bt=function(){function t(e){i(this,t),this.ttCtx=e,this.ctx=e.ctx,this.w=e.w}return o(t,[{key:"moveXCrosshairs",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=this.ttCtx,l=this.w,a=n.getElXCrosshairs(),i=t-n.xcrosshairsWidth/2,r=l.globals.labels.slice().length;if(null!==e&&(i=l.globals.gridWidth/r*e),null!==a&&(a.setAttribute("x",i),a.setAttribute("x1",i),a.setAttribute("x2",i),a.setAttribute("y2",l.globals.gridHeight),a.classList.add("apexcharts-active")),i<0&&(i=0),i>l.globals.gridWidth&&(i=l.globals.gridWidth),n.blxaxisTooltip){var o=i;"tickWidth"!==l.config.xaxis.crosshairs.width&&"barWidth"!==l.config.xaxis.crosshairs.width||(o=i+n.xcrosshairsWidth/2),this.moveXAxisTooltip(o)}}},{key:"moveYCrosshairs",value:function(t){var e=this.ttCtx;null!==e.ycrosshairs&&w.setAttrs(e.ycrosshairs,{y1:t,y2:t}),null!==e.ycrosshairsHidden&&w.setAttrs(e.ycrosshairsHidden,{y1:t,y2:t})}},{key:"moveXAxisTooltip",value:function(t){var e=this.w,n=this.ttCtx;if(null!==n.xaxisTooltip){n.xaxisTooltip.classList.add("apexcharts-active");var l,a=n.xaxisOffY+e.config.xaxis.tooltip.offsetY+e.globals.translateY+1+e.config.xaxis.offsetY;if(t-=n.xaxisTooltip.getBoundingClientRect().width/2,!isNaN(t))t+=e.globals.translateX,l=new w(this.ctx).getTextRects(n.xaxisTooltipText.innerHTML),n.xaxisTooltipText.style.minWidth=l.width+"px",n.xaxisTooltip.style.left=t+"px",n.xaxisTooltip.style.top=a+"px"}}},{key:"moveYAxisTooltip",value:function(t){var e=this.w,n=this.ttCtx;null===n.yaxisTTEls&&(n.yaxisTTEls=e.globals.dom.baseEl.querySelectorAll(".apexcharts-yaxistooltip"));var l=parseInt(n.ycrosshairsHidden.getAttribute("y1"),10),a=e.globals.translateY+l,i=n.yaxisTTEls[t].getBoundingClientRect().height,r=e.globals.translateYAxisX[t]-2;e.config.yaxis[t].opposite&&(r-=26),a-=i/2,-1===e.globals.ignoreYAxisIndexes.indexOf(t)?(n.yaxisTTEls[t].classList.add("apexcharts-active"),n.yaxisTTEls[t].style.top=a+"px",n.yaxisTTEls[t].style.left=r+e.config.yaxis[t].tooltip.offsetX+"px"):n.yaxisTTEls[t].classList.remove("apexcharts-active")}},{key:"moveTooltip",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,l=this.w,a=this.ttCtx,i=a.getElTooltip(),r=a.tooltipRect,o=null!==n?parseFloat(n):1,s=parseFloat(t)+o+5,c=parseFloat(e)+o/2;if(s>l.globals.gridWidth/2&&(s=s-r.ttWidth-o-15),s>l.globals.gridWidth-r.ttWidth-10&&(s=l.globals.gridWidth-r.ttWidth),s<-20&&(s=-20),l.config.tooltip.followCursor){var d=a.getElGrid(),u=d.getBoundingClientRect();c=a.e.clientY+l.globals.translateY-u.top-r.ttHeight/2}if(!l.config.tooltip.followCursor){var h=this.positionChecks(r,s,c);s=h.x,c=h.y}isNaN(s)||(s+=l.globals.translateX,i.style.left=s+"px",i.style.top=c+"px")}},{key:"positionChecks",value:function(t,e,n){var l=this.w;return t.ttHeight/2+n>l.globals.gridHeight&&(n=l.globals.gridHeight-t.ttHeight+l.globals.translateY),n<0&&(n=0),{x:e,y:n}}},{key:"moveMarkers",value:function(t,e){var n=this.w,l=this.ttCtx;if(n.globals.markers.size[t]>0)for(var a=n.globals.dom.baseEl.querySelectorAll(" .apexcharts-series[data\\:realIndex='".concat(t,"'] .apexcharts-marker")),i=0;i0&&(c.setAttribute("r",o),c.setAttribute("cx",n),c.setAttribute("cy",l)),this.moveXCrosshairs(n),i.fixedTooltip||this.moveTooltip(n,l,o)}}},{key:"moveDynamicPointsOnHover",value:function(t){var e,n=this.ttCtx,l=n.w,a=0,i=0,r=l.globals.pointsArray;e=new N(this.ctx).getActiveConfigSeriesIndex(!0);var o=n.tooltipUtil.getHoverMarkerSize(e);r[e]&&(a=r[e][t][0],i=r[e][t][1]);var s=n.tooltipUtil.getAllMarkers();if(null!==s)for(var c=0;c0?(s[c]&&s[c].setAttribute("r",o),s[c]&&s[c].setAttribute("cy",u)):s[c]&&s[c].setAttribute("r",0)}}if(this.moveXCrosshairs(a),!n.fixedTooltip){var h=i||l.globals.gridHeight;this.moveTooltip(a,h,o)}}},{key:"moveStickyTooltipOverBars",value:function(t){var e,n=this.w,l=this.ttCtx,a=n.globals.columnSeries?n.globals.columnSeries.length:n.globals.series.length,i=a>=2&&a%2==0?Math.floor(a/2):Math.floor(a/2)+1,r=n.globals.dom.baseEl.querySelector(".apexcharts-bar-series .apexcharts-series[rel='".concat(i,"'] path[j='").concat(t,"'], .apexcharts-candlestick-series .apexcharts-series[rel='").concat(i,"'] path[j='").concat(t,"'], .apexcharts-rangebar-series .apexcharts-series[rel='").concat(i,"'] path[j='").concat(t,"']")),o=r?parseFloat(r.getAttribute("cx")):0,s=r?parseFloat(r.getAttribute("barWidth")):0;n.globals.isXNumeric?o-=a%2!=0?s/2:0:(o=l.xAxisTicksPositions[t-1]+l.dataPointsDividedWidth/2,isNaN(o)&&(o=l.xAxisTicksPositions[t]-l.dataPointsDividedWidth/2));var c=l.getElGrid().getBoundingClientRect();if(e=l.e.clientY-c.top-l.tooltipRect.ttHeight/2,this.moveXCrosshairs(o),!l.fixedTooltip){var d=e||n.globals.gridHeight;this.moveTooltip(o,d)}}}]),t}(),yt=function(){function t(e){i(this,t),this.w=e.w,this.ttCtx=e,this.ctx=e.ctx,this.tooltipPosition=new bt(e)}return o(t,[{key:"drawDynamicPoints",value:function(){var t=this.w,e=new w(this.ctx),n=new R(this.ctx),l=t.globals.dom.baseEl.querySelectorAll(".apexcharts-series");l=g(l),t.config.chart.stacked&&l.sort((function(t,e){return parseFloat(t.getAttribute("data:realIndex"))-parseFloat(e.getAttribute("data:realIndex"))}));for(var a=0;a2&&void 0!==arguments[2]?arguments[2]:null,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,a=this.w;"bubble"!==a.config.chart.type&&this.newPointSize(t,e);var i=e.getAttribute("cx"),r=e.getAttribute("cy");if(null!==n&&null!==l&&(i=n,r=l),this.tooltipPosition.moveXCrosshairs(i),!this.fixedTooltip){if("radar"===a.config.chart.type){var o=this.ttCtx.getElGrid(),s=o.getBoundingClientRect();i=this.ttCtx.e.clientX-s.left}this.tooltipPosition.moveTooltip(i,r,a.config.markers.hover.size)}}},{key:"enlargePoints",value:function(t){for(var e=this.w,n=this.ttCtx,l=t,a=e.globals.dom.baseEl.querySelectorAll(".apexcharts-series:not(.apexcharts-series-collapsed) .apexcharts-marker"),i=e.config.markers.hover.size,r=0;rr.globals.gridWidth/2&&(l=c-i.tooltipRect.ttWidth/2+u),i.w.config.tooltip.followCursor){var p=i.getElGrid().getBoundingClientRect();a=i.e.clientY-p.top+r.globals.translateY/2-10}}return{x:l,y:a}}},{key:"handleMarkerTooltip",value:function(t){var e,n,l=t.e,a=t.opt,i=t.x,r=t.y,o=this.w,s=this.ttCtx;if(l.target.classList.contains("apexcharts-marker")){var c=parseInt(a.paths.getAttribute("cx"),10),d=parseInt(a.paths.getAttribute("cy"),10),u=parseFloat(a.paths.getAttribute("val"));if(n=parseInt(a.paths.getAttribute("rel"),10),e=parseInt(a.paths.parentNode.parentNode.parentNode.getAttribute("rel"),10)-1,s.intersect){var h=y.findAncestor(a.paths,"apexcharts-series");h&&(e=parseInt(h.getAttribute("data:realIndex"),10))}if(s.tooltipLabels.drawSeriesTexts({ttItems:a.ttItems,i:e,j:n,shared:!s.showOnIntersect&&o.config.tooltip.shared}),"mouseup"===l.type&&s.markerClick(l,e,n),o.globals.capturedSeriesIndex=e,o.globals.capturedDataPointIndex=n,i=c,r=d+o.globals.translateY-1.4*s.tooltipRect.ttHeight,s.w.config.tooltip.followCursor){var p=s.getElGrid().getBoundingClientRect();r=s.e.clientY+o.globals.translateY-p.top}u<0&&(r=d),s.marker.enlargeCurrentPoint(n,a.paths,i,r)}return{x:i,y:r}}},{key:"handleBarTooltip",value:function(t){var e,n,l=t.e,a=t.opt,i=this.w,r=this.ttCtx,o=r.getElTooltip(),s=0,c=0,d=0,u=this.getBarTooltipXY({e:l,opt:a});e=u.i;var h=u.barHeight,p=u.j;if(i.globals.capturedSeriesIndex=e,i.globals.capturedDataPointIndex=p,i.globals.isBarHorizontal&&r.tooltipUtil.hasBars()||!i.config.tooltip.shared?(c=u.x,d=u.y,n=Array.isArray(i.config.stroke.width)?i.config.stroke.width[e]:i.config.stroke.width,s=c):i.globals.comboCharts||i.config.tooltip.shared||(s/=2),isNaN(d)?d=i.globals.svgHeight-r.tooltipRect.ttHeight:d<0&&(d=0),c+r.tooltipRect.ttWidth>i.globals.gridWidth?c-=r.tooltipRect.ttWidth:c<0&&(c=0),r.w.config.tooltip.followCursor){var f=r.getElGrid().getBoundingClientRect();d=r.e.clientY-f.top}if(null===r.tooltip&&(r.tooltip=i.globals.dom.baseEl.querySelector(".apexcharts-tooltip")),i.config.tooltip.shared||(i.globals.comboBarCount>0?r.tooltipPosition.moveXCrosshairs(s+n/2):r.tooltipPosition.moveXCrosshairs(s)),!r.fixedTooltip&&(!i.config.tooltip.shared||i.globals.isBarHorizontal&&r.tooltipUtil.hasBars())){var g=i.globals.isMultipleYAxis?i.config.yaxis[m]&&i.config.yaxis[m].reversed:i.config.yaxis[0].reversed;g&&(c-=r.tooltipRect.ttWidth)<0&&(c=0),o.style.left=c+i.globals.translateX+"px";var m=parseInt(a.paths.parentNode.getAttribute("data:realIndex"),10);!g||i.globals.isBarHorizontal&&r.tooltipUtil.hasBars()||(d=d+h-2*(i.globals.series[e][p]<0?h:0)),r.tooltipRect.ttHeight+d>i.globals.gridHeight?(d=i.globals.gridHeight-r.tooltipRect.ttHeight+i.globals.translateY,o.style.top=d+"px"):o.style.top=d+i.globals.translateY-r.tooltipRect.ttHeight/2+"px"}}},{key:"getBarTooltipXY",value:function(t){var e=t.e,n=t.opt,l=this.w,a=null,i=this.ttCtx,r=0,o=0,s=0,c=0,d=0,u=e.target.classList;if(u.contains("apexcharts-bar-area")||u.contains("apexcharts-candlestick-area")||u.contains("apexcharts-rangebar-area")){var h=e.target,p=h.getBoundingClientRect(),f=n.elGrid.getBoundingClientRect(),g=p.height;d=p.height;var m=p.width,v=parseInt(h.getAttribute("cx"),10),b=parseInt(h.getAttribute("cy"),10);c=parseFloat(h.getAttribute("barWidth"));var y="touchmove"===e.type?e.touches[0].clientX:e.clientX;a=parseInt(h.getAttribute("j"),10),r=parseInt(h.parentNode.getAttribute("rel"),10)-1;var x=h.getAttribute("data-range-y1"),_=h.getAttribute("data-range-y2");l.globals.comboCharts&&(r=parseInt(h.parentNode.getAttribute("data:realIndex"),10)),i.tooltipLabels.drawSeriesTexts({ttItems:n.ttItems,i:r,j:a,y1:x?parseInt(x,10):null,y2:_?parseInt(_,10):null,shared:!i.showOnIntersect&&l.config.tooltip.shared}),l.config.tooltip.followCursor?l.globals.isBarHorizontal?(o=y-f.left+15,s=b-i.dataPointsDividedHeight+g/2-i.tooltipRect.ttHeight/2):(o=l.globals.isXNumeric?v-m/2:v-i.dataPointsDividedWidth+m/2,s=e.clientY-f.top-i.tooltipRect.ttHeight/2-15):l.globals.isBarHorizontal?((o=v)0&&n.setAttribute("width",e.xcrosshairsWidth)}},{key:"handleYCrosshair",value:function(){var t=this.w,e=this.ttCtx;e.ycrosshairs=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs"),e.ycrosshairsHidden=t.globals.dom.baseEl.querySelector(".apexcharts-ycrosshairs-hidden")}},{key:"drawYaxisTooltipText",value:function(t,e,n){var l=this.ttCtx,a=this.w,i=a.globals.yLabelFormatters[t];if(l.yaxisTooltips[t]){var r=l.getElGrid().getBoundingClientRect(),o=(e-r.top)*n.yRatio[t],s=a.globals.maxYArr[t]-a.globals.minYArr[t],c=a.globals.minYArr[t]+(s-o);l.tooltipPosition.moveYCrosshairs(e-r.top),l.yaxisTooltipText[t].innerHTML=i(c),l.tooltipPosition.moveYAxisTooltip(t)}}}]),t}(),wt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var n=this.w;this.tConfig=n.config.tooltip,this.tooltipUtil=new mt(this),this.tooltipLabels=new vt(this),this.tooltipPosition=new bt(this),this.marker=new yt(this),this.intersect=new xt(this),this.axesTooltip=new _t(this),this.showOnIntersect=this.tConfig.intersect,this.showTooltipTitle=this.tConfig.x.show,this.fixedTooltip=this.tConfig.fixed.enabled,this.xaxisTooltip=null,this.yaxisTTEls=null,this.isBarShared=!n.globals.isBarHorizontal&&this.tConfig.shared}return o(t,[{key:"getElTooltip",value:function(t){return t||(t=this),t.w.globals.dom.baseEl.querySelector(".apexcharts-tooltip")}},{key:"getElXCrosshairs",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-xcrosshairs")}},{key:"getElGrid",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-grid")}},{key:"drawTooltip",value:function(t){var e=this.w;this.xyRatios=t,this.blxaxisTooltip=e.config.xaxis.tooltip.enabled&&e.globals.axisCharts,this.yaxisTooltips=e.config.yaxis.map((function(t,n){return!!(t.show&&t.tooltip.enabled&&e.globals.axisCharts)})),this.allTooltipSeriesGroups=[],e.globals.axisCharts||(this.showTooltipTitle=!1);var n=document.createElement("div");if(n.classList.add("apexcharts-tooltip"),n.classList.add("apexcharts-theme-".concat(this.tConfig.theme)),e.globals.dom.elWrap.appendChild(n),e.globals.axisCharts){this.axesTooltip.drawXaxisTooltip(),this.axesTooltip.drawYaxisTooltip(),this.axesTooltip.setXCrosshairWidth(),this.axesTooltip.handleYCrosshair();var l=new G(this.ctx);this.xAxisTicksPositions=l.getXAxisTicksPositions()}if(!e.globals.comboCharts&&!this.tConfig.intersect&&"bar"!==e.config.chart.type&&"rangeBar"!==e.config.chart.type||this.tConfig.shared||(this.showOnIntersect=!0),0!==e.config.markers.size&&0!==e.globals.markers.largestSize||this.marker.drawDynamicPoints(this),e.globals.collapsedSeries.length!==e.globals.series.length){this.dataPointsDividedHeight=e.globals.gridHeight/e.globals.dataPoints,this.dataPointsDividedWidth=e.globals.gridWidth/e.globals.dataPoints,this.showTooltipTitle&&(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.classList.add("apexcharts-tooltip-title"),this.tooltipTitle.style.fontFamily=this.tConfig.style.fontFamily||e.config.chart.fontFamily,this.tooltipTitle.style.fontSize=this.tConfig.style.fontSize,n.appendChild(this.tooltipTitle));var a=e.globals.series.length;(e.globals.xyCharts||e.globals.comboCharts)&&this.tConfig.shared&&(a=this.showOnIntersect?1:e.globals.series.length),this.legendLabels=e.globals.dom.baseEl.querySelectorAll(".apexcharts-legend-text"),this.ttItems=this.createTTElements(a),this.addSVGEvents()}}},{key:"createTTElements",value:function(t){for(var e=this.w,n=[],l=this.getElTooltip(),a=0;a0&&this.addPathsEventListeners(p,d),this.tooltipUtil.hasBars()&&!this.tConfig.shared&&this.addDatapointEventsListeners(d)}}},{key:"drawFixedTooltipRect",value:function(){var t=this.w,e=this.getElTooltip(),n=e.getBoundingClientRect(),l=n.width+10,a=n.height+10,i=this.tConfig.fixed.offsetX,r=this.tConfig.fixed.offsetY,o=this.tConfig.fixed.position.toLowerCase();return o.indexOf("right")>-1&&(i=i+t.globals.svgWidth-l+10),o.indexOf("bottom")>-1&&(r=r+t.globals.svgHeight-a-10),e.style.left=i+"px",e.style.top=r+"px",{x:i,y:r,ttWidth:l,ttHeight:a}}},{key:"addDatapointEventsListeners",value:function(t){var e=this.w.globals.dom.baseEl.querySelectorAll(".apexcharts-series-markers .apexcharts-marker, .apexcharts-bar-area, .apexcharts-candlestick-area, .apexcharts-rangebar-area");this.addPathsEventListeners(e,t)}},{key:"addPathsEventListeners",value:function(t,e){for(var n=this,l=function(l){var a={paths:t[l],tooltipEl:e.tooltipEl,tooltipY:e.tooltipY,tooltipX:e.tooltipX,elGrid:e.elGrid,hoverArea:e.hoverArea,ttItems:e.ttItems};["mousemove","mouseup","touchmove","mouseout","touchend"].map((function(e){return t[l].addEventListener(e,n.seriesHover.bind(n,a),{capture:!1,passive:!0})}))},a=0;ar.top+r.height)this.handleMouseOut(a);else{if(Array.isArray(this.tConfig.enabledOnSeries)&&!i.config.tooltip.shared){var c=parseInt(a.paths.getAttribute("index"),10);if(this.tConfig.enabledOnSeries.indexOf(c)<0)return void this.handleMouseOut(a)}var d=this.getElTooltip(),u=this.getElXCrosshairs(),h=i.globals.xyCharts||"bar"===i.config.chart.type&&!i.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&this.tConfig.shared||i.globals.comboCharts&&this.tooltipUtil.hasBars();if(i.globals.isBarHorizontal&&this.tooltipUtil.hasBars()&&(h=!1),"mousemove"===l.type||"touchmove"===l.type||"mouseup"===l.type){null!==u&&u.classList.add("apexcharts-active");var p=this.yaxisTooltips.filter((function(t){return!0===t}));if(null!==this.ycrosshairs&&p.length&&this.ycrosshairs.classList.add("apexcharts-active"),h&&!this.showOnIntersect)this.handleStickyTooltip(l,o,s,a);else if("heatmap"===i.config.chart.type){var f=this.intersect.handleHeatTooltip({e:l,opt:a,x:e,y:n});e=f.x,n=f.y,d.style.left=e+"px",d.style.top=n+"px"}else this.tooltipUtil.hasBars()&&this.intersect.handleBarTooltip({e:l,opt:a}),this.tooltipUtil.hasMarkers()&&this.intersect.handleMarkerTooltip({e:l,opt:a,x:e,y:n});if(this.yaxisTooltips.length)for(var g=0;ga.globals.gridWidth?this.handleMouseOut(l):null!==o?this.handleStickyCapturedSeries(t,o,l,r):this.tooltipUtil.isXoverlap(r)&&this.create(t,this,0,r,l.ttItems)}},{key:"handleStickyCapturedSeries",value:function(t,e,n,l){var a=this.w;null===a.globals.series[e][l]?this.handleMouseOut(n):void 0!==a.globals.series[e][l]?this.tConfig.shared&&this.tooltipUtil.isXoverlap(l)&&this.tooltipUtil.isInitialSeriesSameLen()?this.create(t,this,e,l,n.ttItems):this.create(t,this,e,l,n.ttItems,!1):this.tooltipUtil.isXoverlap(l)&&this.create(t,this,0,l,n.ttItems)}},{key:"deactivateHoverFilter",value:function(){for(var t=this.w,e=new w(this.ctx),n=t.globals.dom.Paper.select(".apexcharts-bar-area"),l=0;l5&&void 0!==arguments[5]?arguments[5]:null,r=this.w,o=e;"mouseup"===t.type&&this.markerClick(t,n,l),null===i&&(i=this.tConfig.shared);var s=this.tooltipUtil.hasMarkers(),c=this.tooltipUtil.getElBars();if(r.config.legend.tooltipHoverFormatter){var d=r.config.legend.tooltipHoverFormatter,u=Array.from(this.legendLabels);u.forEach((function(t){var e=t.getAttribute("data:default-text");t.innerHTML=decodeURIComponent(e)}));for(var h=0;h0?o.marker.enlargePoints(l):o.tooltipPosition.moveDynamicPointsOnHover(l)),this.tooltipUtil.hasBars()&&(this.barSeriesHeight=this.tooltipUtil.getBarsHeight(c),this.barSeriesHeight>0)){var v=new w(this.ctx),b=r.globals.dom.Paper.select(".apexcharts-bar-area[j='".concat(l,"']"));this.deactivateHoverFilter(),this.tooltipPosition.moveStickyTooltipOverBars(l);for(var y=0;y0&&(this.totalItems+=t[i].length);for(var r=this.graphics.group({class:"apexcharts-bar-series apexcharts-plot-series"}),o=0,s=0,c=function(a,i){var c=void 0,u=void 0,h=void 0,p=void 0,f=[],g=[],m=l.globals.comboCharts?e[a]:a;n.yRatio.length>1&&(n.yaxisIndex=m),n.isReversed=l.config.yaxis[n.yaxisIndex]&&l.config.yaxis[n.yaxisIndex].reversed;var v=n.graphics.group({class:"apexcharts-series",seriesName:y.escapeString(l.globals.seriesNames[m]),rel:a+1,"data:realIndex":m});n.ctx.series.addCollapsedClassToSeries(v,m);var b=n.graphics.group({class:"apexcharts-datalabels","data:realIndex":m}),x=0,_=0,w=n.initialPositions(o,s,c,u,h,p);s=w.y,x=w.barHeight,u=w.yDivision,p=w.zeroW,o=w.x,_=w.barWidth,c=w.xDivision,h=w.zeroH,n.yArrj=[],n.yArrjF=[],n.yArrjVal=[],n.xArrj=[],n.xArrjF=[],n.xArrjVal=[],1===n.prevY.length&&n.prevY[0].every((function(t){return isNaN(t)}))&&(n.prevY[0]=n.prevY[0].map((function(t){return h})),n.prevYF[0]=n.prevYF[0].map((function(t){return 0})));for(var S=0;S1?(n=s.globals.minXDiff/this.xRatio)*parseInt(this.barOptions.columnWidth,10)/100:o*parseInt(s.config.plotOptions.bar.columnWidth,10)/100,a=this.baseLineY[this.yaxisIndex]+(this.isReversed?s.globals.gridHeight:0)-(this.isReversed?2*this.baseLineY[this.yaxisIndex]:0),t=s.globals.padHorizontal+(n-o)/2),{x:t,y:e,yDivision:l,xDivision:n,barHeight:r,barWidth:o,zeroH:a,zeroW:i}}},{key:"drawStackedBarPaths",value:function(t){for(var e,n=t.indexes,l=t.barHeight,a=t.strokeWidth,i=t.zeroW,r=t.x,o=t.y,s=t.yDivision,c=t.elSeries,d=this.w,u=o,h=n.i,p=n.j,f=0,g=0;g0){var m=i;this.prevXVal[h-1][p]<0?m=this.series[h][p]>=0?this.prevX[h-1][p]+f-2*(this.isReversed?f:0):this.prevX[h-1][p]:this.prevXVal[h-1][p]>=0&&(m=this.series[h][p]>=0?this.prevX[h-1][p]:this.prevX[h-1][p]-f+2*(this.isReversed?f:0)),e=m}else e=i;r=null===this.series[h][p]?e:e+this.series[h][p]/this.invertedYRatio-2*(this.isReversed?this.series[h][p]/this.invertedYRatio:0),this.xArrj.push(r),this.xArrjF.push(Math.abs(e-r)),this.xArrjVal.push(this.series[h][p]);var v=this.barHelpers.getBarpaths({barYPosition:u,barHeight:l,x1:e,x2:r,strokeWidth:a,series:this.series,realIndex:n.realIndex,i:h,j:p,w:d});return this.barHelpers.barBackground({j:p,i:h,y1:u,y2:l,elSeries:c}),o+=s,{pathTo:v.pathTo,pathFrom:v.pathFrom,x:r,y:o}}},{key:"drawStackedColumnPaths",value:function(t){var e=t.indexes,n=t.x,l=t.y,a=t.xDivision,i=t.barWidth,r=t.zeroH,o=(t.strokeWidth,t.elSeries),s=this.w,c=e.i,d=e.j,u=e.bc;if(s.globals.isXNumeric){var h=s.globals.seriesX[c][d];h||(h=0),n=(h-s.globals.minX)/this.xRatio-i/2}for(var p,f=n,g=0,m=0;m0&&!s.globals.isXNumeric||c>0&&s.globals.isXNumeric&&s.globals.seriesX[c-1][d]===s.globals.seriesX[c][d]){var v,b,y=Math.min(this.yRatio.length+1,c+1);if(void 0!==this.prevY[c-1])for(var x=1;x=0?b-g+2*(this.isReversed?g:0):b;break}if(this.prevYVal[c-_][d]>=0){v=this.series[c][d]>=0?b:b+g-2*(this.isReversed?g:0);break}}void 0===v&&(v=s.globals.gridHeight),p=this.prevYF[0].every((function(t){return 0===t}))&&this.prevYF.slice(1,c).every((function(t){return t.every((function(t){return isNaN(t)}))}))?s.globals.gridHeight-r:v}else p=s.globals.gridHeight-r;l=p-this.series[c][d]/this.yRatio[this.yaxisIndex]+2*(this.isReversed?this.series[c][d]/this.yRatio[this.yaxisIndex]:0),this.yArrj.push(l),this.yArrjF.push(Math.abs(p-l)),this.yArrjVal.push(this.series[c][d]);var w=this.barHelpers.getColumnPaths({barXPosition:f,barWidth:i,y1:p,y2:l,yRatio:this.yRatio[this.yaxisIndex],strokeWidth:this.strokeWidth,series:this.series,realIndex:e.realIndex,i:c,j:d,w:s});return this.barHelpers.barBackground({bc:u,j:d,i:c,x1:f,x2:i,elSeries:o}),n+=a,{pathTo:w.pathTo,pathFrom:w.pathFrom,x:s.globals.isXNumeric?n-a:n,y:l}}}]),n}(),Ct=function(t){u(n,F);var e=f(n);function n(){return i(this,n),e.apply(this,arguments)}return o(n,[{key:"draw",value:function(t,e){var n=this.w,l=new w(this.ctx),a=new I(this.ctx);this.candlestickOptions=this.w.config.plotOptions.candlestick;var i=new k(this.ctx,n);t=i.getLogSeries(t),this.series=t,this.yRatio=i.getLogYRatios(this.yRatio),this.barHelpers.initVariables(t);for(var r=l.group({class:"apexcharts-candlestick-series apexcharts-plot-series"}),o=0;o0&&(this.visibleI=this.visibleI+1),this.yRatio.length>1&&(this.yaxisIndex=m);var b=this.barHelpers.initialPositions();p=b.y,d=b.barHeight,h=b.x,u=b.barWidth,s=b.xDivision,c=b.zeroH,g.push(h+u/2);for(var x=l.group({class:"apexcharts-datalabels","data:realIndex":m}),_=0;_0&&g.push(h+u/2),f.push(p);var T=a.fillPath({seriesNumber:m,dataPointIndex:_,color:S,value:t[o][_]}),E=this.candlestickOptions.wick.useFillColor?S:void 0;this.renderSeries({realIndex:m,pathFill:T,lineFill:E,j:_,i:o,pathFrom:D.pathFrom,pathTo:D.pathTo,strokeWidth:C,elSeries:v,x:h,y:p,series:t,barHeight:d,barWidth:u,elDataLabelsWrap:x,visibleSeries:this.visibleI,type:"candlestick"})}n.globals.seriesXvalues[m]=g,n.globals.seriesYvalues[m]=f,r.add(v)}return r}},{key:"drawCandleStickPaths",value:function(t){var e=t.indexes,n=t.x,l=(t.y,t.xDivision),a=t.barWidth,i=t.zeroH,r=t.strokeWidth,o=this.w,s=new w(this.ctx),c=e.i,d=e.j,u=!0,h=o.config.plotOptions.candlestick.colors.upward,p=o.config.plotOptions.candlestick.colors.downward,f=this.yRatio[this.yaxisIndex],g=e.realIndex,m=this.getOHLCValue(g,d),v=i,b=i;m.o>m.c&&(u=!1);var y=Math.min(m.o,m.c),x=Math.max(m.o,m.c);o.globals.isXNumeric&&(n=(o.globals.seriesX[g][d]-o.globals.minX)/this.xRatio-a/2);var _=n+a*this.visibleI;void 0===this.series[c][d]||null===this.series[c][d]?y=i:(y=i-y/f,x=i-x/f,v=i-m.h/f,b=i-m.l/f);var S=s.move(_,i),C=s.move(_,y);return o.globals.previousPaths.length>0&&(C=this.getPreviousPath(g,d,!0)),S=s.move(_,x)+s.line(_+a/2,x)+s.line(_+a/2,v)+s.line(_+a/2,x)+s.line(_+a,x)+s.line(_+a,y)+s.line(_+a/2,y)+s.line(_+a/2,b)+s.line(_+a/2,y)+s.line(_,y)+s.line(_,x-r/2),C+=s.move(_,y),o.globals.isXNumeric||(n+=l),{pathTo:S,pathFrom:C,x:n,y:x,barXPosition:_,color:u?h:p}}},{key:"getOHLCValue",value:function(t,e){var n=this.w;return{o:n.globals.seriesCandleO[t][e],h:n.globals.seriesCandleH[t][e],l:n.globals.seriesCandleL[t][e],c:n.globals.seriesCandleC[t][e]}}}]),n}(),kt=function(){function t(e,n){i(this,t),this.ctx=e,this.w=e.w,this.xRatio=n.xRatio,this.yRatio=n.yRatio,this.negRange=!1,this.dynamicAnim=this.w.config.chart.animations.dynamicAnimation,this.rectRadius=this.w.config.plotOptions.heatmap.radius,this.strokeWidth=this.w.config.stroke.show?this.w.config.stroke.width:0}return o(t,[{key:"draw",value:function(t){var e=this.w,n=new w(this.ctx),l=n.group({class:"apexcharts-heatmap"});l.attr("clip-path","url(#gridRectMask".concat(e.globals.cuid,")"));var a=e.globals.gridWidth/e.globals.dataPoints,i=e.globals.gridHeight/e.globals.series.length,r=0,o=!1;this.checkColorRange();var s=t.slice();e.config.yaxis[0].reversed&&(o=!0,s.reverse());for(var c=o?0:s.length-1;o?c=0;o?c++:c--){var d=n.group({class:"apexcharts-series apexcharts-heatmap-series",seriesName:y.escapeString(e.globals.seriesNames[c]),rel:c+1,"data:realIndex":c});if(this.ctx.series.addCollapsedClassToSeries(d,c),e.config.chart.dropShadow.enabled){var u=e.config.chart.dropShadow;new x(this.ctx).dropShadow(d,u,c)}for(var h=0,p=0;p0&&e.colorScale.ranges.map((function(e,n){e.from<=0&&(t.negRange=!0)}))}},{key:"determineHeatColor",value:function(t,e){var n=this.w,l=n.globals.series[t][e],a=n.config.plotOptions.heatmap,i=a.colorScale.inverse?e:t,r=n.globals.colors[i],o=null,s=Math.min.apply(Math,g(n.globals.series[t])),c=Math.max.apply(Math,g(n.globals.series[t]));a.distributed||(s=n.globals.minY,c=n.globals.maxY),void 0!==a.colorScale.min&&(s=a.colorScale.minn.globals.maxY?a.colorScale.max:n.globals.maxY);var d=Math.abs(c)+Math.abs(s),u=100*l/(0===d?d-1e-6:d);return a.colorScale.ranges.length>0&&a.colorScale.ranges.map((function(t,e){if(l>=t.from&&l<=t.to){r=t.color,o=t.foreColor?t.foreColor:null,s=t.from,c=t.to;var n=Math.abs(c)+Math.abs(s);u=100*l/(0===n?n-1e-6:n)}})),{color:r,foreColor:o,percent:u}}},{key:"calculateHeatmapDataLabels",value:function(t){var e=t.x,n=t.y,l=t.i,a=t.j,i=t.heatColorProps,r=(t.series,t.rectHeight),o=t.rectWidth,s=this.w,c=s.config.dataLabels,d=new w(this.ctx),u=new j(this.ctx),h=c.formatter,p=null;if(c.enabled){p=d.group({class:"apexcharts-data-labels"});var f=c.offsetX,g=c.offsetY,m=e+o/2+f,v=n+r/2+parseFloat(c.style.fontSize)/3+g,b=h(s.globals.series[l][a],{seriesIndex:l,dataPointIndex:a,w:s});u.plotDataLabelsText({x:m,y:v,text:b,i:l,j:a,color:i.foreColor,parent:p,dataLabelsConfig:c})}return p}},{key:"animateHeatMap",value:function(t,e,n,l,a,i){var r=new _(this.ctx);r.animateRect(t,{x:e+l/2,y:n+a/2,width:0,height:0},{x:e,y:n,width:l,height:a},i,(function(){r.animationCompleted(t)}))}},{key:"animateHeatColor",value:function(t,e,n,l){t.attr({fill:e}).animate(l).attr({fill:n})}}]),t}(),Dt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"drawYAxisTexts",value:function(t,e,n,l){var a=this.w,i=a.config.yaxis[0],r=a.globals.yLabelFormatters[0];return new w(this.ctx).drawText({x:t+i.labels.offsetX,y:e+i.labels.offsetY,text:r(l,n),textAnchor:"middle",fontSize:i.labels.style.fontSize,fontFamily:i.labels.style.fontFamily,foreColor:Array.isArray(i.labels.style.colors)?i.labels.style.colors[n]:i.labels.style.colors})}}]),t}(),Tt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w;var n=this.w;this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animBeginArr=[0],this.animDur=0,this.donutDataLabels=this.w.config.plotOptions.pie.donut.labels,this.lineColorArr=void 0!==n.globals.stroke.colors?n.globals.stroke.colors:n.globals.colors,this.defaultSize=n.globals.svgHeightthis.fullAngle?e.endAngle=e.endAngle-(l+r):l+r=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle&&(o=this.fullAngle+this.w.config.plotOptions.pie.startAngle%this.fullAngle-.01),Math.ceil(o)>this.fullAngle&&(o-=this.fullAngle);var s=Math.PI*(o-90)/180,c=e.centerX+a*Math.cos(r),d=e.centerY+a*Math.sin(r),u=e.centerX+a*Math.cos(s),h=e.centerY+a*Math.sin(s),p=y.polarToCartesian(e.centerX,e.centerY,e.donutSize,o),f=y.polarToCartesian(e.centerX,e.centerY,e.donutSize,i),g=l>180?1:0,m=["M",c,d,"A",a,a,0,g,1,u,h];return"donut"===e.chartType?[].concat(m,["L",p.x,p.y,"A",e.donutSize,e.donutSize,0,g,0,f.x,f.y,"L",c,d,"z"]).join(" "):"pie"===e.chartType||"polarArea"===e.chartType?[].concat(m,["L",e.centerX,e.centerY,"L",c,d]).join(" "):[].concat(m).join(" ")}},{key:"drawPolarElements",value:function(){var t=this.w,e=new K(this.ctx),n=new w(this.ctx),l=new Dt(this.ctx),a=n.group(),i=n.group(),r=void 0===t.config.yaxis[0].max&&void 0===t.config.yaxis[0].min,o=e.niceScale(0,Math.ceil(this.maxY),t.config.yaxis[0].tickAmount,0,r),s=o.result.reverse(),c=o.result.length;this.maxY=o.niceMax;for(var d=t.globals.radialSize,u=d/(c-1),h=0;h1&&t.total.show&&(a=t.total.color);var r=i.globals.dom.baseEl.querySelector(".apexcharts-datalabel-label"),o=i.globals.dom.baseEl.querySelector(".apexcharts-datalabel-value");n=(0,t.value.formatter)(n,i),l||"function"!=typeof t.total.formatter||(n=t.total.formatter(i));var s=e===t.total.label;e=t.name.formatter(e,s,i),null!==r&&(r.textContent=e),null!==o&&(o.textContent=n),null!==r&&(r.style.fill=a)}},{key:"printDataLabelsInner",value:function(t,e){var n=this.w,l=t.getAttribute("data:value"),a=n.globals.seriesNames[parseInt(t.parentNode.getAttribute("rel"),10)-1];n.globals.series.length>1&&this.printInnerLabels(e,a,l,t);var i=n.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group");null!==i&&(i.style.opacity=1)}},{key:"revertDataLabelsInner",value:function(t,e,n){var l=this,a=this.w,i=a.globals.dom.baseEl.querySelector(".apexcharts-datalabels-group"),r=!1,o=a.globals.dom.baseEl.getElementsByClassName("apexcharts-pie-area"),s=function(t){var n=t.makeSliceOut,a=t.printLabel;Array.prototype.forEach.call(o,(function(t){"true"===t.getAttribute("data:pieClicked")&&(n&&(r=!0),a&&l.printDataLabelsInner(t,e))}))};if(s({makeSliceOut:!0,printLabel:!1}),e.total.show&&a.globals.series.length>1)r&&!e.total.showAlways?s({makeSliceOut:!1,printLabel:!0}):this.printInnerLabels(e,e.total.label,e.total.formatter(a));else if(s({makeSliceOut:!1,printLabel:!0}),!r)if(a.globals.selectedDataPoints.length&&a.globals.series.length>1)if(a.globals.selectedDataPoints[0].length>0){var c=a.globals.selectedDataPoints[0],d=a.globals.dom.baseEl.querySelector(".apexcharts-".concat(this.chartType.toLowerCase(),"-slice-").concat(c));this.printDataLabelsInner(d,e)}else i&&a.globals.selectedDataPoints.length&&0===a.globals.selectedDataPoints[0].length&&(i.style.opacity=0);else i&&a.globals.series.length>1&&(i.style.opacity=0)}}]),t}(),Et=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.chartType=this.w.config.chart.type,this.initialAnim=this.w.config.chart.animations.enabled,this.dynamicAnim=this.initialAnim&&this.w.config.chart.animations.dynamicAnimation.enabled,this.animDur=0;var n=this.w;this.graphics=new w(this.ctx),this.lineColorArr=void 0!==n.globals.stroke.colors?n.globals.stroke.colors:n.globals.colors,this.defaultSize=n.globals.svgHeight0&&(g=e.getPreviousPath(r));for(var m=0;m=10?t.x>0?(n="start",l+=10):t.x<0&&(n="end",l-=10):n="middle",Math.abs(t.y)>=e-10&&(t.y<0?a-=10:t.y>0&&(a+=10)),{textAnchor:n,newX:l,newY:a}}},{key:"getPreviousPath",value:function(t){for(var e=this.w,n=null,l=0;l0&&parseInt(a.realIndex,10)===parseInt(t,10)&&void 0!==e.globals.previousPaths[l].paths[0]&&(n=e.globals.previousPaths[l].paths[0].d)}return n}},{key:"getDataPointsPos",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dataPointsLen;t=t||[],e=e||[];for(var l=[],a=0;a=360&&(h=360-Math.abs(this.startAngle)-.1);var p=n.drawPath({d:"",stroke:d,strokeWidth:r*parseInt(c.strokeWidth,10)/100,fill:"none",strokeOpacity:c.opacity,classes:"apexcharts-radialbar-area"});if(c.dropShadow.enabled){var f=c.dropShadow;a.dropShadow(p,f)}s.add(p),p.attr("id","apexcharts-radialbarTrack-"+o),this.animatePaths(p,{centerX:t.centerX,centerY:t.centerY,endAngle:h,startAngle:u,size:t.size,i:o,totalItems:2,animBeginArr:0,dur:0,isTrack:!0,easing:e.globals.easing})}return l}},{key:"drawArcs",value:function(t){var e=this.w,n=new w(this.ctx),l=new I(this.ctx),a=new x(this.ctx),i=n.group(),r=this.getStrokeWidth(t);t.size=t.size-r/2;var o=e.config.plotOptions.radialBar.hollow.background,s=t.size-r*t.series.length-this.margin*t.series.length-r*parseInt(e.config.plotOptions.radialBar.track.strokeWidth,10)/100/2,c=s-e.config.plotOptions.radialBar.hollow.margin;void 0!==e.config.plotOptions.radialBar.hollow.image&&(o=this.drawHollowImage(t,i,s,o));var d=this.drawHollow({size:c,centerX:t.centerX,centerY:t.centerY,fill:o||"transparent"});if(e.config.plotOptions.radialBar.hollow.dropShadow.enabled){var u=e.config.plotOptions.radialBar.hollow.dropShadow;a.dropShadow(d,u)}var h=1;!this.radialDataLabels.total.show&&e.globals.series.length>1&&(h=0);var p=null;this.radialDataLabels.show&&(p=this.renderInnerDataLabels(this.radialDataLabels,{hollowSize:s,centerX:t.centerX,centerY:t.centerY,opacity:h})),"back"===e.config.plotOptions.radialBar.hollow.position&&(i.add(d),p&&i.add(p));var f=!1;e.config.plotOptions.radialBar.inverseOrder&&(f=!0);for(var g=f?t.series.length-1:0;f?g>=0:g100?100:t.series[g])/100,C=Math.round(this.totalAngle*S)+this.startAngle,k=void 0;e.globals.dataChanged&&(_=this.startAngle,k=Math.round(this.totalAngle*y.negToZero(e.globals.previousPaths[g])/100)+_),Math.abs(C)+Math.abs(b)>=360&&(C-=.01),Math.abs(k)+Math.abs(_)>=360&&(k-=.01);var D=C-b,T=Array.isArray(e.config.stroke.dashArray)?e.config.stroke.dashArray[g]:e.config.stroke.dashArray,E=n.drawPath({d:"",stroke:v,strokeWidth:r,fill:"none",fillOpacity:e.config.fill.opacity,classes:"apexcharts-radialbar-area apexcharts-radialbar-slice-"+g,strokeDashArray:T});if(w.setAttrs(E.node,{"data:angle":D,"data:value":t.series[g]}),e.config.chart.dropShadow.enabled){var M=e.config.chart.dropShadow;a.dropShadow(E,M,g)}this.addListeners(E,this.radialDataLabels),m.add(E),E.attr({index:0,j:g});var A=0;!this.initialAnim||e.globals.resized||e.globals.dataChanged||(A=(C-b)/360*e.config.chart.animations.speed,this.animDur=A/(1.2*t.series.length)+this.animDur,this.animBeginArr.push(this.animDur)),e.globals.dataChanged&&(A=(C-b)/360*e.config.chart.animations.dynamicAnimation.speed,this.animDur=A/(1.2*t.series.length)+this.animDur,this.animBeginArr.push(this.animDur)),this.animatePaths(E,{centerX:t.centerX,centerY:t.centerY,endAngle:C,startAngle:b,prevEndAngle:k,prevStartAngle:_,size:t.size,i:g,totalItems:2,animBeginArr:this.animBeginArr,dur:A,shouldSetPrevPaths:!0,easing:e.globals.easing})}return{g:i,elHollow:d,dataLabels:p}}},{key:"drawHollow",value:function(t){var e=new w(this.ctx).drawCircle(2*t.size);return e.attr({class:"apexcharts-radialbar-hollow",cx:t.centerX,cy:t.centerY,r:t.size,fill:t.fill}),e}},{key:"drawHollowImage",value:function(t,e,n,l){var a=this.w,i=new I(this.ctx),r=y.randomId(),o=a.config.plotOptions.radialBar.hollow.image;if(a.config.plotOptions.radialBar.hollow.imageClipped)i.clippedImgArea({width:n,height:n,image:o,patternID:"pattern".concat(a.globals.cuid).concat(r)}),l="url(#pattern".concat(a.globals.cuid).concat(r,")");else{var s=a.config.plotOptions.radialBar.hollow.imageWidth,c=a.config.plotOptions.radialBar.hollow.imageHeight;if(void 0===s&&void 0===c){var d=a.globals.dom.Paper.image(o).loaded((function(e){this.move(t.centerX-e.width/2+a.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-e.height/2+a.config.plotOptions.radialBar.hollow.imageOffsetY)}));e.add(d)}else{var u=a.globals.dom.Paper.image(o).loaded((function(e){this.move(t.centerX-s/2+a.config.plotOptions.radialBar.hollow.imageOffsetX,t.centerY-c/2+a.config.plotOptions.radialBar.hollow.imageOffsetY),this.size(s,c)}));e.add(u)}}return l}},{key:"getStrokeWidth",value:function(t){var e=this.w;return t.size*(100-parseInt(e.config.plotOptions.radialBar.hollow.size,10))/100/(t.series.length+1)-this.margin}}]),n}(),At=function(){function t(e){i(this,t),this.w=e.w,this.lineCtx=e}return o(t,[{key:"sameValueSeriesFix",value:function(t,e){var n=this.w;if("line"===n.config.chart.type&&("gradient"===n.config.fill.type||"gradient"===n.config.fill.type[t])&&new k(this.lineCtx.ctx,n).seriesHaveSameValues(t)){var l=e[t].slice();l[l.length-1]=l[l.length-1]+1e-6,e[t]=l}return e}},{key:"calculatePoints",value:function(t){var e=t.series,n=t.realIndex,l=t.x,a=t.y,i=t.i,r=t.j,o=t.prevY,s=this.w,c=[],d=[];if(0===r){var u=this.lineCtx.categoryAxisCorrection+s.config.markers.offsetX;s.globals.isXNumeric&&(u=(s.globals.seriesX[n][0]-s.globals.minX)/this.lineCtx.xRatio+s.config.markers.offsetX),c.push(u),d.push(y.isNumber(e[i][0])?o+s.config.markers.offsetY:null),c.push(l+s.config.markers.offsetX),d.push(y.isNumber(e[i][r+1])?a+s.config.markers.offsetY:null)}else c.push(l+s.config.markers.offsetX),d.push(y.isNumber(e[i][r+1])?a+s.config.markers.offsetY:null);return{x:c,y:d}}},{key:"checkPreviousPaths",value:function(t){for(var e=t.pathFromLine,n=t.pathFromArea,l=t.realIndex,a=this.w,i=0;i0&&parseInt(r.realIndex,10)===parseInt(l,10)&&("line"===r.type?(this.lineCtx.appendPathFrom=!1,e=a.globals.previousPaths[i].paths[0].d):"area"===r.type&&(this.lineCtx.appendPathFrom=!1,n=a.globals.previousPaths[i].paths[0].d,a.config.stroke.show&&a.globals.previousPaths[i].paths[1]&&(e=a.globals.previousPaths[i].paths[1].d)))}return{pathFromLine:e,pathFromArea:n}}},{key:"determineFirstPrevY",value:function(t){var e=t.i,n=t.series,l=t.prevY,a=t.lineYPosition,i=this.w;if(void 0!==n[e][0])l=(a=i.config.chart.stacked&&e>0?this.lineCtx.prevSeriesY[e-1][0]:this.lineCtx.zeroY)-n[e][0]/this.lineCtx.yRatio[this.lineCtx.yaxisIndex]+2*(this.lineCtx.isReversed?n[e][0]/this.lineCtx.yRatio[this.lineCtx.yaxisIndex]:0);else if(i.config.chart.stacked&&e>0&&void 0===n[e][0])for(var r=e-1;r>=0;r--)if(null!==n[r][0]&&void 0!==n[r][0]){l=a=this.lineCtx.prevSeriesY[r][0];break}return{prevY:l,lineYPosition:a}}}]),t}(),It=function(){function t(e,n,l){i(this,t),this.ctx=e,this.w=e.w,this.xyRatios=n,this.pointsChart=!("bubble"!==this.w.config.chart.type&&"scatter"!==this.w.config.chart.type)||l,this.scatter=new P(this.ctx),this.noNegatives=this.w.globals.minX===Number.MAX_VALUE,this.lineHelpers=new At(this),this.markers=new R(this.ctx),this.prevSeriesY=[],this.categoryAxisCorrection=0,this.yaxisIndex=0}return o(t,[{key:"draw",value:function(t,e,n){var l=this.w,a=new w(this.ctx),i=l.globals.comboCharts?e:l.config.chart.type,r=a.group({class:"apexcharts-".concat(i,"-series apexcharts-plot-series")}),o=new k(this.ctx,l);this.yRatio=this.xyRatios.yRatio,this.zRatio=this.xyRatios.zRatio,this.xRatio=this.xyRatios.xRatio,this.baseLineY=this.xyRatios.baseLineY,t=o.getLogSeries(t),this.yRatio=o.getLogYRatios(this.yRatio);for(var s=[],c=0;c0&&(p=(l.globals.seriesX[d][0]-l.globals.minX)/this.xRatio),h.push(p);var f,g=p,m=g,v=this.zeroY;v=this.lineHelpers.determineFirstPrevY({i:c,series:t,prevY:v,lineYPosition:0}).prevY,u.push(v),f=v;var b=this._calculatePathsFrom({series:t,i:c,realIndex:d,prevX:m,prevY:v}),y=this._iterateOverDataPoints({series:t,realIndex:d,i:c,x:p,y:1,pX:g,pY:f,pathsFrom:b,linePaths:[],areaPaths:[],seriesIndex:n,lineYPosition:0,xArrj:h,yArrj:u});this._handlePaths({type:i,realIndex:d,i:c,paths:y}),this.elSeries.add(this.elPointsMain),this.elSeries.add(this.elDataLabelsWrap),s.push(this.elSeries)}if(l.config.chart.stacked)for(var x=s.length;x>0;x--)r.add(s[x-1]);else for(var _=0;_1&&(this.yaxisIndex=n),this.isReversed=l.config.yaxis[this.yaxisIndex]&&l.config.yaxis[this.yaxisIndex].reversed,this.zeroY=l.globals.gridHeight-this.baseLineY[this.yaxisIndex]-(this.isReversed?l.globals.gridHeight:0)+(this.isReversed?2*this.baseLineY[this.yaxisIndex]:0),this.areaBottomY=this.zeroY,(this.zeroY>l.globals.gridHeight||"end"===l.config.plotOptions.area.fillTo)&&(this.areaBottomY=l.globals.gridHeight),this.categoryAxisCorrection=this.xDivision/2,this.elSeries=a.group({class:"apexcharts-series",seriesName:y.escapeString(l.globals.seriesNames[n])}),this.elPointsMain=a.group({class:"apexcharts-series-markers-wrap","data:realIndex":n}),this.elDataLabelsWrap=a.group({class:"apexcharts-datalabels","data:realIndex":n});var i=t[e].length===l.globals.dataPoints;this.elSeries.attr({"data:longestSeries":i,rel:e+1,"data:realIndex":n}),this.appendPathFrom=!0}},{key:"_calculatePathsFrom",value:function(t){var e,n,l,a,i=t.series,r=t.i,o=t.realIndex,s=t.prevX,c=t.prevY,d=this.w,u=new w(this.ctx);if(null===i[r][0]){for(var h=0;h0){var p=this.lineHelpers.checkPreviousPaths({pathFromLine:l,pathFromArea:a,realIndex:o});l=p.pathFromLine,a=p.pathFromArea}return{prevX:s,prevY:c,linePath:e,areaPath:n,pathFromLine:l,pathFromArea:a}}},{key:"_handlePaths",value:function(t){var e=t.type,n=t.realIndex,l=t.i,a=t.paths,i=this.w,r=new w(this.ctx),o=new I(this.ctx);this.prevSeriesY.push(a.yArrj),i.globals.seriesXvalues[n]=a.xArrj,i.globals.seriesYvalues[n]=a.yArrj,this.pointsChart||i.globals.delayedElements.push({el:this.elPointsMain.node,index:n});var s={i:l,realIndex:n,animationDelay:l,initialSpeed:i.config.chart.animations.speed,dataChangeSpeed:i.config.chart.animations.dynamicAnimation.speed,className:"apexcharts-".concat(e)};if("area"===e)for(var c=o.fillPath({seriesNumber:n}),u=0;u1?g.globals.dataPoints-1:g.globals.dataPoints,T=0;T0&&g.globals.collapsedSeries.length-1){e--;break}return e>=0?e:0}(l-1)][T+1]:this.zeroY,i=E?h-k/v[this.yaxisIndex]+2*(this.isReversed?k/v[this.yaxisIndex]:0):h-e[l][T+1]/v[this.yaxisIndex]+2*(this.isReversed?e[l][T+1]/v[this.yaxisIndex]:0),p.push(a),f.push(i);var A=this.lineHelpers.calculatePoints({series:e,x:a,y:i,realIndex:n,i:l,j:T,prevY:b}),I=this._createPaths({series:e,i:l,realIndex:n,j:T,x:a,y:i,pX:r,pY:o,linePath:x,areaPath:_,linePaths:c,areaPaths:d,seriesIndex:u});d=I.areaPaths,c=I.linePaths,r=I.pX,o=I.pY,_=I.areaPath,x=I.linePath,this.appendPathFrom&&(S+=m.line(a,this.zeroY),C+=m.line(a,this.zeroY)),this.handleNullDataPoints(e,A,l,T,n),this._handleMarkersAndLabels({pointsPos:A,series:e,x:a,y:i,prevY:b,i:l,j:T,realIndex:n})}return{yArrj:f,xArrj:p,pathFromArea:C,areaPaths:d,pathFromLine:S,linePaths:c}}},{key:"_handleMarkersAndLabels",value:function(t){var e=t.pointsPos,n=(t.series,t.x,t.y,t.prevY,t.i),l=t.j,a=t.realIndex,i=this.w,r=new j(this.ctx);if(this.pointsChart)this.scatter.draw(this.elSeries,l,{realIndex:a,pointsPos:e,zRatio:this.zRatio,elParent:this.elPointsMain});else{i.globals.series[n].length>1&&this.elPointsMain.node.classList.add("apexcharts-element-hidden");var o=this.markers.plotChartMarkers(e,a,l+1);null!==o&&this.elPointsMain.add(o)}var s=r.drawDataLabel(e,a,l+1,null);null!==s&&this.elDataLabelsWrap.add(s)}},{key:"_createPaths",value:function(t){var e=t.series,n=t.i,l=t.realIndex,a=t.j,i=t.x,r=t.y,o=t.pX,s=t.pY,c=t.linePath,d=t.areaPath,u=t.linePaths,h=t.areaPaths,p=t.seriesIndex,f=this.w,g=new w(this.ctx),m=f.config.stroke.curve,v=this.areaBottomY;if(Array.isArray(f.config.stroke.curve)&&(m=Array.isArray(p)?f.config.stroke.curve[p[n]]:f.config.stroke.curve[n]),"smooth"===m){var b=.35*(i-o);f.globals.hasNullValues?(null!==e[n][a]&&(null!==e[n][a+1]?(c=g.move(o,s)+g.curve(o+b,s,i-b,r,i+1,r),d=g.move(o+1,s)+g.curve(o+b,s,i-b,r,i+1,r)+g.line(i,v)+g.line(o,v)+"z"):(c=g.move(o,s),d=g.move(o,s)+"z")),u.push(c),h.push(d)):(c+=g.curve(o+b,s,i-b,r,i,r),d+=g.curve(o+b,s,i-b,r,i,r)),o=i,s=r,a===e[n].length-2&&(d=d+g.curve(o,s,i,r,i,v)+g.move(i,r)+"z",f.globals.hasNullValues||(u.push(c),h.push(d)))}else{if(null===e[n][a+1]){c+=g.move(i,r);var y=f.globals.isXNumeric?(f.globals.seriesX[l][a]-f.globals.minX)/this.xRatio:i-this.xDivision;d=d+g.line(y,v)+g.move(i,r)+"z"}null===e[n][a]&&(c+=g.move(i,r),d+=g.move(i,v)),"stepline"===m?(c=c+g.line(i,null,"H")+g.line(null,r,"V"),d=d+g.line(i,null,"H")+g.line(null,r,"V")):"straight"===m&&(c+=g.line(i,r),d+=g.line(i,r)),a===e[n].length-2&&(d=d+g.line(i,v)+g.move(i,r)+"z",u.push(c),h.push(d))}return{linePaths:u,areaPaths:h,pX:o,pY:s,linePath:c,areaPath:d}}},{key:"handleNullDataPoints",value:function(t,e,n,l,a){var i=this.w;if(null===t[n][l]&&i.config.markers.showNullDataPoints||1===t[n].length){var r=this.markers.plotChartMarkers(e,a,l+1,this.strokeWidth-i.config.markers.strokeWidth/2,!0);null!==r&&this.elPointsMain.add(r)}}}]),t}(),Rt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w,this.timeScaleArray=[],this.utc=this.w.config.xaxis.labels.datetimeUTC}return o(t,[{key:"calculateTimeScaleTicks",value:function(t,e){var n=this,l=this.w;if(l.globals.allSeriesCollapsed)return l.globals.labels=[],l.globals.timescaleLabels=[],[];var a=new B(this.ctx),i=(e-t)/864e5;this.determineInterval(i),l.globals.disableZoomIn=!1,l.globals.disableZoomOut=!1,i<.005?l.globals.disableZoomIn=!0:i>5e4&&(l.globals.disableZoomOut=!0);var r=a.getTimeUnitsfromTimestamp(t,e,this.utc),o=l.globals.gridWidth/i,s=o/24,c=s/60,u=Math.floor(24*i),h=Math.floor(24*i*60),p=Math.floor(i),f=Math.floor(i/30),g=Math.floor(i/365),m={minMinute:r.minMinute,minHour:r.minHour,minDate:r.minDate,minMonth:r.minMonth,minYear:r.minYear},v={firstVal:m,currentMinute:m.minMinute,currentHour:m.minHour,currentMonthDate:m.minDate,currentDate:m.minDate,currentMonth:m.minMonth,currentYear:m.minYear,daysWidthOnXAxis:o,hoursWidthOnXAxis:s,minutesWidthOnXAxis:c,numberOfMinutes:h,numberOfHours:u,numberOfDays:p,numberOfMonths:f,numberOfYears:g};switch(this.tickInterval){case"years":this.generateYearScale(v);break;case"months":case"half_year":this.generateMonthScale(v);break;case"months_days":case"months_fortnight":case"days":case"week_days":this.generateDayScale(v);break;case"hours":this.generateHourScale(v);break;case"minutes":this.generateMinuteScale(v)}var b=this.timeScaleArray.map((function(t){var e={position:t.position,unit:t.unit,year:t.year,day:t.day?t.day:1,hour:t.hour?t.hour:0,month:t.month+1};return"month"===t.unit?d(d({},e),{},{day:1,value:t.value+1}):"day"===t.unit||"hour"===t.unit?d(d({},e),{},{value:t.value}):"minute"===t.unit?d(d({},e),{},{value:t.value,minute:t.value}):t}));return b.filter((function(t){var e=1,a=Math.ceil(l.globals.gridWidth/120),i=t.value;void 0!==l.config.xaxis.tickAmount&&(a=l.config.xaxis.tickAmount),b.length>a&&(e=Math.floor(b.length/a));var r=!1,o=!1;switch(n.tickInterval){case"years":"year"===t.unit&&(r=!0);break;case"half_year":e=7,"year"===t.unit&&(r=!0);break;case"months":e=1,"year"===t.unit&&(r=!0);break;case"months_fortnight":e=15,"year"!==t.unit&&"month"!==t.unit||(r=!0),30===i&&(o=!0);break;case"months_days":e=10,"month"===t.unit&&(r=!0),30===i&&(o=!0);break;case"week_days":e=8,"month"===t.unit&&(r=!0);break;case"days":e=1,"month"===t.unit&&(r=!0);break;case"hours":"day"===t.unit&&(r=!0);break;case"minutes":i%5!=0&&(o=!0)}if("minutes"===n.tickInterval||"hours"===n.tickInterval){if(!o)return!0}else if((i%e==0||r)&&!o)return!0}))}},{key:"recalcDimensionsBasedOnFormat",value:function(t,e){var n=this.w,l=this.formatDates(t),a=this.removeOverlappingTS(l);n.globals.timescaleLabels=a.slice(),new ut(this.ctx).plotCoords()}},{key:"determineInterval",value:function(t){switch(!0){case t>1825:this.tickInterval="years";break;case t>800&&t<=1825:this.tickInterval="half_year";break;case t>180&&t<=800:this.tickInterval="months";break;case t>90&&t<=180:this.tickInterval="months_fortnight";break;case t>60&&t<=90:this.tickInterval="months_days";break;case t>30&&t<=60:this.tickInterval="week_days";break;case t>2&&t<=30:this.tickInterval="days";break;case t>.1&&t<=2:this.tickInterval="hours";break;case t<.1:this.tickInterval="minutes";break;default:this.tickInterval="days"}}},{key:"generateYearScale",value:function(t){var e=t.firstVal,n=t.currentMonth,l=t.currentYear,a=t.daysWidthOnXAxis,i=t.numberOfYears,r=e.minYear,o=0,s=new B(this.ctx);if(e.minDate>1||e.minMonth>0){var c=s.determineRemainingDaysOfYear(e.minYear,e.minMonth,e.minDate);o=(s.determineDaysOfYear(e.minYear)-c+1)*a,r=e.minYear+1,this.timeScaleArray.push({position:o,value:r,unit:"year",year:r,month:y.monthMod(n+1)})}else 1===e.minDate&&0===e.minMonth&&this.timeScaleArray.push({position:o,value:r,unit:"year",year:l,month:y.monthMod(n+1)});for(var d=r,u=o,h=0;h1){s=(c.determineDaysOfMonths(l+1,e.minYear)-n+1)*i,o=y.monthMod(l+1);var h=a+u,p=y.monthMod(o),f=o;0===o&&(d="year",f=h,p=1,h+=u+=1),this.timeScaleArray.push({position:s,value:f,unit:d,year:h,month:p})}else this.timeScaleArray.push({position:s,value:o,unit:d,year:a,month:y.monthMod(l)});for(var g=o+1,m=s,v=0,b=1;vr.determineDaysOfMonths(e+1,n)?(c=1,o="month",h=e+=1,e):e},u=(24-e.minHour)*a,h=s,p=d(c,n,l);0===e.minHour&&1===e.minDate&&(u=0,h=y.monthMod(e.minMonth),o="month",c=e.minDate,i++),this.timeScaleArray.push({position:u,value:h,unit:o,year:this._getYear(l,p,0),month:y.monthMod(p),day:c});for(var f=u,g=0;go.determineDaysOfMonths(e+1,a)&&(g=1,e+=1),{month:e,date:g}},d=function(t,e){return t>o.determineDaysOfMonths(e+1,a)?e+=1:e},u=60-e.minMinute,h=u*i,p=e.minHour+1,f=p+1;60===u&&(h=0,f=(p=e.minHour)+1);var g=n,m=d(g,l);this.timeScaleArray.push({position:h,value:p,unit:s,day:g,hour:f,year:a,month:y.monthMod(m)});for(var v=h,b=0;b=24&&(f=0,s="day",m=c(g+=1,m).month,m=d(g,m));var x=this._getYear(a,m,0);v=0===f&&0===b?u*i:60*i+v;var _=0===f?g:f;this.timeScaleArray.push({position:v,value:_,unit:s,hour:f,day:g,year:x,month:y.monthMod(m)}),f++}}},{key:"generateMinuteScale",value:function(t){var e=t.firstVal,n=t.currentMinute,l=t.currentHour,a=t.currentDate,i=t.currentMonth,r=t.currentYear,o=t.minutesWidthOnXAxis,s=t.numberOfMinutes,c=o-(n-e.minMinute),d=e.minMinute+1,u=d+1,h=a,p=i,f=r,g=l;this.timeScaleArray.push({position:c,value:d,unit:"minute",day:h,hour:g,minute:u,year:f,month:y.monthMod(p)});for(var m=c,v=0;v=60&&(u=0,24===(g+=1)&&(g=0)),m=o+m,this.timeScaleArray.push({position:m,value:u,unit:"minute",hour:g,minute:u,day:h,year:this._getYear(r,p,0),month:y.monthMod(p)}),u++}},{key:"createRawDateString",value:function(t,e){var n=t.year;return n+="-"+("0"+t.month.toString()).slice(-2),"day"===t.unit?n+="day"===t.unit?"-"+("0"+e).slice(-2):"-01":n+="-"+("0"+(t.day?t.day:"1")).slice(-2),"hour"===t.unit?n+="hour"===t.unit?"T"+("0"+e).slice(-2):"T00":n+="T"+("0"+(t.hour?t.hour:"0")).slice(-2),n+="minute"===t.unit?":"+("0"+e).slice(-2)+":00":":00:00",this.utc&&(n+=".000Z"),n}},{key:"formatDates",value:function(t){var e=this,n=this.w;return t.map((function(t){var l=t.value.toString(),a=new B(e.ctx),i=e.createRawDateString(t,l),r=a.getDate(a.parseDate(i));if(e.utc||(r=a.getDate(a.parseDateWithTimezone(i))),void 0===n.config.xaxis.labels.format){var o="dd MMM",s=n.config.xaxis.labels.datetimeFormatter;"year"===t.unit&&(o=s.year),"month"===t.unit&&(o=s.month),"day"===t.unit&&(o=s.day),"hour"===t.unit&&(o=s.hour),"minute"===t.unit&&(o=s.minute),l=a.formatDate(r,o)}else l=a.formatDate(r,n.config.xaxis.labels.format);return{dateString:i,position:t.position,value:l,unit:t.unit,year:t.year,month:t.month}}))}},{key:"removeOverlappingTS",value:function(t){var e,n=this,l=new w(this.ctx),a=!1;t.length>0&&t[0].value&&t.every((function(e){return e.value.length===t[0].value.length}))&&(a=!0,e=l.getTextRects(t[0].value).width);var i=0,r=t.map((function(r,o){if(o>0&&n.w.config.xaxis.labels.hideOverlappingLabels){var s=a?e:l.getTextRects(t[i].value).width,c=t[i].position;return r.position>c+s+10?(i=o,r):null}return r}));return r.filter((function(t){return null!==t}))}},{key:"_getYear",value:function(t,e,n){return t+Math.floor(e/12)+n}}]),t}(),Pt=function(){function t(e,n){i(this,t),this.ctx=n,this.w=n.w,this.el=e}return o(t,[{key:"setupElements",value:function(){var t=this.w.globals,e=this.w.config,n=e.chart.type;t.axisCharts=["line","area","bar","rangeBar","candlestick","scatter","bubble","radar","heatmap"].indexOf(n)>-1,t.xyCharts=["line","area","bar","rangeBar","candlestick","scatter","bubble"].indexOf(n)>-1,t.isBarHorizontal=("bar"===e.chart.type||"rangeBar"===e.chart.type)&&e.plotOptions.bar.horizontal,t.chartClass=".apexcharts"+t.cuid,t.dom.baseEl=this.el,t.dom.elWrap=document.createElement("div"),w.setAttrs(t.dom.elWrap,{id:t.chartClass.substring(1),class:"apexcharts-canvas "+t.chartClass.substring(1)}),this.el.appendChild(t.dom.elWrap),t.dom.Paper=new window.SVG.Doc(t.dom.elWrap),t.dom.Paper.attr({class:"apexcharts-svg","xmlns:data":"ApexChartsNS",transform:"translate(".concat(e.chart.offsetX,", ").concat(e.chart.offsetY,")")}),t.dom.Paper.node.style.background=e.chart.background,this.setSVGDimensions(),t.dom.elGraphical=t.dom.Paper.group().attr({class:"apexcharts-inner apexcharts-graphical"}),t.dom.elAnnotations=t.dom.Paper.group().attr({class:"apexcharts-annotations"}),t.dom.elDefs=t.dom.Paper.defs(),t.dom.elLegendWrap=document.createElement("div"),t.dom.elLegendWrap.classList.add("apexcharts-legend"),t.dom.elWrap.appendChild(t.dom.elLegendWrap),t.dom.Paper.add(t.dom.elGraphical),t.dom.elGraphical.add(t.dom.elDefs)}},{key:"plotChartType",value:function(t,e){var n=this.w,l=n.config,a=n.globals,i={series:[],i:[]},r={series:[],i:[]},o={series:[],i:[]},s={series:[],i:[]},c={series:[],i:[]},d={series:[],i:[]};a.series.map((function(e,u){void 0!==t[u].type?("column"===t[u].type||"bar"===t[u].type?(a.series.length>1&&l.plotOptions.bar.horizontal&&console.warn("Horizontal bars are not supported in a mixed/combo chart. Please turn off `plotOptions.bar.horizontal`"),c.series.push(e),c.i.push(u),n.globals.columnSeries=c.series):"area"===t[u].type?(r.series.push(e),r.i.push(u)):"line"===t[u].type?(i.series.push(e),i.i.push(u)):"scatter"===t[u].type?(o.series.push(e),o.i.push(u)):"bubble"===t[u].type?(s.series.push(e),s.i.push(u)):"candlestick"===t[u].type?(d.series.push(e),d.i.push(u)):console.warn("You have specified an unrecognized chart type. Available types for this propery are line/area/column/bar/scatter/bubble"),a.comboCharts=!0):(i.series.push(e),i.i.push(u))}));var u=new It(this.ctx,e),h=new Ct(this.ctx,e);this.ctx.pie=new Tt(this.ctx);var p=new Mt(this.ctx),f=new H(this.ctx,e),g=new Et(this.ctx),m=[];if(a.comboCharts){if(r.series.length>0&&m.push(u.draw(r.series,"area",r.i)),c.series.length>0)if(n.config.chart.stacked){var v=new St(this.ctx,e);m.push(v.draw(c.series,c.i))}else{var b=new F(this.ctx,e);m.push(b.draw(c.series,c.i))}if(i.series.length>0&&m.push(u.draw(i.series,"line",i.i)),d.series.length>0&&m.push(h.draw(d.series,d.i)),o.series.length>0){var y=new It(this.ctx,e,!0);m.push(y.draw(o.series,"scatter",o.i))}if(s.series.length>0){var x=new It(this.ctx,e,!0);m.push(x.draw(s.series,"bubble",s.i))}}else switch(l.chart.type){case"line":m=u.draw(a.series,"line");break;case"area":m=u.draw(a.series,"area");break;case"bar":m=l.chart.stacked?new St(this.ctx,e).draw(a.series):new F(this.ctx,e).draw(a.series);break;case"candlestick":m=new Ct(this.ctx,e).draw(a.series);break;case"rangeBar":m=f.draw(a.series);break;case"heatmap":m=new kt(this.ctx,e).draw(a.series);break;case"pie":case"donut":case"polarArea":m=this.ctx.pie.draw(a.series);break;case"radialBar":m=p.draw(a.series);break;case"radar":m=g.draw(a.series);break;default:m=u.draw(a.series)}return m}},{key:"setSVGDimensions",value:function(){var t=this.w.globals,e=this.w.config;t.svgWidth=e.chart.width,t.svgHeight=e.chart.height;var n=y.getDimensions(this.el),l=e.chart.width.toString().split(/[0-9]+/g).pop();if("%"===l?y.isNumber(n[0])&&(0===n[0].width&&(n=y.getDimensions(this.el.parentNode)),t.svgWidth=n[0]*parseInt(e.chart.width,10)/100):"px"!==l&&""!==l||(t.svgWidth=parseInt(e.chart.width,10)),"auto"!==t.svgHeight&&""!==t.svgHeight)if("%"===e.chart.height.toString().split(/[0-9]+/g).pop()){var a=y.getDimensions(this.el.parentNode);t.svgHeight=a[1]*parseInt(e.chart.height,10)/100}else t.svgHeight=parseInt(e.chart.height,10);else t.axisCharts?t.svgHeight=t.svgWidth/1.61:t.svgHeight=t.svgWidth/1.2;t.svgWidth<0&&(t.svgWidth=0),t.svgHeight<0&&(t.svgHeight=0),w.setAttrs(t.dom.Paper.node,{width:t.svgWidth,height:t.svgHeight});var i=e.chart.sparkline.enabled?0:t.axisCharts?e.chart.parentHeightOffset:0;t.dom.Paper.node.parentNode.parentNode.style.minHeight=t.svgHeight+i+"px",t.dom.elWrap.style.width=t.svgWidth+"px",t.dom.elWrap.style.height=t.svgHeight+"px"}},{key:"shiftGraphPosition",value:function(){var t=this.w.globals,e=t.translateY,n={transform:"translate("+t.translateX+", "+e+")"};w.setAttrs(t.dom.elGraphical.node,n)}},{key:"resizeNonAxisCharts",value:function(){var t=this.w,e=t.globals,n=0,l=t.config.chart.sparkline.enabled?1:15;l+=t.config.grid.padding.bottom,"top"!==t.config.legend.position&&"bottom"!==t.config.legend.position||!t.config.legend.show||t.config.legend.floating||(n=new pt(this.ctx).legendHelpers.getLegendBBox().clwh+10);var a=t.globals.dom.baseEl.querySelector(".apexcharts-radialbar"),i=2.05*t.globals.radialSize;if(a&&!t.config.chart.sparkline.enabled){var r=y.getBoundingClientRect(a);i=r.bottom;var o=r.bottom-r.top;i=Math.max(2.05*t.globals.radialSize,o)}var s=i+e.translateY+n+l;e.dom.elLegendForeign&&e.dom.elLegendForeign.setAttribute("height",s),e.dom.elWrap.style.height=s+"px",w.setAttrs(e.dom.Paper.node,{height:s}),e.dom.Paper.node.parentNode.parentNode.style.minHeight=s+"px"}},{key:"coreCalculations",value:function(){new Q(this.ctx).init()}},{key:"resetGlobals",value:function(){var t=this,e=function(){return t.w.config.series.map((function(t){return[]}))},n=new Z,l=this.w.globals;n.initGlobalVars(l),l.seriesXvalues=e(),l.seriesYvalues=e()}},{key:"isMultipleY",value:function(){if(this.w.config.yaxis.constructor===Array&&this.w.config.yaxis.length>1)return this.w.globals.isMultipleYAxis=!0,!0}},{key:"xySettings",value:function(){var t=null,e=this.w;if(e.globals.axisCharts){if("back"===e.config.xaxis.crosshairs.position&&new lt(this.ctx).drawXCrosshairs(),"back"===e.config.yaxis[0].crosshairs.position&&new lt(this.ctx).drawYCrosshairs(),"datetime"===e.config.xaxis.type&&void 0===e.config.xaxis.labels.formatter){this.ctx.timeScale=new Rt(this.ctx);var n=[];isFinite(e.globals.minX)&&isFinite(e.globals.maxX)&&!e.globals.isBarHorizontal?n=this.ctx.timeScale.calculateTimeScaleTicks(e.globals.minX,e.globals.maxX):e.globals.isBarHorizontal&&(n=this.ctx.timeScale.calculateTimeScaleTicks(e.globals.minY,e.globals.maxY)),this.ctx.timeScale.recalcDimensionsBasedOnFormat(n)}t=new k(this.ctx).getCalculatedRatios()}return t}},{key:"updateSourceChart",value:function(t){this.ctx.w.globals.selection=void 0,this.ctx.updateHelpers._updateOptions({chart:{selection:{xaxis:{min:t.w.globals.minX,max:t.w.globals.maxX}}}},!1,!1)}},{key:"setupBrushHandler",value:function(){var t=this,e=this.w;if(e.config.chart.brush.enabled&&"function"!=typeof e.config.chart.events.selection){var n=e.config.chart.brush.targets||[e.config.chart.brush.target];n.forEach((function(e){var n=ApexCharts.getChartByID(e);n.w.globals.brushSource=t.ctx,"function"!=typeof n.w.config.chart.events.zoomed&&(n.w.config.chart.events.zoomed=function(){t.updateSourceChart(n)}),"function"!=typeof n.w.config.chart.events.scrolled&&(n.w.config.chart.events.scrolled=function(){t.updateSourceChart(n)})})),e.config.chart.events.selection=function(t,l){n.forEach((function(t){var n=ApexCharts.getChartByID(t),a=y.clone(e.config.yaxis);if(e.config.chart.brush.autoScaleYaxis&&1===n.w.globals.series.length){var i=new K(n);a=i.autoScaleY(n,a,l)}var r=n.w.config.yaxis.reduce((function(t,e,l){return[].concat(g(t),[d(d({},n.w.config.yaxis[l]),{},{min:a[0].min,max:a[0].max})])}),[]);n.ctx.updateHelpers._updateOptions({xaxis:{min:l.xaxis.min,max:l.xaxis.max},yaxis:r},!1,!1,!1,!1)}))}}}}]),t}(),jt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"_updateOptions",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=[this.ctx];i&&(o=this.ctx.getSyncedCharts()),this.ctx.w.globals.isExecCalled&&(o=[this.ctx],this.ctx.w.globals.isExecCalled=!1),o.forEach((function(i){var o=i.w;return o.globals.shouldAnimate=l,n||(o.globals.resized=!0,o.globals.dataChanged=!0,l&&i.series.getPreviousPaths()),t&&"object"===a(t)&&(i.config=new z(t),t=k.extendArrayProps(i.config,t,o),i.w.globals.chartID!==e.ctx.w.globals.chartID&&delete t.series,o.config=y.extend(o.config,t),r&&(o.globals.lastXAxis=t.xaxis?y.clone(t.xaxis):[],o.globals.lastYAxis=t.yaxis?y.clone(t.yaxis):[],o.globals.initialConfig=y.extend({},o.config),o.globals.initialSeries=y.clone(o.config.series))),i.update(t)}))}},{key:"_updateSeries",value:function(t,e){var n,l=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=this.w;return i.globals.shouldAnimate=e,i.globals.dataChanged=!0,e&&this.ctx.series.getPreviousPaths(),i.globals.axisCharts?(0===(n=t.map((function(t,e){return l._extendSeries(t,e)}))).length&&(n=[{data:[]}]),i.config.series=n):i.config.series=t.slice(),a&&(i.globals.initialSeries=y.clone(i.config.series)),this.ctx.update({series:t})}},{key:"_extendSeries",value:function(t,e){var n=this.w,l=n.config.series[e];return d(d({},n.config.series[e]),{},{name:t.name?t.name:l&&l.name,color:t.color?t.color:l&&l.color,type:t.type?t.type:l&&l.type,data:t.data?t.data:l&&l.data})}},{key:"toggleDataPointSelection",value:function(t,e){var n=this.w,l=null,a=".apexcharts-series[data\\:realIndex='".concat(t,"']");return n.globals.axisCharts?l=n.globals.dom.Paper.select("".concat(a," path[j='").concat(e,"'], ").concat(a," circle[j='").concat(e,"'], ").concat(a," rect[j='").concat(e,"']")).members[0]:void 0===e&&(l=n.globals.dom.Paper.select("".concat(a," path[j='").concat(t,"']")).members[0],"pie"!==n.config.chart.type&&"polarArea"!==n.config.chart.type&&"donut"!==n.config.chart.type||this.ctx.pie.pieClicked(t)),l?(new w(this.ctx).pathMouseDown(l,null),l.node?l.node:null):(console.warn("toggleDataPointSelection: Element not found"),null)}},{key:"forceXAxisUpdate",value:function(t){var e=this.w;if(["min","max"].forEach((function(n){void 0!==t.xaxis[n]&&(e.config.xaxis[n]=t.xaxis[n],e.globals.lastXAxis[n]=t.xaxis[n])})),t.xaxis.categories&&t.xaxis.categories.length&&(e.config.xaxis.categories=t.xaxis.categories),e.config.xaxis.convertedCatToNumeric){var n=new q(t);t=n.convertCatToNumericXaxis(t,this.ctx)}return t}},{key:"forceYAxisUpdate",value:function(t){var e=this.w;return e.config.chart.stacked&&"100%"===e.config.chart.stackType&&(Array.isArray(t.yaxis)?t.yaxis.forEach((function(e,n){t.yaxis[n].min=0,t.yaxis[n].max=100})):(t.yaxis.min=0,t.yaxis.max=100)),t}},{key:"revertDefaultAxisMinMax",value:function(){var t=this,e=this.w;e.config.xaxis.min=e.globals.lastXAxis.min,e.config.xaxis.max=e.globals.lastXAxis.max;e.config.yaxis.map((function(n,l){e.globals.zoomed||void 0!==e.globals.lastYAxis[l]?function(t){void 0!==e.globals.lastYAxis[t]&&(e.config.yaxis[t].min=e.globals.lastYAxis[t].min,e.config.yaxis[t].max=e.globals.lastYAxis[t].max)}(l):void 0!==t.ctx.opts.yaxis[l]&&(n.min=t.ctx.opts.yaxis[l].min,n.max=t.ctx.opts.yaxis[l].max)}))}}]),t}();v="undefined"!=typeof window?window:void 0,b=function(t,e){var n=(void 0!==this?this:t).SVG=function(t){if(n.supported)return t=new n.Doc(t),n.parser.draw||n.prepare(),t};if(n.ns="http://www.w3.org/2000/svg",n.xmlns="http://www.w3.org/2000/xmlns/",n.xlink="http://www.w3.org/1999/xlink",n.svgjs="http://svgjs.com/svgjs",n.supported=!0,!n.supported)return!1;n.did=1e3,n.eid=function(t){return"Svgjs"+u(t)+n.did++},n.create=function(t){var n=e.createElementNS(this.ns,t);return n.setAttribute("id",this.eid(t)),n},n.extend=function(){var t,e;e=(t=[].slice.call(arguments)).pop();for(var l=t.length-1;l>=0;l--)if(t[l])for(var a in e)t[l].prototype[a]=e[a];n.Set&&n.Set.inherit&&n.Set.inherit()},n.invent=function(t){var e="function"==typeof t.create?t.create:function(){this.constructor.call(this,n.create(t.create))};return t.inherit&&(e.prototype=new t.inherit),t.extend&&n.extend(e,t.extend),t.construct&&n.extend(t.parent||n.Container,t.construct),e},n.adopt=function(e){return e?e.instance?e.instance:((l="svg"==e.nodeName?e.parentNode instanceof t.SVGElement?new n.Nested:new n.Doc:"linearGradient"==e.nodeName?new n.Gradient("linear"):"radialGradient"==e.nodeName?new n.Gradient("radial"):n[u(e.nodeName)]?new(n[u(e.nodeName)]):new n.Element(e)).type=e.nodeName,l.node=e,e.instance=l,l instanceof n.Doc&&l.namespace().defs(),l.setData(JSON.parse(e.getAttribute("svgjs:data"))||{}),l):null;var l},n.prepare=function(){var t=e.getElementsByTagName("body")[0],l=(t?new n.Doc(t):n.adopt(e.documentElement).nested()).size(2,0);n.parser={body:t||e.documentElement,draw:l.style("opacity:0;position:absolute;left:-100%;top:-100%;overflow:hidden").node,poly:l.polyline().node,path:l.path().node,native:n.create("svg")}},n.parser={native:n.create("svg")},e.addEventListener("DOMContentLoaded",(function(){n.parser.draw||n.prepare()}),!1),n.regex={numberAndUnit:/^([+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?)([a-z%]*)$/i,hex:/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,rgb:/rgb\((\d+),(\d+),(\d+)\)/,reference:/#([a-z0-9\-_]+)/i,transforms:/\)\s*,?\s*/,whitespace:/\s/g,isHex:/^#[a-f0-9]{3,6}$/i,isRgb:/^rgb\(/,isCss:/[^:]+:[^;]+;?/,isBlank:/^(\s+)?$/,isNumber:/^[+-]?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,isPercent:/^-?[\d\.]+%$/,isImage:/\.(jpg|jpeg|png|gif|svg)(\?[^=]+.*)?/i,delimiter:/[\s,]+/,hyphen:/([^e])\-/gi,pathLetters:/[MLHVCSQTAZ]/gi,isPathLetter:/[MLHVCSQTAZ]/i,numbersWithDots:/((\d?\.\d+(?:e[+-]?\d+)?)((?:\.\d+(?:e[+-]?\d+)?)+))+/gi,dots:/\./g},n.utils={map:function(t,e){for(var n=t.length,l=[],a=0;a1?1:t,new n.Color({r:~~(this.r+(this.destination.r-this.r)*t),g:~~(this.g+(this.destination.g-this.g)*t),b:~~(this.b+(this.destination.b-this.b)*t)})):this}}),n.Color.test=function(t){return t+="",n.regex.isHex.test(t)||n.regex.isRgb.test(t)},n.Color.isRgb=function(t){return t&&"number"==typeof t.r&&"number"==typeof t.g&&"number"==typeof t.b},n.Color.isColor=function(t){return n.Color.isRgb(t)||n.Color.test(t)},n.Array=function(t,e){0==(t=(t||[]).valueOf()).length&&e&&(t=e.valueOf()),this.value=this.parse(t)},n.extend(n.Array,{toString:function(){return this.value.join(" ")},valueOf:function(){return this.value},parse:function(t){return t=t.valueOf(),Array.isArray(t)?t:this.split(t)}}),n.PointArray=function(t,e){n.Array.call(this,t,e||[[0,0]])},n.PointArray.prototype=new n.Array,n.PointArray.prototype.constructor=n.PointArray;for(var l={M:function(t,e,n){return e.x=n.x=t[0],e.y=n.y=t[1],["M",e.x,e.y]},L:function(t,e){return e.x=t[0],e.y=t[1],["L",t[0],t[1]]},H:function(t,e){return e.x=t[0],["H",t[0]]},V:function(t,e){return e.y=t[0],["V",t[0]]},C:function(t,e){return e.x=t[4],e.y=t[5],["C",t[0],t[1],t[2],t[3],t[4],t[5]]},Q:function(t,e){return e.x=t[2],e.y=t[3],["Q",t[0],t[1],t[2],t[3]]},Z:function(t,e,n){return e.x=n.x,e.y=n.y,["Z"]}},i="mlhvqtcsaz".split(""),r=0,o=i.length;rs);return i},bbox:function(){return n.parser.draw||n.prepare(),n.parser.path.setAttribute("d",this.toString()),n.parser.path.getBBox()}}),n.Number=n.invent({create:function(t,e){this.value=0,this.unit=e||"","number"==typeof t?this.value=isNaN(t)?0:isFinite(t)?t:t<0?-34e37:34e37:"string"==typeof t?(e=t.match(n.regex.numberAndUnit))&&(this.value=parseFloat(e[1]),"%"==e[5]?this.value/=100:"s"==e[5]&&(this.value*=1e3),this.unit=e[5]):t instanceof n.Number&&(this.value=t.valueOf(),this.unit=t.unit)},extend:{toString:function(){return("%"==this.unit?~~(1e8*this.value)/1e6:"s"==this.unit?this.value/1e3:this.value)+this.unit},toJSON:function(){return this.toString()},valueOf:function(){return this.value},plus:function(t){return t=new n.Number(t),new n.Number(this+t,this.unit||t.unit)},minus:function(t){return t=new n.Number(t),new n.Number(this-t,this.unit||t.unit)},times:function(t){return t=new n.Number(t),new n.Number(this*t,this.unit||t.unit)},divide:function(t){return t=new n.Number(t),new n.Number(this/t,this.unit||t.unit)},to:function(t){var e=new n.Number(this);return"string"==typeof t&&(e.unit=t),e},morph:function(t){return this.destination=new n.Number(t),t.relative&&(this.destination.value+=this.value),this},at:function(t){return this.destination?new n.Number(this.destination).minus(this).times(t).plus(this):this}}}),n.Element=n.invent({create:function(t){this._stroke=n.defaults.attrs.stroke,this._event=null,this.dom={},(this.node=t)&&(this.type=t.nodeName,this.node.instance=this,this._stroke=t.getAttribute("stroke")||this._stroke)},extend:{x:function(t){return this.attr("x",t)},y:function(t){return this.attr("y",t)},cx:function(t){return null==t?this.x()+this.width()/2:this.x(t-this.width()/2)},cy:function(t){return null==t?this.y()+this.height()/2:this.y(t-this.height()/2)},move:function(t,e){return this.x(t).y(e)},center:function(t,e){return this.cx(t).cy(e)},width:function(t){return this.attr("width",t)},height:function(t){return this.attr("height",t)},size:function(t,e){var l=p(this,t,e);return this.width(new n.Number(l.width)).height(new n.Number(l.height))},clone:function(t){this.writeDataToDom();var e=m(this.node.cloneNode(!0));return t?t.add(e):this.after(e),e},remove:function(){return this.parent()&&this.parent().removeElement(this),this},replace:function(t){return this.after(t).remove(),t},addTo:function(t){return t.put(this)},putIn:function(t){return t.add(this)},id:function(t){return this.attr("id",t)},show:function(){return this.style("display","")},hide:function(){return this.style("display","none")},visible:function(){return"none"!=this.style("display")},toString:function(){return this.attr("id")},classes:function(){var t=this.attr("class");return null==t?[]:t.trim().split(n.regex.delimiter)},hasClass:function(t){return-1!=this.classes().indexOf(t)},addClass:function(t){if(!this.hasClass(t)){var e=this.classes();e.push(t),this.attr("class",e.join(" "))}return this},removeClass:function(t){return this.hasClass(t)&&this.attr("class",this.classes().filter((function(e){return e!=t})).join(" ")),this},toggleClass:function(t){return this.hasClass(t)?this.removeClass(t):this.addClass(t)},reference:function(t){return n.get(this.attr(t))},parent:function(e){var l=this;if(!l.node.parentNode)return null;if(l=n.adopt(l.node.parentNode),!e)return l;for(;l&&l.node instanceof t.SVGElement;){if("string"==typeof e?l.matches(e):l instanceof e)return l;if(!l.node.parentNode||"#document"==l.node.parentNode.nodeName)return null;l=n.adopt(l.node.parentNode)}},doc:function(){return this instanceof n.Doc?this:this.parent(n.Doc)},parents:function(t){var e=[],n=this;do{if(!(n=n.parent(t))||!n.node)break;e.push(n)}while(n.parent);return e},matches:function(t){return function(t,e){return(t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector).call(t,e)}(this.node,t)},native:function(){return this.node},svg:function(t){var l=e.createElement("svg");if(!(t&&this instanceof n.Parent))return l.appendChild(t=e.createElement("svg")),this.writeDataToDom(),t.appendChild(this.node.cloneNode(!0)),l.innerHTML.replace(/^/,"").replace(/<\/svg>$/,"");l.innerHTML=""+t.replace(/\n/,"").replace(/<([\w:-]+)([^<]+?)\/>/g,"<$1$2>")+"";for(var a=0,i=l.firstChild.childNodes.length;a":function(t){return-Math.cos(t*Math.PI)/2+.5},">":function(t){return Math.sin(t*Math.PI/2)},"<":function(t){return 1-Math.cos(t*Math.PI/2)}},n.morph=function(t){return function(e,l){return new n.MorphObj(e,l).at(t)}},n.Situation=n.invent({create:function(t){this.init=!1,this.reversed=!1,this.reversing=!1,this.duration=new n.Number(t.duration).valueOf(),this.delay=new n.Number(t.delay).valueOf(),this.start=+new Date+this.delay,this.finish=this.start+this.duration,this.ease=t.ease,this.loop=0,this.loops=!1,this.animations={},this.attrs={},this.styles={},this.transforms=[],this.once={}}}),n.FX=n.invent({create:function(t){this._target=t,this.situations=[],this.active=!1,this.situation=null,this.paused=!1,this.lastPos=0,this.pos=0,this.absPos=0,this._speed=1},extend:{animate:function(t,e,l){"object"===a(t)&&(e=t.ease,l=t.delay,t=t.duration);var i=new n.Situation({duration:t||1e3,delay:l||0,ease:n.easing[e||"-"]||e});return this.queue(i),this},target:function(t){return t&&t instanceof n.Element?(this._target=t,this):this._target},timeToAbsPos:function(t){return(t-this.situation.start)/(this.situation.duration/this._speed)},absPosToTime:function(t){return this.situation.duration/this._speed*t+this.situation.start},startAnimFrame:function(){this.stopAnimFrame(),this.animationFrame=t.requestAnimationFrame(function(){this.step()}.bind(this))},stopAnimFrame:function(){t.cancelAnimationFrame(this.animationFrame)},start:function(){return!this.active&&this.situation&&(this.active=!0,this.startCurrent()),this},startCurrent:function(){return this.situation.start=+new Date+this.situation.delay/this._speed,this.situation.finish=this.situation.start+this.situation.duration/this._speed,this.initAnimations().step()},queue:function(t){return("function"==typeof t||t instanceof n.Situation)&&this.situations.push(t),this.situation||(this.situation=this.situations.shift()),this},dequeue:function(){return this.stop(),this.situation=this.situations.shift(),this.situation&&(this.situation instanceof n.Situation?this.start():this.situation.call(this)),this},initAnimations:function(){var t,e=this.situation;if(e.init)return this;for(var l in e.animations){t=this.target()[l](),Array.isArray(t)||(t=[t]),Array.isArray(e.animations[l])||(e.animations[l]=[e.animations[l]]);for(var a=t.length;a--;)e.animations[l][a]instanceof n.Number&&(t[a]=new n.Number(t[a])),e.animations[l][a]=t[a].morph(e.animations[l][a])}for(var l in e.attrs)e.attrs[l]=new n.MorphObj(this.target().attr(l),e.attrs[l]);for(var l in e.styles)e.styles[l]=new n.MorphObj(this.target().style(l),e.styles[l]);return e.initialTransformation=this.target().matrixify(),e.init=!0,this},clearQueue:function(){return this.situations=[],this},clearCurrent:function(){return this.situation=null,this},stop:function(t,e){var n=this.active;return this.active=!1,e&&this.clearQueue(),t&&this.situation&&(!n&&this.startCurrent(),this.atEnd()),this.stopAnimFrame(),this.clearCurrent()},after:function(t){var e=this.last();return this.target().on("finished.fx",(function n(l){l.detail.situation==e&&(t.call(this,e),this.off("finished.fx",n))})),this._callStart()},during:function(t){var e=this.last(),l=function(l){l.detail.situation==e&&t.call(this,l.detail.pos,n.morph(l.detail.pos),l.detail.eased,e)};return this.target().off("during.fx",l).on("during.fx",l),this.after((function(){this.off("during.fx",l)})),this._callStart()},afterAll:function(t){var e=function e(n){t.call(this),this.off("allfinished.fx",e)};return this.target().off("allfinished.fx",e).on("allfinished.fx",e),this._callStart()},last:function(){return this.situations.length?this.situations[this.situations.length-1]:this.situation},add:function(t,e,n){return this.last()[n||"animations"][t]=e,this._callStart()},step:function(t){var e,n,l;t||(this.absPos=this.timeToAbsPos(+new Date)),!1!==this.situation.loops?(e=Math.max(this.absPos,0),n=Math.floor(e),!0===this.situation.loops||nthis.lastPos&&i<=a&&(this.situation.once[i].call(this.target(),this.pos,a),delete this.situation.once[i]);return this.active&&this.target().fire("during",{pos:this.pos,eased:a,fx:this,situation:this.situation}),this.situation?(this.eachAt(),1==this.pos&&!this.situation.reversed||this.situation.reversed&&0==this.pos?(this.stopAnimFrame(),this.target().fire("finished",{fx:this,situation:this.situation}),this.situations.length||(this.target().fire("allfinished"),this.situations.length||(this.target().off(".fx"),this.active=!1)),this.active?this.dequeue():this.clearCurrent()):!this.paused&&this.active&&this.startAnimFrame(),this.lastPos=a,this):this},eachAt:function(){var t,e=this,l=this.target(),a=this.situation;for(var i in a.animations)t=[].concat(a.animations[i]).map((function(t){return"string"!=typeof t&&t.at?t.at(a.ease(e.pos),e.pos):t})),l[i].apply(l,t);for(var i in a.attrs)t=[i].concat(a.attrs[i]).map((function(t){return"string"!=typeof t&&t.at?t.at(a.ease(e.pos),e.pos):t})),l.attr.apply(l,t);for(var i in a.styles)t=[i].concat(a.styles[i]).map((function(t){return"string"!=typeof t&&t.at?t.at(a.ease(e.pos),e.pos):t})),l.style.apply(l,t);if(a.transforms.length){t=a.initialTransformation,i=0;for(var r=a.transforms.length;i=0;--l)this[y[l]]=null!=t[y[l]]?t[y[l]]:e[y[l]]},extend:{extract:function(){var t=f(this,0,1),e=(f(this,1,0),180/Math.PI*Math.atan2(t.y,t.x)-90);return{x:this.e,y:this.f,transformedX:(this.e*Math.cos(e*Math.PI/180)+this.f*Math.sin(e*Math.PI/180))/Math.sqrt(this.a*this.a+this.b*this.b),transformedY:(this.f*Math.cos(e*Math.PI/180)+this.e*Math.sin(-e*Math.PI/180))/Math.sqrt(this.c*this.c+this.d*this.d),rotation:e,a:this.a,b:this.b,c:this.c,d:this.d,e:this.e,f:this.f,matrix:new n.Matrix(this)}},clone:function(){return new n.Matrix(this)},morph:function(t){return this.destination=new n.Matrix(t),this},multiply:function(t){return new n.Matrix(this.native().multiply(function(t){return t instanceof n.Matrix||(t=new n.Matrix(t)),t}(t).native()))},inverse:function(){return new n.Matrix(this.native().inverse())},translate:function(t,e){return new n.Matrix(this.native().translate(t||0,e||0))},native:function(){for(var t=n.parser.native.createSVGMatrix(),e=y.length-1;e>=0;e--)t[y[e]]=this[y[e]];return t},toString:function(){return"matrix("+b(this.a)+","+b(this.b)+","+b(this.c)+","+b(this.d)+","+b(this.e)+","+b(this.f)+")"}},parent:n.Element,construct:{ctm:function(){return new n.Matrix(this.node.getCTM())},screenCTM:function(){if(this instanceof n.Nested){var t=this.rect(1,1),e=t.node.getScreenCTM();return t.remove(),new n.Matrix(e)}return new n.Matrix(this.node.getScreenCTM())}}}),n.Point=n.invent({create:function(t,e){var n;n=Array.isArray(t)?{x:t[0],y:t[1]}:"object"===a(t)?{x:t.x,y:t.y}:null!=t?{x:t,y:null!=e?e:t}:{x:0,y:0},this.x=n.x,this.y=n.y},extend:{clone:function(){return new n.Point(this)},morph:function(t,e){return this.destination=new n.Point(t,e),this}}}),n.extend(n.Element,{point:function(t,e){return new n.Point(t,e).transform(this.screenCTM().inverse())}}),n.extend(n.Element,{attr:function(t,e,l){if(null==t){for(t={},l=(e=this.node.attributes).length-1;l>=0;l--)t[e[l].nodeName]=n.regex.isNumber.test(e[l].nodeValue)?parseFloat(e[l].nodeValue):e[l].nodeValue;return t}if("object"===a(t))for(var i in t)this.attr(i,t[i]);else if(null===e)this.node.removeAttribute(t);else{if(null==e)return null==(e=this.node.getAttribute(t))?n.defaults.attrs[t]:n.regex.isNumber.test(e)?parseFloat(e):e;"stroke-width"==t?this.attr("stroke",parseFloat(e)>0?this._stroke:null):"stroke"==t&&(this._stroke=e),"fill"!=t&&"stroke"!=t||(n.regex.isImage.test(e)&&(e=this.doc().defs().image(e,0,0)),e instanceof n.Image&&(e=this.doc().defs().pattern(0,0,(function(){this.add(e)})))),"number"==typeof e?e=new n.Number(e):n.Color.isColor(e)?e=new n.Color(e):Array.isArray(e)&&(e=new n.Array(e)),"leading"==t?this.leading&&this.leading(e):"string"==typeof l?this.node.setAttributeNS(l,t,e.toString()):this.node.setAttribute(t,e.toString()),!this.rebuild||"font-size"!=t&&"x"!=t||this.rebuild(t,e)}return this}}),n.extend(n.Element,{transform:function(t,e){var l;return"object"!==a(t)?(l=new n.Matrix(this).extract(),"string"==typeof t?l[t]:l):(l=new n.Matrix(this),e=!!e||!!t.relative,null!=t.a&&(l=e?l.multiply(new n.Matrix(t)):new n.Matrix(t)),this.attr("transform",l))}}),n.extend(n.Element,{untransform:function(){return this.attr("transform",null)},matrixify:function(){return(this.attr("transform")||"").split(n.regex.transforms).slice(0,-1).map((function(t){var e=t.trim().split("(");return[e[0],e[1].split(n.regex.delimiter).map((function(t){return parseFloat(t)}))]})).reduce((function(t,e){return"matrix"==e[0]?t.multiply(g(e[1])):t[e[0]].apply(t,e[1])}),new n.Matrix)},toParent:function(t){if(this==t)return this;var e=this.screenCTM(),n=t.screenCTM().inverse();return this.addTo(t).untransform().transform(n.multiply(e)),this},toDoc:function(){return this.toParent(this.doc())}}),n.Transformation=n.invent({create:function(t,e){if(arguments.length>1&&"boolean"!=typeof e)return this.constructor.call(this,[].slice.call(arguments));if(Array.isArray(t))for(var n=0,l=this.arguments.length;n=0},index:function(t){return[].slice.call(this.node.childNodes).indexOf(t.node)},get:function(t){return n.adopt(this.node.childNodes[t])},first:function(){return this.get(0)},last:function(){return this.get(this.node.childNodes.length-1)},each:function(t,e){for(var l=this.children(),a=0,i=l.length;a=0;l--)e.childNodes[l]instanceof t.SVGElement&&m(e.childNodes[l]);return n.adopt(e).id(n.eid(e.nodeName))}function v(t){return null==t.x&&(t.x=0,t.y=0,t.width=0,t.height=0),t.w=t.width,t.h=t.height,t.x2=t.x+t.width,t.y2=t.y+t.height,t.cx=t.x+t.width/2,t.cy=t.y+t.height/2,t}function b(t){return Math.abs(t)>1e-37?t:0}["fill","stroke"].forEach((function(t){var e={};e[t]=function(e){if(void 0===e)return this;if("string"==typeof e||n.Color.isRgb(e)||e&&"function"==typeof e.fill)this.attr(t,e);else for(var l=s[t].length-1;l>=0;l--)null!=e[s[t][l]]&&this.attr(s.prefix(t,s[t][l]),e[s[t][l]]);return this},n.extend(n.Element,n.FX,e)})),n.extend(n.Element,n.FX,{translate:function(t,e){return this.transform({x:t,y:e})},matrix:function(t){return this.attr("transform",new n.Matrix(6==arguments.length?[].slice.call(arguments):t))},opacity:function(t){return this.attr("opacity",t)},dx:function(t){return this.x(new n.Number(t).plus(this instanceof n.FX?0:this.x()),!0)},dy:function(t){return this.y(new n.Number(t).plus(this instanceof n.FX?0:this.y()),!0)}}),n.extend(n.Path,{length:function(){return this.node.getTotalLength()},pointAt:function(t){return this.node.getPointAtLength(t)}}),n.Set=n.invent({create:function(t){Array.isArray(t)?this.members=t:this.clear()},extend:{add:function(){for(var t=[].slice.call(arguments),e=0,n=t.length;e-1&&this.members.splice(e,1),this},each:function(t){for(var e=0,n=this.members.length;e=0},index:function(t){return this.members.indexOf(t)},get:function(t){return this.members[t]},first:function(){return this.get(0)},last:function(){return this.get(this.members.length-1)},valueOf:function(){return this.members}},construct:{set:function(t){return new n.Set(t)}}}),n.FX.Set=n.invent({create:function(t){this.set=t}}),n.Set.inherit=function(){var t=[];for(var e in n.Shape.prototype)"function"==typeof n.Shape.prototype[e]&&"function"!=typeof n.Set.prototype[e]&&t.push(e);for(var e in t.forEach((function(t){n.Set.prototype[t]=function(){for(var e=0,l=this.members.length;e=0;t--)delete this.memory()[arguments[t]];return this},memory:function(){return this._memory||(this._memory={})}}),n.get=function(t){var l=e.getElementById(function(t){var e=(t||"").toString().match(n.regex.reference);if(e)return e[1]}(t)||t);return n.adopt(l)},n.select=function(t,l){return new n.Set(n.utils.map((l||e).querySelectorAll(t),(function(t){return n.adopt(t)})))},n.extend(n.Parent,{select:function(t){return n.select(t,this.node)}});var y="abcdef".split("");if("function"!=typeof t.CustomEvent){var x=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var l=e.createEvent("CustomEvent");return l.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),l};x.prototype=t.Event.prototype,n.CustomEvent=x}else n.CustomEvent=t.CustomEvent;return n},void 0!==(l=function(){return b(v,v.document)}.call(e,n,e,t))&&(t.exports=l),function(){SVG.Filter=SVG.invent({create:"filter",inherit:SVG.Parent,extend:{source:"SourceGraphic",sourceAlpha:"SourceAlpha",background:"BackgroundImage",backgroundAlpha:"BackgroundAlpha",fill:"FillPaint",stroke:"StrokePaint",autoSetIn:!0,put:function(t,e){return this.add(t,e),!t.attr("in")&&this.autoSetIn&&t.attr("in",this.source),t.attr("result")||t.attr("result",t),t},blend:function(t,e,n){return this.put(new SVG.BlendEffect(t,e,n))},colorMatrix:function(t,e){return this.put(new SVG.ColorMatrixEffect(t,e))},convolveMatrix:function(t){return this.put(new SVG.ConvolveMatrixEffect(t))},componentTransfer:function(t){return this.put(new SVG.ComponentTransferEffect(t))},composite:function(t,e,n){return this.put(new SVG.CompositeEffect(t,e,n))},flood:function(t,e){return this.put(new SVG.FloodEffect(t,e))},offset:function(t,e){return this.put(new SVG.OffsetEffect(t,e))},image:function(t){return this.put(new SVG.ImageEffect(t))},merge:function(){var t=[void 0];for(var e in arguments)t.push(arguments[e]);return this.put(new(SVG.MergeEffect.bind.apply(SVG.MergeEffect,t)))},gaussianBlur:function(t,e){return this.put(new SVG.GaussianBlurEffect(t,e))},morphology:function(t,e){return this.put(new SVG.MorphologyEffect(t,e))},diffuseLighting:function(t,e,n){return this.put(new SVG.DiffuseLightingEffect(t,e,n))},displacementMap:function(t,e,n,l,a){return this.put(new SVG.DisplacementMapEffect(t,e,n,l,a))},specularLighting:function(t,e,n,l){return this.put(new SVG.SpecularLightingEffect(t,e,n,l))},tile:function(){return this.put(new SVG.TileEffect)},turbulence:function(t,e,n,l,a){return this.put(new SVG.TurbulenceEffect(t,e,n,l,a))},toString:function(){return"url(#"+this.attr("id")+")"}}}),SVG.extend(SVG.Defs,{filter:function(t){var e=this.put(new SVG.Filter);return"function"==typeof t&&t.call(e,e),e}}),SVG.extend(SVG.Container,{filter:function(t){return this.defs().filter(t)}}),SVG.extend(SVG.Element,SVG.G,SVG.Nested,{filter:function(t){return this.filterer=t instanceof SVG.Element?t:this.doc().filter(t),this.doc()&&this.filterer.doc()!==this.doc()&&this.doc().defs().add(this.filterer),this.attr("filter",this.filterer),this.filterer},unfilter:function(t){return this.filterer&&!0===t&&this.filterer.remove(),delete this.filterer,this.attr("filter",null)}}),SVG.Effect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Element,extend:{in:function(t){return null==t?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",t)},result:function(t){return null==t?this.attr("result"):this.attr("result",t)},toString:function(){return this.result()}}}),SVG.ParentEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Parent,extend:{in:function(t){return null==t?this.parent()&&this.parent().select('[result="'+this.attr("in")+'"]').get(0)||this.attr("in"):this.attr("in",t)},result:function(t){return null==t?this.attr("result"):this.attr("result",t)},toString:function(){return this.result()}}});var t={blend:function(t,e){return this.parent()&&this.parent().blend(this,t,e)},colorMatrix:function(t,e){return this.parent()&&this.parent().colorMatrix(t,e).in(this)},convolveMatrix:function(t){return this.parent()&&this.parent().convolveMatrix(t).in(this)},componentTransfer:function(t){return this.parent()&&this.parent().componentTransfer(t).in(this)},composite:function(t,e){return this.parent()&&this.parent().composite(this,t,e)},flood:function(t,e){return this.parent()&&this.parent().flood(t,e)},offset:function(t,e){return this.parent()&&this.parent().offset(t,e).in(this)},image:function(t){return this.parent()&&this.parent().image(t)},merge:function(){return this.parent()&&this.parent().merge.apply(this.parent(),[this].concat(arguments))},gaussianBlur:function(t,e){return this.parent()&&this.parent().gaussianBlur(t,e).in(this)},morphology:function(t,e){return this.parent()&&this.parent().morphology(t,e).in(this)},diffuseLighting:function(t,e,n){return this.parent()&&this.parent().diffuseLighting(t,e,n).in(this)},displacementMap:function(t,e,n,l){return this.parent()&&this.parent().displacementMap(this,t,e,n,l)},specularLighting:function(t,e,n,l){return this.parent()&&this.parent().specularLighting(t,e,n,l).in(this)},tile:function(){return this.parent()&&this.parent().tile().in(this)},turbulence:function(t,e,n,l,a){return this.parent()&&this.parent().turbulence(t,e,n,l,a).in(this)}};SVG.extend(SVG.Effect,t),SVG.extend(SVG.ParentEffect,t),SVG.ChildEffect=SVG.invent({create:function(){this.constructor.call(this)},inherit:SVG.Element,extend:{in:function(t){this.attr("in",t)}}});var e={blend:function(t,e,n){this.attr({in:t,in2:e,mode:n||"normal"})},colorMatrix:function(t,e){"matrix"==t&&(e=a(e)),this.attr({type:t,values:void 0===e?null:e})},convolveMatrix:function(t){t=a(t),this.attr({order:Math.sqrt(t.split(" ").length),kernelMatrix:t})},composite:function(t,e,n){this.attr({in:t,in2:e,operator:n})},flood:function(t,e){this.attr("flood-color",t),null!=e&&this.attr("flood-opacity",e)},offset:function(t,e){this.attr({dx:t,dy:e})},image:function(t){this.attr("href",t,SVG.xlink)},displacementMap:function(t,e,n,l,a){this.attr({in:t,in2:e,scale:n,xChannelSelector:l,yChannelSelector:a})},gaussianBlur:function(t,e){null!=t||null!=e?this.attr("stdDeviation",i(Array.prototype.slice.call(arguments))):this.attr("stdDeviation","0 0")},morphology:function(t,e){this.attr({operator:t,radius:e})},tile:function(){},turbulence:function(t,e,n,l,a){this.attr({numOctaves:e,seed:n,stitchTiles:l,baseFrequency:t,type:a})}},n={merge:function(){var t;if(arguments[0]instanceof SVG.Set){var e=this;arguments[0].each((function(t){this instanceof SVG.MergeNode?e.put(this):(this instanceof SVG.Effect||this instanceof SVG.ParentEffect)&&e.put(new SVG.MergeNode(this))}))}else{t=Array.isArray(arguments[0])?arguments[0]:arguments;for(var n=0;n1&&(E*=l=Math.sqrt(l),M*=l),a=(new SVG.Matrix).rotate(A).scale(1/E,1/M).rotate(-A),O=O.transform(a),o=(i=[(N=N.transform(a)).x-O.x,N.y-O.y])[0]*i[0]+i[1]*i[1],r=Math.sqrt(o),i[0]/=r,i[1]/=r,s=o<4?Math.sqrt(1-o/4):0,I===R&&(s*=-1),c=new SVG.Point((N.x+O.x)/2+s*-i[1],(N.y+O.y)/2+s*i[0]),d=new SVG.Point(O.x-c.x,O.y-c.y),u=new SVG.Point(N.x-c.x,N.y-c.y),h=Math.acos(d.x/Math.sqrt(d.x*d.x+d.y*d.y)),d.y<0&&(h*=-1),p=Math.acos(u.x/Math.sqrt(u.x*u.x+u.y*u.y)),u.y<0&&(p*=-1),R&&h>p&&(p+=2*Math.PI),!R&&hi.maxX-e.width&&(r=(l=i.maxX-e.width)-this.startPoints.box.x),null!=i.minY&&ai.maxY-e.height&&(o=(a=i.maxY-e.height)-this.startPoints.box.y),null!=i.snapToGrid&&(l-=l%i.snapToGrid,a-=a%i.snapToGrid,r-=r%i.snapToGrid,o-=o%i.snapToGrid),this.el instanceof SVG.G?this.el.matrix(this.startPoints.transform).transform({x:r,y:o},!0):this.el.move(l,a));return n},t.prototype.end=function(t){var e=this.drag(t);this.el.fire("dragend",{event:t,p:e,m:this.m,handler:this}),SVG.off(window,"mousemove.drag"),SVG.off(window,"touchmove.drag"),SVG.off(window,"mouseup.drag"),SVG.off(window,"touchend.drag")},SVG.extend(SVG.Element,{draggable:function(e,n){"function"!=typeof e&&"object"!=typeof e||(n=e,e=!0);var l=this.remember("_draggable")||new t(this);return(e=void 0===e||e)?l.init(n||{},e):(this.off("mousedown.drag"),this.off("touchstart.drag")),this}})}.call(void 0),function(){function t(t){this.el=t,t.remember("_selectHandler",this),this.pointSelection={isSelected:!1},this.rectSelection={isSelected:!1},this.pointsList={lt:[0,0],rt:["width",0],rb:["width","height"],lb:[0,"height"],t:["width",0],r:["width","height"],b:["width","height"],l:[0,"height"]},this.pointCoord=function(t,e,n){var l="string"!=typeof t?t:e[t];return n?l/2:l},this.pointCoords=function(t,e){var n=this.pointsList[t];return{x:this.pointCoord(n[0],e,"t"===t||"b"===t),y:this.pointCoord(n[1],e,"r"===t||"l"===t)}}}t.prototype.init=function(t,e){var n=this.el.bbox();this.options={};var l=this.el.selectize.defaults.points;for(var a in this.el.selectize.defaults)this.options[a]=this.el.selectize.defaults[a],void 0!==e[a]&&(this.options[a]=e[a]);var i=["points","pointsExclude"];for(var a in i){var r=this.options[i[a]];"string"==typeof r?r=r.length>0?r.split(/\s*,\s*/i):[]:"boolean"==typeof r&&"points"===i[a]&&(r=r?l:[]),this.options[i[a]]=r}this.options.points=[l,this.options.points].reduce((function(t,e){return t.filter((function(t){return e.indexOf(t)>-1}))})),this.options.points=[this.options.points,this.options.pointsExclude].reduce((function(t,e){return t.filter((function(t){return e.indexOf(t)<0}))})),this.parent=this.el.parent(),this.nested=this.nested||this.parent.group(),this.nested.matrix(new SVG.Matrix(this.el).translate(n.x,n.y)),this.options.deepSelect&&-1!==["line","polyline","polygon"].indexOf(this.el.type)?this.selectPoints(t):this.selectRect(t),this.observe(),this.cleanup()},t.prototype.selectPoints=function(t){return this.pointSelection.isSelected=t,this.pointSelection.set||(this.pointSelection.set=this.parent.set(),this.drawPoints()),this},t.prototype.getPointArray=function(){var t=this.el.bbox();return this.el.array().valueOf().map((function(e){return[e[0]-t.x,e[1]-t.y]}))},t.prototype.drawPoints=function(){for(var t=this,e=this.getPointArray(),n=0,l=e.length;n0&&this.parameters.box.height-n[1]>0){if("text"===this.parameters.type)return this.el.move(this.parameters.box.x+n[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize-n[0]);n=this.checkAspectRatio(n),this.el.move(this.parameters.box.x+n[0],this.parameters.box.y+n[1]).size(this.parameters.box.width-n[0],this.parameters.box.height-n[1])}};break;case"rt":this.calc=function(t,e){var n=this.snapToGrid(t,e,2);if(this.parameters.box.width+n[0]>0&&this.parameters.box.height-n[1]>0){if("text"===this.parameters.type)return this.el.move(this.parameters.box.x-n[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize+n[0]);n=this.checkAspectRatio(n,!0),this.el.move(this.parameters.box.x,this.parameters.box.y+n[1]).size(this.parameters.box.width+n[0],this.parameters.box.height-n[1])}};break;case"rb":this.calc=function(t,e){var n=this.snapToGrid(t,e,0);if(this.parameters.box.width+n[0]>0&&this.parameters.box.height+n[1]>0){if("text"===this.parameters.type)return this.el.move(this.parameters.box.x-n[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize+n[0]);n=this.checkAspectRatio(n),this.el.move(this.parameters.box.x,this.parameters.box.y).size(this.parameters.box.width+n[0],this.parameters.box.height+n[1])}};break;case"lb":this.calc=function(t,e){var n=this.snapToGrid(t,e,1);if(this.parameters.box.width-n[0]>0&&this.parameters.box.height+n[1]>0){if("text"===this.parameters.type)return this.el.move(this.parameters.box.x+n[0],this.parameters.box.y),void this.el.attr("font-size",this.parameters.fontSize-n[0]);n=this.checkAspectRatio(n,!0),this.el.move(this.parameters.box.x+n[0],this.parameters.box.y).size(this.parameters.box.width-n[0],this.parameters.box.height+n[1])}};break;case"t":this.calc=function(t,e){var n=this.snapToGrid(t,e,2);if(this.parameters.box.height-n[1]>0){if("text"===this.parameters.type)return;this.el.move(this.parameters.box.x,this.parameters.box.y+n[1]).height(this.parameters.box.height-n[1])}};break;case"r":this.calc=function(t,e){var n=this.snapToGrid(t,e,0);if(this.parameters.box.width+n[0]>0){if("text"===this.parameters.type)return;this.el.move(this.parameters.box.x,this.parameters.box.y).width(this.parameters.box.width+n[0])}};break;case"b":this.calc=function(t,e){var n=this.snapToGrid(t,e,0);if(this.parameters.box.height+n[1]>0){if("text"===this.parameters.type)return;this.el.move(this.parameters.box.x,this.parameters.box.y).height(this.parameters.box.height+n[1])}};break;case"l":this.calc=function(t,e){var n=this.snapToGrid(t,e,1);if(this.parameters.box.width-n[0]>0){if("text"===this.parameters.type)return;this.el.move(this.parameters.box.x+n[0],this.parameters.box.y).width(this.parameters.box.width-n[0])}};break;case"rot":this.calc=function(t,e){var n=t+this.parameters.p.x,l=e+this.parameters.p.y,a=Math.atan2(this.parameters.p.y-this.parameters.box.y-this.parameters.box.height/2,this.parameters.p.x-this.parameters.box.x-this.parameters.box.width/2),i=Math.atan2(l-this.parameters.box.y-this.parameters.box.height/2,n-this.parameters.box.x-this.parameters.box.width/2),r=this.parameters.rotation+180*(i-a)/Math.PI+this.options.snapToAngle/2;this.el.center(this.parameters.box.cx,this.parameters.box.cy).rotate(r-r%this.options.snapToAngle,this.parameters.box.cx,this.parameters.box.cy)};break;case"point":this.calc=function(t,e){var n=this.snapToGrid(t,e,this.parameters.pointCoords[0],this.parameters.pointCoords[1]),l=this.el.array().valueOf();l[this.parameters.i][0]=this.parameters.pointCoords[0]+n[0],l[this.parameters.i][1]=this.parameters.pointCoords[1]+n[1],this.el.plot(l)}}this.el.fire("resizestart",{dx:this.parameters.x,dy:this.parameters.y,event:t}),SVG.on(window,"touchmove.resize",(function(t){e.update(t||window.event)})),SVG.on(window,"touchend.resize",(function(){e.done()})),SVG.on(window,"mousemove.resize",(function(t){e.update(t||window.event)})),SVG.on(window,"mouseup.resize",(function(){e.done()}))},t.prototype.update=function(t){if(t){var e=this._extractPosition(t),n=this.transformPoint(e.x,e.y),l=n.x-this.parameters.p.x,a=n.y-this.parameters.p.y;this.lastUpdateCall=[l,a],this.calc(l,a),this.el.fire("resizing",{dx:l,dy:a,event:t})}else this.lastUpdateCall&&this.calc(this.lastUpdateCall[0],this.lastUpdateCall[1])},t.prototype.done=function(){this.lastUpdateCall=null,SVG.off(window,"mousemove.resize"),SVG.off(window,"mouseup.resize"),SVG.off(window,"touchmove.resize"),SVG.off(window,"touchend.resize"),this.el.fire("resizedone")},t.prototype.snapToGrid=function(t,e,n,l){var a;return void 0!==l?a=[(n+t)%this.options.snapToGrid,(l+e)%this.options.snapToGrid]:(n=null==n?3:n,a=[(this.parameters.box.x+t+(1&n?0:this.parameters.box.width))%this.options.snapToGrid,(this.parameters.box.y+e+(2&n?0:this.parameters.box.height))%this.options.snapToGrid]),t<0&&(a[0]-=this.options.snapToGrid),e<0&&(a[1]-=this.options.snapToGrid),t-=Math.abs(a[0])r.maxX&&(t=r.maxX-a),void 0!==r.minY&&i+er.maxY&&(e=r.maxY-i),[t,e]},t.prototype.checkAspectRatio=function(t,e){if(!this.options.saveAspectRatio)return t;var n=t.slice(),l=this.parameters.box.width/this.parameters.box.height,a=this.parameters.box.width+t[0],i=this.parameters.box.height-t[1],r=a/i;return rl&&(n[0]=this.parameters.box.width-i*l,e&&(n[0]=-n[0])),n},SVG.extend(SVG.Element,{resize:function(e){return(this.remember("_resizeHandler")||new t(this)).init(e||{}),this}}),SVG.Element.prototype.resize.defaults={snapToAngle:.1,snapToGrid:1,constraint:{},saveAspectRatio:!1}}).call(this)}(),function(t,e){void 0===e&&(e={});var n=e.insertAt;if("undefined"!=typeof document){var l=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===n&&l.firstChild?l.insertBefore(a,l.firstChild):l.appendChild(a),a.styleSheet?a.styleSheet.cssText=t:a.appendChild(document.createTextNode(t))}}('.apexcharts-canvas {\n position: relative;\n user-select: none;\n /* cannot give overflow: hidden as it will crop tooltips which overflow outside chart area */\n}\n\n\n/* scrollbar is not visible by default for legend, hence forcing the visibility */\n.apexcharts-canvas ::-webkit-scrollbar {\n -webkit-appearance: none;\n width: 6px;\n}\n\n.apexcharts-canvas ::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: rgba(0, 0, 0, .5);\n box-shadow: 0 0 1px rgba(255, 255, 255, .5);\n -webkit-box-shadow: 0 0 1px rgba(255, 255, 255, .5);\n}\n\n\n.apexcharts-inner {\n position: relative;\n}\n\n.apexcharts-text tspan {\n font-family: inherit;\n}\n\n.legend-mouseover-inactive {\n transition: 0.15s ease all;\n opacity: 0.20;\n}\n\n.apexcharts-series-collapsed {\n opacity: 0;\n}\n\n.apexcharts-tooltip {\n border-radius: 5px;\n box-shadow: 2px 2px 6px -4px #999;\n cursor: default;\n font-size: 14px;\n left: 62px;\n opacity: 0;\n pointer-events: none;\n position: absolute;\n top: 20px;\n overflow: hidden;\n white-space: nowrap;\n z-index: 12;\n transition: 0.15s ease all;\n}\n\n.apexcharts-tooltip.apexcharts-active {\n opacity: 1;\n transition: 0.15s ease all;\n}\n\n.apexcharts-tooltip.apexcharts-theme-light {\n border: 1px solid #e3e3e3;\n background: rgba(255, 255, 255, 0.96);\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark {\n color: #fff;\n background: rgba(30, 30, 30, 0.8);\n}\n\n.apexcharts-tooltip * {\n font-family: inherit;\n}\n\n\n.apexcharts-tooltip-title {\n padding: 6px;\n font-size: 15px;\n margin-bottom: 4px;\n}\n\n.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title {\n background: #ECEFF1;\n border-bottom: 1px solid #ddd;\n}\n\n.apexcharts-tooltip.apexcharts-theme-dark .apexcharts-tooltip-title {\n background: rgba(0, 0, 0, 0.7);\n border-bottom: 1px solid #333;\n}\n\n.apexcharts-tooltip-text-value,\n.apexcharts-tooltip-text-z-value {\n display: inline-block;\n font-weight: 600;\n margin-left: 5px;\n}\n\n.apexcharts-tooltip-text-z-label:empty,\n.apexcharts-tooltip-text-z-value:empty {\n display: none;\n}\n\n.apexcharts-tooltip-text-value,\n.apexcharts-tooltip-text-z-value {\n font-weight: 600;\n}\n\n.apexcharts-tooltip-marker {\n width: 12px;\n height: 12px;\n position: relative;\n top: 0px;\n margin-right: 10px;\n border-radius: 50%;\n}\n\n.apexcharts-tooltip-series-group {\n padding: 0 10px;\n display: none;\n text-align: left;\n justify-content: left;\n align-items: center;\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active .apexcharts-tooltip-marker {\n opacity: 1;\n}\n\n.apexcharts-tooltip-series-group.apexcharts-active,\n.apexcharts-tooltip-series-group:last-child {\n padding-bottom: 4px;\n}\n\n.apexcharts-tooltip-series-group-hidden {\n opacity: 0;\n height: 0;\n line-height: 0;\n padding: 0 !important;\n}\n\n.apexcharts-tooltip-y-group {\n padding: 6px 0 5px;\n}\n\n.apexcharts-tooltip-candlestick {\n padding: 4px 8px;\n}\n\n.apexcharts-tooltip-candlestick>div {\n margin: 4px 0;\n}\n\n.apexcharts-tooltip-candlestick span.value {\n font-weight: bold;\n}\n\n.apexcharts-tooltip-rangebar {\n padding: 5px 8px;\n}\n\n.apexcharts-tooltip-rangebar .category {\n font-weight: 600;\n color: #777;\n}\n\n.apexcharts-tooltip-rangebar .series-name {\n font-weight: bold;\n display: block;\n margin-bottom: 5px;\n}\n\n.apexcharts-xaxistooltip {\n opacity: 0;\n padding: 9px 10px;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #ECEFF1;\n border: 1px solid #90A4AE;\n transition: 0.15s ease all;\n}\n\n.apexcharts-xaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, 0.7);\n border: 1px solid rgba(0, 0, 0, 0.5);\n color: #fff;\n}\n\n.apexcharts-xaxistooltip:after,\n.apexcharts-xaxistooltip:before {\n left: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n\n.apexcharts-xaxistooltip:after {\n border-color: rgba(236, 239, 241, 0);\n border-width: 6px;\n margin-left: -6px;\n}\n\n.apexcharts-xaxistooltip:before {\n border-color: rgba(144, 164, 174, 0);\n border-width: 7px;\n margin-left: -7px;\n}\n\n.apexcharts-xaxistooltip-bottom:after,\n.apexcharts-xaxistooltip-bottom:before {\n bottom: 100%;\n}\n\n.apexcharts-xaxistooltip-top:after,\n.apexcharts-xaxistooltip-top:before {\n top: 100%;\n}\n\n.apexcharts-xaxistooltip-bottom:after {\n border-bottom-color: #ECEFF1;\n}\n\n.apexcharts-xaxistooltip-bottom:before {\n border-bottom-color: #90A4AE;\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:after {\n border-bottom-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-xaxistooltip-bottom.apexcharts-theme-dark:before {\n border-bottom-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-xaxistooltip-top:after {\n border-top-color: #ECEFF1\n}\n\n.apexcharts-xaxistooltip-top:before {\n border-top-color: #90A4AE;\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:after {\n border-top-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-xaxistooltip-top.apexcharts-theme-dark:before {\n border-top-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-xaxistooltip.apexcharts-active {\n opacity: 1;\n transition: 0.15s ease all;\n}\n\n.apexcharts-yaxistooltip {\n opacity: 0;\n padding: 4px 10px;\n pointer-events: none;\n color: #373d3f;\n font-size: 13px;\n text-align: center;\n border-radius: 2px;\n position: absolute;\n z-index: 10;\n background: #ECEFF1;\n border: 1px solid #90A4AE;\n}\n\n.apexcharts-yaxistooltip.apexcharts-theme-dark {\n background: rgba(0, 0, 0, 0.7);\n border: 1px solid rgba(0, 0, 0, 0.5);\n color: #fff;\n}\n\n.apexcharts-yaxistooltip:after,\n.apexcharts-yaxistooltip:before {\n top: 50%;\n border: solid transparent;\n content: " ";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n}\n\n.apexcharts-yaxistooltip:after {\n border-color: rgba(236, 239, 241, 0);\n border-width: 6px;\n margin-top: -6px;\n}\n\n.apexcharts-yaxistooltip:before {\n border-color: rgba(144, 164, 174, 0);\n border-width: 7px;\n margin-top: -7px;\n}\n\n.apexcharts-yaxistooltip-left:after,\n.apexcharts-yaxistooltip-left:before {\n left: 100%;\n}\n\n.apexcharts-yaxistooltip-right:after,\n.apexcharts-yaxistooltip-right:before {\n right: 100%;\n}\n\n.apexcharts-yaxistooltip-left:after {\n border-left-color: #ECEFF1;\n}\n\n.apexcharts-yaxistooltip-left:before {\n border-left-color: #90A4AE;\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:after {\n border-left-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-yaxistooltip-left.apexcharts-theme-dark:before {\n border-left-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-yaxistooltip-right:after {\n border-right-color: #ECEFF1;\n}\n\n.apexcharts-yaxistooltip-right:before {\n border-right-color: #90A4AE;\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:after {\n border-right-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-yaxistooltip-right.apexcharts-theme-dark:before {\n border-right-color: rgba(0, 0, 0, 0.5);\n}\n\n.apexcharts-yaxistooltip.apexcharts-active {\n opacity: 1;\n}\n\n.apexcharts-yaxistooltip-hidden {\n display: none;\n}\n\n.apexcharts-xcrosshairs,\n.apexcharts-ycrosshairs {\n pointer-events: none;\n opacity: 0;\n transition: 0.15s ease all;\n}\n\n.apexcharts-xcrosshairs.apexcharts-active,\n.apexcharts-ycrosshairs.apexcharts-active {\n opacity: 1;\n transition: 0.15s ease all;\n}\n\n.apexcharts-ycrosshairs-hidden {\n opacity: 0;\n}\n\n.apexcharts-selection-rect {\n cursor: move;\n}\n\n.svg_select_boundingRect, .svg_select_points_rot {\n pointer-events: none;\n opacity: 0;\n visibility: hidden;\n}\n.apexcharts-selection-rect + g .svg_select_boundingRect,\n.apexcharts-selection-rect + g .svg_select_points_rot {\n opacity: 0;\n visibility: hidden;\n}\n\n.apexcharts-selection-rect + g .svg_select_points_l,\n.apexcharts-selection-rect + g .svg_select_points_r {\n cursor: ew-resize;\n opacity: 1;\n visibility: visible;\n}\n\n.svg_select_points {\n fill: #efefef;\n stroke: #333;\n rx: 2;\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-zoom {\n cursor: crosshair\n}\n\n.apexcharts-svg.apexcharts-zoomable.hovering-pan {\n cursor: move\n}\n\n.apexcharts-zoom-icon,\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon,\n.apexcharts-reset-icon,\n.apexcharts-pan-icon,\n.apexcharts-selection-icon,\n.apexcharts-menu-icon,\n.apexcharts-toolbar-custom-icon {\n cursor: pointer;\n width: 20px;\n height: 20px;\n line-height: 24px;\n color: #6E8192;\n text-align: center;\n}\n\n.apexcharts-zoom-icon svg,\n.apexcharts-zoomin-icon svg,\n.apexcharts-zoomout-icon svg,\n.apexcharts-reset-icon svg,\n.apexcharts-menu-icon svg {\n fill: #6E8192;\n}\n\n.apexcharts-selection-icon svg {\n fill: #444;\n transform: scale(0.76)\n}\n\n.apexcharts-theme-dark .apexcharts-zoom-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomin-icon svg,\n.apexcharts-theme-dark .apexcharts-zoomout-icon svg,\n.apexcharts-theme-dark .apexcharts-reset-icon svg,\n.apexcharts-theme-dark .apexcharts-pan-icon svg,\n.apexcharts-theme-dark .apexcharts-selection-icon svg,\n.apexcharts-theme-dark .apexcharts-menu-icon svg,\n.apexcharts-theme-dark .apexcharts-toolbar-custom-icon svg {\n fill: #f3f4f5;\n}\n\n.apexcharts-canvas .apexcharts-zoom-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-selection-icon.apexcharts-selected svg,\n.apexcharts-canvas .apexcharts-reset-zoom-icon.apexcharts-selected svg {\n fill: #008FFB;\n}\n\n.apexcharts-theme-light .apexcharts-selection-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoom-icon:not(.apexcharts-selected):hover svg,\n.apexcharts-theme-light .apexcharts-zoomin-icon:hover svg,\n.apexcharts-theme-light .apexcharts-zoomout-icon:hover svg,\n.apexcharts-theme-light .apexcharts-reset-icon:hover svg,\n.apexcharts-theme-light .apexcharts-menu-icon:hover svg {\n fill: #333;\n}\n\n.apexcharts-selection-icon,\n.apexcharts-menu-icon {\n position: relative;\n}\n\n.apexcharts-reset-icon {\n margin-left: 5px;\n}\n\n.apexcharts-zoom-icon,\n.apexcharts-reset-icon,\n.apexcharts-menu-icon {\n transform: scale(0.85);\n}\n\n.apexcharts-zoomin-icon,\n.apexcharts-zoomout-icon {\n transform: scale(0.7)\n}\n\n.apexcharts-zoomout-icon {\n margin-right: 3px;\n}\n\n.apexcharts-pan-icon {\n transform: scale(0.62);\n position: relative;\n left: 1px;\n top: 0px;\n}\n\n.apexcharts-pan-icon svg {\n fill: #fff;\n stroke: #6E8192;\n stroke-width: 2;\n}\n\n.apexcharts-pan-icon.apexcharts-selected svg {\n stroke: #008FFB;\n}\n\n.apexcharts-pan-icon:not(.apexcharts-selected):hover svg {\n stroke: #333;\n}\n\n.apexcharts-toolbar {\n position: absolute;\n z-index: 11;\n max-width: 176px;\n text-align: right;\n border-radius: 3px;\n padding: 0px 6px 2px 6px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.apexcharts-menu {\n background: #fff;\n position: absolute;\n top: 100%;\n border: 1px solid #ddd;\n border-radius: 3px;\n padding: 3px;\n right: 10px;\n opacity: 0;\n min-width: 110px;\n transition: 0.15s ease all;\n pointer-events: none;\n}\n\n.apexcharts-menu.apexcharts-menu-open {\n opacity: 1;\n pointer-events: all;\n transition: 0.15s ease all;\n}\n\n.apexcharts-menu-item {\n padding: 6px 7px;\n font-size: 12px;\n cursor: pointer;\n}\n\n.apexcharts-theme-light .apexcharts-menu-item:hover {\n background: #eee;\n}\n\n.apexcharts-theme-dark .apexcharts-menu {\n background: rgba(0, 0, 0, 0.7);\n color: #fff;\n}\n\n@media screen and (min-width: 768px) {\n .apexcharts-canvas:hover .apexcharts-toolbar {\n opacity: 1;\n }\n}\n\n.apexcharts-datalabel.apexcharts-element-hidden {\n opacity: 0;\n}\n\n.apexcharts-pie-label,\n.apexcharts-datalabels,\n.apexcharts-datalabel,\n.apexcharts-datalabel-label,\n.apexcharts-datalabel-value {\n cursor: default;\n pointer-events: none;\n}\n\n.apexcharts-pie-label-delay {\n opacity: 0;\n animation-name: opaque;\n animation-duration: 0.3s;\n animation-fill-mode: forwards;\n animation-timing-function: ease;\n}\n\n.apexcharts-canvas .apexcharts-element-hidden {\n opacity: 0;\n}\n\n.apexcharts-hide .apexcharts-series-points {\n opacity: 0;\n}\n\n.apexcharts-gridline,\n.apexcharts-annotation-rect,\n.apexcharts-tooltip .apexcharts-marker,\n.apexcharts-area-series .apexcharts-area,\n.apexcharts-line,\n.apexcharts-zoom-rect,\n.apexcharts-toolbar svg,\n.apexcharts-area-series .apexcharts-series-markers .apexcharts-marker.no-pointer-events,\n.apexcharts-line-series .apexcharts-series-markers .apexcharts-marker.no-pointer-events,\n.apexcharts-radar-series path,\n.apexcharts-radar-series polygon {\n pointer-events: none;\n}\n\n\n/* markers */\n\n.apexcharts-marker {\n transition: 0.15s ease all;\n}\n\n@keyframes opaque {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity: 1;\n }\n}\n\n\n/* Resize generated styles */\n\n@keyframes resizeanim {\n from {\n opacity: 0;\n }\n to {\n opacity: 0;\n }\n}\n\n.resize-triggers {\n animation: 1ms resizeanim;\n visibility: hidden;\n opacity: 0;\n}\n\n.resize-triggers,\n.resize-triggers>div,\n.contract-trigger:before {\n content: " ";\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n overflow: hidden;\n}\n\n.resize-triggers>div {\n background: #eee;\n overflow: auto;\n}\n\n.contract-trigger:before {\n width: 200%;\n height: 200%;\n}'),function(){function t(t){var e=t.__resizeTriggers__,n=e.firstElementChild,l=e.lastElementChild,a=n?n.firstElementChild:null;l&&(l.scrollLeft=l.scrollWidth,l.scrollTop=l.scrollHeight),a&&(a.style.width=n.offsetWidth+1+"px",a.style.height=n.offsetHeight+1+"px"),n&&(n.scrollLeft=n.scrollWidth,n.scrollTop=n.scrollHeight)}function e(e){var n=this;t(this),this.__resizeRAF__&&i(this.__resizeRAF__),this.__resizeRAF__=a((function(){(function(t){return t.offsetWidth!=t.__resizeLast__.width||t.offsetHeight!=t.__resizeLast__.height})(n)&&(n.__resizeLast__.width=n.offsetWidth,n.__resizeLast__.height=n.offsetHeight,n.__resizeListeners__.forEach((function(t){t.call(e)})))}))}var n,l,a=(n=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){return window.setTimeout(t,20)},function(t){return n(t)}),i=(l=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout,function(t){return l(t)}),r=!1,o="animationstart",s="Webkit Moz O ms".split(" "),c="webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "),d=document.createElement("fakeelement");if(void 0!==d.style.animationName&&(r=!0),!1===r)for(var u=0;u
',n.appendChild(n.__resizeTriggers__),t(n),n.addEventListener("scroll",e,!0),o&&n.__resizeTriggers__.addEventListener(o,(function(e){"resizeanim"==e.animationName&&t(n)}))),n.__resizeListeners__.push(l)},window.removeResizeListener=function(t,n){t&&(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(n),1),t.__resizeListeners__.length||(t.removeEventListener("scroll",e),t.__resizeTriggers__.parentNode&&(t.__resizeTriggers__=!t.removeChild(t.__resizeTriggers__))))}}(),window.Apex={};var Ot=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"initModules",value:function(){this.ctx.publicMethods=["updateOptions","updateSeries","appendData","appendSeries","toggleSeries","showSeries","hideSeries","setLocale","resetSeries","zoomX","toggleDataPointSelection","dataURI","addXaxisAnnotation","addYaxisAnnotation","addPointAnnotation","clearAnnotations","removeAnnotation","paper","destroy"],this.ctx.eventList=["click","mousedown","mousemove","touchstart","touchmove","mouseup","touchend"],this.ctx.animations=new _(this.ctx),this.ctx.axes=new nt(this.ctx),this.ctx.core=new Pt(this.ctx.el,this.ctx),this.ctx.config=new z({}),this.ctx.data=new W(this.ctx),this.ctx.grid=new X(this.ctx),this.ctx.graphics=new w(this.ctx),this.ctx.coreUtils=new k(this.ctx),this.ctx.crosshairs=new lt(this.ctx),this.ctx.events=new tt(this.ctx),this.ctx.exports=new U(this.ctx),this.ctx.localization=new et(this.ctx),this.ctx.options=new M,this.ctx.responsive=new at(this.ctx),this.ctx.series=new N(this.ctx),this.ctx.theme=new it(this.ctx),this.ctx.formatters=new V(this.ctx),this.ctx.titleSubtitle=new rt(this.ctx),this.ctx.legend=new pt(this.ctx),this.ctx.toolbar=new ft(this.ctx),this.ctx.dimensions=new ut(this.ctx),this.ctx.updateHelpers=new jt(this.ctx),this.ctx.zoomPanSelection=new gt(this.ctx),this.ctx.w.globals.tooltip=new wt(this.ctx)}}]),t}(),Nt=function(){function t(e){i(this,t),this.ctx=e,this.w=e.w}return o(t,[{key:"clear",value:function(){this.ctx.zoomPanSelection&&this.ctx.zoomPanSelection.destroy(),this.ctx.toolbar&&this.ctx.toolbar.destroy(),this.ctx.animations=null,this.ctx.axes=null,this.ctx.annotations=null,this.ctx.core=null,this.ctx.data=null,this.ctx.grid=null,this.ctx.series=null,this.ctx.responsive=null,this.ctx.theme=null,this.ctx.formatters=null,this.ctx.titleSubtitle=null,this.ctx.legend=null,this.ctx.dimensions=null,this.ctx.options=null,this.ctx.crosshairs=null,this.ctx.zoomPanSelection=null,this.ctx.updateHelpers=null,this.ctx.toolbar=null,this.ctx.localization=null,this.ctx.w.globals.tooltip=null,this.clearDomElements()}},{key:"killSVG",value:function(t){t.each((function(t,e){this.removeClass("*"),this.off(),this.stop()}),!0),t.ungroup(),t.clear()}},{key:"clearDomElements",value:function(){var t=this,e=this.w.globals.dom.Paper.node;e.parentNode&&e.parentNode.parentNode&&(e.parentNode.parentNode.style.minHeight="unset"),this.ctx.eventList.forEach((function(e){t.w.globals.dom.baseEl.removeEventListener(e,t.ctx.events.documentEvent)}));var n=this.w.globals.dom;if(null!==this.ctx.el)for(;this.ctx.el.firstChild;)this.ctx.el.removeChild(this.ctx.el.firstChild);this.killSVG(n.Paper),n.Paper.remove(),n.elWrap=null,n.elGraphical=null,n.elAnnotations=null,n.elLegendWrap=null,n.baseEl=null,n.elGridRect=null,n.elGridRectMask=null,n.elGridRectMarkerMask=null,n.elDefs=null}}]),t}(),Lt=function(){function t(e,n){i(this,t),this.opts=n,this.ctx=this,this.w=new $(n).init(),this.el=e,this.w.globals.cuid=y.randomId(),this.w.globals.chartID=this.w.config.chart.id?this.w.config.chart.id:this.w.globals.cuid,new Ot(this).initModules(),this.create=y.bind(this.create,this),this.windowResizeHandler=this._windowResize.bind(this)}return o(t,[{key:"render",value:function(){var t=this;return new Promise((function(e,n){if(null!==t.el){void 0===Apex._chartInstances&&(Apex._chartInstances=[]),t.w.config.chart.id&&Apex._chartInstances.push({id:t.w.globals.chartID,group:t.w.config.chart.group,chart:t}),t.setLocale(t.w.config.chart.defaultLocale);var l=t.w.config.chart.events.beforeMount;"function"==typeof l&&l(t,t.w),t.events.fireEvent("beforeMount",[t,t.w]),window.addEventListener("resize",t.windowResizeHandler),window.addResizeListener(t.el.parentNode,t._parentResizeCallback.bind(t));var a=t.create(t.w.config.series,{});if(!a)return e(t);t.mount(a).then((function(){"function"==typeof t.w.config.chart.events.mounted&&t.w.config.chart.events.mounted(t,t.w),t.events.fireEvent("mounted",[t,t.w]),e(a)})).catch((function(t){n(t)}))}else n(new Error("Element not found"))}))}},{key:"create",value:function(t,e){var n=this.w;new Ot(this).initModules();var l=this.w.globals;if(l.noData=!1,l.animationEnded=!1,this.responsive.checkResponsiveConfig(e),n.config.xaxis.convertedCatToNumeric&&new q(n.config).convertCatToNumericXaxis(n.config,this.ctx),null===this.el)return l.animationEnded=!0,null;if(this.core.setupElements(),0===l.svgWidth)return l.animationEnded=!0,null;var a=k.checkComboSeries(t);l.comboCharts=a.comboCharts,l.comboBarCount=a.comboBarCount;var i=t.every((function(t){return t.data&&0===t.data.length}));(0===t.length||i)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(t),this.theme.init(),new R(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),l.noData&&l.collapsedSeries.length!==l.series.length&&!n.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),l.axisCharts&&(this.core.coreCalculations(),"category"!==n.config.xaxis.type&&this.formatters.setLabelFormatters()),this.formatters.heatmapLabelFormatters(),this.dimensions.plotCoords();var r=this.core.xySettings();this.grid.createGridMask();var o=this.core.plotChartType(t,r),s=new j(this);s.bringForward(),n.config.dataLabels.background.enabled&&s.dataLabelsBackground(),this.core.shiftGraphPosition();var c={plot:{left:n.globals.translateX,top:n.globals.translateY,width:n.globals.gridWidth,height:n.globals.gridHeight}};return{elGraph:o,xyRatios:r,elInner:n.globals.dom.elGraphical,dimensions:c}}},{key:"mount",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=this,l=n.w;return new Promise((function(a,i){if(null===n.el)return i(new Error("Not enough data to display or target element not found"));(null===e||l.globals.allSeriesCollapsed)&&n.series.handleNoData(),n.axes.drawAxis(l.config.chart.type,e.xyRatios),n.grid=new X(n);var r=n.grid.drawGrid();n.annotations=new A(n),n.annotations.drawImageAnnos(),n.annotations.drawTextAnnos(),"back"===l.config.grid.position&&r&&l.globals.dom.elGraphical.add(r.el);var o=new G(t.ctx),s=new J(t.ctx);if(null!==r&&(o.xAxisLabelCorrections(r.xAxisTickWidth),s.setYAxisTextAlignments()),"back"===l.config.annotations.position&&(l.globals.dom.Paper.add(l.globals.dom.elAnnotations),n.annotations.drawAxesAnnotations()),Array.isArray(e.elGraph))for(var c=0;c0&&l.globals.memory.methodsToExec.forEach((function(t){t.method(t.params,!1,t.context)})),l.globals.axisCharts||l.globals.noData||n.core.resizeNonAxisCharts(),a(n)}))}},{key:"destroy",value:function(){window.removeEventListener("resize",this.windowResizeHandler),window.removeResizeListener(this.el.parentNode,this._parentResizeCallback.bind(this));var t=this.w.config.chart.id;t&&Apex._chartInstances.forEach((function(e,n){e.id===t&&Apex._chartInstances.splice(n,1)})),new Nt(this.ctx).clear()}},{key:"updateOptions",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],r=this.w;return r.globals.selection=void 0,t.series&&(this.series.resetSeries(!1,!0,!1),t.series.length&&t.series[0].data&&(t.series=t.series.map((function(t,n){return e.updateHelpers._extendSeries(t,n)}))),this.updateHelpers.revertDefaultAxisMinMax()),t.xaxis&&(t=this.updateHelpers.forceXAxisUpdate(t)),t.yaxis&&(t=this.updateHelpers.forceYAxisUpdate(t)),r.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),t.theme&&(t=this.theme.updateThemeOptions(t)),this.updateHelpers._updateOptions(t,n,l,a,i)}},{key:"updateSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(t,e,n)}},{key:"appendSeries",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],l=this.w.config.series.slice();return l.push(t),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(l,e,n)}},{key:"appendData",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this;n.w.globals.dataChanged=!0,n.series.getPreviousPaths();for(var l=n.w.config.series.slice(),a=0;a0&&void 0!==arguments[0])||arguments[0],e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.series.resetSeries(t,e)}},{key:"addEventListener",value:function(t,e){this.events.addEventListener(t,e)}},{key:"removeEventListener",value:function(t,e){this.events.removeEventListener(t,e)}},{key:"addXaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,l=this;n&&(l=n),l.annotations.addXaxisAnnotationExternal(t,e,l)}},{key:"addYaxisAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,l=this;n&&(l=n),l.annotations.addYaxisAnnotationExternal(t,e,l)}},{key:"addPointAnnotation",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,l=this;n&&(l=n),l.annotations.addPointAnnotationExternal(t,e,l)}},{key:"clearAnnotations",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0,e=this;t&&(e=t),e.annotations.clearAnnotations(e)}},{key:"removeAnnotation",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,n=this;e&&(n=e),n.annotations.removeAnnotation(n,t)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(t,e){return this.coreUtils.getSeriesTotalsXRange(t,e)}},{key:"getHighestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=new Q(this.ctx);return e.getMinYMaxY(t).highestY}},{key:"getLowestValueInSeries",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=new Q(this.ctx);return e.getMinYMaxY(t).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(t,e){return this.updateHelpers.toggleDataPointSelection(t,e)}},{key:"zoomX",value:function(t,e){this.ctx.toolbar.zoomUpdateOptions(t,e)}},{key:"setLocale",value:function(t){this.localization.setCurrentLocaleValues(t)}},{key:"dataURI",value:function(){return new U(this.ctx).dataURI()}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){!this.w.globals.noData&&this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var t=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){t.w.globals.resized=!0,t.w.globals.dataChanged=!1,t.ctx.update({series:t.w.config.series})}),150)}}],[{key:"getChartByID",value:function(t){var e=Apex._chartInstances.filter((function(e){return e.id===t}))[0];return e&&e.chart}},{key:"initOnLoad",value:function(){for(var e=document.querySelectorAll("[data-apexcharts]"),n=0;n2?a-2:0),r=2;r0&&e-1 in t)}S.fn=S.prototype={jquery:"3.5.1",constructor:S,length:0,toArray:function(){return o.call(this)},get:function(t){return null==t?o.call(this):t<0?this[t+this.length]:this[t]},pushStack:function(t){var e=S.merge(this.constructor(),t);return e.prevObject=this,e},each:function(t){return S.each(this,t)},map:function(t){return this.pushStack(S.map(this,(function(e,n){return t.call(e,n,e)})))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,(function(t,e){return(e+1)%2})))},odd:function(){return this.pushStack(S.grep(this,(function(t,e){return e%2})))},eq:function(t){var e=this.length,n=+t+(t<0?e:0);return this.pushStack(n>=0&&n+~]|"+L+")"+L+"*"),W=new RegExp(L+"|>"),V=new RegExp(H),Y=new RegExp("^"+F+"$"),U={ID:new RegExp("^#("+F+")"),CLASS:new RegExp("^\\.("+F+")"),TAG:new RegExp("^("+F+"|[*])"),ATTR:new RegExp("^"+B),PSEUDO:new RegExp("^"+H),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+N+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},G=/HTML$/i,X=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,tt=/[+~]/,et=new RegExp("\\\\[\\da-fA-F]{1,6}"+L+"?|\\\\([^\\r\\n\\f])","g"),nt=function(t,e){var n="0x"+t.slice(1)-65536;return e||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},lt=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,at=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},it=function(){h()},rt=xt((function(t){return!0===t.disabled&&"fieldset"===t.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{P.apply(A=j.call(_.childNodes),_.childNodes),A[_.childNodes.length].nodeType}catch(t){P={apply:A.length?function(t,e){R.apply(t,j.call(e))}:function(t,e){for(var n=t.length,l=0;t[n++]=e[l++];);t.length=n-1}}}function ot(t,e,l,a){var i,o,c,d,u,f,v,b=e&&e.ownerDocument,_=e?e.nodeType:9;if(l=l||[],"string"!=typeof t||!t||1!==_&&9!==_&&11!==_)return l;if(!a&&(h(e),e=e||p,g)){if(11!==_&&(u=J.exec(t)))if(i=u[1]){if(9===_){if(!(c=e.getElementById(i)))return l;if(c.id===i)return l.push(c),l}else if(b&&(c=b.getElementById(i))&&y(e,c)&&c.id===i)return l.push(c),l}else{if(u[2])return P.apply(l,e.getElementsByTagName(t)),l;if((i=u[3])&&n.getElementsByClassName&&e.getElementsByClassName)return P.apply(l,e.getElementsByClassName(i)),l}if(n.qsa&&!T[t+" "]&&(!m||!m.test(t))&&(1!==_||"object"!==e.nodeName.toLowerCase())){if(v=t,b=e,1===_&&(W.test(t)||$.test(t))){for((b=tt.test(t)&&vt(e.parentNode)||e)===e&&n.scope||((d=e.getAttribute("id"))?d=d.replace(lt,at):e.setAttribute("id",d=x)),o=(f=r(t)).length;o--;)f[o]=(d?"#"+d:":scope")+" "+yt(f[o]);v=f.join(",")}try{return P.apply(l,b.querySelectorAll(v)),l}catch(e){T(t,!0)}finally{d===x&&e.removeAttribute("id")}}}return s(t.replace(z,"$1"),e,l,a)}function st(){var t=[];return function e(n,a){return t.push(n+" ")>l.cacheLength&&delete e[t.shift()],e[n+" "]=a}}function ct(t){return t[x]=!0,t}function dt(t){var e=p.createElement("fieldset");try{return!!t(e)}catch(t){return!1}finally{e.parentNode&&e.parentNode.removeChild(e),e=null}}function ut(t,e){for(var n=t.split("|"),a=n.length;a--;)l.attrHandle[n[a]]=e}function ht(t,e){var n=e&&t,l=n&&1===t.nodeType&&1===e.nodeType&&t.sourceIndex-e.sourceIndex;if(l)return l;if(n)for(;n=n.nextSibling;)if(n===e)return-1;return t?1:-1}function pt(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function ft(t){return function(e){var n=e.nodeName.toLowerCase();return("input"===n||"button"===n)&&e.type===t}}function gt(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&rt(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function mt(t){return ct((function(e){return e=+e,ct((function(n,l){for(var a,i=t([],n.length,e),r=i.length;r--;)n[a=i[r]]&&(n[a]=!(l[a]=n[a]))}))}))}function vt(t){return t&&void 0!==t.getElementsByTagName&&t}for(e in n=ot.support={},i=ot.isXML=function(t){var e=t.namespaceURI,n=(t.ownerDocument||t).documentElement;return!G.test(e||n&&n.nodeName||"HTML")},h=ot.setDocument=function(t){var e,a,r=t?t.ownerDocument||t:_;return r!=p&&9===r.nodeType&&r.documentElement?(f=(p=r).documentElement,g=!i(p),_!=p&&(a=p.defaultView)&&a.top!==a&&(a.addEventListener?a.addEventListener("unload",it,!1):a.attachEvent&&a.attachEvent("onunload",it)),n.scope=dt((function(t){return f.appendChild(t).appendChild(p.createElement("div")),void 0!==t.querySelectorAll&&!t.querySelectorAll(":scope fieldset div").length})),n.attributes=dt((function(t){return t.className="i",!t.getAttribute("className")})),n.getElementsByTagName=dt((function(t){return t.appendChild(p.createComment("")),!t.getElementsByTagName("*").length})),n.getElementsByClassName=Q.test(p.getElementsByClassName),n.getById=dt((function(t){return f.appendChild(t).id=x,!p.getElementsByName||!p.getElementsByName(x).length})),n.getById?(l.filter.ID=function(t){var e=t.replace(et,nt);return function(t){return t.getAttribute("id")===e}},l.find.ID=function(t,e){if(void 0!==e.getElementById&&g){var n=e.getElementById(t);return n?[n]:[]}}):(l.filter.ID=function(t){var e=t.replace(et,nt);return function(t){var n=void 0!==t.getAttributeNode&&t.getAttributeNode("id");return n&&n.value===e}},l.find.ID=function(t,e){if(void 0!==e.getElementById&&g){var n,l,a,i=e.getElementById(t);if(i){if((n=i.getAttributeNode("id"))&&n.value===t)return[i];for(a=e.getElementsByName(t),l=0;i=a[l++];)if((n=i.getAttributeNode("id"))&&n.value===t)return[i]}return[]}}),l.find.TAG=n.getElementsByTagName?function(t,e){return void 0!==e.getElementsByTagName?e.getElementsByTagName(t):n.qsa?e.querySelectorAll(t):void 0}:function(t,e){var n,l=[],a=0,i=e.getElementsByTagName(t);if("*"===t){for(;n=i[a++];)1===n.nodeType&&l.push(n);return l}return i},l.find.CLASS=n.getElementsByClassName&&function(t,e){if(void 0!==e.getElementsByClassName&&g)return e.getElementsByClassName(t)},v=[],m=[],(n.qsa=Q.test(p.querySelectorAll))&&(dt((function(t){var e;f.appendChild(t).innerHTML="
",t.querySelectorAll("[msallowcapture^='']").length&&m.push("[*^$]="+L+"*(?:''|\"\")"),t.querySelectorAll("[selected]").length||m.push("\\["+L+"*(?:value|"+N+")"),t.querySelectorAll("[id~="+x+"-]").length||m.push("~="),(e=p.createElement("input")).setAttribute("name",""),t.appendChild(e),t.querySelectorAll("[name='']").length||m.push("\\["+L+"*name"+L+"*="+L+"*(?:''|\"\")"),t.querySelectorAll(":checked").length||m.push(":checked"),t.querySelectorAll("a#"+x+"+*").length||m.push(".#.+[+~]"),t.querySelectorAll("\\\f"),m.push("[\\r\\n\\f]")})),dt((function(t){t.innerHTML="";var e=p.createElement("input");e.setAttribute("type","hidden"),t.appendChild(e).setAttribute("name","D"),t.querySelectorAll("[name=d]").length&&m.push("name"+L+"*[*^$|!~]?="),2!==t.querySelectorAll(":enabled").length&&m.push(":enabled",":disabled"),f.appendChild(t).disabled=!0,2!==t.querySelectorAll(":disabled").length&&m.push(":enabled",":disabled"),t.querySelectorAll("*,:x"),m.push(",.*:")}))),(n.matchesSelector=Q.test(b=f.matches||f.webkitMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&dt((function(t){n.disconnectedMatch=b.call(t,"*"),b.call(t,"[s!='']:x"),v.push("!=",H)})),m=m.length&&new RegExp(m.join("|")),v=v.length&&new RegExp(v.join("|")),e=Q.test(f.compareDocumentPosition),y=e||Q.test(f.contains)?function(t,e){var n=9===t.nodeType?t.documentElement:t,l=e&&e.parentNode;return t===l||!(!l||1!==l.nodeType||!(n.contains?n.contains(l):t.compareDocumentPosition&&16&t.compareDocumentPosition(l)))}:function(t,e){if(e)for(;e=e.parentNode;)if(e===t)return!0;return!1},E=e?function(t,e){if(t===e)return u=!0,0;var l=!t.compareDocumentPosition-!e.compareDocumentPosition;return l||(1&(l=(t.ownerDocument||t)==(e.ownerDocument||e)?t.compareDocumentPosition(e):1)||!n.sortDetached&&e.compareDocumentPosition(t)===l?t==p||t.ownerDocument==_&&y(_,t)?-1:e==p||e.ownerDocument==_&&y(_,e)?1:d?O(d,t)-O(d,e):0:4&l?-1:1)}:function(t,e){if(t===e)return u=!0,0;var n,l=0,a=t.parentNode,i=e.parentNode,r=[t],o=[e];if(!a||!i)return t==p?-1:e==p?1:a?-1:i?1:d?O(d,t)-O(d,e):0;if(a===i)return ht(t,e);for(n=t;n=n.parentNode;)r.unshift(n);for(n=e;n=n.parentNode;)o.unshift(n);for(;r[l]===o[l];)l++;return l?ht(r[l],o[l]):r[l]==_?-1:o[l]==_?1:0},p):p},ot.matches=function(t,e){return ot(t,null,null,e)},ot.matchesSelector=function(t,e){if(h(t),n.matchesSelector&&g&&!T[e+" "]&&(!v||!v.test(e))&&(!m||!m.test(e)))try{var l=b.call(t,e);if(l||n.disconnectedMatch||t.document&&11!==t.document.nodeType)return l}catch(t){T(e,!0)}return ot(e,p,null,[t]).length>0},ot.contains=function(t,e){return(t.ownerDocument||t)!=p&&h(t),y(t,e)},ot.attr=function(t,e){(t.ownerDocument||t)!=p&&h(t);var a=l.attrHandle[e.toLowerCase()],i=a&&M.call(l.attrHandle,e.toLowerCase())?a(t,e,!g):void 0;return void 0!==i?i:n.attributes||!g?t.getAttribute(e):(i=t.getAttributeNode(e))&&i.specified?i.value:null},ot.escape=function(t){return(t+"").replace(lt,at)},ot.error=function(t){throw new Error("Syntax error, unrecognized expression: "+t)},ot.uniqueSort=function(t){var e,l=[],a=0,i=0;if(u=!n.detectDuplicates,d=!n.sortStable&&t.slice(0),t.sort(E),u){for(;e=t[i++];)e===t[i]&&(a=l.push(i));for(;a--;)t.splice(l[a],1)}return d=null,t},a=ot.getText=function(t){var e,n="",l=0,i=t.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=a(t)}else if(3===i||4===i)return t.nodeValue}else for(;e=t[l++];)n+=a(e);return n},(l=ot.selectors={cacheLength:50,createPseudo:ct,match:U,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(t){return t[1]=t[1].replace(et,nt),t[3]=(t[3]||t[4]||t[5]||"").replace(et,nt),"~="===t[2]&&(t[3]=" "+t[3]+" "),t.slice(0,4)},CHILD:function(t){return t[1]=t[1].toLowerCase(),"nth"===t[1].slice(0,3)?(t[3]||ot.error(t[0]),t[4]=+(t[4]?t[5]+(t[6]||1):2*("even"===t[3]||"odd"===t[3])),t[5]=+(t[7]+t[8]||"odd"===t[3])):t[3]&&ot.error(t[0]),t},PSEUDO:function(t){var e,n=!t[6]&&t[2];return U.CHILD.test(t[0])?null:(t[3]?t[2]=t[4]||t[5]||"":n&&V.test(n)&&(e=r(n,!0))&&(e=n.indexOf(")",n.length-e)-n.length)&&(t[0]=t[0].slice(0,e),t[2]=n.slice(0,e)),t.slice(0,3))}},filter:{TAG:function(t){var e=t.replace(et,nt).toLowerCase();return"*"===t?function(){return!0}:function(t){return t.nodeName&&t.nodeName.toLowerCase()===e}},CLASS:function(t){var e=C[t+" "];return e||(e=new RegExp("(^|"+L+")"+t+"("+L+"|$)"))&&C(t,(function(t){return e.test("string"==typeof t.className&&t.className||void 0!==t.getAttribute&&t.getAttribute("class")||"")}))},ATTR:function(t,e,n){return function(l){var a=ot.attr(l,t);return null==a?"!="===e:!e||(a+="","="===e?a===n:"!="===e?a!==n:"^="===e?n&&0===a.indexOf(n):"*="===e?n&&a.indexOf(n)>-1:"$="===e?n&&a.slice(-n.length)===n:"~="===e?(" "+a.replace(q," ")+" ").indexOf(n)>-1:"|="===e&&(a===n||a.slice(0,n.length+1)===n+"-"))}},CHILD:function(t,e,n,l,a){var i="nth"!==t.slice(0,3),r="last"!==t.slice(-4),o="of-type"===e;return 1===l&&0===a?function(t){return!!t.parentNode}:function(e,n,s){var c,d,u,h,p,f,g=i!==r?"nextSibling":"previousSibling",m=e.parentNode,v=o&&e.nodeName.toLowerCase(),b=!s&&!o,y=!1;if(m){if(i){for(;g;){for(h=e;h=h[g];)if(o?h.nodeName.toLowerCase()===v:1===h.nodeType)return!1;f=g="only"===t&&!f&&"nextSibling"}return!0}if(f=[r?m.firstChild:m.lastChild],r&&b){for(y=(p=(c=(d=(u=(h=m)[x]||(h[x]={}))[h.uniqueID]||(u[h.uniqueID]={}))[t]||[])[0]===w&&c[1])&&c[2],h=p&&m.childNodes[p];h=++p&&h&&h[g]||(y=p=0)||f.pop();)if(1===h.nodeType&&++y&&h===e){d[t]=[w,p,y];break}}else if(b&&(y=p=(c=(d=(u=(h=e)[x]||(h[x]={}))[h.uniqueID]||(u[h.uniqueID]={}))[t]||[])[0]===w&&c[1]),!1===y)for(;(h=++p&&h&&h[g]||(y=p=0)||f.pop())&&((o?h.nodeName.toLowerCase()!==v:1!==h.nodeType)||!++y||(b&&((d=(u=h[x]||(h[x]={}))[h.uniqueID]||(u[h.uniqueID]={}))[t]=[w,y]),h!==e)););return(y-=a)===l||y%l==0&&y/l>=0}}},PSEUDO:function(t,e){var n,a=l.pseudos[t]||l.setFilters[t.toLowerCase()]||ot.error("unsupported pseudo: "+t);return a[x]?a(e):a.length>1?(n=[t,t,"",e],l.setFilters.hasOwnProperty(t.toLowerCase())?ct((function(t,n){for(var l,i=a(t,e),r=i.length;r--;)t[l=O(t,i[r])]=!(n[l]=i[r])})):function(t){return a(t,0,n)}):a}},pseudos:{not:ct((function(t){var e=[],n=[],l=o(t.replace(z,"$1"));return l[x]?ct((function(t,e,n,a){for(var i,r=l(t,null,a,[]),o=t.length;o--;)(i=r[o])&&(t[o]=!(e[o]=i))})):function(t,a,i){return e[0]=t,l(e,null,i,n),e[0]=null,!n.pop()}})),has:ct((function(t){return function(e){return ot(t,e).length>0}})),contains:ct((function(t){return t=t.replace(et,nt),function(e){return(e.textContent||a(e)).indexOf(t)>-1}})),lang:ct((function(t){return Y.test(t||"")||ot.error("unsupported lang: "+t),t=t.replace(et,nt).toLowerCase(),function(e){var n;do{if(n=g?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(n=n.toLowerCase())===t||0===n.indexOf(t+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}})),target:function(e){var n=t.location&&t.location.hash;return n&&n.slice(1)===e.id},root:function(t){return t===f},focus:function(t){return t===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(t.type||t.href||~t.tabIndex)},enabled:gt(!1),disabled:gt(!0),checked:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&!!t.checked||"option"===e&&!!t.selected},selected:function(t){return t.parentNode&&t.parentNode.selectedIndex,!0===t.selected},empty:function(t){for(t=t.firstChild;t;t=t.nextSibling)if(t.nodeType<6)return!1;return!0},parent:function(t){return!l.pseudos.empty(t)},header:function(t){return K.test(t.nodeName)},input:function(t){return X.test(t.nodeName)},button:function(t){var e=t.nodeName.toLowerCase();return"input"===e&&"button"===t.type||"button"===e},text:function(t){var e;return"input"===t.nodeName.toLowerCase()&&"text"===t.type&&(null==(e=t.getAttribute("type"))||"text"===e.toLowerCase())},first:mt((function(){return[0]})),last:mt((function(t,e){return[e-1]})),eq:mt((function(t,e,n){return[n<0?n+e:n]})),even:mt((function(t,e){for(var n=0;ne?e:n;--l>=0;)t.push(l);return t})),gt:mt((function(t,e,n){for(var l=n<0?n+e:n;++l1?function(e,n,l){for(var a=t.length;a--;)if(!t[a](e,n,l))return!1;return!0}:t[0]}function wt(t,e,n,l,a){for(var i,r=[],o=0,s=t.length,c=null!=e;o-1&&(i[c]=!(r[c]=u))}}else v=wt(v===r?v.splice(f,v.length):v),a?a(null,r,v,s):P.apply(r,v)}))}function Ct(t){for(var e,n,a,i=t.length,r=l.relative[t[0].type],o=r||l.relative[" "],s=r?1:0,d=xt((function(t){return t===e}),o,!0),u=xt((function(t){return O(e,t)>-1}),o,!0),h=[function(t,n,l){var a=!r&&(l||n!==c)||((e=n).nodeType?d(t,n,l):u(t,n,l));return e=null,a}];s1&&_t(h),s>1&&yt(t.slice(0,s-1).concat({value:" "===t[s-2].type?"*":""})).replace(z,"$1"),n,s0,a=t.length>0,i=function(i,r,o,s,d){var u,f,m,v=0,b="0",y=i&&[],x=[],_=c,S=i||a&&l.find.TAG("*",d),C=w+=null==_?1:Math.random()||.1,k=S.length;for(d&&(c=r==p||r||d);b!==k&&null!=(u=S[b]);b++){if(a&&u){for(f=0,r||u.ownerDocument==p||(h(u),o=!g);m=t[f++];)if(m(u,r||p,o)){s.push(u);break}d&&(w=C)}n&&((u=!m&&u)&&v--,i&&y.push(u))}if(v+=b,n&&b!==v){for(f=0;m=e[f++];)m(y,x,r,o);if(i){if(v>0)for(;b--;)y[b]||x[b]||(x[b]=I.call(s));x=wt(x)}P.apply(s,x),d&&!i&&x.length>0&&v+e.length>1&&ot.uniqueSort(s)}return d&&(w=C,c=_),y};return n?ct(i):i}(i,a))).selector=t}return o},s=ot.select=function(t,e,n,a){var i,s,c,d,u,h="function"==typeof t&&t,p=!a&&r(t=h.selector||t);if(n=n||[],1===p.length){if((s=p[0]=p[0].slice(0)).length>2&&"ID"===(c=s[0]).type&&9===e.nodeType&&g&&l.relative[s[1].type]){if(!(e=(l.find.ID(c.matches[0].replace(et,nt),e)||[])[0]))return n;h&&(e=e.parentNode),t=t.slice(s.shift().value.length)}for(i=U.needsContext.test(t)?0:s.length;i--&&(c=s[i],!l.relative[d=c.type]);)if((u=l.find[d])&&(a=u(c.matches[0].replace(et,nt),tt.test(s[0].type)&&vt(e.parentNode)||e))){if(s.splice(i,1),!(t=a.length&&yt(s)))return P.apply(n,a),n;break}}return(h||o(t,p))(a,e,!g,n,!e||tt.test(t)&&vt(e.parentNode)||e),n},n.sortStable=x.split("").sort(E).join("")===x,n.detectDuplicates=!!u,h(),n.sortDetached=dt((function(t){return 1&t.compareDocumentPosition(p.createElement("fieldset"))})),dt((function(t){return t.innerHTML="","#"===t.firstChild.getAttribute("href")}))||ut("type|href|height|width",(function(t,e,n){if(!n)return t.getAttribute(e,"type"===e.toLowerCase()?1:2)})),n.attributes&&dt((function(t){return t.innerHTML="",t.firstChild.setAttribute("value",""),""===t.firstChild.getAttribute("value")}))||ut("value",(function(t,e,n){if(!n&&"input"===t.nodeName.toLowerCase())return t.defaultValue})),dt((function(t){return null==t.getAttribute("disabled")}))||ut(N,(function(t,e,n){var l;if(!n)return!0===t[e]?e.toLowerCase():(l=t.getAttributeNode(e))&&l.specified?l.value:null})),ot}(n);S.find=k,S.expr=k.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=k.uniqueSort,S.text=k.getText,S.isXMLDoc=k.isXML,S.contains=k.contains,S.escapeSelector=k.escape;var D=function(t,e,n){for(var l=[],a=void 0!==n;(t=t[e])&&9!==t.nodeType;)if(1===t.nodeType){if(a&&S(t).is(n))break;l.push(t)}return l},T=function(t,e){for(var n=[];t;t=t.nextSibling)1===t.nodeType&&t!==e&&n.push(t);return n},E=S.expr.match.needsContext;function M(t,e){return t.nodeName&&t.nodeName.toLowerCase()===e.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function I(t,e,n){return v(e)?S.grep(t,(function(t,l){return!!e.call(t,l,t)!==n})):e.nodeType?S.grep(t,(function(t){return t===e!==n})):"string"!=typeof e?S.grep(t,(function(t){return d.call(e,t)>-1!==n})):S.filter(e,t,n)}S.filter=function(t,e,n){var l=e[0];return n&&(t=":not("+t+")"),1===e.length&&1===l.nodeType?S.find.matchesSelector(l,t)?[l]:[]:S.find.matches(t,S.grep(e,(function(t){return 1===t.nodeType})))},S.fn.extend({find:function(t){var e,n,l=this.length,a=this;if("string"!=typeof t)return this.pushStack(S(t).filter((function(){for(e=0;e1?S.uniqueSort(n):n},filter:function(t){return this.pushStack(I(this,t||[],!1))},not:function(t){return this.pushStack(I(this,t||[],!0))},is:function(t){return!!I(this,"string"==typeof t&&E.test(t)?S(t):t||[],!1).length}});var R,P=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(t,e,n){var l,a;if(!t)return this;if(n=n||R,"string"==typeof t){if(!(l="<"===t[0]&&">"===t[t.length-1]&&t.length>=3?[null,t,null]:P.exec(t))||!l[1]&&e)return!e||e.jquery?(e||n).find(t):this.constructor(e).find(t);if(l[1]){if(e=e instanceof S?e[0]:e,S.merge(this,S.parseHTML(l[1],e&&e.nodeType?e.ownerDocument||e:y,!0)),A.test(l[1])&&S.isPlainObject(e))for(l in e)v(this[l])?this[l](e[l]):this.attr(l,e[l]);return this}return(a=y.getElementById(l[2]))&&(this[0]=a,this.length=1),this}return t.nodeType?(this[0]=t,this.length=1,this):v(t)?void 0!==n.ready?n.ready(t):t(S):S.makeArray(t,this)}).prototype=S.fn,R=S(y);var j=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function N(t,e){for(;(t=t[e])&&1!==t.nodeType;);return t}S.fn.extend({has:function(t){var e=S(t,this),n=e.length;return this.filter((function(){for(var t=0;t-1:1===n.nodeType&&S.find.matchesSelector(n,t))){i.push(n);break}return this.pushStack(i.length>1?S.uniqueSort(i):i)},index:function(t){return t?"string"==typeof t?d.call(S(t),this[0]):d.call(this,t.jquery?t[0]:t):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(t,e){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(t,e))))},addBack:function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}}),S.each({parent:function(t){var e=t.parentNode;return e&&11!==e.nodeType?e:null},parents:function(t){return D(t,"parentNode")},parentsUntil:function(t,e,n){return D(t,"parentNode",n)},next:function(t){return N(t,"nextSibling")},prev:function(t){return N(t,"previousSibling")},nextAll:function(t){return D(t,"nextSibling")},prevAll:function(t){return D(t,"previousSibling")},nextUntil:function(t,e,n){return D(t,"nextSibling",n)},prevUntil:function(t,e,n){return D(t,"previousSibling",n)},siblings:function(t){return T((t.parentNode||{}).firstChild,t)},children:function(t){return T(t.firstChild)},contents:function(t){return null!=t.contentDocument&&r(t.contentDocument)?t.contentDocument:(M(t,"template")&&(t=t.content||t),S.merge([],t.childNodes))}},(function(t,e){S.fn[t]=function(n,l){var a=S.map(this,e,n);return"Until"!==t.slice(-5)&&(l=n),l&&"string"==typeof l&&(a=S.filter(l,a)),this.length>1&&(O[t]||S.uniqueSort(a),j.test(t)&&a.reverse()),this.pushStack(a)}}));var L=/[^\x20\t\r\n\f]+/g;function F(t){return t}function B(t){throw t}function H(t,e,n,l){var a;try{t&&v(a=t.promise)?a.call(t).done(e).fail(n):t&&v(a=t.then)?a.call(t,e,n):e.apply(void 0,[t].slice(l))}catch(t){n.apply(void 0,[t])}}S.Callbacks=function(t){t="string"==typeof t?function(t){var e={};return S.each(t.match(L)||[],(function(t,n){e[n]=!0})),e}(t):S.extend({},t);var e,n,l,a,i=[],r=[],o=-1,s=function(){for(a=a||t.once,l=e=!0;r.length;o=-1)for(n=r.shift();++o-1;)i.splice(n,1),n<=o&&o--})),this},has:function(t){return t?S.inArray(t,i)>-1:i.length>0},empty:function(){return i&&(i=[]),this},disable:function(){return a=r=[],i=n="",this},disabled:function(){return!i},lock:function(){return a=r=[],n||e||(i=n=""),this},locked:function(){return!!a},fireWith:function(t,n){return a||(n=[t,(n=n||[]).slice?n.slice():n],r.push(n),e||s()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!l}};return c},S.extend({Deferred:function(t){var e=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],l="pending",a={state:function(){return l},always:function(){return i.done(arguments).fail(arguments),this},catch:function(t){return a.then(null,t)},pipe:function(){var t=arguments;return S.Deferred((function(n){S.each(e,(function(e,l){var a=v(t[l[4]])&&t[l[4]];i[l[1]]((function(){var t=a&&a.apply(this,arguments);t&&v(t.promise)?t.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[l[0]+"With"](this,a?[t]:arguments)}))})),t=null})).promise()},then:function(t,l,a){var i=0;function r(t,e,l,a){return function(){var o=this,s=arguments,c=function(){var n,c;if(!(t=i&&(l!==B&&(o=void 0,s=[n]),e.rejectWith(o,s))}};t?d():(S.Deferred.getStackHook&&(d.stackTrace=S.Deferred.getStackHook()),n.setTimeout(d))}}return S.Deferred((function(n){e[0][3].add(r(0,n,v(a)?a:F,n.notifyWith)),e[1][3].add(r(0,n,v(t)?t:F)),e[2][3].add(r(0,n,v(l)?l:B))})).promise()},promise:function(t){return null!=t?S.extend(t,a):a}},i={};return S.each(e,(function(t,n){var r=n[2],o=n[5];a[n[1]]=r.add,o&&r.add((function(){l=o}),e[3-t][2].disable,e[3-t][3].disable,e[0][2].lock,e[0][3].lock),r.add(n[3].fire),i[n[0]]=function(){return i[n[0]+"With"](this===i?void 0:this,arguments),this},i[n[0]+"With"]=r.fireWith})),a.promise(i),t&&t.call(i,i),i},when:function(t){var e=arguments.length,n=e,l=Array(n),a=o.call(arguments),i=S.Deferred(),r=function(t){return function(n){l[t]=this,a[t]=arguments.length>1?o.call(arguments):n,--e||i.resolveWith(l,a)}};if(e<=1&&(H(t,i.done(r(n)).resolve,i.reject,!e),"pending"===i.state()||v(a[n]&&a[n].then)))return i.then();for(;n--;)H(a[n],r(n),i.reject);return i.promise()}});var q=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(t,e){n.console&&n.console.warn&&t&&q.test(t.name)&&n.console.warn("jQuery.Deferred exception: "+t.message,t.stack,e)},S.readyException=function(t){n.setTimeout((function(){throw t}))};var z=S.Deferred();function Z(){y.removeEventListener("DOMContentLoaded",Z),n.removeEventListener("load",Z),S.ready()}S.fn.ready=function(t){return z.then(t).catch((function(t){S.readyException(t)})),this},S.extend({isReady:!1,readyWait:1,ready:function(t){(!0===t?--S.readyWait:S.isReady)||(S.isReady=!0,!0!==t&&--S.readyWait>0||z.resolveWith(y,[S]))}}),S.ready.then=z.then,"complete"===y.readyState||"loading"!==y.readyState&&!y.documentElement.doScroll?n.setTimeout(S.ready):(y.addEventListener("DOMContentLoaded",Z),n.addEventListener("load",Z));var $=function(t,e,n,l,a,i,r){var o=0,s=t.length,c=null==n;if("object"===w(n))for(o in a=!0,n)$(t,e,o,n[o],!0,i,r);else if(void 0!==l&&(a=!0,v(l)||(r=!0),c&&(r?(e.call(t,l),e=null):(c=e,e=function(t,e,n){return c.call(S(t),n)})),e))for(;o1,null,!0)},removeData:function(t){return this.each((function(){Q.remove(this,t)}))}}),S.extend({queue:function(t,e,n){var l;if(t)return e=(e||"fx")+"queue",l=K.get(t,e),n&&(!l||Array.isArray(n)?l=K.access(t,e,S.makeArray(n)):l.push(n)),l||[]},dequeue:function(t,e){e=e||"fx";var n=S.queue(t,e),l=n.length,a=n.shift(),i=S._queueHooks(t,e);"inprogress"===a&&(a=n.shift(),l--),a&&("fx"===e&&n.unshift("inprogress"),delete i.stop,a.call(t,(function(){S.dequeue(t,e)}),i)),!l&&i&&i.empty.fire()},_queueHooks:function(t,e){var n=e+"queueHooks";return K.get(t,n)||K.access(t,n,{empty:S.Callbacks("once memory").add((function(){K.remove(t,[e+"queue",n])}))})}}),S.fn.extend({queue:function(t,e){var n=2;return"string"!=typeof t&&(e=t,t="fx",n--),arguments.length\x20\t\r\n\f]*)/i,vt=/^$|^module$|\/(?:java|ecma)script/i;pt=y.createDocumentFragment().appendChild(y.createElement("div")),(ft=y.createElement("input")).setAttribute("type","radio"),ft.setAttribute("checked","checked"),ft.setAttribute("name","t"),pt.appendChild(ft),m.checkClone=pt.cloneNode(!0).cloneNode(!0).lastChild.checked,pt.innerHTML="",m.noCloneChecked=!!pt.cloneNode(!0).lastChild.defaultValue,pt.innerHTML="",m.option=!!pt.lastChild;var bt={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function yt(t,e){var n;return n=void 0!==t.getElementsByTagName?t.getElementsByTagName(e||"*"):void 0!==t.querySelectorAll?t.querySelectorAll(e||"*"):[],void 0===e||e&&M(t,e)?S.merge([t],n):n}function xt(t,e){for(var n=0,l=t.length;n",""]);var _t=/<|&#?\w+;/;function wt(t,e,n,l,a){for(var i,r,o,s,c,d,u=e.createDocumentFragment(),h=[],p=0,f=t.length;p-1)a&&a.push(i);else if(c=rt(i),r=yt(u.appendChild(i),"script"),c&&xt(r),n)for(d=0;i=r[d++];)vt.test(i.type||"")&&n.push(i);return u}var St=/^key/,Ct=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,kt=/^([^.]*)(?:\.(.+)|)/;function Dt(){return!0}function Tt(){return!1}function Et(t,e){return t===function(){try{return y.activeElement}catch(t){}}()==("focus"===e)}function Mt(t,e,n,l,a,i){var r,o;if("object"==typeof e){for(o in"string"!=typeof n&&(l=l||n,n=void 0),e)Mt(t,o,n,l,e[o],i);return t}if(null==l&&null==a?(a=n,l=n=void 0):null==a&&("string"==typeof n?(a=l,l=void 0):(a=l,l=n,n=void 0)),!1===a)a=Tt;else if(!a)return t;return 1===i&&(r=a,(a=function(t){return S().off(t),r.apply(this,arguments)}).guid=r.guid||(r.guid=S.guid++)),t.each((function(){S.event.add(this,e,a,l,n)}))}function At(t,e,n){n?(K.set(t,e,!1),S.event.add(t,e,{namespace:!1,handler:function(t){var l,a,i=K.get(this,e);if(1&t.isTrigger&&this[e]){if(i.length)(S.event.special[e]||{}).delegateType&&t.stopPropagation();else if(i=o.call(arguments),K.set(this,e,i),l=n(this,e),this[e](),i!==(a=K.get(this,e))||l?K.set(this,e,!1):a={},i!==a)return t.stopImmediatePropagation(),t.preventDefault(),a.value}else i.length&&(K.set(this,e,{value:S.event.trigger(S.extend(i[0],S.Event.prototype),i.slice(1),this)}),t.stopImmediatePropagation())}})):void 0===K.get(t,e)&&S.event.add(t,e,Dt)}S.event={global:{},add:function(t,e,n,l,a){var i,r,o,s,c,d,u,h,p,f,g,m=K.get(t);if(G(t))for(n.handler&&(n=(i=n).handler,a=i.selector),a&&S.find.matchesSelector(it,a),n.guid||(n.guid=S.guid++),(s=m.events)||(s=m.events=Object.create(null)),(r=m.handle)||(r=m.handle=function(e){return void 0!==S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),c=(e=(e||"").match(L)||[""]).length;c--;)p=g=(o=kt.exec(e[c])||[])[1],f=(o[2]||"").split(".").sort(),p&&(u=S.event.special[p]||{},p=(a?u.delegateType:u.bindType)||p,u=S.event.special[p]||{},d=S.extend({type:p,origType:g,data:l,handler:n,guid:n.guid,selector:a,needsContext:a&&S.expr.match.needsContext.test(a),namespace:f.join(".")},i),(h=s[p])||((h=s[p]=[]).delegateCount=0,u.setup&&!1!==u.setup.call(t,l,f,r)||t.addEventListener&&t.addEventListener(p,r)),u.add&&(u.add.call(t,d),d.handler.guid||(d.handler.guid=n.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),S.event.global[p]=!0)},remove:function(t,e,n,l,a){var i,r,o,s,c,d,u,h,p,f,g,m=K.hasData(t)&&K.get(t);if(m&&(s=m.events)){for(c=(e=(e||"").match(L)||[""]).length;c--;)if(p=g=(o=kt.exec(e[c])||[])[1],f=(o[2]||"").split(".").sort(),p){for(u=S.event.special[p]||{},h=s[p=(l?u.delegateType:u.bindType)||p]||[],o=o[2]&&new RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),r=i=h.length;i--;)d=h[i],!a&&g!==d.origType||n&&n.guid!==d.guid||o&&!o.test(d.namespace)||l&&l!==d.selector&&("**"!==l||!d.selector)||(h.splice(i,1),d.selector&&h.delegateCount--,u.remove&&u.remove.call(t,d));r&&!h.length&&(u.teardown&&!1!==u.teardown.call(t,f,m.handle)||S.removeEvent(t,p,m.handle),delete s[p])}else for(p in s)S.event.remove(t,p+e[c],n,l,!0);S.isEmptyObject(s)&&K.remove(t,"handle events")}},dispatch:function(t){var e,n,l,a,i,r,o=new Array(arguments.length),s=S.event.fix(t),c=(K.get(this,"events")||Object.create(null))[s.type]||[],d=S.event.special[s.type]||{};for(o[0]=s,e=1;e=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==t.type||!0!==c.disabled)){for(i=[],r={},n=0;n-1:S.find(a,this,null,[c]).length),r[a]&&i.push(l);i.length&&o.push({elem:c,handlers:i})}return c=this,s\s*$/g;function jt(t,e){return M(t,"table")&&M(11!==e.nodeType?e:e.firstChild,"tr")&&S(t).children("tbody")[0]||t}function Ot(t){return t.type=(null!==t.getAttribute("type"))+"/"+t.type,t}function Nt(t){return"true/"===(t.type||"").slice(0,5)?t.type=t.type.slice(5):t.removeAttribute("type"),t}function Lt(t,e){var n,l,a,i,r,o;if(1===e.nodeType){if(K.hasData(t)&&(o=K.get(t).events))for(a in K.remove(e,"handle events"),o)for(n=0,l=o[a].length;n1&&"string"==typeof f&&!m.checkClone&&Rt.test(f))return t.each((function(a){var i=t.eq(a);g&&(e[0]=f.call(this,a,i.html())),Bt(i,e,n,l)}));if(h&&(i=(a=wt(e,t[0].ownerDocument,!1,t,l)).firstChild,1===a.childNodes.length&&(a=i),i||l)){for(o=(r=S.map(yt(a,"script"),Ot)).length;u0&&xt(r,!s&&yt(t,"script")),o},cleanData:function(t){for(var e,n,l,a=S.event.special,i=0;void 0!==(n=t[i]);i++)if(G(n)){if(e=n[K.expando]){if(e.events)for(l in e.events)a[l]?S.event.remove(n,l):S.removeEvent(n,l,e.handle);n[K.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(t){return Ht(this,t,!0)},remove:function(t){return Ht(this,t)},text:function(t){return $(this,(function(t){return void 0===t?S.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=t)}))}),null,t,arguments.length)},append:function(){return Bt(this,arguments,(function(t){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||jt(this,t).appendChild(t)}))},prepend:function(){return Bt(this,arguments,(function(t){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var e=jt(this,t);e.insertBefore(t,e.firstChild)}}))},before:function(){return Bt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this)}))},after:function(){return Bt(this,arguments,(function(t){this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling)}))},empty:function(){for(var t,e=0;null!=(t=this[e]);e++)1===t.nodeType&&(S.cleanData(yt(t,!1)),t.textContent="");return this},clone:function(t,e){return t=null!=t&&t,e=null==e?t:e,this.map((function(){return S.clone(this,t,e)}))},html:function(t){return $(this,(function(t){var e=this[0]||{},n=0,l=this.length;if(void 0===t&&1===e.nodeType)return e.innerHTML;if("string"==typeof t&&!It.test(t)&&!bt[(mt.exec(t)||["",""])[1].toLowerCase()]){t=S.htmlPrefilter(t);try{for(;n3,it.removeChild(t)),o}}))}();var Yt=["Webkit","Moz","ms"],Ut=y.createElement("div").style,Gt={};function Xt(t){var e=S.cssProps[t]||Gt[t];return e||(t in Ut?t:Gt[t]=function(t){for(var e=t[0].toUpperCase()+t.slice(1),n=Yt.length;n--;)if((t=Yt[n]+e)in Ut)return t}(t)||t)}var Kt=/^(none|table(?!-c[ea]).+)/,Qt=/^--/,Jt={position:"absolute",visibility:"hidden",display:"block"},te={letterSpacing:"0",fontWeight:"400"};function ee(t,e,n){var l=lt.exec(e);return l?Math.max(0,l[2]-(n||0))+(l[3]||"px"):e}function ne(t,e,n,l,a,i){var r="width"===e?1:0,o=0,s=0;if(n===(l?"border":"content"))return 0;for(;r<4;r+=2)"margin"===n&&(s+=S.css(t,n+at[r],!0,a)),l?("content"===n&&(s-=S.css(t,"padding"+at[r],!0,a)),"margin"!==n&&(s-=S.css(t,"border"+at[r]+"Width",!0,a))):(s+=S.css(t,"padding"+at[r],!0,a),"padding"!==n?s+=S.css(t,"border"+at[r]+"Width",!0,a):o+=S.css(t,"border"+at[r]+"Width",!0,a));return!l&&i>=0&&(s+=Math.max(0,Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-i-s-o-.5))||0),s}function le(t,e,n){var l=zt(t),a=(!m.boxSizingReliable()||n)&&"border-box"===S.css(t,"boxSizing",!1,l),i=a,r=Wt(t,e,l),o="offset"+e[0].toUpperCase()+e.slice(1);if(qt.test(r)){if(!n)return r;r="auto"}return(!m.boxSizingReliable()&&a||!m.reliableTrDimensions()&&M(t,"tr")||"auto"===r||!parseFloat(r)&&"inline"===S.css(t,"display",!1,l))&&t.getClientRects().length&&(a="border-box"===S.css(t,"boxSizing",!1,l),(i=o in t)&&(r=t[o])),(r=parseFloat(r)||0)+ne(t,e,n||(a?"border":"content"),i,l,r)+"px"}function ae(t,e,n,l,a){return new ae.prototype.init(t,e,n,l,a)}S.extend({cssHooks:{opacity:{get:function(t,e){if(e){var n=Wt(t,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(t,e,n,l){if(t&&3!==t.nodeType&&8!==t.nodeType&&t.style){var a,i,r,o=U(e),s=Qt.test(e),c=t.style;if(s||(e=Xt(o)),r=S.cssHooks[e]||S.cssHooks[o],void 0===n)return r&&"get"in r&&void 0!==(a=r.get(t,!1,l))?a:c[e];"string"===(i=typeof n)&&(a=lt.exec(n))&&a[1]&&(n=ct(t,e,a),i="number"),null!=n&&n==n&&("number"!==i||s||(n+=a&&a[3]||(S.cssNumber[o]?"":"px")),m.clearCloneStyle||""!==n||0!==e.indexOf("background")||(c[e]="inherit"),r&&"set"in r&&void 0===(n=r.set(t,n,l))||(s?c.setProperty(e,n):c[e]=n))}},css:function(t,e,n,l){var a,i,r,o=U(e);return Qt.test(e)||(e=Xt(o)),(r=S.cssHooks[e]||S.cssHooks[o])&&"get"in r&&(a=r.get(t,!0,n)),void 0===a&&(a=Wt(t,e,l)),"normal"===a&&e in te&&(a=te[e]),""===n||n?(i=parseFloat(a),!0===n||isFinite(i)?i||0:a):a}}),S.each(["height","width"],(function(t,e){S.cssHooks[e]={get:function(t,n,l){if(n)return!Kt.test(S.css(t,"display"))||t.getClientRects().length&&t.getBoundingClientRect().width?le(t,e,l):Zt(t,Jt,(function(){return le(t,e,l)}))},set:function(t,n,l){var a,i=zt(t),r=!m.scrollboxSize()&&"absolute"===i.position,o=(r||l)&&"border-box"===S.css(t,"boxSizing",!1,i),s=l?ne(t,e,l,o,i):0;return o&&r&&(s-=Math.ceil(t["offset"+e[0].toUpperCase()+e.slice(1)]-parseFloat(i[e])-ne(t,e,"border",!1,i)-.5)),s&&(a=lt.exec(n))&&"px"!==(a[3]||"px")&&(t.style[e]=n,n=S.css(t,e)),ee(0,n,s)}}})),S.cssHooks.marginLeft=Vt(m.reliableMarginLeft,(function(t,e){if(e)return(parseFloat(Wt(t,"marginLeft"))||t.getBoundingClientRect().left-Zt(t,{marginLeft:0},(function(){return t.getBoundingClientRect().left})))+"px"})),S.each({margin:"",padding:"",border:"Width"},(function(t,e){S.cssHooks[t+e]={expand:function(n){for(var l=0,a={},i="string"==typeof n?n.split(" "):[n];l<4;l++)a[t+at[l]+e]=i[l]||i[l-2]||i[0];return a}},"margin"!==t&&(S.cssHooks[t+e].set=ee)})),S.fn.extend({css:function(t,e){return $(this,(function(t,e,n){var l,a,i={},r=0;if(Array.isArray(e)){for(l=zt(t),a=e.length;r1)}}),S.Tween=ae,ae.prototype={constructor:ae,init:function(t,e,n,l,a,i){this.elem=t,this.prop=n,this.easing=a||S.easing._default,this.options=e,this.start=this.now=this.cur(),this.end=l,this.unit=i||(S.cssNumber[n]?"":"px")},cur:function(){var t=ae.propHooks[this.prop];return t&&t.get?t.get(this):ae.propHooks._default.get(this)},run:function(t){var e,n=ae.propHooks[this.prop];return this.options.duration?this.pos=e=S.easing[this.easing](t,this.options.duration*t,0,1,this.options.duration):this.pos=e=t,this.now=(this.end-this.start)*e+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):ae.propHooks._default.set(this),this}},ae.prototype.init.prototype=ae.prototype,ae.propHooks={_default:{get:function(t){var e;return 1!==t.elem.nodeType||null!=t.elem[t.prop]&&null==t.elem.style[t.prop]?t.elem[t.prop]:(e=S.css(t.elem,t.prop,""))&&"auto"!==e?e:0},set:function(t){S.fx.step[t.prop]?S.fx.step[t.prop](t):1!==t.elem.nodeType||!S.cssHooks[t.prop]&&null==t.elem.style[Xt(t.prop)]?t.elem[t.prop]=t.now:S.style(t.elem,t.prop,t.now+t.unit)}}},ae.propHooks.scrollTop=ae.propHooks.scrollLeft={set:function(t){t.elem.nodeType&&t.elem.parentNode&&(t.elem[t.prop]=t.now)}},S.easing={linear:function(t){return t},swing:function(t){return.5-Math.cos(t*Math.PI)/2},_default:"swing"},S.fx=ae.prototype.init,S.fx.step={};var ie,re,oe=/^(?:toggle|show|hide)$/,se=/queueHooks$/;function ce(){re&&(!1===y.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(ce):n.setTimeout(ce,S.fx.interval),S.fx.tick())}function de(){return n.setTimeout((function(){ie=void 0})),ie=Date.now()}function ue(t,e){var n,l=0,a={height:t};for(e=e?1:0;l<4;l+=2-e)a["margin"+(n=at[l])]=a["padding"+n]=t;return e&&(a.opacity=a.width=t),a}function he(t,e,n){for(var l,a=(pe.tweeners[e]||[]).concat(pe.tweeners["*"]),i=0,r=a.length;i1)},removeAttr:function(t){return this.each((function(){S.removeAttr(this,t)}))}}),S.extend({attr:function(t,e,n){var l,a,i=t.nodeType;if(3!==i&&8!==i&&2!==i)return void 0===t.getAttribute?S.prop(t,e,n):(1===i&&S.isXMLDoc(t)||(a=S.attrHooks[e.toLowerCase()]||(S.expr.match.bool.test(e)?fe:void 0)),void 0!==n?null===n?void S.removeAttr(t,e):a&&"set"in a&&void 0!==(l=a.set(t,n,e))?l:(t.setAttribute(e,n+""),n):a&&"get"in a&&null!==(l=a.get(t,e))?l:null==(l=S.find.attr(t,e))?void 0:l)},attrHooks:{type:{set:function(t,e){if(!m.radioValue&&"radio"===e&&M(t,"input")){var n=t.value;return t.setAttribute("type",e),n&&(t.value=n),e}}}},removeAttr:function(t,e){var n,l=0,a=e&&e.match(L);if(a&&1===t.nodeType)for(;n=a[l++];)t.removeAttribute(n)}}),fe={set:function(t,e,n){return!1===e?S.removeAttr(t,n):t.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),(function(t,e){var n=ge[e]||S.find.attr;ge[e]=function(t,e,l){var a,i,r=e.toLowerCase();return l||(i=ge[r],ge[r]=a,a=null!=n(t,e,l)?r:null,ge[r]=i),a}}));var me=/^(?:input|select|textarea|button)$/i,ve=/^(?:a|area)$/i;function be(t){return(t.match(L)||[]).join(" ")}function ye(t){return t.getAttribute&&t.getAttribute("class")||""}function xe(t){return Array.isArray(t)?t:"string"==typeof t&&t.match(L)||[]}S.fn.extend({prop:function(t,e){return $(this,S.prop,t,e,arguments.length>1)},removeProp:function(t){return this.each((function(){delete this[S.propFix[t]||t]}))}}),S.extend({prop:function(t,e,n){var l,a,i=t.nodeType;if(3!==i&&8!==i&&2!==i)return 1===i&&S.isXMLDoc(t)||(e=S.propFix[e]||e,a=S.propHooks[e]),void 0!==n?a&&"set"in a&&void 0!==(l=a.set(t,n,e))?l:t[e]=n:a&&"get"in a&&null!==(l=a.get(t,e))?l:t[e]},propHooks:{tabIndex:{get:function(t){var e=S.find.attr(t,"tabindex");return e?parseInt(e,10):me.test(t.nodeName)||ve.test(t.nodeName)&&t.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),m.optSelected||(S.propHooks.selected={get:function(t){var e=t.parentNode;return e&&e.parentNode&&e.parentNode.selectedIndex,null},set:function(t){var e=t.parentNode;e&&(e.selectedIndex,e.parentNode&&e.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){S.propFix[this.toLowerCase()]=this})),S.fn.extend({addClass:function(t){var e,n,l,a,i,r,o,s=0;if(v(t))return this.each((function(e){S(this).addClass(t.call(this,e,ye(this)))}));if((e=xe(t)).length)for(;n=this[s++];)if(a=ye(n),l=1===n.nodeType&&" "+be(a)+" "){for(r=0;i=e[r++];)l.indexOf(" "+i+" ")<0&&(l+=i+" ");a!==(o=be(l))&&n.setAttribute("class",o)}return this},removeClass:function(t){var e,n,l,a,i,r,o,s=0;if(v(t))return this.each((function(e){S(this).removeClass(t.call(this,e,ye(this)))}));if(!arguments.length)return this.attr("class","");if((e=xe(t)).length)for(;n=this[s++];)if(a=ye(n),l=1===n.nodeType&&" "+be(a)+" "){for(r=0;i=e[r++];)for(;l.indexOf(" "+i+" ")>-1;)l=l.replace(" "+i+" "," ");a!==(o=be(l))&&n.setAttribute("class",o)}return this},toggleClass:function(t,e){var n=typeof t,l="string"===n||Array.isArray(t);return"boolean"==typeof e&&l?e?this.addClass(t):this.removeClass(t):v(t)?this.each((function(n){S(this).toggleClass(t.call(this,n,ye(this),e),e)})):this.each((function(){var e,a,i,r;if(l)for(a=0,i=S(this),r=xe(t);e=r[a++];)i.hasClass(e)?i.removeClass(e):i.addClass(e);else void 0!==t&&"boolean"!==n||((e=ye(this))&&K.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===t?"":K.get(this,"__className__")||""))}))},hasClass:function(t){var e,n,l=0;for(e=" "+t+" ";n=this[l++];)if(1===n.nodeType&&(" "+be(ye(n))+" ").indexOf(e)>-1)return!0;return!1}});var _e=/\r/g;S.fn.extend({val:function(t){var e,n,l,a=this[0];return arguments.length?(l=v(t),this.each((function(n){var a;1===this.nodeType&&(null==(a=l?t.call(this,n,S(this).val()):t)?a="":"number"==typeof a?a+="":Array.isArray(a)&&(a=S.map(a,(function(t){return null==t?"":t+""}))),(e=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in e&&void 0!==e.set(this,a,"value")||(this.value=a))}))):a?(e=S.valHooks[a.type]||S.valHooks[a.nodeName.toLowerCase()])&&"get"in e&&void 0!==(n=e.get(a,"value"))?n:"string"==typeof(n=a.value)?n.replace(_e,""):null==n?"":n:void 0}}),S.extend({valHooks:{option:{get:function(t){var e=S.find.attr(t,"value");return null!=e?e:be(S.text(t))}},select:{get:function(t){var e,n,l,a=t.options,i=t.selectedIndex,r="select-one"===t.type,o=r?null:[],s=r?i+1:a.length;for(l=i<0?s:r?i:0;l-1)&&(n=!0);return n||(t.selectedIndex=-1),i}}}}),S.each(["radio","checkbox"],(function(){S.valHooks[this]={set:function(t,e){if(Array.isArray(e))return t.checked=S.inArray(S(t).val(),e)>-1}},m.checkOn||(S.valHooks[this].get=function(t){return null===t.getAttribute("value")?"on":t.value})})),m.focusin="onfocusin"in n;var we=/^(?:focusinfocus|focusoutblur)$/,Se=function(t){t.stopPropagation()};S.extend(S.event,{trigger:function(t,e,l,a){var i,r,o,s,c,d,u,h,f=[l||y],g=p.call(t,"type")?t.type:t,m=p.call(t,"namespace")?t.namespace.split("."):[];if(r=h=o=l=l||y,3!==l.nodeType&&8!==l.nodeType&&!we.test(g+S.event.triggered)&&(g.indexOf(".")>-1&&(m=g.split("."),g=m.shift(),m.sort()),c=g.indexOf(":")<0&&"on"+g,(t=t[S.expando]?t:new S.Event(g,"object"==typeof t&&t)).isTrigger=a?2:3,t.namespace=m.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=l),e=null==e?[t]:S.makeArray(e,[t]),u=S.event.special[g]||{},a||!u.trigger||!1!==u.trigger.apply(l,e))){if(!a&&!u.noBubble&&!b(l)){for(s=u.delegateType||g,we.test(s+g)||(r=r.parentNode);r;r=r.parentNode)f.push(r),o=r;o===(l.ownerDocument||y)&&f.push(o.defaultView||o.parentWindow||n)}for(i=0;(r=f[i++])&&!t.isPropagationStopped();)h=r,t.type=i>1?s:u.bindType||g,(d=(K.get(r,"events")||Object.create(null))[t.type]&&K.get(r,"handle"))&&d.apply(r,e),(d=c&&r[c])&&d.apply&&G(r)&&(t.result=d.apply(r,e),!1===t.result&&t.preventDefault());return t.type=g,a||t.isDefaultPrevented()||u._default&&!1!==u._default.apply(f.pop(),e)||!G(l)||c&&v(l[g])&&!b(l)&&((o=l[c])&&(l[c]=null),S.event.triggered=g,t.isPropagationStopped()&&h.addEventListener(g,Se),l[g](),t.isPropagationStopped()&&h.removeEventListener(g,Se),S.event.triggered=void 0,o&&(l[c]=o)),t.result}},simulate:function(t,e,n){var l=S.extend(new S.Event,n,{type:t,isSimulated:!0});S.event.trigger(l,null,e)}}),S.fn.extend({trigger:function(t,e){return this.each((function(){S.event.trigger(t,e,this)}))},triggerHandler:function(t,e){var n=this[0];if(n)return S.event.trigger(t,e,n,!0)}}),m.focusin||S.each({focus:"focusin",blur:"focusout"},(function(t,e){var n=function(t){S.event.simulate(e,t.target,S.event.fix(t))};S.event.special[e]={setup:function(){var l=this.ownerDocument||this.document||this,a=K.access(l,e);a||l.addEventListener(t,n,!0),K.access(l,e,(a||0)+1)},teardown:function(){var l=this.ownerDocument||this.document||this,a=K.access(l,e)-1;a?K.access(l,e,a):(l.removeEventListener(t,n,!0),K.remove(l,e))}}}));var Ce=n.location,ke={guid:Date.now()},De=/\?/;S.parseXML=function(t){var e;if(!t||"string"!=typeof t)return null;try{e=(new n.DOMParser).parseFromString(t,"text/xml")}catch(t){e=void 0}return e&&!e.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+t),e};var Te=/\[\]$/,Ee=/\r?\n/g,Me=/^(?:submit|button|image|reset|file)$/i,Ae=/^(?:input|select|textarea|keygen)/i;function Ie(t,e,n,l){var a;if(Array.isArray(e))S.each(e,(function(e,a){n||Te.test(t)?l(t,a):Ie(t+"["+("object"==typeof a&&null!=a?e:"")+"]",a,n,l)}));else if(n||"object"!==w(e))l(t,e);else for(a in e)Ie(t+"["+a+"]",e[a],n,l)}S.param=function(t,e){var n,l=[],a=function(t,e){var n=v(e)?e():e;l[l.length]=encodeURIComponent(t)+"="+encodeURIComponent(null==n?"":n)};if(null==t)return"";if(Array.isArray(t)||t.jquery&&!S.isPlainObject(t))S.each(t,(function(){a(this.name,this.value)}));else for(n in t)Ie(n,t[n],e,a);return l.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var t=S.prop(this,"elements");return t?S.makeArray(t):this})).filter((function(){var t=this.type;return this.name&&!S(this).is(":disabled")&&Ae.test(this.nodeName)&&!Me.test(t)&&(this.checked||!gt.test(t))})).map((function(t,e){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,(function(t){return{name:e.name,value:t.replace(Ee,"\r\n")}})):{name:e.name,value:n.replace(Ee,"\r\n")}})).get()}});var Re=/%20/g,Pe=/#.*$/,je=/([?&])_=[^&]*/,Oe=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ne=/^(?:GET|HEAD)$/,Le=/^\/\//,Fe={},Be={},He="*/".concat("*"),qe=y.createElement("a");function ze(t){return function(e,n){"string"!=typeof e&&(n=e,e="*");var l,a=0,i=e.toLowerCase().match(L)||[];if(v(n))for(;l=i[a++];)"+"===l[0]?(l=l.slice(1)||"*",(t[l]=t[l]||[]).unshift(n)):(t[l]=t[l]||[]).push(n)}}function Ze(t,e,n,l){var a={},i=t===Be;function r(o){var s;return a[o]=!0,S.each(t[o]||[],(function(t,o){var c=o(e,n,l);return"string"!=typeof c||i||a[c]?i?!(s=c):void 0:(e.dataTypes.unshift(c),r(c),!1)})),s}return r(e.dataTypes[0])||!a["*"]&&r("*")}function $e(t,e){var n,l,a=S.ajaxSettings.flatOptions||{};for(n in e)void 0!==e[n]&&((a[n]?t:l||(l={}))[n]=e[n]);return l&&S.extend(!0,t,l),t}qe.href=Ce.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ce.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Ce.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":He,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(t,e){return e?$e($e(t,S.ajaxSettings),e):$e(S.ajaxSettings,t)},ajaxPrefilter:ze(Fe),ajaxTransport:ze(Be),ajax:function(t,e){"object"==typeof t&&(e=t,t=void 0),e=e||{};var l,a,i,r,o,s,c,d,u,h,p=S.ajaxSetup({},e),f=p.context||p,g=p.context&&(f.nodeType||f.jquery)?S(f):S.event,m=S.Deferred(),v=S.Callbacks("once memory"),b=p.statusCode||{},x={},_={},w="canceled",C={readyState:0,getResponseHeader:function(t){var e;if(c){if(!r)for(r={};e=Oe.exec(i);)r[e[1].toLowerCase()+" "]=(r[e[1].toLowerCase()+" "]||[]).concat(e[2]);e=r[t.toLowerCase()+" "]}return null==e?null:e.join(", ")},getAllResponseHeaders:function(){return c?i:null},setRequestHeader:function(t,e){return null==c&&(t=_[t.toLowerCase()]=_[t.toLowerCase()]||t,x[t]=e),this},overrideMimeType:function(t){return null==c&&(p.mimeType=t),this},statusCode:function(t){var e;if(t)if(c)C.always(t[C.status]);else for(e in t)b[e]=[b[e],t[e]];return this},abort:function(t){var e=t||w;return l&&l.abort(e),k(0,e),this}};if(m.promise(C),p.url=((t||p.url||Ce.href)+"").replace(Le,Ce.protocol+"//"),p.type=e.method||e.type||p.method||p.type,p.dataTypes=(p.dataType||"*").toLowerCase().match(L)||[""],null==p.crossDomain){s=y.createElement("a");try{s.href=p.url,s.href=s.href,p.crossDomain=qe.protocol+"//"+qe.host!=s.protocol+"//"+s.host}catch(t){p.crossDomain=!0}}if(p.data&&p.processData&&"string"!=typeof p.data&&(p.data=S.param(p.data,p.traditional)),Ze(Fe,p,e,C),c)return C;for(u in(d=S.event&&p.global)&&0==S.active++&&S.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Ne.test(p.type),a=p.url.replace(Pe,""),p.hasContent?p.data&&p.processData&&0===(p.contentType||"").indexOf("application/x-www-form-urlencoded")&&(p.data=p.data.replace(Re,"+")):(h=p.url.slice(a.length),p.data&&(p.processData||"string"==typeof p.data)&&(a+=(De.test(a)?"&":"?")+p.data,delete p.data),!1===p.cache&&(a=a.replace(je,"$1"),h=(De.test(a)?"&":"?")+"_="+ke.guid+++h),p.url=a+h),p.ifModified&&(S.lastModified[a]&&C.setRequestHeader("If-Modified-Since",S.lastModified[a]),S.etag[a]&&C.setRequestHeader("If-None-Match",S.etag[a])),(p.data&&p.hasContent&&!1!==p.contentType||e.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+He+"; q=0.01":""):p.accepts["*"]),p.headers)C.setRequestHeader(u,p.headers[u]);if(p.beforeSend&&(!1===p.beforeSend.call(f,C,p)||c))return C.abort();if(w="abort",v.add(p.complete),C.done(p.success),C.fail(p.error),l=Ze(Be,p,e,C)){if(C.readyState=1,d&&g.trigger("ajaxSend",[C,p]),c)return C;p.async&&p.timeout>0&&(o=n.setTimeout((function(){C.abort("timeout")}),p.timeout));try{c=!1,l.send(x,k)}catch(t){if(c)throw t;k(-1,t)}}else k(-1,"No Transport");function k(t,e,r,s){var u,h,y,x,_,w=e;c||(c=!0,o&&n.clearTimeout(o),l=void 0,i=s||"",C.readyState=t>0?4:0,u=t>=200&&t<300||304===t,r&&(x=function(t,e,n){for(var l,a,i,r,o=t.contents,s=t.dataTypes;"*"===s[0];)s.shift(),void 0===l&&(l=t.mimeType||e.getResponseHeader("Content-Type"));if(l)for(a in o)if(o[a]&&o[a].test(l)){s.unshift(a);break}if(s[0]in n)i=s[0];else{for(a in n){if(!s[0]||t.converters[a+" "+s[0]]){i=a;break}r||(r=a)}i=i||r}if(i)return i!==s[0]&&s.unshift(i),n[i]}(p,C,r)),!u&&S.inArray("script",p.dataTypes)>-1&&(p.converters["text script"]=function(){}),x=function(t,e,n,l){var a,i,r,o,s,c={},d=t.dataTypes.slice();if(d[1])for(r in t.converters)c[r.toLowerCase()]=t.converters[r];for(i=d.shift();i;)if(t.responseFields[i]&&(n[t.responseFields[i]]=e),!s&&l&&t.dataFilter&&(e=t.dataFilter(e,t.dataType)),s=i,i=d.shift())if("*"===i)i=s;else if("*"!==s&&s!==i){if(!(r=c[s+" "+i]||c["* "+i]))for(a in c)if((o=a.split(" "))[1]===i&&(r=c[s+" "+o[0]]||c["* "+o[0]])){!0===r?r=c[a]:!0!==c[a]&&(i=o[0],d.unshift(o[1]));break}if(!0!==r)if(r&&t.throws)e=r(e);else try{e=r(e)}catch(t){return{state:"parsererror",error:r?t:"No conversion from "+s+" to "+i}}}return{state:"success",data:e}}(p,x,C,u),u?(p.ifModified&&((_=C.getResponseHeader("Last-Modified"))&&(S.lastModified[a]=_),(_=C.getResponseHeader("etag"))&&(S.etag[a]=_)),204===t||"HEAD"===p.type?w="nocontent":304===t?w="notmodified":(w=x.state,h=x.data,u=!(y=x.error))):(y=w,!t&&w||(w="error",t<0&&(t=0))),C.status=t,C.statusText=(e||w)+"",u?m.resolveWith(f,[h,w,C]):m.rejectWith(f,[C,w,y]),C.statusCode(b),b=void 0,d&&g.trigger(u?"ajaxSuccess":"ajaxError",[C,p,u?h:y]),v.fireWith(f,[C,w]),d&&(g.trigger("ajaxComplete",[C,p]),--S.active||S.event.trigger("ajaxStop")))}return C},getJSON:function(t,e,n){return S.get(t,e,n,"json")},getScript:function(t,e){return S.get(t,void 0,e,"script")}}),S.each(["get","post"],(function(t,e){S[e]=function(t,n,l,a){return v(n)&&(a=a||l,l=n,n=void 0),S.ajax(S.extend({url:t,type:e,dataType:a,data:n,success:l},S.isPlainObject(t)&&t))}})),S.ajaxPrefilter((function(t){var e;for(e in t.headers)"content-type"===e.toLowerCase()&&(t.contentType=t.headers[e]||"")})),S._evalUrl=function(t,e,n){return S.ajax({url:t,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(t){S.globalEval(t,e,n)}})},S.fn.extend({wrapAll:function(t){var e;return this[0]&&(v(t)&&(t=t.call(this[0])),e=S(t,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&e.insertBefore(this[0]),e.map((function(){for(var t=this;t.firstElementChild;)t=t.firstElementChild;return t})).append(this)),this},wrapInner:function(t){return v(t)?this.each((function(e){S(this).wrapInner(t.call(this,e))})):this.each((function(){var e=S(this),n=e.contents();n.length?n.wrapAll(t):e.append(t)}))},wrap:function(t){var e=v(t);return this.each((function(n){S(this).wrapAll(e?t.call(this,n):t)}))},unwrap:function(t){return this.parent(t).not("body").each((function(){S(this).replaceWith(this.childNodes)})),this}}),S.expr.pseudos.hidden=function(t){return!S.expr.pseudos.visible(t)},S.expr.pseudos.visible=function(t){return!!(t.offsetWidth||t.offsetHeight||t.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(t){}};var We={0:200,1223:204},Ve=S.ajaxSettings.xhr();m.cors=!!Ve&&"withCredentials"in Ve,m.ajax=Ve=!!Ve,S.ajaxTransport((function(t){var e,l;if(m.cors||Ve&&!t.crossDomain)return{send:function(a,i){var r,o=t.xhr();if(o.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(r in t.xhrFields)o[r]=t.xhrFields[r];for(r in t.mimeType&&o.overrideMimeType&&o.overrideMimeType(t.mimeType),t.crossDomain||a["X-Requested-With"]||(a["X-Requested-With"]="XMLHttpRequest"),a)o.setRequestHeader(r,a[r]);e=function(t){return function(){e&&(e=l=o.onload=o.onerror=o.onabort=o.ontimeout=o.onreadystatechange=null,"abort"===t?o.abort():"error"===t?"number"!=typeof o.status?i(0,"error"):i(o.status,o.statusText):i(We[o.status]||o.status,o.statusText,"text"!==(o.responseType||"text")||"string"!=typeof o.responseText?{binary:o.response}:{text:o.responseText},o.getAllResponseHeaders()))}},o.onload=e(),l=o.onerror=o.ontimeout=e("error"),void 0!==o.onabort?o.onabort=l:o.onreadystatechange=function(){4===o.readyState&&n.setTimeout((function(){e&&l()}))},e=e("abort");try{o.send(t.hasContent&&t.data||null)}catch(t){if(e)throw t}},abort:function(){e&&e()}}})),S.ajaxPrefilter((function(t){t.crossDomain&&(t.contents.script=!1)})),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(t){return S.globalEval(t),t}}}),S.ajaxPrefilter("script",(function(t){void 0===t.cache&&(t.cache=!1),t.crossDomain&&(t.type="GET")})),S.ajaxTransport("script",(function(t){var e,n;if(t.crossDomain||t.scriptAttrs)return{send:function(l,a){e=S("'); + } + + // restore form tag + html = this.clean.restoreFormTags(html); + + // remove br in|of li/header tags + html = html.replace(new RegExp('', 'gi'), ''); + html = html.replace(new RegExp('', 'gi'), ''); + + // pre class + html = html.replace(/
/gi, "
\n");
+					if (this.opts.preClass)
+					{
+						html = html.replace(/
/gi, '
');
+					}
+
+					// link nofollow
+					if (this.opts.linkNofollow)
+					{
+						html = html.replace(/])>/gi, '');
+						html = html.replace(/])>/gi, '');
+					}
+
+					// replace special characters
+					var chars = {
+						'\u2122': '™',
+						'\u00a9': '©',
+						'\u2026': '…',
+						'\u2014': '—',
+						'\u2010': '‐'
+					};
+
+					$.each(chars, function(i,s)
+					{
+						html = html.replace(new RegExp(i, 'g'), s);
+					});
+
+					html = html.replace(/&/g, '&');
+
+					// remove empty paragpraphs
+					//html = html.replace(/

<\/p>/gi, ""); + + // remove new lines + html = html.replace(/\n{2,}/g, "\n"); + + // remove all newlines + if (this.opts.removeNewlines) + { + html = html.replace(/\r?\n/g, ""); + } + + return html; + }, + onPaste: function(html, data, insert) + { + // if paste event + if (insert !== true) + { + // remove google docs markers + html = html.replace(/([\w\W]*?)<\/b>/gi, "$2"); + html = html.replace(/([\w\W]*?)<\/b>/gi, "$3"); + + // google docs styles + html = html.replace(/]*(font-style: italic; font-weight: bold|font-weight: bold; font-style: italic)[^>]*>([\w\W]*?)<\/span>/gi, '$2'); + html = html.replace(/]*(font-style: italic; font-weight: 700|font-weight: 700; font-style: italic)[^>]*>([\w\W]*?)<\/span>/gi, '$2'); + html = html.replace(/]*font-style: italic[^>]*>([\w\W]*?)<\/span>/gi, '$1'); + html = html.replace(/]*font-weight: bold[^>]*>([\w\W]*?)<\/span>/gi, '$1'); + html = html.replace(/]*font-weight: 700[^>]*>([\w\W]*?)<\/span>/gi, '$1'); + + // op tag + html = html.replace(/]*>/gi, ''); + html = html.replace(/<\/o:p>/gi, ''); + + var msword = this.clean.isHtmlMsWord(html); + if (msword) + { + html = this.clean.cleanMsWord(html); + } + } + + html = $.trim(html); + + if (data.pre) + { + if (this.opts.preSpaces) + { + html = html.replace(/\t/g, new Array(this.opts.preSpaces + 1).join(' ')); + } + } + else + { + + html = this.clean.replaceBrToNl(html); + html = this.clean.removeTagsInsidePre(html); + } + + // if paste event + if (insert !== true) + { + html = this.clean.removeEmptyInlineTags(html); + + if (data.encode === false) + { + html = html.replace(/&/g, '&'); + html = this.clean.convertTags(html, data); + html = this.clean.getPlainText(html); + html = this.clean.reconvertTags(html, data); + } + + } + + if (data.text) + { + html = this.clean.replaceNbspToSpaces(html); + html = this.clean.getPlainText(html); + } + + if (data.lists) + { + html = html.replace("\n", '
'); + } + + if (data.encode) + { + html = this.clean.encodeHtml(html); + } + + if (data.paragraphize) + { + // ff bugfix + html = html.replace(/ \n/g, ' '); + html = html.replace(/\n /g, ' '); + + html = this.paragraphize.load(html); + + // remove empty p + html = html.replace(/

<\/p>/g, ''); + } + + // remove paragraphs form lists (google docs bug) + html = html.replace(/

  • /g, '

  • '); + html = html.replace(/<\/p><\/li>/g, '
  • '); + + return html; + + }, + getCurrentType: function(html, insert) + { + var blocks = this.selection.blocks(); + + var data = { + text: false, + encode: false, + paragraphize: true, + line: this.clean.isHtmlLine(html), + blocks: this.clean.isHtmlBlocked(html), + pre: false, + lists: false, + block: true, + inline: true, + links: true, + images: true + }; + + if (blocks.length === 1 && this.utils.isCurrentOrParent(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'figcaption'])) + { + data.text = true; + data.paragraphize = false; + data.inline = false; + data.images = false; + data.links = false; + data.line = true; + } + else if (this.opts.type === 'inline' || this.opts.enterKey === false) + { + data.paragraphize = false; + data.block = false; + data.line = true; + } + else if (blocks.length === 1 && this.utils.isCurrentOrParent(['li'])) + { + data.lists = true; + data.block = false; + data.paragraphize = false; + data.images = false; + } + else if (blocks.length === 1 && this.utils.isCurrentOrParent(['th', 'td', 'blockquote'])) + { + data.block = false; + data.paragraphize = false; + + } + else if (this.opts.type === 'pre' || (blocks.length === 1 && this.utils.isCurrentOrParent('pre'))) + { + data.inline = false; + data.block = false; + data.encode = true; + data.pre = true; + data.paragraphize = false; + data.images = false; + data.links = false; + } + + if (data.line === true) + { + data.paragraphize = false; + } + + if (insert === true) + { + data.text = false; + } + + return data; + + }, + isHtmlBlocked: function(html) + { + var match1 = html.match(new RegExp('', 'gi')); + var match2 = html.match(new RegExp('])>', 'gi')); + + return (match1 === null && match2 === null) ? false : true; + }, + isHtmlLine: function(html) + { + if (this.clean.isHtmlBlocked(html)) + { + return false; + } + + var matchBR = html.match(//gi); + var matchNL = html.match(/\n/gi); + + return (!matchBR && !matchNL) ? true : false; + }, + isHtmlMsWord: function(html) + { + return html.match(/class="?Mso|style="[^"]*\bmso-|style='[^'']*\bmso-|w:WordDocument/i); + }, + removeEmptyInlineTags: function(html) + { + var tags = this.opts.inlineTags; + var $div = $("
    ").html($.parseHTML(html, document, true)); + var self = this; + + var $spans = $div.find('span'); + var $tags = $div.find(tags.join(',')); + + $tags.removeAttr('style'); + + $tags.each(function() + { + var tagHtml = $(this).html(); + if (this.attributes.length === 0 && self.utils.isEmpty(tagHtml)) + { + $(this).replaceWith(function() + { + return $(this).contents(); + }); + } + }); + + $spans.each(function() + { + var tagHtml = $(this).html(); + if (this.attributes.length === 0) + { + $(this).replaceWith(function() + { + return $(this).contents(); + }); + } + }); + + html = $div.html(); + + // convert php tags + html = html.replace('', '?>'); + + $div.remove(); + + return html; + }, + cleanMsWord: function(html) + { + html = html.replace(//g, ""); + html = html.replace(/[\s\S]*?<\/o:p>/gi, ''); + html = html.replace(/\n/g, " "); + html = html.replace(/|<\/p>|<\/div>|<\/li>|<\/td>/gi, '\n\n'); + + // lists + var $div = $("
    ").html(html); + + var lastList = false; + var lastLevel = 1; + var listsIds = []; + + $div.find("p[style]").each(function() + { + var matches = $(this).attr('style').match(/mso\-list\:l([0-9]+)\slevel([0-9]+)/); + + if (matches) + { + var currentList = parseInt(matches[1]); + var currentLevel = parseInt(matches[2]); + var listType = $(this).html().match(/^[\w]+\./) ? "ol" : "ul"; + + var $li = $("
  • ").html($(this).html()); + + $li.html($li.html().replace(/^([\w\.]+)").attr({"data-level": currentLevel, "data-list": currentList}).html($li); + $(this).replaceWith($list); + + lastList = currentList; + listsIds.push(currentList); + } + else + { + if (currentLevel > lastLevel) + { + var $prevList = $div.find('[data-level="' + lastLevel + '"][data-list="' + lastList + '"]'); + var $lastList = $prevList; + + for(var i = lastLevel; i < currentLevel; i++) + { + $list = $("<" + listType + "/>"); + $list.appendTo($lastList.find("li").last()); + + $lastList = $list; + } + + $lastList.attr({"data-level": currentLevel, "data-list": currentList}).html($li); + + } + else + { + var $prevList = $div.find('[data-level="' + currentLevel + '"][data-list="' + currentList + '"]').last(); + + $prevList.append($li); + } + + lastLevel = currentLevel; + lastList = currentList; + + $(this).remove(); + } + } + }); + + $div.find('[data-level][data-list]').removeAttr('data-level data-list'); + html = $div.html(); + + return html; + }, + replaceNbspToSpaces: function(html) + { + return html.replace(' ', ' '); + }, + replaceBrToNl: function(html) + { + return html.replace(//gi, '\n'); + }, + replaceNlToBr: function(html) + { + return html.replace(/\n/g, '
    '); + }, + convertTags: function(html, data) + { + var $div = $('
    ').html(html); + + // remove iframe + $div.find('iframe').remove(); + + // link target & attrs + var $links = $div.find('a'); + $links.removeAttr('style'); + if (this.opts.pasteLinkTarget !== false) + { + $links.attr('target', this.opts.pasteLinkTarget); + } + + // links + if (data.links && this.opts.pasteLinks) + { + $div.find('a').each(function(i, link) + { + if (link.href) + { + var tmp = '##%%a href="' + link.href + '"'; + var attr; + for (var j = 0, length = link.attributes.length; j < length; j++) + { + attr = link.attributes.item(j); + if (attr.name !== 'href') + { + tmp += ' ' + attr.name + '="' + attr.value + '"'; + } + } + + link.outerHTML = tmp + '%%##' + link.innerHTML + '##%%/a%##'; + } + }); + } + + html = $div.html(); + + // images + if (data.images && this.opts.pasteImages) + { + html = html.replace(/])>/gi, '##%%img$1src="$2"$3%%##'); + } + + // plain text + if (this.opts.pastePlainText) + { + return html; + } + + // all tags + var blockTags = (data.lists) ? ['ul', 'ol', 'li'] : this.opts.pasteBlockTags; + + var tags; + if (data.block || data.lists) + { + tags = (data.inline) ? blockTags.concat(this.opts.pasteInlineTags) : blockTags; + } + else + { + tags = (data.inline) ? this.opts.pasteInlineTags : []; + } + + var len = tags.length; + for (var i = 0; i < len; i++) + { + html = html.replace(new RegExp('<\/' + tags[i] + '>', 'gi'), '###/' + tags[i] + '###'); + + if (tags[i] === 'td' || tags[i] === 'th') + { + html = html.replace(new RegExp('<' + tags[i] + '(.*?[^>])((colspan|rowspan)="(.*?[^>])")?(.*?[^>])>', 'gi'), '###' + tags[i] + ' $2###'); + } + else if (this.utils.isInlineTag(tags[i])) + { + html = html.replace(new RegExp('<' + tags[i] + '([^>]*)class="([^>]*)"[^>]*>', 'gi'), '###' + tags[i] + ' class="$2"###'); + html = html.replace(new RegExp('<' + tags[i] + '([^>]*)data-redactor-style-cache="([^>]*)"[^>]*>', 'gi'), '###' + tags[i] + ' cache="$2"###'); + html = html.replace(new RegExp('<' + tags[i] + '[^>]*>', 'gi'), '###' + tags[i] + '###'); + } + else + { + html = html.replace(new RegExp('<' + tags[i] + '[^>]*>', 'gi'), '###' + tags[i] + '###'); + } + } + + return html; + + }, + reconvertTags: function(html, data) + { + // links & images + if ((data.links && this.opts.pasteLinks) || (data.images && this.opts.pasteImages)) + { + html = html.replace(new RegExp('##%%', 'gi'), '<'); + html = html.replace(new RegExp('%%##', 'gi'), '>'); + } + + // plain text + if (this.opts.pastePlainText) + { + return html; + } + + var blockTags = (data.lists) ? ['ul', 'ol', 'li'] : this.opts.pasteBlockTags; + + var tags; + if (data.block || data.lists) + { + tags = (data.inline) ? blockTags.concat(this.opts.pasteInlineTags) : blockTags; + } + else + { + tags = (data.inline) ? this.opts.pasteInlineTags : []; + } + + var len = tags.length; + for (var i = 0; i < len; i++) + { + html = html.replace(new RegExp('###\/' + tags[i] + '###', 'gi'), ''); + } + + for (var i = 0; i < len; i++) + { + html = html.replace(new RegExp('###' + tags[i] + '###', 'gi'), '<' + tags[i] + '>'); + } + + for (var i = 0; i < len; i++) + { + if (tags[i] === 'td' || tags[i] === 'th') + { + html = html.replace(new RegExp('###' + tags[i] + '\s?(.*?[^#])###', 'gi'), '<' + tags[i] + '$1>'); + } + else if (this.utils.isInlineTag(tags[i])) + { + + var spanMarker = (tags[i] === 'span') ? ' data-redactor-span="true"' : ''; + + html = html.replace(new RegExp('###' + tags[i] + ' cache="(.*?[^#])"###', 'gi'), '<' + tags[i] + ' style="$1"' + spanMarker + ' data-redactor-style-cache="$1">'); + html = html.replace(new RegExp('###' + tags[i] + '\s?(.*?[^#])###', 'gi'), '<' + tags[i] + '$1>'); + } + } + + return html; + + }, + cleanPre: function(block) + { + block = (typeof block === 'undefined') ? $(this.selection.block()).closest('pre', this.core.editor()[0]) : block; + + $(block).find('br').replaceWith(function() + { + return document.createTextNode('\n'); + }); + + $(block).find('p').replaceWith(function() + { + return $(this).contents(); + }); + + }, + removeTagsInsidePre: function(html) + { + var $div = $('
    ').append(html); + $div.find('pre').replaceWith(function() + { + var str = $(this).html(); + str = str.replace(/|<\/p>|<\/div>|<\/li>|<\/td>/gi, '\n'); + str = str.replace(/(<([^>]+)>)/gi, ''); + + return $('
    ').append(str);
    +					});
    +
    +					html = $div.html();
    +					$div.remove();
    +
    +					return html;
    +
    +				},
    +				getPlainText: function(html)
    +				{
    +					html = html.replace(//gi, '');
    +					html = html.replace(//gi, '');
    +                    html = html.replace(/

    <\/p>/g, ''); + html = html.replace(/<\/div>|<\/li>|<\/td>/gi, '\n'); + html = html.replace(/<\/p>/gi, '\n\n'); + html = html.replace(/<\/H[1-6]>/gi, '\n\n'); + + var tmp = document.createElement('div'); + tmp.innerHTML = html; + html = tmp.textContent || tmp.innerText; + + return $.trim(html); + }, + savePreCode: function(html) + { + html = this.clean.savePreFormatting(html); + html = this.clean.saveCodeFormatting(html); + html = this.clean.restoreSelectionMarkers(html); + + return html; + }, + savePreFormatting: function(html) + { + var pre = html.match(/([\w\W]*?)<\/pre>/gi); + if (pre === null) + { + return html; + } + + $.each(pre, $.proxy(function(i,s) + { + var arr = []; + var codeTag = false; + var contents, attr1, attr2; + + if (s.match(/(([\n\r\s]+)?)/i)) + { + arr = s.match(/(([\n\r\s]+)?)([\w\W]*?)<\/code>(([\n\r\s]+)?)<\/pre>/i); + codeTag = true; + + contents = arr[5]; + attr1 = arr[1]; + attr2 = arr[4]; + } + else + { + arr = s.match(/([\w\W]*?)<\/pre>/i); + + contents = arr[2]; + attr1 = arr[1]; + } + + contents = contents.replace(//g, '\n'); + contents = contents.replace(/ /g, ' '); + + if (this.opts.preSpaces) + { + contents = contents.replace(/\t/g, new Array(this.opts.preSpaces + 1).join(' ')); + } + + contents = this.clean.encodeEntities(contents); + + // $ fix + contents = contents.replace(/\$/g, '$'); + + if (codeTag) + { + html = html.replace(s, '' + contents + '

    '); + } + else + { + html = html.replace(s, '' + contents + '
  • '); + } + + + }, this)); + + return html; + }, + saveCodeFormatting: function(html) + { + var code = html.match(/([\w\W]*?)<\/code>/gi); + if (code === null) + { + return html; + } + + $.each(code, $.proxy(function(i,s) + { + var arr = s.match(/([\w\W]*?)<\/code>/i); + + arr[2] = arr[2].replace(/ /g, ' '); + arr[2] = this.clean.encodeEntities(arr[2]); + arr[2] = arr[2].replace(/\$/g, '$'); + + html = html.replace(s, '' + arr[2] + ''); + + }, this)); + + return html; + }, + restoreSelectionMarkers: function(html) + { + html = html.replace(/<span id="selection-marker-([0-9])" class="redactor-selection-marker">​<\/span>/g, '​'); + + return html; + }, + saveFormTags: function(html) + { + return html.replace(/([\w\W]*?)<\/form>/gi, '$2'); + }, + restoreFormTags: function(html) + { + return html.replace(/([\w\W]*?)<\/section>/gi, '$3'); + }, + encodeHtml: function(html) + { + html = html.replace(/â€/g, '"'); + html = html.replace(/“/g, '"'); + html = html.replace(/‘/g, '\''); + html = html.replace(/’/g, '\''); + html = this.clean.encodeEntities(html); + + return html; + }, + encodeEntities: function(str) + { + str = String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); + str = str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"'); + + return str; + }, + stripTags: function(input, denied) + { + if (typeof denied === 'undefined') + { + return input.replace(/(<([^>]+)>)/gi, ''); + } + + var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi; + + return input.replace(tags, function ($0, $1) + { + return denied.indexOf($1.toLowerCase()) === -1 ? $0 : ''; + }); + }, + removeMarkers: function(html) + { + return html.replace(/]?)class="redactor-selection-marker"(.*?[^>]?)>([\w\W]*?)<\/span>/gi, ''); + }, + removeSpaces: function(html) + { + html = $.trim(html); + html = html.replace(/\n/g, ''); + html = html.replace(/[\t]*/g, ''); + html = html.replace(/\n\s*\n/g, "\n"); + html = html.replace(/^[\s\n]*/g, ' '); + html = html.replace(/[\s\n]*$/g, ' '); + html = html.replace( />\s{2,} <'); // between inline tags can be only one space + html = html.replace(/\n\n/g, "\n"); + html = html.replace(/\u200B/g, ''); + + return html; + }, + removeSpacesHard: function(html) + { + html = $.trim(html); + html = html.replace(/\n/g, ''); + html = html.replace(/[\t]*/g, ''); + html = html.replace(/\n\s*\n/g, "\n"); + html = html.replace(/^[\s\n]*/g, ''); + html = html.replace(/[\s\n]*$/g, ''); + html = html.replace( />\s{2,}<'); + html = html.replace(/\n\n/g, "\n"); + html = html.replace(/\u200B/g, ''); + + return html; + }, + normalizeCurrentHeading: function() + { + var heading = this.selection.block(); + if (this.utils.isCurrentOrParentHeader() && heading) + { + heading.normalize(); + } + } + }; + }, + + // =code + code: function() + { + return { + syncFire: true, + html: false, + start: function(html) + { + html = $.trim(html); + html = html.replace(/^(​<\/span>)/, ''); + + // clean + if (this.opts.type === 'textarea') + { + html = this.clean.onSet(html); + } + else if (this.opts.type === 'div' && html === '') + { + html = this.opts.emptyHtml; + } + + html = html.replace(/

    ​<\/span><\/p>/, ''); + + this.events.stopDetectChanges(); + this.core.editor().html(html); + this.observe.load(); + this.events.startDetectChanges(); + }, + set: function(html, options) + { + html = $.trim(html); + + options = options || {}; + + // start + if (options.start) + { + this.start = options.start; + } + + // clean + if (this.opts.type === 'textarea') + { + html = this.clean.onSet(html); + } + else if (this.opts.type === 'div' && html === '') + { + html = this.opts.emptyHtml; + } + + this.core.editor().html(html); + + if (this.opts.type === 'textarea') + { + this.code.sync(); + } + + this.placeholder.enable(); + }, + get: function() + { + if (this.opts.type === 'textarea') + { + return this.core.textarea().val(); + } + else + { + var html = this.core.editor().html(); + + // clean + html = this.clean.onGet(html); + + return html; + } + }, + sync: function() + { + if (!this.code.syncFire) + { + return; + } + + var html = this.core.editor().html(); + var htmlCleaned = this.code.cleaned(html); + + // is there a need to synchronize + if (this.code.isSync(htmlCleaned)) + { + // do not sync + return; + } + + // save code + this.code.html = htmlCleaned; + + if (this.opts.type !== 'textarea') + { + this.core.callback('sync', html); + this.core.callback('change', html); + return; + } + + if (this.opts.type === 'textarea') + { + setTimeout($.proxy(function() + { + this.code.startSync(html); + + }, this), 10); + } + }, + startSync: function(html) + { + // before clean callback + html = this.core.callback('syncBefore', html); + + // clean + html = this.clean.onSync(html); + + // set code + this.core.textarea().val(html); + + // after sync callback + this.core.callback('sync', html); + + // change callback + if (this.start === false) + { + this.core.callback('change', html); + } + + this.start = false; + }, + isSync: function(htmlCleaned) + { + var html = (this.code.html !== false) ? this.code.html : false; + + return (html !== false && html === htmlCleaned); + }, + cleaned: function(html) + { + html = html.replace(/\u200B/g, ''); + return this.clean.removeMarkers(html); + } + }; + }, + + // =core + core: function() + { + return { + + id: function() + { + return this.$editor.attr('id'); + }, + element: function() + { + return this.$element; + }, + editor: function() + { + return (typeof this.$editor === 'undefined') ? $() : this.$editor; + }, + textarea: function() + { + return this.$textarea; + }, + box: function() + { + return (this.opts.type === 'textarea') ? this.$box : this.$element; + }, + toolbar: function() + { + return (this.$toolbar) ? this.$toolbar : false; + }, + air: function() + { + return (this.$air) ? this.$air : false; + }, + object: function() + { + return $.extend({}, this); + }, + structure: function() + { + this.core.editor().toggleClass('redactor-structure'); + }, + addEvent: function(name) + { + this.core.event = name; + }, + getEvent: function() + { + return this.core.event; + }, + callback: function(type, e, data) + { + var eventNamespace = 'redactor'; + var returnValue = false; + var events = $._data(this.core.element()[0], 'events'); + + // on callback + if (typeof events !== 'undefined' && typeof events[type] !== 'undefined') + { + var len = events[type].length; + for (var i = 0; i < len; i++) + { + var namespace = events[type][i].namespace; + if (namespace === 'callback.' + eventNamespace) + { + var handler = events[type][i].handler; + var args = (typeof data === 'undefined') ? [e] : [e, data]; + returnValue = (typeof args === 'undefined') ? handler.call(this, e) : handler.call(this, e, args); + } + } + } + + if (returnValue) + { + return returnValue; + } + + // no callback + if (typeof this.opts.callbacks[type] === 'undefined') + { + return (typeof data === 'undefined') ? e : data; + } + + // callback + var callback = this.opts.callbacks[type]; + + if ($.isFunction(callback)) + { + return (typeof data === 'undefined') ? callback.call(this, e) : callback.call(this, e, data); + } + else + { + return (typeof data === 'undefined') ? e : data; + } + }, + destroy: function() + { + this.opts.destroyed = true; + + this.core.callback('destroy'); + + // placeholder + this.placeholder.destroy(); + + // progress + this.progress.destroy(); + + // help label + $('#redactor-voice-' + this.uuid).remove(); + + this.core.editor().removeClass('redactor-in redactor-styles redactor-structure redactor-layer-img-edit'); + + // caret service + this.core.editor().off('keydown.redactor-remove-textnode'); + + // observer + this.core.editor().off('.redactor-observe.' + this.uuid); + + // off events and remove data + this.$element.off('.redactor').removeData('redactor'); + this.core.editor().off('.redactor'); + + $(document).off('.redactor-dropdown'); + $(document).off('.redactor-air.' + this.uuid); + $(document).off('mousedown.redactor-blur.' + this.uuid); + $(document).off('mousedown.redactor.' + this.uuid); + $(document).off('touchstart.redactor.' + this.uuid + ' click.redactor.' + this.uuid); + $(window).off('.redactor-toolbar.' + this.uuid); + $(window).off('touchmove.redactor.' + this.uuid); + $("body").off('scroll.redactor.' + this.uuid); + + $(this.opts.toolbarFixedTarget).off('scroll.redactor.' + this.uuid); + + // plugins events + var self = this; + if (this.opts.plugins !== false) + { + $.each(this.opts.plugins, function(i,s) + { + $(window).off('.redactor-plugin-' + s); + $(document).off('.redactor-plugin-' + s); + $("body").off('.redactor-plugin-' + s); + self.core.editor().off('.redactor-plugin-' + s); + }); + } + + // click to edit + this.$element.off('click.redactor-click-to-edit'); + this.$element.removeClass('redactor-click-to-edit'); + + // common + this.core.editor().removeClass('redactor-layer'); + this.core.editor().removeAttr('contenteditable'); + + var html = this.code.get(); + + if (this.opts.toolbar && this.$toolbar) + { + // dropdowns off + this.$toolbar.find('a').each(function() + { + var $el = $(this); + if ($el.data('dropdown')) + { + $el.data('dropdown').remove(); + $el.data('dropdown', {}); + } + }); + } + + if (this.opts.type === 'textarea') + { + this.$box.after(this.$element); + this.$box.remove(); + this.$element.val(html).show(); + } + + // air + if (this.opts.air) + { + this.$air.remove(); + } + + if (this.opts.toolbar && this.$toolbar) + { + this.$toolbar.remove(); + } + + // modal + if (this.$modalBox) + { + this.$modalBox.remove(); + } + + if (this.$modalOverlay) + { + this.$modalOverlay.remove(); + } + + // hide link's tooltip + $('.redactor-link-tooltip').remove(); + + // autosave + clearInterval(this.autosaveTimeout); + } + }; + }, + + // =detect + detect: function() + { + return { + + // public + isWebkit: function() + { + return /webkit/.test(this.opts.userAgent); + }, + isFirefox: function() + { + return this.opts.userAgent.indexOf('firefox') > -1; + }, + isIe: function(v) + { + if (document.documentMode || /Edge/.test(navigator.userAgent)) + { + return 'edge'; + } + + var ie; + ie = RegExp('msie' + (!isNaN(v)?('\\s'+v):''), 'i').test(navigator.userAgent); + + if (!ie) + { + ie = !!navigator.userAgent.match(/Trident.*rv[ :]*11\./); + } + + return ie; + }, + isMobile: function() + { + return /(iPhone|iPod|BlackBerry|Android)/.test(navigator.userAgent); + }, + isDesktop: function() + { + return !/(iPhone|iPod|iPad|BlackBerry|Android)/.test(navigator.userAgent); + }, + isIpad: function() + { + return /iPad/.test(navigator.userAgent); + } + + }; + }, + + // =dropdown + dropdown: function() + { + return { + active: false, + button: false, + key: false, + position: [], + getDropdown: function() + { + return this.dropdown.active; + }, + build: function(name, $dropdown, dropdownObject) + { + dropdownObject = this.dropdown.buildFormatting(name, dropdownObject); + + $.each(dropdownObject, $.proxy(function(btnName, btnObject) + { + var $item = this.dropdown.buildItem(btnName, btnObject); + + this.observe.addDropdown($item, btnName, btnObject); + $dropdown.attr('rel', name).append($item); + + }, this)); + }, + buildFormatting: function(name, dropdownObject) + { + if (name !== 'format' || this.opts.formattingAdd === false) + { + return dropdownObject; + } + + $.each(this.opts.formattingAdd, $.proxy(function(i,s) + { + var type = (this.utils.isBlockTag(s.args[0])) ? 'block' : 'inline'; + + dropdownObject[i] = { + func: (type === 'block') ? 'block.format' : 'inline.format', + args: s.args, + title: s.title + }; + + }, this)); + + return dropdownObject; + }, + buildItem: function(btnName, btnObject) + { + var $itemContainer = $('

  • '); + if (typeof btnObject.classname !== 'undefined') + { + $itemContainer.addClass(btnObject.classname); + } + + if (btnName.search(/^divider/i) !== -1) + { + $itemContainer.addClass('redactor-dropdown-divider'); + + return $itemContainer; + } + + var $item = $(''); + var $itemSpan = $('').html(btnObject.title); + + $item.append($itemSpan); + $item.on('mousedown', $.proxy(function(e) + { + e.preventDefault(); + + this.dropdown.buildClick(e, btnName, btnObject); + + }, this)); + + $itemContainer.append($item); + + return $itemContainer; + + }, + buildClick: function(e, btnName, btnObject) + { + if ($(e.target).hasClass('redactor-dropdown-link-inactive')) + { + return; + } + + var command = this.dropdown.buildCommand(btnObject); + + if (typeof btnObject.args !== 'undefined') + { + this.button.toggle(e, btnName, command.type, command.callback, btnObject.args); + } + else + { + this.button.toggle(e, btnName, command.type, command.callback); + } + }, + buildCommand: function(btnObject) + { + var command = {}; + command.type = 'func'; + command.callback = btnObject.func; + + if (btnObject.command) + { + command.type = 'command'; + command.callback = btnObject.command; + } + else if (btnObject.dropdown) + { + command.type = 'dropdown'; + command.callback = btnObject.dropdown; + } + + return command; + }, + show: function(e, key) + { + if (this.detect.isDesktop()) + { + this.core.editor().focus(); + } + + this.dropdown.hideAll(false, key); + + this.dropdown.key = key; + this.dropdown.button = this.button.get(this.dropdown.key); + + if (this.dropdown.button.hasClass('dropact')) + { + this.dropdown.hide(); + return; + } + + // re append + this.dropdown.active = this.dropdown.button.data('dropdown').appendTo(document.body); + + // callback + this.core.callback('dropdownShow', { dropdown: this.dropdown.active, key: this.dropdown.key, button: this.dropdown.button }); + + // set button + this.button.setActive(this.dropdown.key); + this.dropdown.button.addClass('dropact'); + + // position + this.dropdown.getButtonPosition(); + + // show + if (this.button.toolbar().hasClass('toolbar-fixed-box') && this.detect.isDesktop()) + { + this.dropdown.showIsFixedToolbar(); + } + else + { + this.dropdown.showIsUnFixedToolbar(); + } + + // disable scroll whan dropdown scroll + if (this.detect.isDesktop() && !this.detect.isFirefox()) + { + this.dropdown.active.on('mouseover.redactor-dropdown', $.proxy(this.utils.disableBodyScroll, this)); + this.dropdown.active.on('mouseout.redactor-dropdown mousedown.redactor-dropdown', $.proxy(this.utils.enableBodyScroll, this)); + } + + e.stopPropagation(); + + }, + showIsFixedToolbar: function() + { + var top = this.dropdown.button.position().top + this.dropdown.button.innerHeight() + this.opts.toolbarFixedTopOffset; + + var position = 'fixed'; + if (this.opts.toolbarFixedTarget !== document) + { + top = (this.dropdown.button.innerHeight() + this.$toolbar.offset().top) + this.opts.toolbarFixedTopOffset; + position = 'absolute'; + } + + this.dropdown.active.css({ + + position: position, + left: this.dropdown.position.left + 'px', + top: top + 'px' + + }).show(); + + // animate + this.dropdown.active.redactorAnimation('slideDown', { duration: 0.2 }, $.proxy(function() + { + this.dropdown.enableCallback(); + this.dropdown.enableEvents(); + + }, this)); + }, + showIsUnFixedToolbar: function() + { + this.dropdown.active.css({ + + position: 'absolute', + left: this.dropdown.position.left + 'px', + top: (this.dropdown.button.innerHeight() + this.dropdown.position.top) + 'px' + + }).show(); + + // animate + this.dropdown.active.redactorAnimation(((this.opts.animation) ? 'slideDown' : 'show'), { duration: 0.2 }, $.proxy(function() + { + this.dropdown.enableCallback(); + this.dropdown.enableEvents(); + + }, this)); + }, + enableEvents: function() + { + $(document).on('mousedown.redactor-dropdown', $.proxy(this.dropdown.hideAll, this)); + this.core.editor().on('touchstart.redactor-dropdown', $.proxy(this.dropdown.hideAll, this)); + $(document).on('keyup.redactor-dropdown', $.proxy(this.dropdown.closeHandler, this)); + }, + enableCallback: function() + { + this.core.callback('dropdownShown', { dropdown: this.dropdown.active, key: this.dropdown.key, button: this.dropdown.button }); + }, + getButtonPosition: function() + { + this.dropdown.position = this.dropdown.button.offset(); + + // fix right placement + var dropdownWidth = this.dropdown.active.width(); + if ((this.dropdown.position.left + dropdownWidth) > $(document).width()) + { + this.dropdown.position.left = Math.max(0, this.dropdown.position.left - dropdownWidth + parseInt(this.dropdown.button.innerWidth())); + } + + }, + closeHandler: function(e) + { + if (e.which !== this.keyCode.ESC) + { + return; + } + + this.dropdown.hideAll(e); + this.core.editor().focus(); + }, + hideAll: function(e, key) + { + if (this.detect.isDesktop()) + { + this.utils.enableBodyScroll(); + } + + if (e !== false && $(e.target).closest('.redactor-dropdown').length !== 0) + { + return; + } + + var $buttons = (typeof key === 'undefined') ? this.button.toolbar().find('a.dropact') : this.button.toolbar().find('a.dropact').not('.re-' + key); + var $elements = (typeof key === 'undefined') ? $('.redactor-dropdown-' + this.uuid) : $('.redactor-dropdown-' + this.uuid).not('.redactor-dropdown-box-' + key); + + if ($elements.length !== 0) + { + $(document).off('.redactor-dropdown'); + this.core.editor().off('.redactor-dropdown'); + + $.each($elements, $.proxy(function(i,s) + { + var $el = $(s); + + this.core.callback('dropdownHide', $el); + + $el.hide(); + $el.off('mouseover mouseout').off('.redactor-dropdown'); + + }, this)); + + $buttons .removeClass('redactor-act dropact'); + } + + }, + hide: function () + { + if (this.dropdown.active === false) + { + return; + } + + if (this.detect.isDesktop()) + { + this.utils.enableBodyScroll(); + } + + this.dropdown.active.redactorAnimation(((this.opts.animation) ? 'slideUp' : 'hide'), { duration: 0.2 }, $.proxy(function() + { + $(document).off('.redactor-dropdown'); + this.core.editor().off('.redactor-dropdown'); + + this.dropdown.hideOut(); + + + }, this)); + }, + hideOut: function() + { + this.core.callback('dropdownHide', this.dropdown.active); + + this.dropdown.button.removeClass('redactor-act dropact'); + this.dropdown.active.off('mouseover mouseout').off('.redactor-dropdown'); + this.dropdown.button = false; + this.dropdown.key = false; + this.dropdown.active = false; + } + }; + }, + + // =events + events: function() + { + return { + focused: false, + blured: true, + dropImage: false, + stopChanges: false, + stopDetectChanges: function() + { + this.events.stopChanges = true; + }, + startDetectChanges: function() + { + var self = this; + setTimeout(function() + { + self.events.stopChanges = false; + }, 1); + }, + dragover: function(e) + { + e.preventDefault(); + e.stopPropagation(); + + if (e.target.tagName === 'IMG') + { + $(e.target).addClass('redactor-image-dragover'); + } + + }, + dragleave: function(e) + { + // remove image dragover + this.core.editor().find('img').removeClass('redactor-image-dragover'); + }, + drop: function(e) + { + e = e.originalEvent || e; + + // remove image dragover + this.core.editor().find('img').removeClass('redactor-image-dragover'); + + if (this.opts.type === 'inline' || this.opts.type === 'pre') + { + e.preventDefault(); + return false; + } + + if (window.FormData === undefined || !e.dataTransfer) + { + return true; + } + + if (e.dataTransfer.files.length === 0) + { + return this.events.onDrop(e); + } + else + { + this.events.onDropUpload(e); + } + + this.core.callback('drop', e); + + }, + click: function(e) + { + var event = this.core.getEvent(); + var type = (event === 'click' || event === 'arrow') ? false : 'click'; + + this.core.addEvent(type); + this.utils.disableSelectAll(); + this.core.callback('click', e); + }, + focus: function(e) + { + if (this.rtePaste) + { + return; + } + + if (this.events.isCallback('focus')) + { + this.core.callback('focus', e); + } + + this.events.focused = true; + this.events.blured = false; + + // tab + if (this.selection.current() === false) + { + var sel = this.selection.get(); + var range = this.selection.range(sel); + + range.setStart(this.core.editor()[0], 0); + range.setEnd(this.core.editor()[0], 0); + this.selection.update(sel, range); + } + + }, + blur: function(e) + { + if (this.start || this.rtePaste) + { + return; + } + + if ($(e.target).closest('#' + this.core.id() + ', .redactor-toolbar, .redactor-dropdown, #redactor-modal-box').length !== 0) + { + return; + } + + if (!this.events.blured && this.events.isCallback('blur')) + { + this.core.callback('blur', e); + } + + this.events.focused = false; + this.events.blured = true; + }, + touchImageEditing: function() + { + var scrollTimer = -1; + this.events.imageEditing = false; + $(window).on('touchmove.redactor.' + this.uuid, $.proxy(function() + { + this.events.imageEditing = true; + if (scrollTimer !== -1) + { + clearTimeout(scrollTimer); + } + + scrollTimer = setTimeout($.proxy(function() + { + this.events.imageEditing = false; + + }, this), 500); + + }, this)); + }, + init: function() + { + this.core.editor().on('dragover.redactor dragenter.redactor', $.proxy(this.events.dragover, this)); + this.core.editor().on('dragleave.redactor', $.proxy(this.events.dragleave, this)); + this.core.editor().on('drop.redactor', $.proxy(this.events.drop, this)); + this.core.editor().on('click.redactor', $.proxy(this.events.click, this)); + this.core.editor().on('paste.redactor', $.proxy(this.paste.init, this)); + this.core.editor().on('keydown.redactor', $.proxy(this.keydown.init, this)); + this.core.editor().on('keyup.redactor', $.proxy(this.keyup.init, this)); + this.core.editor().on('focus.redactor', $.proxy(this.events.focus, this)); + + $(document).on('mousedown.redactor-blur.' + this.uuid, $.proxy(this.events.blur, this)); + + this.events.touchImageEditing(); + + this.events.createObserver(); + this.events.setupObserver(); + + }, + createObserver: function() + { + var self = this; + this.events.observer = new MutationObserver(function(mutations) + { + mutations.forEach($.proxy(self.events.iterateObserver, self)); + }); + + }, + iterateObserver: function(mutation) + { + + var stop = false; + + // target + if (((this.opts.type === 'textarea' || this.opts.type === 'div') + && (!this.detect.isFirefox() && mutation.target === this.core.editor()[0])) + || (mutation.attributeName === 'class' && mutation.target === this.core.editor()[0]) + || (mutation.attributeName == 'data-vivaldi-spatnav-clickable') + ) + { + stop = true; + } + + if (!stop) + { + this.observe.load(); + this.events.changeHandler(); + } + }, + setupObserver: function() + { + this.events.observer.observe(this.core.editor()[0], { + attributes: true, + subtree: true, + childList: true, + characterData: true, + characterDataOldValue: true + }); + }, + changeHandler: function() + { + if (this.events.stopChanges) + { + return; + } + + this.code.sync(); + + // autosave + if (this.autosave.is()) + { + + clearTimeout(this.autosaveTimeout); + this.autosaveTimeout = setTimeout($.proxy(this.autosave.send, this), 300); + } + + }, + onDropUpload: function(e) + { + e.preventDefault(); + e.stopPropagation(); + + if ((!this.opts.dragImageUpload && !this.opts.dragFileUpload) || (this.opts.imageUpload === null && this.opts.fileUpload === null)) + { + return; + } + + if (e.target.tagName === 'IMG') + { + this.events.dropImage = e.target; + } + + var files = e.dataTransfer.files; + var len = files.length; + for (var i = 0; i < len; i++) + { + this.upload.directUpload(files[i], e); + } + }, + onDrop: function(e) + { + this.core.callback('drop', e); + }, + isCallback: function(name) + { + return (typeof this.opts.callbacks[name] !== 'undefined' && $.isFunction(this.opts.callbacks[name])); + }, + + // #backward + stopDetect: function() + { + this.events.stopDetectChanges(); + }, + startDetect: function() + { + this.events.startDetectChanges(); + } + + }; + }, + + // =file + file: function() + { + return { + is: function() + { + return !(!this.opts.fileUpload || !this.opts.fileUpload && !this.opts.s3); + }, + show: function() + { + // build modal + this.modal.load('file', this.lang.get('file'), 700); + + // build upload + this.upload.init('#redactor-modal-file-upload', this.opts.fileUpload, this.file.insert); + + // set selected text + $('#redactor-filename').val(this.selection.get().toString()); + + // show + this.modal.show(); + }, + insert: function(json, direct, e) + { + // error callback + if (typeof json.error !== 'undefined') + { + this.modal.close(); + this.core.callback('fileUploadError', json); + return; + } + + this.file.release(e, direct); + + // prepare + this.buffer.set(); + this.air.collapsed(); + + // get + var text = this.file.text(json); + var $link = $('').attr('href', json.url).text(text); + var id = (typeof json.id === 'undefined') ? '' : json.id; + var type = (typeof json.s3 === 'undefined') ? 'file' : 's3'; + + // set id + $link.attr('data-' + type, id); + + // insert + $link = $(this.insert.node($link)); + + // focus + this.caret.after($link); + + // callback + this.storage.add({ type: type, node: $link[0], url: json.url, id: id }); + + if (direct !== null) + { + this.core.callback('fileUpload', $link, json); + } + + }, + release: function(e, direct) + { + if (direct) + { + // drag and drop upload + this.marker.remove(); + this.insert.nodeToPoint(e, this.marker.get()); + this.selection.restore(); + } + else + { + // upload from modal + this.modal.close(); + } + }, + text: function(json) + { + var text = $('#redactor-filename').val(); + + return (typeof text === 'undefined' || text === '') ? json.name : text; + } + }; + }, + + // =focus + focus: function() + { + return { + start: function() + { + this.core.editor().focus(); + + if (this.opts.type === 'inline') + { + return; + } + + var $first = this.focus.first(); + if ($first !== false) + { + this.caret.start($first); + } + }, + end: function() + { + this.core.editor().focus(); + + var last = (this.opts.inline) ? this.core.editor() : this.focus.last(); + if (last.length === 0) + { + return; + } + + // get inline last node + var lastNode = this.focus.lastChild(last); + if (!this.detect.isWebkit() && lastNode !== false) + { + this.caret.end(lastNode); + } + else + { + var sel = this.selection.get(); + var range = this.selection.range(sel); + + if (range !== null) + { + range.selectNodeContents(last[0]); + range.collapse(false); + + this.selection.update(sel, range); + } + else + { + this.caret.end(last); + } + } + + }, + first: function() + { + var $first = this.core.editor().children().first(); + if ($first.length === 0 && ($first[0].length === 0 || $first[0].tagName === 'BR' || $first[0].tagName === 'HR' || $first[0].nodeType === 3)) + { + return false; + } + + if ($first[0].tagName === 'UL' || $first[0].tagName === 'OL') + { + return $first.find('li').first(); + } + + return $first; + + }, + last: function() + { + return this.core.editor().children().last(); + }, + lastChild: function(last) + { + var lastNode = last[0].lastChild; + + return (lastNode !== null && this.utils.isInlineTag(lastNode.tagName)) ? lastNode : false; + }, + is: function() + { + return (this.core.editor()[0] === document.activeElement); + } + }; + }, + + // =image + image: function() + { + return { + is: function() + { + return !(!this.opts.imageUpload || !this.opts.imageUpload && !this.opts.s3); + }, + show: function() + { + // build modal + this.modal.load('image', this.lang.get('image'), 700); + + // build upload + this.upload.init('#redactor-modal-image-droparea', this.opts.imageUpload, this.image.insert); + this.modal.show(); + + }, + insert: function(json, direct, e) + { + var $img; + + // error callback + if (typeof json.error !== 'undefined') + { + this.modal.close(); + this.events.dropImage = false; + this.core.callback('imageUploadError', json, e); + return; + } + + // change image + if (this.events.dropImage !== false) + { + $img = $(this.events.dropImage); + + this.core.callback('imageDelete', $img[0].src, $img); + + $img.attr('src', json.url); + + this.events.dropImage = false; + this.core.callback('imageUpload', $img, json); + return; + } + + this.placeholder.hide(); + var $figure = $('<' + this.opts.imageTag + '>'); + + $img = $(''); + $img.attr('src', json.url); + + // set id + var id = (typeof json.id === 'undefined') ? '' : json.id; + var type = (typeof json.s3 === 'undefined') ? 'image' : 's3'; + $img.attr('data-' + type, id); + + $figure.append($img); + + var pre = this.utils.isTag(this.selection.current(), 'pre'); + + if (direct) + { + this.air.collapsed(); + this.marker.remove(); + + var node = this.insert.nodeToPoint(e, this.marker.get()); + var $next = $(node).next(); + + this.selection.restore(); + + // buffer + this.buffer.set(); + + // insert + if (typeof $next !== 'undefined' && $next.length !== 0 && $next[0].tagName === 'IMG') + { + // delete callback + this.core.callback('imageDelete', $next[0].src, $next); + + // replace + $next.closest('figure, p', this.core.editor()[0]).replaceWith($figure); + this.caret.after($figure); + } + else + { + if (pre) + { + $(pre).after($figure); + } + else + { + this.insert.node($figure); + } + + this.caret.after($figure); + } + + } + else + { + this.modal.close(); + + // buffer + this.buffer.set(); + + // insert + this.air.collapsed(); + + if (pre) + { + $(pre).after($figure); + } + else + { + this.insert.node($figure); + } + + this.caret.after($figure); + } + + this.events.dropImage = false; + this.storage.add({ type: type, node: $img[0], url: json.url, id: id }); + + var nextNode = $img[0].nextSibling; + var $nextFigure = $figure.next(); + var isNextEmpty = $(nextNode).text().replace(/\u200B/g, ''); + var isNextFigureEmpty = $nextFigure.text().replace(/\u200B/g, ''); + + if (isNextEmpty === '') + { + $(nextNode).remove(); + } + + if ($nextFigure.length === 1 && $nextFigure[0].tagName === 'FIGURE' && isNextFigureEmpty === '') + { + $nextFigure.remove(); + } + + if (direct !== null) + { + this.core.callback('imageUpload', $img, json); + } + else + { + this.core.callback('imageInserted', $img, json); + } + }, + setEditable: function($image) + { + $image.on('dragstart', function(e) + { + e.preventDefault(); + }); + + if (this.opts.imageResizable) + { + var handler = $.proxy(function(e) + { + this.observe.image = $image; + this.image.resizer = this.image.loadEditableControls($image); + + $(document).on('mousedown.redactor-image-resize-hide.' + this.uuid, $.proxy(this.image.hideResize, this)); + + if (this.image.resizer) + { + this.image.resizer.on('mousedown.redactor touchstart.redactor', $.proxy(function(e) + { + this.image.setResizable(e, $image); + }, this)); + } + + }, this); + + $image.off('mousedown.redactor').on('mousedown.redactor', $.proxy(this.image.hideResize, this)); + $image.off('click.redactor touchstart.redactor').on('click.redactor touchstart.redactor', handler); + } + else + { + $image.off('click.redactor touchstart.redactor').on('click.redactor touchstart.redactor', $.proxy(function(e) + { + setTimeout($.proxy(function() + { + this.image.showEdit($image); + + }, this), 200); + + }, this)); + } + + }, + setResizable: function(e, $image) + { + e.preventDefault(); + + this.image.resizeHandle = { + x : e.pageX, + y : e.pageY, + el : $image, + ratio: $image.width() / $image.height(), + h: $image.height() + }; + + e = e.originalEvent || e; + + if (e.targetTouches) + { + this.image.resizeHandle.x = e.targetTouches[0].pageX; + this.image.resizeHandle.y = e.targetTouches[0].pageY; + } + + this.image.startResize(); + }, + startResize: function() + { + $(document).on('mousemove.redactor-image-resize touchmove.redactor-image-resize', $.proxy(this.image.moveResize, this)); + $(document).on('mouseup.redactor-image-resize touchend.redactor-image-resize', $.proxy(this.image.stopResize, this)); + }, + moveResize: function(e) + { + e.preventDefault(); + + e = e.originalEvent || e; + + var height = this.image.resizeHandle.h; + + if (e.targetTouches) height += (e.targetTouches[0].pageY - this.image.resizeHandle.y); + else height += (e.pageY - this.image.resizeHandle.y); + + var width = Math.round(height * this.image.resizeHandle.ratio); + + if (height < 50 || width < 100) return; + + this.image.resizeHandle.el.attr({width: width, height: height}); + this.image.resizeHandle.el.width(width); + this.image.resizeHandle.el.height(height); + + this.code.sync(); + }, + stopResize: function() + { + this.handle = false; + $(document).off('.redactor-image-resize'); + + this.image.hideResize(); + }, + hideResize: function(e) + { + if (e && $(e.target).closest('#redactor-image-box', this.$editor[0]).length !== 0) return; + if (e && e.target.tagName == 'IMG') + { + var $image = $(e.target); + } + + var imageBox = this.$editor.find('#redactor-image-box'); + if (imageBox.length === 0) return; + + $('#redactor-image-editter').remove(); + $('#redactor-image-resizer').remove(); + + imageBox.find('img').css({ + marginTop: imageBox[0].style.marginTop, + marginBottom: imageBox[0].style.marginBottom, + marginLeft: imageBox[0].style.marginLeft, + marginRight: imageBox[0].style.marginRight + }); + + imageBox.css('margin', ''); + imageBox.find('img').css('opacity', ''); + imageBox.replaceWith(function() + { + return $(this).contents(); + }); + + $(document).off('mousedown.redactor-image-resize-hide.' + this.uuid); + + if (typeof this.image.resizeHandle !== 'undefined') + { + this.image.resizeHandle.el.attr('rel', this.image.resizeHandle.el.attr('style')); + } + }, + loadResizableControls: function($image, imageBox) + { + if (this.opts.imageResizable && !this.detect.isMobile()) + { + var imageResizer = $(''); + + if (!this.detect.isDesktop()) + { + imageResizer.css({ width: '15px', height: '15px' }); + } + + imageResizer.attr('contenteditable', false); + imageBox.append(imageResizer); + imageBox.append($image); + + return imageResizer; + } + else + { + imageBox.append($image); + return false; + } + }, + loadEditableControls: function($image) + { + if ($('#redactor-image-box').length !== 0) + { + return; + } + + var imageBox = $(''); + imageBox.css('float', $image.css('float')).attr('contenteditable', false); + + if ($image[0].style.margin != 'auto') + { + imageBox.css({ + marginTop: $image[0].style.marginTop, + marginBottom: $image[0].style.marginBottom, + marginLeft: $image[0].style.marginLeft, + marginRight: $image[0].style.marginRight + }); + + $image.css('margin', ''); + } + else + { + imageBox.css({ 'display': 'block', 'margin': 'auto' }); + } + + $image.css('opacity', '.5').after(imageBox); + + + if (this.opts.imageEditable) + { + // editter + this.image.editter = $('' + this.lang.get('edit') + ''); + this.image.editter.attr('contenteditable', false); + this.image.editter.on('click', $.proxy(function() + { + this.image.showEdit($image); + }, this)); + + imageBox.append(this.image.editter); + + // position correction + var editerWidth = this.image.editter.innerWidth(); + this.image.editter.css('margin-left', '-' + editerWidth/2 + 'px'); + } + + return this.image.loadResizableControls($image, imageBox); + + }, + showEdit: function($image) + { + if (this.events.imageEditing) + { + return; + } + + this.observe.image = $image; + + var $link = $image.closest('a', this.$editor[0]); + var $figure = $image.closest('figure', this.$editor[0]); + var $container = ($figure.length !== 0) ? $figure : $image; + + this.modal.load('image-edit', this.lang.get('edit'), 705); + + this.image.buttonDelete = this.modal.getDeleteButton().text(this.lang.get('delete')); + this.image.buttonSave = this.modal.getActionButton().text(this.lang.get('save')); + + this.image.buttonDelete.on('click', $.proxy(this.image.remove, this)); + this.image.buttonSave.on('click', $.proxy(this.image.update, this)); + + if (this.opts.imageCaption === false) + { + $('#redactor-image-caption').val('').hide().prev().hide(); + } + else + { + var $parent = $image.closest(this.opts.imageTag, this.$editor[0]); + var $ficaption = $parent.find('figcaption'); + if ($ficaption !== 0) + { + + $('#redactor-image-caption').val($ficaption.text()).show(); + } + } + + if (!this.opts.imagePosition) + { + $('.redactor-image-position-option').hide(); + } + else + { + var isCentered = ($figure.length !== 0) ? ($container.css('text-align') === 'center') : ($container.css('display') == 'block' && $container.css('float') == 'none'); + var floatValue = (isCentered) ? 'center' : $container.css('float'); + $('#redactor-image-align').val(floatValue); + } + + $('#redactor-image-preview').html($('')); + $('#redactor-image-title').val($image.attr('alt')); + + if ($link.length !== 0) + { + $('#redactor-image-link').val($link.attr('href')); + if ($link.attr('target') === '_blank') + { + $('#redactor-image-link-blank').prop('checked', true); + } + } + + // hide link's tooltip + $('.redactor-link-tooltip').remove(); + + this.modal.show(); + + // focus + if (this.detect.isDesktop()) + { + $('#redactor-image-title').focus(); + } + + }, + update: function() + { + var $image = this.observe.image; + var $link = $image.closest('a', this.core.editor()[0]); + + var title = $('#redactor-image-title').val().replace(/(<([^>]+)>)/ig,""); + $image.attr('alt', title).attr('title', title); + + this.image.setFloating($image); + + // as link + var link = $.trim($('#redactor-image-link').val()).replace(/(<([^>]+)>)/ig,""); + if (link !== '') + { + // test url (add protocol) + var pattern = '((xn--)?[a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}'; + var re = new RegExp('^(http|ftp|https)://' + pattern, 'i'); + var re2 = new RegExp('^' + pattern, 'i'); + + if (link.search(re) === -1 && link.search(re2) === 0 && this.opts.linkProtocol) + { + link = this.opts.linkProtocol + '://' + link; + } + + var target = ($('#redactor-image-link-blank').prop('checked')) ? true : false; + + if ($link.length === 0) + { + var a = $('' + this.utils.getOuterHtml($image) + ''); + if (target) + { + a.attr('target', '_blank'); + } + + $image = $image.replaceWith(a); + $link = this.core.editor().find('#redactor-img-tmp'); + $link.removeAttr('id'); + } + else + { + $link.attr('href', link); + if (target) + { + $link.attr('target', '_blank'); + } + else + { + $link.removeAttr('target'); + } + } + } + else if ($link.length !== 0) + { + $link.replaceWith(this.utils.getOuterHtml($image)); + } + + this.image.addCaption($image, $link); + this.modal.close(); + + // buffer + this.buffer.set(); + + }, + setFloating: function($image) + { + var $figure = $image.closest('figure', this.$editor[0]); + var $container = ($figure.length !== 0) ? $figure : $image; + var floating = $('#redactor-image-align').val(); + + var imageFloat = ''; + var imageDisplay = ''; + var imageMargin = ''; + var textAlign = ''; + + switch (floating) + { + case 'left': + imageFloat = 'left'; + imageMargin = '0 ' + this.opts.imageFloatMargin + ' ' + this.opts.imageFloatMargin + ' 0'; + break; + case 'right': + imageFloat = 'right'; + imageMargin = '0 0 ' + this.opts.imageFloatMargin + ' ' + this.opts.imageFloatMargin; + break; + case 'center': + + if ($figure.length !== 0) + { + textAlign = 'center'; + } + else + { + imageDisplay = 'block'; + imageMargin = 'auto'; + } + + break; + } + + $container.css({ 'float': imageFloat, 'display': imageDisplay, 'margin': imageMargin, 'text-align': textAlign }); + $container.attr('rel', $image.attr('style')); + }, + addCaption: function($image, $link) + { + var caption = $('#redactor-image-caption').val(); + + var $target = ($link.length !== 0) ? $link : $image; + var $figcaption = $target.next(); + + if ($figcaption.length === 0 || $figcaption[0].tagName !== 'FIGCAPTION') + { + $figcaption = false; + } + + if (caption !== '') + { + if ($figcaption === false) + { + $figcaption = $('
    ').text(caption); + $target.after($figcaption); + } + else + { + $figcaption.text(caption); + } + } + else if ($figcaption !== false) + { + $figcaption.remove(); + } + }, + remove: function(e, $image, index) + { + $image = (typeof $image === 'undefined') ? $(this.observe.image) : $image; + + // delete from modal + if (typeof e !== 'boolean') + { + this.buffer.set(); + } + + this.events.stopDetectChanges(); + + var $link = $image.closest('a', this.core.editor()[0]); + var $figure = $image.closest(this.opts.imageTag, this.core.editor()[0]); + var $parent = $image.parent(); + + // callback + var imageDeleteStop = this.core.callback('imageDelete', e, $image[0]); + if (imageDeleteStop === false) + { + if (e) e.preventDefault(); + return false; + } + + if ($('#redactor-image-box').length !== 0) + { + $parent = $('#redactor-image-box').parent(); + } + + var $next, $prev; + if ($figure.length !== 0) + { + $prev = $figure.prev(); + $next = $figure.next(); + $figure.remove(); + } + else if ($link.length !== 0) + { + $parent = $link.parent(); + $link.remove(); + } + else + { + $image.remove(); + } + + $('#redactor-image-box').remove(); + + if (e !== false) + { + if ($next && $next.length !== 0) + { + this.caret.start($next); + } + else if ($prev && $prev.length !== 0) + { + this.caret.end($prev); + } + } + + if (typeof e !== 'boolean') + { + this.modal.close(); + } + + this.utils.restoreScroll(); + this.observe.image = false; + this.events.startDetectChanges(); + this.placeholder.enable(); + this.code.sync(); + + } + }; + }, + + // =indent + indent: function() + { + return { + increase: function() + { + if (!this.list.get()) + { + return; + } + + var $current = $(this.selection.current()).closest('li'); + var $list = $current.closest('ul, ol', this.core.editor()[0]); + + var $li = $current.closest('li'); + var $prev = $li.prev(); + if ($prev.length === 0 || $prev[0].tagName !== 'LI') + { + return; + } + + this.buffer.set(); + + + if (this.utils.isCollapsed()) + { + var listTag = $list[0].tagName; + var $newList = $('<' + listTag + ' />'); + + this.selection.save(); + + var $ol = $prev.find('ol').first(); + if ($ol.length === 1) + { + $ol.append($current); + } + else + { + var listTag = $list[0].tagName; + var $newList = $('<' + listTag + ' />'); + $newList.append($current); + $prev.append($newList); + } + + this.selection.restore(); + } + else + { + document.execCommand('indent'); + + // normalize + this.selection.save(); + this.indent.removeEmpty(); + this.indent.normalize(); + this.selection.restore(); + } + }, + decrease: function() + { + if (!this.list.get()) + { + return; + } + + var $current = $(this.selection.current()).closest('li'); + var $list = $current.closest('ul, ol', this.core.editor()[0]); + + this.buffer.set(); + + document.execCommand('outdent'); + + var $item = $(this.selection.current()).closest('li', this.core.editor()[0]); + + if (this.utils.isCollapsed()) + { + this.indent.repositionItem($item); + } + + if ($item.length === 0) + { + document.execCommand('formatblock', false, 'p'); + $item = $(this.selection.current()); + var $next = $item.next(); + if ($next.length !== 0 && $next[0].tagName === 'BR') + { + $next.remove(); + } + } + + // normalize + this.selection.save(); + this.indent.removeEmpty(); + this.indent.normalize(); + this.selection.restore(); + + }, + repositionItem: function($item) + { + var $next = $item.next(); + if ($next.length !== 0 && ($next[0].tagName !== 'UL' || $next[0].tagName !== 'OL')) + { + $item.append($next); + } + + var $prev = $item.prev(); + if ($prev.length !== 0 && $prev[0].tagName !== 'LI') + { + this.selection.save(); + var $li = $item.parents('li', this.core.editor()[0]); + $li.after($item); + this.selection.restore(); + } + }, + normalize: function() + { + this.core.editor().find('li').each($.proxy(function(i,s) + { + var $el = $(s); + + // remove style + var filter = ''; + if (this.opts.keepStyleAttr.length !== 0) + { + filter = ',' + this.opts.keepStyleAttr.join(','); + } + + $el.find(this.opts.inlineTags.join(',')).not('img' + filter).removeAttr('style'); + + var $parent = $el.parent(); + if ($parent.length !== 0 && $parent[0].tagName === 'LI') + { + $parent.after($el); + return; + } + + var $next = $el.next(); + if ($next.length !== 0 && ($next[0].tagName === 'UL' || $next[0].tagName === 'OL')) + { + $el.append($next); + } + + }, this)); + + }, + removeEmpty: function($list) + { + var $lists = this.core.editor().find('ul, ol'); + var $items = this.core.editor().find('li'); + + $items.each($.proxy(function(i, s) + { + this.indent.removeItemEmpty(s); + + }, this)); + + $lists.each($.proxy(function(i, s) + { + this.indent.removeItemEmpty(s); + + }, this)); + + $items.each($.proxy(function(i, s) + { + this.indent.removeItemEmpty(s); + + }, this)); + }, + removeItemEmpty: function(s) + { + var html = s.innerHTML.replace(/[\t\s\n]/g, ''); + html = html.replace(/<\/span>/g, ''); + + if (html === '') + { + $(s).remove(); + } + } + }; + }, + + // =inline + inline: function() + { + return { + format: function(tag, attr, value, type) + { + // Stop formatting pre/code + if (this.utils.isCurrentOrParent(['PRE', 'CODE'])) return; + + // Get params + var params = this.inline.getParams(attr, value, type); + + // Arrange tag + tag = this.inline.arrangeTag(tag); + + this.placeholder.hide(); + this.buffer.set(); + + (this.utils.isCollapsed()) ? this.inline.formatCollapsed(tag, params) : this.inline.formatUncollapsed(tag, params); + }, + formatCollapsed: function(tag, params) + { + var newInline; + var inline = this.selection.inline(); + + if (inline) + { + var currentTag = inline.tagName.toLowerCase(); + if (currentTag === tag) + { + // empty = remove + if (this.utils.isEmpty(inline.innerHTML)) + { + this.caret.after(inline); + $(inline).remove(); + } + // not empty = break + else + { + var $first = this.inline.insertBreakpoint(inline, currentTag); + this.caret.after($first); + } + } + else if ($(inline).closest(tag).length === 0) + { + newInline = this.inline.insertInline(tag); + newInline = this.inline.setParams(newInline, params); + } + else + { + var $first = this.inline.insertBreakpoint(inline, currentTag); + this.caret.after($first); + } + } + else + { + newInline = this.inline.insertInline(tag); + newInline = this.inline.setParams(newInline, params); + } + }, + formatUncollapsed: function(tag, params) + { + this.selection.save(); + + var nodes = this.inline.getClearedNodes(); + this.inline.setNodesStriked(nodes, tag, params); + + this.selection.restore(); + + document.execCommand('strikethrough'); + + this.selection.saveInstant(); + + var self = this; + this.core.editor().find('strike').each(function() + { + var $el = self.utils.replaceToTag(this, tag); + self.inline.setParams($el[0], params); + + var $inside = $el.find(tag); + var $parent = $el.parent(); + var $parentAround = $parent.parent(); + + // revert formatting (safari bug) + if ($parentAround.length !== 0 && $parentAround[0].tagName.toLowerCase() === tag && $parentAround.html() == $parent[0].outerHTML) + { + $el.replaceWith(function() { return $(this).contents(); }); + $parentAround.replaceWith(function() { return $(this).contents(); }); + + return; + } + + // remove inside + if ($inside.length !== 0) self.inline.cleanInsideOrParent($inside, params); + + // same parent + if ($parent.html() == $el[0].outerHTML) self.inline.cleanInsideOrParent($parent, params); + + // bugfix: remove empty inline tags after selection + if (self.detect.isFirefox()) + { + self.core.editor().find(tag + ':empty').remove(); + } + }); + + this.selection.restoreInstant(); + }, + cleanInsideOrParent: function($el, params) + { + if (params) + { + for (var key in params.data) + { + this.inline.removeSpecificAttr($el, key, params.data[key]); + } + } + }, + getClearedNodes: function() + { + var nodes = this.selection.nodes(); + var newNodes = []; + var len = nodes.length; + var started = 0; + + // find array slice + for (var i = 0; i < len; i++) + { + if ($(nodes[i]).hasClass('redactor-selection-marker')) + { + started = i + 2; + break; + } + } + + // find selected inline & text nodes + for (var i = 0; i < len; i++) + { + if (i >= started && !this.utils.isBlockTag(nodes[i].tagName)) + { + newNodes.push(nodes[i]); + } + } + + return newNodes; + }, + isConvertableAttr: function(node, name, value) + { + var nodeAttrValue = $(node).attr(name); + if (nodeAttrValue) + { + if (name === 'style') + { + value = $.trim(value).replace(/;$/, '') + + var rules = value.split(';'); + var count = 0; + for (var i = 0; i < rules.length; i++) + { + var arr = rules[i].split(':'); + var ruleName = $.trim(arr[0]); + var ruleValue = $.trim(arr[1]); + + if (ruleName.search(/color/) !== -1) + { + var val = $(node).css(ruleName); + if (val && (val === ruleValue || this.utils.rgb2hex(val) === ruleValue)) + { + count++; + } + } + else if ($(node).css(ruleName) === ruleValue) + { + count++; + } + } + + if (count === rules.length) + { + return 1; + } + } + else if (nodeAttrValue === value) + { + return 1; + } + } + + return 0; + + }, + isConvertable: function(node, nodeTag, tag, params) + { + if (nodeTag === tag) + { + if (params) + { + var count = 0; + for (var key in params.data) + { + count += this.inline.isConvertableAttr(node, key, params.data[key]); + } + + if (count === Object.keys(params.data).length) + { + return true; + } + } + else + { + return true; + } + } + + return false; + }, + setNodesStriked: function(nodes, tag, params) + { + for (var i = 0; i < nodes.length; i++) + { + var nodeTag = (nodes[i].tagName) ? nodes[i].tagName.toLowerCase() : undefined; + + var parent = nodes[i].parentNode; + var parentTag = (parent && parent.tagName) ? parent.tagName.toLowerCase() : undefined; + + var convertable = this.inline.isConvertable(parent, parentTag, tag, params); + if (convertable) + { + var $el = $(parent).replaceWith(function() + { + return $('').append($(this).contents()); + }); + + $el.attr('data-redactor-inline-converted'); + } + + var convertable = this.inline.isConvertable(nodes[i], nodeTag, tag, params); + if (convertable) + { + var $el = $(nodes[i]).replaceWith(function() + { + return $('').append($(this).contents()); + }); + } + } + }, + insertBreakpoint: function(inline, currentTag) + { + var breakpoint = document.createElement('span'); + breakpoint.id = 'redactor-inline-breakpoint'; + breakpoint = this.insert.node(breakpoint); + + var end = this.utils.isEndOfElement(inline); + var code = this.utils.getOuterHtml(inline); + var endTag = (end) ? '' : '<' + currentTag + '>'; + + code = code.replace(/<\/span>/i, "" + endTag); + + var $code = $(code); + $(inline).replaceWith($code); + + if (endTag !== '') + { + this.utils.cloneAttributes(inline, $code.last()); + } + + return $code.first(); + }, + insertInline: function(tag) + { + var node = document.createElement(tag); + + this.insert.node(node); + this.caret.start(node); + + return node; + }, + arrangeTag: function(tag) + { + var tags = ['b', 'bold', 'i', 'italic', 'underline', 'strikethrough', 'deleted', 'superscript', 'subscript']; + var replaced = ['strong', 'strong', 'em', 'em', 'u', 'del', 'del', 'sup', 'sub']; + + tag = tag.toLowerCase(); + + for (var i = 0; i < tags.length; i++) + { + if (tag === tags[i]) + { + tag = replaced[i]; + } + } + + return tag; + }, + getStyleParams: function(params) + { + var result = {}; + var rules = params.trim().replace(/;$/, '').split(';'); + for (var i = 0; i < rules.length; i++) + { + var rule = rules[i].split(':'); + if (rule) + { + result[rule[0].trim()] = rule[1].trim(); + } + } + + return result; + }, + getParams: function(attr, value, type) + { + var data = false; + var func = 'toggle'; + if (typeof attr === 'object') + { + data = attr; + func = (value !== undefined) ? value : func; + } + else if (attr !== undefined && value !== undefined) + { + data = {}; + data[attr] = value; + func = (type !== undefined) ? type : func; + } + + return (data) ? { 'func': func, 'data': data } : false; + }, + setParams: function(node, params) + { + if (params) + { + for (var key in params.data) + { + var $node = $(node); + if (key === 'style') + { + node = this.inline[params.func + 'Style'](params.data[key], node); + $node.attr('data-redactor-style-cache', $node.attr('style')); + } + else if (key === 'class') + { + node = this.inline[params.func + 'Class'](params.data[key], node); + } + // attr + else + { + node = (params.func === 'remove') ? this.inline[params.func + 'Attr'](key, node) : this.inline[params.func + 'Attr'](key, params.data[key], node); + } + + if (key === 'style' && node.tagName === 'SPAN') + { + $node.attr('data-redactor-span', true); + } + } + } + + return node; + }, + + // Each + eachInline: function(node, callback) + { + var lastNode; + var nodes = (node === undefined) ? this.selection.inlines() : [node]; + if (nodes) + { + for (var i = 0; i < nodes.length; i++) + { + lastNode = callback(nodes[i])[0]; + } + } + + return lastNode; + }, + + // Class + replaceClass: function(value, node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).removeAttr('class').addClass(value); + }); + }, + toggleClass: function(value, node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).toggleClass(value); + }); + }, + addClass: function(value, node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).addClass(value); + }); + }, + removeClass: function(value, node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).removeClass(value); + }); + }, + removeAllClass: function(node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).removeAttr('class'); + }); + }, + + // Attr + replaceAttr: function(name, value, node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).removeAttr(name).attr(name. value); + }); + }, + toggleAttr: function(name, value, node) + { + return this.inline.eachInline(node, function(el) + { + var attr = $(el).attr(name); + + return (attr) ? $(el).removeAttr(name) : $(el).attr(name. value); + }); + }, + addAttr: function(name, value, node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).attr(name, value); + }); + }, + removeAttr: function(name, node) + { + return this.inline.eachInline(node, function(el) + { + var $el = $(el); + + $el.removeAttr(name); + if (name === 'style') + { + $el.removeAttr('data-redactor-style-cache'); + } + + return $el; + }); + }, + removeAllAttr: function(node) + { + return this.inline.eachInline(node, function(el) + { + var $el = $(el); + var len = el.attributes.length; + for (var z = 0; z < len; z++) + { + $el.removeAttr(el.attributes[z].name); + } + + return $el; + }); + }, + removeSpecificAttr: function(node, key, value) + { + var $el = $(node); + if (key === 'style') + { + var arr = value.split(':'); + var name = arr[0].trim(); + $el.css(name, ''); + + if (this.utils.removeEmptyAttr(node, 'style')) + { + $el.removeAttr('data-redactor-style-cache'); + } + } + else + { + $el.removeAttr(key)[0]; + } + }, + + // Style + hasParentStyle: function($el) + { + var $parent = $el.parent(); + + return ($parent.length === 1 && $parent[0].tagName === $el[0].tagName && $parent.html() === $el[0].outerHTML) ? $parent : false; + }, + addParentStyle: function($el) + { + var $parent = this.inline.hasParentStyle($el); + if ($parent) + { + var style = this.inline.getStyleParams($el.attr('style')); + $parent.css(style); + $parent.attr('data-redactor-style-cache', $parent.attr('style')); + + $el.replaceWith(function() + { + return $(this).contents(); + }); + } + else + { + $el.attr('data-redactor-style-cache', $el.attr('style')); + } + + return $el; + }, + replaceStyle: function(params, node) + { + params = this.inline.getStyleParams(params); + + var self = this; + return this.inline.eachInline(node, function(el) + { + var $el = $(el); + $el.removeAttr('style').css(params); + + var style = $el.attr('style'); + if (style) $el.attr('style', style.replace(/"/g, '\'')); + + $el = self.inline.addParentStyle($el); + + return $el; + }); + }, + toggleStyle: function(params, node) + { + params = this.inline.getStyleParams(params); + + var self = this; + return this.inline.eachInline(node, function(el) + { + var $el = $(el); + + for (var key in params) + { + var newVal = params[key]; + var oldVal = $el.css(key); + + oldVal = (self.utils.isRgb(oldVal)) ? self.utils.rgb2hex(oldVal) : oldVal.replace(/"/g, ''); + newVal = (self.utils.isRgb(newVal)) ? self.utils.rgb2hex(newVal) : newVal.replace(/"/g, ''); + + if (oldVal === newVal) + { + $el.css(key, ''); + } + else + { + $el.css(key, newVal); + } + } + + var style = $el.attr('style'); + if (style) $el.attr('style', style.replace(/"/g, '\'')); + + if (!self.utils.removeEmptyAttr(el, 'style')) + { + $el = self.inline.addParentStyle($el); + } + else + { + $el.removeAttr('data-redactor-style-cache'); + } + + + return $el; + }); + }, + addStyle: function(params, node) + { + params = this.inline.getStyleParams(params); + + var self = this; + return this.inline.eachInline(node, function(el) + { + var $el = $(el); + + $el.css(params); + + var style = $el.attr('style'); + if (style) $el.attr('style', style.replace(/"/g, '\'')); + + $el = self.inline.addParentStyle($el); + + return $el; + }); + }, + removeStyle: function(params, node) + { + params = this.inline.getStyleParams(params); + + var self = this; + return this.inline.eachInline(node, function(el) + { + var $el = $(el); + + for (var key in params) + { + $el.css(key, ''); + } + + if (self.utils.removeEmptyAttr(el, 'style')) + { + $el.removeAttr('data-redactor-style-cache'); + } + else + { + $el.attr('data-redactor-style-cache', $el.attr('style')); + } + + return $el; + }); + }, + removeAllStyle: function(node) + { + return this.inline.eachInline(node, function(el) + { + return $(el).removeAttr('style').removeAttr('data-redactor-style-cache'); + }); + }, + removeStyleRule: function(name) + { + var parent = this.selection.parent(); + var nodes = this.selection.inlines(); + + this.buffer.set(); + + if (parent && parent.tagName === 'SPAN') + { + this.inline.removeStyleRuleAttr($(parent), name); + } + + for (var i = 0; i < nodes.length; i++) + { + var el = nodes[i]; + var $el = $(el); + if ($.inArray(el.tagName.toLowerCase(), this.opts.inlineTags) != -1 && !$el.hasClass('redactor-selection-marker')) + { + this.inline.removeStyleRuleAttr($el, name); + } + } + + }, + removeStyleRuleAttr: function($el, name) + { + $el.css(name, ''); + if (this.utils.removeEmptyAttr($el, 'style')) + { + $el.removeAttr('data-redactor-style-cache'); + } + else + { + $el.attr('data-redactor-style-cache', $el.attr('style')); + } + }, + + // Update + update: function(tag, attr, value, type) + { + tag = this.inline.arrangeTag(tag); + + var params = this.inline.getParams(attr, value, type); + var nodes = this.selection.inlines(); + var result = []; + + if (nodes) + { + for (var i = 0; i < nodes.length; i++) + { + var el = nodes[i]; + if (tag === '*' || el.tagName.toLowerCase() === tag) + { + result.push(this.inline.setParams(el, params)); + } + } + } + + return result; + }, + + // All + removeFormat: function() + { + this.selection.save(); + + var nodes = this.inline.getClearedNodes(); + for (var i = 0; i < nodes.length; i++) + { + if (nodes[i].nodeType === 1) + { + $(nodes[i]).replaceWith(function() + { + return $(this).contents(); + }); + } + } + + this.selection.restore(); + } + + }; + }, + + // =insert + insert: function() + { + return { + set: function(html) + { + this.placeholder.hide(); + + this.code.set(html); + this.focus.end(); + + this.placeholder.enable(); + }, + html: function(html, data) + { + this.placeholder.hide(); + this.core.editor().focus(); + + var block = this.selection.block(); + var inline = this.selection.inline(); + + // clean + if (typeof data === 'undefined') + { + data = this.clean.getCurrentType(html, true); + html = this.clean.onPaste(html, data, true); + } + + html = $.parseHTML(html); + + // end node + var endNode = $(html).last(); + + // delete selected content + var sel = this.selection.get(); + var range = this.selection.range(sel); + range.deleteContents(); + + this.selection.update(sel, range); + + // insert list in list + if (data.lists) + { + var $list = $(html); + if ($list.length !== 0 && ($list[0].tagName === 'UL' || $list[0].tagName === 'OL')) + { + + this.insert.appendLists(block, $list); + return; + } + } + + if (data.blocks && block) + { + if (this.utils.isSelectAll()) + { + this.core.editor().html(html); + this.focus.end(); + } + else + { + var breaked = this.utils.breakBlockTag(); + if (breaked === false) + { + this.insert.placeHtml(html); + } + else + { + var $last = $(html).children().last(); + $last.append(this.marker.get()); + + if (breaked.type === 'start') + { + breaked.$block.before(html); + } + else + { + breaked.$block.after(html); + } + + this.selection.restore(); + this.core.editor().find('p').each(function() + { + if ($.trim(this.innerHTML) === '') + { + $(this).remove(); + } + }); + } + } + } + else + { + if (inline) + { + // remove same tag inside + var $div = $("
    ").html(html); + $div.find(inline.tagName.toLowerCase()).each(function() + { + $(this).contents().unwrap(); + }); + + html = $div.html(); + html = $.parseHTML(html); + + endNode = $(html).last(); + + + } + + if (this.utils.isSelectAll()) + { + var $node = $(this.opts.emptyHtml); + this.core.editor().html('').append($node); + $node.html(html); + this.caret.end($node); + } + else + { + this.insert.placeHtml(html); + } + } + + this.utils.disableSelectAll(); + + if (data.pre) this.clean.cleanPre(); + + this.caret.end(endNode); + this.linkify.format(); + }, + text: function(text) + { + text = text.toString(); + text = $.trim(text); + + var tmp = document.createElement('div'); + tmp.innerHTML = text; + text = tmp.textContent || tmp.innerText; + + if (typeof text === 'undefined') + { + return; + } + + this.placeholder.hide(); + this.core.editor().focus(); + + // blocks + var blocks = this.selection.blocks(); + + // nl to spaces + text = text.replace(/\n/g, ' '); + + // select all + if (this.utils.isSelectAll()) + { + var $node = $(this.opts.emptyHtml); + this.core.editor().html('').append($node); + $node.html(text); + this.caret.end($node); + } + else + { + // insert + var sel = this.selection.get(); + var node = document.createTextNode(text); + + if (sel.getRangeAt && sel.rangeCount) + { + var range = sel.getRangeAt(0); + range.deleteContents(); + range.insertNode(node); + range.setStartAfter(node); + range.collapse(true); + + this.selection.update(sel, range); + } + + // wrap node if selected two or more block tags + if (blocks.length > 1) + { + $(node).wrap('

    '); + this.caret.after(node); + } + } + + this.utils.disableSelectAll(); + this.linkify.format(); + this.clean.normalizeCurrentHeading(); + + }, + raw: function(html) + { + this.placeholder.hide(); + this.core.editor().focus(); + + var sel = this.selection.get(); + + var range = this.selection.range(sel); + range.deleteContents(); + + var el = document.createElement("div"); + el.innerHTML = html; + + var frag = document.createDocumentFragment(), node, lastNode; + while ((node = el.firstChild)) + { + lastNode = frag.appendChild(node); + } + + range.insertNode(frag); + + if (lastNode) + { + range = range.cloneRange(); + range.setStartAfter(lastNode); + range.collapse(true); + sel.removeAllRanges(); + sel.addRange(range); + } + }, + node: function(node, deleteContent) + { + this.placeholder.hide(); + + if (typeof this.start !== 'undefined') + { + this.core.editor().focus(); + } + + node = node[0] || node; + + var block = this.selection.block(); + var gap = this.utils.isBlockTag(node.tagName); + var result = true; + + if (this.utils.isSelectAll()) + { + if (gap) + { + this.core.editor().html(node); + } + else + { + this.core.editor().html($('

    ').html(node)); + } + + this.code.sync(); + } + else if (gap && block) + { + var breaked = this.utils.breakBlockTag(); + if (breaked === false) + { + this.insert.placeNode(node, deleteContent); + } + else + { + if (breaked.type === 'start') + { + breaked.$block.before(node); + } + else + { + breaked.$block.after(node); + } + + this.core.editor().find('p:empty').remove(); + } + } + else + { + result = this.insert.placeNode(node, deleteContent); + } + + this.utils.disableSelectAll(); + + if (result) + { + this.caret.end(node); + } + + return node; + + }, + appendLists: function(block, $list) + { + var $block = $(block); + var last; + var isEmpty = this.utils.isEmpty(block.innerHTML); + + if (isEmpty || this.utils.isEndOfElement(block)) + { + last = $block; + $list.find('li').each(function() + { + last.after(this); + last = $(this); + }); + + if (isEmpty) + { + $block.remove(); + } + } + else if (this.utils.isStartOfElement(block)) + { + $list.find('li').each(function() + { + $block.before(this); + last = $(this); + }); + } + else + { + var endOfNode = this.selection.extractEndOfNode(block); + + $block.after($('

  • ').append(endOfNode)); + $block.append($list); + last = $list; + } + + this.marker.remove(); + + if (last) + { + this.caret.end(last); + } + + this.linkify.format(); + }, + placeHtml: function(html) + { + var marker = document.createElement('span'); + marker.id = 'redactor-insert-marker'; + marker = this.insert.node(marker); + + $(marker).before(html); + this.selection.restore(); + this.caret.after(marker); + $(marker).remove(); + }, + placeNode: function(node, deleteContent) + { + var sel = this.selection.get(); + var range = this.selection.range(sel); + if (range == null) + { + return false; + } + + if (deleteContent !== false) + { + range.deleteContents(); + } + + range.insertNode(node); + range.collapse(false); + + this.selection.update(sel, range); + }, + nodeToPoint: function(e, node) + { + this.placeholder.hide(); + + node = node[0] || node; + + if (this.utils.isEmpty()) + { + node = (this.utils.isBlock(node)) ? node : $('

    ').append(node); + + this.core.editor().html(node); + + return node; + } + + var range; + var x = e.clientX, y = e.clientY; + if (document.caretPositionFromPoint) + { + var pos = document.caretPositionFromPoint(x, y); + var sel = document.getSelection(); + range = sel.getRangeAt(0); + range.setStart(pos.offsetNode, pos.offset); + range.collapse(true); + range.insertNode(node); + } + else if (document.caretRangeFromPoint) + { + range = document.caretRangeFromPoint(x, y); + range.insertNode(node); + } + else if (typeof document.body.createTextRange !== "undefined") + { + range = document.body.createTextRange(); + range.moveToPoint(x, y); + var endRange = range.duplicate(); + endRange.moveToPoint(x, y); + range.setEndPoint("EndToEnd", endRange); + range.select(); + } + + return node; + + }, + + // #backward + nodeToCaretPositionFromPoint: function(e, node) + { + this.insert.nodeToPoint(e, node); + }, + marker: function() + { + this.marker.insert(); + } + }; + }, + + // =keydown + keydown: function() + { + return { + init: function(e) + { + if (this.rtePaste) + { + return; + } + + var key = e.which; + var arrow = (key >= 37 && key <= 40); + + this.keydown.ctrl = e.ctrlKey || e.metaKey; + this.keydown.parent = this.selection.parent(); + this.keydown.current = this.selection.current(); + this.keydown.block = this.selection.block(); + + // detect tags + this.keydown.pre = this.utils.isTag(this.keydown.current, 'pre'); + this.keydown.blockquote = this.utils.isTag(this.keydown.current, 'blockquote'); + this.keydown.figcaption = this.utils.isTag(this.keydown.current, 'figcaption'); + this.keydown.figure = this.utils.isTag(this.keydown.current, 'figure'); + + // callback + var keydownStop = this.core.callback('keydown', e); + if (keydownStop === false) + { + e.preventDefault(); + return false; + } + + // shortcuts setup + this.shortcuts.init(e, key); + + // buffer + this.keydown.checkEvents(arrow, key); + this.keydown.setupBuffer(e, key); + + if (this.utils.isSelectAll() && ( key === this.keyCode.ENTER || key === this.keyCode.BACKSPACE || key === this.keyCode.DELETE)) + { + e.preventDefault(); + + this.code.set(this.opts.emptyHtml); + this.events.changeHandler(); + return; + } + + this.keydown.addArrowsEvent(arrow); + this.keydown.setupSelectAll(e, key); + + // turn off enter key + if (!this.opts.enterKey && key === this.keyCode.ENTER) + { + e.preventDefault(); + + // remove selected + var sel = this.selection.get(); + var range = this.selection.range(sel); + + if (!range.collapsed) + { + range.deleteContents(); + } + + return; + } + + // down + if (this.opts.enterKey && key === this.keyCode.DOWN) + { + this.keydown.onArrowDown(); + } + + // up + if (this.opts.enterKey && key === this.keyCode.UP) + { + this.keydown.onArrowUp(); + } + + + // replace to p before / after the table or into body + if ((this.opts.type === 'textarea' || this.opts.type === 'div') && this.keydown.current && this.keydown.current.nodeType === 3 && $(this.keydown.parent).hasClass('redactor-in')) + { + this.keydown.wrapToParagraph(); + } + + // on Shift+Space or Ctrl+Space + if (!this.keyup.lastShiftKey && key === this.keyCode.SPACE && (e.ctrlKey || e.shiftKey)) + { + e.preventDefault(); + + return this.keydown.onShiftSpace(); + } + + // on Shift+Enter or Ctrl+Enter + if (key === this.keyCode.ENTER && (e.ctrlKey || e.shiftKey)) + { + e.preventDefault(); + + return this.keydown.onShiftEnter(e); + } + + // on enter + if (key === this.keyCode.ENTER && !e.shiftKey && !e.ctrlKey && !e.metaKey) + { + return this.keydown.onEnter(e); + } + + // tab or cmd + [ + if (key === this.keyCode.TAB || e.metaKey && key === 221 || e.metaKey && key === 219) + { + return this.keydown.onTab(e, key); + } + + // firefox bugfix + if (this.detect.isFirefox() && key === this.keyCode.BACKSPACE && this.keydown.block && this.keydown.block.tagName === 'P' && this.utils.isStartOfElement(this.keydown.block)) + { + var $prev = $(this.keydown.block).prev(); + if ($prev.length !== 0) + { + e.preventDefault(); + + $prev.append(this.marker.get()); + $prev.append($(this.keydown.block).html()); + $(this.keydown.block).remove(); + + this.selection.restore(); + + return; + } + } + + // backspace & delete + if (key === this.keyCode.BACKSPACE || key === this.keyCode.DELETE) + { + if (this.observe.image && typeof this.observe.image !== 'undefined' && $('#redactor-image-box').length !== 0) + { + e.preventDefault(); + + var $prev = this.observe.image.closest('figure, p').prev() + this.image.remove(false); + this.observe.image = false; + + if ($prev && $prev.length !== 0) + { + this.caret.end($prev); + } + else + { + this.core.editor().focus(); + } + + return; + } + + this.keydown.onBackspaceAndDeleteBefore(); + } + + if (key === this.keyCode.DELETE) + { + var $next = $(this.keydown.block).next(); + + // delete figure + if (this.utils.isEndOfElement(this.keydown.block) && $next.length !== 0 && $next[0].tagName === 'FIGURE') + { + $next.remove(); + return false; + } + + // append list (safari bug) + var tagLi = (this.keydown.block && this.keydown.block.tagName === 'LI') ? this.keydown.block : false; + if (tagLi) + { + var $list = $(this.keydown.block).parents('ul, ol').last(); + var $nextList = $list.next(); + + if (this.utils.isRedactorParent($list) && this.utils.isEndOfElement($list) && $nextList.length !== 0 + && ($nextList[0].tagName === 'UL' || $nextList[0].tagName === 'OL')) + { + e.preventDefault(); + + $list.append($nextList.contents()); + $nextList.remove(); + + return false; + } + } + + // append pre + if (this.utils.isEndOfElement(this.keydown.block) && $next.length !== 0 && $next[0].tagName === 'PRE') + { + $(this.keydown.block).append($next.text()); + $next.remove(); + return false; + } + + } + + // image delete + if (key === this.keyCode.DELETE && $('#redactor-image-box').length !== 0) + { + this.image.remove(); + } + + // backspace + if (key === this.keyCode.BACKSPACE) + { + if (this.detect.isFirefox()) + { + this.line.removeOnBackspace(e); + } + + // combine list after and before if paragraph is empty + if (this.list.combineAfterAndBefore(this.keydown.block)) + { + e.preventDefault(); + return; + } + + // backspace as outdent + var block = this.selection.block(); + if (block && block.tagName === 'LI' && this.utils.isCollapsed() && this.utils.isStartOfElement()) + { + this.indent.decrease(); + e.preventDefault(); + return; + } + + this.keydown.removeInvisibleSpace(); + this.keydown.removeEmptyListInTable(e); + + } + + if (key === this.keyCode.BACKSPACE || key === this.keyCode.DELETE) + { + this.keydown.onBackspaceAndDeleteAfter(e); + } + + }, + onShiftSpace: function() + { + this.buffer.set(); + this.insert.raw(' '); + + return false; + }, + onShiftEnter: function(e) + { + this.buffer.set(); + + return (this.keydown.pre) ? this.keydown.insertNewLine(e) : this.insert.raw('
    '); + }, + onBackspaceAndDeleteBefore: function() + { + this.utils.saveScroll(); + }, + onBackspaceAndDeleteAfter: function(e) + { + // remove style tag + setTimeout($.proxy(function() + { + this.code.syncFire = false; + this.keydown.removeEmptyLists(); + + var filter = ''; + if (this.opts.keepStyleAttr.length !== 0) + { + filter = ',' + this.opts.keepStyleAttr.join(','); + } + + var $styleTags = this.core.editor().find('*[style]'); + $styleTags.not('img, figure, iframe, #redactor-image-box, #redactor-image-editter, [data-redactor-style-cache], [data-redactor-span]' + filter).removeAttr('style'); + + this.keydown.formatEmpty(e); + this.code.syncFire = true; + + }, this), 1); + }, + onEnter: function(e) + { + var stop = this.core.callback('enter', e); + if (stop === false) + { + e.preventDefault(); + return false; + } + + // blockquote exit + if (this.keydown.blockquote && this.keydown.exitFromBlockquote(e) === true) + { + return false; + } + + // pre + if (this.keydown.pre) + { + return this.keydown.insertNewLine(e); + } + // blockquote & figcaption + else if (this.keydown.blockquote || this.keydown.figcaption) + { + return this.keydown.insertBreakLine(e); + } + // figure + else if (this.keydown.figure) + { + setTimeout($.proxy(function() + { + this.keydown.replaceToParagraph('FIGURE'); + + }, this), 1); + } + // paragraphs + else if (this.keydown.block) + { + setTimeout($.proxy(function() + { + this.keydown.replaceToParagraph('DIV'); + + }, this), 1); + + // empty list exit + if (this.keydown.block.tagName === 'LI') + { + var current = this.selection.current(); + var $parent = $(current).closest('li', this.$editor[0]); + var $list = $parent.parents('ul,ol', this.$editor[0]).last(); + + if ($parent.length !== 0 && this.utils.isEmpty($parent.html()) && $list.next().length === 0 && this.utils.isEmpty($list.find("li").last().html())) + { + $list.find("li").last().remove(); + + var node = $(this.opts.emptyHtml); + $list.after(node); + this.caret.start(node); + + return false; + } + } + + } + // outside + else if (!this.keydown.block) + { + return this.keydown.insertParagraph(e); + } + + // firefox enter into inline element + if (this.detect.isFirefox() && this.utils.isInline(this.keydown.parent)) + { + this.keydown.insertBreakLine(e); + return; + } + + // remove inline tags in new-empty paragraph + if (!this.opts.keepInlineOnEnter) + { + setTimeout($.proxy(function() + { + var inline = this.selection.inline(); + if (inline && this.utils.isEmpty(inline.innerHTML)) + { + var parent = this.selection.block(); + $(inline).remove(); + //this.caret.start(parent); + + var range = document.createRange(); + range.setStart(parent, 0); + + var textNode = document.createTextNode('\u200B'); + + range.insertNode(textNode); + range.setStartAfter(textNode); + range.collapse(true); + + var sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + } + + + }, this), 1); + } + + // remove last br + setTimeout($.proxy(function() + { + var block = this.selection.block(); + var nodes = block.childNodes; + var last = nodes[nodes.length-1]; + if (last && last.nodeType !== 3 && last.tagName === 'BR') + { + $(last).remove(); + } + + }, this), 1); + }, + checkEvents: function(arrow, key) + { + if (!arrow && (this.core.getEvent() === 'click' || this.core.getEvent() === 'arrow')) + { + this.core.addEvent(false); + + if (this.keydown.checkKeyEvents(key)) + { + this.buffer.set(); + } + } + }, + checkKeyEvents: function(key) + { + var k = this.keyCode; + var keys = [k.BACKSPACE, k.DELETE, k.ENTER, k.ESC, k.TAB, k.CTRL, k.META, k.ALT, k.SHIFT]; + + return ($.inArray(key, keys) === -1) ? true : false; + + }, + addArrowsEvent: function(arrow) + { + if (!arrow) + { + return; + } + + if ((this.core.getEvent() === 'click' || this.core.getEvent() === 'arrow')) + { + this.core.addEvent(false); + return; + } + + this.core.addEvent('arrow'); + }, + setupBuffer: function(e, key) + { + if (this.keydown.ctrl && key === 90 && !e.shiftKey && !e.altKey && this.sBuffer.length) // z key + { + e.preventDefault(); + this.buffer.undo(); + return; + } + // redo + else if (this.keydown.ctrl && key === 90 && e.shiftKey && !e.altKey && this.sRebuffer.length !== 0) + { + e.preventDefault(); + this.buffer.redo(); + return; + } + else if (!this.keydown.ctrl) + { + if (key === this.keyCode.SPACE || key === this.keyCode.BACKSPACE || key === this.keyCode.DELETE || (key === this.keyCode.ENTER && !e.ctrlKey && !e.shiftKey)) + { + this.buffer.set(); + } + } + }, + exitFromBlockquote: function(e) + { + if (!this.utils.isEndOfElement(this.keydown.blockquote)) + { + return; + } + + var tmp = this.clean.removeSpacesHard($(this.keydown.blockquote).html()); + if (tmp.search(/(){1}$/i) !== -1) + { + e.preventDefault(); + + var $last = $(this.keydown.blockquote).children().last(); + + $last.filter('br').remove(); + $(this.keydown.blockquote).children().last().filter('span').remove(); + + var node = $(this.opts.emptyHtml); + $(this.keydown.blockquote).after(node); + this.caret.start(node); + + return true; + + } + + return; + }, + onArrowDown: function() + { + var tags = [this.keydown.blockquote, this.keydown.pre, this.keydown.figcaption]; + + for (var i = 0; i < tags.length; i++) + { + if (tags[i]) + { + this.keydown.insertAfterLastElement(tags[i]); + return false; + } + } + }, + onArrowUp: function() + { + var tags = [this.keydown.blockquote, this.keydown.pre, this.keydown.figcaption]; + + for (var i = 0; i < tags.length; i++) + { + if (tags[i]) + { + this.keydown.insertBeforeFirstElement(tags[i]); + return false; + } + } + }, + insertAfterLastElement: function(element) + { + if (!this.utils.isEndOfElement(element)) + { + return; + } + + var last = this.core.editor().contents().last(); + var $next = (element.tagName === 'FIGCAPTION') ? $(this.keydown.block).parent().next() : $(this.keydown.block).next(); + + if ($next.length !== 0) + { + return; + } + else if (last.length === 0 && last[0] !== element) + { + this.caret.start(last); + return; + } + else + { + var node = $(this.opts.emptyHtml); + + if (element.tagName === 'FIGCAPTION') + { + $(element).parent().after(node); + } + else + { + $(element).after(node); + } + + this.caret.start(node); + } + + }, + insertBeforeFirstElement: function(element) + { + if (!this.utils.isStartOfElement()) + { + return; + } + + if (this.core.editor().contents().length > 1 && this.core.editor().contents().first()[0] !== element) + { + return; + } + + var node = $(this.opts.emptyHtml); + $(element).before(node); + this.caret.start(node); + + }, + onTab: function(e, key) + { + if (!this.opts.tabKey) + { + return true; + } + + var isList = (this.keydown.block && this.keydown.block.tagName === 'LI') + if (this.utils.isEmpty(this.code.get()) || (!isList && !this.keydown.pre && this.opts.tabAsSpaces === false)) + { + return true; + } + + e.preventDefault(); + this.buffer.set(); + + var isListStart = (isList && this.utils.isStartOfElement(this.keydown.block)); + var node; + + if (this.keydown.pre && !e.shiftKey) + { + node = (this.opts.preSpaces) ? document.createTextNode(Array(this.opts.preSpaces + 1).join('\u00a0')) : document.createTextNode('\t'); + this.insert.node(node); + } + else if (this.opts.tabAsSpaces !== false && !isListStart) + { + node = document.createTextNode(Array(this.opts.tabAsSpaces + 1).join('\u00a0')); + this.insert.node(node); + } + else + { + if (e.metaKey && key === 219) + { + this.indent.decrease(); + } + else if (e.metaKey && key === 221) + { + this.indent.increase(); + } + else if (!e.shiftKey) + { + this.indent.increase(); + } + else + { + this.indent.decrease(); + } + } + + return false; + }, + setupSelectAll: function(e, key) + { + if (this.keydown.ctrl && key === 65) + { + this.utils.enableSelectAll(); + } + else if (key !== this.keyCode.LEFT_WIN && !this.keydown.ctrl) + { + this.utils.disableSelectAll(); + } + }, + insertNewLine: function(e) + { + e.preventDefault(); + + var node = document.createTextNode('\n'); + + var sel = this.selection.get(); + var range = this.selection.range(sel); + + range.deleteContents(); + range.insertNode(node); + + this.caret.after(node); + + return false; + }, + insertParagraph: function(e) + { + e.preventDefault(); + + var p = document.createElement('p'); + //p.innerHTML = this.opts.invisibleSpace; + p.innerHTML = '
    '; + + var sel = this.selection.get(); + var range = this.selection.range(sel); + + range.deleteContents(); + range.insertNode(p); + + this.caret.start(p); + + return false; + }, + insertBreakLine: function(e) + { + return this.keydown.insertBreakLineProcessing(e); + }, + insertDblBreakLine: function(e) + { + return this.keydown.insertBreakLineProcessing(e, true); + }, + insertBreakLineProcessing: function(e, dbl) + { + e.stopPropagation(); + + var br1 = document.createElement('br'); + this.insert.node(br1); + + if (dbl === true) + { + var br2 = document.createElement('br'); + this.insert.node(br2); + this.caret.after(br2); + } + else + { + this.caret.after(br1); + } + + return false; + + }, + wrapToParagraph: function() + { + var $current = $(this.keydown.current); + var node = $('

    ').append($current.clone()); + $current.replaceWith(node); + + var next = $(node).next(); + if (typeof(next[0]) !== 'undefined' && next[0].tagName === 'BR') + { + next.remove(); + } + + this.caret.end(node); + + }, + replaceToParagraph: function(tag) + { + var blockElem = this.selection.block(); + var $prev = $(blockElem).prev(); + + var blockHtml = blockElem.innerHTML.replace(//gi, ''); + if (blockElem.tagName === tag && this.utils.isEmpty(blockHtml) && !$(blockElem).hasClass('redactor-in')) + { + var p = document.createElement('p'); + $(blockElem).replaceWith(p); + + this.keydown.setCaretToParagraph(p); + + return false; + } + else if (blockElem.tagName === 'P') + { + $(blockElem).removeAttr('class').removeAttr('style'); + + // fix #227 + if (this.detect.isIe() && this.utils.isEmpty(blockHtml) && this.utils.isInline(this.keydown.parent)) + { + $(blockElem).on('input', $.proxy(function() + { + var parent = this.selection.parent(); + if (this.utils.isInline(parent)) + { + var html = $(parent).html(); + $(blockElem).html(html); + this.caret.end(blockElem); + } + + $(blockElem).off('keyup'); + + }, this)); + } + + return false; + } + else if ($prev.hasClass(this.opts.videoContainerClass)) + { + $prev.removeAttr('class'); + + var p = document.createElement('p'); + $prev.replaceWith(p); + + this.keydown.setCaretToParagraph(p); + + return false; + } + }, + setCaretToParagraph: function(p) + { + var range = document.createRange(); + range.setStart(p, 0); + + var textNode = document.createTextNode('\u200B'); + + range.insertNode(textNode); + range.setStartAfter(textNode); + range.collapse(true); + + var sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + }, + removeInvisibleSpace: function() + { + var $current = $(this.keydown.current); + if ($current.text().search(/^\u200B$/g) === 0) + { + $current.remove(); + } + }, + removeEmptyListInTable: function(e) + { + var $current = $(this.keydown.current); + var $parent = $(this.keydown.parent); + var td = $current.closest('td', this.$editor[0]); + + if (td.length !== 0 && $current.closest('li', this.$editor[0]) && $parent.children('li').length === 1) + { + if (!this.utils.isEmpty($current.text())) + { + return; + } + + e.preventDefault(); + + $current.remove(); + $parent.remove(); + + this.caret.start(td); + } + }, + removeEmptyLists: function() + { + var removeIt = function() + { + var html = $.trim(this.innerHTML).replace(/\/t\/n/g, ''); + if (html === '') + { + $(this).remove(); + } + }; + + this.core.editor().find('li').each(removeIt); + this.core.editor().find('ul, ol').each(removeIt); + }, + formatEmpty: function(e) + { + var html = $.trim(this.core.editor().html()); + + if (!this.utils.isEmpty(html)) + { + return; + } + + e.preventDefault(); + + if (this.opts.type === 'inline' || this.opts.type === 'pre') + { + this.core.editor().html(this.marker.html()); + this.selection.restore(); + } + else + { + this.core.editor().html(this.opts.emptyHtml); + this.focus.start(); + } + + return false; + + } + }; + }, + + // =keyup + keyup: function() + { + return { + init: function(e) + { + if (this.rtePaste) + { + return; + } + + var key = e.which; + this.keyup.block = this.selection.block(); + this.keyup.current = this.selection.current(); + this.keyup.parent = this.selection.parent(); + this.keyup.lastShiftKey = e.shiftKey; + + + // callback + var stop = this.core.callback('keyup', e); + if (stop === false) + { + e.preventDefault(); + return false; + } + + // replace a prev figure to paragraph if caret is before image + if (key === this.keyCode.ENTER) + { + if (this.keyup.block && this.keyup.block.tagName === 'FIGURE') + { + var $prev = $(this.keyup.block).prev(); + if ($prev.length !== 0 && $prev[0].tagName === 'FIGURE') + { + var $newTag = this.utils.replaceToTag($prev, 'p'); + this.caret.start($newTag); + return; + } + } + } + + // replace figure to paragraph + if (key === this.keyCode.BACKSPACE || key === this.keyCode.DELETE) + { + if (this.utils.isSelectAll()) + { + this.focus.start(); + this.toolbar.setUnfixed(); + + return; + } + + // if caret before figure - delete image + if (this.keyup.block && this.keydown.block && this.keyup.block.tagName === 'FIGURE' && this.utils.isStartOfElement(this.keydown.block)) + { + e.preventDefault(); + + this.selection.save(); + $(this.keyup.block).find('figcaption').remove(); + $(this.keyup.block).find('img').first().remove(); + this.utils.replaceToTag(this.keyup.block, 'p'); + + var $marker = this.marker.find(); + $('html, body').animate({ scrollTop: $marker.position().top + 20 }, 500); + + this.selection.restore(); + return; + } + + + // if paragraph does contain only image replace to figure + if (this.keyup.block && this.keyup.block.tagName === 'P') + { + var isContainImage = $(this.keyup.block).find('img').length; + var text = $(this.keyup.block).text().replace(/\u200B/g, ''); + if (text === '' && isContainImage !== 0) + { + this.utils.replaceToTag(this.keyup.block, 'figure'); + } + } + + // if figure does not contain image - replace to paragraph + if (this.keyup.block && this.keyup.block.tagName === 'FIGURE' && $(this.keyup.block).find('img').length === 0) + { + this.selection.save(); + this.utils.replaceToTag(this.keyup.block, 'p'); + this.selection.restore(); + } + } + + // linkify + if (this.linkify.isKey(key)) + { + this.selection.save(); + this.linkify.format(); + this.selection.restore(); + } + + } + + }; + }, + + // =lang + lang: function() + { + return { + load: function() + { + this.opts.curLang = this.opts.langs[this.opts.lang]; + }, + get: function(name) + { + return (typeof this.opts.curLang[name] !== 'undefined') ? this.opts.curLang[name] : ''; + } + }; + }, + + // =line + line: function() + { + return { + insert: function() + { + this.buffer.set(); + + // insert + this.insert.html(this.line.getLineHtml()); + + // find + var $hr = this.core.editor().find('#redactor-hr-tmp-id'); + $hr.removeAttr('id'); + + this.core.callback('insertedLine', $hr); + + return $hr; + }, + getLineHtml: function() + { + var html = '


    '; + if (!this.detect.isFirefox() && this.utils.isEmpty()) + { + html += '

    ' + this.opts.emptyHtml + '

    '; + } + + return html; + }, + // ff only + removeOnBackspace: function(e) + { + if (!this.utils.isCollapsed()) + { + return; + } + + var $block = $(this.selection.block()); + if ($block.length === 0 || !this.utils.isStartOfElement($block)) + { + return; + } + + // if hr is previous element + var $prev = $block.prev(); + if ($prev && $prev.length !== 0 && $prev[0].tagName === 'HR') + { + e.preventDefault(); + $prev.remove(); + } + } + }; + }, + + // =link + link: function() + { + return { + + // public + get: function() + { + return $(this.selection.inlines('a')); + }, + is: function() + { + var nodes = this.selection.nodes() ; + var $link = $(this.selection.current()).closest('a', this.core.editor()[0]); + + return ($link.length === 0 || nodes.length > 1) ? false : $link; + }, + unlink: function(e) + { + // if call from clickable element + if (typeof e !== 'undefined' && e.preventDefault) + { + e.preventDefault(); + } + + // buffer + this.buffer.set(); + + var links = this.selection.inlines('a'); + if (links.length === 0) + { + return; + } + + var $links = this.link.replaceLinksToText(links); + + this.observe.closeAllTooltip(); + this.core.callback('deletedLink', $links); + + }, + insert: function(link, cleaned) + { + var $el = this.link.is(); + + if (cleaned !== true) + { + link = this.link.buildLinkFromObject($el, link); + if (link === false) + { + return false; + } + } + + // buffer + this.buffer.set(); + + // callback + link = this.core.callback('beforeInsertingLink', link); + + if ($el === false) + { + // insert + $el = $(''); + $el = this.link.update($el, link); + $el = $(this.insert.node($el)); + + var $parent = $el.parent(); + if (this.utils.isRedactorParent($parent) === false) + { + $el.wrap('

    '); + } + + // remove unlink wrapper + if ($parent.hasClass('redactor-unlink')) + { + $parent.replaceWith(function(){ + return $(this).contents(); + }); + } + + this.caret.after($el); + this.core.callback('insertedLink', $el); + } + else + { + // update + $el = this.link.update($el, link); + this.caret.after($el); + } + + return $el; + + }, + update: function($el, link) + { + $el.text(link.text); + $el.attr('href', link.url); + + this.link.target($el, link.target); + + return $el; + + }, + target: function($el, target) + { + return (target) ? $el.attr('target', '_blank') : $el.removeAttr('target'); + }, + show: function(e) + { + // if call from clickable element + if (typeof e !== 'undefined' && e.preventDefault) + { + e.preventDefault(); + } + + // close tooltip + this.observe.closeAllTooltip(); + + // is link + var $el = this.link.is(); + + // build modal + this.link.buildModal($el); + + // build link + var link = this.link.buildLinkFromElement($el); + + // if link cut & paste inside editor browser added self host to a link + link.url = this.link.removeSelfHostFromUrl(link.url); + + // new tab target + if (this.opts.linkNewTab && !$el) + { + link.target = true; + } + + // set modal values + this.link.setModalValues(link); + + // show modal + this.modal.show(); + + // focus + if (this.detect.isDesktop()) + { + $('#redactor-link-url').focus(); + } + }, + + // private + setModalValues: function(link) + { + $('#redactor-link-blank').prop('checked', link.target); + $('#redactor-link-url').val(link.url); + $('#redactor-link-url-text').val(link.text); + }, + buildModal: function($el) + { + this.modal.load('link', this.lang.get(($el === false) ? 'link-insert' : 'link-edit'), 600); + + // button insert + var $btn = this.modal.getActionButton(); + $btn.text(this.lang.get(($el === false) ? 'insert' : 'save')).on('click', $.proxy(this.link.callback, this)); + + }, + callback: function() + { + // build link + var link = this.link.buildLinkFromModal(); + if (link === false) + { + return false; + } + + // close + this.modal.close(); + + // insert or update + this.link.insert(link, true); + }, + cleanUrl: function(url) + { + return (typeof url === 'undefined') ? '' : $.trim(url.replace(/[^\W\w\D\d+&\'@#/%?=~_|!:,.;\(\)]/gi, '')); + }, + cleanText: function(text) + { + return (typeof text === 'undefined') ? '' : $.trim(text.replace(/(<([^>]+)>)/gi, '')); + }, + getText: function(link) + { + return (link.text === '' && link.url !== '') ? this.link.truncateUrl(link.url.replace(/<|>/g, '')) : link.text; + }, + isUrl: function(url) + { + var pattern = '((xn--)?[\\W\\w\\D\\d]+(-[\\W\\w\\D\\d]+)*\\.)+[\\W\\w]{2,}'; + + var re1 = new RegExp('^(http|ftp|https)://' + pattern, 'i'); + var re2 = new RegExp('^' + pattern, 'i'); + var re3 = new RegExp('\.(html|php)$', 'i'); + var re4 = new RegExp('^/', 'i'); + var re5 = new RegExp('^tel:(.*?)', 'i'); + + // add protocol + if (url.search(re1) === -1 && url.search(re2) !== -1 && url.search(re3) === -1 && url.substring(0, 1) !== '/') + { + url = 'http://' + url; + } + + if (url.search(re1) !== -1 || url.search(re3) !== -1 || url.search(re4) !== -1 || url.search(re5) !== -1) + { + return url; + } + + return false; + }, + isMailto: function(url) + { + return (url.search('@') !== -1 && /(http|ftp|https):\/\//i.test(url) === false); + }, + isEmpty: function(link) + { + return (link.url === '' || (link.text === '' && link.url === '')); + }, + truncateUrl: function(url) + { + return (url.length > this.opts.linkSize) ? url.substring(0, this.opts.linkSize) + '...' : url; + }, + parse: function(link) + { + // mailto + if (this.link.isMailto(link.url)) + { + link.url = 'mailto:' + link.url.replace('mailto:', ''); + } + // url + else if (link.url.search('#') !== 0) + { + if (this.opts.linkValidation) + { + link.url = this.link.isUrl(link.url); + } + } + + // empty url or text or isn't url + return (this.link.isEmpty(link) || link.url === false) ? false : link; + + }, + buildLinkFromModal: function() + { + var link = {}; + + // url + link.url = this.link.cleanUrl($('#redactor-link-url').val()); + + // text + link.text = this.link.cleanText($('#redactor-link-url-text').val()); + link.text = this.link.getText(link); + + // target + link.target = ($('#redactor-link-blank').prop('checked')) ? true : false; + + // parse + return this.link.parse(link); + + }, + buildLinkFromObject: function($el, link) + { + // url + link.url = this.link.cleanUrl(link.url); + + // text + link.text = (typeof link.text === 'undefined' && this.selection.is()) ? this.selection.text() : this.link.cleanText(link.text); + link.text = this.link.getText(link); + + // target + link.target = ($el === false) ? link.target : this.link.buildTarget($el); + + // parse + return this.link.parse(link); + + }, + buildLinkFromElement: function($el) + { + var link = { + url: '', + text: (this.selection.is()) ? this.selection.text() : '', + target: false + }; + + if ($el !== false) + { + link.url = $el.attr('href'); + link.text = $el.text(); + link.target = this.link.buildTarget($el); + } + + return link; + }, + buildTarget: function($el) + { + return (typeof $el.attr('target') !== 'undefined' && $el.attr('target') === '_blank') ? true : false; + }, + removeSelfHostFromUrl: function(url) + { + var href = self.location.href.replace('#', '').replace(/\/$/i, ''); + return url.replace(/^\/\#/, '#').replace(href, '').replace('mailto:', ''); + }, + replaceLinksToText: function(links) + { + var $first; + var $links = $.each(links, function(i,s) + { + var $el = $(s); + var $unlinked = $('').append($el.contents()); + $el.replaceWith($unlinked); + + if (i === 0) + { + $first = $unlinked; + } + + return $el; + }); + + // set caret after unlinked node + if (links.length === 1 && this.selection.isCollapsed()) + { + this.caret.after($first); + } + + return $links; + } + }; + }, + + // =linkify + linkify: function() + { + return { + isKey: function(key) + { + return key === this.keyCode.ENTER || key === this.keyCode.SPACE; + }, + isLink: function(node) + { + return (node.nodeValue.match(this.opts.regexps.linkyoutube) || node.nodeValue.match(this.opts.regexps.linkvimeo) || node.nodeValue.match(this.opts.regexps.linkimage) || node.nodeValue.match(this.opts.regexps.url)); + }, + isFiltered: function(i, node) + { + return node.nodeType === 3 && $.trim(node.nodeValue) !== "" && !$(node).parent().is("pre") && (this.linkify.isLink(node)); + }, + handler: function(i, node) + { + var $el = $(node); + var text = $el.text(); + var html = text; + + if (html.match(this.opts.regexps.linkyoutube) || html.match(this.opts.regexps.linkvimeo)) + { + html = this.linkify.convertVideoLinks(html); + } + else if (html.match(this.opts.regexps.linkimage)) + { + html = this.linkify.convertImages(html); + } + else + { + html = this.linkify.convertLinks(html); + } + + $el.before(text.replace(text, html)).remove(); + }, + format: function() + { + if (!this.opts.linkify || this.utils.isCurrentOrParent('pre')) + { + return; + } + + this.core.editor().find(":not(iframe,img,a,pre,code,.redactor-unlink)").addBack().contents().filter($.proxy(this.linkify.isFiltered, this)).each($.proxy(this.linkify.handler, this)); + + // collect + var $el; + var $objects = this.core.editor().find('.redactor-linkify-object').each($.proxy(function(i,s) + { + $el = $(s); + $el.removeClass('redactor-linkify-object'); + if ($el.attr('class') === '') + { + $el.removeAttr('class'); + } + + if (s.tagName === 'DIV') // video container + { + this.linkify.breakBlockTag($el, 'video'); + } + else if (s.tagName === 'IMG') // image + { + this.linkify.breakBlockTag($el, 'image'); + } + else if (s.tagName === 'A') + { + this.core.callback('insertedLink', $el); + } + + return $el; + + }, this)); + + // callback + setTimeout($.proxy(function() + { + this.code.sync(); + this.core.callback('linkify', $objects); + + }, this), 100); + + }, + breakBlockTag: function($el, type) + { + var breaked = this.utils.breakBlockTag(); + if (breaked === false) + { + return; + } + + var $newBlock = $el; + if (type === 'image') + { + $newBlock = $('

    ').append($el); + } + + if (breaked.type === 'start') + { + breaked.$block.before($newBlock); + } + else + { + breaked.$block.after($newBlock); + } + + + if (type === 'image') + { + this.caret.after($newBlock); + } + + }, + convertVideoLinks: function(html) + { + var iframeStart = '
    '; + + if (html.match(this.opts.regexps.linkyoutube)) + { + html = html.replace(this.opts.regexps.linkyoutube, iframeStart + '//www.youtube.com/embed/$1' + iframeEnd); + } + + if (html.match(this.opts.regexps.linkvimeo)) + { + html = html.replace(this.opts.regexps.linkvimeo, iframeStart + '//player.vimeo.com/video/$2' + iframeEnd); + } + + return html; + }, + convertImages: function(html) + { + var matches = html.match(this.opts.regexps.linkimage); + if (!matches) + { + return html; + } + + return html.replace(html, ''); + }, + convertLinks: function(html) + { + var matches = html.match(this.opts.regexps.url); + if (!matches) + { + return html; + } + + matches = $.grep(matches, function(v, k) { return $.inArray(v, matches) === k; }); + + var length = matches.length; + + for (var i = 0; i < length; i++) + { + var href = matches[i], text = href; + var linkProtocol = (href.match(/(https?|ftp):\/\//i) !== null) ? '' : 'http://'; + + if (text.length > this.opts.linkSize) + { + text = text.substring(0, this.opts.linkSize) + '...'; + } + + if (text.search('%') === -1) + { + text = decodeURIComponent(text); + } + + var regexB = "\\b"; + + if ($.inArray(href.slice(-1), ["/", "&", "="]) !== -1) + { + regexB = ""; + } + + // escaping url + var regexp = new RegExp('(' + href.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") + regexB + ')', 'g'); + + // target + var target = ''; + if (this.opts.pasteLinkTarget !== false) + { + target = ' target="' + this.opts.pasteLinkTarget + '"'; + } + + html = html.replace(regexp, '
    ' + $.trim(text) + ''); + } + + return html; + } + }; + }, + + // =list + list: function() + { + return { + toggle: function(cmd) + { + if (this.utils.inBlocks(['table', 'td', 'th', 'tr'])) + { + return; + } + + var tag = (cmd === 'orderedlist' || cmd === 'ol') ? 'OL' : 'UL'; + cmd = (tag === 'OL') ? 'orderedlist' : 'unorderedlist' + + var $list = $(this.selection.current()).parentsUntil('.redactor-in', 'ul, ol').first(); + + this.placeholder.hide(); + this.buffer.set(); + + + if ($list.length !== 0 && $list[0].tagName === tag && this.utils.isRedactorParent($list)) + { + this.selection.save(); + + // remove list + $list.find('ul, ol').each(function() + { + var parent = $(this).closest('li'); + $(this).find('li').each(function() + { + $(parent).after(this); + }); + }); + + $list.find('ul, ol').remove(); + $list.find('li').each(function() + { + return $(this).replaceWith(function() + { + return $('

    ').append($(this).contents()); + }); + }); + + + $list.replaceWith(function() + { + return $(this).contents(); + }); + + this.selection.restore(); + return; + } + + + this.selection.save(); + + if ($list.length !== 0 && $list[0].tagName !== tag) + { + $list.each($.proxy(function(i,s) + { + this.utils.replaceToTag(s, tag); + + }, this)); + } + else + { + document.execCommand('insert' + cmd); + } + + this.selection.restore(); + + var $insertedList = this.list.get(); + if (!$insertedList) + { + if (!this.selection.block()) + { + document.execCommand('formatblock', false, 'p'); + } + + return; + } + + // clear span + $insertedList.find('span').replaceWith(function() + { + return $(this).contents(); + }); + + // remove style + $insertedList.find(this.opts.inlineTags.join(',')).each(function() + { + $(this).removeAttr('style'); + }); + + // remove block-element list wrapper + var $listParent = $insertedList.parent(); + if (this.utils.isRedactorParent($listParent) && $listParent[0].tagName !== 'LI' && this.utils.isBlock($listParent)) + { + this.selection.save(); + + $listParent.replaceWith($listParent.contents()); + + this.selection.restore(); + } + + }, + get: function() + { + var current = this.selection.current(); + var $list = $(current).closest('ul, ol', this.core.editor()[0]); + + return ($list.length === 0) ? false : $list; + }, + combineAfterAndBefore: function(block) + { + var $prev = $(block).prev(); + var $next = $(block).next(); + var isEmptyBlock = (block && block.tagName === 'P' && (block.innerHTML === '
    ' || block.innerHTML === '')); + var isBlockWrapped = ($prev.closest('ol, ul', this.core.editor()[0]).length === 1 && $next.closest('ol, ul', this.core.editor()[0]).length === 1); + + if (isEmptyBlock && isBlockWrapped) + { + $prev.children('li').last().append(this.marker.get()); + $prev.append($next.contents()); + this.selection.restore(); + + return true; + } + + return false; + + } + }; + }, + + // =marker + marker: function() + { + return { + + // public + get: function(num) + { + num = (typeof num === 'undefined') ? 1 : num; + + var marker = document.createElement('span'); + + marker.id = 'selection-marker-' + num; + marker.className = 'redactor-selection-marker'; + marker.innerHTML = this.opts.invisibleSpace; + + return marker; + }, + html: function(num) + { + return this.utils.getOuterHtml(this.marker.get(num)); + }, + find: function(num) + { + num = (typeof num === 'undefined') ? 1 : num; + + return this.core.editor().find('span#selection-marker-' + num); + }, + insert: function() + { + var sel = this.selection.get(); + var range = this.selection.range(sel); + + this.marker.insertNode(range, this.marker.get(1), true); + if (range && range.collapsed === false) + { + this.marker.insertNode(range, this.marker.get(2), false); + } + + }, + remove: function() + { + this.core.editor().find('.redactor-selection-marker').each(this.marker.iterateRemove); + }, + + // private + insertNode: function(range, node, collapse) + { + var parent = this.selection.parent(); + if (range === null || $(parent).closest('.redactor-in').length === 0) + { + return; + } + + range = range.cloneRange(); + + try { + range.collapse(collapse); + range.insertNode(node); + } + catch (e) + { + this.focus.start(); + } + }, + iterateRemove: function(i, el) + { + var $el = $(el); + var text = $el.text().replace(/\u200B/g, ''); + var parent = $el.parent()[0]; + + if (text === '') $el.remove(); + else $el.replaceWith(function() { return $(this).contents(); }); + + // if (parent && parent.normalize) parent.normalize(); + } + }; + }, + + // =modal + modal: function() + { + return { + callbacks: {}, + templates: function() + { + this.opts.modal = { + 'image-edit': String() + + '

    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + + '' + + '
    ' + + '
    ' + + '' + + '' + + '' + + '
    ' + + '
    ' + + '
    ', + + 'image': String() + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ', + + 'file': String() + + '
    ' + + '
    ' + + '' + + '

    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ', + + 'link': String() + + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + + '' + + '
    ' + + '
    ' + + '' + + '' + + '
    ' + + '
    ' + }; + + $.extend(this.opts, this.opts.modal); + + }, + addCallback: function(name, callback) + { + this.modal.callbacks[name] = callback; + }, + addTemplate: function(name, template) + { + this.opts.modal[name] = template; + }, + getTemplate: function(name) + { + return this.opts.modal[name]; + }, + getModal: function() + { + return this.$modalBody; + }, + getActionButton: function() + { + return this.$modalBody.find('#redactor-modal-button-action'); + }, + getCancelButton: function() + { + return this.$modalBody.find('#redactor-modal-button-cancel'); + }, + getDeleteButton: function() + { + return this.$modalBody.find('#redactor-modal-button-delete'); + }, + load: function(templateName, title, width) + { + if (typeof this.$modalBox !== 'undefined' && this.$modalBox.hasClass('open')) + { + return; + } + + this.modal.templateName = templateName; + this.modal.width = width; + + this.modal.build(); + this.modal.enableEvents(); + this.modal.setTitle(title); + this.modal.setDraggable(); + this.modal.setContent(); + + // callbacks + if (typeof this.modal.callbacks[templateName] !== 'undefined') + { + this.modal.callbacks[templateName].call(this); + } + + }, + show: function() + { + + if (!this.detect.isDesktop()) + { + document.activeElement.blur(); + } + + this.selection.save(); + this.modal.buildTabber(); + + if (this.detect.isMobile()) + { + this.modal.width = '96%'; + } + + // resize + setTimeout($.proxy(this.modal.buildWidth, this), 0); + $(window).on('resize.redactor-modal', $.proxy(this.modal.buildWidth, this)); + + + this.$modalOverlay.redactorAnimation('fadeIn', { + duration: 0.25 + }); + + this.$modalBox.addClass('open').show(); + this.$modal.redactorAnimation('fadeIn', { + timing: 'cubic-bezier(0.175, 0.885, 0.320, 1.105)' + }, + $.proxy(function() + { + + this.utils.saveScroll(); + this.utils.disableBodyScroll(); + + // modal shown callback + this.core.callback('modalOpened', this.modal.templateName, this.$modal); + + // fix bootstrap modal focus + $(document).off('focusin.modal'); + + // enter + var $elements = this.$modal.find('input[type=text],input[type=url],input[type=email]'); + $elements.on('keydown.redactor-modal', $.proxy(this.modal.setEnter, this)); + + }, this) + ); + + }, + buildWidth: function() + { + var windowHeight = $(window).height(); + var windowWidth = $(window).width(); + + var number = (typeof this.modal.width === 'number'); + + if (!number && this.modal.width.match(/%$/)) + { + this.$modal.css({ 'width': this.modal.width, 'margin-bottom': '16px' }); + } + else if (parseInt(this.modal.width) > windowWidth) + { + this.$modal.css({ 'width': '96%', 'margin-bottom': '2%' }); + } + else + { + if (number) + { + this.modal.width += 'px'; + } + + this.$modal.css({ 'width': this.modal.width, 'margin-bottom': '16px' }); + } + + // margin top + var height = this.$modal.outerHeight(); + var top = (windowHeight/2 - height/2) + 'px'; + + if (this.detect.isMobile()) + { + top = '2%'; + } + else if (height > windowHeight) + { + top = '16px'; + + } + + this.$modal.css('margin-top', top); + }, + buildTabber: function() + { + this.modal.tabs = this.$modal.find('.redactor-modal-tab'); + + if (this.modal.tabs.length < 2) + { + return; + } + + this.modal.$tabsBox = $('
    '); + $.each(this.modal.tabs, $.proxy(function(i,s) + { + var a = $('').text($(s).attr('data-title')); + + a.on('click', $.proxy(this.modal.showTab, this)); + + if (i === 0) + { + a.addClass('active'); + } + + this.modal.$tabsBox.append(a); + + }, this)); + + this.$modalBody.prepend(this.modal.$tabsBox); + + }, + showTab: function(e) + { + e.preventDefault(); + + var $el = $(e.target); + var index = $el.attr('rel'); + + this.modal.tabs.hide(); + this.modal.tabs.eq(index).show(); + + $('#redactor-modal-tabber').find('a').removeClass('active'); + $el.addClass('active'); + + return false; + + }, + setTitle: function(title) + { + this.$modalHeader.html(title); + }, + setContent: function() + { + this.$modalBody.html(this.modal.getTemplate(this.modal.templateName)); + + this.modal.getCancelButton().on('mousedown', $.proxy(this.modal.close, this)); + }, + setDraggable: function() + { + if (typeof $.fn.draggable === 'undefined') + { + return; + } + + this.$modal.draggable({ handle: this.$modalHeader }); + this.$modalHeader.css('cursor', 'move'); + }, + setEnter: function(e) + { + if (e.which !== 13) + { + return; + } + + e.preventDefault(); + this.modal.getActionButton().click(); + }, + build: function() + { + this.modal.buildOverlay(); + + this.$modalBox = $('
    ').hide(); + this.$modal = $('
  • \n\n"); + html = html.replace(/

    \s
    <\/p>/gi, '

    '); + + html = this.paragraphize.getSafes(html); + + html = html.replace('
    ', "\n"); + html = this.paragraphize.convert(html); + + html = this.paragraphize.clear(html); + html = this.paragraphize.restoreSafes(html); + + // after + html = html.replace(new RegExp('\n?<(' + this.opts.paragraphizeBlocks.join('|') + ')(.*?[^>])>', 'gi'), '


    \n<$1$2>'); + + return $.trim(html); + }, + getSafes: function(html) + { + var $div = $('
    ').append(html); + + // remove paragraphs in blockquotes + $div.find('blockquote p').replaceWith(function() + { + return $(this).append('
    ').contents(); + }); + + $div.find(this.opts.paragraphizeBlocks.join(', ')).each($.proxy(function(i,s) + { + this.paragraphize.z++; + this.paragraphize.safes[this.paragraphize.z] = s.outerHTML; + + return $(s).replaceWith("\n#####replace" + this.paragraphize.z + "#####\n\n"); + + + }, this)); + + // deal with redactor selection markers + $div.find('span.redactor-selection-marker').each($.proxy(function(i,s) + { + this.paragraphize.z++; + this.paragraphize.safes[this.paragraphize.z] = s.outerHTML; + + return $(s).replaceWith("\n#####replace" + this.paragraphize.z + "#####\n\n"); + }, this)); + + return $div.html(); + }, + restoreSafes: function(html) + { + $.each(this.paragraphize.safes, function(i,s) + { + s = (typeof s !== 'undefined') ? s.replace(/\$/g, '$') : s; + html = html.replace('#####replace' + i + '#####', s); + + }); + + return html; + }, + convert: function(html) + { + html = html.replace(/\r\n/g, "xparagraphmarkerz"); + html = html.replace(/\n/g, "xparagraphmarkerz"); + html = html.replace(/\r/g, "xparagraphmarkerz"); + + var re1 = /\s+/g; + html = html.replace(re1, " "); + html = $.trim(html); + + var re2 = /xparagraphmarkerzxparagraphmarkerz/gi; + html = html.replace(re2, "

    "); + + var re3 = /xparagraphmarkerz/gi; + html = html.replace(re3, "
    "); + + html = '

    ' + html + '

    '; + + html = html.replace("

    ", ""); + html = html.replace("\r\n\r\n", ""); + html = html.replace(/<\/p>

    /g, "

    \r\n\r\n

    "); + html = html.replace(new RegExp("

    ", "g"), "

    "); + html = html.replace(new RegExp("

    ", "g"), "

    "); + html = html.replace(new RegExp("

    ", "g"), "

    "); + html = html.replace(new RegExp("

    ", "g"), "

    "); + html = html.replace(/

     <\/p>/gi, ""); + html = html.replace(/

    \s?
     <\/p>/gi, ''); + html = html.replace(/

    \s?
    /gi, '

    '); + + return html; + }, + clear: function(html) + { + + html = html.replace(/

    (.*?)#####replace(.*?)#####\s?<\/p>/gi, '

    $1

    #####replace$2#####'); + html = html.replace(/(){2,}<\/p>/gi, '

    '); + + html = html.replace(new RegExp('

    ', 'gi'), ''); + html = html.replace(new RegExp('

    ', 'gi'), ''); + html = html.replace(new RegExp('

    ', 'gi'), '
    '); + html = html.replace(new RegExp('

    ', 'gi'), '
    '); + + html = html.replace(new RegExp('

    ', 'gi'), '

    '); + html = html.replace(new RegExp('

    ', 'gi'), '

    '); + html = html.replace(new RegExp('

    \\s?

    ', 'gi'), ''); + html = html.replace(new RegExp("\n

    ", 'gi'), '

    '); + html = html.replace(new RegExp('

    \t?\t?\n?

    ', 'gi'), '

    '); + html = html.replace(new RegExp('

    \t*

    ', 'gi'), ''); + + return html; + } + }; + }, + + // =paste + paste: function() + { + return { + init: function(e) + { + this.rtePaste = true; + var pre = (this.opts.type === 'pre' || this.utils.isCurrentOrParent('pre')) ? true : false; + + // clipboard event + if (this.detect.isDesktop()) + { + + if (!this.paste.pre && this.opts.clipboardImageUpload && this.opts.imageUpload && this.paste.detectClipboardUpload(e)) + { + if (this.detect.isIe()) + { + setTimeout($.proxy(this.paste.clipboardUpload, this), 100); + } + + return; + } + } + + this.utils.saveScroll(); + this.selection.save(); + this.paste.createPasteBox(pre); + + $(window).on('scroll.redactor-freeze', $.proxy(function() + { + $(window).scrollTop(this.saveBodyScroll); + + }, this)); + + setTimeout($.proxy(function() + { + var html = this.paste.getPasteBoxCode(pre); + + // buffer + this.buffer.set(); + this.selection.restore(); + + this.utils.restoreScroll(); + + // paste info + var data = this.clean.getCurrentType(html); + + // clean + html = this.clean.onPaste(html, data); + + // callback + var returned = this.core.callback('paste', html); + html = (typeof returned === 'undefined') ? html : returned; + + this.paste.insert(html, data); + this.rtePaste = false; + + // clean pre breaklines + if (pre) + { + this.clean.cleanPre(); + } + + $(window).off('scroll.redactor-freeze'); + + }, this), 1); + + }, + getPasteBoxCode: function(pre) + { + var html = (pre) ? this.$pasteBox.val() : this.$pasteBox.html(); + this.$pasteBox.remove(); + + return html; + }, + createPasteBox: function(pre) + { + var css = { position: 'fixed', width: '1px', top: 0, left: '-9999px' }; + + this.$pasteBox = (pre) ? $('"; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // #11217 - WebKit loses check when the name is after the checked attribute + fragment.appendChild( div ); + div.innerHTML = ""; + + // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 + // old WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + support.noCloneEvent = true; + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Execute the test only if not already executed in another module. + if (support.deleteExpando == null) { + // Support: IE<9 + support.deleteExpando = true; + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + } +})(); + + +(function() { + var i, eventName, + div = document.createElement( "div" ); + + // Support: IE<9 (lack submit/change bubble), Firefox 23+ (lack focusin event) + for ( i in { submit: true, change: true, focusin: true }) { + eventName = "on" + i; + + if ( !(support[ i + "Bubbles" ] = eventName in window) ) { + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) + div.setAttribute( eventName, "t" ); + support[ i + "Bubbles" ] = div.attributes[ eventName ].expando === false; + } + } + + // Null elements to avoid leaks in IE. + div = null; +})(); + + +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && jQuery.acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( eventPath.pop(), data ) === false) && + jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) + .apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + /* jshint eqeqeq: false */ + for ( ; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: true */ + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + // Support: IE < 9, Android < 4.0 + src.returnValue === false ? + returnTrue : + returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + jQuery._removeData( doc, fix ); + } else { + jQuery._data( doc, fix, attaches ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); + + +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
    ", "
    " ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "", "
    " ], + tr: [ 2, "", "
    " ], + col: [ 2, "", "
    " ], + td: [ 3, "", "
    " ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
    ", "
    " ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +// Support: IE<8 +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName("tbody")[0] || + elem.appendChild( elem.ownerDocument.createElement("tbody") ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = (jQuery.find.attr( elem, "type" ) !== null) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!support.noCloneEvent || !support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = (rtagName.exec( elem ) || [ "", "" ])[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
    " && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + deletedIds.push( id ); + } + } + } + } + } +}); + +jQuery.fn.extend({ + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + append: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip( arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + remove: function( selector, keepData /* Internal Use Only */ ) { + var elem, + elems = selector ? jQuery.filter( selector, this ) : this, + i = 0; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map(function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ (rtagName.exec( value ) || [ "", "" ])[ 1 ].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var arg = arguments[ 0 ]; + + // Make the changes, replacing each context element with the new content + this.domManip( arguments, function( elem ) { + arg = this.parentNode; + + jQuery.cleanData( getAll( this ) ); + + if ( arg ) { + arg.replaceChild( elem, this ); + } + }); + + // Force removal if there was no new content (e.g., from empty arguments) + return arg && (arg.length || arg.nodeType) ? this : this.remove(); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, callback ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, self.html() ); + } + self.domManip( args, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( this[i], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + + +var iframe, + elemdisplay = {}; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var style, + elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + // getDefaultComputedStyle might be reliably used only on attached element + display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? + + // Use of this method is a temporary fix (more like optmization) until something better comes along, + // since it was removed from specification and supported only in FF + style.display : jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = (iframe || jQuery( "