sinatra-hexacta 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/lib/sinatra/handlers/errors.rb +23 -0
  3. data/lib/sinatra/handlers/init.rb +3 -0
  4. data/lib/sinatra/handlers/notifications.rb +74 -0
  5. data/lib/sinatra/handlers/reports.rb +1 -0
  6. data/lib/sinatra/helpers/charts.rb +15 -0
  7. data/lib/sinatra/helpers/init.rb +5 -0
  8. data/lib/sinatra/helpers/inputs.rb +47 -0
  9. data/lib/sinatra/helpers/libraries.rb +25 -0
  10. data/lib/sinatra/helpers/subscriptions.rb +44 -0
  11. data/lib/sinatra/hexacta.rb +32 -0
  12. data/lib/sinatra/public/css/app.min.1.css +16231 -0
  13. data/lib/sinatra/public/css/app.min.2.css +3341 -0
  14. data/lib/sinatra/public/css/shell.css +65 -0
  15. data/lib/sinatra/public/fonts/montserrat/Montserrat-Black.otf +0 -0
  16. data/lib/sinatra/public/fonts/montserrat/Montserrat-ExtraLight.otf +0 -0
  17. data/lib/sinatra/public/fonts/montserrat/Montserrat-Light.otf +0 -0
  18. data/lib/sinatra/public/fonts/montserrat/Montserrat-SemiBold.otf +0 -0
  19. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.eot +0 -0
  20. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.svg +593 -0
  21. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.ttf +0 -0
  22. data/lib/sinatra/public/fonts/roboto/Roboto-Bold-webfont.woff +0 -0
  23. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.eot +0 -0
  24. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.svg +641 -0
  25. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.ttf +0 -0
  26. data/lib/sinatra/public/fonts/roboto/Roboto-Light-webfont.woff +0 -0
  27. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.eot +0 -0
  28. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.svg +593 -0
  29. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.ttf +0 -0
  30. data/lib/sinatra/public/fonts/roboto/Roboto-Medium-webfont.woff +0 -0
  31. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.eot +0 -0
  32. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.svg +621 -0
  33. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.ttf +0 -0
  34. data/lib/sinatra/public/fonts/roboto/Roboto-Regular-webfont.woff +0 -0
  35. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.eot +0 -0
  36. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.svg +631 -0
  37. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.ttf +0 -0
  38. data/lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.woff +0 -0
  39. data/lib/sinatra/public/img/select.png +0 -0
  40. data/lib/sinatra/public/img/select@2x.png +0 -0
  41. data/lib/sinatra/public/js/app.js +794 -0
  42. data/lib/sinatra/public/js/form_validator.js +29 -0
  43. data/lib/sinatra/public/vendors/animate.css/animate.min.css +7 -0
  44. data/lib/sinatra/public/vendors/bootstrap-validator/validator.js +405 -0
  45. data/lib/sinatra/public/vendors/bootstrap/bootstrap.min.js +7 -0
  46. data/lib/sinatra/public/vendors/chartist/chartist.min.css +1 -0
  47. data/lib/sinatra/public/vendors/chartist/chartist.min.js +10 -0
  48. data/lib/sinatra/public/vendors/chosen/chosen-sprite.png +0 -0
  49. data/lib/sinatra/public/vendors/chosen/chosen-sprite@2x.png +0 -0
  50. data/lib/sinatra/public/vendors/chosen/chosen.jquery.min.js +3 -0
  51. data/lib/sinatra/public/vendors/chosen/chosen.min.css +11 -0
  52. data/lib/sinatra/public/vendors/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.js +2051 -0
  53. data/lib/sinatra/public/vendors/eonasdan-bootstrap-datetimepicker/bootstrap-datetimepicker.min.css +5 -0
  54. data/lib/sinatra/public/vendors/jquery/jquery.min.js +5 -0
  55. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js +5 -0
  56. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css +1267 -0
  57. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js +2370 -0
  58. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css +1 -0
  59. data/lib/sinatra/public/vendors/malihu-custom-scrollbar-plugin/mCSB_buttons.png +0 -0
  60. data/lib/sinatra/public/vendors/material-design-iconic-font/css/material-design-iconic-font.css +5166 -0
  61. data/lib/sinatra/public/vendors/material-design-iconic-font/css/material-design-iconic-font.min.css +1 -0
  62. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.eot +0 -0
  63. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.svg +787 -0
  64. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.ttf +0 -0
  65. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.woff +0 -0
  66. data/lib/sinatra/public/vendors/material-design-iconic-font/fonts/Material-Design-Iconic-Font.woff2 +0 -0
  67. data/lib/sinatra/public/vendors/moment/moment.min.js +7 -0
  68. data/lib/sinatra/public/vendors/typeahead.js/bloodhound.min.js +7 -0
  69. data/lib/sinatra/public/vendors/typeahead.js/handlebars.js +2610 -0
  70. data/lib/sinatra/public/vendors/typeahead.js/typeahead.bundle.min.js +8 -0
  71. data/lib/sinatra/public/vendors/waves/waves.min.css +8 -0
  72. data/lib/sinatra/public/vendors/waves/waves.min.js +10 -0
  73. data/lib/sinatra/views/charts/simple_line.slim +36 -0
  74. data/lib/sinatra/views/errors/403.slim +9 -0
  75. data/lib/sinatra/views/errors/404.slim +27 -0
  76. data/lib/sinatra/views/errors/500.slim +24 -0
  77. data/lib/sinatra/views/inputs/date.slim +12 -0
  78. data/lib/sinatra/views/inputs/input.slim +18 -0
  79. data/lib/sinatra/views/inputs/month.slim +13 -0
  80. data/lib/sinatra/views/inputs/multiple_select.slim +27 -0
  81. data/lib/sinatra/views/inputs/radio.slim +8 -0
  82. data/lib/sinatra/views/inputs/select.slim +26 -0
  83. data/lib/sinatra/views/inputs/textarea.slim +14 -0
  84. data/lib/sinatra/views/inputs/tick.slim +8 -0
  85. data/lib/sinatra/views/inputs/year.slim +12 -0
  86. data/lib/sinatra/views/libraries/include_css.slim +28 -0
  87. data/lib/sinatra/views/libraries/include_js_after.slim +53 -0
  88. data/lib/sinatra/views/libraries/include_js_before.slim +7 -0
  89. data/lib/sinatra/views/notifications.slim +98 -0
  90. data/lib/sinatra/views/notifications/form.slim +41 -0
  91. data/lib/sinatra/views/notifications/item.slim +11 -0
  92. data/lib/sinatra/views/notifications/modal.slim +29 -0
  93. data/lib/sinatra/views/notifications/new.slim +21 -0
  94. data/lib/sinatra/views/notifications/view.slim +80 -0
  95. data/lib/sinatra/views/notifications/widget.slim +33 -0
  96. metadata +136 -0
@@ -0,0 +1 @@
1
+ .ct-double-octave:after,.ct-golden-section:after,.ct-major-eleventh:after,.ct-major-second:after,.ct-major-seventh:after,.ct-major-sixth:after,.ct-major-tenth:after,.ct-major-third:after,.ct-major-twelfth:after,.ct-minor-second:after,.ct-minor-seventh:after,.ct-minor-sixth:after,.ct-minor-third:after,.ct-octave:after,.ct-perfect-fifth:after,.ct-perfect-fourth:after,.ct-square:after{content:"";clear:both}.ct-label{fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:.75rem;line-height:1}.ct-chart-bar .ct-label,.ct-chart-line .ct-label{display:block;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex}.ct-chart-donut .ct-label,.ct-chart-pie .ct-label{dominant-baseline:central}.ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-label.ct-vertical.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end;text-align:right;text-anchor:end}.ct-label.ct-vertical.ct-end{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar .ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;text-anchor:start}.ct-chart-bar .ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-start{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end;text-align:right;text-anchor:end}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-end{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:end}.ct-grid{stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px}.ct-grid-background{fill:none}.ct-point{stroke-width:10px;stroke-linecap:round}.ct-line{fill:none;stroke-width:4px}.ct-area{stroke:none;fill-opacity:.1}.ct-bar{fill:none;stroke-width:10px}.ct-slice-donut{fill:none;stroke-width:60px}.ct-series-a .ct-bar,.ct-series-a .ct-line,.ct-series-a .ct-point,.ct-series-a .ct-slice-donut{stroke:#d70206}.ct-series-a .ct-area,.ct-series-a .ct-slice-donut-solid,.ct-series-a .ct-slice-pie{fill:#d70206}.ct-series-b .ct-bar,.ct-series-b .ct-line,.ct-series-b .ct-point,.ct-series-b .ct-slice-donut{stroke:#f05b4f}.ct-series-b .ct-area,.ct-series-b .ct-slice-donut-solid,.ct-series-b .ct-slice-pie{fill:#f05b4f}.ct-series-c .ct-bar,.ct-series-c .ct-line,.ct-series-c .ct-point,.ct-series-c .ct-slice-donut{stroke:#f4c63d}.ct-series-c .ct-area,.ct-series-c .ct-slice-donut-solid,.ct-series-c .ct-slice-pie{fill:#f4c63d}.ct-series-d .ct-bar,.ct-series-d .ct-line,.ct-series-d .ct-point,.ct-series-d .ct-slice-donut{stroke:#d17905}.ct-series-d .ct-area,.ct-series-d .ct-slice-donut-solid,.ct-series-d .ct-slice-pie{fill:#d17905}.ct-series-e .ct-bar,.ct-series-e .ct-line,.ct-series-e .ct-point,.ct-series-e .ct-slice-donut{stroke:#453d3f}.ct-series-e .ct-area,.ct-series-e .ct-slice-donut-solid,.ct-series-e .ct-slice-pie{fill:#453d3f}.ct-series-f .ct-bar,.ct-series-f .ct-line,.ct-series-f .ct-point,.ct-series-f .ct-slice-donut{stroke:#59922b}.ct-series-f .ct-area,.ct-series-f .ct-slice-donut-solid,.ct-series-f .ct-slice-pie{fill:#59922b}.ct-series-g .ct-bar,.ct-series-g .ct-line,.ct-series-g .ct-point,.ct-series-g .ct-slice-donut{stroke:#0544d3}.ct-series-g .ct-area,.ct-series-g .ct-slice-donut-solid,.ct-series-g .ct-slice-pie{fill:#0544d3}.ct-series-h .ct-bar,.ct-series-h .ct-line,.ct-series-h .ct-point,.ct-series-h .ct-slice-donut{stroke:#6b0392}.ct-series-h .ct-area,.ct-series-h .ct-slice-donut-solid,.ct-series-h .ct-slice-pie{fill:#6b0392}.ct-series-i .ct-bar,.ct-series-i .ct-line,.ct-series-i .ct-point,.ct-series-i .ct-slice-donut{stroke:#f05b4f}.ct-series-i .ct-area,.ct-series-i .ct-slice-donut-solid,.ct-series-i .ct-slice-pie{fill:#f05b4f}.ct-series-j .ct-bar,.ct-series-j .ct-line,.ct-series-j .ct-point,.ct-series-j .ct-slice-donut{stroke:#dda458}.ct-series-j .ct-area,.ct-series-j .ct-slice-donut-solid,.ct-series-j .ct-slice-pie{fill:#dda458}.ct-series-k .ct-bar,.ct-series-k .ct-line,.ct-series-k .ct-point,.ct-series-k .ct-slice-donut{stroke:#eacf7d}.ct-series-k .ct-area,.ct-series-k .ct-slice-donut-solid,.ct-series-k .ct-slice-pie{fill:#eacf7d}.ct-series-l .ct-bar,.ct-series-l .ct-line,.ct-series-l .ct-point,.ct-series-l .ct-slice-donut{stroke:#86797d}.ct-series-l .ct-area,.ct-series-l .ct-slice-donut-solid,.ct-series-l .ct-slice-pie{fill:#86797d}.ct-series-m .ct-bar,.ct-series-m .ct-line,.ct-series-m .ct-point,.ct-series-m .ct-slice-donut{stroke:#b2c326}.ct-series-m .ct-area,.ct-series-m .ct-slice-donut-solid,.ct-series-m .ct-slice-pie{fill:#b2c326}.ct-series-n .ct-bar,.ct-series-n .ct-line,.ct-series-n .ct-point,.ct-series-n .ct-slice-donut{stroke:#6188e2}.ct-series-n .ct-area,.ct-series-n .ct-slice-donut-solid,.ct-series-n .ct-slice-pie{fill:#6188e2}.ct-series-o .ct-bar,.ct-series-o .ct-line,.ct-series-o .ct-point,.ct-series-o .ct-slice-donut{stroke:#a748ca}.ct-series-o .ct-area,.ct-series-o .ct-slice-donut-solid,.ct-series-o .ct-slice-pie{fill:#a748ca}.ct-square{display:block;position:relative;width:100%}.ct-square:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:100%}.ct-square:after{display:table}.ct-square>svg{display:block;position:absolute;top:0;left:0}.ct-minor-second{display:block;position:relative;width:100%}.ct-minor-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:93.75%}.ct-minor-second:after{display:table}.ct-minor-second>svg{display:block;position:absolute;top:0;left:0}.ct-major-second{display:block;position:relative;width:100%}.ct-major-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:88.8888888889%}.ct-major-second:after{display:table}.ct-major-second>svg{display:block;position:absolute;top:0;left:0}.ct-minor-third{display:block;position:relative;width:100%}.ct-minor-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:83.3333333333%}.ct-minor-third:after{display:table}.ct-minor-third>svg{display:block;position:absolute;top:0;left:0}.ct-major-third{display:block;position:relative;width:100%}.ct-major-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:80%}.ct-major-third:after{display:table}.ct-major-third>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fourth{display:block;position:relative;width:100%}.ct-perfect-fourth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:75%}.ct-perfect-fourth:after{display:table}.ct-perfect-fourth>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fifth{display:block;position:relative;width:100%}.ct-perfect-fifth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:66.6666666667%}.ct-perfect-fifth:after{display:table}.ct-perfect-fifth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-sixth{display:block;position:relative;width:100%}.ct-minor-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:62.5%}.ct-minor-sixth:after{display:table}.ct-minor-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-golden-section{display:block;position:relative;width:100%}.ct-golden-section:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:61.804697157%}.ct-golden-section:after{display:table}.ct-golden-section>svg{display:block;position:absolute;top:0;left:0}.ct-major-sixth{display:block;position:relative;width:100%}.ct-major-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:60%}.ct-major-sixth:after{display:table}.ct-major-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-seventh{display:block;position:relative;width:100%}.ct-minor-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:56.25%}.ct-minor-seventh:after{display:table}.ct-minor-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-seventh{display:block;position:relative;width:100%}.ct-major-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:53.3333333333%}.ct-major-seventh:after{display:table}.ct-major-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-octave{display:block;position:relative;width:100%}.ct-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:50%}.ct-octave:after{display:table}.ct-octave>svg{display:block;position:absolute;top:0;left:0}.ct-major-tenth{display:block;position:relative;width:100%}.ct-major-tenth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:40%}.ct-major-tenth:after{display:table}.ct-major-tenth>svg{display:block;position:absolute;top:0;left:0}.ct-major-eleventh{display:block;position:relative;width:100%}.ct-major-eleventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:37.5%}.ct-major-eleventh:after{display:table}.ct-major-eleventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-twelfth{display:block;position:relative;width:100%}.ct-major-twelfth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:33.3333333333%}.ct-major-twelfth:after{display:table}.ct-major-twelfth>svg{display:block;position:absolute;top:0;left:0}.ct-double-octave{display:block;position:relative;width:100%}.ct-double-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:25%}.ct-double-octave:after{display:table}.ct-double-octave>svg{display:block;position:absolute;top:0;left:0}
@@ -0,0 +1,10 @@
1
+ /* Chartist.js 0.11.4
2
+ * Copyright © 2019 Gion Kunz
3
+ * Free to use under either the WTFPL license or the MIT license.
4
+ * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL
5
+ * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT
6
+ */
7
+
8
+ !function(a,b){"function"==typeof define&&define.amd?define("Chartist",[],function(){return a.Chartist=b()}):"object"==typeof module&&module.exports?module.exports=b():a.Chartist=b()}(this,function(){var a={version:"0.11.4"};return function(a,b){"use strict";var c=a.window,d=a.document;b.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},b.noop=function(a){return a},b.alphaNumerate=function(a){return String.fromCharCode(97+a%26)},b.extend=function(a){var c,d,e;for(a=a||{},c=1;c<arguments.length;c++){d=arguments[c];for(var f in d)e=d[f],"object"!=typeof e||null===e||e instanceof Array?a[f]=e:a[f]=b.extend(a[f],e)}return a},b.replaceAll=function(a,b,c){return a.replace(new RegExp(b,"g"),c)},b.ensureUnit=function(a,b){return"number"==typeof a&&(a+=b),a},b.quantity=function(a){if("string"==typeof a){var b=/^(\d+)\s*(.*)$/g.exec(a);return{value:+b[1],unit:b[2]||void 0}}return{value:a}},b.querySelector=function(a){return a instanceof Node?a:d.querySelector(a)},b.times=function(a){return Array.apply(null,new Array(a))},b.sum=function(a,b){return a+(b?b:0)},b.mapMultiply=function(a){return function(b){return b*a}},b.mapAdd=function(a){return function(b){return b+a}},b.serialMap=function(a,c){var d=[],e=Math.max.apply(null,a.map(function(a){return a.length}));return b.times(e).forEach(function(b,e){var f=a.map(function(a){return a[e]});d[e]=c.apply(null,f)}),d},b.roundWithPrecision=function(a,c){var d=Math.pow(10,c||b.precision);return Math.round(a*d)/d},b.precision=8,b.escapingMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"},b.serialize=function(a){return null===a||void 0===a?a:("number"==typeof a?a=""+a:"object"==typeof a&&(a=JSON.stringify({data:a})),Object.keys(b.escapingMap).reduce(function(a,c){return b.replaceAll(a,c,b.escapingMap[c])},a))},b.deserialize=function(a){if("string"!=typeof a)return a;a=Object.keys(b.escapingMap).reduce(function(a,c){return b.replaceAll(a,b.escapingMap[c],c)},a);try{a=JSON.parse(a),a=void 0!==a.data?a.data:a}catch(c){}return a},b.createSvg=function(a,c,d,e){var f;return c=c||"100%",d=d||"100%",Array.prototype.slice.call(a.querySelectorAll("svg")).filter(function(a){return a.getAttributeNS(b.namespaces.xmlns,"ct")}).forEach(function(b){a.removeChild(b)}),f=new b.Svg("svg").attr({width:c,height:d}).addClass(e),f._node.style.width=c,f._node.style.height=d,a.appendChild(f._node),f},b.normalizeData=function(a,c,d){var e,f={raw:a,normalized:{}};return f.normalized.series=b.getDataArray({series:a.series||[]},c,d),e=f.normalized.series.every(function(a){return a instanceof Array})?Math.max.apply(null,f.normalized.series.map(function(a){return a.length})):f.normalized.series.length,f.normalized.labels=(a.labels||[]).slice(),Array.prototype.push.apply(f.normalized.labels,b.times(Math.max(0,e-f.normalized.labels.length)).map(function(){return""})),c&&b.reverseData(f.normalized),f},b.safeHasProperty=function(a,b){return null!==a&&"object"==typeof a&&a.hasOwnProperty(b)},b.isDataHoleValue=function(a){return null===a||void 0===a||"number"==typeof a&&isNaN(a)},b.reverseData=function(a){a.labels.reverse(),a.series.reverse();for(var b=0;b<a.series.length;b++)"object"==typeof a.series[b]&&void 0!==a.series[b].data?a.series[b].data.reverse():a.series[b]instanceof Array&&a.series[b].reverse()},b.getDataArray=function(a,c,d){function e(a){if(b.safeHasProperty(a,"value"))return e(a.value);if(b.safeHasProperty(a,"data"))return e(a.data);if(a instanceof Array)return a.map(e);if(!b.isDataHoleValue(a)){if(d){var c={};return"string"==typeof d?c[d]=b.getNumberOrUndefined(a):c.y=b.getNumberOrUndefined(a),c.x=a.hasOwnProperty("x")?b.getNumberOrUndefined(a.x):c.x,c.y=a.hasOwnProperty("y")?b.getNumberOrUndefined(a.y):c.y,c}return b.getNumberOrUndefined(a)}}return a.series.map(e)},b.normalizePadding=function(a,b){return b=b||0,"number"==typeof a?{top:a,right:a,bottom:a,left:a}:{top:"number"==typeof a.top?a.top:b,right:"number"==typeof a.right?a.right:b,bottom:"number"==typeof a.bottom?a.bottom:b,left:"number"==typeof a.left?a.left:b}},b.getMetaData=function(a,b){var c=a.data?a.data[b]:a[b];return c?c.meta:void 0},b.orderOfMagnitude=function(a){return Math.floor(Math.log(Math.abs(a))/Math.LN10)},b.projectLength=function(a,b,c){return b/c.range*a},b.getAvailableHeight=function(a,c){return Math.max((b.quantity(c.height).value||a.height())-(c.chartPadding.top+c.chartPadding.bottom)-c.axisX.offset,0)},b.getHighLow=function(a,c,d){function e(a){if(void 0!==a)if(a instanceof Array)for(var b=0;b<a.length;b++)e(a[b]);else{var c=d?+a[d]:+a;g&&c>f.high&&(f.high=c),h&&c<f.low&&(f.low=c)}}c=b.extend({},c,d?c["axis"+d.toUpperCase()]:{});var f={high:void 0===c.high?-Number.MAX_VALUE:+c.high,low:void 0===c.low?Number.MAX_VALUE:+c.low},g=void 0===c.high,h=void 0===c.low;return(g||h)&&e(a),(c.referenceValue||0===c.referenceValue)&&(f.high=Math.max(c.referenceValue,f.high),f.low=Math.min(c.referenceValue,f.low)),f.high<=f.low&&(0===f.low?f.high=1:f.low<0?f.high=0:f.high>0?f.low=0:(f.high=1,f.low=0)),f},b.isNumeric=function(a){return null!==a&&isFinite(a)},b.isFalseyButZero=function(a){return!a&&0!==a},b.getNumberOrUndefined=function(a){return b.isNumeric(a)?+a:void 0},b.isMultiValue=function(a){return"object"==typeof a&&("x"in a||"y"in a)},b.getMultiValue=function(a,c){return b.isMultiValue(a)?b.getNumberOrUndefined(a[c||"y"]):b.getNumberOrUndefined(a)},b.rho=function(a){function b(a,c){return a%c===0?c:b(c,a%c)}function c(a){return a*a+1}if(1===a)return a;var d,e=2,f=2;if(a%2===0)return 2;do e=c(e)%a,f=c(c(f))%a,d=b(Math.abs(e-f),a);while(1===d);return d},b.getBounds=function(a,c,d,e){function f(a,b){return a===(a+=b)&&(a*=1+(b>0?o:-o)),a}var g,h,i,j=0,k={high:c.high,low:c.low};k.valueRange=k.high-k.low,k.oom=b.orderOfMagnitude(k.valueRange),k.step=Math.pow(10,k.oom),k.min=Math.floor(k.low/k.step)*k.step,k.max=Math.ceil(k.high/k.step)*k.step,k.range=k.max-k.min,k.numberOfSteps=Math.round(k.range/k.step);var l=b.projectLength(a,k.step,k),m=l<d,n=e?b.rho(k.range):0;if(e&&b.projectLength(a,1,k)>=d)k.step=1;else if(e&&n<k.step&&b.projectLength(a,n,k)>=d)k.step=n;else for(;;){if(m&&b.projectLength(a,k.step,k)<=d)k.step*=2;else{if(m||!(b.projectLength(a,k.step/2,k)>=d))break;if(k.step/=2,e&&k.step%1!==0){k.step*=2;break}}if(j++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}var o=2.221e-16;for(k.step=Math.max(k.step,o),h=k.min,i=k.max;h+k.step<=k.low;)h=f(h,k.step);for(;i-k.step>=k.high;)i=f(i,-k.step);k.min=h,k.max=i,k.range=k.max-k.min;var p=[];for(g=k.min;g<=k.max;g=f(g,k.step)){var q=b.roundWithPrecision(g);q!==p[p.length-1]&&p.push(q)}return k.values=p,k},b.polarToCartesian=function(a,b,c,d){var e=(d-90)*Math.PI/180;return{x:a+c*Math.cos(e),y:b+c*Math.sin(e)}},b.createChartRect=function(a,c,d){var e=!(!c.axisX&&!c.axisY),f=e?c.axisY.offset:0,g=e?c.axisX.offset:0,h=a.width()||b.quantity(c.width).value||0,i=a.height()||b.quantity(c.height).value||0,j=b.normalizePadding(c.chartPadding,d);h=Math.max(h,f+j.left+j.right),i=Math.max(i,g+j.top+j.bottom);var k={padding:j,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return e?("start"===c.axisX.position?(k.y2=j.top+g,k.y1=Math.max(i-j.bottom,k.y2+1)):(k.y2=j.top,k.y1=Math.max(i-j.bottom-g,k.y2+1)),"start"===c.axisY.position?(k.x1=j.left+f,k.x2=Math.max(h-j.right,k.x1+1)):(k.x1=j.left,k.x2=Math.max(h-j.right-f,k.x1+1))):(k.x1=j.left,k.x2=Math.max(h-j.right,k.x1+1),k.y2=j.top,k.y1=Math.max(i-j.bottom,k.y2+1)),k},b.createGrid=function(a,c,d,e,f,g,h,i){var j={};j[d.units.pos+"1"]=a,j[d.units.pos+"2"]=a,j[d.counterUnits.pos+"1"]=e,j[d.counterUnits.pos+"2"]=e+f;var k=g.elem("line",j,h.join(" "));i.emit("draw",b.extend({type:"grid",axis:d,index:c,group:g,element:k},j))},b.createGridBackground=function(a,b,c,d){var e=a.elem("rect",{x:b.x1,y:b.y2,width:b.width(),height:b.height()},c,!0);d.emit("draw",{type:"gridBackground",group:a,element:e})},b.createLabel=function(a,c,e,f,g,h,i,j,k,l,m){var n,o={};if(o[g.units.pos]=a+i[g.units.pos],o[g.counterUnits.pos]=i[g.counterUnits.pos],o[g.units.len]=c,o[g.counterUnits.len]=Math.max(0,h-10),l){var p=d.createElement("span");p.className=k.join(" "),p.setAttribute("xmlns",b.namespaces.xhtml),p.innerText=f[e],p.style[g.units.len]=Math.round(o[g.units.len])+"px",p.style[g.counterUnits.len]=Math.round(o[g.counterUnits.len])+"px",n=j.foreignObject(p,b.extend({style:"overflow: visible;"},o))}else n=j.elem("text",o,k.join(" ")).text(f[e]);m.emit("draw",b.extend({type:"label",axis:g,index:e,group:j,element:n,text:f[e]},o))},b.getSeriesOption=function(a,b,c){if(a.name&&b.series&&b.series[a.name]){var d=b.series[a.name];return d.hasOwnProperty(c)?d[c]:b[c]}return b[c]},b.optionsProvider=function(a,d,e){function f(a){var f=h;if(h=b.extend({},j),d)for(i=0;i<d.length;i++){var g=c.matchMedia(d[i][0]);g.matches&&(h=b.extend(h,d[i][1]))}e&&a&&e.emit("optionsChanged",{previousOptions:f,currentOptions:h})}function g(){k.forEach(function(a){a.removeListener(f)})}var h,i,j=b.extend({},a),k=[];if(!c.matchMedia)throw"window.matchMedia not found! Make sure you're using a polyfill.";if(d)for(i=0;i<d.length;i++){var l=c.matchMedia(d[i][0]);l.addListener(f),k.push(l)}return f(),{removeMediaQueryListeners:g,getCurrentOptions:function(){return b.extend({},h)}}},b.splitIntoSegments=function(a,c,d){var e={increasingX:!1,fillHoles:!1};d=b.extend({},e,d);for(var f=[],g=!0,h=0;h<a.length;h+=2)void 0===b.getMultiValue(c[h/2].value)?d.fillHoles||(g=!0):(d.increasingX&&h>=2&&a[h]<=a[h-2]&&(g=!0),g&&(f.push({pathCoordinates:[],valueData:[]}),g=!1),f[f.length-1].pathCoordinates.push(a[h],a[h+1]),f[f.length-1].valueData.push(c[h/2]));return f}}(this||global,a),function(a,b){"use strict";b.Interpolation={},b.Interpolation.none=function(a){var c={fillHoles:!1};return a=b.extend({},c,a),function(c,d){for(var e=new b.Svg.Path,f=!0,g=0;g<c.length;g+=2){var h=c[g],i=c[g+1],j=d[g/2];void 0!==b.getMultiValue(j.value)?(f?e.move(h,i,!1,j):e.line(h,i,!1,j),f=!1):a.fillHoles||(f=!0)}return e}},b.Interpolation.simple=function(a){var c={divisor:2,fillHoles:!1};a=b.extend({},c,a);var d=1/Math.max(1,a.divisor);return function(c,e){for(var f,g,h,i=new b.Svg.Path,j=0;j<c.length;j+=2){var k=c[j],l=c[j+1],m=(k-f)*d,n=e[j/2];void 0!==n.value?(void 0===h?i.move(k,l,!1,n):i.curve(f+m,g,k-m,l,k,l,!1,n),f=k,g=l,h=n):a.fillHoles||(f=k=h=void 0)}return i}},b.Interpolation.cardinal=function(a){var c={tension:1,fillHoles:!1};a=b.extend({},c,a);var d=Math.min(1,Math.max(0,a.tension)),e=1-d;return function f(c,g){var h=b.splitIntoSegments(c,g,{fillHoles:a.fillHoles});if(h.length){if(h.length>1){var i=[];return h.forEach(function(a){i.push(f(a.pathCoordinates,a.valueData))}),b.Svg.Path.join(i)}if(c=h[0].pathCoordinates,g=h[0].valueData,c.length<=4)return b.Interpolation.none()(c,g);for(var j,k=(new b.Svg.Path).move(c[0],c[1],!1,g[0]),l=0,m=c.length;m-2*!j>l;l+=2){var n=[{x:+c[l-2],y:+c[l-1]},{x:+c[l],y:+c[l+1]},{x:+c[l+2],y:+c[l+3]},{x:+c[l+4],y:+c[l+5]}];j?l?m-4===l?n[3]={x:+c[0],y:+c[1]}:m-2===l&&(n[2]={x:+c[0],y:+c[1]},n[3]={x:+c[2],y:+c[3]}):n[0]={x:+c[m-2],y:+c[m-1]}:m-4===l?n[3]=n[2]:l||(n[0]={x:+c[l],y:+c[l+1]}),k.curve(d*(-n[0].x+6*n[1].x+n[2].x)/6+e*n[2].x,d*(-n[0].y+6*n[1].y+n[2].y)/6+e*n[2].y,d*(n[1].x+6*n[2].x-n[3].x)/6+e*n[2].x,d*(n[1].y+6*n[2].y-n[3].y)/6+e*n[2].y,n[2].x,n[2].y,!1,g[(l+2)/2])}return k}return b.Interpolation.none()([])}},b.Interpolation.monotoneCubic=function(a){var c={fillHoles:!1};return a=b.extend({},c,a),function d(c,e){var f=b.splitIntoSegments(c,e,{fillHoles:a.fillHoles,increasingX:!0});if(f.length){if(f.length>1){var g=[];return f.forEach(function(a){g.push(d(a.pathCoordinates,a.valueData))}),b.Svg.Path.join(g)}if(c=f[0].pathCoordinates,e=f[0].valueData,c.length<=4)return b.Interpolation.none()(c,e);var h,i,j=[],k=[],l=c.length/2,m=[],n=[],o=[],p=[];for(h=0;h<l;h++)j[h]=c[2*h],k[h]=c[2*h+1];for(h=0;h<l-1;h++)o[h]=k[h+1]-k[h],p[h]=j[h+1]-j[h],n[h]=o[h]/p[h];for(m[0]=n[0],m[l-1]=n[l-2],h=1;h<l-1;h++)0===n[h]||0===n[h-1]||n[h-1]>0!=n[h]>0?m[h]=0:(m[h]=3*(p[h-1]+p[h])/((2*p[h]+p[h-1])/n[h-1]+(p[h]+2*p[h-1])/n[h]),isFinite(m[h])||(m[h]=0));for(i=(new b.Svg.Path).move(j[0],k[0],!1,e[0]),h=0;h<l-1;h++)i.curve(j[h]+p[h]/3,k[h]+m[h]*p[h]/3,j[h+1]-p[h]/3,k[h+1]-m[h+1]*p[h]/3,j[h+1],k[h+1],!1,e[h+1]);return i}return b.Interpolation.none()([])}},b.Interpolation.step=function(a){var c={postpone:!0,fillHoles:!1};return a=b.extend({},c,a),function(c,d){for(var e,f,g,h=new b.Svg.Path,i=0;i<c.length;i+=2){var j=c[i],k=c[i+1],l=d[i/2];void 0!==l.value?(void 0===g?h.move(j,k,!1,l):(a.postpone?h.line(j,f,!1,g):h.line(e,k,!1,l),h.line(j,k,!1,l)),e=j,f=k,g=l):a.fillHoles||(e=f=g=void 0)}return h}}}(this||global,a),function(a,b){"use strict";b.EventEmitter=function(){function a(a,b){d[a]=d[a]||[],d[a].push(b)}function b(a,b){d[a]&&(b?(d[a].splice(d[a].indexOf(b),1),0===d[a].length&&delete d[a]):delete d[a])}function c(a,b){d[a]&&d[a].forEach(function(a){a(b)}),d["*"]&&d["*"].forEach(function(c){c(a,b)})}var d=[];return{addEventHandler:a,removeEventHandler:b,emit:c}}}(this||global,a),function(a,b){"use strict";function c(a){var b=[];if(a.length)for(var c=0;c<a.length;c++)b.push(a[c]);return b}function d(a,c){var d=c||this.prototype||b.Class,e=Object.create(d);b.Class.cloneDefinitions(e,a);var f=function(){var a,c=e.constructor||function(){};return a=this===b?Object.create(e):this,c.apply(a,Array.prototype.slice.call(arguments,0)),a};return f.prototype=e,f["super"]=d,f.extend=this.extend,f}function e(){var a=c(arguments),b=a[0];return a.splice(1,a.length-1).forEach(function(a){Object.getOwnPropertyNames(a).forEach(function(c){delete b[c],Object.defineProperty(b,c,Object.getOwnPropertyDescriptor(a,c))})}),b}b.Class={extend:d,cloneDefinitions:e}}(this||global,a),function(a,b){"use strict";function c(a,c,d){return a&&(this.data=a||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),c&&(this.options=b.extend({},d?this.options:this.defaultOptions,c),this.initializeTimeoutId||(this.optionsProvider.removeMediaQueryListeners(),this.optionsProvider=b.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter))),this.initializeTimeoutId||this.createChart(this.optionsProvider.getCurrentOptions()),this}function d(){return this.initializeTimeoutId?i.clearTimeout(this.initializeTimeoutId):(i.removeEventListener("resize",this.resizeListener),this.optionsProvider.removeMediaQueryListeners()),this}function e(a,b){return this.eventEmitter.addEventHandler(a,b),this}function f(a,b){return this.eventEmitter.removeEventHandler(a,b),this}function g(){i.addEventListener("resize",this.resizeListener),this.optionsProvider=b.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.addEventHandler("optionsChanged",function(){this.update()}.bind(this)),this.options.plugins&&this.options.plugins.forEach(function(a){a instanceof Array?a[0](this,a[1]):a(this)}.bind(this)),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=void 0}function h(a,c,d,e,f){this.container=b.querySelector(a),this.data=c||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.defaultOptions=d,this.options=e,this.responsiveOptions=f,this.eventEmitter=b.EventEmitter(),this.supportsForeignObject=b.Svg.isSupported("Extensibility"),this.supportsAnimations=b.Svg.isSupported("AnimationEventsAttribute"),this.resizeListener=function(){this.update()}.bind(this),this.container&&(this.container.__chartist__&&this.container.__chartist__.detach(),this.container.__chartist__=this),this.initializeTimeoutId=setTimeout(g.bind(this),0)}var i=a.window;b.Base=b.Class.extend({constructor:h,optionsProvider:void 0,container:void 0,svg:void 0,eventEmitter:void 0,createChart:function(){throw new Error("Base chart type can't be instantiated!")},update:c,detach:d,on:e,off:f,version:b.version,supportsForeignObject:!1})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e,f){a instanceof Element?this._node=a:(this._node=y.createElementNS(b.namespaces.svg,a),"svg"===a&&this.attr({"xmlns:ct":b.namespaces.ct})),c&&this.attr(c),d&&this.addClass(d),e&&(f&&e._node.firstChild?e._node.insertBefore(this._node,e._node.firstChild):e._node.appendChild(this._node))}function d(a,c){return"string"==typeof a?c?this._node.getAttributeNS(c,a):this._node.getAttribute(a):(Object.keys(a).forEach(function(c){if(void 0!==a[c])if(c.indexOf(":")!==-1){var d=c.split(":");this._node.setAttributeNS(b.namespaces[d[0]],c,a[c])}else this._node.setAttribute(c,a[c])}.bind(this)),this)}function e(a,c,d,e){return new b.Svg(a,c,d,this,e)}function f(){return this._node.parentNode instanceof SVGElement?new b.Svg(this._node.parentNode):null}function g(){for(var a=this._node;"svg"!==a.nodeName;)a=a.parentNode;return new b.Svg(a)}function h(a){var c=this._node.querySelector(a);return c?new b.Svg(c):null}function i(a){var c=this._node.querySelectorAll(a);return c.length?new b.Svg.List(c):null}function j(){return this._node}function k(a,c,d,e){if("string"==typeof a){var f=y.createElement("div");f.innerHTML=a,a=f.firstChild}a.setAttribute("xmlns",b.namespaces.xmlns);var g=this.elem("foreignObject",c,d,e);return g._node.appendChild(a),g}function l(a){return this._node.appendChild(y.createTextNode(a)),this}function m(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}function n(){return this._node.parentNode.removeChild(this._node),this.parent()}function o(a){return this._node.parentNode.replaceChild(a._node,this._node),a}function p(a,b){return b&&this._node.firstChild?this._node.insertBefore(a._node,this._node.firstChild):this._node.appendChild(a._node),this}function q(){return this._node.getAttribute("class")?this._node.getAttribute("class").trim().split(/\s+/):[]}function r(a){return this._node.setAttribute("class",this.classes(this._node).concat(a.trim().split(/\s+/)).filter(function(a,b,c){return c.indexOf(a)===b}).join(" ")),this}function s(a){var b=a.trim().split(/\s+/);return this._node.setAttribute("class",this.classes(this._node).filter(function(a){return b.indexOf(a)===-1}).join(" ")),this}function t(){return this._node.setAttribute("class",""),this}function u(){return this._node.getBoundingClientRect().height}function v(){return this._node.getBoundingClientRect().width}function w(a,c,d){return void 0===c&&(c=!0),Object.keys(a).forEach(function(e){function f(a,c){var f,g,h,i={};a.easing&&(h=a.easing instanceof Array?a.easing:b.Svg.Easing[a.easing],delete a.easing),a.begin=b.ensureUnit(a.begin,"ms"),a.dur=b.ensureUnit(a.dur,"ms"),h&&(a.calcMode="spline",a.keySplines=h.join(" "),a.keyTimes="0;1"),c&&(a.fill="freeze",i[e]=a.from,this.attr(i),g=b.quantity(a.begin||0).value,a.begin="indefinite"),f=this.elem("animate",b.extend({attributeName:e},a)),c&&setTimeout(function(){try{f._node.beginElement()}catch(b){i[e]=a.to,this.attr(i),f.remove()}}.bind(this),g),d&&f._node.addEventListener("beginEvent",function(){d.emit("animationBegin",{element:this,animate:f._node,params:a})}.bind(this)),f._node.addEventListener("endEvent",function(){d&&d.emit("animationEnd",{element:this,animate:f._node,params:a}),c&&(i[e]=a.to,this.attr(i),f.remove())}.bind(this))}a[e]instanceof Array?a[e].forEach(function(a){f.bind(this)(a,!1)}.bind(this)):f.bind(this)(a[e],c)}.bind(this)),this}function x(a){var c=this;this.svgElements=[];for(var d=0;d<a.length;d++)this.svgElements.push(new b.Svg(a[d]));Object.keys(b.Svg.prototype).filter(function(a){return["constructor","parent","querySelector","querySelectorAll","replace","append","classes","height","width"].indexOf(a)===-1}).forEach(function(a){c[a]=function(){var d=Array.prototype.slice.call(arguments,0);return c.svgElements.forEach(function(c){b.Svg.prototype[a].apply(c,d)}),c}})}var y=a.document;b.Svg=b.Class.extend({constructor:c,attr:d,elem:e,parent:f,root:g,querySelector:h,querySelectorAll:i,getNode:j,foreignObject:k,text:l,empty:m,remove:n,replace:o,append:p,classes:q,addClass:r,removeClass:s,removeAllClasses:t,height:u,width:v,animate:w}),b.Svg.isSupported=function(a){return y.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#"+a,"1.1")};var z={easeInSine:[.47,0,.745,.715],easeOutSine:[.39,.575,.565,1],easeInOutSine:[.445,.05,.55,.95],easeInQuad:[.55,.085,.68,.53],easeOutQuad:[.25,.46,.45,.94],easeInOutQuad:[.455,.03,.515,.955],easeInCubic:[.55,.055,.675,.19],easeOutCubic:[.215,.61,.355,1],easeInOutCubic:[.645,.045,.355,1],easeInQuart:[.895,.03,.685,.22],easeOutQuart:[.165,.84,.44,1],easeInOutQuart:[.77,0,.175,1],easeInQuint:[.755,.05,.855,.06],easeOutQuint:[.23,1,.32,1],easeInOutQuint:[.86,0,.07,1],easeInExpo:[.95,.05,.795,.035],easeOutExpo:[.19,1,.22,1],easeInOutExpo:[1,0,0,1],easeInCirc:[.6,.04,.98,.335],easeOutCirc:[.075,.82,.165,1],easeInOutCirc:[.785,.135,.15,.86],easeInBack:[.6,-.28,.735,.045],easeOutBack:[.175,.885,.32,1.275],easeInOutBack:[.68,-.55,.265,1.55]};b.Svg.Easing=z,b.Svg.List=b.Class.extend({constructor:x})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e,f,g){var h=b.extend({command:f?a.toLowerCase():a.toUpperCase()},c,g?{data:g}:{});d.splice(e,0,h)}function d(a,b){a.forEach(function(c,d){t[c.command.toLowerCase()].forEach(function(e,f){b(c,e,d,f,a)})})}function e(a,c){this.pathElements=[],this.pos=0,this.close=a,this.options=b.extend({},u,c)}function f(a){return void 0!==a?(this.pos=Math.max(0,Math.min(this.pathElements.length,a)),this):this.pos}function g(a){return this.pathElements.splice(this.pos,a),this}function h(a,b,d,e){return c("M",{x:+a,y:+b},this.pathElements,this.pos++,d,e),this}function i(a,b,d,e){return c("L",{x:+a,y:+b},this.pathElements,this.pos++,d,e),this}function j(a,b,d,e,f,g,h,i){return c("C",{x1:+a,y1:+b,x2:+d,y2:+e,x:+f,y:+g},this.pathElements,this.pos++,h,i),this}function k(a,b,d,e,f,g,h,i,j){return c("A",{rx:+a,ry:+b,xAr:+d,lAf:+e,sf:+f,x:+g,y:+h},this.pathElements,this.pos++,i,j),this}function l(a){var c=a.replace(/([A-Za-z])([0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce(function(a,b){return b.match(/[A-Za-z]/)&&a.push([]),a[a.length-1].push(b),a},[]);"Z"===c[c.length-1][0].toUpperCase()&&c.pop();var d=c.map(function(a){var c=a.shift(),d=t[c.toLowerCase()];return b.extend({command:c},d.reduce(function(b,c,d){return b[c]=+a[d],b},{}))}),e=[this.pos,0];return Array.prototype.push.apply(e,d),Array.prototype.splice.apply(this.pathElements,e),this.pos+=d.length,this}function m(){var a=Math.pow(10,this.options.accuracy);return this.pathElements.reduce(function(b,c){var d=t[c.command.toLowerCase()].map(function(b){return this.options.accuracy?Math.round(c[b]*a)/a:c[b]}.bind(this));return b+c.command+d.join(",")}.bind(this),"")+(this.close?"Z":"")}function n(a,b){return d(this.pathElements,function(c,d){c[d]*="x"===d[0]?a:b}),this}function o(a,b){return d(this.pathElements,function(c,d){c[d]+="x"===d[0]?a:b}),this}function p(a){return d(this.pathElements,function(b,c,d,e,f){var g=a(b,c,d,e,f);(g||0===g)&&(b[c]=g)}),this}function q(a){var c=new b.Svg.Path(a||this.close);return c.pos=this.pos,c.pathElements=this.pathElements.slice().map(function(a){return b.extend({},a)}),c.options=b.extend({},this.options),c}function r(a){var c=[new b.Svg.Path];return this.pathElements.forEach(function(d){d.command===a.toUpperCase()&&0!==c[c.length-1].pathElements.length&&c.push(new b.Svg.Path),c[c.length-1].pathElements.push(d)}),c}function s(a,c,d){for(var e=new b.Svg.Path(c,d),f=0;f<a.length;f++)for(var g=a[f],h=0;h<g.pathElements.length;h++)e.pathElements.push(g.pathElements[h]);return e}var t={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},u={accuracy:3};b.Svg.Path=b.Class.extend({constructor:e,position:f,remove:g,move:h,line:i,curve:j,arc:k,scale:n,translate:o,transform:p,parse:l,stringify:m,clone:q,splitByCommand:r}),b.Svg.Path.elementDescriptions=t,b.Svg.Path.join=s}(this||global,a),function(a,b){"use strict";function c(a,b,c,d){this.units=a,this.counterUnits=a===e.x?e.y:e.x,this.chartRect=b,this.axisLength=b[a.rectEnd]-b[a.rectStart],this.gridOffset=b[a.rectOffset],this.ticks=c,this.options=d}function d(a,c,d,e,f){var g=e["axis"+this.units.pos.toUpperCase()],h=this.ticks.map(this.projectValue.bind(this)),i=this.ticks.map(g.labelInterpolationFnc);h.forEach(function(j,k){var l,m={x:0,y:0};l=h[k+1]?h[k+1]-j:Math.max(this.axisLength-j,30),b.isFalseyButZero(i[k])&&""!==i[k]||("x"===this.units.pos?(j=this.chartRect.x1+j,m.x=e.axisX.labelOffset.x,"start"===e.axisX.position?m.y=this.chartRect.padding.top+e.axisX.labelOffset.y+(d?5:20):m.y=this.chartRect.y1+e.axisX.labelOffset.y+(d?5:20)):(j=this.chartRect.y1-j,m.y=e.axisY.labelOffset.y-(d?l:0),"start"===e.axisY.position?m.x=d?this.chartRect.padding.left+e.axisY.labelOffset.x:this.chartRect.x1-10:m.x=this.chartRect.x2+e.axisY.labelOffset.x+10),g.showGrid&&b.createGrid(j,k,this,this.gridOffset,this.chartRect[this.counterUnits.len](),a,[e.classNames.grid,e.classNames[this.units.dir]],f),g.showLabel&&b.createLabel(j,l,k,i,this,g.offset,m,c,[e.classNames.label,e.classNames[this.units.dir],"start"===g.position?e.classNames[g.position]:e.classNames.end],d,f))}.bind(this))}var e=(a.window,a.document,{x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}});b.Axis=b.Class.extend({constructor:c,createGridAndLabels:d,projectValue:function(a,b,c){throw new Error("Base axis can't be instantiated!")}}),b.Axis.units=e}(this||global,a),function(a,b){"use strict";function c(a,c,d,e){var f=e.highLow||b.getHighLow(c,e,a.pos);this.bounds=b.getBounds(d[a.rectEnd]-d[a.rectStart],f,e.scaleMinSpace||20,e.onlyInteger),this.range={min:this.bounds.min,max:this.bounds.max},b.AutoScaleAxis["super"].constructor.call(this,a,d,this.bounds.values,e)}function d(a){return this.axisLength*(+b.getMultiValue(a,this.units.pos)-this.bounds.min)/this.bounds.range}a.window,a.document;b.AutoScaleAxis=b.Axis.extend({constructor:c,projectValue:d})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e){var f=e.highLow||b.getHighLow(c,e,a.pos);this.divisor=e.divisor||1,this.ticks=e.ticks||b.times(this.divisor).map(function(a,b){return f.low+(f.high-f.low)/this.divisor*b}.bind(this)),this.ticks.sort(function(a,b){return a-b}),this.range={min:f.low,max:f.high},b.FixedScaleAxis["super"].constructor.call(this,a,d,this.ticks,e),this.stepLength=this.axisLength/this.divisor}function d(a){return this.axisLength*(+b.getMultiValue(a,this.units.pos)-this.range.min)/(this.range.max-this.range.min)}a.window,a.document;b.FixedScaleAxis=b.Axis.extend({constructor:c,projectValue:d})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e){b.StepAxis["super"].constructor.call(this,a,d,e.ticks,e);var f=Math.max(1,e.ticks.length-(e.stretch?1:0));this.stepLength=this.axisLength/f}function d(a,b){return this.stepLength*b}a.window,a.document;b.StepAxis=b.Axis.extend({constructor:c,projectValue:d})}(this||global,a),function(a,b){"use strict";function c(a){var c=b.normalizeData(this.data,a.reverseData,!0);this.svg=b.createSvg(this.container,a.width,a.height,a.classNames.chart);var d,f,g=this.svg.elem("g").addClass(a.classNames.gridGroup),h=this.svg.elem("g"),i=this.svg.elem("g").addClass(a.classNames.labelGroup),j=b.createChartRect(this.svg,a,e.padding);d=void 0===a.axisX.type?new b.StepAxis(b.Axis.units.x,c.normalized.series,j,b.extend({},a.axisX,{ticks:c.normalized.labels,stretch:a.fullWidth})):a.axisX.type.call(b,b.Axis.units.x,c.normalized.series,j,a.axisX),f=void 0===a.axisY.type?new b.AutoScaleAxis(b.Axis.units.y,c.normalized.series,j,b.extend({},a.axisY,{high:b.isNumeric(a.high)?a.high:a.axisY.high,low:b.isNumeric(a.low)?a.low:a.axisY.low})):a.axisY.type.call(b,b.Axis.units.y,c.normalized.series,j,a.axisY),d.createGridAndLabels(g,i,this.supportsForeignObject,a,this.eventEmitter),f.createGridAndLabels(g,i,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&b.createGridBackground(g,j,a.classNames.gridBackground,this.eventEmitter),c.raw.series.forEach(function(e,g){var i=h.elem("g");i.attr({"ct:series-name":e.name,"ct:meta":b.serialize(e.meta)}),i.addClass([a.classNames.series,e.className||a.classNames.series+"-"+b.alphaNumerate(g)].join(" "));var k=[],l=[];c.normalized.series[g].forEach(function(a,h){var i={x:j.x1+d.projectValue(a,h,c.normalized.series[g]),y:j.y1-f.projectValue(a,h,c.normalized.series[g])};k.push(i.x,i.y),l.push({value:a,valueIndex:h,meta:b.getMetaData(e,h)})}.bind(this));var m={lineSmooth:b.getSeriesOption(e,a,"lineSmooth"),showPoint:b.getSeriesOption(e,a,"showPoint"),showLine:b.getSeriesOption(e,a,"showLine"),showArea:b.getSeriesOption(e,a,"showArea"),areaBase:b.getSeriesOption(e,a,"areaBase")},n="function"==typeof m.lineSmooth?m.lineSmooth:m.lineSmooth?b.Interpolation.monotoneCubic():b.Interpolation.none(),o=n(k,l);if(m.showPoint&&o.pathElements.forEach(function(c){var h=i.elem("line",{x1:c.x,y1:c.y,x2:c.x+.01,y2:c.y},a.classNames.point).attr({"ct:value":[c.data.value.x,c.data.value.y].filter(b.isNumeric).join(","),"ct:meta":b.serialize(c.data.meta)});this.eventEmitter.emit("draw",{type:"point",value:c.data.value,index:c.data.valueIndex,meta:c.data.meta,series:e,seriesIndex:g,axisX:d,axisY:f,group:i,element:h,x:c.x,y:c.y})}.bind(this)),m.showLine){var p=i.elem("path",{d:o.stringify()},a.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:c.normalized.series[g],path:o.clone(),chartRect:j,index:g,series:e,seriesIndex:g,seriesMeta:e.meta,axisX:d,axisY:f,group:i,element:p})}if(m.showArea&&f.range){var q=Math.max(Math.min(m.areaBase,f.range.max),f.range.min),r=j.y1-f.projectValue(q);o.splitByCommand("M").filter(function(a){return a.pathElements.length>1}).map(function(a){var b=a.pathElements[0],c=a.pathElements[a.pathElements.length-1];return a.clone(!0).position(0).remove(1).move(b.x,r).line(b.x,b.y).position(a.pathElements.length+1).line(c.x,r)}).forEach(function(b){var h=i.elem("path",{d:b.stringify()},a.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:c.normalized.series[g],path:b.clone(),series:e,seriesIndex:g,axisX:d,axisY:f,chartRect:j,index:g,group:i,element:h})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:f.bounds,chartRect:j,axisX:d,axisY:f,svg:this.svg,options:a})}function d(a,c,d,f){b.Line["super"].constructor.call(this,a,c,e,b.extend({},e,d),f)}var e=(a.window,a.document,{axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}});b.Line=b.Base.extend({constructor:d,createChart:c})}(this||global,a),function(a,b){"use strict";function c(a){var c,d;a.distributeSeries?(c=b.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),c.normalized.series=c.normalized.series.map(function(a){return[a]})):c=b.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),this.svg=b.createSvg(this.container,a.width,a.height,a.classNames.chart+(a.horizontalBars?" "+a.classNames.horizontalBars:""));var f=this.svg.elem("g").addClass(a.classNames.gridGroup),g=this.svg.elem("g"),h=this.svg.elem("g").addClass(a.classNames.labelGroup);
9
+ if(a.stackBars&&0!==c.normalized.series.length){var i=b.serialMap(c.normalized.series,function(){return Array.prototype.slice.call(arguments).map(function(a){return a}).reduce(function(a,b){return{x:a.x+(b&&b.x)||0,y:a.y+(b&&b.y)||0}},{x:0,y:0})});d=b.getHighLow([i],a,a.horizontalBars?"x":"y")}else d=b.getHighLow(c.normalized.series,a,a.horizontalBars?"x":"y");d.high=+a.high||(0===a.high?0:d.high),d.low=+a.low||(0===a.low?0:d.low);var j,k,l,m,n,o=b.createChartRect(this.svg,a,e.padding);k=a.distributeSeries&&a.stackBars?c.normalized.labels.slice(0,1):c.normalized.labels,a.horizontalBars?(j=m=void 0===a.axisX.type?new b.AutoScaleAxis(b.Axis.units.x,c.normalized.series,o,b.extend({},a.axisX,{highLow:d,referenceValue:0})):a.axisX.type.call(b,b.Axis.units.x,c.normalized.series,o,b.extend({},a.axisX,{highLow:d,referenceValue:0})),l=n=void 0===a.axisY.type?new b.StepAxis(b.Axis.units.y,c.normalized.series,o,{ticks:k}):a.axisY.type.call(b,b.Axis.units.y,c.normalized.series,o,a.axisY)):(l=m=void 0===a.axisX.type?new b.StepAxis(b.Axis.units.x,c.normalized.series,o,{ticks:k}):a.axisX.type.call(b,b.Axis.units.x,c.normalized.series,o,a.axisX),j=n=void 0===a.axisY.type?new b.AutoScaleAxis(b.Axis.units.y,c.normalized.series,o,b.extend({},a.axisY,{highLow:d,referenceValue:0})):a.axisY.type.call(b,b.Axis.units.y,c.normalized.series,o,b.extend({},a.axisY,{highLow:d,referenceValue:0})));var p=a.horizontalBars?o.x1+j.projectValue(0):o.y1-j.projectValue(0),q=[];l.createGridAndLabels(f,h,this.supportsForeignObject,a,this.eventEmitter),j.createGridAndLabels(f,h,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&b.createGridBackground(f,o,a.classNames.gridBackground,this.eventEmitter),c.raw.series.forEach(function(d,e){var f,h,i=e-(c.raw.series.length-1)/2;f=a.distributeSeries&&!a.stackBars?l.axisLength/c.normalized.series.length/2:a.distributeSeries&&a.stackBars?l.axisLength/2:l.axisLength/c.normalized.series[e].length/2,h=g.elem("g"),h.attr({"ct:series-name":d.name,"ct:meta":b.serialize(d.meta)}),h.addClass([a.classNames.series,d.className||a.classNames.series+"-"+b.alphaNumerate(e)].join(" ")),c.normalized.series[e].forEach(function(g,k){var r,s,t,u;if(u=a.distributeSeries&&!a.stackBars?e:a.distributeSeries&&a.stackBars?0:k,r=a.horizontalBars?{x:o.x1+j.projectValue(g&&g.x?g.x:0,k,c.normalized.series[e]),y:o.y1-l.projectValue(g&&g.y?g.y:0,u,c.normalized.series[e])}:{x:o.x1+l.projectValue(g&&g.x?g.x:0,u,c.normalized.series[e]),y:o.y1-j.projectValue(g&&g.y?g.y:0,k,c.normalized.series[e])},l instanceof b.StepAxis&&(l.options.stretch||(r[l.units.pos]+=f*(a.horizontalBars?-1:1)),r[l.units.pos]+=a.stackBars||a.distributeSeries?0:i*a.seriesBarDistance*(a.horizontalBars?-1:1)),t=q[k]||p,q[k]=t-(p-r[l.counterUnits.pos]),void 0!==g){var v={};v[l.units.pos+"1"]=r[l.units.pos],v[l.units.pos+"2"]=r[l.units.pos],!a.stackBars||"accumulate"!==a.stackMode&&a.stackMode?(v[l.counterUnits.pos+"1"]=p,v[l.counterUnits.pos+"2"]=r[l.counterUnits.pos]):(v[l.counterUnits.pos+"1"]=t,v[l.counterUnits.pos+"2"]=q[k]),v.x1=Math.min(Math.max(v.x1,o.x1),o.x2),v.x2=Math.min(Math.max(v.x2,o.x1),o.x2),v.y1=Math.min(Math.max(v.y1,o.y2),o.y1),v.y2=Math.min(Math.max(v.y2,o.y2),o.y1);var w=b.getMetaData(d,k);s=h.elem("line",v,a.classNames.bar).attr({"ct:value":[g.x,g.y].filter(b.isNumeric).join(","),"ct:meta":b.serialize(w)}),this.eventEmitter.emit("draw",b.extend({type:"bar",value:g,index:k,meta:w,series:d,seriesIndex:e,axisX:m,axisY:n,chartRect:o,group:h,element:s},v))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:j.bounds,chartRect:o,axisX:m,axisY:n,svg:this.svg,options:a})}function d(a,c,d,f){b.Bar["super"].constructor.call(this,a,c,e,b.extend({},e,d),f)}var e=(a.window,a.document,{axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,referenceValue:0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,showGridBackground:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}});b.Bar=b.Base.extend({constructor:d,createChart:c})}(this||global,a),function(a,b){"use strict";function c(a,b,c){var d=b.x>a.x;return d&&"explode"===c||!d&&"implode"===c?"start":d&&"implode"===c||!d&&"explode"===c?"end":"middle"}function d(a){var d,e,g,h,i,j=b.normalizeData(this.data),k=[],l=a.startAngle;this.svg=b.createSvg(this.container,a.width,a.height,a.donut?a.classNames.chartDonut:a.classNames.chartPie),e=b.createChartRect(this.svg,a,f.padding),g=Math.min(e.width()/2,e.height()/2),i=a.total||j.normalized.series.reduce(function(a,b){return a+b},0);var m=b.quantity(a.donutWidth);"%"===m.unit&&(m.value*=g/100),g-=a.donut&&!a.donutSolid?m.value/2:0,h="outside"===a.labelPosition||a.donut&&!a.donutSolid?g:"center"===a.labelPosition?0:a.donutSolid?g-m.value/2:g/2,h+=a.labelOffset;var n={x:e.x1+e.width()/2,y:e.y2+e.height()/2},o=1===j.raw.series.filter(function(a){return a.hasOwnProperty("value")?0!==a.value:0!==a}).length;j.raw.series.forEach(function(a,b){k[b]=this.svg.elem("g",null,null)}.bind(this)),a.showLabel&&(d=this.svg.elem("g",null,null)),j.raw.series.forEach(function(e,f){if(0!==j.normalized.series[f]||!a.ignoreEmptyValues){k[f].attr({"ct:series-name":e.name}),k[f].addClass([a.classNames.series,e.className||a.classNames.series+"-"+b.alphaNumerate(f)].join(" "));var p=i>0?l+j.normalized.series[f]/i*360:0,q=Math.max(0,l-(0===f||o?0:.2));p-q>=359.99&&(p=q+359.99);var r,s,t,u=b.polarToCartesian(n.x,n.y,g,q),v=b.polarToCartesian(n.x,n.y,g,p),w=new b.Svg.Path(!a.donut||a.donutSolid).move(v.x,v.y).arc(g,g,0,p-l>180,0,u.x,u.y);a.donut?a.donutSolid&&(t=g-m.value,r=b.polarToCartesian(n.x,n.y,t,l-(0===f||o?0:.2)),s=b.polarToCartesian(n.x,n.y,t,p),w.line(r.x,r.y),w.arc(t,t,0,p-l>180,1,s.x,s.y)):w.line(n.x,n.y);var x=a.classNames.slicePie;a.donut&&(x=a.classNames.sliceDonut,a.donutSolid&&(x=a.classNames.sliceDonutSolid));var y=k[f].elem("path",{d:w.stringify()},x);if(y.attr({"ct:value":j.normalized.series[f],"ct:meta":b.serialize(e.meta)}),a.donut&&!a.donutSolid&&(y._node.style.strokeWidth=m.value+"px"),this.eventEmitter.emit("draw",{type:"slice",value:j.normalized.series[f],totalDataSum:i,index:f,meta:e.meta,series:e,group:k[f],element:y,path:w.clone(),center:n,radius:g,startAngle:l,endAngle:p}),a.showLabel){var z;z=1===j.raw.series.length?{x:n.x,y:n.y}:b.polarToCartesian(n.x,n.y,h,l+(p-l)/2);var A;A=j.normalized.labels&&!b.isFalseyButZero(j.normalized.labels[f])?j.normalized.labels[f]:j.normalized.series[f];var B=a.labelInterpolationFnc(A,f);if(B||0===B){var C=d.elem("text",{dx:z.x,dy:z.y,"text-anchor":c(n,z,a.labelDirection)},a.classNames.label).text(""+B);this.eventEmitter.emit("draw",{type:"label",index:f,group:d,element:C,text:""+B,x:z.x,y:z.y})}}l=p}}.bind(this)),this.eventEmitter.emit("created",{chartRect:e,svg:this.svg,options:a})}function e(a,c,d,e){b.Pie["super"].constructor.call(this,a,c,f,b.extend({},f,d),e)}var f=(a.window,a.document,{width:void 0,height:void 0,chartPadding:5,classNames:{chartPie:"ct-chart-pie",chartDonut:"ct-chart-donut",series:"ct-series",slicePie:"ct-slice-pie",sliceDonut:"ct-slice-donut",sliceDonutSolid:"ct-slice-donut-solid",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutSolid:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:"inside",labelInterpolationFnc:b.noop,labelDirection:"neutral",reverseData:!1,ignoreEmptyValues:!1});b.Pie=b.Base.extend({constructor:e,createChart:d,determineAnchorPosition:c})}(this||global,a),a});
10
+ //# sourceMappingURL=chartist.min.js.map
@@ -0,0 +1,3 @@
1
+ /* Chosen v1.8.3 | (c) 2011-2018 by Harvest | MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md */
2
+
3
+ (function(){var t,e,s,i,n=function(t,e){return function(){return t.apply(e,arguments)}},r=function(t,e){function s(){this.constructor=t}for(var i in e)o.call(e,i)&&(t[i]=e[i]);return s.prototype=e.prototype,t.prototype=new s,t.__super__=e.prototype,t},o={}.hasOwnProperty;(i=function(){function t(){this.options_index=0,this.parsed=[]}return t.prototype.add_node=function(t){return"OPTGROUP"===t.nodeName.toUpperCase()?this.add_group(t):this.add_option(t)},t.prototype.add_group=function(t){var e,s,i,n,r,o;for(e=this.parsed.length,this.parsed.push({array_index:e,group:!0,label:t.label,title:t.title?t.title:void 0,children:0,disabled:t.disabled,classes:t.className}),o=[],s=0,i=(r=t.childNodes).length;s<i;s++)n=r[s],o.push(this.add_option(n,e,t.disabled));return o},t.prototype.add_option=function(t,e,s){if("OPTION"===t.nodeName.toUpperCase())return""!==t.text?(null!=e&&(this.parsed[e].children+=1),this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:t.value,text:t.text,html:t.innerHTML,title:t.title?t.title:void 0,selected:t.selected,disabled:!0===s?s:t.disabled,group_array_index:e,group_label:null!=e?this.parsed[e].label:null,classes:t.className,style:t.style.cssText})):this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:!0}),this.options_index+=1},t}()).select_to_array=function(t){var e,s,n,r,o;for(r=new i,s=0,n=(o=t.childNodes).length;s<n;s++)e=o[s],r.add_node(e);return r.parsed},e=function(){function t(e,s){this.form_field=e,this.options=null!=s?s:{},this.label_click_handler=n(this.label_click_handler,this),t.browser_is_supported()&&(this.is_multiple=this.form_field.multiple,this.set_default_text(),this.set_default_values(),this.setup(),this.set_up_html(),this.register_observers(),this.on_ready())}return t.prototype.set_default_values=function(){return this.click_test_action=function(t){return function(e){return t.test_active_click(e)}}(this),this.activate_action=function(t){return function(e){return t.activate_field(e)}}(this),this.active_field=!1,this.mouse_on_container=!1,this.results_showing=!1,this.result_highlighted=null,this.is_rtl=this.options.rtl||/\bchosen-rtl\b/.test(this.form_field.className),this.allow_single_deselect=null!=this.options.allow_single_deselect&&null!=this.form_field.options[0]&&""===this.form_field.options[0].text&&this.options.allow_single_deselect,this.disable_search_threshold=this.options.disable_search_threshold||0,this.disable_search=this.options.disable_search||!1,this.enable_split_word_search=null==this.options.enable_split_word_search||this.options.enable_split_word_search,this.group_search=null==this.options.group_search||this.options.group_search,this.search_contains=this.options.search_contains||!1,this.single_backstroke_delete=null==this.options.single_backstroke_delete||this.options.single_backstroke_delete,this.max_selected_options=this.options.max_selected_options||Infinity,this.inherit_select_classes=this.options.inherit_select_classes||!1,this.display_selected_options=null==this.options.display_selected_options||this.options.display_selected_options,this.display_disabled_options=null==this.options.display_disabled_options||this.options.display_disabled_options,this.include_group_label_in_selected=this.options.include_group_label_in_selected||!1,this.max_shown_results=this.options.max_shown_results||Number.POSITIVE_INFINITY,this.case_sensitive_search=this.options.case_sensitive_search||!1,this.hide_results_on_select=null==this.options.hide_results_on_select||this.options.hide_results_on_select},t.prototype.set_default_text=function(){return this.form_field.getAttribute("data-placeholder")?this.default_text=this.form_field.getAttribute("data-placeholder"):this.is_multiple?this.default_text=this.options.placeholder_text_multiple||this.options.placeholder_text||t.default_multiple_text:this.default_text=this.options.placeholder_text_single||this.options.placeholder_text||t.default_single_text,this.default_text=this.escape_html(this.default_text),this.results_none_found=this.form_field.getAttribute("data-no_results_text")||this.options.no_results_text||t.default_no_result_text},t.prototype.choice_label=function(t){return this.include_group_label_in_selected&&null!=t.group_label?"<b class='group-name'>"+t.group_label+"</b>"+t.html:t.html},t.prototype.mouse_enter=function(){return this.mouse_on_container=!0},t.prototype.mouse_leave=function(){return this.mouse_on_container=!1},t.prototype.input_focus=function(t){if(this.is_multiple){if(!this.active_field)return setTimeout(function(t){return function(){return t.container_mousedown()}}(this),50)}else if(!this.active_field)return this.activate_field()},t.prototype.input_blur=function(t){if(!this.mouse_on_container)return this.active_field=!1,setTimeout(function(t){return function(){return t.blur_test()}}(this),100)},t.prototype.label_click_handler=function(t){return this.is_multiple?this.container_mousedown(t):this.activate_field()},t.prototype.results_option_build=function(t){var e,s,i,n,r,o,h;for(e="",h=0,n=0,r=(o=this.results_data).length;n<r&&(s=o[n],i="",""!==(i=s.group?this.result_add_group(s):this.result_add_option(s))&&(h++,e+=i),(null!=t?t.first:void 0)&&(s.selected&&this.is_multiple?this.choice_build(s):s.selected&&!this.is_multiple&&this.single_set_selected_text(this.choice_label(s))),!(h>=this.max_shown_results));n++);return e},t.prototype.result_add_option=function(t){var e,s;return t.search_match&&this.include_option_in_results(t)?(e=[],t.disabled||t.selected&&this.is_multiple||e.push("active-result"),!t.disabled||t.selected&&this.is_multiple||e.push("disabled-result"),t.selected&&e.push("result-selected"),null!=t.group_array_index&&e.push("group-option"),""!==t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.style.cssText=t.style,s.setAttribute("data-option-array-index",t.array_index),s.innerHTML=t.highlighted_html||t.html,t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.result_add_group=function(t){var e,s;return(t.search_match||t.group_match)&&t.active_options>0?((e=[]).push("group-result"),t.classes&&e.push(t.classes),s=document.createElement("li"),s.className=e.join(" "),s.innerHTML=t.highlighted_html||this.escape_html(t.label),t.title&&(s.title=t.title),this.outerHTML(s)):""},t.prototype.results_update_field=function(){if(this.set_default_text(),this.is_multiple||this.results_reset_cleanup(),this.result_clear_highlight(),this.results_build(),this.results_showing)return this.winnow_results()},t.prototype.reset_single_select_options=function(){var t,e,s,i,n;for(n=[],t=0,e=(s=this.results_data).length;t<e;t++)(i=s[t]).selected?n.push(i.selected=!1):n.push(void 0);return n},t.prototype.results_toggle=function(){return this.results_showing?this.results_hide():this.results_show()},t.prototype.results_search=function(t){return this.results_showing?this.winnow_results():this.results_show()},t.prototype.winnow_results=function(){var t,e,s,i,n,r,o,h,l,c,_,a,u,d,p;for(this.no_results_clear(),c=0,t=(o=this.get_search_text()).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),l=this.get_search_regex(t),s=0,i=(h=this.results_data).length;s<i;s++)(n=h[s]).search_match=!1,_=null,a=null,n.highlighted_html="",this.include_option_in_results(n)&&(n.group&&(n.group_match=!1,n.active_options=0),null!=n.group_array_index&&this.results_data[n.group_array_index]&&(0===(_=this.results_data[n.group_array_index]).active_options&&_.search_match&&(c+=1),_.active_options+=1),p=n.group?n.label:n.text,n.group&&!this.group_search||(a=this.search_string_match(p,l),n.search_match=null!=a,n.search_match&&!n.group&&(c+=1),n.search_match?(o.length&&(u=a.index,r=p.slice(0,u),e=p.slice(u,u+o.length),d=p.slice(u+o.length),n.highlighted_html=this.escape_html(r)+"<em>"+this.escape_html(e)+"</em>"+this.escape_html(d)),null!=_&&(_.group_match=!0)):null!=n.group_array_index&&this.results_data[n.group_array_index].search_match&&(n.search_match=!0)));return this.result_clear_highlight(),c<1&&o.length?(this.update_results_content(""),this.no_results(o)):(this.update_results_content(this.results_option_build()),this.winnow_results_set_highlight())},t.prototype.get_search_regex=function(t){var e,s;return s=this.search_contains?t:"(^|\\s|\\b)"+t+"[^\\s]*",this.enable_split_word_search||this.search_contains||(s="^"+s),e=this.case_sensitive_search?"":"i",new RegExp(s,e)},t.prototype.search_string_match=function(t,e){var s;return s=e.exec(t),!this.search_contains&&(null!=s?s[1]:void 0)&&(s.index+=1),s},t.prototype.choices_count=function(){var t,e,s;if(null!=this.selected_option_count)return this.selected_option_count;for(this.selected_option_count=0,t=0,e=(s=this.form_field.options).length;t<e;t++)s[t].selected&&(this.selected_option_count+=1);return this.selected_option_count},t.prototype.choices_click=function(t){if(t.preventDefault(),this.activate_field(),!this.results_showing&&!this.is_disabled)return this.results_show()},t.prototype.keydown_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),8!==s&&this.pending_backstroke&&this.clear_backstroke(),s){case 8:this.backstroke_length=this.get_search_field_value().length;break;case 9:this.results_showing&&!this.is_multiple&&this.result_select(t),this.mouse_on_container=!1;break;case 13:case 27:this.results_showing&&t.preventDefault();break;case 32:this.disable_search&&t.preventDefault();break;case 38:t.preventDefault(),this.keyup_arrow();break;case 40:t.preventDefault(),this.keydown_arrow()}},t.prototype.keyup_checker=function(t){var e,s;switch(s=null!=(e=t.which)?e:t.keyCode,this.search_field_scale(),s){case 8:this.is_multiple&&this.backstroke_length<1&&this.choices_count()>0?this.keydown_backstroke():this.pending_backstroke||(this.result_clear_highlight(),this.results_search());break;case 13:t.preventDefault(),this.results_showing&&this.result_select(t);break;case 27:this.results_showing&&this.results_hide();break;case 9:case 16:case 17:case 18:case 38:case 40:case 91:break;default:this.results_search()}},t.prototype.clipboard_event_checker=function(t){if(!this.is_disabled)return setTimeout(function(t){return function(){return t.results_search()}}(this),50)},t.prototype.container_width=function(){return null!=this.options.width?this.options.width:this.form_field.offsetWidth+"px"},t.prototype.include_option_in_results=function(t){return!(this.is_multiple&&!this.display_selected_options&&t.selected)&&(!(!this.display_disabled_options&&t.disabled)&&!t.empty)},t.prototype.search_results_touchstart=function(t){return this.touch_started=!0,this.search_results_mouseover(t)},t.prototype.search_results_touchmove=function(t){return this.touch_started=!1,this.search_results_mouseout(t)},t.prototype.search_results_touchend=function(t){if(this.touch_started)return this.search_results_mouseup(t)},t.prototype.outerHTML=function(t){var e;return t.outerHTML?t.outerHTML:((e=document.createElement("div")).appendChild(t),e.innerHTML)},t.prototype.get_single_html=function(){return'<a class="chosen-single chosen-default">\n <input class="chosen-search-input" type="text" autocomplete="off" />\n <span>'+this.default_text+'</span>\n <div><b></b></div>\n</a>\n<div class="chosen-drop">\n <div class="chosen-search">\n </div>\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_multi_html=function(){return'<ul class="chosen-choices">\n <li class="search-field">\n <input class="chosen-search-input" type="text" autocomplete="off" value="'+this.default_text+'" />\n </li>\n</ul>\n<div class="chosen-drop">\n <ul class="chosen-results"></ul>\n</div>'},t.prototype.get_no_results_html=function(t){return'<li class="no-results">\n '+this.results_none_found+" <span>"+this.escape_html(t)+"</span>\n</li>"},t.browser_is_supported=function(){return"Microsoft Internet Explorer"===window.navigator.appName?document.documentMode>=8:!(/iP(od|hone)/i.test(window.navigator.userAgent)||/IEMobile/i.test(window.navigator.userAgent)||/Windows Phone/i.test(window.navigator.userAgent)||/BlackBerry/i.test(window.navigator.userAgent)||/BB10/i.test(window.navigator.userAgent)||/Android.*Mobile/i.test(window.navigator.userAgent))},t.default_multiple_text="Select Some Options",t.default_single_text="Select an Option",t.default_no_result_text="No results match",t}(),(t=jQuery).fn.extend({chosen:function(i){return e.browser_is_supported()?this.each(function(e){var n,r;r=(n=t(this)).data("chosen"),"destroy"!==i?r instanceof s||n.data("chosen",new s(this,i)):r instanceof s&&r.destroy()}):this}}),s=function(s){function n(){return n.__super__.constructor.apply(this,arguments)}return r(n,e),n.prototype.setup=function(){return this.form_field_jq=t(this.form_field),this.current_selectedIndex=this.form_field.selectedIndex},n.prototype.set_up_html=function(){var e,s;return(e=["chosen-container"]).push("chosen-container-"+(this.is_multiple?"multi":"single")),this.inherit_select_classes&&this.form_field.className&&e.push(this.form_field.className),this.is_rtl&&e.push("chosen-rtl"),s={"class":e.join(" "),title:this.form_field.title},this.form_field.id.length&&(s.id=this.form_field.id.replace(/[^\w]/g,"_")+"_chosen"),this.container=t("<div />",s),this.container.width(this.container_width()),this.is_multiple?this.container.html(this.get_multi_html()):this.container.html(this.get_single_html()),this.form_field_jq.css('position', 'absolute').css('opacity', 0).after(this.container),this.dropdown=this.container.find("div.chosen-drop").first(),this.search_field=this.container.find("input").first(),this.search_results=this.container.find("ul.chosen-results").first(),this.search_field_scale(),this.search_no_results=this.container.find("li.no-results").first(),this.is_multiple?(this.search_choices=this.container.find("ul.chosen-choices").first(),this.search_container=this.container.find("li.search-field").first()):(this.search_container=this.container.find("div.chosen-search").first(),this.selected_item=this.container.find(".chosen-single").first()),this.results_build(),this.set_tab_index(),this.set_label_behavior()},n.prototype.on_ready=function(){return this.form_field_jq.trigger("chosen:ready",{chosen:this})},n.prototype.register_observers=function(){return this.container.on("touchstart.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("touchend.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mousedown.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.container.on("mouseup.chosen",function(t){return function(e){t.container_mouseup(e)}}(this)),this.container.on("mouseenter.chosen",function(t){return function(e){t.mouse_enter(e)}}(this)),this.container.on("mouseleave.chosen",function(t){return function(e){t.mouse_leave(e)}}(this)),this.search_results.on("mouseup.chosen",function(t){return function(e){t.search_results_mouseup(e)}}(this)),this.search_results.on("mouseover.chosen",function(t){return function(e){t.search_results_mouseover(e)}}(this)),this.search_results.on("mouseout.chosen",function(t){return function(e){t.search_results_mouseout(e)}}(this)),this.search_results.on("mousewheel.chosen DOMMouseScroll.chosen",function(t){return function(e){t.search_results_mousewheel(e)}}(this)),this.search_results.on("touchstart.chosen",function(t){return function(e){t.search_results_touchstart(e)}}(this)),this.search_results.on("touchmove.chosen",function(t){return function(e){t.search_results_touchmove(e)}}(this)),this.search_results.on("touchend.chosen",function(t){return function(e){t.search_results_touchend(e)}}(this)),this.form_field_jq.on("chosen:updated.chosen",function(t){return function(e){t.results_update_field(e)}}(this)),this.form_field_jq.on("chosen:activate.chosen",function(t){return function(e){t.activate_field(e)}}(this)),this.form_field_jq.on("chosen:open.chosen",function(t){return function(e){t.container_mousedown(e)}}(this)),this.form_field_jq.on("chosen:close.chosen",function(t){return function(e){t.close_field(e)}}(this)),this.search_field.on("blur.chosen",function(t){return function(e){t.input_blur(e)}}(this)),this.search_field.on("keyup.chosen",function(t){return function(e){t.keyup_checker(e)}}(this)),this.search_field.on("keydown.chosen",function(t){return function(e){t.keydown_checker(e)}}(this)),this.search_field.on("focus.chosen",function(t){return function(e){t.input_focus(e)}}(this)),this.search_field.on("cut.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.search_field.on("paste.chosen",function(t){return function(e){t.clipboard_event_checker(e)}}(this)),this.is_multiple?this.search_choices.on("click.chosen",function(t){return function(e){t.choices_click(e)}}(this)):this.container.on("click.chosen",function(t){t.preventDefault()})},n.prototype.destroy=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.form_field_label.length>0&&this.form_field_label.off("click.chosen"),this.search_field[0].tabIndex&&(this.form_field_jq[0].tabIndex=this.search_field[0].tabIndex),this.container.remove(),this.form_field_jq.removeData("chosen"),this.form_field_jq.show()},n.prototype.search_field_disabled=function(){return this.is_disabled=this.form_field.disabled||this.form_field_jq.parents("fieldset").is(":disabled"),this.container.toggleClass("chosen-disabled",this.is_disabled),this.search_field[0].disabled=this.is_disabled,this.is_multiple||this.selected_item.off("focus.chosen",this.activate_field),this.is_disabled?this.close_field():this.is_multiple?void 0:this.selected_item.on("focus.chosen",this.activate_field)},n.prototype.container_mousedown=function(e){var s;if(!this.is_disabled)return!e||"mousedown"!==(s=e.type)&&"touchstart"!==s||this.results_showing||e.preventDefault(),null!=e&&t(e.target).hasClass("search-choice-close")?void 0:(this.active_field?this.is_multiple||!e||t(e.target)[0]!==this.selected_item[0]&&!t(e.target).parents("a.chosen-single").length||(e.preventDefault(),this.results_toggle()):(this.is_multiple&&this.search_field.val(""),t(this.container[0].ownerDocument).on("click.chosen",this.click_test_action),this.results_show()),this.activate_field())},n.prototype.container_mouseup=function(t){if("ABBR"===t.target.nodeName&&!this.is_disabled)return this.results_reset(t)},n.prototype.search_results_mousewheel=function(t){var e;if(t.originalEvent&&(e=t.originalEvent.deltaY||-t.originalEvent.wheelDelta||t.originalEvent.detail),null!=e)return t.preventDefault(),"DOMMouseScroll"===t.type&&(e*=40),this.search_results.scrollTop(e+this.search_results.scrollTop())},n.prototype.blur_test=function(t){if(!this.active_field&&this.container.hasClass("chosen-container-active"))return this.close_field()},n.prototype.close_field=function(){return t(this.container[0].ownerDocument).off("click.chosen",this.click_test_action),this.active_field=!1,this.results_hide(),this.container.removeClass("chosen-container-active"),this.clear_backstroke(),this.show_search_field_default(),this.search_field_scale(),this.search_field.blur()},n.prototype.activate_field=function(){if(!this.is_disabled)return this.container.addClass("chosen-container-active"),this.active_field=!0,this.search_field.val(this.search_field.val()),this.search_field.focus()},n.prototype.test_active_click=function(e){var s;return(s=t(e.target).closest(".chosen-container")).length&&this.container[0]===s[0]?this.active_field=!0:this.close_field()},n.prototype.results_build=function(){return this.parsing=!0,this.selected_option_count=null,this.results_data=i.select_to_array(this.form_field),this.is_multiple?this.search_choices.find("li.search-choice").remove():this.is_multiple||(this.single_set_selected_text(),this.disable_search||this.form_field.options.length<=this.disable_search_threshold?(this.search_field[0].readOnly=!0,this.container.addClass("chosen-container-single-nosearch")):(this.search_field[0].readOnly=!1,this.container.removeClass("chosen-container-single-nosearch"))),this.update_results_content(this.results_option_build({first:!0})),this.search_field_disabled(),this.show_search_field_default(),this.search_field_scale(),this.parsing=!1},n.prototype.result_do_highlight=function(t){var e,s,i,n,r;if(t.length){if(this.result_clear_highlight(),this.result_highlight=t,this.result_highlight.addClass("highlighted"),i=parseInt(this.search_results.css("maxHeight"),10),r=this.search_results.scrollTop(),n=i+r,s=this.result_highlight.position().top+this.search_results.scrollTop(),(e=s+this.result_highlight.outerHeight())>=n)return this.search_results.scrollTop(e-i>0?e-i:0);if(s<r)return this.search_results.scrollTop(s)}},n.prototype.result_clear_highlight=function(){return this.result_highlight&&this.result_highlight.removeClass("highlighted"),this.result_highlight=null},n.prototype.results_show=function(){return this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple||this.search_container.append(this.search_field),this.container.addClass("chosen-with-drop"),this.results_showing=!0,this.search_field.focus(),this.search_field.val(this.get_search_field_value()),this.winnow_results(),this.form_field_jq.trigger("chosen:showing_dropdown",{chosen:this}))},n.prototype.update_results_content=function(t){return this.search_results.html(t)},n.prototype.results_hide=function(){return this.results_showing&&(this.result_clear_highlight(),this.is_multiple||(this.selected_item.prepend(this.search_field),this.search_field.focus()),this.container.removeClass("chosen-with-drop"),this.form_field_jq.trigger("chosen:hiding_dropdown",{chosen:this})),this.results_showing=!1},n.prototype.set_tab_index=function(t){var e;if(this.form_field.tabIndex)return e=this.form_field.tabIndex,this.form_field.tabIndex=-1,this.search_field[0].tabIndex=e},n.prototype.set_label_behavior=function(){if(this.form_field_label=this.form_field_jq.parents("label"),!this.form_field_label.length&&this.form_field.id.length&&(this.form_field_label=t("label[for='"+this.form_field.id+"']")),this.form_field_label.length>0)return this.form_field_label.on("click.chosen",this.label_click_handler)},n.prototype.show_search_field_default=function(){return this.is_multiple&&this.choices_count()<1&&!this.active_field?(this.search_field.val(this.default_text),this.search_field.addClass("default")):(this.search_field.val(""),this.search_field.removeClass("default"))},n.prototype.search_results_mouseup=function(e){var s;if((s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first()).length)return this.result_highlight=s,this.result_select(e),this.search_field.focus()},n.prototype.search_results_mouseover=function(e){var s;if(s=t(e.target).hasClass("active-result")?t(e.target):t(e.target).parents(".active-result").first())return this.result_do_highlight(s)},n.prototype.search_results_mouseout=function(e){if(t(e.target).hasClass("active-result")||t(e.target).parents(".active-result").first())return this.result_clear_highlight()},n.prototype.choice_build=function(e){var s,i;return s=t("<li />",{"class":"search-choice"}).html("<span>"+this.choice_label(e)+"</span>"),e.disabled?s.addClass("search-choice-disabled"):((i=t("<a />",{"class":"search-choice-close","data-option-array-index":e.array_index})).on("click.chosen",function(t){return function(e){return t.choice_destroy_link_click(e)}}(this)),s.append(i)),this.search_container.before(s)},n.prototype.choice_destroy_link_click=function(e){if(e.preventDefault(),e.stopPropagation(),!this.is_disabled)return this.choice_destroy(t(e.target))},n.prototype.choice_destroy=function(t){if(this.result_deselect(t[0].getAttribute("data-option-array-index")))return this.active_field?this.search_field.focus():this.show_search_field_default(),this.is_multiple&&this.choices_count()>0&&this.get_search_field_value().length<1&&this.results_hide(),t.parents("li").first().remove(),this.search_field_scale()},n.prototype.results_reset=function(){if(this.reset_single_select_options(),this.form_field.options[0].selected=!0,this.single_set_selected_text(),this.show_search_field_default(),this.results_reset_cleanup(),this.trigger_form_field_change(),this.active_field)return this.results_hide()},n.prototype.results_reset_cleanup=function(){return this.current_selectedIndex=this.form_field.selectedIndex,this.selected_item.find("abbr").remove()},n.prototype.result_select=function(t){var e,s;if(this.result_highlight)return e=this.result_highlight,this.result_clear_highlight(),this.is_multiple&&this.max_selected_options<=this.choices_count()?(this.form_field_jq.trigger("chosen:maxselected",{chosen:this}),!1):(this.is_multiple?e.removeClass("active-result"):this.reset_single_select_options(),e.addClass("result-selected"),s=this.results_data[e[0].getAttribute("data-option-array-index")],s.selected=!0,this.form_field.options[s.options_index].selected=!0,this.selected_option_count=null,this.search_field.val(""),this.is_multiple?this.choice_build(s):this.single_set_selected_text(this.choice_label(s)),this.is_multiple&&(!this.hide_results_on_select||t.metaKey||t.ctrlKey)?this.winnow_results():(this.results_hide(),this.show_search_field_default()),(this.is_multiple||this.form_field.selectedIndex!==this.current_selectedIndex)&&this.trigger_form_field_change({selected:this.form_field.options[s.options_index].value}),this.current_selectedIndex=this.form_field.selectedIndex,t.preventDefault(),this.search_field_scale())},n.prototype.single_set_selected_text=function(t){return null==t&&(t=this.default_text),t===this.default_text?this.selected_item.addClass("chosen-default"):(this.single_deselect_control_build(),this.selected_item.removeClass("chosen-default")),this.selected_item.find("span").html(t)},n.prototype.result_deselect=function(t){var e;return e=this.results_data[t],!this.form_field.options[e.options_index].disabled&&(e.selected=!1,this.form_field.options[e.options_index].selected=!1,this.selected_option_count=null,this.result_clear_highlight(),this.results_showing&&this.winnow_results(),this.trigger_form_field_change({deselected:this.form_field.options[e.options_index].value}),this.search_field_scale(),!0)},n.prototype.single_deselect_control_build=function(){if(this.allow_single_deselect)return this.selected_item.find("abbr").length||this.selected_item.find("span").first().after('<abbr class="search-choice-close"></abbr>'),this.selected_item.addClass("chosen-single-with-deselect")},n.prototype.get_search_field_value=function(){return this.search_field.val()},n.prototype.get_search_text=function(){return t.trim(this.get_search_field_value())},n.prototype.escape_html=function(e){return t("<div/>").text(e).html()},n.prototype.winnow_results_set_highlight=function(){var t,e;if(e=this.is_multiple?[]:this.search_results.find(".result-selected.active-result"),null!=(t=e.length?e.first():this.search_results.find(".active-result").first()))return this.result_do_highlight(t)},n.prototype.no_results=function(t){var e;return e=this.get_no_results_html(t),this.search_results.append(e),this.form_field_jq.trigger("chosen:no_results",{chosen:this})},n.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove()},n.prototype.keydown_arrow=function(){var t;return this.results_showing&&this.result_highlight?(t=this.result_highlight.nextAll("li.active-result").first())?this.result_do_highlight(t):void 0:this.results_show()},n.prototype.keyup_arrow=function(){var t;return this.results_showing||this.is_multiple?this.result_highlight?(t=this.result_highlight.prevAll("li.active-result")).length?this.result_do_highlight(t.first()):(this.choices_count()>0&&this.results_hide(),this.result_clear_highlight()):void 0:this.results_show()},n.prototype.keydown_backstroke=function(){var t;return this.pending_backstroke?(this.choice_destroy(this.pending_backstroke.find("a").first()),this.clear_backstroke()):(t=this.search_container.siblings("li.search-choice").last()).length&&!t.hasClass("search-choice-disabled")?(this.pending_backstroke=t,this.single_backstroke_delete?this.keydown_backstroke():this.pending_backstroke.addClass("search-choice-focus")):void 0},n.prototype.clear_backstroke=function(){return this.pending_backstroke&&this.pending_backstroke.removeClass("search-choice-focus"),this.pending_backstroke=null},n.prototype.search_field_scale=function(){var e,s,i,n,r,o,h;if(this.is_multiple){for(r={position:"absolute",left:"-1000px",top:"-1000px",display:"none",whiteSpace:"pre"},s=0,i=(o=["fontSize","fontStyle","fontWeight","fontFamily","lineHeight","textTransform","letterSpacing"]).length;s<i;s++)r[n=o[s]]=this.search_field.css(n);return(e=t("<div />").css(r)).text(this.get_search_field_value()),t("body").append(e),h=e.width()+25,e.remove(),this.container.is(":visible")&&(h=Math.min(this.container.outerWidth()-10,h)),this.search_field.width(h)}},n.prototype.trigger_form_field_change=function(t){return this.form_field_jq.trigger("input",t),this.form_field_jq.trigger("change",t)},n}()}).call(this);
@@ -0,0 +1,11 @@
1
+ /*!
2
+ Chosen, a Select Box Enhancer for jQuery and Prototype
3
+ by Patrick Filler for Harvest, http://getharvest.com
4
+
5
+ Version 1.8.3
6
+ Full source at https://github.com/harvesthq/chosen
7
+ Copyright (c) 2011-2018 Harvest http://getharvest.com
8
+
9
+ MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
10
+ This file is generated by `grunt build`, do not edit it by hand.
11
+ */.chosen-container{position:relative;display:inline-block;vertical-align:middle;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.chosen-container *{-webkit-box-sizing:border-box;box-sizing:border-box}.chosen-container .chosen-drop{position:absolute;top:100%;z-index:1010;width:100%;border:1px solid #aaa;border-top:0;background:#fff;-webkit-box-shadow:0 4px 5px rgba(0,0,0,.15);box-shadow:0 4px 5px rgba(0,0,0,.15);display:none}.chosen-container.chosen-with-drop .chosen-drop{display:block}.chosen-container a{cursor:pointer}.chosen-container .chosen-single .group-name,.chosen-container .search-choice .group-name{margin-right:4px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-weight:400;color:#999}.chosen-container .chosen-single .group-name:after,.chosen-container .search-choice .group-name:after{content:":";padding-left:2px;vertical-align:top}.chosen-container-single .chosen-single{position:relative;display:block;overflow:hidden;padding:0 0 0 8px;height:25px;border:1px solid #aaa;border-radius:5px;background-color:#fff;background:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#fff),color-stop(50%,#f6f6f6),color-stop(52%,#eee),to(#f4f4f4));background:linear-gradient(#fff 20%,#f6f6f6 50%,#eee 52%,#f4f4f4 100%);background-clip:padding-box;-webkit-box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);box-shadow:0 0 3px #fff inset,0 1px 1px rgba(0,0,0,.1);color:#444;text-decoration:none;white-space:nowrap;line-height:24px}.chosen-container-single .chosen-single input[type=text]{cursor:pointer;opacity:0;position:absolute}.chosen-container-single .chosen-default{color:#999}.chosen-container-single .chosen-single span{display:block;overflow:hidden;margin-right:26px;text-overflow:ellipsis;white-space:nowrap}.chosen-container-single .chosen-single-with-deselect span{margin-right:38px}.chosen-container-single .chosen-single abbr{position:absolute;top:6px;right:26px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-single .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single.chosen-disabled .chosen-single abbr:hover{background-position:-42px -10px}.chosen-container-single .chosen-single div{position:absolute;top:0;right:0;display:block;width:18px;height:100%}.chosen-container-single .chosen-single div b{display:block;width:100%;height:100%;background:url(chosen-sprite.png) no-repeat 0 2px}.chosen-container-single .chosen-search{position:relative;z-index:1010;margin:0;padding:3px 4px;white-space:nowrap}.chosen-container-single .chosen-search input[type=text]{margin:1px 0;padding:4px 20px 4px 5px;width:100%;height:auto;outline:0;border:1px solid #aaa;background:url(chosen-sprite.png) no-repeat 100% -20px;font-size:1em;font-family:sans-serif;line-height:normal;border-radius:0}.chosen-container-single .chosen-drop{margin-top:-1px;border-radius:0 0 4px 4px;background-clip:padding-box}.chosen-container-single.chosen-container-single-nosearch .chosen-search{position:absolute;clip:rect(0,0,0,0)}.chosen-container .chosen-results{color:#444;position:relative;overflow-x:hidden;overflow-y:auto;margin:0 4px 4px 0;padding:0 0 0 4px;max-height:240px;-webkit-overflow-scrolling:touch}.chosen-container .chosen-results li{display:none;margin:0;padding:5px 6px;list-style:none;line-height:15px;word-wrap:break-word;-webkit-touch-callout:none}.chosen-container .chosen-results li.active-result{display:list-item;cursor:pointer}.chosen-container .chosen-results li.disabled-result{display:list-item;color:#ccc;cursor:default}.chosen-container .chosen-results li.highlighted{background-color:#3875d7;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#3875d7),color-stop(90%,#2a62bc));background-image:linear-gradient(#3875d7 20%,#2a62bc 90%);color:#fff}.chosen-container .chosen-results li.no-results{color:#777;display:list-item;background:#f4f4f4}.chosen-container .chosen-results li.group-result{display:list-item;font-weight:700;cursor:default}.chosen-container .chosen-results li.group-option{padding-left:15px}.chosen-container .chosen-results li em{font-style:normal;text-decoration:underline}.chosen-container-multi .chosen-choices{position:relative;overflow:hidden;margin:0;padding:0 5px;width:100%;height:auto;border:1px solid #aaa;background-color:#fff;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(1%,#eee),color-stop(15%,#fff));background-image:linear-gradient(#eee 1%,#fff 15%);cursor:text}.chosen-container-multi .chosen-choices li{float:left;list-style:none}.chosen-container-multi .chosen-choices li.search-field{margin:0;padding:0;white-space:nowrap}.chosen-container-multi .chosen-choices li.search-field input[type=text]{margin:1px 0;padding:0;height:25px;outline:0;border:0!important;background:0 0!important;-webkit-box-shadow:none;box-shadow:none;color:#999;font-size:100%;font-family:sans-serif;line-height:normal;border-radius:0;width:25px}.chosen-container-multi .chosen-choices li.search-choice{position:relative;margin:3px 5px 3px 0;padding:3px 20px 3px 5px;border:1px solid #aaa;max-width:100%;border-radius:3px;background-color:#eee;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);background-size:100% 19px;background-repeat:repeat-x;background-clip:padding-box;-webkit-box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);box-shadow:0 0 2px #fff inset,0 1px 0 rgba(0,0,0,.05);color:#333;line-height:13px;cursor:default}.chosen-container-multi .chosen-choices li.search-choice span{word-wrap:break-word}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close{position:absolute;top:4px;right:3px;display:block;width:12px;height:12px;background:url(chosen-sprite.png) -42px 1px no-repeat;font-size:1px}.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover{background-position:-42px -10px}.chosen-container-multi .chosen-choices li.search-choice-disabled{padding-right:5px;border:1px solid #ccc;background-color:#e4e4e4;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#f4f4f4),color-stop(50%,#f0f0f0),color-stop(52%,#e8e8e8),to(#eee));background-image:linear-gradient(#f4f4f4 20%,#f0f0f0 50%,#e8e8e8 52%,#eee 100%);color:#666}.chosen-container-multi .chosen-choices li.search-choice-focus{background:#d4d4d4}.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close{background-position:-42px -10px}.chosen-container-multi .chosen-results{margin:0;padding:0}.chosen-container-multi .chosen-drop .result-selected{display:list-item;color:#ccc;cursor:default}.chosen-container-active .chosen-single{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active.chosen-with-drop .chosen-single{border:1px solid #aaa;border-bottom-right-radius:0;border-bottom-left-radius:0;background-image:-webkit-gradient(linear,left top,left bottom,color-stop(20%,#eee),color-stop(80%,#fff));background-image:linear-gradient(#eee 20%,#fff 80%);-webkit-box-shadow:0 1px 0 #fff inset;box-shadow:0 1px 0 #fff inset}.chosen-container-active.chosen-with-drop .chosen-single div{border-left:none;background:0 0}.chosen-container-active.chosen-with-drop .chosen-single div b{background-position:-18px 2px}.chosen-container-active .chosen-choices{border:1px solid #5897fb;-webkit-box-shadow:0 0 5px rgba(0,0,0,.3);box-shadow:0 0 5px rgba(0,0,0,.3)}.chosen-container-active .chosen-choices li.search-field input[type=text]{color:#222!important}.chosen-disabled{opacity:.5!important;cursor:default}.chosen-disabled .chosen-single{cursor:default}.chosen-disabled .chosen-choices .search-choice .search-choice-close{cursor:default}.chosen-rtl{text-align:right}.chosen-rtl .chosen-single{overflow:visible;padding:0 8px 0 0}.chosen-rtl .chosen-single span{margin-right:0;margin-left:26px;direction:rtl}.chosen-rtl .chosen-single-with-deselect span{margin-left:38px}.chosen-rtl .chosen-single div{right:auto;left:3px}.chosen-rtl .chosen-single abbr{right:auto;left:26px}.chosen-rtl .chosen-choices li{float:right}.chosen-rtl .chosen-choices li.search-field input[type=text]{direction:rtl}.chosen-rtl .chosen-choices li.search-choice{margin:3px 5px 3px 0;padding:3px 5px 3px 19px}.chosen-rtl .chosen-choices li.search-choice .search-choice-close{right:auto;left:4px}.chosen-rtl.chosen-container-single .chosen-results{margin:0 0 4px 4px;padding:0 4px 0 0}.chosen-rtl .chosen-results li.group-option{padding-right:15px;padding-left:0}.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div{border-right:none}.chosen-rtl .chosen-search input[type=text]{padding:4px 5px 4px 20px;background:url(chosen-sprite.png) no-repeat -30px -20px;direction:rtl}.chosen-rtl.chosen-container-single .chosen-single div b{background-position:6px 2px}.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b{background-position:-12px 2px}
@@ -0,0 +1,2051 @@
1
+ /*! version : 4.7.14
2
+ =========================================================
3
+ bootstrap-datetimejs
4
+ https://github.com/Eonasdan/bootstrap-datetimepicker
5
+ Copyright (c) 2015 Jonathan Peterson
6
+ =========================================================
7
+ */
8
+ /*
9
+ The MIT License (MIT)
10
+
11
+ Copyright (c) 2015 Jonathan Peterson
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in
21
+ all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29
+ THE SOFTWARE.
30
+ */
31
+ /*global define:false */
32
+ /*global exports:false */
33
+ /*global require:false */
34
+ /*global jQuery:false */
35
+ /*global moment:false */
36
+ (function (factory) {
37
+ 'use strict';
38
+ if (typeof define === 'function' && define.amd) {
39
+ // AMD is used - Register as an anonymous module.
40
+ define(['jquery', 'moment'], factory);
41
+ } else if (typeof exports === 'object') {
42
+ factory(require('jquery'), require('moment'));
43
+ } else {
44
+ // Neither AMD nor CommonJS used. Use global variables.
45
+ if (typeof jQuery === 'undefined') {
46
+ throw 'bootstrap-datetimepicker requires jQuery to be loaded first';
47
+ }
48
+ if (typeof moment === 'undefined') {
49
+ throw 'bootstrap-datetimepicker requires Moment.js to be loaded first';
50
+ }
51
+ factory(jQuery, moment);
52
+ }
53
+ }(function ($, moment) {
54
+ 'use strict';
55
+ if (!moment) {
56
+ throw new Error('bootstrap-datetimepicker requires Moment.js to be loaded first');
57
+ }
58
+
59
+ var dateTimePicker = function (element, options) {
60
+ var picker = {},
61
+ date = moment().startOf('d'),
62
+ viewDate = date.clone(),
63
+ unset = true,
64
+ input,
65
+ component = false,
66
+ widget = false,
67
+ use24Hours,
68
+ minViewModeNumber = 0,
69
+ actualFormat,
70
+ parseFormats,
71
+ currentViewMode,
72
+ datePickerModes = [
73
+ {
74
+ clsName: 'days',
75
+ navFnc: 'M',
76
+ navStep: 1
77
+ },
78
+ {
79
+ clsName: 'months',
80
+ navFnc: 'y',
81
+ navStep: 1
82
+ },
83
+ {
84
+ clsName: 'years',
85
+ navFnc: 'y',
86
+ navStep: 10
87
+ }
88
+ ],
89
+ viewModes = ['days', 'months', 'years'],
90
+ verticalModes = ['top', 'bottom', 'auto'],
91
+ horizontalModes = ['left', 'right', 'auto'],
92
+ toolbarPlacements = ['default', 'top', 'bottom'],
93
+ keyMap = {
94
+ 'up': 38,
95
+ 38: 'up',
96
+ 'down': 40,
97
+ 40: 'down',
98
+ 'left': 37,
99
+ 37: 'left',
100
+ 'right': 39,
101
+ 39: 'right',
102
+ 'tab': 9,
103
+ 9: 'tab',
104
+ 'escape': 27,
105
+ 27: 'escape',
106
+ 'enter': 13,
107
+ 13: 'enter',
108
+ 'pageUp': 33,
109
+ 33: 'pageUp',
110
+ 'pageDown': 34,
111
+ 34: 'pageDown',
112
+ 'shift': 16,
113
+ 16: 'shift',
114
+ 'control': 17,
115
+ 17: 'control',
116
+ 'space': 32,
117
+ 32: 'space',
118
+ 't': 84,
119
+ 84: 't',
120
+ 'delete': 46,
121
+ 46: 'delete'
122
+ },
123
+ keyState = {},
124
+
125
+ /********************************************************************************
126
+ *
127
+ * Private functions
128
+ *
129
+ ********************************************************************************/
130
+ isEnabled = function (granularity) {
131
+ if (typeof granularity !== 'string' || granularity.length > 1) {
132
+ throw new TypeError('isEnabled expects a single character string parameter');
133
+ }
134
+ switch (granularity) {
135
+ case 'y':
136
+ return actualFormat.indexOf('Y') !== -1;
137
+ case 'M':
138
+ return actualFormat.indexOf('M') !== -1;
139
+ case 'd':
140
+ return actualFormat.toLowerCase().indexOf('d') !== -1;
141
+ case 'h':
142
+ case 'H':
143
+ return actualFormat.toLowerCase().indexOf('h') !== -1;
144
+ case 'm':
145
+ return actualFormat.indexOf('m') !== -1;
146
+ case 's':
147
+ return actualFormat.indexOf('s') !== -1;
148
+ default:
149
+ return false;
150
+ }
151
+ },
152
+
153
+ hasTime = function () {
154
+ return (isEnabled('h') || isEnabled('m') || isEnabled('s'));
155
+ },
156
+
157
+ hasDate = function () {
158
+ return (isEnabled('y') || isEnabled('M') || isEnabled('d'));
159
+ },
160
+
161
+ getDatePickerTemplate = function () {
162
+ var headTemplate = $('<thead>')
163
+ .append($('<tr>')
164
+ .append($('<th>').addClass('prev').attr('data-action', 'previous')
165
+ .append($('<span>').addClass(options.icons.previous))
166
+ )
167
+ .append($('<th>').addClass('picker-switch').attr('data-action', 'pickerSwitch').attr('colspan', (options.calendarWeeks ? '6' : '5')))
168
+ .append($('<th>').addClass('next').attr('data-action', 'next')
169
+ .append($('<span>').addClass(options.icons.next))
170
+ )
171
+ ),
172
+ contTemplate = $('<tbody>')
173
+ .append($('<tr>')
174
+ .append($('<td>').attr('colspan', (options.calendarWeeks ? '8' : '7')))
175
+ );
176
+
177
+ return [
178
+ $('<div>').addClass('datepicker-days')
179
+ .append($('<table>').addClass('table-condensed')
180
+ .append(headTemplate)
181
+ .append($('<tbody>'))
182
+ ),
183
+ $('<div>').addClass('datepicker-months')
184
+ .append($('<table>').addClass('table-condensed')
185
+ .append(headTemplate.clone())
186
+ .append(contTemplate.clone())
187
+ ),
188
+ $('<div>').addClass('datepicker-years')
189
+ .append($('<table>').addClass('table-condensed')
190
+ .append(headTemplate.clone())
191
+ .append(contTemplate.clone())
192
+ )
193
+ ];
194
+ },
195
+
196
+ getTimePickerMainTemplate = function () {
197
+ var topRow = $('<tr>'),
198
+ middleRow = $('<tr>'),
199
+ bottomRow = $('<tr>');
200
+
201
+ if (isEnabled('h')) {
202
+ topRow.append($('<td>')
203
+ .append($('<a>').attr({href: '#', tabindex: '-1'}).addClass('btn').attr('data-action', 'incrementHours')
204
+ .append($('<span>').addClass(options.icons.up))));
205
+ middleRow.append($('<td>')
206
+ .append($('<span>').addClass('timepicker-hour').attr('data-time-component', 'hours').attr('data-action', 'showHours')));
207
+ bottomRow.append($('<td>')
208
+ .append($('<a>').attr({href: '#', tabindex: '-1'}).addClass('btn').attr('data-action', 'decrementHours')
209
+ .append($('<span>').addClass(options.icons.down))));
210
+ }
211
+ if (isEnabled('m')) {
212
+ if (isEnabled('h')) {
213
+ topRow.append($('<td>').addClass('separator'));
214
+ middleRow.append($('<td>').addClass('separator').html(':'));
215
+ bottomRow.append($('<td>').addClass('separator'));
216
+ }
217
+ topRow.append($('<td>')
218
+ .append($('<a>').attr({href: '#', tabindex: '-1'}).addClass('btn').attr('data-action', 'incrementMinutes')
219
+ .append($('<span>').addClass(options.icons.up))));
220
+ middleRow.append($('<td>')
221
+ .append($('<span>').addClass('timepicker-minute').attr('data-time-component', 'minutes').attr('data-action', 'showMinutes')));
222
+ bottomRow.append($('<td>')
223
+ .append($('<a>').attr({href: '#', tabindex: '-1'}).addClass('btn').attr('data-action', 'decrementMinutes')
224
+ .append($('<span>').addClass(options.icons.down))));
225
+ }
226
+ if (isEnabled('s')) {
227
+ if (isEnabled('m')) {
228
+ topRow.append($('<td>').addClass('separator'));
229
+ middleRow.append($('<td>').addClass('separator').html(':'));
230
+ bottomRow.append($('<td>').addClass('separator'));
231
+ }
232
+ topRow.append($('<td>')
233
+ .append($('<a>').attr({href: '#', tabindex: '-1'}).addClass('btn').attr('data-action', 'incrementSeconds')
234
+ .append($('<span>').addClass(options.icons.up))));
235
+ middleRow.append($('<td>')
236
+ .append($('<span>').addClass('timepicker-second').attr('data-time-component', 'seconds').attr('data-action', 'showSeconds')));
237
+ bottomRow.append($('<td>')
238
+ .append($('<a>').attr({href: '#', tabindex: '-1'}).addClass('btn').attr('data-action', 'decrementSeconds')
239
+ .append($('<span>').addClass(options.icons.down))));
240
+ }
241
+
242
+ if (!use24Hours) {
243
+ topRow.append($('<td>').addClass('separator'));
244
+ middleRow.append($('<td>')
245
+ .append($('<button>').addClass('btn btn-primary').attr('data-action', 'togglePeriod')));
246
+ bottomRow.append($('<td>').addClass('separator'));
247
+ }
248
+
249
+ return $('<div>').addClass('timepicker-picker')
250
+ .append($('<table>').addClass('table-condensed')
251
+ .append([topRow, middleRow, bottomRow]));
252
+ },
253
+
254
+ getTimePickerTemplate = function () {
255
+ var hoursView = $('<div>').addClass('timepicker-hours')
256
+ .append($('<table>').addClass('table-condensed')),
257
+ minutesView = $('<div>').addClass('timepicker-minutes')
258
+ .append($('<table>').addClass('table-condensed')),
259
+ secondsView = $('<div>').addClass('timepicker-seconds')
260
+ .append($('<table>').addClass('table-condensed')),
261
+ ret = [getTimePickerMainTemplate()];
262
+
263
+ if (isEnabled('h')) {
264
+ ret.push(hoursView);
265
+ }
266
+ if (isEnabled('m')) {
267
+ ret.push(minutesView);
268
+ }
269
+ if (isEnabled('s')) {
270
+ ret.push(secondsView);
271
+ }
272
+
273
+ return ret;
274
+ },
275
+
276
+ getToolbar = function () {
277
+ var row = [];
278
+ if (options.showTodayButton) {
279
+ row.push($('<td>').append($('<a>').attr('data-action', 'today').append($('<span>').addClass(options.icons.today))));
280
+ }
281
+ if (!options.sideBySide && hasDate() && hasTime()) {
282
+ row.push($('<td>').append($('<a>').attr('data-action', 'togglePicker').append($('<span>').addClass(options.icons.time))));
283
+ }
284
+ if (options.showClear) {
285
+ row.push($('<td>').append($('<a>').attr('data-action', 'clear').append($('<span>').addClass(options.icons.clear))));
286
+ }
287
+ if (options.showClose) {
288
+ row.push($('<td>').append($('<a>').attr('data-action', 'close').append($('<span>').addClass(options.icons.close))));
289
+ }
290
+ return $('<table>').addClass('table-condensed').append($('<tbody>').append($('<tr>').append(row)));
291
+ },
292
+
293
+ getTemplate = function () {
294
+ var template = $('<div>').addClass('bootstrap-datetimepicker-widget dropdown-menu'),
295
+ dateView = $('<div>').addClass('datepicker').append(getDatePickerTemplate()),
296
+ timeView = $('<div>').addClass('timepicker').append(getTimePickerTemplate()),
297
+ content = $('<ul>').addClass('list-unstyled'),
298
+ toolbar = $('<li>').addClass('picker-switch' + (options.collapse ? ' accordion-toggle' : '')).append(getToolbar());
299
+
300
+ if (options.inline) {
301
+ template.removeClass('dropdown-menu');
302
+ }
303
+
304
+ if (use24Hours) {
305
+ template.addClass('usetwentyfour');
306
+ }
307
+ if (options.sideBySide && hasDate() && hasTime()) {
308
+ template.addClass('timepicker-sbs');
309
+ template.append(
310
+ $('<div>').addClass('row')
311
+ .append(dateView.addClass('col-sm-6'))
312
+ .append(timeView.addClass('col-sm-6'))
313
+ );
314
+ template.append(toolbar);
315
+ return template;
316
+ }
317
+
318
+ if (options.toolbarPlacement === 'top') {
319
+ content.append(toolbar);
320
+ }
321
+ if (hasDate()) {
322
+ content.append($('<li>').addClass((options.collapse && hasTime() ? 'collapse in' : '')).append(dateView));
323
+ }
324
+ if (options.toolbarPlacement === 'default') {
325
+ content.append(toolbar);
326
+ }
327
+ if (hasTime()) {
328
+ content.append($('<li>').addClass((options.collapse && hasDate() ? 'collapse' : '')).append(timeView));
329
+ }
330
+ if (options.toolbarPlacement === 'bottom') {
331
+ content.append(toolbar);
332
+ }
333
+ return template.append(content);
334
+ },
335
+
336
+ dataToOptions = function () {
337
+ var eData,
338
+ dataOptions = {};
339
+
340
+ if (element.is('input') || options.inline) {
341
+ eData = element.data();
342
+ } else {
343
+ eData = element.find('input').data();
344
+ }
345
+
346
+ if (eData.dateOptions && eData.dateOptions instanceof Object) {
347
+ dataOptions = $.extend(true, dataOptions, eData.dateOptions);
348
+ }
349
+
350
+ $.each(options, function (key) {
351
+ var attributeName = 'date' + key.charAt(0).toUpperCase() + key.slice(1);
352
+ if (eData[attributeName] !== undefined) {
353
+ dataOptions[key] = eData[attributeName];
354
+ }
355
+ });
356
+ return dataOptions;
357
+ },
358
+
359
+ place = function () {
360
+ var position = (component || element).position(),
361
+ offset = (component || element).offset(),
362
+ vertical = options.widgetPositioning.vertical,
363
+ horizontal = options.widgetPositioning.horizontal,
364
+ parent;
365
+
366
+ if (options.widgetParent) {
367
+ parent = options.widgetParent.append(widget);
368
+ } else if (element.is('input')) {
369
+ parent = element.parent().append(widget);
370
+ } else if (options.inline) {
371
+ parent = element.append(widget);
372
+ return;
373
+ } else {
374
+ parent = element;
375
+ element.children().first().after(widget);
376
+ }
377
+
378
+ // Top and bottom logic
379
+ if (vertical === 'auto') {
380
+ if (offset.top + widget.height() * 1.5 >= $(window).height() + $(window).scrollTop() &&
381
+ widget.height() + element.outerHeight() < offset.top) {
382
+ vertical = 'top';
383
+ } else {
384
+ vertical = 'bottom';
385
+ }
386
+ }
387
+
388
+ // Left and right logic
389
+ if (horizontal === 'auto') {
390
+ if (parent.width() < offset.left + widget.outerWidth() / 2 &&
391
+ offset.left + widget.outerWidth() > $(window).width()) {
392
+ horizontal = 'right';
393
+ } else {
394
+ horizontal = 'left';
395
+ }
396
+ }
397
+
398
+ if (vertical === 'top') {
399
+ widget.addClass('top').removeClass('bottom');
400
+ } else {
401
+ widget.addClass('bottom').removeClass('top');
402
+ }
403
+
404
+ if (horizontal === 'right') {
405
+ widget.addClass('pull-right');
406
+ } else {
407
+ widget.removeClass('pull-right');
408
+ }
409
+
410
+ // find the first parent element that has a relative css positioning
411
+ if (parent.css('position') !== 'relative') {
412
+ parent = parent.parents().filter(function () {
413
+ return $(this).css('position') === 'relative';
414
+ }).first();
415
+ }
416
+
417
+ if (parent.length === 0) {
418
+ throw new Error('datetimepicker component should be placed within a relative positioned container');
419
+ }
420
+
421
+ widget.css({
422
+ top: vertical === 'top' ? 'auto' : position.top + element.outerHeight(),
423
+ bottom: vertical === 'top' ? position.top + element.outerHeight() : 'auto',
424
+ left: horizontal === 'left' ? parent.css('padding-left') : 'auto',
425
+ right: horizontal === 'left' ? 'auto' : parent.width() - element.outerWidth()
426
+ });
427
+ },
428
+
429
+ notifyEvent = function (e) {
430
+ if (e.type === 'dp.change' && ((e.date && e.date.isSame(e.oldDate)) || (!e.date && !e.oldDate))) {
431
+ return;
432
+ }
433
+ element.trigger(e);
434
+ },
435
+
436
+ showMode = function (dir) {
437
+ if (!widget) {
438
+ return;
439
+ }
440
+ if (dir) {
441
+ currentViewMode = Math.max(minViewModeNumber, Math.min(2, currentViewMode + dir));
442
+ }
443
+ widget.find('.datepicker > div').hide().filter('.datepicker-' + datePickerModes[currentViewMode].clsName).show();
444
+ },
445
+
446
+ fillDow = function () {
447
+ var row = $('<tr>'),
448
+ currentDate = viewDate.clone().startOf('w');
449
+
450
+ if (options.calendarWeeks === true) {
451
+ row.append($('<th>').addClass('cw').text('#'));
452
+ }
453
+
454
+ while (currentDate.isBefore(viewDate.clone().endOf('w'))) {
455
+ row.append($('<th>').addClass('dow').text(currentDate.format('dd')));
456
+ currentDate.add(1, 'd');
457
+ }
458
+ widget.find('.datepicker-days thead').append(row);
459
+ },
460
+
461
+ isInDisabledDates = function (testDate) {
462
+ return options.disabledDates[testDate.format('YYYY-MM-DD')] === true;
463
+ },
464
+
465
+ isInEnabledDates = function (testDate) {
466
+ return options.enabledDates[testDate.format('YYYY-MM-DD')] === true;
467
+ },
468
+
469
+ isValid = function (targetMoment, granularity) {
470
+ if (!targetMoment.isValid()) {
471
+ return false;
472
+ }
473
+ if (options.disabledDates && isInDisabledDates(targetMoment) && granularity !== 'M') {
474
+ return false;
475
+ }
476
+ if (options.enabledDates && !isInEnabledDates(targetMoment) && granularity !== 'M') {
477
+ return false;
478
+ }
479
+ if (options.minDate && targetMoment.isBefore(options.minDate, granularity)) {
480
+ return false;
481
+ }
482
+ if (options.maxDate && targetMoment.isAfter(options.maxDate, granularity)) {
483
+ return false;
484
+ }
485
+ if (granularity === 'd' && options.daysOfWeekDisabled.indexOf(targetMoment.day()) !== -1) { //widget && widget.find('.datepicker-days').length > 0
486
+ return false;
487
+ }
488
+ return true;
489
+ },
490
+
491
+ fillMonths = function () {
492
+ var spans = [],
493
+ monthsShort = viewDate.clone().startOf('y').hour(12); // hour is changed to avoid DST issues in some browsers
494
+ while (monthsShort.isSame(viewDate, 'y')) {
495
+ spans.push($('<span>').attr('data-action', 'selectMonth').addClass('month').text(monthsShort.format('MMM')));
496
+ monthsShort.add(1, 'M');
497
+ }
498
+ widget.find('.datepicker-months td').empty().append(spans);
499
+ },
500
+
501
+ updateMonths = function () {
502
+ var monthsView = widget.find('.datepicker-months'),
503
+ monthsViewHeader = monthsView.find('th'),
504
+ months = monthsView.find('tbody').find('span');
505
+
506
+ monthsView.find('.disabled').removeClass('disabled');
507
+
508
+ if (!isValid(viewDate.clone().subtract(1, 'y'), 'y')) {
509
+ monthsViewHeader.eq(0).addClass('disabled');
510
+ }
511
+
512
+ monthsViewHeader.eq(1).text(viewDate.year());
513
+
514
+ if (!isValid(viewDate.clone().add(1, 'y'), 'y')) {
515
+ monthsViewHeader.eq(2).addClass('disabled');
516
+ }
517
+
518
+ months.removeClass('active');
519
+ if (date.isSame(viewDate, 'y')) {
520
+ months.eq(date.month()).addClass('active');
521
+ }
522
+
523
+ months.each(function (index) {
524
+ if (!isValid(viewDate.clone().month(index), 'M')) {
525
+ $(this).addClass('disabled');
526
+ }
527
+ });
528
+ },
529
+
530
+ updateYears = function () {
531
+ var yearsView = widget.find('.datepicker-years'),
532
+ yearsViewHeader = yearsView.find('th'),
533
+ startYear = viewDate.clone().subtract(5, 'y'),
534
+ endYear = viewDate.clone().add(6, 'y'),
535
+ html = '';
536
+
537
+ yearsView.find('.disabled').removeClass('disabled');
538
+
539
+ if (options.minDate && options.minDate.isAfter(startYear, 'y')) {
540
+ yearsViewHeader.eq(0).addClass('disabled');
541
+ }
542
+
543
+ yearsViewHeader.eq(1).text(startYear.year() + '-' + endYear.year());
544
+
545
+ if (options.maxDate && options.maxDate.isBefore(endYear, 'y')) {
546
+ yearsViewHeader.eq(2).addClass('disabled');
547
+ }
548
+
549
+ while (!startYear.isAfter(endYear, 'y')) {
550
+ html += '<span data-action="selectYear" class="year' + (startYear.isSame(date, 'y') ? ' active' : '') + (!isValid(startYear, 'y') ? ' disabled' : '') + '">' + startYear.year() + '</span>';
551
+ startYear.add(1, 'y');
552
+ }
553
+
554
+ yearsView.find('td').html(html);
555
+ },
556
+
557
+ fillDate = function () {
558
+ var daysView = widget.find('.datepicker-days'),
559
+ daysViewHeader = daysView.find('th'),
560
+ currentDate,
561
+ html = [],
562
+ row,
563
+ clsName;
564
+
565
+ if (!hasDate()) {
566
+ return;
567
+ }
568
+
569
+ daysView.find('.disabled').removeClass('disabled');
570
+ daysViewHeader.eq(1).text(viewDate.format(options.dayViewHeaderFormat));
571
+
572
+ if (!isValid(viewDate.clone().subtract(1, 'M'), 'M')) {
573
+ daysViewHeader.eq(0).addClass('disabled');
574
+ }
575
+ if (!isValid(viewDate.clone().add(1, 'M'), 'M')) {
576
+ daysViewHeader.eq(2).addClass('disabled');
577
+ }
578
+
579
+ currentDate = viewDate.clone().startOf('M').startOf('week');
580
+
581
+ while (!viewDate.clone().endOf('M').endOf('w').isBefore(currentDate, 'd')) {
582
+ if (currentDate.weekday() === 0) {
583
+ row = $('<tr>');
584
+ if (options.calendarWeeks) {
585
+ row.append('<td class="cw">' + currentDate.week() + '</td>');
586
+ }
587
+ html.push(row);
588
+ }
589
+ clsName = '';
590
+ if (currentDate.isBefore(viewDate, 'M')) {
591
+ clsName += ' old';
592
+ }
593
+ if (currentDate.isAfter(viewDate, 'M')) {
594
+ clsName += ' new';
595
+ }
596
+ if (currentDate.isSame(date, 'd') && !unset) {
597
+ clsName += ' active';
598
+ }
599
+ if (!isValid(currentDate, 'd')) {
600
+ clsName += ' disabled';
601
+ }
602
+ if (currentDate.isSame(moment(), 'd')) {
603
+ clsName += ' today';
604
+ }
605
+ if (currentDate.day() === 0 || currentDate.day() === 6) {
606
+ clsName += ' weekend';
607
+ }
608
+ row.append('<td data-action="selectDay" class="day' + clsName + '">' + currentDate.date() + '</td>');
609
+ currentDate.add(1, 'd');
610
+ }
611
+
612
+ daysView.find('tbody').empty().append(html);
613
+
614
+ updateMonths();
615
+
616
+ updateYears();
617
+ },
618
+
619
+ fillHours = function () {
620
+ var table = widget.find('.timepicker-hours table'),
621
+ currentHour = viewDate.clone().startOf('d'),
622
+ html = [],
623
+ row = $('<tr>');
624
+
625
+ if (viewDate.hour() > 11 && !use24Hours) {
626
+ currentHour.hour(12);
627
+ }
628
+ while (currentHour.isSame(viewDate, 'd') && (use24Hours || (viewDate.hour() < 12 && currentHour.hour() < 12) || viewDate.hour() > 11)) {
629
+ if (currentHour.hour() % 4 === 0) {
630
+ row = $('<tr>');
631
+ html.push(row);
632
+ }
633
+ row.append('<td data-action="selectHour" class="hour' + (!isValid(currentHour, 'h') ? ' disabled' : '') + '">' + currentHour.format(use24Hours ? 'HH' : 'hh') + '</td>');
634
+ currentHour.add(1, 'h');
635
+ }
636
+ table.empty().append(html);
637
+ },
638
+
639
+ fillMinutes = function () {
640
+ var table = widget.find('.timepicker-minutes table'),
641
+ currentMinute = viewDate.clone().startOf('h'),
642
+ html = [],
643
+ row = $('<tr>'),
644
+ step = options.stepping === 1 ? 5 : options.stepping;
645
+
646
+ while (viewDate.isSame(currentMinute, 'h')) {
647
+ if (currentMinute.minute() % (step * 4) === 0) {
648
+ row = $('<tr>');
649
+ html.push(row);
650
+ }
651
+ row.append('<td data-action="selectMinute" class="minute' + (!isValid(currentMinute, 'm') ? ' disabled' : '') + '">' + currentMinute.format('mm') + '</td>');
652
+ currentMinute.add(step, 'm');
653
+ }
654
+ table.empty().append(html);
655
+ },
656
+
657
+ fillSeconds = function () {
658
+ var table = widget.find('.timepicker-seconds table'),
659
+ currentSecond = viewDate.clone().startOf('m'),
660
+ html = [],
661
+ row = $('<tr>');
662
+
663
+ while (viewDate.isSame(currentSecond, 'm')) {
664
+ if (currentSecond.second() % 20 === 0) {
665
+ row = $('<tr>');
666
+ html.push(row);
667
+ }
668
+ row.append('<td data-action="selectSecond" class="second' + (!isValid(currentSecond, 's') ? ' disabled' : '') + '">' + currentSecond.format('ss') + '</td>');
669
+ currentSecond.add(5, 's');
670
+ }
671
+
672
+ table.empty().append(html);
673
+ },
674
+
675
+ fillTime = function () {
676
+ var timeComponents = widget.find('.timepicker span[data-time-component]');
677
+ if (!use24Hours) {
678
+ widget.find('.timepicker [data-action=togglePeriod]').text(date.format('A'));
679
+ }
680
+ timeComponents.filter('[data-time-component=hours]').text(date.format(use24Hours ? 'HH' : 'hh'));
681
+ timeComponents.filter('[data-time-component=minutes]').text(date.format('mm'));
682
+ timeComponents.filter('[data-time-component=seconds]').text(date.format('ss'));
683
+
684
+ fillHours();
685
+ fillMinutes();
686
+ fillSeconds();
687
+ },
688
+
689
+ update = function () {
690
+ if (!widget) {
691
+ return;
692
+ }
693
+ fillDate();
694
+ fillTime();
695
+ },
696
+
697
+ setValue = function (targetMoment) {
698
+ var oldDate = unset ? null : date;
699
+
700
+ // case of calling setValue(null or false)
701
+ if (!targetMoment) {
702
+ unset = true;
703
+ input.val('');
704
+ element.data('date', '');
705
+ notifyEvent({
706
+ type: 'dp.change',
707
+ date: null,
708
+ oldDate: oldDate
709
+ });
710
+ update();
711
+ return;
712
+ }
713
+
714
+ targetMoment = targetMoment.clone().locale(options.locale);
715
+
716
+ if (options.stepping !== 1) {
717
+ targetMoment.minutes((Math.round(targetMoment.minutes() / options.stepping) * options.stepping) % 60).seconds(0);
718
+ }
719
+
720
+ if (isValid(targetMoment)) {
721
+ date = targetMoment;
722
+ viewDate = date.clone();
723
+ input.val(date.format(actualFormat));
724
+ element.data('date', date.format(actualFormat));
725
+ update();
726
+ unset = false;
727
+ notifyEvent({
728
+ type: 'dp.change',
729
+ date: date.clone(),
730
+ oldDate: oldDate
731
+ });
732
+ } else {
733
+ if (!options.keepInvalid) {
734
+ input.val(unset ? '' : date.format(actualFormat));
735
+ }
736
+ notifyEvent({
737
+ type: 'dp.error',
738
+ date: targetMoment
739
+ });
740
+ }
741
+ },
742
+
743
+ hide = function () {
744
+ var transitioning = false;
745
+ if (!widget) {
746
+ return picker;
747
+ }
748
+ // Ignore event if in the middle of a picker transition
749
+ widget.find('.collapse').each(function () {
750
+ var collapseData = $(this).data('collapse');
751
+ if (collapseData && collapseData.transitioning) {
752
+ transitioning = true;
753
+ return false;
754
+ }
755
+ return true;
756
+ });
757
+ if (transitioning) {
758
+ return picker;
759
+ }
760
+ if (component && component.hasClass('btn')) {
761
+ component.toggleClass('active');
762
+ }
763
+ widget.hide();
764
+
765
+ $(window).off('resize', place);
766
+ widget.off('click', '[data-action]');
767
+ widget.off('mousedown', false);
768
+
769
+ widget.remove();
770
+ widget = false;
771
+
772
+ notifyEvent({
773
+ type: 'dp.hide',
774
+ date: date.clone()
775
+ });
776
+ return picker;
777
+ },
778
+
779
+ clear = function () {
780
+ setValue(null);
781
+ },
782
+
783
+ /********************************************************************************
784
+ *
785
+ * Widget UI interaction functions
786
+ *
787
+ ********************************************************************************/
788
+ actions = {
789
+ next: function () {
790
+ viewDate.add(datePickerModes[currentViewMode].navStep, datePickerModes[currentViewMode].navFnc);
791
+ fillDate();
792
+ },
793
+
794
+ previous: function () {
795
+ viewDate.subtract(datePickerModes[currentViewMode].navStep, datePickerModes[currentViewMode].navFnc);
796
+ fillDate();
797
+ },
798
+
799
+ pickerSwitch: function () {
800
+ showMode(1);
801
+ },
802
+
803
+ selectMonth: function (e) {
804
+ var month = $(e.target).closest('tbody').find('span').index($(e.target));
805
+ viewDate.month(month);
806
+ if (currentViewMode === minViewModeNumber) {
807
+ setValue(date.clone().year(viewDate.year()).month(viewDate.month()));
808
+ if (!options.inline) {
809
+ hide();
810
+ }
811
+ } else {
812
+ showMode(-1);
813
+ fillDate();
814
+ }
815
+ },
816
+
817
+ selectYear: function (e) {
818
+ var year = parseInt($(e.target).text(), 10) || 0;
819
+ viewDate.year(year);
820
+ if (currentViewMode === minViewModeNumber) {
821
+ setValue(date.clone().year(viewDate.year()));
822
+ if (!options.inline) {
823
+ hide();
824
+ }
825
+ } else {
826
+ showMode(-1);
827
+ fillDate();
828
+ }
829
+ },
830
+
831
+ selectDay: function (e) {
832
+ var day = viewDate.clone();
833
+ if ($(e.target).is('.old')) {
834
+ day.subtract(1, 'M');
835
+ }
836
+ if ($(e.target).is('.new')) {
837
+ day.add(1, 'M');
838
+ }
839
+ setValue(day.date(parseInt($(e.target).text(), 10)));
840
+ if (!hasTime() && !options.keepOpen && !options.inline) {
841
+ hide();
842
+ }
843
+ },
844
+
845
+ incrementHours: function () {
846
+ setValue(date.clone().add(1, 'h'));
847
+ },
848
+
849
+ incrementMinutes: function () {
850
+ setValue(date.clone().add(options.stepping, 'm'));
851
+ },
852
+
853
+ incrementSeconds: function () {
854
+ setValue(date.clone().add(1, 's'));
855
+ },
856
+
857
+ decrementHours: function () {
858
+ setValue(date.clone().subtract(1, 'h'));
859
+ },
860
+
861
+ decrementMinutes: function () {
862
+ setValue(date.clone().subtract(options.stepping, 'm'));
863
+ },
864
+
865
+ decrementSeconds: function () {
866
+ setValue(date.clone().subtract(1, 's'));
867
+ },
868
+
869
+ togglePeriod: function () {
870
+ setValue(date.clone().add((date.hours() >= 12) ? -12 : 12, 'h'));
871
+ },
872
+
873
+ togglePicker: function (e) {
874
+ var $this = $(e.target),
875
+ $parent = $this.closest('ul'),
876
+ expanded = $parent.find('.in'),
877
+ closed = $parent.find('.collapse:not(.in)'),
878
+ collapseData;
879
+
880
+ if (expanded && expanded.length) {
881
+ collapseData = expanded.data('collapse');
882
+ if (collapseData && collapseData.transitioning) {
883
+ return;
884
+ }
885
+ if (expanded.collapse) { // if collapse plugin is available through bootstrap.js then use it
886
+ expanded.collapse('hide');
887
+ closed.collapse('show');
888
+ } else { // otherwise just toggle in class on the two views
889
+ expanded.removeClass('in');
890
+ closed.addClass('in');
891
+ }
892
+ if ($this.is('span')) {
893
+ $this.toggleClass(options.icons.time + ' ' + options.icons.date);
894
+ } else {
895
+ $this.find('span').toggleClass(options.icons.time + ' ' + options.icons.date);
896
+ }
897
+
898
+ // NOTE: uncomment if toggled state will be restored in show()
899
+ //if (component) {
900
+ // component.find('span').toggleClass(options.icons.time + ' ' + options.icons.date);
901
+ //}
902
+ }
903
+ },
904
+
905
+ showPicker: function () {
906
+ widget.find('.timepicker > div:not(.timepicker-picker)').hide();
907
+ widget.find('.timepicker .timepicker-picker').show();
908
+ },
909
+
910
+ showHours: function () {
911
+ widget.find('.timepicker .timepicker-picker').hide();
912
+ widget.find('.timepicker .timepicker-hours').show();
913
+ },
914
+
915
+ showMinutes: function () {
916
+ widget.find('.timepicker .timepicker-picker').hide();
917
+ widget.find('.timepicker .timepicker-minutes').show();
918
+ },
919
+
920
+ showSeconds: function () {
921
+ widget.find('.timepicker .timepicker-picker').hide();
922
+ widget.find('.timepicker .timepicker-seconds').show();
923
+ },
924
+
925
+ selectHour: function (e) {
926
+ var hour = parseInt($(e.target).text(), 10);
927
+
928
+ if (!use24Hours) {
929
+ if (date.hours() >= 12) {
930
+ if (hour !== 12) {
931
+ hour += 12;
932
+ }
933
+ } else {
934
+ if (hour === 12) {
935
+ hour = 0;
936
+ }
937
+ }
938
+ }
939
+ setValue(date.clone().hours(hour));
940
+ actions.showPicker.call(picker);
941
+ },
942
+
943
+ selectMinute: function (e) {
944
+ setValue(date.clone().minutes(parseInt($(e.target).text(), 10)));
945
+ actions.showPicker.call(picker);
946
+ },
947
+
948
+ selectSecond: function (e) {
949
+ setValue(date.clone().seconds(parseInt($(e.target).text(), 10)));
950
+ actions.showPicker.call(picker);
951
+ },
952
+
953
+ clear: clear,
954
+
955
+ today: function () {
956
+ setValue(moment());
957
+ },
958
+
959
+ close: hide
960
+ },
961
+
962
+ doAction = function (e) {
963
+ if ($(e.currentTarget).is('.disabled')) {
964
+ return false;
965
+ }
966
+ actions[$(e.currentTarget).data('action')].apply(picker, arguments);
967
+ return false;
968
+ },
969
+
970
+ show = function () {
971
+ var currentMoment,
972
+ useCurrentGranularity = {
973
+ 'year': function (m) {
974
+ return m.month(0).date(1).hours(0).seconds(0).minutes(0);
975
+ },
976
+ 'month': function (m) {
977
+ return m.date(1).hours(0).seconds(0).minutes(0);
978
+ },
979
+ 'day': function (m) {
980
+ return m.hours(0).seconds(0).minutes(0);
981
+ },
982
+ 'hour': function (m) {
983
+ return m.seconds(0).minutes(0);
984
+ },
985
+ 'minute': function (m) {
986
+ return m.seconds(0);
987
+ }
988
+ };
989
+
990
+ if (input.prop('disabled') || (!options.ignoreReadonly && input.prop('readonly')) || widget) {
991
+ return picker;
992
+ }
993
+ if (options.useCurrent && unset && ((input.is('input') && input.val().trim().length === 0) || options.inline)) {
994
+ currentMoment = moment();
995
+ if (typeof options.useCurrent === 'string') {
996
+ currentMoment = useCurrentGranularity[options.useCurrent](currentMoment);
997
+ }
998
+ setValue(currentMoment);
999
+ }
1000
+
1001
+ widget = getTemplate();
1002
+
1003
+ fillDow();
1004
+ fillMonths();
1005
+
1006
+ widget.find('.timepicker-hours').hide();
1007
+ widget.find('.timepicker-minutes').hide();
1008
+ widget.find('.timepicker-seconds').hide();
1009
+
1010
+ update();
1011
+ showMode();
1012
+
1013
+ $(window).on('resize', place);
1014
+ widget.on('click', '[data-action]', doAction); // this handles clicks on the widget
1015
+ widget.on('mousedown', false);
1016
+
1017
+ if (component && component.hasClass('btn')) {
1018
+ component.toggleClass('active');
1019
+ }
1020
+ widget.show();
1021
+ place();
1022
+
1023
+ if (!input.is(':focus')) {
1024
+ input.focus();
1025
+ }
1026
+
1027
+ notifyEvent({
1028
+ type: 'dp.show'
1029
+ });
1030
+ return picker;
1031
+ },
1032
+
1033
+ toggle = function () {
1034
+ return (widget ? hide() : show());
1035
+ },
1036
+
1037
+ parseInputDate = function (inputDate) {
1038
+ if (moment.isMoment(inputDate) || inputDate instanceof Date) {
1039
+ inputDate = moment(inputDate);
1040
+ } else {
1041
+ inputDate = moment(inputDate, parseFormats, options.useStrict);
1042
+ }
1043
+ inputDate.locale(options.locale);
1044
+ return inputDate;
1045
+ },
1046
+
1047
+ keydown = function (e) {
1048
+ //if (e.keyCode === 27 && widget) { // allow escape to hide picker
1049
+ // hide();
1050
+ // return false;
1051
+ //}
1052
+ //if (e.keyCode === 40 && !widget) { // allow down to show picker
1053
+ // show();
1054
+ // e.preventDefault();
1055
+ //}
1056
+ //return true;
1057
+
1058
+ var handler = null,
1059
+ index,
1060
+ index2,
1061
+ pressedKeys = [],
1062
+ pressedModifiers = {},
1063
+ currentKey = e.which,
1064
+ keyBindKeys,
1065
+ allModifiersPressed,
1066
+ pressed = 'p';
1067
+
1068
+ keyState[currentKey] = pressed;
1069
+
1070
+ for (index in keyState) {
1071
+ if (keyState.hasOwnProperty(index) && keyState[index] === pressed) {
1072
+ pressedKeys.push(index);
1073
+ if (parseInt(index, 10) !== currentKey) {
1074
+ pressedModifiers[index] = true;
1075
+ }
1076
+ }
1077
+ }
1078
+
1079
+ for (index in options.keyBinds) {
1080
+ if (options.keyBinds.hasOwnProperty(index) && typeof (options.keyBinds[index]) === 'function') {
1081
+ keyBindKeys = index.split(' ');
1082
+ if (keyBindKeys.length === pressedKeys.length && keyMap[currentKey] === keyBindKeys[keyBindKeys.length - 1]) {
1083
+ allModifiersPressed = true;
1084
+ for (index2 = keyBindKeys.length - 2; index2 >= 0; index2--) {
1085
+ if (!(keyMap[keyBindKeys[index2]] in pressedModifiers)) {
1086
+ allModifiersPressed = false;
1087
+ break;
1088
+ }
1089
+ }
1090
+ if (allModifiersPressed) {
1091
+ handler = options.keyBinds[index];
1092
+ break;
1093
+ }
1094
+ }
1095
+ }
1096
+ }
1097
+
1098
+ if (handler) {
1099
+ handler.call(picker, widget);
1100
+ e.stopPropagation();
1101
+ e.preventDefault();
1102
+ }
1103
+ },
1104
+
1105
+ keyup = function (e) {
1106
+ keyState[e.which] = 'r';
1107
+ e.stopPropagation();
1108
+ e.preventDefault();
1109
+ },
1110
+
1111
+ change = function (e) {
1112
+ var val = $(e.target).val().trim(),
1113
+ parsedDate = val ? parseInputDate(val) : null;
1114
+ setValue(parsedDate);
1115
+ e.stopImmediatePropagation();
1116
+ return false;
1117
+ },
1118
+
1119
+ attachDatePickerElementEvents = function () {
1120
+ input.on({
1121
+ 'change': change,
1122
+ 'blur': options.debug ? '' : hide,
1123
+ 'keydown': keydown,
1124
+ 'keyup': keyup
1125
+ });
1126
+
1127
+ if (element.is('input')) {
1128
+ input.on({
1129
+ 'focus': show
1130
+ });
1131
+ } else if (component) {
1132
+ component.on('click', toggle);
1133
+ component.on('mousedown', false);
1134
+ }
1135
+ },
1136
+
1137
+ detachDatePickerElementEvents = function () {
1138
+ input.off({
1139
+ 'change': change,
1140
+ 'blur': hide,
1141
+ 'keydown': keydown,
1142
+ 'keyup': keyup
1143
+ });
1144
+
1145
+ if (element.is('input')) {
1146
+ input.off({
1147
+ 'focus': show
1148
+ });
1149
+ } else if (component) {
1150
+ component.off('click', toggle);
1151
+ component.off('mousedown', false);
1152
+ }
1153
+ },
1154
+
1155
+ indexGivenDates = function (givenDatesArray) {
1156
+ // Store given enabledDates and disabledDates as keys.
1157
+ // This way we can check their existence in O(1) time instead of looping through whole array.
1158
+ // (for example: options.enabledDates['2014-02-27'] === true)
1159
+ var givenDatesIndexed = {};
1160
+ $.each(givenDatesArray, function () {
1161
+ var dDate = parseInputDate(this);
1162
+ if (dDate.isValid()) {
1163
+ givenDatesIndexed[dDate.format('YYYY-MM-DD')] = true;
1164
+ }
1165
+ });
1166
+ return (Object.keys(givenDatesIndexed).length) ? givenDatesIndexed : false;
1167
+ },
1168
+
1169
+ initFormatting = function () {
1170
+ var format = options.format || 'L LT';
1171
+
1172
+ actualFormat = format.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput) {
1173
+ var newinput = date.localeData().longDateFormat(formatInput) || formatInput;
1174
+ return newinput.replace(/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, function (formatInput2) { //temp fix for #740
1175
+ return date.localeData().longDateFormat(formatInput2) || formatInput2;
1176
+ });
1177
+ });
1178
+
1179
+
1180
+ parseFormats = options.extraFormats ? options.extraFormats.slice() : [];
1181
+ if (parseFormats.indexOf(format) < 0 && parseFormats.indexOf(actualFormat) < 0) {
1182
+ parseFormats.push(actualFormat);
1183
+ }
1184
+
1185
+ use24Hours = (actualFormat.toLowerCase().indexOf('a') < 1 && actualFormat.indexOf('h') < 1);
1186
+
1187
+ if (isEnabled('y')) {
1188
+ minViewModeNumber = 2;
1189
+ }
1190
+ if (isEnabled('M')) {
1191
+ minViewModeNumber = 1;
1192
+ }
1193
+ if (isEnabled('d')) {
1194
+ minViewModeNumber = 0;
1195
+ }
1196
+
1197
+ currentViewMode = Math.max(minViewModeNumber, currentViewMode);
1198
+
1199
+ if (!unset) {
1200
+ setValue(date);
1201
+ }
1202
+ };
1203
+
1204
+ /********************************************************************************
1205
+ *
1206
+ * Public API functions
1207
+ * =====================
1208
+ *
1209
+ * Important: Do not expose direct references to private objects or the options
1210
+ * object to the outer world. Always return a clone when returning values or make
1211
+ * a clone when setting a private variable.
1212
+ *
1213
+ ********************************************************************************/
1214
+ picker.destroy = function () {
1215
+ hide();
1216
+ detachDatePickerElementEvents();
1217
+ element.removeData('DateTimePicker');
1218
+ element.removeData('date');
1219
+ };
1220
+
1221
+ picker.toggle = toggle;
1222
+
1223
+ picker.show = show;
1224
+
1225
+ picker.hide = hide;
1226
+
1227
+ picker.disable = function () {
1228
+ hide();
1229
+ if (component && component.hasClass('btn')) {
1230
+ component.addClass('disabled');
1231
+ }
1232
+ input.prop('disabled', true);
1233
+ return picker;
1234
+ };
1235
+
1236
+ picker.enable = function () {
1237
+ if (component && component.hasClass('btn')) {
1238
+ component.removeClass('disabled');
1239
+ }
1240
+ input.prop('disabled', false);
1241
+ return picker;
1242
+ };
1243
+
1244
+ picker.ignoreReadonly = function (ignoreReadonly) {
1245
+ if (arguments.length === 0) {
1246
+ return options.ignoreReadonly;
1247
+ }
1248
+ if (typeof ignoreReadonly !== 'boolean') {
1249
+ throw new TypeError('ignoreReadonly () expects a boolean parameter');
1250
+ }
1251
+ options.ignoreReadonly = ignoreReadonly;
1252
+ return picker;
1253
+ };
1254
+
1255
+ picker.options = function (newOptions) {
1256
+ if (arguments.length === 0) {
1257
+ return $.extend(true, {}, options);
1258
+ }
1259
+
1260
+ if (!(newOptions instanceof Object)) {
1261
+ throw new TypeError('options() options parameter should be an object');
1262
+ }
1263
+ $.extend(true, options, newOptions);
1264
+ $.each(options, function (key, value) {
1265
+ if (picker[key] !== undefined) {
1266
+ picker[key](value);
1267
+ } else {
1268
+ throw new TypeError('option ' + key + ' is not recognized!');
1269
+ }
1270
+ });
1271
+ return picker;
1272
+ };
1273
+
1274
+ picker.date = function (newDate) {
1275
+ if (arguments.length === 0) {
1276
+ if (unset) {
1277
+ return null;
1278
+ }
1279
+ return date.clone();
1280
+ }
1281
+
1282
+ if (newDate !== null && typeof newDate !== 'string' && !moment.isMoment(newDate) && !(newDate instanceof Date)) {
1283
+ throw new TypeError('date() parameter must be one of [null, string, moment or Date]');
1284
+ }
1285
+
1286
+ setValue(newDate === null ? null : parseInputDate(newDate));
1287
+ return picker;
1288
+ };
1289
+
1290
+ picker.format = function (newFormat) {
1291
+ if (arguments.length === 0) {
1292
+ return options.format;
1293
+ }
1294
+
1295
+ if ((typeof newFormat !== 'string') && ((typeof newFormat !== 'boolean') || (newFormat !== false))) {
1296
+ throw new TypeError('format() expects a sting or boolean:false parameter ' + newFormat);
1297
+ }
1298
+
1299
+ options.format = newFormat;
1300
+ if (actualFormat) {
1301
+ initFormatting(); // reinit formatting
1302
+ }
1303
+ return picker;
1304
+ };
1305
+
1306
+ picker.dayViewHeaderFormat = function (newFormat) {
1307
+ if (arguments.length === 0) {
1308
+ return options.dayViewHeaderFormat;
1309
+ }
1310
+
1311
+ if (typeof newFormat !== 'string') {
1312
+ throw new TypeError('dayViewHeaderFormat() expects a string parameter');
1313
+ }
1314
+
1315
+ options.dayViewHeaderFormat = newFormat;
1316
+ return picker;
1317
+ };
1318
+
1319
+ picker.extraFormats = function (formats) {
1320
+ if (arguments.length === 0) {
1321
+ return options.extraFormats;
1322
+ }
1323
+
1324
+ if (formats !== false && !(formats instanceof Array)) {
1325
+ throw new TypeError('extraFormats() expects an array or false parameter');
1326
+ }
1327
+
1328
+ options.extraFormats = formats;
1329
+ if (parseFormats) {
1330
+ initFormatting(); // reinit formatting
1331
+ }
1332
+ return picker;
1333
+ };
1334
+
1335
+ picker.disabledDates = function (dates) {
1336
+ if (arguments.length === 0) {
1337
+ return (options.disabledDates ? $.extend({}, options.disabledDates) : options.disabledDates);
1338
+ }
1339
+
1340
+ if (!dates) {
1341
+ options.disabledDates = false;
1342
+ update();
1343
+ return picker;
1344
+ }
1345
+ if (!(dates instanceof Array)) {
1346
+ throw new TypeError('disabledDates() expects an array parameter');
1347
+ }
1348
+ options.disabledDates = indexGivenDates(dates);
1349
+ options.enabledDates = false;
1350
+ update();
1351
+ return picker;
1352
+ };
1353
+
1354
+ picker.enabledDates = function (dates) {
1355
+ if (arguments.length === 0) {
1356
+ return (options.enabledDates ? $.extend({}, options.enabledDates) : options.enabledDates);
1357
+ }
1358
+
1359
+ if (!dates) {
1360
+ options.enabledDates = false;
1361
+ update();
1362
+ return picker;
1363
+ }
1364
+ if (!(dates instanceof Array)) {
1365
+ throw new TypeError('enabledDates() expects an array parameter');
1366
+ }
1367
+ options.enabledDates = indexGivenDates(dates);
1368
+ options.disabledDates = false;
1369
+ update();
1370
+ return picker;
1371
+ };
1372
+
1373
+ picker.daysOfWeekDisabled = function (daysOfWeekDisabled) {
1374
+ if (arguments.length === 0) {
1375
+ return options.daysOfWeekDisabled.splice(0);
1376
+ }
1377
+
1378
+ if (!(daysOfWeekDisabled instanceof Array)) {
1379
+ throw new TypeError('daysOfWeekDisabled() expects an array parameter');
1380
+ }
1381
+ options.daysOfWeekDisabled = daysOfWeekDisabled.reduce(function (previousValue, currentValue) {
1382
+ currentValue = parseInt(currentValue, 10);
1383
+ if (currentValue > 6 || currentValue < 0 || isNaN(currentValue)) {
1384
+ return previousValue;
1385
+ }
1386
+ if (previousValue.indexOf(currentValue) === -1) {
1387
+ previousValue.push(currentValue);
1388
+ }
1389
+ return previousValue;
1390
+ }, []).sort();
1391
+ update();
1392
+ return picker;
1393
+ };
1394
+
1395
+ picker.maxDate = function (maxDate) {
1396
+ if (arguments.length === 0) {
1397
+ return options.maxDate ? options.maxDate.clone() : options.maxDate;
1398
+ }
1399
+
1400
+ if ((typeof maxDate === 'boolean') && maxDate === false) {
1401
+ options.maxDate = false;
1402
+ update();
1403
+ return picker;
1404
+ }
1405
+
1406
+ if (typeof maxDate === 'string') {
1407
+ if (maxDate === 'now' || maxDate === 'moment') {
1408
+ maxDate = moment();
1409
+ }
1410
+ }
1411
+
1412
+ var parsedDate = parseInputDate(maxDate);
1413
+
1414
+ if (!parsedDate.isValid()) {
1415
+ throw new TypeError('maxDate() Could not parse date parameter: ' + maxDate);
1416
+ }
1417
+ if (options.minDate && parsedDate.isBefore(options.minDate)) {
1418
+ throw new TypeError('maxDate() date parameter is before options.minDate: ' + parsedDate.format(actualFormat));
1419
+ }
1420
+ options.maxDate = parsedDate;
1421
+ if (options.maxDate.isBefore(maxDate)) {
1422
+ setValue(options.maxDate);
1423
+ }
1424
+ if (viewDate.isAfter(parsedDate)) {
1425
+ viewDate = parsedDate.clone();
1426
+ }
1427
+ update();
1428
+ return picker;
1429
+ };
1430
+
1431
+ picker.minDate = function (minDate) {
1432
+ if (arguments.length === 0) {
1433
+ return options.minDate ? options.minDate.clone() : options.minDate;
1434
+ }
1435
+
1436
+ if ((typeof minDate === 'boolean') && minDate === false) {
1437
+ options.minDate = false;
1438
+ update();
1439
+ return picker;
1440
+ }
1441
+
1442
+ if (typeof minDate === 'string') {
1443
+ if (minDate === 'now' || minDate === 'moment') {
1444
+ minDate = moment();
1445
+ }
1446
+ }
1447
+
1448
+ var parsedDate = parseInputDate(minDate);
1449
+
1450
+ if (!parsedDate.isValid()) {
1451
+ throw new TypeError('minDate() Could not parse date parameter: ' + minDate);
1452
+ }
1453
+ if (options.maxDate && parsedDate.isAfter(options.maxDate)) {
1454
+ throw new TypeError('minDate() date parameter is after options.maxDate: ' + parsedDate.format(actualFormat));
1455
+ }
1456
+ options.minDate = parsedDate;
1457
+ if (options.minDate.isAfter(minDate)) {
1458
+ setValue(options.minDate);
1459
+ }
1460
+ if (viewDate.isBefore(parsedDate)) {
1461
+ viewDate = parsedDate.clone();
1462
+ }
1463
+ update();
1464
+ return picker;
1465
+ };
1466
+
1467
+ picker.defaultDate = function (defaultDate) {
1468
+ if (arguments.length === 0) {
1469
+ return options.defaultDate ? options.defaultDate.clone() : options.defaultDate;
1470
+ }
1471
+ if (!defaultDate) {
1472
+ options.defaultDate = false;
1473
+ return picker;
1474
+ }
1475
+
1476
+ if (typeof defaultDate === 'string') {
1477
+ if (defaultDate === 'now' || defaultDate === 'moment') {
1478
+ defaultDate = moment();
1479
+ }
1480
+ }
1481
+
1482
+ var parsedDate = parseInputDate(defaultDate);
1483
+ if (!parsedDate.isValid()) {
1484
+ throw new TypeError('defaultDate() Could not parse date parameter: ' + defaultDate);
1485
+ }
1486
+ if (!isValid(parsedDate)) {
1487
+ throw new TypeError('defaultDate() date passed is invalid according to component setup validations');
1488
+ }
1489
+
1490
+ options.defaultDate = parsedDate;
1491
+
1492
+ if (options.defaultDate && input.val().trim() === '' && input.attr('placeholder') === undefined) {
1493
+ setValue(options.defaultDate);
1494
+ }
1495
+ return picker;
1496
+ };
1497
+
1498
+ picker.locale = function (locale) {
1499
+ if (arguments.length === 0) {
1500
+ return options.locale;
1501
+ }
1502
+
1503
+ if (!moment.localeData(locale)) {
1504
+ throw new TypeError('locale() locale ' + locale + ' is not loaded from moment locales!');
1505
+ }
1506
+
1507
+ options.locale = locale;
1508
+ date.locale(options.locale);
1509
+ viewDate.locale(options.locale);
1510
+
1511
+ if (actualFormat) {
1512
+ initFormatting(); // reinit formatting
1513
+ }
1514
+ if (widget) {
1515
+ hide();
1516
+ show();
1517
+ }
1518
+ return picker;
1519
+ };
1520
+
1521
+ picker.stepping = function (stepping) {
1522
+ if (arguments.length === 0) {
1523
+ return options.stepping;
1524
+ }
1525
+
1526
+ stepping = parseInt(stepping, 10);
1527
+ if (isNaN(stepping) || stepping < 1) {
1528
+ stepping = 1;
1529
+ }
1530
+ options.stepping = stepping;
1531
+ return picker;
1532
+ };
1533
+
1534
+ picker.useCurrent = function (useCurrent) {
1535
+ var useCurrentOptions = ['year', 'month', 'day', 'hour', 'minute'];
1536
+ if (arguments.length === 0) {
1537
+ return options.useCurrent;
1538
+ }
1539
+
1540
+ if ((typeof useCurrent !== 'boolean') && (typeof useCurrent !== 'string')) {
1541
+ throw new TypeError('useCurrent() expects a boolean or string parameter');
1542
+ }
1543
+ if (typeof useCurrent === 'string' && useCurrentOptions.indexOf(useCurrent.toLowerCase()) === -1) {
1544
+ throw new TypeError('useCurrent() expects a string parameter of ' + useCurrentOptions.join(', '));
1545
+ }
1546
+ options.useCurrent = useCurrent;
1547
+ return picker;
1548
+ };
1549
+
1550
+ picker.collapse = function (collapse) {
1551
+ if (arguments.length === 0) {
1552
+ return options.collapse;
1553
+ }
1554
+
1555
+ if (typeof collapse !== 'boolean') {
1556
+ throw new TypeError('collapse() expects a boolean parameter');
1557
+ }
1558
+ if (options.collapse === collapse) {
1559
+ return picker;
1560
+ }
1561
+ options.collapse = collapse;
1562
+ if (widget) {
1563
+ hide();
1564
+ show();
1565
+ }
1566
+ return picker;
1567
+ };
1568
+
1569
+ picker.icons = function (icons) {
1570
+ if (arguments.length === 0) {
1571
+ return $.extend({}, options.icons);
1572
+ }
1573
+
1574
+ if (!(icons instanceof Object)) {
1575
+ throw new TypeError('icons() expects parameter to be an Object');
1576
+ }
1577
+ $.extend(options.icons, icons);
1578
+ if (widget) {
1579
+ hide();
1580
+ show();
1581
+ }
1582
+ return picker;
1583
+ };
1584
+
1585
+ picker.useStrict = function (useStrict) {
1586
+ if (arguments.length === 0) {
1587
+ return options.useStrict;
1588
+ }
1589
+
1590
+ if (typeof useStrict !== 'boolean') {
1591
+ throw new TypeError('useStrict() expects a boolean parameter');
1592
+ }
1593
+ options.useStrict = useStrict;
1594
+ return picker;
1595
+ };
1596
+
1597
+ picker.sideBySide = function (sideBySide) {
1598
+ if (arguments.length === 0) {
1599
+ return options.sideBySide;
1600
+ }
1601
+
1602
+ if (typeof sideBySide !== 'boolean') {
1603
+ throw new TypeError('sideBySide() expects a boolean parameter');
1604
+ }
1605
+ options.sideBySide = sideBySide;
1606
+ if (widget) {
1607
+ hide();
1608
+ show();
1609
+ }
1610
+ return picker;
1611
+ };
1612
+
1613
+ picker.viewMode = function (viewMode) {
1614
+ if (arguments.length === 0) {
1615
+ return options.viewMode;
1616
+ }
1617
+
1618
+ if (typeof viewMode !== 'string') {
1619
+ throw new TypeError('viewMode() expects a string parameter');
1620
+ }
1621
+
1622
+ if (viewModes.indexOf(viewMode) === -1) {
1623
+ throw new TypeError('viewMode() parameter must be one of (' + viewModes.join(', ') + ') value');
1624
+ }
1625
+
1626
+ options.viewMode = viewMode;
1627
+ currentViewMode = Math.max(viewModes.indexOf(viewMode), minViewModeNumber);
1628
+
1629
+ showMode();
1630
+ return picker;
1631
+ };
1632
+
1633
+ picker.toolbarPlacement = function (toolbarPlacement) {
1634
+ if (arguments.length === 0) {
1635
+ return options.toolbarPlacement;
1636
+ }
1637
+
1638
+ if (typeof toolbarPlacement !== 'string') {
1639
+ throw new TypeError('toolbarPlacement() expects a string parameter');
1640
+ }
1641
+ if (toolbarPlacements.indexOf(toolbarPlacement) === -1) {
1642
+ throw new TypeError('toolbarPlacement() parameter must be one of (' + toolbarPlacements.join(', ') + ') value');
1643
+ }
1644
+ options.toolbarPlacement = toolbarPlacement;
1645
+
1646
+ if (widget) {
1647
+ hide();
1648
+ show();
1649
+ }
1650
+ return picker;
1651
+ };
1652
+
1653
+ picker.widgetPositioning = function (widgetPositioning) {
1654
+ if (arguments.length === 0) {
1655
+ return $.extend({}, options.widgetPositioning);
1656
+ }
1657
+
1658
+ if (({}).toString.call(widgetPositioning) !== '[object Object]') {
1659
+ throw new TypeError('widgetPositioning() expects an object variable');
1660
+ }
1661
+ if (widgetPositioning.horizontal) {
1662
+ if (typeof widgetPositioning.horizontal !== 'string') {
1663
+ throw new TypeError('widgetPositioning() horizontal variable must be a string');
1664
+ }
1665
+ widgetPositioning.horizontal = widgetPositioning.horizontal.toLowerCase();
1666
+ if (horizontalModes.indexOf(widgetPositioning.horizontal) === -1) {
1667
+ throw new TypeError('widgetPositioning() expects horizontal parameter to be one of (' + horizontalModes.join(', ') + ')');
1668
+ }
1669
+ options.widgetPositioning.horizontal = widgetPositioning.horizontal;
1670
+ }
1671
+ if (widgetPositioning.vertical) {
1672
+ if (typeof widgetPositioning.vertical !== 'string') {
1673
+ throw new TypeError('widgetPositioning() vertical variable must be a string');
1674
+ }
1675
+ widgetPositioning.vertical = widgetPositioning.vertical.toLowerCase();
1676
+ if (verticalModes.indexOf(widgetPositioning.vertical) === -1) {
1677
+ throw new TypeError('widgetPositioning() expects vertical parameter to be one of (' + verticalModes.join(', ') + ')');
1678
+ }
1679
+ options.widgetPositioning.vertical = widgetPositioning.vertical;
1680
+ }
1681
+ update();
1682
+ return picker;
1683
+ };
1684
+
1685
+ picker.calendarWeeks = function (calendarWeeks) {
1686
+ if (arguments.length === 0) {
1687
+ return options.calendarWeeks;
1688
+ }
1689
+
1690
+ if (typeof calendarWeeks !== 'boolean') {
1691
+ throw new TypeError('calendarWeeks() expects parameter to be a boolean value');
1692
+ }
1693
+
1694
+ options.calendarWeeks = calendarWeeks;
1695
+ update();
1696
+ return picker;
1697
+ };
1698
+
1699
+ picker.showTodayButton = function (showTodayButton) {
1700
+ if (arguments.length === 0) {
1701
+ return options.showTodayButton;
1702
+ }
1703
+
1704
+ if (typeof showTodayButton !== 'boolean') {
1705
+ throw new TypeError('showTodayButton() expects a boolean parameter');
1706
+ }
1707
+
1708
+ options.showTodayButton = showTodayButton;
1709
+ if (widget) {
1710
+ hide();
1711
+ show();
1712
+ }
1713
+ return picker;
1714
+ };
1715
+
1716
+ picker.showClear = function (showClear) {
1717
+ if (arguments.length === 0) {
1718
+ return options.showClear;
1719
+ }
1720
+
1721
+ if (typeof showClear !== 'boolean') {
1722
+ throw new TypeError('showClear() expects a boolean parameter');
1723
+ }
1724
+
1725
+ options.showClear = showClear;
1726
+ if (widget) {
1727
+ hide();
1728
+ show();
1729
+ }
1730
+ return picker;
1731
+ };
1732
+
1733
+ picker.widgetParent = function (widgetParent) {
1734
+ if (arguments.length === 0) {
1735
+ return options.widgetParent;
1736
+ }
1737
+
1738
+ if (typeof widgetParent === 'string') {
1739
+ widgetParent = $(widgetParent);
1740
+ }
1741
+
1742
+ if (widgetParent !== null && (typeof widgetParent !== 'string' && !(widgetParent instanceof $))) {
1743
+ throw new TypeError('widgetParent() expects a string or a jQuery object parameter');
1744
+ }
1745
+
1746
+ options.widgetParent = widgetParent;
1747
+ if (widget) {
1748
+ hide();
1749
+ show();
1750
+ }
1751
+ return picker;
1752
+ };
1753
+
1754
+ picker.keepOpen = function (keepOpen) {
1755
+ if (arguments.length === 0) {
1756
+ return options.keepOpen;
1757
+ }
1758
+
1759
+ if (typeof keepOpen !== 'boolean') {
1760
+ throw new TypeError('keepOpen() expects a boolean parameter');
1761
+ }
1762
+
1763
+ options.keepOpen = keepOpen;
1764
+ return picker;
1765
+ };
1766
+
1767
+ picker.inline = function (inline) {
1768
+ if (arguments.length === 0) {
1769
+ return options.inline;
1770
+ }
1771
+
1772
+ if (typeof inline !== 'boolean') {
1773
+ throw new TypeError('inline() expects a boolean parameter');
1774
+ }
1775
+
1776
+ options.inline = inline;
1777
+ return picker;
1778
+ };
1779
+
1780
+ picker.clear = function () {
1781
+ clear();
1782
+ return picker;
1783
+ };
1784
+
1785
+ picker.keyBinds = function (keyBinds) {
1786
+ options.keyBinds = keyBinds;
1787
+ return picker;
1788
+ };
1789
+
1790
+ picker.debug = function (debug) {
1791
+ if (typeof debug !== 'boolean') {
1792
+ throw new TypeError('debug() expects a boolean parameter');
1793
+ }
1794
+
1795
+ options.debug = debug;
1796
+ return picker;
1797
+ };
1798
+
1799
+ picker.showClose = function (showClose) {
1800
+ if (arguments.length === 0) {
1801
+ return options.showClose;
1802
+ }
1803
+
1804
+ if (typeof showClose !== 'boolean') {
1805
+ throw new TypeError('showClose() expects a boolean parameter');
1806
+ }
1807
+
1808
+ options.showClose = showClose;
1809
+ return picker;
1810
+ };
1811
+
1812
+ picker.keepInvalid = function (keepInvalid) {
1813
+ if (arguments.length === 0) {
1814
+ return options.keepInvalid;
1815
+ }
1816
+
1817
+ if (typeof keepInvalid !== 'boolean') {
1818
+ throw new TypeError('keepInvalid() expects a boolean parameter');
1819
+ }
1820
+ options.keepInvalid = keepInvalid;
1821
+ return picker;
1822
+ };
1823
+
1824
+ picker.datepickerInput = function (datepickerInput) {
1825
+ if (arguments.length === 0) {
1826
+ return options.datepickerInput;
1827
+ }
1828
+
1829
+ if (typeof datepickerInput !== 'string') {
1830
+ throw new TypeError('datepickerInput() expects a string parameter');
1831
+ }
1832
+
1833
+ options.datepickerInput = datepickerInput;
1834
+ return picker;
1835
+ };
1836
+
1837
+ // initializing element and component attributes
1838
+ if (element.is('input')) {
1839
+ input = element;
1840
+ } else {
1841
+ input = element.find(options.datepickerInput);
1842
+ if (input.size() === 0) {
1843
+ input = element.find('input');
1844
+ } else if (!input.is('input')) {
1845
+ throw new Error('CSS class "' + options.datepickerInput + '" cannot be applied to non input element');
1846
+ }
1847
+ }
1848
+
1849
+ if (element.hasClass('input-group')) {
1850
+ // in case there is more then one 'input-group-addon' Issue #48
1851
+ if (element.find('.datepickerbutton').size() === 0) {
1852
+ component = element.find('[class^="input-group-"]');
1853
+ } else {
1854
+ component = element.find('.datepickerbutton');
1855
+ }
1856
+ }
1857
+
1858
+ if (!options.inline && !input.is('input')) {
1859
+ throw new Error('Could not initialize DateTimePicker without an input element');
1860
+ }
1861
+
1862
+ $.extend(true, options, dataToOptions());
1863
+
1864
+ picker.options(options);
1865
+
1866
+ initFormatting();
1867
+
1868
+ attachDatePickerElementEvents();
1869
+
1870
+ if (input.prop('disabled')) {
1871
+ picker.disable();
1872
+ }
1873
+ if (input.is('input') && input.val().trim().length !== 0) {
1874
+ setValue(parseInputDate(input.val().trim()));
1875
+ }
1876
+ else if (options.defaultDate && input.attr('placeholder') === undefined) {
1877
+ setValue(options.defaultDate);
1878
+ }
1879
+ if (options.inline) {
1880
+ show();
1881
+ }
1882
+ return picker;
1883
+ };
1884
+
1885
+ /********************************************************************************
1886
+ *
1887
+ * jQuery plugin constructor and defaults object
1888
+ *
1889
+ ********************************************************************************/
1890
+
1891
+ $.fn.datetimepicker = function (options) {
1892
+ return this.each(function () {
1893
+ var $this = $(this);
1894
+ if (!$this.data('DateTimePicker')) {
1895
+ // create a private copy of the defaults object
1896
+ options = $.extend(true, {}, $.fn.datetimepicker.defaults, options);
1897
+ $this.data('DateTimePicker', dateTimePicker($this, options));
1898
+ }
1899
+ });
1900
+ };
1901
+
1902
+ $.fn.datetimepicker.defaults = {
1903
+ format: false,
1904
+ dayViewHeaderFormat: 'MMMM YYYY',
1905
+ extraFormats: false,
1906
+ stepping: 1,
1907
+ minDate: false,
1908
+ maxDate: false,
1909
+ useCurrent: true,
1910
+ collapse: true,
1911
+ locale: moment.locale(),
1912
+ defaultDate: false,
1913
+ disabledDates: false,
1914
+ enabledDates: false,
1915
+ icons: {
1916
+ time: 'glyphicon glyphicon-time',
1917
+ date: 'glyphicon glyphicon-calendar',
1918
+ up: 'glyphicon glyphicon-chevron-up',
1919
+ down: 'glyphicon glyphicon-chevron-down',
1920
+ previous: 'glyphicon glyphicon-chevron-left',
1921
+ next: 'glyphicon glyphicon-chevron-right',
1922
+ today: 'glyphicon glyphicon-screenshot',
1923
+ clear: 'glyphicon glyphicon-trash',
1924
+ close: 'glyphicon glyphicon-remove'
1925
+ },
1926
+ useStrict: false,
1927
+ sideBySide: false,
1928
+ daysOfWeekDisabled: [],
1929
+ calendarWeeks: false,
1930
+ viewMode: 'days',
1931
+ toolbarPlacement: 'default',
1932
+ showTodayButton: false,
1933
+ showClear: false,
1934
+ showClose: false,
1935
+ widgetPositioning: {
1936
+ horizontal: 'auto',
1937
+ vertical: 'auto'
1938
+ },
1939
+ widgetParent: null,
1940
+ ignoreReadonly: false,
1941
+ keepOpen: false,
1942
+ inline: false,
1943
+ keepInvalid: false,
1944
+ datepickerInput: '.datepickerinput',
1945
+ keyBinds: {
1946
+ up: function (widget) {
1947
+ if (!widget) {
1948
+ return;
1949
+ }
1950
+ var d = this.date() || moment();
1951
+ if (widget.find('.datepicker').is(':visible')) {
1952
+ this.date(d.clone().subtract(7, 'd'));
1953
+ } else {
1954
+ this.date(d.clone().add(1, 'm'));
1955
+ }
1956
+ },
1957
+ down: function (widget) {
1958
+ if (!widget) {
1959
+ this.show();
1960
+ return;
1961
+ }
1962
+ var d = this.date() || moment();
1963
+ if (widget.find('.datepicker').is(':visible')) {
1964
+ this.date(d.clone().add(7, 'd'));
1965
+ } else {
1966
+ this.date(d.clone().subtract(1, 'm'));
1967
+ }
1968
+ },
1969
+ 'control up': function (widget) {
1970
+ if (!widget) {
1971
+ return;
1972
+ }
1973
+ var d = this.date() || moment();
1974
+ if (widget.find('.datepicker').is(':visible')) {
1975
+ this.date(d.clone().subtract(1, 'y'));
1976
+ } else {
1977
+ this.date(d.clone().add(1, 'h'));
1978
+ }
1979
+ },
1980
+ 'control down': function (widget) {
1981
+ if (!widget) {
1982
+ return;
1983
+ }
1984
+ var d = this.date() || moment();
1985
+ if (widget.find('.datepicker').is(':visible')) {
1986
+ this.date(d.clone().add(1, 'y'));
1987
+ } else {
1988
+ this.date(d.clone().subtract(1, 'h'));
1989
+ }
1990
+ },
1991
+ left: function (widget) {
1992
+ if (!widget) {
1993
+ return;
1994
+ }
1995
+ var d = this.date() || moment();
1996
+ if (widget.find('.datepicker').is(':visible')) {
1997
+ this.date(d.clone().subtract(1, 'd'));
1998
+ }
1999
+ },
2000
+ right: function (widget) {
2001
+ if (!widget) {
2002
+ return;
2003
+ }
2004
+ var d = this.date() || moment();
2005
+ if (widget.find('.datepicker').is(':visible')) {
2006
+ this.date(d.clone().add(1, 'd'));
2007
+ }
2008
+ },
2009
+ pageUp: function (widget) {
2010
+ if (!widget) {
2011
+ return;
2012
+ }
2013
+ var d = this.date() || moment();
2014
+ if (widget.find('.datepicker').is(':visible')) {
2015
+ this.date(d.clone().subtract(1, 'M'));
2016
+ }
2017
+ },
2018
+ pageDown: function (widget) {
2019
+ if (!widget) {
2020
+ return;
2021
+ }
2022
+ var d = this.date() || moment();
2023
+ if (widget.find('.datepicker').is(':visible')) {
2024
+ this.date(d.clone().add(1, 'M'));
2025
+ }
2026
+ },
2027
+ enter: function () {
2028
+ this.hide();
2029
+ },
2030
+ escape: function () {
2031
+ this.hide();
2032
+ },
2033
+ //tab: function (widget) { //this break the flow of the form. disabling for now
2034
+ // var toggle = widget.find('.picker-switch a[data-action="togglePicker"]');
2035
+ // if(toggle.length > 0) toggle.click();
2036
+ //},
2037
+ 'control space': function (widget) {
2038
+ if (widget.find('.timepicker').is(':visible')) {
2039
+ widget.find('.btn[data-action="togglePeriod"]').click();
2040
+ }
2041
+ },
2042
+ t: function () {
2043
+ this.date(moment());
2044
+ },
2045
+ 'delete': function () {
2046
+ this.clear();
2047
+ }
2048
+ },
2049
+ debug: false
2050
+ };
2051
+ }));