Version Description
(2020.03.16) = ~ Fixed security issues (CVE-2020-7916 and CVE-2020-7917): uer logged can change role all users to Instructor ~ Fixed error preview Assignment
Download this release
Release Info
Developer | ThimPress |
Plugin | LearnPress – WordPress LMS Plugin |
Version | 3.2.6.7 |
Comparing to | |
See all releases |
Code changes from version 3.2.6.5 to 3.2.6.7
- assets/css/font-awesome.min.css +4 -0
- assets/css/jalert.css +1 -0
- assets/js/admin/admin-tabs.js +88 -0
- assets/js/admin/admin-tools.js +106 -0
- assets/js/admin/all.js +1 -0
- assets/js/admin/attributes.js +92 -0
- assets/js/admin/course-editor.js +866 -0
- assets/js/admin/index.php +1 -0
- assets/js/admin/meta-box-order.js +461 -0
- assets/js/admin/modal-search-items.js +145 -0
- assets/js/admin/modal-search-users.js +148 -0
- assets/js/admin/question-editor.asset.php +0 -1
- assets/js/admin/question-editor.deps.json +0 -1
- assets/js/admin/question-editor.js +330 -0
- assets/js/admin/quiz-editor.js +1002 -0
- assets/js/admin/settings.js +235 -0
- assets/js/admin/setup.js +153 -0
- assets/js/admin/statistic.js +286 -0
- assets/js/admin/sync-data.js +268 -0
- assets/js/admin/update.js +238 -0
- assets/js/admin/utils/_advanced-list.js +133 -0
- assets/js/admin/utils/_advertisement.js +79 -0
- assets/js/admin/utils/_cookie.js +3 -0
- assets/js/admin/utils/_dropdown-pages.js +130 -0
- assets/js/admin/utils/_search-items.js +46 -0
- assets/js/frontend/quiz.bak.js +915 -0
- assets/js/index.php +1 -0
- assets/js/vendor/Chart.bundle.min.js +16 -0
- assets/js/vendor/circle-bar.js +72 -0
- assets/js/vendor/jquery-scrollbar/jquery.scrollbar.css +185 -0
- assets/js/vendor/jquery-scrollbar/jquery.scrollbar.js +780 -0
- assets/js/vendor/jquery-tipsy/jquery.tipsy.css +1 -0
- assets/js/vendor/jquery-tipsy/jquery.tipsy.js +258 -0
- assets/js/vendor/jquery.alert.js +210 -0
- assets/js/vendor/jquery.appear.js +102 -0
- assets/js/vendor/jquery.caret.js +79 -0
- assets/js/vendor/jquery.cookie.js +73 -0
- assets/js/vendor/jquery.scrollTo.js +210 -0
- assets/js/vendor/jquery.timer.js +84 -0
- assets/js/vendor/sortable.js +1490 -0
- assets/js/vendor/vue-resource.js +1574 -0
- assets/js/vendor/vue.js +11945 -0
- assets/js/vendor/vue.min.js +6 -0
assets/css/font-awesome.min.css
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome
|
3 |
+
* License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License)
|
4 |
+
*/@font-face{font-family:FontAwesome;src:url(../fonts/awesome/fontawesome-webfont.eot?v=4.7.0);src:url(../fonts/awesome/fontawesome-webfont.eot?#iefix&v=4.7.0) format('embedded-opentype'),url(../fonts/awesome/fontawesome-webfont.woff2?v=4.7.0) format('woff2'),url(../fonts/awesome/fontawesome-webfont.woff?v=4.7.0) format('woff'),url(../fonts/awesome/fontawesome-webfont.ttf?v=4.7.0) format('truetype'),url(../fonts/awesome/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular) format('svg');font-weight:400;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-close:before,.fa-remove:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-repeat:before,.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before,.fa-warning:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-floppy-o:before,.fa-save:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before,.fa-flash:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-chain-broken:before,.fa-unlink:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:"\f150"}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:"\f151"}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:"\f152"}.fa-eur:before,.fa-euro:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-inr:before,.fa-rupee:before{content:"\f156"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:"\f157"}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:"\f158"}.fa-krw:before,.fa-won:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-try:before,.fa-turkish-lira:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:"\f1c5"}.fa-file-archive-o:before,.fa-file-zip-o:before{content:"\f1c6"}.fa-file-audio-o:before,.fa-file-sound-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before,.fa-resistance:before{content:"\f1d0"}.fa-empire:before,.fa-ge:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before,.fa-y-combinator-square:before,.fa-yc-square:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-paper-plane:before,.fa-send:before{content:"\f1d8"}.fa-paper-plane-o:before,.fa-send-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-bed:before,.fa-hotel:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-y-combinator:before,.fa-yc:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before,.fa-battery:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-paper-o:before,.fa-hand-stop-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-television:before,.fa-tv:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before{content:"\f2a3"}.fa-deaf:before,.fa-deafness:before,.fa-hard-of-hearing:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-sign-language:before,.fa-signing:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-address-card:before,.fa-vcard:before{content:"\f2bb"}.fa-address-card-o:before,.fa-vcard-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer-full:before,.fa-thermometer:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bath:before,.fa-bathtub:before,.fa-s15:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}
|
assets/css/jalert.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
#popup_container{background:#fff}#popup_container #popup_title{padding:10px 20px;background:#18b6c7;color:#fff;font-size:18px;margin:0}#popup_container #popup_content{padding:20px}#popup_container #popup_content #popup_message{margin-bottom:20px}#popup_container #popup_panel{text-align:center}.single-lp_course .course-students{padding-top:10px}.single-lp_course .course-students-list{margin-top:10px}.single-lp_course .course-students-list .students{list-style-type:none;margin:0}.single-lp_course .course-students-list .students li{margin-right:10px}.single-lp_course .course-students-list .students p{margin-top:15px}.single-lp_course .lp_course .entry-footer{display:none}
|
assets/js/admin/admin-tabs.js
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Plugin: Tabs
|
3 |
+
*/
|
4 |
+
;(function ($) {
|
5 |
+
var adminTabs = function ($el, options) {
|
6 |
+
var $tabs = $el.find('.tabs-nav').find('li'),
|
7 |
+
$tabsWrap = $tabs.parent(),
|
8 |
+
$contents = $el.find('.tabs-content-container > li'),
|
9 |
+
$currentTab = null,
|
10 |
+
$currentContent = null;
|
11 |
+
|
12 |
+
function selectTab($tab) {
|
13 |
+
var index = $tabs.index($tab),
|
14 |
+
url = $tab.find('a').attr('href');
|
15 |
+
|
16 |
+
$currentContent = $contents.eq(index);
|
17 |
+
|
18 |
+
$tab.addClass('active').siblings('li.active').removeClass('active');
|
19 |
+
$currentContent.show().css({visibility: 'hidden'});
|
20 |
+
calculateHeight($currentContent);
|
21 |
+
$currentContent.hide();
|
22 |
+
$currentContent.show();
|
23 |
+
$currentContent.siblings('li.active').fadeOut(0, function () {
|
24 |
+
$currentContent.addClass('active').siblings('li.active').removeClass('active');
|
25 |
+
});
|
26 |
+
|
27 |
+
LP.setUrl(url);
|
28 |
+
}
|
29 |
+
|
30 |
+
function calculateHeight($currentContent) {
|
31 |
+
|
32 |
+
var contentHeight = $currentContent.height(),
|
33 |
+
tabsHeight = $tabsWrap.outerHeight();
|
34 |
+
|
35 |
+
if (contentHeight < tabsHeight) {
|
36 |
+
contentHeight = tabsHeight + parseInt($tabsWrap.css('margin')) * 2;
|
37 |
+
} else {
|
38 |
+
contentHeight = undefined;
|
39 |
+
}
|
40 |
+
$currentContent.css('visibility', '').css({height: contentHeight});
|
41 |
+
}
|
42 |
+
|
43 |
+
function selectDefaultTab() {
|
44 |
+
$currentTab = $tabs.filter('.active');
|
45 |
+
if (!$currentTab.length) {
|
46 |
+
$currentTab = $tabs.first();
|
47 |
+
}
|
48 |
+
$currentTab.find('a').trigger('click');
|
49 |
+
}
|
50 |
+
|
51 |
+
function initEvents() {
|
52 |
+
$el.on('click', '.tabs-nav a', function (event) {
|
53 |
+
event.preventDefault();
|
54 |
+
$currentTab = $(this).parent();
|
55 |
+
selectTab($currentTab);
|
56 |
+
});
|
57 |
+
}
|
58 |
+
|
59 |
+
function init() {
|
60 |
+
initEvents();
|
61 |
+
selectDefaultTab();
|
62 |
+
$(window).on('resize.calculate-tab', function () {
|
63 |
+
var $currentContent = $el.find('.tabs-content-container .active').css('height', '');
|
64 |
+
calculateHeight($currentContent);
|
65 |
+
})
|
66 |
+
}
|
67 |
+
|
68 |
+
init();
|
69 |
+
};
|
70 |
+
$.fn.lpAdminTab = function (options) {
|
71 |
+
options = $.extend({}, options || {});
|
72 |
+
return $.each(this, function () {
|
73 |
+
var $el = $(this),
|
74 |
+
tabs = $el.data('learn-press/tabs');
|
75 |
+
|
76 |
+
if (!tabs) {
|
77 |
+
tabs = new adminTabs($el, options);
|
78 |
+
$el.data('learn-press/tabs', tabs)
|
79 |
+
}
|
80 |
+
return $el;
|
81 |
+
})
|
82 |
+
};
|
83 |
+
|
84 |
+
var $doc = $(document);
|
85 |
+
$doc.ready(function () {
|
86 |
+
$('.learn-press-tabs').lpAdminTab();
|
87 |
+
});
|
88 |
+
})(jQuery);
|
assets/js/admin/admin-tools.js
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
|
3 |
+
var $doc = $(document),
|
4 |
+
isRunning = false;
|
5 |
+
|
6 |
+
function installSampleCourse(e) {
|
7 |
+
e.preventDefault();
|
8 |
+
|
9 |
+
var $button = $(this);
|
10 |
+
|
11 |
+
if (isRunning) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
if (!confirm(lpGlobalSettings.i18n.confirm_install_sample_data)) {
|
16 |
+
return;
|
17 |
+
}
|
18 |
+
|
19 |
+
$button.addClass('disabled').html($button.data('installing-text'));
|
20 |
+
$('.lp-install-sample-data-response').remove();
|
21 |
+
isRunning = true;
|
22 |
+
$.ajax({
|
23 |
+
url: $button.attr('href'),
|
24 |
+
data: $('.lp-install-sample-data-options').serializeJSON(),
|
25 |
+
success: function (response) {
|
26 |
+
$button.removeClass('disabled').html($button.data('text'));
|
27 |
+
isRunning = false;
|
28 |
+
$(response).insertBefore($button.parent());
|
29 |
+
},
|
30 |
+
error: function () {
|
31 |
+
$button.removeClass('disabled').html($button.data('text'));
|
32 |
+
isRunning = false;
|
33 |
+
}
|
34 |
+
});
|
35 |
+
}
|
36 |
+
|
37 |
+
function uninstallSampleCourse(e) {
|
38 |
+
e.preventDefault();
|
39 |
+
|
40 |
+
var $button = $(this);
|
41 |
+
|
42 |
+
if (isRunning) {
|
43 |
+
return;
|
44 |
+
}
|
45 |
+
|
46 |
+
if (!confirm(lpGlobalSettings.i18n.confirm_uninstall_sample_data)) {
|
47 |
+
return;
|
48 |
+
}
|
49 |
+
|
50 |
+
$button.addClass('disabled').html($button.data('uninstalling-text'));
|
51 |
+
isRunning = true;
|
52 |
+
$.ajax({
|
53 |
+
url: $button.attr('href'),
|
54 |
+
success: function (response) {
|
55 |
+
$button.removeClass('disabled').html($button.data('text'));
|
56 |
+
isRunning = false;
|
57 |
+
},
|
58 |
+
error: function () {
|
59 |
+
$button.removeClass('disabled').html($button.data('text'));
|
60 |
+
isRunning = false;
|
61 |
+
}
|
62 |
+
})
|
63 |
+
}
|
64 |
+
|
65 |
+
function clearHardCache(e) {
|
66 |
+
e.preventDefault();
|
67 |
+
var $button = $(this);
|
68 |
+
|
69 |
+
if ($button.hasClass('disabled')) {
|
70 |
+
return;
|
71 |
+
}
|
72 |
+
|
73 |
+
$button.addClass('disabled').html($button.data('cleaning-text'));
|
74 |
+
$.ajax({
|
75 |
+
url: $button.attr('href'),
|
76 |
+
data: {},
|
77 |
+
success: function (response) {
|
78 |
+
$button.removeClass('disabled').html($button.data('text'));
|
79 |
+
},
|
80 |
+
error: function () {
|
81 |
+
$button.removeClass('disabled').html($button.data('text'));
|
82 |
+
}
|
83 |
+
});
|
84 |
+
}
|
85 |
+
|
86 |
+
function toggleHardCache() {
|
87 |
+
$.ajax({
|
88 |
+
url: 'admin.php?page=lp-toggle-hard-cache-option',
|
89 |
+
data: {v: this.checked ? 'yes' : 'no'},
|
90 |
+
success: function (response) {
|
91 |
+
},
|
92 |
+
error: function () {
|
93 |
+
}
|
94 |
+
});
|
95 |
+
}
|
96 |
+
|
97 |
+
$doc.on('click', '#learn-press-install-sample-data', installSampleCourse)
|
98 |
+
.on('click', '#learn-press-uninstall-sample-data', uninstallSampleCourse)
|
99 |
+
.on('click', '#learn-press-clear-cache', clearHardCache)
|
100 |
+
.on('click', 'input[name="enable_hard_cache"]', toggleHardCache)
|
101 |
+
.on('click', '#learn-press-install-sample-data-options', function (e) {
|
102 |
+
e.preventDefault();
|
103 |
+
$('.lp-install-sample-data-options').toggleClass('hide-if-js');
|
104 |
+
})
|
105 |
+
|
106 |
+
})(jQuery);
|
assets/js/admin/all.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
function login(){alert()}function abc(){}var x=0;abc();
|
assets/js/admin/attributes.js
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
var select2Options = {
|
3 |
+
formatNoMatches: function () {
|
4 |
+
$(document).off('keyup.addNewAttributeValueEvent');
|
5 |
+
$(document).on('keyup.addNewAttributeValueEvent', '.select2-input', addNewAttributeValueEvent);
|
6 |
+
return 'No match found, <code>Ctrl + Enter</code> to add new attribute';
|
7 |
+
},
|
8 |
+
formatMatches : function () {
|
9 |
+
$(document).off('keyup.addNewAttributeValueEvent');
|
10 |
+
}
|
11 |
+
}, postId = 0;
|
12 |
+
|
13 |
+
function getPostId() {
|
14 |
+
if (!postId) {
|
15 |
+
postId = $('input[name="post_ID"]').val();
|
16 |
+
}
|
17 |
+
return postId;
|
18 |
+
}
|
19 |
+
|
20 |
+
function addAttributeToCourse(button) {
|
21 |
+
$(button).addClass('disabled');
|
22 |
+
$.post({
|
23 |
+
url : window.location.href.addQueryVar('add-attribute-to-course', getPostId()),
|
24 |
+
data : $().extend({}, $(button).data()),
|
25 |
+
success: function (response) {
|
26 |
+
var $html = $('.course-attributes');
|
27 |
+
$(response).appendTo($html);
|
28 |
+
$html.find('.course-attribute-values').select2(select2Options)
|
29 |
+
}
|
30 |
+
})
|
31 |
+
}
|
32 |
+
|
33 |
+
function addNewAttributeValue(name, taxonomy, el) {
|
34 |
+
var $li = $(el).closest('.learn-press-attribute');
|
35 |
+
$.post({
|
36 |
+
url : window.location.href.addQueryVar('add-attribute-value', getPostId()),
|
37 |
+
data : {
|
38 |
+
name : name,
|
39 |
+
taxonomy: taxonomy
|
40 |
+
},
|
41 |
+
dataType: 'text',
|
42 |
+
success : function (response) {
|
43 |
+
response = LP.parseJSON(response);
|
44 |
+
if (response.result == 'success') {
|
45 |
+
$li.find('select.course-attribute-values').append('<option value="' + response.slug + '" selected="selected">' + response.name + '</option>').change();
|
46 |
+
} else {
|
47 |
+
if (response.message) {
|
48 |
+
alert(response.message);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
})
|
53 |
+
}
|
54 |
+
|
55 |
+
function addNewAttributeValueEvent(e) {
|
56 |
+
if (e.ctrlKey && e.keyCode == 13) {
|
57 |
+
var $sel = $('.select2-focused');
|
58 |
+
if ($sel.length == 0) {
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
addNewAttributeValue($sel.val(), $sel.closest('.learn-press-attribute').data('taxonomy'), this)
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
function saveAttributesEvent(e) {
|
66 |
+
$.post({
|
67 |
+
url : window.location.href.addQueryVar('save-attributes', getPostId()),
|
68 |
+
data : {
|
69 |
+
data: $('.course-attributes').find('input, select, textarea').serialize(),
|
70 |
+
},
|
71 |
+
success: function () {
|
72 |
+
|
73 |
+
}
|
74 |
+
});
|
75 |
+
}
|
76 |
+
|
77 |
+
$(document).ready(function () {
|
78 |
+
$(document)
|
79 |
+
.on('click', '.add-attribute:not(.disabled)', function () {
|
80 |
+
addAttributeToCourse(this);
|
81 |
+
})
|
82 |
+
.on('click', '#save-attributes', saveAttributesEvent)
|
83 |
+
.on('keyup.addNewAttributeValueEvent', '.select2-input', addNewAttributeValueEvent);
|
84 |
+
|
85 |
+
var $courseAttributes = $('.course-attribute-values') ;
|
86 |
+
|
87 |
+
if ($courseAttributes.length) {
|
88 |
+
$courseAttributes.select2(select2Options);
|
89 |
+
}
|
90 |
+
|
91 |
+
});
|
92 |
+
})(jQuery);
|
assets/js/admin/course-editor.js
ADDED
@@ -0,0 +1,866 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Helpers
|
5 |
+
*
|
6 |
+
* @since 3.0.0
|
7 |
+
*/
|
8 |
+
(function (exports) {
|
9 |
+
function cloneObject(object) {
|
10 |
+
return JSON.parse(JSON.stringify(object));
|
11 |
+
}
|
12 |
+
|
13 |
+
exports.LP_Helpers = {
|
14 |
+
cloneObject: cloneObject
|
15 |
+
};
|
16 |
+
})(window);
|
17 |
+
|
18 |
+
window.$Vue = window.$Vue || Vue;
|
19 |
+
window.$Vuex = window.$Vuex || Vuex;
|
20 |
+
|
21 |
+
var $VueHTTP = Vue.http;
|
22 |
+
|
23 |
+
jQuery(function ($) {
|
24 |
+
|
25 |
+
/**
|
26 |
+
* I18n Store
|
27 |
+
*
|
28 |
+
* @since 3.0.0
|
29 |
+
*/
|
30 |
+
|
31 |
+
var LP_Curriculum_i18n_Store = (function (helpers, data) {
|
32 |
+
var state = helpers.cloneObject(data.i18n);
|
33 |
+
|
34 |
+
var getters = {
|
35 |
+
all: function (state) {
|
36 |
+
return state;
|
37 |
+
}
|
38 |
+
};
|
39 |
+
|
40 |
+
return {
|
41 |
+
namespaced: true,
|
42 |
+
state: state,
|
43 |
+
getters: getters
|
44 |
+
};
|
45 |
+
|
46 |
+
})(LP_Helpers, lpAdminCourseEditorSettings);
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Sections Store.
|
50 |
+
*
|
51 |
+
* @since 3.0.0
|
52 |
+
*/
|
53 |
+
var LP_Curriculum_Sections_Store = (function (helpers, data) {
|
54 |
+
var state = helpers.cloneObject(data.sections);
|
55 |
+
|
56 |
+
state.statusUpdateSection = {};
|
57 |
+
state.statusUpdateSectionItem = {};
|
58 |
+
|
59 |
+
state.sections = state.sections.map(function (section) {
|
60 |
+
var hiddenSections = state.hidden_sections;
|
61 |
+
var find = hiddenSections.find(function (sectionId) {
|
62 |
+
return parseInt(section.id) === parseInt(sectionId);
|
63 |
+
});
|
64 |
+
|
65 |
+
section.open = !find;
|
66 |
+
|
67 |
+
return section;
|
68 |
+
});
|
69 |
+
|
70 |
+
var getters = {
|
71 |
+
sections: function (state) {
|
72 |
+
return state.sections || [];
|
73 |
+
},
|
74 |
+
urlEdit: function (state) {
|
75 |
+
return state.urlEdit;
|
76 |
+
},
|
77 |
+
hiddenSections: function (state) {
|
78 |
+
return state.sections
|
79 |
+
.filter(function (section) {
|
80 |
+
return !section.open;
|
81 |
+
})
|
82 |
+
.map(function (section) {
|
83 |
+
return parseInt(section.id);
|
84 |
+
});
|
85 |
+
},
|
86 |
+
isHiddenAllSections: function (state, getters) {
|
87 |
+
var sections = getters['sections'];
|
88 |
+
var hiddenSections = getters['hiddenSections'];
|
89 |
+
|
90 |
+
return hiddenSections.length === sections.length;
|
91 |
+
},
|
92 |
+
statusUpdateSection: function (state) {
|
93 |
+
return state.statusUpdateSection;
|
94 |
+
},
|
95 |
+
statusUpdateSectionItem: function (state) {
|
96 |
+
return state.statusUpdateSectionItem;
|
97 |
+
}
|
98 |
+
};
|
99 |
+
|
100 |
+
var mutations = {
|
101 |
+
'SORT_SECTION': function (state, orders) {
|
102 |
+
state.sections = state.sections.map(function (section) {
|
103 |
+
section.order = orders[section.id];
|
104 |
+
|
105 |
+
return section;
|
106 |
+
});
|
107 |
+
},
|
108 |
+
'SET_SECTIONS': function (state, sections) {
|
109 |
+
state.sections = sections;
|
110 |
+
},
|
111 |
+
'ADD_NEW_SECTION': function (state, newSection) {
|
112 |
+
if (newSection.open === undefined) {
|
113 |
+
newSection.open = true;
|
114 |
+
}
|
115 |
+
var pos;
|
116 |
+
|
117 |
+
if (newSection.temp_id) {
|
118 |
+
state.sections.map(function (section, i) {
|
119 |
+
if (newSection.temp_id == section.id) {
|
120 |
+
pos = i;
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
});
|
124 |
+
}
|
125 |
+
|
126 |
+
if (pos !== undefined) {
|
127 |
+
$Vue.set(state.sections, pos, newSection);
|
128 |
+
} else {
|
129 |
+
state.sections.push(newSection);
|
130 |
+
}
|
131 |
+
},
|
132 |
+
'ADD_EMPTY_SECTION': function (state, section) {
|
133 |
+
section.open = true;
|
134 |
+
state.sections.push(section);
|
135 |
+
},
|
136 |
+
'REMOVE_SECTION': function (state, index) {
|
137 |
+
state.sections.splice(index, 1);
|
138 |
+
},
|
139 |
+
'REMOVE_SECTION_ITEM': function (state, payload) {
|
140 |
+
|
141 |
+
var section = state.sections.find(function (section) {
|
142 |
+
return (section.id === payload.section_id);
|
143 |
+
});
|
144 |
+
|
145 |
+
var items = section.items || [],
|
146 |
+
item = payload.item,
|
147 |
+
index = -1;
|
148 |
+
items.forEach(function (it, i) {
|
149 |
+
if (it.id === item.id) {
|
150 |
+
index = i;
|
151 |
+
}
|
152 |
+
});
|
153 |
+
|
154 |
+
if (index !== -1) {
|
155 |
+
if (item.temp_id) {
|
156 |
+
items[index].id = item.temp_id;
|
157 |
+
} else {
|
158 |
+
items.splice(index, 1);
|
159 |
+
}
|
160 |
+
}
|
161 |
+
},
|
162 |
+
'UPDATE_SECTION_ITEMS': function (state, payload) {
|
163 |
+
var section = state.sections.find(function (section) {
|
164 |
+
return parseInt(section.id) === parseInt(payload.section_id);
|
165 |
+
});
|
166 |
+
|
167 |
+
if (!section) {
|
168 |
+
return;
|
169 |
+
}
|
170 |
+
section.items = payload.items;
|
171 |
+
},
|
172 |
+
'UPDATE_SECTION_ITEM': function (state, payload) {
|
173 |
+
|
174 |
+
},
|
175 |
+
|
176 |
+
'CLOSE_SECTION': function (state, section) {
|
177 |
+
state.sections.forEach(function (_section, index) {
|
178 |
+
if (section.id === _section.id) {
|
179 |
+
state.sections[index].open = false;
|
180 |
+
}
|
181 |
+
});
|
182 |
+
|
183 |
+
},
|
184 |
+
|
185 |
+
'OPEN_SECTION': function (state, section) {
|
186 |
+
state.sections.forEach(function (_section, index) {
|
187 |
+
if (section.id === _section.id) {
|
188 |
+
state.sections[index].open = true;
|
189 |
+
}
|
190 |
+
});
|
191 |
+
},
|
192 |
+
|
193 |
+
'OPEN_ALL_SECTIONS': function (state) {
|
194 |
+
state.sections = state.sections.map(function (_section) {
|
195 |
+
_section.open = true;
|
196 |
+
|
197 |
+
return _section;
|
198 |
+
});
|
199 |
+
},
|
200 |
+
|
201 |
+
'CLOSE_ALL_SECTIONS': function (state) {
|
202 |
+
state.sections = state.sections.map(function (_section) {
|
203 |
+
_section.open = false;
|
204 |
+
|
205 |
+
return _section;
|
206 |
+
});
|
207 |
+
},
|
208 |
+
|
209 |
+
'UPDATE_SECTION_REQUEST': function (state, sectionId) {
|
210 |
+
$Vue.set(state.statusUpdateSection, sectionId, 'updating');
|
211 |
+
},
|
212 |
+
|
213 |
+
'UPDATE_SECTION_SUCCESS': function (state, sectionId) {
|
214 |
+
$Vue.set(state.statusUpdateSection, sectionId, 'successful');
|
215 |
+
},
|
216 |
+
|
217 |
+
'UPDATE_SECTION_FAILURE': function (state, sectionId) {
|
218 |
+
$Vue.set(state.statusUpdateSection, sectionId, 'failed');
|
219 |
+
},
|
220 |
+
|
221 |
+
'UPDATE_SECTION_ITEM_REQUEST': function (state, itemId) {
|
222 |
+
$Vue.set(state.statusUpdateSectionItem, itemId, 'updating');
|
223 |
+
},
|
224 |
+
|
225 |
+
'UPDATE_SECTION_ITEM_SUCCESS': function (state, itemId) {
|
226 |
+
$Vue.set(state.statusUpdateSectionItem, itemId, 'successful');
|
227 |
+
},
|
228 |
+
|
229 |
+
'UPDATE_SECTION_ITEM_FAILURE': function (state, itemId) {
|
230 |
+
$Vue.set(state.statusUpdateSectionItem, itemId, 'failed');
|
231 |
+
},
|
232 |
+
'APPEND_EMPTY_ITEM_TO_SECTION': function (state, data) {
|
233 |
+
|
234 |
+
var section = state.sections.find(function (section) {
|
235 |
+
return parseInt(section.id) === parseInt(data.section_id);
|
236 |
+
});
|
237 |
+
|
238 |
+
if (!section) {
|
239 |
+
return;
|
240 |
+
}
|
241 |
+
|
242 |
+
section.items.push({id: data.item.id, title: data.item.title, type: 'empty-item'});
|
243 |
+
},
|
244 |
+
'UPDATE_ITEM_SECTION_BY_ID': function (state, data) {
|
245 |
+
var section = state.sections.find(function (section) {
|
246 |
+
return parseInt(section.id) === parseInt(data.section_id);
|
247 |
+
});
|
248 |
+
|
249 |
+
if (!section) {
|
250 |
+
return;
|
251 |
+
}
|
252 |
+
|
253 |
+
for (var i = 0; i < section.items.length; i++) {
|
254 |
+
try {
|
255 |
+
if (!section.items[i]) {
|
256 |
+
continue;
|
257 |
+
}
|
258 |
+
|
259 |
+
var item_id = section.items[i].id;
|
260 |
+
if (item_id) {
|
261 |
+
if (data.items[item_id]) {
|
262 |
+
$Vue.set(section.items, i, data.items[item_id])
|
263 |
+
}
|
264 |
+
}
|
265 |
+
} catch (ex) {
|
266 |
+
console.log(ex)
|
267 |
+
}
|
268 |
+
}
|
269 |
+
|
270 |
+
//section.items.push({id: data.item.id, title: data.item.title, type: 'empty-item'});
|
271 |
+
}
|
272 |
+
};
|
273 |
+
|
274 |
+
var actions = {
|
275 |
+
|
276 |
+
toggleAllSections: function (context) {
|
277 |
+
var hidden = context.getters['isHiddenAllSections'];
|
278 |
+
|
279 |
+
if (hidden) {
|
280 |
+
context.commit('OPEN_ALL_SECTIONS');
|
281 |
+
} else {
|
282 |
+
context.commit('CLOSE_ALL_SECTIONS');
|
283 |
+
}
|
284 |
+
|
285 |
+
LP.Request({
|
286 |
+
type: 'hidden-sections',
|
287 |
+
hidden: context.getters['hiddenSections']
|
288 |
+
});
|
289 |
+
},
|
290 |
+
|
291 |
+
updateSectionsOrder: function (context, order) {
|
292 |
+
LP.Request({
|
293 |
+
type: 'sort-sections',
|
294 |
+
order: JSON.stringify(order)
|
295 |
+
}).then(
|
296 |
+
function (response) {
|
297 |
+
var result = response.body;
|
298 |
+
var order_sections = result.data;
|
299 |
+
context.commit('SORT_SECTION', order_sections);
|
300 |
+
},
|
301 |
+
function (error) {
|
302 |
+
console.error(error);
|
303 |
+
}
|
304 |
+
);
|
305 |
+
},
|
306 |
+
|
307 |
+
toggleSection: function (context, section) {
|
308 |
+
if (section.open) {
|
309 |
+
context.commit('CLOSE_SECTION', section);
|
310 |
+
} else {
|
311 |
+
context.commit('OPEN_SECTION', section);
|
312 |
+
}
|
313 |
+
|
314 |
+
LP.Request({
|
315 |
+
type: 'hidden-sections',
|
316 |
+
hidden: context.getters['hiddenSections']
|
317 |
+
});
|
318 |
+
},
|
319 |
+
|
320 |
+
updateSection: function (context, section) {
|
321 |
+
context.commit('UPDATE_SECTION_REQUEST', section.id);
|
322 |
+
|
323 |
+
LP.Request({
|
324 |
+
type: 'update-section',
|
325 |
+
section: JSON.stringify(section)
|
326 |
+
})
|
327 |
+
.then(function () {
|
328 |
+
context.commit('UPDATE_SECTION_SUCCESS', section.id);
|
329 |
+
})
|
330 |
+
.catch(function () {
|
331 |
+
context.commit('UPDATE_SECTION_FAILURE', section.id);
|
332 |
+
})
|
333 |
+
},
|
334 |
+
|
335 |
+
removeSection: function (context, payload) {
|
336 |
+
context.commit('REMOVE_SECTION', payload.index);
|
337 |
+
|
338 |
+
LP.Request({
|
339 |
+
type: 'remove-section',
|
340 |
+
section_id: payload.section.id
|
341 |
+
}).then(
|
342 |
+
function (response) {
|
343 |
+
var result = response.body;
|
344 |
+
},
|
345 |
+
function (error) {
|
346 |
+
console.error(error);
|
347 |
+
}
|
348 |
+
);
|
349 |
+
},
|
350 |
+
|
351 |
+
newSection: function (context, name) {
|
352 |
+
var newSection = {
|
353 |
+
type: 'new-section',
|
354 |
+
section_name: name,
|
355 |
+
temp_id: LP.uniqueId()
|
356 |
+
}
|
357 |
+
context.commit('ADD_NEW_SECTION', {
|
358 |
+
id: newSection.temp_id,
|
359 |
+
items: [],
|
360 |
+
open: false,
|
361 |
+
title: newSection.section_name
|
362 |
+
});
|
363 |
+
|
364 |
+
LP.Request(newSection).then(
|
365 |
+
function (response) {
|
366 |
+
var result = response.body;
|
367 |
+
|
368 |
+
if (result.success) {
|
369 |
+
var section = $.extend({}, result.data, {open: true});
|
370 |
+
|
371 |
+
// update course section
|
372 |
+
context.commit('ADD_NEW_SECTION', section);
|
373 |
+
}
|
374 |
+
},
|
375 |
+
function (error) {
|
376 |
+
console.error(error);
|
377 |
+
}
|
378 |
+
);
|
379 |
+
},
|
380 |
+
|
381 |
+
updateSectionItem: function (context, payload) {
|
382 |
+
context.commit('UPDATE_SECTION_ITEM_REQUEST', payload.item.id);
|
383 |
+
|
384 |
+
LP.Request({
|
385 |
+
type: 'update-section-item',
|
386 |
+
section_id: payload.section_id,
|
387 |
+
item: JSON.stringify(payload.item)
|
388 |
+
|
389 |
+
}).then(
|
390 |
+
function (response) {
|
391 |
+
context.commit('UPDATE_SECTION_ITEM_SUCCESS', payload.item.id);
|
392 |
+
|
393 |
+
var result = response.body;
|
394 |
+
if (result.success) {
|
395 |
+
var item = result.data;
|
396 |
+
|
397 |
+
context.commit('UPDATE_SECTION_ITEM', {section_id: payload.section_id, item: item});
|
398 |
+
}
|
399 |
+
},
|
400 |
+
function (error) {
|
401 |
+
context.commit('UPDATE_SECTION_ITEM_FAILURE', payload.item.id);
|
402 |
+
console.error(error);
|
403 |
+
}
|
404 |
+
);
|
405 |
+
},
|
406 |
+
|
407 |
+
removeSectionItem: function (context, payload) {
|
408 |
+
var id = payload.item.id;
|
409 |
+
context.commit('REMOVE_SECTION_ITEM', payload);
|
410 |
+
payload.item.temp_id = 0;
|
411 |
+
LP.Request({
|
412 |
+
type: 'remove-section-item',
|
413 |
+
section_id: payload.section_id,
|
414 |
+
item_id: id
|
415 |
+
}).then(
|
416 |
+
function () {
|
417 |
+
context.commit('REMOVE_SECTION_ITEM', payload);
|
418 |
+
}
|
419 |
+
);
|
420 |
+
},
|
421 |
+
|
422 |
+
deleteSectionItem: function (context, payload) {
|
423 |
+
var id = payload.item.id;
|
424 |
+
context.commit('REMOVE_SECTION_ITEM', payload);
|
425 |
+
payload.item.temp_id = 0;
|
426 |
+
LP.Request({
|
427 |
+
type: 'delete-section-item',
|
428 |
+
section_id: payload.section_id,
|
429 |
+
item_id: id
|
430 |
+
}).then(
|
431 |
+
function () {
|
432 |
+
context.commit('REMOVE_SECTION_ITEM', payload);
|
433 |
+
}
|
434 |
+
);
|
435 |
+
},
|
436 |
+
|
437 |
+
newSectionItem: function (context, payload) {
|
438 |
+
|
439 |
+
context.commit('APPEND_EMPTY_ITEM_TO_SECTION', payload)
|
440 |
+
//context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
|
441 |
+
LP.Request({
|
442 |
+
type: 'new-section-item',
|
443 |
+
section_id: payload.section_id,
|
444 |
+
item: JSON.stringify(payload.item)
|
445 |
+
}).then(
|
446 |
+
function (response) {
|
447 |
+
var result = response.body;
|
448 |
+
|
449 |
+
if (result.success) {
|
450 |
+
// context.commit('UPDATE_SECTION_ITEMS', {section_id: payload.section_id, items: result.data});
|
451 |
+
var items = {};
|
452 |
+
$.each(result.data, function (i, a) {
|
453 |
+
items[a.old_id ? a.old_id : a.id] = a;
|
454 |
+
});
|
455 |
+
context.commit('UPDATE_ITEM_SECTION_BY_ID', {
|
456 |
+
section_id: payload.section_id,
|
457 |
+
items: items
|
458 |
+
});
|
459 |
+
}
|
460 |
+
},
|
461 |
+
function (error) {
|
462 |
+
console.error(error);
|
463 |
+
}
|
464 |
+
);
|
465 |
+
},
|
466 |
+
|
467 |
+
updateSectionItems: function (context, payload) {
|
468 |
+
LP.Request({
|
469 |
+
type: 'update-section-items',
|
470 |
+
section_id: payload.section_id,
|
471 |
+
items: JSON.stringify(payload.items),
|
472 |
+
last_section: state.sections[state.sections.length - 1] === (payload.section_id)
|
473 |
+
}).then(
|
474 |
+
function (response) {
|
475 |
+
var result = response.body;
|
476 |
+
|
477 |
+
if (result.success) {
|
478 |
+
// console.log(result);
|
479 |
+
}
|
480 |
+
},
|
481 |
+
function (error) {
|
482 |
+
console.error(error);
|
483 |
+
}
|
484 |
+
);
|
485 |
+
}
|
486 |
+
};
|
487 |
+
|
488 |
+
return {
|
489 |
+
namespaced: true,
|
490 |
+
state: state,
|
491 |
+
getters: getters,
|
492 |
+
mutations: mutations,
|
493 |
+
actions: actions
|
494 |
+
};
|
495 |
+
})(LP_Helpers, lpAdminCourseEditorSettings);
|
496 |
+
|
497 |
+
|
498 |
+
/**
|
499 |
+
* Choose Item Modal Store
|
500 |
+
*
|
501 |
+
* @since 3.0.0
|
502 |
+
*
|
503 |
+
* @type {{namespaced, state, getters, mutations, actions}}
|
504 |
+
*/
|
505 |
+
var LP_Choose_Items_Modal_Store = (function (exports, helpers, data) {
|
506 |
+
var state = helpers.cloneObject(data.chooseItems);
|
507 |
+
state.sectionId = false;
|
508 |
+
state.pagination = '';
|
509 |
+
state.status = '';
|
510 |
+
|
511 |
+
var getters = {
|
512 |
+
status: function (state) {
|
513 |
+
return state.status;
|
514 |
+
},
|
515 |
+
pagination: function (state) {
|
516 |
+
return state.pagination;
|
517 |
+
},
|
518 |
+
items: function (state, _getters) {
|
519 |
+
return state.items.map(function (item) {
|
520 |
+
var find = _getters.addedItems.find(function (_item) {
|
521 |
+
return item.id === _item.id;
|
522 |
+
});
|
523 |
+
|
524 |
+
item.added = !!find;
|
525 |
+
|
526 |
+
return item;
|
527 |
+
});
|
528 |
+
},
|
529 |
+
addedItems: function (state) {
|
530 |
+
return state.addedItems;
|
531 |
+
},
|
532 |
+
isOpen: function (state) {
|
533 |
+
return state.open;
|
534 |
+
},
|
535 |
+
types: function (state) {
|
536 |
+
return state.types;
|
537 |
+
},
|
538 |
+
section: function () {
|
539 |
+
return state.sectionId;
|
540 |
+
}
|
541 |
+
};
|
542 |
+
|
543 |
+
var mutations = {
|
544 |
+
'TOGGLE': function (state) {
|
545 |
+
state.open = !state.open;
|
546 |
+
},
|
547 |
+
'SET_SECTION': function (state, sectionId) {
|
548 |
+
state.sectionId = sectionId;
|
549 |
+
},
|
550 |
+
'SET_LIST_ITEMS': function (state, items) {
|
551 |
+
state.items = items;
|
552 |
+
},
|
553 |
+
'ADD_ITEM': function (state, item) {
|
554 |
+
state.addedItems.push(item);
|
555 |
+
},
|
556 |
+
'REMOVE_ADDED_ITEM': function (state, item) {
|
557 |
+
state.addedItems.forEach(function (_item, index) {
|
558 |
+
if (_item.id === item.id) {
|
559 |
+
state.addedItems.splice(index, 1);
|
560 |
+
}
|
561 |
+
});
|
562 |
+
},
|
563 |
+
'RESET': function (state) {
|
564 |
+
state.addedItems = [];
|
565 |
+
state.items = [];
|
566 |
+
},
|
567 |
+
'UPDATE_PAGINATION': function (state, pagination) {
|
568 |
+
state.pagination = pagination;
|
569 |
+
},
|
570 |
+
'SEARCH_ITEMS_REQUEST': function (state) {
|
571 |
+
state.status = 'loading';
|
572 |
+
},
|
573 |
+
'SEARCH_ITEMS_SUCCESS': function (state) {
|
574 |
+
state.status = 'successful';
|
575 |
+
},
|
576 |
+
'SEARCH_ITEMS_FAILURE': function (state) {
|
577 |
+
state.status = 'failed';
|
578 |
+
}
|
579 |
+
};
|
580 |
+
|
581 |
+
var actions = {
|
582 |
+
|
583 |
+
toggle: function (context) {
|
584 |
+
context.commit('TOGGLE');
|
585 |
+
},
|
586 |
+
|
587 |
+
open: function (context, sectionId) {
|
588 |
+
context.commit('SET_SECTION', sectionId);
|
589 |
+
context.commit('RESET');
|
590 |
+
context.commit('TOGGLE');
|
591 |
+
},
|
592 |
+
|
593 |
+
searchItems: function (context, payload) {
|
594 |
+
context.commit('SEARCH_ITEMS_REQUEST');
|
595 |
+
|
596 |
+
LP.Request({
|
597 |
+
type: 'search-items',
|
598 |
+
query: payload.query,
|
599 |
+
item_type: payload.type,
|
600 |
+
page: payload.page,
|
601 |
+
exclude: JSON.stringify([])
|
602 |
+
}).then(
|
603 |
+
function (response) {
|
604 |
+
var result = response.body;
|
605 |
+
|
606 |
+
if (!result.success) {
|
607 |
+
return;
|
608 |
+
}
|
609 |
+
|
610 |
+
var data = result.data;
|
611 |
+
|
612 |
+
context.commit('SET_LIST_ITEMS', data.items);
|
613 |
+
context.commit('UPDATE_PAGINATION', data.pagination);
|
614 |
+
context.commit('SEARCH_ITEMS_SUCCESS');
|
615 |
+
},
|
616 |
+
function (error) {
|
617 |
+
context.commit('SEARCH_ITEMS_FAILURE');
|
618 |
+
|
619 |
+
console.error(error);
|
620 |
+
}
|
621 |
+
);
|
622 |
+
},
|
623 |
+
|
624 |
+
addItem: function (context, item) {
|
625 |
+
context.commit('ADD_ITEM', item);
|
626 |
+
},
|
627 |
+
|
628 |
+
removeItem: function (context, index) {
|
629 |
+
context.commit('REMOVE_ADDED_ITEM', index);
|
630 |
+
},
|
631 |
+
|
632 |
+
addItemsToSection: function (context) {
|
633 |
+
var items = context.getters.addedItems;
|
634 |
+
|
635 |
+
if (items.length > 0) {
|
636 |
+
LP.Request({
|
637 |
+
type: 'add-items-to-section',
|
638 |
+
section_id: context.getters.section,
|
639 |
+
items: JSON.stringify(items)
|
640 |
+
}).then(
|
641 |
+
function (response) {
|
642 |
+
var result = response.body;
|
643 |
+
|
644 |
+
if (result.success) {
|
645 |
+
context.commit('TOGGLE');
|
646 |
+
|
647 |
+
var items = result.data;
|
648 |
+
context.commit('ss/UPDATE_SECTION_ITEMS', {
|
649 |
+
section_id: context.getters.section,
|
650 |
+
items: items
|
651 |
+
}, {root: true});
|
652 |
+
}
|
653 |
+
},
|
654 |
+
function (error) {
|
655 |
+
console.error(error);
|
656 |
+
}
|
657 |
+
);
|
658 |
+
}
|
659 |
+
}
|
660 |
+
};
|
661 |
+
|
662 |
+
return {
|
663 |
+
namespaced: true,
|
664 |
+
state: state,
|
665 |
+
getters: getters,
|
666 |
+
mutations: mutations,
|
667 |
+
actions: actions
|
668 |
+
}
|
669 |
+
})(window, LP_Helpers, lpAdminCourseEditorSettings);
|
670 |
+
|
671 |
+
/**
|
672 |
+
* Root Store
|
673 |
+
*
|
674 |
+
* @since 3.0.0
|
675 |
+
*/
|
676 |
+
(function (exports, helpers, data) {
|
677 |
+
var state = helpers.cloneObject(data.root);
|
678 |
+
|
679 |
+
state.status = 'success';
|
680 |
+
state.heartbeat = true;
|
681 |
+
state.countCurrentRequest = 0;
|
682 |
+
|
683 |
+
var getters = {
|
684 |
+
heartbeat: function (state) {
|
685 |
+
return state.heartbeat;
|
686 |
+
},
|
687 |
+
action: function (state) {
|
688 |
+
return state.action;
|
689 |
+
},
|
690 |
+
id: function (state) {
|
691 |
+
return state.course_id;
|
692 |
+
},
|
693 |
+
autoDraft: function (state) {
|
694 |
+
return state.auto_draft;
|
695 |
+
},
|
696 |
+
disable_curriculum: function (state) {
|
697 |
+
return state.disable_curriculum;
|
698 |
+
},
|
699 |
+
status: function (state) {
|
700 |
+
return state.status || 'error';
|
701 |
+
},
|
702 |
+
currentRequest: function (state) {
|
703 |
+
return state.countCurrentRequest || 0;
|
704 |
+
},
|
705 |
+
urlAjax: function (state) {
|
706 |
+
return state.ajax;
|
707 |
+
},
|
708 |
+
nonce: function (state) {
|
709 |
+
return state.nonce;
|
710 |
+
}
|
711 |
+
};
|
712 |
+
|
713 |
+
var mutations = {
|
714 |
+
|
715 |
+
'UPDATE_HEART_BEAT': function (state, status) {
|
716 |
+
state.heartbeat = !!status;
|
717 |
+
},
|
718 |
+
|
719 |
+
'UPDATE_AUTO_DRAFT_STATUS': function (state, status) {
|
720 |
+
// check auto draft status
|
721 |
+
state.auto_draft = status;
|
722 |
+
},
|
723 |
+
|
724 |
+
'UPDATE_STATUS': function (state, status) {
|
725 |
+
state.status = status;
|
726 |
+
},
|
727 |
+
|
728 |
+
'INCREASE_NUMBER_REQUEST': function (state) {
|
729 |
+
state.countCurrentRequest++;
|
730 |
+
},
|
731 |
+
|
732 |
+
'DECREASE_NUMBER_REQUEST': function (state) {
|
733 |
+
state.countCurrentRequest--;
|
734 |
+
}
|
735 |
+
};
|
736 |
+
|
737 |
+
var actions = {
|
738 |
+
heartbeat: function (context) {
|
739 |
+
LP.Request({
|
740 |
+
type: 'heartbeat'
|
741 |
+
}).then(
|
742 |
+
function (response) {
|
743 |
+
var result = response.body;
|
744 |
+
context.commit('UPDATE_HEART_BEAT', !!result.success);
|
745 |
+
},
|
746 |
+
function (error) {
|
747 |
+
context.commit('UPDATE_HEART_BEAT', false);
|
748 |
+
}
|
749 |
+
);
|
750 |
+
},
|
751 |
+
|
752 |
+
draftCourse: function (context, payload) {
|
753 |
+
var auto_draft = context.getters['autoDraft'];
|
754 |
+
|
755 |
+
if (auto_draft) {
|
756 |
+
LP.Request({
|
757 |
+
type: 'draft-course',
|
758 |
+
course: JSON.stringify(payload)
|
759 |
+
}).then(function (response) {
|
760 |
+
var result = response.body;
|
761 |
+
|
762 |
+
if (!result.success) {
|
763 |
+
return;
|
764 |
+
}
|
765 |
+
|
766 |
+
context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
|
767 |
+
}
|
768 |
+
)
|
769 |
+
}
|
770 |
+
},
|
771 |
+
|
772 |
+
newRequest: function (context) {
|
773 |
+
context.commit('INCREASE_NUMBER_REQUEST');
|
774 |
+
context.commit('UPDATE_STATUS', 'loading');
|
775 |
+
|
776 |
+
window.onbeforeunload = function () {
|
777 |
+
return '';
|
778 |
+
}
|
779 |
+
},
|
780 |
+
|
781 |
+
requestComplete: function (context, status) {
|
782 |
+
context.commit('DECREASE_NUMBER_REQUEST');
|
783 |
+
|
784 |
+
if (context.getters.currentRequest === 0) {
|
785 |
+
context.commit('UPDATE_STATUS', status);
|
786 |
+
window.onbeforeunload = null;
|
787 |
+
}
|
788 |
+
}
|
789 |
+
};
|
790 |
+
|
791 |
+
exports.LP_Curriculum_Store = new $Vuex.Store({
|
792 |
+
state: state,
|
793 |
+
getters: getters,
|
794 |
+
mutations: mutations,
|
795 |
+
actions: actions,
|
796 |
+
modules: {
|
797 |
+
ci: LP_Choose_Items_Modal_Store,
|
798 |
+
i18n: LP_Curriculum_i18n_Store,
|
799 |
+
ss: LP_Curriculum_Sections_Store
|
800 |
+
}
|
801 |
+
});
|
802 |
+
|
803 |
+
})(window, LP_Helpers, lpAdminCourseEditorSettings);
|
804 |
+
|
805 |
+
/**
|
806 |
+
* HTTP
|
807 |
+
*
|
808 |
+
* @since 3.0.0
|
809 |
+
*/
|
810 |
+
(function (exports, $store) {
|
811 |
+
LP.Request = function (payload) {
|
812 |
+
payload['id'] = $store.getters.id;
|
813 |
+
payload['nonce'] = $store.getters.nonce;
|
814 |
+
payload['lp-ajax'] = $store.getters.action;
|
815 |
+
|
816 |
+
return $VueHTTP.post($store.getters.urlAjax,
|
817 |
+
payload,
|
818 |
+
{
|
819 |
+
emulateJSON: true,
|
820 |
+
params: {
|
821 |
+
namespace: 'LPCurriculumRequest'
|
822 |
+
}
|
823 |
+
});
|
824 |
+
};
|
825 |
+
|
826 |
+
$VueHTTP.interceptors.push(function (request, next) {
|
827 |
+
if (request.params['namespace'] !== 'LPCurriculumRequest') {
|
828 |
+
next();
|
829 |
+
return;
|
830 |
+
}
|
831 |
+
|
832 |
+
$store.dispatch('newRequest');
|
833 |
+
|
834 |
+
next(function (response) {
|
835 |
+
|
836 |
+
if (!jQuery.isPlainObject(response.body)) {
|
837 |
+
response.body = LP.parseJSON(response.body);
|
838 |
+
}
|
839 |
+
|
840 |
+
var body = response.body;
|
841 |
+
var result = body.success || false;
|
842 |
+
|
843 |
+
if (result) {
|
844 |
+
$store.dispatch('requestComplete', 'success');
|
845 |
+
} else {
|
846 |
+
$store.dispatch('requestComplete', 'failed');
|
847 |
+
}
|
848 |
+
});
|
849 |
+
});
|
850 |
+
})(window, LP_Curriculum_Store);
|
851 |
+
|
852 |
+
/**
|
853 |
+
* Init app.
|
854 |
+
*
|
855 |
+
* @since 3.0.0
|
856 |
+
*/
|
857 |
+
(function ($, $store) {
|
858 |
+
$(document).ready(function () {
|
859 |
+
window.LP_Course_Editor = new $Vue({
|
860 |
+
el: '#admin-editor-lp_course',
|
861 |
+
template: '<lp-course-editor></lp-course-editor>'
|
862 |
+
});
|
863 |
+
});
|
864 |
+
})(jQuery, LP_Curriculum_Store);
|
865 |
+
|
866 |
+
});
|
assets/js/admin/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden.
|
assets/js/admin/meta-box-order.js
ADDED
@@ -0,0 +1,461 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;
|
2 |
+
(function ($) {
|
3 |
+
"use strict";
|
4 |
+
window.$Vue = window.$Vue || Vue;
|
5 |
+
|
6 |
+
$(document).ready(function () {
|
7 |
+
|
8 |
+
var $listItems = $('.list-order-items').find('tbody'),
|
9 |
+
$listUsers = $('#list-users'),
|
10 |
+
template = function (templateHTML, data) {
|
11 |
+
return _.template(templateHTML, {
|
12 |
+
evaluate: /<#([\s\S]+?)#>/g,
|
13 |
+
interpolate: /\{\{\{([\s\S]+?)\}\}\}/g,
|
14 |
+
escape: /\{\{([^\}]+?)\}\}(?!\})/g
|
15 |
+
})(data);
|
16 |
+
},
|
17 |
+
advancedListOptions = {
|
18 |
+
template: '#tmpl-order-advanced-list-item',
|
19 |
+
onRemove: function () {
|
20 |
+
if (this.$el.children().length === 0) {
|
21 |
+
this.$el.append('<li class="user-guest">' + orderOptions.i18n_guest + '</li>')
|
22 |
+
}
|
23 |
+
console.log(this.$el)
|
24 |
+
},
|
25 |
+
onAdd: function () {
|
26 |
+
this.$el.find('.user-guest').remove();
|
27 |
+
}
|
28 |
+
},
|
29 |
+
orderOptions = lpMetaBoxOrderSettings;
|
30 |
+
|
31 |
+
function getAddedUsers() {
|
32 |
+
return $('#list-users').children().map(function () {
|
33 |
+
return $(this).data('id')
|
34 |
+
}).get();
|
35 |
+
}
|
36 |
+
|
37 |
+
function getAddedItems() {
|
38 |
+
return $('.list-order-items tbody').children('.order-item-row').map(function () {
|
39 |
+
return $(this).data('id')
|
40 |
+
}).get();
|
41 |
+
}
|
42 |
+
|
43 |
+
if ($listUsers.length) {
|
44 |
+
$listUsers.advancedList(advancedListOptions);
|
45 |
+
if (orderOptions.users) {
|
46 |
+
_.forEach(orderOptions.users, function (userData, userId) {
|
47 |
+
$listUsers.advancedList('add', [
|
48 |
+
template(orderOptions.userTextFormat, userData),
|
49 |
+
userId
|
50 |
+
]);
|
51 |
+
})
|
52 |
+
}
|
53 |
+
}
|
54 |
+
|
55 |
+
$listItems.on('click', '.remove-order-item', function (e) {
|
56 |
+
e.preventDefault();
|
57 |
+
var $item = $(this).closest('tr'),
|
58 |
+
item_id = $item.data('item_id');
|
59 |
+
|
60 |
+
$item.remove();
|
61 |
+
if ($listItems.children(':not(.no-order-items)').length === 0) {
|
62 |
+
$listItems.find('.no-order-items').show();
|
63 |
+
}
|
64 |
+
|
65 |
+
$Vue.http.post(
|
66 |
+
window.location.href, {
|
67 |
+
order_id: $('#post_ID').val(),
|
68 |
+
items: [item_id],
|
69 |
+
'lp-ajax': 'remove_items_from_order'
|
70 |
+
}, {
|
71 |
+
emulateJSON: true,
|
72 |
+
params: {}
|
73 |
+
}
|
74 |
+
).then(function (response) {
|
75 |
+
var result = LP.parseJSON(response.body || response.bodyText);
|
76 |
+
$('.order-subtotal').html(result.order_data.subtotal_html);
|
77 |
+
$('.order-total').html(result.order_data.total_html);
|
78 |
+
});
|
79 |
+
});
|
80 |
+
|
81 |
+
$('.order-date.date-picker').on('change', function () {
|
82 |
+
var m = this.value.split('-');
|
83 |
+
['aa', 'mm', 'jj'].forEach(function (v, k) {
|
84 |
+
$('input[name="' + v + '"]').val(m[k]);
|
85 |
+
});
|
86 |
+
}).datepicker({
|
87 |
+
dateFormat: 'yy-mm-dd',
|
88 |
+
numberOfMonths: 1,
|
89 |
+
showButtonPanel: true,
|
90 |
+
select: function () {
|
91 |
+
console.log(arguments)
|
92 |
+
}
|
93 |
+
});
|
94 |
+
|
95 |
+
$('#learn-press-add-order-item').on('click', function () {
|
96 |
+
LP.$modalSearchItems.open({
|
97 |
+
data: {
|
98 |
+
postType: 'lp_course',
|
99 |
+
context: 'order-items',
|
100 |
+
contextId: $('#post_ID').val(),
|
101 |
+
exclude: getAddedItems(),
|
102 |
+
show: true
|
103 |
+
},
|
104 |
+
callbacks: {
|
105 |
+
addItems: function () {
|
106 |
+
var that = this;
|
107 |
+
$Vue.http.post(
|
108 |
+
window.location.href, {
|
109 |
+
order_id: this.contextId,
|
110 |
+
items: this.selected,
|
111 |
+
'lp-ajax': 'add_items_to_order'
|
112 |
+
}, {
|
113 |
+
emulateJSON: true,
|
114 |
+
params: {}
|
115 |
+
}
|
116 |
+
).then(function (response) {
|
117 |
+
var result = LP.parseJSON(response.body || response.bodyText),
|
118 |
+
$noItem = $listItems.find('.no-order-items').hide();
|
119 |
+
$(result.item_html).insertBefore($noItem);
|
120 |
+
$('.order-subtotal').html(result.order_data.subtotal_html);
|
121 |
+
$('.order-total').html(result.order_data.total_html);
|
122 |
+
});
|
123 |
+
this.close();
|
124 |
+
}
|
125 |
+
}
|
126 |
+
});
|
127 |
+
});
|
128 |
+
|
129 |
+
$(document).on('click', '.change-user', function (e) {
|
130 |
+
e.preventDefault();
|
131 |
+
LP.$modalSearchUsers.open({
|
132 |
+
data: {
|
133 |
+
context: 'order-items',
|
134 |
+
contextId: $('#post_ID').val(),
|
135 |
+
show: true,
|
136 |
+
multiple: $(this).data('multiple') === 'yes',
|
137 |
+
exclude: getAddedUsers(),
|
138 |
+
textFormat: orderOptions.userTextFormat
|
139 |
+
},
|
140 |
+
callbacks: {
|
141 |
+
addUsers: function (data) {
|
142 |
+
if (this.multiple) {
|
143 |
+
if (!$listUsers.length) {
|
144 |
+
$listUsers = $(LP.template('tmpl-order-data-user')({multiple: true}));
|
145 |
+
$listUsers.advancedList(advancedListOptions);
|
146 |
+
|
147 |
+
$('.order-data-user').replaceWith($listUsers);
|
148 |
+
}
|
149 |
+
for (var i = 0; i < this.selected.length; i++) {
|
150 |
+
$listUsers.advancedList('add', [template(this.textFormat, this.selected[i]), this.selected[i].id]);
|
151 |
+
}
|
152 |
+
} else {
|
153 |
+
var $html = LP.template('tmpl-order-data-user')({
|
154 |
+
name: template(this.textFormat, this.selected[0]),
|
155 |
+
id: this.selected[0].id
|
156 |
+
});
|
157 |
+
|
158 |
+
$('.order-data-user').replaceWith($html);
|
159 |
+
}
|
160 |
+
|
161 |
+
this.close();
|
162 |
+
}
|
163 |
+
}
|
164 |
+
});
|
165 |
+
});
|
166 |
+
});
|
167 |
+
/*
|
168 |
+
var LP_Order_View = window.LP_Order_View = Backbone.View.extend({
|
169 |
+
el: 'body',
|
170 |
+
events: {
|
171 |
+
'click #learn-press-add-order-item': '_addItem',
|
172 |
+
'click #learn-press-calculate-order-total': 'calculateTotal',
|
173 |
+
'click #learn-press-courses-result a[data-id]': 'addItem',
|
174 |
+
'click .remove-order-item': 'removeItem',
|
175 |
+
'keyup #learn-press-search-item-term': 'searchItems',
|
176 |
+
'change select[name="order-status"]': '_updateDescription'
|
177 |
+
},
|
178 |
+
initialize: function () {
|
179 |
+
_.bindAll(this, 'resetModal', 'updateModal', '_updateDescription');
|
180 |
+
LP.Hook.addAction('learn_press_message_box_before_resize', this.resetModal);
|
181 |
+
LP.Hook.addAction('learn_press_message_box_resize', this.updateModal);
|
182 |
+
|
183 |
+
var $selectUsers = this.$('#order-customer');
|
184 |
+
if ($selectUsers.attr('multiple') == 'multiple') {
|
185 |
+
$selectUsers.select2({
|
186 |
+
width: $('#minor-publishing .misc-pub-section').innerWidth() - 20
|
187 |
+
});
|
188 |
+
}
|
189 |
+
var $add_new_h2 = $('body.post-type-lp_order').find('.page-title-action, .add-new-h2'),
|
190 |
+
$add_h2 = $('<a href="post-new.php?post_type=lp_order&multi-users=yes" class="page-title-action add-new-h2">Add order multiple users</a>');
|
191 |
+
$add_h2
|
192 |
+
.insertAfter($add_new_h2);
|
193 |
+
|
194 |
+
$('.wp-list-table #order_status').css('width', '135px');
|
195 |
+
|
196 |
+
$('select[name="order-status"]').on('change', function () {
|
197 |
+
var $sel = $(this),
|
198 |
+
$sec = $('.order-action-section'),
|
199 |
+
status = $sel.data('status'),
|
200 |
+
order_id = +$sel.closest('tr.type-lp_order').find('td.column-title strong a.row-title').text().replace('#', '');
|
201 |
+
|
202 |
+
// console.log(order_id);
|
203 |
+
// console.log($sel.val());
|
204 |
+
|
205 |
+
$.ajax({
|
206 |
+
url: LP_Settings.ajax,
|
207 |
+
data: {
|
208 |
+
action: 'learnpress_update_order_status',
|
209 |
+
order_id: order_id,
|
210 |
+
value: $sel.val(),
|
211 |
+
},
|
212 |
+
dataType: 'text',
|
213 |
+
type: 'post',
|
214 |
+
success: function (response) {
|
215 |
+
LP.log(response);
|
216 |
+
response = LP.parseJSON(response);
|
217 |
+
if (response.result === 'success') {
|
218 |
+
var $order_table = that.$('.order-items'),
|
219 |
+
$no_item = $order_table.find('.no-order-items');
|
220 |
+
$(response.item_html).insertBefore($no_item);
|
221 |
+
$order_table.find('.order-subtotal').html(response.order_data.subtotal_html);
|
222 |
+
$order_table.find('.order-total').html(response.order_data.total_html);
|
223 |
+
|
224 |
+
$item.remove();
|
225 |
+
$no_item.addClass('hide-if-js');
|
226 |
+
}
|
227 |
+
}
|
228 |
+
});
|
229 |
+
|
230 |
+
$sec.toggleClass('hide-if-js', status != $sel.val());
|
231 |
+
}).trigger('init');
|
232 |
+
|
233 |
+
|
234 |
+
$(document).on('learn_press_modal_search_items_response', this.addItem2);
|
235 |
+
this.userSuggest();
|
236 |
+
},
|
237 |
+
_updateDescription: function (e) {
|
238 |
+
var $sel = $(e.target),
|
239 |
+
$option = $sel.find('option:selected');
|
240 |
+
$sel.siblings('.description').hide().html($option.attr('data-desc'))
|
241 |
+
.removeClass(function (c, d) {
|
242 |
+
var m = d.match(/(lp-.*)\s?/);
|
243 |
+
return m ? m[0] : '';
|
244 |
+
}).addClass($option.val()).show();
|
245 |
+
},
|
246 |
+
userSuggest: function () {
|
247 |
+
var id = ( typeof current_site_id !== 'undefined' ) ? '&site_id=' + current_site_id : '';
|
248 |
+
var position = {offset: '0, -1'};
|
249 |
+
if (typeof isRtl !== 'undefined' && isRtl) {
|
250 |
+
position.my = 'right top';
|
251 |
+
position.at = 'right bottom';
|
252 |
+
}
|
253 |
+
$('.wp-suggest-user').each(function () {
|
254 |
+
var $this = $(this),
|
255 |
+
autocompleteType = ( typeof $this.data('autocompleteType') !== 'undefined' ) ? $this.data('autocompleteType') : 'add',
|
256 |
+
autocompleteField = ( typeof $this.data('autocompleteField') !== 'undefined' ) ? $this.data('autocompleteField') : 'user_login';
|
257 |
+
|
258 |
+
$this.autocomplete({
|
259 |
+
source: LP_Settings.ajax + '?action=learnpress_search_users&autocomplete_type=' + autocompleteType + '&autocomplete_field=' + autocompleteField + id,
|
260 |
+
delay: 500,
|
261 |
+
minLength: 2,
|
262 |
+
position: position,
|
263 |
+
open: function () {
|
264 |
+
$(this).addClass('open');
|
265 |
+
},
|
266 |
+
close: function () {
|
267 |
+
$(this).removeClass('open');
|
268 |
+
},
|
269 |
+
select: function (a, b) {
|
270 |
+
LP.log(a, b);
|
271 |
+
}
|
272 |
+
});
|
273 |
+
});
|
274 |
+
},
|
275 |
+
resetModal: function (height, $app) {
|
276 |
+
this.$('#learn-press-courses-result').css('height', height - 120).css('overflow', 'auto');
|
277 |
+
},
|
278 |
+
updateModal: function ($app) {
|
279 |
+
this.$('#learn-press-courses-result').css('height', '').css('overflow', '');
|
280 |
+
},
|
281 |
+
showFormItems: function (type) {
|
282 |
+
var $form = LP.ModalSearchItems({
|
283 |
+
template: 'tmpl-learn-press-search-items',
|
284 |
+
type: 'lp_course',
|
285 |
+
//section : $button.closest('.curriculum-section'),
|
286 |
+
context: 'course-items',
|
287 |
+
context_id: $('#post_ID').val(),
|
288 |
+
//exclude : this.getSelectedItems(),
|
289 |
+
notices: false
|
290 |
+
});
|
291 |
+
LP.MessageBox.show($form.$el);
|
292 |
+
$form.$el.find('header input').focus();
|
293 |
+
|
294 |
+
},
|
295 |
+
_addItem: function (e) {
|
296 |
+
this.showFormItems('lp_course', 'add-lp_course')
|
297 |
+
// var $form = $('#learn-press-modal-add-order-courses');
|
298 |
+
// if ($form.length == 0) {
|
299 |
+
// $form = $(wp.template('learn-press-modal-add-order-courses')());
|
300 |
+
// }
|
301 |
+
// LP.MessageBox.show($form);
|
302 |
+
},
|
303 |
+
addItem2: function (e, $view, $items) {
|
304 |
+
var that = this;
|
305 |
+
var selected = $items; //$form.find('li:visible input:checked'),
|
306 |
+
if (e.ctrlKey) {
|
307 |
+
//return true;
|
308 |
+
}
|
309 |
+
var ids = [];
|
310 |
+
selected.each(function () {
|
311 |
+
ids.push($(this).data('id'));
|
312 |
+
});
|
313 |
+
|
314 |
+
$.ajax({
|
315 |
+
url: LP_Settings.ajax,
|
316 |
+
data: {
|
317 |
+
action: 'learnpress_add_item_to_order',
|
318 |
+
order_id: parseInt($('input#post_ID').val()),
|
319 |
+
item_id: ids,
|
320 |
+
nonce: $('#learn-press-modal-add-order-courses').attr('data-nonce')
|
321 |
+
},
|
322 |
+
dataType: 'text',
|
323 |
+
type: 'post',
|
324 |
+
success: function (response) {
|
325 |
+
LP.log(response);
|
326 |
+
response = LP.parseJSON(response);
|
327 |
+
if (response.result === 'success') {
|
328 |
+
var $order_table = $('.order-items'),
|
329 |
+
$no_item = $order_table.find('.no-order-items');
|
330 |
+
$(response.item_html).insertBefore($no_item);
|
331 |
+
$order_table.find('.order-subtotal').html(response.order_data.subtotal_html);
|
332 |
+
$order_table.find('.order-total').html(response.order_data.total_html);
|
333 |
+
|
334 |
+
selected.each(function () {
|
335 |
+
console.log($(this));
|
336 |
+
$(this).remove();
|
337 |
+
});
|
338 |
+
$no_item.addClass('hide-if-js');
|
339 |
+
}
|
340 |
+
}
|
341 |
+
});
|
342 |
+
|
343 |
+
return false;
|
344 |
+
// restart sortable
|
345 |
+
// _makeListSortable();
|
346 |
+
},
|
347 |
+
addItem: function (e, ids) {
|
348 |
+
console.log('add item to order');
|
349 |
+
|
350 |
+
var that = this,
|
351 |
+
$item = $(e.target);
|
352 |
+
if (e.ctrlKey) {
|
353 |
+
//return true;
|
354 |
+
}
|
355 |
+
$.ajax({
|
356 |
+
url: LP_Settings.ajax,
|
357 |
+
data: {
|
358 |
+
action: 'learnpress_add_item_to_order',
|
359 |
+
order_id: parseInt($('input#post_ID').val()),
|
360 |
+
item_id: parseInt($item.attr('data-id')),
|
361 |
+
nonce: $('#learn-press-modal-add-order-courses').attr('data-nonce')
|
362 |
+
},
|
363 |
+
dataType: 'text',
|
364 |
+
type: 'post',
|
365 |
+
success: function (response) {
|
366 |
+
LP.log(response);
|
367 |
+
response = LP.parseJSON(response);
|
368 |
+
if (response.result === 'success') {
|
369 |
+
var $order_table = that.$('.order-items'),
|
370 |
+
$no_item = $order_table.find('.no-order-items');
|
371 |
+
$(response.item_html).insertBefore($no_item);
|
372 |
+
$order_table.find('.order-subtotal').html(response.order_data.subtotal_html);
|
373 |
+
$order_table.find('.order-total').html(response.order_data.total_html);
|
374 |
+
|
375 |
+
$item.remove();
|
376 |
+
$no_item.addClass('hide-if-js');
|
377 |
+
}
|
378 |
+
}
|
379 |
+
});
|
380 |
+
|
381 |
+
return false;
|
382 |
+
},
|
383 |
+
removeItem: function (e) {
|
384 |
+
e.preventDefault();
|
385 |
+
var that = this,
|
386 |
+
$item = $(e.target).closest('tr'),
|
387 |
+
item_id = parseInt($item.attr('data-item_id'));
|
388 |
+
if (!item_id) {
|
389 |
+
return;
|
390 |
+
}
|
391 |
+
$.ajax({
|
392 |
+
url: LP_Settings.ajax,
|
393 |
+
data: {
|
394 |
+
action: 'learnpress_remove_order_item',
|
395 |
+
order_id: $('#post_ID').val(),
|
396 |
+
item_id: item_id,
|
397 |
+
remove_nonce: $item.attr('data-remove_nonce')
|
398 |
+
},
|
399 |
+
type: 'post',
|
400 |
+
dataType: 'text',
|
401 |
+
success: function (response) {
|
402 |
+
response = LP.parseJSON(response);
|
403 |
+
if (response.result === 'success') {
|
404 |
+
var $order_table = that.$('.order-items'),
|
405 |
+
$no_item = $order_table.find('.no-order-items'),
|
406 |
+
$other_items = $item.siblings().filter(function () {
|
407 |
+
return !$(this).is($no_item);
|
408 |
+
});
|
409 |
+
$order_table.find('.order-subtotal').html(response.order_data.subtotal_html);
|
410 |
+
$order_table.find('.order-total').html(response.order_data.total_html);
|
411 |
+
$item.remove();
|
412 |
+
$other_items.length == 0 && $no_item.removeClass('hide-if-js');
|
413 |
+
}
|
414 |
+
}
|
415 |
+
});
|
416 |
+
},
|
417 |
+
calculateTotal: function (e) {
|
418 |
+
LP.log(e);
|
419 |
+
},
|
420 |
+
fetchResults: function (results) {
|
421 |
+
var $list = this.$('#learn-press-courses-result'),
|
422 |
+
$t = $list.find('li').filter(function () {
|
423 |
+
return $(this).hasClass('lp-search-no-results') ? true : $(this).remove() && false;
|
424 |
+
});
|
425 |
+
_.each(results, function (i, k) {
|
426 |
+
$('<li><a href="' + i.permalink + '" data-id="' + k + '">' + i.title + '</a></li>').insertBefore($t);
|
427 |
+
});
|
428 |
+
},
|
429 |
+
searchItems: function (e) {
|
430 |
+
var that = this,
|
431 |
+
$input = $(e.target),
|
432 |
+
timer = $input.data('timer'),
|
433 |
+
term = $input.val(),
|
434 |
+
_search = function () {
|
435 |
+
$.ajax({
|
436 |
+
url: LP_Settings.ajax,
|
437 |
+
data: {
|
438 |
+
action: 'learnpress_search_courses',
|
439 |
+
nonce: $input.attr('data-nonce'),
|
440 |
+
term: term
|
441 |
+
},
|
442 |
+
type: 'get',
|
443 |
+
dataType: 'text',
|
444 |
+
success: function (response) {
|
445 |
+
response = LP.parseJSON(response);
|
446 |
+
that.fetchResults(response);
|
447 |
+
}
|
448 |
+
});
|
449 |
+
};
|
450 |
+
timer && clearTimeout(timer);
|
451 |
+
if ((term + '').length >= 3) {
|
452 |
+
timer = setTimeout(_search, 250);
|
453 |
+
$input.data('timer', timer);
|
454 |
+
}
|
455 |
+
}
|
456 |
+
});
|
457 |
+
|
458 |
+
$(document).ready(function () {
|
459 |
+
new LP_Order_View();
|
460 |
+
});*/
|
461 |
+
})(jQuery);
|
assets/js/admin/modal-search-items.js
ADDED
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*global jQuery, Backbone, _ */
|
2 |
+
(function ($, _) {
|
3 |
+
'use strict';
|
4 |
+
window.$Vue = window.$Vue || Vue;
|
5 |
+
var $VueHTTP = $Vue.http;
|
6 |
+
|
7 |
+
$(document).ready(function () {
|
8 |
+
$Vue.component('learn-press-modal-search-items', {
|
9 |
+
template: '#learn-press-modal-search-items',
|
10 |
+
data: function () {
|
11 |
+
return {
|
12 |
+
paged: 1,
|
13 |
+
term: '',
|
14 |
+
hasItems: false,
|
15 |
+
selected: []
|
16 |
+
}
|
17 |
+
},
|
18 |
+
watch: {
|
19 |
+
show: function (value) {
|
20 |
+
if (value) {
|
21 |
+
$(this.$refs.search).focus();
|
22 |
+
}
|
23 |
+
}
|
24 |
+
},
|
25 |
+
props: ['postType', 'context', 'contextId', 'show', 'callbacks', 'exclude'],
|
26 |
+
created: function () {
|
27 |
+
},
|
28 |
+
mounted: function () {
|
29 |
+
this.term = '';
|
30 |
+
this.paged = 1;
|
31 |
+
this.search();
|
32 |
+
},
|
33 |
+
methods: {
|
34 |
+
doSearch: function (e) {
|
35 |
+
this.term = e.target.value;
|
36 |
+
this.paged = 1;
|
37 |
+
this.search();
|
38 |
+
},
|
39 |
+
search: _.debounce(function (term) {
|
40 |
+
$('#modal-search-items').addClass('loading');
|
41 |
+
var that = this;
|
42 |
+
$VueHTTP.post(
|
43 |
+
window.location.href, {
|
44 |
+
type: this.postType,
|
45 |
+
context: this.context,
|
46 |
+
context_id: this.contextId,
|
47 |
+
term: term || this.term,
|
48 |
+
paged: this.paged,
|
49 |
+
exclude: this.exclude,
|
50 |
+
'lp-ajax': 'modal_search_items'
|
51 |
+
}, {
|
52 |
+
emulateJSON: true,
|
53 |
+
params: {}
|
54 |
+
}
|
55 |
+
).then(function (response) {
|
56 |
+
var result = LP.parseJSON(response.body || response.bodyText);
|
57 |
+
that.hasItems = !!_.size(result.items);
|
58 |
+
|
59 |
+
$('#modal-search-items').removeClass('loading');
|
60 |
+
|
61 |
+
$(that.$el).find('.search-results').html(result.html).find('input[type="checkbox"]').each(function () {
|
62 |
+
var id = parseInt($(this).val());
|
63 |
+
if (_.indexOf(that.selected, id) >= 0) {
|
64 |
+
this.checked = true;
|
65 |
+
}
|
66 |
+
});
|
67 |
+
_.debounce(function () {
|
68 |
+
$(that.$el).find('.search-nav').html(result.nav).find('a, span').addClass('button').filter('span').addClass('disabled');
|
69 |
+
}, 10)();
|
70 |
+
});
|
71 |
+
}, 500),
|
72 |
+
loadPage: function (e) {
|
73 |
+
e.preventDefault();
|
74 |
+
var $button = $(e.target);
|
75 |
+
if ($button.is('span')) {
|
76 |
+
return;
|
77 |
+
}
|
78 |
+
if ($button.hasClass('next')) {
|
79 |
+
this.paged++;
|
80 |
+
} else if ($button.hasClass('prev')) {
|
81 |
+
this.paged--;
|
82 |
+
} else {
|
83 |
+
var paged = $button.html();
|
84 |
+
this.paged = parseInt(paged);
|
85 |
+
}
|
86 |
+
this.search();
|
87 |
+
},
|
88 |
+
selectItem: function (e) {
|
89 |
+
var $select = $(e.target).closest('li'),
|
90 |
+
$chk = $select.find('input[type="checkbox"]'),
|
91 |
+
id = parseInt($chk.val()),
|
92 |
+
pos = _.indexOf(this.selected, id);
|
93 |
+
|
94 |
+
if ($chk.is(':checked')) {
|
95 |
+
if (pos === -1) {
|
96 |
+
this.selected.push(id);
|
97 |
+
}
|
98 |
+
} else {
|
99 |
+
if (pos >= 0) {
|
100 |
+
this.selected.splice(pos, 1);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
},
|
104 |
+
addItems: function () {
|
105 |
+
var close = true;
|
106 |
+
if (this.callbacks && this.callbacks.addItems) {
|
107 |
+
this.callbacks.addItems.call(this);
|
108 |
+
}
|
109 |
+
$(document).triggerHandler('learn-press/add-order-items', this.selected);
|
110 |
+
},
|
111 |
+
close: function () {
|
112 |
+
this.$emit('close');
|
113 |
+
}
|
114 |
+
}
|
115 |
+
});
|
116 |
+
|
117 |
+
window.LP.$modalSearchItems = new $Vue({
|
118 |
+
el: '#vue-modal-search-items',
|
119 |
+
data: {
|
120 |
+
show: false,
|
121 |
+
term: '',
|
122 |
+
postType: '',
|
123 |
+
callbacks: {},
|
124 |
+
exclude: '',
|
125 |
+
context: ''
|
126 |
+
},
|
127 |
+
methods: {
|
128 |
+
open: function (options) {
|
129 |
+
_.each(options.data, function (v, k) {
|
130 |
+
this[k] = v;
|
131 |
+
}, this);
|
132 |
+
|
133 |
+
this.callbacks = options.callbacks;
|
134 |
+
this.focusSearch();
|
135 |
+
},
|
136 |
+
close: function () {
|
137 |
+
this.show = false;
|
138 |
+
},
|
139 |
+
focusSearch: _.debounce(function () {
|
140 |
+
$('input[name="search"]', this.$el).focus();
|
141 |
+
}, 200)
|
142 |
+
}
|
143 |
+
});
|
144 |
+
});
|
145 |
+
}(jQuery, _));
|
assets/js/admin/modal-search-users.js
ADDED
@@ -0,0 +1,148 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*global jQuery, Backbone, _ */
|
2 |
+
( function ($, _) {
|
3 |
+
'use strict';
|
4 |
+
window.$Vue = window.$Vue || Vue;
|
5 |
+
|
6 |
+
var $VueHTTP = $Vue.http;
|
7 |
+
|
8 |
+
$(document).ready(function () {
|
9 |
+
$Vue.component('learn-press-modal-search-users', {
|
10 |
+
template: '#learn-press-modal-search-users',
|
11 |
+
data: function () {
|
12 |
+
return {
|
13 |
+
paged: 1,
|
14 |
+
term: '',
|
15 |
+
hasUsers: false,
|
16 |
+
selected: []
|
17 |
+
}
|
18 |
+
},
|
19 |
+
watch: {
|
20 |
+
show: function (value) {
|
21 |
+
if (value) {
|
22 |
+
$(this.$refs.search).focus();
|
23 |
+
}
|
24 |
+
}
|
25 |
+
},
|
26 |
+
props: ['multiple', 'context', 'contextId', 'show', 'callbacks', 'textFormat', 'exclude'],
|
27 |
+
created: function () {
|
28 |
+
|
29 |
+
},
|
30 |
+
methods: {
|
31 |
+
doSearch: function (e) {
|
32 |
+
this.term = e.target.value;
|
33 |
+
this.paged = 1;
|
34 |
+
this.search();
|
35 |
+
},
|
36 |
+
search: _.debounce(function (term) {
|
37 |
+
var that = this;
|
38 |
+
$VueHTTP.post(
|
39 |
+
window.location.href, {
|
40 |
+
type: this.postType,
|
41 |
+
context: this.context,
|
42 |
+
context_id: this.contextId,
|
43 |
+
term: term || this.term,
|
44 |
+
paged: this.paged,
|
45 |
+
multiple: this.multiple ? 'yes': 'no',
|
46 |
+
text_format: this.textFormat,
|
47 |
+
exclude: this.exclude,
|
48 |
+
'lp-ajax': 'modal_search_users'
|
49 |
+
}, {
|
50 |
+
emulateJSON: true,
|
51 |
+
params: {}
|
52 |
+
}
|
53 |
+
).then(function (response) {
|
54 |
+
|
55 |
+
var result = LP.parseJSON(response.body || response.bodyText);
|
56 |
+
that.hasUsers = !!_.size(result.users);
|
57 |
+
|
58 |
+
$(that.$el).find('.search-results').html(result.html).find('input[type="checkbox"]').each(function () {
|
59 |
+
var id = parseInt($(this).val());
|
60 |
+
if (_.indexOf(that.selected, id) >= 0) {
|
61 |
+
this.checked = true;
|
62 |
+
}
|
63 |
+
});
|
64 |
+
_.debounce(function () {
|
65 |
+
$(that.$el).find('.search-nav').html(result.nav).find('a, span').addClass('button').filter('span').addClass('disabled');
|
66 |
+
}, 10)();
|
67 |
+
});
|
68 |
+
}, 500),
|
69 |
+
loadPage: function (e) {
|
70 |
+
e.preventDefault();
|
71 |
+
var $button = $(e.target);
|
72 |
+
if ($button.is('span')) {
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
if ($button.hasClass('next')) {
|
76 |
+
this.paged++;
|
77 |
+
} else if ($button.hasClass('prev')) {
|
78 |
+
this.paged--;
|
79 |
+
} else {
|
80 |
+
var paged = $button.html();
|
81 |
+
this.paged = parseInt(paged);
|
82 |
+
}
|
83 |
+
this.search();
|
84 |
+
},
|
85 |
+
selectItem: function (e) {
|
86 |
+
var $select = $(e.target).closest('li'),
|
87 |
+
$chk = $select.find('input[type="checkbox"]'),
|
88 |
+
id = parseInt($chk.val()),
|
89 |
+
//pos = _.indexOf(this.selected, id),
|
90 |
+
pos = _.findLastIndex(this.selected, {id: id});
|
91 |
+
if(this.multiple) {
|
92 |
+
if ($chk.is(':checked')) {
|
93 |
+
if (pos === -1) {
|
94 |
+
this.selected.push($select.closest('li').data('data'));
|
95 |
+
}
|
96 |
+
} else {
|
97 |
+
if (pos >= 0) {
|
98 |
+
this.selected.splice(pos, 1);
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}else{
|
102 |
+
e.preventDefault();
|
103 |
+
this.selected = [$select.closest('li').data('data')];
|
104 |
+
this.addUsers();
|
105 |
+
}
|
106 |
+
},
|
107 |
+
addUsers:function(){
|
108 |
+
var $els = $(this.$el).find('.lp-result-item');
|
109 |
+
if(this.callbacks && this.callbacks.addUsers){
|
110 |
+
this.callbacks.addUsers.call(this, this.selected);
|
111 |
+
}
|
112 |
+
$(document).triggerHandler('learn-press/modal-add-users', this.selected);
|
113 |
+
},
|
114 |
+
close: function () {
|
115 |
+
this.$emit('close');
|
116 |
+
}
|
117 |
+
}
|
118 |
+
});
|
119 |
+
|
120 |
+
window.LP.$modalSearchUsers = new $Vue({
|
121 |
+
el: '#vue-modal-search-users',
|
122 |
+
data: {
|
123 |
+
show: false,
|
124 |
+
term: '',
|
125 |
+
multiple: false,
|
126 |
+
callbacks: {},
|
127 |
+
textFormat: '{{display_name}} ({{email}})',
|
128 |
+
exclude: 0
|
129 |
+
},
|
130 |
+
methods: {
|
131 |
+
open: function (options) {
|
132 |
+
_.each(options.data, function (v, k) {
|
133 |
+
this[k] = v;
|
134 |
+
}, this);
|
135 |
+
this.callbacks = options.callbacks;
|
136 |
+
this.focusSearch();
|
137 |
+
},
|
138 |
+
close: function () {
|
139 |
+
this.show = false;
|
140 |
+
},
|
141 |
+
focusSearch: _.debounce(function(){
|
142 |
+
$('input[name="search"]', this.$el).focus();
|
143 |
+
}, 200)
|
144 |
+
}
|
145 |
+
});
|
146 |
+
});
|
147 |
+
|
148 |
+
}(jQuery, _));
|
assets/js/admin/question-editor.asset.php
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
<?php return array('dependencies' => array('wp-compose', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '440e894b14d9d2ae15f3660c6b67bfd3');
|
|
assets/js/admin/question-editor.deps.json
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
["LP-data-controls"]
|
|
assets/js/admin/question-editor.js
ADDED
@@ -0,0 +1,330 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Helpers
|
5 |
+
*
|
6 |
+
* @since 3.0.0
|
7 |
+
*/
|
8 |
+
(function (exports) {
|
9 |
+
function cloneObject(object) {
|
10 |
+
return JSON.parse(JSON.stringify(object));
|
11 |
+
}
|
12 |
+
|
13 |
+
exports.LP_Helpers = {
|
14 |
+
cloneObject: cloneObject
|
15 |
+
};
|
16 |
+
})(window);
|
17 |
+
|
18 |
+
window.$Vue = window.$Vue || Vue;
|
19 |
+
window.$Vuex = window.$Vuex || Vuex;
|
20 |
+
|
21 |
+
var $VueHTTP = Vue.http;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Root Store
|
25 |
+
*
|
26 |
+
* @since 3.0.0
|
27 |
+
*/
|
28 |
+
(function (exports, helpers, data) {
|
29 |
+
|
30 |
+
var state = helpers.cloneObject(data.root),
|
31 |
+
i18n = helpers.cloneObject(data.i18n);
|
32 |
+
|
33 |
+
state.status = 'successful';
|
34 |
+
state.countCurrentRequest = 0;
|
35 |
+
|
36 |
+
var getters = {
|
37 |
+
id: function (state) {
|
38 |
+
return state.id;
|
39 |
+
},
|
40 |
+
type: function (state) {
|
41 |
+
return state.type;
|
42 |
+
},
|
43 |
+
code: function (state) {
|
44 |
+
return Date.now();
|
45 |
+
}
|
46 |
+
,
|
47 |
+
autoDraft: function (state) {
|
48 |
+
return state.auto_draft;
|
49 |
+
},
|
50 |
+
answers: function (state) {
|
51 |
+
return Object.values(state.answers) || [];
|
52 |
+
},
|
53 |
+
settings: function (state) {
|
54 |
+
return state.setting;
|
55 |
+
},
|
56 |
+
types: function (state) {
|
57 |
+
return state.questionTypes || [];
|
58 |
+
},
|
59 |
+
numberCorrect: function (state) {
|
60 |
+
var correct = 0;
|
61 |
+
Object.keys(state.answers).forEach(function (key) {
|
62 |
+
if (state.answers[key].is_true === 'yes') {
|
63 |
+
correct += 1;
|
64 |
+
}
|
65 |
+
});
|
66 |
+
return correct;
|
67 |
+
},
|
68 |
+
status: function (state) {
|
69 |
+
return state.status;
|
70 |
+
},
|
71 |
+
currentRequest: function (state) {
|
72 |
+
return state.countCurrentRequest || 0;
|
73 |
+
},
|
74 |
+
action: function (state) {
|
75 |
+
return state.action;
|
76 |
+
},
|
77 |
+
nonce: function (state) {
|
78 |
+
return state.nonce;
|
79 |
+
},
|
80 |
+
externalComponent: function (state) {
|
81 |
+
return state.externalComponent || [];
|
82 |
+
},
|
83 |
+
state: function (state) {
|
84 |
+
return state;
|
85 |
+
},
|
86 |
+
i18n: function (state) {
|
87 |
+
return i18n;
|
88 |
+
}
|
89 |
+
};
|
90 |
+
|
91 |
+
var mutations = {
|
92 |
+
|
93 |
+
'UPDATE_STATUS': function (state, status) {
|
94 |
+
state.status = status;
|
95 |
+
},
|
96 |
+
|
97 |
+
'UPDATE_AUTO_DRAFT_STATUS': function (state, status) {
|
98 |
+
state.auto_draft = status;
|
99 |
+
},
|
100 |
+
|
101 |
+
'CHANGE_QUESTION_TYPE': function (state, question) {
|
102 |
+
state.answers = question.answers;
|
103 |
+
state.type = question.type;
|
104 |
+
},
|
105 |
+
|
106 |
+
'SET_ANSWERS': function (state, answers) {
|
107 |
+
state.answers = answers;
|
108 |
+
},
|
109 |
+
|
110 |
+
'DELETE_ANSWER': function (state, id) {
|
111 |
+
for (var i = 0, n = state.answers.length; i < n; i++) {
|
112 |
+
if (state.answers[i].question_answer_id == id) {
|
113 |
+
state.answers[i].question_answer_id = LP.uniqueId();
|
114 |
+
break;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
},
|
118 |
+
'ADD_NEW_ANSWER': function (state, answer) {
|
119 |
+
state.answers.push(answer);
|
120 |
+
},
|
121 |
+
'UPDATE_ANSWERS': function (state, answers) {
|
122 |
+
state.answers = answers;
|
123 |
+
},
|
124 |
+
|
125 |
+
'INCREASE_NUMBER_REQUEST': function (state) {
|
126 |
+
state.countCurrentRequest++;
|
127 |
+
},
|
128 |
+
|
129 |
+
'DECREASE_NUMBER_REQUEST': function (state) {
|
130 |
+
state.countCurrentRequest--;
|
131 |
+
}
|
132 |
+
};
|
133 |
+
|
134 |
+
var actions = {
|
135 |
+
|
136 |
+
changeQuestionType: function (context, payload) {
|
137 |
+
LP.Request({
|
138 |
+
type: 'change-question-type',
|
139 |
+
question_type: payload.type,
|
140 |
+
draft_question: context.getters.autoDraft ? JSON.stringify(payload.question) : ''
|
141 |
+
}).then(function (response) {
|
142 |
+
var result = response.body;
|
143 |
+
|
144 |
+
if (result.success) {
|
145 |
+
context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
|
146 |
+
context.commit('CHANGE_QUESTION_TYPE', result.data);
|
147 |
+
}
|
148 |
+
})
|
149 |
+
},
|
150 |
+
|
151 |
+
updateAnswersOrder: function (context, order) {
|
152 |
+
LP.Request({
|
153 |
+
type: 'sort-answer',
|
154 |
+
order: order
|
155 |
+
}).then(
|
156 |
+
function (response) {
|
157 |
+
var result = response.body;
|
158 |
+
if (result.success) {
|
159 |
+
// context.commit('SET_ANSWERS', result.data);
|
160 |
+
}
|
161 |
+
}
|
162 |
+
)
|
163 |
+
},
|
164 |
+
|
165 |
+
updateAnswerTitle: function (context, answer) {
|
166 |
+
if (typeof answer.question_answer_id == 'undefined') {
|
167 |
+
return;
|
168 |
+
}
|
169 |
+
answer = JSON.stringify(answer);
|
170 |
+
LP.Request({
|
171 |
+
type: 'update-answer-title',
|
172 |
+
answer: answer
|
173 |
+
})
|
174 |
+
},
|
175 |
+
|
176 |
+
updateCorrectAnswer: function (context, correct) {
|
177 |
+
LP.Request({
|
178 |
+
type: 'change-correct',
|
179 |
+
correct: JSON.stringify(correct)
|
180 |
+
}).then(
|
181 |
+
function (response) {
|
182 |
+
var result = response.body;
|
183 |
+
if (result.success) {
|
184 |
+
context.commit('UPDATE_ANSWERS', result.data);
|
185 |
+
context.commit('UPDATE_AUTO_DRAFT_STATUS', false);
|
186 |
+
}
|
187 |
+
}
|
188 |
+
)
|
189 |
+
},
|
190 |
+
|
191 |
+
deleteAnswer: function (context, payload) {
|
192 |
+
|
193 |
+
context.commit('DELETE_ANSWER', payload.id);
|
194 |
+
LP.Request({
|
195 |
+
type: 'delete-answer',
|
196 |
+
answer_id: payload.id
|
197 |
+
}).then(
|
198 |
+
function (response) {
|
199 |
+
var result = response.body;
|
200 |
+
|
201 |
+
if (result.success) {
|
202 |
+
context.commit('SET_ANSWERS', result.data);
|
203 |
+
} else {
|
204 |
+
// notice error
|
205 |
+
}
|
206 |
+
})
|
207 |
+
},
|
208 |
+
|
209 |
+
newAnswer: function (context, data) {
|
210 |
+
context.commit('ADD_NEW_ANSWER', data.answer);
|
211 |
+
LP.Request({
|
212 |
+
type: 'new-answer'
|
213 |
+
}).then(
|
214 |
+
function (response) {
|
215 |
+
var result = response.body;
|
216 |
+
|
217 |
+
if (result.success) {
|
218 |
+
context.commit('UPDATE_ANSWERS', result.data);
|
219 |
+
} else {
|
220 |
+
// notice error
|
221 |
+
}
|
222 |
+
})
|
223 |
+
},
|
224 |
+
|
225 |
+
newRequest: function (context) {
|
226 |
+
context.commit('INCREASE_NUMBER_REQUEST');
|
227 |
+
context.commit('UPDATE_STATUS', 'loading');
|
228 |
+
|
229 |
+
window.onbeforeunload = function () {
|
230 |
+
return '';
|
231 |
+
}
|
232 |
+
},
|
233 |
+
|
234 |
+
requestCompleted: function (context, status) {
|
235 |
+
context.commit('DECREASE_NUMBER_REQUEST');
|
236 |
+
|
237 |
+
if (context.getters.currentRequest === 0) {
|
238 |
+
context.commit('UPDATE_STATUS', status);
|
239 |
+
window.onbeforeunload = null;
|
240 |
+
}
|
241 |
+
}
|
242 |
+
};
|
243 |
+
|
244 |
+
exports.LP_Question_Store = new $Vuex.Store({
|
245 |
+
state: state,
|
246 |
+
getters: getters,
|
247 |
+
mutations: mutations,
|
248 |
+
actions: actions
|
249 |
+
});
|
250 |
+
|
251 |
+
})(window, LP_Helpers, lp_question_editor);
|
252 |
+
|
253 |
+
|
254 |
+
/**
|
255 |
+
* HTTP
|
256 |
+
*
|
257 |
+
* @since 3.0.0
|
258 |
+
*/
|
259 |
+
(function (exports, $store) {
|
260 |
+
var $ = jQuery,
|
261 |
+
$publishingAction = null;
|
262 |
+
|
263 |
+
LP.Request = function (payload) {
|
264 |
+
$publishingAction = $('#publishing-action');
|
265 |
+
|
266 |
+
payload['id'] = $store.getters.id;
|
267 |
+
payload['nonce'] = $store.getters.nonce;
|
268 |
+
payload['lp-ajax'] = $store.getters.action;
|
269 |
+
payload['code'] = $store.getters.code;
|
270 |
+
|
271 |
+
$publishingAction.find('#publish').addClass('disabled');
|
272 |
+
$publishingAction.find('.spinner').addClass('is-active');
|
273 |
+
$publishingAction.addClass('code-' + payload['code']);
|
274 |
+
|
275 |
+
return $VueHTTP.post($store.getters.urlAjax,
|
276 |
+
payload,
|
277 |
+
{
|
278 |
+
emulateJSON: true,
|
279 |
+
params: {
|
280 |
+
namespace: 'LPQuestionEditorRequest',
|
281 |
+
code: payload['code'],
|
282 |
+
}
|
283 |
+
});
|
284 |
+
};
|
285 |
+
|
286 |
+
$VueHTTP.interceptors.push(function (request, next) {
|
287 |
+
if (request.params['namespace'] !== 'LPQuestionEditorRequest') {
|
288 |
+
next();
|
289 |
+
return;
|
290 |
+
}
|
291 |
+
|
292 |
+
$store.dispatch('newRequest');
|
293 |
+
|
294 |
+
next(function (response) {
|
295 |
+
if (!jQuery.isPlainObject(response.body)) {
|
296 |
+
response.body = LP.parseJSON(response.body);
|
297 |
+
}
|
298 |
+
|
299 |
+
var body = response.body;
|
300 |
+
var result = body.success || false;
|
301 |
+
|
302 |
+
if (result) {
|
303 |
+
$store.dispatch('requestCompleted', 'successful');
|
304 |
+
} else {
|
305 |
+
$store.dispatch('requestCompleted', 'failed');
|
306 |
+
}
|
307 |
+
$publishingAction.removeClass('code-' + request.params.code);
|
308 |
+
if (!$publishingAction.attr('class')) {
|
309 |
+
$publishingAction.find('#publish').removeClass('disabled');
|
310 |
+
$publishingAction.find('.spinner').removeClass('is-active');
|
311 |
+
}
|
312 |
+
|
313 |
+
});
|
314 |
+
});
|
315 |
+
})(window, LP_Question_Store);
|
316 |
+
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Init app.
|
320 |
+
*
|
321 |
+
* @since 3.0.0
|
322 |
+
*/
|
323 |
+
(function ($, $store) {
|
324 |
+
$(document).ready(function () {
|
325 |
+
window.LP_Question_Editor = new $Vue({
|
326 |
+
el: '#admin-editor-lp_question',
|
327 |
+
template: '<lp-question-editor></lp-question-editor>'
|
328 |
+
});
|
329 |
+
});
|
330 |
+
})(jQuery, LP_Question_Store);
|
assets/js/admin/quiz-editor.js
ADDED
@@ -0,0 +1,1002 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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LP_Helpers = {
|
14 |
+
cloneObject: cloneObject
|
15 |
+
};
|
16 |
+
})(window);
|
17 |
+
|
18 |
+
window.$Vue = window.$Vue || Vue;
|
19 |
+
window.$Vuex = window.$Vuex || Vuex;
|
20 |
+
|
21 |
+
var $VueHTTP = Vue.http;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Choose quiz items modal store.
|
25 |
+
*
|
26 |
+
* @since 3.0.0
|
27 |
+
*/
|
28 |
+
var LP_Choose_Quiz_Items_Modal_Store = (function (exports, helpers, data) {
|
29 |
+
|
30 |
+
var state = helpers.cloneObject(data.chooseItems);
|
31 |
+
state.quizId = false;
|
32 |
+
state.pagination = '';
|
33 |
+
state.status = '';
|
34 |
+
|
35 |
+
var getters = {
|
36 |
+
status: function (state) {
|
37 |
+
return state.status;
|
38 |
+
},
|
39 |
+
pagination: function (state) {
|
40 |
+
return state.pagination;
|
41 |
+
},
|
42 |
+
items: function (state, _getters) {
|
43 |
+
return state.items.map(function (item) {
|
44 |
+
var find = _getters.addedItems.find(function (_item) {
|
45 |
+
return item.id === _item.id;
|
46 |
+
});
|
47 |
+
|
48 |
+
item.added = !!find;
|
49 |
+
|
50 |
+
return item;
|
51 |
+
});
|
52 |
+
},
|
53 |
+
code: function (state) {
|
54 |
+
return Date.now();
|
55 |
+
},
|
56 |
+
addedItems: function (state) {
|
57 |
+
return state.addedItems;
|
58 |
+
},
|
59 |
+
isOpen: function (state) {
|
60 |
+
return state.open;
|
61 |
+
},
|
62 |
+
quiz: function (state) {
|
63 |
+
return state.quizId;
|
64 |
+
}
|
65 |
+
};
|
66 |
+
|
67 |
+
var mutations = {
|
68 |
+
'TOGGLE': function (state) {
|
69 |
+
state.open = !state.open;
|
70 |
+
},
|
71 |
+
'SET_QUIZ': function (state, quizId) {
|
72 |
+
state.quizId = quizId;
|
73 |
+
},
|
74 |
+
'SET_LIST_ITEMS': function (state, items) {
|
75 |
+
state.items = items;
|
76 |
+
},
|
77 |
+
'ADD_ITEM': function (state, item) {
|
78 |
+
state.addedItems.push(item);
|
79 |
+
},
|
80 |
+
'REMOVE_ADDED_ITEM': function (state, item) {
|
81 |
+
state.addedItems.forEach(function (_item, index) {
|
82 |
+
if (_item.id === item.id) {
|
83 |
+
state.addedItems.splice(index, 1);
|
84 |
+
}
|
85 |
+
})
|
86 |
+
},
|
87 |
+
'RESET': function (state) {
|
88 |
+
state.addedItems = [];
|
89 |
+
state.items = [];
|
90 |
+
},
|
91 |
+
'UPDATE_PAGINATION': function (state, pagination) {
|
92 |
+
state.pagination = pagination;
|
93 |
+
},
|
94 |
+
'SEARCH_ITEM_REQUEST': function (state) {
|
95 |
+
state.status = 'loading';
|
96 |
+
},
|
97 |
+
'SEARCH_ITEM_SUCCESS': function (state) {
|
98 |
+
state.status = 'successful';
|
99 |
+
},
|
100 |
+
'SEARCH_ITEM_FAIL': function (state) {
|
101 |
+
state.status = 'fail';
|
102 |
+
}
|
103 |
+
};
|
104 |
+
|
105 |
+
var actions = {
|
106 |
+
|
107 |
+
toggle: function (context) {
|
108 |
+
context.commit('TOGGLE');
|
109 |
+
},
|
110 |
+
|
111 |
+
// open modal
|
112 |
+
open: function (context, quizId) {
|
113 |
+
context.commit('SET_QUIZ', quizId);
|
114 |
+
context.commit('RESET');
|
115 |
+
context.commit('TOGGLE');
|
116 |
+
},
|
117 |
+
|
118 |
+
// query available question
|
119 |
+
searchItems: function (context, payload) {
|
120 |
+
context.commit('SEARCH_ITEM_REQUEST');
|
121 |
+
|
122 |
+
LP.Request({
|
123 |
+
type: 'search-items',
|
124 |
+
query: payload.query,
|
125 |
+
page: payload.page,
|
126 |
+
exclude: JSON.stringify([])
|
127 |
+
}).then(
|
128 |
+
function (response) {
|
129 |
+
var result = response.body;
|
130 |
+
|
131 |
+
if (!result.success) {
|
132 |
+
return;
|
133 |
+
}
|
134 |
+
|
135 |
+
var data = result.data;
|
136 |
+
|
137 |
+
context.commit('SET_LIST_ITEMS', data.items);
|
138 |
+
context.commit('UPDATE_PAGINATION', data.pagination);
|
139 |
+
context.commit('SEARCH_ITEM_SUCCESS');
|
140 |
+
},
|
141 |
+
function (error) {
|
142 |
+
context.commit('SEARCH_ITEMS_FAIL');
|
143 |
+
|
144 |
+
console.log(error);
|
145 |
+
}
|
146 |
+
);
|
147 |
+
},
|
148 |
+
|
149 |
+
// add question
|
150 |
+
addItem: function (context, item) {
|
151 |
+
context.commit('ADD_ITEM', item);
|
152 |
+
},
|
153 |
+
|
154 |
+
// remove question
|
155 |
+
removeItem: function (context, index) {
|
156 |
+
context.commit('REMOVE_ADDED_ITEM', index);
|
157 |
+
},
|
158 |
+
|
159 |
+
addQuestionsToQuiz: function (context, quiz) {
|
160 |
+
var items = context.getters.addedItems;
|
161 |
+
|
162 |
+
if (items.length > 0) {
|
163 |
+
LP.Request({
|
164 |
+
type: 'add-questions-to-quiz',
|
165 |
+
items: JSON.stringify(items),
|
166 |
+
draft_quiz: JSON.stringify(quiz)
|
167 |
+
}).then(
|
168 |
+
function (response) {
|
169 |
+
var result = response.body;
|
170 |
+
|
171 |
+
if (result.success) {
|
172 |
+
var questions = result.data;
|
173 |
+
|
174 |
+
// update quiz list questions
|
175 |
+
context.commit('lqs/SET_QUESTIONS', questions, {root: true});
|
176 |
+
context.commit('TOGGLE');
|
177 |
+
}
|
178 |
+
},
|
179 |
+
function (error) {
|
180 |
+
console.log(error);
|
181 |
+
}
|
182 |
+
)
|
183 |
+
}
|
184 |
+
}
|
185 |
+
};
|
186 |
+
|
187 |
+
return {
|
188 |
+
namespaced: true,
|
189 |
+
state: state,
|
190 |
+
getters: getters,
|
191 |
+
mutations: mutations,
|
192 |
+
actions: actions
|
193 |
+
}
|
194 |
+
|
195 |
+
})(window, LP_Helpers, lp_quiz_editor);
|
196 |
+
|
197 |
+
/**
|
198 |
+
* I18n Store
|
199 |
+
*
|
200 |
+
* @since 3.0.0
|
201 |
+
*/
|
202 |
+
var LP_Quiz_i18n_Store = (function (helpers, data) {
|
203 |
+
|
204 |
+
var state = helpers.cloneObject(data.i18n);
|
205 |
+
|
206 |
+
var getters = {
|
207 |
+
all: function (state) {
|
208 |
+
return state;
|
209 |
+
}
|
210 |
+
};
|
211 |
+
|
212 |
+
return {
|
213 |
+
namespaced: true,
|
214 |
+
state: state,
|
215 |
+
getters: getters
|
216 |
+
}
|
217 |
+
|
218 |
+
})(LP_Helpers, lp_quiz_editor);
|
219 |
+
|
220 |
+
/**
|
221 |
+
* List quiz questions store.
|
222 |
+
*
|
223 |
+
* @since 3.0.0
|
224 |
+
*/
|
225 |
+
var LP_List_Quiz_Questions_Store = (function (helpers, data, $) {
|
226 |
+
|
227 |
+
var state = helpers.cloneObject(data.listQuestions);
|
228 |
+
|
229 |
+
state.statusUpdateQuestions = {};
|
230 |
+
state.statusUpdateQuestionItem = {};
|
231 |
+
state.statusUpdateQuestionAnswer = {};
|
232 |
+
|
233 |
+
state.questions = state.questions.map(function (question) {
|
234 |
+
var hiddenQuestions = state.hidden_questions;
|
235 |
+
var find = hiddenQuestions.find(function (questionId) {
|
236 |
+
return parseInt(question.id) === parseInt(questionId);
|
237 |
+
});
|
238 |
+
|
239 |
+
question.open = !find;
|
240 |
+
|
241 |
+
return question;
|
242 |
+
});
|
243 |
+
|
244 |
+
var getters = {
|
245 |
+
listQuestions: function (state) {
|
246 |
+
return state.questions || [];
|
247 |
+
},
|
248 |
+
questionsOrder: function (state) {
|
249 |
+
return state.order || [];
|
250 |
+
},
|
251 |
+
externalComponent: function (state) {
|
252 |
+
return state.externalComponent || [];
|
253 |
+
},
|
254 |
+
hiddenQuestionsSettings: function (state) {
|
255 |
+
return state.hidden_questions_settings || [];
|
256 |
+
},
|
257 |
+
hiddenQuestions: function (state) {
|
258 |
+
return state.questions
|
259 |
+
.filter(function (question) {
|
260 |
+
return !question.open;
|
261 |
+
})
|
262 |
+
.map(function (question) {
|
263 |
+
return parseInt(question.id);
|
264 |
+
})
|
265 |
+
},
|
266 |
+
isHiddenListQuestions: function (state, getters) {
|
267 |
+
var questions = getters['listQuestions'];
|
268 |
+
var hiddenQuestions = getters['hiddenQuestions'];
|
269 |
+
|
270 |
+
return questions.length === hiddenQuestions.length;
|
271 |
+
},
|
272 |
+
disableUpdateList: function (state) {
|
273 |
+
return state.disableUpdateList;
|
274 |
+
},
|
275 |
+
statusUpdateQuestions: function (state) {
|
276 |
+
return state.statusUpdateQuestions;
|
277 |
+
},
|
278 |
+
statusUpdateQuestionItem: function (state) {
|
279 |
+
return state.statusUpdateQuestionItem;
|
280 |
+
},
|
281 |
+
statusUpdateQuestionAnswer: function (state) {
|
282 |
+
return state.statusUpdateQuestionAnswer;
|
283 |
+
}
|
284 |
+
};
|
285 |
+
|
286 |
+
var mutations = {
|
287 |
+
'SORT_QUESTIONS': function (state, orders) {
|
288 |
+
state.questions = state.questions.map(function (question) {
|
289 |
+
question.order = orders[question.id];
|
290 |
+
return question;
|
291 |
+
});
|
292 |
+
},
|
293 |
+
'SORT_QUESTION_ANSWERS': function (state, orders) {
|
294 |
+
state.questions = state.questions.map(function (question) {
|
295 |
+
question.answers.answer_order = orders[question.answers.question_answer_id];
|
296 |
+
return question;
|
297 |
+
})
|
298 |
+
},
|
299 |
+
'ADD_QUESTION_ANSWER': function (state, payload) {
|
300 |
+
state.questions = state.questions.map(function (question) {
|
301 |
+
if (question.id === payload.question_id) {
|
302 |
+
var found = false;
|
303 |
+
if (payload.answer.temp_id) {
|
304 |
+
for (var i = 0, n = question.answers.length; i < n; i++) {
|
305 |
+
if (question.answers[i].question_answer_id == payload.answer.temp_id) {
|
306 |
+
found = true;
|
307 |
+
$Vue.set(question.answers, i, payload.answer);
|
308 |
+
}
|
309 |
+
}
|
310 |
+
}
|
311 |
+
|
312 |
+
!found && question.answers.push(payload.answer);
|
313 |
+
return question;
|
314 |
+
} else {
|
315 |
+
return question;
|
316 |
+
}
|
317 |
+
})
|
318 |
+
},
|
319 |
+
'CHANGE_QUESTION_CORRECT_ANSWERS': function (state, data) {
|
320 |
+
state.questions = state.questions.map(function (question) {
|
321 |
+
if (parseInt(question.id) === data.id) {
|
322 |
+
question.answers = data.answers;
|
323 |
+
}
|
324 |
+
return question;
|
325 |
+
});
|
326 |
+
},
|
327 |
+
'SET_QUESTIONS': function (state, questions) {
|
328 |
+
state.questions = questions;
|
329 |
+
},
|
330 |
+
'ADD_NEW_QUESTION': function (state, question) {
|
331 |
+
var found = false;
|
332 |
+
if (question.temp_id) {
|
333 |
+
for (var i = 0, n = state.questions.length; i < n; i++) {
|
334 |
+
if (state.questions[i].id === question.temp_id) {
|
335 |
+
$Vue.set(state.questions, i, question);
|
336 |
+
found = true;
|
337 |
+
break;
|
338 |
+
}
|
339 |
+
}
|
340 |
+
}
|
341 |
+
if (!found) {
|
342 |
+
var _last_child = $('.lp-list-questions .main > div:last-child');
|
343 |
+
if (_last_child.length) {
|
344 |
+
var _offset = _last_child.offset().top;
|
345 |
+
$('html,body').animate({scrollTop: _offset});
|
346 |
+
}
|
347 |
+
|
348 |
+
state.questions.push(question);
|
349 |
+
}
|
350 |
+
},
|
351 |
+
'CHANGE_QUESTION_TYPE': function (state, data) {
|
352 |
+
state.questions = state.questions.map(function (question) {
|
353 |
+
if (parseInt(question.id) === data.id) {
|
354 |
+
question.answers = data.answers;
|
355 |
+
question.type = data.type;
|
356 |
+
question.open = true;
|
357 |
+
}
|
358 |
+
return question;
|
359 |
+
});
|
360 |
+
},
|
361 |
+
'REMOVE_QUESTION': function (state, item) {
|
362 |
+
var questions = state.questions,
|
363 |
+
index = questions.indexOf(item);
|
364 |
+
|
365 |
+
if (item.temp_id) {
|
366 |
+
state.questions[index].id = item.temp_id;
|
367 |
+
} else {
|
368 |
+
state.questions.splice(index, 1);
|
369 |
+
}
|
370 |
+
},
|
371 |
+
'DELETE_QUESTION_ANSWER': function (state, payload) {
|
372 |
+
var question_id = payload.question_id,
|
373 |
+
answer_id = payload.answer_id;
|
374 |
+
|
375 |
+
state.questions = state.questions.map(function (question) {
|
376 |
+
if (question.id === question_id) {
|
377 |
+
var answers = question.answers;
|
378 |
+
answers.forEach(function (answer) {
|
379 |
+
if (answer.question_answer_id === answer_id) {
|
380 |
+
var index = answers.indexOf(answer);
|
381 |
+
answers.splice(index, 1);
|
382 |
+
}
|
383 |
+
})
|
384 |
+
}
|
385 |
+
return question;
|
386 |
+
});
|
387 |
+
},
|
388 |
+
'REMOVE_QUESTIONS': function () {
|
389 |
+
// code
|
390 |
+
},
|
391 |
+
'CLOSE_QUESTION': function (state, question) {
|
392 |
+
state.questions.forEach(function (_question, index) {
|
393 |
+
if (question.id === _question.id) {
|
394 |
+
state.questions[index].open = false;
|
395 |
+
}
|
396 |
+
});
|
397 |
+
},
|
398 |
+
'OPEN_QUESTION': function (state, question) {
|
399 |
+
state.questions.forEach(function (_question, index) {
|
400 |
+
if ((question.id) === _question.id) {
|
401 |
+
state.questions[index].open = true;
|
402 |
+
}
|
403 |
+
});
|
404 |
+
},
|
405 |
+
'CLOSE_LIST_QUESTIONS': function (state) {
|
406 |
+
state.questions = state.questions.map(function (_question) {
|
407 |
+
_question.open = false;
|
408 |
+
|
409 |
+
return _question;
|
410 |
+
});
|
411 |
+
},
|
412 |
+
'OPEN_LIST_QUESTIONS': function (state) {
|
413 |
+
state.questions = state.questions.map(function (_question) {
|
414 |
+
_question.open = true;
|
415 |
+
|
416 |
+
return _question;
|
417 |
+
})
|
418 |
+
},
|
419 |
+
'UPDATE_QUESTION_REQUEST': function (state, questionId) {
|
420 |
+
$Vue.set(state.statusUpdateQuestionItem, questionId, 'updating');
|
421 |
+
},
|
422 |
+
'UPDATE_QUESTION_SUCCESS': function (state, questionID) {
|
423 |
+
$Vue.set(state.statusUpdateQuestionItem, questionID, 'successful');
|
424 |
+
},
|
425 |
+
'UPDATE_QUESTION_FAILURE': function (state, questionID) {
|
426 |
+
$Vue.set(state.statusUpdateQuestionItem, questionID, 'failed')
|
427 |
+
},
|
428 |
+
|
429 |
+
'UPDATE_QUESTION_ANSWER_REQUEST': function (state, question_id) {
|
430 |
+
$Vue.set(state.statusUpdateQuestionAnswer, question_id, 'updating');
|
431 |
+
},
|
432 |
+
'UPDATE_QUESTION_ANSWER_SUCCESS': function (state, question_id) {
|
433 |
+
$Vue.set(state.statusUpdateQuestionAnswer, question_id, 'successful');
|
434 |
+
},
|
435 |
+
'UPDATE_QUESTION_ANSWER_FAIL': function (state, question_id) {
|
436 |
+
$Vue.set(state.statusUpdateQuestionAnswer, question_id, 'failed');
|
437 |
+
},
|
438 |
+
'DELETE_ANSWER': function (state, data) {
|
439 |
+
state.questions.map(function (question, index) {
|
440 |
+
if (question.id == data.question_id) {
|
441 |
+
for (var i = 0, n = question.answers.length; i < n; i++) {
|
442 |
+
if (question.answers[i].question_answer_id == data.answer_id) {
|
443 |
+
question.answers[i].question_answer_id = data.temp_id;
|
444 |
+
//state.questions[index].answers.splice(i, 1);
|
445 |
+
break;
|
446 |
+
}
|
447 |
+
}
|
448 |
+
return false;
|
449 |
+
}
|
450 |
+
})
|
451 |
+
|
452 |
+
}
|
453 |
+
};
|
454 |
+
|
455 |
+
var actions = {
|
456 |
+
|
457 |
+
toggleAll: function (context) {
|
458 |
+
var hidden = context.getters['isHiddenListQuestions'];
|
459 |
+
|
460 |
+
if (hidden) {
|
461 |
+
context.commit('OPEN_LIST_QUESTIONS');
|
462 |
+
} else {
|
463 |
+
context.commit('CLOSE_LIST_QUESTIONS');
|
464 |
+
}
|
465 |
+
|
466 |
+
LP.Request({
|
467 |
+
type: 'hidden-questions',
|
468 |
+
hidden: context.getters['hiddenQuestions']
|
469 |
+
})
|
470 |
+
},
|
471 |
+
|
472 |
+
updateQuizQuestionsHidden: function (context, data) {
|
473 |
+
LP.Request($.extend({}, data, {
|
474 |
+
type: 'update-quiz-questions-hidden'
|
475 |
+
}));
|
476 |
+
},
|
477 |
+
|
478 |
+
newQuestion: function (context, payload) {
|
479 |
+
var newQuestion = JSON.parse(JSON.stringify(payload.question));
|
480 |
+
newQuestion.settings = {};
|
481 |
+
context.commit('ADD_NEW_QUESTION', newQuestion);
|
482 |
+
LP.Request({
|
483 |
+
type: 'new-question',
|
484 |
+
question: JSON.stringify(payload.question),
|
485 |
+
draft_quiz: JSON.stringify(payload.quiz)
|
486 |
+
}).then(
|
487 |
+
function (response) {
|
488 |
+
var result = response.body;
|
489 |
+
|
490 |
+
if (result.success) {
|
491 |
+
// update new question type
|
492 |
+
context.commit('UPDATE_NEW_QUESTION_TYPE', payload.question.type, {root: true});
|
493 |
+
// update list quiz questions
|
494 |
+
context.commit('ADD_NEW_QUESTION', result.data);
|
495 |
+
context.commit('CLOSE_LIST_QUESTIONS');
|
496 |
+
context.commit('OPEN_QUESTION', result.data);
|
497 |
+
}
|
498 |
+
},
|
499 |
+
function (error) {
|
500 |
+
console.log(error);
|
501 |
+
}
|
502 |
+
);
|
503 |
+
},
|
504 |
+
|
505 |
+
updateQuestionsOrder: function (context, order) {
|
506 |
+
LP.Request({
|
507 |
+
type: 'sort-questions',
|
508 |
+
order: JSON.stringify(order)
|
509 |
+
}).then(
|
510 |
+
function (response) {
|
511 |
+
context.commit('SORT_QUESTIONS', order);
|
512 |
+
},
|
513 |
+
function (error) {
|
514 |
+
console.log(error);
|
515 |
+
}
|
516 |
+
);
|
517 |
+
},
|
518 |
+
|
519 |
+
updateQuestionTitle: function (context, question) {
|
520 |
+
|
521 |
+
context.commit('UPDATE_QUESTION_REQUEST', question.id);
|
522 |
+
|
523 |
+
LP.Request({
|
524 |
+
type: 'update-question-title',
|
525 |
+
question: JSON.stringify(question)
|
526 |
+
}).then(
|
527 |
+
function () {
|
528 |
+
context.commit('UPDATE_QUESTION_SUCCESS', question.id);
|
529 |
+
}
|
530 |
+
).catch(
|
531 |
+
function () {
|
532 |
+
context.commit('UPDATE_QUESTION_FAILURE', question.id);
|
533 |
+
})
|
534 |
+
},
|
535 |
+
|
536 |
+
changeQuestionType: function (context, payload) {
|
537 |
+
|
538 |
+
context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
|
539 |
+
|
540 |
+
LP.Request({
|
541 |
+
type: 'change-question-type',
|
542 |
+
question_id: payload.question_id,
|
543 |
+
question_type: payload.type
|
544 |
+
}).then(function (response) {
|
545 |
+
var result = response.body;
|
546 |
+
|
547 |
+
if (result.success) {
|
548 |
+
var question = result.data;
|
549 |
+
context.commit('CHANGE_QUESTION_TYPE', question);
|
550 |
+
context.commit('UPDATE_NEW_QUESTION_TYPE', question.type.key, {root: true});
|
551 |
+
context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
|
552 |
+
}
|
553 |
+
}).catch(function () {
|
554 |
+
context.commit('UPDATE_QUESTION_FAILURE', payload.question_id);
|
555 |
+
|
556 |
+
})
|
557 |
+
},
|
558 |
+
|
559 |
+
isHiddenQuestionsSettings: function (context, id) {
|
560 |
+
},
|
561 |
+
|
562 |
+
cloneQuestion: function (context, question) {
|
563 |
+
LP.Request({
|
564 |
+
type: 'clone-question',
|
565 |
+
question: JSON.stringify(question)
|
566 |
+
}).then(
|
567 |
+
function (response) {
|
568 |
+
var result = response.body;
|
569 |
+
|
570 |
+
if (result.success) {
|
571 |
+
var question = result.data;
|
572 |
+
|
573 |
+
context.commit('ADD_NEW_QUESTION', result.data);
|
574 |
+
context.commit('UPDATE_NEW_QUESTION_TYPE', question.type.key, {root: true})
|
575 |
+
}
|
576 |
+
},
|
577 |
+
function (error) {
|
578 |
+
console.log(error);
|
579 |
+
}
|
580 |
+
)
|
581 |
+
},
|
582 |
+
|
583 |
+
removeQuestion: function (context, question) {
|
584 |
+
var question_id = question.id;
|
585 |
+
question.temp_id = LP.uniqueId();
|
586 |
+
context.commit('REMOVE_QUESTION', question);
|
587 |
+
|
588 |
+
LP.Request({
|
589 |
+
type: 'remove-question',
|
590 |
+
question_id: question_id
|
591 |
+
}).then(
|
592 |
+
function (response) {
|
593 |
+
var result = response.body;
|
594 |
+
|
595 |
+
if (result.success) {
|
596 |
+
question.id = question.temp_id;
|
597 |
+
question.temp_id = 0;
|
598 |
+
context.commit('REMOVE_QUESTION', question);
|
599 |
+
}
|
600 |
+
},
|
601 |
+
function (error) {
|
602 |
+
console.error(error);
|
603 |
+
}
|
604 |
+
)
|
605 |
+
},
|
606 |
+
|
607 |
+
deleteQuestion: function (context, question) {
|
608 |
+
var question_id = question.id;
|
609 |
+
question.temp_id = LP.uniqueId();
|
610 |
+
context.commit('REMOVE_QUESTION', question);
|
611 |
+
LP.Request({
|
612 |
+
type: 'delete-question',
|
613 |
+
question_id: question_id
|
614 |
+
})
|
615 |
+
.then(function () {
|
616 |
+
question.id = question.temp_id;
|
617 |
+
question.temp_id = 0;
|
618 |
+
context.commit('REMOVE_QUESTION', question);
|
619 |
+
context.commit('UPDATE_QUESTION_SUCCESS', question.id);
|
620 |
+
})
|
621 |
+
.catch(function () {
|
622 |
+
context.commit('UPDATE_QUESTION_FAILURE', question.id);
|
623 |
+
})
|
624 |
+
},
|
625 |
+
|
626 |
+
toggleQuestion: function (context, question) {
|
627 |
+
if (question.open) {
|
628 |
+
context.commit('CLOSE_QUESTION', question);
|
629 |
+
} else {
|
630 |
+
context.commit('OPEN_QUESTION', question);
|
631 |
+
}
|
632 |
+
|
633 |
+
LP.Request({
|
634 |
+
type: 'hidden-questions',
|
635 |
+
hidden: context.getters['hiddenQuestions']
|
636 |
+
}
|
637 |
+
)
|
638 |
+
},
|
639 |
+
|
640 |
+
updateQuestionAnswersOrder: function (context, payload) {
|
641 |
+
context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
|
642 |
+
|
643 |
+
LP.Request({
|
644 |
+
type: 'sort-question-answers',
|
645 |
+
question_id: payload.question_id,
|
646 |
+
order: JSON.stringify(payload.order)
|
647 |
+
}).then(
|
648 |
+
function (response) {
|
649 |
+
var result = response.body,
|
650 |
+
order = result.data;
|
651 |
+
context.commit('SORT_QUESTION_ANSWERS', order);
|
652 |
+
context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
|
653 |
+
},
|
654 |
+
function (error) {
|
655 |
+
context.commit('UPDATE_QUESTION_FAILURE', payload.question_id);
|
656 |
+
console.log(error);
|
657 |
+
}
|
658 |
+
)
|
659 |
+
},
|
660 |
+
|
661 |
+
updateQuestionAnswerTitle: function (context, payload) {
|
662 |
+
|
663 |
+
context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
|
664 |
+
|
665 |
+
LP.Request({
|
666 |
+
type: 'update-question-answer-title',
|
667 |
+
question_id: parseInt(payload.question_id),
|
668 |
+
answer: JSON.stringify(payload.answer)
|
669 |
+
}).then(
|
670 |
+
function () {
|
671 |
+
context.commit('UPDATE_QUESTION_ANSWER_SUCCESS', parseInt(payload.question_id));
|
672 |
+
context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
|
673 |
+
}
|
674 |
+
).catch(
|
675 |
+
function () {
|
676 |
+
context.commit('UPDATE_QUESTION_ANSWER_FAILURE', parseInt(payload.question_id));
|
677 |
+
context.commit('UPDATE_QUESTION_FAILURE', payload.question_id);
|
678 |
+
})
|
679 |
+
},
|
680 |
+
|
681 |
+
updateQuestionCorrectAnswer: function (context, payload) {
|
682 |
+
context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
|
683 |
+
|
684 |
+
LP.Request({
|
685 |
+
type: 'change-question-correct-answer',
|
686 |
+
question_id: payload.question_id,
|
687 |
+
correct: JSON.stringify(payload.correct)
|
688 |
+
}).then(
|
689 |
+
function (response) {
|
690 |
+
var result = response.body;
|
691 |
+
if (result.success) {
|
692 |
+
context.commit('CHANGE_QUESTION_CORRECT_ANSWERS', result.data);
|
693 |
+
context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
|
694 |
+
}
|
695 |
+
},
|
696 |
+
function (error) {
|
697 |
+
context.commit('UPDATE_QUESTION_FAILURE', payload.question_id);
|
698 |
+
console.log(error);
|
699 |
+
}
|
700 |
+
)
|
701 |
+
},
|
702 |
+
|
703 |
+
deleteQuestionAnswer: function (context, payload) {
|
704 |
+
payload.temp_id = LP.uniqueId();
|
705 |
+
context.commit('DELETE_ANSWER', payload);
|
706 |
+
context.commit('UPDATE_QUESTION_REQUEST', payload.question_id);
|
707 |
+
|
708 |
+
LP.Request({
|
709 |
+
type: 'delete-question-answer',
|
710 |
+
question_id: payload.question_id,
|
711 |
+
answer_id: payload.answer_id
|
712 |
+
}).then(
|
713 |
+
function (response) {
|
714 |
+
var result = response.body;
|
715 |
+
|
716 |
+
if (result.success) {
|
717 |
+
context.commit('DELETE_QUESTION_ANSWER', {
|
718 |
+
question_id: payload.question_id,
|
719 |
+
answer_id: payload.temp_id
|
720 |
+
//answer_id: payload.answer_id
|
721 |
+
});
|
722 |
+
context.commit('UPDATE_QUESTION_SUCCESS', payload.question_id);
|
723 |
+
}
|
724 |
+
},
|
725 |
+
function (error) {
|
726 |
+
context.commit('UPDATE_QUESTION_FAILURE', payload.question_id);
|
727 |
+
console.log(error);
|
728 |
+
}
|
729 |
+
)
|
730 |
+
},
|
731 |
+
|
732 |
+
newQuestionAnswer: function (context, data) {
|
733 |
+
var temp_id = LP.uniqueId(),
|
734 |
+
question_id = data.question_id;
|
735 |
+
context.commit('UPDATE_QUESTION_REQUEST', question_id);
|
736 |
+
context.commit('ADD_QUESTION_ANSWER', {
|
737 |
+
question_id: question_id,
|
738 |
+
answer: {'text': LP_Quiz_Store.getters['i18n/all'].new_option, 'question_answer_id': temp_id}
|
739 |
+
});
|
740 |
+
LP.Request({
|
741 |
+
type: 'new-question-answer',
|
742 |
+
question_id: question_id,
|
743 |
+
question_answer_id: temp_id
|
744 |
+
})
|
745 |
+
.then(
|
746 |
+
function (response) {
|
747 |
+
var result = response.body;
|
748 |
+
if (result.success) {
|
749 |
+
var answer = result.data;
|
750 |
+
context.commit('ADD_QUESTION_ANSWER', {question_id: question_id, answer: answer});
|
751 |
+
context.commit('UPDATE_QUESTION_SUCCESS', question_id);
|
752 |
+
|
753 |
+
data.success && setTimeout(function () {
|
754 |
+
data.success.apply(data.context, [answer]);
|
755 |
+
}, 300);
|
756 |
+
}
|
757 |
+
},
|
758 |
+
function (error) {
|
759 |
+
context.commit('UPDATE_QUESTION_FAILURE', question_id);
|
760 |
+
console.error(error);
|
761 |
+
}
|
762 |
+
)
|
763 |
+
},
|
764 |
+
|
765 |
+
updateQuestionContent: function (context, question) {
|
766 |
+
|
767 |
+
context.commit('UPDATE_QUESTION_REQUEST', question.id);
|
768 |
+
|
769 |
+
LP.Request({
|
770 |
+
type: 'update-question-content',
|
771 |
+
question: JSON.stringify(question)
|
772 |
+
}).then(
|
773 |
+
function () {
|
774 |
+
context.commit('UPDATE_QUESTION_SUCCESS', question.id);
|
775 |
+
}
|
776 |
+
).catch(
|
777 |
+
function () {
|
778 |
+
context.commit('UPDATE_QUESTION_FAILURE', question.id);
|
779 |
+
})
|
780 |
+
},
|
781 |
+
|
782 |
+
updateQuestionMeta: function (context, payload) {
|
783 |
+
|
784 |
+
context.commit('UPDATE_QUESTION_REQUEST', payload.question.id);
|
785 |
+
|
786 |
+
LP.Request({
|
787 |
+
type: 'update-question-meta',
|
788 |
+
question: JSON.stringify(payload.question),
|
789 |
+
meta_key: payload.meta_key
|
790 |
+
}).then(
|
791 |
+
function () {
|
792 |
+
context.commit('UPDATE_QUESTION_SUCCESS', payload.question.id);
|
793 |
+
}
|
794 |
+
).catch(
|
795 |
+
function () {
|
796 |
+
context.commit('UPDATE_QUESTION_FAILURE', payload.question.id);
|
797 |
+
})
|
798 |
+
}
|
799 |
+
};
|
800 |
+
|
801 |
+
return {
|
802 |
+
namespaced: true,
|
803 |
+
state: state,
|
804 |
+
getters: getters,
|
805 |
+
mutations: mutations,
|
806 |
+
actions: actions
|
807 |
+
}
|
808 |
+
|
809 |
+
})(LP_Helpers, lp_quiz_editor, jQuery);
|
810 |
+
|
811 |
+
/**
|
812 |
+
* Root Store
|
813 |
+
*
|
814 |
+
* @since 3.0.0
|
815 |
+
*/
|
816 |
+
(function (exports, helpers, data) {
|
817 |
+
|
818 |
+
var state = helpers.cloneObject(data.root);
|
819 |
+
|
820 |
+
state.status = 'success';
|
821 |
+
state.heartbeat = true;
|
822 |
+
state.countCurrentRequest = 0;
|
823 |
+
|
824 |
+
var getters = {
|
825 |
+
heartbeat: function (state) {
|
826 |
+
return state.heartbeat;
|
827 |
+
},
|
828 |
+
questionTypes: function (state) {
|
829 |
+
return state.types;
|
830 |
+
},
|
831 |
+
defaultNewQuestionType: function (state) {
|
832 |
+
return state.default_new
|
833 |
+
},
|
834 |
+
action: function (state) {
|
835 |
+
return state.action;
|
836 |
+
},
|
837 |
+
id: function (state) {
|
838 |
+
return state.quiz_id;
|
839 |
+
},
|
840 |
+
status: function (state) {
|
841 |
+
return state.status || 'error';
|
842 |
+
},
|
843 |
+
currentRequest: function (state) {
|
844 |
+
return state.countCurrentRequest || 0;
|
845 |
+
},
|
846 |
+
nonce: function (state) {
|
847 |
+
return state.nonce;
|
848 |
+
}
|
849 |
+
};
|
850 |
+
|
851 |
+
var mutations = {
|
852 |
+
|
853 |
+
'UPDATE_HEART_BEAT': function (state, status) {
|
854 |
+
state.heartbeat = !!status;
|
855 |
+
},
|
856 |
+
|
857 |
+
'UPDATE_STATUS': function (state, status) {
|
858 |
+
state.status = status;
|
859 |
+
},
|
860 |
+
|
861 |
+
'UPDATE_NEW_QUESTION_TYPE': function (state, type) {
|
862 |
+
state.default_new = type;
|
863 |
+
},
|
864 |
+
|
865 |
+
'INCREASE_NUMBER_REQUEST': function (state) {
|
866 |
+
state.countCurrentRequest++;
|
867 |
+
},
|
868 |
+
|
869 |
+
'DECREASE_NUMBER_REQUEST': function (state) {
|
870 |
+
state.countCurrentRequest--;
|
871 |
+
}
|
872 |
+
};
|
873 |
+
|
874 |
+
var actions = {
|
875 |
+
heartbeat: function (context) {
|
876 |
+
LP.Request({
|
877 |
+
type: 'heartbeat'
|
878 |
+
}
|
879 |
+
)
|
880 |
+
.then(
|
881 |
+
function (response) {
|
882 |
+
var result = response.body;
|
883 |
+
context.commit('UPDATE_HEART_BEAT', !!result.success);
|
884 |
+
},
|
885 |
+
function (error) {
|
886 |
+
context.commit('UPDATE_HEART_BEAT', false);
|
887 |
+
}
|
888 |
+
);
|
889 |
+
},
|
890 |
+
|
891 |
+
newRequest: function (context) {
|
892 |
+
context.commit('INCREASE_NUMBER_REQUEST');
|
893 |
+
context.commit('UPDATE_STATUS', 'loading');
|
894 |
+
|
895 |
+
window.onbeforeunload = function () {
|
896 |
+
return '';
|
897 |
+
}
|
898 |
+
},
|
899 |
+
|
900 |
+
requestComplete: function (context, status) {
|
901 |
+
context.commit('DECREASE_NUMBER_REQUEST');
|
902 |
+
|
903 |
+
if (context.getters.currentRequest === 0) {
|
904 |
+
context.commit('UPDATE_STATUS', status);
|
905 |
+
window.onbeforeunload = null;
|
906 |
+
}
|
907 |
+
}
|
908 |
+
};
|
909 |
+
|
910 |
+
exports.LP_Quiz_Store = new $Vuex.Store({
|
911 |
+
state: state,
|
912 |
+
getters: getters,
|
913 |
+
mutations: mutations,
|
914 |
+
actions: actions,
|
915 |
+
modules: {
|
916 |
+
cqi: LP_Choose_Quiz_Items_Modal_Store,
|
917 |
+
i18n: LP_Quiz_i18n_Store,
|
918 |
+
lqs: LP_List_Quiz_Questions_Store
|
919 |
+
}
|
920 |
+
});
|
921 |
+
|
922 |
+
})(window, LP_Helpers, lp_quiz_editor);
|
923 |
+
|
924 |
+
|
925 |
+
/**
|
926 |
+
* HTTP
|
927 |
+
*
|
928 |
+
* @since 3.0.0
|
929 |
+
*/
|
930 |
+
(function (exports, $store) {
|
931 |
+
var $ = jQuery,
|
932 |
+
$publishingAction = null;
|
933 |
+
|
934 |
+
LP.Request = function (payload) {
|
935 |
+
payload['id'] = $store.getters.id;
|
936 |
+
payload['nonce'] = $store.getters.nonce;
|
937 |
+
payload['lp-ajax'] = $store.getters.action;
|
938 |
+
payload['code'] = Date.now();
|
939 |
+
|
940 |
+
$publishingAction = $('#publishing-action');
|
941 |
+
|
942 |
+
$publishingAction.find('#publish').addClass('disabled');
|
943 |
+
$publishingAction.find('.spinner').addClass('is-active');
|
944 |
+
$publishingAction.addClass('code-' + payload['code']);
|
945 |
+
|
946 |
+
return $VueHTTP.post($store.getters.urlAjax,
|
947 |
+
payload, {
|
948 |
+
emulateJSON: true,
|
949 |
+
params: {
|
950 |
+
namespace: 'LPListQuizQuestionsRequest',
|
951 |
+
code: payload['code'],
|
952 |
+
}
|
953 |
+
});
|
954 |
+
};
|
955 |
+
|
956 |
+
$VueHTTP.interceptors.push(function (request, next) {
|
957 |
+
if (request.params['namespace'] !== 'LPListQuizQuestionsRequest') {
|
958 |
+
next();
|
959 |
+
return;
|
960 |
+
}
|
961 |
+
|
962 |
+
$store.dispatch('newRequest');
|
963 |
+
|
964 |
+
next(function (response) {
|
965 |
+
|
966 |
+
if (!jQuery.isPlainObject(response.body)) {
|
967 |
+
response.body = LP.parseJSON(response.body);
|
968 |
+
}
|
969 |
+
|
970 |
+
var body = response.body,
|
971 |
+
result = body.success || false;
|
972 |
+
|
973 |
+
if (result) {
|
974 |
+
$store.dispatch('requestComplete', 'success');
|
975 |
+
} else {
|
976 |
+
$store.dispatch('requestComplete', 'fail');
|
977 |
+
}
|
978 |
+
|
979 |
+
$publishingAction.removeClass('code-' + request.params.code);
|
980 |
+
if (!$publishingAction.attr('class')) {
|
981 |
+
$publishingAction.find('#publish').removeClass('disabled');
|
982 |
+
$publishingAction.find('.spinner').removeClass('is-active');
|
983 |
+
}
|
984 |
+
|
985 |
+
});
|
986 |
+
});
|
987 |
+
|
988 |
+
})(window, LP_Quiz_Store);
|
989 |
+
|
990 |
+
/**
|
991 |
+
* Init app.
|
992 |
+
*
|
993 |
+
* @since 3.0.0
|
994 |
+
*/
|
995 |
+
(function ($, $store) {
|
996 |
+
$(document).ready(function () {
|
997 |
+
window.LP_Quiz_Editor = new $Vue({
|
998 |
+
el: '#admin-editor-lp_quiz',
|
999 |
+
template: '<lp-quiz-editor></lp-quiz-editor>'
|
1000 |
+
});
|
1001 |
+
});
|
1002 |
+
})(jQuery, LP_Quiz_Store);
|
assets/js/admin/settings.js
ADDED
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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.positions);
|
8 |
+
$('.learn-press-dropdown-pages').each(function () {
|
9 |
+
var $select = $(this),
|
10 |
+
$new_option = $('<option value="' + args.ID + '">' + args.name + '</option>')
|
11 |
+
if (position == 0) {
|
12 |
+
$('option', $select).each(function () {
|
13 |
+
if (parseInt($(this).val())) {
|
14 |
+
$new_option.insertBefore($(this));
|
15 |
+
return false;
|
16 |
+
}
|
17 |
+
})
|
18 |
+
} else if (position == args.positions.length - 1) {
|
19 |
+
$select.append($new_option);
|
20 |
+
} else {
|
21 |
+
$new_option.insertAfter($('option[value="' + args.positions[position - 1] + '"]', $select));
|
22 |
+
}
|
23 |
+
});
|
24 |
+
}
|
25 |
+
|
26 |
+
function _insertVariableToEditor(edId, variable) {
|
27 |
+
var ed = null,
|
28 |
+
editorId = null,
|
29 |
+
activeEditor = tinyMCE.activeEditor;
|
30 |
+
for (editorId in tinyMCE.editors) {
|
31 |
+
if (editorId == edId) {
|
32 |
+
break;
|
33 |
+
}
|
34 |
+
editorId = null;
|
35 |
+
}
|
36 |
+
if (!editorId) {
|
37 |
+
_insertVariableToTextarea(edId, variable);
|
38 |
+
return;
|
39 |
+
}
|
40 |
+
if (activeEditor && $(activeEditor.getElement()).attr('id') == editorId) {
|
41 |
+
activeEditor.execCommand('insertHTML', false, variable);
|
42 |
+
if ($(activeEditor.getElement()).is(':visible')) {
|
43 |
+
_insertVariableToTextarea(edId, variable);
|
44 |
+
}
|
45 |
+
} else {
|
46 |
+
|
47 |
+
}
|
48 |
+
}
|
49 |
+
|
50 |
+
function _insertVariableToTextarea(eId, varibale) {
|
51 |
+
var $el = $('#' + eId).get(0);
|
52 |
+
if (document.selection) {
|
53 |
+
$el.focus();
|
54 |
+
sel = document.selection.createRange();
|
55 |
+
sel.text = varibale;
|
56 |
+
$el.focus();
|
57 |
+
}
|
58 |
+
else if ($el.selectionStart || $el.selectionStart == '0') {
|
59 |
+
var startPos = $el.selectionStart;
|
60 |
+
var endPos = $el.selectionEnd;
|
61 |
+
var scrollTop = $el.scrollTop;
|
62 |
+
$el.value = $el.value.substring(0, startPos) + varibale + $el.value.substring(endPos, $el.value.length);
|
63 |
+
$el.focus();
|
64 |
+
$el.selectionStart = startPos + varibale.length;
|
65 |
+
$el.selectionEnd = startPos + varibale.length;
|
66 |
+
$el.scrollTop = scrollTop;
|
67 |
+
} else {
|
68 |
+
$el.value += varibale;
|
69 |
+
$el.focus();
|
70 |
+
}
|
71 |
+
}
|
72 |
+
|
73 |
+
function _ready() {
|
74 |
+
|
75 |
+
/*var $generate_thumbnail = $('input[name="learn_press_generate_course_thumbnail"]').on('click', function () {
|
76 |
+
var toggle = !($(this).is(':checked'));
|
77 |
+
console.log(toggle);
|
78 |
+
$('.single-course-thumbnail').toggleClass('hide-if-js', toggle);
|
79 |
+
$('.archive-course-thumbnail').toggleClass('hide-if-js', toggle);
|
80 |
+
});
|
81 |
+
$generate_thumbnail.filter(':checked').trigger('change');
|
82 |
+
*/
|
83 |
+
$('#learn_press_email_formats').change(function () {
|
84 |
+
$('.learn-press-email-template.' + this.value).removeClass('hide-if-js').siblings().addClass('hide-if-js');
|
85 |
+
});
|
86 |
+
$('.learn-press-email-variables').each(function () {
|
87 |
+
var $list = $(this),
|
88 |
+
hasEditor = $list.hasClass('has-editor');
|
89 |
+
$list.on('click', 'li', function () {
|
90 |
+
if (hasEditor) {
|
91 |
+
_insertVariableToEditor($list.attr('data-target'), $(this).data('variable'));
|
92 |
+
} else {
|
93 |
+
_insertVariableToTextarea($list.attr('data-target'), $(this).data('variable'));
|
94 |
+
}
|
95 |
+
})
|
96 |
+
});
|
97 |
+
|
98 |
+
$('.learn-press-dropdown-pages').each(function () {
|
99 |
+
$(this).change(function () {
|
100 |
+
var $select = $(this),
|
101 |
+
thisId = $select.attr('id'),
|
102 |
+
$actions = $select.siblings('.learn-press-quick-add-page-actions');
|
103 |
+
$select.siblings('[data-id="' + thisId + '"]').hide();
|
104 |
+
$actions.addClass('hide-if-js');
|
105 |
+
if (this.value != 'add_new_page') {
|
106 |
+
if (parseInt(this.value)) {
|
107 |
+
$actions.find('a.edit-page').attr('href', 'post.php?post=' + this.value + '&action=edit');
|
108 |
+
$actions.find('a.view-page').attr('href', LP_Settings.siteurl + '?page_id=' + this.value);
|
109 |
+
$actions.removeClass('hide-if-js');
|
110 |
+
$select.attr('data-selected', this.value);
|
111 |
+
}
|
112 |
+
return;
|
113 |
+
}
|
114 |
+
;
|
115 |
+
$select.attr('disabled', true);
|
116 |
+
$('.learn-press-quick-add-page-inline.' + thisId).removeClass('hide-if-js').find('input').focus().val('');
|
117 |
+
});
|
118 |
+
});
|
119 |
+
|
120 |
+
$doc.on('click', '.learn-press-quick-add-page-inline button', function () {
|
121 |
+
var $form = $(this).parent(),
|
122 |
+
$input = $form.find('input'),
|
123 |
+
$select = $form.siblings('select'),
|
124 |
+
page_name = $input.val();
|
125 |
+
if (!page_name) {
|
126 |
+
alert('Please enter the name of page');
|
127 |
+
$input.focus();
|
128 |
+
return;
|
129 |
+
}
|
130 |
+
|
131 |
+
$.ajax({
|
132 |
+
url : LP_Settings.ajax,
|
133 |
+
data : {
|
134 |
+
action : 'learnpress_create_page',
|
135 |
+
page_name: page_name
|
136 |
+
},
|
137 |
+
type : 'post',
|
138 |
+
dataType: 'html',
|
139 |
+
success : function (response) {
|
140 |
+
response = LP.parseJSON(response);
|
141 |
+
if (response.page) {
|
142 |
+
addPageToAllDropdowns({
|
143 |
+
ID : response.page.ID,
|
144 |
+
name : response.page.post_title,
|
145 |
+
positions: response.positions
|
146 |
+
});
|
147 |
+
$select.val(response.page.ID).removeAttr('disabled').focus().trigger('change');
|
148 |
+
$form.addClass('hide-if-js');
|
149 |
+
} else if (response.error) {
|
150 |
+
alert(response.error);
|
151 |
+
$select.removeAttr('disabled')
|
152 |
+
}
|
153 |
+
$select.siblings('button').show();
|
154 |
+
}
|
155 |
+
});
|
156 |
+
}).on('click', '.learn-press-quick-add-page-inline a', function (e) {
|
157 |
+
e.preventDefault();
|
158 |
+
var $select = $(this).parent().addClass('hide-if-js').siblings('select');
|
159 |
+
$select.val($select.attr('data-selected')).removeAttr('disabled').trigger('change');
|
160 |
+
$select.siblings('button').show();
|
161 |
+
}).on('click', '.button-quick-add-page', function (e) {
|
162 |
+
var $button = $(this),
|
163 |
+
id = $button.data('id');
|
164 |
+
$button.siblings('select#' + id).val('add_new_page').trigger('change');
|
165 |
+
}).on('keypress keydown', '.learn-press-quick-add-page-inline input[type="text"]', function (e) {
|
166 |
+
if (e.keyCode == 13 && e.type == 'keypress') {
|
167 |
+
e.preventDefault();
|
168 |
+
$(this).siblings('button').trigger('click')
|
169 |
+
} else if (e.keyCode == 27 && e.type == 'keydown') {
|
170 |
+
$(this).siblings('a').trigger('click')
|
171 |
+
}
|
172 |
+
}).on('change update', '#learn_press_required_review', function (e) {
|
173 |
+
var $depend = $('input[name="learn_press_enable_edit_published"]').closest('tr');
|
174 |
+
$depend.toggleClass('hide-if-js', !e.target.checked).find('input[type="checkbox"]').prop('disabled', !e.target.checked)
|
175 |
+
}).on('change update', '#learn_press_auto_redirect_next_lesson', function (e) {
|
176 |
+
var $depend = $('#learn_press_auto_redirect_message, #learn_press_auto_redirect_time').closest('tr');
|
177 |
+
$depend.toggleClass('hide-if-js', !e.target.checked);
|
178 |
+
}).on('change', '.learn-press-single-course-permalink input[type="radio"]', function () {
|
179 |
+
var $check = $(this),
|
180 |
+
$row = $check.closest('.learn-press-single-course-permalink');
|
181 |
+
if ($row.hasClass('custom-base')) {
|
182 |
+
$row.find('input[type="text"]').prop('readonly', false);
|
183 |
+
} else {
|
184 |
+
$row.siblings('.custom-base').find('input[type="text"]').prop('readonly', true);
|
185 |
+
}
|
186 |
+
});
|
187 |
+
|
188 |
+
$('#learn_press_required_review, #learn_press_auto_redirect_next_lesson').trigger('update');
|
189 |
+
$('#learn-press-admin-settings').on('click', '.nav-tab, .subsubsub > li > a', function (e) {
|
190 |
+
e.preventDefault();
|
191 |
+
var redirect = $(this).attr('href'),
|
192 |
+
data = $('#mainform').serialize();
|
193 |
+
if (data != oldData) {
|
194 |
+
$('#learn-press-updating-message').show();
|
195 |
+
$.ajax({
|
196 |
+
url : window.location.href,
|
197 |
+
data : data,
|
198 |
+
type : 'post',
|
199 |
+
dataType: 'html',
|
200 |
+
success : function (res) {
|
201 |
+
$('#learn-press-updating-message').hide();
|
202 |
+
$('#learn-press-updated-message').show();
|
203 |
+
window.location.href = redirect;
|
204 |
+
}
|
205 |
+
});
|
206 |
+
} else {
|
207 |
+
window.location.href = redirect;
|
208 |
+
}
|
209 |
+
});
|
210 |
+
if ($('#learn-press-admin-settings .subsubsub').length) {
|
211 |
+
$('#learn-press-admin-settings').removeClass('no-subtabs');
|
212 |
+
}
|
213 |
+
$('.learn-press-settings-wrap').addClass('ready')
|
214 |
+
.on('click', '#learn-press-reset-settings', function () {
|
215 |
+
if (!confirm($(this).data('text'))) {
|
216 |
+
return false;
|
217 |
+
}
|
218 |
+
});
|
219 |
+
|
220 |
+
// hold current settings to know if user changed anything
|
221 |
+
oldData = $('#mainform').serialize();
|
222 |
+
|
223 |
+
(function () {
|
224 |
+
$('.learn-press-dropdown-pages').each(function () {
|
225 |
+
var $sel = $(this);
|
226 |
+
$sel.css('width', $sel.width() + 50).find('option').each(function () {
|
227 |
+
$(this).html($(this).html().replace(/ /g, ''));
|
228 |
+
});
|
229 |
+
$sel.select2();
|
230 |
+
});
|
231 |
+
})();
|
232 |
+
}
|
233 |
+
|
234 |
+
$doc.ready(_ready);
|
235 |
+
})(jQuery);
|
assets/js/admin/setup.js
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
|
3 |
+
"use strict";
|
4 |
+
|
5 |
+
function init() {
|
6 |
+
function validateEmail(email) {
|
7 |
+
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
8 |
+
return re.test(email);
|
9 |
+
}
|
10 |
+
|
11 |
+
function checkForm($form) {
|
12 |
+
var $emails = $form.find('input[type="email"]'),
|
13 |
+
valid = true;
|
14 |
+
$emails.each(function () {
|
15 |
+
var $this = $(this);
|
16 |
+
$this.css('border-color', '');
|
17 |
+
|
18 |
+
switch ($this.attr('name')) {
|
19 |
+
case 'settings[paypal][paypal_email]':
|
20 |
+
case 'settings[paypal][paypal_sandbox_email]':
|
21 |
+
if (!$this.closest('tr').prev().find('input[type="checkbox"]').is(':checked')) {
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
break;
|
25 |
+
}
|
26 |
+
if (!validateEmail(this.value)) {
|
27 |
+
valid = false;
|
28 |
+
$this.css('border-color', '#FF0000');
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
+
return valid;
|
33 |
+
}
|
34 |
+
|
35 |
+
function blockContent(block) {
|
36 |
+
$('#main').toggleClass('loading', block === undefined ? true : block);
|
37 |
+
}
|
38 |
+
|
39 |
+
function getFormData(more) {
|
40 |
+
var data = $('#learn-press-setup-form').serializeJSON();
|
41 |
+
|
42 |
+
return $.extend(data, more || {});
|
43 |
+
}
|
44 |
+
|
45 |
+
function replaceMainContent(newContent) {
|
46 |
+
var $newContent = $(newContent);
|
47 |
+
$main.replaceWith($newContent);
|
48 |
+
$main = $newContent;
|
49 |
+
}
|
50 |
+
|
51 |
+
var $main = $('#main');
|
52 |
+
|
53 |
+
$(document).on('click', '.buttons .button', function (e) {
|
54 |
+
e.preventDefault();
|
55 |
+
var $form = $('#learn-press-setup-form'),
|
56 |
+
loadUrl = $(this).attr('href'),
|
57 |
+
$main = $('#main');
|
58 |
+
|
59 |
+
if (!checkForm($form)) {
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
$main.addClass('loading');
|
64 |
+
$.post({
|
65 |
+
url: loadUrl,
|
66 |
+
data: getFormData(),
|
67 |
+
success: function (res) {
|
68 |
+
var $html = $(res);
|
69 |
+
replaceMainContent($html.contents().filter('#main'));
|
70 |
+
|
71 |
+
LP.setUrl(loadUrl);
|
72 |
+
|
73 |
+
$('.learn-press-dropdown-pages').dropdownPages();
|
74 |
+
$('.learn-press-tip').QuickTip();
|
75 |
+
$main.removeClass('loading');
|
76 |
+
}
|
77 |
+
});
|
78 |
+
}).on('change', '#currency', function () {
|
79 |
+
var m = $(this).children(':selected').html().match(/\((.*)\)/),
|
80 |
+
symbol = m ? m[1] : '';
|
81 |
+
$('#currency-pos').children().each(function () {
|
82 |
+
|
83 |
+
var $option = $(this),
|
84 |
+
text = $option.html();
|
85 |
+
|
86 |
+
switch ($option.val()) {
|
87 |
+
case 'left':
|
88 |
+
text = text.replace(/\( (.*)69/, '( ' + symbol + '69');
|
89 |
+
break;
|
90 |
+
case 'right':
|
91 |
+
text = text.replace(/9([^0-9]*) \)/, '9' + symbol + ' )');
|
92 |
+
break;
|
93 |
+
case 'left_with_space':
|
94 |
+
text = text.replace(/\( (.*) 6/, '( ' + symbol + ' 6');
|
95 |
+
break;
|
96 |
+
case 'right_with_space':
|
97 |
+
text = text.replace(/9 (.*) \)/, '9 ' + symbol + ' )');
|
98 |
+
break;
|
99 |
+
}
|
100 |
+
$option.html(text);
|
101 |
+
});
|
102 |
+
}).on('change', 'input, select', function () {
|
103 |
+
var $form = $('#learn-press-setup-form'),
|
104 |
+
loadUrl = '',
|
105 |
+
$main = $('#main');
|
106 |
+
$.post({
|
107 |
+
url: loadUrl,
|
108 |
+
dataType: 'html',
|
109 |
+
data: getFormData({
|
110 |
+
'lp-ajax': 'get-price-format'
|
111 |
+
}
|
112 |
+
),
|
113 |
+
success: function (res) {
|
114 |
+
$('#preview-price').html(res);
|
115 |
+
}
|
116 |
+
});
|
117 |
+
}).on('click', '#create-pages', function (e) {
|
118 |
+
e.preventDefault();
|
119 |
+
blockContent();
|
120 |
+
$.post({
|
121 |
+
url: $(this).attr('href'),
|
122 |
+
dataType: 'html',
|
123 |
+
data: getFormData({
|
124 |
+
'lp-ajax': 'setup-create-pages'
|
125 |
+
}
|
126 |
+
),
|
127 |
+
success: function (res) {
|
128 |
+
replaceMainContent($(res).contents().filter('#main'));
|
129 |
+
$('.learn-press-dropdown-pages').dropdownPages();
|
130 |
+
blockContent(false);
|
131 |
+
}
|
132 |
+
});
|
133 |
+
}).on('click', '#install-sample-course', function (e) {
|
134 |
+
e.preventDefault();
|
135 |
+
|
136 |
+
var $button = $(this);
|
137 |
+
blockContent();
|
138 |
+
|
139 |
+
$.post({
|
140 |
+
url: $(this).attr('href'),
|
141 |
+
dataType: 'html',
|
142 |
+
data: {},
|
143 |
+
success: function (res) {
|
144 |
+
blockContent(false);
|
145 |
+
$button.replaceWith($(res).find('a:first').addClass('button button-primary'));
|
146 |
+
}
|
147 |
+
});
|
148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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
$.fn.LP_Chart_Line = function (data, config) {
|
3 |
+
return $.each(this, function () {
|
4 |
+
var $elem = $(this),
|
5 |
+
$canvas = $('<canvas />');
|
6 |
+
$elem.html('');
|
7 |
+
$canvas.appendTo($elem);
|
8 |
+
new Chart($canvas.get(0).getContext('2d')).Line(data, config);
|
9 |
+
});
|
10 |
+
//
|
11 |
+
}
|
12 |
+
|
13 |
+
$.fn.LP_Statistic_Users = function () {
|
14 |
+
if(parseInt($(this).length)===0){
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
return $.each(this, function () {
|
18 |
+
var $buttons = $('.chart-buttons button').on('click', function () {
|
19 |
+
var $button = $(this),
|
20 |
+
type = $button.data('type'),
|
21 |
+
from = '', to = '',
|
22 |
+
$container = $('#learn-press-chart');
|
23 |
+
$buttons.not(this).not('[data-type="user-custom-time"]').prop('disabled', false);
|
24 |
+
if (type == 'user-custom-time') {
|
25 |
+
from = $('#user-custom-time input[name="from"]').val();
|
26 |
+
to = $('#user-custom-time input[name="to"]').val();
|
27 |
+
|
28 |
+
if (from == '' || to == '') {
|
29 |
+
return false;
|
30 |
+
}
|
31 |
+
} else {
|
32 |
+
$button.prop('disabled', true)
|
33 |
+
}
|
34 |
+
$container.addClass('loading')
|
35 |
+
$.ajax({
|
36 |
+
url : 'admin-ajax.php',
|
37 |
+
data : {
|
38 |
+
action: 'learnpress_load_chart',
|
39 |
+
type : type,
|
40 |
+
range : [from, to]
|
41 |
+
},
|
42 |
+
dataType: 'text',
|
43 |
+
success : function (response) {
|
44 |
+
response = LP.parseJSON(response);
|
45 |
+
$container.LP_Chart_Line(response, LP_Chart_Config);
|
46 |
+
$container.removeClass('loading');
|
47 |
+
}
|
48 |
+
});
|
49 |
+
return false;
|
50 |
+
}),
|
51 |
+
$inputs = $('.chart-buttons #user-custom-time input[type="text"]').change(function () {
|
52 |
+
var _valid_date = function () {
|
53 |
+
if (new Date($inputs[0].value) < new Date($inputs[1].value)) {
|
54 |
+
return true;
|
55 |
+
}
|
56 |
+
}
|
57 |
+
$buttons.filter('[data-type="user-custom-time"]').prop('disabled', $inputs.filter(function () {
|
58 |
+
return this.value == '';
|
59 |
+
}).get().length || !_valid_date());
|
60 |
+
})
|
61 |
+
});
|
62 |
+
}
|
63 |
+
|
64 |
+
$.fn.LP_Statistic_Courses = function () {
|
65 |
+
if(parseInt($(this).length)===0){
|
66 |
+
return;
|
67 |
+
}
|
68 |
+
return $.each(this, function () {
|
69 |
+
var $buttons = $('.chart-buttons button').on('click', function () {
|
70 |
+
var $button = $(this),
|
71 |
+
type = $button.data('type'),
|
72 |
+
from = '', to = '',
|
73 |
+
$container = $('#learn-press-chart');
|
74 |
+
$buttons.not(this).not('[data-type="course-custom-time"]').prop('disabled', false);
|
75 |
+
if ( type == 'course-custom-time' ) {
|
76 |
+
from = $('#course-custom-time input[name="from"]').val();
|
77 |
+
to = $('#course-custom-time input[name="to"]').val();
|
78 |
+
|
79 |
+
if (from == '' || to == '') {
|
80 |
+
return false;
|
81 |
+
}
|
82 |
+
} else {
|
83 |
+
$button.prop('disabled', true)
|
84 |
+
}
|
85 |
+
$container.addClass('loading')
|
86 |
+
$.ajax({
|
87 |
+
url : 'admin-ajax.php',
|
88 |
+
data : {
|
89 |
+
action: 'learnpress_load_chart',
|
90 |
+
type : type,
|
91 |
+
range : [from, to]
|
92 |
+
},
|
93 |
+
dataType: 'text',
|
94 |
+
success : function (response) {
|
95 |
+
response = LP.parseJSON(response);
|
96 |
+
$container.LP_Chart_Line(response, LP_Chart_Config);
|
97 |
+
$container.removeClass('loading');
|
98 |
+
}
|
99 |
+
});
|
100 |
+
return false;
|
101 |
+
}),
|
102 |
+
$inputs = $('.chart-buttons #course-custom-time input[type="text"]').change(function () {
|
103 |
+
var _valid_date = function () {
|
104 |
+
if (new Date($inputs[0].value) < new Date($inputs[1].value)) {
|
105 |
+
return true;
|
106 |
+
}
|
107 |
+
}
|
108 |
+
$buttons.filter('[data-type="course-custom-time"]').prop('disabled', $inputs.filter(function () {
|
109 |
+
return this.value == '';
|
110 |
+
}).get().length || !_valid_date());
|
111 |
+
})
|
112 |
+
});
|
113 |
+
}
|
114 |
+
|
115 |
+
$.fn.LP_Statistic_Orders = function () {
|
116 |
+
if(parseInt($(this).length)===0){
|
117 |
+
return;
|
118 |
+
}
|
119 |
+
$('.panel_report_option').hide();
|
120 |
+
$('#panel_report_sales_by_'+$('#report_sales_by').val()).show();
|
121 |
+
$('#report_sales_by').on('change', function(){
|
122 |
+
$('.panel_report_option').hide();
|
123 |
+
$('#panel_report_sales_by_'+$(this).val()).show();
|
124 |
+
if('date'==$(this).val()){
|
125 |
+
LP_Statistic_Orders_Upgrade_Chart();
|
126 |
+
}
|
127 |
+
});
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Upgrade Chart for Order Statistics
|
131 |
+
* @returns {Boolean}
|
132 |
+
*/
|
133 |
+
var LP_Statistic_Orders_Upgrade_Chart =function(){
|
134 |
+
var type = '', from = '', to = '', report_sales_by = 'date', cat_id = 0, course_id = 0;
|
135 |
+
report_sales_by = $('#report_sales_by').val();
|
136 |
+
$container = $('#learn-press-chart');
|
137 |
+
$container.addClass('loading');
|
138 |
+
// get type
|
139 |
+
var $buttons = $('.chart-buttons button:disabled').not('[data-type="order-custom-time"]');
|
140 |
+
if( parseInt( $buttons.length ) > 0 ) {
|
141 |
+
type = $($buttons[0]).data('type');
|
142 |
+
} else {
|
143 |
+
type = 'order-custom-time';
|
144 |
+
from = $('#order-custom-time input[name="from"]').val();
|
145 |
+
to = $('#order-custom-time input[name="to"]').val();
|
146 |
+
if (from == '' || to == '') {
|
147 |
+
return false;
|
148 |
+
}
|
149 |
+
}
|
150 |
+
if( 'course' === report_sales_by ) {
|
151 |
+
course_id = $('#report-by-course-id').val();
|
152 |
+
} else if( 'category' === report_sales_by ) {
|
153 |
+
cat_id = $('#report-by-course-category-id').val();
|
154 |
+
}
|
155 |
+
|
156 |
+
$.ajax({
|
157 |
+
url : 'admin-ajax.php',
|
158 |
+
data : {
|
159 |
+
action: 'learnpress_load_chart',
|
160 |
+
type : type,
|
161 |
+
range : [from, to],
|
162 |
+
report_sales_by: report_sales_by,
|
163 |
+
course_id: course_id,
|
164 |
+
cat_id: cat_id
|
165 |
+
},
|
166 |
+
dataType: 'text',
|
167 |
+
success : function (response) {
|
168 |
+
response = LP.parseJSON(response);
|
169 |
+
$container.LP_Chart_Line(response, LP_Chart_Config);
|
170 |
+
$container.removeClass('loading');
|
171 |
+
}
|
172 |
+
});
|
173 |
+
};
|
174 |
+
|
175 |
+
|
176 |
+
$('#report-by-course-id').select2({
|
177 |
+
placeholder:'Select a course',
|
178 |
+
minimumInputLength: 1,
|
179 |
+
ajax: {
|
180 |
+
url: ajaxurl+'?action=learnpress_search_course',
|
181 |
+
dataType: 'json',
|
182 |
+
quietMillis: 250,
|
183 |
+
data: function (term, page) {
|
184 |
+
return {
|
185 |
+
q: term, // search term
|
186 |
+
};
|
187 |
+
},
|
188 |
+
results: function ( data, page ) {
|
189 |
+
return { results: data.items };
|
190 |
+
},
|
191 |
+
cache: true
|
192 |
+
}
|
193 |
+
});
|
194 |
+
|
195 |
+
$('#report-by-course-id').on('change', function(){
|
196 |
+
LP_Statistic_Orders_Upgrade_Chart();
|
197 |
+
});
|
198 |
+
|
199 |
+
$('#report-by-course-category-id').select2({
|
200 |
+
placeholder:'Select a course',
|
201 |
+
minimumInputLength: 1,
|
202 |
+
ajax: {
|
203 |
+
url: ajaxurl+'?action=learnpress_search_course_category',
|
204 |
+
dataType: 'json',
|
205 |
+
quietMillis: 250,
|
206 |
+
data: function (term, page) {
|
207 |
+
return {
|
208 |
+
q: term, // search term
|
209 |
+
};
|
210 |
+
},
|
211 |
+
results: function ( data, page ) {
|
212 |
+
return { results: data.items };
|
213 |
+
},
|
214 |
+
cache: true
|
215 |
+
}
|
216 |
+
});
|
217 |
+
|
218 |
+
$('#report-by-course-category-id').on('change', function(){
|
219 |
+
LP_Statistic_Orders_Upgrade_Chart();
|
220 |
+
});
|
221 |
+
|
222 |
+
var $buttons = $('.chart-buttons button').on('click', function () {
|
223 |
+
var $button = $(this),
|
224 |
+
type = $button.data('type'),
|
225 |
+
from = '', to = '',
|
226 |
+
$container = $('#learn-press-chart');
|
227 |
+
$buttons.not(this).not('[data-type="order-custom-time"]').prop('disabled', false);
|
228 |
+
if (type !== 'order-custom-time') {
|
229 |
+
$button.prop('disabled', true);
|
230 |
+
$('#order-custom-time input[name="from"]').val('');
|
231 |
+
$('#order-custom-time input[name="to"]').val('');
|
232 |
+
}
|
233 |
+
LP_Statistic_Orders_Upgrade_Chart();
|
234 |
+
return false;
|
235 |
+
});
|
236 |
+
|
237 |
+
var $inputs = $('.chart-buttons #order-custom-time input[type="text"]').change(function () {
|
238 |
+
var _valid_date = function () {
|
239 |
+
if (new Date($inputs[0].value) < new Date($inputs[1].value)) {
|
240 |
+
return true;
|
241 |
+
}
|
242 |
+
}
|
243 |
+
$buttons.filter('[data-type="order-custom-time"]').prop('disabled', $inputs.filter(function () {
|
244 |
+
return this.value == '';
|
245 |
+
}).get().length || !_valid_date());
|
246 |
+
});
|
247 |
+
|
248 |
+
}
|
249 |
+
;
|
250 |
+
$(document).ready(function () {
|
251 |
+
if (typeof $.fn.datepicker != 'undefined') {
|
252 |
+
$(".date-picker").datepicker({
|
253 |
+
dateFormat: 'yy/mm/dd'
|
254 |
+
});
|
255 |
+
}
|
256 |
+
$('.learn-press-statistic-users').LP_Statistic_Users();
|
257 |
+
$('.learn-press-statistic-courses').LP_Statistic_Courses();
|
258 |
+
$('.learn-press-statistic-orders').LP_Statistic_Orders();
|
259 |
+
|
260 |
+
});
|
261 |
+
return;
|
262 |
+
|
263 |
+
var student_chart;
|
264 |
+
window.drawStudentsChart = drawStudentsChart = function (data, config) {
|
265 |
+
var $student_chart = $("#lpr-chart-students").clone().attr('style', '').removeAttr("width").removeAttr('height');
|
266 |
+
$("#lpr-chart-students").replaceWith($student_chart);
|
267 |
+
$student_chart = $student_chart[0].getContext("2d");
|
268 |
+
student_chart = new Chart($student_chart).Line(data, config);
|
269 |
+
}
|
270 |
+
if (typeof last_seven_days == 'undefined') return;
|
271 |
+
drawStudentsChart(last_seven_days, config);
|
272 |
+
|
273 |
+
|
274 |
+
var courses_chart;
|
275 |
+
window.drawCoursesChart = drawCoursesChart = function (data, config) {
|
276 |
+
var $courses_chart = $("#lpr-chart-courses").clone().attr('style', '').removeAttr("width").removeAttr('height');
|
277 |
+
$("#lpr-chart-courses").replaceWith($courses_chart);
|
278 |
+
$courses_chart = $courses_chart[0].getContext("2d");
|
279 |
+
courses_chart = new Chart($courses_chart).Bar(data, config);
|
280 |
+
}
|
281 |
+
if (typeof data == 'undefined') return;
|
282 |
+
|
283 |
+
drawCoursesChart(data, config);
|
284 |
+
|
285 |
+
})(jQuery);
|
286 |
+
|
assets/js/admin/sync-data.js
ADDED
@@ -0,0 +1,268 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
var Sync_Base = {
|
3 |
+
id: 'sync-base',
|
4 |
+
syncing: false,
|
5 |
+
items: false,
|
6 |
+
completed: false,
|
7 |
+
callback: null,
|
8 |
+
methodGetItems: '',
|
9 |
+
itemsKey: '',
|
10 |
+
chunkSize: 50,
|
11 |
+
sync: function (callback) {
|
12 |
+
if (this.syncing) {
|
13 |
+
return;
|
14 |
+
}
|
15 |
+
|
16 |
+
this.callback = callback;
|
17 |
+
|
18 |
+
if (this.items === false) {
|
19 |
+
this.get_items();
|
20 |
+
} else {
|
21 |
+
if (!this.dispatch()) {
|
22 |
+
this.completed = true;
|
23 |
+
this.callToCallback();
|
24 |
+
return;
|
25 |
+
}
|
26 |
+
}
|
27 |
+
|
28 |
+
this.syncing = true;
|
29 |
+
},
|
30 |
+
init: function () {
|
31 |
+
this.syncing = false;
|
32 |
+
this.items = false;
|
33 |
+
this.completed = false;
|
34 |
+
},
|
35 |
+
is_completed: function () {
|
36 |
+
return this.completed;
|
37 |
+
},
|
38 |
+
dispatch: function () {
|
39 |
+
var that = this,
|
40 |
+
items = this.items ? this.items.splice(0, this.chunkSize) : false;
|
41 |
+
if (!items || items.length === 0) {
|
42 |
+
return false;
|
43 |
+
}
|
44 |
+
$.ajax({
|
45 |
+
url: '',
|
46 |
+
data: {
|
47 |
+
'lp-ajax': this.id,
|
48 |
+
sync: items
|
49 |
+
},
|
50 |
+
method: 'post',
|
51 |
+
success: function (response) {
|
52 |
+
response = LP.parseJSON(response)
|
53 |
+
that.syncing = false;
|
54 |
+
if (response.result !== 'success') {
|
55 |
+
that.completed = true;
|
56 |
+
}
|
57 |
+
that.callToCallback();
|
58 |
+
if (that.is_completed()) {
|
59 |
+
return;
|
60 |
+
}
|
61 |
+
|
62 |
+
that.sync(that.callback);
|
63 |
+
}
|
64 |
+
});
|
65 |
+
|
66 |
+
return true;
|
67 |
+
},
|
68 |
+
callToCallback: function () {
|
69 |
+
this.callback && this.callback.call(this);
|
70 |
+
},
|
71 |
+
get_items: function () {
|
72 |
+
var that = this;
|
73 |
+
$.ajax({
|
74 |
+
url: '',
|
75 |
+
data: {
|
76 |
+
'lp-ajax': this.id,
|
77 |
+
sync: this.methodGetItems
|
78 |
+
},
|
79 |
+
success: function (response) {
|
80 |
+
that.syncing = false;
|
81 |
+
response = LP.parseJSON(response);
|
82 |
+
if (response[that.itemsKey]) {
|
83 |
+
that.items = response[that.itemsKey];
|
84 |
+
that.sync(that.callback);
|
85 |
+
} else {
|
86 |
+
that.completed = true;
|
87 |
+
that.items = [];
|
88 |
+
that.callToCallback();
|
89 |
+
}
|
90 |
+
}
|
91 |
+
});
|
92 |
+
}
|
93 |
+
};
|
94 |
+
|
95 |
+
var Sync_Course_Orders = $.extend({}, Sync_Base, {
|
96 |
+
id: 'sync-course-orders',
|
97 |
+
methodGetItems: 'get-courses',
|
98 |
+
itemsKey: 'courses'
|
99 |
+
});
|
100 |
+
|
101 |
+
var Sync_User_Courses = $.extend({}, Sync_Base, {
|
102 |
+
id: 'sync-user-courses',
|
103 |
+
methodGetItems: 'get-users',
|
104 |
+
itemsKey: 'users',
|
105 |
+
chunkSize: 500
|
106 |
+
});
|
107 |
+
|
108 |
+
var Sync_User_Orders = $.extend({}, Sync_Base, {
|
109 |
+
id: 'sync-user-orders',
|
110 |
+
methodGetItems: 'get-users',
|
111 |
+
itemsKey: 'users',
|
112 |
+
chunkSize: 500
|
113 |
+
});
|
114 |
+
|
115 |
+
var Sync_Course_Final_Quiz = $.extend({}, Sync_Base, {
|
116 |
+
id: 'sync-course-final-quiz',
|
117 |
+
methodGetItems: 'get-courses',
|
118 |
+
itemsKey: 'courses',
|
119 |
+
chunkSize: 500
|
120 |
+
});
|
121 |
+
|
122 |
+
var Sync_Remove_Older_Data = $.extend({}, Sync_Base, {
|
123 |
+
id: 'sync-remove-older-data',
|
124 |
+
methodGetItems: 'remove-older-data',
|
125 |
+
itemsKey: '_nothing_here',
|
126 |
+
chunkSize: 500
|
127 |
+
});
|
128 |
+
|
129 |
+
var Sync_Calculate_Course_Results = $.extend({}, Sync_Base, {
|
130 |
+
id: 'sync-calculate-course-results',
|
131 |
+
methodGetItems: 'get-users',
|
132 |
+
itemsKey: 'users',
|
133 |
+
chunkSize: 1
|
134 |
+
});
|
135 |
+
|
136 |
+
|
137 |
+
window.LP_Sync_Data = {
|
138 |
+
syncs: [],
|
139 |
+
syncing: 0,
|
140 |
+
options: {},
|
141 |
+
start: function (options) {
|
142 |
+
this.syncs = [];
|
143 |
+
this.options = $.extend({
|
144 |
+
onInit: function () {
|
145 |
+
},
|
146 |
+
onStart: function () {
|
147 |
+
|
148 |
+
},
|
149 |
+
onCompleted: function () {
|
150 |
+
|
151 |
+
},
|
152 |
+
onCompletedAll: function () {
|
153 |
+
|
154 |
+
}
|
155 |
+
}, options || {});
|
156 |
+
|
157 |
+
if (!this.get_syncs()) {
|
158 |
+
return;
|
159 |
+
}
|
160 |
+
this.reset();
|
161 |
+
this.options.onInit.call(this);
|
162 |
+
var that = this,
|
163 |
+
syncing = 0,
|
164 |
+
totalSyncs = this.syncs.length,
|
165 |
+
syncCallback = function ($sync) {
|
166 |
+
|
167 |
+
if ($sync.is_completed()) {
|
168 |
+
syncing++;
|
169 |
+
that.options.onCompleted.call(that, $sync)
|
170 |
+
if (syncing >= totalSyncs) {
|
171 |
+
|
172 |
+
that.options.onCompletedAll.call(that)
|
173 |
+
return;
|
174 |
+
}
|
175 |
+
that.sync(syncing, syncCallback)
|
176 |
+
}
|
177 |
+
};
|
178 |
+
this.sync(syncing, syncCallback);
|
179 |
+
},
|
180 |
+
reset: function () {
|
181 |
+
for (var sync in this.syncs) {
|
182 |
+
try {
|
183 |
+
this[this.syncs[sync]].init();
|
184 |
+
} catch (e) {
|
185 |
+
}
|
186 |
+
}
|
187 |
+
},
|
188 |
+
sync: function (sync, callback) {
|
189 |
+
var that = this,
|
190 |
+
$sync = this[this.syncs[sync]];
|
191 |
+
that.options.onStart.call(that, $sync);
|
192 |
+
$sync.sync(function () {
|
193 |
+
callback.call(that, $sync)
|
194 |
+
})
|
195 |
+
},
|
196 |
+
get_syncs: function () {
|
197 |
+
var syncs = $('input[name^="lp-repair"]:checked').serializeJSON()['lp-repair'];
|
198 |
+
if (!syncs) {
|
199 |
+
return false;
|
200 |
+
}
|
201 |
+
|
202 |
+
for (var sync in syncs) {
|
203 |
+
if (syncs[sync] !== 'yes') {
|
204 |
+
continue;
|
205 |
+
}
|
206 |
+
|
207 |
+
sync = sync.replace(/[-]+/g, '_');
|
208 |
+
|
209 |
+
if (!this[sync]) {
|
210 |
+
continue;
|
211 |
+
}
|
212 |
+
|
213 |
+
this.syncs.push(sync);
|
214 |
+
}
|
215 |
+
|
216 |
+
return this.syncs;
|
217 |
+
},
|
218 |
+
get_sync: function (id) {
|
219 |
+
id = id.replace(/[-]+/g, '_');
|
220 |
+
return this[id];
|
221 |
+
},
|
222 |
+
sync_course_orders: Sync_Course_Orders,
|
223 |
+
sync_user_orders: Sync_User_Orders,
|
224 |
+
sync_user_courses: Sync_User_Courses,
|
225 |
+
sync_course_final_quiz: Sync_Course_Final_Quiz,
|
226 |
+
sync_remove_older_data: Sync_Remove_Older_Data,
|
227 |
+
sync_calculate_course_results: Sync_Calculate_Course_Results
|
228 |
+
}
|
229 |
+
|
230 |
+
$(document).ready(function () {
|
231 |
+
function initSyncs() {
|
232 |
+
var $chkAll = $('#learn-press-check-all-syncs'),
|
233 |
+
$chks = $('#learn-press-syncs').find('[name^="lp-repair"]');
|
234 |
+
|
235 |
+
$chkAll.on('click', function () {
|
236 |
+
$chks.prop('checked', this.checked)
|
237 |
+
});
|
238 |
+
|
239 |
+
$chks.on('click', function () {
|
240 |
+
$chkAll.prop('checked', $chks.filter(':checked').length === $chks.length);
|
241 |
+
})
|
242 |
+
}
|
243 |
+
|
244 |
+
initSyncs();
|
245 |
+
}).on('click', '.lp-button-repair', function () {
|
246 |
+
function getInput(sync) {
|
247 |
+
return $('ul#learn-press-syncs').find('input[name*="' + sync + '"]')
|
248 |
+
}
|
249 |
+
|
250 |
+
LP_Sync_Data.start({
|
251 |
+
onInit: function () {
|
252 |
+
$('ul#learn-press-syncs').children().removeClass('syncing synced');
|
253 |
+
$('.lp-button-repair').prop('disabled', true);
|
254 |
+
},
|
255 |
+
onStart: function ($sync) {
|
256 |
+
getInput($sync.id).closest('li').addClass('syncing');
|
257 |
+
},
|
258 |
+
onCompleted: function ($sync) {
|
259 |
+
getInput($sync.id).closest('li').removeClass('syncing').addClass('synced');
|
260 |
+
},
|
261 |
+
onCompletedAll: function () {
|
262 |
+
$('ul#learn-press-syncs').children().removeClass('syncing synced');
|
263 |
+
$('.lp-button-repair').prop('disabled', false);
|
264 |
+
}
|
265 |
+
});
|
266 |
+
});
|
267 |
+
|
268 |
+
})(jQuery);
|
assets/js/admin/update.js
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var Package = function (data) {
|
5 |
+
this.data = data;
|
6 |
+
|
7 |
+
var currentIndex = -1,
|
8 |
+
currentVersion = null,
|
9 |
+
currentPackage = null,
|
10 |
+
versions = Object.keys(this.data);
|
11 |
+
|
12 |
+
this.reset = function (current) {
|
13 |
+
current = (current === undefined || current > versions.length - 1 || current < 0 ) ? 0 : current;
|
14 |
+
currentIndex = current;
|
15 |
+
currentVersion = versions[current];
|
16 |
+
currentPackage = this.data[currentVersion];
|
17 |
+
|
18 |
+
return currentPackage;
|
19 |
+
}
|
20 |
+
|
21 |
+
this.next = function () {
|
22 |
+
if (currentIndex >= versions.length - 1) {
|
23 |
+
return false;
|
24 |
+
}
|
25 |
+
|
26 |
+
currentIndex++;
|
27 |
+
this.reset(currentIndex);
|
28 |
+
|
29 |
+
return currentPackage;
|
30 |
+
}
|
31 |
+
|
32 |
+
this.prev = function () {
|
33 |
+
if (currentIndex <= 0) {
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
currentIndex--;
|
38 |
+
this.reset(currentIndex);
|
39 |
+
|
40 |
+
return currentPackage;
|
41 |
+
}
|
42 |
+
|
43 |
+
this.currentVersion = function () {
|
44 |
+
return currentVersion;
|
45 |
+
}
|
46 |
+
|
47 |
+
this.hasPackage = function () {
|
48 |
+
return versions.length
|
49 |
+
}
|
50 |
+
|
51 |
+
this.getPercentCompleted = function () {
|
52 |
+
return (currentIndex) / versions.length;
|
53 |
+
}
|
54 |
+
|
55 |
+
this.getTotal = function () {
|
56 |
+
return versions.length;
|
57 |
+
}
|
58 |
+
|
59 |
+
if (!this.data) {
|
60 |
+
return;
|
61 |
+
}
|
62 |
+
|
63 |
+
}
|
64 |
+
var UpdaterSettings = {
|
65 |
+
el: '#learn-press-updater',
|
66 |
+
data: {
|
67 |
+
packages: null,
|
68 |
+
status: '',
|
69 |
+
force: false,
|
70 |
+
},
|
71 |
+
watch: {
|
72 |
+
packages: function (newPackages, oldPackages) {
|
73 |
+
if (newPackages) {
|
74 |
+
|
75 |
+
}
|
76 |
+
}
|
77 |
+
},
|
78 |
+
mounted: function () {
|
79 |
+
$(this.$el).show();
|
80 |
+
},
|
81 |
+
methods: {
|
82 |
+
getUpdatePackages: function (callback) {
|
83 |
+
var that = this;
|
84 |
+
$.ajax({
|
85 |
+
url: lpGlobalSettings.admin_url,
|
86 |
+
data: {
|
87 |
+
'lp-ajax': 'get-update-packages',
|
88 |
+
force: this.force,
|
89 |
+
_wpnonce: lpGlobalSettings._wpnonce
|
90 |
+
},
|
91 |
+
success: function (res) {
|
92 |
+
var packages = LP.parseJSON(res);
|
93 |
+
that.packages = new Package(packages);
|
94 |
+
callback && callback.call(that)
|
95 |
+
}
|
96 |
+
})
|
97 |
+
},
|
98 |
+
start: function (e, force) {
|
99 |
+
this.packages = null;
|
100 |
+
this.force = force;
|
101 |
+
this.getUpdatePackages(function () {
|
102 |
+
if (this.packages.hasPackage()) {
|
103 |
+
var p = this.packages.next();
|
104 |
+
this.status = 'updating';
|
105 |
+
this.doUpdate(p);
|
106 |
+
}
|
107 |
+
});
|
108 |
+
},
|
109 |
+
getPackages: function () {
|
110 |
+
return this.packages ? this.packages.data : {};
|
111 |
+
},
|
112 |
+
hasPackage: function () {
|
113 |
+
return !$.isEmptyObject(this.getPackages());
|
114 |
+
},
|
115 |
+
updateButtonClass: function () {
|
116 |
+
return {
|
117 |
+
'disabled': this.status === 'updating'
|
118 |
+
}
|
119 |
+
},
|
120 |
+
doUpdate: function (p, i) {
|
121 |
+
var that = this;
|
122 |
+
|
123 |
+
p = p ? p : this.packages.next();
|
124 |
+
i = i ? i : 1;
|
125 |
+
|
126 |
+
if (p) {
|
127 |
+
$.ajax({
|
128 |
+
url: lpGlobalSettings.admin_url,
|
129 |
+
data: {
|
130 |
+
'lp-ajax': 'do-update-package',
|
131 |
+
package: p,
|
132 |
+
version: this.packages.currentVersion(),
|
133 |
+
_wpnonce: lpGlobalSettings._wpnonce,
|
134 |
+
force: this.force,
|
135 |
+
i: i
|
136 |
+
},
|
137 |
+
success: function (res) {
|
138 |
+
var response = LP.parseJSON(res),
|
139 |
+
$status = $(that.$el).find('.updater-progress-status');
|
140 |
+
if (response.done === 'yes') {
|
141 |
+
that.update(that.packages.getPercentCompleted() * 100);
|
142 |
+
that.doUpdate();
|
143 |
+
} else {
|
144 |
+
var newWidth = that.packages.getPercentCompleted() * 100;
|
145 |
+
if (response.percent) {
|
146 |
+
var stepWidth = 1 / that.packages.getTotal();
|
147 |
+
newWidth += (stepWidth * response.percent);
|
148 |
+
}
|
149 |
+
|
150 |
+
that.update(newWidth);
|
151 |
+
that.doUpdate(p, ++i);
|
152 |
+
}
|
153 |
+
},
|
154 |
+
error: function () {
|
155 |
+
that.doUpdate(p, i);
|
156 |
+
}
|
157 |
+
});
|
158 |
+
|
159 |
+
} else {
|
160 |
+
that.update(100).addClass('completed');
|
161 |
+
setTimeout(function (x) {
|
162 |
+
x.status = 'completed';
|
163 |
+
}, 2000, this);
|
164 |
+
}
|
165 |
+
},
|
166 |
+
update: function (value) {
|
167 |
+
return $(this.$el).find('.updater-progress-status').css('width', value + '%').attr('data-value', parseInt(value));
|
168 |
+
}
|
169 |
+
}
|
170 |
+
};
|
171 |
+
|
172 |
+
|
173 |
+
|
174 |
+
function init() {
|
175 |
+
|
176 |
+
window.lpGlobalSettings = window.lpGlobalSettings || {};
|
177 |
+
|
178 |
+
if($('#learn-press-updater').length) {
|
179 |
+
var Updater = new Vue(UpdaterSettings);
|
180 |
+
}
|
181 |
+
|
182 |
+
|
183 |
+
// return;
|
184 |
+
//
|
185 |
+
// var i18n = window.lpUpdateSettings || {};
|
186 |
+
// $(document).on('click', '#button-update', function (e) {
|
187 |
+
// e.preventDefault();
|
188 |
+
// var $form = $('#learn-press-update-form'),
|
189 |
+
// loadUrl = $(this).attr('href'),
|
190 |
+
// $main = $('#main').addClass('loading');
|
191 |
+
// $('.learn-press-message').remove();
|
192 |
+
// $.post({
|
193 |
+
// url: loadUrl,
|
194 |
+
// data: $form.serializeJSON(),
|
195 |
+
// success: function (res) {
|
196 |
+
// $(res).insertBefore($form);
|
197 |
+
// $main.removeClass('loading');
|
198 |
+
// }
|
199 |
+
// });
|
200 |
+
// }).on('click', '.lp-button-upgrade', function (e) {
|
201 |
+
// e.preventDefault();
|
202 |
+
//
|
203 |
+
// if (!confirm(i18n.i18n_confirm)) {
|
204 |
+
// return false;
|
205 |
+
// }
|
206 |
+
//
|
207 |
+
// var $btn = $(this),
|
208 |
+
// url = $btn.addClass('disabled').attr('href'),
|
209 |
+
// context = $btn.data('context');
|
210 |
+
// $.post({
|
211 |
+
// url: url,
|
212 |
+
// data: {
|
213 |
+
// context: context
|
214 |
+
// },
|
215 |
+
// success: function (res) {
|
216 |
+
// var $msg = $(res);
|
217 |
+
// if (context == 'message') {
|
218 |
+
// $btn.closest('.notice').replaceWith($msg);
|
219 |
+
// } else {
|
220 |
+
// $msg.insertBefore($btn);
|
221 |
+
// }
|
222 |
+
// }
|
223 |
+
// });
|
224 |
+
// }).on('click', '#skip-notice-install', function(){
|
225 |
+
// $.post({
|
226 |
+
// url: '',
|
227 |
+
// data: {
|
228 |
+
// 'lp-ajax': 'skip-notice-install'
|
229 |
+
// }
|
230 |
+
// });
|
231 |
+
//
|
232 |
+
// $('#notice-install').fadeOut();
|
233 |
+
// });
|
234 |
+
}
|
235 |
+
|
236 |
+
$(document).ready(init);
|
237 |
+
|
238 |
+
})(jQuery);
|
assets/js/admin/utils/_advanced-list.js
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
/**
|
3 |
+
* Advanced list.
|
4 |
+
*
|
5 |
+
* @param el
|
6 |
+
* @param options
|
7 |
+
*/
|
8 |
+
var advancedList = function (el, options) {
|
9 |
+
var self = this,
|
10 |
+
$el = $(el).hasClass('advanced-list') ? $(el) : $('.advanced-list', el);
|
11 |
+
|
12 |
+
this.options = $.extend({
|
13 |
+
template: '<li data-id="{{id}}"><span class="remove-item"></span><span>{{text}}</span> </li>'
|
14 |
+
}, options || {});
|
15 |
+
this.$el = $el;
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Callback for removing event.
|
19 |
+
*
|
20 |
+
* @param e
|
21 |
+
* @private
|
22 |
+
*/
|
23 |
+
function _remove(e) {
|
24 |
+
e.preventDefault();
|
25 |
+
remove($el.children().index($(this).closest('li')) + 1)
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* @param e
|
31 |
+
* @private
|
32 |
+
*/
|
33 |
+
function _add(e) {
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Remove an element at a position from list.
|
39 |
+
*
|
40 |
+
* @param at
|
41 |
+
*/
|
42 |
+
function remove(at) {
|
43 |
+
$el.children(':eq(' + (at - 1) + ')').remove();
|
44 |
+
self.options.onRemove && self.options.onRemove.call(self);
|
45 |
+
}
|
46 |
+
|
47 |
+
/**
|
48 |
+
* Add new element into list.
|
49 |
+
*
|
50 |
+
* @param data
|
51 |
+
* @param at - Optional. Position where to insert
|
52 |
+
*/
|
53 |
+
function add(data, at) {
|
54 |
+
var options = {},
|
55 |
+
template = getTemplate();
|
56 |
+
if ($.isPlainObject(data)) {
|
57 |
+
options = $.extend({id: 0, text: ''}, data)
|
58 |
+
} else if (typeof data === 'string') {
|
59 |
+
options = {
|
60 |
+
id: '',
|
61 |
+
text: data
|
62 |
+
}
|
63 |
+
} else if (data[0] !== undefined) {
|
64 |
+
options = {
|
65 |
+
id: data[1] ? data[1] : '',
|
66 |
+
text: data[0]
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
// Replace placeholders with related variables
|
71 |
+
for (var prop in options) {
|
72 |
+
var reg = new RegExp('\{\{' + prop + '\}\}', 'g')
|
73 |
+
template = template.replace(reg, options[prop]);
|
74 |
+
}
|
75 |
+
|
76 |
+
template = $(template);
|
77 |
+
|
78 |
+
if (at !== undefined) {
|
79 |
+
var $e = $el.children(':eq(' + (at - 1) + ')');
|
80 |
+
if ($e.length) {
|
81 |
+
template.insertBefore($e);
|
82 |
+
} else {
|
83 |
+
$el.append(template)
|
84 |
+
}
|
85 |
+
} else {
|
86 |
+
$el.append(template)
|
87 |
+
}
|
88 |
+
|
89 |
+
// Append "\n" between li elements
|
90 |
+
var $child = $el.children().detach();
|
91 |
+
$child.each(function () {
|
92 |
+
$el.append("\n").append(this);
|
93 |
+
});
|
94 |
+
self.options.onAdd && self.options.onAdd.call(self);
|
95 |
+
}
|
96 |
+
|
97 |
+
function getTemplate() {
|
98 |
+
var $container = $(self.options.template);
|
99 |
+
if ($container.length) {
|
100 |
+
return $container.html();
|
101 |
+
}
|
102 |
+
return self.options.template;
|
103 |
+
}
|
104 |
+
|
105 |
+
$el.on('click', '.remove-item', _remove);
|
106 |
+
// export
|
107 |
+
this.add = add;
|
108 |
+
this.remove = remove;
|
109 |
+
}
|
110 |
+
|
111 |
+
// Export
|
112 |
+
$.fn.advancedList = function (options) {
|
113 |
+
var args = [];
|
114 |
+
for (var i = 1; i < arguments.length; i++) {
|
115 |
+
args.push(arguments[i]);
|
116 |
+
}
|
117 |
+
return $.each(this, function () {
|
118 |
+
var $advancedList = $(this).data('advancedList');
|
119 |
+
if (!$advancedList) {
|
120 |
+
$advancedList = new advancedList(this, options);
|
121 |
+
$(this).data('advancedList', $advancedList);
|
122 |
+
}
|
123 |
+
|
124 |
+
// Try to calling to methods of class
|
125 |
+
if (typeof options === 'string') {
|
126 |
+
if ($.isFunction($advancedList[options])) {
|
127 |
+
return $advancedList[options].apply($advancedList, args);
|
128 |
+
}
|
129 |
+
}
|
130 |
+
return this;
|
131 |
+
})
|
132 |
+
}
|
133 |
+
})(jQuery);
|
assets/js/admin/utils/_advertisement.js
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
function LP_Advertisement_Slider(el, options) {
|
3 |
+
this.options = $.extend({}, options || {});
|
4 |
+
var $el = $(el),
|
5 |
+
$items = $el.find('.slide-item'),
|
6 |
+
$controls = $('<div class="slider-controls"><div class="prev-item"></div><div class="next-item"></div></div>'),
|
7 |
+
$wrapItems = $('<div class="slider-items"></div>').append($items),
|
8 |
+
itemIndex = 0,
|
9 |
+
timer = null;
|
10 |
+
|
11 |
+
function init() {
|
12 |
+
createHTML();
|
13 |
+
bindEvents();
|
14 |
+
activeItem();
|
15 |
+
}
|
16 |
+
|
17 |
+
function createHTML() {
|
18 |
+
$el.append($wrapItems);
|
19 |
+
$items.each(function () {
|
20 |
+
$(this).append($controls.clone())
|
21 |
+
})
|
22 |
+
}
|
23 |
+
|
24 |
+
function activeItem(index) {
|
25 |
+
index = index !== undefined ? index : itemIndex;
|
26 |
+
var activeItem = $items.eq(index);
|
27 |
+
|
28 |
+
activeItem.show();
|
29 |
+
// A ha???
|
30 |
+
setTimeout(function () {
|
31 |
+
activeItem.addClass('slide-active');
|
32 |
+
}, 1);
|
33 |
+
|
34 |
+
activeItem.siblings().removeClass('slide-active');
|
35 |
+
|
36 |
+
timer && clearTimeout(timer);
|
37 |
+
timer = setTimeout(function () {
|
38 |
+
activeItem.siblings().hide();
|
39 |
+
}, 500)
|
40 |
+
}
|
41 |
+
|
42 |
+
function nextItem() {
|
43 |
+
if (itemIndex < $items.length - 1) {
|
44 |
+
itemIndex++;
|
45 |
+
} else {
|
46 |
+
itemIndex = 0;
|
47 |
+
}
|
48 |
+
activeItem(itemIndex);
|
49 |
+
}
|
50 |
+
|
51 |
+
function prevItem() {
|
52 |
+
if (itemIndex > 0) {
|
53 |
+
itemIndex--;
|
54 |
+
} else {
|
55 |
+
itemIndex = $items.length - 1;
|
56 |
+
}
|
57 |
+
activeItem(itemIndex);
|
58 |
+
}
|
59 |
+
|
60 |
+
function bindEvents() {
|
61 |
+
$el.on('click', '.next-item', nextItem);
|
62 |
+
$el.on('click', '.prev-item', prevItem);
|
63 |
+
}
|
64 |
+
|
65 |
+
init();
|
66 |
+
}
|
67 |
+
|
68 |
+
$.fn.LP_Advertisement_Slider = function (opts) {
|
69 |
+
return $.each(this, function () {
|
70 |
+
var $slider = $(this).data('LP_Advertisement_Slider');
|
71 |
+
if (!$slider) {
|
72 |
+
$slider = new LP_Advertisement_Slider(this, opts);
|
73 |
+
$(this).data('LP_Advertisement_Slider', $slider);
|
74 |
+
}
|
75 |
+
return this;
|
76 |
+
})
|
77 |
+
};
|
78 |
+
})(jQuery);
|
79 |
+
|
assets/js/admin/utils/_cookie.js
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
1 |
+
function login() {
|
2 |
+
alert();
|
3 |
+
}
|
assets/js/admin/utils/_dropdown-pages.js
ADDED
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
function dropdownPages(el, options) {
|
3 |
+
this.options = $.extend({
|
4 |
+
ID: '',
|
5 |
+
name: 'Add new page'
|
6 |
+
}, options || {});
|
7 |
+
var $element = $(el),
|
8 |
+
$select = $element.find('select'),
|
9 |
+
$listWrap = $element.find('.list-pages-wrapper'),
|
10 |
+
$actions = $element.find('.quick-add-page-actions'),
|
11 |
+
$form = $element.find('.quick-add-page-inline');
|
12 |
+
|
13 |
+
function addNewPageToList(args) {
|
14 |
+
var $new_option = $('<option value="' + args.ID + '">' + args.name + '</option>');
|
15 |
+
var position = $.inArray(args.ID + "", args.positions);
|
16 |
+
|
17 |
+
$('.learn-press-dropdown-pages select').each(function(){
|
18 |
+
var $sel = $(this),
|
19 |
+
$option = $new_option.clone();
|
20 |
+
if (position == 0) {
|
21 |
+
$('option', $sel).each(function () {
|
22 |
+
if (parseInt($(this).val())) {
|
23 |
+
$option.insertBefore($(this));
|
24 |
+
return false;
|
25 |
+
}
|
26 |
+
})
|
27 |
+
} else if (position == args.positions.length - 1) {
|
28 |
+
$sel.append($option);
|
29 |
+
} else {
|
30 |
+
$option.insertAfter($('option[value="' + args.positions[position - 1] + '"]', $sel));
|
31 |
+
}
|
32 |
+
});
|
33 |
+
}
|
34 |
+
|
35 |
+
$select.change(function () {
|
36 |
+
|
37 |
+
$actions.addClass('hide-if-js');
|
38 |
+
if (this.value !== 'add_new_page') {
|
39 |
+
if (parseInt(this.value)) {
|
40 |
+
$actions.find('a.edit-page').attr('href', 'post.php?post=' + this.value + '&action=edit');
|
41 |
+
$actions.find('a.view-page').attr('href', lpGlobalSettings.siteurl + '?page_id=' + this.value);
|
42 |
+
$actions.removeClass('hide-if-js');
|
43 |
+
$select.attr('data-selected', this.value);
|
44 |
+
}
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
$listWrap.addClass('hide-if-js');
|
48 |
+
$form.removeClass('hide-if-js').find('input').focus().val('');
|
49 |
+
});
|
50 |
+
|
51 |
+
// Select 2
|
52 |
+
$select
|
53 |
+
.css('width', $select.width() + 50)
|
54 |
+
.find('option').each(function () {
|
55 |
+
$(this).html($(this).html().replace(/ /g, ''));
|
56 |
+
});
|
57 |
+
|
58 |
+
$select.select2({
|
59 |
+
allowClear: true
|
60 |
+
});
|
61 |
+
|
62 |
+
$select.on('select2:select', function (e) {
|
63 |
+
var data = e.params.data;
|
64 |
+
});
|
65 |
+
|
66 |
+
$element.on('click', '.quick-add-page-inline button', function () {
|
67 |
+
var $button = $(this),
|
68 |
+
$input = $form.find('input'),
|
69 |
+
page_name = $input.val();
|
70 |
+
if (!page_name) {
|
71 |
+
alert('Please enter the name of page');
|
72 |
+
$input.focus();
|
73 |
+
return;
|
74 |
+
}
|
75 |
+
$button.prop('disabled', true);
|
76 |
+
$.ajax({
|
77 |
+
url: lpGlobalSettings.ajax,
|
78 |
+
data: {
|
79 |
+
action: 'learnpress_create_page',
|
80 |
+
page_name: page_name
|
81 |
+
},
|
82 |
+
type: 'post',
|
83 |
+
dataType: 'html',
|
84 |
+
success: function (response) {
|
85 |
+
response = LP.parseJSON(response);
|
86 |
+
if (response.page) {
|
87 |
+
addNewPageToList({
|
88 |
+
ID: response.page.ID,
|
89 |
+
name: response.page.post_title,
|
90 |
+
positions: response.positions
|
91 |
+
});
|
92 |
+
$select.val(response.page.ID).focus().trigger('change');
|
93 |
+
$form.addClass('hide-if-js');
|
94 |
+
} else if (response.error) {
|
95 |
+
alert(response.error);
|
96 |
+
}
|
97 |
+
$button.prop('disabled', false);
|
98 |
+
$listWrap.removeClass('hide-if-js');
|
99 |
+
}
|
100 |
+
});
|
101 |
+
}).on('click', '.quick-add-page-inline a', function (e) {
|
102 |
+
e.preventDefault();
|
103 |
+
$form.addClass('hide-if-js');
|
104 |
+
$select.val($select.attr('data-selected') + '').removeAttr('disabled').trigger('change');
|
105 |
+
$listWrap.removeClass('hide-if-js');
|
106 |
+
}).on('click', '.button-quick-add-page', function (e) {
|
107 |
+
$select.val('add_new_page').trigger('change');
|
108 |
+
}).on('keypress keydown', '.quick-add-page-inline input[type="text"]', function (e) {
|
109 |
+
if (e.keyCode == 13 && e.type == 'keypress') {
|
110 |
+
e.preventDefault();
|
111 |
+
$(this).siblings('button').trigger('click')
|
112 |
+
} else if (e.keyCode == 27 && e.type == 'keydown') {
|
113 |
+
$(this).siblings('a').trigger('click')
|
114 |
+
}
|
115 |
+
})
|
116 |
+
}
|
117 |
+
|
118 |
+
$.fn.dropdownPages = function () {
|
119 |
+
return $.each(this, function () {
|
120 |
+
var $instance = $(this).data('dropdownPages');
|
121 |
+
if (!$instance) {
|
122 |
+
$instance = new dropdownPages(this, {});
|
123 |
+
$(this).data('dropdownPages', $instance);
|
124 |
+
}
|
125 |
+
return $instance;
|
126 |
+
})
|
127 |
+
}
|
128 |
+
})(jQuery);
|
129 |
+
|
130 |
+
|
assets/js/admin/utils/_search-items.js
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
var timer = null,
|
3 |
+
$wraps = null,
|
4 |
+
$cloneWraps = null,
|
5 |
+
onSearch = function (keyword) {
|
6 |
+
if (!$cloneWraps) {
|
7 |
+
$cloneWraps = $wraps.clone();
|
8 |
+
}
|
9 |
+
keywords = keyword.toLowerCase().split(/\s+/).filter(function (a, b) {
|
10 |
+
return a.length >= 3;
|
11 |
+
});
|
12 |
+
var foundItems = function ($w1, $w2) {
|
13 |
+
return $w1.find('.plugin-card').each(function () {
|
14 |
+
var $item = $(this),
|
15 |
+
itemText = $item.find('.item-title').text().toLowerCase(),
|
16 |
+
itemDesc = $item.find('.column-description, .theme-description').text();
|
17 |
+
var found = function () {
|
18 |
+
var reg = new RegExp(keywords.join('|'), 'ig');
|
19 |
+
return itemText.match(reg) || itemDesc.match(reg)
|
20 |
+
}
|
21 |
+
if (keywords.length) {
|
22 |
+
if (found()) {
|
23 |
+
var $clone = $item.clone();
|
24 |
+
$w2.append($clone);
|
25 |
+
}
|
26 |
+
} else {
|
27 |
+
$w2.append($item.clone());
|
28 |
+
}
|
29 |
+
});
|
30 |
+
}
|
31 |
+
|
32 |
+
$wraps.each(function (i) {
|
33 |
+
var $this = $(this).html(''),
|
34 |
+
$items = foundItems($cloneWraps.eq(i), $this),
|
35 |
+
count = $this.children().length;
|
36 |
+
|
37 |
+
$this.prev('h2').find('span').html(count)
|
38 |
+
});
|
39 |
+
};
|
40 |
+
$(document).on('keyup', '.lp-search-addon', function (e) {
|
41 |
+
timer && clearTimeout(timer);
|
42 |
+
timer = setTimeout(onSearch, 300, e.target.value);
|
43 |
+
}).ready(function () {
|
44 |
+
$wraps = $('.addons-browse');
|
45 |
+
})
|
46 |
+
})(jQuery);
|
assets/js/frontend/quiz.bak.js
ADDED
@@ -0,0 +1,915 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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this.destroy = function () {
|
8 |
+
this.model.questions.forEach(function (m) {
|
9 |
+
try {
|
10 |
+
m instanceof Model_Question ? (
|
11 |
+
// prevent trigger 'sync' action
|
12 |
+
m.set('id', null),
|
13 |
+
m.destroy()
|
14 |
+
) : false;
|
15 |
+
} catch (ex) {
|
16 |
+
console.log(ex);
|
17 |
+
}
|
18 |
+
});
|
19 |
+
this.model.set('id', null);
|
20 |
+
this.model.destroy();
|
21 |
+
this.view.destroy();
|
22 |
+
this.view.undelegateEvents();
|
23 |
+
};
|
24 |
+
}, Model_Question, List_Questions, windowTarget = parent.window || window;
|
25 |
+
|
26 |
+
Quiz.Model_Question = Model_Question = Backbone.Model.extend({
|
27 |
+
defaults: {
|
28 |
+
//question_id: 0
|
29 |
+
},
|
30 |
+
data: null,
|
31 |
+
view: false,
|
32 |
+
url: function () {
|
33 |
+
return this.urlRoot;
|
34 |
+
},
|
35 |
+
urlRoot: function () {
|
36 |
+
return 'abc';
|
37 |
+
},
|
38 |
+
initialize: function () {
|
39 |
+
},
|
40 |
+
element: function () {
|
41 |
+
return $(this.get('content'));
|
42 |
+
},
|
43 |
+
submit: function (args) {
|
44 |
+
var that = this;
|
45 |
+
args = $.extend({
|
46 |
+
complete: null,
|
47 |
+
data: {}
|
48 |
+
}, args || {});
|
49 |
+
this.fetch({
|
50 |
+
data: $.extend({
|
51 |
+
action: 'learnpress_load_quiz_question',
|
52 |
+
user_id: this.get('user_id'),
|
53 |
+
quiz_id: this.get('quiz_id'),
|
54 |
+
question_id: this.get('id')
|
55 |
+
}, args.data || {}),
|
56 |
+
complete: (function (e) {
|
57 |
+
var response = LP.parseJSON(e.responseText);
|
58 |
+
if (response.result == 'success') {
|
59 |
+
//if (!that.get('content')) {
|
60 |
+
that.set(response.question);
|
61 |
+
if (response.permalink) {
|
62 |
+
LP.setUrl(response.permalink);
|
63 |
+
}
|
64 |
+
//}
|
65 |
+
$.isFunction(args.complete) && args.complete.call(that, response);
|
66 |
+
}
|
67 |
+
})
|
68 |
+
});
|
69 |
+
},
|
70 |
+
check: function (args) {
|
71 |
+
var that = this;
|
72 |
+
if ($.isFunction(args)) {
|
73 |
+
args = {
|
74 |
+
complete: args
|
75 |
+
}
|
76 |
+
} else {
|
77 |
+
args = $.extend({
|
78 |
+
complete: null,
|
79 |
+
data: {}
|
80 |
+
}, args || {});
|
81 |
+
}
|
82 |
+
LP.doAjax({
|
83 |
+
data: $.extend({
|
84 |
+
'lp-ajax': 'check-question',
|
85 |
+
question_id: this.get('id')
|
86 |
+
//question_answer: $('form#learn-press-quiz-question').serializeJSON()
|
87 |
+
}, args.data || {}),
|
88 |
+
dataType: 'html',
|
89 |
+
success: function (response, raw) {
|
90 |
+
var $content = that.get('response');
|
91 |
+
if ($content) {
|
92 |
+
$content.find('.learn-press-question-options').replaceWith($(response).filter('.learn-press-question-options'));
|
93 |
+
}
|
94 |
+
that.set({checked: 'yes', response: $content});
|
95 |
+
$.isFunction(args.complete) && args.complete.call(that, response);
|
96 |
+
}
|
97 |
+
});
|
98 |
+
},
|
99 |
+
showHint: function (args) {
|
100 |
+
var that = this;
|
101 |
+
LP.doAjax({
|
102 |
+
data: $.extend({
|
103 |
+
'lp-ajax': 'get-question-hint',
|
104 |
+
user_id: this.get('user_id'),
|
105 |
+
quiz_id: this.get('quiz_id'),
|
106 |
+
question_id: this.get('id'),
|
107 |
+
question_answer: $('form#learn-press-quiz-question').serializeJSON()
|
108 |
+
}, args.data || {}),
|
109 |
+
success: function (response, raw) {
|
110 |
+
that.set('checked', response.checked);
|
111 |
+
$.isFunction(args.complete) && args.complete.call(that, response);
|
112 |
+
}
|
113 |
+
});
|
114 |
+
}
|
115 |
+
});
|
116 |
+
/**
|
117 |
+
* List Questions
|
118 |
+
*/
|
119 |
+
Quiz.List_Questions = List_Questions = Backbone.Collection.extend({
|
120 |
+
url: 'admin-ajax.php',
|
121 |
+
urlRoot: function () {
|
122 |
+
return '';
|
123 |
+
},
|
124 |
+
len: 0,
|
125 |
+
model: Model_Question,
|
126 |
+
initialize: function () {
|
127 |
+
this.on('add', function (model) {
|
128 |
+
this.listenTo(model, 'change', this.onChange);
|
129 |
+
this.listenTo(model, 'change:hasShowedHint', this.onChangedHint);
|
130 |
+
this.listenTo(model, 'change:checked', function (a) {
|
131 |
+
if (a.changed['checked'] && a.changed['checked'] === 'yes') {
|
132 |
+
var $dom = a.get('response');
|
133 |
+
if ($dom) $dom.find('.button-check-answer').attr('disabled', true);
|
134 |
+
}
|
135 |
+
}, this);
|
136 |
+
model.set('index', this.len++);
|
137 |
+
}, this);
|
138 |
+
this.on('change:view', function () {
|
139 |
+
this.questions.view = this.get('view');
|
140 |
+
});
|
141 |
+
|
142 |
+
},
|
143 |
+
onChangedHint: function (a, b) {
|
144 |
+
|
145 |
+
},
|
146 |
+
onChange: function (a, b) {
|
147 |
+
|
148 |
+
if (a.changed['current']) {
|
149 |
+
if (a.get('current') !== 'yes') {
|
150 |
+
|
151 |
+
} else {
|
152 |
+
this.current = a;
|
153 |
+
for (var i = 0; i < this.length; i++) {
|
154 |
+
var e = this.at(i);
|
155 |
+
if (e.get('id') == a.get('id')) {
|
156 |
+
$('.question-' + e.get('id')).toggleClass('current', true);
|
157 |
+
continue;
|
158 |
+
}
|
159 |
+
if (e.get('current') != 'yes') {
|
160 |
+
continue;
|
161 |
+
}
|
162 |
+
this.stopListening(e, 'change', this.onChange);
|
163 |
+
e.set('current', 'no');
|
164 |
+
this.listenTo(e, 'change', this.onChange);
|
165 |
+
$('.question-' + e.get('id')).toggleClass('current', false)
|
166 |
+
}
|
167 |
+
try {
|
168 |
+
this.view.updateUrl();
|
169 |
+
} catch (e) {
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
}
|
174 |
+
});
|
175 |
+
|
176 |
+
Quiz.Model = Backbone.Model.extend({
|
177 |
+
_args: null,
|
178 |
+
questions: null,
|
179 |
+
initialize: function (args) {
|
180 |
+
_.bindAll(this, 'getQuizData');
|
181 |
+
this._args = args || {};
|
182 |
+
this.on('change:view', function () {
|
183 |
+
this.questions.view = this.get('view');
|
184 |
+
});
|
185 |
+
this._initQuestions();
|
186 |
+
this.set('remainingTime', args.totalTime - args.userTime);
|
187 |
+
LP.Hook.addFilter('learn_press_finish_quiz_data', this.getQuizData);
|
188 |
+
|
189 |
+
this.prepareQuestion({delayTime: this.delayTime})
|
190 |
+
},
|
191 |
+
_initQuestions: function () {
|
192 |
+
this.questions = new List_Questions();
|
193 |
+
_.forEach(this._args.questions, function (q) {
|
194 |
+
this.questions.add(q);
|
195 |
+
}, this);
|
196 |
+
if (this.questions.length && !this.current()) {
|
197 |
+
this.questions.at(0).set('current', 'yes');
|
198 |
+
}
|
199 |
+
},
|
200 |
+
_secondsToDHMS: function (t) {
|
201 |
+
var d = Math.floor(t / (24 * 3600)), t = t - d * 24 * 3600, h = Math.floor(t / 3600), t = t - h * 3600,
|
202 |
+
m = Math.floor(t / 60), s = Math.floor(t - m * 60);
|
203 |
+
return {d: d, h: h, m: m, s: s}
|
204 |
+
},
|
205 |
+
getRemainingTime: function (format) {
|
206 |
+
var t = this.get('remainingTime');
|
207 |
+
if (format == 'dhms') {
|
208 |
+
t = this._secondsToDHMS(t);
|
209 |
+
}
|
210 |
+
return t;
|
211 |
+
},
|
212 |
+
getTotalTime: function (format) {
|
213 |
+
var t = this.get('totalTime');
|
214 |
+
if (format == 'dhms') {
|
215 |
+
t = this._secondsToDHMS(t);
|
216 |
+
}
|
217 |
+
return t;
|
218 |
+
},
|
219 |
+
getUserTime: function (format) {
|
220 |
+
var t = this.get('userTime');
|
221 |
+
if (format == 'dhms') {
|
222 |
+
t = this._secondsToDHMS(t);
|
223 |
+
}
|
224 |
+
return t;
|
225 |
+
},
|
226 |
+
inc: function (seconds) {
|
227 |
+
var userTime = this.get('userTime') + (seconds || 1);
|
228 |
+
var t = {
|
229 |
+
userTime: userTime,
|
230 |
+
remainingTime: Math.max(this.get('totalTime') - userTime, 0)
|
231 |
+
};
|
232 |
+
this.set(t);
|
233 |
+
return t;
|
234 |
+
},
|
235 |
+
decr: function (seconds) {
|
236 |
+
var userTime = this.get('userTime') - (seconds || 1);
|
237 |
+
var t = {
|
238 |
+
userTime: userTime,
|
239 |
+
remainingTime: Math.max(this.get('totalTime') - userTime, 0)
|
240 |
+
};
|
241 |
+
this.set(t);
|
242 |
+
return t;
|
243 |
+
},
|
244 |
+
fetchCurrent: function (callback) {
|
245 |
+
var current = this.getCurrent(),
|
246 |
+
that = this;
|
247 |
+
if (!current) {
|
248 |
+
return;
|
249 |
+
}
|
250 |
+
LP.Hook.doAction('learn_press_before_fetch_question', current.get('id'), that);
|
251 |
+
$.ajax({
|
252 |
+
url: current.get('url'),
|
253 |
+
dataType: 'html',
|
254 |
+
success: function (response) {
|
255 |
+
that.set('response', response);
|
256 |
+
$.isFunction(callback) && callback(response, that);
|
257 |
+
}
|
258 |
+
});
|
259 |
+
},
|
260 |
+
next: function (callback, args) {
|
261 |
+
var next = this.findNext(),
|
262 |
+
that = this,
|
263 |
+
id = 0;
|
264 |
+
if (!next) {
|
265 |
+
return;
|
266 |
+
}
|
267 |
+
id = parseInt(next.get('id'));
|
268 |
+
LP.Hook.doAction('learn_press_before_next_question', id, that);
|
269 |
+
this.select(id, function (args) {
|
270 |
+
LP.Hook.doAction('learn_press_previous_question', id, that);
|
271 |
+
callback && callback.apply(null, arguments);
|
272 |
+
}, args);
|
273 |
+
},
|
274 |
+
prev: function (callback, args) {
|
275 |
+
var prev = this.findPrev(),
|
276 |
+
that = this,
|
277 |
+
id = 0;
|
278 |
+
if (!prev) {
|
279 |
+
return;
|
280 |
+
}
|
281 |
+
id = prev.get('id');
|
282 |
+
LP.Hook.doAction('learn_press_before_previous_question', id, that);
|
283 |
+
this.select(id, function () {
|
284 |
+
LP.Hook.doAction('learn_press_previous_question', id, that);
|
285 |
+
callback && callback.apply(null, arguments);
|
286 |
+
}, args);
|
287 |
+
},
|
288 |
+
select: function (id, callback, args) {
|
289 |
+
var question = this.questions.findWhere({id: parseInt(id)}),
|
290 |
+
that = this,
|
291 |
+
loadedCallback = function () {
|
292 |
+
$.isFunction(callback) && callback(question, that);
|
293 |
+
LP.Hook.doAction('learn_press_select_question', question, that);
|
294 |
+
};
|
295 |
+
if (!question) {
|
296 |
+
return;
|
297 |
+
}
|
298 |
+
if (question.get('current') === 'yes') {
|
299 |
+
windowTarget.LP.unblockContent();
|
300 |
+
return;
|
301 |
+
}
|
302 |
+
LP.Hook.doAction('learn_press_before_select_question', question, that);
|
303 |
+
question.set('current', 'yes');
|
304 |
+
if (question.get('response')) {
|
305 |
+
loadedCallback();
|
306 |
+
$.ajax({
|
307 |
+
url: question.get('url'),
|
308 |
+
data: $.extend({
|
309 |
+
id: question.get('id'),
|
310 |
+
'lp-ajax': 'fetch-question',
|
311 |
+
'lp-update-current-question': true
|
312 |
+
}, args || {}),
|
313 |
+
dataType: 'html'
|
314 |
+
});
|
315 |
+
} else {
|
316 |
+
$.ajax({
|
317 |
+
url: question.get('url'),
|
318 |
+
data: $.extend({
|
319 |
+
id: question.get('id'),
|
320 |
+
data: $('form[name="quiz-question-content"]').serialize(),
|
321 |
+
'lp-ajax': 'fetch-question'
|
322 |
+
}, args || {}),
|
323 |
+
dataType: 'html',
|
324 |
+
success: function (response) {
|
325 |
+
var $html = $(response).contents().find('.learn-press-content-item-summary');
|
326 |
+
question.set('response', $html);
|
327 |
+
loadedCallback();
|
328 |
+
}
|
329 |
+
});
|
330 |
+
}
|
331 |
+
|
332 |
+
/* Prepare next question & prev question */
|
333 |
+
this.prepareQuestion(args)
|
334 |
+
},
|
335 |
+
prepareQuestion: function (args) {
|
336 |
+
|
337 |
+
var next = this.findNext(),
|
338 |
+
prev = this.findPrev();
|
339 |
+
|
340 |
+
if (next) {
|
341 |
+
this.prepareResponse(parseInt(next.get('id')), args);
|
342 |
+
}
|
343 |
+
if (prev) {
|
344 |
+
this.prepareResponse(parseInt(prev.get('id')), args);
|
345 |
+
}
|
346 |
+
},
|
347 |
+
prepareResponse: function (id, args) {
|
348 |
+
|
349 |
+
var question = this.questions.findWhere({id: parseInt(id)}),
|
350 |
+
currentQuestion = this.current();
|
351 |
+
|
352 |
+
if (question.get('response')) {
|
353 |
+
return;
|
354 |
+
}
|
355 |
+
|
356 |
+
$.ajax({
|
357 |
+
url: question.get('url'),
|
358 |
+
data: $.extend({
|
359 |
+
id: question.get('id'),
|
360 |
+
data: $('form[name="quiz-question-content"]').serialize(),
|
361 |
+
'lp-ajax': 'fetch-question',
|
362 |
+
'lp-current-question': currentQuestion.get('id')
|
363 |
+
|
364 |
+
}, args || {}),
|
365 |
+
dataType: 'html',
|
366 |
+
success: function (response) {
|
367 |
+
var $html = $(response).contents().find('.learn-press-content-item-summary');
|
368 |
+
question.set('response', $html);
|
369 |
+
}
|
370 |
+
});
|
371 |
+
},
|
372 |
+
getQuestionPosition: function (question_id) {
|
373 |
+
question_id = question_id || this.get('question_id');
|
374 |
+
return _.indexOf(this.getIds(), question_id);
|
375 |
+
},
|
376 |
+
countQuestions: function () {
|
377 |
+
return this.questions.length;
|
378 |
+
},
|
379 |
+
isLast: function (question_id) {
|
380 |
+
question_id = question_id || this.getCurrent('id');
|
381 |
+
var q = this.questions.findWhere({id: parseInt(question_id)});
|
382 |
+
return q ? q.get('index') == this.questions.length - 1 : false;
|
383 |
+
},
|
384 |
+
isFirst: function (question_id) {
|
385 |
+
question_id = question_id || this.getCurrent('id');
|
386 |
+
var q = this.questions.findWhere({id: parseInt(question_id)});
|
387 |
+
return q ? q.get('index') == 0 : false;
|
388 |
+
},
|
389 |
+
findNext: function (question_id) {
|
390 |
+
question_id = question_id || this.getCurrent('id');
|
391 |
+
var q = this.questions.findWhere({id: parseInt(question_id)}),
|
392 |
+
next = false;
|
393 |
+
if (q) {
|
394 |
+
var index = q.get('index');
|
395 |
+
next = this.questions.at(index + 1);
|
396 |
+
}
|
397 |
+
return next;
|
398 |
+
},
|
399 |
+
findPrev: function (question_id) {
|
400 |
+
question_id = question_id || this.getCurrent('id');
|
401 |
+
var q = this.questions.findWhere({id: parseInt(question_id)}),
|
402 |
+
prev = false;
|
403 |
+
if (q) {
|
404 |
+
var index = q.get('index');
|
405 |
+
prev = this.questions.at(index - 1);
|
406 |
+
}
|
407 |
+
return prev;
|
408 |
+
},
|
409 |
+
getCurrent: function (_field, _default) {
|
410 |
+
var current = this.current(),
|
411 |
+
r = _default;
|
412 |
+
if (current) {
|
413 |
+
r = current.get(_field);
|
414 |
+
}
|
415 |
+
return r;
|
416 |
+
},
|
417 |
+
current: function (create) {
|
418 |
+
var current = this.questions.findWhere({current: 'yes'});
|
419 |
+
if (!current && create) {
|
420 |
+
current = new Model_Question();
|
421 |
+
}
|
422 |
+
return current;
|
423 |
+
},
|
424 |
+
getIds: function () {
|
425 |
+
return $.map(this.get('questions'), function (i, v) {
|
426 |
+
return parseInt(i.id);
|
427 |
+
});
|
428 |
+
},
|
429 |
+
showHint: function (callback, args) {
|
430 |
+
this.current().showHint({
|
431 |
+
complete: callback,
|
432 |
+
data: this.getRequestParams(args)
|
433 |
+
});
|
434 |
+
},
|
435 |
+
checkAnswer: function (callback, args) {
|
436 |
+
if (!args) {
|
437 |
+
args = {};
|
438 |
+
}
|
439 |
+
args.question_answer = this.getQuestionAnswerData(this.current());
|
440 |
+
this.current().check({
|
441 |
+
complete: callback,
|
442 |
+
data: this.getRequestParams(args)
|
443 |
+
});
|
444 |
+
},
|
445 |
+
getRequestParams: function (args) {
|
446 |
+
var defaults = LP.Hook.applyFilters('learn_press_request_quiz_params', {
|
447 |
+
quiz_id: this.get('id'),
|
448 |
+
user_id: this.get('user_id'),
|
449 |
+
course_id: this.get('courseId')
|
450 |
+
});
|
451 |
+
|
452 |
+
return $.extend(defaults, args || {});
|
453 |
+
},
|
454 |
+
getQuestion: function (thing) {
|
455 |
+
var question = false;
|
456 |
+
if ($.isNumeric(thing)) {
|
457 |
+
question = this.questions.findWhere({id: parseInt(thing)});
|
458 |
+
} else if ($.isPlainObject(thing)) {
|
459 |
+
question = this.questions.findWhere(thing);
|
460 |
+
} else if ($.type(thing) == 'undefined' || $.type(thing) == null) {
|
461 |
+
question = this.current();
|
462 |
+
} else if (thing instanceof Model_Question) {
|
463 |
+
question = thing;
|
464 |
+
}
|
465 |
+
return question;
|
466 |
+
},
|
467 |
+
getQuizData: function (data) {
|
468 |
+
data.answers = {};
|
469 |
+
this.questions.forEach(function (model) {
|
470 |
+
data.answers[model.get('id')] = this.getQuestionAnswerData(model);
|
471 |
+
}, this);
|
472 |
+
return data;
|
473 |
+
},
|
474 |
+
getQuestionAnswerData: function (question) {
|
475 |
+
question = this.getQuestion(question);
|
476 |
+
if (!question) {
|
477 |
+
return undefined;
|
478 |
+
}
|
479 |
+
var $html = question.get('response'),
|
480 |
+
answer = {},
|
481 |
+
$form = $('<form />');
|
482 |
+
if ($html) {
|
483 |
+
var $content = $html.find('.quiz-question-content');
|
484 |
+
$form.html($content.clone());
|
485 |
+
answer = $form.serializeJSON();
|
486 |
+
}
|
487 |
+
return LP.Hook.applyFilters('learn_press_question_answer_data', answer, $form, question, this);
|
488 |
+
}
|
489 |
+
});
|
490 |
+
Quiz.View = Backbone.View.extend({
|
491 |
+
el: function () {
|
492 |
+
return 'body';
|
493 |
+
},
|
494 |
+
events: {
|
495 |
+
'click .button-prev-question': '_prevQuestion',
|
496 |
+
'click .button-next-question': '_nextQuestion',
|
497 |
+
'click .button-hint': '_showHint',
|
498 |
+
'click .button-check-answer': '_checkAnswer',
|
499 |
+
'click .quiz-questions-list .question-title': '_selectQuestion',
|
500 |
+
'click .button-start-quiz': '_startQuiz',
|
501 |
+
'click .button-finish-quiz': '_finishQuiz',
|
502 |
+
'click .button-retake-quiz': '_retakeQuiz',
|
503 |
+
'click .button-complete-item': '_completeItem',
|
504 |
+
'click #lp-navigation .nav-link a': '_click_nav_link'
|
505 |
+
},
|
506 |
+
timeout: 0,
|
507 |
+
delayTimeout: 0,
|
508 |
+
delayTime: 0,
|
509 |
+
localized: null,
|
510 |
+
initialize: function () {
|
511 |
+
_.bindAll(this, 'pause', '_onTick', 'itemUrl', '_loadQuestionCompleted', '_checkAnswerCompleted', '_checkAnswer', '_onDestroy', 'destroy');
|
512 |
+
LP.Hook.addAction('learn_press_before_finish_quiz', this.destroy);
|
513 |
+
LP.Hook.addFilter('learn_press_get_current_item_url', this.itemUrl);
|
514 |
+
this.model.current(true).set('response', this.$('.learn-press-content-item-summary'));
|
515 |
+
this.model.set('view', this);
|
516 |
+
this.model.on('destroy', this._onDestroy);
|
517 |
+
this._initCountDown();
|
518 |
+
this.updateButtons();
|
519 |
+
this.windowTarget = windowTarget;
|
520 |
+
this.localized = window.learn_press_single_course_localize || {};
|
521 |
+
$(document).ready(function () {
|
522 |
+
$(window).trigger('load');
|
523 |
+
$(document).trigger('resize');
|
524 |
+
});
|
525 |
+
},
|
526 |
+
_initCountDown: function () {
|
527 |
+
if (this.model.get('status') != 'started' || this.model.get('totalTime') <= 0) {
|
528 |
+
return;
|
529 |
+
}
|
530 |
+
this.updateCountdown();
|
531 |
+
setTimeout($.proxy(function () {
|
532 |
+
this.$('.quiz-countdown').removeClass('hide-if-js');
|
533 |
+
this.start();
|
534 |
+
}, this), 500);
|
535 |
+
},
|
536 |
+
_addLeadingZero: function (n) {
|
537 |
+
return n < 10 ? "0" + n : "" + n;
|
538 |
+
},
|
539 |
+
_onDestroy: function () {
|
540 |
+
this.pause();
|
541 |
+
},
|
542 |
+
_onTick: function () {
|
543 |
+
this.timeout && clearTimeout(this.timeout);
|
544 |
+
var timer = this.model.inc();
|
545 |
+
this.updateCountdown();
|
546 |
+
|
547 |
+
if (timer.remainingTime == 0) {
|
548 |
+
LP.Hook.doAction('learn_press_quiz_timeout', this);
|
549 |
+
this.$('.button-finish-quiz').trigger('click');
|
550 |
+
return;
|
551 |
+
}
|
552 |
+
this.timeout = setTimeout(this._onTick, 1000);
|
553 |
+
},
|
554 |
+
|
555 |
+
_prevQuestion: function (e) {
|
556 |
+
e.preventDefault();
|
557 |
+
var delayTime = this.delayTime;
|
558 |
+
this._beforeFetchQuestion();
|
559 |
+
this.model.prev(this._loadQuestionCompleted, {delayTime: delayTime});
|
560 |
+
},
|
561 |
+
_nextQuestion: function (e) {
|
562 |
+
e.preventDefault();
|
563 |
+
var delayTime = this.delayTime;
|
564 |
+
this._beforeFetchQuestion();
|
565 |
+
this.model.next(this._loadQuestionCompleted, {delayTime: delayTime});
|
566 |
+
|
567 |
+
},
|
568 |
+
_selectQuestion: function (e) {
|
569 |
+
e.preventDefault();
|
570 |
+
if (this.model.get('status') == 'started') {
|
571 |
+
var id = $(e.target).closest('li').attr('data-id'),
|
572 |
+
delayTime = this.delayTime;
|
573 |
+
if (this.model.current().get('id') == id) {
|
574 |
+
return;
|
575 |
+
}
|
576 |
+
this._beforeFetchQuestion();
|
577 |
+
this.model.select(id, this._loadQuestionCompleted, {delayTime: delayTime});
|
578 |
+
}
|
579 |
+
},
|
580 |
+
_beforeFetchQuestion: function () {
|
581 |
+
windowTarget.LP.blockContent();
|
582 |
+
this.pause();
|
583 |
+
this.incrDelay(true);
|
584 |
+
this.model.current(true).set('response', this.$('.learn-press-content-item-summary'));
|
585 |
+
},
|
586 |
+
_loadQuestionCompleted: function (question, model) {
|
587 |
+
var loaded = model.get('loaded'),
|
588 |
+
$newElement = question.get('response'),
|
589 |
+
$oldElement = this.$('.learn-press-content-item-summary');
|
590 |
+
$newElement.show().insertAfter($oldElement);
|
591 |
+
$oldElement.detach();
|
592 |
+
if (this.model.get('show-list')) {
|
593 |
+
$newElement.find('.lp-group-heading-title').addClass('active');
|
594 |
+
$newElement.find('.lp-group-content-wrap').removeClass('hide-if-js');
|
595 |
+
}
|
596 |
+
this.updateButtons();
|
597 |
+
if (model.getCurrent('hasShowedHint') === 'yes') {
|
598 |
+
this.$('.button-hint').attr('disabled', true);
|
599 |
+
this.$('.question-hint-content').removeClass('hide-if-js');
|
600 |
+
} else {
|
601 |
+
this.$('.button-hint').attr('disabled', false);
|
602 |
+
this.$('.question-hint-content').addClass('hide-if-js');
|
603 |
+
}
|
604 |
+
this.start();
|
605 |
+
$(window).trigger('load');
|
606 |
+
$(document).trigger('resize');
|
607 |
+
windowTarget.LP.setUrl(question.get('url'));
|
608 |
+
windowTarget.LP.unblockContent();
|
609 |
+
},
|
610 |
+
_showHint: function (e) {
|
611 |
+
e.preventDefault();
|
612 |
+
this.model.current().set('hasShowedHint', 'yes');
|
613 |
+
this.$('.button-hint').attr('disabled', true);
|
614 |
+
this.$('.learn-press-question-hint').removeClass('hide-if-js');
|
615 |
+
},
|
616 |
+
_showHintCompleted: function (response) {
|
617 |
+
windowTarget.LP.unblockContent();
|
618 |
+
},
|
619 |
+
_checkAnswer: function (e) {
|
620 |
+
e.preventDefault();
|
621 |
+
var that = this,
|
622 |
+
$button = $(e.target),
|
623 |
+
security = $button.data('security');
|
624 |
+
windowTarget.LP.blockContent();
|
625 |
+
this.pause();
|
626 |
+
this.model.checkAnswer(this._checkAnswerCompleted, $button.data());
|
627 |
+
},
|
628 |
+
_checkAnswerCompleted: function (question) {
|
629 |
+
this.start();
|
630 |
+
this.$('.button-check-answer, .button-hint').hide();
|
631 |
+
windowTarget.LP.unblockContent();
|
632 |
+
},
|
633 |
+
updateButtons: function () {
|
634 |
+
if (this.model.get('status') === 'started') {
|
635 |
+
this.$('.button-prev-question').toggleClass('hide-if-js', this.model.isFirst());
|
636 |
+
this.$('.button-next-question').toggleClass('hide-if-js', this.model.isLast());
|
637 |
+
var current = this.model.current();
|
638 |
+
if (current) {
|
639 |
+
this.$('.button-check-answer').toggleClass('hide-if-js', current.get('hasCheckAnswer') !== 'yes');
|
640 |
+
this.$('.button-hint').toggleClass('hide-if-js', current.get('hasHint') !== 'yes');
|
641 |
+
}
|
642 |
+
}
|
643 |
+
},
|
644 |
+
start: function () {
|
645 |
+
if (this.model.get('status') != 'started' || this.model.get('totalTime') <= 0) {
|
646 |
+
return;
|
647 |
+
}
|
648 |
+
this.delayTimeout && clearTimeout(this.delayTimeout);
|
649 |
+
this._onTick();
|
650 |
+
},
|
651 |
+
pause: function () {
|
652 |
+
this.timeout && clearTimeout(this.timeout);
|
653 |
+
},
|
654 |
+
incrDelay: function (t) {
|
655 |
+
if (t) {
|
656 |
+
this.delayTime = 0;
|
657 |
+
}
|
658 |
+
this.delayTimeout && clearTimeout(this.delayTimeout);
|
659 |
+
this.delayTime++;
|
660 |
+
this.delayTimeout = setTimeout($.proxy(function () {
|
661 |
+
this.incrDelay();
|
662 |
+
}, this), 990);
|
663 |
+
},
|
664 |
+
updateCountdown: function () {
|
665 |
+
var totalTime = this.model.getTotalTime('dhms'),
|
666 |
+
remainingTime = this.model.getRemainingTime('dhms'),
|
667 |
+
strTime = [];
|
668 |
+
if (totalTime.d) {
|
669 |
+
strTime.push(this._addLeadingZero(remainingTime.d));
|
670 |
+
}
|
671 |
+
if (totalTime.h) {
|
672 |
+
strTime.push(this._addLeadingZero(remainingTime.h));
|
673 |
+
}
|
674 |
+
strTime.push(this._addLeadingZero(remainingTime.m));
|
675 |
+
strTime.push(this._addLeadingZero(remainingTime.s));
|
676 |
+
var t = parseInt(this.model.get('remainingTime') / this.model.get('totalTime') * 100);// * 360;
|
677 |
+
this.$('.quiz-countdown').attr('data-value', t).attr('data-' + this.model.get('id'), 100).toggleClass('warning-time-over', t < 10).find('.countdown').html(strTime.join(':'));
|
678 |
+
},
|
679 |
+
itemUrl: function (url, item) {
|
680 |
+
if (item.get('id') == this.model.get('id')) {
|
681 |
+
var questionName = this.model.getCurrent('name'), reg;
|
682 |
+
if (questionName && this.model.get('status') !== 'completed') {
|
683 |
+
reg = new RegExp('!' + questionName + '/?$!', '');
|
684 |
+
if (!url.match(reg)) {
|
685 |
+
url = url.replace(/\/$/, '') + '/' + questionName + '/';
|
686 |
+
}
|
687 |
+
}
|
688 |
+
|
689 |
+
}
|
690 |
+
return url;
|
691 |
+
},
|
692 |
+
destroy: function () {
|
693 |
+
this.pause();
|
694 |
+
LP.Hook.removeAction('learn_press_before_finish_quiz');
|
695 |
+
LP.Hook.removeFilter('learn_press_get_current_item_url');
|
696 |
+
},
|
697 |
+
/********************************/
|
698 |
+
_submit: function (args) {
|
699 |
+
var data = {};
|
700 |
+
data = this.model.getQuizData(data);
|
701 |
+
|
702 |
+
args = $.extend({
|
703 |
+
security: '',
|
704 |
+
action: ''
|
705 |
+
}, args || {});
|
706 |
+
windowTarget.LP.blockContent();
|
707 |
+
LP.Hook.doAction('learn_press_before_start_quiz', this.currentItem, this);
|
708 |
+
var $form = this.$('form.quiz-buttons');
|
709 |
+
var qlenght = this.model.questions.length;
|
710 |
+
this.model.questions.forEach(function (m) {
|
711 |
+
var $content = m.get('response');
|
712 |
+
if (!$content) {
|
713 |
+
return;
|
714 |
+
}
|
715 |
+
var $question = '';
|
716 |
+
if (qlenght === 1) {
|
717 |
+
var $question = jQuery('#' + $content.attr('id') + ' .quiz-question-content').clone().hide();
|
718 |
+
} else {
|
719 |
+
var $question = $content.find('.quiz-question-content').clone().hide();
|
720 |
+
}
|
721 |
+
$form.append($question);
|
722 |
+
});
|
723 |
+
$form.find('input[name="security"]').val(args.security);
|
724 |
+
$form.find('input[name="lp-ajax"]').val(args.action);
|
725 |
+
var extraArgs = _.omit(args, ['security', 'action']);
|
726 |
+
_.forEach(extraArgs, function (v, k) {
|
727 |
+
$form.append('<input type="hidden" name="' + k + '" value="' + v + '" />');
|
728 |
+
});
|
729 |
+
$form.submit();
|
730 |
+
},
|
731 |
+
_confirm: function (localize, onYes, onNo) {
|
732 |
+
var that = this,
|
733 |
+
loc = this.localized[localize] || {},
|
734 |
+
message = loc.message || '',
|
735 |
+
title = loc.title || '';
|
736 |
+
windowTarget.jConfirm(message, title, function (confirm) {
|
737 |
+
if (confirm && $.isFunction(onYes)) {
|
738 |
+
onYes.call(that);
|
739 |
+
} else if ($.isFunction(onNo)) {
|
740 |
+
onNo.call(that);
|
741 |
+
}
|
742 |
+
});
|
743 |
+
},
|
744 |
+
_startQuiz: function (e) {
|
745 |
+
var that = this,
|
746 |
+
$button = $(e.target);
|
747 |
+
windowTarget.LP.Hook.doAction('learn_press_before_start_quiz', this);
|
748 |
+
this._submit($button.data());
|
749 |
+
return false;
|
750 |
+
},
|
751 |
+
_finishQuiz: function (e) {
|
752 |
+
var that = this,
|
753 |
+
$button = $(e.target);
|
754 |
+
e.preventDefault();
|
755 |
+
if (typeof e.originalEvent === 'undefined') {
|
756 |
+
windowTarget.LP.Hook.doAction('learn_press_before_finish_quiz', this);
|
757 |
+
that._submit($.extend($button.data(), {auto_finish: 'yes'}));
|
758 |
+
} else {
|
759 |
+
this._confirm('confirm_finish_quiz', function () {
|
760 |
+
windowTarget.LP.Hook.doAction('learn_press_before_finish_quiz', this);
|
761 |
+
that._submit($button.data());
|
762 |
+
});
|
763 |
+
}
|
764 |
+
return false;
|
765 |
+
},
|
766 |
+
_doFinishQuiz: function (security) {
|
767 |
+
var that = this;
|
768 |
+
LP.Hook.doAction('learn_press_before_finish_quiz', that.currentItem, that);
|
769 |
+
that.finishQuiz({
|
770 |
+
security: security,
|
771 |
+
beforeSend: windowTarget.LP.blockContent(),
|
772 |
+
callback: function (response, item) {
|
773 |
+
windowTarget.LP.unblockContent();
|
774 |
+
that.$('#learn-press-content-item').html(response.html.content);
|
775 |
+
windowTarget.LP.setUrl(that.model.get('permalink'));
|
776 |
+
var data = response.course_result;
|
777 |
+
data.messageType = 'update-course';
|
778 |
+
LP.sendMessage(data, windowTarget);
|
779 |
+
}
|
780 |
+
});
|
781 |
+
},
|
782 |
+
_retakeQuiz: function (e) {
|
783 |
+
e.preventDefault();
|
784 |
+
var that = this,
|
785 |
+
$button = $(e.target);
|
786 |
+
this._confirm('confirm_retake_quiz', function () {
|
787 |
+
LP.Hook.doAction('learn_press_before_retake_quiz', this);
|
788 |
+
that._submit($button.data());
|
789 |
+
});
|
790 |
+
return false;
|
791 |
+
},
|
792 |
+
|
793 |
+
complete: function (args) {
|
794 |
+
var that = this;
|
795 |
+
args = $.extend({
|
796 |
+
context: null,
|
797 |
+
callback: null,
|
798 |
+
format: 'json'
|
799 |
+
}, this.toJSON(), args || {});
|
800 |
+
var data = {};
|
801 |
+
|
802 |
+
// Omit unwanted fields
|
803 |
+
_.forEach(args, function (v, k) {
|
804 |
+
if (($.inArray(k, ['content', 'current', 'title', 'url']) == -1) && !$.isFunction(v)) {
|
805 |
+
data[k] = v;
|
806 |
+
}
|
807 |
+
;
|
808 |
+
});
|
809 |
+
LP.ajax({
|
810 |
+
url: this.get('url'),
|
811 |
+
action: 'complete-item',
|
812 |
+
data: data,
|
813 |
+
dataType: 'json',
|
814 |
+
success: function (response) {
|
815 |
+
///response = LP.parseJSON(response);
|
816 |
+
LP.Hook.doAction('learn_press_course_item_completed', response, that);
|
817 |
+
response = LP.Hook.applyFilters('learn_press_course_item_complete_response', response, that);
|
818 |
+
$.isFunction(args.callback) && args.callback.call(args.context, response, that);
|
819 |
+
}
|
820 |
+
});
|
821 |
+
},
|
822 |
+
startQuiz: function (args) {
|
823 |
+
var args = $.extend({
|
824 |
+
course_id: this.model.get('courseId'),
|
825 |
+
quiz_id: this.model.get('id'),
|
826 |
+
security: null
|
827 |
+
}, args || {});
|
828 |
+
var data = this._validateObject(args), that = this;
|
829 |
+
LP.ajax({
|
830 |
+
url: this.model.get('url'),
|
831 |
+
action: 'start-quiz',
|
832 |
+
data: data,
|
833 |
+
dataType: 'json',
|
834 |
+
success: function (response) {
|
835 |
+
$.isFunction(args.callback) && args.callback.call(args.context, response, that);
|
836 |
+
}
|
837 |
+
});
|
838 |
+
},
|
839 |
+
finishQuiz: function (args) {
|
840 |
+
var args = $.extend({
|
841 |
+
course_id: this.model.get('courseId'),
|
842 |
+
quiz_id: this.model.get('id'),
|
843 |
+
security: null
|
844 |
+
}, args || {});
|
845 |
+
var data = this._validateObject(args), that = this;
|
846 |
+
data = LP.Hook.applyFilters('learn_press_finish_quiz_data', data);
|
847 |
+
var beforeSend = args.beforeSend || function () {
|
848 |
+
};
|
849 |
+
LP.ajax({
|
850 |
+
url: this.model.get('url'),
|
851 |
+
action: 'finish-quiz',
|
852 |
+
data: data,
|
853 |
+
dataType: 'json',
|
854 |
+
beforeSend: beforeSend,
|
855 |
+
success: function (response) {
|
856 |
+
windowTarget.LP.unblockContent();
|
857 |
+
$.isFunction(args.callback) && args.callback.call(args.context, response, that);
|
858 |
+
}
|
859 |
+
});
|
860 |
+
},
|
861 |
+
retakeQuiz: function (args) {
|
862 |
+
var args = $.extend({
|
863 |
+
course_id: this.model.get('courseId'),
|
864 |
+
quiz_id: this.model.get('id'),
|
865 |
+
security: null
|
866 |
+
}, args || {});
|
867 |
+
var data = this._validateObject(args), that = this;
|
868 |
+
LP.ajax({
|
869 |
+
url: this.model.get('url'),
|
870 |
+
action: 'retake-quiz',
|
871 |
+
data: data,
|
872 |
+
dataType: 'json',
|
873 |
+
beforeSend: function () {
|
874 |
+
windowTarget.LP.blockContent();
|
875 |
+
},
|
876 |
+
success: function (response) {
|
877 |
+
windowTarget.LP.unblockContent();
|
878 |
+
$.isFunction(args.callback) && args.callback.call(args.context, response, that);
|
879 |
+
}
|
880 |
+
});
|
881 |
+
},
|
882 |
+
_click_nav_link: function (e) {
|
883 |
+
e.preventDefault();
|
884 |
+
var $button = $(e.target);
|
885 |
+
var lesson_id = '';
|
886 |
+
if ($button.prop("tagName").toLowerCase() != 'a') {
|
887 |
+
lesson_id = $button.parent().attr('data-id');
|
888 |
+
} else {
|
889 |
+
lesson_id = $($button).attr('data-id');
|
890 |
+
}
|
891 |
+
$(windowTarget.document).find('.course-item.course-item-' + lesson_id + '.viewable').trigger('click');
|
892 |
+
},
|
893 |
+
_toJSON: function () {
|
894 |
+
// call parent method
|
895 |
+
var json = Course_Item.__super__.toJSON.apply(this, arguments);
|
896 |
+
},
|
897 |
+
_validateObject: function (obj) {
|
898 |
+
var ret = {};
|
899 |
+
for (var i in obj) {
|
900 |
+
if (!$.isFunction(obj[i])) {
|
901 |
+
ret[i] = obj[i];
|
902 |
+
}
|
903 |
+
}
|
904 |
+
return ret;
|
905 |
+
}
|
906 |
+
});
|
907 |
+
|
908 |
+
window.LP_Quiz = Quiz;
|
909 |
+
$(document).ready(function () {
|
910 |
+
if (typeof LP_Quiz_Params != 'undefined') {
|
911 |
+
window.$LP_Quiz = new LP_Quiz($.extend({course: LP.$LP_Course}, LP_Quiz_Params));
|
912 |
+
}
|
913 |
+
windowTarget.LP.unblockContent();
|
914 |
+
});
|
915 |
+
})(jQuery);
|
assets/js/index.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php // Silence is golden.
|
assets/js/vendor/Chart.bundle.min.js
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Chart.js
|
3 |
+
* http://chartjs.org/
|
4 |
+
* Version: 2.5.0
|
5 |
+
*
|
6 |
+
* Copyright 2017 Nick Downie
|
7 |
+
* Released under the MIT license
|
8 |
+
* https://github.com/chartjs/Chart.js/blob/master/LICENSE.md
|
9 |
+
*/
|
10 |
+
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Chart=t()}}(function(){var t;return function t(e,n,i){function a(o,s){if(!n[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(r)return r(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=n[o]={exports:{}};e[o][0].call(d.exports,function(t){var n=e[o][1][t];return a(n?n:t)},d,d.exports,t,e,n,i)}return n[o].exports}for(var r="function"==typeof require&&require,o=0;o<i.length;o++)a(i[o]);return a}({1:[function(t,e,n){function i(t){if(t){var e=/^#([a-fA-F0-9]{3})$/,n=/^#([a-fA-F0-9]{6})$/,i=/^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,a=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,r=/(\w+)/,o=[0,0,0],s=1,l=t.match(e);if(l){l=l[1];for(var u=0;u<o.length;u++)o[u]=parseInt(l[u]+l[u],16)}else if(l=t.match(n)){l=l[1];for(var u=0;u<o.length;u++)o[u]=parseInt(l.slice(2*u,2*u+2),16)}else if(l=t.match(i)){for(var u=0;u<o.length;u++)o[u]=parseInt(l[u+1]);s=parseFloat(l[4])}else if(l=t.match(a)){for(var u=0;u<o.length;u++)o[u]=Math.round(2.55*parseFloat(l[u+1]));s=parseFloat(l[4])}else if(l=t.match(r)){if("transparent"==l[1])return[0,0,0,0];if(o=x[l[1]],!o)return}for(var u=0;u<o.length;u++)o[u]=b(o[u],0,255);return s=s||0==s?b(s,0,1):1,o[3]=s,o}}function a(t){if(t){var e=/^hsla?\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,n=t.match(e);if(n){var i=parseFloat(n[4]),a=b(parseInt(n[1]),0,360),r=b(parseFloat(n[2]),0,100),o=b(parseFloat(n[3]),0,100),s=b(isNaN(i)?1:i,0,1);return[a,r,o,s]}}}function r(t){if(t){var e=/^hwb\(\s*([+-]?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)/,n=t.match(e);if(n){var i=parseFloat(n[4]),a=b(parseInt(n[1]),0,360),r=b(parseFloat(n[2]),0,100),o=b(parseFloat(n[3]),0,100),s=b(isNaN(i)?1:i,0,1);return[a,r,o,s]}}}function o(t){var e=i(t);return e&&e.slice(0,3)}function s(t){var e=a(t);return e&&e.slice(0,3)}function l(t){var e=i(t);return e?e[3]:(e=a(t))?e[3]:(e=r(t))?e[3]:void 0}function u(t){return"#"+y(t[0])+y(t[1])+y(t[2])}function d(t,e){return e<1||t[3]&&t[3]<1?c(t,e):"rgb("+t[0]+", "+t[1]+", "+t[2]+")"}function c(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"rgba("+t[0]+", "+t[1]+", "+t[2]+", "+e+")"}function h(t,e){if(e<1||t[3]&&t[3]<1)return f(t,e);var n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgb("+n+"%, "+i+"%, "+a+"%)"}function f(t,e){var n=Math.round(t[0]/255*100),i=Math.round(t[1]/255*100),a=Math.round(t[2]/255*100);return"rgba("+n+"%, "+i+"%, "+a+"%, "+(e||t[3]||1)+")"}function g(t,e){return e<1||t[3]&&t[3]<1?m(t,e):"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)"}function m(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+e+")"}function p(t,e){return void 0===e&&(e=void 0!==t[3]?t[3]:1),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+(void 0!==e&&1!==e?", "+e:"")+")"}function v(t){return k[t.slice(0,3)]}function b(t,e,n){return Math.min(Math.max(e,t),n)}function y(t){var e=t.toString(16).toUpperCase();return e.length<2?"0"+e:e}var x=t(5);e.exports={getRgba:i,getHsla:a,getRgb:o,getHsl:s,getHwb:r,getAlpha:l,hexString:u,rgbString:d,rgbaString:c,percentString:h,percentaString:f,hslString:g,hslaString:m,hwbString:p,keyword:v};var k={};for(var _ in x)k[x[_]]=_},{5:5}],2:[function(t,e,n){var i=t(4),a=t(1),r=function(t){if(t instanceof r)return t;if(!(this instanceof r))return new r(t);this.values={rgb:[0,0,0],hsl:[0,0,0],hsv:[0,0,0],hwb:[0,0,0],cmyk:[0,0,0,0],alpha:1};var e;if("string"==typeof t)if(e=a.getRgba(t))this.setValues("rgb",e);else if(e=a.getHsla(t))this.setValues("hsl",e);else{if(!(e=a.getHwb(t)))throw new Error('Unable to parse color from string "'+t+'"');this.setValues("hwb",e)}else if("object"==typeof t)if(e=t,void 0!==e.r||void 0!==e.red)this.setValues("rgb",e);else if(void 0!==e.l||void 0!==e.lightness)this.setValues("hsl",e);else if(void 0!==e.v||void 0!==e.value)this.setValues("hsv",e);else if(void 0!==e.w||void 0!==e.whiteness)this.setValues("hwb",e);else{if(void 0===e.c&&void 0===e.cyan)throw new Error("Unable to parse color from object "+JSON.stringify(t));this.setValues("cmyk",e)}};r.prototype={rgb:function(){return this.setSpace("rgb",arguments)},hsl:function(){return this.setSpace("hsl",arguments)},hsv:function(){return this.setSpace("hsv",arguments)},hwb:function(){return this.setSpace("hwb",arguments)},cmyk:function(){return this.setSpace("cmyk",arguments)},rgbArray:function(){return this.values.rgb},hslArray:function(){return this.values.hsl},hsvArray:function(){return this.values.hsv},hwbArray:function(){var t=this.values;return 1!==t.alpha?t.hwb.concat([t.alpha]):t.hwb},cmykArray:function(){return this.values.cmyk},rgbaArray:function(){var t=this.values;return t.rgb.concat([t.alpha])},hslaArray:function(){var t=this.values;return t.hsl.concat([t.alpha])},alpha:function(t){return void 0===t?this.values.alpha:(this.setValues("alpha",t),this)},red:function(t){return this.setChannel("rgb",0,t)},green:function(t){return this.setChannel("rgb",1,t)},blue:function(t){return this.setChannel("rgb",2,t)},hue:function(t){return t&&(t%=360,t=t<0?360+t:t),this.setChannel("hsl",0,t)},saturation:function(t){return this.setChannel("hsl",1,t)},lightness:function(t){return this.setChannel("hsl",2,t)},saturationv:function(t){return this.setChannel("hsv",1,t)},whiteness:function(t){return this.setChannel("hwb",1,t)},blackness:function(t){return this.setChannel("hwb",2,t)},value:function(t){return this.setChannel("hsv",2,t)},cyan:function(t){return this.setChannel("cmyk",0,t)},magenta:function(t){return this.setChannel("cmyk",1,t)},yellow:function(t){return this.setChannel("cmyk",2,t)},black:function(t){return this.setChannel("cmyk",3,t)},hexString:function(){return a.hexString(this.values.rgb)},rgbString:function(){return a.rgbString(this.values.rgb,this.values.alpha)},rgbaString:function(){return a.rgbaString(this.values.rgb,this.values.alpha)},percentString:function(){return a.percentString(this.values.rgb,this.values.alpha)},hslString:function(){return a.hslString(this.values.hsl,this.values.alpha)},hslaString:function(){return a.hslaString(this.values.hsl,this.values.alpha)},hwbString:function(){return a.hwbString(this.values.hwb,this.values.alpha)},keyword:function(){return a.keyword(this.values.rgb,this.values.alpha)},rgbNumber:function(){var t=this.values.rgb;return t[0]<<16|t[1]<<8|t[2]},luminosity:function(){for(var t=this.values.rgb,e=[],n=0;n<t.length;n++){var i=t[n]/255;e[n]=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4)}return.2126*e[0]+.7152*e[1]+.0722*e[2]},contrast:function(t){var e=this.luminosity(),n=t.luminosity();return e>n?(e+.05)/(n+.05):(n+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(299*t[0]+587*t[1]+114*t[2])/1e3;return e<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,n=(e[0]+t)%360;return e[0]=n<0?360+n:n,this.setValues("hsl",e),this},mix:function(t,e){var n=this,i=t,a=void 0===e?.5:e,r=2*a-1,o=n.alpha()-i.alpha(),s=((r*o===-1?r:(r+o)/(1+r*o))+1)/2,l=1-s;return this.rgb(s*n.red()+l*i.red(),s*n.green()+l*i.green(),s*n.blue()+l*i.blue()).alpha(n.alpha()*a+i.alpha()*(1-a))},toJSON:function(){return this.rgb()},clone:function(){var t,e,n=new r,i=this.values,a=n.values;for(var o in i)i.hasOwnProperty(o)&&(t=i[o],e={}.toString.call(t),"[object Array]"===e?a[o]=t.slice(0):"[object Number]"===e?a[o]=t:console.error("unexpected color value:",t));return n}},r.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},r.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},r.prototype.getValues=function(t){for(var e=this.values,n={},i=0;i<t.length;i++)n[t.charAt(i)]=e[t][i];return 1!==e.alpha&&(n.a=e.alpha),n},r.prototype.setValues=function(t,e){var n,a=this.values,r=this.spaces,o=this.maxes,s=1;if("alpha"===t)s=e;else if(e.length)a[t]=e.slice(0,t.length),s=e[t.length];else if(void 0!==e[t.charAt(0)]){for(n=0;n<t.length;n++)a[t][n]=e[t.charAt(n)];s=e.a}else if(void 0!==e[r[t][0]]){var l=r[t];for(n=0;n<t.length;n++)a[t][n]=e[l[n]];s=e.alpha}if(a.alpha=Math.max(0,Math.min(1,void 0===s?a.alpha:s)),"alpha"===t)return!1;var u;for(n=0;n<t.length;n++)u=Math.max(0,Math.min(o[t][n],a[t][n])),a[t][n]=Math.round(u);for(var d in r)d!==t&&(a[d]=i[t][d](a[t]));return!0},r.prototype.setSpace=function(t,e){var n=e[0];return void 0===n?this.getValues(t):("number"==typeof n&&(n=Array.prototype.slice.call(e)),this.setValues(t,n),this)},r.prototype.setChannel=function(t,e,n){var i=this.values[t];return void 0===n?i[e]:n===i[e]?this:(i[e]=n,this.setValues(t,i),this)},"undefined"!=typeof window&&(window.Color=r),e.exports=r},{1:1,4:4}],3:[function(t,e,n){function i(t){var e,n,i,a=t[0]/255,r=t[1]/255,o=t[2]/255,s=Math.min(a,r,o),l=Math.max(a,r,o),u=l-s;return l==s?e=0:a==l?e=(r-o)/u:r==l?e=2+(o-a)/u:o==l&&(e=4+(a-r)/u),e=Math.min(60*e,360),e<0&&(e+=360),i=(s+l)/2,n=l==s?0:i<=.5?u/(l+s):u/(2-l-s),[e,100*n,100*i]}function a(t){var e,n,i,a=t[0],r=t[1],o=t[2],s=Math.min(a,r,o),l=Math.max(a,r,o),u=l-s;return n=0==l?0:u/l*1e3/10,l==s?e=0:a==l?e=(r-o)/u:r==l?e=2+(o-a)/u:o==l&&(e=4+(a-r)/u),e=Math.min(60*e,360),e<0&&(e+=360),i=l/255*1e3/10,[e,n,i]}function o(t){var e=t[0],n=t[1],a=t[2],r=i(t)[0],o=1/255*Math.min(e,Math.min(n,a)),a=1-1/255*Math.max(e,Math.max(n,a));return[r,100*o,100*a]}function s(t){var e,n,i,a,r=t[0]/255,o=t[1]/255,s=t[2]/255;return a=Math.min(1-r,1-o,1-s),e=(1-r-a)/(1-a)||0,n=(1-o-a)/(1-a)||0,i=(1-s-a)/(1-a)||0,[100*e,100*n,100*i,100*a]}function l(t){return K[JSON.stringify(t)]}function u(t){var e=t[0]/255,n=t[1]/255,i=t[2]/255;e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92;var a=.4124*e+.3576*n+.1805*i,r=.2126*e+.7152*n+.0722*i,o=.0193*e+.1192*n+.9505*i;return[100*a,100*r,100*o]}function d(t){var e,n,i,a=u(t),r=a[0],o=a[1],s=a[2];return r/=95.047,o/=100,s/=108.883,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*o-16,n=500*(r-o),i=200*(o-s),[e,n,i]}function c(t){return Y(d(t))}function h(t){var e,n,i,a,r,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0==s)return r=255*l,[r,r,r];n=l<.5?l*(1+s):l+s-l*s,e=2*l-n,a=[0,0,0];for(var u=0;u<3;u++)i=o+1/3*-(u-1),i<0&&i++,i>1&&i--,r=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,a[u]=255*r;return a}function f(t){var e,n,i=t[0],a=t[1]/100,r=t[2]/100;return 0===r?[0,0,0]:(r*=2,a*=r<=1?r:2-r,n=(r+a)/2,e=2*a/(r+a),[i,100*e,100*n])}function m(t){return o(h(t))}function p(t){return s(h(t))}function v(t){return l(h(t))}function y(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,a=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-n),s=255*i*(1-n*r),l=255*i*(1-n*(1-r)),i=255*i;switch(a){case 0:return[i,l,o];case 1:return[s,i,o];case 2:return[o,i,l];case 3:return[o,s,i];case 4:return[l,o,i];case 5:return[i,o,s]}}function x(t){var e,n,i=t[0],a=t[1]/100,r=t[2]/100;return n=(2-a)*r,e=a*r,e/=n<=1?n:2-n,e=e||0,n/=2,[i,100*e,100*n]}function k(t){return o(y(t))}function _(t){return s(y(t))}function w(t){return l(y(t))}function S(t){var e,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100,u=s+l;switch(u>1&&(s/=u,l/=u),e=Math.floor(6*o),n=1-l,i=6*o-e,0!=(1&e)&&(i=1-i),a=s+i*(n-s),e){default:case 6:case 0:r=n,g=a,b=s;break;case 1:r=a,g=n,b=s;break;case 2:r=s,g=n,b=a;break;case 3:r=s,g=a,b=n;break;case 4:r=a,g=s,b=n;break;case 5:r=n,g=s,b=a}return[255*r,255*g,255*b]}function M(t){return i(S(t))}function D(t){return a(S(t))}function C(t){return s(S(t))}function T(t){return l(S(t))}function P(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100,s=t[3]/100;return e=1-Math.min(1,a*(1-s)+s),n=1-Math.min(1,r*(1-s)+s),i=1-Math.min(1,o*(1-s)+s),[255*e,255*n,255*i]}function I(t){return i(P(t))}function A(t){return a(P(t))}function F(t){return o(P(t))}function O(t){return l(P(t))}function R(t){var e,n,i,a=t[0]/100,r=t[1]/100,o=t[2]/100;return e=3.2406*a+r*-1.5372+o*-.4986,n=a*-.9689+1.8758*r+.0415*o,i=.0557*a+r*-.204+1.057*o,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,e=Math.min(Math.max(0,e),1),n=Math.min(Math.max(0,n),1),i=Math.min(Math.max(0,i),1),[255*e,255*n,255*i]}function L(t){var e,n,i,a=t[0],r=t[1],o=t[2];return a/=95.047,r/=100,o/=108.883,a=a>.008856?Math.pow(a,1/3):7.787*a+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,e=116*r-16,n=500*(a-r),i=200*(r-o),[e,n,i]}function V(t){return Y(L(t))}function W(t){var e,n,i,a,r=t[0],o=t[1],s=t[2];return r<=8?(n=100*r/903.3,a=7.787*(n/100)+16/116):(n=100*Math.pow((r+16)/116,3),a=Math.pow(n/100,1/3)),e=e/95.047<=.008856?e=95.047*(o/500+a-16/116)/7.787:95.047*Math.pow(o/500+a,3),i=i/108.883<=.008859?i=108.883*(a-s/200-16/116)/7.787:108.883*Math.pow(a-s/200,3),[e,n,i]}function Y(t){var e,n,i,a=t[0],r=t[1],o=t[2];return e=Math.atan2(o,r),n=360*e/2/Math.PI,n<0&&(n+=360),i=Math.sqrt(r*r+o*o),[a,i,n]}function B(t){return R(W(t))}function z(t){var e,n,i,a=t[0],r=t[1],o=t[2];return i=o/360*2*Math.PI,e=r*Math.cos(i),n=r*Math.sin(i),[a,e,n]}function N(t){return W(z(t))}function H(t){return B(z(t))}function E(t){return J[t]}function U(t){return i(E(t))}function j(t){return a(E(t))}function G(t){return o(E(t))}function q(t){return s(E(t))}function Z(t){return d(E(t))}function X(t){return u(E(t))}e.exports={rgb2hsl:i,rgb2hsv:a,rgb2hwb:o,rgb2cmyk:s,rgb2keyword:l,rgb2xyz:u,rgb2lab:d,rgb2lch:c,hsl2rgb:h,hsl2hsv:f,hsl2hwb:m,hsl2cmyk:p,hsl2keyword:v,hsv2rgb:y,hsv2hsl:x,hsv2hwb:k,hsv2cmyk:_,hsv2keyword:w,hwb2rgb:S,hwb2hsl:M,hwb2hsv:D,hwb2cmyk:C,hwb2keyword:T,cmyk2rgb:P,cmyk2hsl:I,cmyk2hsv:A,cmyk2hwb:F,cmyk2keyword:O,keyword2rgb:E,keyword2hsl:U,keyword2hsv:j,keyword2hwb:G,keyword2cmyk:q,keyword2lab:Z,keyword2xyz:X,xyz2rgb:R,xyz2lab:L,xyz2lch:V,lab2xyz:W,lab2rgb:B,lab2lch:Y,lch2lab:z,lch2xyz:N,lch2rgb:H};var J={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},K={};for(var Q in J)K[JSON.stringify(J[Q])]=Q},{}],4:[function(t,e,n){var i=t(3),a=function(){return new u};for(var r in i){a[r+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(r);var o=/(\w+)2(\w+)/.exec(r),s=o[1],l=o[2];a[s]=a[s]||{},a[s][l]=a[r]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var n=i[t](e);if("string"==typeof n||void 0===n)return n;for(var a=0;a<n.length;a++)n[a]=Math.round(n[a]);return n}}(r)}var u=function(){this.convs={}};u.prototype.routeSpace=function(t,e){var n=e[0];return void 0===n?this.getValues(t):("number"==typeof n&&(n=Array.prototype.slice.call(e)),this.setValues(t,n))},u.prototype.setValues=function(t,e){return this.space=t,this.convs={},this.convs[t]=e,this},u.prototype.getValues=function(t){var e=this.convs[t];if(!e){var n=this.space,i=this.convs[n];e=a[n][t](i),this.convs[t]=e}return e},["rgb","hsl","hsv","cmyk","keyword"].forEach(function(t){u.prototype[t]=function(e){return this.routeSpace(t,arguments)}}),e.exports=a},{3:3}],5:[function(t,e,n){e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},{}],6:[function(e,n,i){!function(e,a){"object"==typeof i&&"undefined"!=typeof n?n.exports=a():"function"==typeof t&&t.amd?t(a):e.moment=a()}(this,function(){"use strict";function t(){return vi.apply(null,arguments)}function i(t){vi=t}function a(t){return t instanceof Array||"[object Array]"===Object.prototype.toString.call(t)}function r(t){return null!=t&&"[object Object]"===Object.prototype.toString.call(t)}function o(t){var e;for(e in t)return!1;return!0}function s(t){return"number"==typeof t||"[object Number]"===Object.prototype.toString.call(t)}function l(t){return t instanceof Date||"[object Date]"===Object.prototype.toString.call(t)}function u(t,e){var n,i=[];for(n=0;n<t.length;++n)i.push(e(t[n],n));return i}function d(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function c(t,e){for(var n in e)d(e,n)&&(t[n]=e[n]);return d(e,"toString")&&(t.toString=e.toString),d(e,"valueOf")&&(t.valueOf=e.valueOf),t}function h(t,e,n,i){return ye(t,e,n,i,!0).utc()}function f(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function g(t){return null==t._pf&&(t._pf=f()),t._pf}function m(t){if(null==t._isValid){var e=g(t),n=yi.call(e.parsedDateParts,function(t){return null!=t}),i=!isNaN(t._d.getTime())&&e.overflow<0&&!e.empty&&!e.invalidMonth&&!e.invalidWeekday&&!e.nullInput&&!e.invalidFormat&&!e.userInvalidated&&(!e.meridiem||e.meridiem&&n);if(t._strict&&(i=i&&0===e.charsLeftOver&&0===e.unusedTokens.length&&void 0===e.bigHour),null!=Object.isFrozen&&Object.isFrozen(t))return i;t._isValid=i}return t._isValid}function p(t){var e=h(NaN);return null!=t?c(g(e),t):g(e).userInvalidated=!0,e}function v(t){return void 0===t}function b(t,e){var n,i,a;if(v(e._isAMomentObject)||(t._isAMomentObject=e._isAMomentObject),v(e._i)||(t._i=e._i),v(e._f)||(t._f=e._f),v(e._l)||(t._l=e._l),v(e._strict)||(t._strict=e._strict),v(e._tzm)||(t._tzm=e._tzm),v(e._isUTC)||(t._isUTC=e._isUTC),v(e._offset)||(t._offset=e._offset),v(e._pf)||(t._pf=g(e)),v(e._locale)||(t._locale=e._locale),xi.length>0)for(n in xi)i=xi[n],a=e[i],v(a)||(t[i]=a);return t}function y(e){b(this,e),this._d=new Date(null!=e._d?e._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),ki===!1&&(ki=!0,t.updateOffset(this),ki=!1)}function x(t){return t instanceof y||null!=t&&null!=t._isAMomentObject}function k(t){return t<0?Math.ceil(t)||0:Math.floor(t)}function _(t){var e=+t,n=0;return 0!==e&&isFinite(e)&&(n=k(e)),n}function w(t,e,n){var i,a=Math.min(t.length,e.length),r=Math.abs(t.length-e.length),o=0;for(i=0;i<a;i++)(n&&t[i]!==e[i]||!n&&_(t[i])!==_(e[i]))&&o++;return o+r}function S(e){t.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+e)}function M(e,n){var i=!0;return c(function(){if(null!=t.deprecationHandler&&t.deprecationHandler(null,e),i){for(var a,r=[],o=0;o<arguments.length;o++){if(a="","object"==typeof arguments[o]){a+="\n["+o+"] ";for(var s in arguments[0])a+=s+": "+arguments[0][s]+", ";a=a.slice(0,-2)}else a=arguments[o];r.push(a)}S(e+"\nArguments: "+Array.prototype.slice.call(r).join("")+"\n"+(new Error).stack),i=!1}return n.apply(this,arguments)},n)}function D(e,n){null!=t.deprecationHandler&&t.deprecationHandler(e,n),_i[e]||(S(n),_i[e]=!0)}function C(t){return t instanceof Function||"[object Function]"===Object.prototype.toString.call(t)}function T(t){var e,n;for(n in t)e=t[n],C(e)?this[n]=e:this["_"+n]=e;this._config=t,this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function P(t,e){var n,i=c({},t);for(n in e)d(e,n)&&(r(t[n])&&r(e[n])?(i[n]={},c(i[n],t[n]),c(i[n],e[n])):null!=e[n]?i[n]=e[n]:delete i[n]);for(n in t)d(t,n)&&!d(e,n)&&r(t[n])&&(i[n]=c({},i[n]));return i}function I(t){null!=t&&this.set(t)}function A(t,e,n){var i=this._calendar[t]||this._calendar.sameElse;return C(i)?i.call(e,n):i}function F(t){var e=this._longDateFormat[t],n=this._longDateFormat[t.toUpperCase()];return e||!n?e:(this._longDateFormat[t]=n.replace(/MMMM|MM|DD|dddd/g,function(t){return t.slice(1)}),this._longDateFormat[t])}function O(){return this._invalidDate}function R(t){return this._ordinal.replace("%d",t)}function L(t,e,n,i){var a=this._relativeTime[n];return C(a)?a(t,e,n,i):a.replace(/%d/i,t)}function V(t,e){var n=this._relativeTime[t>0?"future":"past"];return C(n)?n(e):n.replace(/%s/i,e)}function W(t,e){var n=t.toLowerCase();Fi[n]=Fi[n+"s"]=Fi[e]=t}function Y(t){return"string"==typeof t?Fi[t]||Fi[t.toLowerCase()]:void 0}function B(t){var e,n,i={};for(n in t)d(t,n)&&(e=Y(n),e&&(i[e]=t[n]));return i}function z(t,e){Oi[t]=e}function N(t){var e=[];for(var n in t)e.push({unit:n,priority:Oi[n]});return e.sort(function(t,e){return t.priority-e.priority}),e}function H(e,n){return function(i){return null!=i?(U(this,e,i),t.updateOffset(this,n),this):E(this,e)}}function E(t,e){return t.isValid()?t._d["get"+(t._isUTC?"UTC":"")+e]():NaN}function U(t,e,n){t.isValid()&&t._d["set"+(t._isUTC?"UTC":"")+e](n)}function j(t){return t=Y(t),C(this[t])?this[t]():this}function G(t,e){if("object"==typeof t){t=B(t);for(var n=N(t),i=0;i<n.length;i++)this[n[i].unit](t[n[i].unit])}else if(t=Y(t),C(this[t]))return this[t](e);return this}function q(t,e,n){var i=""+Math.abs(t),a=e-i.length,r=t>=0;return(r?n?"+":"":"-")+Math.pow(10,Math.max(0,a)).toString().substr(1)+i}function Z(t,e,n,i){var a=i;"string"==typeof i&&(a=function(){return this[i]()}),t&&(Wi[t]=a),e&&(Wi[e[0]]=function(){return q(a.apply(this,arguments),e[1],e[2])}),n&&(Wi[n]=function(){return this.localeData().ordinal(a.apply(this,arguments),t)})}function X(t){return t.match(/\[[\s\S]/)?t.replace(/^\[|\]$/g,""):t.replace(/\\/g,"")}function J(t){var e,n,i=t.match(Ri);for(e=0,n=i.length;e<n;e++)Wi[i[e]]?i[e]=Wi[i[e]]:i[e]=X(i[e]);return function(e){var a,r="";for(a=0;a<n;a++)r+=i[a]instanceof Function?i[a].call(e,t):i[a];return r}}function K(t,e){return t.isValid()?(e=Q(e,t.localeData()),Vi[e]=Vi[e]||J(e),Vi[e](t)):t.localeData().invalidDate()}function Q(t,e){function n(t){return e.longDateFormat(t)||t}var i=5;for(Li.lastIndex=0;i>=0&&Li.test(t);)t=t.replace(Li,n),Li.lastIndex=0,i-=1;return t}function $(t,e,n){ea[t]=C(e)?e:function(t,i){return t&&n?n:e}}function tt(t,e){return d(ea,t)?ea[t](e._strict,e._locale):new RegExp(et(t))}function et(t){return nt(t.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(t,e,n,i,a){return e||n||i||a}))}function nt(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function it(t,e){var n,i=e;for("string"==typeof t&&(t=[t]),s(e)&&(i=function(t,n){n[e]=_(t)}),n=0;n<t.length;n++)na[t[n]]=i}function at(t,e){it(t,function(t,n,i,a){i._w=i._w||{},e(t,i._w,i,a)})}function rt(t,e,n){null!=e&&d(na,t)&&na[t](e,n._a,n,t)}function ot(t,e){return new Date(Date.UTC(t,e+1,0)).getUTCDate()}function st(t,e){return t?a(this._months)?this._months[t.month()]:this._months[(this._months.isFormat||fa).test(e)?"format":"standalone"][t.month()]:this._months}function lt(t,e){return t?a(this._monthsShort)?this._monthsShort[t.month()]:this._monthsShort[fa.test(e)?"format":"standalone"][t.month()]:this._monthsShort}function ut(t,e,n){var i,a,r,o=t.toLocaleLowerCase();if(!this._monthsParse)for(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],i=0;i<12;++i)r=h([2e3,i]),this._shortMonthsParse[i]=this.monthsShort(r,"").toLocaleLowerCase(),this._longMonthsParse[i]=this.months(r,"").toLocaleLowerCase();return n?"MMM"===e?(a=ha.call(this._shortMonthsParse,o),a!==-1?a:null):(a=ha.call(this._longMonthsParse,o),a!==-1?a:null):"MMM"===e?(a=ha.call(this._shortMonthsParse,o),a!==-1?a:(a=ha.call(this._longMonthsParse,o),a!==-1?a:null)):(a=ha.call(this._longMonthsParse,o),a!==-1?a:(a=ha.call(this._shortMonthsParse,o),a!==-1?a:null))}function dt(t,e,n){var i,a,r;if(this._monthsParseExact)return ut.call(this,t,e,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),i=0;i<12;i++){if(a=h([2e3,i]),n&&!this._longMonthsParse[i]&&(this._longMonthsParse[i]=new RegExp("^"+this.months(a,"").replace(".","")+"$","i"),this._shortMonthsParse[i]=new RegExp("^"+this.monthsShort(a,"").replace(".","")+"$","i")),n||this._monthsParse[i]||(r="^"+this.months(a,"")+"|^"+this.monthsShort(a,""),this._monthsParse[i]=new RegExp(r.replace(".",""),"i")),n&&"MMMM"===e&&this._longMonthsParse[i].test(t))return i;if(n&&"MMM"===e&&this._shortMonthsParse[i].test(t))return i;if(!n&&this._monthsParse[i].test(t))return i}}function ct(t,e){var n;if(!t.isValid())return t;if("string"==typeof e)if(/^\d+$/.test(e))e=_(e);else if(e=t.localeData().monthsParse(e),!s(e))return t;return n=Math.min(t.date(),ot(t.year(),e)),
|
11 |
+
t._d["set"+(t._isUTC?"UTC":"")+"Month"](e,n),t}function ht(e){return null!=e?(ct(this,e),t.updateOffset(this,!0),this):E(this,"Month")}function ft(){return ot(this.year(),this.month())}function gt(t){return this._monthsParseExact?(d(this,"_monthsRegex")||pt.call(this),t?this._monthsShortStrictRegex:this._monthsShortRegex):(d(this,"_monthsShortRegex")||(this._monthsShortRegex=pa),this._monthsShortStrictRegex&&t?this._monthsShortStrictRegex:this._monthsShortRegex)}function mt(t){return this._monthsParseExact?(d(this,"_monthsRegex")||pt.call(this),t?this._monthsStrictRegex:this._monthsRegex):(d(this,"_monthsRegex")||(this._monthsRegex=va),this._monthsStrictRegex&&t?this._monthsStrictRegex:this._monthsRegex)}function pt(){function t(t,e){return e.length-t.length}var e,n,i=[],a=[],r=[];for(e=0;e<12;e++)n=h([2e3,e]),i.push(this.monthsShort(n,"")),a.push(this.months(n,"")),r.push(this.months(n,"")),r.push(this.monthsShort(n,""));for(i.sort(t),a.sort(t),r.sort(t),e=0;e<12;e++)i[e]=nt(i[e]),a[e]=nt(a[e]);for(e=0;e<24;e++)r[e]=nt(r[e]);this._monthsRegex=new RegExp("^("+r.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+a.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+i.join("|")+")","i")}function vt(t){return bt(t)?366:365}function bt(t){return t%4===0&&t%100!==0||t%400===0}function yt(){return bt(this.year())}function xt(t,e,n,i,a,r,o){var s=new Date(t,e,n,i,a,r,o);return t<100&&t>=0&&isFinite(s.getFullYear())&&s.setFullYear(t),s}function kt(t){var e=new Date(Date.UTC.apply(null,arguments));return t<100&&t>=0&&isFinite(e.getUTCFullYear())&&e.setUTCFullYear(t),e}function _t(t,e,n){var i=7+e-n,a=(7+kt(t,0,i).getUTCDay()-e)%7;return-a+i-1}function wt(t,e,n,i,a){var r,o,s=(7+n-i)%7,l=_t(t,i,a),u=1+7*(e-1)+s+l;return u<=0?(r=t-1,o=vt(r)+u):u>vt(t)?(r=t+1,o=u-vt(t)):(r=t,o=u),{year:r,dayOfYear:o}}function St(t,e,n){var i,a,r=_t(t.year(),e,n),o=Math.floor((t.dayOfYear()-r-1)/7)+1;return o<1?(a=t.year()-1,i=o+Mt(a,e,n)):o>Mt(t.year(),e,n)?(i=o-Mt(t.year(),e,n),a=t.year()+1):(a=t.year(),i=o),{week:i,year:a}}function Mt(t,e,n){var i=_t(t,e,n),a=_t(t+1,e,n);return(vt(t)-i+a)/7}function Dt(t){return St(t,this._week.dow,this._week.doy).week}function Ct(){return this._week.dow}function Tt(){return this._week.doy}function Pt(t){var e=this.localeData().week(this);return null==t?e:this.add(7*(t-e),"d")}function It(t){var e=St(this,1,4).week;return null==t?e:this.add(7*(t-e),"d")}function At(t,e){return"string"!=typeof t?t:isNaN(t)?(t=e.weekdaysParse(t),"number"==typeof t?t:null):parseInt(t,10)}function Ft(t,e){return"string"==typeof t?e.weekdaysParse(t)%7||7:isNaN(t)?null:t}function Ot(t,e){return t?a(this._weekdays)?this._weekdays[t.day()]:this._weekdays[this._weekdays.isFormat.test(e)?"format":"standalone"][t.day()]:this._weekdays}function Rt(t){return t?this._weekdaysShort[t.day()]:this._weekdaysShort}function Lt(t){return t?this._weekdaysMin[t.day()]:this._weekdaysMin}function Vt(t,e,n){var i,a,r,o=t.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],i=0;i<7;++i)r=h([2e3,1]).day(i),this._minWeekdaysParse[i]=this.weekdaysMin(r,"").toLocaleLowerCase(),this._shortWeekdaysParse[i]=this.weekdaysShort(r,"").toLocaleLowerCase(),this._weekdaysParse[i]=this.weekdays(r,"").toLocaleLowerCase();return n?"dddd"===e?(a=ha.call(this._weekdaysParse,o),a!==-1?a:null):"ddd"===e?(a=ha.call(this._shortWeekdaysParse,o),a!==-1?a:null):(a=ha.call(this._minWeekdaysParse,o),a!==-1?a:null):"dddd"===e?(a=ha.call(this._weekdaysParse,o),a!==-1?a:(a=ha.call(this._shortWeekdaysParse,o),a!==-1?a:(a=ha.call(this._minWeekdaysParse,o),a!==-1?a:null))):"ddd"===e?(a=ha.call(this._shortWeekdaysParse,o),a!==-1?a:(a=ha.call(this._weekdaysParse,o),a!==-1?a:(a=ha.call(this._minWeekdaysParse,o),a!==-1?a:null))):(a=ha.call(this._minWeekdaysParse,o),a!==-1?a:(a=ha.call(this._weekdaysParse,o),a!==-1?a:(a=ha.call(this._shortWeekdaysParse,o),a!==-1?a:null)))}function Wt(t,e,n){var i,a,r;if(this._weekdaysParseExact)return Vt.call(this,t,e,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),i=0;i<7;i++){if(a=h([2e3,1]).day(i),n&&!this._fullWeekdaysParse[i]&&(this._fullWeekdaysParse[i]=new RegExp("^"+this.weekdays(a,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[i]=new RegExp("^"+this.weekdaysShort(a,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[i]=new RegExp("^"+this.weekdaysMin(a,"").replace(".",".?")+"$","i")),this._weekdaysParse[i]||(r="^"+this.weekdays(a,"")+"|^"+this.weekdaysShort(a,"")+"|^"+this.weekdaysMin(a,""),this._weekdaysParse[i]=new RegExp(r.replace(".",""),"i")),n&&"dddd"===e&&this._fullWeekdaysParse[i].test(t))return i;if(n&&"ddd"===e&&this._shortWeekdaysParse[i].test(t))return i;if(n&&"dd"===e&&this._minWeekdaysParse[i].test(t))return i;if(!n&&this._weekdaysParse[i].test(t))return i}}function Yt(t){if(!this.isValid())return null!=t?this:NaN;var e=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=t?(t=At(t,this.localeData()),this.add(t-e,"d")):e}function Bt(t){if(!this.isValid())return null!=t?this:NaN;var e=(this.day()+7-this.localeData()._week.dow)%7;return null==t?e:this.add(t-e,"d")}function zt(t){if(!this.isValid())return null!=t?this:NaN;if(null!=t){var e=Ft(t,this.localeData());return this.day(this.day()%7?e:e-7)}return this.day()||7}function Nt(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Ut.call(this),t?this._weekdaysStrictRegex:this._weekdaysRegex):(d(this,"_weekdaysRegex")||(this._weekdaysRegex=wa),this._weekdaysStrictRegex&&t?this._weekdaysStrictRegex:this._weekdaysRegex)}function Ht(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Ut.call(this),t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(d(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Sa),this._weekdaysShortStrictRegex&&t?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Et(t){return this._weekdaysParseExact?(d(this,"_weekdaysRegex")||Ut.call(this),t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(d(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=Ma),this._weekdaysMinStrictRegex&&t?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Ut(){function t(t,e){return e.length-t.length}var e,n,i,a,r,o=[],s=[],l=[],u=[];for(e=0;e<7;e++)n=h([2e3,1]).day(e),i=this.weekdaysMin(n,""),a=this.weekdaysShort(n,""),r=this.weekdays(n,""),o.push(i),s.push(a),l.push(r),u.push(i),u.push(a),u.push(r);for(o.sort(t),s.sort(t),l.sort(t),u.sort(t),e=0;e<7;e++)s[e]=nt(s[e]),l[e]=nt(l[e]),u[e]=nt(u[e]);this._weekdaysRegex=new RegExp("^("+u.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+o.join("|")+")","i")}function jt(){return this.hours()%12||12}function Gt(){return this.hours()||24}function qt(t,e){Z(t,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),e)})}function Zt(t,e){return e._meridiemParse}function Xt(t){return"p"===(t+"").toLowerCase().charAt(0)}function Jt(t,e,n){return t>11?n?"pm":"PM":n?"am":"AM"}function Kt(t){return t?t.toLowerCase().replace("_","-"):t}function Qt(t){for(var e,n,i,a,r=0;r<t.length;){for(a=Kt(t[r]).split("-"),e=a.length,n=Kt(t[r+1]),n=n?n.split("-"):null;e>0;){if(i=$t(a.slice(0,e).join("-")))return i;if(n&&n.length>=e&&w(a,n,!0)>=e-1)break;e--}r++}return null}function $t(t){var i=null;if(!Ia[t]&&"undefined"!=typeof n&&n&&n.exports)try{i=Da._abbr,e("./locale/"+t),te(i)}catch(t){}return Ia[t]}function te(t,e){var n;return t&&(n=v(e)?ie(t):ee(t,e),n&&(Da=n)),Da._abbr}function ee(t,e){if(null!==e){var n=Pa;if(e.abbr=t,null!=Ia[t])D("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),n=Ia[t]._config;else if(null!=e.parentLocale){if(null==Ia[e.parentLocale])return Aa[e.parentLocale]||(Aa[e.parentLocale]=[]),Aa[e.parentLocale].push({name:t,config:e}),null;n=Ia[e.parentLocale]._config}return Ia[t]=new I(P(n,e)),Aa[t]&&Aa[t].forEach(function(t){ee(t.name,t.config)}),te(t),Ia[t]}return delete Ia[t],null}function ne(t,e){if(null!=e){var n,i=Pa;null!=Ia[t]&&(i=Ia[t]._config),e=P(i,e),n=new I(e),n.parentLocale=Ia[t],Ia[t]=n,te(t)}else null!=Ia[t]&&(null!=Ia[t].parentLocale?Ia[t]=Ia[t].parentLocale:null!=Ia[t]&&delete Ia[t]);return Ia[t]}function ie(t){var e;if(t&&t._locale&&t._locale._abbr&&(t=t._locale._abbr),!t)return Da;if(!a(t)){if(e=$t(t))return e;t=[t]}return Qt(t)}function ae(){return Mi(Ia)}function re(t){var e,n=t._a;return n&&g(t).overflow===-2&&(e=n[aa]<0||n[aa]>11?aa:n[ra]<1||n[ra]>ot(n[ia],n[aa])?ra:n[oa]<0||n[oa]>24||24===n[oa]&&(0!==n[sa]||0!==n[la]||0!==n[ua])?oa:n[sa]<0||n[sa]>59?sa:n[la]<0||n[la]>59?la:n[ua]<0||n[ua]>999?ua:-1,g(t)._overflowDayOfYear&&(e<ia||e>ra)&&(e=ra),g(t)._overflowWeeks&&e===-1&&(e=da),g(t)._overflowWeekday&&e===-1&&(e=ca),g(t).overflow=e),t}function oe(t){var e,n,i,a,r,o,s=t._i,l=Fa.exec(s)||Oa.exec(s);if(l){for(g(t).iso=!0,e=0,n=La.length;e<n;e++)if(La[e][1].exec(l[1])){a=La[e][0],i=La[e][2]!==!1;break}if(null==a)return void(t._isValid=!1);if(l[3]){for(e=0,n=Va.length;e<n;e++)if(Va[e][1].exec(l[3])){r=(l[2]||" ")+Va[e][0];break}if(null==r)return void(t._isValid=!1)}if(!i&&null!=r)return void(t._isValid=!1);if(l[4]){if(!Ra.exec(l[4]))return void(t._isValid=!1);o="Z"}t._f=a+(r||"")+(o||""),he(t)}else t._isValid=!1}function se(e){var n=Wa.exec(e._i);return null!==n?void(e._d=new Date(+n[1])):(oe(e),void(e._isValid===!1&&(delete e._isValid,t.createFromInputFallback(e))))}function le(t,e,n){return null!=t?t:null!=e?e:n}function ue(e){var n=new Date(t.now());return e._useUTC?[n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate()]:[n.getFullYear(),n.getMonth(),n.getDate()]}function de(t){var e,n,i,a,r=[];if(!t._d){for(i=ue(t),t._w&&null==t._a[ra]&&null==t._a[aa]&&ce(t),t._dayOfYear&&(a=le(t._a[ia],i[ia]),t._dayOfYear>vt(a)&&(g(t)._overflowDayOfYear=!0),n=kt(a,0,t._dayOfYear),t._a[aa]=n.getUTCMonth(),t._a[ra]=n.getUTCDate()),e=0;e<3&&null==t._a[e];++e)t._a[e]=r[e]=i[e];for(;e<7;e++)t._a[e]=r[e]=null==t._a[e]?2===e?1:0:t._a[e];24===t._a[oa]&&0===t._a[sa]&&0===t._a[la]&&0===t._a[ua]&&(t._nextDay=!0,t._a[oa]=0),t._d=(t._useUTC?kt:xt).apply(null,r),null!=t._tzm&&t._d.setUTCMinutes(t._d.getUTCMinutes()-t._tzm),t._nextDay&&(t._a[oa]=24)}}function ce(t){var e,n,i,a,r,o,s,l;if(e=t._w,null!=e.GG||null!=e.W||null!=e.E)r=1,o=4,n=le(e.GG,t._a[ia],St(xe(),1,4).year),i=le(e.W,1),a=le(e.E,1),(a<1||a>7)&&(l=!0);else{r=t._locale._week.dow,o=t._locale._week.doy;var u=St(xe(),r,o);n=le(e.gg,t._a[ia],u.year),i=le(e.w,u.week),null!=e.d?(a=e.d,(a<0||a>6)&&(l=!0)):null!=e.e?(a=e.e+r,(e.e<0||e.e>6)&&(l=!0)):a=r}i<1||i>Mt(n,r,o)?g(t)._overflowWeeks=!0:null!=l?g(t)._overflowWeekday=!0:(s=wt(n,i,a,r,o),t._a[ia]=s.year,t._dayOfYear=s.dayOfYear)}function he(e){if(e._f===t.ISO_8601)return void oe(e);e._a=[],g(e).empty=!0;var n,i,a,r,o,s=""+e._i,l=s.length,u=0;for(a=Q(e._f,e._locale).match(Ri)||[],n=0;n<a.length;n++)r=a[n],i=(s.match(tt(r,e))||[])[0],i&&(o=s.substr(0,s.indexOf(i)),o.length>0&&g(e).unusedInput.push(o),s=s.slice(s.indexOf(i)+i.length),u+=i.length),Wi[r]?(i?g(e).empty=!1:g(e).unusedTokens.push(r),rt(r,i,e)):e._strict&&!i&&g(e).unusedTokens.push(r);g(e).charsLeftOver=l-u,s.length>0&&g(e).unusedInput.push(s),e._a[oa]<=12&&g(e).bigHour===!0&&e._a[oa]>0&&(g(e).bigHour=void 0),g(e).parsedDateParts=e._a.slice(0),g(e).meridiem=e._meridiem,e._a[oa]=fe(e._locale,e._a[oa],e._meridiem),de(e),re(e)}function fe(t,e,n){var i;return null==n?e:null!=t.meridiemHour?t.meridiemHour(e,n):null!=t.isPM?(i=t.isPM(n),i&&e<12&&(e+=12),i||12!==e||(e=0),e):e}function ge(t){var e,n,i,a,r;if(0===t._f.length)return g(t).invalidFormat=!0,void(t._d=new Date(NaN));for(a=0;a<t._f.length;a++)r=0,e=b({},t),null!=t._useUTC&&(e._useUTC=t._useUTC),e._f=t._f[a],he(e),m(e)&&(r+=g(e).charsLeftOver,r+=10*g(e).unusedTokens.length,g(e).score=r,(null==i||r<i)&&(i=r,n=e));c(t,n||e)}function me(t){if(!t._d){var e=B(t._i);t._a=u([e.year,e.month,e.day||e.date,e.hour,e.minute,e.second,e.millisecond],function(t){return t&&parseInt(t,10)}),de(t)}}function pe(t){var e=new y(re(ve(t)));return e._nextDay&&(e.add(1,"d"),e._nextDay=void 0),e}function ve(t){var e=t._i,n=t._f;return t._locale=t._locale||ie(t._l),null===e||void 0===n&&""===e?p({nullInput:!0}):("string"==typeof e&&(t._i=e=t._locale.preparse(e)),x(e)?new y(re(e)):(l(e)?t._d=e:a(n)?ge(t):n?he(t):be(t),m(t)||(t._d=null),t))}function be(e){var n=e._i;void 0===n?e._d=new Date(t.now()):l(n)?e._d=new Date(n.valueOf()):"string"==typeof n?se(e):a(n)?(e._a=u(n.slice(0),function(t){return parseInt(t,10)}),de(e)):"object"==typeof n?me(e):s(n)?e._d=new Date(n):t.createFromInputFallback(e)}function ye(t,e,n,i,s){var l={};return n!==!0&&n!==!1||(i=n,n=void 0),(r(t)&&o(t)||a(t)&&0===t.length)&&(t=void 0),l._isAMomentObject=!0,l._useUTC=l._isUTC=s,l._l=n,l._i=t,l._f=e,l._strict=i,pe(l)}function xe(t,e,n,i){return ye(t,e,n,i,!1)}function ke(t,e){var n,i;if(1===e.length&&a(e[0])&&(e=e[0]),!e.length)return xe();for(n=e[0],i=1;i<e.length;++i)e[i].isValid()&&!e[i][t](n)||(n=e[i]);return n}function _e(){var t=[].slice.call(arguments,0);return ke("isBefore",t)}function we(){var t=[].slice.call(arguments,0);return ke("isAfter",t)}function Se(t){var e=B(t),n=e.year||0,i=e.quarter||0,a=e.month||0,r=e.week||0,o=e.day||0,s=e.hour||0,l=e.minute||0,u=e.second||0,d=e.millisecond||0;this._milliseconds=+d+1e3*u+6e4*l+1e3*s*60*60,this._days=+o+7*r,this._months=+a+3*i+12*n,this._data={},this._locale=ie(),this._bubble()}function Me(t){return t instanceof Se}function De(t){return t<0?Math.round(-1*t)*-1:Math.round(t)}function Ce(t,e){Z(t,0,0,function(){var t=this.utcOffset(),n="+";return t<0&&(t=-t,n="-"),n+q(~~(t/60),2)+e+q(~~t%60,2)})}function Te(t,e){var n=(e||"").match(t);if(null===n)return null;var i=n[n.length-1]||[],a=(i+"").match(Na)||["-",0,0],r=+(60*a[1])+_(a[2]);return 0===r?0:"+"===a[0]?r:-r}function Pe(e,n){var i,a;return n._isUTC?(i=n.clone(),a=(x(e)||l(e)?e.valueOf():xe(e).valueOf())-i.valueOf(),i._d.setTime(i._d.valueOf()+a),t.updateOffset(i,!1),i):xe(e).local()}function Ie(t){return 15*-Math.round(t._d.getTimezoneOffset()/15)}function Ae(e,n){var i,a=this._offset||0;if(!this.isValid())return null!=e?this:NaN;if(null!=e){if("string"==typeof e){if(e=Te(Qi,e),null===e)return this}else Math.abs(e)<16&&(e*=60);return!this._isUTC&&n&&(i=Ie(this)),this._offset=e,this._isUTC=!0,null!=i&&this.add(i,"m"),a!==e&&(!n||this._changeInProgress?qe(this,He(e-a,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,t.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?a:Ie(this)}function Fe(t,e){return null!=t?("string"!=typeof t&&(t=-t),this.utcOffset(t,e),this):-this.utcOffset()}function Oe(t){return this.utcOffset(0,t)}function Re(t){return this._isUTC&&(this.utcOffset(0,t),this._isUTC=!1,t&&this.subtract(Ie(this),"m")),this}function Le(){if(null!=this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var t=Te(Ki,this._i);null!=t?this.utcOffset(t):this.utcOffset(0,!0)}return this}function Ve(t){return!!this.isValid()&&(t=t?xe(t).utcOffset():0,(this.utcOffset()-t)%60===0)}function We(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ye(){if(!v(this._isDSTShifted))return this._isDSTShifted;var t={};if(b(t,this),t=ve(t),t._a){var e=t._isUTC?h(t._a):xe(t._a);this._isDSTShifted=this.isValid()&&w(t._a,e.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Be(){return!!this.isValid()&&!this._isUTC}function ze(){return!!this.isValid()&&this._isUTC}function Ne(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function He(t,e){var n,i,a,r=t,o=null;return Me(t)?r={ms:t._milliseconds,d:t._days,M:t._months}:s(t)?(r={},e?r[e]=t:r.milliseconds=t):(o=Ha.exec(t))?(n="-"===o[1]?-1:1,r={y:0,d:_(o[ra])*n,h:_(o[oa])*n,m:_(o[sa])*n,s:_(o[la])*n,ms:_(De(1e3*o[ua]))*n}):(o=Ea.exec(t))?(n="-"===o[1]?-1:1,r={y:Ee(o[2],n),M:Ee(o[3],n),w:Ee(o[4],n),d:Ee(o[5],n),h:Ee(o[6],n),m:Ee(o[7],n),s:Ee(o[8],n)}):null==r?r={}:"object"==typeof r&&("from"in r||"to"in r)&&(a=je(xe(r.from),xe(r.to)),r={},r.ms=a.milliseconds,r.M=a.months),i=new Se(r),Me(t)&&d(t,"_locale")&&(i._locale=t._locale),i}function Ee(t,e){var n=t&&parseFloat(t.replace(",","."));return(isNaN(n)?0:n)*e}function Ue(t,e){var n={milliseconds:0,months:0};return n.months=e.month()-t.month()+12*(e.year()-t.year()),t.clone().add(n.months,"M").isAfter(e)&&--n.months,n.milliseconds=+e-+t.clone().add(n.months,"M"),n}function je(t,e){var n;return t.isValid()&&e.isValid()?(e=Pe(e,t),t.isBefore(e)?n=Ue(t,e):(n=Ue(e,t),n.milliseconds=-n.milliseconds,n.months=-n.months),n):{milliseconds:0,months:0}}function Ge(t,e){return function(n,i){var a,r;return null===i||isNaN(+i)||(D(e,"moment()."+e+"(period, number) is deprecated. Please use moment()."+e+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),r=n,n=i,i=r),n="string"==typeof n?+n:n,a=He(n,i),qe(this,a,t),this}}function qe(e,n,i,a){var r=n._milliseconds,o=De(n._days),s=De(n._months);e.isValid()&&(a=null==a||a,r&&e._d.setTime(e._d.valueOf()+r*i),o&&U(e,"Date",E(e,"Date")+o*i),s&&ct(e,E(e,"Month")+s*i),a&&t.updateOffset(e,o||s))}function Ze(t,e){var n=t.diff(e,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"}function Xe(e,n){var i=e||xe(),a=Pe(i,this).startOf("day"),r=t.calendarFormat(this,a)||"sameElse",o=n&&(C(n[r])?n[r].call(this,i):n[r]);return this.format(o||this.localeData().calendar(r,this,xe(i)))}function Je(){return new y(this)}function Ke(t,e){var n=x(t)?t:xe(t);return!(!this.isValid()||!n.isValid())&&(e=Y(v(e)?"millisecond":e),"millisecond"===e?this.valueOf()>n.valueOf():n.valueOf()<this.clone().startOf(e).valueOf())}function Qe(t,e){var n=x(t)?t:xe(t);return!(!this.isValid()||!n.isValid())&&(e=Y(v(e)?"millisecond":e),"millisecond"===e?this.valueOf()<n.valueOf():this.clone().endOf(e).valueOf()<n.valueOf())}function $e(t,e,n,i){return i=i||"()",("("===i[0]?this.isAfter(t,n):!this.isBefore(t,n))&&(")"===i[1]?this.isBefore(e,n):!this.isAfter(e,n))}function tn(t,e){var n,i=x(t)?t:xe(t);return!(!this.isValid()||!i.isValid())&&(e=Y(e||"millisecond"),"millisecond"===e?this.valueOf()===i.valueOf():(n=i.valueOf(),this.clone().startOf(e).valueOf()<=n&&n<=this.clone().endOf(e).valueOf()))}function en(t,e){return this.isSame(t,e)||this.isAfter(t,e)}function nn(t,e){return this.isSame(t,e)||this.isBefore(t,e)}function an(t,e,n){var i,a,r,o;return this.isValid()?(i=Pe(t,this),i.isValid()?(a=6e4*(i.utcOffset()-this.utcOffset()),e=Y(e),"year"===e||"month"===e||"quarter"===e?(o=rn(this,i),"quarter"===e?o/=3:"year"===e&&(o/=12)):(r=this-i,o="second"===e?r/1e3:"minute"===e?r/6e4:"hour"===e?r/36e5:"day"===e?(r-a)/864e5:"week"===e?(r-a)/6048e5:r),n?o:k(o)):NaN):NaN}function rn(t,e){var n,i,a=12*(e.year()-t.year())+(e.month()-t.month()),r=t.clone().add(a,"months");return e-r<0?(n=t.clone().add(a-1,"months"),i=(e-r)/(r-n)):(n=t.clone().add(a+1,"months"),i=(e-r)/(n-r)),-(a+i)||0}function on(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function sn(){var t=this.clone().utc();return 0<t.year()&&t.year()<=9999?C(Date.prototype.toISOString)?this.toDate().toISOString():K(t,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):K(t,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}function ln(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var t="moment",e="";this.isLocal()||(t=0===this.utcOffset()?"moment.utc":"moment.parseZone",e="Z");var n="["+t+'("]',i=0<this.year()&&this.year()<=9999?"YYYY":"YYYYYY",a="-MM-DD[T]HH:mm:ss.SSS",r=e+'[")]';return this.format(n+i+a+r)}function un(e){e||(e=this.isUtc()?t.defaultFormatUtc:t.defaultFormat);var n=K(this,e);return this.localeData().postformat(n)}function dn(t,e){return this.isValid()&&(x(t)&&t.isValid()||xe(t).isValid())?He({to:this,from:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function cn(t){return this.from(xe(),t)}function hn(t,e){return this.isValid()&&(x(t)&&t.isValid()||xe(t).isValid())?He({from:this,to:t}).locale(this.locale()).humanize(!e):this.localeData().invalidDate()}function fn(t){return this.to(xe(),t)}function gn(t){var e;return void 0===t?this._locale._abbr:(e=ie(t),null!=e&&(this._locale=e),this)}function mn(){return this._locale}function pn(t){switch(t=Y(t)){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":case"date":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===t&&this.weekday(0),"isoWeek"===t&&this.isoWeekday(1),"quarter"===t&&this.month(3*Math.floor(this.month()/3)),this}function vn(t){return t=Y(t),void 0===t||"millisecond"===t?this:("date"===t&&(t="day"),this.startOf(t).add(1,"isoWeek"===t?"week":t).subtract(1,"ms"))}function bn(){return this._d.valueOf()-6e4*(this._offset||0)}function yn(){return Math.floor(this.valueOf()/1e3)}function xn(){return new Date(this.valueOf())}function kn(){var t=this;return[t.year(),t.month(),t.date(),t.hour(),t.minute(),t.second(),t.millisecond()]}function _n(){var t=this;return{years:t.year(),months:t.month(),date:t.date(),hours:t.hours(),minutes:t.minutes(),seconds:t.seconds(),milliseconds:t.milliseconds()}}function wn(){return this.isValid()?this.toISOString():null}function Sn(){return m(this)}function Mn(){return c({},g(this))}function Dn(){return g(this).overflow}function Cn(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function Tn(t,e){Z(0,[t,t.length],0,e)}function Pn(t){return On.call(this,t,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function In(t){return On.call(this,t,this.isoWeek(),this.isoWeekday(),1,4)}function An(){return Mt(this.year(),1,4)}function Fn(){var t=this.localeData()._week;return Mt(this.year(),t.dow,t.doy)}function On(t,e,n,i,a){var r;return null==t?St(this,i,a).year:(r=Mt(t,i,a),e>r&&(e=r),Rn.call(this,t,e,n,i,a))}function Rn(t,e,n,i,a){var r=wt(t,e,n,i,a),o=kt(r.year,0,r.dayOfYear);return this.year(o.getUTCFullYear()),this.month(o.getUTCMonth()),this.date(o.getUTCDate()),this}function Ln(t){return null==t?Math.ceil((this.month()+1)/3):this.month(3*(t-1)+this.month()%3)}function Vn(t){var e=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==t?e:this.add(t-e,"d")}function Wn(t,e){e[ua]=_(1e3*("0."+t))}function Yn(){return this._isUTC?"UTC":""}function Bn(){return this._isUTC?"Coordinated Universal Time":""}function zn(t){return xe(1e3*t)}function Nn(){return xe.apply(null,arguments).parseZone()}function Hn(t){return t}function En(t,e,n,i){var a=ie(),r=h().set(i,e);return a[n](r,t)}function Un(t,e,n){if(s(t)&&(e=t,t=void 0),t=t||"",null!=e)return En(t,e,n,"month");var i,a=[];for(i=0;i<12;i++)a[i]=En(t,i,n,"month");return a}function jn(t,e,n,i){"boolean"==typeof t?(s(e)&&(n=e,e=void 0),e=e||""):(e=t,n=e,t=!1,s(e)&&(n=e,e=void 0),e=e||"");var a=ie(),r=t?a._week.dow:0;if(null!=n)return En(e,(n+r)%7,i,"day");var o,l=[];for(o=0;o<7;o++)l[o]=En(e,(o+r)%7,i,"day");return l}function Gn(t,e){return Un(t,e,"months")}function qn(t,e){return Un(t,e,"monthsShort")}function Zn(t,e,n){return jn(t,e,n,"weekdays")}function Xn(t,e,n){return jn(t,e,n,"weekdaysShort")}function Jn(t,e,n){return jn(t,e,n,"weekdaysMin")}function Kn(){var t=this._data;return this._milliseconds=tr(this._milliseconds),this._days=tr(this._days),this._months=tr(this._months),t.milliseconds=tr(t.milliseconds),t.seconds=tr(t.seconds),t.minutes=tr(t.minutes),t.hours=tr(t.hours),t.months=tr(t.months),t.years=tr(t.years),this}function Qn(t,e,n,i){var a=He(e,n);return t._milliseconds+=i*a._milliseconds,t._days+=i*a._days,t._months+=i*a._months,t._bubble()}function $n(t,e){return Qn(this,t,e,1)}function ti(t,e){return Qn(this,t,e,-1)}function ei(t){return t<0?Math.floor(t):Math.ceil(t)}function ni(){var t,e,n,i,a,r=this._milliseconds,o=this._days,s=this._months,l=this._data;return r>=0&&o>=0&&s>=0||r<=0&&o<=0&&s<=0||(r+=864e5*ei(ai(s)+o),o=0,s=0),l.milliseconds=r%1e3,t=k(r/1e3),l.seconds=t%60,e=k(t/60),l.minutes=e%60,n=k(e/60),l.hours=n%24,o+=k(n/24),a=k(ii(o)),s+=a,o-=ei(ai(a)),i=k(s/12),s%=12,l.days=o,l.months=s,l.years=i,this}function ii(t){return 4800*t/146097}function ai(t){return 146097*t/4800}function ri(t){var e,n,i=this._milliseconds;if(t=Y(t),"month"===t||"year"===t)return e=this._days+i/864e5,n=this._months+ii(e),"month"===t?n:n/12;switch(e=this._days+Math.round(ai(this._months)),t){case"week":return e/7+i/6048e5;case"day":return e+i/864e5;case"hour":return 24*e+i/36e5;case"minute":return 1440*e+i/6e4;case"second":return 86400*e+i/1e3;case"millisecond":return Math.floor(864e5*e)+i;default:throw new Error("Unknown unit "+t)}}function oi(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*_(this._months/12)}function si(t){return function(){return this.as(t)}}function li(t){return t=Y(t),this[t+"s"]()}function ui(t){return function(){return this._data[t]}}function di(){return k(this.days()/7)}function ci(t,e,n,i,a){return a.relativeTime(e||1,!!n,t,i)}function hi(t,e,n){var i=He(t).abs(),a=pr(i.as("s")),r=pr(i.as("m")),o=pr(i.as("h")),s=pr(i.as("d")),l=pr(i.as("M")),u=pr(i.as("y")),d=a<vr.s&&["s",a]||r<=1&&["m"]||r<vr.m&&["mm",r]||o<=1&&["h"]||o<vr.h&&["hh",o]||s<=1&&["d"]||s<vr.d&&["dd",s]||l<=1&&["M"]||l<vr.M&&["MM",l]||u<=1&&["y"]||["yy",u];return d[2]=e,d[3]=+t>0,d[4]=n,ci.apply(null,d)}function fi(t){return void 0===t?pr:"function"==typeof t&&(pr=t,!0)}function gi(t,e){return void 0!==vr[t]&&(void 0===e?vr[t]:(vr[t]=e,!0))}function mi(t){var e=this.localeData(),n=hi(this,!t,e);return t&&(n=e.pastFuture(+this,n)),e.postformat(n)}function pi(){var t,e,n,i=br(this._milliseconds)/1e3,a=br(this._days),r=br(this._months);t=k(i/60),e=k(t/60),i%=60,t%=60,n=k(r/12),r%=12;var o=n,s=r,l=a,u=e,d=t,c=i,h=this.asSeconds();return h?(h<0?"-":"")+"P"+(o?o+"Y":"")+(s?s+"M":"")+(l?l+"D":"")+(u||d||c?"T":"")+(u?u+"H":"")+(d?d+"M":"")+(c?c+"S":""):"P0D"}var vi,bi;bi=Array.prototype.some?Array.prototype.some:function(t){for(var e=Object(this),n=e.length>>>0,i=0;i<n;i++)if(i in e&&t.call(this,e[i],i,e))return!0;return!1};var yi=bi,xi=t.momentProperties=[],ki=!1,_i={};t.suppressDeprecationWarnings=!1,t.deprecationHandler=null;var wi;wi=Object.keys?Object.keys:function(t){var e,n=[];for(e in t)d(t,e)&&n.push(e);return n};var Si,Mi=wi,Di={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ci={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},Ti="Invalid date",Pi="%d",Ii=/\d{1,2}/,Ai={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Fi={},Oi={},Ri=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Li=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Vi={},Wi={},Yi=/\d/,Bi=/\d\d/,zi=/\d{3}/,Ni=/\d{4}/,Hi=/[+-]?\d{6}/,Ei=/\d\d?/,Ui=/\d\d\d\d?/,ji=/\d\d\d\d\d\d?/,Gi=/\d{1,3}/,qi=/\d{1,4}/,Zi=/[+-]?\d{1,6}/,Xi=/\d+/,Ji=/[+-]?\d+/,Ki=/Z|[+-]\d\d:?\d\d/gi,Qi=/Z|[+-]\d\d(?::?\d\d)?/gi,$i=/[+-]?\d+(\.\d{1,3})?/,ta=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,ea={},na={},ia=0,aa=1,ra=2,oa=3,sa=4,la=5,ua=6,da=7,ca=8;Si=Array.prototype.indexOf?Array.prototype.indexOf:function(t){var e;for(e=0;e<this.length;++e)if(this[e]===t)return e;return-1};var ha=Si;Z("M",["MM",2],"Mo",function(){return this.month()+1}),Z("MMM",0,0,function(t){return this.localeData().monthsShort(this,t)}),Z("MMMM",0,0,function(t){return this.localeData().months(this,t)}),W("month","M"),z("month",8),$("M",Ei),$("MM",Ei,Bi),$("MMM",function(t,e){return e.monthsShortRegex(t)}),$("MMMM",function(t,e){return e.monthsRegex(t)}),it(["M","MM"],function(t,e){e[aa]=_(t)-1}),it(["MMM","MMMM"],function(t,e,n,i){var a=n._locale.monthsParse(t,i,n._strict);null!=a?e[aa]=a:g(n).invalidMonth=t});var fa=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,ga="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ma="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),pa=ta,va=ta;Z("Y",0,0,function(){var t=this.year();return t<=9999?""+t:"+"+t}),Z(0,["YY",2],0,function(){return this.year()%100}),Z(0,["YYYY",4],0,"year"),Z(0,["YYYYY",5],0,"year"),Z(0,["YYYYYY",6,!0],0,"year"),W("year","y"),z("year",1),$("Y",Ji),$("YY",Ei,Bi),$("YYYY",qi,Ni),$("YYYYY",Zi,Hi),$("YYYYYY",Zi,Hi),it(["YYYYY","YYYYYY"],ia),it("YYYY",function(e,n){n[ia]=2===e.length?t.parseTwoDigitYear(e):_(e)}),it("YY",function(e,n){n[ia]=t.parseTwoDigitYear(e)}),it("Y",function(t,e){e[ia]=parseInt(t,10)}),t.parseTwoDigitYear=function(t){return _(t)+(_(t)>68?1900:2e3)};var ba=H("FullYear",!0);Z("w",["ww",2],"wo","week"),Z("W",["WW",2],"Wo","isoWeek"),W("week","w"),W("isoWeek","W"),z("week",5),z("isoWeek",5),$("w",Ei),$("ww",Ei,Bi),$("W",Ei),$("WW",Ei,Bi),at(["w","ww","W","WW"],function(t,e,n,i){e[i.substr(0,1)]=_(t)});var ya={dow:0,doy:6};Z("d",0,"do","day"),Z("dd",0,0,function(t){return this.localeData().weekdaysMin(this,t)}),Z("ddd",0,0,function(t){return this.localeData().weekdaysShort(this,t)}),Z("dddd",0,0,function(t){return this.localeData().weekdays(this,t)}),Z("e",0,0,"weekday"),Z("E",0,0,"isoWeekday"),W("day","d"),W("weekday","e"),W("isoWeekday","E"),z("day",11),z("weekday",11),z("isoWeekday",11),$("d",Ei),$("e",Ei),$("E",Ei),$("dd",function(t,e){return e.weekdaysMinRegex(t)}),$("ddd",function(t,e){return e.weekdaysShortRegex(t)}),$("dddd",function(t,e){return e.weekdaysRegex(t)}),at(["dd","ddd","dddd"],function(t,e,n,i){var a=n._locale.weekdaysParse(t,i,n._strict);null!=a?e.d=a:g(n).invalidWeekday=t}),at(["d","e","E"],function(t,e,n,i){e[i]=_(t)});var xa="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),ka="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),_a="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),wa=ta,Sa=ta,Ma=ta;Z("H",["HH",2],0,"hour"),Z("h",["hh",2],0,jt),Z("k",["kk",2],0,Gt),Z("hmm",0,0,function(){return""+jt.apply(this)+q(this.minutes(),2)}),Z("hmmss",0,0,function(){return""+jt.apply(this)+q(this.minutes(),2)+q(this.seconds(),2)}),Z("Hmm",0,0,function(){return""+this.hours()+q(this.minutes(),2)}),Z("Hmmss",0,0,function(){return""+this.hours()+q(this.minutes(),2)+q(this.seconds(),2)}),qt("a",!0),qt("A",!1),W("hour","h"),z("hour",13),$("a",Zt),$("A",Zt),$("H",Ei),$("h",Ei),$("HH",Ei,Bi),$("hh",Ei,Bi),$("hmm",Ui),$("hmmss",ji),$("Hmm",Ui),$("Hmmss",ji),it(["H","HH"],oa),it(["a","A"],function(t,e,n){n._isPm=n._locale.isPM(t),n._meridiem=t}),it(["h","hh"],function(t,e,n){e[oa]=_(t),g(n).bigHour=!0}),it("hmm",function(t,e,n){var i=t.length-2;e[oa]=_(t.substr(0,i)),e[sa]=_(t.substr(i)),g(n).bigHour=!0}),it("hmmss",function(t,e,n){var i=t.length-4,a=t.length-2;e[oa]=_(t.substr(0,i)),e[sa]=_(t.substr(i,2)),e[la]=_(t.substr(a)),g(n).bigHour=!0}),it("Hmm",function(t,e,n){var i=t.length-2;e[oa]=_(t.substr(0,i)),e[sa]=_(t.substr(i))}),it("Hmmss",function(t,e,n){var i=t.length-4,a=t.length-2;e[oa]=_(t.substr(0,i)),e[sa]=_(t.substr(i,2)),e[la]=_(t.substr(a))});var Da,Ca=/[ap]\.?m?\.?/i,Ta=H("Hours",!0),Pa={calendar:Di,longDateFormat:Ci,invalidDate:Ti,ordinal:Pi,ordinalParse:Ii,relativeTime:Ai,months:ga,monthsShort:ma,week:ya,weekdays:xa,weekdaysMin:_a,weekdaysShort:ka,meridiemParse:Ca},Ia={},Aa={},Fa=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Oa=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ra=/Z|[+-]\d\d(?::?\d\d)?/,La=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],Va=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Wa=/^\/?Date\((\-?\d+)/i;
|
12 |
+
t.createFromInputFallback=M("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(t){t._d=new Date(t._i+(t._useUTC?" UTC":""))}),t.ISO_8601=function(){};var Ya=M("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=xe.apply(null,arguments);return this.isValid()&&t.isValid()?t<this?this:t:p()}),Ba=M("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var t=xe.apply(null,arguments);return this.isValid()&&t.isValid()?t>this?this:t:p()}),za=function(){return Date.now?Date.now():+new Date};Ce("Z",":"),Ce("ZZ",""),$("Z",Qi),$("ZZ",Qi),it(["Z","ZZ"],function(t,e,n){n._useUTC=!0,n._tzm=Te(Qi,t)});var Na=/([\+\-]|\d\d)/gi;t.updateOffset=function(){};var Ha=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Ea=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;He.fn=Se.prototype;var Ua=Ge(1,"add"),ja=Ge(-1,"subtract");t.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",t.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Ga=M("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(t){return void 0===t?this.localeData():this.locale(t)});Z(0,["gg",2],0,function(){return this.weekYear()%100}),Z(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Tn("gggg","weekYear"),Tn("ggggg","weekYear"),Tn("GGGG","isoWeekYear"),Tn("GGGGG","isoWeekYear"),W("weekYear","gg"),W("isoWeekYear","GG"),z("weekYear",1),z("isoWeekYear",1),$("G",Ji),$("g",Ji),$("GG",Ei,Bi),$("gg",Ei,Bi),$("GGGG",qi,Ni),$("gggg",qi,Ni),$("GGGGG",Zi,Hi),$("ggggg",Zi,Hi),at(["gggg","ggggg","GGGG","GGGGG"],function(t,e,n,i){e[i.substr(0,2)]=_(t)}),at(["gg","GG"],function(e,n,i,a){n[a]=t.parseTwoDigitYear(e)}),Z("Q",0,"Qo","quarter"),W("quarter","Q"),z("quarter",7),$("Q",Yi),it("Q",function(t,e){e[aa]=3*(_(t)-1)}),Z("D",["DD",2],"Do","date"),W("date","D"),z("date",9),$("D",Ei),$("DD",Ei,Bi),$("Do",function(t,e){return t?e._ordinalParse:e._ordinalParseLenient}),it(["D","DD"],ra),it("Do",function(t,e){e[ra]=_(t.match(Ei)[0],10)});var qa=H("Date",!0);Z("DDD",["DDDD",3],"DDDo","dayOfYear"),W("dayOfYear","DDD"),z("dayOfYear",4),$("DDD",Gi),$("DDDD",zi),it(["DDD","DDDD"],function(t,e,n){n._dayOfYear=_(t)}),Z("m",["mm",2],0,"minute"),W("minute","m"),z("minute",14),$("m",Ei),$("mm",Ei,Bi),it(["m","mm"],sa);var Za=H("Minutes",!1);Z("s",["ss",2],0,"second"),W("second","s"),z("second",15),$("s",Ei),$("ss",Ei,Bi),it(["s","ss"],la);var Xa=H("Seconds",!1);Z("S",0,0,function(){return~~(this.millisecond()/100)}),Z(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Z(0,["SSS",3],0,"millisecond"),Z(0,["SSSS",4],0,function(){return 10*this.millisecond()}),Z(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),Z(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),Z(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),Z(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),Z(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),W("millisecond","ms"),z("millisecond",16),$("S",Gi,Yi),$("SS",Gi,Bi),$("SSS",Gi,zi);var Ja;for(Ja="SSSS";Ja.length<=9;Ja+="S")$(Ja,Xi);for(Ja="S";Ja.length<=9;Ja+="S")it(Ja,Wn);var Ka=H("Milliseconds",!1);Z("z",0,0,"zoneAbbr"),Z("zz",0,0,"zoneName");var Qa=y.prototype;Qa.add=Ua,Qa.calendar=Xe,Qa.clone=Je,Qa.diff=an,Qa.endOf=vn,Qa.format=un,Qa.from=dn,Qa.fromNow=cn,Qa.to=hn,Qa.toNow=fn,Qa.get=j,Qa.invalidAt=Dn,Qa.isAfter=Ke,Qa.isBefore=Qe,Qa.isBetween=$e,Qa.isSame=tn,Qa.isSameOrAfter=en,Qa.isSameOrBefore=nn,Qa.isValid=Sn,Qa.lang=Ga,Qa.locale=gn,Qa.localeData=mn,Qa.max=Ba,Qa.min=Ya,Qa.parsingFlags=Mn,Qa.set=G,Qa.startOf=pn,Qa.subtract=ja,Qa.toArray=kn,Qa.toObject=_n,Qa.toDate=xn,Qa.toISOString=sn,Qa.inspect=ln,Qa.toJSON=wn,Qa.toString=on,Qa.unix=yn,Qa.valueOf=bn,Qa.creationData=Cn,Qa.year=ba,Qa.isLeapYear=yt,Qa.weekYear=Pn,Qa.isoWeekYear=In,Qa.quarter=Qa.quarters=Ln,Qa.month=ht,Qa.daysInMonth=ft,Qa.week=Qa.weeks=Pt,Qa.isoWeek=Qa.isoWeeks=It,Qa.weeksInYear=Fn,Qa.isoWeeksInYear=An,Qa.date=qa,Qa.day=Qa.days=Yt,Qa.weekday=Bt,Qa.isoWeekday=zt,Qa.dayOfYear=Vn,Qa.hour=Qa.hours=Ta,Qa.minute=Qa.minutes=Za,Qa.second=Qa.seconds=Xa,Qa.millisecond=Qa.milliseconds=Ka,Qa.utcOffset=Ae,Qa.utc=Oe,Qa.local=Re,Qa.parseZone=Le,Qa.hasAlignedHourOffset=Ve,Qa.isDST=We,Qa.isLocal=Be,Qa.isUtcOffset=ze,Qa.isUtc=Ne,Qa.isUTC=Ne,Qa.zoneAbbr=Yn,Qa.zoneName=Bn,Qa.dates=M("dates accessor is deprecated. Use date instead.",qa),Qa.months=M("months accessor is deprecated. Use month instead",ht),Qa.years=M("years accessor is deprecated. Use year instead",ba),Qa.zone=M("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Fe),Qa.isDSTShifted=M("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Ye);var $a=I.prototype;$a.calendar=A,$a.longDateFormat=F,$a.invalidDate=O,$a.ordinal=R,$a.preparse=Hn,$a.postformat=Hn,$a.relativeTime=L,$a.pastFuture=V,$a.set=T,$a.months=st,$a.monthsShort=lt,$a.monthsParse=dt,$a.monthsRegex=mt,$a.monthsShortRegex=gt,$a.week=Dt,$a.firstDayOfYear=Tt,$a.firstDayOfWeek=Ct,$a.weekdays=Ot,$a.weekdaysMin=Lt,$a.weekdaysShort=Rt,$a.weekdaysParse=Wt,$a.weekdaysRegex=Nt,$a.weekdaysShortRegex=Ht,$a.weekdaysMinRegex=Et,$a.isPM=Xt,$a.meridiem=Jt,te("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(t){var e=t%10,n=1===_(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th";return t+n}}),t.lang=M("moment.lang is deprecated. Use moment.locale instead.",te),t.langData=M("moment.langData is deprecated. Use moment.localeData instead.",ie);var tr=Math.abs,er=si("ms"),nr=si("s"),ir=si("m"),ar=si("h"),rr=si("d"),or=si("w"),sr=si("M"),lr=si("y"),ur=ui("milliseconds"),dr=ui("seconds"),cr=ui("minutes"),hr=ui("hours"),fr=ui("days"),gr=ui("months"),mr=ui("years"),pr=Math.round,vr={s:45,m:45,h:22,d:26,M:11},br=Math.abs,yr=Se.prototype;return yr.abs=Kn,yr.add=$n,yr.subtract=ti,yr.as=ri,yr.asMilliseconds=er,yr.asSeconds=nr,yr.asMinutes=ir,yr.asHours=ar,yr.asDays=rr,yr.asWeeks=or,yr.asMonths=sr,yr.asYears=lr,yr.valueOf=oi,yr._bubble=ni,yr.get=li,yr.milliseconds=ur,yr.seconds=dr,yr.minutes=cr,yr.hours=hr,yr.days=fr,yr.weeks=di,yr.months=gr,yr.years=mr,yr.humanize=mi,yr.toISOString=pi,yr.toString=pi,yr.toJSON=pi,yr.locale=gn,yr.localeData=mn,yr.toIsoString=M("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",pi),yr.lang=Ga,Z("X",0,0,"unix"),Z("x",0,0,"valueOf"),$("x",Ji),$("X",$i),it("X",function(t,e,n){n._d=new Date(1e3*parseFloat(t,10))}),it("x",function(t,e,n){n._d=new Date(_(t))}),t.version="2.17.1",i(xe),t.fn=Qa,t.min=_e,t.max=we,t.now=za,t.utc=h,t.unix=zn,t.months=Gn,t.isDate=l,t.locale=te,t.invalid=p,t.duration=He,t.isMoment=x,t.weekdays=Zn,t.parseZone=Nn,t.localeData=ie,t.isDuration=Me,t.monthsShort=qn,t.weekdaysMin=Jn,t.defineLocale=ee,t.updateLocale=ne,t.locales=ae,t.weekdaysShort=Xn,t.normalizeUnits=Y,t.relativeTimeRounding=fi,t.relativeTimeThreshold=gi,t.calendarFormat=Ze,t.prototype=Qa,t})},{}],7:[function(t,e,n){var i=t(28)();t(26)(i),t(42)(i),t(22)(i),t(31)(i),t(25)(i),t(21)(i),t(23)(i),t(24)(i),t(29)(i),t(33)(i),t(34)(i),t(32)(i),t(35)(i),t(30)(i),t(27)(i),t(36)(i),t(37)(i),t(38)(i),t(39)(i),t(40)(i),t(45)(i),t(43)(i),t(44)(i),t(46)(i),t(47)(i),t(48)(i),t(15)(i),t(16)(i),t(17)(i),t(18)(i),t(19)(i),t(20)(i),t(8)(i),t(9)(i),t(10)(i),t(11)(i),t(12)(i),t(13)(i),t(14)(i),window.Chart=e.exports=i},{10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,42:42,43:43,44:44,45:45,46:46,47:47,48:48,8:8,9:9}],8:[function(t,e,n){"use strict";e.exports=function(t){t.Bar=function(e,n){return n.type="bar",new t(e,n)}}},{}],9:[function(t,e,n){"use strict";e.exports=function(t){t.Bubble=function(e,n){return n.type="bubble",new t(e,n)}}},{}],10:[function(t,e,n){"use strict";e.exports=function(t){t.Doughnut=function(e,n){return n.type="doughnut",new t(e,n)}}},{}],11:[function(t,e,n){"use strict";e.exports=function(t){t.Line=function(e,n){return n.type="line",new t(e,n)}}},{}],12:[function(t,e,n){"use strict";e.exports=function(t){t.PolarArea=function(e,n){return n.type="polarArea",new t(e,n)}}},{}],13:[function(t,e,n){"use strict";e.exports=function(t){t.Radar=function(e,n){return n.type="radar",new t(e,n)}}},{}],14:[function(t,e,n){"use strict";e.exports=function(t){var e={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-1"}],yAxes:[{type:"linear",position:"left",id:"y-axis-1"}]},tooltips:{callbacks:{title:function(){return""},label:function(t){return"("+t.xLabel+", "+t.yLabel+")"}}}};t.defaults.scatter=e,t.controllers.scatter=t.controllers.line,t.Scatter=function(e,n){return n.type="scatter",new t(e,n)}}},{}],15:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.bar={hover:{mode:"label"},scales:{xAxes:[{type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}],yAxes:[{type:"linear"}]}},t.controllers.bar=t.DatasetController.extend({dataElementType:t.elements.Rectangle,initialize:function(e,n){t.DatasetController.prototype.initialize.call(this,e,n);var i=this,a=i.getMeta(),r=i.getDataset();a.stack=r.stack,a.bar=!0},getStackCount:function(){var t=this,n=t.getMeta(),i=t.getScaleForId(n.yAxisID),a=[];return e.each(t.chart.data.datasets,function(e,n){var r=t.chart.getDatasetMeta(n);r.bar&&t.chart.isDatasetVisible(n)&&(i.options.stacked===!1||i.options.stacked===!0&&a.indexOf(r.stack)===-1||void 0===i.options.stacked&&(void 0===r.stack||a.indexOf(r.stack)===-1))&&a.push(r.stack)},t),a.length},update:function(t){var n=this;e.each(n.getMeta().data,function(e,i){n.updateElement(e,i,t)},n)},updateElement:function(t,n,i){var a=this,r=a.getMeta(),o=a.getScaleForId(r.xAxisID),s=a.getScaleForId(r.yAxisID),l=s.getBasePixel(),u=a.chart.options.elements.rectangle,d=t.custom||{},c=a.getDataset();t._xScale=o,t._yScale=s,t._datasetIndex=a.index,t._index=n;var h=a.getRuler(n);t._model={x:a.calculateBarX(n,a.index,h),y:i?l:a.calculateBarY(n,a.index),label:a.chart.data.labels[n],datasetLabel:c.label,horizontal:!1,base:i?l:a.calculateBarBase(a.index,n),width:a.calculateBarWidth(h),backgroundColor:d.backgroundColor?d.backgroundColor:e.getValueAtIndexOrDefault(c.backgroundColor,n,u.backgroundColor),borderSkipped:d.borderSkipped?d.borderSkipped:u.borderSkipped,borderColor:d.borderColor?d.borderColor:e.getValueAtIndexOrDefault(c.borderColor,n,u.borderColor),borderWidth:d.borderWidth?d.borderWidth:e.getValueAtIndexOrDefault(c.borderWidth,n,u.borderWidth)},t.pivot()},calculateBarBase:function(t,e){var n=this,i=n.getMeta(),a=n.getScaleForId(i.yAxisID),r=a.getBaseValue(),o=r;if(a.options.stacked===!0||void 0===a.options.stacked&&void 0!==i.stack){for(var s=n.chart,l=s.data.datasets,u=Number(l[t].data[e]),d=0;d<t;d++){var c=l[d],h=s.getDatasetMeta(d);if(h.bar&&h.yAxisID===a.id&&s.isDatasetVisible(d)&&i.stack===h.stack){var f=Number(c.data[e]);r+=u<0?Math.min(f,o):Math.max(f,o)}}return a.getPixelForValue(r)}return a.getBasePixel()},getRuler:function(){var t=this,e=t.getMeta(),n=t.getScaleForId(e.xAxisID),i=t.getStackCount(),a=n.width/n.ticks.length,r=a*n.options.categoryPercentage,o=(a-a*n.options.categoryPercentage)/2,s=r/i,l=s*n.options.barPercentage,u=s-s*n.options.barPercentage;return{stackCount:i,tickWidth:a,categoryWidth:r,categorySpacing:o,fullBarWidth:s,barWidth:l,barSpacing:u}},calculateBarWidth:function(t){var e=this,n=e.getMeta(),i=e.getScaleForId(n.xAxisID);return i.options.barThickness?i.options.barThickness:t.barWidth},getStackIndex:function(t){var e,n,i=this,a=i.chart.getDatasetMeta(t),r=i.getScaleForId(a.yAxisID),o=[a.stack];for(n=0;n<t;++n)e=this.chart.getDatasetMeta(n),e.bar&&this.chart.isDatasetVisible(n)&&(r.options.stacked===!1||r.options.stacked===!0&&o.indexOf(e.stack)===-1||void 0===r.options.stacked&&(void 0===e.stack||o.indexOf(e.stack)===-1))&&o.push(e.stack);return o.length-1},calculateBarX:function(t,e,n){var i=this,a=i.getMeta(),r=i.getScaleForId(a.xAxisID),o=i.getStackIndex(e),s=r.getPixelForValue(null,t,e,i.chart.isCombo);return s-=i.chart.isCombo?n.tickWidth/2:0,s+n.barWidth/2+n.categorySpacing+n.barWidth*o+n.barSpacing/2+n.barSpacing*o},calculateBarY:function(t,e){var n=this,i=n.getMeta(),a=n.getScaleForId(i.yAxisID),r=Number(n.getDataset().data[t]);if(a.options.stacked||void 0===a.options.stacked&&void 0!==i.stack){for(var o=a.getBaseValue(),s=o,l=o,u=0;u<e;u++){var d=n.chart.data.datasets[u],c=n.chart.getDatasetMeta(u);if(c.bar&&c.yAxisID===a.id&&n.chart.isDatasetVisible(u)&&i.stack===c.stack){var h=Number(d.data[t]);h<0?l+=h||0:s+=h||0}}return r<0?a.getPixelForValue(l+r):a.getPixelForValue(s+r)}return a.getPixelForValue(r)},draw:function(e){var n,i,a=this,r=e||1,o=a.getMeta().data,s=a.getDataset();for(t.canvasHelpers.clipArea(a.chart.chart.ctx,a.chart.chartArea),n=0,i=o.length;n<i;++n){var l=s.data[n];null===l||void 0===l||isNaN(l)||o[n].transition(r).draw()}t.canvasHelpers.unclipArea(a.chart.chart.ctx)},setHoverStyle:function(t){var n=this.chart.data.datasets[t._datasetIndex],i=t._index,a=t.custom||{},r=t._model;r.backgroundColor=a.hoverBackgroundColor?a.hoverBackgroundColor:e.getValueAtIndexOrDefault(n.hoverBackgroundColor,i,e.getHoverColor(r.backgroundColor)),r.borderColor=a.hoverBorderColor?a.hoverBorderColor:e.getValueAtIndexOrDefault(n.hoverBorderColor,i,e.getHoverColor(r.borderColor)),r.borderWidth=a.hoverBorderWidth?a.hoverBorderWidth:e.getValueAtIndexOrDefault(n.hoverBorderWidth,i,r.borderWidth)},removeHoverStyle:function(t){var n=this.chart.data.datasets[t._datasetIndex],i=t._index,a=t.custom||{},r=t._model,o=this.chart.options.elements.rectangle;r.backgroundColor=a.backgroundColor?a.backgroundColor:e.getValueAtIndexOrDefault(n.backgroundColor,i,o.backgroundColor),r.borderColor=a.borderColor?a.borderColor:e.getValueAtIndexOrDefault(n.borderColor,i,o.borderColor),r.borderWidth=a.borderWidth?a.borderWidth:e.getValueAtIndexOrDefault(n.borderWidth,i,o.borderWidth)}}),t.defaults.horizontalBar={hover:{mode:"label"},scales:{xAxes:[{type:"linear",position:"bottom"}],yAxes:[{position:"left",type:"category",categoryPercentage:.8,barPercentage:.9,gridLines:{offsetGridLines:!0}}]},elements:{rectangle:{borderSkipped:"left"}},tooltips:{callbacks:{title:function(t,e){var n="";return t.length>0&&(t[0].yLabel?n=t[0].yLabel:e.labels.length>0&&t[0].index<e.labels.length&&(n=e.labels[t[0].index])),n},label:function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n+": "+t.xLabel}}}},t.controllers.horizontalBar=t.controllers.bar.extend({getStackCount:function(){var t=this,n=t.getMeta(),i=t.getScaleForId(n.xAxisID),a=[];return e.each(t.chart.data.datasets,function(e,n){var r=t.chart.getDatasetMeta(n);r.bar&&t.chart.isDatasetVisible(n)&&(i.options.stacked===!1||i.options.stacked===!0&&a.indexOf(r.stack)===-1||void 0===i.options.stacked&&(void 0===r.stack||a.indexOf(r.stack)===-1))&&a.push(r.stack)},t),a.length},updateElement:function(t,n,i){var a=this,r=a.getMeta(),o=a.getScaleForId(r.xAxisID),s=a.getScaleForId(r.yAxisID),l=o.getBasePixel(),u=t.custom||{},d=a.getDataset(),c=a.chart.options.elements.rectangle;t._xScale=o,t._yScale=s,t._datasetIndex=a.index,t._index=n;var h=a.getRuler(n);t._model={x:i?l:a.calculateBarX(n,a.index),y:a.calculateBarY(n,a.index,h),label:a.chart.data.labels[n],datasetLabel:d.label,horizontal:!0,base:i?l:a.calculateBarBase(a.index,n),height:a.calculateBarHeight(h),backgroundColor:u.backgroundColor?u.backgroundColor:e.getValueAtIndexOrDefault(d.backgroundColor,n,c.backgroundColor),borderSkipped:u.borderSkipped?u.borderSkipped:c.borderSkipped,borderColor:u.borderColor?u.borderColor:e.getValueAtIndexOrDefault(d.borderColor,n,c.borderColor),borderWidth:u.borderWidth?u.borderWidth:e.getValueAtIndexOrDefault(d.borderWidth,n,c.borderWidth)},t.pivot()},calculateBarBase:function(t,e){var n=this,i=n.getMeta(),a=n.getScaleForId(i.xAxisID),r=a.getBaseValue(),o=r;if(a.options.stacked||void 0===a.options.stacked&&void 0!==i.stack){for(var s=n.chart,l=s.data.datasets,u=Number(l[t].data[e]),d=0;d<t;d++){var c=l[d],h=s.getDatasetMeta(d);if(h.bar&&h.xAxisID===a.id&&s.isDatasetVisible(d)&&i.stack===h.stack){var f=Number(c.data[e]);r+=u<0?Math.min(f,o):Math.max(f,o)}}return a.getPixelForValue(r)}return a.getBasePixel()},getRuler:function(){var t=this,e=t.getMeta(),n=t.getScaleForId(e.yAxisID),i=t.getStackCount(),a=n.height/n.ticks.length,r=a*n.options.categoryPercentage,o=(a-a*n.options.categoryPercentage)/2,s=r/i,l=s*n.options.barPercentage,u=s-s*n.options.barPercentage;return{stackCount:i,tickHeight:a,categoryHeight:r,categorySpacing:o,fullBarHeight:s,barHeight:l,barSpacing:u}},calculateBarHeight:function(t){var e=this,n=e.getMeta(),i=e.getScaleForId(n.yAxisID);return i.options.barThickness?i.options.barThickness:t.barHeight},getStackIndex:function(t){var e,n,i=this,a=i.chart.getDatasetMeta(t),r=i.getScaleForId(a.xAxisID),o=[a.stack];for(n=0;n<t;++n)e=this.chart.getDatasetMeta(n),e.bar&&this.chart.isDatasetVisible(n)&&(r.options.stacked===!1||r.options.stacked===!0&&o.indexOf(e.stack)===-1||void 0===r.options.stacked&&(void 0===e.stack||o.indexOf(e.stack)===-1))&&o.push(e.stack);return o.length-1},calculateBarX:function(t,e){var n=this,i=n.getMeta(),a=n.getScaleForId(i.xAxisID),r=Number(n.getDataset().data[t]);if(a.options.stacked||void 0===a.options.stacked&&void 0!==i.stack){for(var o=a.getBaseValue(),s=o,l=o,u=0;u<e;u++){var d=n.chart.data.datasets[u],c=n.chart.getDatasetMeta(u);if(c.bar&&c.xAxisID===a.id&&n.chart.isDatasetVisible(u)&&i.stack===c.stack){var h=Number(d.data[t]);h<0?l+=h||0:s+=h||0}}return r<0?a.getPixelForValue(l+r):a.getPixelForValue(s+r)}return a.getPixelForValue(r)},calculateBarY:function(t,e,n){var i=this,a=i.getMeta(),r=i.getScaleForId(a.yAxisID),o=i.getStackIndex(e),s=r.getPixelForValue(null,t,e,i.chart.isCombo);return s-=i.chart.isCombo?n.tickHeight/2:0,s+n.barHeight/2+n.categorySpacing+n.barHeight*o+n.barSpacing/2+n.barSpacing*o}})}},{}],16:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.bubble={hover:{mode:"single"},scales:{xAxes:[{type:"linear",position:"bottom",id:"x-axis-0"}],yAxes:[{type:"linear",position:"left",id:"y-axis-0"}]},tooltips:{callbacks:{title:function(){return""},label:function(t,e){var n=e.datasets[t.datasetIndex].label||"",i=e.datasets[t.datasetIndex].data[t.index];return n+": ("+t.xLabel+", "+t.yLabel+", "+i.r+")"}}}},t.controllers.bubble=t.DatasetController.extend({dataElementType:t.elements.Point,update:function(t){var n=this,i=n.getMeta(),a=i.data;e.each(a,function(e,i){n.updateElement(e,i,t)})},updateElement:function(n,i,a){var r=this,o=r.getMeta(),s=r.getScaleForId(o.xAxisID),l=r.getScaleForId(o.yAxisID),u=n.custom||{},d=r.getDataset(),c=d.data[i],h=r.chart.options.elements.point,f=r.index;e.extend(n,{_xScale:s,_yScale:l,_datasetIndex:f,_index:i,_model:{x:a?s.getPixelForDecimal(.5):s.getPixelForValue("object"==typeof c?c:NaN,i,f,r.chart.isCombo),y:a?l.getBasePixel():l.getPixelForValue(c,i,f),radius:a?0:u.radius?u.radius:r.getRadius(c),hitRadius:u.hitRadius?u.hitRadius:e.getValueAtIndexOrDefault(d.hitRadius,i,h.hitRadius)}}),t.DatasetController.prototype.removeHoverStyle.call(r,n,h);var g=n._model;g.skip=u.skip?u.skip:isNaN(g.x)||isNaN(g.y),n.pivot()},getRadius:function(t){return t.r||this.chart.options.elements.point.radius},setHoverStyle:function(n){var i=this;t.DatasetController.prototype.setHoverStyle.call(i,n);var a=i.chart.data.datasets[n._datasetIndex],r=n._index,o=n.custom||{},s=n._model;s.radius=o.hoverRadius?o.hoverRadius:e.getValueAtIndexOrDefault(a.hoverRadius,r,i.chart.options.elements.point.hoverRadius)+i.getRadius(a.data[r])},removeHoverStyle:function(e){var n=this;t.DatasetController.prototype.removeHoverStyle.call(n,e,n.chart.options.elements.point);var i=n.chart.data.datasets[e._datasetIndex].data[e._index],a=e.custom||{},r=e._model;r.radius=a.radius?a.radius:n.getRadius(i)}})}},{}],17:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers,n=t.defaults;n.doughnut={animation:{animateRotate:!0,animateScale:!1},aspectRatio:1,hover:{mode:"single"},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var r=0;r<i[0].data.length;++r)e.push('<li><span style="background-color:'+i[0].backgroundColor[r]+'"></span>'),a[r]&&e.push(a[r]),e.push("</li>");return e.push("</ul>"),e.join("")},legend:{labels:{generateLabels:function(t){var n=t.data;return n.labels.length&&n.datasets.length?n.labels.map(function(i,a){var r=t.getDatasetMeta(0),o=n.datasets[0],s=r.data[a],l=s&&s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(o.backgroundColor,a,d.backgroundColor),h=l.borderColor?l.borderColor:u(o.borderColor,a,d.borderColor),f=l.borderWidth?l.borderWidth:u(o.borderWidth,a,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(o.data[a])||r.data[a].hidden,index:a}}):[]}},onClick:function(t,e){var n,i,a,r=e.index,o=this.chart;for(n=0,i=(o.data.datasets||[]).length;n<i;++n)a=o.getDatasetMeta(n),a.data[r]&&(a.data[r].hidden=!a.data[r].hidden);o.update()}},cutoutPercentage:50,rotation:Math.PI*-.5,circumference:2*Math.PI,tooltips:{callbacks:{title:function(){return""},label:function(t,n){var i=n.labels[t.index],a=": "+n.datasets[t.datasetIndex].data[t.index];return e.isArray(i)?(i=i.slice(),i[0]+=a):i+=a,i}}}},n.pie=e.clone(n.doughnut),e.extend(n.pie,{cutoutPercentage:0}),t.controllers.doughnut=t.controllers.pie=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,getRingIndex:function(t){for(var e=0,n=0;n<t;++n)this.chart.isDatasetVisible(n)&&++e;return e},update:function(t){var n=this,i=n.chart,a=i.chartArea,r=i.options,o=r.elements.arc,s=a.right-a.left-o.borderWidth,l=a.bottom-a.top-o.borderWidth,u=Math.min(s,l),d={x:0,y:0},c=n.getMeta(),h=r.cutoutPercentage,f=r.circumference;if(f<2*Math.PI){var g=r.rotation%(2*Math.PI);g+=2*Math.PI*(g>=Math.PI?-1:g<-Math.PI?1:0);var m=g+f,p={x:Math.cos(g),y:Math.sin(g)},v={x:Math.cos(m),y:Math.sin(m)},b=g<=0&&0<=m||g<=2*Math.PI&&2*Math.PI<=m,y=g<=.5*Math.PI&&.5*Math.PI<=m||g<=2.5*Math.PI&&2.5*Math.PI<=m,x=g<=-Math.PI&&-Math.PI<=m||g<=Math.PI&&Math.PI<=m,k=g<=.5*-Math.PI&&.5*-Math.PI<=m||g<=1.5*Math.PI&&1.5*Math.PI<=m,_=h/100,w={x:x?-1:Math.min(p.x*(p.x<0?1:_),v.x*(v.x<0?1:_)),y:k?-1:Math.min(p.y*(p.y<0?1:_),v.y*(v.y<0?1:_))},S={x:b?1:Math.max(p.x*(p.x>0?1:_),v.x*(v.x>0?1:_)),y:y?1:Math.max(p.y*(p.y>0?1:_),v.y*(v.y>0?1:_))},M={width:.5*(S.x-w.x),height:.5*(S.y-w.y)};u=Math.min(s/M.width,l/M.height),d={x:(S.x+w.x)*-.5,y:(S.y+w.y)*-.5}}i.borderWidth=n.getMaxBorderWidth(c.data),i.outerRadius=Math.max((u-i.borderWidth)/2,0),i.innerRadius=Math.max(h?i.outerRadius/100*h:0,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),i.offsetX=d.x*i.outerRadius,i.offsetY=d.y*i.outerRadius,c.total=n.calculateTotal(),n.outerRadius=i.outerRadius-i.radiusLength*n.getRingIndex(n.index),n.innerRadius=Math.max(n.outerRadius-i.radiusLength,0),e.each(c.data,function(e,i){n.updateElement(e,i,t)})},updateElement:function(t,n,i){var a=this,r=a.chart,o=r.chartArea,s=r.options,l=s.animation,u=(o.left+o.right)/2,d=(o.top+o.bottom)/2,c=s.rotation,h=s.rotation,f=a.getDataset(),g=i&&l.animateRotate?0:t.hidden?0:a.calculateCircumference(f.data[n])*(s.circumference/(2*Math.PI)),m=i&&l.animateScale?0:a.innerRadius,p=i&&l.animateScale?0:a.outerRadius,v=e.getValueAtIndexOrDefault;e.extend(t,{_datasetIndex:a.index,_index:n,_model:{x:u+r.offsetX,y:d+r.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:p,innerRadius:m,label:v(f.label,n,r.data.labels[n])}});var b=t._model;this.removeHoverStyle(t),i&&l.animateRotate||(0===n?b.startAngle=s.rotation:b.startAngle=a.getMeta().data[n-1]._model.endAngle,b.endAngle=b.startAngle+b.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,n=this.getDataset(),i=this.getMeta(),a=0;return e.each(i.data,function(e,i){t=n.data[i],isNaN(t)||e.hidden||(a+=Math.abs(t))}),a},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,n,i=0,a=this.index,r=t.length,o=0;o<r;o++)e=t[o]._model?t[o]._model.borderWidth:0,n=t[o]._chart?t[o]._chart.config.data.datasets[a].hoverBorderWidth:0,i=e>i?e:i,i=n>i?n:i;return i}})}},{}],18:[function(t,e,n){"use strict";e.exports=function(t){function e(t,e){return n.getValueOrDefault(t.showLine,e.showLines)}var n=t.helpers;t.defaults.line={showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}},t.controllers.line=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,update:function(t){var i,a,r,o=this,s=o.getMeta(),l=s.dataset,u=s.data||[],d=o.chart.options,c=d.elements.line,h=o.getScaleForId(s.yAxisID),f=o.getDataset(),g=e(f,d);for(g&&(r=l.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),l._scale=h,l._datasetIndex=o.index,l._children=u,l._model={spanGaps:f.spanGaps?f.spanGaps:d.spanGaps,tension:r.tension?r.tension:n.getValueOrDefault(f.lineTension,c.tension),backgroundColor:r.backgroundColor?r.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:r.borderWidth?r.borderWidth:f.borderWidth||c.borderWidth,borderColor:r.borderColor?r.borderColor:f.borderColor||c.borderColor,borderCapStyle:r.borderCapStyle?r.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:r.borderDash?r.borderDash:f.borderDash||c.borderDash,borderDashOffset:r.borderDashOffset?r.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:r.borderJoinStyle?r.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:r.fill?r.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:r.steppedLine?r.steppedLine:n.getValueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:r.cubicInterpolationMode?r.cubicInterpolationMode:n.getValueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode),scaleTop:h.top,scaleBottom:h.bottom,scaleZero:h.getBasePixel()},l.pivot()),i=0,a=u.length;i<a;++i)o.updateElement(u[i],i,t);for(g&&0!==l._model.tension&&o.updateBezierControlPoints(),i=0,a=u.length;i<a;++i)u[i].pivot()},getPointBackgroundColor:function(t,e){var i=this.chart.options.elements.point.backgroundColor,a=this.getDataset(),r=t.custom||{};return r.backgroundColor?i=r.backgroundColor:a.pointBackgroundColor?i=n.getValueAtIndexOrDefault(a.pointBackgroundColor,e,i):a.backgroundColor&&(i=a.backgroundColor),i},getPointBorderColor:function(t,e){var i=this.chart.options.elements.point.borderColor,a=this.getDataset(),r=t.custom||{};return r.borderColor?i=r.borderColor:a.pointBorderColor?i=n.getValueAtIndexOrDefault(a.pointBorderColor,e,i):a.borderColor&&(i=a.borderColor),i},getPointBorderWidth:function(t,e){var i=this.chart.options.elements.point.borderWidth,a=this.getDataset(),r=t.custom||{};return isNaN(r.borderWidth)?isNaN(a.pointBorderWidth)?isNaN(a.borderWidth)||(i=a.borderWidth):i=n.getValueAtIndexOrDefault(a.pointBorderWidth,e,i):i=r.borderWidth,i},updateElement:function(t,e,i){var a,r,o=this,s=o.getMeta(),l=t.custom||{},u=o.getDataset(),d=o.index,c=u.data[e],h=o.getScaleForId(s.yAxisID),f=o.getScaleForId(s.xAxisID),g=o.chart.options.elements.point,m=o.chart.data.labels||[],p=1===m.length||1===u.data.length||o.chart.isCombo;void 0!==u.radius&&void 0===u.pointRadius&&(u.pointRadius=u.radius),void 0!==u.hitRadius&&void 0===u.pointHitRadius&&(u.pointHitRadius=u.hitRadius),a=f.getPixelForValue("object"==typeof c?c:NaN,e,d,p),r=i?h.getBasePixel():o.calculatePointY(c,e,d),t._xScale=f,t._yScale=h,t._datasetIndex=d,t._index=e,t._model={x:a,y:r,skip:l.skip||isNaN(a)||isNaN(r),radius:l.radius||n.getValueAtIndexOrDefault(u.pointRadius,e,g.radius),pointStyle:l.pointStyle||n.getValueAtIndexOrDefault(u.pointStyle,e,g.pointStyle),backgroundColor:o.getPointBackgroundColor(t,e),borderColor:o.getPointBorderColor(t,e),borderWidth:o.getPointBorderWidth(t,e),tension:s.dataset._model?s.dataset._model.tension:0,steppedLine:!!s.dataset._model&&s.dataset._model.steppedLine,hitRadius:l.hitRadius||n.getValueAtIndexOrDefault(u.pointHitRadius,e,g.hitRadius)}},calculatePointY:function(t,e,n){var i,a,r,o=this,s=o.chart,l=o.getMeta(),u=o.getScaleForId(l.yAxisID),d=0,c=0;if(u.options.stacked){for(i=0;i<n;i++)if(a=s.data.datasets[i],r=s.getDatasetMeta(i),"line"===r.type&&r.yAxisID===u.id&&s.isDatasetVisible(i)){var h=Number(u.getRightValue(a.data[e]));h<0?c+=h||0:d+=h||0}var f=Number(u.getRightValue(t));return f<0?u.getPixelForValue(c+f):u.getPixelForValue(d+f)}return u.getPixelForValue(t)},updateBezierControlPoints:function(){function t(t,e,n){return Math.max(Math.min(t,n),e)}var e,i,a,r,o,s=this,l=s.getMeta(),u=s.chart.chartArea,d=l.data||[];if(l.dataset._model.spanGaps&&(d=d.filter(function(t){return!t._model.skip})),"monotone"===l.dataset._model.cubicInterpolationMode)n.splineCurveMonotone(d);else for(e=0,i=d.length;e<i;++e)a=d[e],r=a._model,o=n.splineCurve(n.previousItem(d,e)._model,r,n.nextItem(d,e)._model,l.dataset._model.tension),r.controlPointPreviousX=o.previous.x,r.controlPointPreviousY=o.previous.y,r.controlPointNextX=o.next.x,r.controlPointNextY=o.next.y;if(s.chart.options.elements.line.capBezierPoints)for(e=0,i=d.length;e<i;++e)r=d[e]._model,r.controlPointPreviousX=t(r.controlPointPreviousX,u.left,u.right),r.controlPointPreviousY=t(r.controlPointPreviousY,u.top,u.bottom),r.controlPointNextX=t(r.controlPointNextX,u.left,u.right),r.controlPointNextY=t(r.controlPointNextY,u.top,u.bottom)},draw:function(n){var i,a,r=this,o=r.getMeta(),s=o.data||[],l=n||1;for(i=0,a=s.length;i<a;++i)s[i].transition(l);for(t.canvasHelpers.clipArea(r.chart.chart.ctx,r.chart.chartArea),e(r.getDataset(),r.chart.options)&&o.dataset.transition(l).draw(),t.canvasHelpers.unclipArea(r.chart.chart.ctx),i=0,a=s.length;i<a;++i)s[i].draw(r.chart.chartArea)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],i=t._index,a=t.custom||{},r=t._model;r.radius=a.hoverRadius||n.getValueAtIndexOrDefault(e.pointHoverRadius,i,this.chart.options.elements.point.hoverRadius),r.backgroundColor=a.hoverBackgroundColor||n.getValueAtIndexOrDefault(e.pointHoverBackgroundColor,i,n.getHoverColor(r.backgroundColor)),r.borderColor=a.hoverBorderColor||n.getValueAtIndexOrDefault(e.pointHoverBorderColor,i,n.getHoverColor(r.borderColor)),r.borderWidth=a.hoverBorderWidth||n.getValueAtIndexOrDefault(e.pointHoverBorderWidth,i,r.borderWidth)},removeHoverStyle:function(t){var e=this,i=e.chart.data.datasets[t._datasetIndex],a=t._index,r=t.custom||{},o=t._model;void 0!==i.radius&&void 0===i.pointRadius&&(i.pointRadius=i.radius),o.radius=r.radius||n.getValueAtIndexOrDefault(i.pointRadius,a,e.chart.options.elements.point.radius),o.backgroundColor=e.getPointBackgroundColor(t,a),o.borderColor=e.getPointBorderColor(t,a),o.borderWidth=e.getPointBorderWidth(t,a)}})}},{}],19:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.polarArea={scale:{type:"radialLinear",lineArc:!0,ticks:{beginAtZero:!0}},animation:{animateRotate:!0,animateScale:!0},startAngle:-.5*Math.PI,aspectRatio:1,legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');var n=t.data,i=n.datasets,a=n.labels;if(i.length)for(var r=0;r<i[0].data.length;++r)e.push('<li><span style="background-color:'+i[0].backgroundColor[r]+'"></span>'),a[r]&&e.push(a[r]),e.push("</li>");return e.push("</ul>"),e.join("");
|
13 |
+
},legend:{labels:{generateLabels:function(t){var n=t.data;return n.labels.length&&n.datasets.length?n.labels.map(function(i,a){var r=t.getDatasetMeta(0),o=n.datasets[0],s=r.data[a],l=s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(o.backgroundColor,a,d.backgroundColor),h=l.borderColor?l.borderColor:u(o.borderColor,a,d.borderColor),f=l.borderWidth?l.borderWidth:u(o.borderWidth,a,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(o.data[a])||r.data[a].hidden,index:a}}):[]}},onClick:function(t,e){var n,i,a,r=e.index,o=this.chart;for(n=0,i=(o.data.datasets||[]).length;n<i;++n)a=o.getDatasetMeta(n),a.data[r].hidden=!a.data[r].hidden;o.update()}},tooltips:{callbacks:{title:function(){return""},label:function(t,e){return e.labels[t.index]+": "+t.yLabel}}}},t.controllers.polarArea=t.DatasetController.extend({dataElementType:t.elements.Arc,linkScales:e.noop,update:function(t){var n=this,i=n.chart,a=i.chartArea,r=n.getMeta(),o=i.options,s=o.elements.arc,l=Math.min(a.right-a.left,a.bottom-a.top);i.outerRadius=Math.max((l-s.borderWidth/2)/2,0),i.innerRadius=Math.max(o.cutoutPercentage?i.outerRadius/100*o.cutoutPercentage:1,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),n.outerRadius=i.outerRadius-i.radiusLength*n.index,n.innerRadius=n.outerRadius-i.radiusLength,r.count=n.countVisibleElements(),e.each(r.data,function(e,i){n.updateElement(e,i,t)})},updateElement:function(t,n,i){for(var a=this,r=a.chart,o=a.getDataset(),s=r.options,l=s.animation,u=r.scale,d=e.getValueAtIndexOrDefault,c=r.data.labels,h=a.calculateCircumference(o.data[n]),f=u.xCenter,g=u.yCenter,m=0,p=a.getMeta(),v=0;v<n;++v)isNaN(o.data[v])||p.data[v].hidden||++m;var b=s.startAngle,y=t.hidden?0:u.getDistanceFromCenterForValue(o.data[n]),x=b+h*m,k=x+(t.hidden?0:h),_=l.animateScale?0:u.getDistanceFromCenterForValue(o.data[n]);e.extend(t,{_datasetIndex:a.index,_index:n,_scale:u,_model:{x:f,y:g,innerRadius:0,outerRadius:i?_:y,startAngle:i&&l.animateRotate?b:x,endAngle:i&&l.animateRotate?b:k,label:d(c,n,c[n])}}),a.removeHoverStyle(t),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},countVisibleElements:function(){var t=this.getDataset(),n=this.getMeta(),i=0;return e.each(n.data,function(e,n){isNaN(t.data[n])||e.hidden||i++}),i},calculateCircumference:function(t){var e=this.getMeta().count;return e>0&&!isNaN(t)?2*Math.PI/e:0}})}},{}],20:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.radar={aspectRatio:1,scale:{type:"radialLinear"},elements:{line:{tension:0}}},t.controllers.radar=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,linkScales:e.noop,update:function(t){var n=this,i=n.getMeta(),a=i.dataset,r=i.data,o=a.custom||{},s=n.getDataset(),l=n.chart.options.elements.line,u=n.chart.scale;void 0!==s.tension&&void 0===s.lineTension&&(s.lineTension=s.tension),e.extend(i.dataset,{_datasetIndex:n.index,_children:r,_loop:!0,_model:{tension:o.tension?o.tension:e.getValueOrDefault(s.lineTension,l.tension),backgroundColor:o.backgroundColor?o.backgroundColor:s.backgroundColor||l.backgroundColor,borderWidth:o.borderWidth?o.borderWidth:s.borderWidth||l.borderWidth,borderColor:o.borderColor?o.borderColor:s.borderColor||l.borderColor,fill:o.fill?o.fill:void 0!==s.fill?s.fill:l.fill,borderCapStyle:o.borderCapStyle?o.borderCapStyle:s.borderCapStyle||l.borderCapStyle,borderDash:o.borderDash?o.borderDash:s.borderDash||l.borderDash,borderDashOffset:o.borderDashOffset?o.borderDashOffset:s.borderDashOffset||l.borderDashOffset,borderJoinStyle:o.borderJoinStyle?o.borderJoinStyle:s.borderJoinStyle||l.borderJoinStyle,scaleTop:u.top,scaleBottom:u.bottom,scaleZero:u.getBasePosition()}}),i.dataset.pivot(),e.each(r,function(e,i){n.updateElement(e,i,t)},n),n.updateBezierControlPoints()},updateElement:function(t,n,i){var a=this,r=t.custom||{},o=a.getDataset(),s=a.chart.scale,l=a.chart.options.elements.point,u=s.getPointPositionForValue(n,o.data[n]);e.extend(t,{_datasetIndex:a.index,_index:n,_scale:s,_model:{x:i?s.xCenter:u.x,y:i?s.yCenter:u.y,tension:r.tension?r.tension:e.getValueOrDefault(o.lineTension,a.chart.options.elements.line.tension),radius:r.radius?r.radius:e.getValueAtIndexOrDefault(o.pointRadius,n,l.radius),backgroundColor:r.backgroundColor?r.backgroundColor:e.getValueAtIndexOrDefault(o.pointBackgroundColor,n,l.backgroundColor),borderColor:r.borderColor?r.borderColor:e.getValueAtIndexOrDefault(o.pointBorderColor,n,l.borderColor),borderWidth:r.borderWidth?r.borderWidth:e.getValueAtIndexOrDefault(o.pointBorderWidth,n,l.borderWidth),pointStyle:r.pointStyle?r.pointStyle:e.getValueAtIndexOrDefault(o.pointStyle,n,l.pointStyle),hitRadius:r.hitRadius?r.hitRadius:e.getValueAtIndexOrDefault(o.hitRadius,n,l.hitRadius)}}),t._model.skip=r.skip?r.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,n=this.getMeta();e.each(n.data,function(i,a){var r=i._model,o=e.splineCurve(e.previousItem(n.data,a,!0)._model,r,e.nextItem(n.data,a,!0)._model,r.tension);r.controlPointPreviousX=Math.max(Math.min(o.previous.x,t.right),t.left),r.controlPointPreviousY=Math.max(Math.min(o.previous.y,t.bottom),t.top),r.controlPointNextX=Math.max(Math.min(o.next.x,t.right),t.left),r.controlPointNextY=Math.max(Math.min(o.next.y,t.bottom),t.top),i.pivot()})},draw:function(t){var n=this.getMeta(),i=t||1;e.each(n.data,function(t){t.transition(i)}),n.dataset.transition(i).draw(),e.each(n.data,function(t){t.draw()})},setHoverStyle:function(t){var n=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},a=t._index,r=t._model;r.radius=i.hoverRadius?i.hoverRadius:e.getValueAtIndexOrDefault(n.pointHoverRadius,a,this.chart.options.elements.point.hoverRadius),r.backgroundColor=i.hoverBackgroundColor?i.hoverBackgroundColor:e.getValueAtIndexOrDefault(n.pointHoverBackgroundColor,a,e.getHoverColor(r.backgroundColor)),r.borderColor=i.hoverBorderColor?i.hoverBorderColor:e.getValueAtIndexOrDefault(n.pointHoverBorderColor,a,e.getHoverColor(r.borderColor)),r.borderWidth=i.hoverBorderWidth?i.hoverBorderWidth:e.getValueAtIndexOrDefault(n.pointHoverBorderWidth,a,r.borderWidth)},removeHoverStyle:function(t){var n=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},a=t._index,r=t._model,o=this.chart.options.elements.point;r.radius=i.radius?i.radius:e.getValueAtIndexOrDefault(n.radius,a,o.radius),r.backgroundColor=i.backgroundColor?i.backgroundColor:e.getValueAtIndexOrDefault(n.pointBackgroundColor,a,o.backgroundColor),r.borderColor=i.borderColor?i.borderColor:e.getValueAtIndexOrDefault(n.pointBorderColor,a,o.borderColor),r.borderWidth=i.borderWidth?i.borderWidth:e.getValueAtIndexOrDefault(n.pointBorderWidth,a,o.borderWidth)}})}},{}],21:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.animation={duration:1e3,easing:"easeOutQuart",onProgress:e.noop,onComplete:e.noop},t.Animation=t.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,n,i){var a=this;i||(t.animating=!0);for(var r=0;r<a.animations.length;++r)if(a.animations[r].chartInstance===t)return void(a.animations[r].animationObject=e);a.animations.push({chartInstance:t,animationObject:e}),1===a.animations.length&&a.requestAnimationFrame()},cancelAnimation:function(t){var n=e.findIndex(this.animations,function(e){return e.chartInstance===t});n!==-1&&(this.animations.splice(n,1),t.animating=!1)},requestAnimationFrame:function(){var t=this;null===t.request&&(t.request=e.requestAnimFrame.call(window,function(){t.request=null,t.startDigest()}))},startDigest:function(){var t=this,e=Date.now(),n=0;t.dropFrames>1&&(n=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1);for(var i=0;i<t.animations.length;)null===t.animations[i].animationObject.currentStep&&(t.animations[i].animationObject.currentStep=0),t.animations[i].animationObject.currentStep+=1+n,t.animations[i].animationObject.currentStep>t.animations[i].animationObject.numSteps&&(t.animations[i].animationObject.currentStep=t.animations[i].animationObject.numSteps),t.animations[i].animationObject.render(t.animations[i].chartInstance,t.animations[i].animationObject),t.animations[i].animationObject.onAnimationProgress&&t.animations[i].animationObject.onAnimationProgress.call&&t.animations[i].animationObject.onAnimationProgress.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].animationObject.currentStep===t.animations[i].animationObject.numSteps?(t.animations[i].animationObject.onAnimationComplete&&t.animations[i].animationObject.onAnimationComplete.call&&t.animations[i].animationObject.onAnimationComplete.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].chartInstance.animating=!1,t.animations.splice(i,1)):++i;var a=Date.now(),r=(a-e)/t.frameDuration;t.dropFrames+=r,t.animations.length>0&&t.requestAnimationFrame()}}}},{}],22:[function(t,e,n){"use strict";e.exports=function(t){var e=t.canvasHelpers={};e.drawPoint=function(e,n,i,a,r){var o,s,l,u,d,c;if("object"==typeof n&&(o=n.toString(),"[object HTMLImageElement]"===o||"[object HTMLCanvasElement]"===o))return void e.drawImage(n,a-n.width/2,r-n.height/2);if(!(isNaN(i)||i<=0)){switch(n){default:e.beginPath(),e.arc(a,r,i,0,2*Math.PI),e.closePath(),e.fill();break;case"triangle":e.beginPath(),s=3*i/Math.sqrt(3),d=s*Math.sqrt(3)/2,e.moveTo(a-s/2,r+d/3),e.lineTo(a+s/2,r+d/3),e.lineTo(a,r-2*d/3),e.closePath(),e.fill();break;case"rect":c=1/Math.SQRT2*i,e.beginPath(),e.fillRect(a-c,r-c,2*c,2*c),e.strokeRect(a-c,r-c,2*c,2*c);break;case"rectRounded":var h=i/Math.SQRT2,f=a-h,g=r-h,m=Math.SQRT2*i;t.helpers.drawRoundedRectangle(e,f,g,m,m,i/2),e.fill();break;case"rectRot":c=1/Math.SQRT2*i,e.beginPath(),e.moveTo(a-c,r),e.lineTo(a,r+c),e.lineTo(a+c,r),e.lineTo(a,r-c),e.closePath(),e.fill();break;case"cross":e.beginPath(),e.moveTo(a,r+i),e.lineTo(a,r-i),e.moveTo(a-i,r),e.lineTo(a+i,r),e.closePath();break;case"crossRot":e.beginPath(),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(a-l,r-u),e.lineTo(a+l,r+u),e.moveTo(a-l,r+u),e.lineTo(a+l,r-u),e.closePath();break;case"star":e.beginPath(),e.moveTo(a,r+i),e.lineTo(a,r-i),e.moveTo(a-i,r),e.lineTo(a+i,r),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(a-l,r-u),e.lineTo(a+l,r+u),e.moveTo(a-l,r+u),e.lineTo(a+l,r-u),e.closePath();break;case"line":e.beginPath(),e.moveTo(a-i,r),e.lineTo(a+i,r),e.closePath();break;case"dash":e.beginPath(),e.moveTo(a,r),e.lineTo(a+i,r),e.closePath()}e.stroke()}},e.clipArea=function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},e.unclipArea=function(t){t.restore()}}},{}],23:[function(t,e,n){"use strict";e.exports=function(t){function e(e){e=e||{};var n=e.data=e.data||{};return n.datasets=n.datasets||[],n.labels=n.labels||[],e.options=i.configMerge(t.defaults.global,t.defaults[e.type],e.options||{}),e}function n(t){var e=t.options;e.scale?t.scale.options=e.scale:e.scales&&e.scales.xAxes.concat(e.scales.yAxes).forEach(function(e){t.scales[e.id].options=e}),t.tooltip._options=e.tooltips}var i=t.helpers,a=t.plugins,r=t.platform;t.types={},t.instances={},t.controllers={},t.Controller=function(n,a,o){var s=this;a=e(a);var l=r.acquireContext(n,a),u=l&&l.canvas,d=u&&u.height,c=u&&u.width;return o.ctx=l,o.canvas=u,o.config=a,o.width=c,o.height=d,o.aspectRatio=d?c/d:null,s.id=i.uid(),s.chart=o,s.config=a,s.options=a.options,s._bufferedRender=!1,t.instances[s.id]=s,Object.defineProperty(s,"data",{get:function(){return s.config.data}}),l&&u?(s.initialize(),s.update(),s):(console.error("Failed to create chart: can't acquire context from the given item"),s)},i.extend(t.Controller.prototype,{initialize:function(){var t=this;return a.notify(t,"beforeInit"),i.retinaScale(t.chart),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildScales(),t.initToolTip(),a.notify(t,"afterInit"),t},clear:function(){return i.clear(this.chart),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(t){var e=this,n=e.chart,r=e.options,o=n.canvas,s=r.maintainAspectRatio&&n.aspectRatio||null,l=Math.floor(i.getMaximumWidth(o)),u=Math.floor(s?l/s:i.getMaximumHeight(o));if((n.width!==l||n.height!==u)&&(o.width=n.width=l,o.height=n.height=u,o.style.width=l+"px",o.style.height=u+"px",i.retinaScale(n),!t)){var d={width:l,height:u};a.notify(e,"resize",[d]),e.options.onResize&&e.options.onResize(e,d),e.stop(),e.update(e.options.responsiveAnimationDuration)}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},n=t.scale;i.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),i.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),n&&(n.id=n.id||"scale")},buildScales:function(){var e=this,n=e.options,a=e.scales={},r=[];n.scales&&(r=r.concat((n.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category"}}),(n.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear"}}))),n.scale&&r.push({options:n.scale,dtype:"radialLinear",isDefault:!0}),i.each(r,function(n){var r=n.options,o=i.getValueOrDefault(r.type,n.dtype),s=t.scaleService.getScaleConstructor(o);if(s){var l=new s({id:r.id,options:r,ctx:e.chart.ctx,chart:e});a[l.id]=l,n.isDefault&&(e.scale=l)}}),t.scaleService.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e=this,n=[],a=[];if(i.each(e.data.datasets,function(i,r){var o=e.getDatasetMeta(r);o.type||(o.type=i.type||e.config.type),n.push(o.type),o.controller?o.controller.updateIndex(r):(o.controller=new t.controllers[o.type](e,r),a.push(o.controller))},e),n.length>1)for(var r=1;r<n.length;r++)if(n[r]!==n[r-1]){e.isCombo=!0;break}return a},resetElements:function(){var t=this;i.each(t.data.datasets,function(e,n){t.getDatasetMeta(n).controller.reset()},t)},reset:function(){this.resetElements(),this.tooltip.initialize()},update:function(t,e){var r=this;if(n(r),a.notify(r,"beforeUpdate")!==!1){r.tooltip._data=r.data;var o=r.buildOrUpdateControllers();i.each(r.data.datasets,function(t,e){r.getDatasetMeta(e).controller.buildOrUpdateElements()},r),r.updateLayout(),i.each(o,function(t){t.reset()}),r.updateDatasets(),a.notify(r,"afterUpdate"),r._bufferedRender?r._bufferedRequest={lazy:e,duration:t}:r.render(t,e)}},updateLayout:function(){var e=this;a.notify(e,"beforeLayout")!==!1&&(t.layoutService.update(this,this.chart.width,this.chart.height),a.notify(e,"afterScaleUpdate"),a.notify(e,"afterLayout"))},updateDatasets:function(){var t=this;if(a.notify(t,"beforeDatasetsUpdate")!==!1){for(var e=0,n=t.data.datasets.length;e<n;++e)t.getDatasetMeta(e).controller.update();a.notify(t,"afterDatasetsUpdate")}},render:function(e,n){var r=this;if(a.notify(r,"beforeRender")!==!1){var o=r.options.animation,s=function(){a.notify(r,"afterRender");var t=o&&o.onComplete;t&&t.call&&t.call(r)};if(o&&("undefined"!=typeof e&&0!==e||"undefined"==typeof e&&0!==o.duration)){var l=new t.Animation;l.numSteps=(e||o.duration)/16.66,l.easing=o.easing,l.render=function(t,e){var n=i.easingEffects[e.easing],a=e.currentStep/e.numSteps,r=n(a);t.draw(r,a,e.currentStep)},l.onAnimationProgress=o.onProgress,l.onAnimationComplete=s,t.animationService.addAnimation(r,l,e,n)}else r.draw(),s();return r}},draw:function(t){var e=this;e.clear(),void 0!==t&&null!==t||(t=1),a.notify(e,"beforeDraw",[t])!==!1&&(i.each(e.boxes,function(t){t.draw(e.chartArea)},e),e.scale&&e.scale.draw(),e.drawDatasets(t),e.tooltip.transition(t).draw(),a.notify(e,"afterDraw",[t]))},drawDatasets:function(t){var e=this;a.notify(e,"beforeDatasetsDraw",[t])!==!1&&(i.each(e.data.datasets,function(n,i){e.isDatasetVisible(i)&&e.getDatasetMeta(i).controller.draw(t)},e,!0),a.notify(e,"afterDatasetsDraw",[t]))},getElementAtEvent:function(e){return t.Interaction.modes.single(this,e)},getElementsAtEvent:function(e){return t.Interaction.modes.label(this,e,{intersect:!0})},getElementsAtXAxis:function(e){return t.Interaction.modes["x-axis"](this,e,{intersect:!0})},getElementsAtEventForMode:function(e,n,i){var a=t.Interaction.modes[n];return"function"==typeof a?a(this,e,i):[]},getDatasetAtEvent:function(e){return t.Interaction.modes.dataset(this,e,{intersect:!0})},getDatasetMeta:function(t){var e=this,n=e.data.datasets[t];n._meta||(n._meta={});var i=n._meta[e.id];return i||(i=n._meta[e.id]={type:null,data:[],dataset:null,controller:null,hidden:null,xAxisID:null,yAxisID:null}),i},getVisibleDatasetCount:function(){for(var t=0,e=0,n=this.data.datasets.length;e<n;++e)this.isDatasetVisible(e)&&t++;return t},isDatasetVisible:function(t){var e=this.getDatasetMeta(t);return"boolean"==typeof e.hidden?!e.hidden:!this.data.datasets[t].hidden},generateLegend:function(){return this.options.legendCallback(this)},destroy:function(){var e,n,o,s=this,l=s.chart.canvas;for(s.stop(),n=0,o=s.data.datasets.length;n<o;++n)e=s.getDatasetMeta(n),e.controller&&(e.controller.destroy(),e.controller=null);l&&(s.unbindEvents(),i.clear(s.chart),r.releaseContext(s.chart.ctx),s.chart.canvas=null,s.chart.ctx=null),a.notify(s,"destroy"),delete t.instances[s.id]},toBase64Image:function(){return this.chart.canvas.toDataURL.apply(this.chart.canvas,arguments)},initToolTip:function(){var e=this;e.tooltip=new t.Tooltip({_chart:e.chart,_chartInstance:e,_data:e.data,_options:e.options.tooltips},e),e.tooltip.initialize()},bindEvents:function(){var t=this,e=t._listeners={},n=function(){t.eventHandler.apply(t,arguments)};i.each(t.options.events,function(i){r.addEventListener(t,i,n),e[i]=n}),t.options.responsive&&(n=function(){t.resize()},r.addEventListener(t,"resize",n),e.resize=n)},unbindEvents:function(){var t=this,e=t._listeners;e&&(delete t._listeners,i.each(e,function(e,n){r.removeEventListener(t,n,e)}))},updateHoverStyle:function(t,e,n){var i,a,r,o=n?"setHoverStyle":"removeHoverStyle";for(a=0,r=t.length;a<r;++a)i=t[a],i&&this.getDatasetMeta(i._datasetIndex).controller[o](i)},eventHandler:function(t){var e=this,n=e.tooltip;if(a.notify(e,"beforeEvent",[t])!==!1){e._bufferedRender=!0,e._bufferedRequest=null;var i=e.handleEvent(t);i|=n&&n.handleEvent(t),a.notify(e,"afterEvent",[t]);var r=e._bufferedRequest;return r?e.render(r.duration,r.lazy):i&&!e.animating&&(e.stop(),e.render(e.options.hover.animationDuration,!0)),e._bufferedRender=!1,e._bufferedRequest=null,e}},handleEvent:function(t){var e=this,n=e.options||{},a=n.hover,r=!1;return e.lastActive=e.lastActive||[],"mouseout"===t.type?e.active=[]:e.active=e.getElementsAtEventForMode(t,a.mode,a),a.onHover&&a.onHover.call(e,t.native,e.active),"mouseup"!==t.type&&"click"!==t.type||n.onClick&&n.onClick.call(e,t.native,e.active),e.lastActive.length&&e.updateHoverStyle(e.lastActive,a.mode,!1),e.active.length&&a.mode&&e.updateHoverStyle(e.active,a.mode,!0),r=!i.arrayEquals(e.active,e.lastActive),e.lastActive=e.active,r}})}},{}],24:[function(t,e,n){"use strict";e.exports=function(t){function e(t,e){return t._chartjs?void t._chartjs.listeners.push(e):(Object.defineProperty(t,"_chartjs",{configurable:!0,enumerable:!1,value:{listeners:[e]}}),void a.forEach(function(e){var n="onData"+e.charAt(0).toUpperCase()+e.slice(1),a=t[e];Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:function(){var e=Array.prototype.slice.call(arguments),r=a.apply(this,e);return i.each(t._chartjs.listeners,function(t){"function"==typeof t[n]&&t[n].apply(t,e)}),r}})}))}function n(t,e){var n=t._chartjs;if(n){var i=n.listeners,r=i.indexOf(e);r!==-1&&i.splice(r,1),i.length>0||(a.forEach(function(e){delete t[e]}),delete t._chartjs)}}var i=t.helpers,a=["push","pop","shift","splice","unshift"];t.DatasetController=function(t,e){this.initialize(t,e)},i.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var n=this;n.chart=t,n.index=e,n.linkScales(),n.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),n=t.getDataset();null===e.xAxisID&&(e.xAxisID=n.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=n.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},destroy:function(){this._data&&n(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,n=e.dataElementType;return n&&new n({_chart:e.chart.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,n=this,i=n.getMeta(),a=n.getDataset().data||[],r=i.data;for(t=0,e=a.length;t<e;++t)r[t]=r[t]||n.createMetaData(t);i.dataset=i.dataset||n.createMetaDataset()},addElementAndReset:function(t){var e=this.createMetaData(t);this.getMeta().data.splice(t,0,e),this.updateElement(e,t,!0)},buildOrUpdateElements:function(){var t=this,i=t.getDataset(),a=i.data||(i.data=[]);t._data!==a&&(t._data&&n(t._data,t),e(a,t),t._data=a),t.resyncElements()},update:i.noop,draw:function(t){var e,n,i=t||1,a=this.getMeta().data;for(e=0,n=a.length;e<n;++e)a[e].transition(i).draw()},removeHoverStyle:function(t,e){var n=this.chart.data.datasets[t._datasetIndex],a=t._index,r=t.custom||{},o=i.getValueAtIndexOrDefault,s=t._model;s.backgroundColor=r.backgroundColor?r.backgroundColor:o(n.backgroundColor,a,e.backgroundColor),s.borderColor=r.borderColor?r.borderColor:o(n.borderColor,a,e.borderColor),s.borderWidth=r.borderWidth?r.borderWidth:o(n.borderWidth,a,e.borderWidth)},setHoverStyle:function(t){var e=this.chart.data.datasets[t._datasetIndex],n=t._index,a=t.custom||{},r=i.getValueAtIndexOrDefault,o=i.getHoverColor,s=t._model;s.backgroundColor=a.hoverBackgroundColor?a.hoverBackgroundColor:r(e.hoverBackgroundColor,n,o(s.backgroundColor)),s.borderColor=a.hoverBorderColor?a.hoverBorderColor:r(e.hoverBorderColor,n,o(s.borderColor)),s.borderWidth=a.hoverBorderWidth?a.hoverBorderWidth:r(e.hoverBorderWidth,n,s.borderWidth)},resyncElements:function(){var t=this,e=t.getMeta(),n=t.getDataset().data,i=e.data.length,a=n.length;a<i?e.data.splice(a,i-a):a>i&&t.insertElements(i,a-i)},insertElements:function(t,e){for(var n=0;n<e;++n)this.addElementAndReset(t+n)},onDataPush:function(){this.insertElements(this.getDataset().data.length-1,arguments.length)},onDataPop:function(){this.getMeta().data.pop()},onDataShift:function(){this.getMeta().data.shift()},onDataSplice:function(t,e){this.getMeta().data.splice(t,e),this.insertElements(t,arguments.length-2)},onDataUnshift:function(){this.insertElements(0,arguments.length)}}),t.DatasetController.extend=i.inherits}},{}],25:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.elements={},t.Element=function(t){e.extend(this,t),this.initialize.apply(this,arguments)},e.extend(t.Element.prototype,{initialize:function(){this.hidden=!1},pivot:function(){var t=this;return t._view||(t._view=e.clone(t._model)),t._start=e.clone(t._view),t},transition:function(t){var n=this;return n._view||(n._view=e.clone(n._model)),1===t?(n._view=n._model,n._start=null,n):(n._start||n.pivot(),e.each(n._model,function(i,a){if("_"===a[0]);else if(n._view.hasOwnProperty(a))if(i===n._view[a]);else if("string"==typeof i)try{var r=e.color(n._model[a]).mix(e.color(n._start[a]),t);n._view[a]=r.rgbString()}catch(t){n._view[a]=i}else if("number"==typeof i){var o=void 0!==n._start[a]&&isNaN(n._start[a])===!1?n._start[a]:0;n._view[a]=(n._model[a]-o)*t+o}else n._view[a]=i;else"number"!=typeof i||isNaN(n._view[a])?n._view[a]=i:n._view[a]=i*t},n),n)},tooltipPosition:function(){return{x:this._model.x,y:this._model.y}},hasValue:function(){return e.isNumber(this._model.x)&&e.isNumber(this._model.y)}}),t.Element.extend=e.inherits}},{}],26:[function(t,e,n){"use strict";var i=t(2);e.exports=function(t){function e(t,e,n){var i;return"string"==typeof t?(i=parseInt(t,10),t.indexOf("%")!==-1&&(i=i/100*e.parentNode[n])):i=t,i}function n(t){return void 0!==t&&null!==t&&"none"!==t}function a(t,i,a){var r=document.defaultView,o=t.parentNode,s=r.getComputedStyle(t)[i],l=r.getComputedStyle(o)[i],u=n(s),d=n(l),c=Number.POSITIVE_INFINITY;return u||d?Math.min(u?e(s,t,a):c,d?e(l,o,a):c):"none"}var r=t.helpers={};r.each=function(t,e,n,i){var a,o;if(r.isArray(t))if(o=t.length,i)for(a=o-1;a>=0;a--)e.call(n,t[a],a);else for(a=0;a<o;a++)e.call(n,t[a],a);else if("object"==typeof t){var s=Object.keys(t);for(o=s.length,a=0;a<o;a++)e.call(n,t[s[a]],s[a])}},r.clone=function(t){var e={};return r.each(t,function(t,n){r.isArray(t)?e[n]=t.slice(0):"object"==typeof t&&null!==t?e[n]=r.clone(t):e[n]=t}),e},r.extend=function(t){for(var e=function(e,n){t[n]=e},n=1,i=arguments.length;n<i;n++)r.each(arguments[n],e);return t},r.configMerge=function(e){var n=r.clone(e);return r.each(Array.prototype.slice.call(arguments,1),function(e){r.each(e,function(e,i){var a=n.hasOwnProperty(i),o=a?n[i]:{};"scales"===i?n[i]=r.scaleMerge(o,e):"scale"===i?n[i]=r.configMerge(o,t.scaleService.getScaleDefaults(e.type),e):!a||"object"!=typeof o||r.isArray(o)||null===o||"object"!=typeof e||r.isArray(e)?n[i]=e:n[i]=r.configMerge(o,e)})}),n},r.scaleMerge=function(e,n){var i=r.clone(e);return r.each(n,function(e,n){"xAxes"===n||"yAxes"===n?i.hasOwnProperty(n)?r.each(e,function(e,a){var o=r.getValueOrDefault(e.type,"xAxes"===n?"category":"linear"),s=t.scaleService.getScaleDefaults(o);a>=i[n].length||!i[n][a].type?i[n].push(r.configMerge(s,e)):e.type&&e.type!==i[n][a].type?i[n][a]=r.configMerge(i[n][a],s,e):i[n][a]=r.configMerge(i[n][a],e)}):(i[n]=[],r.each(e,function(e){var a=r.getValueOrDefault(e.type,"xAxes"===n?"category":"linear");i[n].push(r.configMerge(t.scaleService.getScaleDefaults(a),e))})):i.hasOwnProperty(n)&&"object"==typeof i[n]&&null!==i[n]&&"object"==typeof e?i[n]=r.configMerge(i[n],e):i[n]=e}),i},r.getValueAtIndexOrDefault=function(t,e,n){return void 0===t||null===t?n:r.isArray(t)?e<t.length?t[e]:n:t},r.getValueOrDefault=function(t,e){return void 0===t?e:t},r.indexOf=Array.prototype.indexOf?function(t,e){return t.indexOf(e)}:function(t,e){for(var n=0,i=t.length;n<i;++n)if(t[n]===e)return n;return-1},r.where=function(t,e){if(r.isArray(t)&&Array.prototype.filter)return t.filter(e);var n=[];return r.each(t,function(t){e(t)&&n.push(t)}),n},r.findIndex=Array.prototype.findIndex?function(t,e,n){return t.findIndex(e,n)}:function(t,e,n){n=void 0===n?t:n;for(var i=0,a=t.length;i<a;++i)if(e.call(n,t[i],i,t))return i;return-1},r.findNextWhere=function(t,e,n){void 0!==n&&null!==n||(n=-1);for(var i=n+1;i<t.length;i++){var a=t[i];if(e(a))return a}},r.findPreviousWhere=function(t,e,n){void 0!==n&&null!==n||(n=t.length);for(var i=n-1;i>=0;i--){var a=t[i];if(e(a))return a}},r.inherits=function(t){var e=this,n=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},i=function(){this.constructor=n};return i.prototype=e.prototype,n.prototype=new i,n.extend=r.inherits,t&&r.extend(n.prototype,t),n.__super__=e.prototype,n},r.noop=function(){},r.uid=function(){var t=0;return function(){return t++}}(),r.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},r.almostEquals=function(t,e,n){return Math.abs(t-e)<n},r.almostWhole=function(t,e){var n=Math.round(t);return n-e<t&&n+e>t},r.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},r.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},r.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},r.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},r.toRadians=function(t){return t*(Math.PI/180)},r.toDegrees=function(t){return t*(180/Math.PI)},r.getAngleFromPoint=function(t,e){var n=e.x-t.x,i=e.y-t.y,a=Math.sqrt(n*n+i*i),r=Math.atan2(i,n);return r<-.5*Math.PI&&(r+=2*Math.PI),{angle:r,distance:a}},r.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},r.aliasPixel=function(t){return t%2===0?0:.5},r.splineCurve=function(t,e,n,i){var a=t.skip?e:t,r=e,o=n.skip?e:n,s=Math.sqrt(Math.pow(r.x-a.x,2)+Math.pow(r.y-a.y,2)),l=Math.sqrt(Math.pow(o.x-r.x,2)+Math.pow(o.y-r.y,2)),u=s/(s+l),d=l/(s+l);u=isNaN(u)?0:u,d=isNaN(d)?0:d;var c=i*u,h=i*d;return{previous:{x:r.x-c*(o.x-a.x),y:r.y-c*(o.y-a.y)},next:{x:r.x+h*(o.x-a.x),y:r.y+h*(o.y-a.y)}}},r.EPSILON=Number.EPSILON||1e-14,r.splineCurveMonotone=function(t){var e,n,i,a,o=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),s=o.length;for(e=0;e<s;++e)if(i=o[e],!i.model.skip){if(n=e>0?o[e-1]:null,a=e<s-1?o[e+1]:null,a&&!a.model.skip){var l=a.model.x-i.model.x;i.deltaK=0!==l?(a.model.y-i.model.y)/l:0}!n||n.model.skip?i.mK=i.deltaK:!a||a.model.skip?i.mK=n.deltaK:this.sign(n.deltaK)!==this.sign(i.deltaK)?i.mK=0:i.mK=(n.deltaK+i.deltaK)/2}var u,d,c,h;for(e=0;e<s-1;++e)i=o[e],a=o[e+1],i.model.skip||a.model.skip||(r.almostEquals(i.deltaK,0,this.EPSILON)?i.mK=a.mK=0:(u=i.mK/i.deltaK,d=a.mK/i.deltaK,h=Math.pow(u,2)+Math.pow(d,2),h<=9||(c=3/Math.sqrt(h),i.mK=u*c*i.deltaK,a.mK=d*c*i.deltaK)));var f;for(e=0;e<s;++e)i=o[e],i.model.skip||(n=e>0?o[e-1]:null,a=e<s-1?o[e+1]:null,n&&!n.model.skip&&(f=(i.model.x-n.model.x)/3,i.model.controlPointPreviousX=i.model.x-f,i.model.controlPointPreviousY=i.model.y-f*i.mK),a&&!a.model.skip&&(f=(a.model.x-i.model.x)/3,i.model.controlPointNextX=i.model.x+f,i.model.controlPointNextY=i.model.y+f*i.mK))},r.nextItem=function(t,e,n){return n?e>=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},r.previousItem=function(t,e,n){return n?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},r.niceNum=function(t,e){var n,i=Math.floor(r.log10(t)),a=t/Math.pow(10,i);return n=e?a<1.5?1:a<3?2:a<7?5:10:a<=1?1:a<=2?2:a<=5?5:10,n*Math.pow(10,i)};var o=r.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===(t/=1)?1:(n||(n=.3),i<Math.abs(1)?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),-(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/n)))},easeOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:1===(t/=1)?1:(n||(n=.3),i<Math.abs(1)?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),i*Math.pow(2,-10*t)*Math.sin((1*t-e)*(2*Math.PI)/n)+1)},easeInOutElastic:function(t){var e=1.70158,n=0,i=1;return 0===t?0:2===(t/=.5)?1:(n||(n=1*(.3*1.5)),i<Math.abs(1)?(i=1,e=n/4):e=n/(2*Math.PI)*Math.asin(1/i),t<1?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/n)):i*Math.pow(2,-10*(t-=1))*Math.sin((1*t-e)*(2*Math.PI)/n)*.5+1)},easeInBack:function(t){var e=1.70158;
|
14 |
+
return 1*(t/=1)*t*((e+1)*t-e)},easeOutBack:function(t){var e=1.70158;return 1*((t=t/1-1)*t*((e+1)*t+e)+1)},easeInOutBack:function(t){var e=1.70158;return(t/=.5)<1?.5*(t*t*(((e*=1.525)+1)*t-e)):.5*((t-=2)*t*(((e*=1.525)+1)*t+e)+2)},easeInBounce:function(t){return 1-o.easeOutBounce(1-t)},easeOutBounce:function(t){return(t/=1)<1/2.75?1*(7.5625*t*t):t<2/2.75?1*(7.5625*(t-=1.5/2.75)*t+.75):t<2.5/2.75?1*(7.5625*(t-=2.25/2.75)*t+.9375):1*(7.5625*(t-=2.625/2.75)*t+.984375)},easeInOutBounce:function(t){return t<.5?.5*o.easeInBounce(2*t):.5*o.easeOutBounce(2*t-1)+.5}};r.requestAnimFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){return window.setTimeout(t,1e3/60)}}(),r.getRelativePosition=function(t,e){var n,i,a=t.originalEvent||t,o=t.currentTarget||t.srcElement,s=o.getBoundingClientRect(),l=a.touches;l&&l.length>0?(n=l[0].clientX,i=l[0].clientY):(n=a.clientX,i=a.clientY);var u=parseFloat(r.getStyle(o,"padding-left")),d=parseFloat(r.getStyle(o,"padding-top")),c=parseFloat(r.getStyle(o,"padding-right")),h=parseFloat(r.getStyle(o,"padding-bottom")),f=s.right-s.left-u-c,g=s.bottom-s.top-d-h;return n=Math.round((n-s.left-u)/f*o.width/e.currentDevicePixelRatio),i=Math.round((i-s.top-d)/g*o.height/e.currentDevicePixelRatio),{x:n,y:i}},r.addEvent=function(t,e,n){t.addEventListener?t.addEventListener(e,n):t.attachEvent?t.attachEvent("on"+e,n):t["on"+e]=n},r.removeEvent=function(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent?t.detachEvent("on"+e,n):t["on"+e]=r.noop},r.getConstraintWidth=function(t){return a(t,"max-width","clientWidth")},r.getConstraintHeight=function(t){return a(t,"max-height","clientHeight")},r.getMaximumWidth=function(t){var e=t.parentNode,n=parseInt(r.getStyle(e,"padding-left"),10),i=parseInt(r.getStyle(e,"padding-right"),10),a=e.clientWidth-n-i,o=r.getConstraintWidth(t);return isNaN(o)?a:Math.min(a,o)},r.getMaximumHeight=function(t){var e=t.parentNode,n=parseInt(r.getStyle(e,"padding-top"),10),i=parseInt(r.getStyle(e,"padding-bottom"),10),a=e.clientHeight-n-i,o=r.getConstraintHeight(t);return isNaN(o)?a:Math.min(a,o)},r.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},r.retinaScale=function(t){var e=t.currentDevicePixelRatio=window.devicePixelRatio||1;if(1!==e){var n=t.canvas,i=t.height,a=t.width;n.height=i*e,n.width=a*e,t.ctx.scale(e,e),n.style.height=i+"px",n.style.width=a+"px"}},r.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},r.fontString=function(t,e,n){return e+" "+t+"px "+n},r.longestText=function(t,e,n,i){i=i||{};var a=i.data=i.data||{},o=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(a=i.data={},o=i.garbageCollect=[],i.font=e),t.font=e;var s=0;r.each(n,function(e){void 0!==e&&null!==e&&r.isArray(e)!==!0?s=r.measureText(t,a,o,s,e):r.isArray(e)&&r.each(e,function(e){void 0===e||null===e||r.isArray(e)||(s=r.measureText(t,a,o,s,e))})});var l=o.length/2;if(l>n.length){for(var u=0;u<l;u++)delete a[o[u]];o.splice(0,l)}return s},r.measureText=function(t,e,n,i,a){var r=e[a];return r||(r=e[a]=t.measureText(a).width,n.push(a)),r>i&&(i=r),i},r.numberOfLabelLines=function(t){var e=1;return r.each(t,function(t){r.isArray(t)&&t.length>e&&(e=t.length)}),e},r.drawRoundedRectangle=function(t,e,n,i,a,r){t.beginPath(),t.moveTo(e+r,n),t.lineTo(e+i-r,n),t.quadraticCurveTo(e+i,n,e+i,n+r),t.lineTo(e+i,n+a-r),t.quadraticCurveTo(e+i,n+a,e+i-r,n+a),t.lineTo(e+r,n+a),t.quadraticCurveTo(e,n+a,e,n+a-r),t.lineTo(e,n+r),t.quadraticCurveTo(e,n,e+r,n),t.closePath()},r.color=function(e){return i?i(e instanceof CanvasGradient?t.defaults.global.defaultColor:e):(console.error("Color.js not found!"),e)},r.isArray=Array.isArray?function(t){return Array.isArray(t)}:function(t){return"[object Array]"===Object.prototype.toString.call(t)},r.arrayEquals=function(t,e){var n,i,a,o;if(!t||!e||t.length!==e.length)return!1;for(n=0,i=t.length;n<i;++n)if(a=t[n],o=e[n],a instanceof Array&&o instanceof Array){if(!r.arrayEquals(a,o))return!1}else if(a!==o)return!1;return!0},r.callCallback=function(t,e,n){t&&"function"==typeof t.call&&t.apply(n,e)},r.getHoverColor=function(t){return t instanceof CanvasPattern?t:r.color(t).saturate(.5).darken(.1).rgbString()}}},{2:2}],27:[function(t,e,n){"use strict";e.exports=function(t){function e(t,e){return t.native?{x:t.x,y:t.y}:o.getRelativePosition(t,e)}function n(t,e){var n,i,a,r,o,s=t.data.datasets;for(i=0,r=s.length;i<r;++i)if(t.isDatasetVisible(i))for(n=t.getDatasetMeta(i),a=0,o=n.data.length;a<o;++a){var l=n.data[a];l._view.skip||e(l)}}function i(t,e){var i=[];return n(t,function(t){t.inRange(e.x,e.y)&&i.push(t)}),i}function a(t,e,i,a){var r=Number.POSITIVE_INFINITY,s=[];return a||(a=o.distanceBetweenPoints),n(t,function(t){if(!i||t.inRange(e.x,e.y)){var n=t.getCenterPoint(),o=a(e,n);o<r?(s=[t],r=o):o===r&&s.push(t)}}),s}function r(t,n,r){var o=e(n,t.chart),s=function(t,e){return Math.abs(t.x-e.x)},l=r.intersect?i(t,o):a(t,o,!1,s),u=[];return l.length?(t.data.datasets.forEach(function(e,n){if(t.isDatasetVisible(n)){var i=t.getDatasetMeta(n),a=i.data[l[0]._index];a&&!a._view.skip&&u.push(a)}}),u):[]}var o=t.helpers;t.Interaction={modes:{single:function(t,i){var a=e(i,t.chart),r=[];return n(t,function(t){if(t.inRange(a.x,a.y))return r.push(t),r}),r.slice(0,1)},label:r,index:r,dataset:function(t,n,r){var o=e(n,t.chart),s=r.intersect?i(t,o):a(t,o,!1);return s.length>0&&(s=t.getDatasetMeta(s[0]._datasetIndex).data),s},"x-axis":function(t,e){return r(t,e,!0)},point:function(t,n){var a=e(n,t.chart);return i(t,a)},nearest:function(t,n,i){var r=e(n,t.chart),o=a(t,r,i.intersect);return o.length>1&&o.sort(function(t,e){var n=t.getArea(),i=e.getArea(),a=n-i;return 0===a&&(a=t._datasetIndex-e._datasetIndex),a}),o.slice(0,1)},x:function(t,i,a){var r=e(i,t.chart),o=[],s=!1;return n(t,function(t){t.inXRange(r.x)&&o.push(t),t.inRange(r.x,r.y)&&(s=!0)}),a.intersect&&!s&&(o=[]),o},y:function(t,i,a){var r=e(i,t.chart),o=[],s=!1;return n(t,function(t){t.inYRange(r.y)&&o.push(t),t.inRange(r.x,r.y)&&(s=!0)}),a.intersect&&!s&&(o=[]),o}}}}},{}],28:[function(t,e,n){"use strict";e.exports=function(){var t=function(e,n){return this.controller=new t.Controller(e,n,this),this.controller};return t.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},legendCallback:function(t){var e=[];e.push('<ul class="'+t.id+'-legend">');for(var n=0;n<t.data.datasets.length;n++)e.push('<li><span style="background-color:'+t.data.datasets[n].backgroundColor+'"></span>'),t.data.datasets[n].label&&e.push(t.data.datasets[n].label),e.push("</li>");return e.push("</ul>"),e.join("")}}},t.Chart=t,t}},{}],29:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),t.boxes.push(e)},removeBox:function(t,e){t.boxes&&t.boxes.splice(t.boxes.indexOf(e),1)},update:function(t,n,i){function a(t){var e,n=t.isHorizontal();n?(e=t.update(t.options.fullWidth?y:M,S),D-=e.height):(e=t.update(w,_),M-=e.width),C.push({horizontal:n,minSize:e,box:t})}function r(t){var n=e.findNextWhere(C,function(e){return e.box===t});if(n)if(t.isHorizontal()){var i={left:Math.max(F,T),right:Math.max(O,P),top:0,bottom:0};t.update(t.options.fullWidth?y:M,x/2,i)}else t.update(n.minSize.width,D)}function o(t){var n=e.findNextWhere(C,function(e){return e.box===t}),i={left:0,right:0,top:R,bottom:L};n&&t.update(n.minSize.width,D,i)}function s(t){t.isHorizontal()?(t.left=t.options.fullWidth?d:F,t.right=t.options.fullWidth?n-c:F+M,t.top=N,t.bottom=N+t.height,N=t.bottom):(t.left=z,t.right=z+t.width,t.top=R,t.bottom=R+D,z=t.right)}if(t){var l=t.options.layout,u=l?l.padding:null,d=0,c=0,h=0,f=0;isNaN(u)?(d=u.left||0,c=u.right||0,h=u.top||0,f=u.bottom||0):(d=u,c=u,h=u,f=u);var g=e.where(t.boxes,function(t){return"left"===t.options.position}),m=e.where(t.boxes,function(t){return"right"===t.options.position}),p=e.where(t.boxes,function(t){return"top"===t.options.position}),v=e.where(t.boxes,function(t){return"bottom"===t.options.position}),b=e.where(t.boxes,function(t){return"chartArea"===t.options.position});p.sort(function(t,e){return(e.options.fullWidth?1:0)-(t.options.fullWidth?1:0)}),v.sort(function(t,e){return(t.options.fullWidth?1:0)-(e.options.fullWidth?1:0)});var y=n-d-c,x=i-h-f,k=y/2,_=x/2,w=(n-k)/(g.length+m.length),S=(i-_)/(p.length+v.length),M=y,D=x,C=[];e.each(g.concat(m,p,v),a);var T=0,P=0,I=0,A=0;e.each(p.concat(v),function(t){if(t.getPadding){var e=t.getPadding();T=Math.max(T,e.left),P=Math.max(P,e.right)}}),e.each(g.concat(m),function(t){if(t.getPadding){var e=t.getPadding();I=Math.max(I,e.top),A=Math.max(A,e.bottom)}});var F=d,O=c,R=h,L=f;e.each(g.concat(m),r),e.each(g,function(t){F+=t.width}),e.each(m,function(t){O+=t.width}),e.each(p.concat(v),r),e.each(p,function(t){R+=t.height}),e.each(v,function(t){L+=t.height}),e.each(g.concat(m),o),F=d,O=c,R=h,L=f,e.each(g,function(t){F+=t.width}),e.each(m,function(t){O+=t.width}),e.each(p,function(t){R+=t.height}),e.each(v,function(t){L+=t.height});var V=Math.max(T-F,0);F+=V,O+=Math.max(P-O,0);var W=Math.max(I-R,0);R+=W,L+=Math.max(A-L,0);var Y=i-R-L,B=n-F-O;B===M&&Y===D||(e.each(g,function(t){t.height=Y}),e.each(m,function(t){t.height=Y}),e.each(p,function(t){t.options.fullWidth||(t.width=B)}),e.each(v,function(t){t.options.fullWidth||(t.width=B)}),D=Y,M=B);var z=d+V,N=h+W;e.each(g.concat(p),s),z+=M,N+=D,e.each(m,s),e.each(v,s),t.chartArea={left:F,top:R,right:F+M,bottom:R+D},e.each(b,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(M,D)})}}}}},{}],30:[function(t,e,n){"use strict";e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}function n(e,n){var i=new t.Legend({ctx:e.chart.ctx,options:n,chart:e});e.legend=i,t.layoutService.addBox(e,i)}var i=t.helpers,a=i.noop;t.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(t,e){var n=e.datasetIndex,i=this.chart,a=i.getDatasetMeta(n);a.hidden=null===a.hidden?!i.data.datasets[n].hidden:null,i.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return i.isArray(e.datasets)?e.datasets.map(function(e,n){return{text:e.label,fillStyle:i.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(n),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:n}},this):[]}}},t.Legend=t.Element.extend({initialize:function(t){i.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:a,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:a,beforeSetDimensions:a,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:a,beforeBuildLabels:a,buildLabels:function(){var t=this,e=t.options.labels,n=e.generateLabels.call(t,t.chart);e.filter&&(n=n.filter(function(n){return e.filter(n,t.chart.data)})),t.options.reverse&&n.reverse(),t.legendItems=n},afterBuildLabels:a,beforeFit:a,fit:function(){var n=this,a=n.options,r=a.labels,o=a.display,s=n.ctx,l=t.defaults.global,u=i.getValueOrDefault,d=u(r.fontSize,l.defaultFontSize),c=u(r.fontStyle,l.defaultFontStyle),h=u(r.fontFamily,l.defaultFontFamily),f=i.fontString(d,c,h),g=n.legendHitBoxes=[],m=n.minSize,p=n.isHorizontal();if(p?(m.width=n.maxWidth,m.height=o?10:0):(m.width=o?10:0,m.height=n.maxHeight),o)if(s.font=f,p){var v=n.lineWidths=[0],b=n.legendItems.length?d+r.padding:0;s.textAlign="left",s.textBaseline="top",i.each(n.legendItems,function(t,i){var a=e(r,d),o=a+d/2+s.measureText(t.text).width;v[v.length-1]+o+r.padding>=n.width&&(b+=d+r.padding,v[v.length]=n.left),g[i]={left:0,top:0,width:o,height:d},v[v.length-1]+=o+r.padding}),m.height+=b}else{var y=r.padding,x=n.columnWidths=[],k=r.padding,_=0,w=0,S=d+y;i.each(n.legendItems,function(t,n){var i=e(r,d),a=i+d/2+s.measureText(t.text).width;w+S>m.height&&(k+=_+r.padding,x.push(_),_=0,w=0),_=Math.max(_,a),w+=S,g[n]={left:0,top:0,width:a,height:d}}),k+=_,x.push(_),m.width+=k}n.width=m.width,n.height=m.height},afterFit:a,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var n=this,a=n.options,r=a.labels,o=t.defaults.global,s=o.elements.line,l=n.width,u=n.lineWidths;if(a.display){var d,c=n.ctx,h=i.getValueOrDefault,f=h(r.fontColor,o.defaultFontColor),g=h(r.fontSize,o.defaultFontSize),m=h(r.fontStyle,o.defaultFontStyle),p=h(r.fontFamily,o.defaultFontFamily),v=i.fontString(g,m,p);c.textAlign="left",c.textBaseline="top",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=v;var b=e(r,g),y=n.legendHitBoxes,x=function(e,n,i){if(!(isNaN(b)||b<=0)){c.save(),c.fillStyle=h(i.fillStyle,o.defaultColor),c.lineCap=h(i.lineCap,s.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,s.borderDashOffset),c.lineJoin=h(i.lineJoin,s.borderJoinStyle),c.lineWidth=h(i.lineWidth,s.borderWidth),c.strokeStyle=h(i.strokeStyle,o.defaultColor);var r=0===h(i.lineWidth,s.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,s.borderDash)),a.labels&&a.labels.usePointStyle){var l=g*Math.SQRT2/2,u=l/Math.SQRT2,d=e+u,f=n+u;t.canvasHelpers.drawPoint(c,i.pointStyle,l,d,f)}else r||c.strokeRect(e,n,b,g),c.fillRect(e,n,b,g);c.restore()}},k=function(t,e,n,i){c.fillText(n.text,b+g/2+t,e),n.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(b+g/2+t,e+g/2),c.lineTo(b+g/2+t+i,e+g/2),c.stroke())},_=n.isHorizontal();d=_?{x:n.left+(l-u[0])/2,y:n.top+r.padding,line:0}:{x:n.left+r.padding,y:n.top+r.padding,line:0};var w=g+r.padding;i.each(n.legendItems,function(t,e){var i=c.measureText(t.text).width,a=b+g/2+i,o=d.x,s=d.y;_?o+a>=l&&(s=d.y+=w,d.line++,o=d.x=n.left+(l-u[d.line])/2):s+w>n.bottom&&(o=d.x=o+n.columnWidths[d.line]+r.padding,s=d.y=n.top+r.padding,d.line++),x(o,s,t),y[e].left=o,y[e].top=s,k(o,s,t,i),_?d.x+=a+r.padding:d.y+=w})}},handleEvent:function(t){var e=this,n=e.options,i="mouseup"===t.type?"click":t.type,a=!1;if("mousemove"===i){if(!n.onHover)return}else{if("click"!==i)return;if(!n.onClick)return}var r=t.x,o=t.y;if(r>=e.left&&r<=e.right&&o>=e.top&&o<=e.bottom)for(var s=e.legendHitBoxes,l=0;l<s.length;++l){var u=s[l];if(r>=u.left&&r<=u.left+u.width&&o>=u.top&&o<=u.top+u.height){if("click"===i){n.onClick.call(e,t.native,e.legendItems[l]),a=!0;break}if("mousemove"===i){n.onHover.call(e,t.native,e.legendItems[l]),a=!0;break}}}return a}}),t.plugins.register({beforeInit:function(t){var e=t.options.legend;e&&n(t,e)},beforeUpdate:function(e){var a=e.options.legend;a?(a=i.configMerge(t.defaults.global.legend,a),e.legend?e.legend.options=a:n(e,a)):(t.layoutService.removeBox(e,e.legend),delete e.legend)},afterEvent:function(t,e){var n=t.legend;n&&n.handleEvent(e)}})}},{}],31:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.plugins={},t.plugins={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){e.indexOf(t)===-1&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var n=e.indexOf(t);n!==-1&&e.splice(n,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length},getAll:function(){return this._plugins},notify:function(t,e,n){var i,a,r,o,s,l=this.descriptors(t),u=l.length;for(i=0;i<u;++i)if(a=l[i],r=a.plugin,s=r[e],"function"==typeof s&&(o=[t].concat(n||[]),o.push(a.options),s.apply(r,o)===!1))return!1;return!0},descriptors:function(n){var i=n._plugins||(n._plugins={});if(i.id===this._cacheId)return i.descriptors;var a=[],r=[],o=n&&n.config||{},s=t.defaults.global.plugins,l=o.options&&o.options.plugins||{};return this._plugins.concat(o.plugins||[]).forEach(function(t){var n=a.indexOf(t);if(n===-1){var i=t.id,o=l[i];o!==!1&&(o===!0&&(o=e.clone(s[i])),a.push(t),r.push({plugin:t,options:o||{}}))}}),i.descriptors=r,i.id=this._cacheId,r}},t.pluginService=t.plugins,t.PluginBase=e.inherits({})}},{}],32:[function(t,e,n){"use strict";e.exports=function(t){function e(t,e,n){return i.isArray(e)?i.longestText(t,n,e):t.measureText(e).width}function n(e){var n=i.getValueOrDefault,a=t.defaults.global,r=n(e.fontSize,a.defaultFontSize),o=n(e.fontStyle,a.defaultFontStyle),s=n(e.fontFamily,a.defaultFontFamily);return{size:r,style:o,family:s,font:i.fontString(r,o,s)}}var i=t.helpers;t.defaults.scale={display:!0,position:"left",gridLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1,drawBorder:!0,drawOnChartArea:!0,drawTicks:!0,tickMarkLength:10,zeroLineWidth:1,zeroLineColor:"rgba(0,0,0,0.25)",offsetGridLines:!1,borderDash:[],borderDashOffset:0},scaleLabel:{labelString:"",display:!1},ticks:{beginAtZero:!1,minRotation:0,maxRotation:50,mirror:!1,padding:0,reverse:!1,display:!0,autoSkip:!0,autoSkipPadding:0,labelOffset:0,callback:t.Ticks.formatters.values}},t.Scale=t.Element.extend({getPadding:function(){var t=this;return{left:t.paddingLeft||0,top:t.paddingTop||0,right:t.paddingRight||0,bottom:t.paddingBottom||0}},beforeUpdate:function(){i.callCallback(this.options.beforeUpdate,[this])},update:function(t,e,n){var a=this;return a.beforeUpdate(),a.maxWidth=t,a.maxHeight=e,a.margins=i.extend({left:0,right:0,top:0,bottom:0},n),a.longestTextCache=a.longestTextCache||{},a.beforeSetDimensions(),a.setDimensions(),a.afterSetDimensions(),a.beforeDataLimits(),a.determineDataLimits(),a.afterDataLimits(),a.beforeBuildTicks(),a.buildTicks(),a.afterBuildTicks(),a.beforeTickToLabelConversion(),a.convertTicksToLabels(),a.afterTickToLabelConversion(),a.beforeCalculateTickRotation(),a.calculateTickRotation(),a.afterCalculateTickRotation(),a.beforeFit(),a.fit(),a.afterFit(),a.afterUpdate(),a.minSize},afterUpdate:function(){i.callCallback(this.options.afterUpdate,[this])},beforeSetDimensions:function(){i.callCallback(this.options.beforeSetDimensions,[this])},setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0},afterSetDimensions:function(){i.callCallback(this.options.afterSetDimensions,[this])},beforeDataLimits:function(){i.callCallback(this.options.beforeDataLimits,[this])},determineDataLimits:i.noop,afterDataLimits:function(){i.callCallback(this.options.afterDataLimits,[this])},beforeBuildTicks:function(){i.callCallback(this.options.beforeBuildTicks,[this])},buildTicks:i.noop,afterBuildTicks:function(){i.callCallback(this.options.afterBuildTicks,[this])},beforeTickToLabelConversion:function(){i.callCallback(this.options.beforeTickToLabelConversion,[this])},convertTicksToLabels:function(){var t=this,e=t.options.ticks;t.ticks=t.ticks.map(e.userCallback||e.callback)},afterTickToLabelConversion:function(){i.callCallback(this.options.afterTickToLabelConversion,[this])},beforeCalculateTickRotation:function(){i.callCallback(this.options.beforeCalculateTickRotation,[this])},calculateTickRotation:function(){var t=this,e=t.ctx,a=t.options.ticks,r=n(a);e.font=r.font;var o=a.minRotation||0;if(t.options.display&&t.isHorizontal())for(var s,l,u=i.longestText(e,r.font,t.ticks,t.longestTextCache),d=u,c=t.getPixelForTick(1)-t.getPixelForTick(0)-6;d>c&&o<a.maxRotation;){var h=i.toRadians(o);if(s=Math.cos(h),l=Math.sin(h),l*u>t.maxHeight){o--;break}o++,d=s*u}t.labelRotation=o},afterCalculateTickRotation:function(){i.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){i.callCallback(this.options.beforeFit,[this])},fit:function(){var t=this,a=t.minSize={width:0,height:0},r=t.options,o=r.ticks,s=r.scaleLabel,l=r.gridLines,u=r.display,d=t.isHorizontal(),c=n(o),h=1.5*n(s).size,f=r.gridLines.tickMarkLength;if(d?a.width=t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:a.width=u&&l.drawTicks?f:0,d?a.height=u&&l.drawTicks?f:0:a.height=t.maxHeight,s.display&&u&&(d?a.height+=h:a.width+=h),o.display&&u){var g=i.longestText(t.ctx,c.font,t.ticks,t.longestTextCache),m=i.numberOfLabelLines(t.ticks),p=.5*c.size;if(d){t.longestLabelWidth=g;var v=i.toRadians(t.labelRotation),b=Math.cos(v),y=Math.sin(v),x=y*g+c.size*m+p*m;a.height=Math.min(t.maxHeight,a.height+x),t.ctx.font=c.font;var k=t.ticks[0],_=e(t.ctx,k,c.font),w=t.ticks[t.ticks.length-1],S=e(t.ctx,w,c.font);0!==t.labelRotation?(t.paddingLeft="bottom"===r.position?b*_+3:b*p+3,t.paddingRight="bottom"===r.position?b*p+3:b*S+3):(t.paddingLeft=_/2+3,t.paddingRight=S/2+3)}else o.mirror?g=0:g+=t.options.ticks.padding,a.width+=g,t.paddingTop=c.size/2,t.paddingBottom=c.size/2}t.handleMargins(),t.width=a.width,t.height=a.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){i.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){return null===t||"undefined"==typeof t?NaN:"number"!=typeof t||isFinite(t)?"object"==typeof t?t instanceof Date||t.isValid?t:this.getRightValue(this.isHorizontal()?t.x:t.y):t:NaN},getLabelForIndex:i.noop,getPixelForValue:i.noop,getValueForPixel:i.noop,getPixelForTick:function(t,e){var n=this;if(n.isHorizontal()){var i=n.width-(n.paddingLeft+n.paddingRight),a=i/Math.max(n.ticks.length-(n.options.gridLines.offsetGridLines?0:1),1),r=a*t+n.paddingLeft;e&&(r+=a/2);var o=n.left+Math.round(r);return o+=n.isFullWidth()?n.margins.left:0}var s=n.height-(n.paddingTop+n.paddingBottom);return n.top+t*(s/(n.ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var n=e.width-(e.paddingLeft+e.paddingRight),i=n*t+e.paddingLeft,a=e.left+Math.round(i);return a+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,n=t.max;return t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0},draw:function(e){var a=this,r=a.options;if(r.display){var o,s,l=a.ctx,u=t.defaults.global,d=r.ticks,c=r.gridLines,h=r.scaleLabel,f=0!==a.labelRotation,g=d.autoSkip,m=a.isHorizontal();d.maxTicksLimit&&(s=d.maxTicksLimit);var p=i.getValueOrDefault(d.fontColor,u.defaultFontColor),v=n(d),b=c.drawTicks?c.tickMarkLength:0,y=i.getValueOrDefault(c.borderDash,u.borderDash),x=i.getValueOrDefault(c.borderDashOffset,u.borderDashOffset),k=i.getValueOrDefault(h.fontColor,u.defaultFontColor),_=n(h),w=i.toRadians(a.labelRotation),S=Math.cos(w),M=a.longestLabelWidth*S;l.fillStyle=p;var D=[];if(m){if(o=!1,f&&(M/=2),(M+d.autoSkipPadding)*a.ticks.length>a.width-(a.paddingLeft+a.paddingRight)&&(o=1+Math.floor((M+d.autoSkipPadding)*a.ticks.length/(a.width-(a.paddingLeft+a.paddingRight)))),s&&a.ticks.length>s)for(;!o||a.ticks.length/(o||1)>s;)o||(o=1),o+=1;g||(o=!1)}var C="right"===r.position?a.left:a.right-b,T="right"===r.position?a.left+b:a.right,P="bottom"===r.position?a.top:a.bottom-b,I="bottom"===r.position?a.top+b:a.bottom;if(i.each(a.ticks,function(t,n){if(void 0!==t&&null!==t){var s=a.ticks.length===n+1,l=o>1&&n%o>0||n%o===0&&n+o>=a.ticks.length;if((!l||s)&&void 0!==t&&null!==t){var u,h;n===("undefined"!=typeof a.zeroLineIndex?a.zeroLineIndex:0)?(u=c.zeroLineWidth,h=c.zeroLineColor):(u=i.getValueAtIndexOrDefault(c.lineWidth,n),h=i.getValueAtIndexOrDefault(c.color,n));var g,p,v,k,_,S,M,A,F,O,R="middle",L="middle";if(m){"bottom"===r.position?(L=f?"middle":"top",R=f?"right":"center",O=a.top+b):(L=f?"middle":"bottom",R=f?"left":"center",O=a.bottom-b);var V=a.getPixelForTick(n)+i.aliasPixel(u);F=a.getPixelForTick(n,c.offsetGridLines)+d.labelOffset,g=v=_=M=V,p=P,k=I,S=e.top,A=e.bottom}else{var W,Y="left"===r.position,B=d.padding;d.mirror?(R=Y?"left":"right",W=B):(R=Y?"right":"left",W=b+B),F=Y?a.right-W:a.left+W;var z=a.getPixelForTick(n);z+=i.aliasPixel(u),O=a.getPixelForTick(n,c.offsetGridLines),g=C,v=T,_=e.left,M=e.right,p=k=S=A=z}D.push({tx1:g,ty1:p,tx2:v,ty2:k,x1:_,y1:S,x2:M,y2:A,labelX:F,labelY:O,glWidth:u,glColor:h,glBorderDash:y,glBorderDashOffset:x,rotation:-1*w,label:t,textBaseline:L,textAlign:R})}}}),i.each(D,function(t){if(c.display&&(l.save(),l.lineWidth=t.glWidth,l.strokeStyle=t.glColor,l.setLineDash&&(l.setLineDash(t.glBorderDash),l.lineDashOffset=t.glBorderDashOffset),l.beginPath(),c.drawTicks&&(l.moveTo(t.tx1,t.ty1),l.lineTo(t.tx2,t.ty2)),c.drawOnChartArea&&(l.moveTo(t.x1,t.y1),l.lineTo(t.x2,t.y2)),l.stroke(),l.restore()),d.display){l.save(),l.translate(t.labelX,t.labelY),l.rotate(t.rotation),l.font=v.font,l.textBaseline=t.textBaseline,l.textAlign=t.textAlign;var e=t.label;if(i.isArray(e))for(var n=0,a=0;n<e.length;++n)l.fillText(""+e[n],0,a),a+=1.5*v.size;else l.fillText(e,0,0);l.restore()}}),h.display){var A,F,O=0;if(m)A=a.left+(a.right-a.left)/2,F="bottom"===r.position?a.bottom-_.size/2:a.top+_.size/2;else{var R="left"===r.position;A=R?a.left+_.size/2:a.right-_.size/2,F=a.top+(a.bottom-a.top)/2,O=R?-.5*Math.PI:.5*Math.PI}l.save(),l.translate(A,F),l.rotate(O),l.textAlign="center",l.textBaseline="middle",l.fillStyle=k,l.font=_.font,l.fillText(h.labelString,0,0),l.restore()}if(c.drawBorder){l.lineWidth=i.getValueAtIndexOrDefault(c.lineWidth,0),l.strokeStyle=i.getValueAtIndexOrDefault(c.color,0);var L=a.left,V=a.right,W=a.top,Y=a.bottom,B=i.aliasPixel(l.lineWidth);m?(W=Y="top"===r.position?a.bottom:a.top,W+=B,Y+=B):(L=V="left"===r.position?a.right:a.left,L+=B,V+=B),l.beginPath(),l.moveTo(L,W),l.lineTo(V,Y),l.stroke()}}}})}},{}],33:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.scaleService={constructors:{},defaults:{},registerScaleType:function(t,n,i){this.constructors[t]=n,this.defaults[t]=e.clone(i)},getScaleConstructor:function(t){return this.constructors.hasOwnProperty(t)?this.constructors[t]:void 0},getScaleDefaults:function(n){return this.defaults.hasOwnProperty(n)?e.scaleMerge(t.defaults.scale,this.defaults[n]):{}},updateScaleDefaults:function(t,n){var i=this.defaults;i.hasOwnProperty(t)&&(i[t]=e.extend(i[t],n))},addScalesToLayout:function(n){e.each(n.scales,function(e){t.layoutService.addBox(n,e)})}}}},{}],34:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers;t.Ticks={generators:{linear:function(t,n){var i,a=[];if(t.stepSize&&t.stepSize>0)i=t.stepSize;else{var r=e.niceNum(n.max-n.min,!1);i=e.niceNum(r/(t.maxTicks-1),!0)}var o=Math.floor(n.min/i)*i,s=Math.ceil(n.max/i)*i;t.min&&t.max&&t.stepSize&&e.almostWhole((t.max-t.min)/t.stepSize,i/1e3)&&(o=t.min,s=t.max);var l=(s-o)/i;l=e.almostEquals(l,Math.round(l),i/1e3)?Math.round(l):Math.ceil(l),a.push(void 0!==t.min?t.min:o);for(var u=1;u<l;++u)a.push(o+u*i);return a.push(void 0!==t.max?t.max:s),a},logarithmic:function(t,n){var i,a,r=[],o=e.getValueOrDefault,s=o(t.min,Math.pow(10,Math.floor(e.log10(n.min)))),l=Math.floor(e.log10(n.max)),u=Math.ceil(n.max/Math.pow(10,l));0===s?(i=Math.floor(e.log10(n.minNotZero)),a=Math.floor(n.minNotZero/Math.pow(10,i)),r.push(s),s=a*Math.pow(10,i)):(i=Math.floor(e.log10(s)),a=Math.floor(s/Math.pow(10,i)));do r.push(s),++a,10===a&&(a=1,++i),s=a*Math.pow(10,i);while(i<l||i===l&&a<u);var d=o(t.max,s);return r.push(d),r}},formatters:{values:function(t){return e.isArray(t)?t:""+t},linear:function(t,n,i){var a=i.length>3?i[2]-i[1]:i[1]-i[0];Math.abs(a)>1&&t!==Math.floor(t)&&(a=t-Math.floor(t));var r=e.log10(Math.abs(a)),o="";if(0!==t){var s=-1*Math.floor(r);s=Math.max(Math.min(s,20),0),o=t.toFixed(s)}else o="0";return o},logarithmic:function(t,n,i){var a=t/Math.pow(10,Math.floor(e.log10(t)));return 0===t?"0":1===a||2===a||5===a||0===n||n===i.length-1?t.toExponential():""}}}}},{}],35:[function(t,e,n){"use strict";e.exports=function(t){function e(e,n){var i=new t.Title({ctx:e.chart.ctx,options:n,chart:e});e.titleBlock=i,t.layoutService.addBox(e,i)}var n=t.helpers;t.defaults.global.title={display:!1,position:"top",fullWidth:!0,fontStyle:"bold",padding:10,text:""};var i=n.noop;t.Title=t.Element.extend({initialize:function(t){var e=this;n.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:i,update:function(t,e,n){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=n,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:i,beforeSetDimensions:i,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:i,beforeBuildLabels:i,buildLabels:i,afterBuildLabels:i,beforeFit:i,fit:function(){var e=this,i=n.getValueOrDefault,a=e.options,r=t.defaults.global,o=a.display,s=i(a.fontSize,r.defaultFontSize),l=e.minSize;e.isHorizontal()?(l.width=e.maxWidth,l.height=o?s+2*a.padding:0):(l.width=o?s+2*a.padding:0,l.height=e.maxHeight),e.width=l.width,e.height=l.height},afterFit:i,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var e=this,i=e.ctx,a=n.getValueOrDefault,r=e.options,o=t.defaults.global;if(r.display){var s,l,u,d=a(r.fontSize,o.defaultFontSize),c=a(r.fontStyle,o.defaultFontStyle),h=a(r.fontFamily,o.defaultFontFamily),f=n.fontString(d,c,h),g=0,m=e.top,p=e.left,v=e.bottom,b=e.right;i.fillStyle=a(r.fontColor,o.defaultFontColor),i.font=f,e.isHorizontal()?(s=p+(b-p)/2,l=m+(v-m)/2,u=b-p):(s="left"===r.position?p+d/2:b-d/2,l=m+(v-m)/2,u=v-m,g=Math.PI*("left"===r.position?-.5:.5)),i.save(),i.translate(s,l),i.rotate(g),i.textAlign="center",i.textBaseline="middle",i.fillText(r.text,0,0,u),i.restore()}}}),t.plugins.register({beforeInit:function(t){var n=t.options.title;n&&e(t,n)},beforeUpdate:function(i){var a=i.options.title;a?(a=n.configMerge(t.defaults.global.title,a),i.titleBlock?i.titleBlock.options=a:e(i,a)):(t.layoutService.removeBox(i,i.titleBlock),delete i.titleBlock)}})}},{}],36:[function(t,e,n){"use strict";e.exports=function(t){function e(t,e){var n=l.color(t);return n.alpha(e*n.alpha()).rgbaString()}function n(t,e){return e&&(l.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function i(t){var e=t._xScale,n=t._yScale||t._scale,i=t._index,a=t._datasetIndex;return{xLabel:e?e.getLabelForIndex(i,a):"",yLabel:n?n.getLabelForIndex(i,a):"",index:i,datasetIndex:a,x:t._model.x,y:t._model.y}}function a(e){var n=t.defaults.global,i=l.getValueOrDefault;return{xPadding:e.xPadding,yPadding:e.yPadding,xAlign:e.xAlign,yAlign:e.yAlign,bodyFontColor:e.bodyFontColor,_bodyFontFamily:i(e.bodyFontFamily,n.defaultFontFamily),_bodyFontStyle:i(e.bodyFontStyle,n.defaultFontStyle),_bodyAlign:e.bodyAlign,bodyFontSize:i(e.bodyFontSize,n.defaultFontSize),bodySpacing:e.bodySpacing,titleFontColor:e.titleFontColor,_titleFontFamily:i(e.titleFontFamily,n.defaultFontFamily),_titleFontStyle:i(e.titleFontStyle,n.defaultFontStyle),titleFontSize:i(e.titleFontSize,n.defaultFontSize),_titleAlign:e.titleAlign,titleSpacing:e.titleSpacing,
|
15 |
+
titleMarginBottom:e.titleMarginBottom,footerFontColor:e.footerFontColor,_footerFontFamily:i(e.footerFontFamily,n.defaultFontFamily),_footerFontStyle:i(e.footerFontStyle,n.defaultFontStyle),footerFontSize:i(e.footerFontSize,n.defaultFontSize),_footerAlign:e.footerAlign,footerSpacing:e.footerSpacing,footerMarginTop:e.footerMarginTop,caretSize:e.caretSize,cornerRadius:e.cornerRadius,backgroundColor:e.backgroundColor,opacity:0,legendColorBackground:e.multiKeyBackground,displayColors:e.displayColors}}function r(t,e){var n=t._chart.ctx,i=2*e.yPadding,a=0,r=e.body,o=r.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);o+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,u=e.footer.length,d=e.titleFontSize,c=e.bodyFontSize,h=e.footerFontSize;i+=s*d,i+=s?(s-1)*e.titleSpacing:0,i+=s?e.titleMarginBottom:0,i+=o*c,i+=o?(o-1)*e.bodySpacing:0,i+=u?e.footerMarginTop:0,i+=u*h,i+=u?(u-1)*e.footerSpacing:0;var f=0,g=function(t){a=Math.max(a,n.measureText(t).width+f)};return n.font=l.fontString(d,e._titleFontStyle,e._titleFontFamily),l.each(e.title,g),n.font=l.fontString(c,e._bodyFontStyle,e._bodyFontFamily),l.each(e.beforeBody.concat(e.afterBody),g),f=e.displayColors?c+2:0,l.each(r,function(t){l.each(t.before,g),l.each(t.lines,g),l.each(t.after,g)}),f=0,n.font=l.fontString(h,e._footerFontStyle,e._footerFontFamily),l.each(e.footer,g),a+=2*e.xPadding,{width:a,height:i}}function o(t,e){var n=t._model,i=t._chart,a=t._chartInstance.chartArea,r="center",o="center";n.y<e.height?o="top":n.y>i.height-e.height&&(o="bottom");var s,l,u,d,c,h=(a.left+a.right)/2,f=(a.top+a.bottom)/2;"center"===o?(s=function(t){return t<=h},l=function(t){return t>h}):(s=function(t){return t<=e.width/2},l=function(t){return t>=i.width-e.width/2}),u=function(t){return t+e.width>i.width},d=function(t){return t-e.width<0},c=function(t){return t<=f?"top":"bottom"},s(n.x)?(r="left",u(n.x)&&(r="center",o=c(n.y))):l(n.x)&&(r="right",d(n.x)&&(r="center",o=c(n.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:r,yAlign:g.yAlign?g.yAlign:o}}function s(t,e,n){var i=t.x,a=t.y,r=t.caretSize,o=t.caretPadding,s=t.cornerRadius,l=n.xAlign,u=n.yAlign,d=r+o,c=s+o;return"right"===l?i-=e.width:"center"===l&&(i-=e.width/2),"top"===u?a+=d:a-="bottom"===u?e.height+d:e.height/2,"center"===u?"left"===l?i+=d:"right"===l&&(i-=d):"left"===l?i-=c:"right"===l&&(i+=c),{x:i,y:a}}var l=t.helpers;t.defaults.global.tooltips={enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,callbacks:{beforeTitle:l.noop,title:function(t,e){var n="",i=e.labels,a=i?i.length:0;if(t.length>0){var r=t[0];r.xLabel?n=r.xLabel:a>0&&r.index<a&&(n=i[r.index])}return n},afterTitle:l.noop,beforeBody:l.noop,beforeLabel:l.noop,label:function(t,e){var n=e.datasets[t.datasetIndex].label||"";return n+": "+t.yLabel},labelColor:function(t,e){var n=e.getDatasetMeta(t.datasetIndex),i=n.data[t.index],a=i._view;return{borderColor:a.borderColor,backgroundColor:a.backgroundColor}},afterLabel:l.noop,afterBody:l.noop,beforeFooter:l.noop,footer:l.noop,afterFooter:l.noop}},t.Tooltip=t.Element.extend({initialize:function(){this._model=a(this._options)},getTitle:function(){var t=this,e=t._options,i=e.callbacks,a=i.beforeTitle.apply(t,arguments),r=i.title.apply(t,arguments),o=i.afterTitle.apply(t,arguments),s=[];return s=n(s,a),s=n(s,r),s=n(s,o)},getBeforeBody:function(){var t=this._options.callbacks.beforeBody.apply(this,arguments);return l.isArray(t)?t:void 0!==t?[t]:[]},getBody:function(t,e){var i=this,a=i._options.callbacks,r=[];return l.each(t,function(t){var o={before:[],lines:[],after:[]};n(o.before,a.beforeLabel.call(i,t,e)),n(o.lines,a.label.call(i,t,e)),n(o.after,a.afterLabel.call(i,t,e)),r.push(o)}),r},getAfterBody:function(){var t=this._options.callbacks.afterBody.apply(this,arguments);return l.isArray(t)?t:void 0!==t?[t]:[]},getFooter:function(){var t=this,e=t._options.callbacks,i=e.beforeFooter.apply(t,arguments),a=e.footer.apply(t,arguments),r=e.afterFooter.apply(t,arguments),o=[];return o=n(o,i),o=n(o,a),o=n(o,r)},update:function(e){var n,u,d=this,c=d._options,h=d._model,f=d._model=a(c),g=d._active,m=d._data,p=d._chartInstance,v={xAlign:h.xAlign,yAlign:h.yAlign},b={x:h.x,y:h.y},y={width:h.width,height:h.height},x={x:h.caretX,y:h.caretY};if(g.length){f.opacity=1;var k=[];x=t.Tooltip.positioners[c.position](g,d._eventPosition);var _=[];for(n=0,u=g.length;n<u;++n)_.push(i(g[n]));c.filter&&(_=_.filter(function(t){return c.filter(t,m)})),c.itemSort&&(_=_.sort(function(t,e){return c.itemSort(t,e,m)})),l.each(_,function(t){k.push(c.callbacks.labelColor.call(d,t,p))}),f.title=d.getTitle(_,m),f.beforeBody=d.getBeforeBody(_,m),f.body=d.getBody(_,m),f.afterBody=d.getAfterBody(_,m),f.footer=d.getFooter(_,m),f.x=Math.round(x.x),f.y=Math.round(x.y),f.caretPadding=l.getValueOrDefault(x.padding,2),f.labelColors=k,f.dataPoints=_,y=r(this,f),v=o(this,y),b=s(f,y,v)}else f.opacity=0;return f.xAlign=v.xAlign,f.yAlign=v.yAlign,f.x=b.x,f.y=b.y,f.width=y.width,f.height=y.height,f.caretX=x.x,f.caretY=x.y,d._model=f,e&&c.custom&&c.custom.call(d,f),d},drawCaret:function(t,n,i){var a,r,o,s,l,u,d=this._view,c=this._chart.ctx,h=d.caretSize,f=d.cornerRadius,g=d.xAlign,m=d.yAlign,p=t.x,v=t.y,b=n.width,y=n.height;"center"===m?("left"===g?(a=p,r=a-h,o=a):(a=p+b,r=a+h,o=a),l=v+y/2,s=l-h,u=l+h):("left"===g?(a=p+f,r=a+h,o=r+h):"right"===g?(a=p+b-f,r=a-h,o=r-h):(r=p+b/2,a=r-h,o=r+h),"top"===m?(s=v,l=s-h,u=s):(s=v+y,l=s+h,u=s)),c.fillStyle=e(d.backgroundColor,i),c.beginPath(),c.moveTo(a,s),c.lineTo(r,l),c.lineTo(o,u),c.closePath(),c.fill()},drawTitle:function(t,n,i,a){var r=n.title;if(r.length){i.textAlign=n._titleAlign,i.textBaseline="top";var o=n.titleFontSize,s=n.titleSpacing;i.fillStyle=e(n.titleFontColor,a),i.font=l.fontString(o,n._titleFontStyle,n._titleFontFamily);var u,d;for(u=0,d=r.length;u<d;++u)i.fillText(r[u],t.x,t.y),t.y+=o+s,u+1===r.length&&(t.y+=n.titleMarginBottom-s)}},drawBody:function(t,n,i,a){var r=n.bodyFontSize,o=n.bodySpacing,s=n.body;i.textAlign=n._bodyAlign,i.textBaseline="top";var u=e(n.bodyFontColor,a);i.fillStyle=u,i.font=l.fontString(r,n._bodyFontStyle,n._bodyFontFamily);var d=0,c=function(e){i.fillText(e,t.x+d,t.y),t.y+=r+o};l.each(n.beforeBody,c);var h=n.displayColors;d=h?r+2:0,l.each(s,function(o,s){l.each(o.before,c),l.each(o.lines,function(o){h&&(i.fillStyle=e(n.legendColorBackground,a),i.fillRect(t.x,t.y,r,r),i.strokeStyle=e(n.labelColors[s].borderColor,a),i.strokeRect(t.x,t.y,r,r),i.fillStyle=e(n.labelColors[s].backgroundColor,a),i.fillRect(t.x+1,t.y+1,r-2,r-2),i.fillStyle=u),c(o)}),l.each(o.after,c)}),d=0,l.each(n.afterBody,c),t.y-=o},drawFooter:function(t,n,i,a){var r=n.footer;r.length&&(t.y+=n.footerMarginTop,i.textAlign=n._footerAlign,i.textBaseline="top",i.fillStyle=e(n.footerFontColor,a),i.font=l.fontString(n.footerFontSize,n._footerFontStyle,n._footerFontFamily),l.each(r,function(e){i.fillText(e,t.x,t.y),t.y+=n.footerFontSize+n.footerSpacing}))},drawBackground:function(t,n,i,a,r){i.fillStyle=e(n.backgroundColor,r),l.drawRoundedRectangle(i,t.x,t.y,a.width,a.height,n.cornerRadius),i.fill()},draw:function(){var t=this._chart.ctx,e=this._view;if(0!==e.opacity){var n={width:e.width,height:e.height},i={x:e.x,y:e.y},a=Math.abs(e.opacity<.001)?0:e.opacity;this._options.enabled&&(this.drawBackground(i,e,t,n,a),this.drawCaret(i,n,a),i.x+=e.xPadding,i.y+=e.yPadding,this.drawTitle(i,e,t,a),this.drawBody(i,e,t,a),this.drawFooter(i,e,t,a))}},handleEvent:function(t){var e=this,n=e._options,i=!1;if(e._lastActive=e._lastActive||[],"mouseout"===t.type?e._active=[]:e._active=e._chartInstance.getElementsAtEventForMode(t,n.mode,n),i=!l.arrayEquals(e._active,e._lastActive),e._lastActive=e._active,n.enabled||n.custom){e._eventPosition={x:t.x,y:t.y};var a=e._model;e.update(!0),e.pivot(),i|=a.x!==e._model.x||a.y!==e._model.y}return i}}),t.Tooltip.positioners={average:function(t){if(!t.length)return!1;var e,n,i=0,a=0,r=0;for(e=0,n=t.length;e<n;++e){var o=t[e];if(o&&o.hasValue()){var s=o.tooltipPosition();i+=s.x,a+=s.y,++r}}return{x:Math.round(i/r),y:Math.round(a/r)}},nearest:function(t,e){var n,i,a,r=e.x,o=e.y,s=Number.POSITIVE_INFINITY;for(i=0,a=t.length;i<a;++i){var u=t[i];if(u&&u.hasValue()){var d=u.getCenterPoint(),c=l.distanceBetweenPoints(e,d);c<s&&(s=c,n=u)}}if(n){var h=n.tooltipPosition();r=h.x,o=h.y}return{x:r,y:o}}}}},{}],37:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers,n=t.defaults.global;n.elements.arc={backgroundColor:n.defaultColor,borderColor:"#fff",borderWidth:2},t.elements.Arc=t.Element.extend({inLabelRange:function(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hoverRadius,2)},inRange:function(t,n){var i=this._view;if(i){for(var a=e.getAngleFromPoint(i,{x:t,y:n}),r=a.angle,o=a.distance,s=i.startAngle,l=i.endAngle;l<s;)l+=2*Math.PI;for(;r>l;)r-=2*Math.PI;for(;r<s;)r+=2*Math.PI;var u=r>=s&&r<=l,d=o>=i.innerRadius&&o<=i.outerRadius;return u&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,n=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,n=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*n,y:t.y+Math.sin(e)*n}},draw:function(){var t=this._chart.ctx,e=this._view,n=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,n,i),t.arc(e.x,e.y,e.innerRadius,i,n,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})}},{}],38:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers,n=t.defaults.global;t.defaults.global.elements.line={tension:.4,backgroundColor:n.defaultColor,borderWidth:3,borderColor:n.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0},t.elements.Line=t.Element.extend({draw:function(){function t(t,e){var n=e._view;e._view.steppedLine===!0?(l.lineTo(n.x,t._view.y),l.lineTo(n.x,n.y)):0===e._view.tension?l.lineTo(n.x,n.y):l.bezierCurveTo(t._view.controlPointNextX,t._view.controlPointNextY,n.controlPointPreviousX,n.controlPointPreviousY,n.x,n.y)}var i=this,a=i._view,r=a.spanGaps,o=a.scaleZero,s=i._loop;s||("top"===a.fill?o=a.scaleTop:"bottom"===a.fill&&(o=a.scaleBottom));var l=i._chart.ctx;l.save();var u=i._children.slice(),d=-1;s&&u.length&&u.push(u[0]);var c,h,f,g;if(u.length&&a.fill){for(l.beginPath(),c=0;c<u.length;++c)h=u[c],f=e.previousItem(u,c),g=h._view,0===c?(s?l.moveTo(o.x,o.y):l.moveTo(g.x,o),g.skip||(d=c,l.lineTo(g.x,g.y))):(f=d===-1?f:u[d],g.skip?r||d!==c-1||(s?l.lineTo(o.x,o.y):l.lineTo(f._view.x,o)):(d!==c-1?r&&d!==-1?t(f,h):s?l.lineTo(g.x,g.y):(l.lineTo(g.x,o),l.lineTo(g.x,g.y)):t(f,h),d=c));s||d===-1||l.lineTo(u[d]._view.x,o),l.fillStyle=a.backgroundColor||n.defaultColor,l.closePath(),l.fill()}var m=n.elements.line;for(l.lineCap=a.borderCapStyle||m.borderCapStyle,l.setLineDash&&l.setLineDash(a.borderDash||m.borderDash),l.lineDashOffset=a.borderDashOffset||m.borderDashOffset,l.lineJoin=a.borderJoinStyle||m.borderJoinStyle,l.lineWidth=a.borderWidth||m.borderWidth,l.strokeStyle=a.borderColor||n.defaultColor,l.beginPath(),d=-1,c=0;c<u.length;++c)h=u[c],f=e.previousItem(u,c),g=h._view,0===c?g.skip||(l.moveTo(g.x,g.y),d=c):(f=d===-1?f:u[d],g.skip||(d!==c-1&&!r||d===-1?l.moveTo(g.x,g.y):t(f,h),d=c));l.stroke(),l.restore()}})}},{}],39:[function(t,e,n){"use strict";e.exports=function(t){function e(t){var e=this._view;return!!e&&Math.pow(t-e.x,2)<Math.pow(e.radius+e.hitRadius,2)}function n(t){var e=this._view;return!!e&&Math.pow(t-e.y,2)<Math.pow(e.radius+e.hitRadius,2)}var i=t.helpers,a=t.defaults.global,r=a.defaultColor;a.elements.point={radius:3,pointStyle:"circle",backgroundColor:r,borderWidth:1,borderColor:r,hitRadius:1,hoverRadius:4,hoverBorderWidth:1},t.elements.Point=t.Element.extend({inRange:function(t,e){var n=this._view;return!!n&&Math.pow(t-n.x,2)+Math.pow(e-n.y,2)<Math.pow(n.hitRadius+n.radius,2)},inLabelRange:e,inXRange:e,inYRange:n,getCenterPoint:function(){var t=this._view;return{x:t.x,y:t.y}},getArea:function(){return Math.PI*Math.pow(this._view.radius,2)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y,padding:t.radius+t.borderWidth}},draw:function(e){var n=this._view,o=this._model,s=this._chart.ctx,l=n.pointStyle,u=n.radius,d=n.x,c=n.y,h=t.helpers.color,f=1.01,g=0;n.skip||(s.strokeStyle=n.borderColor||r,s.lineWidth=i.getValueOrDefault(n.borderWidth,a.elements.point.borderWidth),s.fillStyle=n.backgroundColor||r,void 0!==e&&(o.x<e.left||e.right*f<o.x||o.y<e.top||e.bottom*f<o.y)&&(o.x<e.left?g=(d-o.x)/(e.left-o.x):e.right*f<o.x?g=(o.x-d)/(o.x-e.right):o.y<e.top?g=(c-o.y)/(e.top-o.y):e.bottom*f<o.y&&(g=(o.y-c)/(o.y-e.bottom)),g=Math.round(100*g)/100,s.strokeStyle=h(s.strokeStyle).alpha(g).rgbString(),s.fillStyle=h(s.fillStyle).alpha(g).rgbString()),t.canvasHelpers.drawPoint(s,l,u,d,c))}})}},{}],40:[function(t,e,n){"use strict";e.exports=function(t){function e(t){return void 0!==t._view.width}function n(t){var n,i,a,r,o=t._view;if(e(t)){var s=o.width/2;n=o.x-s,i=o.x+s,a=Math.min(o.y,o.base),r=Math.max(o.y,o.base)}else{var l=o.height/2;n=Math.min(o.x,o.base),i=Math.max(o.x,o.base),a=o.y-l,r=o.y+l}return{left:n,top:a,right:i,bottom:r}}var i=t.defaults.global;i.elements.rectangle={backgroundColor:i.defaultColor,borderWidth:0,borderColor:i.defaultColor,borderSkipped:"bottom"},t.elements.Rectangle=t.Element.extend({draw:function(){function t(t){return v[(y+t)%4]}var e,n,i,a,r,o,s,l=this._chart.ctx,u=this._view,d=u.borderWidth;if(u.horizontal?(e=u.base,n=u.x,i=u.y-u.height/2,a=u.y+u.height/2,r=n>e?1:-1,o=1,s=u.borderSkipped||"left"):(e=u.x-u.width/2,n=u.x+u.width/2,i=u.y,a=u.base,r=1,o=a>i?1:-1,s=u.borderSkipped||"bottom"),d){var c=Math.min(Math.abs(e-n),Math.abs(i-a));d=d>c?c:d;var h=d/2,f=e+("left"!==s?h*r:0),g=n+("right"!==s?-h*r:0),m=i+("top"!==s?h*o:0),p=a+("bottom"!==s?-h*o:0);f!==g&&(i=m,a=p),m!==p&&(e=f,n=g)}l.beginPath(),l.fillStyle=u.backgroundColor,l.strokeStyle=u.borderColor,l.lineWidth=d;var v=[[e,a],[e,i],[n,i],[n,a]],b=["bottom","left","top","right"],y=b.indexOf(s,0);y===-1&&(y=0);var x=t(0);l.moveTo(x[0],x[1]);for(var k=1;k<4;k++)x=t(k),l.lineTo(x[0],x[1]);l.fill(),d&&l.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var i=!1;if(this._view){var a=n(this);i=t>=a.left&&t<=a.right&&e>=a.top&&e<=a.bottom}return i},inLabelRange:function(t,i){var a=this;if(!a._view)return!1;var r=!1,o=n(a);return r=e(a)?t>=o.left&&t<=o.right:i>=o.top&&i<=o.bottom},inXRange:function(t){var e=n(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=n(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,n,i=this._view;return e(this)?(t=i.x,n=(i.y+i.base)/2):(t=(i.x+i.base)/2,n=i.y),{x:t,y:n}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})}},{}],41:[function(t,e,n){"use strict";e.exports=function(t){function e(t,e){var n=l.getStyle(t,e),i=n&&n.match(/(\d+)px/);return i?Number(i[1]):void 0}function n(t,n){var i=t.style,a=t.getAttribute("height"),r=t.getAttribute("width");if(t._chartjs={initial:{height:a,width:r,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",null===r||""===r){var o=e(t,"width");void 0!==o&&(t.width=o)}if(null===a||""===a)if(""===t.style.height)t.height=t.width/(n.options.aspectRatio||2);else{var s=e(t,"height");void 0!==o&&(t.height=s)}return t}function i(t,e,n,i,a){return{type:t,chart:e,native:a||null,x:void 0!==n?n:null,y:void 0!==i?i:null}}function a(t,e){var n=u[t.type]||t.type,a=l.getRelativePosition(t,e);return i(n,e,a.x,a.y,t)}function r(t){var e=document.createElement("iframe");return e.className="chartjs-hidden-iframe",e.style.cssText="display:block;overflow:hidden;border:0;margin:0;top:0;left:0;bottom:0;right:0;height:100%;width:100%;position:absolute;pointer-events:none;z-index:-1;",e.tabIndex=-1,l.addEvent(e,"load",function(){l.addEvent(e.contentWindow||e,"resize",t),t()}),e}function o(t,e,n){var a=t._chartjs={ticking:!1},o=function(){a.ticking||(a.ticking=!0,l.requestAnimFrame.call(window,function(){if(a.resizer)return a.ticking=!1,e(i("resize",n))}))};a.resizer=r(o),t.insertBefore(a.resizer,t.firstChild)}function s(t){if(t&&t._chartjs){var e=t._chartjs.resizer;e&&(e.parentNode.removeChild(e),t._chartjs.resizer=null),delete t._chartjs}}var l=t.helpers,u={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};return{acquireContext:function(t,e){if("string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t instanceof HTMLCanvasElement){var i=t.getContext&&t.getContext("2d");if(i instanceof CanvasRenderingContext2D)return n(t,e),i}return null},releaseContext:function(t){var e=t.canvas;if(e._chartjs){var n=e._chartjs.initial;["height","width"].forEach(function(t){var i=n[t];void 0===i||null===i?e.removeAttribute(t):e.setAttribute(t,i)}),l.each(n.style||{},function(t,n){e.style[n]=t}),e.width=e.width,delete e._chartjs}},addEventListener:function(t,e,n){var i=t.chart.canvas;if("resize"===e)return void o(i.parentNode,n,t.chart);var r=n._chartjs||(n._chartjs={}),s=r.proxies||(r.proxies={}),u=s[t.id+"_"+e]=function(e){n(a(e,t.chart))};l.addEvent(i,e,u)},removeEventListener:function(t,e,n){var i=t.chart.canvas;if("resize"===e)return void s(i.parentNode,n);var a=n._chartjs||{},r=a.proxies||{},o=r[t.id+"_"+e];o&&l.removeEvent(i,e,o)}}}},{}],42:[function(t,e,n){"use strict";var i=t(41);e.exports=function(t){t.platform={acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},t.helpers.extend(t.platform,i(t))}},{41:41}],43:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers,n={position:"bottom"},i=t.Scale.extend({getLabels:function(){var t=this.chart.data;return(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,n=t.getLabels();t.minIndex=0,t.maxIndex=n.length-1;var i;void 0!==t.options.ticks.min&&(i=e.indexOf(n,t.options.ticks.min),t.minIndex=i!==-1?i:t.minIndex),void 0!==t.options.ticks.max&&(i=e.indexOf(n,t.options.ticks.max),t.maxIndex=i!==-1?i:t.maxIndex),t.min=n[t.minIndex],t.max=n[t.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var n=this,i=n.chart.data,a=n.isHorizontal();return i.yLabels&&!a?n.getRightValue(i.datasets[e].data[t]):n.ticks[t-n.minIndex]},getPixelForValue:function(t,e,n,i){var a=this,r=Math.max(a.maxIndex+1-a.minIndex-(a.options.gridLines.offsetGridLines?0:1),1);if(void 0!==t&&isNaN(e)){var o=a.getLabels(),s=o.indexOf(t);e=s!==-1?s:e}if(a.isHorizontal()){var l=a.width/r,u=l*(e-a.minIndex);return(a.options.gridLines.offsetGridLines&&i||a.maxIndex===a.minIndex&&i)&&(u+=l/2),a.left+Math.round(u)}var d=a.height/r,c=d*(e-a.minIndex);return a.options.gridLines.offsetGridLines&&i&&(c+=d/2),a.top+Math.round(c)},getPixelForTick:function(t,e){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null,e)},getValueForPixel:function(t){var e,n=this,i=Math.max(n.ticks.length-(n.options.gridLines.offsetGridLines?0:1),1),a=n.isHorizontal(),r=(a?n.width:n.height)/i;return t-=a?n.left:n.top,n.options.gridLines.offsetGridLines&&(t-=r/2),e=t<=0?0:Math.round(t/r)},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",i,n)}},{}],44:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers,n={position:"left",ticks:{callback:t.Ticks.formatters.linear}},i=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return s?t.xAxisID===n.id:t.yAxisID===n.id}var n=this,i=n.options,a=n.chart,r=a.data,o=r.datasets,s=n.isHorizontal();n.min=null,n.max=null;var l=i.stacked;if(void 0===l&&e.each(o,function(e,n){if(!l){var i=a.getDatasetMeta(n);a.isDatasetVisible(n)&&t(i)&&void 0!==i.stack&&(l=!0)}}),i.stacked||l){var u={};e.each(o,function(r,o){var s=a.getDatasetMeta(o),l=[s.type,void 0===i.stacked&&void 0===s.stack?o:"",s.stack].join(".");void 0===u[l]&&(u[l]={positiveValues:[],negativeValues:[]});var d=u[l].positiveValues,c=u[l].negativeValues;a.isDatasetVisible(o)&&t(s)&&e.each(r.data,function(t,e){var a=+n.getRightValue(t);isNaN(a)||s.data[e].hidden||(d[e]=d[e]||0,c[e]=c[e]||0,i.relativePoints?d[e]=100:a<0?c[e]+=a:d[e]+=a)})}),e.each(u,function(t){var i=t.positiveValues.concat(t.negativeValues),a=e.min(i),r=e.max(i);n.min=null===n.min?a:Math.min(n.min,a),n.max=null===n.max?r:Math.max(n.max,r)})}else e.each(o,function(i,r){var o=a.getDatasetMeta(r);a.isDatasetVisible(r)&&t(o)&&e.each(i.data,function(t,e){var i=+n.getRightValue(t);isNaN(i)||o.data[e].hidden||(null===n.min?n.min=i:i<n.min&&(n.min=i),null===n.max?n.max=i:i>n.max&&(n.max=i))})});this.handleTickRangeOptions()},getTickLimit:function(){var n,i=this,a=i.options.ticks;if(i.isHorizontal())n=Math.min(a.maxTicksLimit?a.maxTicksLimit:11,Math.ceil(i.width/50));else{var r=e.getValueOrDefault(a.fontSize,t.defaults.global.defaultFontSize);n=Math.min(a.maxTicksLimit?a.maxTicksLimit:11,Math.ceil(i.height/(2*r)))}return n},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,n=this,i=n.start,a=+n.getRightValue(t),r=n.end-i;return n.isHorizontal()?(e=n.left+n.width/r*(a-i),Math.round(e)):(e=n.bottom-n.height/r*(a-i),Math.round(e))},getValueForPixel:function(t){var e=this,n=e.isHorizontal(),i=n?e.width:e.height,a=(n?t-e.left:e.bottom-t)/i;return e.start+(e.end-e.start)*a},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",i,n)}},{}],45:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers,n=e.noop;t.LinearScaleBase=t.Scale.extend({handleTickRangeOptions:function(){var t=this,n=t.options,i=n.ticks;if(i.beginAtZero){var a=e.sign(t.min),r=e.sign(t.max);a<0&&r<0?t.max=0:a>0&&r>0&&(t.min=0)}void 0!==i.min?t.min=i.min:void 0!==i.suggestedMin&&(t.min=Math.min(t.min,i.suggestedMin)),void 0!==i.max?t.max=i.max:void 0!==i.suggestedMax&&(t.max=Math.max(t.max,i.suggestedMax)),t.min===t.max&&(t.max++,i.beginAtZero||t.min--)},getTickLimit:n,handleDirectionalChanges:n,buildTicks:function(){var n=this,i=n.options,a=i.ticks,r=n.getTickLimit();r=Math.max(2,r);var o={maxTicks:r,min:a.min,max:a.max,stepSize:e.getValueOrDefault(a.fixedStepSize,a.stepSize)},s=n.ticks=t.Ticks.generators.linear(o,n);n.handleDirectionalChanges(),n.max=e.max(s),n.min=e.min(s),a.reverse?(s.reverse(),n.start=n.max,n.end=n.min):(n.start=n.min,n.end=n.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{}],46:[function(t,e,n){"use strict";e.exports=function(t){var e=t.helpers,n={position:"left",ticks:{callback:t.Ticks.formatters.logarithmic}},i=t.Scale.extend({determineDataLimits:function(){function t(t){return u?t.xAxisID===n.id:t.yAxisID===n.id}var n=this,i=n.options,a=i.ticks,r=n.chart,o=r.data,s=o.datasets,l=e.getValueOrDefault,u=n.isHorizontal();n.min=null,n.max=null,n.minNotZero=null;var d=i.stacked;if(void 0===d&&e.each(s,function(e,n){if(!d){var i=r.getDatasetMeta(n);r.isDatasetVisible(n)&&t(i)&&void 0!==i.stack&&(d=!0)}}),i.stacked||d){var c={};e.each(s,function(a,o){var s=r.getDatasetMeta(o),l=[s.type,void 0===i.stacked&&void 0===s.stack?o:"",s.stack].join(".");r.isDatasetVisible(o)&&t(s)&&(void 0===c[l]&&(c[l]=[]),e.each(a.data,function(t,e){var a=c[l],r=+n.getRightValue(t);isNaN(r)||s.data[e].hidden||(a[e]=a[e]||0,i.relativePoints?a[e]=100:a[e]+=r)}))}),e.each(c,function(t){var i=e.min(t),a=e.max(t);n.min=null===n.min?i:Math.min(n.min,i),n.max=null===n.max?a:Math.max(n.max,a)})}else e.each(s,function(i,a){var o=r.getDatasetMeta(a);r.isDatasetVisible(a)&&t(o)&&e.each(i.data,function(t,e){var i=+n.getRightValue(t);isNaN(i)||o.data[e].hidden||(null===n.min?n.min=i:i<n.min&&(n.min=i),null===n.max?n.max=i:i>n.max&&(n.max=i),0!==i&&(null===n.minNotZero||i<n.minNotZero)&&(n.minNotZero=i))})});n.min=l(a.min,n.min),n.max=l(a.max,n.max),n.min===n.max&&(0!==n.min&&null!==n.min?(n.min=Math.pow(10,Math.floor(e.log10(n.min))-1),n.max=Math.pow(10,Math.floor(e.log10(n.max))+1)):(n.min=1,n.max=10))},buildTicks:function(){var n=this,i=n.options,a=i.ticks,r={min:a.min,max:a.max},o=n.ticks=t.Ticks.generators.logarithmic(r,n);n.isHorizontal()||o.reverse(),n.max=e.max(o),n.min=e.min(o),a.reverse?(o.reverse(),n.start=n.max,n.end=n.min):(n.start=n.min,n.end=n.max)},convertTicksToLabels:function(){this.tickValues=this.ticks.slice(),t.Scale.prototype.convertTicksToLabels.call(this)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForTick:function(t){return this.getPixelForValue(this.tickValues[t])},getPixelForValue:function(t){var n,i,a,r=this,o=r.start,s=+r.getRightValue(t),l=r.options,u=l.ticks;return r.isHorizontal()?(a=e.log10(r.end)-e.log10(o),0===s?i=r.left:(n=r.width,i=r.left+n/a*(e.log10(s)-e.log10(o)))):(n=r.height,0!==o||u.reverse?0===r.end&&u.reverse?(a=e.log10(r.start)-e.log10(r.minNotZero),i=s===r.end?r.top:s===r.minNotZero?r.top+.02*n:r.top+.02*n+.98*n/a*(e.log10(s)-e.log10(r.minNotZero))):(a=e.log10(r.end)-e.log10(o),n=r.height,i=r.bottom-n/a*(e.log10(s)-e.log10(o))):(a=e.log10(r.end)-e.log10(r.minNotZero),i=s===o?r.bottom:s===r.minNotZero?r.bottom-.02*n:r.bottom-.02*n-.98*n/a*(e.log10(s)-e.log10(r.minNotZero)))),i},getValueForPixel:function(t){var n,i,a=this,r=e.log10(a.end)-e.log10(a.start);return a.isHorizontal()?(i=a.width,n=a.start*Math.pow(10,(t-a.left)*r/i)):(i=a.height,n=Math.pow(10,(a.bottom-t)*r/i)/a.start),n}});t.scaleService.registerScaleType("logarithmic",i,n)}},{}],47:[function(t,e,n){"use strict";e.exports=function(t){function e(t){return t.options.lineArc?0:t.chart.data.labels.length}function n(t){var e=t.options.pointLabels,n=f.getValueOrDefault(e.fontSize,g.defaultFontSize),i=f.getValueOrDefault(e.fontStyle,g.defaultFontStyle),a=f.getValueOrDefault(e.fontFamily,g.defaultFontFamily),r=f.fontString(n,i,a);return{size:n,style:i,family:a,font:r}}function i(t,e,n){return f.isArray(n)?{w:f.longestText(t,t.font,n),h:n.length*e+1.5*(n.length-1)*e}:{w:t.measureText(n).width,h:e}}function a(t,e,n,i,a){return t===i||t===a?{start:e-n/2,end:e+n/2}:t<i||t>a?{start:e-n-5,end:e}:{start:e,end:e+n+5}}function r(t){var r,o,s,l=n(t),u=Math.min(t.height/2,t.width/2),d={l:t.width,r:0,t:t.height,b:0},c={};t.ctx.font=l.font,t._pointLabelSizes=[];var h=e(t);for(r=0;r<h;r++){s=t.getPointPosition(r,u),o=i(t.ctx,l.size,t.pointLabels[r]||""),t._pointLabelSizes[r]=o;var g=t.getIndexAngle(r),m=f.toDegrees(g)%360,p=a(m,s.x,o.w,0,180),v=a(m,s.y,o.h,90,270);p.start<d.l&&(d.l=p.start,c.l=g),p.end>d.r&&(d.r=p.end,c.r=g),v.start<d.t&&(d.t=v.start,c.t=g),v.end>d.b&&(d.b=v.end,c.b=g)}t.setReductions(u,d,c)}function o(t){var e=Math.min(t.height/2,t.width/2);t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0)}function s(t){return 0===t||180===t?"center":t<180?"left":"right"}function l(t,e,n,i){if(f.isArray(e))for(var a=n.y,r=1.5*i,o=0;o<e.length;++o)t.fillText(e[o],n.x,a),a+=r;else t.fillText(e,n.x,n.y)}function u(t,e,n){90===t||270===t?n.y-=e.h/2:(t>270||t<90)&&(n.y-=e.h)}function d(t){var i=t.ctx,a=f.getValueOrDefault,r=t.options,o=r.angleLines,d=r.pointLabels;i.lineWidth=o.lineWidth,i.strokeStyle=o.color;var c=t.getDistanceFromCenterForValue(r.reverse?t.min:t.max),h=n(t);i.textBaseline="top";for(var m=e(t)-1;m>=0;m--){if(o.display){var p=t.getPointPosition(m,c);i.beginPath(),i.moveTo(t.xCenter,t.yCenter),i.lineTo(p.x,p.y),i.stroke(),i.closePath()}var v=t.getPointPosition(m,c+5),b=a(d.fontColor,g.defaultFontColor);i.font=h.font,i.fillStyle=b;var y=t.getIndexAngle(m),x=f.toDegrees(y);i.textAlign=s(x),u(x,t._pointLabelSizes[m],v),l(i,t.pointLabels[m]||"",v,h.size)}}function c(t,n,i,a){var r=t.ctx;if(r.strokeStyle=f.getValueAtIndexOrDefault(n.color,a-1),r.lineWidth=f.getValueAtIndexOrDefault(n.lineWidth,a-1),t.options.lineArc)r.beginPath(),r.arc(t.xCenter,t.yCenter,i,0,2*Math.PI),r.closePath(),r.stroke();else{var o=e(t);if(0===o)return;r.beginPath();var s=t.getPointPosition(0,i);r.moveTo(s.x,s.y);for(var l=1;l<o;l++)s=t.getPointPosition(l,i),r.lineTo(s.x,s.y);r.closePath(),r.stroke()}}function h(t){return f.isNumber(t)?t:0}var f=t.helpers,g=t.defaults.global,m={display:!0,animate:!0,lineArc:!1,position:"chartArea",angleLines:{display:!0,color:"rgba(0, 0, 0, 0.1)",lineWidth:1},ticks:{showLabelBackdrop:!0,backdropColor:"rgba(255,255,255,0.75)",backdropPaddingY:2,backdropPaddingX:2,callback:t.Ticks.formatters.linear},pointLabels:{fontSize:10,callback:function(t){return t}}},p=t.LinearScaleBase.extend({setDimensions:function(){var t=this,e=t.options,n=e.ticks;t.width=t.maxWidth,t.height=t.maxHeight,t.xCenter=Math.round(t.width/2),t.yCenter=Math.round(t.height/2);var i=f.min([t.height,t.width]),a=f.getValueOrDefault(n.fontSize,g.defaultFontSize);t.drawingArea=e.display?i/2-(a/2+n.backdropPaddingY):i/2},determineDataLimits:function(){var t=this,e=t.chart,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;f.each(e.data.datasets,function(a,r){if(e.isDatasetVisible(r)){var o=e.getDatasetMeta(r);f.each(a.data,function(e,a){var r=+t.getRightValue(e);isNaN(r)||o.data[a].hidden||(n=Math.min(r,n),i=Math.max(r,i))})}}),t.min=n===Number.POSITIVE_INFINITY?0:n,t.max=i===Number.NEGATIVE_INFINITY?0:i,t.handleTickRangeOptions()},getTickLimit:function(){var t=this.options.ticks,e=f.getValueOrDefault(t.fontSize,g.defaultFontSize);return Math.min(t.maxTicksLimit?t.maxTicksLimit:11,Math.ceil(this.drawingArea/(1.5*e)))},convertTicksToLabels:function(){var e=this;t.LinearScaleBase.prototype.convertTicksToLabels.call(e),e.pointLabels=e.chart.data.labels.map(e.options.pointLabels.callback,e)},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},fit:function(){this.options.lineArc?o(this):r(this)},setReductions:function(t,e,n){var i=this,a=e.l/Math.sin(n.l),r=Math.max(e.r-i.width,0)/Math.sin(n.r),o=-e.t/Math.cos(n.t),s=-Math.max(e.b-i.height,0)/Math.cos(n.b);a=h(a),r=h(r),o=h(o),s=h(s),i.drawingArea=Math.min(Math.round(t-(a+r)/2),Math.round(t-(o+s)/2)),i.setCenterPoint(a,r,o,s)},setCenterPoint:function(t,e,n,i){var a=this,r=a.width-e-a.drawingArea,o=t+a.drawingArea,s=n+a.drawingArea,l=a.height-i-a.drawingArea;a.xCenter=Math.round((o+r)/2+a.left),a.yCenter=Math.round((s+l)/2+a.top)},getIndexAngle:function(t){var n=2*Math.PI/e(this),i=this.chart.options&&this.chart.options.startAngle?this.chart.options.startAngle:0,a=i*Math.PI*2/360;return t*n+a},getDistanceFromCenterForValue:function(t){var e=this;if(null===t)return 0;var n=e.drawingArea/(e.max-e.min);return e.options.reverse?(e.max-t)*n:(t-e.min)*n},getPointPosition:function(t,e){var n=this,i=n.getIndexAngle(t)-Math.PI/2;return{x:Math.round(Math.cos(i)*e)+n.xCenter,y:Math.round(Math.sin(i)*e)+n.yCenter}},getPointPositionForValue:function(t,e){return this.getPointPosition(t,this.getDistanceFromCenterForValue(e))},getBasePosition:function(){var t=this,e=t.min,n=t.max;return t.getPointPositionForValue(0,t.beginAtZero?0:e<0&&n<0?n:e>0&&n>0?e:0)},draw:function(){var t=this,e=t.options,n=e.gridLines,i=e.ticks,a=f.getValueOrDefault;
|
16 |
+
if(e.display){var r=t.ctx,o=a(i.fontSize,g.defaultFontSize),s=a(i.fontStyle,g.defaultFontStyle),l=a(i.fontFamily,g.defaultFontFamily),u=f.fontString(o,s,l);f.each(t.ticks,function(s,l){if(l>0||e.reverse){var d=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),h=t.yCenter-d;if(n.display&&0!==l&&c(t,n,d,l),i.display){var f=a(i.fontColor,g.defaultFontColor);if(r.font=u,i.showLabelBackdrop){var m=r.measureText(s).width;r.fillStyle=i.backdropColor,r.fillRect(t.xCenter-m/2-i.backdropPaddingX,h-o/2-i.backdropPaddingY,m+2*i.backdropPaddingX,o+2*i.backdropPaddingY)}r.textAlign="center",r.textBaseline="middle",r.fillStyle=f,r.fillText(s,t.xCenter,h)}}}),e.lineArc||d(t)}}});t.scaleService.registerScaleType("radialLinear",p,m)}},{}],48:[function(t,e,n){"use strict";var i=t(6);i="function"==typeof i?i:window.moment,e.exports=function(t){var e=t.helpers,n={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},a={position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},r=t.Scale.extend({initialize:function(){if(!i)throw new Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");t.Scale.prototype.initialize.call(this)},getLabelMoment:function(t,e){return null===t||null===e?null:"undefined"!=typeof this.labelMoments[t]?this.labelMoments[t][e]:null},getLabelDiff:function(t,e){var n=this;return null===t||null===e?null:(void 0===n.labelDiffs&&n.buildLabelDiffs(),"undefined"!=typeof n.labelDiffs[t]?n.labelDiffs[t][e]:null)},getMomentStartOf:function(t){var e=this;return"week"===e.options.time.unit&&e.options.time.isoWeekday!==!1?t.clone().startOf("isoWeek").isoWeekday(e.options.time.isoWeekday):t.clone().startOf(e.tickUnit)},determineDataLimits:function(){var t=this;t.labelMoments=[];var n=[];t.chart.data.labels&&t.chart.data.labels.length>0?(e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),n.push(i))},t),t.firstTick=i.min.call(t,n),t.lastTick=i.max.call(t,n)):(t.firstTick=null,t.lastTick=null),e.each(t.chart.data.datasets,function(a,r){var o=[],s=t.chart.isDatasetVisible(r);"object"==typeof a.data[0]&&null!==a.data[0]?e.each(a.data,function(e){var n=t.parseTime(t.getRightValue(e));n.isValid()&&(t.options.time.round&&n.startOf(t.options.time.round),o.push(n),s&&(t.firstTick=null!==t.firstTick?i.min(t.firstTick,n):n,t.lastTick=null!==t.lastTick?i.max(t.lastTick,n):n))},t):o=n,t.labelMoments.push(o)},t),t.options.time.min&&(t.firstTick=t.parseTime(t.options.time.min)),t.options.time.max&&(t.lastTick=t.parseTime(t.options.time.max)),t.firstTick=(t.firstTick||i()).clone(),t.lastTick=(t.lastTick||i()).clone()},buildLabelDiffs:function(){var t=this;t.labelDiffs=[];var n=[];t.chart.data.labels&&t.chart.data.labels.length>0&&e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),n.push(i.diff(t.firstTick,t.tickUnit,!0)))},t),e.each(t.chart.data.datasets,function(i){var a=[];"object"==typeof i.data[0]&&null!==i.data[0]?e.each(i.data,function(e){var n=t.parseTime(t.getRightValue(e));n.isValid()&&(t.options.time.round&&n.startOf(t.options.time.round),a.push(n.diff(t.firstTick,t.tickUnit,!0)))},t):a=n,t.labelDiffs.push(a)},t)},buildTicks:function(){var i=this;i.ctx.save();var a=e.getValueOrDefault(i.options.ticks.fontSize,t.defaults.global.defaultFontSize),r=e.getValueOrDefault(i.options.ticks.fontStyle,t.defaults.global.defaultFontStyle),o=e.getValueOrDefault(i.options.ticks.fontFamily,t.defaults.global.defaultFontFamily),s=e.fontString(a,r,o);if(i.ctx.font=s,i.ticks=[],i.unitScale=1,i.scaleSizeInUnits=0,i.options.time.unit)i.tickUnit=i.options.time.unit||"day",i.displayFormat=i.options.time.displayFormats[i.tickUnit],i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,1);else{var l=i.isHorizontal()?i.width:i.height,u=i.tickFormatFunction(i.firstTick,0,[]),d=i.ctx.measureText(u).width,c=Math.cos(e.toRadians(i.options.ticks.maxRotation)),h=Math.sin(e.toRadians(i.options.ticks.maxRotation));d=d*c+a*h;var f=l/d;i.tickUnit=i.options.time.minUnit,i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.displayFormat=i.options.time.displayFormats[i.tickUnit];for(var g=0,m=n.units[g];g<n.units.length;){if(i.unitScale=1,e.isArray(m.steps)&&Math.ceil(i.scaleSizeInUnits/f)<e.max(m.steps)){for(var p=0;p<m.steps.length;++p)if(m.steps[p]>=Math.ceil(i.scaleSizeInUnits/f)){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,m.steps[p]);break}break}if(m.maxStep===!1||Math.ceil(i.scaleSizeInUnits/f)<m.maxStep){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,Math.ceil(i.scaleSizeInUnits/f));break}++g,m=n.units[g],i.tickUnit=m.name;var v=i.firstTick.diff(i.getMomentStartOf(i.firstTick),i.tickUnit,!0),b=i.getMomentStartOf(i.lastTick.clone().add(1,i.tickUnit)).diff(i.lastTick,i.tickUnit,!0);i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)+v+b,i.displayFormat=i.options.time.displayFormats[m.name]}}var y;if(i.options.time.min?y=i.getMomentStartOf(i.firstTick):(i.firstTick=i.getMomentStartOf(i.firstTick),y=i.firstTick),!i.options.time.max){var x=i.getMomentStartOf(i.lastTick),k=x.diff(i.lastTick,i.tickUnit,!0);k<0?i.lastTick=i.getMomentStartOf(i.lastTick.add(1,i.tickUnit)):k>=0&&(i.lastTick=x),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)}i.options.time.displayFormat&&(i.displayFormat=i.options.time.displayFormat),i.ticks.push(i.firstTick.clone());for(var _=i.unitScale;_<=i.scaleSizeInUnits;_+=i.unitScale){var w=y.clone().add(_,i.tickUnit);if(i.options.time.max&&w.diff(i.lastTick,i.tickUnit,!0)>=0)break;i.ticks.push(w)}var S=i.ticks[i.ticks.length-1].diff(i.lastTick,i.tickUnit);0===S&&0!==i.scaleSizeInUnits||(i.options.time.max?(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.ticks[0],i.tickUnit,!0)):(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0))),i.ctx.restore(),i.labelDiffs=void 0},getLabelForIndex:function(t,e){var n=this,i=n.chart.data.labels&&t<n.chart.data.labels.length?n.chart.data.labels[t]:"",a=n.chart.data.datasets[e].data[t];return null!==a&&"object"==typeof a&&(i=n.getRightValue(a)),n.options.time.tooltipFormat&&(i=n.parseTime(i).format(n.options.time.tooltipFormat)),i},tickFormatFunction:function(t,n,i){var a=t.format(this.displayFormat),r=this.options.ticks,o=e.getValueOrDefault(r.callback,r.userCallback);return o?o(a,n,i):a},convertTicksToLabels:function(){var t=this;t.tickMoments=t.ticks,t.ticks=t.ticks.map(t.tickFormatFunction,t)},getPixelForValue:function(t,e,n){var i=this,a=null;if(void 0!==e&&void 0!==n&&(a=i.getLabelDiff(n,e)),null===a&&(t&&t.isValid||(t=i.parseTime(i.getRightValue(t))),t&&t.isValid&&t.isValid()&&(a=t.diff(i.firstTick,i.tickUnit,!0))),null!==a){var r=0!==a?a/i.scaleSizeInUnits:a;if(i.isHorizontal()){var o=i.width*r;return i.left+Math.round(o)}var s=i.height*r;return i.top+Math.round(s)}},getPixelForTick:function(t){return this.getPixelForValue(this.tickMoments[t],null,null)},getValueForPixel:function(t){var e=this,n=e.isHorizontal()?e.width:e.height,a=(t-(e.isHorizontal()?e.left:e.top))/n;return a*=e.scaleSizeInUnits,e.firstTick.clone().add(i.duration(a,e.tickUnit).asSeconds(),"seconds")},parseTime:function(t){var e=this;return"string"==typeof e.options.time.parser?i(t,e.options.time.parser):"function"==typeof e.options.time.parser?e.options.time.parser(t):"function"==typeof t.getMonth||"number"==typeof t?i(t):t.isValid&&t.isValid()?t:"string"!=typeof e.options.time.format&&e.options.time.format.call?(console.warn("options.time.format is deprecated and replaced by options.time.parser. See http://nnnick.github.io/Chart.js/docs-v2/#scales-time-scale"),e.options.time.format(t)):i(t,e.options.time.format)}});t.scaleService.registerScaleType("time",r,a)}},{6:6}]},{},[7])(7)});
|
assets/js/vendor/circle-bar.js
ADDED
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
;(function ($) {
|
2 |
+
$.circleBar = function (el, options) {
|
3 |
+
this.options = $.extend({
|
4 |
+
value: 0
|
5 |
+
}, options || {});
|
6 |
+
|
7 |
+
var that = this,
|
8 |
+
$bg = $(el),
|
9 |
+
$bg50 = $(el).find('.before'),
|
10 |
+
$bg100 = $(el).find('.after'),
|
11 |
+
bgColor = '#DDD',
|
12 |
+
activeColor = '#FF0000';
|
13 |
+
|
14 |
+
function draw() {
|
15 |
+
var deg = that.options.value * 360 / 100;
|
16 |
+
$bg.removeClass('bg50 bg100')
|
17 |
+
if (that.options.value <= 50) {
|
18 |
+
$bg.addClass('bg50');
|
19 |
+
$bg50.css('transform', 'rotate(' + (-135 + deg) + 'deg)');
|
20 |
+
} else {
|
21 |
+
$bg.addClass('bg100');
|
22 |
+
$bg100.css('transform', 'rotate(' + (-135 + ((that.options.value - 50) * 180 / 50)) + 'deg)');
|
23 |
+
}
|
24 |
+
}
|
25 |
+
|
26 |
+
draw();
|
27 |
+
|
28 |
+
this.value = function (val) {
|
29 |
+
if (val) {
|
30 |
+
that.options.value = val;
|
31 |
+
draw();
|
32 |
+
return $bg;
|
33 |
+
}
|
34 |
+
|
35 |
+
return that.options.value;
|
36 |
+
}
|
37 |
+
}
|
38 |
+
$.fn.circleBar = function (options, val) {
|
39 |
+
if (typeof options === 'string') {
|
40 |
+
var $circleBar = $(this).data('circleBar');
|
41 |
+
if (!$circleBar) {
|
42 |
+
return null;
|
43 |
+
}
|
44 |
+
if ($circleBar[options]) {
|
45 |
+
return $circleBar[options].apply($circleBar, [val]);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
return $.each(this, function () {
|
49 |
+
var $circleBar = $(this).data('circleBar');
|
50 |
+
|
51 |
+
if (!$circleBar) {
|
52 |
+
$circleBar = new $.circleBar(this, options);
|
53 |
+
$(this).data('circleBar', $circleBar);
|
54 |
+
}
|
55 |
+
})
|
56 |
+
}
|
57 |
+
|
58 |
+
$(document).ready(function () {
|
59 |
+
var i = 0;
|
60 |
+
var $c = $('.quiz-result-overall').circleBar({
|
61 |
+
value: 45
|
62 |
+
});
|
63 |
+
var t = setInterval(function () {
|
64 |
+
$c.circleBar('value', i++);
|
65 |
+
if (i > 100) {
|
66 |
+
clearInterval(t);
|
67 |
+
}
|
68 |
+
|
69 |
+
}, 40)
|
70 |
+
})
|
71 |
+
|
72 |
+
})(jQuery);
|
assets/js/vendor/jquery-scrollbar/jquery.scrollbar.css
ADDED
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.scroll-wrapper {
|
2 |
+
overflow: hidden !important;
|
3 |
+
padding: 0 !important;
|
4 |
+
position: relative
|
5 |
+
}
|
6 |
+
|
7 |
+
.scroll-wrapper > .scroll-content {
|
8 |
+
border: none !important;
|
9 |
+
box-sizing: content-box !important;
|
10 |
+
height: auto;
|
11 |
+
left: 0;
|
12 |
+
margin: 0;
|
13 |
+
max-height: none;
|
14 |
+
max-width: none !important;
|
15 |
+
overflow: scroll !important;
|
16 |
+
padding: 0;
|
17 |
+
position: relative !important;
|
18 |
+
top: 0;
|
19 |
+
width: auto !important
|
20 |
+
}
|
21 |
+
|
22 |
+
.scroll-wrapper > .scroll-content::-webkit-scrollbar {
|
23 |
+
height: 0;
|
24 |
+
width: 0
|
25 |
+
}
|
26 |
+
|
27 |
+
.scroll-element {
|
28 |
+
display: none
|
29 |
+
}
|
30 |
+
|
31 |
+
.scroll-element, .scroll-element div {
|
32 |
+
box-sizing: content-box
|
33 |
+
}
|
34 |
+
|
35 |
+
.scroll-element.scroll-x.scroll-scrollx_visible, .scroll-element.scroll-y.scroll-scrolly_visible {
|
36 |
+
display: block
|
37 |
+
}
|
38 |
+
|
39 |
+
.scroll-element .scroll-arrow, .scroll-element .scroll-bar {
|
40 |
+
cursor: default
|
41 |
+
}
|
42 |
+
|
43 |
+
.scroll-textarea {
|
44 |
+
border: 1px solid #ccc;
|
45 |
+
border-top-color: #999
|
46 |
+
}
|
47 |
+
|
48 |
+
.scroll-textarea > .scroll-content {
|
49 |
+
overflow: hidden !important
|
50 |
+
}
|
51 |
+
|
52 |
+
.scroll-textarea > .scroll-content > textarea {
|
53 |
+
border: none !important;
|
54 |
+
box-sizing: border-box;
|
55 |
+
height: 100% !important;
|
56 |
+
margin: 0;
|
57 |
+
max-height: none !important;
|
58 |
+
max-width: none !important;
|
59 |
+
overflow: scroll !important;
|
60 |
+
outline: 0;
|
61 |
+
padding: 2px;
|
62 |
+
position: relative !important;
|
63 |
+
top: 0;
|
64 |
+
width: 100% !important
|
65 |
+
}
|
66 |
+
|
67 |
+
.scroll-textarea > .scroll-content > textarea::-webkit-scrollbar {
|
68 |
+
height: 0;
|
69 |
+
width: 0
|
70 |
+
}
|
71 |
+
|
72 |
+
.scrollbar-light > .scroll-element, .scrollbar-light > .scroll-element div {
|
73 |
+
border: none;
|
74 |
+
margin: 0;
|
75 |
+
overflow: hidden;
|
76 |
+
padding: 0;
|
77 |
+
position: absolute;
|
78 |
+
z-index: 10
|
79 |
+
}
|
80 |
+
|
81 |
+
.scrollbar-light > .scroll-element {
|
82 |
+
}
|
83 |
+
|
84 |
+
.scrollbar-light > .scroll-element div {
|
85 |
+
display: block;
|
86 |
+
height: 100%;
|
87 |
+
left: 5px;
|
88 |
+
top: 0;
|
89 |
+
width: 1px
|
90 |
+
}
|
91 |
+
|
92 |
+
.scrollbar-light > .scroll-element .scroll-element_outer {
|
93 |
+
-webkit-border-radius: 10px;
|
94 |
+
-moz-border-radius: 10px;
|
95 |
+
border-radius: 10px
|
96 |
+
}
|
97 |
+
|
98 |
+
.scrollbar-light > .scroll-element .scroll-element_size {
|
99 |
+
background: #dbdbdb;
|
100 |
+
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2RiZGJkYiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNlOGU4ZTgiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
|
101 |
+
background: -moz-linear-gradient(left, #dbdbdb 0, #e8e8e8 100%);
|
102 |
+
background: -webkit-gradient(linear, left top, right top, color-stop(0, #dbdbdb), color-stop(100%, #e8e8e8));
|
103 |
+
background: -webkit-linear-gradient(left, #dbdbdb 0, #e8e8e8 100%);
|
104 |
+
background: -o-linear-gradient(left, #dbdbdb 0, #e8e8e8 100%);
|
105 |
+
background: -ms-linear-gradient(left, #dbdbdb 0, #e8e8e8 100%);
|
106 |
+
background: linear-gradient(to right, #dbdbdb 0, #e8e8e8 100%);
|
107 |
+
-webkit-border-radius: 10px;
|
108 |
+
-moz-border-radius: 10px;
|
109 |
+
border-radius: 10px
|
110 |
+
}
|
111 |
+
|
112 |
+
.scrollbar-light > .scroll-element.scroll-x {
|
113 |
+
bottom: 0;
|
114 |
+
height: 17px;
|
115 |
+
left: 0;
|
116 |
+
min-width: 100%;
|
117 |
+
width: 100%
|
118 |
+
}
|
119 |
+
|
120 |
+
.scrollbar-light > .scroll-element.scroll-y {
|
121 |
+
height: 100%;
|
122 |
+
min-height: 100%;
|
123 |
+
right: 2px;
|
124 |
+
top: 0;
|
125 |
+
width: 12px;
|
126 |
+
opacity: 0
|
127 |
+
}
|
128 |
+
|
129 |
+
.scrollbar-light > .scroll-element .scroll-bar {
|
130 |
+
background: #fefefe;
|
131 |
+
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iI2ZlZmVmZSIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiNmNWY1ZjUiIHN0b3Atb3BhY2l0eT0iMSIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
|
132 |
+
background: -moz-linear-gradient(left, #fefefe 0, #f5f5f5 100%);
|
133 |
+
background: -webkit-gradient(linear, left top, right top, color-stop(0, #fefefe), color-stop(100%, #f5f5f5));
|
134 |
+
background: -webkit-linear-gradient(left, #fefefe 0, #f5f5f5 100%);
|
135 |
+
background: -o-linear-gradient(left, #fefefe 0, #f5f5f5 100%);
|
136 |
+
background: -ms-linear-gradient(left, #fefefe 0, #f5f5f5 100%);
|
137 |
+
background: linear-gradient(to right, #fefefe 0, #f5f5f5 100%);
|
138 |
+
-webkit-border-radius: 10px;
|
139 |
+
-moz-border-radius: 10px;
|
140 |
+
border-radius: 10px
|
141 |
+
}
|
142 |
+
|
143 |
+
.scrollbar-light > .scroll-element.scroll-y .scroll-bar {
|
144 |
+
left: 0;
|
145 |
+
min-height: 10px;
|
146 |
+
width: 11px;
|
147 |
+
background: #12b3ff;
|
148 |
+
opacity: .5;
|
149 |
+
transition: opacity .25s
|
150 |
+
}
|
151 |
+
|
152 |
+
.scrollbar-light > .scroll-element.scroll-y .scroll-bar:hover {
|
153 |
+
opacity: 1
|
154 |
+
}
|
155 |
+
|
156 |
+
.scrollbar-light > .scroll-element.scroll-x .scroll-element_size {
|
157 |
+
left: -4px;
|
158 |
+
width: 1px
|
159 |
+
}
|
160 |
+
|
161 |
+
.scrollbar-light > .scroll-element.scroll-y .scroll-element_outer {
|
162 |
+
left: 0;
|
163 |
+
top: 2px;
|
164 |
+
width: 12px
|
165 |
+
}
|
166 |
+
|
167 |
+
.scrollbar-light > .scroll-element.scroll-y .scroll-element_size {
|
168 |
+
top: -4px
|
169 |
+
}
|
170 |
+
|
171 |
+
.scrollbar-light > .scroll-element.scroll-x.scroll-scrolly_visible .scroll-element_size {
|
172 |
+
left: -19px
|
173 |
+
}
|
174 |
+
|
175 |
+
.scrollbar-light > .scroll-element.scroll-y.scroll-scrollx_visible .scroll-element_size {
|
176 |
+
top: -19px
|
177 |
+
}
|
178 |
+
|
179 |
+
.scrollbar-light > .scroll-element.scroll-x.scroll-scrolly_visible .scroll-element_track {
|
180 |
+
left: -19px
|
181 |
+
}
|
182 |
+
|
183 |
+
.scrollbar-light > .scroll-element.scroll-y.scroll-scrollx_visible .scroll-element_track {
|
184 |
+
top: -19px
|
185 |
+
}
|
assets/js/vendor/jquery-scrollbar/jquery.scrollbar.js
ADDED
@@ -0,0 +1,780 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* jQuery CSS Customizable Scrollbar
|
3 |
+
*
|
4 |
+
* Copyright 2015, Yuriy Khabarov
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
*
|
7 |
+
* If you found bug, please contact me via email <13real008@gmail.com>
|
8 |
+
*
|
9 |
+
* @author Yuriy Khabarov aka Gromo
|
10 |
+
* @version 0.2.10
|
11 |
+
* @url https://github.com/gromo/jquery.scrollbar/
|
12 |
+
*
|
13 |
+
*/
|
14 |
+
;
|
15 |
+
(function (root, factory) {
|
16 |
+
if (typeof define === 'function' && define.amd) {
|
17 |
+
define(['jquery'], factory);
|
18 |
+
} else {
|
19 |
+
factory(root.jQuery);
|
20 |
+
}
|
21 |
+
}(this, function ($) {
|
22 |
+
'use strict';
|
23 |
+
// init flags & variables
|
24 |
+
var debug = false;
|
25 |
+
|
26 |
+
var browser = {
|
27 |
+
data: {
|
28 |
+
index: 0,
|
29 |
+
name: 'scrollbar'
|
30 |
+
},
|
31 |
+
macosx: /mac/i.test(navigator.platform),
|
32 |
+
mobile: /android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent),
|
33 |
+
overlay: null,
|
34 |
+
scroll: null,
|
35 |
+
scrolls: [],
|
36 |
+
webkit: /webkit/i.test(navigator.userAgent) && !/edge\/\d+/i.test(navigator.userAgent)
|
37 |
+
};
|
38 |
+
|
39 |
+
browser.scrolls.add = function (instance) {
|
40 |
+
this.remove(instance).push(instance);
|
41 |
+
};
|
42 |
+
browser.scrolls.remove = function (instance) {
|
43 |
+
while ($.inArray(instance, this) >= 0) {
|
44 |
+
this.splice($.inArray(instance, this), 1);
|
45 |
+
}
|
46 |
+
return this;
|
47 |
+
};
|
48 |
+
|
49 |
+
var defaults = {
|
50 |
+
"autoScrollSize": true, // automatically calculate scrollsize
|
51 |
+
"autoUpdate": true, // update scrollbar if content/container size changed
|
52 |
+
"debug": false, // debug mode
|
53 |
+
"disableBodyScroll": false, // disable body scroll if mouse over container
|
54 |
+
"duration": 200, // scroll animate duration in ms
|
55 |
+
"ignoreMobile": false, // ignore mobile devices
|
56 |
+
"ignoreOverlay": false, // ignore browsers with overlay scrollbars (mobile, MacOS)
|
57 |
+
"scrollStep": 30, // scroll step for scrollbar arrows
|
58 |
+
"showArrows": false, // add class to show arrows
|
59 |
+
"stepScrolling": true, // when scrolling to scrollbar mousedown position
|
60 |
+
|
61 |
+
"scrollx": null, // horizontal scroll element
|
62 |
+
"scrolly": null, // vertical scroll element
|
63 |
+
|
64 |
+
"onDestroy": null, // callback function on destroy,
|
65 |
+
"onInit": null, // callback function on first initialization
|
66 |
+
"onScroll": null, // callback function on content scrolling
|
67 |
+
"onUpdate": null // callback function on init/resize (before scrollbar size calculation)
|
68 |
+
};
|
69 |
+
|
70 |
+
|
71 |
+
var BaseScrollbar = function (container) {
|
72 |
+
|
73 |
+
if (!browser.scroll) {
|
74 |
+
browser.overlay = isScrollOverlaysContent();
|
75 |
+
browser.scroll = getBrowserScrollSize();
|
76 |
+
updateScrollbars();
|
77 |
+
|
78 |
+
$(window).resize(function () {
|
79 |
+
var forceUpdate = false;
|
80 |
+
if (browser.scroll && (browser.scroll.height || browser.scroll.width)) {
|
81 |
+
var scroll = getBrowserScrollSize();
|
82 |
+
if (scroll.height !== browser.scroll.height || scroll.width !== browser.scroll.width) {
|
83 |
+
browser.scroll = scroll;
|
84 |
+
forceUpdate = true; // handle page zoom
|
85 |
+
}
|
86 |
+
}
|
87 |
+
updateScrollbars(forceUpdate);
|
88 |
+
});
|
89 |
+
}
|
90 |
+
|
91 |
+
this.container = container;
|
92 |
+
this.namespace = '.scrollbar_' + browser.data.index++;
|
93 |
+
this.options = $.extend({}, defaults, window.jQueryScrollbarOptions || {});
|
94 |
+
this.scrollTo = null;
|
95 |
+
this.scrollx = {};
|
96 |
+
this.scrolly = {};
|
97 |
+
|
98 |
+
container.data(browser.data.name, this);
|
99 |
+
browser.scrolls.add(this);
|
100 |
+
};
|
101 |
+
|
102 |
+
BaseScrollbar.prototype = {
|
103 |
+
|
104 |
+
destroy: function () {
|
105 |
+
|
106 |
+
if (!this.wrapper) {
|
107 |
+
return;
|
108 |
+
}
|
109 |
+
|
110 |
+
this.container.removeData(browser.data.name);
|
111 |
+
browser.scrolls.remove(this);
|
112 |
+
|
113 |
+
// init variables
|
114 |
+
var scrollLeft = this.container.scrollLeft();
|
115 |
+
var scrollTop = this.container.scrollTop();
|
116 |
+
|
117 |
+
this.container.insertBefore(this.wrapper).css({
|
118 |
+
"height": "",
|
119 |
+
"margin": "",
|
120 |
+
"max-height": ""
|
121 |
+
})
|
122 |
+
.removeClass('scroll-content scroll-scrollx_visible scroll-scrolly_visible')
|
123 |
+
.off(this.namespace)
|
124 |
+
.scrollLeft(scrollLeft)
|
125 |
+
.scrollTop(scrollTop);
|
126 |
+
|
127 |
+
this.scrollx.scroll.removeClass('scroll-scrollx_visible').find('div').andSelf().off(this.namespace);
|
128 |
+
this.scrolly.scroll.removeClass('scroll-scrolly_visible').find('div').andSelf().off(this.namespace);
|
129 |
+
|
130 |
+
this.wrapper.remove();
|
131 |
+
|
132 |
+
$(document).add('body').off(this.namespace);
|
133 |
+
|
134 |
+
if ($.isFunction(this.options.onDestroy)){
|
135 |
+
this.options.onDestroy.apply(this, [this.container]);
|
136 |
+
}
|
137 |
+
},
|
138 |
+
init: function (options) {
|
139 |
+
// init variables
|
140 |
+
var S = this,
|
141 |
+
c = this.container,
|
142 |
+
cw = this.containerWrapper || c,
|
143 |
+
namespace = this.namespace,
|
144 |
+
o = $.extend(this.options, options || {}),
|
145 |
+
s = {x: this.scrollx, y: this.scrolly},
|
146 |
+
w = this.wrapper;
|
147 |
+
|
148 |
+
var initScroll = {
|
149 |
+
"scrollLeft": c.scrollLeft(),
|
150 |
+
"scrollTop": c.scrollTop()
|
151 |
+
};
|
152 |
+
|
153 |
+
// do not init if in ignorable browser
|
154 |
+
if ((browser.mobile && o.ignoreMobile)
|
155 |
+
|| (browser.overlay && o.ignoreOverlay)
|
156 |
+
|| (browser.macosx && !browser.webkit) // still required to ignore nonWebKit browsers on Mac
|
157 |
+
) {
|
158 |
+
//return false;
|
159 |
+
}
|
160 |
+
|
161 |
+
// init scroll container
|
162 |
+
if (!w) {
|
163 |
+
this.wrapper = w = $('<div>').addClass('scroll-wrapper').addClass(c.attr('class'))
|
164 |
+
.css('position', c.css('position') == 'absolute' ? 'absolute' : 'relative')
|
165 |
+
.insertBefore(c).append(c);
|
166 |
+
|
167 |
+
if (c.is('textarea')) {
|
168 |
+
this.containerWrapper = cw = $('<div>').insertBefore(c).append(c);
|
169 |
+
w.addClass('scroll-textarea');
|
170 |
+
}
|
171 |
+
|
172 |
+
cw.addClass('scroll-content').css({
|
173 |
+
"height": "auto",
|
174 |
+
"margin-bottom": browser.scroll.height * -1 + 'px',
|
175 |
+
"margin-right": browser.scroll.width * -1 + 'px',
|
176 |
+
"max-height": ""
|
177 |
+
});
|
178 |
+
|
179 |
+
c.on('scroll' + namespace, function (event) {
|
180 |
+
if ($.isFunction(o.onScroll)) {
|
181 |
+
o.onScroll.call(S, {
|
182 |
+
"maxScroll": s.y.maxScrollOffset,
|
183 |
+
"scroll": c.scrollTop(),
|
184 |
+
"size": s.y.size,
|
185 |
+
"visible": s.y.visible
|
186 |
+
}, {
|
187 |
+
"maxScroll": s.x.maxScrollOffset,
|
188 |
+
"scroll": c.scrollLeft(),
|
189 |
+
"size": s.x.size,
|
190 |
+
"visible": s.x.visible
|
191 |
+
});
|
192 |
+
}
|
193 |
+
s.x.isVisible && s.x.scroll.bar.css('left', c.scrollLeft() * s.x.kx + 'px');
|
194 |
+
s.y.isVisible && s.y.scroll.bar.css('top', c.scrollTop() * s.y.kx + 'px');
|
195 |
+
});
|
196 |
+
|
197 |
+
/* prevent native scrollbars to be visible on #anchor click */
|
198 |
+
w.on('scroll' + namespace, function () {
|
199 |
+
w.scrollTop(0).scrollLeft(0);
|
200 |
+
});
|
201 |
+
|
202 |
+
if (o.disableBodyScroll) {
|
203 |
+
var handleMouseScroll = function (event) {
|
204 |
+
isVerticalScroll(event) ?
|
205 |
+
s.y.isVisible && s.y.mousewheel(event) :
|
206 |
+
s.x.isVisible && s.x.mousewheel(event);
|
207 |
+
};
|
208 |
+
w.on('MozMousePixelScroll' + namespace, handleMouseScroll);
|
209 |
+
w.on('mousewheel' + namespace, handleMouseScroll);
|
210 |
+
|
211 |
+
if (browser.mobile) {
|
212 |
+
w.on('touchstart' + namespace, function (event) {
|
213 |
+
var touch = event.originalEvent.touches && event.originalEvent.touches[0] || event;
|
214 |
+
var originalTouch = {
|
215 |
+
"pageX": touch.pageX,
|
216 |
+
"pageY": touch.pageY
|
217 |
+
};
|
218 |
+
var originalScroll = {
|
219 |
+
"left": c.scrollLeft(),
|
220 |
+
"top": c.scrollTop()
|
221 |
+
};
|
222 |
+
$(document).on('touchmove' + namespace, function (event) {
|
223 |
+
var touch = event.originalEvent.targetTouches && event.originalEvent.targetTouches[0] || event;
|
224 |
+
c.scrollLeft(originalScroll.left + originalTouch.pageX - touch.pageX);
|
225 |
+
c.scrollTop(originalScroll.top + originalTouch.pageY - touch.pageY);
|
226 |
+
event.preventDefault();
|
227 |
+
});
|
228 |
+
$(document).on('touchend' + namespace, function () {
|
229 |
+
$(document).off(namespace);
|
230 |
+
});
|
231 |
+
});
|
232 |
+
}
|
233 |
+
}
|
234 |
+
if ($.isFunction(o.onInit)){
|
235 |
+
o.onInit.apply(this, [c]);
|
236 |
+
}
|
237 |
+
|
238 |
+
} else {
|
239 |
+
cw.css({
|
240 |
+
"height": "auto",
|
241 |
+
"margin-bottom": browser.scroll.height * -1 + 'px',
|
242 |
+
"margin-right": browser.scroll.width * -1 + 'px',
|
243 |
+
"max-height": ""
|
244 |
+
});
|
245 |
+
}
|
246 |
+
|
247 |
+
// init scrollbars & recalculate sizes
|
248 |
+
$.each(s, function (d, scrollx) {
|
249 |
+
|
250 |
+
var scrollCallback = null;
|
251 |
+
var scrollForward = 1;
|
252 |
+
var scrollOffset = (d === 'x') ? 'scrollLeft' : 'scrollTop';
|
253 |
+
var scrollStep = o.scrollStep;
|
254 |
+
var scrollTo = function () {
|
255 |
+
var currentOffset = c[scrollOffset]();
|
256 |
+
c[scrollOffset](currentOffset + scrollStep);
|
257 |
+
if (scrollForward == 1 && (currentOffset + scrollStep) >= scrollToValue)
|
258 |
+
currentOffset = c[scrollOffset]();
|
259 |
+
if (scrollForward == -1 && (currentOffset + scrollStep) <= scrollToValue)
|
260 |
+
currentOffset = c[scrollOffset]();
|
261 |
+
if (c[scrollOffset]() == currentOffset && scrollCallback) {
|
262 |
+
scrollCallback();
|
263 |
+
}
|
264 |
+
}
|
265 |
+
var scrollToValue = 0;
|
266 |
+
|
267 |
+
if (!scrollx.scroll) {
|
268 |
+
|
269 |
+
scrollx.scroll = S._getScroll(o['scroll' + d]).addClass('scroll-' + d);
|
270 |
+
|
271 |
+
if(o.showArrows){
|
272 |
+
scrollx.scroll.addClass('scroll-element_arrows_visible');
|
273 |
+
}
|
274 |
+
|
275 |
+
scrollx.mousewheel = function (event) {
|
276 |
+
|
277 |
+
if (!scrollx.isVisible || (d === 'x' && isVerticalScroll(event))) {
|
278 |
+
return true;
|
279 |
+
}
|
280 |
+
if (d === 'y' && !isVerticalScroll(event)) {
|
281 |
+
s.x.mousewheel(event);
|
282 |
+
return true;
|
283 |
+
}
|
284 |
+
|
285 |
+
var delta = event.originalEvent.wheelDelta * -1 || event.originalEvent.detail;
|
286 |
+
var maxScrollValue = scrollx.size - scrollx.visible - scrollx.offset;
|
287 |
+
|
288 |
+
if ((delta > 0 && scrollToValue < maxScrollValue) || (delta < 0 && scrollToValue > 0)) {
|
289 |
+
scrollToValue = scrollToValue + delta;
|
290 |
+
if (scrollToValue < 0)
|
291 |
+
scrollToValue = 0;
|
292 |
+
if (scrollToValue > maxScrollValue)
|
293 |
+
scrollToValue = maxScrollValue;
|
294 |
+
|
295 |
+
S.scrollTo = S.scrollTo || {};
|
296 |
+
S.scrollTo[scrollOffset] = scrollToValue;
|
297 |
+
setTimeout(function () {
|
298 |
+
if (S.scrollTo) {
|
299 |
+
c.stop().animate(S.scrollTo, 240, 'linear', function () {
|
300 |
+
scrollToValue = c[scrollOffset]();
|
301 |
+
});
|
302 |
+
S.scrollTo = null;
|
303 |
+
}
|
304 |
+
}, 1);
|
305 |
+
}
|
306 |
+
|
307 |
+
event.preventDefault();
|
308 |
+
return false;
|
309 |
+
};
|
310 |
+
|
311 |
+
scrollx.scroll
|
312 |
+
.on('MozMousePixelScroll' + namespace, scrollx.mousewheel)
|
313 |
+
.on('mousewheel' + namespace, scrollx.mousewheel)
|
314 |
+
.on('mouseenter' + namespace, function () {
|
315 |
+
scrollToValue = c[scrollOffset]();
|
316 |
+
});
|
317 |
+
|
318 |
+
// handle arrows & scroll inner mousedown event
|
319 |
+
scrollx.scroll.find('.scroll-arrow, .scroll-element_track')
|
320 |
+
.on('mousedown' + namespace, function (event) {
|
321 |
+
|
322 |
+
if (event.which != 1) // lmb
|
323 |
+
return true;
|
324 |
+
|
325 |
+
scrollForward = 1;
|
326 |
+
|
327 |
+
var data = {
|
328 |
+
"eventOffset": event[(d === 'x') ? 'pageX' : 'pageY'],
|
329 |
+
"maxScrollValue": scrollx.size - scrollx.visible - scrollx.offset,
|
330 |
+
"scrollbarOffset": scrollx.scroll.bar.offset()[(d === 'x') ? 'left' : 'top'],
|
331 |
+
"scrollbarSize": scrollx.scroll.bar[(d === 'x') ? 'outerWidth' : 'outerHeight']()
|
332 |
+
};
|
333 |
+
var timeout = 0, timer = 0;
|
334 |
+
|
335 |
+
if ($(this).hasClass('scroll-arrow')) {
|
336 |
+
scrollForward = $(this).hasClass("scroll-arrow_more") ? 1 : -1;
|
337 |
+
scrollStep = o.scrollStep * scrollForward;
|
338 |
+
scrollToValue = scrollForward > 0 ? data.maxScrollValue : 0;
|
339 |
+
} else {
|
340 |
+
scrollForward = (data.eventOffset > (data.scrollbarOffset + data.scrollbarSize) ? 1
|
341 |
+
: (data.eventOffset < data.scrollbarOffset ? -1 : 0));
|
342 |
+
scrollStep = Math.round(scrollx.visible * 0.75) * scrollForward;
|
343 |
+
scrollToValue = (data.eventOffset - data.scrollbarOffset -
|
344 |
+
(o.stepScrolling ? (scrollForward == 1 ? data.scrollbarSize : 0)
|
345 |
+
: Math.round(data.scrollbarSize / 2)));
|
346 |
+
scrollToValue = c[scrollOffset]() + (scrollToValue / scrollx.kx);
|
347 |
+
}
|
348 |
+
|
349 |
+
S.scrollTo = S.scrollTo || {};
|
350 |
+
S.scrollTo[scrollOffset] = o.stepScrolling ? c[scrollOffset]() + scrollStep : scrollToValue;
|
351 |
+
|
352 |
+
if (o.stepScrolling) {
|
353 |
+
scrollCallback = function () {
|
354 |
+
scrollToValue = c[scrollOffset]();
|
355 |
+
clearInterval(timer);
|
356 |
+
clearTimeout(timeout);
|
357 |
+
timeout = 0;
|
358 |
+
timer = 0;
|
359 |
+
};
|
360 |
+
timeout = setTimeout(function () {
|
361 |
+
timer = setInterval(scrollTo, 40);
|
362 |
+
}, o.duration + 100);
|
363 |
+
}
|
364 |
+
|
365 |
+
setTimeout(function () {
|
366 |
+
if (S.scrollTo) {
|
367 |
+
c.animate(S.scrollTo, o.duration);
|
368 |
+
S.scrollTo = null;
|
369 |
+
}
|
370 |
+
}, 1);
|
371 |
+
|
372 |
+
return S._handleMouseDown(scrollCallback, event);
|
373 |
+
});
|
374 |
+
|
375 |
+
// handle scrollbar drag'n'drop
|
376 |
+
scrollx.scroll.bar.on('mousedown' + namespace, function (event) {
|
377 |
+
|
378 |
+
if (event.which != 1) // lmb
|
379 |
+
return true;
|
380 |
+
|
381 |
+
var eventPosition = event[(d === 'x') ? 'pageX' : 'pageY'];
|
382 |
+
var initOffset = c[scrollOffset]();
|
383 |
+
|
384 |
+
scrollx.scroll.addClass('scroll-draggable');
|
385 |
+
|
386 |
+
$(document).on('mousemove' + namespace, function (event) {
|
387 |
+
var diff = parseInt((event[(d === 'x') ? 'pageX' : 'pageY'] - eventPosition) / scrollx.kx, 10);
|
388 |
+
c[scrollOffset](initOffset + diff);
|
389 |
+
});
|
390 |
+
|
391 |
+
return S._handleMouseDown(function () {
|
392 |
+
scrollx.scroll.removeClass('scroll-draggable');
|
393 |
+
scrollToValue = c[scrollOffset]();
|
394 |
+
}, event);
|
395 |
+
});
|
396 |
+
}
|
397 |
+
});
|
398 |
+
|
399 |
+
// remove classes & reset applied styles
|
400 |
+
$.each(s, function (d, scrollx) {
|
401 |
+
var scrollClass = 'scroll-scroll' + d + '_visible';
|
402 |
+
var scrolly = (d == "x") ? s.y : s.x;
|
403 |
+
|
404 |
+
scrollx.scroll.removeClass(scrollClass);
|
405 |
+
scrolly.scroll.removeClass(scrollClass);
|
406 |
+
cw.removeClass(scrollClass);
|
407 |
+
});
|
408 |
+
|
409 |
+
// calculate init sizes
|
410 |
+
$.each(s, function (d, scrollx) {
|
411 |
+
$.extend(scrollx, (d == "x") ? {
|
412 |
+
"offset": parseInt(c.css('left'), 10) || 0,
|
413 |
+
"size": c.prop('scrollWidth'),
|
414 |
+
"visible": w.width()
|
415 |
+
} : {
|
416 |
+
"offset": parseInt(c.css('top'), 10) || 0,
|
417 |
+
"size": c.prop('scrollHeight'),
|
418 |
+
"visible": w.height()
|
419 |
+
});
|
420 |
+
});
|
421 |
+
|
422 |
+
// update scrollbar visibility/dimensions
|
423 |
+
this._updateScroll('x', this.scrollx);
|
424 |
+
this._updateScroll('y', this.scrolly);
|
425 |
+
|
426 |
+
if ($.isFunction(o.onUpdate)){
|
427 |
+
o.onUpdate.apply(this, [c]);
|
428 |
+
}
|
429 |
+
|
430 |
+
// calculate scroll size
|
431 |
+
$.each(s, function (d, scrollx) {
|
432 |
+
|
433 |
+
var cssOffset = (d === 'x') ? 'left' : 'top';
|
434 |
+
var cssFullSize = (d === 'x') ? 'outerWidth' : 'outerHeight';
|
435 |
+
var cssSize = (d === 'x') ? 'width' : 'height';
|
436 |
+
var offset = parseInt(c.css(cssOffset), 10) || 0;
|
437 |
+
|
438 |
+
var AreaSize = scrollx.size;
|
439 |
+
var AreaVisible = scrollx.visible + offset;
|
440 |
+
|
441 |
+
var scrollSize = scrollx.scroll.size[cssFullSize]() + (parseInt(scrollx.scroll.size.css(cssOffset), 10) || 0);
|
442 |
+
|
443 |
+
if (o.autoScrollSize) {
|
444 |
+
scrollx.scrollbarSize = parseInt(scrollSize * AreaVisible / AreaSize, 10);
|
445 |
+
scrollx.scroll.bar.css(cssSize, scrollx.scrollbarSize + 'px');
|
446 |
+
}
|
447 |
+
|
448 |
+
scrollx.scrollbarSize = scrollx.scroll.bar[cssFullSize]();
|
449 |
+
scrollx.kx = ((scrollSize - scrollx.scrollbarSize) / (AreaSize - AreaVisible)) || 1;
|
450 |
+
scrollx.maxScrollOffset = AreaSize - AreaVisible;
|
451 |
+
});
|
452 |
+
|
453 |
+
c.scrollLeft(initScroll.scrollLeft).scrollTop(initScroll.scrollTop).trigger('scroll');
|
454 |
+
},
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Get scrollx/scrolly object
|
458 |
+
*
|
459 |
+
* @param {Mixed} scroll
|
460 |
+
* @returns {jQuery} scroll object
|
461 |
+
*/
|
462 |
+
_getScroll: function (scroll) {
|
463 |
+
var types = {
|
464 |
+
advanced: [
|
465 |
+
'<div class="scroll-element">',
|
466 |
+
'<div class="scroll-element_corner"></div>',
|
467 |
+
'<div class="scroll-arrow scroll-arrow_less"></div>',
|
468 |
+
'<div class="scroll-arrow scroll-arrow_more"></div>',
|
469 |
+
'<div class="scroll-element_outer">',
|
470 |
+
'<div class="scroll-element_size"></div>', // required! used for scrollbar size calculation !
|
471 |
+
'<div class="scroll-element_inner-wrapper">',
|
472 |
+
'<div class="scroll-element_inner scroll-element_track">', // used for handling scrollbar click
|
473 |
+
'<div class="scroll-element_inner-bottom"></div>',
|
474 |
+
'</div>',
|
475 |
+
'</div>',
|
476 |
+
'<div class="scroll-bar">', // required
|
477 |
+
'<div class="scroll-bar_body">',
|
478 |
+
'<div class="scroll-bar_body-inner"></div>',
|
479 |
+
'</div>',
|
480 |
+
'<div class="scroll-bar_bottom"></div>',
|
481 |
+
'<div class="scroll-bar_center"></div>',
|
482 |
+
'</div>',
|
483 |
+
'</div>',
|
484 |
+
'</div>'
|
485 |
+
].join(''),
|
486 |
+
simple: [
|
487 |
+
'<div class="scroll-element">',
|
488 |
+
'<div class="scroll-element_outer">',
|
489 |
+
'<div class="scroll-element_size"></div>', // required! used for scrollbar size calculation !
|
490 |
+
'<div class="scroll-element_track"></div>', // used for handling scrollbar click
|
491 |
+
'<div class="scroll-bar"></div>', // required
|
492 |
+
'</div>',
|
493 |
+
'</div>'
|
494 |
+
].join('')
|
495 |
+
};
|
496 |
+
if (types[scroll]) {
|
497 |
+
scroll = types[scroll];
|
498 |
+
}
|
499 |
+
if (!scroll) {
|
500 |
+
scroll = types['simple'];
|
501 |
+
}
|
502 |
+
if (typeof (scroll) == 'string') {
|
503 |
+
scroll = $(scroll).appendTo(this.wrapper);
|
504 |
+
} else {
|
505 |
+
scroll = $(scroll);
|
506 |
+
}
|
507 |
+
$.extend(scroll, {
|
508 |
+
bar: scroll.find('.scroll-bar'),
|
509 |
+
size: scroll.find('.scroll-element_size'),
|
510 |
+
track: scroll.find('.scroll-element_track')
|
511 |
+
});
|
512 |
+
return scroll;
|
513 |
+
},
|
514 |
+
|
515 |
+
_handleMouseDown: function(callback, event) {
|
516 |
+
|
517 |
+
var namespace = this.namespace;
|
518 |
+
|
519 |
+
$(document).on('blur' + namespace, function () {
|
520 |
+
$(document).add('body').off(namespace);
|
521 |
+
callback && callback();
|
522 |
+
});
|
523 |
+
$(document).on('dragstart' + namespace, function (event) {
|
524 |
+
event.preventDefault();
|
525 |
+
return false;
|
526 |
+
});
|
527 |
+
$(document).on('mouseup' + namespace, function () {
|
528 |
+
$(document).add('body').off(namespace);
|
529 |
+
callback && callback();
|
530 |
+
});
|
531 |
+
$('body').on('selectstart' + namespace, function (event) {
|
532 |
+
event.preventDefault();
|
533 |
+
return false;
|
534 |
+
});
|
535 |
+
|
536 |
+
event && event.preventDefault();
|
537 |
+
return false;
|
538 |
+
},
|
539 |
+
|
540 |
+
_updateScroll: function (d, scrollx) {
|
541 |
+
|
542 |
+
var container = this.container,
|
543 |
+
containerWrapper = this.containerWrapper || container,
|
544 |
+
scrollClass = 'scroll-scroll' + d + '_visible',
|
545 |
+
scrolly = (d === 'x') ? this.scrolly : this.scrollx,
|
546 |
+
offset = parseInt(this.container.css((d === 'x') ? 'left' : 'top'), 10) || 0,
|
547 |
+
wrapper = this.wrapper;
|
548 |
+
|
549 |
+
var AreaSize = scrollx.size;
|
550 |
+
var AreaVisible = scrollx.visible + offset;
|
551 |
+
|
552 |
+
scrollx.isVisible = (AreaSize - AreaVisible) > 1; // bug in IE9/11 with 1px diff
|
553 |
+
if (scrollx.isVisible) {
|
554 |
+
scrollx.scroll.addClass(scrollClass);
|
555 |
+
scrolly.scroll.addClass(scrollClass);
|
556 |
+
containerWrapper.addClass(scrollClass);
|
557 |
+
} else {
|
558 |
+
scrollx.scroll.removeClass(scrollClass);
|
559 |
+
scrolly.scroll.removeClass(scrollClass);
|
560 |
+
containerWrapper.removeClass(scrollClass);
|
561 |
+
}
|
562 |
+
|
563 |
+
if (d === 'y') {
|
564 |
+
if(container.is('textarea') || AreaSize < AreaVisible){
|
565 |
+
containerWrapper.css({
|
566 |
+
"height": (AreaVisible + browser.scroll.height) + 'px',
|
567 |
+
"max-height": "none"
|
568 |
+
});
|
569 |
+
} else {
|
570 |
+
containerWrapper.css({
|
571 |
+
//"height": "auto", // do not reset height value: issue with height:100%!
|
572 |
+
"max-height": (AreaVisible + browser.scroll.height) + 'px'
|
573 |
+
});
|
574 |
+
}
|
575 |
+
}
|
576 |
+
|
577 |
+
if (scrollx.size != container.prop('scrollWidth')
|
578 |
+
|| scrolly.size != container.prop('scrollHeight')
|
579 |
+
|| scrollx.visible != wrapper.width()
|
580 |
+
|| scrolly.visible != wrapper.height()
|
581 |
+
|| scrollx.offset != (parseInt(container.css('left'), 10) || 0)
|
582 |
+
|| scrolly.offset != (parseInt(container.css('top'), 10) || 0)
|
583 |
+
) {
|
584 |
+
$.extend(this.scrollx, {
|
585 |
+
"offset": parseInt(container.css('left'), 10) || 0,
|
586 |
+
"size": container.prop('scrollWidth'),
|
587 |
+
"visible": wrapper.width()
|
588 |
+
});
|
589 |
+
$.extend(this.scrolly, {
|
590 |
+
"offset": parseInt(container.css('top'), 10) || 0,
|
591 |
+
"size": this.container.prop('scrollHeight'),
|
592 |
+
"visible": wrapper.height()
|
593 |
+
});
|
594 |
+
this._updateScroll(d === 'x' ? 'y' : 'x', scrolly);
|
595 |
+
}
|
596 |
+
}
|
597 |
+
};
|
598 |
+
|
599 |
+
var CustomScrollbar = BaseScrollbar;
|
600 |
+
|
601 |
+
/*
|
602 |
+
* Extend jQuery as plugin
|
603 |
+
*
|
604 |
+
* @param {Mixed} command to execute
|
605 |
+
* @param {Mixed} arguments as Array
|
606 |
+
* @return {jQuery}
|
607 |
+
*/
|
608 |
+
$.fn.scrollbar = function (command, args) {
|
609 |
+
if (typeof command !== 'string') {
|
610 |
+
args = command;
|
611 |
+
command = 'init';
|
612 |
+
}
|
613 |
+
if (typeof args === 'undefined') {
|
614 |
+
args = [];
|
615 |
+
}
|
616 |
+
if (!$.isArray(args)) {
|
617 |
+
args = [args];
|
618 |
+
}
|
619 |
+
this.not('body, .scroll-wrapper').each(function () {
|
620 |
+
var element = $(this),
|
621 |
+
instance = element.data(browser.data.name);
|
622 |
+
if (instance || command === 'init') {
|
623 |
+
if (!instance) {
|
624 |
+
instance = new CustomScrollbar(element);
|
625 |
+
}
|
626 |
+
if (instance[command]) {
|
627 |
+
instance[command].apply(instance, args);
|
628 |
+
}
|
629 |
+
}
|
630 |
+
});
|
631 |
+
return this;
|
632 |
+
};
|
633 |
+
|
634 |
+
/**
|
635 |
+
* Connect default options to global object
|
636 |
+
*/
|
637 |
+
$.fn.scrollbar.options = defaults;
|
638 |
+
|
639 |
+
|
640 |
+
/**
|
641 |
+
* Check if scroll content/container size is changed
|
642 |
+
*/
|
643 |
+
|
644 |
+
var updateScrollbars = (function () {
|
645 |
+
var timer = 0,
|
646 |
+
timerCounter = 0;
|
647 |
+
|
648 |
+
return function (force) {
|
649 |
+
var i, container, options, scroll, wrapper, scrollx, scrolly;
|
650 |
+
for (i = 0; i < browser.scrolls.length; i++) {
|
651 |
+
scroll = browser.scrolls[i];
|
652 |
+
container = scroll.container;
|
653 |
+
options = scroll.options;
|
654 |
+
wrapper = scroll.wrapper;
|
655 |
+
scrollx = scroll.scrollx;
|
656 |
+
scrolly = scroll.scrolly;
|
657 |
+
if (force || (options.autoUpdate && wrapper && wrapper.is(':visible') &&
|
658 |
+
(container.prop('scrollWidth') != scrollx.size || container.prop('scrollHeight') != scrolly.size || wrapper.width() != scrollx.visible || wrapper.height() != scrolly.visible))) {
|
659 |
+
scroll.init();
|
660 |
+
|
661 |
+
if (options.debug) {
|
662 |
+
window.console && console.log({
|
663 |
+
scrollHeight: container.prop('scrollHeight') + ':' + scroll.scrolly.size,
|
664 |
+
scrollWidth: container.prop('scrollWidth') + ':' + scroll.scrollx.size,
|
665 |
+
visibleHeight: wrapper.height() + ':' + scroll.scrolly.visible,
|
666 |
+
visibleWidth: wrapper.width() + ':' + scroll.scrollx.visible
|
667 |
+
}, true);
|
668 |
+
timerCounter++;
|
669 |
+
}
|
670 |
+
}
|
671 |
+
}
|
672 |
+
if (debug && timerCounter > 10) {
|
673 |
+
window.console && console.log('Scroll updates exceed 10');
|
674 |
+
updateScrollbars = function () {};
|
675 |
+
} else {
|
676 |
+
clearTimeout(timer);
|
677 |
+
timer = setTimeout(updateScrollbars, 300);
|
678 |
+
}
|
679 |
+
};
|
680 |
+
})();
|
681 |
+
|
682 |
+
/* ADDITIONAL FUNCTIONS */
|
683 |
+
/**
|
684 |
+
* Get native browser scrollbar size (height/width)
|
685 |
+
*
|
686 |
+
* @param {Boolean} actual size or CSS size, default - CSS size
|
687 |
+
* @returns {Object} with height, width
|
688 |
+
*/
|
689 |
+
function getBrowserScrollSize(actualSize) {
|
690 |
+
|
691 |
+
if (browser.webkit && !actualSize) {
|
692 |
+
return {
|
693 |
+
"height": 0,
|
694 |
+
"width": 0
|
695 |
+
};
|
696 |
+
}
|
697 |
+
|
698 |
+
if (!browser.data.outer) {
|
699 |
+
var css = {
|
700 |
+
"border": "none",
|
701 |
+
"box-sizing": "content-box",
|
702 |
+
"height": "200px",
|
703 |
+
"margin": "0",
|
704 |
+
"padding": "0",
|
705 |
+
"width": "200px"
|
706 |
+
};
|
707 |
+
browser.data.inner = $("<div>").css($.extend({}, css));
|
708 |
+
browser.data.outer = $("<div>").css($.extend({
|
709 |
+
"left": "-1000px",
|
710 |
+
"overflow": "scroll",
|
711 |
+
"position": "absolute",
|
712 |
+
"top": "-1000px"
|
713 |
+
}, css)).append(browser.data.inner).appendTo("body");
|
714 |
+
}
|
715 |
+
|
716 |
+
browser.data.outer.scrollLeft(1000).scrollTop(1000);
|
717 |
+
|
718 |
+
return {
|
719 |
+
"height": Math.ceil((browser.data.outer.offset().top - browser.data.inner.offset().top) || 0),
|
720 |
+
"width": Math.ceil((browser.data.outer.offset().left - browser.data.inner.offset().left) || 0)
|
721 |
+
};
|
722 |
+
}
|
723 |
+
|
724 |
+
/**
|
725 |
+
* Check if native browser scrollbars overlay content
|
726 |
+
*
|
727 |
+
* @returns {Boolean}
|
728 |
+
*/
|
729 |
+
function isScrollOverlaysContent() {
|
730 |
+
var scrollSize = getBrowserScrollSize(true);
|
731 |
+
return !(scrollSize.height || scrollSize.width);
|
732 |
+
}
|
733 |
+
|
734 |
+
function isVerticalScroll(event) {
|
735 |
+
var e = event.originalEvent;
|
736 |
+
if (e.axis && e.axis === e.HORIZONTAL_AXIS)
|
737 |
+
return false;
|
738 |
+
if (e.wheelDeltaX)
|
739 |
+
return false;
|
740 |
+
return true;
|
741 |
+
}
|
742 |
+
|
743 |
+
|
744 |
+
/**
|
745 |
+
* Extend AngularJS as UI directive
|
746 |
+
* and expose a provider for override default config
|
747 |
+
*
|
748 |
+
*/
|
749 |
+
if (window.angular) {
|
750 |
+
(function (angular) {
|
751 |
+
angular.module('jQueryScrollbar', [])
|
752 |
+
.provider('jQueryScrollbar', function () {
|
753 |
+
var defaultOptions = defaults;
|
754 |
+
return {
|
755 |
+
setOptions: function (options) {
|
756 |
+
angular.extend(defaultOptions, options);
|
757 |
+
},
|
758 |
+
$get: function () {
|
759 |
+
return {
|
760 |
+
options: angular.copy(defaultOptions)
|
761 |
+
};
|
762 |
+
}
|
763 |
+
};
|
764 |
+
})
|
765 |
+
.directive('jqueryScrollbar', ['jQueryScrollbar', '$parse', function (jQueryScrollbar, $parse) {
|
766 |
+
return {
|
767 |
+
"restrict": "AC",
|
768 |
+
"link": function (scope, element, attrs) {
|
769 |
+
var model = $parse(attrs.jqueryScrollbar),
|
770 |
+
options = model(scope);
|
771 |
+
element.scrollbar(options || jQueryScrollbar.options)
|
772 |
+
.on('$destroy', function () {
|
773 |
+
element.scrollbar('destroy');
|
774 |
+
});
|
775 |
+
}
|
776 |
+
};
|
777 |
+
}]);
|
778 |
+
})(window.angular);
|
779 |
+
}
|
780 |
+
}));
|
assets/js/vendor/jquery-tipsy/jquery.tipsy.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.tipsy{font-size:12px;position:absolute;padding:5px;z-index:100000}.tipsy-inner{background-color:#000;color:#fff;max-width:200px;padding:5px 8px 4px 8px;text-align:center}.tipsy-inner{border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px}.tipsy-arrow{position:absolute;width:0;height:0;line-height:0;border:5px dashed #000}.tipsy-arrow-n{border-bottom-color:#000}.tipsy-arrow-s{border-top-color:#000}.tipsy-arrow-e{border-left-color:#000}.tipsy-arrow-w{border-right-color:#000}.tipsy-n .tipsy-arrow{top:0;left:50%;margin-left:-5px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.tipsy-nw .tipsy-arrow{top:0;left:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.tipsy-ne .tipsy-arrow{top:0;right:10px;border-bottom-style:solid;border-top:none;border-left-color:transparent;border-right-color:transparent}.tipsy-s .tipsy-arrow{bottom:0;left:50%;margin-left:-5px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.tipsy-sw .tipsy-arrow{bottom:0;left:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.tipsy-se .tipsy-arrow{bottom:0;right:10px;border-top-style:solid;border-bottom:none;border-left-color:transparent;border-right-color:transparent}.tipsy-e .tipsy-arrow{right:0;top:50%;margin-top:-5px;border-left-style:solid;border-right:none;border-top-color:transparent;border-bottom-color:transparent}.tipsy-w .tipsy-arrow{left:0;top:50%;margin-top:-5px;border-right-style:solid;border-left:none;border-top-color:transparent;border-bottom-color:transparent}
|
assets/js/vendor/jquery-tipsy/jquery.tipsy.js
ADDED
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// tipsy, facebook style tooltips for jquery
|
2 |
+
// version 1.0.0a
|
3 |
+
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
|
4 |
+
// released under the MIT license
|
5 |
+
|
6 |
+
(function($) {
|
7 |
+
|
8 |
+
function maybeCall(thing, ctx) {
|
9 |
+
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
|
10 |
+
};
|
11 |
+
|
12 |
+
function isElementInDOM(ele) {
|
13 |
+
while (ele = ele.parentNode) {
|
14 |
+
if (ele == document) return true;
|
15 |
+
}
|
16 |
+
return false;
|
17 |
+
};
|
18 |
+
|
19 |
+
function Tipsy(element, options) {
|
20 |
+
this.$element = $(element);
|
21 |
+
this.options = options;
|
22 |
+
this.enabled = true;
|
23 |
+
this.fixTitle();
|
24 |
+
};
|
25 |
+
|
26 |
+
Tipsy.prototype = {
|
27 |
+
show: function() {
|
28 |
+
var title = this.getTitle();
|
29 |
+
if (title && this.enabled) {
|
30 |
+
var $tip = this.tip();
|
31 |
+
|
32 |
+
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
|
33 |
+
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
|
34 |
+
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
|
35 |
+
|
36 |
+
var pos = $.extend({}, this.$element.offset(), {
|
37 |
+
width: this.$element[0].offsetWidth,
|
38 |
+
height: this.$element[0].offsetHeight
|
39 |
+
});
|
40 |
+
|
41 |
+
var actualWidth = $tip[0].offsetWidth,
|
42 |
+
actualHeight = $tip[0].offsetHeight,
|
43 |
+
gravity = maybeCall(this.options.gravity, this.$element[0]);
|
44 |
+
|
45 |
+
var tp;
|
46 |
+
switch (gravity.charAt(0)) {
|
47 |
+
case 'n':
|
48 |
+
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
49 |
+
break;
|
50 |
+
case 's':
|
51 |
+
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
|
52 |
+
break;
|
53 |
+
case 'e':
|
54 |
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
|
55 |
+
break;
|
56 |
+
case 'w':
|
57 |
+
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
|
58 |
+
break;
|
59 |
+
}
|
60 |
+
|
61 |
+
if (gravity.length == 2) {
|
62 |
+
if (gravity.charAt(1) == 'w') {
|
63 |
+
tp.left = pos.left + pos.width / 2 - 15;
|
64 |
+
} else {
|
65 |
+
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
$tip.css(tp).addClass('tipsy-' + gravity);
|
70 |
+
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
|
71 |
+
if (this.options.className) {
|
72 |
+
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
|
73 |
+
}
|
74 |
+
|
75 |
+
if (this.options.fade) {
|
76 |
+
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
|
77 |
+
} else {
|
78 |
+
$tip.css({visibility: 'visible', opacity: this.options.opacity});
|
79 |
+
}
|
80 |
+
}
|
81 |
+
},
|
82 |
+
|
83 |
+
hide: function() {
|
84 |
+
if (this.options.fade) {
|
85 |
+
this.tip().stop().fadeOut(function() { $(this).remove(); });
|
86 |
+
} else {
|
87 |
+
this.tip().remove();
|
88 |
+
}
|
89 |
+
},
|
90 |
+
|
91 |
+
fixTitle: function() {
|
92 |
+
var $e = this.$element;
|
93 |
+
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
|
94 |
+
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
|
95 |
+
}
|
96 |
+
},
|
97 |
+
|
98 |
+
getTitle: function() {
|
99 |
+
var title, $e = this.$element, o = this.options;
|
100 |
+
this.fixTitle();
|
101 |
+
var title, o = this.options;
|
102 |
+
if (typeof o.title == 'string') {
|
103 |
+
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
|
104 |
+
} else if (typeof o.title == 'function') {
|
105 |
+
title = o.title.call($e[0]);
|
106 |
+
}
|
107 |
+
title = ('' + title).replace(/(^\s*|\s*$)/, "");
|
108 |
+
return title || o.fallback;
|
109 |
+
},
|
110 |
+
|
111 |
+
tip: function() {
|
112 |
+
if (!this.$tip) {
|
113 |
+
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
|
114 |
+
this.$tip.data('tipsy-pointee', this.$element[0]);
|
115 |
+
}
|
116 |
+
return this.$tip;
|
117 |
+
},
|
118 |
+
|
119 |
+
validate: function() {
|
120 |
+
if (!this.$element[0].parentNode) {
|
121 |
+
this.hide();
|
122 |
+
this.$element = null;
|
123 |
+
this.options = null;
|
124 |
+
}
|
125 |
+
},
|
126 |
+
|
127 |
+
enable: function() { this.enabled = true; },
|
128 |
+
disable: function() { this.enabled = false; },
|
129 |
+
toggleEnabled: function() { this.enabled = !this.enabled; }
|
130 |
+
};
|
131 |
+
|
132 |
+
$.fn.tipsy = function(options) {
|
133 |
+
|
134 |
+
if (options === true) {
|
135 |
+
return this.data('tipsy');
|
136 |
+
} else if (typeof options == 'string') {
|
137 |
+
var tipsy = this.data('tipsy');
|
138 |
+
if (tipsy) tipsy[options]();
|
139 |
+
return this;
|
140 |
+
}
|
141 |
+
|
142 |
+
options = $.extend({}, $.fn.tipsy.defaults, options);
|
143 |
+
|
144 |
+
function get(ele) {
|
145 |
+
var tipsy = $.data(ele, 'tipsy');
|
146 |
+
if (!tipsy) {
|
147 |
+
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
|
148 |
+
$.data(ele, 'tipsy', tipsy);
|
149 |
+
}
|
150 |
+
return tipsy;
|
151 |
+
}
|
152 |
+
|
153 |
+
function enter() {
|
154 |
+
var tipsy = get(this);
|
155 |
+
tipsy.hoverState = 'in';
|
156 |
+
if (options.delayIn == 0) {
|
157 |
+
tipsy.show();
|
158 |
+
} else {
|
159 |
+
tipsy.fixTitle();
|
160 |
+
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
|
161 |
+
}
|
162 |
+
};
|
163 |
+
|
164 |
+
function leave() {
|
165 |
+
var tipsy = get(this);
|
166 |
+
tipsy.hoverState = 'out';
|
167 |
+
if (options.delayOut == 0) {
|
168 |
+
tipsy.hide();
|
169 |
+
} else {
|
170 |
+
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
|
171 |
+
}
|
172 |
+
};
|
173 |
+
|
174 |
+
if (!options.live) this.each(function() { get(this); });
|
175 |
+
|
176 |
+
if (options.trigger != 'manual') {
|
177 |
+
var binder = options.live ? 'live' : 'bind',
|
178 |
+
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
|
179 |
+
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
|
180 |
+
this[binder](eventIn, enter)[binder](eventOut, leave);
|
181 |
+
}
|
182 |
+
|
183 |
+
return this;
|
184 |
+
|
185 |
+
};
|
186 |
+
|
187 |
+
$.fn.tipsy.defaults = {
|
188 |
+
className: null,
|
189 |
+
delayIn: 0,
|
190 |
+
delayOut: 0,
|
191 |
+
fade: false,
|
192 |
+
fallback: '',
|
193 |
+
gravity: 'n',
|
194 |
+
html: false,
|
195 |
+
live: false,
|
196 |
+
offset: 0,
|
197 |
+
opacity: 0.8,
|
198 |
+
title: 'title',
|
199 |
+
trigger: 'hover'
|
200 |
+
};
|
201 |
+
|
202 |
+
$.fn.tipsy.revalidate = function() {
|
203 |
+
$('.tipsy').each(function() {
|
204 |
+
var pointee = $.data(this, 'tipsy-pointee');
|
205 |
+
if (!pointee || !isElementInDOM(pointee)) {
|
206 |
+
$(this).remove();
|
207 |
+
}
|
208 |
+
});
|
209 |
+
};
|
210 |
+
|
211 |
+
// Overwrite this method to provide options on a per-element basis.
|
212 |
+
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
|
213 |
+
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
|
214 |
+
// (remember - do not modify 'options' in place!)
|
215 |
+
$.fn.tipsy.elementOptions = function(ele, options) {
|
216 |
+
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
|
217 |
+
};
|
218 |
+
|
219 |
+
$.fn.tipsy.autoNS = function() {
|
220 |
+
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
|
221 |
+
};
|
222 |
+
|
223 |
+
$.fn.tipsy.autoWE = function() {
|
224 |
+
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
|
225 |
+
};
|
226 |
+
|
227 |
+
/**
|
228 |
+
* yields a closure of the supplied parameters, producing a function that takes
|
229 |
+
* no arguments and is suitable for use as an autogravity function like so:
|
230 |
+
*
|
231 |
+
* @param margin (int) - distance from the viewable region edge that an
|
232 |
+
* element should be before setting its tooltip's gravity to be away
|
233 |
+
* from that edge.
|
234 |
+
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
|
235 |
+
* if there are no viewable region edges effecting the tooltip's
|
236 |
+
* gravity. It will try to vary from this minimally, for example,
|
237 |
+
* if 'sw' is preferred and an element is near the right viewable
|
238 |
+
* region edge, but not the top edge, it will set the gravity for
|
239 |
+
* that element's tooltip to be 'se', preserving the southern
|
240 |
+
* component.
|
241 |
+
*/
|
242 |
+
$.fn.tipsy.autoBounds = function(margin, prefer) {
|
243 |
+
return function() {
|
244 |
+
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
|
245 |
+
boundTop = $(document).scrollTop() + margin,
|
246 |
+
boundLeft = $(document).scrollLeft() + margin,
|
247 |
+
$this = $(this);
|
248 |
+
|
249 |
+
if ($this.offset().top < boundTop) dir.ns = 'n';
|
250 |
+
if ($this.offset().left < boundLeft) dir.ew = 'w';
|
251 |
+
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
|
252 |
+
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
|
253 |
+
|
254 |
+
return dir.ns + (dir.ew ? dir.ew : '');
|
255 |
+
}
|
256 |
+
};
|
257 |
+
|
258 |
+
})(jQuery);
|
assets/js/vendor/jquery.alert.js
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function ($) {
|
2 |
+
|
3 |
+
$.alerts = {
|
4 |
+
|
5 |
+
// These properties can be read/written by accessing $.alerts.propertyName from your scripts at any time
|
6 |
+
|
7 |
+
verticalOffset : -75, // vertical offset of the dialog from center screen, in pixels
|
8 |
+
horizontalOffset : 0, // horizontal offset of the dialog from center screen, in pixels/
|
9 |
+
repositionOnResize: true, // re-centers the dialog on window resize
|
10 |
+
overlayOpacity : .01, // transparency level of overlay
|
11 |
+
overlayColor : '#FFF', // base color of overlay
|
12 |
+
draggable : true, // make the dialogs draggable (requires UI Draggables plugin)
|
13 |
+
okButton : ' OK ', // text for the OK button
|
14 |
+
cancelButton : ' Cancel ', // text for the Cancel button
|
15 |
+
dialogClass : null, // if specified, this class will be applied to all dialogs
|
16 |
+
|
17 |
+
// Public methods
|
18 |
+
|
19 |
+
alert: function (message, title, callback) {
|
20 |
+
if (title == null) title = 'Alert';
|
21 |
+
$.alerts._show(title, message, null, 'alert', function (result) {
|
22 |
+
if (callback) callback(result);
|
23 |
+
});
|
24 |
+
},
|
25 |
+
|
26 |
+
confirm: function (message, title, callback) {
|
27 |
+
if (title == null) title = 'Confirm';
|
28 |
+
$.alerts._show(title, message, null, 'confirm', function (result) {
|
29 |
+
if (callback) callback(result);
|
30 |
+
});
|
31 |
+
},
|
32 |
+
|
33 |
+
prompt: function (message, value, title, callback) {
|
34 |
+
if (title == null) title = 'Prompt';
|
35 |
+
$.alerts._show(title, message, value, 'prompt', function (result) {
|
36 |
+
if (callback) callback(result);
|
37 |
+
});
|
38 |
+
},
|
39 |
+
|
40 |
+
// Private methods
|
41 |
+
|
42 |
+
_show: function (title, msg, value, type, callback) {
|
43 |
+
|
44 |
+
$.alerts._hide();
|
45 |
+
$.alerts._overlay('show');
|
46 |
+
|
47 |
+
$("BODY").append(
|
48 |
+
'<div id="popup_container">' +
|
49 |
+
'<h1 id="popup_title"></h1>' +
|
50 |
+
'<div id="popup_content">' +
|
51 |
+
'<div id="popup_message"></div>' +
|
52 |
+
'</div>' +
|
53 |
+
'</div>');
|
54 |
+
|
55 |
+
if ($.alerts.dialogClass) $("#popup_container").addClass($.alerts.dialogClass);
|
56 |
+
|
57 |
+
// IE6 Fix
|
58 |
+
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
|
59 |
+
|
60 |
+
$("#popup_container").css({
|
61 |
+
position: pos,
|
62 |
+
zIndex : 99999,
|
63 |
+
padding : 0,
|
64 |
+
margin : 0
|
65 |
+
});
|
66 |
+
|
67 |
+
$("#popup_title").text(title);
|
68 |
+
$("#popup_content").addClass(type);
|
69 |
+
$("#popup_message").text(msg);
|
70 |
+
$("#popup_message").html($("#popup_message").text().replace(/\n/g, '<br />'));
|
71 |
+
|
72 |
+
$("#popup_container").css({
|
73 |
+
minWidth: $("#popup_container").outerWidth(),
|
74 |
+
maxWidth: $("#popup_container").outerWidth()
|
75 |
+
});
|
76 |
+
|
77 |
+
$.alerts._reposition();
|
78 |
+
$.alerts._maintainPosition(true);
|
79 |
+
|
80 |
+
switch (type) {
|
81 |
+
case 'alert':
|
82 |
+
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /></div>');
|
83 |
+
$("#popup_ok").click(function () {
|
84 |
+
$.alerts._hide();
|
85 |
+
callback(true);
|
86 |
+
});
|
87 |
+
$("#popup_ok").focus().keypress(function (e) {
|
88 |
+
if (e.keyCode == 13 || e.keyCode == 27) $("#popup_ok").trigger('click');
|
89 |
+
});
|
90 |
+
break;
|
91 |
+
case 'confirm':
|
92 |
+
$("#popup_message").after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
93 |
+
$("#popup_ok").click(function () {
|
94 |
+
$.alerts._hide();
|
95 |
+
if (callback) callback(true);
|
96 |
+
});
|
97 |
+
$("#popup_cancel").click(function () {
|
98 |
+
$.alerts._hide();
|
99 |
+
if (callback) callback(false);
|
100 |
+
});
|
101 |
+
$("#popup_ok").focus();
|
102 |
+
$("#popup_ok, #popup_cancel").keypress(function (e) {
|
103 |
+
if (e.keyCode == 13) $("#popup_ok").trigger('click');
|
104 |
+
if (e.keyCode == 27) $("#popup_cancel").trigger('click');
|
105 |
+
});
|
106 |
+
break;
|
107 |
+
case 'prompt':
|
108 |
+
$("#popup_message").append('<br /><input type="text" size="30" id="popup_prompt" />').after('<div id="popup_panel"><input type="button" value="' + $.alerts.okButton + '" id="popup_ok" /> <input type="button" value="' + $.alerts.cancelButton + '" id="popup_cancel" /></div>');
|
109 |
+
$("#popup_prompt").width($("#popup_message").width());
|
110 |
+
$("#popup_ok").click(function () {
|
111 |
+
var val = $("#popup_prompt").val();
|
112 |
+
$.alerts._hide();
|
113 |
+
if (callback) callback(val);
|
114 |
+
});
|
115 |
+
$("#popup_cancel").click(function () {
|
116 |
+
$.alerts._hide();
|
117 |
+
if (callback) callback(null);
|
118 |
+
});
|
119 |
+
$("#popup_prompt, #popup_ok, #popup_cancel").keypress(function (e) {
|
120 |
+
if (e.keyCode == 13) $("#popup_ok").trigger('click');
|
121 |
+
if (e.keyCode == 27) $("#popup_cancel").trigger('click');
|
122 |
+
});
|
123 |
+
if (value) $("#popup_prompt").val(value);
|
124 |
+
$("#popup_prompt").focus().select();
|
125 |
+
break;
|
126 |
+
}
|
127 |
+
|
128 |
+
// Make draggable
|
129 |
+
if ($.alerts.draggable) {
|
130 |
+
try {
|
131 |
+
$("#popup_container").draggable({ handle: $("#popup_title") });
|
132 |
+
$("#popup_title").css({ cursor: 'move' });
|
133 |
+
} catch (e) { /* requires jQuery UI draggables */
|
134 |
+
}
|
135 |
+
}
|
136 |
+
},
|
137 |
+
|
138 |
+
_hide: function () {
|
139 |
+
$("#popup_container").remove();
|
140 |
+
$.alerts._overlay('hide');
|
141 |
+
$.alerts._maintainPosition(false);
|
142 |
+
},
|
143 |
+
|
144 |
+
_overlay: function (status) {
|
145 |
+
switch (status) {
|
146 |
+
case 'show':
|
147 |
+
$.alerts._overlay('hide');
|
148 |
+
$("BODY").append('<div id="popup_overlay"></div>');
|
149 |
+
$("#popup_overlay").css({
|
150 |
+
position : 'absolute',
|
151 |
+
zIndex : 99998,
|
152 |
+
top : '0px',
|
153 |
+
left : '0px',
|
154 |
+
width : '100%',
|
155 |
+
height : $(document).height(),
|
156 |
+
background: $.alerts.overlayColor,
|
157 |
+
opacity : $.alerts.overlayOpacity
|
158 |
+
});
|
159 |
+
break;
|
160 |
+
case 'hide':
|
161 |
+
$("#popup_overlay").remove();
|
162 |
+
break;
|
163 |
+
}
|
164 |
+
},
|
165 |
+
|
166 |
+
_reposition: function () {
|
167 |
+
var top = (($(window).height() / 2) - ($("#popup_container").outerHeight() / 2)) + $.alerts.verticalOffset;
|
168 |
+
var left = (($(window).width() / 2) - ($("#popup_container").outerWidth() / 2)) + $.alerts.horizontalOffset;
|
169 |
+
if (top < 0) top = 0;
|
170 |
+
if (left < 0) left = 0;
|
171 |
+
|
172 |
+
// IE6 fix
|
173 |
+
if ($.browser.msie && parseInt($.browser.version) <= 6) top = top + $(window).scrollTop();
|
174 |
+
|
175 |
+
$("#popup_container").css({
|
176 |
+
top : top + 'px',
|
177 |
+
left: left + 'px'
|
178 |
+
});
|
179 |
+
$("#popup_overlay").height($(document).height());
|
180 |
+
},
|
181 |
+
|
182 |
+
_maintainPosition: function (status) {
|
183 |
+
if ($.alerts.repositionOnResize) {
|
184 |
+
switch (status) {
|
185 |
+
case true:
|
186 |
+
$(window).bind('resize', $.alerts._reposition);
|
187 |
+
break;
|
188 |
+
case false:
|
189 |
+
$(window).unbind('resize', $.alerts._reposition);
|
190 |
+
break;
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
}
|
196 |
+
|
197 |
+
// Shortuct functions
|
198 |
+
jAlert = function (message, title, callback) {
|
199 |
+
$.alerts.alert(message, title, callback);
|
200 |
+
}
|
201 |
+
|
202 |
+
jConfirm = function (message, title, callback) {
|
203 |
+
$.alerts.confirm(message, title, callback);
|
204 |
+
};
|
205 |
+
|
206 |
+
jPrompt = function (message, value, title, callback) {
|
207 |
+
$.alerts.prompt(message, value, title, callback);
|
208 |
+
};
|
209 |
+
|
210 |
+
})(jQuery);
|
assets/js/vendor/jquery.appear.js
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery appear plugin
|
3 |
+
*
|
4 |
+
* Copyright (c) 2012 Andrey Sidorov
|
5 |
+
* licensed under MIT license.
|
6 |
+
*
|
7 |
+
* https://github.com/morr/jquery.appear/
|
8 |
+
*
|
9 |
+
* Version: 0.3.3
|
10 |
+
*/
|
11 |
+
(function ($) {
|
12 |
+
var selectors = [];
|
13 |
+
|
14 |
+
var check_binded = false;
|
15 |
+
var check_lock = false;
|
16 |
+
var defaults = {
|
17 |
+
interval : 250,
|
18 |
+
force_process: false
|
19 |
+
}
|
20 |
+
var $window = $(window);
|
21 |
+
|
22 |
+
var $prior_appeared;
|
23 |
+
|
24 |
+
function process() {
|
25 |
+
check_lock = false;
|
26 |
+
for (var index = 0; index < selectors.length; index++) {
|
27 |
+
var $appeared = $(selectors[index]).filter(function () {
|
28 |
+
return $(this).is(':appeared');
|
29 |
+
});
|
30 |
+
|
31 |
+
$appeared.trigger('appear', [$appeared]);
|
32 |
+
|
33 |
+
if ($prior_appeared) {
|
34 |
+
var $disappeared = $prior_appeared.not($appeared);
|
35 |
+
$disappeared.trigger('disappear', [$disappeared]);
|
36 |
+
}
|
37 |
+
$prior_appeared = $appeared;
|
38 |
+
}
|
39 |
+
}
|
40 |
+
|
41 |
+
// "appeared" custom filter
|
42 |
+
$.expr[':']['appeared'] = function (element) {
|
43 |
+
var $element = $(element);
|
44 |
+
if (!$element.is(':visible')) {
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
var window_left = $window.scrollLeft();
|
49 |
+
var window_top = $window.scrollTop();
|
50 |
+
var offset = $element.offset();
|
51 |
+
var left = offset.left;
|
52 |
+
var top = offset.top;
|
53 |
+
|
54 |
+
if (top + $element.height() >= window_top &&
|
55 |
+
top - ($element.data('appear-top-offset') || 0) <= window_top + $window.height() &&
|
56 |
+
left + $element.width() >= window_left &&
|
57 |
+
left - ($element.data('appear-left-offset') || 0) <= window_left + $window.width()) {
|
58 |
+
return true;
|
59 |
+
} else {
|
60 |
+
return false;
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
$.fn.extend({
|
65 |
+
// watching for element's appearance in browser viewport
|
66 |
+
appear: function (options) {
|
67 |
+
var opts = $.extend({}, defaults, options || {});
|
68 |
+
var selector = this.selector || this;
|
69 |
+
if (!check_binded) {
|
70 |
+
var on_check = function () {
|
71 |
+
if (check_lock) {
|
72 |
+
return;
|
73 |
+
}
|
74 |
+
check_lock = true;
|
75 |
+
|
76 |
+
setTimeout(process, opts.interval);
|
77 |
+
};
|
78 |
+
|
79 |
+
$(window).scroll(on_check).resize(on_check);
|
80 |
+
check_binded = true;
|
81 |
+
}
|
82 |
+
|
83 |
+
if (opts.force_process) {
|
84 |
+
setTimeout(process, opts.interval);
|
85 |
+
}
|
86 |
+
selectors.push(selector);
|
87 |
+
return $(selector);
|
88 |
+
}
|
89 |
+
});
|
90 |
+
|
91 |
+
$.extend({
|
92 |
+
// force elements's appearance check
|
93 |
+
force_appear: function () {
|
94 |
+
if (check_binded) {
|
95 |
+
process();
|
96 |
+
return true;
|
97 |
+
}
|
98 |
+
;
|
99 |
+
return false;
|
100 |
+
}
|
101 |
+
});
|
102 |
+
})(jQuery);
|
assets/js/vendor/jquery.caret.js
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($) {
|
2 |
+
$.fn.caret = function(pos) {
|
3 |
+
var target = this[0];
|
4 |
+
var isContentEditable = target.contentEditable === 'true';
|
5 |
+
//get
|
6 |
+
if (arguments.length == 0) {
|
7 |
+
//HTML5
|
8 |
+
if (window.getSelection) {
|
9 |
+
//contenteditable
|
10 |
+
if (isContentEditable) {
|
11 |
+
target.focus();
|
12 |
+
var range1 = window.getSelection().getRangeAt(0),
|
13 |
+
range2 = range1.cloneRange();
|
14 |
+
range2.selectNodeContents(target);
|
15 |
+
range2.setEnd(range1.endContainer, range1.endOffset);
|
16 |
+
return range2.toString().length;
|
17 |
+
}
|
18 |
+
//textarea
|
19 |
+
return target.selectionStart;
|
20 |
+
}
|
21 |
+
//IE<9
|
22 |
+
if (document.selection) {
|
23 |
+
target.focus();
|
24 |
+
//contenteditable
|
25 |
+
if (isContentEditable) {
|
26 |
+
var range1 = document.selection.createRange(),
|
27 |
+
range2 = document.body.createTextRange();
|
28 |
+
range2.moveToElementText(target);
|
29 |
+
range2.setEndPoint('EndToEnd', range1);
|
30 |
+
return range2.text.length;
|
31 |
+
}
|
32 |
+
//textarea
|
33 |
+
var pos = 0,
|
34 |
+
range = target.createTextRange(),
|
35 |
+
range2 = document.selection.createRange().duplicate(),
|
36 |
+
bookmark = range2.getBookmark();
|
37 |
+
range.moveToBookmark(bookmark);
|
38 |
+
while (range.moveStart('character', -1) !== 0) pos++;
|
39 |
+
return pos;
|
40 |
+
}
|
41 |
+
// Addition for jsdom support
|
42 |
+
if (target.selectionStart)
|
43 |
+
return target.selectionStart;
|
44 |
+
//not supported
|
45 |
+
return 0;
|
46 |
+
}
|
47 |
+
//set
|
48 |
+
if (pos == -1)
|
49 |
+
pos = this[isContentEditable? 'text' : 'val']().length;
|
50 |
+
//HTML5
|
51 |
+
if (window.getSelection) {
|
52 |
+
//contenteditable
|
53 |
+
if (isContentEditable) {
|
54 |
+
target.focus();
|
55 |
+
window.getSelection().collapse(target.firstChild, pos);
|
56 |
+
}
|
57 |
+
//textarea
|
58 |
+
else
|
59 |
+
target.setSelectionRange(pos, pos);
|
60 |
+
}
|
61 |
+
//IE<9
|
62 |
+
else if (document.body.createTextRange) {
|
63 |
+
if (isContentEditable) {
|
64 |
+
var range = document.body.createTextRange();
|
65 |
+
range.moveToElementText(target);
|
66 |
+
range.moveStart('character', pos);
|
67 |
+
range.collapse(true);
|
68 |
+
range.select();
|
69 |
+
} else {
|
70 |
+
var range = target.createTextRange();
|
71 |
+
range.move('character', pos);
|
72 |
+
range.select();
|
73 |
+
}
|
74 |
+
}
|
75 |
+
if (!isContentEditable)
|
76 |
+
target.focus();
|
77 |
+
return this;
|
78 |
+
}
|
79 |
+
})(jQuery);
|
assets/js/vendor/jquery.cookie.js
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// jQuery cookie plugin
|
2 |
+
(function (factory) {
|
3 |
+
if (typeof define === 'function' && define.amd) {
|
4 |
+
define(['jquery'], factory);
|
5 |
+
} else if (typeof exports === 'object') {
|
6 |
+
module.exports = factory(require('jquery'));
|
7 |
+
} else {
|
8 |
+
factory(jQuery);
|
9 |
+
}
|
10 |
+
}(function ($) {
|
11 |
+
var pluses = /\+/g;
|
12 |
+
function encode(s) {
|
13 |
+
return config.raw ? s : encodeURIComponent(s);
|
14 |
+
}
|
15 |
+
function decode(s) {
|
16 |
+
return config.raw ? s : decodeURIComponent(s);
|
17 |
+
}
|
18 |
+
function stringifyCookieValue(value) {
|
19 |
+
return encode(config.json ? JSON.stringify(value) : String(value));
|
20 |
+
}
|
21 |
+
function parseCookieValue(s) {
|
22 |
+
if (s.indexOf('"') === 0) {
|
23 |
+
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
24 |
+
}
|
25 |
+
try {
|
26 |
+
s = decodeURIComponent(s.replace(pluses, ' '));
|
27 |
+
return config.json ? JSON.parse(s) : s;
|
28 |
+
} catch (e) {
|
29 |
+
}
|
30 |
+
}
|
31 |
+
function read(s, converter) {
|
32 |
+
var value = config.raw ? s : parseCookieValue(s);
|
33 |
+
return $.isFunction(converter) ? converter(value) : value;
|
34 |
+
}
|
35 |
+
var config = $.cookie = function (key, value, options) {
|
36 |
+
if (arguments.length > 1 && !$.isFunction(value)) {
|
37 |
+
options = $.extend({}, config.defaults, options);
|
38 |
+
if (typeof options.expires === 'number') {
|
39 |
+
var days = options.expires, t = options.expires = new Date();
|
40 |
+
t.setMilliseconds(t.getMilliseconds() + days * 864e+5);
|
41 |
+
}
|
42 |
+
return (document.cookie = [
|
43 |
+
encode(key), '=', stringifyCookieValue(value),
|
44 |
+
options.expires ? '; expires=' + options.expires.toUTCString() : '',
|
45 |
+
options.path ? '; path=' + options.path : '',
|
46 |
+
options.domain ? '; domain=' + options.domain : '',
|
47 |
+
options.secure ? '; secure' : ''
|
48 |
+
].join(''));
|
49 |
+
}
|
50 |
+
var result = key ? undefined : {},
|
51 |
+
cookies = document.cookie ? document.cookie.split('; ') : [],
|
52 |
+
i = 0,
|
53 |
+
l = cookies.length;
|
54 |
+
for (; i < l; i++) {
|
55 |
+
var parts = cookies[i].split('='),
|
56 |
+
name = decode(parts.shift()),
|
57 |
+
cookie = parts.join('=');
|
58 |
+
if (key === name) {
|
59 |
+
result = read(cookie, value);
|
60 |
+
break;
|
61 |
+
}
|
62 |
+
if (!key && (cookie = read(cookie)) !== undefined) {
|
63 |
+
result[name] = cookie;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
return result;
|
67 |
+
};
|
68 |
+
config.defaults = {};
|
69 |
+
$.removeCookie = function (key, options) {
|
70 |
+
$.cookie(key, '', $.extend({}, options, {expires: -1}));
|
71 |
+
return !$.cookie(key);
|
72 |
+
};
|
73 |
+
}));
|
assets/js/vendor/jquery.scrollTo.js
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* jQuery.scrollTo
|
3 |
+
* Copyright (c) 2007-2015 Ariel Flesler - aflesler ○ gmail • com | http://flesler.blogspot.com
|
4 |
+
* Licensed under MIT
|
5 |
+
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
|
6 |
+
* @projectDescription Lightweight, cross-browser and highly customizable animated scrolling with jQuery
|
7 |
+
* @author Ariel Flesler
|
8 |
+
* @version 2.1.2
|
9 |
+
*/
|
10 |
+
;(function(factory) {
|
11 |
+
'use strict';
|
12 |
+
if (typeof define === 'function' && define.amd) {
|
13 |
+
// AMD
|
14 |
+
define(['jquery'], factory);
|
15 |
+
} else if (typeof module !== 'undefined' && module.exports) {
|
16 |
+
// CommonJS
|
17 |
+
module.exports = factory(require('jquery'));
|
18 |
+
} else {
|
19 |
+
// Global
|
20 |
+
factory(jQuery);
|
21 |
+
}
|
22 |
+
})(function($) {
|
23 |
+
'use strict';
|
24 |
+
|
25 |
+
var $scrollTo = $.scrollTo = function(target, duration, settings) {
|
26 |
+
return $(window).scrollTo(target, duration, settings);
|
27 |
+
};
|
28 |
+
|
29 |
+
$scrollTo.defaults = {
|
30 |
+
axis:'xy',
|
31 |
+
duration: 0,
|
32 |
+
limit:true
|
33 |
+
};
|
34 |
+
|
35 |
+
function isWin(elem) {
|
36 |
+
return !elem.nodeName ||
|
37 |
+
$.inArray(elem.nodeName.toLowerCase(), ['iframe','#document','html','body']) !== -1;
|
38 |
+
}
|
39 |
+
|
40 |
+
$.fn.scrollTo = function(target, duration, settings) {
|
41 |
+
if (typeof duration === 'object') {
|
42 |
+
settings = duration;
|
43 |
+
duration = 0;
|
44 |
+
}
|
45 |
+
if (typeof settings === 'function') {
|
46 |
+
settings = { onAfter:settings };
|
47 |
+
}
|
48 |
+
if (target === 'max') {
|
49 |
+
target = 9e9;
|
50 |
+
}
|
51 |
+
|
52 |
+
settings = $.extend({}, $scrollTo.defaults, settings);
|
53 |
+
// Speed is still recognized for backwards compatibility
|
54 |
+
duration = duration || settings.duration;
|
55 |
+
// Make sure the settings are given right
|
56 |
+
var queue = settings.queue && settings.axis.length > 1;
|
57 |
+
if (queue) {
|
58 |
+
// Let's keep the overall duration
|
59 |
+
duration /= 2;
|
60 |
+
}
|
61 |
+
settings.offset = both(settings.offset);
|
62 |
+
settings.over = both(settings.over);
|
63 |
+
|
64 |
+
return this.each(function() {
|
65 |
+
// Null target yields nothing, just like jQuery does
|
66 |
+
if (target === null) return;
|
67 |
+
|
68 |
+
var win = isWin(this),
|
69 |
+
elem = win ? this.contentWindow || window : this,
|
70 |
+
$elem = $(elem),
|
71 |
+
targ = target,
|
72 |
+
attr = {},
|
73 |
+
toff;
|
74 |
+
|
75 |
+
switch (typeof targ) {
|
76 |
+
// A number will pass the regex
|
77 |
+
case 'number':
|
78 |
+
case 'string':
|
79 |
+
if (/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(targ)) {
|
80 |
+
targ = both(targ);
|
81 |
+
// We are done
|
82 |
+
break;
|
83 |
+
}
|
84 |
+
// Relative/Absolute selector
|
85 |
+
targ = win ? $(targ) : $(targ, elem);
|
86 |
+
/* falls through */
|
87 |
+
case 'object':
|
88 |
+
if (targ.length === 0) return;
|
89 |
+
// DOMElement / jQuery
|
90 |
+
if (targ.is || targ.style) {
|
91 |
+
// Get the real position of the target
|
92 |
+
toff = (targ = $(targ)).offset();
|
93 |
+
}
|
94 |
+
}
|
95 |
+
|
96 |
+
var offset = $.isFunction(settings.offset) && settings.offset(elem, targ) || settings.offset;
|
97 |
+
|
98 |
+
$.each(settings.axis.split(''), function(i, axis) {
|
99 |
+
var Pos = axis === 'x' ? 'Left' : 'Top',
|
100 |
+
pos = Pos.toLowerCase(),
|
101 |
+
key = 'scroll' + Pos,
|
102 |
+
prev = $elem[key](),
|
103 |
+
max = $scrollTo.max(elem, axis);
|
104 |
+
|
105 |
+
if (toff) {// jQuery / DOMElement
|
106 |
+
attr[key] = toff[pos] + (win ? 0 : prev - $elem.offset()[pos]);
|
107 |
+
|
108 |
+
// If it's a dom element, reduce the margin
|
109 |
+
if (settings.margin) {
|
110 |
+
attr[key] -= parseInt(targ.css('margin'+Pos), 10) || 0;
|
111 |
+
attr[key] -= parseInt(targ.css('border'+Pos+'Width'), 10) || 0;
|
112 |
+
}
|
113 |
+
|
114 |
+
attr[key] += offset[pos] || 0;
|
115 |
+
|
116 |
+
if (settings.over[pos]) {
|
117 |
+
// Scroll to a fraction of its width/height
|
118 |
+
attr[key] += targ[axis === 'x'?'width':'height']() * settings.over[pos];
|
119 |
+
}
|
120 |
+
} else {
|
121 |
+
var val = targ[pos];
|
122 |
+
// Handle percentage values
|
123 |
+
attr[key] = val.slice && val.slice(-1) === '%' ?
|
124 |
+
parseFloat(val) / 100 * max
|
125 |
+
: val;
|
126 |
+
}
|
127 |
+
|
128 |
+
// Number or 'number'
|
129 |
+
if (settings.limit && /^\d+$/.test(attr[key])) {
|
130 |
+
// Check the limits
|
131 |
+
attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max);
|
132 |
+
}
|
133 |
+
|
134 |
+
// Don't waste time animating, if there's no need.
|
135 |
+
if (!i && settings.axis.length > 1) {
|
136 |
+
if (prev === attr[key]) {
|
137 |
+
// No animation needed
|
138 |
+
attr = {};
|
139 |
+
} else if (queue) {
|
140 |
+
// Intermediate animation
|
141 |
+
animate(settings.onAfterFirst);
|
142 |
+
// Don't animate this axis again in the next iteration.
|
143 |
+
attr = {};
|
144 |
+
}
|
145 |
+
}
|
146 |
+
});
|
147 |
+
|
148 |
+
animate(settings.onAfter);
|
149 |
+
|
150 |
+
function animate(callback) {
|
151 |
+
var opts = $.extend({}, settings, {
|
152 |
+
// The queue setting conflicts with animate()
|
153 |
+
// Force it to always be true
|
154 |
+
queue: true,
|
155 |
+
duration: duration,
|
156 |
+
complete: callback && function() {
|
157 |
+
callback.call(elem, targ, settings);
|
158 |
+
}
|
159 |
+
});
|
160 |
+
$elem.animate(attr, opts);
|
161 |
+
}
|
162 |
+
});
|
163 |
+
};
|
164 |
+
|
165 |
+
// Max scrolling position, works on quirks mode
|
166 |
+
// It only fails (not too badly) on IE, quirks mode.
|
167 |
+
$scrollTo.max = function(elem, axis) {
|
168 |
+
var Dim = axis === 'x' ? 'Width' : 'Height',
|
169 |
+
scroll = 'scroll'+Dim;
|
170 |
+
|
171 |
+
if (!isWin(elem))
|
172 |
+
return elem[scroll] - $(elem)[Dim.toLowerCase()]();
|
173 |
+
|
174 |
+
var size = 'client' + Dim,
|
175 |
+
doc = elem.ownerDocument || elem.document,
|
176 |
+
html = doc.documentElement,
|
177 |
+
body = doc.body;
|
178 |
+
|
179 |
+
return Math.max(html[scroll], body[scroll]) - Math.min(html[size], body[size]);
|
180 |
+
};
|
181 |
+
|
182 |
+
function both(val) {
|
183 |
+
return $.isFunction(val) || $.isPlainObject(val) ? val : { top:val, left:val };
|
184 |
+
}
|
185 |
+
|
186 |
+
// Add special hooks so that window scroll properties can be animated
|
187 |
+
$.Tween.propHooks.scrollLeft =
|
188 |
+
$.Tween.propHooks.scrollTop = {
|
189 |
+
get: function(t) {
|
190 |
+
return $(t.elem)[t.prop]();
|
191 |
+
},
|
192 |
+
set: function(t) {
|
193 |
+
var curr = this.get(t);
|
194 |
+
// If interrupt is true and user scrolled, stop animating
|
195 |
+
if (t.options.interrupt && t._last && t._last !== curr) {
|
196 |
+
return $(t.elem).stop();
|
197 |
+
}
|
198 |
+
var next = Math.round(t.now);
|
199 |
+
// Don't waste CPU
|
200 |
+
// Browsers don't render floating point scroll
|
201 |
+
if (curr !== next) {
|
202 |
+
$(t.elem)[t.prop](next);
|
203 |
+
t._last = this.get(t);
|
204 |
+
}
|
205 |
+
}
|
206 |
+
};
|
207 |
+
|
208 |
+
// AMD requirement
|
209 |
+
return $scrollTo;
|
210 |
+
});
|
assets/js/vendor/jquery.timer.js
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function (e) {
|
2 |
+
e.backward_timer = function (t) {
|
3 |
+
var n = {seconds: 5, step: 1, format: "h%:m%:s%", value_setter: undefined, on_exhausted: function (e) {
|
4 |
+
}, on_tick : function (e) {
|
5 |
+
}}, r = this;
|
6 |
+
r.seconds_left = 0;
|
7 |
+
r.target = e(t);
|
8 |
+
r.timeout = undefined;
|
9 |
+
r.settings = {};
|
10 |
+
r.methods = {init : function (t) {
|
11 |
+
r.settings = e.extend({}, n, t);
|
12 |
+
if (r.settings.value_setter == undefined) {
|
13 |
+
if (r.target.is("input")) {
|
14 |
+
r.settings.value_setter = "val"
|
15 |
+
} else {
|
16 |
+
r.settings.value_setter = "text"
|
17 |
+
}
|
18 |
+
}
|
19 |
+
r.methods.reset()
|
20 |
+
}, start : function () {
|
21 |
+
if (r.timeout == undefined) {
|
22 |
+
var e = r.seconds_left == r.settings.seconds ? 0 : r.settings.step * 1e3;
|
23 |
+
setTimeout(r.methods._on_tick, e, e)
|
24 |
+
}
|
25 |
+
}, cancel : function () {
|
26 |
+
if (r.timeout != undefined) {
|
27 |
+
clearTimeout(r.timeout);
|
28 |
+
r.timeout = undefined
|
29 |
+
}
|
30 |
+
}, reset : function () {
|
31 |
+
r.seconds_left = r.settings.seconds;
|
32 |
+
r.methods._render_seconds()
|
33 |
+
}, _on_tick : function (e) {
|
34 |
+
if (e != 0) {
|
35 |
+
r.settings.on_tick(r)
|
36 |
+
}
|
37 |
+
r.methods._render_seconds();
|
38 |
+
if (r.seconds_left > 0) {
|
39 |
+
if (r.seconds_left < r.settings.step) {
|
40 |
+
var t = r.seconds_left
|
41 |
+
} else {
|
42 |
+
var t = r.settings.step
|
43 |
+
}
|
44 |
+
r.seconds_left -= t;
|
45 |
+
var n = t * 1e3;
|
46 |
+
r.timeout = setTimeout(r.methods._on_tick, n, n)
|
47 |
+
} else {
|
48 |
+
r.timeout = undefined;
|
49 |
+
r.settings.on_exhausted(r)
|
50 |
+
}
|
51 |
+
}, _render_seconds : function () {
|
52 |
+
var e = r.methods._seconds_to_dhms(r.seconds_left), t = r.settings.format;
|
53 |
+
if (t.indexOf("d%") !== -1) {
|
54 |
+
t = t.replace("d%", e.d).replace("h%", r.methods._check_leading_zero(e.h))
|
55 |
+
} else {
|
56 |
+
t = t.replace("h%", e.d * 24 + e.h)
|
57 |
+
}
|
58 |
+
t = t.replace("m%", r.methods._check_leading_zero(e.m)).replace("s%", r.methods._check_leading_zero(e.s));
|
59 |
+
r.target[r.settings.value_setter](t)
|
60 |
+
}, _seconds_to_dhms : function (e) {
|
61 |
+
var t = Math.floor(e / (24 * 3600)), e = e - t * 24 * 3600, n = Math.floor(e / 3600), e = e - n * 3600, r = Math.floor(e / 60), i = Math.floor(e - r * 60);
|
62 |
+
return{d: t, h: n, m: r, s: i}
|
63 |
+
}, _check_leading_zero: function (e) {
|
64 |
+
return e < 10 ? "0" + e : "" + e
|
65 |
+
}}
|
66 |
+
};
|
67 |
+
e.fn.backward_timer = function (t) {
|
68 |
+
var n = arguments;
|
69 |
+
return this.each(function () {
|
70 |
+
var r = e(this).data("backward_timer");
|
71 |
+
if (r == undefined) {
|
72 |
+
r = new e.backward_timer(this);
|
73 |
+
e(this).data("backward_timer", r)
|
74 |
+
}
|
75 |
+
if (r.methods[t]) {
|
76 |
+
return r.methods[t].apply(this, Array.prototype.slice.call(n, 1))
|
77 |
+
} else if (typeof t === "object" || !t) {
|
78 |
+
return r.methods.init.apply(this, n)
|
79 |
+
} else {
|
80 |
+
e.error("Method " + t + " does not exist on jQuery.backward_timer")
|
81 |
+
}
|
82 |
+
})
|
83 |
+
}
|
84 |
+
})(jQuery)
|
assets/js/vendor/sortable.js
ADDED
@@ -0,0 +1,1490 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**!
|
2 |
+
* Sortable
|
3 |
+
* @author RubaXa <trash@rubaxa.org>
|
4 |
+
* @license MIT
|
5 |
+
*/
|
6 |
+
|
7 |
+
(function sortableModule(factory) {
|
8 |
+
"use strict";
|
9 |
+
|
10 |
+
if (typeof define === "function" && define.amd) {
|
11 |
+
define(factory);
|
12 |
+
}
|
13 |
+
else if (typeof module != "undefined" && typeof module.exports != "undefined") {
|
14 |
+
module.exports = factory();
|
15 |
+
}
|
16 |
+
else {
|
17 |
+
/* jshint sub:true */
|
18 |
+
window["Sortable"] = factory();
|
19 |
+
}
|
20 |
+
})(function sortableFactory() {
|
21 |
+
"use strict";
|
22 |
+
|
23 |
+
if (typeof window == "undefined" || !window.document) {
|
24 |
+
return function sortableError() {
|
25 |
+
throw new Error("Sortable.js requires a window with a document");
|
26 |
+
};
|
27 |
+
}
|
28 |
+
|
29 |
+
var dragEl,
|
30 |
+
parentEl,
|
31 |
+
ghostEl,
|
32 |
+
cloneEl,
|
33 |
+
rootEl,
|
34 |
+
nextEl,
|
35 |
+
lastDownEl,
|
36 |
+
|
37 |
+
scrollEl,
|
38 |
+
scrollParentEl,
|
39 |
+
scrollCustomFn,
|
40 |
+
|
41 |
+
lastEl,
|
42 |
+
lastCSS,
|
43 |
+
lastParentCSS,
|
44 |
+
|
45 |
+
oldIndex,
|
46 |
+
newIndex,
|
47 |
+
|
48 |
+
activeGroup,
|
49 |
+
putSortable,
|
50 |
+
|
51 |
+
autoScroll = {},
|
52 |
+
|
53 |
+
tapEvt,
|
54 |
+
touchEvt,
|
55 |
+
|
56 |
+
moved,
|
57 |
+
|
58 |
+
/** @const */
|
59 |
+
R_SPACE = /\s+/g,
|
60 |
+
R_FLOAT = /left|right|inline/,
|
61 |
+
|
62 |
+
expando = 'Sortable' + (new Date).getTime(),
|
63 |
+
|
64 |
+
win = window,
|
65 |
+
document = win.document,
|
66 |
+
parseInt = win.parseInt,
|
67 |
+
|
68 |
+
$ = win.jQuery || win.Zepto,
|
69 |
+
Polymer = win.Polymer,
|
70 |
+
|
71 |
+
captureMode = false,
|
72 |
+
|
73 |
+
supportDraggable = !!('draggable' in document.createElement('div')),
|
74 |
+
supportCssPointerEvents = (function (el) {
|
75 |
+
// false when IE11
|
76 |
+
if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
el = document.createElement('x');
|
80 |
+
el.style.cssText = 'pointer-events:auto';
|
81 |
+
return el.style.pointerEvents === 'auto';
|
82 |
+
})(),
|
83 |
+
|
84 |
+
_silent = false,
|
85 |
+
|
86 |
+
abs = Math.abs,
|
87 |
+
min = Math.min,
|
88 |
+
|
89 |
+
savedInputChecked = [],
|
90 |
+
touchDragOverListeners = [],
|
91 |
+
|
92 |
+
_autoScroll = _throttle(function (/**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
|
93 |
+
// Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
|
94 |
+
if (rootEl && options.scroll) {
|
95 |
+
var _this = rootEl[expando],
|
96 |
+
el,
|
97 |
+
rect,
|
98 |
+
sens = options.scrollSensitivity,
|
99 |
+
speed = options.scrollSpeed,
|
100 |
+
|
101 |
+
x = evt.clientX,
|
102 |
+
y = evt.clientY,
|
103 |
+
|
104 |
+
winWidth = window.innerWidth,
|
105 |
+
winHeight = window.innerHeight,
|
106 |
+
|
107 |
+
vx,
|
108 |
+
vy,
|
109 |
+
|
110 |
+
scrollOffsetX,
|
111 |
+
scrollOffsetY
|
112 |
+
;
|
113 |
+
|
114 |
+
// Delect scrollEl
|
115 |
+
if (scrollParentEl !== rootEl) {
|
116 |
+
scrollEl = options.scroll;
|
117 |
+
scrollParentEl = rootEl;
|
118 |
+
scrollCustomFn = options.scrollFn;
|
119 |
+
|
120 |
+
if (scrollEl === true) {
|
121 |
+
scrollEl = rootEl;
|
122 |
+
|
123 |
+
do {
|
124 |
+
if ((scrollEl.offsetWidth < scrollEl.scrollWidth) ||
|
125 |
+
(scrollEl.offsetHeight < scrollEl.scrollHeight)
|
126 |
+
) {
|
127 |
+
break;
|
128 |
+
}
|
129 |
+
/* jshint boss:true */
|
130 |
+
} while (scrollEl = scrollEl.parentNode);
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
if (scrollEl) {
|
135 |
+
el = scrollEl;
|
136 |
+
rect = scrollEl.getBoundingClientRect();
|
137 |
+
vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
|
138 |
+
vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
|
139 |
+
}
|
140 |
+
|
141 |
+
|
142 |
+
if (!(vx || vy)) {
|
143 |
+
vx = (winWidth - x <= sens) - (x <= sens);
|
144 |
+
vy = (winHeight - y <= sens) - (y <= sens);
|
145 |
+
|
146 |
+
/* jshint expr:true */
|
147 |
+
(vx || vy) && (el = win);
|
148 |
+
}
|
149 |
+
|
150 |
+
|
151 |
+
if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
|
152 |
+
autoScroll.el = el;
|
153 |
+
autoScroll.vx = vx;
|
154 |
+
autoScroll.vy = vy;
|
155 |
+
|
156 |
+
clearInterval(autoScroll.pid);
|
157 |
+
|
158 |
+
if (el) {
|
159 |
+
autoScroll.pid = setInterval(function () {
|
160 |
+
scrollOffsetY = vy ? vy * speed : 0;
|
161 |
+
scrollOffsetX = vx ? vx * speed : 0;
|
162 |
+
|
163 |
+
if ('function' === typeof(scrollCustomFn)) {
|
164 |
+
return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
|
165 |
+
}
|
166 |
+
|
167 |
+
if (el === win) {
|
168 |
+
win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
|
169 |
+
} else {
|
170 |
+
el.scrollTop += scrollOffsetY;
|
171 |
+
el.scrollLeft += scrollOffsetX;
|
172 |
+
}
|
173 |
+
}, 24);
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}, 30),
|
178 |
+
|
179 |
+
_prepareGroup = function (options) {
|
180 |
+
function toFn(value, pull) {
|
181 |
+
if (value === void 0 || value === true) {
|
182 |
+
value = group.name;
|
183 |
+
}
|
184 |
+
|
185 |
+
if (typeof value === 'function') {
|
186 |
+
return value;
|
187 |
+
} else {
|
188 |
+
return function (to, from) {
|
189 |
+
var fromGroup = from.options.group.name;
|
190 |
+
|
191 |
+
return pull
|
192 |
+
? value
|
193 |
+
: value && (value.join
|
194 |
+
? value.indexOf(fromGroup) > -1
|
195 |
+
: (fromGroup == value)
|
196 |
+
);
|
197 |
+
};
|
198 |
+
}
|
199 |
+
}
|
200 |
+
|
201 |
+
var group = {};
|
202 |
+
var originalGroup = options.group;
|
203 |
+
|
204 |
+
if (!originalGroup || typeof originalGroup != 'object') {
|
205 |
+
originalGroup = {name: originalGroup};
|
206 |
+
}
|
207 |
+
|
208 |
+
group.name = originalGroup.name;
|
209 |
+
group.checkPull = toFn(originalGroup.pull, true);
|
210 |
+
group.checkPut = toFn(originalGroup.put);
|
211 |
+
group.revertClone = originalGroup.revertClone;
|
212 |
+
|
213 |
+
options.group = group;
|
214 |
+
}
|
215 |
+
;
|
216 |
+
|
217 |
+
|
218 |
+
/**
|
219 |
+
* @class Sortable
|
220 |
+
* @param {HTMLElement} el
|
221 |
+
* @param {Object} [options]
|
222 |
+
*/
|
223 |
+
function Sortable(el, options) {
|
224 |
+
if (!(el && el.nodeType && el.nodeType === 1)) {
|
225 |
+
throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
|
226 |
+
}
|
227 |
+
|
228 |
+
this.el = el; // root element
|
229 |
+
this.options = options = _extend({}, options);
|
230 |
+
|
231 |
+
|
232 |
+
// Export instance
|
233 |
+
el[expando] = this;
|
234 |
+
|
235 |
+
// Default options
|
236 |
+
var defaults = {
|
237 |
+
group: Math.random(),
|
238 |
+
sort: true,
|
239 |
+
disabled: false,
|
240 |
+
store: null,
|
241 |
+
handle: null,
|
242 |
+
scroll: true,
|
243 |
+
scrollSensitivity: 30,
|
244 |
+
scrollSpeed: 10,
|
245 |
+
draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
|
246 |
+
ghostClass: 'sortable-ghost',
|
247 |
+
chosenClass: 'sortable-chosen',
|
248 |
+
dragClass: 'sortable-drag',
|
249 |
+
ignore: 'a, img',
|
250 |
+
filter: null,
|
251 |
+
preventOnFilter: true,
|
252 |
+
animation: 0,
|
253 |
+
setData: function (dataTransfer, dragEl) {
|
254 |
+
dataTransfer.setData('Text', dragEl.textContent);
|
255 |
+
},
|
256 |
+
dropBubble: false,
|
257 |
+
dragoverBubble: false,
|
258 |
+
dataIdAttr: 'data-id',
|
259 |
+
delay: 0,
|
260 |
+
forceFallback: false,
|
261 |
+
fallbackClass: 'sortable-fallback',
|
262 |
+
fallbackOnBody: false,
|
263 |
+
fallbackTolerance: 0,
|
264 |
+
fallbackOffset: {x: 0, y: 0}
|
265 |
+
};
|
266 |
+
|
267 |
+
|
268 |
+
// Set default options
|
269 |
+
for (var name in defaults) {
|
270 |
+
!(name in options) && (options[name] = defaults[name]);
|
271 |
+
}
|
272 |
+
|
273 |
+
_prepareGroup(options);
|
274 |
+
|
275 |
+
// Bind all private methods
|
276 |
+
for (var fn in this) {
|
277 |
+
if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
|
278 |
+
this[fn] = this[fn].bind(this);
|
279 |
+
}
|
280 |
+
}
|
281 |
+
|
282 |
+
// Setup drag mode
|
283 |
+
this.nativeDraggable = options.forceFallback ? false : supportDraggable;
|
284 |
+
|
285 |
+
// Bind events
|
286 |
+
_on(el, 'mousedown', this._onTapStart);
|
287 |
+
_on(el, 'touchstart', this._onTapStart);
|
288 |
+
_on(el, 'pointerdown', this._onTapStart);
|
289 |
+
|
290 |
+
if (this.nativeDraggable) {
|
291 |
+
_on(el, 'dragover', this);
|
292 |
+
_on(el, 'dragenter', this);
|
293 |
+
}
|
294 |
+
|
295 |
+
touchDragOverListeners.push(this._onDragOver);
|
296 |
+
|
297 |
+
// Restore sorting
|
298 |
+
options.store && this.sort(options.store.get(this));
|
299 |
+
}
|
300 |
+
|
301 |
+
|
302 |
+
Sortable.prototype = /** @lends Sortable.prototype */ {
|
303 |
+
constructor: Sortable,
|
304 |
+
|
305 |
+
_onTapStart: function (/** Event|TouchEvent */evt) {
|
306 |
+
var _this = this,
|
307 |
+
el = this.el,
|
308 |
+
options = this.options,
|
309 |
+
preventOnFilter = options.preventOnFilter,
|
310 |
+
type = evt.type,
|
311 |
+
touch = evt.touches && evt.touches[0],
|
312 |
+
target = (touch || evt).target,
|
313 |
+
originalTarget = evt.target.shadowRoot && evt.path[0] || target,
|
314 |
+
filter = options.filter,
|
315 |
+
startIndex;
|
316 |
+
|
317 |
+
_saveInputCheckedState(el);
|
318 |
+
|
319 |
+
|
320 |
+
// Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
|
321 |
+
if (dragEl) {
|
322 |
+
return;
|
323 |
+
}
|
324 |
+
|
325 |
+
if (type === 'mousedown' && evt.button !== 0 || options.disabled) {
|
326 |
+
return; // only left button or enabled
|
327 |
+
}
|
328 |
+
|
329 |
+
|
330 |
+
target = _closest(target, options.draggable, el);
|
331 |
+
|
332 |
+
if (!target) {
|
333 |
+
return;
|
334 |
+
}
|
335 |
+
|
336 |
+
if (lastDownEl === target) {
|
337 |
+
// Ignoring duplicate `down`
|
338 |
+
return;
|
339 |
+
}
|
340 |
+
|
341 |
+
// Get the index of the dragged element within its parent
|
342 |
+
startIndex = _index(target, options.draggable);
|
343 |
+
|
344 |
+
// Check filter
|
345 |
+
if (typeof filter === 'function') {
|
346 |
+
if (filter.call(this, evt, target, this)) {
|
347 |
+
_dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
|
348 |
+
preventOnFilter && evt.preventDefault();
|
349 |
+
return; // cancel dnd
|
350 |
+
}
|
351 |
+
}
|
352 |
+
else if (filter) {
|
353 |
+
filter = filter.split(',').some(function (criteria) {
|
354 |
+
criteria = _closest(originalTarget, criteria.trim(), el);
|
355 |
+
|
356 |
+
if (criteria) {
|
357 |
+
_dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
|
358 |
+
return true;
|
359 |
+
}
|
360 |
+
});
|
361 |
+
|
362 |
+
if (filter) {
|
363 |
+
preventOnFilter && evt.preventDefault();
|
364 |
+
return; // cancel dnd
|
365 |
+
}
|
366 |
+
}
|
367 |
+
|
368 |
+
if (options.handle && !_closest(originalTarget, options.handle, el)) {
|
369 |
+
return;
|
370 |
+
}
|
371 |
+
|
372 |
+
// Prepare `dragstart`
|
373 |
+
this._prepareDragStart(evt, touch, target, startIndex);
|
374 |
+
},
|
375 |
+
|
376 |
+
_prepareDragStart: function (/** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
|
377 |
+
var _this = this,
|
378 |
+
el = _this.el,
|
379 |
+
options = _this.options,
|
380 |
+
ownerDocument = el.ownerDocument,
|
381 |
+
dragStartFn;
|
382 |
+
|
383 |
+
if (target && !dragEl && (target.parentNode === el)) {
|
384 |
+
tapEvt = evt;
|
385 |
+
|
386 |
+
rootEl = el;
|
387 |
+
dragEl = target;
|
388 |
+
parentEl = dragEl.parentNode;
|
389 |
+
nextEl = dragEl.nextSibling;
|
390 |
+
lastDownEl = target;
|
391 |
+
activeGroup = options.group;
|
392 |
+
oldIndex = startIndex;
|
393 |
+
|
394 |
+
this._lastX = (touch || evt).clientX;
|
395 |
+
this._lastY = (touch || evt).clientY;
|
396 |
+
|
397 |
+
dragEl.style['will-change'] = 'transform';
|
398 |
+
|
399 |
+
dragStartFn = function () {
|
400 |
+
// Delayed drag has been triggered
|
401 |
+
// we can re-enable the events: touchmove/mousemove
|
402 |
+
_this._disableDelayedDrag();
|
403 |
+
|
404 |
+
// Make the element draggable
|
405 |
+
dragEl.draggable = _this.nativeDraggable;
|
406 |
+
|
407 |
+
// Chosen item
|
408 |
+
_toggleClass(dragEl, options.chosenClass, true);
|
409 |
+
|
410 |
+
// Bind the events: dragstart/dragend
|
411 |
+
_this._triggerDragStart(evt, touch);
|
412 |
+
|
413 |
+
// Drag start event
|
414 |
+
_dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
|
415 |
+
};
|
416 |
+
|
417 |
+
// Disable "draggable"
|
418 |
+
options.ignore.split(',').forEach(function (criteria) {
|
419 |
+
_find(dragEl, criteria.trim(), _disableDraggable);
|
420 |
+
});
|
421 |
+
|
422 |
+
_on(ownerDocument, 'mouseup', _this._onDrop);
|
423 |
+
_on(ownerDocument, 'touchend', _this._onDrop);
|
424 |
+
_on(ownerDocument, 'touchcancel', _this._onDrop);
|
425 |
+
_on(ownerDocument, 'pointercancel', _this._onDrop);
|
426 |
+
_on(ownerDocument, 'selectstart', _this);
|
427 |
+
|
428 |
+
if (options.delay) {
|
429 |
+
// If the user moves the pointer or let go the click or touch
|
430 |
+
// before the delay has been reached:
|
431 |
+
// disable the delayed drag
|
432 |
+
_on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
|
433 |
+
_on(ownerDocument, 'touchend', _this._disableDelayedDrag);
|
434 |
+
_on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
|
435 |
+
_on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
|
436 |
+
_on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
|
437 |
+
_on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
|
438 |
+
|
439 |
+
_this._dragStartTimer = setTimeout(dragStartFn, options.delay);
|
440 |
+
} else {
|
441 |
+
dragStartFn();
|
442 |
+
}
|
443 |
+
|
444 |
+
}
|
445 |
+
},
|
446 |
+
|
447 |
+
_disableDelayedDrag: function () {
|
448 |
+
var ownerDocument = this.el.ownerDocument;
|
449 |
+
|
450 |
+
clearTimeout(this._dragStartTimer);
|
451 |
+
_off(ownerDocument, 'mouseup', this._disableDelayedDrag);
|
452 |
+
_off(ownerDocument, 'touchend', this._disableDelayedDrag);
|
453 |
+
_off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
|
454 |
+
_off(ownerDocument, 'mousemove', this._disableDelayedDrag);
|
455 |
+
_off(ownerDocument, 'touchmove', this._disableDelayedDrag);
|
456 |
+
_off(ownerDocument, 'pointermove', this._disableDelayedDrag);
|
457 |
+
},
|
458 |
+
|
459 |
+
_triggerDragStart: function (/** Event */evt, /** Touch */touch) {
|
460 |
+
touch = touch || (evt.pointerType == 'touch' ? evt : null);
|
461 |
+
|
462 |
+
if (touch) {
|
463 |
+
// Touch device support
|
464 |
+
tapEvt = {
|
465 |
+
target: dragEl,
|
466 |
+
clientX: touch.clientX,
|
467 |
+
clientY: touch.clientY
|
468 |
+
};
|
469 |
+
|
470 |
+
this._onDragStart(tapEvt, 'touch');
|
471 |
+
}
|
472 |
+
else if (!this.nativeDraggable) {
|
473 |
+
this._onDragStart(tapEvt, true);
|
474 |
+
}
|
475 |
+
else {
|
476 |
+
_on(dragEl, 'dragend', this);
|
477 |
+
_on(rootEl, 'dragstart', this._onDragStart);
|
478 |
+
}
|
479 |
+
try {
|
480 |
+
if (document.selection) {
|
481 |
+
// Timeout neccessary for IE9
|
482 |
+
setTimeout(function () {
|
483 |
+
document.selection.empty();
|
484 |
+
});
|
485 |
+
} else {
|
486 |
+
window.getSelection().removeAllRanges();
|
487 |
+
}
|
488 |
+
} catch (err) {
|
489 |
+
console.log(err)
|
490 |
+
}
|
491 |
+
},
|
492 |
+
|
493 |
+
_dragStarted: function () {
|
494 |
+
if (rootEl && dragEl) {
|
495 |
+
var options = this.options;
|
496 |
+
|
497 |
+
// Apply effect
|
498 |
+
_toggleClass(dragEl, options.ghostClass, true);
|
499 |
+
_toggleClass(dragEl, options.dragClass, false);
|
500 |
+
|
501 |
+
Sortable.active = this;
|
502 |
+
|
503 |
+
// Drag start event
|
504 |
+
_dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
|
505 |
+
} else {
|
506 |
+
this._nulling();
|
507 |
+
}
|
508 |
+
},
|
509 |
+
|
510 |
+
_emulateDragOver: function () {
|
511 |
+
if (touchEvt) {
|
512 |
+
if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
|
513 |
+
return;
|
514 |
+
}
|
515 |
+
|
516 |
+
this._lastX = touchEvt.clientX;
|
517 |
+
this._lastY = touchEvt.clientY;
|
518 |
+
|
519 |
+
if (!supportCssPointerEvents) {
|
520 |
+
_css(ghostEl, 'display', 'none');
|
521 |
+
}
|
522 |
+
|
523 |
+
var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
|
524 |
+
parent = target,
|
525 |
+
i = touchDragOverListeners.length;
|
526 |
+
|
527 |
+
if (parent) {
|
528 |
+
do {
|
529 |
+
if (parent[expando]) {
|
530 |
+
while (i--) {
|
531 |
+
touchDragOverListeners[i]({
|
532 |
+
clientX: touchEvt.clientX,
|
533 |
+
clientY: touchEvt.clientY,
|
534 |
+
target: target,
|
535 |
+
rootEl: parent
|
536 |
+
});
|
537 |
+
}
|
538 |
+
|
539 |
+
break;
|
540 |
+
}
|
541 |
+
|
542 |
+
target = parent; // store last element
|
543 |
+
}
|
544 |
+
/* jshint boss:true */
|
545 |
+
while (parent = parent.parentNode);
|
546 |
+
}
|
547 |
+
|
548 |
+
if (!supportCssPointerEvents) {
|
549 |
+
_css(ghostEl, 'display', '');
|
550 |
+
}
|
551 |
+
}
|
552 |
+
},
|
553 |
+
|
554 |
+
|
555 |
+
_onTouchMove: function (/**TouchEvent*/evt) {
|
556 |
+
if (tapEvt) {
|
557 |
+
var options = this.options,
|
558 |
+
fallbackTolerance = options.fallbackTolerance,
|
559 |
+
fallbackOffset = options.fallbackOffset,
|
560 |
+
touch = evt.touches ? evt.touches[0] : evt,
|
561 |
+
dx = (touch.clientX - tapEvt.clientX) + fallbackOffset.x,
|
562 |
+
dy = (touch.clientY - tapEvt.clientY) + fallbackOffset.y,
|
563 |
+
translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
|
564 |
+
|
565 |
+
// only set the status to dragging, when we are actually dragging
|
566 |
+
if (!Sortable.active) {
|
567 |
+
if (fallbackTolerance &&
|
568 |
+
min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance
|
569 |
+
) {
|
570 |
+
return;
|
571 |
+
}
|
572 |
+
|
573 |
+
this._dragStarted();
|
574 |
+
}
|
575 |
+
|
576 |
+
// as well as creating the ghost element on the document body
|
577 |
+
this._appendGhost();
|
578 |
+
|
579 |
+
moved = true;
|
580 |
+
touchEvt = touch;
|
581 |
+
|
582 |
+
_css(ghostEl, 'webkitTransform', translate3d);
|
583 |
+
_css(ghostEl, 'mozTransform', translate3d);
|
584 |
+
_css(ghostEl, 'msTransform', translate3d);
|
585 |
+
_css(ghostEl, 'transform', translate3d);
|
586 |
+
|
587 |
+
evt.preventDefault();
|
588 |
+
}
|
589 |
+
},
|
590 |
+
|
591 |
+
_appendGhost: function () {
|
592 |
+
if (!ghostEl) {
|
593 |
+
var rect = dragEl.getBoundingClientRect(),
|
594 |
+
css = _css(dragEl),
|
595 |
+
options = this.options,
|
596 |
+
ghostRect;
|
597 |
+
|
598 |
+
ghostEl = dragEl.cloneNode(true);
|
599 |
+
|
600 |
+
_toggleClass(ghostEl, options.ghostClass, false);
|
601 |
+
_toggleClass(ghostEl, options.fallbackClass, true);
|
602 |
+
_toggleClass(ghostEl, options.dragClass, true);
|
603 |
+
|
604 |
+
_css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
|
605 |
+
_css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
|
606 |
+
_css(ghostEl, 'width', rect.width);
|
607 |
+
_css(ghostEl, 'height', rect.height);
|
608 |
+
_css(ghostEl, 'opacity', '0.8');
|
609 |
+
_css(ghostEl, 'position', 'fixed');
|
610 |
+
_css(ghostEl, 'zIndex', '100000');
|
611 |
+
_css(ghostEl, 'pointerEvents', 'none');
|
612 |
+
|
613 |
+
options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
|
614 |
+
|
615 |
+
// Fixing dimensions.
|
616 |
+
ghostRect = ghostEl.getBoundingClientRect();
|
617 |
+
_css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
|
618 |
+
_css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
|
619 |
+
}
|
620 |
+
},
|
621 |
+
|
622 |
+
_onDragStart: function (/**Event*/evt, /**boolean*/useFallback) {
|
623 |
+
var dataTransfer = evt.dataTransfer,
|
624 |
+
options = this.options;
|
625 |
+
|
626 |
+
this._offUpEvents();
|
627 |
+
|
628 |
+
if (activeGroup.checkPull(this, this, dragEl, evt)) {
|
629 |
+
cloneEl = _clone(dragEl);
|
630 |
+
|
631 |
+
cloneEl.draggable = false;
|
632 |
+
cloneEl.style['will-change'] = '';
|
633 |
+
|
634 |
+
_css(cloneEl, 'display', 'none');
|
635 |
+
_toggleClass(cloneEl, this.options.chosenClass, false);
|
636 |
+
|
637 |
+
rootEl.insertBefore(cloneEl, dragEl);
|
638 |
+
_dispatchEvent(this, rootEl, 'clone', dragEl);
|
639 |
+
}
|
640 |
+
|
641 |
+
_toggleClass(dragEl, options.dragClass, true);
|
642 |
+
|
643 |
+
if (useFallback) {
|
644 |
+
if (useFallback === 'touch') {
|
645 |
+
// Bind touch events
|
646 |
+
_on(document, 'touchmove', this._onTouchMove);
|
647 |
+
_on(document, 'touchend', this._onDrop);
|
648 |
+
_on(document, 'touchcancel', this._onDrop);
|
649 |
+
_on(document, 'pointermove', this._onTouchMove);
|
650 |
+
_on(document, 'pointerup', this._onDrop);
|
651 |
+
} else {
|
652 |
+
// Old brwoser
|
653 |
+
_on(document, 'mousemove', this._onTouchMove);
|
654 |
+
_on(document, 'mouseup', this._onDrop);
|
655 |
+
}
|
656 |
+
|
657 |
+
this._loopId = setInterval(this._emulateDragOver, 50);
|
658 |
+
}
|
659 |
+
else {
|
660 |
+
if (dataTransfer) {
|
661 |
+
dataTransfer.effectAllowed = 'move';
|
662 |
+
options.setData && options.setData.call(this, dataTransfer, dragEl);
|
663 |
+
}
|
664 |
+
|
665 |
+
_on(document, 'drop', this);
|
666 |
+
setTimeout(this._dragStarted, 0);
|
667 |
+
}
|
668 |
+
},
|
669 |
+
|
670 |
+
_onDragOver: function (/**Event*/evt) {
|
671 |
+
var el = this.el,
|
672 |
+
target,
|
673 |
+
dragRect,
|
674 |
+
targetRect,
|
675 |
+
revert,
|
676 |
+
options = this.options,
|
677 |
+
group = options.group,
|
678 |
+
activeSortable = Sortable.active,
|
679 |
+
isOwner = (activeGroup === group),
|
680 |
+
isMovingBetweenSortable = false,
|
681 |
+
canSort = options.sort;
|
682 |
+
|
683 |
+
if (evt.preventDefault !== void 0) {
|
684 |
+
evt.preventDefault();
|
685 |
+
!options.dragoverBubble && evt.stopPropagation();
|
686 |
+
}
|
687 |
+
|
688 |
+
if (dragEl.animated) {
|
689 |
+
return;
|
690 |
+
}
|
691 |
+
|
692 |
+
moved = true;
|
693 |
+
|
694 |
+
if (activeSortable && !options.disabled &&
|
695 |
+
(isOwner
|
696 |
+
? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
|
697 |
+
: (
|
698 |
+
putSortable === this ||
|
699 |
+
(
|
700 |
+
(activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) &&
|
701 |
+
group.checkPut(this, activeSortable, dragEl, evt)
|
702 |
+
)
|
703 |
+
)
|
704 |
+
) &&
|
705 |
+
(evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
|
706 |
+
) {
|
707 |
+
// Smart auto-scrolling
|
708 |
+
_autoScroll(evt, options, this.el);
|
709 |
+
|
710 |
+
if (_silent) {
|
711 |
+
return;
|
712 |
+
}
|
713 |
+
|
714 |
+
target = _closest(evt.target, options.draggable, el);
|
715 |
+
dragRect = dragEl.getBoundingClientRect();
|
716 |
+
|
717 |
+
if (putSortable !== this) {
|
718 |
+
putSortable = this;
|
719 |
+
isMovingBetweenSortable = true;
|
720 |
+
}
|
721 |
+
|
722 |
+
if (revert) {
|
723 |
+
_cloneHide(activeSortable, true);
|
724 |
+
parentEl = rootEl; // actualization
|
725 |
+
|
726 |
+
if (cloneEl || nextEl) {
|
727 |
+
rootEl.insertBefore(dragEl, cloneEl || nextEl);
|
728 |
+
}
|
729 |
+
else if (!canSort) {
|
730 |
+
rootEl.appendChild(dragEl);
|
731 |
+
}
|
732 |
+
|
733 |
+
return;
|
734 |
+
}
|
735 |
+
|
736 |
+
|
737 |
+
if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
|
738 |
+
(el === evt.target) && (_ghostIsLast(el, evt))
|
739 |
+
) {
|
740 |
+
//assign target only if condition is true
|
741 |
+
if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
|
742 |
+
target = el.lastElementChild;
|
743 |
+
}
|
744 |
+
|
745 |
+
if (target) {
|
746 |
+
if (target.animated) {
|
747 |
+
return;
|
748 |
+
}
|
749 |
+
|
750 |
+
targetRect = target.getBoundingClientRect();
|
751 |
+
}
|
752 |
+
|
753 |
+
_cloneHide(activeSortable, isOwner);
|
754 |
+
|
755 |
+
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
|
756 |
+
if (!dragEl.contains(el)) {
|
757 |
+
el.appendChild(dragEl);
|
758 |
+
parentEl = el; // actualization
|
759 |
+
}
|
760 |
+
|
761 |
+
this._animate(dragRect, dragEl);
|
762 |
+
target && this._animate(targetRect, target);
|
763 |
+
}
|
764 |
+
}
|
765 |
+
else if (target && !target.animated && target !== dragEl && (target.parentNode[expando] !== void 0)) {
|
766 |
+
if (lastEl !== target) {
|
767 |
+
lastEl = target;
|
768 |
+
lastCSS = _css(target);
|
769 |
+
lastParentCSS = _css(target.parentNode);
|
770 |
+
}
|
771 |
+
|
772 |
+
targetRect = target.getBoundingClientRect();
|
773 |
+
|
774 |
+
var width = targetRect.right - targetRect.left,
|
775 |
+
height = targetRect.bottom - targetRect.top,
|
776 |
+
floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display)
|
777 |
+
|| (lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0),
|
778 |
+
isWide = (target.offsetWidth > dragEl.offsetWidth),
|
779 |
+
isLong = (target.offsetHeight > dragEl.offsetHeight),
|
780 |
+
halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
|
781 |
+
nextSibling = target.nextElementSibling,
|
782 |
+
after = false
|
783 |
+
;
|
784 |
+
|
785 |
+
if (floating) {
|
786 |
+
var elTop = dragEl.offsetTop,
|
787 |
+
tgTop = target.offsetTop;
|
788 |
+
|
789 |
+
if (elTop === tgTop) {
|
790 |
+
after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide;
|
791 |
+
}
|
792 |
+
else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
|
793 |
+
after = (evt.clientY - targetRect.top) / height > 0.5;
|
794 |
+
} else {
|
795 |
+
after = tgTop > elTop;
|
796 |
+
}
|
797 |
+
} else if (!isMovingBetweenSortable) {
|
798 |
+
after = (nextSibling !== dragEl) && !isLong || halfway && isLong;
|
799 |
+
}
|
800 |
+
|
801 |
+
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
|
802 |
+
|
803 |
+
if (moveVector !== false) {
|
804 |
+
if (moveVector === 1 || moveVector === -1) {
|
805 |
+
after = (moveVector === 1);
|
806 |
+
}
|
807 |
+
|
808 |
+
_silent = true;
|
809 |
+
setTimeout(_unsilent, 30);
|
810 |
+
|
811 |
+
_cloneHide(activeSortable, isOwner);
|
812 |
+
|
813 |
+
if (!dragEl.contains(el)) {
|
814 |
+
if (after && !nextSibling) {
|
815 |
+
el.appendChild(dragEl);
|
816 |
+
} else {
|
817 |
+
target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
|
818 |
+
}
|
819 |
+
}
|
820 |
+
|
821 |
+
parentEl = dragEl.parentNode; // actualization
|
822 |
+
|
823 |
+
this._animate(dragRect, dragEl);
|
824 |
+
this._animate(targetRect, target);
|
825 |
+
}
|
826 |
+
}
|
827 |
+
}
|
828 |
+
},
|
829 |
+
|
830 |
+
_animate: function (prevRect, target) {
|
831 |
+
var ms = this.options.animation;
|
832 |
+
|
833 |
+
if (ms) {
|
834 |
+
var currentRect = target.getBoundingClientRect();
|
835 |
+
|
836 |
+
if (prevRect.nodeType === 1) {
|
837 |
+
prevRect = prevRect.getBoundingClientRect();
|
838 |
+
}
|
839 |
+
|
840 |
+
_css(target, 'transition', 'none');
|
841 |
+
_css(target, 'transform', 'translate3d('
|
842 |
+
+ (prevRect.left - currentRect.left) + 'px,'
|
843 |
+
+ (prevRect.top - currentRect.top) + 'px,0)'
|
844 |
+
);
|
845 |
+
|
846 |
+
target.offsetWidth; // repaint
|
847 |
+
|
848 |
+
_css(target, 'transition', 'all ' + ms + 'ms');
|
849 |
+
_css(target, 'transform', 'translate3d(0,0,0)');
|
850 |
+
|
851 |
+
clearTimeout(target.animated);
|
852 |
+
target.animated = setTimeout(function () {
|
853 |
+
_css(target, 'transition', '');
|
854 |
+
_css(target, 'transform', '');
|
855 |
+
target.animated = false;
|
856 |
+
}, ms);
|
857 |
+
}
|
858 |
+
},
|
859 |
+
|
860 |
+
_offUpEvents: function () {
|
861 |
+
var ownerDocument = this.el.ownerDocument;
|
862 |
+
|
863 |
+
_off(document, 'touchmove', this._onTouchMove);
|
864 |
+
_off(document, 'pointermove', this._onTouchMove);
|
865 |
+
_off(ownerDocument, 'mouseup', this._onDrop);
|
866 |
+
_off(ownerDocument, 'touchend', this._onDrop);
|
867 |
+
_off(ownerDocument, 'pointerup', this._onDrop);
|
868 |
+
_off(ownerDocument, 'touchcancel', this._onDrop);
|
869 |
+
_off(ownerDocument, 'pointercancel', this._onDrop);
|
870 |
+
_off(ownerDocument, 'selectstart', this);
|
871 |
+
},
|
872 |
+
|
873 |
+
_onDrop: function (/**Event*/evt) {
|
874 |
+
var el = this.el,
|
875 |
+
options = this.options;
|
876 |
+
|
877 |
+
clearInterval(this._loopId);
|
878 |
+
clearInterval(autoScroll.pid);
|
879 |
+
clearTimeout(this._dragStartTimer);
|
880 |
+
|
881 |
+
// Unbind events
|
882 |
+
_off(document, 'mousemove', this._onTouchMove);
|
883 |
+
|
884 |
+
if (this.nativeDraggable) {
|
885 |
+
_off(document, 'drop', this);
|
886 |
+
_off(el, 'dragstart', this._onDragStart);
|
887 |
+
}
|
888 |
+
|
889 |
+
this._offUpEvents();
|
890 |
+
|
891 |
+
if (evt) {
|
892 |
+
if (moved) {
|
893 |
+
evt.preventDefault();
|
894 |
+
!options.dropBubble && evt.stopPropagation();
|
895 |
+
}
|
896 |
+
|
897 |
+
ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
|
898 |
+
|
899 |
+
if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
|
900 |
+
// Remove clone
|
901 |
+
cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
|
902 |
+
}
|
903 |
+
|
904 |
+
if (dragEl) {
|
905 |
+
if (this.nativeDraggable) {
|
906 |
+
_off(dragEl, 'dragend', this);
|
907 |
+
}
|
908 |
+
|
909 |
+
_disableDraggable(dragEl);
|
910 |
+
dragEl.style['will-change'] = '';
|
911 |
+
|
912 |
+
// Remove class's
|
913 |
+
_toggleClass(dragEl, this.options.ghostClass, false);
|
914 |
+
_toggleClass(dragEl, this.options.chosenClass, false);
|
915 |
+
|
916 |
+
// Drag stop event
|
917 |
+
_dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
|
918 |
+
|
919 |
+
if (rootEl !== parentEl) {
|
920 |
+
newIndex = _index(dragEl, options.draggable);
|
921 |
+
|
922 |
+
if (newIndex >= 0) {
|
923 |
+
// Add event
|
924 |
+
_dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
|
925 |
+
|
926 |
+
// Remove event
|
927 |
+
_dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
|
928 |
+
|
929 |
+
// drag from one list and drop into another
|
930 |
+
_dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
|
931 |
+
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
|
932 |
+
}
|
933 |
+
}
|
934 |
+
else {
|
935 |
+
if (dragEl.nextSibling !== nextEl) {
|
936 |
+
// Get the index of the dragged element within its parent
|
937 |
+
newIndex = _index(dragEl, options.draggable);
|
938 |
+
|
939 |
+
if (newIndex >= 0) {
|
940 |
+
// drag & drop within the same list
|
941 |
+
_dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
|
942 |
+
_dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
|
943 |
+
}
|
944 |
+
}
|
945 |
+
}
|
946 |
+
|
947 |
+
if (Sortable.active) {
|
948 |
+
/* jshint eqnull:true */
|
949 |
+
if (newIndex == null || newIndex === -1) {
|
950 |
+
newIndex = oldIndex;
|
951 |
+
}
|
952 |
+
|
953 |
+
_dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
|
954 |
+
|
955 |
+
// Save sorting
|
956 |
+
this.save();
|
957 |
+
}
|
958 |
+
}
|
959 |
+
|
960 |
+
}
|
961 |
+
|
962 |
+
this._nulling();
|
963 |
+
},
|
964 |
+
|
965 |
+
_nulling: function() {
|
966 |
+
rootEl =
|
967 |
+
dragEl =
|
968 |
+
parentEl =
|
969 |
+
ghostEl =
|
970 |
+
nextEl =
|
971 |
+
cloneEl =
|
972 |
+
lastDownEl =
|
973 |
+
|
974 |
+
scrollEl =
|
975 |
+
scrollParentEl =
|
976 |
+
|
977 |
+
tapEvt =
|
978 |
+
touchEvt =
|
979 |
+
|
980 |
+
moved =
|
981 |
+
newIndex =
|
982 |
+
|
983 |
+
lastEl =
|
984 |
+
lastCSS =
|
985 |
+
|
986 |
+
putSortable =
|
987 |
+
activeGroup =
|
988 |
+
Sortable.active = null;
|
989 |
+
|
990 |
+
savedInputChecked.forEach(function (el) {
|
991 |
+
el.checked = true;
|
992 |
+
});
|
993 |
+
savedInputChecked.length = 0;
|
994 |
+
},
|
995 |
+
|
996 |
+
handleEvent: function (/**Event*/evt) {
|
997 |
+
switch (evt.type) {
|
998 |
+
case 'drop':
|
999 |
+
case 'dragend':
|
1000 |
+
this._onDrop(evt);
|
1001 |
+
break;
|
1002 |
+
|
1003 |
+
case 'dragover':
|
1004 |
+
case 'dragenter':
|
1005 |
+
if (dragEl) {
|
1006 |
+
this._onDragOver(evt);
|
1007 |
+
_globalDragOver(evt);
|
1008 |
+
}
|
1009 |
+
break;
|
1010 |
+
|
1011 |
+
case 'selectstart':
|
1012 |
+
evt.preventDefault();
|
1013 |
+
break;
|
1014 |
+
}
|
1015 |
+
},
|
1016 |
+
|
1017 |
+
|
1018 |
+
/**
|
1019 |
+
* Serializes the item into an array of string.
|
1020 |
+
* @returns {String[]}
|
1021 |
+
*/
|
1022 |
+
toArray: function () {
|
1023 |
+
var order = [],
|
1024 |
+
el,
|
1025 |
+
children = this.el.children,
|
1026 |
+
i = 0,
|
1027 |
+
n = children.length,
|
1028 |
+
options = this.options;
|
1029 |
+
|
1030 |
+
for (; i < n; i++) {
|
1031 |
+
el = children[i];
|
1032 |
+
if (_closest(el, options.draggable, this.el)) {
|
1033 |
+
order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
|
1034 |
+
}
|
1035 |
+
}
|
1036 |
+
|
1037 |
+
return order;
|
1038 |
+
},
|
1039 |
+
|
1040 |
+
|
1041 |
+
/**
|
1042 |
+
* Sorts the elements according to the array.
|
1043 |
+
* @param {String[]} order order of the items
|
1044 |
+
*/
|
1045 |
+
sort: function (order) {
|
1046 |
+
var items = {}, rootEl = this.el;
|
1047 |
+
|
1048 |
+
this.toArray().forEach(function (id, i) {
|
1049 |
+
var el = rootEl.children[i];
|
1050 |
+
|
1051 |
+
if (_closest(el, this.options.draggable, rootEl)) {
|
1052 |
+
items[id] = el;
|
1053 |
+
}
|
1054 |
+
}, this);
|
1055 |
+
|
1056 |
+
order.forEach(function (id) {
|
1057 |
+
if (items[id]) {
|
1058 |
+
rootEl.removeChild(items[id]);
|
1059 |
+
rootEl.appendChild(items[id]);
|
1060 |
+
}
|
1061 |
+
});
|
1062 |
+
},
|
1063 |
+
|
1064 |
+
|
1065 |
+
/**
|
1066 |
+
* Save the current sorting
|
1067 |
+
*/
|
1068 |
+
save: function () {
|
1069 |
+
var store = this.options.store;
|
1070 |
+
store && store.set(this);
|
1071 |
+
},
|
1072 |
+
|
1073 |
+
|
1074 |
+
/**
|
1075 |
+
* For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
|
1076 |
+
* @param {HTMLElement} el
|
1077 |
+
* @param {String} [selector] default: `options.draggable`
|
1078 |
+
* @returns {HTMLElement|null}
|
1079 |
+
*/
|
1080 |
+
closest: function (el, selector) {
|
1081 |
+
return _closest(el, selector || this.options.draggable, this.el);
|
1082 |
+
},
|
1083 |
+
|
1084 |
+
|
1085 |
+
/**
|
1086 |
+
* Set/get option
|
1087 |
+
* @param {string} name
|
1088 |
+
* @param {*} [value]
|
1089 |
+
* @returns {*}
|
1090 |
+
*/
|
1091 |
+
option: function (name, value) {
|
1092 |
+
var options = this.options;
|
1093 |
+
|
1094 |
+
if (value === void 0) {
|
1095 |
+
return options[name];
|
1096 |
+
} else {
|
1097 |
+
options[name] = value;
|
1098 |
+
|
1099 |
+
if (name === 'group') {
|
1100 |
+
_prepareGroup(options);
|
1101 |
+
}
|
1102 |
+
}
|
1103 |
+
},
|
1104 |
+
|
1105 |
+
|
1106 |
+
/**
|
1107 |
+
* Destroy
|
1108 |
+
*/
|
1109 |
+
destroy: function () {
|
1110 |
+
var el = this.el;
|
1111 |
+
|
1112 |
+
el[expando] = null;
|
1113 |
+
|
1114 |
+
_off(el, 'mousedown', this._onTapStart);
|
1115 |
+
_off(el, 'touchstart', this._onTapStart);
|
1116 |
+
_off(el, 'pointerdown', this._onTapStart);
|
1117 |
+
|
1118 |
+
if (this.nativeDraggable) {
|
1119 |
+
_off(el, 'dragover', this);
|
1120 |
+
_off(el, 'dragenter', this);
|
1121 |
+
}
|
1122 |
+
|
1123 |
+
// Remove draggable attributes
|
1124 |
+
Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
|
1125 |
+
el.removeAttribute('draggable');
|
1126 |
+
});
|
1127 |
+
|
1128 |
+
touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
|
1129 |
+
|
1130 |
+
this._onDrop();
|
1131 |
+
|
1132 |
+
this.el = el = null;
|
1133 |
+
}
|
1134 |
+
};
|
1135 |
+
|
1136 |
+
|
1137 |
+
function _cloneHide(sortable, state) {
|
1138 |
+
if (sortable.lastPullMode !== 'clone') {
|
1139 |
+
state = true;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
if (cloneEl && (cloneEl.state !== state)) {
|
1143 |
+
_css(cloneEl, 'display', state ? 'none' : '');
|
1144 |
+
|
1145 |
+
if (!state) {
|
1146 |
+
if (cloneEl.state) {
|
1147 |
+
if (sortable.options.group.revertClone) {
|
1148 |
+
rootEl.insertBefore(cloneEl, nextEl);
|
1149 |
+
sortable._animate(dragEl, cloneEl);
|
1150 |
+
} else {
|
1151 |
+
rootEl.insertBefore(cloneEl, dragEl);
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
cloneEl.state = state;
|
1157 |
+
}
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
|
1161 |
+
function _closest(/**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
|
1162 |
+
if (el) {
|
1163 |
+
ctx = ctx || document;
|
1164 |
+
|
1165 |
+
do {
|
1166 |
+
if ((selector === '>*' && el.parentNode === ctx) || _matches(el, selector)) {
|
1167 |
+
return el;
|
1168 |
+
}
|
1169 |
+
/* jshint boss:true */
|
1170 |
+
} while (el = _getParentOrHost(el));
|
1171 |
+
}
|
1172 |
+
|
1173 |
+
return null;
|
1174 |
+
}
|
1175 |
+
|
1176 |
+
|
1177 |
+
function _getParentOrHost(el) {
|
1178 |
+
var parent = el.host;
|
1179 |
+
|
1180 |
+
return (parent && parent.nodeType) ? parent : el.parentNode;
|
1181 |
+
}
|
1182 |
+
|
1183 |
+
|
1184 |
+
function _globalDragOver(/**Event*/evt) {
|
1185 |
+
if (evt.dataTransfer) {
|
1186 |
+
evt.dataTransfer.dropEffect = 'move';
|
1187 |
+
}
|
1188 |
+
evt.preventDefault();
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
|
1192 |
+
function _on(el, event, fn) {
|
1193 |
+
el.addEventListener(event, fn, captureMode);
|
1194 |
+
}
|
1195 |
+
|
1196 |
+
|
1197 |
+
function _off(el, event, fn) {
|
1198 |
+
el.removeEventListener(event, fn, captureMode);
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
|
1202 |
+
function _toggleClass(el, name, state) {
|
1203 |
+
if (el) {
|
1204 |
+
if (el.classList) {
|
1205 |
+
el.classList[state ? 'add' : 'remove'](name);
|
1206 |
+
}
|
1207 |
+
else {
|
1208 |
+
var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
|
1209 |
+
el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
|
1210 |
+
}
|
1211 |
+
}
|
1212 |
+
}
|
1213 |
+
|
1214 |
+
|
1215 |
+
function _css(el, prop, val) {
|
1216 |
+
var style = el && el.style;
|
1217 |
+
|
1218 |
+
if (style) {
|
1219 |
+
if (val === void 0) {
|
1220 |
+
if (document.defaultView && document.defaultView.getComputedStyle) {
|
1221 |
+
val = document.defaultView.getComputedStyle(el, '');
|
1222 |
+
}
|
1223 |
+
else if (el.currentStyle) {
|
1224 |
+
val = el.currentStyle;
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
return prop === void 0 ? val : val[prop];
|
1228 |
+
}
|
1229 |
+
else {
|
1230 |
+
if (!(prop in style)) {
|
1231 |
+
prop = '-webkit-' + prop;
|
1232 |
+
}
|
1233 |
+
|
1234 |
+
style[prop] = val + (typeof val === 'string' ? '' : 'px');
|
1235 |
+
}
|
1236 |
+
}
|
1237 |
+
}
|
1238 |
+
|
1239 |
+
|
1240 |
+
function _find(ctx, tagName, iterator) {
|
1241 |
+
if (ctx) {
|
1242 |
+
var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length;
|
1243 |
+
|
1244 |
+
if (iterator) {
|
1245 |
+
for (; i < n; i++) {
|
1246 |
+
iterator(list[i], i);
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
return list;
|
1251 |
+
}
|
1252 |
+
|
1253 |
+
return [];
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
|
1257 |
+
|
1258 |
+
function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
|
1259 |
+
sortable = (sortable || rootEl[expando]);
|
1260 |
+
|
1261 |
+
var evt = document.createEvent('Event'),
|
1262 |
+
options = sortable.options,
|
1263 |
+
onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
|
1264 |
+
|
1265 |
+
evt.initEvent(name, true, true);
|
1266 |
+
|
1267 |
+
evt.to = rootEl;
|
1268 |
+
evt.from = fromEl || rootEl;
|
1269 |
+
evt.item = targetEl || rootEl;
|
1270 |
+
evt.clone = cloneEl;
|
1271 |
+
|
1272 |
+
evt.oldIndex = startIndex;
|
1273 |
+
evt.newIndex = newIndex;
|
1274 |
+
|
1275 |
+
rootEl.dispatchEvent(evt);
|
1276 |
+
|
1277 |
+
if (options[onName]) {
|
1278 |
+
options[onName].call(sortable, evt);
|
1279 |
+
}
|
1280 |
+
}
|
1281 |
+
|
1282 |
+
|
1283 |
+
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
|
1284 |
+
var evt,
|
1285 |
+
sortable = fromEl[expando],
|
1286 |
+
onMoveFn = sortable.options.onMove,
|
1287 |
+
retVal;
|
1288 |
+
|
1289 |
+
evt = document.createEvent('Event');
|
1290 |
+
evt.initEvent('move', true, true);
|
1291 |
+
|
1292 |
+
evt.to = toEl;
|
1293 |
+
evt.from = fromEl;
|
1294 |
+
evt.dragged = dragEl;
|
1295 |
+
evt.draggedRect = dragRect;
|
1296 |
+
evt.related = targetEl || toEl;
|
1297 |
+
evt.relatedRect = targetRect || toEl.getBoundingClientRect();
|
1298 |
+
evt.willInsertAfter = willInsertAfter;
|
1299 |
+
|
1300 |
+
fromEl.dispatchEvent(evt);
|
1301 |
+
|
1302 |
+
if (onMoveFn) {
|
1303 |
+
retVal = onMoveFn.call(sortable, evt, originalEvt);
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
return retVal;
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
|
1310 |
+
function _disableDraggable(el) {
|
1311 |
+
el.draggable = false;
|
1312 |
+
}
|
1313 |
+
|
1314 |
+
|
1315 |
+
function _unsilent() {
|
1316 |
+
_silent = false;
|
1317 |
+
}
|
1318 |
+
|
1319 |
+
|
1320 |
+
/** @returns {HTMLElement|false} */
|
1321 |
+
function _ghostIsLast(el, evt) {
|
1322 |
+
var lastEl = el.lastElementChild,
|
1323 |
+
rect = lastEl.getBoundingClientRect();
|
1324 |
+
|
1325 |
+
// 5 — min delta
|
1326 |
+
// abs — нельзя добавлять, а то глюки при наведении сверху
|
1327 |
+
return (evt.clientY - (rect.top + rect.height) > 5) ||
|
1328 |
+
(evt.clientX - (rect.left + rect.width) > 5);
|
1329 |
+
}
|
1330 |
+
|
1331 |
+
|
1332 |
+
/**
|
1333 |
+
* Generate id
|
1334 |
+
* @param {HTMLElement} el
|
1335 |
+
* @returns {String}
|
1336 |
+
* @private
|
1337 |
+
*/
|
1338 |
+
function _generateId(el) {
|
1339 |
+
var str = el.tagName + el.className + el.src + el.href + el.textContent,
|
1340 |
+
i = str.length,
|
1341 |
+
sum = 0;
|
1342 |
+
|
1343 |
+
while (i--) {
|
1344 |
+
sum += str.charCodeAt(i);
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
return sum.toString(36);
|
1348 |
+
}
|
1349 |
+
|
1350 |
+
/**
|
1351 |
+
* Returns the index of an element within its parent for a selected set of
|
1352 |
+
* elements
|
1353 |
+
* @param {HTMLElement} el
|
1354 |
+
* @param {selector} selector
|
1355 |
+
* @return {number}
|
1356 |
+
*/
|
1357 |
+
function _index(el, selector) {
|
1358 |
+
var index = 0;
|
1359 |
+
|
1360 |
+
if (!el || !el.parentNode) {
|
1361 |
+
return -1;
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
while (el && (el = el.previousElementSibling)) {
|
1365 |
+
if ((el.nodeName.toUpperCase() !== 'TEMPLATE') && (selector === '>*' || _matches(el, selector))) {
|
1366 |
+
index++;
|
1367 |
+
}
|
1368 |
+
}
|
1369 |
+
|
1370 |
+
return index;
|
1371 |
+
}
|
1372 |
+
|
1373 |
+
function _matches(/**HTMLElement*/el, /**String*/selector) {
|
1374 |
+
if (el) {
|
1375 |
+
selector = selector.split('.');
|
1376 |
+
|
1377 |
+
var tag = selector.shift().toUpperCase(),
|
1378 |
+
re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
|
1379 |
+
|
1380 |
+
return (
|
1381 |
+
(tag === '' || el.nodeName.toUpperCase() == tag) &&
|
1382 |
+
(!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length)
|
1383 |
+
);
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
return false;
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
function _throttle(callback, ms) {
|
1390 |
+
var args, _this;
|
1391 |
+
|
1392 |
+
return function () {
|
1393 |
+
if (args === void 0) {
|
1394 |
+
args = arguments;
|
1395 |
+
_this = this;
|
1396 |
+
|
1397 |
+
setTimeout(function () {
|
1398 |
+
if (args.length === 1) {
|
1399 |
+
callback.call(_this, args[0]);
|
1400 |
+
} else {
|
1401 |
+
callback.apply(_this, args);
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
args = void 0;
|
1405 |
+
}, ms);
|
1406 |
+
}
|
1407 |
+
};
|
1408 |
+
}
|
1409 |
+
|
1410 |
+
function _extend(dst, src) {
|
1411 |
+
if (dst && src) {
|
1412 |
+
for (var key in src) {
|
1413 |
+
if (src.hasOwnProperty(key)) {
|
1414 |
+
dst[key] = src[key];
|
1415 |
+
}
|
1416 |
+
}
|
1417 |
+
}
|
1418 |
+
|
1419 |
+
return dst;
|
1420 |
+
}
|
1421 |
+
|
1422 |
+
function _clone(el) {
|
1423 |
+
return $
|
1424 |
+
? $(el).clone(true)[0]
|
1425 |
+
: (Polymer && Polymer.dom
|
1426 |
+
? Polymer.dom(el).cloneNode(true)
|
1427 |
+
: el.cloneNode(true)
|
1428 |
+
);
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
function _saveInputCheckedState(root) {
|
1432 |
+
var inputs = root.getElementsByTagName('input');
|
1433 |
+
var idx = inputs.length;
|
1434 |
+
|
1435 |
+
while (idx--) {
|
1436 |
+
var el = inputs[idx];
|
1437 |
+
el.checked && savedInputChecked.push(el);
|
1438 |
+
}
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
// Fixed #973:
|
1442 |
+
_on(document, 'touchmove', function (evt) {
|
1443 |
+
if (Sortable.active) {
|
1444 |
+
evt.preventDefault();
|
1445 |
+
}
|
1446 |
+
});
|
1447 |
+
|
1448 |
+
try {
|
1449 |
+
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
|
1450 |
+
get: function () {
|
1451 |
+
captureMode = {
|
1452 |
+
capture: false,
|
1453 |
+
passive: false
|
1454 |
+
};
|
1455 |
+
}
|
1456 |
+
}));
|
1457 |
+
} catch (err) {}
|
1458 |
+
|
1459 |
+
// Export utils
|
1460 |
+
Sortable.utils = {
|
1461 |
+
on: _on,
|
1462 |
+
off: _off,
|
1463 |
+
css: _css,
|
1464 |
+
find: _find,
|
1465 |
+
is: function (el, selector) {
|
1466 |
+
return !!_closest(el, selector, el);
|
1467 |
+
},
|
1468 |
+
extend: _extend,
|
1469 |
+
throttle: _throttle,
|
1470 |
+
closest: _closest,
|
1471 |
+
toggleClass: _toggleClass,
|
1472 |
+
clone: _clone,
|
1473 |
+
index: _index
|
1474 |
+
};
|
1475 |
+
|
1476 |
+
|
1477 |
+
/**
|
1478 |
+
* Create sortable instance
|
1479 |
+
* @param {HTMLElement} el
|
1480 |
+
* @param {Object} [options]
|
1481 |
+
*/
|
1482 |
+
Sortable.create = function (el, options) {
|
1483 |
+
return new Sortable(el, options);
|
1484 |
+
};
|
1485 |
+
|
1486 |
+
|
1487 |
+
// Export
|
1488 |
+
Sortable.version = '1.6.0';
|
1489 |
+
return Sortable;
|
1490 |
+
});
|
assets/js/vendor/vue-resource.js
ADDED
@@ -0,0 +1,1574 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* vue-resource v1.3.4
|
3 |
+
* https://github.com/pagekit/vue-resource
|
4 |
+
* Released under the MIT License.
|
5 |
+
*/
|
6 |
+
|
7 |
+
(function (global, factory) {
|
8 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
9 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
10 |
+
(global.VueResource = factory());
|
11 |
+
}(this, (function () { 'use strict';
|
12 |
+
|
13 |
+
/**
|
14 |
+
* Promises/A+ polyfill v1.1.4 (https://github.com/bramstein/promis)
|
15 |
+
*/
|
16 |
+
|
17 |
+
var RESOLVED = 0;
|
18 |
+
var REJECTED = 1;
|
19 |
+
var PENDING = 2;
|
20 |
+
|
21 |
+
function Promise$1(executor) {
|
22 |
+
|
23 |
+
this.state = PENDING;
|
24 |
+
this.value = undefined;
|
25 |
+
this.deferred = [];
|
26 |
+
|
27 |
+
var promise = this;
|
28 |
+
|
29 |
+
try {
|
30 |
+
executor(function (x) {
|
31 |
+
promise.resolve(x);
|
32 |
+
}, function (r) {
|
33 |
+
promise.reject(r);
|
34 |
+
});
|
35 |
+
} catch (e) {
|
36 |
+
promise.reject(e);
|
37 |
+
}
|
38 |
+
}
|
39 |
+
|
40 |
+
Promise$1.reject = function (r) {
|
41 |
+
return new Promise$1(function (resolve, reject) {
|
42 |
+
reject(r);
|
43 |
+
});
|
44 |
+
};
|
45 |
+
|
46 |
+
Promise$1.resolve = function (x) {
|
47 |
+
return new Promise$1(function (resolve, reject) {
|
48 |
+
resolve(x);
|
49 |
+
});
|
50 |
+
};
|
51 |
+
|
52 |
+
Promise$1.all = function all(iterable) {
|
53 |
+
return new Promise$1(function (resolve, reject) {
|
54 |
+
var count = 0, result = [];
|
55 |
+
|
56 |
+
if (iterable.length === 0) {
|
57 |
+
resolve(result);
|
58 |
+
}
|
59 |
+
|
60 |
+
function resolver(i) {
|
61 |
+
return function (x) {
|
62 |
+
result[i] = x;
|
63 |
+
count += 1;
|
64 |
+
|
65 |
+
if (count === iterable.length) {
|
66 |
+
resolve(result);
|
67 |
+
}
|
68 |
+
};
|
69 |
+
}
|
70 |
+
|
71 |
+
for (var i = 0; i < iterable.length; i += 1) {
|
72 |
+
Promise$1.resolve(iterable[i]).then(resolver(i), reject);
|
73 |
+
}
|
74 |
+
});
|
75 |
+
};
|
76 |
+
|
77 |
+
Promise$1.race = function race(iterable) {
|
78 |
+
return new Promise$1(function (resolve, reject) {
|
79 |
+
for (var i = 0; i < iterable.length; i += 1) {
|
80 |
+
Promise$1.resolve(iterable[i]).then(resolve, reject);
|
81 |
+
}
|
82 |
+
});
|
83 |
+
};
|
84 |
+
|
85 |
+
var p$1 = Promise$1.prototype;
|
86 |
+
|
87 |
+
p$1.resolve = function resolve(x) {
|
88 |
+
var promise = this;
|
89 |
+
|
90 |
+
if (promise.state === PENDING) {
|
91 |
+
if (x === promise) {
|
92 |
+
throw new TypeError('Promise settled with itself.');
|
93 |
+
}
|
94 |
+
|
95 |
+
var called = false;
|
96 |
+
|
97 |
+
try {
|
98 |
+
var then = x && x['then'];
|
99 |
+
|
100 |
+
if (x !== null && typeof x === 'object' && typeof then === 'function') {
|
101 |
+
then.call(x, function (x) {
|
102 |
+
if (!called) {
|
103 |
+
promise.resolve(x);
|
104 |
+
}
|
105 |
+
called = true;
|
106 |
+
|
107 |
+
}, function (r) {
|
108 |
+
if (!called) {
|
109 |
+
promise.reject(r);
|
110 |
+
}
|
111 |
+
called = true;
|
112 |
+
});
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
} catch (e) {
|
116 |
+
if (!called) {
|
117 |
+
promise.reject(e);
|
118 |
+
}
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
|
122 |
+
promise.state = RESOLVED;
|
123 |
+
promise.value = x;
|
124 |
+
promise.notify();
|
125 |
+
}
|
126 |
+
};
|
127 |
+
|
128 |
+
p$1.reject = function reject(reason) {
|
129 |
+
var promise = this;
|
130 |
+
|
131 |
+
if (promise.state === PENDING) {
|
132 |
+
if (reason === promise) {
|
133 |
+
throw new TypeError('Promise settled with itself.');
|
134 |
+
}
|
135 |
+
|
136 |
+
promise.state = REJECTED;
|
137 |
+
promise.value = reason;
|
138 |
+
promise.notify();
|
139 |
+
}
|
140 |
+
};
|
141 |
+
|
142 |
+
p$1.notify = function notify() {
|
143 |
+
var promise = this;
|
144 |
+
|
145 |
+
nextTick(function () {
|
146 |
+
if (promise.state !== PENDING) {
|
147 |
+
while (promise.deferred.length) {
|
148 |
+
var deferred = promise.deferred.shift(),
|
149 |
+
onResolved = deferred[0],
|
150 |
+
onRejected = deferred[1],
|
151 |
+
resolve = deferred[2],
|
152 |
+
reject = deferred[3];
|
153 |
+
|
154 |
+
try {
|
155 |
+
if (promise.state === RESOLVED) {
|
156 |
+
if (typeof onResolved === 'function') {
|
157 |
+
resolve(onResolved.call(undefined, promise.value));
|
158 |
+
} else {
|
159 |
+
resolve(promise.value);
|
160 |
+
}
|
161 |
+
} else if (promise.state === REJECTED) {
|
162 |
+
if (typeof onRejected === 'function') {
|
163 |
+
resolve(onRejected.call(undefined, promise.value));
|
164 |
+
} else {
|
165 |
+
reject(promise.value);
|
166 |
+
}
|
167 |
+
}
|
168 |
+
} catch (e) {
|
169 |
+
reject(e);
|
170 |
+
}
|
171 |
+
}
|
172 |
+
}
|
173 |
+
});
|
174 |
+
};
|
175 |
+
|
176 |
+
p$1.then = function then(onResolved, onRejected) {
|
177 |
+
var promise = this;
|
178 |
+
|
179 |
+
return new Promise$1(function (resolve, reject) {
|
180 |
+
promise.deferred.push([onResolved, onRejected, resolve, reject]);
|
181 |
+
promise.notify();
|
182 |
+
});
|
183 |
+
};
|
184 |
+
|
185 |
+
p$1.catch = function (onRejected) {
|
186 |
+
return this.then(undefined, onRejected);
|
187 |
+
};
|
188 |
+
|
189 |
+
/**
|
190 |
+
* Promise adapter.
|
191 |
+
*/
|
192 |
+
|
193 |
+
if (typeof Promise === 'undefined') {
|
194 |
+
window.Promise = Promise$1;
|
195 |
+
}
|
196 |
+
|
197 |
+
function PromiseObj(executor, context) {
|
198 |
+
|
199 |
+
if (executor instanceof Promise) {
|
200 |
+
this.promise = executor;
|
201 |
+
} else {
|
202 |
+
this.promise = new Promise(executor.bind(context));
|
203 |
+
}
|
204 |
+
|
205 |
+
this.context = context;
|
206 |
+
}
|
207 |
+
|
208 |
+
PromiseObj.all = function (iterable, context) {
|
209 |
+
return new PromiseObj(Promise.all(iterable), context);
|
210 |
+
};
|
211 |
+
|
212 |
+
PromiseObj.resolve = function (value, context) {
|
213 |
+
return new PromiseObj(Promise.resolve(value), context);
|
214 |
+
};
|
215 |
+
|
216 |
+
PromiseObj.reject = function (reason, context) {
|
217 |
+
return new PromiseObj(Promise.reject(reason), context);
|
218 |
+
};
|
219 |
+
|
220 |
+
PromiseObj.race = function (iterable, context) {
|
221 |
+
return new PromiseObj(Promise.race(iterable), context);
|
222 |
+
};
|
223 |
+
|
224 |
+
var p = PromiseObj.prototype;
|
225 |
+
|
226 |
+
p.bind = function (context) {
|
227 |
+
this.context = context;
|
228 |
+
return this;
|
229 |
+
};
|
230 |
+
|
231 |
+
p.then = function (fulfilled, rejected) {
|
232 |
+
|
233 |
+
if (fulfilled && fulfilled.bind && this.context) {
|
234 |
+
fulfilled = fulfilled.bind(this.context);
|
235 |
+
}
|
236 |
+
|
237 |
+
if (rejected && rejected.bind && this.context) {
|
238 |
+
rejected = rejected.bind(this.context);
|
239 |
+
}
|
240 |
+
|
241 |
+
return new PromiseObj(this.promise.then(fulfilled, rejected), this.context);
|
242 |
+
};
|
243 |
+
|
244 |
+
p.catch = function (rejected) {
|
245 |
+
|
246 |
+
if (rejected && rejected.bind && this.context) {
|
247 |
+
rejected = rejected.bind(this.context);
|
248 |
+
}
|
249 |
+
|
250 |
+
return new PromiseObj(this.promise.catch(rejected), this.context);
|
251 |
+
};
|
252 |
+
|
253 |
+
p.finally = function (callback) {
|
254 |
+
|
255 |
+
return this.then(function (value) {
|
256 |
+
callback.call(this);
|
257 |
+
return value;
|
258 |
+
}, function (reason) {
|
259 |
+
callback.call(this);
|
260 |
+
return Promise.reject(reason);
|
261 |
+
}
|
262 |
+
);
|
263 |
+
};
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Utility functions.
|
267 |
+
*/
|
268 |
+
|
269 |
+
var ref = {};
|
270 |
+
var hasOwnProperty = ref.hasOwnProperty;
|
271 |
+
|
272 |
+
var ref$1 = [];
|
273 |
+
var slice = ref$1.slice;
|
274 |
+
var debug = false;
|
275 |
+
var ntick;
|
276 |
+
|
277 |
+
var inBrowser = typeof window !== 'undefined';
|
278 |
+
|
279 |
+
var Util = function (ref) {
|
280 |
+
var config = ref.config;
|
281 |
+
var nextTick = ref.nextTick;
|
282 |
+
|
283 |
+
ntick = nextTick;
|
284 |
+
debug = config.debug || !config.silent;
|
285 |
+
};
|
286 |
+
|
287 |
+
function warn(msg) {
|
288 |
+
if (typeof console !== 'undefined' && debug) {
|
289 |
+
console.warn('[VueResource warn]: ' + msg);
|
290 |
+
}
|
291 |
+
}
|
292 |
+
|
293 |
+
function error(msg) {
|
294 |
+
if (typeof console !== 'undefined') {
|
295 |
+
console.error(msg);
|
296 |
+
}
|
297 |
+
}
|
298 |
+
|
299 |
+
function nextTick(cb, ctx) {
|
300 |
+
return ntick(cb, ctx);
|
301 |
+
}
|
302 |
+
|
303 |
+
function trim(str) {
|
304 |
+
return str ? str.replace(/^\s*|\s*$/g, '') : '';
|
305 |
+
}
|
306 |
+
|
307 |
+
function trimEnd(str, chars) {
|
308 |
+
|
309 |
+
if (str && chars === undefined) {
|
310 |
+
return str.replace(/\s+$/, '');
|
311 |
+
}
|
312 |
+
|
313 |
+
if (!str || !chars) {
|
314 |
+
return str;
|
315 |
+
}
|
316 |
+
|
317 |
+
return str.replace(new RegExp(("[" + chars + "]+$")), '');
|
318 |
+
}
|
319 |
+
|
320 |
+
function toLower(str) {
|
321 |
+
return str ? str.toLowerCase() : '';
|
322 |
+
}
|
323 |
+
|
324 |
+
function toUpper(str) {
|
325 |
+
return str ? str.toUpperCase() : '';
|
326 |
+
}
|
327 |
+
|
328 |
+
var isArray = Array.isArray;
|
329 |
+
|
330 |
+
function isString(val) {
|
331 |
+
return typeof val === 'string';
|
332 |
+
}
|
333 |
+
|
334 |
+
|
335 |
+
|
336 |
+
function isFunction(val) {
|
337 |
+
return typeof val === 'function';
|
338 |
+
}
|
339 |
+
|
340 |
+
function isObject(obj) {
|
341 |
+
return obj !== null && typeof obj === 'object';
|
342 |
+
}
|
343 |
+
|
344 |
+
function isPlainObject(obj) {
|
345 |
+
return isObject(obj) && Object.getPrototypeOf(obj) == Object.prototype;
|
346 |
+
}
|
347 |
+
|
348 |
+
function isBlob(obj) {
|
349 |
+
return typeof Blob !== 'undefined' && obj instanceof Blob;
|
350 |
+
}
|
351 |
+
|
352 |
+
function isFormData(obj) {
|
353 |
+
return typeof FormData !== 'undefined' && obj instanceof FormData;
|
354 |
+
}
|
355 |
+
|
356 |
+
function when(value, fulfilled, rejected) {
|
357 |
+
|
358 |
+
var promise = PromiseObj.resolve(value);
|
359 |
+
|
360 |
+
if (arguments.length < 2) {
|
361 |
+
return promise;
|
362 |
+
}
|
363 |
+
|
364 |
+
return promise.then(fulfilled, rejected);
|
365 |
+
}
|
366 |
+
|
367 |
+
function options(fn, obj, opts) {
|
368 |
+
|
369 |
+
opts = opts || {};
|
370 |
+
|
371 |
+
if (isFunction(opts)) {
|
372 |
+
opts = opts.call(obj);
|
373 |
+
}
|
374 |
+
|
375 |
+
return merge(fn.bind({$vm: obj, $options: opts}), fn, {$options: opts});
|
376 |
+
}
|
377 |
+
|
378 |
+
function each(obj, iterator) {
|
379 |
+
|
380 |
+
var i, key;
|
381 |
+
|
382 |
+
if (isArray(obj)) {
|
383 |
+
for (i = 0; i < obj.length; i++) {
|
384 |
+
iterator.call(obj[i], obj[i], i);
|
385 |
+
}
|
386 |
+
} else if (isObject(obj)) {
|
387 |
+
for (key in obj) {
|
388 |
+
if (hasOwnProperty.call(obj, key)) {
|
389 |
+
iterator.call(obj[key], obj[key], key);
|
390 |
+
}
|
391 |
+
}
|
392 |
+
}
|
393 |
+
|
394 |
+
return obj;
|
395 |
+
}
|
396 |
+
|
397 |
+
var assign = Object.assign || _assign;
|
398 |
+
|
399 |
+
function merge(target) {
|
400 |
+
|
401 |
+
var args = slice.call(arguments, 1);
|
402 |
+
|
403 |
+
args.forEach(function (source) {
|
404 |
+
_merge(target, source, true);
|
405 |
+
});
|
406 |
+
|
407 |
+
return target;
|
408 |
+
}
|
409 |
+
|
410 |
+
function defaults(target) {
|
411 |
+
|
412 |
+
var args = slice.call(arguments, 1);
|
413 |
+
|
414 |
+
args.forEach(function (source) {
|
415 |
+
|
416 |
+
for (var key in source) {
|
417 |
+
if (target[key] === undefined) {
|
418 |
+
target[key] = source[key];
|
419 |
+
}
|
420 |
+
}
|
421 |
+
|
422 |
+
});
|
423 |
+
|
424 |
+
return target;
|
425 |
+
}
|
426 |
+
|
427 |
+
function _assign(target) {
|
428 |
+
|
429 |
+
var args = slice.call(arguments, 1);
|
430 |
+
|
431 |
+
args.forEach(function (source) {
|
432 |
+
_merge(target, source);
|
433 |
+
});
|
434 |
+
|
435 |
+
return target;
|
436 |
+
}
|
437 |
+
|
438 |
+
function _merge(target, source, deep) {
|
439 |
+
for (var key in source) {
|
440 |
+
if (deep && (isPlainObject(source[key]) || isArray(source[key]))) {
|
441 |
+
if (isPlainObject(source[key]) && !isPlainObject(target[key])) {
|
442 |
+
target[key] = {};
|
443 |
+
}
|
444 |
+
if (isArray(source[key]) && !isArray(target[key])) {
|
445 |
+
target[key] = [];
|
446 |
+
}
|
447 |
+
_merge(target[key], source[key], deep);
|
448 |
+
} else if (source[key] !== undefined) {
|
449 |
+
target[key] = source[key];
|
450 |
+
}
|
451 |
+
}
|
452 |
+
}
|
453 |
+
|
454 |
+
/**
|
455 |
+
* Root Prefix Transform.
|
456 |
+
*/
|
457 |
+
|
458 |
+
var root = function (options$$1, next) {
|
459 |
+
|
460 |
+
var url = next(options$$1);
|
461 |
+
|
462 |
+
if (isString(options$$1.root) && !/^(https?:)?\//.test(url)) {
|
463 |
+
url = trimEnd(options$$1.root, '/') + '/' + url;
|
464 |
+
}
|
465 |
+
|
466 |
+
return url;
|
467 |
+
};
|
468 |
+
|
469 |
+
/**
|
470 |
+
* Query Parameter Transform.
|
471 |
+
*/
|
472 |
+
|
473 |
+
var query = function (options$$1, next) {
|
474 |
+
|
475 |
+
var urlParams = Object.keys(Url.options.params), query = {}, url = next(options$$1);
|
476 |
+
|
477 |
+
each(options$$1.params, function (value, key) {
|
478 |
+
if (urlParams.indexOf(key) === -1) {
|
479 |
+
query[key] = value;
|
480 |
+
}
|
481 |
+
});
|
482 |
+
|
483 |
+
query = Url.params(query);
|
484 |
+
|
485 |
+
if (query) {
|
486 |
+
url += (url.indexOf('?') == -1 ? '?' : '&') + query;
|
487 |
+
}
|
488 |
+
|
489 |
+
return url;
|
490 |
+
};
|
491 |
+
|
492 |
+
/**
|
493 |
+
* URL Template v2.0.6 (https://github.com/bramstein/url-template)
|
494 |
+
*/
|
495 |
+
|
496 |
+
function expand(url, params, variables) {
|
497 |
+
|
498 |
+
var tmpl = parse(url), expanded = tmpl.expand(params);
|
499 |
+
|
500 |
+
if (variables) {
|
501 |
+
variables.push.apply(variables, tmpl.vars);
|
502 |
+
}
|
503 |
+
|
504 |
+
return expanded;
|
505 |
+
}
|
506 |
+
|
507 |
+
function parse(template) {
|
508 |
+
|
509 |
+
var operators = ['+', '#', '.', '/', ';', '?', '&'], variables = [];
|
510 |
+
|
511 |
+
return {
|
512 |
+
vars: variables,
|
513 |
+
expand: function expand(context) {
|
514 |
+
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
|
515 |
+
if (expression) {
|
516 |
+
|
517 |
+
var operator = null, values = [];
|
518 |
+
|
519 |
+
if (operators.indexOf(expression.charAt(0)) !== -1) {
|
520 |
+
operator = expression.charAt(0);
|
521 |
+
expression = expression.substr(1);
|
522 |
+
}
|
523 |
+
|
524 |
+
expression.split(/,/g).forEach(function (variable) {
|
525 |
+
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
|
526 |
+
values.push.apply(values, getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
|
527 |
+
variables.push(tmp[1]);
|
528 |
+
});
|
529 |
+
|
530 |
+
if (operator && operator !== '+') {
|
531 |
+
|
532 |
+
var separator = ',';
|
533 |
+
|
534 |
+
if (operator === '?') {
|
535 |
+
separator = '&';
|
536 |
+
} else if (operator !== '#') {
|
537 |
+
separator = operator;
|
538 |
+
}
|
539 |
+
|
540 |
+
return (values.length !== 0 ? operator : '') + values.join(separator);
|
541 |
+
} else {
|
542 |
+
return values.join(',');
|
543 |
+
}
|
544 |
+
|
545 |
+
} else {
|
546 |
+
return encodeReserved(literal);
|
547 |
+
}
|
548 |
+
});
|
549 |
+
}
|
550 |
+
};
|
551 |
+
}
|
552 |
+
|
553 |
+
function getValues(context, operator, key, modifier) {
|
554 |
+
|
555 |
+
var value = context[key], result = [];
|
556 |
+
|
557 |
+
if (isDefined(value) && value !== '') {
|
558 |
+
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
559 |
+
value = value.toString();
|
560 |
+
|
561 |
+
if (modifier && modifier !== '*') {
|
562 |
+
value = value.substring(0, parseInt(modifier, 10));
|
563 |
+
}
|
564 |
+
|
565 |
+
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
|
566 |
+
} else {
|
567 |
+
if (modifier === '*') {
|
568 |
+
if (Array.isArray(value)) {
|
569 |
+
value.filter(isDefined).forEach(function (value) {
|
570 |
+
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : null));
|
571 |
+
});
|
572 |
+
} else {
|
573 |
+
Object.keys(value).forEach(function (k) {
|
574 |
+
if (isDefined(value[k])) {
|
575 |
+
result.push(encodeValue(operator, value[k], k));
|
576 |
+
}
|
577 |
+
});
|
578 |
+
}
|
579 |
+
} else {
|
580 |
+
var tmp = [];
|
581 |
+
|
582 |
+
if (Array.isArray(value)) {
|
583 |
+
value.filter(isDefined).forEach(function (value) {
|
584 |
+
tmp.push(encodeValue(operator, value));
|
585 |
+
});
|
586 |
+
} else {
|
587 |
+
Object.keys(value).forEach(function (k) {
|
588 |
+
if (isDefined(value[k])) {
|
589 |
+
tmp.push(encodeURIComponent(k));
|
590 |
+
tmp.push(encodeValue(operator, value[k].toString()));
|
591 |
+
}
|
592 |
+
});
|
593 |
+
}
|
594 |
+
|
595 |
+
if (isKeyOperator(operator)) {
|
596 |
+
result.push(encodeURIComponent(key) + '=' + tmp.join(','));
|
597 |
+
} else if (tmp.length !== 0) {
|
598 |
+
result.push(tmp.join(','));
|
599 |
+
}
|
600 |
+
}
|
601 |
+
}
|
602 |
+
} else {
|
603 |
+
if (operator === ';') {
|
604 |
+
result.push(encodeURIComponent(key));
|
605 |
+
} else if (value === '' && (operator === '&' || operator === '?')) {
|
606 |
+
result.push(encodeURIComponent(key) + '=');
|
607 |
+
} else if (value === '') {
|
608 |
+
result.push('');
|
609 |
+
}
|
610 |
+
}
|
611 |
+
|
612 |
+
return result;
|
613 |
+
}
|
614 |
+
|
615 |
+
function isDefined(value) {
|
616 |
+
return value !== undefined && value !== null;
|
617 |
+
}
|
618 |
+
|
619 |
+
function isKeyOperator(operator) {
|
620 |
+
return operator === ';' || operator === '&' || operator === '?';
|
621 |
+
}
|
622 |
+
|
623 |
+
function encodeValue(operator, value, key) {
|
624 |
+
|
625 |
+
value = (operator === '+' || operator === '#') ? encodeReserved(value) : encodeURIComponent(value);
|
626 |
+
|
627 |
+
if (key) {
|
628 |
+
return encodeURIComponent(key) + '=' + value;
|
629 |
+
} else {
|
630 |
+
return value;
|
631 |
+
}
|
632 |
+
}
|
633 |
+
|
634 |
+
function encodeReserved(str) {
|
635 |
+
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
|
636 |
+
if (!/%[0-9A-Fa-f]/.test(part)) {
|
637 |
+
part = encodeURI(part);
|
638 |
+
}
|
639 |
+
return part;
|
640 |
+
}).join('');
|
641 |
+
}
|
642 |
+
|
643 |
+
/**
|
644 |
+
* URL Template (RFC 6570) Transform.
|
645 |
+
*/
|
646 |
+
|
647 |
+
var template = function (options) {
|
648 |
+
|
649 |
+
var variables = [], url = expand(options.url, options.params, variables);
|
650 |
+
|
651 |
+
variables.forEach(function (key) {
|
652 |
+
delete options.params[key];
|
653 |
+
});
|
654 |
+
|
655 |
+
return url;
|
656 |
+
};
|
657 |
+
|
658 |
+
/**
|
659 |
+
* Service for URL templating.
|
660 |
+
*/
|
661 |
+
|
662 |
+
function Url(url, params) {
|
663 |
+
|
664 |
+
var self = this || {}, options$$1 = url, transform;
|
665 |
+
|
666 |
+
if (isString(url)) {
|
667 |
+
options$$1 = {url: url, params: params};
|
668 |
+
}
|
669 |
+
|
670 |
+
options$$1 = merge({}, Url.options, self.$options, options$$1);
|
671 |
+
|
672 |
+
Url.transforms.forEach(function (handler) {
|
673 |
+
|
674 |
+
if (isString(handler)) {
|
675 |
+
handler = Url.transform[handler];
|
676 |
+
}
|
677 |
+
|
678 |
+
if (isFunction(handler)) {
|
679 |
+
transform = factory(handler, transform, self.$vm);
|
680 |
+
}
|
681 |
+
|
682 |
+
});
|
683 |
+
|
684 |
+
return transform(options$$1);
|
685 |
+
}
|
686 |
+
|
687 |
+
/**
|
688 |
+
* Url options.
|
689 |
+
*/
|
690 |
+
|
691 |
+
Url.options = {
|
692 |
+
url: '',
|
693 |
+
root: null,
|
694 |
+
params: {}
|
695 |
+
};
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Url transforms.
|
699 |
+
*/
|
700 |
+
|
701 |
+
Url.transform = {template: template, query: query, root: root};
|
702 |
+
Url.transforms = ['template', 'query', 'root'];
|
703 |
+
|
704 |
+
/**
|
705 |
+
* Encodes a Url parameter string.
|
706 |
+
*
|
707 |
+
* @param {Object} obj
|
708 |
+
*/
|
709 |
+
|
710 |
+
Url.params = function (obj) {
|
711 |
+
|
712 |
+
var params = [], escape = encodeURIComponent;
|
713 |
+
|
714 |
+
params.add = function (key, value) {
|
715 |
+
|
716 |
+
if (isFunction(value)) {
|
717 |
+
value = value();
|
718 |
+
}
|
719 |
+
|
720 |
+
if (value === null) {
|
721 |
+
value = '';
|
722 |
+
}
|
723 |
+
|
724 |
+
this.push(escape(key) + '=' + escape(value));
|
725 |
+
};
|
726 |
+
|
727 |
+
serialize(params, obj);
|
728 |
+
|
729 |
+
return params.join('&').replace(/%20/g, '+');
|
730 |
+
};
|
731 |
+
|
732 |
+
/**
|
733 |
+
* Parse a URL and return its components.
|
734 |
+
*
|
735 |
+
* @param {String} url
|
736 |
+
*/
|
737 |
+
|
738 |
+
Url.parse = function (url) {
|
739 |
+
|
740 |
+
var el = document.createElement('a');
|
741 |
+
|
742 |
+
if (document.documentMode) {
|
743 |
+
el.href = url;
|
744 |
+
url = el.href;
|
745 |
+
}
|
746 |
+
|
747 |
+
el.href = url;
|
748 |
+
|
749 |
+
return {
|
750 |
+
href: el.href,
|
751 |
+
protocol: el.protocol ? el.protocol.replace(/:$/, '') : '',
|
752 |
+
port: el.port,
|
753 |
+
host: el.host,
|
754 |
+
hostname: el.hostname,
|
755 |
+
pathname: el.pathname.charAt(0) === '/' ? el.pathname : '/' + el.pathname,
|
756 |
+
search: el.search ? el.search.replace(/^\?/, '') : '',
|
757 |
+
hash: el.hash ? el.hash.replace(/^#/, '') : ''
|
758 |
+
};
|
759 |
+
};
|
760 |
+
|
761 |
+
function factory(handler, next, vm) {
|
762 |
+
return function (options$$1) {
|
763 |
+
return handler.call(vm, options$$1, next);
|
764 |
+
};
|
765 |
+
}
|
766 |
+
|
767 |
+
function serialize(params, obj, scope) {
|
768 |
+
|
769 |
+
var array = isArray(obj), plain = isPlainObject(obj), hash;
|
770 |
+
|
771 |
+
each(obj, function (value, key) {
|
772 |
+
|
773 |
+
hash = isObject(value) || isArray(value);
|
774 |
+
|
775 |
+
if (scope) {
|
776 |
+
key = scope + '[' + (plain || hash ? key : '') + ']';
|
777 |
+
}
|
778 |
+
|
779 |
+
if (!scope && array) {
|
780 |
+
params.add(value.name, value.value);
|
781 |
+
} else if (hash) {
|
782 |
+
serialize(params, value, key);
|
783 |
+
} else {
|
784 |
+
params.add(key, value);
|
785 |
+
}
|
786 |
+
});
|
787 |
+
}
|
788 |
+
|
789 |
+
/**
|
790 |
+
* XDomain client (Internet Explorer).
|
791 |
+
*/
|
792 |
+
|
793 |
+
var xdrClient = function (request) {
|
794 |
+
return new PromiseObj(function (resolve) {
|
795 |
+
|
796 |
+
var xdr = new XDomainRequest(), handler = function (ref) {
|
797 |
+
var type = ref.type;
|
798 |
+
|
799 |
+
|
800 |
+
var status = 0;
|
801 |
+
|
802 |
+
if (type === 'load') {
|
803 |
+
status = 200;
|
804 |
+
} else if (type === 'error') {
|
805 |
+
status = 500;
|
806 |
+
}
|
807 |
+
|
808 |
+
resolve(request.respondWith(xdr.responseText, {status: status}));
|
809 |
+
};
|
810 |
+
|
811 |
+
request.abort = function () { return xdr.abort(); };
|
812 |
+
|
813 |
+
xdr.open(request.method, request.getUrl());
|
814 |
+
|
815 |
+
if (request.timeout) {
|
816 |
+
xdr.timeout = request.timeout;
|
817 |
+
}
|
818 |
+
|
819 |
+
xdr.onload = handler;
|
820 |
+
xdr.onabort = handler;
|
821 |
+
xdr.onerror = handler;
|
822 |
+
xdr.ontimeout = handler;
|
823 |
+
xdr.onprogress = function () {};
|
824 |
+
xdr.send(request.getBody());
|
825 |
+
});
|
826 |
+
};
|
827 |
+
|
828 |
+
/**
|
829 |
+
* CORS Interceptor.
|
830 |
+
*/
|
831 |
+
|
832 |
+
var SUPPORTS_CORS = inBrowser && 'withCredentials' in new XMLHttpRequest();
|
833 |
+
|
834 |
+
var cors = function (request, next) {
|
835 |
+
|
836 |
+
if (inBrowser) {
|
837 |
+
|
838 |
+
var orgUrl = Url.parse(location.href);
|
839 |
+
var reqUrl = Url.parse(request.getUrl());
|
840 |
+
|
841 |
+
if (reqUrl.protocol !== orgUrl.protocol || reqUrl.host !== orgUrl.host) {
|
842 |
+
|
843 |
+
request.crossOrigin = true;
|
844 |
+
request.emulateHTTP = false;
|
845 |
+
|
846 |
+
if (!SUPPORTS_CORS) {
|
847 |
+
request.client = xdrClient;
|
848 |
+
}
|
849 |
+
}
|
850 |
+
}
|
851 |
+
|
852 |
+
next();
|
853 |
+
};
|
854 |
+
|
855 |
+
/**
|
856 |
+
* Form data Interceptor.
|
857 |
+
*/
|
858 |
+
|
859 |
+
var form = function (request, next) {
|
860 |
+
|
861 |
+
if (isFormData(request.body)) {
|
862 |
+
|
863 |
+
request.headers.delete('Content-Type');
|
864 |
+
|
865 |
+
} else if (isObject(request.body) && request.emulateJSON) {
|
866 |
+
|
867 |
+
request.body = Url.params(request.body);
|
868 |
+
request.headers.set('Content-Type', 'application/x-www-form-urlencoded');
|
869 |
+
}
|
870 |
+
|
871 |
+
next();
|
872 |
+
};
|
873 |
+
|
874 |
+
/**
|
875 |
+
* JSON Interceptor.
|
876 |
+
*/
|
877 |
+
|
878 |
+
var json = function (request, next) {
|
879 |
+
|
880 |
+
var type = request.headers.get('Content-Type') || '';
|
881 |
+
|
882 |
+
if (isObject(request.body) && type.indexOf('application/json') === 0) {
|
883 |
+
request.body = JSON.stringify(request.body);
|
884 |
+
}
|
885 |
+
|
886 |
+
next(function (response) {
|
887 |
+
|
888 |
+
return response.bodyText ? when(response.text(), function (text) {
|
889 |
+
|
890 |
+
type = response.headers.get('Content-Type') || '';
|
891 |
+
|
892 |
+
if (type.indexOf('application/json') === 0 || isJson(text)) {
|
893 |
+
|
894 |
+
try {
|
895 |
+
response.body = JSON.parse(text);
|
896 |
+
} catch (e) {
|
897 |
+
response.body = null;
|
898 |
+
}
|
899 |
+
|
900 |
+
} else {
|
901 |
+
response.body = text;
|
902 |
+
}
|
903 |
+
|
904 |
+
return response;
|
905 |
+
|
906 |
+
}) : response;
|
907 |
+
|
908 |
+
});
|
909 |
+
};
|
910 |
+
|
911 |
+
function isJson(str) {
|
912 |
+
|
913 |
+
var start = str.match(/^\[|^\{(?!\{)/), end = {'[': /]$/, '{': /}$/};
|
914 |
+
|
915 |
+
return start && end[start[0]].test(str);
|
916 |
+
}
|
917 |
+
|
918 |
+
/**
|
919 |
+
* JSONP client (Browser).
|
920 |
+
*/
|
921 |
+
|
922 |
+
var jsonpClient = function (request) {
|
923 |
+
return new PromiseObj(function (resolve) {
|
924 |
+
|
925 |
+
var name = request.jsonp || 'callback', callback = request.jsonpCallback || '_jsonp' + Math.random().toString(36).substr(2), body = null, handler, script;
|
926 |
+
|
927 |
+
handler = function (ref) {
|
928 |
+
var type = ref.type;
|
929 |
+
|
930 |
+
|
931 |
+
var status = 0;
|
932 |
+
|
933 |
+
if (type === 'load' && body !== null) {
|
934 |
+
status = 200;
|
935 |
+
} else if (type === 'error') {
|
936 |
+
status = 500;
|
937 |
+
}
|
938 |
+
|
939 |
+
if (status && window[callback]) {
|
940 |
+
delete window[callback];
|
941 |
+
document.body.removeChild(script);
|
942 |
+
}
|
943 |
+
|
944 |
+
resolve(request.respondWith(body, {status: status}));
|
945 |
+
};
|
946 |
+
|
947 |
+
window[callback] = function (result) {
|
948 |
+
body = JSON.stringify(result);
|
949 |
+
};
|
950 |
+
|
951 |
+
request.abort = function () {
|
952 |
+
handler({type: 'abort'});
|
953 |
+
};
|
954 |
+
|
955 |
+
request.params[name] = callback;
|
956 |
+
|
957 |
+
if (request.timeout) {
|
958 |
+
setTimeout(request.abort, request.timeout);
|
959 |
+
}
|
960 |
+
|
961 |
+
script = document.createElement('script');
|
962 |
+
script.src = request.getUrl();
|
963 |
+
script.type = 'text/javascript';
|
964 |
+
script.async = true;
|
965 |
+
script.onload = handler;
|
966 |
+
script.onerror = handler;
|
967 |
+
|
968 |
+
document.body.appendChild(script);
|
969 |
+
});
|
970 |
+
};
|
971 |
+
|
972 |
+
/**
|
973 |
+
* JSONP Interceptor.
|
974 |
+
*/
|
975 |
+
|
976 |
+
var jsonp = function (request, next) {
|
977 |
+
|
978 |
+
if (request.method == 'JSONP') {
|
979 |
+
request.client = jsonpClient;
|
980 |
+
}
|
981 |
+
|
982 |
+
next();
|
983 |
+
};
|
984 |
+
|
985 |
+
/**
|
986 |
+
* Before Interceptor.
|
987 |
+
*/
|
988 |
+
|
989 |
+
var before = function (request, next) {
|
990 |
+
|
991 |
+
if (isFunction(request.before)) {
|
992 |
+
request.before.call(this, request);
|
993 |
+
}
|
994 |
+
|
995 |
+
next();
|
996 |
+
};
|
997 |
+
|
998 |
+
/**
|
999 |
+
* HTTP method override Interceptor.
|
1000 |
+
*/
|
1001 |
+
|
1002 |
+
var method = function (request, next) {
|
1003 |
+
|
1004 |
+
if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) {
|
1005 |
+
request.headers.set('X-HTTP-Method-Override', request.method);
|
1006 |
+
request.method = 'POST';
|
1007 |
+
}
|
1008 |
+
|
1009 |
+
next();
|
1010 |
+
};
|
1011 |
+
|
1012 |
+
/**
|
1013 |
+
* Header Interceptor.
|
1014 |
+
*/
|
1015 |
+
|
1016 |
+
var header = function (request, next) {
|
1017 |
+
|
1018 |
+
var headers = assign({}, Http.headers.common,
|
1019 |
+
!request.crossOrigin ? Http.headers.custom : {},
|
1020 |
+
Http.headers[toLower(request.method)]
|
1021 |
+
);
|
1022 |
+
|
1023 |
+
each(headers, function (value, name) {
|
1024 |
+
if (!request.headers.has(name)) {
|
1025 |
+
request.headers.set(name, value);
|
1026 |
+
}
|
1027 |
+
});
|
1028 |
+
|
1029 |
+
next();
|
1030 |
+
};
|
1031 |
+
|
1032 |
+
/**
|
1033 |
+
* XMLHttp client (Browser).
|
1034 |
+
*/
|
1035 |
+
|
1036 |
+
var xhrClient = function (request) {
|
1037 |
+
return new PromiseObj(function (resolve) {
|
1038 |
+
|
1039 |
+
var xhr = new XMLHttpRequest(), handler = function (event) {
|
1040 |
+
|
1041 |
+
var response = request.respondWith(
|
1042 |
+
'response' in xhr ? xhr.response : xhr.responseText, {
|
1043 |
+
status: xhr.status === 1223 ? 204 : xhr.status, // IE9 status bug
|
1044 |
+
statusText: xhr.status === 1223 ? 'No Content' : trim(xhr.statusText)
|
1045 |
+
}
|
1046 |
+
);
|
1047 |
+
|
1048 |
+
each(trim(xhr.getAllResponseHeaders()).split('\n'), function (row) {
|
1049 |
+
response.headers.append(row.slice(0, row.indexOf(':')), row.slice(row.indexOf(':') + 1));
|
1050 |
+
});
|
1051 |
+
|
1052 |
+
resolve(response);
|
1053 |
+
};
|
1054 |
+
|
1055 |
+
request.abort = function () { return xhr.abort(); };
|
1056 |
+
|
1057 |
+
if (request.progress) {
|
1058 |
+
if (request.method === 'GET') {
|
1059 |
+
xhr.addEventListener('progress', request.progress);
|
1060 |
+
} else if (/^(POST|PUT)$/i.test(request.method)) {
|
1061 |
+
xhr.upload.addEventListener('progress', request.progress);
|
1062 |
+
}
|
1063 |
+
}
|
1064 |
+
|
1065 |
+
xhr.open(request.method, request.getUrl(), true);
|
1066 |
+
|
1067 |
+
if (request.timeout) {
|
1068 |
+
xhr.timeout = request.timeout;
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
if (request.responseType && 'responseType' in xhr) {
|
1072 |
+
xhr.responseType = request.responseType;
|
1073 |
+
}
|
1074 |
+
|
1075 |
+
if (request.withCredentials || request.credentials) {
|
1076 |
+
xhr.withCredentials = true;
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
if (!request.crossOrigin) {
|
1080 |
+
request.headers.set('X-Requested-With', 'XMLHttpRequest');
|
1081 |
+
}
|
1082 |
+
|
1083 |
+
request.headers.forEach(function (value, name) {
|
1084 |
+
xhr.setRequestHeader(name, value);
|
1085 |
+
});
|
1086 |
+
|
1087 |
+
xhr.onload = handler;
|
1088 |
+
xhr.onabort = handler;
|
1089 |
+
xhr.onerror = handler;
|
1090 |
+
xhr.ontimeout = handler;
|
1091 |
+
xhr.send(request.getBody());
|
1092 |
+
});
|
1093 |
+
};
|
1094 |
+
|
1095 |
+
/**
|
1096 |
+
* Http client (Node).
|
1097 |
+
*/
|
1098 |
+
|
1099 |
+
var nodeClient = function (request) {
|
1100 |
+
|
1101 |
+
var client = require('got');
|
1102 |
+
|
1103 |
+
return new PromiseObj(function (resolve) {
|
1104 |
+
|
1105 |
+
var url = request.getUrl();
|
1106 |
+
var body = request.getBody();
|
1107 |
+
var method = request.method;
|
1108 |
+
var headers = {}, handler;
|
1109 |
+
|
1110 |
+
request.headers.forEach(function (value, name) {
|
1111 |
+
headers[name] = value;
|
1112 |
+
});
|
1113 |
+
|
1114 |
+
client(url, {body: body, method: method, headers: headers}).then(handler = function (resp) {
|
1115 |
+
|
1116 |
+
var response = request.respondWith(resp.body, {
|
1117 |
+
status: resp.statusCode,
|
1118 |
+
statusText: trim(resp.statusMessage)
|
1119 |
+
}
|
1120 |
+
);
|
1121 |
+
|
1122 |
+
each(resp.headers, function (value, name) {
|
1123 |
+
response.headers.set(name, value);
|
1124 |
+
});
|
1125 |
+
|
1126 |
+
resolve(response);
|
1127 |
+
|
1128 |
+
}, function (error$$1) { return handler(error$$1.response); });
|
1129 |
+
});
|
1130 |
+
};
|
1131 |
+
|
1132 |
+
/**
|
1133 |
+
* Base client.
|
1134 |
+
*/
|
1135 |
+
|
1136 |
+
var Client = function (context) {
|
1137 |
+
|
1138 |
+
var reqHandlers = [sendRequest], resHandlers = [], handler;
|
1139 |
+
|
1140 |
+
if (!isObject(context)) {
|
1141 |
+
context = null;
|
1142 |
+
}
|
1143 |
+
|
1144 |
+
function Client(request) {
|
1145 |
+
return new PromiseObj(function (resolve, reject) {
|
1146 |
+
|
1147 |
+
function exec() {
|
1148 |
+
|
1149 |
+
handler = reqHandlers.pop();
|
1150 |
+
|
1151 |
+
if (isFunction(handler)) {
|
1152 |
+
handler.call(context, request, next);
|
1153 |
+
} else {
|
1154 |
+
warn(("Invalid interceptor of type " + (typeof handler) + ", must be a function"));
|
1155 |
+
next();
|
1156 |
+
}
|
1157 |
+
}
|
1158 |
+
|
1159 |
+
function next(response) {
|
1160 |
+
|
1161 |
+
if (isFunction(response)) {
|
1162 |
+
|
1163 |
+
resHandlers.unshift(response);
|
1164 |
+
|
1165 |
+
} else if (isObject(response)) {
|
1166 |
+
|
1167 |
+
resHandlers.forEach(function (handler) {
|
1168 |
+
response = when(response, function (response) {
|
1169 |
+
return handler.call(context, response) || response;
|
1170 |
+
}, reject);
|
1171 |
+
});
|
1172 |
+
|
1173 |
+
when(response, resolve, reject);
|
1174 |
+
|
1175 |
+
return;
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
exec();
|
1179 |
+
}
|
1180 |
+
|
1181 |
+
exec();
|
1182 |
+
|
1183 |
+
}, context);
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
Client.use = function (handler) {
|
1187 |
+
reqHandlers.push(handler);
|
1188 |
+
};
|
1189 |
+
|
1190 |
+
return Client;
|
1191 |
+
};
|
1192 |
+
|
1193 |
+
function sendRequest(request, resolve) {
|
1194 |
+
|
1195 |
+
var client = request.client || (inBrowser ? xhrClient : nodeClient);
|
1196 |
+
|
1197 |
+
resolve(client(request));
|
1198 |
+
}
|
1199 |
+
|
1200 |
+
/**
|
1201 |
+
* HTTP Headers.
|
1202 |
+
*/
|
1203 |
+
|
1204 |
+
var Headers = function Headers(headers) {
|
1205 |
+
var this$1 = this;
|
1206 |
+
|
1207 |
+
|
1208 |
+
this.map = {};
|
1209 |
+
|
1210 |
+
each(headers, function (value, name) { return this$1.append(name, value); });
|
1211 |
+
};
|
1212 |
+
|
1213 |
+
Headers.prototype.has = function has (name) {
|
1214 |
+
return getName(this.map, name) !== null;
|
1215 |
+
};
|
1216 |
+
|
1217 |
+
Headers.prototype.get = function get (name) {
|
1218 |
+
|
1219 |
+
var list = this.map[getName(this.map, name)];
|
1220 |
+
|
1221 |
+
return list ? list.join() : null;
|
1222 |
+
};
|
1223 |
+
|
1224 |
+
Headers.prototype.getAll = function getAll (name) {
|
1225 |
+
return this.map[getName(this.map, name)] || [];
|
1226 |
+
};
|
1227 |
+
|
1228 |
+
Headers.prototype.set = function set (name, value) {
|
1229 |
+
this.map[normalizeName(getName(this.map, name) || name)] = [trim(value)];
|
1230 |
+
};
|
1231 |
+
|
1232 |
+
Headers.prototype.append = function append (name, value){
|
1233 |
+
|
1234 |
+
var list = this.map[getName(this.map, name)];
|
1235 |
+
|
1236 |
+
if (list) {
|
1237 |
+
list.push(trim(value));
|
1238 |
+
} else {
|
1239 |
+
this.set(name, value);
|
1240 |
+
}
|
1241 |
+
};
|
1242 |
+
|
1243 |
+
Headers.prototype.delete = function delete$1 (name){
|
1244 |
+
delete this.map[getName(this.map, name)];
|
1245 |
+
};
|
1246 |
+
|
1247 |
+
Headers.prototype.deleteAll = function deleteAll (){
|
1248 |
+
this.map = {};
|
1249 |
+
};
|
1250 |
+
|
1251 |
+
Headers.prototype.forEach = function forEach (callback, thisArg) {
|
1252 |
+
var this$1 = this;
|
1253 |
+
|
1254 |
+
each(this.map, function (list, name) {
|
1255 |
+
each(list, function (value) { return callback.call(thisArg, value, name, this$1); });
|
1256 |
+
});
|
1257 |
+
};
|
1258 |
+
|
1259 |
+
function getName(map, name) {
|
1260 |
+
return Object.keys(map).reduce(function (prev, curr) {
|
1261 |
+
return toLower(name) === toLower(curr) ? curr : prev;
|
1262 |
+
}, null);
|
1263 |
+
}
|
1264 |
+
|
1265 |
+
function normalizeName(name) {
|
1266 |
+
|
1267 |
+
if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
|
1268 |
+
throw new TypeError('Invalid character in header field name');
|
1269 |
+
}
|
1270 |
+
|
1271 |
+
return trim(name);
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
/**
|
1275 |
+
* HTTP Response.
|
1276 |
+
*/
|
1277 |
+
|
1278 |
+
var Response = function Response(body, ref) {
|
1279 |
+
var url = ref.url;
|
1280 |
+
var headers = ref.headers;
|
1281 |
+
var status = ref.status;
|
1282 |
+
var statusText = ref.statusText;
|
1283 |
+
|
1284 |
+
|
1285 |
+
this.url = url;
|
1286 |
+
this.ok = status >= 200 && status < 300;
|
1287 |
+
this.status = status || 0;
|
1288 |
+
this.statusText = statusText || '';
|
1289 |
+
this.headers = new Headers(headers);
|
1290 |
+
this.body = body;
|
1291 |
+
|
1292 |
+
if (isString(body)) {
|
1293 |
+
|
1294 |
+
this.bodyText = body;
|
1295 |
+
|
1296 |
+
} else if (isBlob(body)) {
|
1297 |
+
|
1298 |
+
this.bodyBlob = body;
|
1299 |
+
|
1300 |
+
if (isBlobText(body)) {
|
1301 |
+
this.bodyText = blobText(body);
|
1302 |
+
}
|
1303 |
+
}
|
1304 |
+
};
|
1305 |
+
|
1306 |
+
Response.prototype.blob = function blob () {
|
1307 |
+
return when(this.bodyBlob);
|
1308 |
+
};
|
1309 |
+
|
1310 |
+
Response.prototype.text = function text () {
|
1311 |
+
return when(this.bodyText);
|
1312 |
+
};
|
1313 |
+
|
1314 |
+
Response.prototype.json = function json () {
|
1315 |
+
return when(this.text(), function (text) { return JSON.parse(text); });
|
1316 |
+
};
|
1317 |
+
|
1318 |
+
Object.defineProperty(Response.prototype, 'data', {
|
1319 |
+
|
1320 |
+
get: function get() {
|
1321 |
+
return this.body;
|
1322 |
+
},
|
1323 |
+
|
1324 |
+
set: function set(body) {
|
1325 |
+
this.body = body;
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
});
|
1329 |
+
|
1330 |
+
function blobText(body) {
|
1331 |
+
return new PromiseObj(function (resolve) {
|
1332 |
+
|
1333 |
+
var reader = new FileReader();
|
1334 |
+
|
1335 |
+
reader.readAsText(body);
|
1336 |
+
reader.onload = function () {
|
1337 |
+
resolve(reader.result);
|
1338 |
+
};
|
1339 |
+
|
1340 |
+
});
|
1341 |
+
}
|
1342 |
+
|
1343 |
+
function isBlobText(body) {
|
1344 |
+
return body.type.indexOf('text') === 0 || body.type.indexOf('json') !== -1;
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
/**
|
1348 |
+
* HTTP Request.
|
1349 |
+
*/
|
1350 |
+
|
1351 |
+
var Request = function Request(options$$1) {
|
1352 |
+
|
1353 |
+
this.body = null;
|
1354 |
+
this.params = {};
|
1355 |
+
|
1356 |
+
assign(this, options$$1, {
|
1357 |
+
method: toUpper(options$$1.method || 'GET')
|
1358 |
+
});
|
1359 |
+
|
1360 |
+
if (!(this.headers instanceof Headers)) {
|
1361 |
+
this.headers = new Headers(this.headers);
|
1362 |
+
}
|
1363 |
+
};
|
1364 |
+
|
1365 |
+
Request.prototype.getUrl = function getUrl (){
|
1366 |
+
return Url(this);
|
1367 |
+
};
|
1368 |
+
|
1369 |
+
Request.prototype.getBody = function getBody (){
|
1370 |
+
return this.body;
|
1371 |
+
};
|
1372 |
+
|
1373 |
+
Request.prototype.respondWith = function respondWith (body, options$$1) {
|
1374 |
+
return new Response(body, assign(options$$1 || {}, {url: this.getUrl()}));
|
1375 |
+
};
|
1376 |
+
|
1377 |
+
/**
|
1378 |
+
* Service for sending network requests.
|
1379 |
+
*/
|
1380 |
+
|
1381 |
+
var COMMON_HEADERS = {'Accept': 'application/json, text/plain, */*'};
|
1382 |
+
var JSON_CONTENT_TYPE = {'Content-Type': 'application/json;charset=utf-8'};
|
1383 |
+
|
1384 |
+
function Http(options$$1) {
|
1385 |
+
|
1386 |
+
var self = this || {}, client = Client(self.$vm);
|
1387 |
+
|
1388 |
+
defaults(options$$1 || {}, self.$options, Http.options);
|
1389 |
+
|
1390 |
+
Http.interceptors.forEach(function (handler) {
|
1391 |
+
|
1392 |
+
if (isString(handler)) {
|
1393 |
+
handler = Http.interceptor[handler];
|
1394 |
+
}
|
1395 |
+
|
1396 |
+
if (isFunction(handler)) {
|
1397 |
+
client.use(handler);
|
1398 |
+
}
|
1399 |
+
|
1400 |
+
});
|
1401 |
+
|
1402 |
+
return client(new Request(options$$1)).then(function (response) {
|
1403 |
+
|
1404 |
+
return response.ok ? response : PromiseObj.reject(response);
|
1405 |
+
|
1406 |
+
}, function (response) {
|
1407 |
+
|
1408 |
+
if (response instanceof Error) {
|
1409 |
+
error(response);
|
1410 |
+
}
|
1411 |
+
|
1412 |
+
return PromiseObj.reject(response);
|
1413 |
+
});
|
1414 |
+
}
|
1415 |
+
|
1416 |
+
Http.options = {};
|
1417 |
+
|
1418 |
+
Http.headers = {
|
1419 |
+
put: JSON_CONTENT_TYPE,
|
1420 |
+
post: JSON_CONTENT_TYPE,
|
1421 |
+
patch: JSON_CONTENT_TYPE,
|
1422 |
+
delete: JSON_CONTENT_TYPE,
|
1423 |
+
common: COMMON_HEADERS,
|
1424 |
+
custom: {}
|
1425 |
+
};
|
1426 |
+
|
1427 |
+
Http.interceptor = {before: before, method: method, jsonp: jsonp, json: json, form: form, header: header, cors: cors};
|
1428 |
+
Http.interceptors = ['before', 'method', 'jsonp', 'json', 'form', 'header', 'cors'];
|
1429 |
+
|
1430 |
+
['get', 'delete', 'head', 'jsonp'].forEach(function (method$$1) {
|
1431 |
+
|
1432 |
+
Http[method$$1] = function (url, options$$1) {
|
1433 |
+
return this(assign(options$$1 || {}, {url: url, method: method$$1}));
|
1434 |
+
};
|
1435 |
+
|
1436 |
+
});
|
1437 |
+
|
1438 |
+
['post', 'put', 'patch'].forEach(function (method$$1) {
|
1439 |
+
|
1440 |
+
Http[method$$1] = function (url, body, options$$1) {
|
1441 |
+
return this(assign(options$$1 || {}, {url: url, method: method$$1, body: body}));
|
1442 |
+
};
|
1443 |
+
|
1444 |
+
});
|
1445 |
+
|
1446 |
+
/**
|
1447 |
+
* Service for interacting with RESTful services.
|
1448 |
+
*/
|
1449 |
+
|
1450 |
+
function Resource(url, params, actions, options$$1) {
|
1451 |
+
|
1452 |
+
var self = this || {}, resource = {};
|
1453 |
+
|
1454 |
+
actions = assign({},
|
1455 |
+
Resource.actions,
|
1456 |
+
actions
|
1457 |
+
);
|
1458 |
+
|
1459 |
+
each(actions, function (action, name) {
|
1460 |
+
|
1461 |
+
action = merge({url: url, params: assign({}, params)}, options$$1, action);
|
1462 |
+
|
1463 |
+
resource[name] = function () {
|
1464 |
+
return (self.$http || Http)(opts(action, arguments));
|
1465 |
+
};
|
1466 |
+
});
|
1467 |
+
|
1468 |
+
return resource;
|
1469 |
+
}
|
1470 |
+
|
1471 |
+
function opts(action, args) {
|
1472 |
+
|
1473 |
+
var options$$1 = assign({}, action), params = {}, body;
|
1474 |
+
|
1475 |
+
switch (args.length) {
|
1476 |
+
|
1477 |
+
case 2:
|
1478 |
+
|
1479 |
+
params = args[0];
|
1480 |
+
body = args[1];
|
1481 |
+
|
1482 |
+
break;
|
1483 |
+
|
1484 |
+
case 1:
|
1485 |
+
|
1486 |
+
if (/^(POST|PUT|PATCH)$/i.test(options$$1.method)) {
|
1487 |
+
body = args[0];
|
1488 |
+
} else {
|
1489 |
+
params = args[0];
|
1490 |
+
}
|
1491 |
+
|
1492 |
+
break;
|
1493 |
+
|
1494 |
+
case 0:
|
1495 |
+
|
1496 |
+
break;
|
1497 |
+
|
1498 |
+
default:
|
1499 |
+
|
1500 |
+
throw 'Expected up to 2 arguments [params, body], got ' + args.length + ' arguments';
|
1501 |
+
}
|
1502 |
+
|
1503 |
+
options$$1.body = body;
|
1504 |
+
options$$1.params = assign({}, options$$1.params, params);
|
1505 |
+
|
1506 |
+
return options$$1;
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
Resource.actions = {
|
1510 |
+
|
1511 |
+
get: {method: 'GET'},
|
1512 |
+
save: {method: 'POST'},
|
1513 |
+
query: {method: 'GET'},
|
1514 |
+
update: {method: 'PUT'},
|
1515 |
+
remove: {method: 'DELETE'},
|
1516 |
+
delete: {method: 'DELETE'}
|
1517 |
+
|
1518 |
+
};
|
1519 |
+
|
1520 |
+
/**
|
1521 |
+
* Install plugin.
|
1522 |
+
*/
|
1523 |
+
|
1524 |
+
function plugin(Vue) {
|
1525 |
+
|
1526 |
+
if (plugin.installed) {
|
1527 |
+
return;
|
1528 |
+
}
|
1529 |
+
|
1530 |
+
Util(Vue);
|
1531 |
+
|
1532 |
+
Vue.url = Url;
|
1533 |
+
Vue.http = Http;
|
1534 |
+
Vue.resource = Resource;
|
1535 |
+
Vue.Promise = PromiseObj;
|
1536 |
+
|
1537 |
+
Object.defineProperties(Vue.prototype, {
|
1538 |
+
|
1539 |
+
$url: {
|
1540 |
+
get: function get() {
|
1541 |
+
return options(Vue.url, this, this.$options.url);
|
1542 |
+
}
|
1543 |
+
},
|
1544 |
+
|
1545 |
+
$http: {
|
1546 |
+
get: function get() {
|
1547 |
+
return options(Vue.http, this, this.$options.http);
|
1548 |
+
}
|
1549 |
+
},
|
1550 |
+
|
1551 |
+
$resource: {
|
1552 |
+
get: function get() {
|
1553 |
+
return Vue.resource.bind(this);
|
1554 |
+
}
|
1555 |
+
},
|
1556 |
+
|
1557 |
+
$promise: {
|
1558 |
+
get: function get() {
|
1559 |
+
var this$1 = this;
|
1560 |
+
|
1561 |
+
return function (executor) { return new Vue.Promise(executor, this$1); };
|
1562 |
+
}
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
});
|
1566 |
+
}
|
1567 |
+
|
1568 |
+
if (typeof window !== 'undefined' && window.Vue) {
|
1569 |
+
window.Vue.use(plugin);
|
1570 |
+
}
|
1571 |
+
|
1572 |
+
return plugin;
|
1573 |
+
|
1574 |
+
})));
|
assets/js/vendor/vue.js
ADDED
@@ -0,0 +1,11945 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Vue.js v2.6.10
|
3 |
+
* (c) 2014-2019 Evan You
|
4 |
+
* Released under the MIT License.
|
5 |
+
*/
|
6 |
+
|
7 |
+
(function (global, factory) {
|
8 |
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
9 |
+
typeof define === 'function' && define.amd ? define(factory) :
|
10 |
+
(global = global || self, global.Vue = factory());
|
11 |
+
}(this, function () { 'use strict';
|
12 |
+
|
13 |
+
/* */
|
14 |
+
|
15 |
+
var emptyObject = Object.freeze({});
|
16 |
+
|
17 |
+
// These helpers produce better VM code in JS engines due to their
|
18 |
+
// explicitness and function inlining.
|
19 |
+
function isUndef (v) {
|
20 |
+
return v === undefined || v === null
|
21 |
+
}
|
22 |
+
|
23 |
+
function isDef (v) {
|
24 |
+
return v !== undefined && v !== null
|
25 |
+
}
|
26 |
+
|
27 |
+
function isTrue (v) {
|
28 |
+
return v === true
|
29 |
+
}
|
30 |
+
|
31 |
+
function isFalse (v) {
|
32 |
+
return v === false
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Check if value is primitive.
|
37 |
+
*/
|
38 |
+
function isPrimitive (value) {
|
39 |
+
return (
|
40 |
+
typeof value === 'string' ||
|
41 |
+
typeof value === 'number' ||
|
42 |
+
// $flow-disable-line
|
43 |
+
typeof value === 'symbol' ||
|
44 |
+
typeof value === 'boolean'
|
45 |
+
)
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Quick object check - this is primarily used to tell
|
50 |
+
* Objects from primitive values when we know the value
|
51 |
+
* is a JSON-compliant type.
|
52 |
+
*/
|
53 |
+
function isObject (obj) {
|
54 |
+
return obj !== null && typeof obj === 'object'
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Get the raw type string of a value, e.g., [object Object].
|
59 |
+
*/
|
60 |
+
var _toString = Object.prototype.toString;
|
61 |
+
|
62 |
+
function toRawType (value) {
|
63 |
+
return _toString.call(value).slice(8, -1)
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Strict object type check. Only returns true
|
68 |
+
* for plain JavaScript objects.
|
69 |
+
*/
|
70 |
+
function isPlainObject (obj) {
|
71 |
+
return _toString.call(obj) === '[object Object]'
|
72 |
+
}
|
73 |
+
|
74 |
+
function isRegExp (v) {
|
75 |
+
return _toString.call(v) === '[object RegExp]'
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Check if val is a valid array index.
|
80 |
+
*/
|
81 |
+
function isValidArrayIndex (val) {
|
82 |
+
var n = parseFloat(String(val));
|
83 |
+
return n >= 0 && Math.floor(n) === n && isFinite(val)
|
84 |
+
}
|
85 |
+
|
86 |
+
function isPromise (val) {
|
87 |
+
return (
|
88 |
+
isDef(val) &&
|
89 |
+
typeof val.then === 'function' &&
|
90 |
+
typeof val.catch === 'function'
|
91 |
+
)
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Convert a value to a string that is actually rendered.
|
96 |
+
*/
|
97 |
+
function toString (val) {
|
98 |
+
return val == null
|
99 |
+
? ''
|
100 |
+
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
|
101 |
+
? JSON.stringify(val, null, 2)
|
102 |
+
: String(val)
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Convert an input value to a number for persistence.
|
107 |
+
* If the conversion fails, return original string.
|
108 |
+
*/
|
109 |
+
function toNumber (val) {
|
110 |
+
var n = parseFloat(val);
|
111 |
+
return isNaN(n) ? val : n
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Make a map and return a function for checking if a key
|
116 |
+
* is in that map.
|
117 |
+
*/
|
118 |
+
function makeMap (
|
119 |
+
str,
|
120 |
+
expectsLowerCase
|
121 |
+
) {
|
122 |
+
var map = Object.create(null);
|
123 |
+
var list = str.split(',');
|
124 |
+
for (var i = 0; i < list.length; i++) {
|
125 |
+
map[list[i]] = true;
|
126 |
+
}
|
127 |
+
return expectsLowerCase
|
128 |
+
? function (val) { return map[val.toLowerCase()]; }
|
129 |
+
: function (val) { return map[val]; }
|
130 |
+
}
|
131 |
+
|
132 |
+
/**
|
133 |
+
* Check if a tag is a built-in tag.
|
134 |
+
*/
|
135 |
+
var isBuiltInTag = makeMap('slot,component', true);
|
136 |
+
|
137 |
+
/**
|
138 |
+
* Check if an attribute is a reserved attribute.
|
139 |
+
*/
|
140 |
+
var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
|
141 |
+
|
142 |
+
/**
|
143 |
+
* Remove an item from an array.
|
144 |
+
*/
|
145 |
+
function remove (arr, item) {
|
146 |
+
if (arr.length) {
|
147 |
+
var index = arr.indexOf(item);
|
148 |
+
if (index > -1) {
|
149 |
+
return arr.splice(index, 1)
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Check whether an object has the property.
|
156 |
+
*/
|
157 |
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
158 |
+
function hasOwn (obj, key) {
|
159 |
+
return hasOwnProperty.call(obj, key)
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Create a cached version of a pure function.
|
164 |
+
*/
|
165 |
+
function cached (fn) {
|
166 |
+
var cache = Object.create(null);
|
167 |
+
return (function cachedFn (str) {
|
168 |
+
var hit = cache[str];
|
169 |
+
return hit || (cache[str] = fn(str))
|
170 |
+
})
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Camelize a hyphen-delimited string.
|
175 |
+
*/
|
176 |
+
var camelizeRE = /-(\w)/g;
|
177 |
+
var camelize = cached(function (str) {
|
178 |
+
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
|
179 |
+
});
|
180 |
+
|
181 |
+
/**
|
182 |
+
* Capitalize a string.
|
183 |
+
*/
|
184 |
+
var capitalize = cached(function (str) {
|
185 |
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
186 |
+
});
|
187 |
+
|
188 |
+
/**
|
189 |
+
* Hyphenate a camelCase string.
|
190 |
+
*/
|
191 |
+
var hyphenateRE = /\B([A-Z])/g;
|
192 |
+
var hyphenate = cached(function (str) {
|
193 |
+
return str.replace(hyphenateRE, '-$1').toLowerCase()
|
194 |
+
});
|
195 |
+
|
196 |
+
/**
|
197 |
+
* Simple bind polyfill for environments that do not support it,
|
198 |
+
* e.g., PhantomJS 1.x. Technically, we don't need this anymore
|
199 |
+
* since native bind is now performant enough in most browsers.
|
200 |
+
* But removing it would mean breaking code that was able to run in
|
201 |
+
* PhantomJS 1.x, so this must be kept for backward compatibility.
|
202 |
+
*/
|
203 |
+
|
204 |
+
/* istanbul ignore next */
|
205 |
+
function polyfillBind (fn, ctx) {
|
206 |
+
function boundFn (a) {
|
207 |
+
var l = arguments.length;
|
208 |
+
return l
|
209 |
+
? l > 1
|
210 |
+
? fn.apply(ctx, arguments)
|
211 |
+
: fn.call(ctx, a)
|
212 |
+
: fn.call(ctx)
|
213 |
+
}
|
214 |
+
|
215 |
+
boundFn._length = fn.length;
|
216 |
+
return boundFn
|
217 |
+
}
|
218 |
+
|
219 |
+
function nativeBind (fn, ctx) {
|
220 |
+
return fn.bind(ctx)
|
221 |
+
}
|
222 |
+
|
223 |
+
var bind = Function.prototype.bind
|
224 |
+
? nativeBind
|
225 |
+
: polyfillBind;
|
226 |
+
|
227 |
+
/**
|
228 |
+
* Convert an Array-like object to a real Array.
|
229 |
+
*/
|
230 |
+
function toArray (list, start) {
|
231 |
+
start = start || 0;
|
232 |
+
var i = list.length - start;
|
233 |
+
var ret = new Array(i);
|
234 |
+
while (i--) {
|
235 |
+
ret[i] = list[i + start];
|
236 |
+
}
|
237 |
+
return ret
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Mix properties into target object.
|
242 |
+
*/
|
243 |
+
function extend (to, _from) {
|
244 |
+
for (var key in _from) {
|
245 |
+
to[key] = _from[key];
|
246 |
+
}
|
247 |
+
return to
|
248 |
+
}
|
249 |
+
|
250 |
+
/**
|
251 |
+
* Merge an Array of Objects into a single Object.
|
252 |
+
*/
|
253 |
+
function toObject (arr) {
|
254 |
+
var res = {};
|
255 |
+
for (var i = 0; i < arr.length; i++) {
|
256 |
+
if (arr[i]) {
|
257 |
+
extend(res, arr[i]);
|
258 |
+
}
|
259 |
+
}
|
260 |
+
return res
|
261 |
+
}
|
262 |
+
|
263 |
+
/* eslint-disable no-unused-vars */
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Perform no operation.
|
267 |
+
* Stubbing args to make Flow happy without leaving useless transpiled code
|
268 |
+
* with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
|
269 |
+
*/
|
270 |
+
function noop (a, b, c) {}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Always return false.
|
274 |
+
*/
|
275 |
+
var no = function (a, b, c) { return false; };
|
276 |
+
|
277 |
+
/* eslint-enable no-unused-vars */
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Return the same value.
|
281 |
+
*/
|
282 |
+
var identity = function (_) { return _; };
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Generate a string containing static keys from compiler modules.
|
286 |
+
*/
|
287 |
+
function genStaticKeys (modules) {
|
288 |
+
return modules.reduce(function (keys, m) {
|
289 |
+
return keys.concat(m.staticKeys || [])
|
290 |
+
}, []).join(',')
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Check if two values are loosely equal - that is,
|
295 |
+
* if they are plain objects, do they have the same shape?
|
296 |
+
*/
|
297 |
+
function looseEqual (a, b) {
|
298 |
+
if (a === b) { return true }
|
299 |
+
var isObjectA = isObject(a);
|
300 |
+
var isObjectB = isObject(b);
|
301 |
+
if (isObjectA && isObjectB) {
|
302 |
+
try {
|
303 |
+
var isArrayA = Array.isArray(a);
|
304 |
+
var isArrayB = Array.isArray(b);
|
305 |
+
if (isArrayA && isArrayB) {
|
306 |
+
return a.length === b.length && a.every(function (e, i) {
|
307 |
+
return looseEqual(e, b[i])
|
308 |
+
})
|
309 |
+
} else if (a instanceof Date && b instanceof Date) {
|
310 |
+
return a.getTime() === b.getTime()
|
311 |
+
} else if (!isArrayA && !isArrayB) {
|
312 |
+
var keysA = Object.keys(a);
|
313 |
+
var keysB = Object.keys(b);
|
314 |
+
return keysA.length === keysB.length && keysA.every(function (key) {
|
315 |
+
return looseEqual(a[key], b[key])
|
316 |
+
})
|
317 |
+
} else {
|
318 |
+
/* istanbul ignore next */
|
319 |
+
return false
|
320 |
+
}
|
321 |
+
} catch (e) {
|
322 |
+
/* istanbul ignore next */
|
323 |
+
return false
|
324 |
+
}
|
325 |
+
} else if (!isObjectA && !isObjectB) {
|
326 |
+
return String(a) === String(b)
|
327 |
+
} else {
|
328 |
+
return false
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Return the first index at which a loosely equal value can be
|
334 |
+
* found in the array (if value is a plain object, the array must
|
335 |
+
* contain an object of the same shape), or -1 if it is not present.
|
336 |
+
*/
|
337 |
+
function looseIndexOf (arr, val) {
|
338 |
+
for (var i = 0; i < arr.length; i++) {
|
339 |
+
if (looseEqual(arr[i], val)) { return i }
|
340 |
+
}
|
341 |
+
return -1
|
342 |
+
}
|
343 |
+
|
344 |
+
/**
|
345 |
+
* Ensure a function is called only once.
|
346 |
+
*/
|
347 |
+
function once (fn) {
|
348 |
+
var called = false;
|
349 |
+
return function () {
|
350 |
+
if (!called) {
|
351 |
+
called = true;
|
352 |
+
fn.apply(this, arguments);
|
353 |
+
}
|
354 |
+
}
|
355 |
+
}
|
356 |
+
|
357 |
+
var SSR_ATTR = 'data-server-rendered';
|
358 |
+
|
359 |
+
var ASSET_TYPES = [
|
360 |
+
'component',
|
361 |
+
'directive',
|
362 |
+
'filter'
|
363 |
+
];
|
364 |
+
|
365 |
+
var LIFECYCLE_HOOKS = [
|
366 |
+
'beforeCreate',
|
367 |
+
'created',
|
368 |
+
'beforeMount',
|
369 |
+
'mounted',
|
370 |
+
'beforeUpdate',
|
371 |
+
'updated',
|
372 |
+
'beforeDestroy',
|
373 |
+
'destroyed',
|
374 |
+
'activated',
|
375 |
+
'deactivated',
|
376 |
+
'errorCaptured',
|
377 |
+
'serverPrefetch'
|
378 |
+
];
|
379 |
+
|
380 |
+
/* */
|
381 |
+
|
382 |
+
|
383 |
+
|
384 |
+
var config = ({
|
385 |
+
/**
|
386 |
+
* Option merge strategies (used in core/util/options)
|
387 |
+
*/
|
388 |
+
// $flow-disable-line
|
389 |
+
optionMergeStrategies: Object.create(null),
|
390 |
+
|
391 |
+
/**
|
392 |
+
* Whether to suppress warnings.
|
393 |
+
*/
|
394 |
+
silent: false,
|
395 |
+
|
396 |
+
/**
|
397 |
+
* Show production mode tip message on boot?
|
398 |
+
*/
|
399 |
+
productionTip: "development" !== 'production',
|
400 |
+
|
401 |
+
/**
|
402 |
+
* Whether to enable devtools
|
403 |
+
*/
|
404 |
+
devtools: "development" !== 'production',
|
405 |
+
|
406 |
+
/**
|
407 |
+
* Whether to record perf
|
408 |
+
*/
|
409 |
+
performance: false,
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Error handler for watcher errors
|
413 |
+
*/
|
414 |
+
errorHandler: null,
|
415 |
+
|
416 |
+
/**
|
417 |
+
* Warn handler for watcher warns
|
418 |
+
*/
|
419 |
+
warnHandler: null,
|
420 |
+
|
421 |
+
/**
|
422 |
+
* Ignore certain custom elements
|
423 |
+
*/
|
424 |
+
ignoredElements: [],
|
425 |
+
|
426 |
+
/**
|
427 |
+
* Custom user key aliases for v-on
|
428 |
+
*/
|
429 |
+
// $flow-disable-line
|
430 |
+
keyCodes: Object.create(null),
|
431 |
+
|
432 |
+
/**
|
433 |
+
* Check if a tag is reserved so that it cannot be registered as a
|
434 |
+
* component. This is platform-dependent and may be overwritten.
|
435 |
+
*/
|
436 |
+
isReservedTag: no,
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Check if an attribute is reserved so that it cannot be used as a component
|
440 |
+
* prop. This is platform-dependent and may be overwritten.
|
441 |
+
*/
|
442 |
+
isReservedAttr: no,
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Check if a tag is an unknown element.
|
446 |
+
* Platform-dependent.
|
447 |
+
*/
|
448 |
+
isUnknownElement: no,
|
449 |
+
|
450 |
+
/**
|
451 |
+
* Get the namespace of an element
|
452 |
+
*/
|
453 |
+
getTagNamespace: noop,
|
454 |
+
|
455 |
+
/**
|
456 |
+
* Parse the real tag name for the specific platform.
|
457 |
+
*/
|
458 |
+
parsePlatformTagName: identity,
|
459 |
+
|
460 |
+
/**
|
461 |
+
* Check if an attribute must be bound using property, e.g. value
|
462 |
+
* Platform-dependent.
|
463 |
+
*/
|
464 |
+
mustUseProp: no,
|
465 |
+
|
466 |
+
/**
|
467 |
+
* Perform updates asynchronously. Intended to be used by Vue Test Utils
|
468 |
+
* This will significantly reduce performance if set to false.
|
469 |
+
*/
|
470 |
+
async: true,
|
471 |
+
|
472 |
+
/**
|
473 |
+
* Exposed for legacy reasons
|
474 |
+
*/
|
475 |
+
_lifecycleHooks: LIFECYCLE_HOOKS
|
476 |
+
});
|
477 |
+
|
478 |
+
/* */
|
479 |
+
|
480 |
+
/**
|
481 |
+
* unicode letters used for parsing html tags, component names and property paths.
|
482 |
+
* using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
|
483 |
+
* skipping \u10000-\uEFFFF due to it freezing up PhantomJS
|
484 |
+
*/
|
485 |
+
var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Check if a string starts with $ or _
|
489 |
+
*/
|
490 |
+
function isReserved (str) {
|
491 |
+
var c = (str + '').charCodeAt(0);
|
492 |
+
return c === 0x24 || c === 0x5F
|
493 |
+
}
|
494 |
+
|
495 |
+
/**
|
496 |
+
* Define a property.
|
497 |
+
*/
|
498 |
+
function def (obj, key, val, enumerable) {
|
499 |
+
Object.defineProperty(obj, key, {
|
500 |
+
value: val,
|
501 |
+
enumerable: !!enumerable,
|
502 |
+
writable: true,
|
503 |
+
configurable: true
|
504 |
+
});
|
505 |
+
}
|
506 |
+
|
507 |
+
/**
|
508 |
+
* Parse simple path.
|
509 |
+
*/
|
510 |
+
var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
|
511 |
+
function parsePath (path) {
|
512 |
+
if (bailRE.test(path)) {
|
513 |
+
return
|
514 |
+
}
|
515 |
+
var segments = path.split('.');
|
516 |
+
return function (obj) {
|
517 |
+
for (var i = 0; i < segments.length; i++) {
|
518 |
+
if (!obj) { return }
|
519 |
+
obj = obj[segments[i]];
|
520 |
+
}
|
521 |
+
return obj
|
522 |
+
}
|
523 |
+
}
|
524 |
+
|
525 |
+
/* */
|
526 |
+
|
527 |
+
// can we use __proto__?
|
528 |
+
var hasProto = '__proto__' in {};
|
529 |
+
|
530 |
+
// Browser environment sniffing
|
531 |
+
var inBrowser = typeof window !== 'undefined';
|
532 |
+
var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
|
533 |
+
var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
|
534 |
+
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
|
535 |
+
var isIE = UA && /msie|trident/.test(UA);
|
536 |
+
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
|
537 |
+
var isEdge = UA && UA.indexOf('edge/') > 0;
|
538 |
+
var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
|
539 |
+
var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
|
540 |
+
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
|
541 |
+
var isPhantomJS = UA && /phantomjs/.test(UA);
|
542 |
+
var isFF = UA && UA.match(/firefox\/(\d+)/);
|
543 |
+
|
544 |
+
// Firefox has a "watch" function on Object.prototype...
|
545 |
+
var nativeWatch = ({}).watch;
|
546 |
+
|
547 |
+
var supportsPassive = false;
|
548 |
+
if (inBrowser) {
|
549 |
+
try {
|
550 |
+
var opts = {};
|
551 |
+
Object.defineProperty(opts, 'passive', ({
|
552 |
+
get: function get () {
|
553 |
+
/* istanbul ignore next */
|
554 |
+
supportsPassive = true;
|
555 |
+
}
|
556 |
+
})); // https://github.com/facebook/flow/issues/285
|
557 |
+
window.addEventListener('test-passive', null, opts);
|
558 |
+
} catch (e) {}
|
559 |
+
}
|
560 |
+
|
561 |
+
// this needs to be lazy-evaled because vue may be required before
|
562 |
+
// vue-server-renderer can set VUE_ENV
|
563 |
+
var _isServer;
|
564 |
+
var isServerRendering = function () {
|
565 |
+
if (_isServer === undefined) {
|
566 |
+
/* istanbul ignore if */
|
567 |
+
if (!inBrowser && !inWeex && typeof global !== 'undefined') {
|
568 |
+
// detect presence of vue-server-renderer and avoid
|
569 |
+
// Webpack shimming the process
|
570 |
+
_isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
|
571 |
+
} else {
|
572 |
+
_isServer = false;
|
573 |
+
}
|
574 |
+
}
|
575 |
+
return _isServer
|
576 |
+
};
|
577 |
+
|
578 |
+
// detect devtools
|
579 |
+
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
580 |
+
|
581 |
+
/* istanbul ignore next */
|
582 |
+
function isNative (Ctor) {
|
583 |
+
return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
|
584 |
+
}
|
585 |
+
|
586 |
+
var hasSymbol =
|
587 |
+
typeof Symbol !== 'undefined' && isNative(Symbol) &&
|
588 |
+
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
|
589 |
+
|
590 |
+
var _Set;
|
591 |
+
/* istanbul ignore if */ // $flow-disable-line
|
592 |
+
if (typeof Set !== 'undefined' && isNative(Set)) {
|
593 |
+
// use native Set when available.
|
594 |
+
_Set = Set;
|
595 |
+
} else {
|
596 |
+
// a non-standard Set polyfill that only works with primitive keys.
|
597 |
+
_Set = /*@__PURE__*/(function () {
|
598 |
+
function Set () {
|
599 |
+
this.set = Object.create(null);
|
600 |
+
}
|
601 |
+
Set.prototype.has = function has (key) {
|
602 |
+
return this.set[key] === true
|
603 |
+
};
|
604 |
+
Set.prototype.add = function add (key) {
|
605 |
+
this.set[key] = true;
|
606 |
+
};
|
607 |
+
Set.prototype.clear = function clear () {
|
608 |
+
this.set = Object.create(null);
|
609 |
+
};
|
610 |
+
|
611 |
+
return Set;
|
612 |
+
}());
|
613 |
+
}
|
614 |
+
|
615 |
+
/* */
|
616 |
+
|
617 |
+
var warn = noop;
|
618 |
+
var tip = noop;
|
619 |
+
var generateComponentTrace = (noop); // work around flow check
|
620 |
+
var formatComponentName = (noop);
|
621 |
+
|
622 |
+
{
|
623 |
+
var hasConsole = typeof console !== 'undefined';
|
624 |
+
var classifyRE = /(?:^|[-_])(\w)/g;
|
625 |
+
var classify = function (str) { return str
|
626 |
+
.replace(classifyRE, function (c) { return c.toUpperCase(); })
|
627 |
+
.replace(/[-_]/g, ''); };
|
628 |
+
|
629 |
+
warn = function (msg, vm) {
|
630 |
+
var trace = vm ? generateComponentTrace(vm) : '';
|
631 |
+
|
632 |
+
if (config.warnHandler) {
|
633 |
+
config.warnHandler.call(null, msg, vm, trace);
|
634 |
+
} else if (hasConsole && (!config.silent)) {
|
635 |
+
console.error(("[Vue warn]: " + msg + trace));
|
636 |
+
}
|
637 |
+
};
|
638 |
+
|
639 |
+
tip = function (msg, vm) {
|
640 |
+
if (hasConsole && (!config.silent)) {
|
641 |
+
console.warn("[Vue tip]: " + msg + (
|
642 |
+
vm ? generateComponentTrace(vm) : ''
|
643 |
+
));
|
644 |
+
}
|
645 |
+
};
|
646 |
+
|
647 |
+
formatComponentName = function (vm, includeFile) {
|
648 |
+
if (vm.$root === vm) {
|
649 |
+
return '<Root>'
|
650 |
+
}
|
651 |
+
var options = typeof vm === 'function' && vm.cid != null
|
652 |
+
? vm.options
|
653 |
+
: vm._isVue
|
654 |
+
? vm.$options || vm.constructor.options
|
655 |
+
: vm;
|
656 |
+
var name = options.name || options._componentTag;
|
657 |
+
var file = options.__file;
|
658 |
+
if (!name && file) {
|
659 |
+
var match = file.match(/([^/\\]+)\.vue$/);
|
660 |
+
name = match && match[1];
|
661 |
+
}
|
662 |
+
|
663 |
+
return (
|
664 |
+
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
|
665 |
+
(file && includeFile !== false ? (" at " + file) : '')
|
666 |
+
)
|
667 |
+
};
|
668 |
+
|
669 |
+
var repeat = function (str, n) {
|
670 |
+
var res = '';
|
671 |
+
while (n) {
|
672 |
+
if (n % 2 === 1) { res += str; }
|
673 |
+
if (n > 1) { str += str; }
|
674 |
+
n >>= 1;
|
675 |
+
}
|
676 |
+
return res
|
677 |
+
};
|
678 |
+
|
679 |
+
generateComponentTrace = function (vm) {
|
680 |
+
if (vm._isVue && vm.$parent) {
|
681 |
+
var tree = [];
|
682 |
+
var currentRecursiveSequence = 0;
|
683 |
+
while (vm) {
|
684 |
+
if (tree.length > 0) {
|
685 |
+
var last = tree[tree.length - 1];
|
686 |
+
if (last.constructor === vm.constructor) {
|
687 |
+
currentRecursiveSequence++;
|
688 |
+
vm = vm.$parent;
|
689 |
+
continue
|
690 |
+
} else if (currentRecursiveSequence > 0) {
|
691 |
+
tree[tree.length - 1] = [last, currentRecursiveSequence];
|
692 |
+
currentRecursiveSequence = 0;
|
693 |
+
}
|
694 |
+
}
|
695 |
+
tree.push(vm);
|
696 |
+
vm = vm.$parent;
|
697 |
+
}
|
698 |
+
return '\n\nfound in\n\n' + tree
|
699 |
+
.map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
|
700 |
+
? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
|
701 |
+
: formatComponentName(vm))); })
|
702 |
+
.join('\n')
|
703 |
+
} else {
|
704 |
+
return ("\n\n(found in " + (formatComponentName(vm)) + ")")
|
705 |
+
}
|
706 |
+
};
|
707 |
+
}
|
708 |
+
|
709 |
+
/* */
|
710 |
+
|
711 |
+
var uid = 0;
|
712 |
+
|
713 |
+
/**
|
714 |
+
* A dep is an observable that can have multiple
|
715 |
+
* directives subscribing to it.
|
716 |
+
*/
|
717 |
+
var Dep = function Dep () {
|
718 |
+
this.id = uid++;
|
719 |
+
this.subs = [];
|
720 |
+
};
|
721 |
+
|
722 |
+
Dep.prototype.addSub = function addSub (sub) {
|
723 |
+
this.subs.push(sub);
|
724 |
+
};
|
725 |
+
|
726 |
+
Dep.prototype.removeSub = function removeSub (sub) {
|
727 |
+
remove(this.subs, sub);
|
728 |
+
};
|
729 |
+
|
730 |
+
Dep.prototype.depend = function depend () {
|
731 |
+
if (Dep.target) {
|
732 |
+
Dep.target.addDep(this);
|
733 |
+
}
|
734 |
+
};
|
735 |
+
|
736 |
+
Dep.prototype.notify = function notify () {
|
737 |
+
// stabilize the subscriber list first
|
738 |
+
var subs = this.subs.slice();
|
739 |
+
if (!config.async) {
|
740 |
+
// subs aren't sorted in scheduler if not running async
|
741 |
+
// we need to sort them now to make sure they fire in correct
|
742 |
+
// order
|
743 |
+
subs.sort(function (a, b) { return a.id - b.id; });
|
744 |
+
}
|
745 |
+
for (var i = 0, l = subs.length; i < l; i++) {
|
746 |
+
subs[i].update();
|
747 |
+
}
|
748 |
+
};
|
749 |
+
|
750 |
+
// The current target watcher being evaluated.
|
751 |
+
// This is globally unique because only one watcher
|
752 |
+
// can be evaluated at a time.
|
753 |
+
Dep.target = null;
|
754 |
+
var targetStack = [];
|
755 |
+
|
756 |
+
function pushTarget (target) {
|
757 |
+
targetStack.push(target);
|
758 |
+
Dep.target = target;
|
759 |
+
}
|
760 |
+
|
761 |
+
function popTarget () {
|
762 |
+
targetStack.pop();
|
763 |
+
Dep.target = targetStack[targetStack.length - 1];
|
764 |
+
}
|
765 |
+
|
766 |
+
/* */
|
767 |
+
|
768 |
+
var VNode = function VNode (
|
769 |
+
tag,
|
770 |
+
data,
|
771 |
+
children,
|
772 |
+
text,
|
773 |
+
elm,
|
774 |
+
context,
|
775 |
+
componentOptions,
|
776 |
+
asyncFactory
|
777 |
+
) {
|
778 |
+
this.tag = tag;
|
779 |
+
this.data = data;
|
780 |
+
this.children = children;
|
781 |
+
this.text = text;
|
782 |
+
this.elm = elm;
|
783 |
+
this.ns = undefined;
|
784 |
+
this.context = context;
|
785 |
+
this.fnContext = undefined;
|
786 |
+
this.fnOptions = undefined;
|
787 |
+
this.fnScopeId = undefined;
|
788 |
+
this.key = data && data.key;
|
789 |
+
this.componentOptions = componentOptions;
|
790 |
+
this.componentInstance = undefined;
|
791 |
+
this.parent = undefined;
|
792 |
+
this.raw = false;
|
793 |
+
this.isStatic = false;
|
794 |
+
this.isRootInsert = true;
|
795 |
+
this.isComment = false;
|
796 |
+
this.isCloned = false;
|
797 |
+
this.isOnce = false;
|
798 |
+
this.asyncFactory = asyncFactory;
|
799 |
+
this.asyncMeta = undefined;
|
800 |
+
this.isAsyncPlaceholder = false;
|
801 |
+
};
|
802 |
+
|
803 |
+
var prototypeAccessors = { child: { configurable: true } };
|
804 |
+
|
805 |
+
// DEPRECATED: alias for componentInstance for backwards compat.
|
806 |
+
/* istanbul ignore next */
|
807 |
+
prototypeAccessors.child.get = function () {
|
808 |
+
return this.componentInstance
|
809 |
+
};
|
810 |
+
|
811 |
+
Object.defineProperties( VNode.prototype, prototypeAccessors );
|
812 |
+
|
813 |
+
var createEmptyVNode = function (text) {
|
814 |
+
if ( text === void 0 ) text = '';
|
815 |
+
|
816 |
+
var node = new VNode();
|
817 |
+
node.text = text;
|
818 |
+
node.isComment = true;
|
819 |
+
return node
|
820 |
+
};
|
821 |
+
|
822 |
+
function createTextVNode (val) {
|
823 |
+
return new VNode(undefined, undefined, undefined, String(val))
|
824 |
+
}
|
825 |
+
|
826 |
+
// optimized shallow clone
|
827 |
+
// used for static nodes and slot nodes because they may be reused across
|
828 |
+
// multiple renders, cloning them avoids errors when DOM manipulations rely
|
829 |
+
// on their elm reference.
|
830 |
+
function cloneVNode (vnode) {
|
831 |
+
var cloned = new VNode(
|
832 |
+
vnode.tag,
|
833 |
+
vnode.data,
|
834 |
+
// #7975
|
835 |
+
// clone children array to avoid mutating original in case of cloning
|
836 |
+
// a child.
|
837 |
+
vnode.children && vnode.children.slice(),
|
838 |
+
vnode.text,
|
839 |
+
vnode.elm,
|
840 |
+
vnode.context,
|
841 |
+
vnode.componentOptions,
|
842 |
+
vnode.asyncFactory
|
843 |
+
);
|
844 |
+
cloned.ns = vnode.ns;
|
845 |
+
cloned.isStatic = vnode.isStatic;
|
846 |
+
cloned.key = vnode.key;
|
847 |
+
cloned.isComment = vnode.isComment;
|
848 |
+
cloned.fnContext = vnode.fnContext;
|
849 |
+
cloned.fnOptions = vnode.fnOptions;
|
850 |
+
cloned.fnScopeId = vnode.fnScopeId;
|
851 |
+
cloned.asyncMeta = vnode.asyncMeta;
|
852 |
+
cloned.isCloned = true;
|
853 |
+
return cloned
|
854 |
+
}
|
855 |
+
|
856 |
+
/*
|
857 |
+
* not type checking this file because flow doesn't play well with
|
858 |
+
* dynamically accessing methods on Array prototype
|
859 |
+
*/
|
860 |
+
|
861 |
+
var arrayProto = Array.prototype;
|
862 |
+
var arrayMethods = Object.create(arrayProto);
|
863 |
+
|
864 |
+
var methodsToPatch = [
|
865 |
+
'push',
|
866 |
+
'pop',
|
867 |
+
'shift',
|
868 |
+
'unshift',
|
869 |
+
'splice',
|
870 |
+
'sort',
|
871 |
+
'reverse'
|
872 |
+
];
|
873 |
+
|
874 |
+
/**
|
875 |
+
* Intercept mutating methods and emit events
|
876 |
+
*/
|
877 |
+
methodsToPatch.forEach(function (method) {
|
878 |
+
// cache original method
|
879 |
+
var original = arrayProto[method];
|
880 |
+
def(arrayMethods, method, function mutator () {
|
881 |
+
var args = [], len = arguments.length;
|
882 |
+
while ( len-- ) args[ len ] = arguments[ len ];
|
883 |
+
|
884 |
+
var result = original.apply(this, args);
|
885 |
+
var ob = this.__ob__;
|
886 |
+
var inserted;
|
887 |
+
switch (method) {
|
888 |
+
case 'push':
|
889 |
+
case 'unshift':
|
890 |
+
inserted = args;
|
891 |
+
break
|
892 |
+
case 'splice':
|
893 |
+
inserted = args.slice(2);
|
894 |
+
break
|
895 |
+
}
|
896 |
+
if (inserted) { ob.observeArray(inserted); }
|
897 |
+
// notify change
|
898 |
+
ob.dep.notify();
|
899 |
+
return result
|
900 |
+
});
|
901 |
+
});
|
902 |
+
|
903 |
+
/* */
|
904 |
+
|
905 |
+
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
|
906 |
+
|
907 |
+
/**
|
908 |
+
* In some cases we may want to disable observation inside a component's
|
909 |
+
* update computation.
|
910 |
+
*/
|
911 |
+
var shouldObserve = true;
|
912 |
+
|
913 |
+
function toggleObserving (value) {
|
914 |
+
shouldObserve = value;
|
915 |
+
}
|
916 |
+
|
917 |
+
/**
|
918 |
+
* Observer class that is attached to each observed
|
919 |
+
* object. Once attached, the observer converts the target
|
920 |
+
* object's property keys into getter/setters that
|
921 |
+
* collect dependencies and dispatch updates.
|
922 |
+
*/
|
923 |
+
var Observer = function Observer (value) {
|
924 |
+
this.value = value;
|
925 |
+
this.dep = new Dep();
|
926 |
+
this.vmCount = 0;
|
927 |
+
def(value, '__ob__', this);
|
928 |
+
if (Array.isArray(value)) {
|
929 |
+
if (hasProto) {
|
930 |
+
protoAugment(value, arrayMethods);
|
931 |
+
} else {
|
932 |
+
copyAugment(value, arrayMethods, arrayKeys);
|
933 |
+
}
|
934 |
+
this.observeArray(value);
|
935 |
+
} else {
|
936 |
+
this.walk(value);
|
937 |
+
}
|
938 |
+
};
|
939 |
+
|
940 |
+
/**
|
941 |
+
* Walk through all properties and convert them into
|
942 |
+
* getter/setters. This method should only be called when
|
943 |
+
* value type is Object.
|
944 |
+
*/
|
945 |
+
Observer.prototype.walk = function walk (obj) {
|
946 |
+
var keys = Object.keys(obj);
|
947 |
+
for (var i = 0; i < keys.length; i++) {
|
948 |
+
defineReactive$$1(obj, keys[i]);
|
949 |
+
}
|
950 |
+
};
|
951 |
+
|
952 |
+
/**
|
953 |
+
* Observe a list of Array items.
|
954 |
+
*/
|
955 |
+
Observer.prototype.observeArray = function observeArray (items) {
|
956 |
+
for (var i = 0, l = items.length; i < l; i++) {
|
957 |
+
observe(items[i]);
|
958 |
+
}
|
959 |
+
};
|
960 |
+
|
961 |
+
// helpers
|
962 |
+
|
963 |
+
/**
|
964 |
+
* Augment a target Object or Array by intercepting
|
965 |
+
* the prototype chain using __proto__
|
966 |
+
*/
|
967 |
+
function protoAugment (target, src) {
|
968 |
+
/* eslint-disable no-proto */
|
969 |
+
target.__proto__ = src;
|
970 |
+
/* eslint-enable no-proto */
|
971 |
+
}
|
972 |
+
|
973 |
+
/**
|
974 |
+
* Augment a target Object or Array by defining
|
975 |
+
* hidden properties.
|
976 |
+
*/
|
977 |
+
/* istanbul ignore next */
|
978 |
+
function copyAugment (target, src, keys) {
|
979 |
+
for (var i = 0, l = keys.length; i < l; i++) {
|
980 |
+
var key = keys[i];
|
981 |
+
def(target, key, src[key]);
|
982 |
+
}
|
983 |
+
}
|
984 |
+
|
985 |
+
/**
|
986 |
+
* Attempt to create an observer instance for a value,
|
987 |
+
* returns the new observer if successfully observed,
|
988 |
+
* or the existing observer if the value already has one.
|
989 |
+
*/
|
990 |
+
function observe (value, asRootData) {
|
991 |
+
if (!isObject(value) || value instanceof VNode) {
|
992 |
+
return
|
993 |
+
}
|
994 |
+
var ob;
|
995 |
+
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
|
996 |
+
ob = value.__ob__;
|
997 |
+
} else if (
|
998 |
+
shouldObserve &&
|
999 |
+
!isServerRendering() &&
|
1000 |
+
(Array.isArray(value) || isPlainObject(value)) &&
|
1001 |
+
Object.isExtensible(value) &&
|
1002 |
+
!value._isVue
|
1003 |
+
) {
|
1004 |
+
ob = new Observer(value);
|
1005 |
+
}
|
1006 |
+
if (asRootData && ob) {
|
1007 |
+
ob.vmCount++;
|
1008 |
+
}
|
1009 |
+
return ob
|
1010 |
+
}
|
1011 |
+
|
1012 |
+
/**
|
1013 |
+
* Define a reactive property on an Object.
|
1014 |
+
*/
|
1015 |
+
function defineReactive$$1 (
|
1016 |
+
obj,
|
1017 |
+
key,
|
1018 |
+
val,
|
1019 |
+
customSetter,
|
1020 |
+
shallow
|
1021 |
+
) {
|
1022 |
+
var dep = new Dep();
|
1023 |
+
|
1024 |
+
var property = Object.getOwnPropertyDescriptor(obj, key);
|
1025 |
+
if (property && property.configurable === false) {
|
1026 |
+
return
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
// cater for pre-defined getter/setters
|
1030 |
+
var getter = property && property.get;
|
1031 |
+
var setter = property && property.set;
|
1032 |
+
if ((!getter || setter) && arguments.length === 2) {
|
1033 |
+
val = obj[key];
|
1034 |
+
}
|
1035 |
+
|
1036 |
+
var childOb = !shallow && observe(val);
|
1037 |
+
Object.defineProperty(obj, key, {
|
1038 |
+
enumerable: true,
|
1039 |
+
configurable: true,
|
1040 |
+
get: function reactiveGetter () {
|
1041 |
+
var value = getter ? getter.call(obj) : val;
|
1042 |
+
if (Dep.target) {
|
1043 |
+
dep.depend();
|
1044 |
+
if (childOb) {
|
1045 |
+
childOb.dep.depend();
|
1046 |
+
if (Array.isArray(value)) {
|
1047 |
+
dependArray(value);
|
1048 |
+
}
|
1049 |
+
}
|
1050 |
+
}
|
1051 |
+
return value
|
1052 |
+
},
|
1053 |
+
set: function reactiveSetter (newVal) {
|
1054 |
+
var value = getter ? getter.call(obj) : val;
|
1055 |
+
/* eslint-disable no-self-compare */
|
1056 |
+
if (newVal === value || (newVal !== newVal && value !== value)) {
|
1057 |
+
return
|
1058 |
+
}
|
1059 |
+
/* eslint-enable no-self-compare */
|
1060 |
+
if (customSetter) {
|
1061 |
+
customSetter();
|
1062 |
+
}
|
1063 |
+
// #7981: for accessor properties without setter
|
1064 |
+
if (getter && !setter) { return }
|
1065 |
+
if (setter) {
|
1066 |
+
setter.call(obj, newVal);
|
1067 |
+
} else {
|
1068 |
+
val = newVal;
|
1069 |
+
}
|
1070 |
+
childOb = !shallow && observe(newVal);
|
1071 |
+
dep.notify();
|
1072 |
+
}
|
1073 |
+
});
|
1074 |
+
}
|
1075 |
+
|
1076 |
+
/**
|
1077 |
+
* Set a property on an object. Adds the new property and
|
1078 |
+
* triggers change notification if the property doesn't
|
1079 |
+
* already exist.
|
1080 |
+
*/
|
1081 |
+
function set (target, key, val) {
|
1082 |
+
if (isUndef(target) || isPrimitive(target)
|
1083 |
+
) {
|
1084 |
+
warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
|
1085 |
+
}
|
1086 |
+
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1087 |
+
target.length = Math.max(target.length, key);
|
1088 |
+
target.splice(key, 1, val);
|
1089 |
+
return val
|
1090 |
+
}
|
1091 |
+
if (key in target && !(key in Object.prototype)) {
|
1092 |
+
target[key] = val;
|
1093 |
+
return val
|
1094 |
+
}
|
1095 |
+
var ob = (target).__ob__;
|
1096 |
+
if (target._isVue || (ob && ob.vmCount)) {
|
1097 |
+
warn(
|
1098 |
+
'Avoid adding reactive properties to a Vue instance or its root $data ' +
|
1099 |
+
'at runtime - declare it upfront in the data option.'
|
1100 |
+
);
|
1101 |
+
return val
|
1102 |
+
}
|
1103 |
+
if (!ob) {
|
1104 |
+
target[key] = val;
|
1105 |
+
return val
|
1106 |
+
}
|
1107 |
+
defineReactive$$1(ob.value, key, val);
|
1108 |
+
ob.dep.notify();
|
1109 |
+
return val
|
1110 |
+
}
|
1111 |
+
|
1112 |
+
/**
|
1113 |
+
* Delete a property and trigger change if necessary.
|
1114 |
+
*/
|
1115 |
+
function del (target, key) {
|
1116 |
+
if (isUndef(target) || isPrimitive(target)
|
1117 |
+
) {
|
1118 |
+
warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
|
1119 |
+
}
|
1120 |
+
if (Array.isArray(target) && isValidArrayIndex(key)) {
|
1121 |
+
target.splice(key, 1);
|
1122 |
+
return
|
1123 |
+
}
|
1124 |
+
var ob = (target).__ob__;
|
1125 |
+
if (target._isVue || (ob && ob.vmCount)) {
|
1126 |
+
warn(
|
1127 |
+
'Avoid deleting properties on a Vue instance or its root $data ' +
|
1128 |
+
'- just set it to null.'
|
1129 |
+
);
|
1130 |
+
return
|
1131 |
+
}
|
1132 |
+
if (!hasOwn(target, key)) {
|
1133 |
+
return
|
1134 |
+
}
|
1135 |
+
delete target[key];
|
1136 |
+
if (!ob) {
|
1137 |
+
return
|
1138 |
+
}
|
1139 |
+
ob.dep.notify();
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
/**
|
1143 |
+
* Collect dependencies on array elements when the array is touched, since
|
1144 |
+
* we cannot intercept array element access like property getters.
|
1145 |
+
*/
|
1146 |
+
function dependArray (value) {
|
1147 |
+
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
|
1148 |
+
e = value[i];
|
1149 |
+
e && e.__ob__ && e.__ob__.dep.depend();
|
1150 |
+
if (Array.isArray(e)) {
|
1151 |
+
dependArray(e);
|
1152 |
+
}
|
1153 |
+
}
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
/* */
|
1157 |
+
|
1158 |
+
/**
|
1159 |
+
* Option overwriting strategies are functions that handle
|
1160 |
+
* how to merge a parent option value and a child option
|
1161 |
+
* value into the final value.
|
1162 |
+
*/
|
1163 |
+
var strats = config.optionMergeStrategies;
|
1164 |
+
|
1165 |
+
/**
|
1166 |
+
* Options with restrictions
|
1167 |
+
*/
|
1168 |
+
{
|
1169 |
+
strats.el = strats.propsData = function (parent, child, vm, key) {
|
1170 |
+
if (!vm) {
|
1171 |
+
warn(
|
1172 |
+
"option \"" + key + "\" can only be used during instance " +
|
1173 |
+
'creation with the `new` keyword.'
|
1174 |
+
);
|
1175 |
+
}
|
1176 |
+
return defaultStrat(parent, child)
|
1177 |
+
};
|
1178 |
+
}
|
1179 |
+
|
1180 |
+
/**
|
1181 |
+
* Helper that recursively merges two data objects together.
|
1182 |
+
*/
|
1183 |
+
function mergeData (to, from) {
|
1184 |
+
if (!from) { return to }
|
1185 |
+
var key, toVal, fromVal;
|
1186 |
+
|
1187 |
+
var keys = hasSymbol
|
1188 |
+
? Reflect.ownKeys(from)
|
1189 |
+
: Object.keys(from);
|
1190 |
+
|
1191 |
+
for (var i = 0; i < keys.length; i++) {
|
1192 |
+
key = keys[i];
|
1193 |
+
// in case the object is already observed...
|
1194 |
+
if (key === '__ob__') { continue }
|
1195 |
+
toVal = to[key];
|
1196 |
+
fromVal = from[key];
|
1197 |
+
if (!hasOwn(to, key)) {
|
1198 |
+
set(to, key, fromVal);
|
1199 |
+
} else if (
|
1200 |
+
toVal !== fromVal &&
|
1201 |
+
isPlainObject(toVal) &&
|
1202 |
+
isPlainObject(fromVal)
|
1203 |
+
) {
|
1204 |
+
mergeData(toVal, fromVal);
|
1205 |
+
}
|
1206 |
+
}
|
1207 |
+
return to
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* Data
|
1212 |
+
*/
|
1213 |
+
function mergeDataOrFn (
|
1214 |
+
parentVal,
|
1215 |
+
childVal,
|
1216 |
+
vm
|
1217 |
+
) {
|
1218 |
+
if (!vm) {
|
1219 |
+
// in a Vue.extend merge, both should be functions
|
1220 |
+
if (!childVal) {
|
1221 |
+
return parentVal
|
1222 |
+
}
|
1223 |
+
if (!parentVal) {
|
1224 |
+
return childVal
|
1225 |
+
}
|
1226 |
+
// when parentVal & childVal are both present,
|
1227 |
+
// we need to return a function that returns the
|
1228 |
+
// merged result of both functions... no need to
|
1229 |
+
// check if parentVal is a function here because
|
1230 |
+
// it has to be a function to pass previous merges.
|
1231 |
+
return function mergedDataFn () {
|
1232 |
+
return mergeData(
|
1233 |
+
typeof childVal === 'function' ? childVal.call(this, this) : childVal,
|
1234 |
+
typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
|
1235 |
+
)
|
1236 |
+
}
|
1237 |
+
} else {
|
1238 |
+
return function mergedInstanceDataFn () {
|
1239 |
+
// instance merge
|
1240 |
+
var instanceData = typeof childVal === 'function'
|
1241 |
+
? childVal.call(vm, vm)
|
1242 |
+
: childVal;
|
1243 |
+
var defaultData = typeof parentVal === 'function'
|
1244 |
+
? parentVal.call(vm, vm)
|
1245 |
+
: parentVal;
|
1246 |
+
if (instanceData) {
|
1247 |
+
return mergeData(instanceData, defaultData)
|
1248 |
+
} else {
|
1249 |
+
return defaultData
|
1250 |
+
}
|
1251 |
+
}
|
1252 |
+
}
|
1253 |
+
}
|
1254 |
+
|
1255 |
+
strats.data = function (
|
1256 |
+
parentVal,
|
1257 |
+
childVal,
|
1258 |
+
vm
|
1259 |
+
) {
|
1260 |
+
if (!vm) {
|
1261 |
+
if (childVal && typeof childVal !== 'function') {
|
1262 |
+
warn(
|
1263 |
+
'The "data" option should be a function ' +
|
1264 |
+
'that returns a per-instance value in component ' +
|
1265 |
+
'definitions.',
|
1266 |
+
vm
|
1267 |
+
);
|
1268 |
+
|
1269 |
+
return parentVal
|
1270 |
+
}
|
1271 |
+
return mergeDataOrFn(parentVal, childVal)
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
return mergeDataOrFn(parentVal, childVal, vm)
|
1275 |
+
};
|
1276 |
+
|
1277 |
+
/**
|
1278 |
+
* Hooks and props are merged as arrays.
|
1279 |
+
*/
|
1280 |
+
function mergeHook (
|
1281 |
+
parentVal,
|
1282 |
+
childVal
|
1283 |
+
) {
|
1284 |
+
var res = childVal
|
1285 |
+
? parentVal
|
1286 |
+
? parentVal.concat(childVal)
|
1287 |
+
: Array.isArray(childVal)
|
1288 |
+
? childVal
|
1289 |
+
: [childVal]
|
1290 |
+
: parentVal;
|
1291 |
+
return res
|
1292 |
+
? dedupeHooks(res)
|
1293 |
+
: res
|
1294 |
+
}
|
1295 |
+
|
1296 |
+
function dedupeHooks (hooks) {
|
1297 |
+
var res = [];
|
1298 |
+
for (var i = 0; i < hooks.length; i++) {
|
1299 |
+
if (res.indexOf(hooks[i]) === -1) {
|
1300 |
+
res.push(hooks[i]);
|
1301 |
+
}
|
1302 |
+
}
|
1303 |
+
return res
|
1304 |
+
}
|
1305 |
+
|
1306 |
+
LIFECYCLE_HOOKS.forEach(function (hook) {
|
1307 |
+
strats[hook] = mergeHook;
|
1308 |
+
});
|
1309 |
+
|
1310 |
+
/**
|
1311 |
+
* Assets
|
1312 |
+
*
|
1313 |
+
* When a vm is present (instance creation), we need to do
|
1314 |
+
* a three-way merge between constructor options, instance
|
1315 |
+
* options and parent options.
|
1316 |
+
*/
|
1317 |
+
function mergeAssets (
|
1318 |
+
parentVal,
|
1319 |
+
childVal,
|
1320 |
+
vm,
|
1321 |
+
key
|
1322 |
+
) {
|
1323 |
+
var res = Object.create(parentVal || null);
|
1324 |
+
if (childVal) {
|
1325 |
+
assertObjectType(key, childVal, vm);
|
1326 |
+
return extend(res, childVal)
|
1327 |
+
} else {
|
1328 |
+
return res
|
1329 |
+
}
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
ASSET_TYPES.forEach(function (type) {
|
1333 |
+
strats[type + 's'] = mergeAssets;
|
1334 |
+
});
|
1335 |
+
|
1336 |
+
/**
|
1337 |
+
* Watchers.
|
1338 |
+
*
|
1339 |
+
* Watchers hashes should not overwrite one
|
1340 |
+
* another, so we merge them as arrays.
|
1341 |
+
*/
|
1342 |
+
strats.watch = function (
|
1343 |
+
parentVal,
|
1344 |
+
childVal,
|
1345 |
+
vm,
|
1346 |
+
key
|
1347 |
+
) {
|
1348 |
+
// work around Firefox's Object.prototype.watch...
|
1349 |
+
if (parentVal === nativeWatch) { parentVal = undefined; }
|
1350 |
+
if (childVal === nativeWatch) { childVal = undefined; }
|
1351 |
+
/* istanbul ignore if */
|
1352 |
+
if (!childVal) { return Object.create(parentVal || null) }
|
1353 |
+
{
|
1354 |
+
assertObjectType(key, childVal, vm);
|
1355 |
+
}
|
1356 |
+
if (!parentVal) { return childVal }
|
1357 |
+
var ret = {};
|
1358 |
+
extend(ret, parentVal);
|
1359 |
+
for (var key$1 in childVal) {
|
1360 |
+
var parent = ret[key$1];
|
1361 |
+
var child = childVal[key$1];
|
1362 |
+
if (parent && !Array.isArray(parent)) {
|
1363 |
+
parent = [parent];
|
1364 |
+
}
|
1365 |
+
ret[key$1] = parent
|
1366 |
+
? parent.concat(child)
|
1367 |
+
: Array.isArray(child) ? child : [child];
|
1368 |
+
}
|
1369 |
+
return ret
|
1370 |
+
};
|
1371 |
+
|
1372 |
+
/**
|
1373 |
+
* Other object hashes.
|
1374 |
+
*/
|
1375 |
+
strats.props =
|
1376 |
+
strats.methods =
|
1377 |
+
strats.inject =
|
1378 |
+
strats.computed = function (
|
1379 |
+
parentVal,
|
1380 |
+
childVal,
|
1381 |
+
vm,
|
1382 |
+
key
|
1383 |
+
) {
|
1384 |
+
if (childVal && "development" !== 'production') {
|
1385 |
+
assertObjectType(key, childVal, vm);
|
1386 |
+
}
|
1387 |
+
if (!parentVal) { return childVal }
|
1388 |
+
var ret = Object.create(null);
|
1389 |
+
extend(ret, parentVal);
|
1390 |
+
if (childVal) { extend(ret, childVal); }
|
1391 |
+
return ret
|
1392 |
+
};
|
1393 |
+
strats.provide = mergeDataOrFn;
|
1394 |
+
|
1395 |
+
/**
|
1396 |
+
* Default strategy.
|
1397 |
+
*/
|
1398 |
+
var defaultStrat = function (parentVal, childVal) {
|
1399 |
+
return childVal === undefined
|
1400 |
+
? parentVal
|
1401 |
+
: childVal
|
1402 |
+
};
|
1403 |
+
|
1404 |
+
/**
|
1405 |
+
* Validate component names
|
1406 |
+
*/
|
1407 |
+
function checkComponents (options) {
|
1408 |
+
for (var key in options.components) {
|
1409 |
+
validateComponentName(key);
|
1410 |
+
}
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
function validateComponentName (name) {
|
1414 |
+
if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
|
1415 |
+
warn(
|
1416 |
+
'Invalid component name: "' + name + '". Component names ' +
|
1417 |
+
'should conform to valid custom element name in html5 specification.'
|
1418 |
+
);
|
1419 |
+
}
|
1420 |
+
if (isBuiltInTag(name) || config.isReservedTag(name)) {
|
1421 |
+
warn(
|
1422 |
+
'Do not use built-in or reserved HTML elements as component ' +
|
1423 |
+
'id: ' + name
|
1424 |
+
);
|
1425 |
+
}
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
/**
|
1429 |
+
* Ensure all props option syntax are normalized into the
|
1430 |
+
* Object-based format.
|
1431 |
+
*/
|
1432 |
+
function normalizeProps (options, vm) {
|
1433 |
+
var props = options.props;
|
1434 |
+
if (!props) { return }
|
1435 |
+
var res = {};
|
1436 |
+
var i, val, name;
|
1437 |
+
if (Array.isArray(props)) {
|
1438 |
+
i = props.length;
|
1439 |
+
while (i--) {
|
1440 |
+
val = props[i];
|
1441 |
+
if (typeof val === 'string') {
|
1442 |
+
name = camelize(val);
|
1443 |
+
res[name] = { type: null };
|
1444 |
+
} else {
|
1445 |
+
warn('props must be strings when using array syntax.');
|
1446 |
+
}
|
1447 |
+
}
|
1448 |
+
} else if (isPlainObject(props)) {
|
1449 |
+
for (var key in props) {
|
1450 |
+
val = props[key];
|
1451 |
+
name = camelize(key);
|
1452 |
+
res[name] = isPlainObject(val)
|
1453 |
+
? val
|
1454 |
+
: { type: val };
|
1455 |
+
}
|
1456 |
+
} else {
|
1457 |
+
warn(
|
1458 |
+
"Invalid value for option \"props\": expected an Array or an Object, " +
|
1459 |
+
"but got " + (toRawType(props)) + ".",
|
1460 |
+
vm
|
1461 |
+
);
|
1462 |
+
}
|
1463 |
+
options.props = res;
|
1464 |
+
}
|
1465 |
+
|
1466 |
+
/**
|
1467 |
+
* Normalize all injections into Object-based format
|
1468 |
+
*/
|
1469 |
+
function normalizeInject (options, vm) {
|
1470 |
+
var inject = options.inject;
|
1471 |
+
if (!inject) { return }
|
1472 |
+
var normalized = options.inject = {};
|
1473 |
+
if (Array.isArray(inject)) {
|
1474 |
+
for (var i = 0; i < inject.length; i++) {
|
1475 |
+
normalized[inject[i]] = { from: inject[i] };
|
1476 |
+
}
|
1477 |
+
} else if (isPlainObject(inject)) {
|
1478 |
+
for (var key in inject) {
|
1479 |
+
var val = inject[key];
|
1480 |
+
normalized[key] = isPlainObject(val)
|
1481 |
+
? extend({ from: key }, val)
|
1482 |
+
: { from: val };
|
1483 |
+
}
|
1484 |
+
} else {
|
1485 |
+
warn(
|
1486 |
+
"Invalid value for option \"inject\": expected an Array or an Object, " +
|
1487 |
+
"but got " + (toRawType(inject)) + ".",
|
1488 |
+
vm
|
1489 |
+
);
|
1490 |
+
}
|
1491 |
+
}
|
1492 |
+
|
1493 |
+
/**
|
1494 |
+
* Normalize raw function directives into object format.
|
1495 |
+
*/
|
1496 |
+
function normalizeDirectives (options) {
|
1497 |
+
var dirs = options.directives;
|
1498 |
+
if (dirs) {
|
1499 |
+
for (var key in dirs) {
|
1500 |
+
var def$$1 = dirs[key];
|
1501 |
+
if (typeof def$$1 === 'function') {
|
1502 |
+
dirs[key] = { bind: def$$1, update: def$$1 };
|
1503 |
+
}
|
1504 |
+
}
|
1505 |
+
}
|
1506 |
+
}
|
1507 |
+
|
1508 |
+
function assertObjectType (name, value, vm) {
|
1509 |
+
if (!isPlainObject(value)) {
|
1510 |
+
warn(
|
1511 |
+
"Invalid value for option \"" + name + "\": expected an Object, " +
|
1512 |
+
"but got " + (toRawType(value)) + ".",
|
1513 |
+
vm
|
1514 |
+
);
|
1515 |
+
}
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
/**
|
1519 |
+
* Merge two option objects into a new one.
|
1520 |
+
* Core utility used in both instantiation and inheritance.
|
1521 |
+
*/
|
1522 |
+
function mergeOptions (
|
1523 |
+
parent,
|
1524 |
+
child,
|
1525 |
+
vm
|
1526 |
+
) {
|
1527 |
+
{
|
1528 |
+
checkComponents(child);
|
1529 |
+
}
|
1530 |
+
|
1531 |
+
if (typeof child === 'function') {
|
1532 |
+
child = child.options;
|
1533 |
+
}
|
1534 |
+
|
1535 |
+
normalizeProps(child, vm);
|
1536 |
+
normalizeInject(child, vm);
|
1537 |
+
normalizeDirectives(child);
|
1538 |
+
|
1539 |
+
// Apply extends and mixins on the child options,
|
1540 |
+
// but only if it is a raw options object that isn't
|
1541 |
+
// the result of another mergeOptions call.
|
1542 |
+
// Only merged options has the _base property.
|
1543 |
+
if (!child._base) {
|
1544 |
+
if (child.extends) {
|
1545 |
+
parent = mergeOptions(parent, child.extends, vm);
|
1546 |
+
}
|
1547 |
+
if (child.mixins) {
|
1548 |
+
for (var i = 0, l = child.mixins.length; i < l; i++) {
|
1549 |
+
parent = mergeOptions(parent, child.mixins[i], vm);
|
1550 |
+
}
|
1551 |
+
}
|
1552 |
+
}
|
1553 |
+
|
1554 |
+
var options = {};
|
1555 |
+
var key;
|
1556 |
+
for (key in parent) {
|
1557 |
+
mergeField(key);
|
1558 |
+
}
|
1559 |
+
for (key in child) {
|
1560 |
+
if (!hasOwn(parent, key)) {
|
1561 |
+
mergeField(key);
|
1562 |
+
}
|
1563 |
+
}
|
1564 |
+
function mergeField (key) {
|
1565 |
+
var strat = strats[key] || defaultStrat;
|
1566 |
+
options[key] = strat(parent[key], child[key], vm, key);
|
1567 |
+
}
|
1568 |
+
return options
|
1569 |
+
}
|
1570 |
+
|
1571 |
+
/**
|
1572 |
+
* Resolve an asset.
|
1573 |
+
* This function is used because child instances need access
|
1574 |
+
* to assets defined in its ancestor chain.
|
1575 |
+
*/
|
1576 |
+
function resolveAsset (
|
1577 |
+
options,
|
1578 |
+
type,
|
1579 |
+
id,
|
1580 |
+
warnMissing
|
1581 |
+
) {
|
1582 |
+
/* istanbul ignore if */
|
1583 |
+
if (typeof id !== 'string') {
|
1584 |
+
return
|
1585 |
+
}
|
1586 |
+
var assets = options[type];
|
1587 |
+
// check local registration variations first
|
1588 |
+
if (hasOwn(assets, id)) { return assets[id] }
|
1589 |
+
var camelizedId = camelize(id);
|
1590 |
+
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
|
1591 |
+
var PascalCaseId = capitalize(camelizedId);
|
1592 |
+
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
|
1593 |
+
// fallback to prototype chain
|
1594 |
+
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
|
1595 |
+
if (warnMissing && !res) {
|
1596 |
+
warn(
|
1597 |
+
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
|
1598 |
+
options
|
1599 |
+
);
|
1600 |
+
}
|
1601 |
+
return res
|
1602 |
+
}
|
1603 |
+
|
1604 |
+
/* */
|
1605 |
+
|
1606 |
+
|
1607 |
+
|
1608 |
+
function validateProp (
|
1609 |
+
key,
|
1610 |
+
propOptions,
|
1611 |
+
propsData,
|
1612 |
+
vm
|
1613 |
+
) {
|
1614 |
+
var prop = propOptions[key];
|
1615 |
+
var absent = !hasOwn(propsData, key);
|
1616 |
+
var value = propsData[key];
|
1617 |
+
// boolean casting
|
1618 |
+
var booleanIndex = getTypeIndex(Boolean, prop.type);
|
1619 |
+
if (booleanIndex > -1) {
|
1620 |
+
if (absent && !hasOwn(prop, 'default')) {
|
1621 |
+
value = false;
|
1622 |
+
} else if (value === '' || value === hyphenate(key)) {
|
1623 |
+
// only cast empty string / same name to boolean if
|
1624 |
+
// boolean has higher priority
|
1625 |
+
var stringIndex = getTypeIndex(String, prop.type);
|
1626 |
+
if (stringIndex < 0 || booleanIndex < stringIndex) {
|
1627 |
+
value = true;
|
1628 |
+
}
|
1629 |
+
}
|
1630 |
+
}
|
1631 |
+
// check default value
|
1632 |
+
if (value === undefined) {
|
1633 |
+
value = getPropDefaultValue(vm, prop, key);
|
1634 |
+
// since the default value is a fresh copy,
|
1635 |
+
// make sure to observe it.
|
1636 |
+
var prevShouldObserve = shouldObserve;
|
1637 |
+
toggleObserving(true);
|
1638 |
+
observe(value);
|
1639 |
+
toggleObserving(prevShouldObserve);
|
1640 |
+
}
|
1641 |
+
{
|
1642 |
+
assertProp(prop, key, value, vm, absent);
|
1643 |
+
}
|
1644 |
+
return value
|
1645 |
+
}
|
1646 |
+
|
1647 |
+
/**
|
1648 |
+
* Get the default value of a prop.
|
1649 |
+
*/
|
1650 |
+
function getPropDefaultValue (vm, prop, key) {
|
1651 |
+
// no default, return undefined
|
1652 |
+
if (!hasOwn(prop, 'default')) {
|
1653 |
+
return undefined
|
1654 |
+
}
|
1655 |
+
var def = prop.default;
|
1656 |
+
// warn against non-factory defaults for Object & Array
|
1657 |
+
if (isObject(def)) {
|
1658 |
+
warn(
|
1659 |
+
'Invalid default value for prop "' + key + '": ' +
|
1660 |
+
'Props with type Object/Array must use a factory function ' +
|
1661 |
+
'to return the default value.',
|
1662 |
+
vm
|
1663 |
+
);
|
1664 |
+
}
|
1665 |
+
// the raw prop value was also undefined from previous render,
|
1666 |
+
// return previous default value to avoid unnecessary watcher trigger
|
1667 |
+
if (vm && vm.$options.propsData &&
|
1668 |
+
vm.$options.propsData[key] === undefined &&
|
1669 |
+
vm._props[key] !== undefined
|
1670 |
+
) {
|
1671 |
+
return vm._props[key]
|
1672 |
+
}
|
1673 |
+
// call factory function for non-Function types
|
1674 |
+
// a value is Function if its prototype is function even across different execution context
|
1675 |
+
return typeof def === 'function' && getType(prop.type) !== 'Function'
|
1676 |
+
? def.call(vm)
|
1677 |
+
: def
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
/**
|
1681 |
+
* Assert whether a prop is valid.
|
1682 |
+
*/
|
1683 |
+
function assertProp (
|
1684 |
+
prop,
|
1685 |
+
name,
|
1686 |
+
value,
|
1687 |
+
vm,
|
1688 |
+
absent
|
1689 |
+
) {
|
1690 |
+
if (prop.required && absent) {
|
1691 |
+
warn(
|
1692 |
+
'Missing required prop: "' + name + '"',
|
1693 |
+
vm
|
1694 |
+
);
|
1695 |
+
return
|
1696 |
+
}
|
1697 |
+
if (value == null && !prop.required) {
|
1698 |
+
return
|
1699 |
+
}
|
1700 |
+
var type = prop.type;
|
1701 |
+
var valid = !type || type === true;
|
1702 |
+
var expectedTypes = [];
|
1703 |
+
if (type) {
|
1704 |
+
if (!Array.isArray(type)) {
|
1705 |
+
type = [type];
|
1706 |
+
}
|
1707 |
+
for (var i = 0; i < type.length && !valid; i++) {
|
1708 |
+
var assertedType = assertType(value, type[i]);
|
1709 |
+
expectedTypes.push(assertedType.expectedType || '');
|
1710 |
+
valid = assertedType.valid;
|
1711 |
+
}
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
if (!valid) {
|
1715 |
+
warn(
|
1716 |
+
getInvalidTypeMessage(name, value, expectedTypes),
|
1717 |
+
vm
|
1718 |
+
);
|
1719 |
+
return
|
1720 |
+
}
|
1721 |
+
var validator = prop.validator;
|
1722 |
+
if (validator) {
|
1723 |
+
if (!validator(value)) {
|
1724 |
+
warn(
|
1725 |
+
'Invalid prop: custom validator check failed for prop "' + name + '".',
|
1726 |
+
vm
|
1727 |
+
);
|
1728 |
+
}
|
1729 |
+
}
|
1730 |
+
}
|
1731 |
+
|
1732 |
+
var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
|
1733 |
+
|
1734 |
+
function assertType (value, type) {
|
1735 |
+
var valid;
|
1736 |
+
var expectedType = getType(type);
|
1737 |
+
if (simpleCheckRE.test(expectedType)) {
|
1738 |
+
var t = typeof value;
|
1739 |
+
valid = t === expectedType.toLowerCase();
|
1740 |
+
// for primitive wrapper objects
|
1741 |
+
if (!valid && t === 'object') {
|
1742 |
+
valid = value instanceof type;
|
1743 |
+
}
|
1744 |
+
} else if (expectedType === 'Object') {
|
1745 |
+
valid = isPlainObject(value);
|
1746 |
+
} else if (expectedType === 'Array') {
|
1747 |
+
valid = Array.isArray(value);
|
1748 |
+
} else {
|
1749 |
+
valid = value instanceof type;
|
1750 |
+
}
|
1751 |
+
return {
|
1752 |
+
valid: valid,
|
1753 |
+
expectedType: expectedType
|
1754 |
+
}
|
1755 |
+
}
|
1756 |
+
|
1757 |
+
/**
|
1758 |
+
* Use function string name to check built-in types,
|
1759 |
+
* because a simple equality check will fail when running
|
1760 |
+
* across different vms / iframes.
|
1761 |
+
*/
|
1762 |
+
function getType (fn) {
|
1763 |
+
var match = fn && fn.toString().match(/^\s*function (\w+)/);
|
1764 |
+
return match ? match[1] : ''
|
1765 |
+
}
|
1766 |
+
|
1767 |
+
function isSameType (a, b) {
|
1768 |
+
return getType(a) === getType(b)
|
1769 |
+
}
|
1770 |
+
|
1771 |
+
function getTypeIndex (type, expectedTypes) {
|
1772 |
+
if (!Array.isArray(expectedTypes)) {
|
1773 |
+
return isSameType(expectedTypes, type) ? 0 : -1
|
1774 |
+
}
|
1775 |
+
for (var i = 0, len = expectedTypes.length; i < len; i++) {
|
1776 |
+
if (isSameType(expectedTypes[i], type)) {
|
1777 |
+
return i
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
return -1
|
1781 |
+
}
|
1782 |
+
|
1783 |
+
function getInvalidTypeMessage (name, value, expectedTypes) {
|
1784 |
+
var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
|
1785 |
+
" Expected " + (expectedTypes.map(capitalize).join(', '));
|
1786 |
+
var expectedType = expectedTypes[0];
|
1787 |
+
var receivedType = toRawType(value);
|
1788 |
+
var expectedValue = styleValue(value, expectedType);
|
1789 |
+
var receivedValue = styleValue(value, receivedType);
|
1790 |
+
// check if we need to specify expected value
|
1791 |
+
if (expectedTypes.length === 1 &&
|
1792 |
+
isExplicable(expectedType) &&
|
1793 |
+
!isBoolean(expectedType, receivedType)) {
|
1794 |
+
message += " with value " + expectedValue;
|
1795 |
+
}
|
1796 |
+
message += ", got " + receivedType + " ";
|
1797 |
+
// check if we need to specify received value
|
1798 |
+
if (isExplicable(receivedType)) {
|
1799 |
+
message += "with value " + receivedValue + ".";
|
1800 |
+
}
|
1801 |
+
return message
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
function styleValue (value, type) {
|
1805 |
+
if (type === 'String') {
|
1806 |
+
return ("\"" + value + "\"")
|
1807 |
+
} else if (type === 'Number') {
|
1808 |
+
return ("" + (Number(value)))
|
1809 |
+
} else {
|
1810 |
+
return ("" + value)
|
1811 |
+
}
|
1812 |
+
}
|
1813 |
+
|
1814 |
+
function isExplicable (value) {
|
1815 |
+
var explicitTypes = ['string', 'number', 'boolean'];
|
1816 |
+
return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
|
1817 |
+
}
|
1818 |
+
|
1819 |
+
function isBoolean () {
|
1820 |
+
var args = [], len = arguments.length;
|
1821 |
+
while ( len-- ) args[ len ] = arguments[ len ];
|
1822 |
+
|
1823 |
+
return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
/* */
|
1827 |
+
|
1828 |
+
function handleError (err, vm, info) {
|
1829 |
+
// Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
|
1830 |
+
// See: https://github.com/vuejs/vuex/issues/1505
|
1831 |
+
pushTarget();
|
1832 |
+
try {
|
1833 |
+
if (vm) {
|
1834 |
+
var cur = vm;
|
1835 |
+
while ((cur = cur.$parent)) {
|
1836 |
+
var hooks = cur.$options.errorCaptured;
|
1837 |
+
if (hooks) {
|
1838 |
+
for (var i = 0; i < hooks.length; i++) {
|
1839 |
+
try {
|
1840 |
+
var capture = hooks[i].call(cur, err, vm, info) === false;
|
1841 |
+
if (capture) { return }
|
1842 |
+
} catch (e) {
|
1843 |
+
globalHandleError(e, cur, 'errorCaptured hook');
|
1844 |
+
}
|
1845 |
+
}
|
1846 |
+
}
|
1847 |
+
}
|
1848 |
+
}
|
1849 |
+
globalHandleError(err, vm, info);
|
1850 |
+
} finally {
|
1851 |
+
popTarget();
|
1852 |
+
}
|
1853 |
+
}
|
1854 |
+
|
1855 |
+
function invokeWithErrorHandling (
|
1856 |
+
handler,
|
1857 |
+
context,
|
1858 |
+
args,
|
1859 |
+
vm,
|
1860 |
+
info
|
1861 |
+
) {
|
1862 |
+
var res;
|
1863 |
+
try {
|
1864 |
+
res = args ? handler.apply(context, args) : handler.call(context);
|
1865 |
+
if (res && !res._isVue && isPromise(res) && !res._handled) {
|
1866 |
+
res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
|
1867 |
+
// issue #9511
|
1868 |
+
// avoid catch triggering multiple times when nested calls
|
1869 |
+
res._handled = true;
|
1870 |
+
}
|
1871 |
+
} catch (e) {
|
1872 |
+
handleError(e, vm, info);
|
1873 |
+
}
|
1874 |
+
return res
|
1875 |
+
}
|
1876 |
+
|
1877 |
+
function globalHandleError (err, vm, info) {
|
1878 |
+
if (config.errorHandler) {
|
1879 |
+
try {
|
1880 |
+
return config.errorHandler.call(null, err, vm, info)
|
1881 |
+
} catch (e) {
|
1882 |
+
// if the user intentionally throws the original error in the handler,
|
1883 |
+
// do not log it twice
|
1884 |
+
if (e !== err) {
|
1885 |
+
logError(e, null, 'config.errorHandler');
|
1886 |
+
}
|
1887 |
+
}
|
1888 |
+
}
|
1889 |
+
logError(err, vm, info);
|
1890 |
+
}
|
1891 |
+
|
1892 |
+
function logError (err, vm, info) {
|
1893 |
+
{
|
1894 |
+
warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
|
1895 |
+
}
|
1896 |
+
/* istanbul ignore else */
|
1897 |
+
if ((inBrowser || inWeex) && typeof console !== 'undefined') {
|
1898 |
+
console.error(err);
|
1899 |
+
} else {
|
1900 |
+
throw err
|
1901 |
+
}
|
1902 |
+
}
|
1903 |
+
|
1904 |
+
/* */
|
1905 |
+
|
1906 |
+
var isUsingMicroTask = false;
|
1907 |
+
|
1908 |
+
var callbacks = [];
|
1909 |
+
var pending = false;
|
1910 |
+
|
1911 |
+
function flushCallbacks () {
|
1912 |
+
pending = false;
|
1913 |
+
var copies = callbacks.slice(0);
|
1914 |
+
callbacks.length = 0;
|
1915 |
+
for (var i = 0; i < copies.length; i++) {
|
1916 |
+
copies[i]();
|
1917 |
+
}
|
1918 |
+
}
|
1919 |
+
|
1920 |
+
// Here we have async deferring wrappers using microtasks.
|
1921 |
+
// In 2.5 we used (macro) tasks (in combination with microtasks).
|
1922 |
+
// However, it has subtle problems when state is changed right before repaint
|
1923 |
+
// (e.g. #6813, out-in transitions).
|
1924 |
+
// Also, using (macro) tasks in event handler would cause some weird behaviors
|
1925 |
+
// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
|
1926 |
+
// So we now use microtasks everywhere, again.
|
1927 |
+
// A major drawback of this tradeoff is that there are some scenarios
|
1928 |
+
// where microtasks have too high a priority and fire in between supposedly
|
1929 |
+
// sequential events (e.g. #4521, #6690, which have workarounds)
|
1930 |
+
// or even between bubbling of the same event (#6566).
|
1931 |
+
var timerFunc;
|
1932 |
+
|
1933 |
+
// The nextTick behavior leverages the microtask queue, which can be accessed
|
1934 |
+
// via either native Promise.then or MutationObserver.
|
1935 |
+
// MutationObserver has wider support, however it is seriously bugged in
|
1936 |
+
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
|
1937 |
+
// completely stops working after triggering a few times... so, if native
|
1938 |
+
// Promise is available, we will use it:
|
1939 |
+
/* istanbul ignore next, $flow-disable-line */
|
1940 |
+
if (typeof Promise !== 'undefined' && isNative(Promise)) {
|
1941 |
+
var p = Promise.resolve();
|
1942 |
+
timerFunc = function () {
|
1943 |
+
p.then(flushCallbacks);
|
1944 |
+
// In problematic UIWebViews, Promise.then doesn't completely break, but
|
1945 |
+
// it can get stuck in a weird state where callbacks are pushed into the
|
1946 |
+
// microtask queue but the queue isn't being flushed, until the browser
|
1947 |
+
// needs to do some other work, e.g. handle a timer. Therefore we can
|
1948 |
+
// "force" the microtask queue to be flushed by adding an empty timer.
|
1949 |
+
if (isIOS) { setTimeout(noop); }
|
1950 |
+
};
|
1951 |
+
isUsingMicroTask = true;
|
1952 |
+
} else if (!isIE && typeof MutationObserver !== 'undefined' && (
|
1953 |
+
isNative(MutationObserver) ||
|
1954 |
+
// PhantomJS and iOS 7.x
|
1955 |
+
MutationObserver.toString() === '[object MutationObserverConstructor]'
|
1956 |
+
)) {
|
1957 |
+
// Use MutationObserver where native Promise is not available,
|
1958 |
+
// e.g. PhantomJS, iOS7, Android 4.4
|
1959 |
+
// (#6466 MutationObserver is unreliable in IE11)
|
1960 |
+
var counter = 1;
|
1961 |
+
var observer = new MutationObserver(flushCallbacks);
|
1962 |
+
var textNode = document.createTextNode(String(counter));
|
1963 |
+
observer.observe(textNode, {
|
1964 |
+
characterData: true
|
1965 |
+
});
|
1966 |
+
timerFunc = function () {
|
1967 |
+
counter = (counter + 1) % 2;
|
1968 |
+
textNode.data = String(counter);
|
1969 |
+
};
|
1970 |
+
isUsingMicroTask = true;
|
1971 |
+
} else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
|
1972 |
+
// Fallback to setImmediate.
|
1973 |
+
// Techinically it leverages the (macro) task queue,
|
1974 |
+
// but it is still a better choice than setTimeout.
|
1975 |
+
timerFunc = function () {
|
1976 |
+
setImmediate(flushCallbacks);
|
1977 |
+
};
|
1978 |
+
} else {
|
1979 |
+
// Fallback to setTimeout.
|
1980 |
+
timerFunc = function () {
|
1981 |
+
setTimeout(flushCallbacks, 0);
|
1982 |
+
};
|
1983 |
+
}
|
1984 |
+
|
1985 |
+
function nextTick (cb, ctx) {
|
1986 |
+
var _resolve;
|
1987 |
+
callbacks.push(function () {
|
1988 |
+
if (cb) {
|
1989 |
+
try {
|
1990 |
+
cb.call(ctx);
|
1991 |
+
} catch (e) {
|
1992 |
+
handleError(e, ctx, 'nextTick');
|
1993 |
+
}
|
1994 |
+
} else if (_resolve) {
|
1995 |
+
_resolve(ctx);
|
1996 |
+
}
|
1997 |
+
});
|
1998 |
+
if (!pending) {
|
1999 |
+
pending = true;
|
2000 |
+
timerFunc();
|
2001 |
+
}
|
2002 |
+
// $flow-disable-line
|
2003 |
+
if (!cb && typeof Promise !== 'undefined') {
|
2004 |
+
return new Promise(function (resolve) {
|
2005 |
+
_resolve = resolve;
|
2006 |
+
})
|
2007 |
+
}
|
2008 |
+
}
|
2009 |
+
|
2010 |
+
/* */
|
2011 |
+
|
2012 |
+
var mark;
|
2013 |
+
var measure;
|
2014 |
+
|
2015 |
+
{
|
2016 |
+
var perf = inBrowser && window.performance;
|
2017 |
+
/* istanbul ignore if */
|
2018 |
+
if (
|
2019 |
+
perf &&
|
2020 |
+
perf.mark &&
|
2021 |
+
perf.measure &&
|
2022 |
+
perf.clearMarks &&
|
2023 |
+
perf.clearMeasures
|
2024 |
+
) {
|
2025 |
+
mark = function (tag) { return perf.mark(tag); };
|
2026 |
+
measure = function (name, startTag, endTag) {
|
2027 |
+
perf.measure(name, startTag, endTag);
|
2028 |
+
perf.clearMarks(startTag);
|
2029 |
+
perf.clearMarks(endTag);
|
2030 |
+
// perf.clearMeasures(name)
|
2031 |
+
};
|
2032 |
+
}
|
2033 |
+
}
|
2034 |
+
|
2035 |
+
/* not type checking this file because flow doesn't play well with Proxy */
|
2036 |
+
|
2037 |
+
var initProxy;
|
2038 |
+
|
2039 |
+
{
|
2040 |
+
var allowedGlobals = makeMap(
|
2041 |
+
'Infinity,undefined,NaN,isFinite,isNaN,' +
|
2042 |
+
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
|
2043 |
+
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
|
2044 |
+
'require' // for Webpack/Browserify
|
2045 |
+
);
|
2046 |
+
|
2047 |
+
var warnNonPresent = function (target, key) {
|
2048 |
+
warn(
|
2049 |
+
"Property or method \"" + key + "\" is not defined on the instance but " +
|
2050 |
+
'referenced during render. Make sure that this property is reactive, ' +
|
2051 |
+
'either in the data option, or for class-based components, by ' +
|
2052 |
+
'initializing the property. ' +
|
2053 |
+
'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
|
2054 |
+
target
|
2055 |
+
);
|
2056 |
+
};
|
2057 |
+
|
2058 |
+
var warnReservedPrefix = function (target, key) {
|
2059 |
+
warn(
|
2060 |
+
"Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
|
2061 |
+
'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
|
2062 |
+
'prevent conflicts with Vue internals' +
|
2063 |
+
'See: https://vuejs.org/v2/api/#data',
|
2064 |
+
target
|
2065 |
+
);
|
2066 |
+
};
|
2067 |
+
|
2068 |
+
var hasProxy =
|
2069 |
+
typeof Proxy !== 'undefined' && isNative(Proxy);
|
2070 |
+
|
2071 |
+
if (hasProxy) {
|
2072 |
+
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
|
2073 |
+
config.keyCodes = new Proxy(config.keyCodes, {
|
2074 |
+
set: function set (target, key, value) {
|
2075 |
+
if (isBuiltInModifier(key)) {
|
2076 |
+
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
|
2077 |
+
return false
|
2078 |
+
} else {
|
2079 |
+
target[key] = value;
|
2080 |
+
return true
|
2081 |
+
}
|
2082 |
+
}
|
2083 |
+
});
|
2084 |
+
}
|
2085 |
+
|
2086 |
+
var hasHandler = {
|
2087 |
+
has: function has (target, key) {
|
2088 |
+
var has = key in target;
|
2089 |
+
var isAllowed = allowedGlobals(key) ||
|
2090 |
+
(typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
|
2091 |
+
if (!has && !isAllowed) {
|
2092 |
+
if (key in target.$data) { warnReservedPrefix(target, key); }
|
2093 |
+
else { warnNonPresent(target, key); }
|
2094 |
+
}
|
2095 |
+
return has || !isAllowed
|
2096 |
+
}
|
2097 |
+
};
|
2098 |
+
|
2099 |
+
var getHandler = {
|
2100 |
+
get: function get (target, key) {
|
2101 |
+
if (typeof key === 'string' && !(key in target)) {
|
2102 |
+
if (key in target.$data) { warnReservedPrefix(target, key); }
|
2103 |
+
else { warnNonPresent(target, key); }
|
2104 |
+
}
|
2105 |
+
return target[key]
|
2106 |
+
}
|
2107 |
+
};
|
2108 |
+
|
2109 |
+
initProxy = function initProxy (vm) {
|
2110 |
+
if (hasProxy) {
|
2111 |
+
// determine which proxy handler to use
|
2112 |
+
var options = vm.$options;
|
2113 |
+
var handlers = options.render && options.render._withStripped
|
2114 |
+
? getHandler
|
2115 |
+
: hasHandler;
|
2116 |
+
vm._renderProxy = new Proxy(vm, handlers);
|
2117 |
+
} else {
|
2118 |
+
vm._renderProxy = vm;
|
2119 |
+
}
|
2120 |
+
};
|
2121 |
+
}
|
2122 |
+
|
2123 |
+
/* */
|
2124 |
+
|
2125 |
+
var seenObjects = new _Set();
|
2126 |
+
|
2127 |
+
/**
|
2128 |
+
* Recursively traverse an object to evoke all converted
|
2129 |
+
* getters, so that every nested property inside the object
|
2130 |
+
* is collected as a "deep" dependency.
|
2131 |
+
*/
|
2132 |
+
function traverse (val) {
|
2133 |
+
_traverse(val, seenObjects);
|
2134 |
+
seenObjects.clear();
|
2135 |
+
}
|
2136 |
+
|
2137 |
+
function _traverse (val, seen) {
|
2138 |
+
var i, keys;
|
2139 |
+
var isA = Array.isArray(val);
|
2140 |
+
if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
|
2141 |
+
return
|
2142 |
+
}
|
2143 |
+
if (val.__ob__) {
|
2144 |
+
var depId = val.__ob__.dep.id;
|
2145 |
+
if (seen.has(depId)) {
|
2146 |
+
return
|
2147 |
+
}
|
2148 |
+
seen.add(depId);
|
2149 |
+
}
|
2150 |
+
if (isA) {
|
2151 |
+
i = val.length;
|
2152 |
+
while (i--) { _traverse(val[i], seen); }
|
2153 |
+
} else {
|
2154 |
+
keys = Object.keys(val);
|
2155 |
+
i = keys.length;
|
2156 |
+
while (i--) { _traverse(val[keys[i]], seen); }
|
2157 |
+
}
|
2158 |
+
}
|
2159 |
+
|
2160 |
+
/* */
|
2161 |
+
|
2162 |
+
var normalizeEvent = cached(function (name) {
|
2163 |
+
var passive = name.charAt(0) === '&';
|
2164 |
+
name = passive ? name.slice(1) : name;
|
2165 |
+
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
|
2166 |
+
name = once$$1 ? name.slice(1) : name;
|
2167 |
+
var capture = name.charAt(0) === '!';
|
2168 |
+
name = capture ? name.slice(1) : name;
|
2169 |
+
return {
|
2170 |
+
name: name,
|
2171 |
+
once: once$$1,
|
2172 |
+
capture: capture,
|
2173 |
+
passive: passive
|
2174 |
+
}
|
2175 |
+
});
|
2176 |
+
|
2177 |
+
function createFnInvoker (fns, vm) {
|
2178 |
+
function invoker () {
|
2179 |
+
var arguments$1 = arguments;
|
2180 |
+
|
2181 |
+
var fns = invoker.fns;
|
2182 |
+
if (Array.isArray(fns)) {
|
2183 |
+
var cloned = fns.slice();
|
2184 |
+
for (var i = 0; i < cloned.length; i++) {
|
2185 |
+
invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
|
2186 |
+
}
|
2187 |
+
} else {
|
2188 |
+
// return handler return value for single handlers
|
2189 |
+
return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
|
2190 |
+
}
|
2191 |
+
}
|
2192 |
+
invoker.fns = fns;
|
2193 |
+
return invoker
|
2194 |
+
}
|
2195 |
+
|
2196 |
+
function updateListeners (
|
2197 |
+
on,
|
2198 |
+
oldOn,
|
2199 |
+
add,
|
2200 |
+
remove$$1,
|
2201 |
+
createOnceHandler,
|
2202 |
+
vm
|
2203 |
+
) {
|
2204 |
+
var name, def$$1, cur, old, event;
|
2205 |
+
for (name in on) {
|
2206 |
+
def$$1 = cur = on[name];
|
2207 |
+
old = oldOn[name];
|
2208 |
+
event = normalizeEvent(name);
|
2209 |
+
if (isUndef(cur)) {
|
2210 |
+
warn(
|
2211 |
+
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
|
2212 |
+
vm
|
2213 |
+
);
|
2214 |
+
} else if (isUndef(old)) {
|
2215 |
+
if (isUndef(cur.fns)) {
|
2216 |
+
cur = on[name] = createFnInvoker(cur, vm);
|
2217 |
+
}
|
2218 |
+
if (isTrue(event.once)) {
|
2219 |
+
cur = on[name] = createOnceHandler(event.name, cur, event.capture);
|
2220 |
+
}
|
2221 |
+
add(event.name, cur, event.capture, event.passive, event.params);
|
2222 |
+
} else if (cur !== old) {
|
2223 |
+
old.fns = cur;
|
2224 |
+
on[name] = old;
|
2225 |
+
}
|
2226 |
+
}
|
2227 |
+
for (name in oldOn) {
|
2228 |
+
if (isUndef(on[name])) {
|
2229 |
+
event = normalizeEvent(name);
|
2230 |
+
remove$$1(event.name, oldOn[name], event.capture);
|
2231 |
+
}
|
2232 |
+
}
|
2233 |
+
}
|
2234 |
+
|
2235 |
+
/* */
|
2236 |
+
|
2237 |
+
function mergeVNodeHook (def, hookKey, hook) {
|
2238 |
+
if (def instanceof VNode) {
|
2239 |
+
def = def.data.hook || (def.data.hook = {});
|
2240 |
+
}
|
2241 |
+
var invoker;
|
2242 |
+
var oldHook = def[hookKey];
|
2243 |
+
|
2244 |
+
function wrappedHook () {
|
2245 |
+
hook.apply(this, arguments);
|
2246 |
+
// important: remove merged hook to ensure it's called only once
|
2247 |
+
// and prevent memory leak
|
2248 |
+
remove(invoker.fns, wrappedHook);
|
2249 |
+
}
|
2250 |
+
|
2251 |
+
if (isUndef(oldHook)) {
|
2252 |
+
// no existing hook
|
2253 |
+
invoker = createFnInvoker([wrappedHook]);
|
2254 |
+
} else {
|
2255 |
+
/* istanbul ignore if */
|
2256 |
+
if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
|
2257 |
+
// already a merged invoker
|
2258 |
+
invoker = oldHook;
|
2259 |
+
invoker.fns.push(wrappedHook);
|
2260 |
+
} else {
|
2261 |
+
// existing plain hook
|
2262 |
+
invoker = createFnInvoker([oldHook, wrappedHook]);
|
2263 |
+
}
|
2264 |
+
}
|
2265 |
+
|
2266 |
+
invoker.merged = true;
|
2267 |
+
def[hookKey] = invoker;
|
2268 |
+
}
|
2269 |
+
|
2270 |
+
/* */
|
2271 |
+
|
2272 |
+
function extractPropsFromVNodeData (
|
2273 |
+
data,
|
2274 |
+
Ctor,
|
2275 |
+
tag
|
2276 |
+
) {
|
2277 |
+
// we are only extracting raw values here.
|
2278 |
+
// validation and default values are handled in the child
|
2279 |
+
// component itself.
|
2280 |
+
var propOptions = Ctor.options.props;
|
2281 |
+
if (isUndef(propOptions)) {
|
2282 |
+
return
|
2283 |
+
}
|
2284 |
+
var res = {};
|
2285 |
+
var attrs = data.attrs;
|
2286 |
+
var props = data.props;
|
2287 |
+
if (isDef(attrs) || isDef(props)) {
|
2288 |
+
for (var key in propOptions) {
|
2289 |
+
var altKey = hyphenate(key);
|
2290 |
+
{
|
2291 |
+
var keyInLowerCase = key.toLowerCase();
|
2292 |
+
if (
|
2293 |
+
key !== keyInLowerCase &&
|
2294 |
+
attrs && hasOwn(attrs, keyInLowerCase)
|
2295 |
+
) {
|
2296 |
+
tip(
|
2297 |
+
"Prop \"" + keyInLowerCase + "\" is passed to component " +
|
2298 |
+
(formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
|
2299 |
+
" \"" + key + "\". " +
|
2300 |
+
"Note that HTML attributes are case-insensitive and camelCased " +
|
2301 |
+
"props need to use their kebab-case equivalents when using in-DOM " +
|
2302 |
+
"templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
|
2303 |
+
);
|
2304 |
+
}
|
2305 |
+
}
|
2306 |
+
checkProp(res, props, key, altKey, true) ||
|
2307 |
+
checkProp(res, attrs, key, altKey, false);
|
2308 |
+
}
|
2309 |
+
}
|
2310 |
+
return res
|
2311 |
+
}
|
2312 |
+
|
2313 |
+
function checkProp (
|
2314 |
+
res,
|
2315 |
+
hash,
|
2316 |
+
key,
|
2317 |
+
altKey,
|
2318 |
+
preserve
|
2319 |
+
) {
|
2320 |
+
if (isDef(hash)) {
|
2321 |
+
if (hasOwn(hash, key)) {
|
2322 |
+
res[key] = hash[key];
|
2323 |
+
if (!preserve) {
|
2324 |
+
delete hash[key];
|
2325 |
+
}
|
2326 |
+
return true
|
2327 |
+
} else if (hasOwn(hash, altKey)) {
|
2328 |
+
res[key] = hash[altKey];
|
2329 |
+
if (!preserve) {
|
2330 |
+
delete hash[altKey];
|
2331 |
+
}
|
2332 |
+
return true
|
2333 |
+
}
|
2334 |
+
}
|
2335 |
+
return false
|
2336 |
+
}
|
2337 |
+
|
2338 |
+
/* */
|
2339 |
+
|
2340 |
+
// The template compiler attempts to minimize the need for normalization by
|
2341 |
+
// statically analyzing the template at compile time.
|
2342 |
+
//
|
2343 |
+
// For plain HTML markup, normalization can be completely skipped because the
|
2344 |
+
// generated render function is guaranteed to return Array<VNode>. There are
|
2345 |
+
// two cases where extra normalization is needed:
|
2346 |
+
|
2347 |
+
// 1. When the children contains components - because a functional component
|
2348 |
+
// may return an Array instead of a single root. In this case, just a simple
|
2349 |
+
// normalization is needed - if any child is an Array, we flatten the whole
|
2350 |
+
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
|
2351 |
+
// because functional components already normalize their own children.
|
2352 |
+
function simpleNormalizeChildren (children) {
|
2353 |
+
for (var i = 0; i < children.length; i++) {
|
2354 |
+
if (Array.isArray(children[i])) {
|
2355 |
+
return Array.prototype.concat.apply([], children)
|
2356 |
+
}
|
2357 |
+
}
|
2358 |
+
return children
|
2359 |
+
}
|
2360 |
+
|
2361 |
+
// 2. When the children contains constructs that always generated nested Arrays,
|
2362 |
+
// e.g. <template>, <slot>, v-for, or when the children is provided by user
|
2363 |
+
// with hand-written render functions / JSX. In such cases a full normalization
|
2364 |
+
// is needed to cater to all possible types of children values.
|
2365 |
+
function normalizeChildren (children) {
|
2366 |
+
return isPrimitive(children)
|
2367 |
+
? [createTextVNode(children)]
|
2368 |
+
: Array.isArray(children)
|
2369 |
+
? normalizeArrayChildren(children)
|
2370 |
+
: undefined
|
2371 |
+
}
|
2372 |
+
|
2373 |
+
function isTextNode (node) {
|
2374 |
+
return isDef(node) && isDef(node.text) && isFalse(node.isComment)
|
2375 |
+
}
|
2376 |
+
|
2377 |
+
function normalizeArrayChildren (children, nestedIndex) {
|
2378 |
+
var res = [];
|
2379 |
+
var i, c, lastIndex, last;
|
2380 |
+
for (i = 0; i < children.length; i++) {
|
2381 |
+
c = children[i];
|
2382 |
+
if (isUndef(c) || typeof c === 'boolean') { continue }
|
2383 |
+
lastIndex = res.length - 1;
|
2384 |
+
last = res[lastIndex];
|
2385 |
+
// nested
|
2386 |
+
if (Array.isArray(c)) {
|
2387 |
+
if (c.length > 0) {
|
2388 |
+
c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
|
2389 |
+
// merge adjacent text nodes
|
2390 |
+
if (isTextNode(c[0]) && isTextNode(last)) {
|
2391 |
+
res[lastIndex] = createTextVNode(last.text + (c[0]).text);
|
2392 |
+
c.shift();
|
2393 |
+
}
|
2394 |
+
res.push.apply(res, c);
|
2395 |
+
}
|
2396 |
+
} else if (isPrimitive(c)) {
|
2397 |
+
if (isTextNode(last)) {
|
2398 |
+
// merge adjacent text nodes
|
2399 |
+
// this is necessary for SSR hydration because text nodes are
|
2400 |
+
// essentially merged when rendered to HTML strings
|
2401 |
+
res[lastIndex] = createTextVNode(last.text + c);
|
2402 |
+
} else if (c !== '') {
|
2403 |
+
// convert primitive to vnode
|
2404 |
+
res.push(createTextVNode(c));
|
2405 |
+
}
|
2406 |
+
} else {
|
2407 |
+
if (isTextNode(c) && isTextNode(last)) {
|
2408 |
+
// merge adjacent text nodes
|
2409 |
+
res[lastIndex] = createTextVNode(last.text + c.text);
|
2410 |
+
} else {
|
2411 |
+
// default key for nested array children (likely generated by v-for)
|
2412 |
+
if (isTrue(children._isVList) &&
|
2413 |
+
isDef(c.tag) &&
|
2414 |
+
isUndef(c.key) &&
|
2415 |
+
isDef(nestedIndex)) {
|
2416 |
+
c.key = "__vlist" + nestedIndex + "_" + i + "__";
|
2417 |
+
}
|
2418 |
+
res.push(c);
|
2419 |
+
}
|
2420 |
+
}
|
2421 |
+
}
|
2422 |
+
return res
|
2423 |
+
}
|
2424 |
+
|
2425 |
+
/* */
|
2426 |
+
|
2427 |
+
function initProvide (vm) {
|
2428 |
+
var provide = vm.$options.provide;
|
2429 |
+
if (provide) {
|
2430 |
+
vm._provided = typeof provide === 'function'
|
2431 |
+
? provide.call(vm)
|
2432 |
+
: provide;
|
2433 |
+
}
|
2434 |
+
}
|
2435 |
+
|
2436 |
+
function initInjections (vm) {
|
2437 |
+
var result = resolveInject(vm.$options.inject, vm);
|
2438 |
+
if (result) {
|
2439 |
+
toggleObserving(false);
|
2440 |
+
Object.keys(result).forEach(function (key) {
|
2441 |
+
/* istanbul ignore else */
|
2442 |
+
{
|
2443 |
+
defineReactive$$1(vm, key, result[key], function () {
|
2444 |
+
warn(
|
2445 |
+
"Avoid mutating an injected value directly since the changes will be " +
|
2446 |
+
"overwritten whenever the provided component re-renders. " +
|
2447 |
+
"injection being mutated: \"" + key + "\"",
|
2448 |
+
vm
|
2449 |
+
);
|
2450 |
+
});
|
2451 |
+
}
|
2452 |
+
});
|
2453 |
+
toggleObserving(true);
|
2454 |
+
}
|
2455 |
+
}
|
2456 |
+
|
2457 |
+
function resolveInject (inject, vm) {
|
2458 |
+
if (inject) {
|
2459 |
+
// inject is :any because flow is not smart enough to figure out cached
|
2460 |
+
var result = Object.create(null);
|
2461 |
+
var keys = hasSymbol
|
2462 |
+
? Reflect.ownKeys(inject)
|
2463 |
+
: Object.keys(inject);
|
2464 |
+
|
2465 |
+
for (var i = 0; i < keys.length; i++) {
|
2466 |
+
var key = keys[i];
|
2467 |
+
// #6574 in case the inject object is observed...
|
2468 |
+
if (key === '__ob__') { continue }
|
2469 |
+
var provideKey = inject[key].from;
|
2470 |
+
var source = vm;
|
2471 |
+
while (source) {
|
2472 |
+
if (source._provided && hasOwn(source._provided, provideKey)) {
|
2473 |
+
result[key] = source._provided[provideKey];
|
2474 |
+
break
|
2475 |
+
}
|
2476 |
+
source = source.$parent;
|
2477 |
+
}
|
2478 |
+
if (!source) {
|
2479 |
+
if ('default' in inject[key]) {
|
2480 |
+
var provideDefault = inject[key].default;
|
2481 |
+
result[key] = typeof provideDefault === 'function'
|
2482 |
+
? provideDefault.call(vm)
|
2483 |
+
: provideDefault;
|
2484 |
+
} else {
|
2485 |
+
warn(("Injection \"" + key + "\" not found"), vm);
|
2486 |
+
}
|
2487 |
+
}
|
2488 |
+
}
|
2489 |
+
return result
|
2490 |
+
}
|
2491 |
+
}
|
2492 |
+
|
2493 |
+
/* */
|
2494 |
+
|
2495 |
+
|
2496 |
+
|
2497 |
+
/**
|
2498 |
+
* Runtime helper for resolving raw children VNodes into a slot object.
|
2499 |
+
*/
|
2500 |
+
function resolveSlots (
|
2501 |
+
children,
|
2502 |
+
context
|
2503 |
+
) {
|
2504 |
+
if (!children || !children.length) {
|
2505 |
+
return {}
|
2506 |
+
}
|
2507 |
+
var slots = {};
|
2508 |
+
for (var i = 0, l = children.length; i < l; i++) {
|
2509 |
+
var child = children[i];
|
2510 |
+
var data = child.data;
|
2511 |
+
// remove slot attribute if the node is resolved as a Vue slot node
|
2512 |
+
if (data && data.attrs && data.attrs.slot) {
|
2513 |
+
delete data.attrs.slot;
|
2514 |
+
}
|
2515 |
+
// named slots should only be respected if the vnode was rendered in the
|
2516 |
+
// same context.
|
2517 |
+
if ((child.context === context || child.fnContext === context) &&
|
2518 |
+
data && data.slot != null
|
2519 |
+
) {
|
2520 |
+
var name = data.slot;
|
2521 |
+
var slot = (slots[name] || (slots[name] = []));
|
2522 |
+
if (child.tag === 'template') {
|
2523 |
+
slot.push.apply(slot, child.children || []);
|
2524 |
+
} else {
|
2525 |
+
slot.push(child);
|
2526 |
+
}
|
2527 |
+
} else {
|
2528 |
+
(slots.default || (slots.default = [])).push(child);
|
2529 |
+
}
|
2530 |
+
}
|
2531 |
+
// ignore slots that contains only whitespace
|
2532 |
+
for (var name$1 in slots) {
|
2533 |
+
if (slots[name$1].every(isWhitespace)) {
|
2534 |
+
delete slots[name$1];
|
2535 |
+
}
|
2536 |
+
}
|
2537 |
+
return slots
|
2538 |
+
}
|
2539 |
+
|
2540 |
+
function isWhitespace (node) {
|
2541 |
+
return (node.isComment && !node.asyncFactory) || node.text === ' '
|
2542 |
+
}
|
2543 |
+
|
2544 |
+
/* */
|
2545 |
+
|
2546 |
+
function normalizeScopedSlots (
|
2547 |
+
slots,
|
2548 |
+
normalSlots,
|
2549 |
+
prevSlots
|
2550 |
+
) {
|
2551 |
+
var res;
|
2552 |
+
var hasNormalSlots = Object.keys(normalSlots).length > 0;
|
2553 |
+
var isStable = slots ? !!slots.$stable : !hasNormalSlots;
|
2554 |
+
var key = slots && slots.$key;
|
2555 |
+
if (!slots) {
|
2556 |
+
res = {};
|
2557 |
+
} else if (slots._normalized) {
|
2558 |
+
// fast path 1: child component re-render only, parent did not change
|
2559 |
+
return slots._normalized
|
2560 |
+
} else if (
|
2561 |
+
isStable &&
|
2562 |
+
prevSlots &&
|
2563 |
+
prevSlots !== emptyObject &&
|
2564 |
+
key === prevSlots.$key &&
|
2565 |
+
!hasNormalSlots &&
|
2566 |
+
!prevSlots.$hasNormal
|
2567 |
+
) {
|
2568 |
+
// fast path 2: stable scoped slots w/ no normal slots to proxy,
|
2569 |
+
// only need to normalize once
|
2570 |
+
return prevSlots
|
2571 |
+
} else {
|
2572 |
+
res = {};
|
2573 |
+
for (var key$1 in slots) {
|
2574 |
+
if (slots[key$1] && key$1[0] !== '$') {
|
2575 |
+
res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
|
2576 |
+
}
|
2577 |
+
}
|
2578 |
+
}
|
2579 |
+
// expose normal slots on scopedSlots
|
2580 |
+
for (var key$2 in normalSlots) {
|
2581 |
+
if (!(key$2 in res)) {
|
2582 |
+
res[key$2] = proxyNormalSlot(normalSlots, key$2);
|
2583 |
+
}
|
2584 |
+
}
|
2585 |
+
// avoriaz seems to mock a non-extensible $scopedSlots object
|
2586 |
+
// and when that is passed down this would cause an error
|
2587 |
+
if (slots && Object.isExtensible(slots)) {
|
2588 |
+
(slots)._normalized = res;
|
2589 |
+
}
|
2590 |
+
def(res, '$stable', isStable);
|
2591 |
+
def(res, '$key', key);
|
2592 |
+
def(res, '$hasNormal', hasNormalSlots);
|
2593 |
+
return res
|
2594 |
+
}
|
2595 |
+
|
2596 |
+
function normalizeScopedSlot(normalSlots, key, fn) {
|
2597 |
+
var normalized = function () {
|
2598 |
+
var res = arguments.length ? fn.apply(null, arguments) : fn({});
|
2599 |
+
res = res && typeof res === 'object' && !Array.isArray(res)
|
2600 |
+
? [res] // single vnode
|
2601 |
+
: normalizeChildren(res);
|
2602 |
+
return res && (
|
2603 |
+
res.length === 0 ||
|
2604 |
+
(res.length === 1 && res[0].isComment) // #9658
|
2605 |
+
) ? undefined
|
2606 |
+
: res
|
2607 |
+
};
|
2608 |
+
// this is a slot using the new v-slot syntax without scope. although it is
|
2609 |
+
// compiled as a scoped slot, render fn users would expect it to be present
|
2610 |
+
// on this.$slots because the usage is semantically a normal slot.
|
2611 |
+
if (fn.proxy) {
|
2612 |
+
Object.defineProperty(normalSlots, key, {
|
2613 |
+
get: normalized,
|
2614 |
+
enumerable: true,
|
2615 |
+
configurable: true
|
2616 |
+
});
|
2617 |
+
}
|
2618 |
+
return normalized
|
2619 |
+
}
|
2620 |
+
|
2621 |
+
function proxyNormalSlot(slots, key) {
|
2622 |
+
return function () { return slots[key]; }
|
2623 |
+
}
|
2624 |
+
|
2625 |
+
/* */
|
2626 |
+
|
2627 |
+
/**
|
2628 |
+
* Runtime helper for rendering v-for lists.
|
2629 |
+
*/
|
2630 |
+
function renderList (
|
2631 |
+
val,
|
2632 |
+
render
|
2633 |
+
) {
|
2634 |
+
var ret, i, l, keys, key;
|
2635 |
+
if (Array.isArray(val) || typeof val === 'string') {
|
2636 |
+
ret = new Array(val.length);
|
2637 |
+
for (i = 0, l = val.length; i < l; i++) {
|
2638 |
+
ret[i] = render(val[i], i);
|
2639 |
+
}
|
2640 |
+
} else if (typeof val === 'number') {
|
2641 |
+
ret = new Array(val);
|
2642 |
+
for (i = 0; i < val; i++) {
|
2643 |
+
ret[i] = render(i + 1, i);
|
2644 |
+
}
|
2645 |
+
} else if (isObject(val)) {
|
2646 |
+
if (hasSymbol && val[Symbol.iterator]) {
|
2647 |
+
ret = [];
|
2648 |
+
var iterator = val[Symbol.iterator]();
|
2649 |
+
var result = iterator.next();
|
2650 |
+
while (!result.done) {
|
2651 |
+
ret.push(render(result.value, ret.length));
|
2652 |
+
result = iterator.next();
|
2653 |
+
}
|
2654 |
+
} else {
|
2655 |
+
keys = Object.keys(val);
|
2656 |
+
ret = new Array(keys.length);
|
2657 |
+
for (i = 0, l = keys.length; i < l; i++) {
|
2658 |
+
key = keys[i];
|
2659 |
+
ret[i] = render(val[key], key, i);
|
2660 |
+
}
|
2661 |
+
}
|
2662 |
+
}
|
2663 |
+
if (!isDef(ret)) {
|
2664 |
+
ret = [];
|
2665 |
+
}
|
2666 |
+
(ret)._isVList = true;
|
2667 |
+
return ret
|
2668 |
+
}
|
2669 |
+
|
2670 |
+
/* */
|
2671 |
+
|
2672 |
+
/**
|
2673 |
+
* Runtime helper for rendering <slot>
|
2674 |
+
*/
|
2675 |
+
function renderSlot (
|
2676 |
+
name,
|
2677 |
+
fallback,
|
2678 |
+
props,
|
2679 |
+
bindObject
|
2680 |
+
) {
|
2681 |
+
var scopedSlotFn = this.$scopedSlots[name];
|
2682 |
+
var nodes;
|
2683 |
+
if (scopedSlotFn) { // scoped slot
|
2684 |
+
props = props || {};
|
2685 |
+
if (bindObject) {
|
2686 |
+
if (!isObject(bindObject)) {
|
2687 |
+
warn(
|
2688 |
+
'slot v-bind without argument expects an Object',
|
2689 |
+
this
|
2690 |
+
);
|
2691 |
+
}
|
2692 |
+
props = extend(extend({}, bindObject), props);
|
2693 |
+
}
|
2694 |
+
nodes = scopedSlotFn(props) || fallback;
|
2695 |
+
} else {
|
2696 |
+
nodes = this.$slots[name] || fallback;
|
2697 |
+
}
|
2698 |
+
|
2699 |
+
var target = props && props.slot;
|
2700 |
+
if (target) {
|
2701 |
+
return this.$createElement('template', { slot: target }, nodes)
|
2702 |
+
} else {
|
2703 |
+
return nodes
|
2704 |
+
}
|
2705 |
+
}
|
2706 |
+
|
2707 |
+
/* */
|
2708 |
+
|
2709 |
+
/**
|
2710 |
+
* Runtime helper for resolving filters
|
2711 |
+
*/
|
2712 |
+
function resolveFilter (id) {
|
2713 |
+
return resolveAsset(this.$options, 'filters', id, true) || identity
|
2714 |
+
}
|
2715 |
+
|
2716 |
+
/* */
|
2717 |
+
|
2718 |
+
function isKeyNotMatch (expect, actual) {
|
2719 |
+
if (Array.isArray(expect)) {
|
2720 |
+
return expect.indexOf(actual) === -1
|
2721 |
+
} else {
|
2722 |
+
return expect !== actual
|
2723 |
+
}
|
2724 |
+
}
|
2725 |
+
|
2726 |
+
/**
|
2727 |
+
* Runtime helper for checking keyCodes from config.
|
2728 |
+
* exposed as Vue.prototype._k
|
2729 |
+
* passing in eventKeyName as last argument separately for backwards compat
|
2730 |
+
*/
|
2731 |
+
function checkKeyCodes (
|
2732 |
+
eventKeyCode,
|
2733 |
+
key,
|
2734 |
+
builtInKeyCode,
|
2735 |
+
eventKeyName,
|
2736 |
+
builtInKeyName
|
2737 |
+
) {
|
2738 |
+
var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
|
2739 |
+
if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
|
2740 |
+
return isKeyNotMatch(builtInKeyName, eventKeyName)
|
2741 |
+
} else if (mappedKeyCode) {
|
2742 |
+
return isKeyNotMatch(mappedKeyCode, eventKeyCode)
|
2743 |
+
} else if (eventKeyName) {
|
2744 |
+
return hyphenate(eventKeyName) !== key
|
2745 |
+
}
|
2746 |
+
}
|
2747 |
+
|
2748 |
+
/* */
|
2749 |
+
|
2750 |
+
/**
|
2751 |
+
* Runtime helper for merging v-bind="object" into a VNode's data.
|
2752 |
+
*/
|
2753 |
+
function bindObjectProps (
|
2754 |
+
data,
|
2755 |
+
tag,
|
2756 |
+
value,
|
2757 |
+
asProp,
|
2758 |
+
isSync
|
2759 |
+
) {
|
2760 |
+
if (value) {
|
2761 |
+
if (!isObject(value)) {
|
2762 |
+
warn(
|
2763 |
+
'v-bind without argument expects an Object or Array value',
|
2764 |
+
this
|
2765 |
+
);
|
2766 |
+
} else {
|
2767 |
+
if (Array.isArray(value)) {
|
2768 |
+
value = toObject(value);
|
2769 |
+
}
|
2770 |
+
var hash;
|
2771 |
+
var loop = function ( key ) {
|
2772 |
+
if (
|
2773 |
+
key === 'class' ||
|
2774 |
+
key === 'style' ||
|
2775 |
+
isReservedAttribute(key)
|
2776 |
+
) {
|
2777 |
+
hash = data;
|
2778 |
+
} else {
|
2779 |
+
var type = data.attrs && data.attrs.type;
|
2780 |
+
hash = asProp || config.mustUseProp(tag, type, key)
|
2781 |
+
? data.domProps || (data.domProps = {})
|
2782 |
+
: data.attrs || (data.attrs = {});
|
2783 |
+
}
|
2784 |
+
var camelizedKey = camelize(key);
|
2785 |
+
var hyphenatedKey = hyphenate(key);
|
2786 |
+
if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
|
2787 |
+
hash[key] = value[key];
|
2788 |
+
|
2789 |
+
if (isSync) {
|
2790 |
+
var on = data.on || (data.on = {});
|
2791 |
+
on[("update:" + key)] = function ($event) {
|
2792 |
+
value[key] = $event;
|
2793 |
+
};
|
2794 |
+
}
|
2795 |
+
}
|
2796 |
+
};
|
2797 |
+
|
2798 |
+
for (var key in value) loop( key );
|
2799 |
+
}
|
2800 |
+
}
|
2801 |
+
return data
|
2802 |
+
}
|
2803 |
+
|
2804 |
+
/* */
|
2805 |
+
|
2806 |
+
/**
|
2807 |
+
* Runtime helper for rendering static trees.
|
2808 |
+
*/
|
2809 |
+
function renderStatic (
|
2810 |
+
index,
|
2811 |
+
isInFor
|
2812 |
+
) {
|
2813 |
+
var cached = this._staticTrees || (this._staticTrees = []);
|
2814 |
+
var tree = cached[index];
|
2815 |
+
// if has already-rendered static tree and not inside v-for,
|
2816 |
+
// we can reuse the same tree.
|
2817 |
+
if (tree && !isInFor) {
|
2818 |
+
return tree
|
2819 |
+
}
|
2820 |
+
// otherwise, render a fresh tree.
|
2821 |
+
tree = cached[index] = this.$options.staticRenderFns[index].call(
|
2822 |
+
this._renderProxy,
|
2823 |
+
null,
|
2824 |
+
this // for render fns generated for functional component templates
|
2825 |
+
);
|
2826 |
+
markStatic(tree, ("__static__" + index), false);
|
2827 |
+
return tree
|
2828 |
+
}
|
2829 |
+
|
2830 |
+
/**
|
2831 |
+
* Runtime helper for v-once.
|
2832 |
+
* Effectively it means marking the node as static with a unique key.
|
2833 |
+
*/
|
2834 |
+
function markOnce (
|
2835 |
+
tree,
|
2836 |
+
index,
|
2837 |
+
key
|
2838 |
+
) {
|
2839 |
+
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
|
2840 |
+
return tree
|
2841 |
+
}
|
2842 |
+
|
2843 |
+
function markStatic (
|
2844 |
+
tree,
|
2845 |
+
key,
|
2846 |
+
isOnce
|
2847 |
+
) {
|
2848 |
+
if (Array.isArray(tree)) {
|
2849 |
+
for (var i = 0; i < tree.length; i++) {
|
2850 |
+
if (tree[i] && typeof tree[i] !== 'string') {
|
2851 |
+
markStaticNode(tree[i], (key + "_" + i), isOnce);
|
2852 |
+
}
|
2853 |
+
}
|
2854 |
+
} else {
|
2855 |
+
markStaticNode(tree, key, isOnce);
|
2856 |
+
}
|
2857 |
+
}
|
2858 |
+
|
2859 |
+
function markStaticNode (node, key, isOnce) {
|
2860 |
+
node.isStatic = true;
|
2861 |
+
node.key = key;
|
2862 |
+
node.isOnce = isOnce;
|
2863 |
+
}
|
2864 |
+
|
2865 |
+
/* */
|
2866 |
+
|
2867 |
+
function bindObjectListeners (data, value) {
|
2868 |
+
if (value) {
|
2869 |
+
if (!isPlainObject(value)) {
|
2870 |
+
warn(
|
2871 |
+
'v-on without argument expects an Object value',
|
2872 |
+
this
|
2873 |
+
);
|
2874 |
+
} else {
|
2875 |
+
var on = data.on = data.on ? extend({}, data.on) : {};
|
2876 |
+
for (var key in value) {
|
2877 |
+
var existing = on[key];
|
2878 |
+
var ours = value[key];
|
2879 |
+
on[key] = existing ? [].concat(existing, ours) : ours;
|
2880 |
+
}
|
2881 |
+
}
|
2882 |
+
}
|
2883 |
+
return data
|
2884 |
+
}
|
2885 |
+
|
2886 |
+
/* */
|
2887 |
+
|
2888 |
+
function resolveScopedSlots (
|
2889 |
+
fns, // see flow/vnode
|
2890 |
+
res,
|
2891 |
+
// the following are added in 2.6
|
2892 |
+
hasDynamicKeys,
|
2893 |
+
contentHashKey
|
2894 |
+
) {
|
2895 |
+
res = res || { $stable: !hasDynamicKeys };
|
2896 |
+
for (var i = 0; i < fns.length; i++) {
|
2897 |
+
var slot = fns[i];
|
2898 |
+
if (Array.isArray(slot)) {
|
2899 |
+
resolveScopedSlots(slot, res, hasDynamicKeys);
|
2900 |
+
} else if (slot) {
|
2901 |
+
// marker for reverse proxying v-slot without scope on this.$slots
|
2902 |
+
if (slot.proxy) {
|
2903 |
+
slot.fn.proxy = true;
|
2904 |
+
}
|
2905 |
+
res[slot.key] = slot.fn;
|
2906 |
+
}
|
2907 |
+
}
|
2908 |
+
if (contentHashKey) {
|
2909 |
+
(res).$key = contentHashKey;
|
2910 |
+
}
|
2911 |
+
return res
|
2912 |
+
}
|
2913 |
+
|
2914 |
+
/* */
|
2915 |
+
|
2916 |
+
function bindDynamicKeys (baseObj, values) {
|
2917 |
+
for (var i = 0; i < values.length; i += 2) {
|
2918 |
+
var key = values[i];
|
2919 |
+
if (typeof key === 'string' && key) {
|
2920 |
+
baseObj[values[i]] = values[i + 1];
|
2921 |
+
} else if (key !== '' && key !== null) {
|
2922 |
+
// null is a speical value for explicitly removing a binding
|
2923 |
+
warn(
|
2924 |
+
("Invalid value for dynamic directive argument (expected string or null): " + key),
|
2925 |
+
this
|
2926 |
+
);
|
2927 |
+
}
|
2928 |
+
}
|
2929 |
+
return baseObj
|
2930 |
+
}
|
2931 |
+
|
2932 |
+
// helper to dynamically append modifier runtime markers to event names.
|
2933 |
+
// ensure only append when value is already string, otherwise it will be cast
|
2934 |
+
// to string and cause the type check to miss.
|
2935 |
+
function prependModifier (value, symbol) {
|
2936 |
+
return typeof value === 'string' ? symbol + value : value
|
2937 |
+
}
|
2938 |
+
|
2939 |
+
/* */
|
2940 |
+
|
2941 |
+
function installRenderHelpers (target) {
|
2942 |
+
target._o = markOnce;
|
2943 |
+
target._n = toNumber;
|
2944 |
+
target._s = toString;
|
2945 |
+
target._l = renderList;
|
2946 |
+
target._t = renderSlot;
|
2947 |
+
target._q = looseEqual;
|
2948 |
+
target._i = looseIndexOf;
|
2949 |
+
target._m = renderStatic;
|
2950 |
+
target._f = resolveFilter;
|
2951 |
+
target._k = checkKeyCodes;
|
2952 |
+
target._b = bindObjectProps;
|
2953 |
+
target._v = createTextVNode;
|
2954 |
+
target._e = createEmptyVNode;
|
2955 |
+
target._u = resolveScopedSlots;
|
2956 |
+
target._g = bindObjectListeners;
|
2957 |
+
target._d = bindDynamicKeys;
|
2958 |
+
target._p = prependModifier;
|
2959 |
+
}
|
2960 |
+
|
2961 |
+
/* */
|
2962 |
+
|
2963 |
+
function FunctionalRenderContext (
|
2964 |
+
data,
|
2965 |
+
props,
|
2966 |
+
children,
|
2967 |
+
parent,
|
2968 |
+
Ctor
|
2969 |
+
) {
|
2970 |
+
var this$1 = this;
|
2971 |
+
|
2972 |
+
var options = Ctor.options;
|
2973 |
+
// ensure the createElement function in functional components
|
2974 |
+
// gets a unique context - this is necessary for correct named slot check
|
2975 |
+
var contextVm;
|
2976 |
+
if (hasOwn(parent, '_uid')) {
|
2977 |
+
contextVm = Object.create(parent);
|
2978 |
+
// $flow-disable-line
|
2979 |
+
contextVm._original = parent;
|
2980 |
+
} else {
|
2981 |
+
// the context vm passed in is a functional context as well.
|
2982 |
+
// in this case we want to make sure we are able to get a hold to the
|
2983 |
+
// real context instance.
|
2984 |
+
contextVm = parent;
|
2985 |
+
// $flow-disable-line
|
2986 |
+
parent = parent._original;
|
2987 |
+
}
|
2988 |
+
var isCompiled = isTrue(options._compiled);
|
2989 |
+
var needNormalization = !isCompiled;
|
2990 |
+
|
2991 |
+
this.data = data;
|
2992 |
+
this.props = props;
|
2993 |
+
this.children = children;
|
2994 |
+
this.parent = parent;
|
2995 |
+
this.listeners = data.on || emptyObject;
|
2996 |
+
this.injections = resolveInject(options.inject, parent);
|
2997 |
+
this.slots = function () {
|
2998 |
+
if (!this$1.$slots) {
|
2999 |
+
normalizeScopedSlots(
|
3000 |
+
data.scopedSlots,
|
3001 |
+
this$1.$slots = resolveSlots(children, parent)
|
3002 |
+
);
|
3003 |
+
}
|
3004 |
+
return this$1.$slots
|
3005 |
+
};
|
3006 |
+
|
3007 |
+
Object.defineProperty(this, 'scopedSlots', ({
|
3008 |
+
enumerable: true,
|
3009 |
+
get: function get () {
|
3010 |
+
return normalizeScopedSlots(data.scopedSlots, this.slots())
|
3011 |
+
}
|
3012 |
+
}));
|
3013 |
+
|
3014 |
+
// support for compiled functional template
|
3015 |
+
if (isCompiled) {
|
3016 |
+
// exposing $options for renderStatic()
|
3017 |
+
this.$options = options;
|
3018 |
+
// pre-resolve slots for renderSlot()
|
3019 |
+
this.$slots = this.slots();
|
3020 |
+
this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
|
3021 |
+
}
|
3022 |
+
|
3023 |
+
if (options._scopeId) {
|
3024 |
+
this._c = function (a, b, c, d) {
|
3025 |
+
var vnode = createElement(contextVm, a, b, c, d, needNormalization);
|
3026 |
+
if (vnode && !Array.isArray(vnode)) {
|
3027 |
+
vnode.fnScopeId = options._scopeId;
|
3028 |
+
vnode.fnContext = parent;
|
3029 |
+
}
|
3030 |
+
return vnode
|
3031 |
+
};
|
3032 |
+
} else {
|
3033 |
+
this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
|
3034 |
+
}
|
3035 |
+
}
|
3036 |
+
|
3037 |
+
installRenderHelpers(FunctionalRenderContext.prototype);
|
3038 |
+
|
3039 |
+
function createFunctionalComponent (
|
3040 |
+
Ctor,
|
3041 |
+
propsData,
|
3042 |
+
data,
|
3043 |
+
contextVm,
|
3044 |
+
children
|
3045 |
+
) {
|
3046 |
+
var options = Ctor.options;
|
3047 |
+
var props = {};
|
3048 |
+
var propOptions = options.props;
|
3049 |
+
if (isDef(propOptions)) {
|
3050 |
+
for (var key in propOptions) {
|
3051 |
+
props[key] = validateProp(key, propOptions, propsData || emptyObject);
|
3052 |
+
}
|
3053 |
+
} else {
|
3054 |
+
if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
|
3055 |
+
if (isDef(data.props)) { mergeProps(props, data.props); }
|
3056 |
+
}
|
3057 |
+
|
3058 |
+
var renderContext = new FunctionalRenderContext(
|
3059 |
+
data,
|
3060 |
+
props,
|
3061 |
+
children,
|
3062 |
+
contextVm,
|
3063 |
+
Ctor
|
3064 |
+
);
|
3065 |
+
|
3066 |
+
var vnode = options.render.call(null, renderContext._c, renderContext);
|
3067 |
+
|
3068 |
+
if (vnode instanceof VNode) {
|
3069 |
+
return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
|
3070 |
+
} else if (Array.isArray(vnode)) {
|
3071 |
+
var vnodes = normalizeChildren(vnode) || [];
|
3072 |
+
var res = new Array(vnodes.length);
|
3073 |
+
for (var i = 0; i < vnodes.length; i++) {
|
3074 |
+
res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
|
3075 |
+
}
|
3076 |
+
return res
|
3077 |
+
}
|
3078 |
+
}
|
3079 |
+
|
3080 |
+
function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
|
3081 |
+
// #7817 clone node before setting fnContext, otherwise if the node is reused
|
3082 |
+
// (e.g. it was from a cached normal slot) the fnContext causes named slots
|
3083 |
+
// that should not be matched to match.
|
3084 |
+
var clone = cloneVNode(vnode);
|
3085 |
+
clone.fnContext = contextVm;
|
3086 |
+
clone.fnOptions = options;
|
3087 |
+
{
|
3088 |
+
(clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
|
3089 |
+
}
|
3090 |
+
if (data.slot) {
|
3091 |
+
(clone.data || (clone.data = {})).slot = data.slot;
|
3092 |
+
}
|
3093 |
+
return clone
|
3094 |
+
}
|
3095 |
+
|
3096 |
+
function mergeProps (to, from) {
|
3097 |
+
for (var key in from) {
|
3098 |
+
to[camelize(key)] = from[key];
|
3099 |
+
}
|
3100 |
+
}
|
3101 |
+
|
3102 |
+
/* */
|
3103 |
+
|
3104 |
+
/* */
|
3105 |
+
|
3106 |
+
/* */
|
3107 |
+
|
3108 |
+
/* */
|
3109 |
+
|
3110 |
+
// inline hooks to be invoked on component VNodes during patch
|
3111 |
+
var componentVNodeHooks = {
|
3112 |
+
init: function init (vnode, hydrating) {
|
3113 |
+
if (
|
3114 |
+
vnode.componentInstance &&
|
3115 |
+
!vnode.componentInstance._isDestroyed &&
|
3116 |
+
vnode.data.keepAlive
|
3117 |
+
) {
|
3118 |
+
// kept-alive components, treat as a patch
|
3119 |
+
var mountedNode = vnode; // work around flow
|
3120 |
+
componentVNodeHooks.prepatch(mountedNode, mountedNode);
|
3121 |
+
} else {
|
3122 |
+
var child = vnode.componentInstance = createComponentInstanceForVnode(
|
3123 |
+
vnode,
|
3124 |
+
activeInstance
|
3125 |
+
);
|
3126 |
+
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
|
3127 |
+
}
|
3128 |
+
},
|
3129 |
+
|
3130 |
+
prepatch: function prepatch (oldVnode, vnode) {
|
3131 |
+
var options = vnode.componentOptions;
|
3132 |
+
var child = vnode.componentInstance = oldVnode.componentInstance;
|
3133 |
+
updateChildComponent(
|
3134 |
+
child,
|
3135 |
+
options.propsData, // updated props
|
3136 |
+
options.listeners, // updated listeners
|
3137 |
+
vnode, // new parent vnode
|
3138 |
+
options.children // new children
|
3139 |
+
);
|
3140 |
+
},
|
3141 |
+
|
3142 |
+
insert: function insert (vnode) {
|
3143 |
+
var context = vnode.context;
|
3144 |
+
var componentInstance = vnode.componentInstance;
|
3145 |
+
if (!componentInstance._isMounted) {
|
3146 |
+
componentInstance._isMounted = true;
|
3147 |
+
callHook(componentInstance, 'mounted');
|
3148 |
+
}
|
3149 |
+
if (vnode.data.keepAlive) {
|
3150 |
+
if (context._isMounted) {
|
3151 |
+
// vue-router#1212
|
3152 |
+
// During updates, a kept-alive component's child components may
|
3153 |
+
// change, so directly walking the tree here may call activated hooks
|
3154 |
+
// on incorrect children. Instead we push them into a queue which will
|
3155 |
+
// be processed after the whole patch process ended.
|
3156 |
+
queueActivatedComponent(componentInstance);
|
3157 |
+
} else {
|
3158 |
+
activateChildComponent(componentInstance, true /* direct */);
|
3159 |
+
}
|
3160 |
+
}
|
3161 |
+
},
|
3162 |
+
|
3163 |
+
destroy: function destroy (vnode) {
|
3164 |
+
var componentInstance = vnode.componentInstance;
|
3165 |
+
if (!componentInstance._isDestroyed) {
|
3166 |
+
if (!vnode.data.keepAlive) {
|
3167 |
+
componentInstance.$destroy();
|
3168 |
+
} else {
|
3169 |
+
deactivateChildComponent(componentInstance, true /* direct */);
|
3170 |
+
}
|
3171 |
+
}
|
3172 |
+
}
|
3173 |
+
};
|
3174 |
+
|
3175 |
+
var hooksToMerge = Object.keys(componentVNodeHooks);
|
3176 |
+
|
3177 |
+
function createComponent (
|
3178 |
+
Ctor,
|
3179 |
+
data,
|
3180 |
+
context,
|
3181 |
+
children,
|
3182 |
+
tag
|
3183 |
+
) {
|
3184 |
+
if (isUndef(Ctor)) {
|
3185 |
+
return
|
3186 |
+
}
|
3187 |
+
|
3188 |
+
var baseCtor = context.$options._base;
|
3189 |
+
|
3190 |
+
// plain options object: turn it into a constructor
|
3191 |
+
if (isObject(Ctor)) {
|
3192 |
+
Ctor = baseCtor.extend(Ctor);
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
// if at this stage it's not a constructor or an async component factory,
|
3196 |
+
// reject.
|
3197 |
+
if (typeof Ctor !== 'function') {
|
3198 |
+
{
|
3199 |
+
warn(("Invalid Component definition: " + (String(Ctor))), context);
|
3200 |
+
}
|
3201 |
+
return
|
3202 |
+
}
|
3203 |
+
|
3204 |
+
// async component
|
3205 |
+
var asyncFactory;
|
3206 |
+
if (isUndef(Ctor.cid)) {
|
3207 |
+
asyncFactory = Ctor;
|
3208 |
+
Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
|
3209 |
+
if (Ctor === undefined) {
|
3210 |
+
// return a placeholder node for async component, which is rendered
|
3211 |
+
// as a comment node but preserves all the raw information for the node.
|
3212 |
+
// the information will be used for async server-rendering and hydration.
|
3213 |
+
return createAsyncPlaceholder(
|
3214 |
+
asyncFactory,
|
3215 |
+
data,
|
3216 |
+
context,
|
3217 |
+
children,
|
3218 |
+
tag
|
3219 |
+
)
|
3220 |
+
}
|
3221 |
+
}
|
3222 |
+
|
3223 |
+
data = data || {};
|
3224 |
+
|
3225 |
+
// resolve constructor options in case global mixins are applied after
|
3226 |
+
// component constructor creation
|
3227 |
+
resolveConstructorOptions(Ctor);
|
3228 |
+
|
3229 |
+
// transform component v-model data into props & events
|
3230 |
+
if (isDef(data.model)) {
|
3231 |
+
transformModel(Ctor.options, data);
|
3232 |
+
}
|
3233 |
+
|
3234 |
+
// extract props
|
3235 |
+
var propsData = extractPropsFromVNodeData(data, Ctor, tag);
|
3236 |
+
|
3237 |
+
// functional component
|
3238 |
+
if (isTrue(Ctor.options.functional)) {
|
3239 |
+
return createFunctionalComponent(Ctor, propsData, data, context, children)
|
3240 |
+
}
|
3241 |
+
|
3242 |
+
// extract listeners, since these needs to be treated as
|
3243 |
+
// child component listeners instead of DOM listeners
|
3244 |
+
var listeners = data.on;
|
3245 |
+
// replace with listeners with .native modifier
|
3246 |
+
// so it gets processed during parent component patch.
|
3247 |
+
data.on = data.nativeOn;
|
3248 |
+
|
3249 |
+
if (isTrue(Ctor.options.abstract)) {
|
3250 |
+
// abstract components do not keep anything
|
3251 |
+
// other than props & listeners & slot
|
3252 |
+
|
3253 |
+
// work around flow
|
3254 |
+
var slot = data.slot;
|
3255 |
+
data = {};
|
3256 |
+
if (slot) {
|
3257 |
+
data.slot = slot;
|
3258 |
+
}
|
3259 |
+
}
|
3260 |
+
|
3261 |
+
// install component management hooks onto the placeholder node
|
3262 |
+
installComponentHooks(data);
|
3263 |
+
|
3264 |
+
// return a placeholder vnode
|
3265 |
+
var name = Ctor.options.name || tag;
|
3266 |
+
var vnode = new VNode(
|
3267 |
+
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
|
3268 |
+
data, undefined, undefined, undefined, context,
|
3269 |
+
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
|
3270 |
+
asyncFactory
|
3271 |
+
);
|
3272 |
+
|
3273 |
+
return vnode
|
3274 |
+
}
|
3275 |
+
|
3276 |
+
function createComponentInstanceForVnode (
|
3277 |
+
vnode, // we know it's MountedComponentVNode but flow doesn't
|
3278 |
+
parent // activeInstance in lifecycle state
|
3279 |
+
) {
|
3280 |
+
var options = {
|
3281 |
+
_isComponent: true,
|
3282 |
+
_parentVnode: vnode,
|
3283 |
+
parent: parent
|
3284 |
+
};
|
3285 |
+
// check inline-template render functions
|
3286 |
+
var inlineTemplate = vnode.data.inlineTemplate;
|
3287 |
+
if (isDef(inlineTemplate)) {
|
3288 |
+
options.render = inlineTemplate.render;
|
3289 |
+
options.staticRenderFns = inlineTemplate.staticRenderFns;
|
3290 |
+
}
|
3291 |
+
return new vnode.componentOptions.Ctor(options)
|
3292 |
+
}
|
3293 |
+
|
3294 |
+
function installComponentHooks (data) {
|
3295 |
+
var hooks = data.hook || (data.hook = {});
|
3296 |
+
for (var i = 0; i < hooksToMerge.length; i++) {
|
3297 |
+
var key = hooksToMerge[i];
|
3298 |
+
var existing = hooks[key];
|
3299 |
+
var toMerge = componentVNodeHooks[key];
|
3300 |
+
if (existing !== toMerge && !(existing && existing._merged)) {
|
3301 |
+
hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
|
3302 |
+
}
|
3303 |
+
}
|
3304 |
+
}
|
3305 |
+
|
3306 |
+
function mergeHook$1 (f1, f2) {
|
3307 |
+
var merged = function (a, b) {
|
3308 |
+
// flow complains about extra args which is why we use any
|
3309 |
+
f1(a, b);
|
3310 |
+
f2(a, b);
|
3311 |
+
};
|
3312 |
+
merged._merged = true;
|
3313 |
+
return merged
|
3314 |
+
}
|
3315 |
+
|
3316 |
+
// transform component v-model info (value and callback) into
|
3317 |
+
// prop and event handler respectively.
|
3318 |
+
function transformModel (options, data) {
|
3319 |
+
var prop = (options.model && options.model.prop) || 'value';
|
3320 |
+
var event = (options.model && options.model.event) || 'input'
|
3321 |
+
;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
|
3322 |
+
var on = data.on || (data.on = {});
|
3323 |
+
var existing = on[event];
|
3324 |
+
var callback = data.model.callback;
|
3325 |
+
if (isDef(existing)) {
|
3326 |
+
if (
|
3327 |
+
Array.isArray(existing)
|
3328 |
+
? existing.indexOf(callback) === -1
|
3329 |
+
: existing !== callback
|
3330 |
+
) {
|
3331 |
+
on[event] = [callback].concat(existing);
|
3332 |
+
}
|
3333 |
+
} else {
|
3334 |
+
on[event] = callback;
|
3335 |
+
}
|
3336 |
+
}
|
3337 |
+
|
3338 |
+
/* */
|
3339 |
+
|
3340 |
+
var SIMPLE_NORMALIZE = 1;
|
3341 |
+
var ALWAYS_NORMALIZE = 2;
|
3342 |
+
|
3343 |
+
// wrapper function for providing a more flexible interface
|
3344 |
+
// without getting yelled at by flow
|
3345 |
+
function createElement (
|
3346 |
+
context,
|
3347 |
+
tag,
|
3348 |
+
data,
|
3349 |
+
children,
|
3350 |
+
normalizationType,
|
3351 |
+
alwaysNormalize
|
3352 |
+
) {
|
3353 |
+
if (Array.isArray(data) || isPrimitive(data)) {
|
3354 |
+
normalizationType = children;
|
3355 |
+
children = data;
|
3356 |
+
data = undefined;
|
3357 |
+
}
|
3358 |
+
if (isTrue(alwaysNormalize)) {
|
3359 |
+
normalizationType = ALWAYS_NORMALIZE;
|
3360 |
+
}
|
3361 |
+
return _createElement(context, tag, data, children, normalizationType)
|
3362 |
+
}
|
3363 |
+
|
3364 |
+
function _createElement (
|
3365 |
+
context,
|
3366 |
+
tag,
|
3367 |
+
data,
|
3368 |
+
children,
|
3369 |
+
normalizationType
|
3370 |
+
) {
|
3371 |
+
if (isDef(data) && isDef((data).__ob__)) {
|
3372 |
+
warn(
|
3373 |
+
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
|
3374 |
+
'Always create fresh vnode data objects in each render!',
|
3375 |
+
context
|
3376 |
+
);
|
3377 |
+
return createEmptyVNode()
|
3378 |
+
}
|
3379 |
+
// object syntax in v-bind
|
3380 |
+
if (isDef(data) && isDef(data.is)) {
|
3381 |
+
tag = data.is;
|
3382 |
+
}
|
3383 |
+
if (!tag) {
|
3384 |
+
// in case of component :is set to falsy value
|
3385 |
+
return createEmptyVNode()
|
3386 |
+
}
|
3387 |
+
// warn against non-primitive key
|
3388 |
+
if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
|
3389 |
+
) {
|
3390 |
+
{
|
3391 |
+
warn(
|
3392 |
+
'Avoid using non-primitive value as key, ' +
|
3393 |
+
'use string/number value instead.',
|
3394 |
+
context
|
3395 |
+
);
|
3396 |
+
}
|
3397 |
+
}
|
3398 |
+
// support single function children as default scoped slot
|
3399 |
+
if (Array.isArray(children) &&
|
3400 |
+
typeof children[0] === 'function'
|
3401 |
+
) {
|
3402 |
+
data = data || {};
|
3403 |
+
data.scopedSlots = { default: children[0] };
|
3404 |
+
children.length = 0;
|
3405 |
+
}
|
3406 |
+
if (normalizationType === ALWAYS_NORMALIZE) {
|
3407 |
+
children = normalizeChildren(children);
|
3408 |
+
} else if (normalizationType === SIMPLE_NORMALIZE) {
|
3409 |
+
children = simpleNormalizeChildren(children);
|
3410 |
+
}
|
3411 |
+
var vnode, ns;
|
3412 |
+
if (typeof tag === 'string') {
|
3413 |
+
var Ctor;
|
3414 |
+
ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
|
3415 |
+
if (config.isReservedTag(tag)) {
|
3416 |
+
// platform built-in elements
|
3417 |
+
vnode = new VNode(
|
3418 |
+
config.parsePlatformTagName(tag), data, children,
|
3419 |
+
undefined, undefined, context
|
3420 |
+
);
|
3421 |
+
} else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
|
3422 |
+
// component
|
3423 |
+
vnode = createComponent(Ctor, data, context, children, tag);
|
3424 |
+
} else {
|
3425 |
+
// unknown or unlisted namespaced elements
|
3426 |
+
// check at runtime because it may get assigned a namespace when its
|
3427 |
+
// parent normalizes children
|
3428 |
+
vnode = new VNode(
|
3429 |
+
tag, data, children,
|
3430 |
+
undefined, undefined, context
|
3431 |
+
);
|
3432 |
+
}
|
3433 |
+
} else {
|
3434 |
+
// direct component options / constructor
|
3435 |
+
vnode = createComponent(tag, data, context, children);
|
3436 |
+
}
|
3437 |
+
if (Array.isArray(vnode)) {
|
3438 |
+
return vnode
|
3439 |
+
} else if (isDef(vnode)) {
|
3440 |
+
if (isDef(ns)) { applyNS(vnode, ns); }
|
3441 |
+
if (isDef(data)) { registerDeepBindings(data); }
|
3442 |
+
return vnode
|
3443 |
+
} else {
|
3444 |
+
return createEmptyVNode()
|
3445 |
+
}
|
3446 |
+
}
|
3447 |
+
|
3448 |
+
function applyNS (vnode, ns, force) {
|
3449 |
+
vnode.ns = ns;
|
3450 |
+
if (vnode.tag === 'foreignObject') {
|
3451 |
+
// use default namespace inside foreignObject
|
3452 |
+
ns = undefined;
|
3453 |
+
force = true;
|
3454 |
+
}
|
3455 |
+
if (isDef(vnode.children)) {
|
3456 |
+
for (var i = 0, l = vnode.children.length; i < l; i++) {
|
3457 |
+
var child = vnode.children[i];
|
3458 |
+
if (isDef(child.tag) && (
|
3459 |
+
isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
|
3460 |
+
applyNS(child, ns, force);
|
3461 |
+
}
|
3462 |
+
}
|
3463 |
+
}
|
3464 |
+
}
|
3465 |
+
|
3466 |
+
// ref #5318
|
3467 |
+
// necessary to ensure parent re-render when deep bindings like :style and
|
3468 |
+
// :class are used on slot nodes
|
3469 |
+
function registerDeepBindings (data) {
|
3470 |
+
if (isObject(data.style)) {
|
3471 |
+
traverse(data.style);
|
3472 |
+
}
|
3473 |
+
if (isObject(data.class)) {
|
3474 |
+
traverse(data.class);
|
3475 |
+
}
|
3476 |
+
}
|
3477 |
+
|
3478 |
+
/* */
|
3479 |
+
|
3480 |
+
function initRender (vm) {
|
3481 |
+
vm._vnode = null; // the root of the child tree
|
3482 |
+
vm._staticTrees = null; // v-once cached trees
|
3483 |
+
var options = vm.$options;
|
3484 |
+
var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
|
3485 |
+
var renderContext = parentVnode && parentVnode.context;
|
3486 |
+
vm.$slots = resolveSlots(options._renderChildren, renderContext);
|
3487 |
+
vm.$scopedSlots = emptyObject;
|
3488 |
+
// bind the createElement fn to this instance
|
3489 |
+
// so that we get proper render context inside it.
|
3490 |
+
// args order: tag, data, children, normalizationType, alwaysNormalize
|
3491 |
+
// internal version is used by render functions compiled from templates
|
3492 |
+
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
|
3493 |
+
// normalization is always applied for the public version, used in
|
3494 |
+
// user-written render functions.
|
3495 |
+
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
|
3496 |
+
|
3497 |
+
// $attrs & $listeners are exposed for easier HOC creation.
|
3498 |
+
// they need to be reactive so that HOCs using them are always updated
|
3499 |
+
var parentData = parentVnode && parentVnode.data;
|
3500 |
+
|
3501 |
+
/* istanbul ignore else */
|
3502 |
+
{
|
3503 |
+
defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
|
3504 |
+
!isUpdatingChildComponent && warn("$attrs is readonly.", vm);
|
3505 |
+
}, true);
|
3506 |
+
defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
|
3507 |
+
!isUpdatingChildComponent && warn("$listeners is readonly.", vm);
|
3508 |
+
}, true);
|
3509 |
+
}
|
3510 |
+
}
|
3511 |
+
|
3512 |
+
var currentRenderingInstance = null;
|
3513 |
+
|
3514 |
+
function renderMixin (Vue) {
|
3515 |
+
// install runtime convenience helpers
|
3516 |
+
installRenderHelpers(Vue.prototype);
|
3517 |
+
|
3518 |
+
Vue.prototype.$nextTick = function (fn) {
|
3519 |
+
return nextTick(fn, this)
|
3520 |
+
};
|
3521 |
+
|
3522 |
+
Vue.prototype._render = function () {
|
3523 |
+
var vm = this;
|
3524 |
+
var ref = vm.$options;
|
3525 |
+
var render = ref.render;
|
3526 |
+
var _parentVnode = ref._parentVnode;
|
3527 |
+
|
3528 |
+
if (_parentVnode) {
|
3529 |
+
vm.$scopedSlots = normalizeScopedSlots(
|
3530 |
+
_parentVnode.data.scopedSlots,
|
3531 |
+
vm.$slots,
|
3532 |
+
vm.$scopedSlots
|
3533 |
+
);
|
3534 |
+
}
|
3535 |
+
|
3536 |
+
// set parent vnode. this allows render functions to have access
|
3537 |
+
// to the data on the placeholder node.
|
3538 |
+
vm.$vnode = _parentVnode;
|
3539 |
+
// render self
|
3540 |
+
var vnode;
|
3541 |
+
try {
|
3542 |
+
// There's no need to maintain a stack becaues all render fns are called
|
3543 |
+
// separately from one another. Nested component's render fns are called
|
3544 |
+
// when parent component is patched.
|
3545 |
+
currentRenderingInstance = vm;
|
3546 |
+
vnode = render.call(vm._renderProxy, vm.$createElement);
|
3547 |
+
} catch (e) {
|
3548 |
+
handleError(e, vm, "render");
|
3549 |
+
// return error render result,
|
3550 |
+
// or previous vnode to prevent render error causing blank component
|
3551 |
+
/* istanbul ignore else */
|
3552 |
+
if (vm.$options.renderError) {
|
3553 |
+
try {
|
3554 |
+
vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
|
3555 |
+
} catch (e) {
|
3556 |
+
handleError(e, vm, "renderError");
|
3557 |
+
vnode = vm._vnode;
|
3558 |
+
}
|
3559 |
+
} else {
|
3560 |
+
vnode = vm._vnode;
|
3561 |
+
}
|
3562 |
+
} finally {
|
3563 |
+
currentRenderingInstance = null;
|
3564 |
+
}
|
3565 |
+
// if the returned array contains only a single node, allow it
|
3566 |
+
if (Array.isArray(vnode) && vnode.length === 1) {
|
3567 |
+
vnode = vnode[0];
|
3568 |
+
}
|
3569 |
+
// return empty vnode in case the render function errored out
|
3570 |
+
if (!(vnode instanceof VNode)) {
|
3571 |
+
if (Array.isArray(vnode)) {
|
3572 |
+
warn(
|
3573 |
+
'Multiple root nodes returned from render function. Render function ' +
|
3574 |
+
'should return a single root node.',
|
3575 |
+
vm
|
3576 |
+
);
|
3577 |
+
}
|
3578 |
+
vnode = createEmptyVNode();
|
3579 |
+
}
|
3580 |
+
// set parent
|
3581 |
+
vnode.parent = _parentVnode;
|
3582 |
+
return vnode
|
3583 |
+
};
|
3584 |
+
}
|
3585 |
+
|
3586 |
+
/* */
|
3587 |
+
|
3588 |
+
function ensureCtor (comp, base) {
|
3589 |
+
if (
|
3590 |
+
comp.__esModule ||
|
3591 |
+
(hasSymbol && comp[Symbol.toStringTag] === 'Module')
|
3592 |
+
) {
|
3593 |
+
comp = comp.default;
|
3594 |
+
}
|
3595 |
+
return isObject(comp)
|
3596 |
+
? base.extend(comp)
|
3597 |
+
: comp
|
3598 |
+
}
|
3599 |
+
|
3600 |
+
function createAsyncPlaceholder (
|
3601 |
+
factory,
|
3602 |
+
data,
|
3603 |
+
context,
|
3604 |
+
children,
|
3605 |
+
tag
|
3606 |
+
) {
|
3607 |
+
var node = createEmptyVNode();
|
3608 |
+
node.asyncFactory = factory;
|
3609 |
+
node.asyncMeta = { data: data, context: context, children: children, tag: tag };
|
3610 |
+
return node
|
3611 |
+
}
|
3612 |
+
|
3613 |
+
function resolveAsyncComponent (
|
3614 |
+
factory,
|
3615 |
+
baseCtor
|
3616 |
+
) {
|
3617 |
+
if (isTrue(factory.error) && isDef(factory.errorComp)) {
|
3618 |
+
return factory.errorComp
|
3619 |
+
}
|
3620 |
+
|
3621 |
+
if (isDef(factory.resolved)) {
|
3622 |
+
return factory.resolved
|
3623 |
+
}
|
3624 |
+
|
3625 |
+
var owner = currentRenderingInstance;
|
3626 |
+
if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
|
3627 |
+
// already pending
|
3628 |
+
factory.owners.push(owner);
|
3629 |
+
}
|
3630 |
+
|
3631 |
+
if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
|
3632 |
+
return factory.loadingComp
|
3633 |
+
}
|
3634 |
+
|
3635 |
+
if (owner && !isDef(factory.owners)) {
|
3636 |
+
var owners = factory.owners = [owner];
|
3637 |
+
var sync = true;
|
3638 |
+
var timerLoading = null;
|
3639 |
+
var timerTimeout = null
|
3640 |
+
|
3641 |
+
;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
|
3642 |
+
|
3643 |
+
var forceRender = function (renderCompleted) {
|
3644 |
+
for (var i = 0, l = owners.length; i < l; i++) {
|
3645 |
+
(owners[i]).$forceUpdate();
|
3646 |
+
}
|
3647 |
+
|
3648 |
+
if (renderCompleted) {
|
3649 |
+
owners.length = 0;
|
3650 |
+
if (timerLoading !== null) {
|
3651 |
+
clearTimeout(timerLoading);
|
3652 |
+
timerLoading = null;
|
3653 |
+
}
|
3654 |
+
if (timerTimeout !== null) {
|
3655 |
+
clearTimeout(timerTimeout);
|
3656 |
+
timerTimeout = null;
|
3657 |
+
}
|
3658 |
+
}
|
3659 |
+
};
|
3660 |
+
|
3661 |
+
var resolve = once(function (res) {
|
3662 |
+
// cache resolved
|
3663 |
+
factory.resolved = ensureCtor(res, baseCtor);
|
3664 |
+
// invoke callbacks only if this is not a synchronous resolve
|
3665 |
+
// (async resolves are shimmed as synchronous during SSR)
|
3666 |
+
if (!sync) {
|
3667 |
+
forceRender(true);
|
3668 |
+
} else {
|
3669 |
+
owners.length = 0;
|
3670 |
+
}
|
3671 |
+
});
|
3672 |
+
|
3673 |
+
var reject = once(function (reason) {
|
3674 |
+
warn(
|
3675 |
+
"Failed to resolve async component: " + (String(factory)) +
|
3676 |
+
(reason ? ("\nReason: " + reason) : '')
|
3677 |
+
);
|
3678 |
+
if (isDef(factory.errorComp)) {
|
3679 |
+
factory.error = true;
|
3680 |
+
forceRender(true);
|
3681 |
+
}
|
3682 |
+
});
|
3683 |
+
|
3684 |
+
var res = factory(resolve, reject);
|
3685 |
+
|
3686 |
+
if (isObject(res)) {
|
3687 |
+
if (isPromise(res)) {
|
3688 |
+
// () => Promise
|
3689 |
+
if (isUndef(factory.resolved)) {
|
3690 |
+
res.then(resolve, reject);
|
3691 |
+
}
|
3692 |
+
} else if (isPromise(res.component)) {
|
3693 |
+
res.component.then(resolve, reject);
|
3694 |
+
|
3695 |
+
if (isDef(res.error)) {
|
3696 |
+
factory.errorComp = ensureCtor(res.error, baseCtor);
|
3697 |
+
}
|
3698 |
+
|
3699 |
+
if (isDef(res.loading)) {
|
3700 |
+
factory.loadingComp = ensureCtor(res.loading, baseCtor);
|
3701 |
+
if (res.delay === 0) {
|
3702 |
+
factory.loading = true;
|
3703 |
+
} else {
|
3704 |
+
timerLoading = setTimeout(function () {
|
3705 |
+
timerLoading = null;
|
3706 |
+
if (isUndef(factory.resolved) && isUndef(factory.error)) {
|
3707 |
+
factory.loading = true;
|
3708 |
+
forceRender(false);
|
3709 |
+
}
|
3710 |
+
}, res.delay || 200);
|
3711 |
+
}
|
3712 |
+
}
|
3713 |
+
|
3714 |
+
if (isDef(res.timeout)) {
|
3715 |
+
timerTimeout = setTimeout(function () {
|
3716 |
+
timerTimeout = null;
|
3717 |
+
if (isUndef(factory.resolved)) {
|
3718 |
+
reject(
|
3719 |
+
"timeout (" + (res.timeout) + "ms)"
|
3720 |
+
);
|
3721 |
+
}
|
3722 |
+
}, res.timeout);
|
3723 |
+
}
|
3724 |
+
}
|
3725 |
+
}
|
3726 |
+
|
3727 |
+
sync = false;
|
3728 |
+
// return in case resolved synchronously
|
3729 |
+
return factory.loading
|
3730 |
+
? factory.loadingComp
|
3731 |
+
: factory.resolved
|
3732 |
+
}
|
3733 |
+
}
|
3734 |
+
|
3735 |
+
/* */
|
3736 |
+
|
3737 |
+
function isAsyncPlaceholder (node) {
|
3738 |
+
return node.isComment && node.asyncFactory
|
3739 |
+
}
|
3740 |
+
|
3741 |
+
/* */
|
3742 |
+
|
3743 |
+
function getFirstComponentChild (children) {
|
3744 |
+
if (Array.isArray(children)) {
|
3745 |
+
for (var i = 0; i < children.length; i++) {
|
3746 |
+
var c = children[i];
|
3747 |
+
if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
|
3748 |
+
return c
|
3749 |
+
}
|
3750 |
+
}
|
3751 |
+
}
|
3752 |
+
}
|
3753 |
+
|
3754 |
+
/* */
|
3755 |
+
|
3756 |
+
/* */
|
3757 |
+
|
3758 |
+
function initEvents (vm) {
|
3759 |
+
vm._events = Object.create(null);
|
3760 |
+
vm._hasHookEvent = false;
|
3761 |
+
// init parent attached events
|
3762 |
+
var listeners = vm.$options._parentListeners;
|
3763 |
+
if (listeners) {
|
3764 |
+
updateComponentListeners(vm, listeners);
|
3765 |
+
}
|
3766 |
+
}
|
3767 |
+
|
3768 |
+
var target;
|
3769 |
+
|
3770 |
+
function add (event, fn) {
|
3771 |
+
target.$on(event, fn);
|
3772 |
+
}
|
3773 |
+
|
3774 |
+
function remove$1 (event, fn) {
|
3775 |
+
target.$off(event, fn);
|
3776 |
+
}
|
3777 |
+
|
3778 |
+
function createOnceHandler (event, fn) {
|
3779 |
+
var _target = target;
|
3780 |
+
return function onceHandler () {
|
3781 |
+
var res = fn.apply(null, arguments);
|
3782 |
+
if (res !== null) {
|
3783 |
+
_target.$off(event, onceHandler);
|
3784 |
+
}
|
3785 |
+
}
|
3786 |
+
}
|
3787 |
+
|
3788 |
+
function updateComponentListeners (
|
3789 |
+
vm,
|
3790 |
+
listeners,
|
3791 |
+
oldListeners
|
3792 |
+
) {
|
3793 |
+
target = vm;
|
3794 |
+
updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
|
3795 |
+
target = undefined;
|
3796 |
+
}
|
3797 |
+
|
3798 |
+
function eventsMixin (Vue) {
|
3799 |
+
var hookRE = /^hook:/;
|
3800 |
+
Vue.prototype.$on = function (event, fn) {
|
3801 |
+
var vm = this;
|
3802 |
+
if (Array.isArray(event)) {
|
3803 |
+
for (var i = 0, l = event.length; i < l; i++) {
|
3804 |
+
vm.$on(event[i], fn);
|
3805 |
+
}
|
3806 |
+
} else {
|
3807 |
+
(vm._events[event] || (vm._events[event] = [])).push(fn);
|
3808 |
+
// optimize hook:event cost by using a boolean flag marked at registration
|
3809 |
+
// instead of a hash lookup
|
3810 |
+
if (hookRE.test(event)) {
|
3811 |
+
vm._hasHookEvent = true;
|
3812 |
+
}
|
3813 |
+
}
|
3814 |
+
return vm
|
3815 |
+
};
|
3816 |
+
|
3817 |
+
Vue.prototype.$once = function (event, fn) {
|
3818 |
+
var vm = this;
|
3819 |
+
function on () {
|
3820 |
+
vm.$off(event, on);
|
3821 |
+
fn.apply(vm, arguments);
|
3822 |
+
}
|
3823 |
+
on.fn = fn;
|
3824 |
+
vm.$on(event, on);
|
3825 |
+
return vm
|
3826 |
+
};
|
3827 |
+
|
3828 |
+
Vue.prototype.$off = function (event, fn) {
|
3829 |
+
var vm = this;
|
3830 |
+
// all
|
3831 |
+
if (!arguments.length) {
|
3832 |
+
vm._events = Object.create(null);
|
3833 |
+
return vm
|
3834 |
+
}
|
3835 |
+
// array of events
|
3836 |
+
if (Array.isArray(event)) {
|
3837 |
+
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
|
3838 |
+
vm.$off(event[i$1], fn);
|
3839 |
+
}
|
3840 |
+
return vm
|
3841 |
+
}
|
3842 |
+
// specific event
|
3843 |
+
var cbs = vm._events[event];
|
3844 |
+
if (!cbs) {
|
3845 |
+
return vm
|
3846 |
+
}
|
3847 |
+
if (!fn) {
|
3848 |
+
vm._events[event] = null;
|
3849 |
+
return vm
|
3850 |
+
}
|
3851 |
+
// specific handler
|
3852 |
+
var cb;
|
3853 |
+
var i = cbs.length;
|
3854 |
+
while (i--) {
|
3855 |
+
cb = cbs[i];
|
3856 |
+
if (cb === fn || cb.fn === fn) {
|
3857 |
+
cbs.splice(i, 1);
|
3858 |
+
break
|
3859 |
+
}
|
3860 |
+
}
|
3861 |
+
return vm
|
3862 |
+
};
|
3863 |
+
|
3864 |
+
Vue.prototype.$emit = function (event) {
|
3865 |
+
var vm = this;
|
3866 |
+
{
|
3867 |
+
var lowerCaseEvent = event.toLowerCase();
|
3868 |
+
if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
|
3869 |
+
tip(
|
3870 |
+
"Event \"" + lowerCaseEvent + "\" is emitted in component " +
|
3871 |
+
(formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
|
3872 |
+
"Note that HTML attributes are case-insensitive and you cannot use " +
|
3873 |
+
"v-on to listen to camelCase events when using in-DOM templates. " +
|
3874 |
+
"You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
|
3875 |
+
);
|
3876 |
+
}
|
3877 |
+
}
|
3878 |
+
var cbs = vm._events[event];
|
3879 |
+
if (cbs) {
|
3880 |
+
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
|
3881 |
+
var args = toArray(arguments, 1);
|
3882 |
+
var info = "event handler for \"" + event + "\"";
|
3883 |
+
for (var i = 0, l = cbs.length; i < l; i++) {
|
3884 |
+
invokeWithErrorHandling(cbs[i], vm, args, vm, info);
|
3885 |
+
}
|
3886 |
+
}
|
3887 |
+
return vm
|
3888 |
+
};
|
3889 |
+
}
|
3890 |
+
|
3891 |
+
/* */
|
3892 |
+
|
3893 |
+
var activeInstance = null;
|
3894 |
+
var isUpdatingChildComponent = false;
|
3895 |
+
|
3896 |
+
function setActiveInstance(vm) {
|
3897 |
+
var prevActiveInstance = activeInstance;
|
3898 |
+
activeInstance = vm;
|
3899 |
+
return function () {
|
3900 |
+
activeInstance = prevActiveInstance;
|
3901 |
+
}
|
3902 |
+
}
|
3903 |
+
|
3904 |
+
function initLifecycle (vm) {
|
3905 |
+
var options = vm.$options;
|
3906 |
+
|
3907 |
+
// locate first non-abstract parent
|
3908 |
+
var parent = options.parent;
|
3909 |
+
if (parent && !options.abstract) {
|
3910 |
+
while (parent.$options.abstract && parent.$parent) {
|
3911 |
+
parent = parent.$parent;
|
3912 |
+
}
|
3913 |
+
parent.$children.push(vm);
|
3914 |
+
}
|
3915 |
+
|
3916 |
+
vm.$parent = parent;
|
3917 |
+
vm.$root = parent ? parent.$root : vm;
|
3918 |
+
|
3919 |
+
vm.$children = [];
|
3920 |
+
vm.$refs = {};
|
3921 |
+
|
3922 |
+
vm._watcher = null;
|
3923 |
+
vm._inactive = null;
|
3924 |
+
vm._directInactive = false;
|
3925 |
+
vm._isMounted = false;
|
3926 |
+
vm._isDestroyed = false;
|
3927 |
+
vm._isBeingDestroyed = false;
|
3928 |
+
}
|
3929 |
+
|
3930 |
+
function lifecycleMixin (Vue) {
|
3931 |
+
Vue.prototype._update = function (vnode, hydrating) {
|
3932 |
+
var vm = this;
|
3933 |
+
var prevEl = vm.$el;
|
3934 |
+
var prevVnode = vm._vnode;
|
3935 |
+
var restoreActiveInstance = setActiveInstance(vm);
|
3936 |
+
vm._vnode = vnode;
|
3937 |
+
// Vue.prototype.__patch__ is injected in entry points
|
3938 |
+
// based on the rendering backend used.
|
3939 |
+
if (!prevVnode) {
|
3940 |
+
// initial render
|
3941 |
+
vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
|
3942 |
+
} else {
|
3943 |
+
// updates
|
3944 |
+
vm.$el = vm.__patch__(prevVnode, vnode);
|
3945 |
+
}
|
3946 |
+
restoreActiveInstance();
|
3947 |
+
// update __vue__ reference
|
3948 |
+
if (prevEl) {
|
3949 |
+
prevEl.__vue__ = null;
|
3950 |
+
}
|
3951 |
+
if (vm.$el) {
|
3952 |
+
vm.$el.__vue__ = vm;
|
3953 |
+
}
|
3954 |
+
// if parent is an HOC, update its $el as well
|
3955 |
+
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
|
3956 |
+
vm.$parent.$el = vm.$el;
|
3957 |
+
}
|
3958 |
+
// updated hook is called by the scheduler to ensure that children are
|
3959 |
+
// updated in a parent's updated hook.
|
3960 |
+
};
|
3961 |
+
|
3962 |
+
Vue.prototype.$forceUpdate = function () {
|
3963 |
+
var vm = this;
|
3964 |
+
if (vm._watcher) {
|
3965 |
+
vm._watcher.update();
|
3966 |
+
}
|
3967 |
+
};
|
3968 |
+
|
3969 |
+
Vue.prototype.$destroy = function () {
|
3970 |
+
var vm = this;
|
3971 |
+
if (vm._isBeingDestroyed) {
|
3972 |
+
return
|
3973 |
+
}
|
3974 |
+
callHook(vm, 'beforeDestroy');
|
3975 |
+
vm._isBeingDestroyed = true;
|
3976 |
+
// remove self from parent
|
3977 |
+
var parent = vm.$parent;
|
3978 |
+
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
|
3979 |
+
remove(parent.$children, vm);
|
3980 |
+
}
|
3981 |
+
// teardown watchers
|
3982 |
+
if (vm._watcher) {
|
3983 |
+
vm._watcher.teardown();
|
3984 |
+
}
|
3985 |
+
var i = vm._watchers.length;
|
3986 |
+
while (i--) {
|
3987 |
+
vm._watchers[i].teardown();
|
3988 |
+
}
|
3989 |
+
// remove reference from data ob
|
3990 |
+
// frozen object may not have observer.
|
3991 |
+
if (vm._data.__ob__) {
|
3992 |
+
vm._data.__ob__.vmCount--;
|
3993 |
+
}
|
3994 |
+
// call the last hook...
|
3995 |
+
vm._isDestroyed = true;
|
3996 |
+
// invoke destroy hooks on current rendered tree
|
3997 |
+
vm.__patch__(vm._vnode, null);
|
3998 |
+
// fire destroyed hook
|
3999 |
+
callHook(vm, 'destroyed');
|
4000 |
+
// turn off all instance listeners.
|
4001 |
+
vm.$off();
|
4002 |
+
// remove __vue__ reference
|
4003 |
+
if (vm.$el) {
|
4004 |
+
vm.$el.__vue__ = null;
|
4005 |
+
}
|
4006 |
+
// release circular reference (#6759)
|
4007 |
+
if (vm.$vnode) {
|
4008 |
+
vm.$vnode.parent = null;
|
4009 |
+
}
|
4010 |
+
};
|
4011 |
+
}
|
4012 |
+
|
4013 |
+
function mountComponent (
|
4014 |
+
vm,
|
4015 |
+
el,
|
4016 |
+
hydrating
|
4017 |
+
) {
|
4018 |
+
vm.$el = el;
|
4019 |
+
if (!vm.$options.render) {
|
4020 |
+
vm.$options.render = createEmptyVNode;
|
4021 |
+
{
|
4022 |
+
/* istanbul ignore if */
|
4023 |
+
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
|
4024 |
+
vm.$options.el || el) {
|
4025 |
+
warn(
|
4026 |
+
'You are using the runtime-only build of Vue where the template ' +
|
4027 |
+
'compiler is not available. Either pre-compile the templates into ' +
|
4028 |
+
'render functions, or use the compiler-included build.',
|
4029 |
+
vm
|
4030 |
+
);
|
4031 |
+
} else {
|
4032 |
+
warn(
|
4033 |
+
'Failed to mount component: template or render function not defined.',
|
4034 |
+
vm
|
4035 |
+
);
|
4036 |
+
}
|
4037 |
+
}
|
4038 |
+
}
|
4039 |
+
callHook(vm, 'beforeMount');
|
4040 |
+
|
4041 |
+
var updateComponent;
|
4042 |
+
/* istanbul ignore if */
|
4043 |
+
if (config.performance && mark) {
|
4044 |
+
updateComponent = function () {
|
4045 |
+
var name = vm._name;
|
4046 |
+
var id = vm._uid;
|
4047 |
+
var startTag = "vue-perf-start:" + id;
|
4048 |
+
var endTag = "vue-perf-end:" + id;
|
4049 |
+
|
4050 |
+
mark(startTag);
|
4051 |
+
var vnode = vm._render();
|
4052 |
+
mark(endTag);
|
4053 |
+
measure(("vue " + name + " render"), startTag, endTag);
|
4054 |
+
|
4055 |
+
mark(startTag);
|
4056 |
+
vm._update(vnode, hydrating);
|
4057 |
+
mark(endTag);
|
4058 |
+
measure(("vue " + name + " patch"), startTag, endTag);
|
4059 |
+
};
|
4060 |
+
} else {
|
4061 |
+
updateComponent = function () {
|
4062 |
+
vm._update(vm._render(), hydrating);
|
4063 |
+
};
|
4064 |
+
}
|
4065 |
+
|
4066 |
+
// we set this to vm._watcher inside the watcher's constructor
|
4067 |
+
// since the watcher's initial patch may call $forceUpdate (e.g. inside child
|
4068 |
+
// component's mounted hook), which relies on vm._watcher being already defined
|
4069 |
+
new Watcher(vm, updateComponent, noop, {
|
4070 |
+
before: function before () {
|
4071 |
+
if (vm._isMounted && !vm._isDestroyed) {
|
4072 |
+
callHook(vm, 'beforeUpdate');
|
4073 |
+
}
|
4074 |
+
}
|
4075 |
+
}, true /* isRenderWatcher */);
|
4076 |
+
hydrating = false;
|
4077 |
+
|
4078 |
+
// manually mounted instance, call mounted on self
|
4079 |
+
// mounted is called for render-created child components in its inserted hook
|
4080 |
+
if (vm.$vnode == null) {
|
4081 |
+
vm._isMounted = true;
|
4082 |
+
callHook(vm, 'mounted');
|
4083 |
+
}
|
4084 |
+
return vm
|
4085 |
+
}
|
4086 |
+
|
4087 |
+
function updateChildComponent (
|
4088 |
+
vm,
|
4089 |
+
propsData,
|
4090 |
+
listeners,
|
4091 |
+
parentVnode,
|
4092 |
+
renderChildren
|
4093 |
+
) {
|
4094 |
+
{
|
4095 |
+
isUpdatingChildComponent = true;
|
4096 |
+
}
|
4097 |
+
|
4098 |
+
// determine whether component has slot children
|
4099 |
+
// we need to do this before overwriting $options._renderChildren.
|
4100 |
+
|
4101 |
+
// check if there are dynamic scopedSlots (hand-written or compiled but with
|
4102 |
+
// dynamic slot names). Static scoped slots compiled from template has the
|
4103 |
+
// "$stable" marker.
|
4104 |
+
var newScopedSlots = parentVnode.data.scopedSlots;
|
4105 |
+
var oldScopedSlots = vm.$scopedSlots;
|
4106 |
+
var hasDynamicScopedSlot = !!(
|
4107 |
+
(newScopedSlots && !newScopedSlots.$stable) ||
|
4108 |
+
(oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
|
4109 |
+
(newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
|
4110 |
+
);
|
4111 |
+
|
4112 |
+
// Any static slot children from the parent may have changed during parent's
|
4113 |
+
// update. Dynamic scoped slots may also have changed. In such cases, a forced
|
4114 |
+
// update is necessary to ensure correctness.
|
4115 |
+
var needsForceUpdate = !!(
|
4116 |
+
renderChildren || // has new static slots
|
4117 |
+
vm.$options._renderChildren || // has old static slots
|
4118 |
+
hasDynamicScopedSlot
|
4119 |
+
);
|
4120 |
+
|
4121 |
+
vm.$options._parentVnode = parentVnode;
|
4122 |
+
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
|
4123 |
+
|
4124 |
+
if (vm._vnode) { // update child tree's parent
|
4125 |
+
vm._vnode.parent = parentVnode;
|
4126 |
+
}
|
4127 |
+
vm.$options._renderChildren = renderChildren;
|
4128 |
+
|
4129 |
+
// update $attrs and $listeners hash
|
4130 |
+
// these are also reactive so they may trigger child update if the child
|
4131 |
+
// used them during render
|
4132 |
+
vm.$attrs = parentVnode.data.attrs || emptyObject;
|
4133 |
+
vm.$listeners = listeners || emptyObject;
|
4134 |
+
|
4135 |
+
// update props
|
4136 |
+
if (propsData && vm.$options.props) {
|
4137 |
+
toggleObserving(false);
|
4138 |
+
var props = vm._props;
|
4139 |
+
var propKeys = vm.$options._propKeys || [];
|
4140 |
+
for (var i = 0; i < propKeys.length; i++) {
|
4141 |
+
var key = propKeys[i];
|
4142 |
+
var propOptions = vm.$options.props; // wtf flow?
|
4143 |
+
props[key] = validateProp(key, propOptions, propsData, vm);
|
4144 |
+
}
|
4145 |
+
toggleObserving(true);
|
4146 |
+
// keep a copy of raw propsData
|
4147 |
+
vm.$options.propsData = propsData;
|
4148 |
+
}
|
4149 |
+
|
4150 |
+
// update listeners
|
4151 |
+
listeners = listeners || emptyObject;
|
4152 |
+
var oldListeners = vm.$options._parentListeners;
|
4153 |
+
vm.$options._parentListeners = listeners;
|
4154 |
+
updateComponentListeners(vm, listeners, oldListeners);
|
4155 |
+
|
4156 |
+
// resolve slots + force update if has children
|
4157 |
+
if (needsForceUpdate) {
|
4158 |
+
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
|
4159 |
+
vm.$forceUpdate();
|
4160 |
+
}
|
4161 |
+
|
4162 |
+
{
|
4163 |
+
isUpdatingChildComponent = false;
|
4164 |
+
}
|
4165 |
+
}
|
4166 |
+
|
4167 |
+
function isInInactiveTree (vm) {
|
4168 |
+
while (vm && (vm = vm.$parent)) {
|
4169 |
+
if (vm._inactive) { return true }
|
4170 |
+
}
|
4171 |
+
return false
|
4172 |
+
}
|
4173 |
+
|
4174 |
+
function activateChildComponent (vm, direct) {
|
4175 |
+
if (direct) {
|
4176 |
+
vm._directInactive = false;
|
4177 |
+
if (isInInactiveTree(vm)) {
|
4178 |
+
return
|
4179 |
+
}
|
4180 |
+
} else if (vm._directInactive) {
|
4181 |
+
return
|
4182 |
+
}
|
4183 |
+
if (vm._inactive || vm._inactive === null) {
|
4184 |
+
vm._inactive = false;
|
4185 |
+
for (var i = 0; i < vm.$children.length; i++) {
|
4186 |
+
activateChildComponent(vm.$children[i]);
|
4187 |
+
}
|
4188 |
+
callHook(vm, 'activated');
|
4189 |
+
}
|
4190 |
+
}
|
4191 |
+
|
4192 |
+
function deactivateChildComponent (vm, direct) {
|
4193 |
+
if (direct) {
|
4194 |
+
vm._directInactive = true;
|
4195 |
+
if (isInInactiveTree(vm)) {
|
4196 |
+
return
|
4197 |
+
}
|
4198 |
+
}
|
4199 |
+
if (!vm._inactive) {
|
4200 |
+
vm._inactive = true;
|
4201 |
+
for (var i = 0; i < vm.$children.length; i++) {
|
4202 |
+
deactivateChildComponent(vm.$children[i]);
|
4203 |
+
}
|
4204 |
+
callHook(vm, 'deactivated');
|
4205 |
+
}
|
4206 |
+
}
|
4207 |
+
|
4208 |
+
function callHook (vm, hook) {
|
4209 |
+
// #7573 disable dep collection when invoking lifecycle hooks
|
4210 |
+
pushTarget();
|
4211 |
+
var handlers = vm.$options[hook];
|
4212 |
+
var info = hook + " hook";
|
4213 |
+
if (handlers) {
|
4214 |
+
for (var i = 0, j = handlers.length; i < j; i++) {
|
4215 |
+
invokeWithErrorHandling(handlers[i], vm, null, vm, info);
|
4216 |
+
}
|
4217 |
+
}
|
4218 |
+
if (vm._hasHookEvent) {
|
4219 |
+
vm.$emit('hook:' + hook);
|
4220 |
+
}
|
4221 |
+
popTarget();
|
4222 |
+
}
|
4223 |
+
|
4224 |
+
/* */
|
4225 |
+
|
4226 |
+
var MAX_UPDATE_COUNT = 100;
|
4227 |
+
|
4228 |
+
var queue = [];
|
4229 |
+
var activatedChildren = [];
|
4230 |
+
var has = {};
|
4231 |
+
var circular = {};
|
4232 |
+
var waiting = false;
|
4233 |
+
var flushing = false;
|
4234 |
+
var index = 0;
|
4235 |
+
|
4236 |
+
/**
|
4237 |
+
* Reset the scheduler's state.
|
4238 |
+
*/
|
4239 |
+
function resetSchedulerState () {
|
4240 |
+
index = queue.length = activatedChildren.length = 0;
|
4241 |
+
has = {};
|
4242 |
+
{
|
4243 |
+
circular = {};
|
4244 |
+
}
|
4245 |
+
waiting = flushing = false;
|
4246 |
+
}
|
4247 |
+
|
4248 |
+
// Async edge case #6566 requires saving the timestamp when event listeners are
|
4249 |
+
// attached. However, calling performance.now() has a perf overhead especially
|
4250 |
+
// if the page has thousands of event listeners. Instead, we take a timestamp
|
4251 |
+
// every time the scheduler flushes and use that for all event listeners
|
4252 |
+
// attached during that flush.
|
4253 |
+
var currentFlushTimestamp = 0;
|
4254 |
+
|
4255 |
+
// Async edge case fix requires storing an event listener's attach timestamp.
|
4256 |
+
var getNow = Date.now;
|
4257 |
+
|
4258 |
+
// Determine what event timestamp the browser is using. Annoyingly, the
|
4259 |
+
// timestamp can either be hi-res (relative to page load) or low-res
|
4260 |
+
// (relative to UNIX epoch), so in order to compare time we have to use the
|
4261 |
+
// same timestamp type when saving the flush timestamp.
|
4262 |
+
// All IE versions use low-res event timestamps, and have problematic clock
|
4263 |
+
// implementations (#9632)
|
4264 |
+
if (inBrowser && !isIE) {
|
4265 |
+
var performance = window.performance;
|
4266 |
+
if (
|
4267 |
+
performance &&
|
4268 |
+
typeof performance.now === 'function' &&
|
4269 |
+
getNow() > document.createEvent('Event').timeStamp
|
4270 |
+
) {
|
4271 |
+
// if the event timestamp, although evaluated AFTER the Date.now(), is
|
4272 |
+
// smaller than it, it means the event is using a hi-res timestamp,
|
4273 |
+
// and we need to use the hi-res version for event listener timestamps as
|
4274 |
+
// well.
|
4275 |
+
getNow = function () { return performance.now(); };
|
4276 |
+
}
|
4277 |
+
}
|
4278 |
+
|
4279 |
+
/**
|
4280 |
+
* Flush both queues and run the watchers.
|
4281 |
+
*/
|
4282 |
+
function flushSchedulerQueue () {
|
4283 |
+
currentFlushTimestamp = getNow();
|
4284 |
+
flushing = true;
|
4285 |
+
var watcher, id;
|
4286 |
+
|
4287 |
+
// Sort queue before flush.
|
4288 |
+
// This ensures that:
|
4289 |
+
// 1. Components are updated from parent to child. (because parent is always
|
4290 |
+
// created before the child)
|
4291 |
+
// 2. A component's user watchers are run before its render watcher (because
|
4292 |
+
// user watchers are created before the render watcher)
|
4293 |
+
// 3. If a component is destroyed during a parent component's watcher run,
|
4294 |
+
// its watchers can be skipped.
|
4295 |
+
queue.sort(function (a, b) { return a.id - b.id; });
|
4296 |
+
|
4297 |
+
// do not cache length because more watchers might be pushed
|
4298 |
+
// as we run existing watchers
|
4299 |
+
for (index = 0; index < queue.length; index++) {
|
4300 |
+
watcher = queue[index];
|
4301 |
+
if (watcher.before) {
|
4302 |
+
watcher.before();
|
4303 |
+
}
|
4304 |
+
id = watcher.id;
|
4305 |
+
has[id] = null;
|
4306 |
+
watcher.run();
|
4307 |
+
// in dev build, check and stop circular updates.
|
4308 |
+
if (has[id] != null) {
|
4309 |
+
circular[id] = (circular[id] || 0) + 1;
|
4310 |
+
if (circular[id] > MAX_UPDATE_COUNT) {
|
4311 |
+
warn(
|
4312 |
+
'You may have an infinite update loop ' + (
|
4313 |
+
watcher.user
|
4314 |
+
? ("in watcher with expression \"" + (watcher.expression) + "\"")
|
4315 |
+
: "in a component render function."
|
4316 |
+
),
|
4317 |
+
watcher.vm
|
4318 |
+
);
|
4319 |
+
break
|
4320 |
+
}
|
4321 |
+
}
|
4322 |
+
}
|
4323 |
+
|
4324 |
+
// keep copies of post queues before resetting state
|
4325 |
+
var activatedQueue = activatedChildren.slice();
|
4326 |
+
var updatedQueue = queue.slice();
|
4327 |
+
|
4328 |
+
resetSchedulerState();
|
4329 |
+
|
4330 |
+
// call component updated and activated hooks
|
4331 |
+
callActivatedHooks(activatedQueue);
|
4332 |
+
callUpdatedHooks(updatedQueue);
|
4333 |
+
|
4334 |
+
// devtool hook
|
4335 |
+
/* istanbul ignore if */
|
4336 |
+
if (devtools && config.devtools) {
|
4337 |
+
devtools.emit('flush');
|
4338 |
+
}
|
4339 |
+
}
|
4340 |
+
|
4341 |
+
function callUpdatedHooks (queue) {
|
4342 |
+
var i = queue.length;
|
4343 |
+
while (i--) {
|
4344 |
+
var watcher = queue[i];
|
4345 |
+
var vm = watcher.vm;
|
4346 |
+
if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
|
4347 |
+
callHook(vm, 'updated');
|
4348 |
+
}
|
4349 |
+
}
|
4350 |
+
}
|
4351 |
+
|
4352 |
+
/**
|
4353 |
+
* Queue a kept-alive component that was activated during patch.
|
4354 |
+
* The queue will be processed after the entire tree has been patched.
|
4355 |
+
*/
|
4356 |
+
function queueActivatedComponent (vm) {
|
4357 |
+
// setting _inactive to false here so that a render function can
|
4358 |
+
// rely on checking whether it's in an inactive tree (e.g. router-view)
|
4359 |
+
vm._inactive = false;
|
4360 |
+
activatedChildren.push(vm);
|
4361 |
+
}
|
4362 |
+
|
4363 |
+
function callActivatedHooks (queue) {
|
4364 |
+
for (var i = 0; i < queue.length; i++) {
|
4365 |
+
queue[i]._inactive = true;
|
4366 |
+
activateChildComponent(queue[i], true /* true */);
|
4367 |
+
}
|
4368 |
+
}
|
4369 |
+
|
4370 |
+
/**
|
4371 |
+
* Push a watcher into the watcher queue.
|
4372 |
+
* Jobs with duplicate IDs will be skipped unless it's
|
4373 |
+
* pushed when the queue is being flushed.
|
4374 |
+
*/
|
4375 |
+
function queueWatcher (watcher) {
|
4376 |
+
var id = watcher.id;
|
4377 |
+
if (has[id] == null) {
|
4378 |
+
has[id] = true;
|
4379 |
+
if (!flushing) {
|
4380 |
+
queue.push(watcher);
|
4381 |
+
} else {
|
4382 |
+
// if already flushing, splice the watcher based on its id
|
4383 |
+
// if already past its id, it will be run next immediately.
|
4384 |
+
var i = queue.length - 1;
|
4385 |
+
while (i > index && queue[i].id > watcher.id) {
|
4386 |
+
i--;
|
4387 |
+
}
|
4388 |
+
queue.splice(i + 1, 0, watcher);
|
4389 |
+
}
|
4390 |
+
// queue the flush
|
4391 |
+
if (!waiting) {
|
4392 |
+
waiting = true;
|
4393 |
+
|
4394 |
+
if (!config.async) {
|
4395 |
+
flushSchedulerQueue();
|
4396 |
+
return
|
4397 |
+
}
|
4398 |
+
nextTick(flushSchedulerQueue);
|
4399 |
+
}
|
4400 |
+
}
|
4401 |
+
}
|
4402 |
+
|
4403 |
+
/* */
|
4404 |
+
|
4405 |
+
|
4406 |
+
|
4407 |
+
var uid$2 = 0;
|
4408 |
+
|
4409 |
+
/**
|
4410 |
+
* A watcher parses an expression, collects dependencies,
|
4411 |
+
* and fires callback when the expression value changes.
|
4412 |
+
* This is used for both the $watch() api and directives.
|
4413 |
+
*/
|
4414 |
+
var Watcher = function Watcher (
|
4415 |
+
vm,
|
4416 |
+
expOrFn,
|
4417 |
+
cb,
|
4418 |
+
options,
|
4419 |
+
isRenderWatcher
|
4420 |
+
) {
|
4421 |
+
this.vm = vm;
|
4422 |
+
if (isRenderWatcher) {
|
4423 |
+
vm._watcher = this;
|
4424 |
+
}
|
4425 |
+
vm._watchers.push(this);
|
4426 |
+
// options
|
4427 |
+
if (options) {
|
4428 |
+
this.deep = !!options.deep;
|
4429 |
+
this.user = !!options.user;
|
4430 |
+
this.lazy = !!options.lazy;
|
4431 |
+
this.sync = !!options.sync;
|
4432 |
+
this.before = options.before;
|
4433 |
+
} else {
|
4434 |
+
this.deep = this.user = this.lazy = this.sync = false;
|
4435 |
+
}
|
4436 |
+
this.cb = cb;
|
4437 |
+
this.id = ++uid$2; // uid for batching
|
4438 |
+
this.active = true;
|
4439 |
+
this.dirty = this.lazy; // for lazy watchers
|
4440 |
+
this.deps = [];
|
4441 |
+
this.newDeps = [];
|
4442 |
+
this.depIds = new _Set();
|
4443 |
+
this.newDepIds = new _Set();
|
4444 |
+
this.expression = expOrFn.toString();
|
4445 |
+
// parse expression for getter
|
4446 |
+
if (typeof expOrFn === 'function') {
|
4447 |
+
this.getter = expOrFn;
|
4448 |
+
} else {
|
4449 |
+
this.getter = parsePath(expOrFn);
|
4450 |
+
if (!this.getter) {
|
4451 |
+
this.getter = noop;
|
4452 |
+
warn(
|
4453 |
+
"Failed watching path: \"" + expOrFn + "\" " +
|
4454 |
+
'Watcher only accepts simple dot-delimited paths. ' +
|
4455 |
+
'For full control, use a function instead.',
|
4456 |
+
vm
|
4457 |
+
);
|
4458 |
+
}
|
4459 |
+
}
|
4460 |
+
this.value = this.lazy
|
4461 |
+
? undefined
|
4462 |
+
: this.get();
|
4463 |
+
};
|
4464 |
+
|
4465 |
+
/**
|
4466 |
+
* Evaluate the getter, and re-collect dependencies.
|
4467 |
+
*/
|
4468 |
+
Watcher.prototype.get = function get () {
|
4469 |
+
pushTarget(this);
|
4470 |
+
var value;
|
4471 |
+
var vm = this.vm;
|
4472 |
+
try {
|
4473 |
+
value = this.getter.call(vm, vm);
|
4474 |
+
} catch (e) {
|
4475 |
+
if (this.user) {
|
4476 |
+
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
|
4477 |
+
} else {
|
4478 |
+
throw e
|
4479 |
+
}
|
4480 |
+
} finally {
|
4481 |
+
// "touch" every property so they are all tracked as
|
4482 |
+
// dependencies for deep watching
|
4483 |
+
if (this.deep) {
|
4484 |
+
traverse(value);
|
4485 |
+
}
|
4486 |
+
popTarget();
|
4487 |
+
this.cleanupDeps();
|
4488 |
+
}
|
4489 |
+
return value
|
4490 |
+
};
|
4491 |
+
|
4492 |
+
/**
|
4493 |
+
* Add a dependency to this directive.
|
4494 |
+
*/
|
4495 |
+
Watcher.prototype.addDep = function addDep (dep) {
|
4496 |
+
var id = dep.id;
|
4497 |
+
if (!this.newDepIds.has(id)) {
|
4498 |
+
this.newDepIds.add(id);
|
4499 |
+
this.newDeps.push(dep);
|
4500 |
+
if (!this.depIds.has(id)) {
|
4501 |
+
dep.addSub(this);
|
4502 |
+
}
|
4503 |
+
}
|
4504 |
+
};
|
4505 |
+
|
4506 |
+
/**
|
4507 |
+
* Clean up for dependency collection.
|
4508 |
+
*/
|
4509 |
+
Watcher.prototype.cleanupDeps = function cleanupDeps () {
|
4510 |
+
var i = this.deps.length;
|
4511 |
+
while (i--) {
|
4512 |
+
var dep = this.deps[i];
|
4513 |
+
if (!this.newDepIds.has(dep.id)) {
|
4514 |
+
dep.removeSub(this);
|
4515 |
+
}
|
4516 |
+
}
|
4517 |
+
var tmp = this.depIds;
|
4518 |
+
this.depIds = this.newDepIds;
|
4519 |
+
this.newDepIds = tmp;
|
4520 |
+
this.newDepIds.clear();
|
4521 |
+
tmp = this.deps;
|
4522 |
+
this.deps = this.newDeps;
|
4523 |
+
this.newDeps = tmp;
|
4524 |
+
this.newDeps.length = 0;
|
4525 |
+
};
|
4526 |
+
|
4527 |
+
/**
|
4528 |
+
* Subscriber interface.
|
4529 |
+
* Will be called when a dependency changes.
|
4530 |
+
*/
|
4531 |
+
Watcher.prototype.update = function update () {
|
4532 |
+
/* istanbul ignore else */
|
4533 |
+
if (this.lazy) {
|
4534 |
+
this.dirty = true;
|
4535 |
+
} else if (this.sync) {
|
4536 |
+
this.run();
|
4537 |
+
} else {
|
4538 |
+
queueWatcher(this);
|
4539 |
+
}
|
4540 |
+
};
|
4541 |
+
|
4542 |
+
/**
|
4543 |
+
* Scheduler job interface.
|
4544 |
+
* Will be called by the scheduler.
|
4545 |
+
*/
|
4546 |
+
Watcher.prototype.run = function run () {
|
4547 |
+
if (this.active) {
|
4548 |
+
var value = this.get();
|
4549 |
+
if (
|
4550 |
+
value !== this.value ||
|
4551 |
+
// Deep watchers and watchers on Object/Arrays should fire even
|
4552 |
+
// when the value is the same, because the value may
|
4553 |
+
// have mutated.
|
4554 |
+
isObject(value) ||
|
4555 |
+
this.deep
|
4556 |
+
) {
|
4557 |
+
// set new value
|
4558 |
+
var oldValue = this.value;
|
4559 |
+
this.value = value;
|
4560 |
+
if (this.user) {
|
4561 |
+
try {
|
4562 |
+
this.cb.call(this.vm, value, oldValue);
|
4563 |
+
} catch (e) {
|
4564 |
+
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
|
4565 |
+
}
|
4566 |
+
} else {
|
4567 |
+
this.cb.call(this.vm, value, oldValue);
|
4568 |
+
}
|
4569 |
+
}
|
4570 |
+
}
|
4571 |
+
};
|
4572 |
+
|
4573 |
+
/**
|
4574 |
+
* Evaluate the value of the watcher.
|
4575 |
+
* This only gets called for lazy watchers.
|
4576 |
+
*/
|
4577 |
+
Watcher.prototype.evaluate = function evaluate () {
|
4578 |
+
this.value = this.get();
|
4579 |
+
this.dirty = false;
|
4580 |
+
};
|
4581 |
+
|
4582 |
+
/**
|
4583 |
+
* Depend on all deps collected by this watcher.
|
4584 |
+
*/
|
4585 |
+
Watcher.prototype.depend = function depend () {
|
4586 |
+
var i = this.deps.length;
|
4587 |
+
while (i--) {
|
4588 |
+
this.deps[i].depend();
|
4589 |
+
}
|
4590 |
+
};
|
4591 |
+
|
4592 |
+
/**
|
4593 |
+
* Remove self from all dependencies' subscriber list.
|
4594 |
+
*/
|
4595 |
+
Watcher.prototype.teardown = function teardown () {
|
4596 |
+
if (this.active) {
|
4597 |
+
// remove self from vm's watcher list
|
4598 |
+
// this is a somewhat expensive operation so we skip it
|
4599 |
+
// if the vm is being destroyed.
|
4600 |
+
if (!this.vm._isBeingDestroyed) {
|
4601 |
+
remove(this.vm._watchers, this);
|
4602 |
+
}
|
4603 |
+
var i = this.deps.length;
|
4604 |
+
while (i--) {
|
4605 |
+
this.deps[i].removeSub(this);
|
4606 |
+
}
|
4607 |
+
this.active = false;
|
4608 |
+
}
|
4609 |
+
};
|
4610 |
+
|
4611 |
+
/* */
|
4612 |
+
|
4613 |
+
var sharedPropertyDefinition = {
|
4614 |
+
enumerable: true,
|
4615 |
+
configurable: true,
|
4616 |
+
get: noop,
|
4617 |
+
set: noop
|
4618 |
+
};
|
4619 |
+
|
4620 |
+
function proxy (target, sourceKey, key) {
|
4621 |
+
sharedPropertyDefinition.get = function proxyGetter () {
|
4622 |
+
return this[sourceKey][key]
|
4623 |
+
};
|
4624 |
+
sharedPropertyDefinition.set = function proxySetter (val) {
|
4625 |
+
this[sourceKey][key] = val;
|
4626 |
+
};
|
4627 |
+
Object.defineProperty(target, key, sharedPropertyDefinition);
|
4628 |
+
}
|
4629 |
+
|
4630 |
+
function initState (vm) {
|
4631 |
+
vm._watchers = [];
|
4632 |
+
var opts = vm.$options;
|
4633 |
+
if (opts.props) { initProps(vm, opts.props); }
|
4634 |
+
if (opts.methods) { initMethods(vm, opts.methods); }
|
4635 |
+
if (opts.data) {
|
4636 |
+
initData(vm);
|
4637 |
+
} else {
|
4638 |
+
observe(vm._data = {}, true /* asRootData */);
|
4639 |
+
}
|
4640 |
+
if (opts.computed) { initComputed(vm, opts.computed); }
|
4641 |
+
if (opts.watch && opts.watch !== nativeWatch) {
|
4642 |
+
initWatch(vm, opts.watch);
|
4643 |
+
}
|
4644 |
+
}
|
4645 |
+
|
4646 |
+
function initProps (vm, propsOptions) {
|
4647 |
+
var propsData = vm.$options.propsData || {};
|
4648 |
+
var props = vm._props = {};
|
4649 |
+
// cache prop keys so that future props updates can iterate using Array
|
4650 |
+
// instead of dynamic object key enumeration.
|
4651 |
+
var keys = vm.$options._propKeys = [];
|
4652 |
+
var isRoot = !vm.$parent;
|
4653 |
+
// root instance props should be converted
|
4654 |
+
if (!isRoot) {
|
4655 |
+
toggleObserving(false);
|
4656 |
+
}
|
4657 |
+
var loop = function ( key ) {
|
4658 |
+
keys.push(key);
|
4659 |
+
var value = validateProp(key, propsOptions, propsData, vm);
|
4660 |
+
/* istanbul ignore else */
|
4661 |
+
{
|
4662 |
+
var hyphenatedKey = hyphenate(key);
|
4663 |
+
if (isReservedAttribute(hyphenatedKey) ||
|
4664 |
+
config.isReservedAttr(hyphenatedKey)) {
|
4665 |
+
warn(
|
4666 |
+
("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
|
4667 |
+
vm
|
4668 |
+
);
|
4669 |
+
}
|
4670 |
+
defineReactive$$1(props, key, value, function () {
|
4671 |
+
if (!isRoot && !isUpdatingChildComponent) {
|
4672 |
+
warn(
|
4673 |
+
"Avoid mutating a prop directly since the value will be " +
|
4674 |
+
"overwritten whenever the parent component re-renders. " +
|
4675 |
+
"Instead, use a data or computed property based on the prop's " +
|
4676 |
+
"value. Prop being mutated: \"" + key + "\"",
|
4677 |
+
vm
|
4678 |
+
);
|
4679 |
+
}
|
4680 |
+
});
|
4681 |
+
}
|
4682 |
+
// static props are already proxied on the component's prototype
|
4683 |
+
// during Vue.extend(). We only need to proxy props defined at
|
4684 |
+
// instantiation here.
|
4685 |
+
if (!(key in vm)) {
|
4686 |
+
proxy(vm, "_props", key);
|
4687 |
+
}
|
4688 |
+
};
|
4689 |
+
|
4690 |
+
for (var key in propsOptions) loop( key );
|
4691 |
+
toggleObserving(true);
|
4692 |
+
}
|
4693 |
+
|
4694 |
+
function initData (vm) {
|
4695 |
+
var data = vm.$options.data;
|
4696 |
+
data = vm._data = typeof data === 'function'
|
4697 |
+
? getData(data, vm)
|
4698 |
+
: data || {};
|
4699 |
+
if (!isPlainObject(data)) {
|
4700 |
+
data = {};
|
4701 |
+
warn(
|
4702 |
+
'data functions should return an object:\n' +
|
4703 |
+
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
|
4704 |
+
vm
|
4705 |
+
);
|
4706 |
+
}
|
4707 |
+
// proxy data on instance
|
4708 |
+
var keys = Object.keys(data);
|
4709 |
+
var props = vm.$options.props;
|
4710 |
+
var methods = vm.$options.methods;
|
4711 |
+
var i = keys.length;
|
4712 |
+
while (i--) {
|
4713 |
+
var key = keys[i];
|
4714 |
+
{
|
4715 |
+
if (methods && hasOwn(methods, key)) {
|
4716 |
+
warn(
|
4717 |
+
("Method \"" + key + "\" has already been defined as a data property."),
|
4718 |
+
vm
|
4719 |
+
);
|
4720 |
+
}
|
4721 |
+
}
|
4722 |
+
if (props && hasOwn(props, key)) {
|
4723 |
+
warn(
|
4724 |
+
"The data property \"" + key + "\" is already declared as a prop. " +
|
4725 |
+
"Use prop default value instead.",
|
4726 |
+
vm
|
4727 |
+
);
|
4728 |
+
} else if (!isReserved(key)) {
|
4729 |
+
proxy(vm, "_data", key);
|
4730 |
+
}
|
4731 |
+
}
|
4732 |
+
// observe data
|
4733 |
+
observe(data, true /* asRootData */);
|
4734 |
+
}
|
4735 |
+
|
4736 |
+
function getData (data, vm) {
|
4737 |
+
// #7573 disable dep collection when invoking data getters
|
4738 |
+
pushTarget();
|
4739 |
+
try {
|
4740 |
+
return data.call(vm, vm)
|
4741 |
+
} catch (e) {
|
4742 |
+
handleError(e, vm, "data()");
|
4743 |
+
return {}
|
4744 |
+
} finally {
|
4745 |
+
popTarget();
|
4746 |
+
}
|
4747 |
+
}
|
4748 |
+
|
4749 |
+
var computedWatcherOptions = { lazy: true };
|
4750 |
+
|
4751 |
+
function initComputed (vm, computed) {
|
4752 |
+
// $flow-disable-line
|
4753 |
+
var watchers = vm._computedWatchers = Object.create(null);
|
4754 |
+
// computed properties are just getters during SSR
|
4755 |
+
var isSSR = isServerRendering();
|
4756 |
+
|
4757 |
+
for (var key in computed) {
|
4758 |
+
var userDef = computed[key];
|
4759 |
+
var getter = typeof userDef === 'function' ? userDef : userDef.get;
|
4760 |
+
if (getter == null) {
|
4761 |
+
warn(
|
4762 |
+
("Getter is missing for computed property \"" + key + "\"."),
|
4763 |
+
vm
|
4764 |
+
);
|
4765 |
+
}
|
4766 |
+
|
4767 |
+
if (!isSSR) {
|
4768 |
+
// create internal watcher for the computed property.
|
4769 |
+
watchers[key] = new Watcher(
|
4770 |
+
vm,
|
4771 |
+
getter || noop,
|
4772 |
+
noop,
|
4773 |
+
computedWatcherOptions
|
4774 |
+
);
|
4775 |
+
}
|
4776 |
+
|
4777 |
+
// component-defined computed properties are already defined on the
|
4778 |
+
// component prototype. We only need to define computed properties defined
|
4779 |
+
// at instantiation here.
|
4780 |
+
if (!(key in vm)) {
|
4781 |
+
defineComputed(vm, key, userDef);
|
4782 |
+
} else {
|
4783 |
+
if (key in vm.$data) {
|
4784 |
+
warn(("The computed property \"" + key + "\" is already defined in data."), vm);
|
4785 |
+
} else if (vm.$options.props && key in vm.$options.props) {
|
4786 |
+
warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
|
4787 |
+
}
|
4788 |
+
}
|
4789 |
+
}
|
4790 |
+
}
|
4791 |
+
|
4792 |
+
function defineComputed (
|
4793 |
+
target,
|
4794 |
+
key,
|
4795 |
+
userDef
|
4796 |
+
) {
|
4797 |
+
var shouldCache = !isServerRendering();
|
4798 |
+
if (typeof userDef === 'function') {
|
4799 |
+
sharedPropertyDefinition.get = shouldCache
|
4800 |
+
? createComputedGetter(key)
|
4801 |
+
: createGetterInvoker(userDef);
|
4802 |
+
sharedPropertyDefinition.set = noop;
|
4803 |
+
} else {
|
4804 |
+
sharedPropertyDefinition.get = userDef.get
|
4805 |
+
? shouldCache && userDef.cache !== false
|
4806 |
+
? createComputedGetter(key)
|
4807 |
+
: createGetterInvoker(userDef.get)
|
4808 |
+
: noop;
|
4809 |
+
sharedPropertyDefinition.set = userDef.set || noop;
|
4810 |
+
}
|
4811 |
+
if (sharedPropertyDefinition.set === noop) {
|
4812 |
+
sharedPropertyDefinition.set = function () {
|
4813 |
+
warn(
|
4814 |
+
("Computed property \"" + key + "\" was assigned to but it has no setter."),
|
4815 |
+
this
|
4816 |
+
);
|
4817 |
+
};
|
4818 |
+
}
|
4819 |
+
Object.defineProperty(target, key, sharedPropertyDefinition);
|
4820 |
+
}
|
4821 |
+
|
4822 |
+
function createComputedGetter (key) {
|
4823 |
+
return function computedGetter () {
|
4824 |
+
var watcher = this._computedWatchers && this._computedWatchers[key];
|
4825 |
+
if (watcher) {
|
4826 |
+
if (watcher.dirty) {
|
4827 |
+
watcher.evaluate();
|
4828 |
+
}
|
4829 |
+
if (Dep.target) {
|
4830 |
+
watcher.depend();
|
4831 |
+
}
|
4832 |
+
return watcher.value
|
4833 |
+
}
|
4834 |
+
}
|
4835 |
+
}
|
4836 |
+
|
4837 |
+
function createGetterInvoker(fn) {
|
4838 |
+
return function computedGetter () {
|
4839 |
+
return fn.call(this, this)
|
4840 |
+
}
|
4841 |
+
}
|
4842 |
+
|
4843 |
+
function initMethods (vm, methods) {
|
4844 |
+
var props = vm.$options.props;
|
4845 |
+
for (var key in methods) {
|
4846 |
+
{
|
4847 |
+
if (typeof methods[key] !== 'function') {
|
4848 |
+
warn(
|
4849 |
+
"Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
|
4850 |
+
"Did you reference the function correctly?",
|
4851 |
+
vm
|
4852 |
+
);
|
4853 |
+
}
|
4854 |
+
if (props && hasOwn(props, key)) {
|
4855 |
+
warn(
|
4856 |
+
("Method \"" + key + "\" has already been defined as a prop."),
|
4857 |
+
vm
|
4858 |
+
);
|
4859 |
+
}
|
4860 |
+
if ((key in vm) && isReserved(key)) {
|
4861 |
+
warn(
|
4862 |
+
"Method \"" + key + "\" conflicts with an existing Vue instance method. " +
|
4863 |
+
"Avoid defining component methods that start with _ or $."
|
4864 |
+
);
|
4865 |
+
}
|
4866 |
+
}
|
4867 |
+
vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
|
4868 |
+
}
|
4869 |
+
}
|
4870 |
+
|
4871 |
+
function initWatch (vm, watch) {
|
4872 |
+
for (var key in watch) {
|
4873 |
+
var handler = watch[key];
|
4874 |
+
if (Array.isArray(handler)) {
|
4875 |
+
for (var i = 0; i < handler.length; i++) {
|
4876 |
+
createWatcher(vm, key, handler[i]);
|
4877 |
+
}
|
4878 |
+
} else {
|
4879 |
+
createWatcher(vm, key, handler);
|
4880 |
+
}
|
4881 |
+
}
|
4882 |
+
}
|
4883 |
+
|
4884 |
+
function createWatcher (
|
4885 |
+
vm,
|
4886 |
+
expOrFn,
|
4887 |
+
handler,
|
4888 |
+
options
|
4889 |
+
) {
|
4890 |
+
if (isPlainObject(handler)) {
|
4891 |
+
options = handler;
|
4892 |
+
handler = handler.handler;
|
4893 |
+
}
|
4894 |
+
if (typeof handler === 'string') {
|
4895 |
+
handler = vm[handler];
|
4896 |
+
}
|
4897 |
+
return vm.$watch(expOrFn, handler, options)
|
4898 |
+
}
|
4899 |
+
|
4900 |
+
function stateMixin (Vue) {
|
4901 |
+
// flow somehow has problems with directly declared definition object
|
4902 |
+
// when using Object.defineProperty, so we have to procedurally build up
|
4903 |
+
// the object here.
|
4904 |
+
var dataDef = {};
|
4905 |
+
dataDef.get = function () { return this._data };
|
4906 |
+
var propsDef = {};
|
4907 |
+
propsDef.get = function () { return this._props };
|
4908 |
+
{
|
4909 |
+
dataDef.set = function () {
|
4910 |
+
warn(
|
4911 |
+
'Avoid replacing instance root $data. ' +
|
4912 |
+
'Use nested data properties instead.',
|
4913 |
+
this
|
4914 |
+
);
|
4915 |
+
};
|
4916 |
+
propsDef.set = function () {
|
4917 |
+
warn("$props is readonly.", this);
|
4918 |
+
};
|
4919 |
+
}
|
4920 |
+
Object.defineProperty(Vue.prototype, '$data', dataDef);
|
4921 |
+
Object.defineProperty(Vue.prototype, '$props', propsDef);
|
4922 |
+
|
4923 |
+
Vue.prototype.$set = set;
|
4924 |
+
Vue.prototype.$delete = del;
|
4925 |
+
|
4926 |
+
Vue.prototype.$watch = function (
|
4927 |
+
expOrFn,
|
4928 |
+
cb,
|
4929 |
+
options
|
4930 |
+
) {
|
4931 |
+
var vm = this;
|
4932 |
+
if (isPlainObject(cb)) {
|
4933 |
+
return createWatcher(vm, expOrFn, cb, options)
|
4934 |
+
}
|
4935 |
+
options = options || {};
|
4936 |
+
options.user = true;
|
4937 |
+
var watcher = new Watcher(vm, expOrFn, cb, options);
|
4938 |
+
if (options.immediate) {
|
4939 |
+
try {
|
4940 |
+
cb.call(vm, watcher.value);
|
4941 |
+
} catch (error) {
|
4942 |
+
handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
|
4943 |
+
}
|
4944 |
+
}
|
4945 |
+
return function unwatchFn () {
|
4946 |
+
watcher.teardown();
|
4947 |
+
}
|
4948 |
+
};
|
4949 |
+
}
|
4950 |
+
|
4951 |
+
/* */
|
4952 |
+
|
4953 |
+
var uid$3 = 0;
|
4954 |
+
|
4955 |
+
function initMixin (Vue) {
|
4956 |
+
Vue.prototype._init = function (options) {
|
4957 |
+
var vm = this;
|
4958 |
+
// a uid
|
4959 |
+
vm._uid = uid$3++;
|
4960 |
+
|
4961 |
+
var startTag, endTag;
|
4962 |
+
/* istanbul ignore if */
|
4963 |
+
if (config.performance && mark) {
|
4964 |
+
startTag = "vue-perf-start:" + (vm._uid);
|
4965 |
+
endTag = "vue-perf-end:" + (vm._uid);
|
4966 |
+
mark(startTag);
|
4967 |
+
}
|
4968 |
+
|
4969 |
+
// a flag to avoid this being observed
|
4970 |
+
vm._isVue = true;
|
4971 |
+
// merge options
|
4972 |
+
if (options && options._isComponent) {
|
4973 |
+
// optimize internal component instantiation
|
4974 |
+
// since dynamic options merging is pretty slow, and none of the
|
4975 |
+
// internal component options needs special treatment.
|
4976 |
+
initInternalComponent(vm, options);
|
4977 |
+
} else {
|
4978 |
+
vm.$options = mergeOptions(
|
4979 |
+
resolveConstructorOptions(vm.constructor),
|
4980 |
+
options || {},
|
4981 |
+
vm
|
4982 |
+
);
|
4983 |
+
}
|
4984 |
+
/* istanbul ignore else */
|
4985 |
+
{
|
4986 |
+
initProxy(vm);
|
4987 |
+
}
|
4988 |
+
// expose real self
|
4989 |
+
vm._self = vm;
|
4990 |
+
initLifecycle(vm);
|
4991 |
+
initEvents(vm);
|
4992 |
+
initRender(vm);
|
4993 |
+
callHook(vm, 'beforeCreate');
|
4994 |
+
initInjections(vm); // resolve injections before data/props
|
4995 |
+
initState(vm);
|
4996 |
+
initProvide(vm); // resolve provide after data/props
|
4997 |
+
callHook(vm, 'created');
|
4998 |
+
|
4999 |
+
/* istanbul ignore if */
|
5000 |
+
if (config.performance && mark) {
|
5001 |
+
vm._name = formatComponentName(vm, false);
|
5002 |
+
mark(endTag);
|
5003 |
+
measure(("vue " + (vm._name) + " init"), startTag, endTag);
|
5004 |
+
}
|
5005 |
+
|
5006 |
+
if (vm.$options.el) {
|
5007 |
+
vm.$mount(vm.$options.el);
|
5008 |
+
}
|
5009 |
+
};
|
5010 |
+
}
|
5011 |
+
|
5012 |
+
function initInternalComponent (vm, options) {
|
5013 |
+
var opts = vm.$options = Object.create(vm.constructor.options);
|
5014 |
+
// doing this because it's faster than dynamic enumeration.
|
5015 |
+
var parentVnode = options._parentVnode;
|
5016 |
+
opts.parent = options.parent;
|
5017 |
+
opts._parentVnode = parentVnode;
|
5018 |
+
|
5019 |
+
var vnodeComponentOptions = parentVnode.componentOptions;
|
5020 |
+
opts.propsData = vnodeComponentOptions.propsData;
|
5021 |
+
opts._parentListeners = vnodeComponentOptions.listeners;
|
5022 |
+
opts._renderChildren = vnodeComponentOptions.children;
|
5023 |
+
opts._componentTag = vnodeComponentOptions.tag;
|
5024 |
+
|
5025 |
+
if (options.render) {
|
5026 |
+
opts.render = options.render;
|
5027 |
+
opts.staticRenderFns = options.staticRenderFns;
|
5028 |
+
}
|
5029 |
+
}
|
5030 |
+
|
5031 |
+
function resolveConstructorOptions (Ctor) {
|
5032 |
+
var options = Ctor.options;
|
5033 |
+
if (Ctor.super) {
|
5034 |
+
var superOptions = resolveConstructorOptions(Ctor.super);
|
5035 |
+
var cachedSuperOptions = Ctor.superOptions;
|
5036 |
+
if (superOptions !== cachedSuperOptions) {
|
5037 |
+
// super option changed,
|
5038 |
+
// need to resolve new options.
|
5039 |
+
Ctor.superOptions = superOptions;
|
5040 |
+
// check if there are any late-modified/attached options (#4976)
|
5041 |
+
var modifiedOptions = resolveModifiedOptions(Ctor);
|
5042 |
+
// update base extend options
|
5043 |
+
if (modifiedOptions) {
|
5044 |
+
extend(Ctor.extendOptions, modifiedOptions);
|
5045 |
+
}
|
5046 |
+
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
|
5047 |
+
if (options.name) {
|
5048 |
+
options.components[options.name] = Ctor;
|
5049 |
+
}
|
5050 |
+
}
|
5051 |
+
}
|
5052 |
+
return options
|
5053 |
+
}
|
5054 |
+
|
5055 |
+
function resolveModifiedOptions (Ctor) {
|
5056 |
+
var modified;
|
5057 |
+
var latest = Ctor.options;
|
5058 |
+
var sealed = Ctor.sealedOptions;
|
5059 |
+
for (var key in latest) {
|
5060 |
+
if (latest[key] !== sealed[key]) {
|
5061 |
+
if (!modified) { modified = {}; }
|
5062 |
+
modified[key] = latest[key];
|
5063 |
+
}
|
5064 |
+
}
|
5065 |
+
return modified
|
5066 |
+
}
|
5067 |
+
|
5068 |
+
function Vue (options) {
|
5069 |
+
if (!(this instanceof Vue)
|
5070 |
+
) {
|
5071 |
+
warn('Vue is a constructor and should be called with the `new` keyword');
|
5072 |
+
}
|
5073 |
+
this._init(options);
|
5074 |
+
}
|
5075 |
+
|
5076 |
+
initMixin(Vue);
|
5077 |
+
stateMixin(Vue);
|
5078 |
+
eventsMixin(Vue);
|
5079 |
+
lifecycleMixin(Vue);
|
5080 |
+
renderMixin(Vue);
|
5081 |
+
|
5082 |
+
/* */
|
5083 |
+
|
5084 |
+
function initUse (Vue) {
|
5085 |
+
Vue.use = function (plugin) {
|
5086 |
+
var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
|
5087 |
+
if (installedPlugins.indexOf(plugin) > -1) {
|
5088 |
+
return this
|
5089 |
+
}
|
5090 |
+
|
5091 |
+
// additional parameters
|
5092 |
+
var args = toArray(arguments, 1);
|
5093 |
+
args.unshift(this);
|
5094 |
+
if (typeof plugin.install === 'function') {
|
5095 |
+
plugin.install.apply(plugin, args);
|
5096 |
+
} else if (typeof plugin === 'function') {
|
5097 |
+
plugin.apply(null, args);
|
5098 |
+
}
|
5099 |
+
installedPlugins.push(plugin);
|
5100 |
+
return this
|
5101 |
+
};
|
5102 |
+
}
|
5103 |
+
|
5104 |
+
/* */
|
5105 |
+
|
5106 |
+
function initMixin$1 (Vue) {
|
5107 |
+
Vue.mixin = function (mixin) {
|
5108 |
+
this.options = mergeOptions(this.options, mixin);
|
5109 |
+
return this
|
5110 |
+
};
|
5111 |
+
}
|
5112 |
+
|
5113 |
+
/* */
|
5114 |
+
|
5115 |
+
function initExtend (Vue) {
|
5116 |
+
/**
|
5117 |
+
* Each instance constructor, including Vue, has a unique
|
5118 |
+
* cid. This enables us to create wrapped "child
|
5119 |
+
* constructors" for prototypal inheritance and cache them.
|
5120 |
+
*/
|
5121 |
+
Vue.cid = 0;
|
5122 |
+
var cid = 1;
|
5123 |
+
|
5124 |
+
/**
|
5125 |
+
* Class inheritance
|
5126 |
+
*/
|
5127 |
+
Vue.extend = function (extendOptions) {
|
5128 |
+
extendOptions = extendOptions || {};
|
5129 |
+
var Super = this;
|
5130 |
+
var SuperId = Super.cid;
|
5131 |
+
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
|
5132 |
+
if (cachedCtors[SuperId]) {
|
5133 |
+
return cachedCtors[SuperId]
|
5134 |
+
}
|
5135 |
+
|
5136 |
+
var name = extendOptions.name || Super.options.name;
|
5137 |
+
if (name) {
|
5138 |
+
validateComponentName(name);
|
5139 |
+
}
|
5140 |
+
|
5141 |
+
var Sub = function VueComponent (options) {
|
5142 |
+
this._init(options);
|
5143 |
+
};
|
5144 |
+
Sub.prototype = Object.create(Super.prototype);
|
5145 |
+
Sub.prototype.constructor = Sub;
|
5146 |
+
Sub.cid = cid++;
|
5147 |
+
Sub.options = mergeOptions(
|
5148 |
+
Super.options,
|
5149 |
+
extendOptions
|
5150 |
+
);
|
5151 |
+
Sub['super'] = Super;
|
5152 |
+
|
5153 |
+
// For props and computed properties, we define the proxy getters on
|
5154 |
+
// the Vue instances at extension time, on the extended prototype. This
|
5155 |
+
// avoids Object.defineProperty calls for each instance created.
|
5156 |
+
if (Sub.options.props) {
|
5157 |
+
initProps$1(Sub);
|
5158 |
+
}
|
5159 |
+
if (Sub.options.computed) {
|
5160 |
+
initComputed$1(Sub);
|
5161 |
+
}
|
5162 |
+
|
5163 |
+
// allow further extension/mixin/plugin usage
|
5164 |
+
Sub.extend = Super.extend;
|
5165 |
+
Sub.mixin = Super.mixin;
|
5166 |
+
Sub.use = Super.use;
|
5167 |
+
|
5168 |
+
// create asset registers, so extended classes
|
5169 |
+
// can have their private assets too.
|
5170 |
+
ASSET_TYPES.forEach(function (type) {
|
5171 |
+
Sub[type] = Super[type];
|
5172 |
+
});
|
5173 |
+
// enable recursive self-lookup
|
5174 |
+
if (name) {
|
5175 |
+
Sub.options.components[name] = Sub;
|
5176 |
+
}
|
5177 |
+
|
5178 |
+
// keep a reference to the super options at extension time.
|
5179 |
+
// later at instantiation we can check if Super's options have
|
5180 |
+
// been updated.
|
5181 |
+
Sub.superOptions = Super.options;
|
5182 |
+
Sub.extendOptions = extendOptions;
|
5183 |
+
Sub.sealedOptions = extend({}, Sub.options);
|
5184 |
+
|
5185 |
+
// cache constructor
|
5186 |
+
cachedCtors[SuperId] = Sub;
|
5187 |
+
return Sub
|
5188 |
+
};
|
5189 |
+
}
|
5190 |
+
|
5191 |
+
function initProps$1 (Comp) {
|
5192 |
+
var props = Comp.options.props;
|
5193 |
+
for (var key in props) {
|
5194 |
+
proxy(Comp.prototype, "_props", key);
|
5195 |
+
}
|
5196 |
+
}
|
5197 |
+
|
5198 |
+
function initComputed$1 (Comp) {
|
5199 |
+
var computed = Comp.options.computed;
|
5200 |
+
for (var key in computed) {
|
5201 |
+
defineComputed(Comp.prototype, key, computed[key]);
|
5202 |
+
}
|
5203 |
+
}
|
5204 |
+
|
5205 |
+
/* */
|
5206 |
+
|
5207 |
+
function initAssetRegisters (Vue) {
|
5208 |
+
/**
|
5209 |
+
* Create asset registration methods.
|
5210 |
+
*/
|
5211 |
+
ASSET_TYPES.forEach(function (type) {
|
5212 |
+
Vue[type] = function (
|
5213 |
+
id,
|
5214 |
+
definition
|
5215 |
+
) {
|
5216 |
+
if (!definition) {
|
5217 |
+
return this.options[type + 's'][id]
|
5218 |
+
} else {
|
5219 |
+
/* istanbul ignore if */
|
5220 |
+
if (type === 'component') {
|
5221 |
+
validateComponentName(id);
|
5222 |
+
}
|
5223 |
+
if (type === 'component' && isPlainObject(definition)) {
|
5224 |
+
definition.name = definition.name || id;
|
5225 |
+
definition = this.options._base.extend(definition);
|
5226 |
+
}
|
5227 |
+
if (type === 'directive' && typeof definition === 'function') {
|
5228 |
+
definition = { bind: definition, update: definition };
|
5229 |
+
}
|
5230 |
+
this.options[type + 's'][id] = definition;
|
5231 |
+
return definition
|
5232 |
+
}
|
5233 |
+
};
|
5234 |
+
});
|
5235 |
+
}
|
5236 |
+
|
5237 |
+
/* */
|
5238 |
+
|
5239 |
+
|
5240 |
+
|
5241 |
+
function getComponentName (opts) {
|
5242 |
+
return opts && (opts.Ctor.options.name || opts.tag)
|
5243 |
+
}
|
5244 |
+
|
5245 |
+
function matches (pattern, name) {
|
5246 |
+
if (Array.isArray(pattern)) {
|
5247 |
+
return pattern.indexOf(name) > -1
|
5248 |
+
} else if (typeof pattern === 'string') {
|
5249 |
+
return pattern.split(',').indexOf(name) > -1
|
5250 |
+
} else if (isRegExp(pattern)) {
|
5251 |
+
return pattern.test(name)
|
5252 |
+
}
|
5253 |
+
/* istanbul ignore next */
|
5254 |
+
return false
|
5255 |
+
}
|
5256 |
+
|
5257 |
+
function pruneCache (keepAliveInstance, filter) {
|
5258 |
+
var cache = keepAliveInstance.cache;
|
5259 |
+
var keys = keepAliveInstance.keys;
|
5260 |
+
var _vnode = keepAliveInstance._vnode;
|
5261 |
+
for (var key in cache) {
|
5262 |
+
var cachedNode = cache[key];
|
5263 |
+
if (cachedNode) {
|
5264 |
+
var name = getComponentName(cachedNode.componentOptions);
|
5265 |
+
if (name && !filter(name)) {
|
5266 |
+
pruneCacheEntry(cache, key, keys, _vnode);
|
5267 |
+
}
|
5268 |
+
}
|
5269 |
+
}
|
5270 |
+
}
|
5271 |
+
|
5272 |
+
function pruneCacheEntry (
|
5273 |
+
cache,
|
5274 |
+
key,
|
5275 |
+
keys,
|
5276 |
+
current
|
5277 |
+
) {
|
5278 |
+
var cached$$1 = cache[key];
|
5279 |
+
if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
|
5280 |
+
cached$$1.componentInstance.$destroy();
|
5281 |
+
}
|
5282 |
+
cache[key] = null;
|
5283 |
+
remove(keys, key);
|
5284 |
+
}
|
5285 |
+
|
5286 |
+
var patternTypes = [String, RegExp, Array];
|
5287 |
+
|
5288 |
+
var KeepAlive = {
|
5289 |
+
name: 'keep-alive',
|
5290 |
+
abstract: true,
|
5291 |
+
|
5292 |
+
props: {
|
5293 |
+
include: patternTypes,
|
5294 |
+
exclude: patternTypes,
|
5295 |
+
max: [String, Number]
|
5296 |
+
},
|
5297 |
+
|
5298 |
+
created: function created () {
|
5299 |
+
this.cache = Object.create(null);
|
5300 |
+
this.keys = [];
|
5301 |
+
},
|
5302 |
+
|
5303 |
+
destroyed: function destroyed () {
|
5304 |
+
for (var key in this.cache) {
|
5305 |
+
pruneCacheEntry(this.cache, key, this.keys);
|
5306 |
+
}
|
5307 |
+
},
|
5308 |
+
|
5309 |
+
mounted: function mounted () {
|
5310 |
+
var this$1 = this;
|
5311 |
+
|
5312 |
+
this.$watch('include', function (val) {
|
5313 |
+
pruneCache(this$1, function (name) { return matches(val, name); });
|
5314 |
+
});
|
5315 |
+
this.$watch('exclude', function (val) {
|
5316 |
+
pruneCache(this$1, function (name) { return !matches(val, name); });
|
5317 |
+
});
|
5318 |
+
},
|
5319 |
+
|
5320 |
+
render: function render () {
|
5321 |
+
var slot = this.$slots.default;
|
5322 |
+
var vnode = getFirstComponentChild(slot);
|
5323 |
+
var componentOptions = vnode && vnode.componentOptions;
|
5324 |
+
if (componentOptions) {
|
5325 |
+
// check pattern
|
5326 |
+
var name = getComponentName(componentOptions);
|
5327 |
+
var ref = this;
|
5328 |
+
var include = ref.include;
|
5329 |
+
var exclude = ref.exclude;
|
5330 |
+
if (
|
5331 |
+
// not included
|
5332 |
+
(include && (!name || !matches(include, name))) ||
|
5333 |
+
// excluded
|
5334 |
+
(exclude && name && matches(exclude, name))
|
5335 |
+
) {
|
5336 |
+
return vnode
|
5337 |
+
}
|
5338 |
+
|
5339 |
+
var ref$1 = this;
|
5340 |
+
var cache = ref$1.cache;
|
5341 |
+
var keys = ref$1.keys;
|
5342 |
+
var key = vnode.key == null
|
5343 |
+
// same constructor may get registered as different local components
|
5344 |
+
// so cid alone is not enough (#3269)
|
5345 |
+
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
|
5346 |
+
: vnode.key;
|
5347 |
+
if (cache[key]) {
|
5348 |
+
vnode.componentInstance = cache[key].componentInstance;
|
5349 |
+
// make current key freshest
|
5350 |
+
remove(keys, key);
|
5351 |
+
keys.push(key);
|
5352 |
+
} else {
|
5353 |
+
cache[key] = vnode;
|
5354 |
+
keys.push(key);
|
5355 |
+
// prune oldest entry
|
5356 |
+
if (this.max && keys.length > parseInt(this.max)) {
|
5357 |
+
pruneCacheEntry(cache, keys[0], keys, this._vnode);
|
5358 |
+
}
|
5359 |
+
}
|
5360 |
+
|
5361 |
+
vnode.data.keepAlive = true;
|
5362 |
+
}
|
5363 |
+
return vnode || (slot && slot[0])
|
5364 |
+
}
|
5365 |
+
};
|
5366 |
+
|
5367 |
+
var builtInComponents = {
|
5368 |
+
KeepAlive: KeepAlive
|
5369 |
+
};
|
5370 |
+
|
5371 |
+
/* */
|
5372 |
+
|
5373 |
+
function initGlobalAPI (Vue) {
|
5374 |
+
// config
|
5375 |
+
var configDef = {};
|
5376 |
+
configDef.get = function () { return config; };
|
5377 |
+
{
|
5378 |
+
configDef.set = function () {
|
5379 |
+
warn(
|
5380 |
+
'Do not replace the Vue.config object, set individual fields instead.'
|
5381 |
+
);
|
5382 |
+
};
|
5383 |
+
}
|
5384 |
+
Object.defineProperty(Vue, 'config', configDef);
|
5385 |
+
|
5386 |
+
// exposed util methods.
|
5387 |
+
// NOTE: these are not considered part of the public API - avoid relying on
|
5388 |
+
// them unless you are aware of the risk.
|
5389 |
+
Vue.util = {
|
5390 |
+
warn: warn,
|
5391 |
+
extend: extend,
|
5392 |
+
mergeOptions: mergeOptions,
|
5393 |
+
defineReactive: defineReactive$$1
|
5394 |
+
};
|
5395 |
+
|
5396 |
+
Vue.set = set;
|
5397 |
+
Vue.delete = del;
|
5398 |
+
Vue.nextTick = nextTick;
|
5399 |
+
|
5400 |
+
// 2.6 explicit observable API
|
5401 |
+
Vue.observable = function (obj) {
|
5402 |
+
observe(obj);
|
5403 |
+
return obj
|
5404 |
+
};
|
5405 |
+
|
5406 |
+
Vue.options = Object.create(null);
|
5407 |
+
ASSET_TYPES.forEach(function (type) {
|
5408 |
+
Vue.options[type + 's'] = Object.create(null);
|
5409 |
+
});
|
5410 |
+
|
5411 |
+
// this is used to identify the "base" constructor to extend all plain-object
|
5412 |
+
// components with in Weex's multi-instance scenarios.
|
5413 |
+
Vue.options._base = Vue;
|
5414 |
+
|
5415 |
+
extend(Vue.options.components, builtInComponents);
|
5416 |
+
|
5417 |
+
initUse(Vue);
|
5418 |
+
initMixin$1(Vue);
|
5419 |
+
initExtend(Vue);
|
5420 |
+
initAssetRegisters(Vue);
|
5421 |
+
}
|
5422 |
+
|
5423 |
+
initGlobalAPI(Vue);
|
5424 |
+
|
5425 |
+
Object.defineProperty(Vue.prototype, '$isServer', {
|
5426 |
+
get: isServerRendering
|
5427 |
+
});
|
5428 |
+
|
5429 |
+
Object.defineProperty(Vue.prototype, '$ssrContext', {
|
5430 |
+
get: function get () {
|
5431 |
+
/* istanbul ignore next */
|
5432 |
+
return this.$vnode && this.$vnode.ssrContext
|
5433 |
+
}
|
5434 |
+
});
|
5435 |
+
|
5436 |
+
// expose FunctionalRenderContext for ssr runtime helper installation
|
5437 |
+
Object.defineProperty(Vue, 'FunctionalRenderContext', {
|
5438 |
+
value: FunctionalRenderContext
|
5439 |
+
});
|
5440 |
+
|
5441 |
+
Vue.version = '2.6.10';
|
5442 |
+
|
5443 |
+
/* */
|
5444 |
+
|
5445 |
+
// these are reserved for web because they are directly compiled away
|
5446 |
+
// during template compilation
|
5447 |
+
var isReservedAttr = makeMap('style,class');
|
5448 |
+
|
5449 |
+
// attributes that should be using props for binding
|
5450 |
+
var acceptValue = makeMap('input,textarea,option,select,progress');
|
5451 |
+
var mustUseProp = function (tag, type, attr) {
|
5452 |
+
return (
|
5453 |
+
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
|
5454 |
+
(attr === 'selected' && tag === 'option') ||
|
5455 |
+
(attr === 'checked' && tag === 'input') ||
|
5456 |
+
(attr === 'muted' && tag === 'video')
|
5457 |
+
)
|
5458 |
+
};
|
5459 |
+
|
5460 |
+
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
|
5461 |
+
|
5462 |
+
var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
|
5463 |
+
|
5464 |
+
var convertEnumeratedValue = function (key, value) {
|
5465 |
+
return isFalsyAttrValue(value) || value === 'false'
|
5466 |
+
? 'false'
|
5467 |
+
// allow arbitrary string value for contenteditable
|
5468 |
+
: key === 'contenteditable' && isValidContentEditableValue(value)
|
5469 |
+
? value
|
5470 |
+
: 'true'
|
5471 |
+
};
|
5472 |
+
|
5473 |
+
var isBooleanAttr = makeMap(
|
5474 |
+
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
|
5475 |
+
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
|
5476 |
+
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
|
5477 |
+
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
|
5478 |
+
'required,reversed,scoped,seamless,selected,sortable,translate,' +
|
5479 |
+
'truespeed,typemustmatch,visible'
|
5480 |
+
);
|
5481 |
+
|
5482 |
+
var xlinkNS = 'http://www.w3.org/1999/xlink';
|
5483 |
+
|
5484 |
+
var isXlink = function (name) {
|
5485 |
+
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
|
5486 |
+
};
|
5487 |
+
|
5488 |
+
var getXlinkProp = function (name) {
|
5489 |
+
return isXlink(name) ? name.slice(6, name.length) : ''
|
5490 |
+
};
|
5491 |
+
|
5492 |
+
var isFalsyAttrValue = function (val) {
|
5493 |
+
return val == null || val === false
|
5494 |
+
};
|
5495 |
+
|
5496 |
+
/* */
|
5497 |
+
|
5498 |
+
function genClassForVnode (vnode) {
|
5499 |
+
var data = vnode.data;
|
5500 |
+
var parentNode = vnode;
|
5501 |
+
var childNode = vnode;
|
5502 |
+
while (isDef(childNode.componentInstance)) {
|
5503 |
+
childNode = childNode.componentInstance._vnode;
|
5504 |
+
if (childNode && childNode.data) {
|
5505 |
+
data = mergeClassData(childNode.data, data);
|
5506 |
+
}
|
5507 |
+
}
|
5508 |
+
while (isDef(parentNode = parentNode.parent)) {
|
5509 |
+
if (parentNode && parentNode.data) {
|
5510 |
+
data = mergeClassData(data, parentNode.data);
|
5511 |
+
}
|
5512 |
+
}
|
5513 |
+
return renderClass(data.staticClass, data.class)
|
5514 |
+
}
|
5515 |
+
|
5516 |
+
function mergeClassData (child, parent) {
|
5517 |
+
return {
|
5518 |
+
staticClass: concat(child.staticClass, parent.staticClass),
|
5519 |
+
class: isDef(child.class)
|
5520 |
+
? [child.class, parent.class]
|
5521 |
+
: parent.class
|
5522 |
+
}
|
5523 |
+
}
|
5524 |
+
|
5525 |
+
function renderClass (
|
5526 |
+
staticClass,
|
5527 |
+
dynamicClass
|
5528 |
+
) {
|
5529 |
+
if (isDef(staticClass) || isDef(dynamicClass)) {
|
5530 |
+
return concat(staticClass, stringifyClass(dynamicClass))
|
5531 |
+
}
|
5532 |
+
/* istanbul ignore next */
|
5533 |
+
return ''
|
5534 |
+
}
|
5535 |
+
|
5536 |
+
function concat (a, b) {
|
5537 |
+
return a ? b ? (a + ' ' + b) : a : (b || '')
|
5538 |
+
}
|
5539 |
+
|
5540 |
+
function stringifyClass (value) {
|
5541 |
+
if (Array.isArray(value)) {
|
5542 |
+
return stringifyArray(value)
|
5543 |
+
}
|
5544 |
+
if (isObject(value)) {
|
5545 |
+
return stringifyObject(value)
|
5546 |
+
}
|
5547 |
+
if (typeof value === 'string') {
|
5548 |
+
return value
|
5549 |
+
}
|
5550 |
+
/* istanbul ignore next */
|
5551 |
+
return ''
|
5552 |
+
}
|
5553 |
+
|
5554 |
+
function stringifyArray (value) {
|
5555 |
+
var res = '';
|
5556 |
+
var stringified;
|
5557 |
+
for (var i = 0, l = value.length; i < l; i++) {
|
5558 |
+
if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
|
5559 |
+
if (res) { res += ' '; }
|
5560 |
+
res += stringified;
|
5561 |
+
}
|
5562 |
+
}
|
5563 |
+
return res
|
5564 |
+
}
|
5565 |
+
|
5566 |
+
function stringifyObject (value) {
|
5567 |
+
var res = '';
|
5568 |
+
for (var key in value) {
|
5569 |
+
if (value[key]) {
|
5570 |
+
if (res) { res += ' '; }
|
5571 |
+
res += key;
|
5572 |
+
}
|
5573 |
+
}
|
5574 |
+
return res
|
5575 |
+
}
|
5576 |
+
|
5577 |
+
/* */
|
5578 |
+
|
5579 |
+
var namespaceMap = {
|
5580 |
+
svg: 'http://www.w3.org/2000/svg',
|
5581 |
+
math: 'http://www.w3.org/1998/Math/MathML'
|
5582 |
+
};
|
5583 |
+
|
5584 |
+
var isHTMLTag = makeMap(
|
5585 |
+
'html,body,base,head,link,meta,style,title,' +
|
5586 |
+
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
|
5587 |
+
'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
|
5588 |
+
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
|
5589 |
+
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
|
5590 |
+
'embed,object,param,source,canvas,script,noscript,del,ins,' +
|
5591 |
+
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
|
5592 |
+
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
|
5593 |
+
'output,progress,select,textarea,' +
|
5594 |
+
'details,dialog,menu,menuitem,summary,' +
|
5595 |
+
'content,element,shadow,template,blockquote,iframe,tfoot'
|
5596 |
+
);
|
5597 |
+
|
5598 |
+
// this map is intentionally selective, only covering SVG elements that may
|
5599 |
+
// contain child elements.
|
5600 |
+
var isSVG = makeMap(
|
5601 |
+
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
|
5602 |
+
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
|
5603 |
+
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
|
5604 |
+
true
|
5605 |
+
);
|
5606 |
+
|
5607 |
+
var isPreTag = function (tag) { return tag === 'pre'; };
|
5608 |
+
|
5609 |
+
var isReservedTag = function (tag) {
|
5610 |
+
return isHTMLTag(tag) || isSVG(tag)
|
5611 |
+
};
|
5612 |
+
|
5613 |
+
function getTagNamespace (tag) {
|
5614 |
+
if (isSVG(tag)) {
|
5615 |
+
return 'svg'
|
5616 |
+
}
|
5617 |
+
// basic support for MathML
|
5618 |
+
// note it doesn't support other MathML elements being component roots
|
5619 |
+
if (tag === 'math') {
|
5620 |
+
return 'math'
|
5621 |
+
}
|
5622 |
+
}
|
5623 |
+
|
5624 |
+
var unknownElementCache = Object.create(null);
|
5625 |
+
function isUnknownElement (tag) {
|
5626 |
+
/* istanbul ignore if */
|
5627 |
+
if (!inBrowser) {
|
5628 |
+
return true
|
5629 |
+
}
|
5630 |
+
if (isReservedTag(tag)) {
|
5631 |
+
return false
|
5632 |
+
}
|
5633 |
+
tag = tag.toLowerCase();
|
5634 |
+
/* istanbul ignore if */
|
5635 |
+
if (unknownElementCache[tag] != null) {
|
5636 |
+
return unknownElementCache[tag]
|
5637 |
+
}
|
5638 |
+
var el = document.createElement(tag);
|
5639 |
+
if (tag.indexOf('-') > -1) {
|
5640 |
+
// http://stackoverflow.com/a/28210364/1070244
|
5641 |
+
return (unknownElementCache[tag] = (
|
5642 |
+
el.constructor === window.HTMLUnknownElement ||
|
5643 |
+
el.constructor === window.HTMLElement
|
5644 |
+
))
|
5645 |
+
} else {
|
5646 |
+
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
|
5647 |
+
}
|
5648 |
+
}
|
5649 |
+
|
5650 |
+
var isTextInputType = makeMap('text,number,password,search,email,tel,url');
|
5651 |
+
|
5652 |
+
/* */
|
5653 |
+
|
5654 |
+
/**
|
5655 |
+
* Query an element selector if it's not an element already.
|
5656 |
+
*/
|
5657 |
+
function query (el) {
|
5658 |
+
if (typeof el === 'string') {
|
5659 |
+
var selected = document.querySelector(el);
|
5660 |
+
if (!selected) {
|
5661 |
+
warn(
|
5662 |
+
'Cannot find element: ' + el
|
5663 |
+
);
|
5664 |
+
return document.createElement('div')
|
5665 |
+
}
|
5666 |
+
return selected
|
5667 |
+
} else {
|
5668 |
+
return el
|
5669 |
+
}
|
5670 |
+
}
|
5671 |
+
|
5672 |
+
/* */
|
5673 |
+
|
5674 |
+
function createElement$1 (tagName, vnode) {
|
5675 |
+
var elm = document.createElement(tagName);
|
5676 |
+
if (tagName !== 'select') {
|
5677 |
+
return elm
|
5678 |
+
}
|
5679 |
+
// false or null will remove the attribute but undefined will not
|
5680 |
+
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
|
5681 |
+
elm.setAttribute('multiple', 'multiple');
|
5682 |
+
}
|
5683 |
+
return elm
|
5684 |
+
}
|
5685 |
+
|
5686 |
+
function createElementNS (namespace, tagName) {
|
5687 |
+
return document.createElementNS(namespaceMap[namespace], tagName)
|
5688 |
+
}
|
5689 |
+
|
5690 |
+
function createTextNode (text) {
|
5691 |
+
return document.createTextNode(text)
|
5692 |
+
}
|
5693 |
+
|
5694 |
+
function createComment (text) {
|
5695 |
+
return document.createComment(text)
|
5696 |
+
}
|
5697 |
+
|
5698 |
+
function insertBefore (parentNode, newNode, referenceNode) {
|
5699 |
+
parentNode.insertBefore(newNode, referenceNode);
|
5700 |
+
}
|
5701 |
+
|
5702 |
+
function removeChild (node, child) {
|
5703 |
+
node.removeChild(child);
|
5704 |
+
}
|
5705 |
+
|
5706 |
+
function appendChild (node, child) {
|
5707 |
+
node.appendChild(child);
|
5708 |
+
}
|
5709 |
+
|
5710 |
+
function parentNode (node) {
|
5711 |
+
return node.parentNode
|
5712 |
+
}
|
5713 |
+
|
5714 |
+
function nextSibling (node) {
|
5715 |
+
return node.nextSibling
|
5716 |
+
}
|
5717 |
+
|
5718 |
+
function tagName (node) {
|
5719 |
+
return node.tagName
|
5720 |
+
}
|
5721 |
+
|
5722 |
+
function setTextContent (node, text) {
|
5723 |
+
node.textContent = text;
|
5724 |
+
}
|
5725 |
+
|
5726 |
+
function setStyleScope (node, scopeId) {
|
5727 |
+
node.setAttribute(scopeId, '');
|
5728 |
+
}
|
5729 |
+
|
5730 |
+
var nodeOps = /*#__PURE__*/Object.freeze({
|
5731 |
+
createElement: createElement$1,
|
5732 |
+
createElementNS: createElementNS,
|
5733 |
+
createTextNode: createTextNode,
|
5734 |
+
createComment: createComment,
|
5735 |
+
insertBefore: insertBefore,
|
5736 |
+
removeChild: removeChild,
|
5737 |
+
appendChild: appendChild,
|
5738 |
+
parentNode: parentNode,
|
5739 |
+
nextSibling: nextSibling,
|
5740 |
+
tagName: tagName,
|
5741 |
+
setTextContent: setTextContent,
|
5742 |
+
setStyleScope: setStyleScope
|
5743 |
+
});
|
5744 |
+
|
5745 |
+
/* */
|
5746 |
+
|
5747 |
+
var ref = {
|
5748 |
+
create: function create (_, vnode) {
|
5749 |
+
registerRef(vnode);
|
5750 |
+
},
|
5751 |
+
update: function update (oldVnode, vnode) {
|
5752 |
+
if (oldVnode.data.ref !== vnode.data.ref) {
|
5753 |
+
registerRef(oldVnode, true);
|
5754 |
+
registerRef(vnode);
|
5755 |
+
}
|
5756 |
+
},
|
5757 |
+
destroy: function destroy (vnode) {
|
5758 |
+
registerRef(vnode, true);
|
5759 |
+
}
|
5760 |
+
};
|
5761 |
+
|
5762 |
+
function registerRef (vnode, isRemoval) {
|
5763 |
+
var key = vnode.data.ref;
|
5764 |
+
if (!isDef(key)) { return }
|
5765 |
+
|
5766 |
+
var vm = vnode.context;
|
5767 |
+
var ref = vnode.componentInstance || vnode.elm;
|
5768 |
+
var refs = vm.$refs;
|
5769 |
+
if (isRemoval) {
|
5770 |
+
if (Array.isArray(refs[key])) {
|
5771 |
+
remove(refs[key], ref);
|
5772 |
+
} else if (refs[key] === ref) {
|
5773 |
+
refs[key] = undefined;
|
5774 |
+
}
|
5775 |
+
} else {
|
5776 |
+
if (vnode.data.refInFor) {
|
5777 |
+
if (!Array.isArray(refs[key])) {
|
5778 |
+
refs[key] = [ref];
|
5779 |
+
} else if (refs[key].indexOf(ref) < 0) {
|
5780 |
+
// $flow-disable-line
|
5781 |
+
refs[key].push(ref);
|
5782 |
+
}
|
5783 |
+
} else {
|
5784 |
+
refs[key] = ref;
|
5785 |
+
}
|
5786 |
+
}
|
5787 |
+
}
|
5788 |
+
|
5789 |
+
/**
|
5790 |
+
* Virtual DOM patching algorithm based on Snabbdom by
|
5791 |
+
* Simon Friis Vindum (@paldepind)
|
5792 |
+
* Licensed under the MIT License
|
5793 |
+
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
|
5794 |
+
*
|
5795 |
+
* modified by Evan You (@yyx990803)
|
5796 |
+
*
|
5797 |
+
* Not type-checking this because this file is perf-critical and the cost
|
5798 |
+
* of making flow understand it is not worth it.
|
5799 |
+
*/
|
5800 |
+
|
5801 |
+
var emptyNode = new VNode('', {}, []);
|
5802 |
+
|
5803 |
+
var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
|
5804 |
+
|
5805 |
+
function sameVnode (a, b) {
|
5806 |
+
return (
|
5807 |
+
a.key === b.key && (
|
5808 |
+
(
|
5809 |
+
a.tag === b.tag &&
|
5810 |
+
a.isComment === b.isComment &&
|
5811 |
+
isDef(a.data) === isDef(b.data) &&
|
5812 |
+
sameInputType(a, b)
|
5813 |
+
) || (
|
5814 |
+
isTrue(a.isAsyncPlaceholder) &&
|
5815 |
+
a.asyncFactory === b.asyncFactory &&
|
5816 |
+
isUndef(b.asyncFactory.error)
|
5817 |
+
)
|
5818 |
+
)
|
5819 |
+
)
|
5820 |
+
}
|
5821 |
+
|
5822 |
+
function sameInputType (a, b) {
|
5823 |
+
if (a.tag !== 'input') { return true }
|
5824 |
+
var i;
|
5825 |
+
var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
|
5826 |
+
var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
|
5827 |
+
return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
|
5828 |
+
}
|
5829 |
+
|
5830 |
+
function createKeyToOldIdx (children, beginIdx, endIdx) {
|
5831 |
+
var i, key;
|
5832 |
+
var map = {};
|
5833 |
+
for (i = beginIdx; i <= endIdx; ++i) {
|
5834 |
+
key = children[i].key;
|
5835 |
+
if (isDef(key)) { map[key] = i; }
|
5836 |
+
}
|
5837 |
+
return map
|
5838 |
+
}
|
5839 |
+
|
5840 |
+
function createPatchFunction (backend) {
|
5841 |
+
var i, j;
|
5842 |
+
var cbs = {};
|
5843 |
+
|
5844 |
+
var modules = backend.modules;
|
5845 |
+
var nodeOps = backend.nodeOps;
|
5846 |
+
|
5847 |
+
for (i = 0; i < hooks.length; ++i) {
|
5848 |
+
cbs[hooks[i]] = [];
|
5849 |
+
for (j = 0; j < modules.length; ++j) {
|
5850 |
+
if (isDef(modules[j][hooks[i]])) {
|
5851 |
+
cbs[hooks[i]].push(modules[j][hooks[i]]);
|
5852 |
+
}
|
5853 |
+
}
|
5854 |
+
}
|
5855 |
+
|
5856 |
+
function emptyNodeAt (elm) {
|
5857 |
+
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
|
5858 |
+
}
|
5859 |
+
|
5860 |
+
function createRmCb (childElm, listeners) {
|
5861 |
+
function remove$$1 () {
|
5862 |
+
if (--remove$$1.listeners === 0) {
|
5863 |
+
removeNode(childElm);
|
5864 |
+
}
|
5865 |
+
}
|
5866 |
+
remove$$1.listeners = listeners;
|
5867 |
+
return remove$$1
|
5868 |
+
}
|
5869 |
+
|
5870 |
+
function removeNode (el) {
|
5871 |
+
var parent = nodeOps.parentNode(el);
|
5872 |
+
// element may have already been removed due to v-html / v-text
|
5873 |
+
if (isDef(parent)) {
|
5874 |
+
nodeOps.removeChild(parent, el);
|
5875 |
+
}
|
5876 |
+
}
|
5877 |
+
|
5878 |
+
function isUnknownElement$$1 (vnode, inVPre) {
|
5879 |
+
return (
|
5880 |
+
!inVPre &&
|
5881 |
+
!vnode.ns &&
|
5882 |
+
!(
|
5883 |
+
config.ignoredElements.length &&
|
5884 |
+
config.ignoredElements.some(function (ignore) {
|
5885 |
+
return isRegExp(ignore)
|
5886 |
+
? ignore.test(vnode.tag)
|
5887 |
+
: ignore === vnode.tag
|
5888 |
+
})
|
5889 |
+
) &&
|
5890 |
+
config.isUnknownElement(vnode.tag)
|
5891 |
+
)
|
5892 |
+
}
|
5893 |
+
|
5894 |
+
var creatingElmInVPre = 0;
|
5895 |
+
|
5896 |
+
function createElm (
|
5897 |
+
vnode,
|
5898 |
+
insertedVnodeQueue,
|
5899 |
+
parentElm,
|
5900 |
+
refElm,
|
5901 |
+
nested,
|
5902 |
+
ownerArray,
|
5903 |
+
index
|
5904 |
+
) {
|
5905 |
+
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
5906 |
+
// This vnode was used in a previous render!
|
5907 |
+
// now it's used as a new node, overwriting its elm would cause
|
5908 |
+
// potential patch errors down the road when it's used as an insertion
|
5909 |
+
// reference node. Instead, we clone the node on-demand before creating
|
5910 |
+
// associated DOM element for it.
|
5911 |
+
vnode = ownerArray[index] = cloneVNode(vnode);
|
5912 |
+
}
|
5913 |
+
|
5914 |
+
vnode.isRootInsert = !nested; // for transition enter check
|
5915 |
+
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
|
5916 |
+
return
|
5917 |
+
}
|
5918 |
+
|
5919 |
+
var data = vnode.data;
|
5920 |
+
var children = vnode.children;
|
5921 |
+
var tag = vnode.tag;
|
5922 |
+
if (isDef(tag)) {
|
5923 |
+
{
|
5924 |
+
if (data && data.pre) {
|
5925 |
+
creatingElmInVPre++;
|
5926 |
+
}
|
5927 |
+
if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
|
5928 |
+
warn(
|
5929 |
+
'Unknown custom element: <' + tag + '> - did you ' +
|
5930 |
+
'register the component correctly? For recursive components, ' +
|
5931 |
+
'make sure to provide the "name" option.',
|
5932 |
+
vnode.context
|
5933 |
+
);
|
5934 |
+
}
|
5935 |
+
}
|
5936 |
+
|
5937 |
+
vnode.elm = vnode.ns
|
5938 |
+
? nodeOps.createElementNS(vnode.ns, tag)
|
5939 |
+
: nodeOps.createElement(tag, vnode);
|
5940 |
+
setScope(vnode);
|
5941 |
+
|
5942 |
+
/* istanbul ignore if */
|
5943 |
+
{
|
5944 |
+
createChildren(vnode, children, insertedVnodeQueue);
|
5945 |
+
if (isDef(data)) {
|
5946 |
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
5947 |
+
}
|
5948 |
+
insert(parentElm, vnode.elm, refElm);
|
5949 |
+
}
|
5950 |
+
|
5951 |
+
if (data && data.pre) {
|
5952 |
+
creatingElmInVPre--;
|
5953 |
+
}
|
5954 |
+
} else if (isTrue(vnode.isComment)) {
|
5955 |
+
vnode.elm = nodeOps.createComment(vnode.text);
|
5956 |
+
insert(parentElm, vnode.elm, refElm);
|
5957 |
+
} else {
|
5958 |
+
vnode.elm = nodeOps.createTextNode(vnode.text);
|
5959 |
+
insert(parentElm, vnode.elm, refElm);
|
5960 |
+
}
|
5961 |
+
}
|
5962 |
+
|
5963 |
+
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
5964 |
+
var i = vnode.data;
|
5965 |
+
if (isDef(i)) {
|
5966 |
+
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
|
5967 |
+
if (isDef(i = i.hook) && isDef(i = i.init)) {
|
5968 |
+
i(vnode, false /* hydrating */);
|
5969 |
+
}
|
5970 |
+
// after calling the init hook, if the vnode is a child component
|
5971 |
+
// it should've created a child instance and mounted it. the child
|
5972 |
+
// component also has set the placeholder vnode's elm.
|
5973 |
+
// in that case we can just return the element and be done.
|
5974 |
+
if (isDef(vnode.componentInstance)) {
|
5975 |
+
initComponent(vnode, insertedVnodeQueue);
|
5976 |
+
insert(parentElm, vnode.elm, refElm);
|
5977 |
+
if (isTrue(isReactivated)) {
|
5978 |
+
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
|
5979 |
+
}
|
5980 |
+
return true
|
5981 |
+
}
|
5982 |
+
}
|
5983 |
+
}
|
5984 |
+
|
5985 |
+
function initComponent (vnode, insertedVnodeQueue) {
|
5986 |
+
if (isDef(vnode.data.pendingInsert)) {
|
5987 |
+
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
|
5988 |
+
vnode.data.pendingInsert = null;
|
5989 |
+
}
|
5990 |
+
vnode.elm = vnode.componentInstance.$el;
|
5991 |
+
if (isPatchable(vnode)) {
|
5992 |
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
5993 |
+
setScope(vnode);
|
5994 |
+
} else {
|
5995 |
+
// empty component root.
|
5996 |
+
// skip all element-related modules except for ref (#3455)
|
5997 |
+
registerRef(vnode);
|
5998 |
+
// make sure to invoke the insert hook
|
5999 |
+
insertedVnodeQueue.push(vnode);
|
6000 |
+
}
|
6001 |
+
}
|
6002 |
+
|
6003 |
+
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
|
6004 |
+
var i;
|
6005 |
+
// hack for #4339: a reactivated component with inner transition
|
6006 |
+
// does not trigger because the inner node's created hooks are not called
|
6007 |
+
// again. It's not ideal to involve module-specific logic in here but
|
6008 |
+
// there doesn't seem to be a better way to do it.
|
6009 |
+
var innerNode = vnode;
|
6010 |
+
while (innerNode.componentInstance) {
|
6011 |
+
innerNode = innerNode.componentInstance._vnode;
|
6012 |
+
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
|
6013 |
+
for (i = 0; i < cbs.activate.length; ++i) {
|
6014 |
+
cbs.activate[i](emptyNode, innerNode);
|
6015 |
+
}
|
6016 |
+
insertedVnodeQueue.push(innerNode);
|
6017 |
+
break
|
6018 |
+
}
|
6019 |
+
}
|
6020 |
+
// unlike a newly created component,
|
6021 |
+
// a reactivated keep-alive component doesn't insert itself
|
6022 |
+
insert(parentElm, vnode.elm, refElm);
|
6023 |
+
}
|
6024 |
+
|
6025 |
+
function insert (parent, elm, ref$$1) {
|
6026 |
+
if (isDef(parent)) {
|
6027 |
+
if (isDef(ref$$1)) {
|
6028 |
+
if (nodeOps.parentNode(ref$$1) === parent) {
|
6029 |
+
nodeOps.insertBefore(parent, elm, ref$$1);
|
6030 |
+
}
|
6031 |
+
} else {
|
6032 |
+
nodeOps.appendChild(parent, elm);
|
6033 |
+
}
|
6034 |
+
}
|
6035 |
+
}
|
6036 |
+
|
6037 |
+
function createChildren (vnode, children, insertedVnodeQueue) {
|
6038 |
+
if (Array.isArray(children)) {
|
6039 |
+
{
|
6040 |
+
checkDuplicateKeys(children);
|
6041 |
+
}
|
6042 |
+
for (var i = 0; i < children.length; ++i) {
|
6043 |
+
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
|
6044 |
+
}
|
6045 |
+
} else if (isPrimitive(vnode.text)) {
|
6046 |
+
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
|
6047 |
+
}
|
6048 |
+
}
|
6049 |
+
|
6050 |
+
function isPatchable (vnode) {
|
6051 |
+
while (vnode.componentInstance) {
|
6052 |
+
vnode = vnode.componentInstance._vnode;
|
6053 |
+
}
|
6054 |
+
return isDef(vnode.tag)
|
6055 |
+
}
|
6056 |
+
|
6057 |
+
function invokeCreateHooks (vnode, insertedVnodeQueue) {
|
6058 |
+
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6059 |
+
cbs.create[i$1](emptyNode, vnode);
|
6060 |
+
}
|
6061 |
+
i = vnode.data.hook; // Reuse variable
|
6062 |
+
if (isDef(i)) {
|
6063 |
+
if (isDef(i.create)) { i.create(emptyNode, vnode); }
|
6064 |
+
if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
|
6065 |
+
}
|
6066 |
+
}
|
6067 |
+
|
6068 |
+
// set scope id attribute for scoped CSS.
|
6069 |
+
// this is implemented as a special case to avoid the overhead
|
6070 |
+
// of going through the normal attribute patching process.
|
6071 |
+
function setScope (vnode) {
|
6072 |
+
var i;
|
6073 |
+
if (isDef(i = vnode.fnScopeId)) {
|
6074 |
+
nodeOps.setStyleScope(vnode.elm, i);
|
6075 |
+
} else {
|
6076 |
+
var ancestor = vnode;
|
6077 |
+
while (ancestor) {
|
6078 |
+
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
|
6079 |
+
nodeOps.setStyleScope(vnode.elm, i);
|
6080 |
+
}
|
6081 |
+
ancestor = ancestor.parent;
|
6082 |
+
}
|
6083 |
+
}
|
6084 |
+
// for slot content they should also get the scopeId from the host instance.
|
6085 |
+
if (isDef(i = activeInstance) &&
|
6086 |
+
i !== vnode.context &&
|
6087 |
+
i !== vnode.fnContext &&
|
6088 |
+
isDef(i = i.$options._scopeId)
|
6089 |
+
) {
|
6090 |
+
nodeOps.setStyleScope(vnode.elm, i);
|
6091 |
+
}
|
6092 |
+
}
|
6093 |
+
|
6094 |
+
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
|
6095 |
+
for (; startIdx <= endIdx; ++startIdx) {
|
6096 |
+
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
|
6097 |
+
}
|
6098 |
+
}
|
6099 |
+
|
6100 |
+
function invokeDestroyHook (vnode) {
|
6101 |
+
var i, j;
|
6102 |
+
var data = vnode.data;
|
6103 |
+
if (isDef(data)) {
|
6104 |
+
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
|
6105 |
+
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
|
6106 |
+
}
|
6107 |
+
if (isDef(i = vnode.children)) {
|
6108 |
+
for (j = 0; j < vnode.children.length; ++j) {
|
6109 |
+
invokeDestroyHook(vnode.children[j]);
|
6110 |
+
}
|
6111 |
+
}
|
6112 |
+
}
|
6113 |
+
|
6114 |
+
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
|
6115 |
+
for (; startIdx <= endIdx; ++startIdx) {
|
6116 |
+
var ch = vnodes[startIdx];
|
6117 |
+
if (isDef(ch)) {
|
6118 |
+
if (isDef(ch.tag)) {
|
6119 |
+
removeAndInvokeRemoveHook(ch);
|
6120 |
+
invokeDestroyHook(ch);
|
6121 |
+
} else { // Text node
|
6122 |
+
removeNode(ch.elm);
|
6123 |
+
}
|
6124 |
+
}
|
6125 |
+
}
|
6126 |
+
}
|
6127 |
+
|
6128 |
+
function removeAndInvokeRemoveHook (vnode, rm) {
|
6129 |
+
if (isDef(rm) || isDef(vnode.data)) {
|
6130 |
+
var i;
|
6131 |
+
var listeners = cbs.remove.length + 1;
|
6132 |
+
if (isDef(rm)) {
|
6133 |
+
// we have a recursively passed down rm callback
|
6134 |
+
// increase the listeners count
|
6135 |
+
rm.listeners += listeners;
|
6136 |
+
} else {
|
6137 |
+
// directly removing
|
6138 |
+
rm = createRmCb(vnode.elm, listeners);
|
6139 |
+
}
|
6140 |
+
// recursively invoke hooks on child component root node
|
6141 |
+
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
|
6142 |
+
removeAndInvokeRemoveHook(i, rm);
|
6143 |
+
}
|
6144 |
+
for (i = 0; i < cbs.remove.length; ++i) {
|
6145 |
+
cbs.remove[i](vnode, rm);
|
6146 |
+
}
|
6147 |
+
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
|
6148 |
+
i(vnode, rm);
|
6149 |
+
} else {
|
6150 |
+
rm();
|
6151 |
+
}
|
6152 |
+
} else {
|
6153 |
+
removeNode(vnode.elm);
|
6154 |
+
}
|
6155 |
+
}
|
6156 |
+
|
6157 |
+
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
|
6158 |
+
var oldStartIdx = 0;
|
6159 |
+
var newStartIdx = 0;
|
6160 |
+
var oldEndIdx = oldCh.length - 1;
|
6161 |
+
var oldStartVnode = oldCh[0];
|
6162 |
+
var oldEndVnode = oldCh[oldEndIdx];
|
6163 |
+
var newEndIdx = newCh.length - 1;
|
6164 |
+
var newStartVnode = newCh[0];
|
6165 |
+
var newEndVnode = newCh[newEndIdx];
|
6166 |
+
var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
|
6167 |
+
|
6168 |
+
// removeOnly is a special flag used only by <transition-group>
|
6169 |
+
// to ensure removed elements stay in correct relative positions
|
6170 |
+
// during leaving transitions
|
6171 |
+
var canMove = !removeOnly;
|
6172 |
+
|
6173 |
+
{
|
6174 |
+
checkDuplicateKeys(newCh);
|
6175 |
+
}
|
6176 |
+
|
6177 |
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
6178 |
+
if (isUndef(oldStartVnode)) {
|
6179 |
+
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
|
6180 |
+
} else if (isUndef(oldEndVnode)) {
|
6181 |
+
oldEndVnode = oldCh[--oldEndIdx];
|
6182 |
+
} else if (sameVnode(oldStartVnode, newStartVnode)) {
|
6183 |
+
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6184 |
+
oldStartVnode = oldCh[++oldStartIdx];
|
6185 |
+
newStartVnode = newCh[++newStartIdx];
|
6186 |
+
} else if (sameVnode(oldEndVnode, newEndVnode)) {
|
6187 |
+
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6188 |
+
oldEndVnode = oldCh[--oldEndIdx];
|
6189 |
+
newEndVnode = newCh[--newEndIdx];
|
6190 |
+
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
|
6191 |
+
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
|
6192 |
+
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
|
6193 |
+
oldStartVnode = oldCh[++oldStartIdx];
|
6194 |
+
newEndVnode = newCh[--newEndIdx];
|
6195 |
+
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
|
6196 |
+
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6197 |
+
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
|
6198 |
+
oldEndVnode = oldCh[--oldEndIdx];
|
6199 |
+
newStartVnode = newCh[++newStartIdx];
|
6200 |
+
} else {
|
6201 |
+
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
|
6202 |
+
idxInOld = isDef(newStartVnode.key)
|
6203 |
+
? oldKeyToIdx[newStartVnode.key]
|
6204 |
+
: findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
|
6205 |
+
if (isUndef(idxInOld)) { // New element
|
6206 |
+
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6207 |
+
} else {
|
6208 |
+
vnodeToMove = oldCh[idxInOld];
|
6209 |
+
if (sameVnode(vnodeToMove, newStartVnode)) {
|
6210 |
+
patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
|
6211 |
+
oldCh[idxInOld] = undefined;
|
6212 |
+
canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
|
6213 |
+
} else {
|
6214 |
+
// same key but different element. treat as new element
|
6215 |
+
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
|
6216 |
+
}
|
6217 |
+
}
|
6218 |
+
newStartVnode = newCh[++newStartIdx];
|
6219 |
+
}
|
6220 |
+
}
|
6221 |
+
if (oldStartIdx > oldEndIdx) {
|
6222 |
+
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
|
6223 |
+
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
|
6224 |
+
} else if (newStartIdx > newEndIdx) {
|
6225 |
+
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
|
6226 |
+
}
|
6227 |
+
}
|
6228 |
+
|
6229 |
+
function checkDuplicateKeys (children) {
|
6230 |
+
var seenKeys = {};
|
6231 |
+
for (var i = 0; i < children.length; i++) {
|
6232 |
+
var vnode = children[i];
|
6233 |
+
var key = vnode.key;
|
6234 |
+
if (isDef(key)) {
|
6235 |
+
if (seenKeys[key]) {
|
6236 |
+
warn(
|
6237 |
+
("Duplicate keys detected: '" + key + "'. This may cause an update error."),
|
6238 |
+
vnode.context
|
6239 |
+
);
|
6240 |
+
} else {
|
6241 |
+
seenKeys[key] = true;
|
6242 |
+
}
|
6243 |
+
}
|
6244 |
+
}
|
6245 |
+
}
|
6246 |
+
|
6247 |
+
function findIdxInOld (node, oldCh, start, end) {
|
6248 |
+
for (var i = start; i < end; i++) {
|
6249 |
+
var c = oldCh[i];
|
6250 |
+
if (isDef(c) && sameVnode(node, c)) { return i }
|
6251 |
+
}
|
6252 |
+
}
|
6253 |
+
|
6254 |
+
function patchVnode (
|
6255 |
+
oldVnode,
|
6256 |
+
vnode,
|
6257 |
+
insertedVnodeQueue,
|
6258 |
+
ownerArray,
|
6259 |
+
index,
|
6260 |
+
removeOnly
|
6261 |
+
) {
|
6262 |
+
if (oldVnode === vnode) {
|
6263 |
+
return
|
6264 |
+
}
|
6265 |
+
|
6266 |
+
if (isDef(vnode.elm) && isDef(ownerArray)) {
|
6267 |
+
// clone reused vnode
|
6268 |
+
vnode = ownerArray[index] = cloneVNode(vnode);
|
6269 |
+
}
|
6270 |
+
|
6271 |
+
var elm = vnode.elm = oldVnode.elm;
|
6272 |
+
|
6273 |
+
if (isTrue(oldVnode.isAsyncPlaceholder)) {
|
6274 |
+
if (isDef(vnode.asyncFactory.resolved)) {
|
6275 |
+
hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
|
6276 |
+
} else {
|
6277 |
+
vnode.isAsyncPlaceholder = true;
|
6278 |
+
}
|
6279 |
+
return
|
6280 |
+
}
|
6281 |
+
|
6282 |
+
// reuse element for static trees.
|
6283 |
+
// note we only do this if the vnode is cloned -
|
6284 |
+
// if the new node is not cloned it means the render functions have been
|
6285 |
+
// reset by the hot-reload-api and we need to do a proper re-render.
|
6286 |
+
if (isTrue(vnode.isStatic) &&
|
6287 |
+
isTrue(oldVnode.isStatic) &&
|
6288 |
+
vnode.key === oldVnode.key &&
|
6289 |
+
(isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
|
6290 |
+
) {
|
6291 |
+
vnode.componentInstance = oldVnode.componentInstance;
|
6292 |
+
return
|
6293 |
+
}
|
6294 |
+
|
6295 |
+
var i;
|
6296 |
+
var data = vnode.data;
|
6297 |
+
if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
|
6298 |
+
i(oldVnode, vnode);
|
6299 |
+
}
|
6300 |
+
|
6301 |
+
var oldCh = oldVnode.children;
|
6302 |
+
var ch = vnode.children;
|
6303 |
+
if (isDef(data) && isPatchable(vnode)) {
|
6304 |
+
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
|
6305 |
+
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
|
6306 |
+
}
|
6307 |
+
if (isUndef(vnode.text)) {
|
6308 |
+
if (isDef(oldCh) && isDef(ch)) {
|
6309 |
+
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
|
6310 |
+
} else if (isDef(ch)) {
|
6311 |
+
{
|
6312 |
+
checkDuplicateKeys(ch);
|
6313 |
+
}
|
6314 |
+
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
|
6315 |
+
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
|
6316 |
+
} else if (isDef(oldCh)) {
|
6317 |
+
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
|
6318 |
+
} else if (isDef(oldVnode.text)) {
|
6319 |
+
nodeOps.setTextContent(elm, '');
|
6320 |
+
}
|
6321 |
+
} else if (oldVnode.text !== vnode.text) {
|
6322 |
+
nodeOps.setTextContent(elm, vnode.text);
|
6323 |
+
}
|
6324 |
+
if (isDef(data)) {
|
6325 |
+
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
|
6326 |
+
}
|
6327 |
+
}
|
6328 |
+
|
6329 |
+
function invokeInsertHook (vnode, queue, initial) {
|
6330 |
+
// delay insert hooks for component root nodes, invoke them after the
|
6331 |
+
// element is really inserted
|
6332 |
+
if (isTrue(initial) && isDef(vnode.parent)) {
|
6333 |
+
vnode.parent.data.pendingInsert = queue;
|
6334 |
+
} else {
|
6335 |
+
for (var i = 0; i < queue.length; ++i) {
|
6336 |
+
queue[i].data.hook.insert(queue[i]);
|
6337 |
+
}
|
6338 |
+
}
|
6339 |
+
}
|
6340 |
+
|
6341 |
+
var hydrationBailed = false;
|
6342 |
+
// list of modules that can skip create hook during hydration because they
|
6343 |
+
// are already rendered on the client or has no need for initialization
|
6344 |
+
// Note: style is excluded because it relies on initial clone for future
|
6345 |
+
// deep updates (#7063).
|
6346 |
+
var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
|
6347 |
+
|
6348 |
+
// Note: this is a browser-only function so we can assume elms are DOM nodes.
|
6349 |
+
function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
|
6350 |
+
var i;
|
6351 |
+
var tag = vnode.tag;
|
6352 |
+
var data = vnode.data;
|
6353 |
+
var children = vnode.children;
|
6354 |
+
inVPre = inVPre || (data && data.pre);
|
6355 |
+
vnode.elm = elm;
|
6356 |
+
|
6357 |
+
if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
|
6358 |
+
vnode.isAsyncPlaceholder = true;
|
6359 |
+
return true
|
6360 |
+
}
|
6361 |
+
// assert node match
|
6362 |
+
{
|
6363 |
+
if (!assertNodeMatch(elm, vnode, inVPre)) {
|
6364 |
+
return false
|
6365 |
+
}
|
6366 |
+
}
|
6367 |
+
if (isDef(data)) {
|
6368 |
+
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
|
6369 |
+
if (isDef(i = vnode.componentInstance)) {
|
6370 |
+
// child component. it should have hydrated its own tree.
|
6371 |
+
initComponent(vnode, insertedVnodeQueue);
|
6372 |
+
return true
|
6373 |
+
}
|
6374 |
+
}
|
6375 |
+
if (isDef(tag)) {
|
6376 |
+
if (isDef(children)) {
|
6377 |
+
// empty element, allow client to pick up and populate children
|
6378 |
+
if (!elm.hasChildNodes()) {
|
6379 |
+
createChildren(vnode, children, insertedVnodeQueue);
|
6380 |
+
} else {
|
6381 |
+
// v-html and domProps: innerHTML
|
6382 |
+
if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
|
6383 |
+
if (i !== elm.innerHTML) {
|
6384 |
+
/* istanbul ignore if */
|
6385 |
+
if (typeof console !== 'undefined' &&
|
6386 |
+
!hydrationBailed
|
6387 |
+
) {
|
6388 |
+
hydrationBailed = true;
|
6389 |
+
console.warn('Parent: ', elm);
|
6390 |
+
console.warn('server innerHTML: ', i);
|
6391 |
+
console.warn('client innerHTML: ', elm.innerHTML);
|
6392 |
+
}
|
6393 |
+
return false
|
6394 |
+
}
|
6395 |
+
} else {
|
6396 |
+
// iterate and compare children lists
|
6397 |
+
var childrenMatch = true;
|
6398 |
+
var childNode = elm.firstChild;
|
6399 |
+
for (var i$1 = 0; i$1 < children.length; i$1++) {
|
6400 |
+
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
|
6401 |
+
childrenMatch = false;
|
6402 |
+
break
|
6403 |
+
}
|
6404 |
+
childNode = childNode.nextSibling;
|
6405 |
+
}
|
6406 |
+
// if childNode is not null, it means the actual childNodes list is
|
6407 |
+
// longer than the virtual children list.
|
6408 |
+
if (!childrenMatch || childNode) {
|
6409 |
+
/* istanbul ignore if */
|
6410 |
+
if (typeof console !== 'undefined' &&
|
6411 |
+
!hydrationBailed
|
6412 |
+
) {
|
6413 |
+
hydrationBailed = true;
|
6414 |
+
console.warn('Parent: ', elm);
|
6415 |
+
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
|
6416 |
+
}
|
6417 |
+
return false
|
6418 |
+
}
|
6419 |
+
}
|
6420 |
+
}
|
6421 |
+
}
|
6422 |
+
if (isDef(data)) {
|
6423 |
+
var fullInvoke = false;
|
6424 |
+
for (var key in data) {
|
6425 |
+
if (!isRenderedModule(key)) {
|
6426 |
+
fullInvoke = true;
|
6427 |
+
invokeCreateHooks(vnode, insertedVnodeQueue);
|
6428 |
+
break
|
6429 |
+
}
|
6430 |
+
}
|
6431 |
+
if (!fullInvoke && data['class']) {
|
6432 |
+
// ensure collecting deps for deep class bindings for future updates
|
6433 |
+
traverse(data['class']);
|
6434 |
+
}
|
6435 |
+
}
|
6436 |
+
} else if (elm.data !== vnode.text) {
|
6437 |
+
elm.data = vnode.text;
|
6438 |
+
}
|
6439 |
+
return true
|
6440 |
+
}
|
6441 |
+
|
6442 |
+
function assertNodeMatch (node, vnode, inVPre) {
|
6443 |
+
if (isDef(vnode.tag)) {
|
6444 |
+
return vnode.tag.indexOf('vue-component') === 0 || (
|
6445 |
+
!isUnknownElement$$1(vnode, inVPre) &&
|
6446 |
+
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
|
6447 |
+
)
|
6448 |
+
} else {
|
6449 |
+
return node.nodeType === (vnode.isComment ? 8 : 3)
|
6450 |
+
}
|
6451 |
+
}
|
6452 |
+
|
6453 |
+
return function patch (oldVnode, vnode, hydrating, removeOnly) {
|
6454 |
+
if (isUndef(vnode)) {
|
6455 |
+
if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
|
6456 |
+
return
|
6457 |
+
}
|
6458 |
+
|
6459 |
+
var isInitialPatch = false;
|
6460 |
+
var insertedVnodeQueue = [];
|
6461 |
+
|
6462 |
+
if (isUndef(oldVnode)) {
|
6463 |
+
// empty mount (likely as component), create new root element
|
6464 |
+
isInitialPatch = true;
|
6465 |
+
createElm(vnode, insertedVnodeQueue);
|
6466 |
+
} else {
|
6467 |
+
var isRealElement = isDef(oldVnode.nodeType);
|
6468 |
+
if (!isRealElement && sameVnode(oldVnode, vnode)) {
|
6469 |
+
// patch existing root node
|
6470 |
+
patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
|
6471 |
+
} else {
|
6472 |
+
if (isRealElement) {
|
6473 |
+
// mounting to a real element
|
6474 |
+
// check if this is server-rendered content and if we can perform
|
6475 |
+
// a successful hydration.
|
6476 |
+
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
|
6477 |
+
oldVnode.removeAttribute(SSR_ATTR);
|
6478 |
+
hydrating = true;
|
6479 |
+
}
|
6480 |
+
if (isTrue(hydrating)) {
|
6481 |
+
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
|
6482 |
+
invokeInsertHook(vnode, insertedVnodeQueue, true);
|
6483 |
+
return oldVnode
|
6484 |
+
} else {
|
6485 |
+
warn(
|
6486 |
+
'The client-side rendered virtual DOM tree is not matching ' +
|
6487 |
+
'server-rendered content. This is likely caused by incorrect ' +
|
6488 |
+
'HTML markup, for example nesting block-level elements inside ' +
|
6489 |
+
'<p>, or missing <tbody>. Bailing hydration and performing ' +
|
6490 |
+
'full client-side render.'
|
6491 |
+
);
|
6492 |
+
}
|
6493 |
+
}
|
6494 |
+
// either not server-rendered, or hydration failed.
|
6495 |
+
// create an empty node and replace it
|
6496 |
+
oldVnode = emptyNodeAt(oldVnode);
|
6497 |
+
}
|
6498 |
+
|
6499 |
+
// replacing existing element
|
6500 |
+
var oldElm = oldVnode.elm;
|
6501 |
+
var parentElm = nodeOps.parentNode(oldElm);
|
6502 |
+
|
6503 |
+
// create new node
|
6504 |
+
createElm(
|
6505 |
+
vnode,
|
6506 |
+
insertedVnodeQueue,
|
6507 |
+
// extremely rare edge case: do not insert if old element is in a
|
6508 |
+
// leaving transition. Only happens when combining transition +
|
6509 |
+
// keep-alive + HOCs. (#4590)
|
6510 |
+
oldElm._leaveCb ? null : parentElm,
|
6511 |
+
nodeOps.nextSibling(oldElm)
|
6512 |
+
);
|
6513 |
+
|
6514 |
+
// update parent placeholder node element, recursively
|
6515 |
+
if (isDef(vnode.parent)) {
|
6516 |
+
var ancestor = vnode.parent;
|
6517 |
+
var patchable = isPatchable(vnode);
|
6518 |
+
while (ancestor) {
|
6519 |
+
for (var i = 0; i < cbs.destroy.length; ++i) {
|
6520 |
+
cbs.destroy[i](ancestor);
|
6521 |
+
}
|
6522 |
+
ancestor.elm = vnode.elm;
|
6523 |
+
if (patchable) {
|
6524 |
+
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
|
6525 |
+
cbs.create[i$1](emptyNode, ancestor);
|
6526 |
+
}
|
6527 |
+
// #6513
|
6528 |
+
// invoke insert hooks that may have been merged by create hooks.
|
6529 |
+
// e.g. for directives that uses the "inserted" hook.
|
6530 |
+
var insert = ancestor.data.hook.insert;
|
6531 |
+
if (insert.merged) {
|
6532 |
+
// start at index 1 to avoid re-invoking component mounted hook
|
6533 |
+
for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
|
6534 |
+
insert.fns[i$2]();
|
6535 |
+
}
|
6536 |
+
}
|
6537 |
+
} else {
|
6538 |
+
registerRef(ancestor);
|
6539 |
+
}
|
6540 |
+
ancestor = ancestor.parent;
|
6541 |
+
}
|
6542 |
+
}
|
6543 |
+
|
6544 |
+
// destroy old node
|
6545 |
+
if (isDef(parentElm)) {
|
6546 |
+
removeVnodes(parentElm, [oldVnode], 0, 0);
|
6547 |
+
} else if (isDef(oldVnode.tag)) {
|
6548 |
+
invokeDestroyHook(oldVnode);
|
6549 |
+
}
|
6550 |
+
}
|
6551 |
+
}
|
6552 |
+
|
6553 |
+
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
|
6554 |
+
return vnode.elm
|
6555 |
+
}
|
6556 |
+
}
|
6557 |
+
|
6558 |
+
/* */
|
6559 |
+
|
6560 |
+
var directives = {
|
6561 |
+
create: updateDirectives,
|
6562 |
+
update: updateDirectives,
|
6563 |
+
destroy: function unbindDirectives (vnode) {
|
6564 |
+
updateDirectives(vnode, emptyNode);
|
6565 |
+
}
|
6566 |
+
};
|
6567 |
+
|
6568 |
+
function updateDirectives (oldVnode, vnode) {
|
6569 |
+
if (oldVnode.data.directives || vnode.data.directives) {
|
6570 |
+
_update(oldVnode, vnode);
|
6571 |
+
}
|
6572 |
+
}
|
6573 |
+
|
6574 |
+
function _update (oldVnode, vnode) {
|
6575 |
+
var isCreate = oldVnode === emptyNode;
|
6576 |
+
var isDestroy = vnode === emptyNode;
|
6577 |
+
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
|
6578 |
+
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
|
6579 |
+
|
6580 |
+
var dirsWithInsert = [];
|
6581 |
+
var dirsWithPostpatch = [];
|
6582 |
+
|
6583 |
+
var key, oldDir, dir;
|
6584 |
+
for (key in newDirs) {
|
6585 |
+
oldDir = oldDirs[key];
|
6586 |
+
dir = newDirs[key];
|
6587 |
+
if (!oldDir) {
|
6588 |
+
// new directive, bind
|
6589 |
+
callHook$1(dir, 'bind', vnode, oldVnode);
|
6590 |
+
if (dir.def && dir.def.inserted) {
|
6591 |
+
dirsWithInsert.push(dir);
|
6592 |
+
}
|
6593 |
+
} else {
|
6594 |
+
// existing directive, update
|
6595 |
+
dir.oldValue = oldDir.value;
|
6596 |
+
dir.oldArg = oldDir.arg;
|
6597 |
+
callHook$1(dir, 'update', vnode, oldVnode);
|
6598 |
+
if (dir.def && dir.def.componentUpdated) {
|
6599 |
+
dirsWithPostpatch.push(dir);
|
6600 |
+
}
|
6601 |
+
}
|
6602 |
+
}
|
6603 |
+
|
6604 |
+
if (dirsWithInsert.length) {
|
6605 |
+
var callInsert = function () {
|
6606 |
+
for (var i = 0; i < dirsWithInsert.length; i++) {
|
6607 |
+
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
|
6608 |
+
}
|
6609 |
+
};
|
6610 |
+
if (isCreate) {
|
6611 |
+
mergeVNodeHook(vnode, 'insert', callInsert);
|
6612 |
+
} else {
|
6613 |
+
callInsert();
|
6614 |
+
}
|
6615 |
+
}
|
6616 |
+
|
6617 |
+
if (dirsWithPostpatch.length) {
|
6618 |
+
mergeVNodeHook(vnode, 'postpatch', function () {
|
6619 |
+
for (var i = 0; i < dirsWithPostpatch.length; i++) {
|
6620 |
+
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
|
6621 |
+
}
|
6622 |
+
});
|
6623 |
+
}
|
6624 |
+
|
6625 |
+
if (!isCreate) {
|
6626 |
+
for (key in oldDirs) {
|
6627 |
+
if (!newDirs[key]) {
|
6628 |
+
// no longer present, unbind
|
6629 |
+
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
|
6630 |
+
}
|
6631 |
+
}
|
6632 |
+
}
|
6633 |
+
}
|
6634 |
+
|
6635 |
+
var emptyModifiers = Object.create(null);
|
6636 |
+
|
6637 |
+
function normalizeDirectives$1 (
|
6638 |
+
dirs,
|
6639 |
+
vm
|
6640 |
+
) {
|
6641 |
+
var res = Object.create(null);
|
6642 |
+
if (!dirs) {
|
6643 |
+
// $flow-disable-line
|
6644 |
+
return res
|
6645 |
+
}
|
6646 |
+
var i, dir;
|
6647 |
+
for (i = 0; i < dirs.length; i++) {
|
6648 |
+
dir = dirs[i];
|
6649 |
+
if (!dir.modifiers) {
|
6650 |
+
// $flow-disable-line
|
6651 |
+
dir.modifiers = emptyModifiers;
|
6652 |
+
}
|
6653 |
+
res[getRawDirName(dir)] = dir;
|
6654 |
+
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
|
6655 |
+
}
|
6656 |
+
// $flow-disable-line
|
6657 |
+
return res
|
6658 |
+
}
|
6659 |
+
|
6660 |
+
function getRawDirName (dir) {
|
6661 |
+
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
|
6662 |
+
}
|
6663 |
+
|
6664 |
+
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
|
6665 |
+
var fn = dir.def && dir.def[hook];
|
6666 |
+
if (fn) {
|
6667 |
+
try {
|
6668 |
+
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
|
6669 |
+
} catch (e) {
|
6670 |
+
handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
|
6671 |
+
}
|
6672 |
+
}
|
6673 |
+
}
|
6674 |
+
|
6675 |
+
var baseModules = [
|
6676 |
+
ref,
|
6677 |
+
directives
|
6678 |
+
];
|
6679 |
+
|
6680 |
+
/* */
|
6681 |
+
|
6682 |
+
function updateAttrs (oldVnode, vnode) {
|
6683 |
+
var opts = vnode.componentOptions;
|
6684 |
+
if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
|
6685 |
+
return
|
6686 |
+
}
|
6687 |
+
if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
|
6688 |
+
return
|
6689 |
+
}
|
6690 |
+
var key, cur, old;
|
6691 |
+
var elm = vnode.elm;
|
6692 |
+
var oldAttrs = oldVnode.data.attrs || {};
|
6693 |
+
var attrs = vnode.data.attrs || {};
|
6694 |
+
// clone observed objects, as the user probably wants to mutate it
|
6695 |
+
if (isDef(attrs.__ob__)) {
|
6696 |
+
attrs = vnode.data.attrs = extend({}, attrs);
|
6697 |
+
}
|
6698 |
+
|
6699 |
+
for (key in attrs) {
|
6700 |
+
cur = attrs[key];
|
6701 |
+
old = oldAttrs[key];
|
6702 |
+
if (old !== cur) {
|
6703 |
+
setAttr(elm, key, cur);
|
6704 |
+
}
|
6705 |
+
}
|
6706 |
+
// #4391: in IE9, setting type can reset value for input[type=radio]
|
6707 |
+
// #6666: IE/Edge forces progress value down to 1 before setting a max
|
6708 |
+
/* istanbul ignore if */
|
6709 |
+
if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
|
6710 |
+
setAttr(elm, 'value', attrs.value);
|
6711 |
+
}
|
6712 |
+
for (key in oldAttrs) {
|
6713 |
+
if (isUndef(attrs[key])) {
|
6714 |
+
if (isXlink(key)) {
|
6715 |
+
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6716 |
+
} else if (!isEnumeratedAttr(key)) {
|
6717 |
+
elm.removeAttribute(key);
|
6718 |
+
}
|
6719 |
+
}
|
6720 |
+
}
|
6721 |
+
}
|
6722 |
+
|
6723 |
+
function setAttr (el, key, value) {
|
6724 |
+
if (el.tagName.indexOf('-') > -1) {
|
6725 |
+
baseSetAttr(el, key, value);
|
6726 |
+
} else if (isBooleanAttr(key)) {
|
6727 |
+
// set attribute for blank value
|
6728 |
+
// e.g. <option disabled>Select one</option>
|
6729 |
+
if (isFalsyAttrValue(value)) {
|
6730 |
+
el.removeAttribute(key);
|
6731 |
+
} else {
|
6732 |
+
// technically allowfullscreen is a boolean attribute for <iframe>,
|
6733 |
+
// but Flash expects a value of "true" when used on <embed> tag
|
6734 |
+
value = key === 'allowfullscreen' && el.tagName === 'EMBED'
|
6735 |
+
? 'true'
|
6736 |
+
: key;
|
6737 |
+
el.setAttribute(key, value);
|
6738 |
+
}
|
6739 |
+
} else if (isEnumeratedAttr(key)) {
|
6740 |
+
el.setAttribute(key, convertEnumeratedValue(key, value));
|
6741 |
+
} else if (isXlink(key)) {
|
6742 |
+
if (isFalsyAttrValue(value)) {
|
6743 |
+
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
|
6744 |
+
} else {
|
6745 |
+
el.setAttributeNS(xlinkNS, key, value);
|
6746 |
+
}
|
6747 |
+
} else {
|
6748 |
+
baseSetAttr(el, key, value);
|
6749 |
+
}
|
6750 |
+
}
|
6751 |
+
|
6752 |
+
function baseSetAttr (el, key, value) {
|
6753 |
+
if (isFalsyAttrValue(value)) {
|
6754 |
+
el.removeAttribute(key);
|
6755 |
+
} else {
|
6756 |
+
// #7138: IE10 & 11 fires input event when setting placeholder on
|
6757 |
+
// <textarea>... block the first input event and remove the blocker
|
6758 |
+
// immediately.
|
6759 |
+
/* istanbul ignore if */
|
6760 |
+
if (
|
6761 |
+
isIE && !isIE9 &&
|
6762 |
+
el.tagName === 'TEXTAREA' &&
|
6763 |
+
key === 'placeholder' && value !== '' && !el.__ieph
|
6764 |
+
) {
|
6765 |
+
var blocker = function (e) {
|
6766 |
+
e.stopImmediatePropagation();
|
6767 |
+
el.removeEventListener('input', blocker);
|
6768 |
+
};
|
6769 |
+
el.addEventListener('input', blocker);
|
6770 |
+
// $flow-disable-line
|
6771 |
+
el.__ieph = true; /* IE placeholder patched */
|
6772 |
+
}
|
6773 |
+
el.setAttribute(key, value);
|
6774 |
+
}
|
6775 |
+
}
|
6776 |
+
|
6777 |
+
var attrs = {
|
6778 |
+
create: updateAttrs,
|
6779 |
+
update: updateAttrs
|
6780 |
+
};
|
6781 |
+
|
6782 |
+
/* */
|
6783 |
+
|
6784 |
+
function updateClass (oldVnode, vnode) {
|
6785 |
+
var el = vnode.elm;
|
6786 |
+
var data = vnode.data;
|
6787 |
+
var oldData = oldVnode.data;
|
6788 |
+
if (
|
6789 |
+
isUndef(data.staticClass) &&
|
6790 |
+
isUndef(data.class) && (
|
6791 |
+
isUndef(oldData) || (
|
6792 |
+
isUndef(oldData.staticClass) &&
|
6793 |
+
isUndef(oldData.class)
|
6794 |
+
)
|
6795 |
+
)
|
6796 |
+
) {
|
6797 |
+
return
|
6798 |
+
}
|
6799 |
+
|
6800 |
+
var cls = genClassForVnode(vnode);
|
6801 |
+
|
6802 |
+
// handle transition classes
|
6803 |
+
var transitionClass = el._transitionClasses;
|
6804 |
+
if (isDef(transitionClass)) {
|
6805 |
+
cls = concat(cls, stringifyClass(transitionClass));
|
6806 |
+
}
|
6807 |
+
|
6808 |
+
// set the class
|
6809 |
+
if (cls !== el._prevClass) {
|
6810 |
+
el.setAttribute('class', cls);
|
6811 |
+
el._prevClass = cls;
|
6812 |
+
}
|
6813 |
+
}
|
6814 |
+
|
6815 |
+
var klass = {
|
6816 |
+
create: updateClass,
|
6817 |
+
update: updateClass
|
6818 |
+
};
|
6819 |
+
|
6820 |
+
/* */
|
6821 |
+
|
6822 |
+
var validDivisionCharRE = /[\w).+\-_$\]]/;
|
6823 |
+
|
6824 |
+
function parseFilters (exp) {
|
6825 |
+
var inSingle = false;
|
6826 |
+
var inDouble = false;
|
6827 |
+
var inTemplateString = false;
|
6828 |
+
var inRegex = false;
|
6829 |
+
var curly = 0;
|
6830 |
+
var square = 0;
|
6831 |
+
var paren = 0;
|
6832 |
+
var lastFilterIndex = 0;
|
6833 |
+
var c, prev, i, expression, filters;
|
6834 |
+
|
6835 |
+
for (i = 0; i < exp.length; i++) {
|
6836 |
+
prev = c;
|
6837 |
+
c = exp.charCodeAt(i);
|
6838 |
+
if (inSingle) {
|
6839 |
+
if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
|
6840 |
+
} else if (inDouble) {
|
6841 |
+
if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
|
6842 |
+
} else if (inTemplateString) {
|
6843 |
+
if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
|
6844 |
+
} else if (inRegex) {
|
6845 |
+
if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
|
6846 |
+
} else if (
|
6847 |
+
c === 0x7C && // pipe
|
6848 |
+
exp.charCodeAt(i + 1) !== 0x7C &&
|
6849 |
+
exp.charCodeAt(i - 1) !== 0x7C &&
|
6850 |
+
!curly && !square && !paren
|
6851 |
+
) {
|
6852 |
+
if (expression === undefined) {
|
6853 |
+
// first filter, end of expression
|
6854 |
+
lastFilterIndex = i + 1;
|
6855 |
+
expression = exp.slice(0, i).trim();
|
6856 |
+
} else {
|
6857 |
+
pushFilter();
|
6858 |
+
}
|
6859 |
+
} else {
|
6860 |
+
switch (c) {
|
6861 |
+
case 0x22: inDouble = true; break // "
|
6862 |
+
case 0x27: inSingle = true; break // '
|
6863 |
+
case 0x60: inTemplateString = true; break // `
|
6864 |
+
case 0x28: paren++; break // (
|
6865 |
+
case 0x29: paren--; break // )
|
6866 |
+
case 0x5B: square++; break // [
|
6867 |
+
case 0x5D: square--; break // ]
|
6868 |
+
case 0x7B: curly++; break // {
|
6869 |
+
case 0x7D: curly--; break // }
|
6870 |
+
}
|
6871 |
+
if (c === 0x2f) { // /
|
6872 |
+
var j = i - 1;
|
6873 |
+
var p = (void 0);
|
6874 |
+
// find first non-whitespace prev char
|
6875 |
+
for (; j >= 0; j--) {
|
6876 |
+
p = exp.charAt(j);
|
6877 |
+
if (p !== ' ') { break }
|
6878 |
+
}
|
6879 |
+
if (!p || !validDivisionCharRE.test(p)) {
|
6880 |
+
inRegex = true;
|
6881 |
+
}
|
6882 |
+
}
|
6883 |
+
}
|
6884 |
+
}
|
6885 |
+
|
6886 |
+
if (expression === undefined) {
|
6887 |
+
expression = exp.slice(0, i).trim();
|
6888 |
+
} else if (lastFilterIndex !== 0) {
|
6889 |
+
pushFilter();
|
6890 |
+
}
|
6891 |
+
|
6892 |
+
function pushFilter () {
|
6893 |
+
(filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
|
6894 |
+
lastFilterIndex = i + 1;
|
6895 |
+
}
|
6896 |
+
|
6897 |
+
if (filters) {
|
6898 |
+
for (i = 0; i < filters.length; i++) {
|
6899 |
+
expression = wrapFilter(expression, filters[i]);
|
6900 |
+
}
|
6901 |
+
}
|
6902 |
+
|
6903 |
+
return expression
|
6904 |
+
}
|
6905 |
+
|
6906 |
+
function wrapFilter (exp, filter) {
|
6907 |
+
var i = filter.indexOf('(');
|
6908 |
+
if (i < 0) {
|
6909 |
+
// _f: resolveFilter
|
6910 |
+
return ("_f(\"" + filter + "\")(" + exp + ")")
|
6911 |
+
} else {
|
6912 |
+
var name = filter.slice(0, i);
|
6913 |
+
var args = filter.slice(i + 1);
|
6914 |
+
return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
|
6915 |
+
}
|
6916 |
+
}
|
6917 |
+
|
6918 |
+
/* */
|
6919 |
+
|
6920 |
+
|
6921 |
+
|
6922 |
+
/* eslint-disable no-unused-vars */
|
6923 |
+
function baseWarn (msg, range) {
|
6924 |
+
console.error(("[Vue compiler]: " + msg));
|
6925 |
+
}
|
6926 |
+
/* eslint-enable no-unused-vars */
|
6927 |
+
|
6928 |
+
function pluckModuleFunction (
|
6929 |
+
modules,
|
6930 |
+
key
|
6931 |
+
) {
|
6932 |
+
return modules
|
6933 |
+
? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
|
6934 |
+
: []
|
6935 |
+
}
|
6936 |
+
|
6937 |
+
function addProp (el, name, value, range, dynamic) {
|
6938 |
+
(el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6939 |
+
el.plain = false;
|
6940 |
+
}
|
6941 |
+
|
6942 |
+
function addAttr (el, name, value, range, dynamic) {
|
6943 |
+
var attrs = dynamic
|
6944 |
+
? (el.dynamicAttrs || (el.dynamicAttrs = []))
|
6945 |
+
: (el.attrs || (el.attrs = []));
|
6946 |
+
attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
|
6947 |
+
el.plain = false;
|
6948 |
+
}
|
6949 |
+
|
6950 |
+
// add a raw attr (use this in preTransforms)
|
6951 |
+
function addRawAttr (el, name, value, range) {
|
6952 |
+
el.attrsMap[name] = value;
|
6953 |
+
el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
|
6954 |
+
}
|
6955 |
+
|
6956 |
+
function addDirective (
|
6957 |
+
el,
|
6958 |
+
name,
|
6959 |
+
rawName,
|
6960 |
+
value,
|
6961 |
+
arg,
|
6962 |
+
isDynamicArg,
|
6963 |
+
modifiers,
|
6964 |
+
range
|
6965 |
+
) {
|
6966 |
+
(el.directives || (el.directives = [])).push(rangeSetItem({
|
6967 |
+
name: name,
|
6968 |
+
rawName: rawName,
|
6969 |
+
value: value,
|
6970 |
+
arg: arg,
|
6971 |
+
isDynamicArg: isDynamicArg,
|
6972 |
+
modifiers: modifiers
|
6973 |
+
}, range));
|
6974 |
+
el.plain = false;
|
6975 |
+
}
|
6976 |
+
|
6977 |
+
function prependModifierMarker (symbol, name, dynamic) {
|
6978 |
+
return dynamic
|
6979 |
+
? ("_p(" + name + ",\"" + symbol + "\")")
|
6980 |
+
: symbol + name // mark the event as captured
|
6981 |
+
}
|
6982 |
+
|
6983 |
+
function addHandler (
|
6984 |
+
el,
|
6985 |
+
name,
|
6986 |
+
value,
|
6987 |
+
modifiers,
|
6988 |
+
important,
|
6989 |
+
warn,
|
6990 |
+
range,
|
6991 |
+
dynamic
|
6992 |
+
) {
|
6993 |
+
modifiers = modifiers || emptyObject;
|
6994 |
+
// warn prevent and passive modifier
|
6995 |
+
/* istanbul ignore if */
|
6996 |
+
if (
|
6997 |
+
warn &&
|
6998 |
+
modifiers.prevent && modifiers.passive
|
6999 |
+
) {
|
7000 |
+
warn(
|
7001 |
+
'passive and prevent can\'t be used together. ' +
|
7002 |
+
'Passive handler can\'t prevent default event.',
|
7003 |
+
range
|
7004 |
+
);
|
7005 |
+
}
|
7006 |
+
|
7007 |
+
// normalize click.right and click.middle since they don't actually fire
|
7008 |
+
// this is technically browser-specific, but at least for now browsers are
|
7009 |
+
// the only target envs that have right/middle clicks.
|
7010 |
+
if (modifiers.right) {
|
7011 |
+
if (dynamic) {
|
7012 |
+
name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
|
7013 |
+
} else if (name === 'click') {
|
7014 |
+
name = 'contextmenu';
|
7015 |
+
delete modifiers.right;
|
7016 |
+
}
|
7017 |
+
} else if (modifiers.middle) {
|
7018 |
+
if (dynamic) {
|
7019 |
+
name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
|
7020 |
+
} else if (name === 'click') {
|
7021 |
+
name = 'mouseup';
|
7022 |
+
}
|
7023 |
+
}
|
7024 |
+
|
7025 |
+
// check capture modifier
|
7026 |
+
if (modifiers.capture) {
|
7027 |
+
delete modifiers.capture;
|
7028 |
+
name = prependModifierMarker('!', name, dynamic);
|
7029 |
+
}
|
7030 |
+
if (modifiers.once) {
|
7031 |
+
delete modifiers.once;
|
7032 |
+
name = prependModifierMarker('~', name, dynamic);
|
7033 |
+
}
|
7034 |
+
/* istanbul ignore if */
|
7035 |
+
if (modifiers.passive) {
|
7036 |
+
delete modifiers.passive;
|
7037 |
+
name = prependModifierMarker('&', name, dynamic);
|
7038 |
+
}
|
7039 |
+
|
7040 |
+
var events;
|
7041 |
+
if (modifiers.native) {
|
7042 |
+
delete modifiers.native;
|
7043 |
+
events = el.nativeEvents || (el.nativeEvents = {});
|
7044 |
+
} else {
|
7045 |
+
events = el.events || (el.events = {});
|
7046 |
+
}
|
7047 |
+
|
7048 |
+
var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
|
7049 |
+
if (modifiers !== emptyObject) {
|
7050 |
+
newHandler.modifiers = modifiers;
|
7051 |
+
}
|
7052 |
+
|
7053 |
+
var handlers = events[name];
|
7054 |
+
/* istanbul ignore if */
|
7055 |
+
if (Array.isArray(handlers)) {
|
7056 |
+
important ? handlers.unshift(newHandler) : handlers.push(newHandler);
|
7057 |
+
} else if (handlers) {
|
7058 |
+
events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
|
7059 |
+
} else {
|
7060 |
+
events[name] = newHandler;
|
7061 |
+
}
|
7062 |
+
|
7063 |
+
el.plain = false;
|
7064 |
+
}
|
7065 |
+
|
7066 |
+
function getRawBindingAttr (
|
7067 |
+
el,
|
7068 |
+
name
|
7069 |
+
) {
|
7070 |
+
return el.rawAttrsMap[':' + name] ||
|
7071 |
+
el.rawAttrsMap['v-bind:' + name] ||
|
7072 |
+
el.rawAttrsMap[name]
|
7073 |
+
}
|
7074 |
+
|
7075 |
+
function getBindingAttr (
|
7076 |
+
el,
|
7077 |
+
name,
|
7078 |
+
getStatic
|
7079 |
+
) {
|
7080 |
+
var dynamicValue =
|
7081 |
+
getAndRemoveAttr(el, ':' + name) ||
|
7082 |
+
getAndRemoveAttr(el, 'v-bind:' + name);
|
7083 |
+
if (dynamicValue != null) {
|
7084 |
+
return parseFilters(dynamicValue)
|
7085 |
+
} else if (getStatic !== false) {
|
7086 |
+
var staticValue = getAndRemoveAttr(el, name);
|
7087 |
+
if (staticValue != null) {
|
7088 |
+
return JSON.stringify(staticValue)
|
7089 |
+
}
|
7090 |
+
}
|
7091 |
+
}
|
7092 |
+
|
7093 |
+
// note: this only removes the attr from the Array (attrsList) so that it
|
7094 |
+
// doesn't get processed by processAttrs.
|
7095 |
+
// By default it does NOT remove it from the map (attrsMap) because the map is
|
7096 |
+
// needed during codegen.
|
7097 |
+
function getAndRemoveAttr (
|
7098 |
+
el,
|
7099 |
+
name,
|
7100 |
+
removeFromMap
|
7101 |
+
) {
|
7102 |
+
var val;
|
7103 |
+
if ((val = el.attrsMap[name]) != null) {
|
7104 |
+
var list = el.attrsList;
|
7105 |
+
for (var i = 0, l = list.length; i < l; i++) {
|
7106 |
+
if (list[i].name === name) {
|
7107 |
+
list.splice(i, 1);
|
7108 |
+
break
|
7109 |
+
}
|
7110 |
+
}
|
7111 |
+
}
|
7112 |
+
if (removeFromMap) {
|
7113 |
+
delete el.attrsMap[name];
|
7114 |
+
}
|
7115 |
+
return val
|
7116 |
+
}
|
7117 |
+
|
7118 |
+
function getAndRemoveAttrByRegex (
|
7119 |
+
el,
|
7120 |
+
name
|
7121 |
+
) {
|
7122 |
+
var list = el.attrsList;
|
7123 |
+
for (var i = 0, l = list.length; i < l; i++) {
|
7124 |
+
var attr = list[i];
|
7125 |
+
if (name.test(attr.name)) {
|
7126 |
+
list.splice(i, 1);
|
7127 |
+
return attr
|
7128 |
+
}
|
7129 |
+
}
|
7130 |
+
}
|
7131 |
+
|
7132 |
+
function rangeSetItem (
|
7133 |
+
item,
|
7134 |
+
range
|
7135 |
+
) {
|
7136 |
+
if (range) {
|
7137 |
+
if (range.start != null) {
|
7138 |
+
item.start = range.start;
|
7139 |
+
}
|
7140 |
+
if (range.end != null) {
|
7141 |
+
item.end = range.end;
|
7142 |
+
}
|
7143 |
+
}
|
7144 |
+
return item
|
7145 |
+
}
|
7146 |
+
|
7147 |
+
/* */
|
7148 |
+
|
7149 |
+
/**
|
7150 |
+
* Cross-platform code generation for component v-model
|
7151 |
+
*/
|
7152 |
+
function genComponentModel (
|
7153 |
+
el,
|
7154 |
+
value,
|
7155 |
+
modifiers
|
7156 |
+
) {
|
7157 |
+
var ref = modifiers || {};
|
7158 |
+
var number = ref.number;
|
7159 |
+
var trim = ref.trim;
|
7160 |
+
|
7161 |
+
var baseValueExpression = '$$v';
|
7162 |
+
var valueExpression = baseValueExpression;
|
7163 |
+
if (trim) {
|
7164 |
+
valueExpression =
|
7165 |
+
"(typeof " + baseValueExpression + " === 'string'" +
|
7166 |
+
"? " + baseValueExpression + ".trim()" +
|
7167 |
+
": " + baseValueExpression + ")";
|
7168 |
+
}
|
7169 |
+
if (number) {
|
7170 |
+
valueExpression = "_n(" + valueExpression + ")";
|
7171 |
+
}
|
7172 |
+
var assignment = genAssignmentCode(value, valueExpression);
|
7173 |
+
|
7174 |
+
el.model = {
|
7175 |
+
value: ("(" + value + ")"),
|
7176 |
+
expression: JSON.stringify(value),
|
7177 |
+
callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
|
7178 |
+
};
|
7179 |
+
}
|
7180 |
+
|
7181 |
+
/**
|
7182 |
+
* Cross-platform codegen helper for generating v-model value assignment code.
|
7183 |
+
*/
|
7184 |
+
function genAssignmentCode (
|
7185 |
+
value,
|
7186 |
+
assignment
|
7187 |
+
) {
|
7188 |
+
var res = parseModel(value);
|
7189 |
+
if (res.key === null) {
|
7190 |
+
return (value + "=" + assignment)
|
7191 |
+
} else {
|
7192 |
+
return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
|
7193 |
+
}
|
7194 |
+
}
|
7195 |
+
|
7196 |
+
/**
|
7197 |
+
* Parse a v-model expression into a base path and a final key segment.
|
7198 |
+
* Handles both dot-path and possible square brackets.
|
7199 |
+
*
|
7200 |
+
* Possible cases:
|
7201 |
+
*
|
7202 |
+
* - test
|
7203 |
+
* - test[key]
|
7204 |
+
* - test[test1[key]]
|
7205 |
+
* - test["a"][key]
|
7206 |
+
* - xxx.test[a[a].test1[key]]
|
7207 |
+
* - test.xxx.a["asa"][test1[key]]
|
7208 |
+
*
|
7209 |
+
*/
|
7210 |
+
|
7211 |
+
var len, str, chr, index$1, expressionPos, expressionEndPos;
|
7212 |
+
|
7213 |
+
|
7214 |
+
|
7215 |
+
function parseModel (val) {
|
7216 |
+
// Fix https://github.com/vuejs/vue/pull/7730
|
7217 |
+
// allow v-model="obj.val " (trailing whitespace)
|
7218 |
+
val = val.trim();
|
7219 |
+
len = val.length;
|
7220 |
+
|
7221 |
+
if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
|
7222 |
+
index$1 = val.lastIndexOf('.');
|
7223 |
+
if (index$1 > -1) {
|
7224 |
+
return {
|
7225 |
+
exp: val.slice(0, index$1),
|
7226 |
+
key: '"' + val.slice(index$1 + 1) + '"'
|
7227 |
+
}
|
7228 |
+
} else {
|
7229 |
+
return {
|
7230 |
+
exp: val,
|
7231 |
+
key: null
|
7232 |
+
}
|
7233 |
+
}
|
7234 |
+
}
|
7235 |
+
|
7236 |
+
str = val;
|
7237 |
+
index$1 = expressionPos = expressionEndPos = 0;
|
7238 |
+
|
7239 |
+
while (!eof()) {
|
7240 |
+
chr = next();
|
7241 |
+
/* istanbul ignore if */
|
7242 |
+
if (isStringStart(chr)) {
|
7243 |
+
parseString(chr);
|
7244 |
+
} else if (chr === 0x5B) {
|
7245 |
+
parseBracket(chr);
|
7246 |
+
}
|
7247 |
+
}
|
7248 |
+
|
7249 |
+
return {
|
7250 |
+
exp: val.slice(0, expressionPos),
|
7251 |
+
key: val.slice(expressionPos + 1, expressionEndPos)
|
7252 |
+
}
|
7253 |
+
}
|
7254 |
+
|
7255 |
+
function next () {
|
7256 |
+
return str.charCodeAt(++index$1)
|
7257 |
+
}
|
7258 |
+
|
7259 |
+
function eof () {
|
7260 |
+
return index$1 >= len
|
7261 |
+
}
|
7262 |
+
|
7263 |
+
function isStringStart (chr) {
|
7264 |
+
return chr === 0x22 || chr === 0x27
|
7265 |
+
}
|
7266 |
+
|
7267 |
+
function parseBracket (chr) {
|
7268 |
+
var inBracket = 1;
|
7269 |
+
expressionPos = index$1;
|
7270 |
+
while (!eof()) {
|
7271 |
+
chr = next();
|
7272 |
+
if (isStringStart(chr)) {
|
7273 |
+
parseString(chr);
|
7274 |
+
continue
|
7275 |
+
}
|
7276 |
+
if (chr === 0x5B) { inBracket++; }
|
7277 |
+
if (chr === 0x5D) { inBracket--; }
|
7278 |
+
if (inBracket === 0) {
|
7279 |
+
expressionEndPos = index$1;
|
7280 |
+
break
|
7281 |
+
}
|
7282 |
+
}
|
7283 |
+
}
|
7284 |
+
|
7285 |
+
function parseString (chr) {
|
7286 |
+
var stringQuote = chr;
|
7287 |
+
while (!eof()) {
|
7288 |
+
chr = next();
|
7289 |
+
if (chr === stringQuote) {
|
7290 |
+
break
|
7291 |
+
}
|
7292 |
+
}
|
7293 |
+
}
|
7294 |
+
|
7295 |
+
/* */
|
7296 |
+
|
7297 |
+
var warn$1;
|
7298 |
+
|
7299 |
+
// in some cases, the event used has to be determined at runtime
|
7300 |
+
// so we used some reserved tokens during compile.
|
7301 |
+
var RANGE_TOKEN = '__r';
|
7302 |
+
var CHECKBOX_RADIO_TOKEN = '__c';
|
7303 |
+
|
7304 |
+
function model (
|
7305 |
+
el,
|
7306 |
+
dir,
|
7307 |
+
_warn
|
7308 |
+
) {
|
7309 |
+
warn$1 = _warn;
|
7310 |
+
var value = dir.value;
|
7311 |
+
var modifiers = dir.modifiers;
|
7312 |
+
var tag = el.tag;
|
7313 |
+
var type = el.attrsMap.type;
|
7314 |
+
|
7315 |
+
{
|
7316 |
+
// inputs with type="file" are read only and setting the input's
|
7317 |
+
// value will throw an error.
|
7318 |
+
if (tag === 'input' && type === 'file') {
|
7319 |
+
warn$1(
|
7320 |
+
"<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
|
7321 |
+
"File inputs are read only. Use a v-on:change listener instead.",
|
7322 |
+
el.rawAttrsMap['v-model']
|
7323 |
+
);
|
7324 |
+
}
|
7325 |
+
}
|
7326 |
+
|
7327 |
+
if (el.component) {
|
7328 |
+
genComponentModel(el, value, modifiers);
|
7329 |
+
// component v-model doesn't need extra runtime
|
7330 |
+
return false
|
7331 |
+
} else if (tag === 'select') {
|
7332 |
+
genSelect(el, value, modifiers);
|
7333 |
+
} else if (tag === 'input' && type === 'checkbox') {
|
7334 |
+
genCheckboxModel(el, value, modifiers);
|
7335 |
+
} else if (tag === 'input' && type === 'radio') {
|
7336 |
+
genRadioModel(el, value, modifiers);
|
7337 |
+
} else if (tag === 'input' || tag === 'textarea') {
|
7338 |
+
genDefaultModel(el, value, modifiers);
|
7339 |
+
} else if (!config.isReservedTag(tag)) {
|
7340 |
+
genComponentModel(el, value, modifiers);
|
7341 |
+
// component v-model doesn't need extra runtime
|
7342 |
+
return false
|
7343 |
+
} else {
|
7344 |
+
warn$1(
|
7345 |
+
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
7346 |
+
"v-model is not supported on this element type. " +
|
7347 |
+
'If you are working with contenteditable, it\'s recommended to ' +
|
7348 |
+
'wrap a library dedicated for that purpose inside a custom component.',
|
7349 |
+
el.rawAttrsMap['v-model']
|
7350 |
+
);
|
7351 |
+
}
|
7352 |
+
|
7353 |
+
// ensure runtime directive metadata
|
7354 |
+
return true
|
7355 |
+
}
|
7356 |
+
|
7357 |
+
function genCheckboxModel (
|
7358 |
+
el,
|
7359 |
+
value,
|
7360 |
+
modifiers
|
7361 |
+
) {
|
7362 |
+
var number = modifiers && modifiers.number;
|
7363 |
+
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7364 |
+
var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
|
7365 |
+
var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
|
7366 |
+
addProp(el, 'checked',
|
7367 |
+
"Array.isArray(" + value + ")" +
|
7368 |
+
"?_i(" + value + "," + valueBinding + ")>-1" + (
|
7369 |
+
trueValueBinding === 'true'
|
7370 |
+
? (":(" + value + ")")
|
7371 |
+
: (":_q(" + value + "," + trueValueBinding + ")")
|
7372 |
+
)
|
7373 |
+
);
|
7374 |
+
addHandler(el, 'change',
|
7375 |
+
"var $$a=" + value + "," +
|
7376 |
+
'$$el=$event.target,' +
|
7377 |
+
"$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
|
7378 |
+
'if(Array.isArray($$a)){' +
|
7379 |
+
"var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
|
7380 |
+
'$$i=_i($$a,$$v);' +
|
7381 |
+
"if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
|
7382 |
+
"else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
|
7383 |
+
"}else{" + (genAssignmentCode(value, '$$c')) + "}",
|
7384 |
+
null, true
|
7385 |
+
);
|
7386 |
+
}
|
7387 |
+
|
7388 |
+
function genRadioModel (
|
7389 |
+
el,
|
7390 |
+
value,
|
7391 |
+
modifiers
|
7392 |
+
) {
|
7393 |
+
var number = modifiers && modifiers.number;
|
7394 |
+
var valueBinding = getBindingAttr(el, 'value') || 'null';
|
7395 |
+
valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
|
7396 |
+
addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
|
7397 |
+
addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
|
7398 |
+
}
|
7399 |
+
|
7400 |
+
function genSelect (
|
7401 |
+
el,
|
7402 |
+
value,
|
7403 |
+
modifiers
|
7404 |
+
) {
|
7405 |
+
var number = modifiers && modifiers.number;
|
7406 |
+
var selectedVal = "Array.prototype.filter" +
|
7407 |
+
".call($event.target.options,function(o){return o.selected})" +
|
7408 |
+
".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
|
7409 |
+
"return " + (number ? '_n(val)' : 'val') + "})";
|
7410 |
+
|
7411 |
+
var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
|
7412 |
+
var code = "var $$selectedVal = " + selectedVal + ";";
|
7413 |
+
code = code + " " + (genAssignmentCode(value, assignment));
|
7414 |
+
addHandler(el, 'change', code, null, true);
|
7415 |
+
}
|
7416 |
+
|
7417 |
+
function genDefaultModel (
|
7418 |
+
el,
|
7419 |
+
value,
|
7420 |
+
modifiers
|
7421 |
+
) {
|
7422 |
+
var type = el.attrsMap.type;
|
7423 |
+
|
7424 |
+
// warn if v-bind:value conflicts with v-model
|
7425 |
+
// except for inputs with v-bind:type
|
7426 |
+
{
|
7427 |
+
var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
|
7428 |
+
var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
|
7429 |
+
if (value$1 && !typeBinding) {
|
7430 |
+
var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
|
7431 |
+
warn$1(
|
7432 |
+
binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
|
7433 |
+
'because the latter already expands to a value binding internally',
|
7434 |
+
el.rawAttrsMap[binding]
|
7435 |
+
);
|
7436 |
+
}
|
7437 |
+
}
|
7438 |
+
|
7439 |
+
var ref = modifiers || {};
|
7440 |
+
var lazy = ref.lazy;
|
7441 |
+
var number = ref.number;
|
7442 |
+
var trim = ref.trim;
|
7443 |
+
var needCompositionGuard = !lazy && type !== 'range';
|
7444 |
+
var event = lazy
|
7445 |
+
? 'change'
|
7446 |
+
: type === 'range'
|
7447 |
+
? RANGE_TOKEN
|
7448 |
+
: 'input';
|
7449 |
+
|
7450 |
+
var valueExpression = '$event.target.value';
|
7451 |
+
if (trim) {
|
7452 |
+
valueExpression = "$event.target.value.trim()";
|
7453 |
+
}
|
7454 |
+
if (number) {
|
7455 |
+
valueExpression = "_n(" + valueExpression + ")";
|
7456 |
+
}
|
7457 |
+
|
7458 |
+
var code = genAssignmentCode(value, valueExpression);
|
7459 |
+
if (needCompositionGuard) {
|
7460 |
+
code = "if($event.target.composing)return;" + code;
|
7461 |
+
}
|
7462 |
+
|
7463 |
+
addProp(el, 'value', ("(" + value + ")"));
|
7464 |
+
addHandler(el, event, code, null, true);
|
7465 |
+
if (trim || number) {
|
7466 |
+
addHandler(el, 'blur', '$forceUpdate()');
|
7467 |
+
}
|
7468 |
+
}
|
7469 |
+
|
7470 |
+
/* */
|
7471 |
+
|
7472 |
+
// normalize v-model event tokens that can only be determined at runtime.
|
7473 |
+
// it's important to place the event as the first in the array because
|
7474 |
+
// the whole point is ensuring the v-model callback gets called before
|
7475 |
+
// user-attached handlers.
|
7476 |
+
function normalizeEvents (on) {
|
7477 |
+
/* istanbul ignore if */
|
7478 |
+
if (isDef(on[RANGE_TOKEN])) {
|
7479 |
+
// IE input[type=range] only supports `change` event
|
7480 |
+
var event = isIE ? 'change' : 'input';
|
7481 |
+
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
|
7482 |
+
delete on[RANGE_TOKEN];
|
7483 |
+
}
|
7484 |
+
// This was originally intended to fix #4521 but no longer necessary
|
7485 |
+
// after 2.5. Keeping it for backwards compat with generated code from < 2.4
|
7486 |
+
/* istanbul ignore if */
|
7487 |
+
if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
|
7488 |
+
on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
|
7489 |
+
delete on[CHECKBOX_RADIO_TOKEN];
|
7490 |
+
}
|
7491 |
+
}
|
7492 |
+
|
7493 |
+
var target$1;
|
7494 |
+
|
7495 |
+
function createOnceHandler$1 (event, handler, capture) {
|
7496 |
+
var _target = target$1; // save current target element in closure
|
7497 |
+
return function onceHandler () {
|
7498 |
+
var res = handler.apply(null, arguments);
|
7499 |
+
if (res !== null) {
|
7500 |
+
remove$2(event, onceHandler, capture, _target);
|
7501 |
+
}
|
7502 |
+
}
|
7503 |
+
}
|
7504 |
+
|
7505 |
+
// #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
|
7506 |
+
// implementation and does not fire microtasks in between event propagation, so
|
7507 |
+
// safe to exclude.
|
7508 |
+
var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
|
7509 |
+
|
7510 |
+
function add$1 (
|
7511 |
+
name,
|
7512 |
+
handler,
|
7513 |
+
capture,
|
7514 |
+
passive
|
7515 |
+
) {
|
7516 |
+
// async edge case #6566: inner click event triggers patch, event handler
|
7517 |
+
// attached to outer element during patch, and triggered again. This
|
7518 |
+
// happens because browsers fire microtask ticks between event propagation.
|
7519 |
+
// the solution is simple: we save the timestamp when a handler is attached,
|
7520 |
+
// and the handler would only fire if the event passed to it was fired
|
7521 |
+
// AFTER it was attached.
|
7522 |
+
if (useMicrotaskFix) {
|
7523 |
+
var attachedTimestamp = currentFlushTimestamp;
|
7524 |
+
var original = handler;
|
7525 |
+
handler = original._wrapper = function (e) {
|
7526 |
+
if (
|
7527 |
+
// no bubbling, should always fire.
|
7528 |
+
// this is just a safety net in case event.timeStamp is unreliable in
|
7529 |
+
// certain weird environments...
|
7530 |
+
e.target === e.currentTarget ||
|
7531 |
+
// event is fired after handler attachment
|
7532 |
+
e.timeStamp >= attachedTimestamp ||
|
7533 |
+
// bail for environments that have buggy event.timeStamp implementations
|
7534 |
+
// #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
|
7535 |
+
// #9681 QtWebEngine event.timeStamp is negative value
|
7536 |
+
e.timeStamp <= 0 ||
|
7537 |
+
// #9448 bail if event is fired in another document in a multi-page
|
7538 |
+
// electron/nw.js app, since event.timeStamp will be using a different
|
7539 |
+
// starting reference
|
7540 |
+
e.target.ownerDocument !== document
|
7541 |
+
) {
|
7542 |
+
return original.apply(this, arguments)
|
7543 |
+
}
|
7544 |
+
};
|
7545 |
+
}
|
7546 |
+
target$1.addEventListener(
|
7547 |
+
name,
|
7548 |
+
handler,
|
7549 |
+
supportsPassive
|
7550 |
+
? { capture: capture, passive: passive }
|
7551 |
+
: capture
|
7552 |
+
);
|
7553 |
+
}
|
7554 |
+
|
7555 |
+
function remove$2 (
|
7556 |
+
name,
|
7557 |
+
handler,
|
7558 |
+
capture,
|
7559 |
+
_target
|
7560 |
+
) {
|
7561 |
+
(_target || target$1).removeEventListener(
|
7562 |
+
name,
|
7563 |
+
handler._wrapper || handler,
|
7564 |
+
capture
|
7565 |
+
);
|
7566 |
+
}
|
7567 |
+
|
7568 |
+
function updateDOMListeners (oldVnode, vnode) {
|
7569 |
+
if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
|
7570 |
+
return
|
7571 |
+
}
|
7572 |
+
var on = vnode.data.on || {};
|
7573 |
+
var oldOn = oldVnode.data.on || {};
|
7574 |
+
target$1 = vnode.elm;
|
7575 |
+
normalizeEvents(on);
|
7576 |
+
updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
|
7577 |
+
target$1 = undefined;
|
7578 |
+
}
|
7579 |
+
|
7580 |
+
var events = {
|
7581 |
+
create: updateDOMListeners,
|
7582 |
+
update: updateDOMListeners
|
7583 |
+
};
|
7584 |
+
|
7585 |
+
/* */
|
7586 |
+
|
7587 |
+
var svgContainer;
|
7588 |
+
|
7589 |
+
function updateDOMProps (oldVnode, vnode) {
|
7590 |
+
if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
|
7591 |
+
return
|
7592 |
+
}
|
7593 |
+
var key, cur;
|
7594 |
+
var elm = vnode.elm;
|
7595 |
+
var oldProps = oldVnode.data.domProps || {};
|
7596 |
+
var props = vnode.data.domProps || {};
|
7597 |
+
// clone observed objects, as the user probably wants to mutate it
|
7598 |
+
if (isDef(props.__ob__)) {
|
7599 |
+
props = vnode.data.domProps = extend({}, props);
|
7600 |
+
}
|
7601 |
+
|
7602 |
+
for (key in oldProps) {
|
7603 |
+
if (!(key in props)) {
|
7604 |
+
elm[key] = '';
|
7605 |
+
}
|
7606 |
+
}
|
7607 |
+
|
7608 |
+
for (key in props) {
|
7609 |
+
cur = props[key];
|
7610 |
+
// ignore children if the node has textContent or innerHTML,
|
7611 |
+
// as these will throw away existing DOM nodes and cause removal errors
|
7612 |
+
// on subsequent patches (#3360)
|
7613 |
+
if (key === 'textContent' || key === 'innerHTML') {
|
7614 |
+
if (vnode.children) { vnode.children.length = 0; }
|
7615 |
+
if (cur === oldProps[key]) { continue }
|
7616 |
+
// #6601 work around Chrome version <= 55 bug where single textNode
|
7617 |
+
// replaced by innerHTML/textContent retains its parentNode property
|
7618 |
+
if (elm.childNodes.length === 1) {
|
7619 |
+
elm.removeChild(elm.childNodes[0]);
|
7620 |
+
}
|
7621 |
+
}
|
7622 |
+
|
7623 |
+
if (key === 'value' && elm.tagName !== 'PROGRESS') {
|
7624 |
+
// store value as _value as well since
|
7625 |
+
// non-string values will be stringified
|
7626 |
+
elm._value = cur;
|
7627 |
+
// avoid resetting cursor position when value is the same
|
7628 |
+
var strCur = isUndef(cur) ? '' : String(cur);
|
7629 |
+
if (shouldUpdateValue(elm, strCur)) {
|
7630 |
+
elm.value = strCur;
|
7631 |
+
}
|
7632 |
+
} else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
|
7633 |
+
// IE doesn't support innerHTML for SVG elements
|
7634 |
+
svgContainer = svgContainer || document.createElement('div');
|
7635 |
+
svgContainer.innerHTML = "<svg>" + cur + "</svg>";
|
7636 |
+
var svg = svgContainer.firstChild;
|
7637 |
+
while (elm.firstChild) {
|
7638 |
+
elm.removeChild(elm.firstChild);
|
7639 |
+
}
|
7640 |
+
while (svg.firstChild) {
|
7641 |
+
elm.appendChild(svg.firstChild);
|
7642 |
+
}
|
7643 |
+
} else if (
|
7644 |
+
// skip the update if old and new VDOM state is the same.
|
7645 |
+
// `value` is handled separately because the DOM value may be temporarily
|
7646 |
+
// out of sync with VDOM state due to focus, composition and modifiers.
|
7647 |
+
// This #4521 by skipping the unnecesarry `checked` update.
|
7648 |
+
cur !== oldProps[key]
|
7649 |
+
) {
|
7650 |
+
// some property updates can throw
|
7651 |
+
// e.g. `value` on <progress> w/ non-finite value
|
7652 |
+
try {
|
7653 |
+
elm[key] = cur;
|
7654 |
+
} catch (e) {}
|
7655 |
+
}
|
7656 |
+
}
|
7657 |
+
}
|
7658 |
+
|
7659 |
+
// check platforms/web/util/attrs.js acceptValue
|
7660 |
+
|
7661 |
+
|
7662 |
+
function shouldUpdateValue (elm, checkVal) {
|
7663 |
+
return (!elm.composing && (
|
7664 |
+
elm.tagName === 'OPTION' ||
|
7665 |
+
isNotInFocusAndDirty(elm, checkVal) ||
|
7666 |
+
isDirtyWithModifiers(elm, checkVal)
|
7667 |
+
))
|
7668 |
+
}
|
7669 |
+
|
7670 |
+
function isNotInFocusAndDirty (elm, checkVal) {
|
7671 |
+
// return true when textbox (.number and .trim) loses focus and its value is
|
7672 |
+
// not equal to the updated value
|
7673 |
+
var notInFocus = true;
|
7674 |
+
// #6157
|
7675 |
+
// work around IE bug when accessing document.activeElement in an iframe
|
7676 |
+
try { notInFocus = document.activeElement !== elm; } catch (e) {}
|
7677 |
+
return notInFocus && elm.value !== checkVal
|
7678 |
+
}
|
7679 |
+
|
7680 |
+
function isDirtyWithModifiers (elm, newVal) {
|
7681 |
+
var value = elm.value;
|
7682 |
+
var modifiers = elm._vModifiers; // injected by v-model runtime
|
7683 |
+
if (isDef(modifiers)) {
|
7684 |
+
if (modifiers.number) {
|
7685 |
+
return toNumber(value) !== toNumber(newVal)
|
7686 |
+
}
|
7687 |
+
if (modifiers.trim) {
|
7688 |
+
return value.trim() !== newVal.trim()
|
7689 |
+
}
|
7690 |
+
}
|
7691 |
+
return value !== newVal
|
7692 |
+
}
|
7693 |
+
|
7694 |
+
var domProps = {
|
7695 |
+
create: updateDOMProps,
|
7696 |
+
update: updateDOMProps
|
7697 |
+
};
|
7698 |
+
|
7699 |
+
/* */
|
7700 |
+
|
7701 |
+
var parseStyleText = cached(function (cssText) {
|
7702 |
+
var res = {};
|
7703 |
+
var listDelimiter = /;(?![^(]*\))/g;
|
7704 |
+
var propertyDelimiter = /:(.+)/;
|
7705 |
+
cssText.split(listDelimiter).forEach(function (item) {
|
7706 |
+
if (item) {
|
7707 |
+
var tmp = item.split(propertyDelimiter);
|
7708 |
+
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
|
7709 |
+
}
|
7710 |
+
});
|
7711 |
+
return res
|
7712 |
+
});
|
7713 |
+
|
7714 |
+
// merge static and dynamic style data on the same vnode
|
7715 |
+
function normalizeStyleData (data) {
|
7716 |
+
var style = normalizeStyleBinding(data.style);
|
7717 |
+
// static style is pre-processed into an object during compilation
|
7718 |
+
// and is always a fresh object, so it's safe to merge into it
|
7719 |
+
return data.staticStyle
|
7720 |
+
? extend(data.staticStyle, style)
|
7721 |
+
: style
|
7722 |
+
}
|
7723 |
+
|
7724 |
+
// normalize possible array / string values into Object
|
7725 |
+
function normalizeStyleBinding (bindingStyle) {
|
7726 |
+
if (Array.isArray(bindingStyle)) {
|
7727 |
+
return toObject(bindingStyle)
|
7728 |
+
}
|
7729 |
+
if (typeof bindingStyle === 'string') {
|
7730 |
+
return parseStyleText(bindingStyle)
|
7731 |
+
}
|
7732 |
+
return bindingStyle
|
7733 |
+
}
|
7734 |
+
|
7735 |
+
/**
|
7736 |
+
* parent component style should be after child's
|
7737 |
+
* so that parent component's style could override it
|
7738 |
+
*/
|
7739 |
+
function getStyle (vnode, checkChild) {
|
7740 |
+
var res = {};
|
7741 |
+
var styleData;
|
7742 |
+
|
7743 |
+
if (checkChild) {
|
7744 |
+
var childNode = vnode;
|
7745 |
+
while (childNode.componentInstance) {
|
7746 |
+
childNode = childNode.componentInstance._vnode;
|
7747 |
+
if (
|
7748 |
+
childNode && childNode.data &&
|
7749 |
+
(styleData = normalizeStyleData(childNode.data))
|
7750 |
+
) {
|
7751 |
+
extend(res, styleData);
|
7752 |
+
}
|
7753 |
+
}
|
7754 |
+
}
|
7755 |
+
|
7756 |
+
if ((styleData = normalizeStyleData(vnode.data))) {
|
7757 |
+
extend(res, styleData);
|
7758 |
+
}
|
7759 |
+
|
7760 |
+
var parentNode = vnode;
|
7761 |
+
while ((parentNode = parentNode.parent)) {
|
7762 |
+
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
|
7763 |
+
extend(res, styleData);
|
7764 |
+
}
|
7765 |
+
}
|
7766 |
+
return res
|
7767 |
+
}
|
7768 |
+
|
7769 |
+
/* */
|
7770 |
+
|
7771 |
+
var cssVarRE = /^--/;
|
7772 |
+
var importantRE = /\s*!important$/;
|
7773 |
+
var setProp = function (el, name, val) {
|
7774 |
+
/* istanbul ignore if */
|
7775 |
+
if (cssVarRE.test(name)) {
|
7776 |
+
el.style.setProperty(name, val);
|
7777 |
+
} else if (importantRE.test(val)) {
|
7778 |
+
el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
|
7779 |
+
} else {
|
7780 |
+
var normalizedName = normalize(name);
|
7781 |
+
if (Array.isArray(val)) {
|
7782 |
+
// Support values array created by autoprefixer, e.g.
|
7783 |
+
// {display: ["-webkit-box", "-ms-flexbox", "flex"]}
|
7784 |
+
// Set them one by one, and the browser will only set those it can recognize
|
7785 |
+
for (var i = 0, len = val.length; i < len; i++) {
|
7786 |
+
el.style[normalizedName] = val[i];
|
7787 |
+
}
|
7788 |
+
} else {
|
7789 |
+
el.style[normalizedName] = val;
|
7790 |
+
}
|
7791 |
+
}
|
7792 |
+
};
|
7793 |
+
|
7794 |
+
var vendorNames = ['Webkit', 'Moz', 'ms'];
|
7795 |
+
|
7796 |
+
var emptyStyle;
|
7797 |
+
var normalize = cached(function (prop) {
|
7798 |
+
emptyStyle = emptyStyle || document.createElement('div').style;
|
7799 |
+
prop = camelize(prop);
|
7800 |
+
if (prop !== 'filter' && (prop in emptyStyle)) {
|
7801 |
+
return prop
|
7802 |
+
}
|
7803 |
+
var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
|
7804 |
+
for (var i = 0; i < vendorNames.length; i++) {
|
7805 |
+
var name = vendorNames[i] + capName;
|
7806 |
+
if (name in emptyStyle) {
|
7807 |
+
return name
|
7808 |
+
}
|
7809 |
+
}
|
7810 |
+
});
|
7811 |
+
|
7812 |
+
function updateStyle (oldVnode, vnode) {
|
7813 |
+
var data = vnode.data;
|
7814 |
+
var oldData = oldVnode.data;
|
7815 |
+
|
7816 |
+
if (isUndef(data.staticStyle) && isUndef(data.style) &&
|
7817 |
+
isUndef(oldData.staticStyle) && isUndef(oldData.style)
|
7818 |
+
) {
|
7819 |
+
return
|
7820 |
+
}
|
7821 |
+
|
7822 |
+
var cur, name;
|
7823 |
+
var el = vnode.elm;
|
7824 |
+
var oldStaticStyle = oldData.staticStyle;
|
7825 |
+
var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
|
7826 |
+
|
7827 |
+
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
|
7828 |
+
var oldStyle = oldStaticStyle || oldStyleBinding;
|
7829 |
+
|
7830 |
+
var style = normalizeStyleBinding(vnode.data.style) || {};
|
7831 |
+
|
7832 |
+
// store normalized style under a different key for next diff
|
7833 |
+
// make sure to clone it if it's reactive, since the user likely wants
|
7834 |
+
// to mutate it.
|
7835 |
+
vnode.data.normalizedStyle = isDef(style.__ob__)
|
7836 |
+
? extend({}, style)
|
7837 |
+
: style;
|
7838 |
+
|
7839 |
+
var newStyle = getStyle(vnode, true);
|
7840 |
+
|
7841 |
+
for (name in oldStyle) {
|
7842 |
+
if (isUndef(newStyle[name])) {
|
7843 |
+
setProp(el, name, '');
|
7844 |
+
}
|
7845 |
+
}
|
7846 |
+
for (name in newStyle) {
|
7847 |
+
cur = newStyle[name];
|
7848 |
+
if (cur !== oldStyle[name]) {
|
7849 |
+
// ie9 setting to null has no effect, must use empty string
|
7850 |
+
setProp(el, name, cur == null ? '' : cur);
|
7851 |
+
}
|
7852 |
+
}
|
7853 |
+
}
|
7854 |
+
|
7855 |
+
var style = {
|
7856 |
+
create: updateStyle,
|
7857 |
+
update: updateStyle
|
7858 |
+
};
|
7859 |
+
|
7860 |
+
/* */
|
7861 |
+
|
7862 |
+
var whitespaceRE = /\s+/;
|
7863 |
+
|
7864 |
+
/**
|
7865 |
+
* Add class with compatibility for SVG since classList is not supported on
|
7866 |
+
* SVG elements in IE
|
7867 |
+
*/
|
7868 |
+
function addClass (el, cls) {
|
7869 |
+
/* istanbul ignore if */
|
7870 |
+
if (!cls || !(cls = cls.trim())) {
|
7871 |
+
return
|
7872 |
+
}
|
7873 |
+
|
7874 |
+
/* istanbul ignore else */
|
7875 |
+
if (el.classList) {
|
7876 |
+
if (cls.indexOf(' ') > -1) {
|
7877 |
+
cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
|
7878 |
+
} else {
|
7879 |
+
el.classList.add(cls);
|
7880 |
+
}
|
7881 |
+
} else {
|
7882 |
+
var cur = " " + (el.getAttribute('class') || '') + " ";
|
7883 |
+
if (cur.indexOf(' ' + cls + ' ') < 0) {
|
7884 |
+
el.setAttribute('class', (cur + cls).trim());
|
7885 |
+
}
|
7886 |
+
}
|
7887 |
+
}
|
7888 |
+
|
7889 |
+
/**
|
7890 |
+
* Remove class with compatibility for SVG since classList is not supported on
|
7891 |
+
* SVG elements in IE
|
7892 |
+
*/
|
7893 |
+
function removeClass (el, cls) {
|
7894 |
+
/* istanbul ignore if */
|
7895 |
+
if (!cls || !(cls = cls.trim())) {
|
7896 |
+
return
|
7897 |
+
}
|
7898 |
+
|
7899 |
+
/* istanbul ignore else */
|
7900 |
+
if (el.classList) {
|
7901 |
+
if (cls.indexOf(' ') > -1) {
|
7902 |
+
cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
|
7903 |
+
} else {
|
7904 |
+
el.classList.remove(cls);
|
7905 |
+
}
|
7906 |
+
if (!el.classList.length) {
|
7907 |
+
el.removeAttribute('class');
|
7908 |
+
}
|
7909 |
+
} else {
|
7910 |
+
var cur = " " + (el.getAttribute('class') || '') + " ";
|
7911 |
+
var tar = ' ' + cls + ' ';
|
7912 |
+
while (cur.indexOf(tar) >= 0) {
|
7913 |
+
cur = cur.replace(tar, ' ');
|
7914 |
+
}
|
7915 |
+
cur = cur.trim();
|
7916 |
+
if (cur) {
|
7917 |
+
el.setAttribute('class', cur);
|
7918 |
+
} else {
|
7919 |
+
el.removeAttribute('class');
|
7920 |
+
}
|
7921 |
+
}
|
7922 |
+
}
|
7923 |
+
|
7924 |
+
/* */
|
7925 |
+
|
7926 |
+
function resolveTransition (def$$1) {
|
7927 |
+
if (!def$$1) {
|
7928 |
+
return
|
7929 |
+
}
|
7930 |
+
/* istanbul ignore else */
|
7931 |
+
if (typeof def$$1 === 'object') {
|
7932 |
+
var res = {};
|
7933 |
+
if (def$$1.css !== false) {
|
7934 |
+
extend(res, autoCssTransition(def$$1.name || 'v'));
|
7935 |
+
}
|
7936 |
+
extend(res, def$$1);
|
7937 |
+
return res
|
7938 |
+
} else if (typeof def$$1 === 'string') {
|
7939 |
+
return autoCssTransition(def$$1)
|
7940 |
+
}
|
7941 |
+
}
|
7942 |
+
|
7943 |
+
var autoCssTransition = cached(function (name) {
|
7944 |
+
return {
|
7945 |
+
enterClass: (name + "-enter"),
|
7946 |
+
enterToClass: (name + "-enter-to"),
|
7947 |
+
enterActiveClass: (name + "-enter-active"),
|
7948 |
+
leaveClass: (name + "-leave"),
|
7949 |
+
leaveToClass: (name + "-leave-to"),
|
7950 |
+
leaveActiveClass: (name + "-leave-active")
|
7951 |
+
}
|
7952 |
+
});
|
7953 |
+
|
7954 |
+
var hasTransition = inBrowser && !isIE9;
|
7955 |
+
var TRANSITION = 'transition';
|
7956 |
+
var ANIMATION = 'animation';
|
7957 |
+
|
7958 |
+
// Transition property/event sniffing
|
7959 |
+
var transitionProp = 'transition';
|
7960 |
+
var transitionEndEvent = 'transitionend';
|
7961 |
+
var animationProp = 'animation';
|
7962 |
+
var animationEndEvent = 'animationend';
|
7963 |
+
if (hasTransition) {
|
7964 |
+
/* istanbul ignore if */
|
7965 |
+
if (window.ontransitionend === undefined &&
|
7966 |
+
window.onwebkittransitionend !== undefined
|
7967 |
+
) {
|
7968 |
+
transitionProp = 'WebkitTransition';
|
7969 |
+
transitionEndEvent = 'webkitTransitionEnd';
|
7970 |
+
}
|
7971 |
+
if (window.onanimationend === undefined &&
|
7972 |
+
window.onwebkitanimationend !== undefined
|
7973 |
+
) {
|
7974 |
+
animationProp = 'WebkitAnimation';
|
7975 |
+
animationEndEvent = 'webkitAnimationEnd';
|
7976 |
+
}
|
7977 |
+
}
|
7978 |
+
|
7979 |
+
// binding to window is necessary to make hot reload work in IE in strict mode
|
7980 |
+
var raf = inBrowser
|
7981 |
+
? window.requestAnimationFrame
|
7982 |
+
? window.requestAnimationFrame.bind(window)
|
7983 |
+
: setTimeout
|
7984 |
+
: /* istanbul ignore next */ function (fn) { return fn(); };
|
7985 |
+
|
7986 |
+
function nextFrame (fn) {
|
7987 |
+
raf(function () {
|
7988 |
+
raf(fn);
|
7989 |
+
});
|
7990 |
+
}
|
7991 |
+
|
7992 |
+
function addTransitionClass (el, cls) {
|
7993 |
+
var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
|
7994 |
+
if (transitionClasses.indexOf(cls) < 0) {
|
7995 |
+
transitionClasses.push(cls);
|
7996 |
+
addClass(el, cls);
|
7997 |
+
}
|
7998 |
+
}
|
7999 |
+
|
8000 |
+
function removeTransitionClass (el, cls) {
|
8001 |
+
if (el._transitionClasses) {
|
8002 |
+
remove(el._transitionClasses, cls);
|
8003 |
+
}
|
8004 |
+
removeClass(el, cls);
|
8005 |
+
}
|
8006 |
+
|
8007 |
+
function whenTransitionEnds (
|
8008 |
+
el,
|
8009 |
+
expectedType,
|
8010 |
+
cb
|
8011 |
+
) {
|
8012 |
+
var ref = getTransitionInfo(el, expectedType);
|
8013 |
+
var type = ref.type;
|
8014 |
+
var timeout = ref.timeout;
|
8015 |
+
var propCount = ref.propCount;
|
8016 |
+
if (!type) { return cb() }
|
8017 |
+
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
|
8018 |
+
var ended = 0;
|
8019 |
+
var end = function () {
|
8020 |
+
el.removeEventListener(event, onEnd);
|
8021 |
+
cb();
|
8022 |
+
};
|
8023 |
+
var onEnd = function (e) {
|
8024 |
+
if (e.target === el) {
|
8025 |
+
if (++ended >= propCount) {
|
8026 |
+
end();
|
8027 |
+
}
|
8028 |
+
}
|
8029 |
+
};
|
8030 |
+
setTimeout(function () {
|
8031 |
+
if (ended < propCount) {
|
8032 |
+
end();
|
8033 |
+
}
|
8034 |
+
}, timeout + 1);
|
8035 |
+
el.addEventListener(event, onEnd);
|
8036 |
+
}
|
8037 |
+
|
8038 |
+
var transformRE = /\b(transform|all)(,|$)/;
|
8039 |
+
|
8040 |
+
function getTransitionInfo (el, expectedType) {
|
8041 |
+
var styles = window.getComputedStyle(el);
|
8042 |
+
// JSDOM may return undefined for transition properties
|
8043 |
+
var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
|
8044 |
+
var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
|
8045 |
+
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
|
8046 |
+
var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
|
8047 |
+
var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
|
8048 |
+
var animationTimeout = getTimeout(animationDelays, animationDurations);
|
8049 |
+
|
8050 |
+
var type;
|
8051 |
+
var timeout = 0;
|
8052 |
+
var propCount = 0;
|
8053 |
+
/* istanbul ignore if */
|
8054 |
+
if (expectedType === TRANSITION) {
|
8055 |
+
if (transitionTimeout > 0) {
|
8056 |
+
type = TRANSITION;
|
8057 |
+
timeout = transitionTimeout;
|
8058 |
+
propCount = transitionDurations.length;
|
8059 |
+
}
|
8060 |
+
} else if (expectedType === ANIMATION) {
|
8061 |
+
if (animationTimeout > 0) {
|
8062 |
+
type = ANIMATION;
|
8063 |
+
timeout = animationTimeout;
|
8064 |
+
propCount = animationDurations.length;
|
8065 |
+
}
|
8066 |
+
} else {
|
8067 |
+
timeout = Math.max(transitionTimeout, animationTimeout);
|
8068 |
+
type = timeout > 0
|
8069 |
+
? transitionTimeout > animationTimeout
|
8070 |
+
? TRANSITION
|
8071 |
+
: ANIMATION
|
8072 |
+
: null;
|
8073 |
+
propCount = type
|
8074 |
+
? type === TRANSITION
|
8075 |
+
? transitionDurations.length
|
8076 |
+
: animationDurations.length
|
8077 |
+
: 0;
|
8078 |
+
}
|
8079 |
+
var hasTransform =
|
8080 |
+
type === TRANSITION &&
|
8081 |
+
transformRE.test(styles[transitionProp + 'Property']);
|
8082 |
+
return {
|
8083 |
+
type: type,
|
8084 |
+
timeout: timeout,
|
8085 |
+
propCount: propCount,
|
8086 |
+
hasTransform: hasTransform
|
8087 |
+
}
|
8088 |
+
}
|
8089 |
+
|
8090 |
+
function getTimeout (delays, durations) {
|
8091 |
+
/* istanbul ignore next */
|
8092 |
+
while (delays.length < durations.length) {
|
8093 |
+
delays = delays.concat(delays);
|
8094 |
+
}
|
8095 |
+
|
8096 |
+
return Math.max.apply(null, durations.map(function (d, i) {
|
8097 |
+
return toMs(d) + toMs(delays[i])
|
8098 |
+
}))
|
8099 |
+
}
|
8100 |
+
|
8101 |
+
// Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
|
8102 |
+
// in a locale-dependent way, using a comma instead of a dot.
|
8103 |
+
// If comma is not replaced with a dot, the input will be rounded down (i.e. acting
|
8104 |
+
// as a floor function) causing unexpected behaviors
|
8105 |
+
function toMs (s) {
|
8106 |
+
return Number(s.slice(0, -1).replace(',', '.')) * 1000
|
8107 |
+
}
|
8108 |
+
|
8109 |
+
/* */
|
8110 |
+
|
8111 |
+
function enter (vnode, toggleDisplay) {
|
8112 |
+
var el = vnode.elm;
|
8113 |
+
|
8114 |
+
// call leave callback now
|
8115 |
+
if (isDef(el._leaveCb)) {
|
8116 |
+
el._leaveCb.cancelled = true;
|
8117 |
+
el._leaveCb();
|
8118 |
+
}
|
8119 |
+
|
8120 |
+
var data = resolveTransition(vnode.data.transition);
|
8121 |
+
if (isUndef(data)) {
|
8122 |
+
return
|
8123 |
+
}
|
8124 |
+
|
8125 |
+
/* istanbul ignore if */
|
8126 |
+
if (isDef(el._enterCb) || el.nodeType !== 1) {
|
8127 |
+
return
|
8128 |
+
}
|
8129 |
+
|
8130 |
+
var css = data.css;
|
8131 |
+
var type = data.type;
|
8132 |
+
var enterClass = data.enterClass;
|
8133 |
+
var enterToClass = data.enterToClass;
|
8134 |
+
var enterActiveClass = data.enterActiveClass;
|
8135 |
+
var appearClass = data.appearClass;
|
8136 |
+
var appearToClass = data.appearToClass;
|
8137 |
+
var appearActiveClass = data.appearActiveClass;
|
8138 |
+
var beforeEnter = data.beforeEnter;
|
8139 |
+
var enter = data.enter;
|
8140 |
+
var afterEnter = data.afterEnter;
|
8141 |
+
var enterCancelled = data.enterCancelled;
|
8142 |
+
var beforeAppear = data.beforeAppear;
|
8143 |
+
var appear = data.appear;
|
8144 |
+
var afterAppear = data.afterAppear;
|
8145 |
+
var appearCancelled = data.appearCancelled;
|
8146 |
+
var duration = data.duration;
|
8147 |
+
|
8148 |
+
// activeInstance will always be the <transition> component managing this
|
8149 |
+
// transition. One edge case to check is when the <transition> is placed
|
8150 |
+
// as the root node of a child component. In that case we need to check
|
8151 |
+
// <transition>'s parent for appear check.
|
8152 |
+
var context = activeInstance;
|
8153 |
+
var transitionNode = activeInstance.$vnode;
|
8154 |
+
while (transitionNode && transitionNode.parent) {
|
8155 |
+
context = transitionNode.context;
|
8156 |
+
transitionNode = transitionNode.parent;
|
8157 |
+
}
|
8158 |
+
|
8159 |
+
var isAppear = !context._isMounted || !vnode.isRootInsert;
|
8160 |
+
|
8161 |
+
if (isAppear && !appear && appear !== '') {
|
8162 |
+
return
|
8163 |
+
}
|
8164 |
+
|
8165 |
+
var startClass = isAppear && appearClass
|
8166 |
+
? appearClass
|
8167 |
+
: enterClass;
|
8168 |
+
var activeClass = isAppear && appearActiveClass
|
8169 |
+
? appearActiveClass
|
8170 |
+
: enterActiveClass;
|
8171 |
+
var toClass = isAppear && appearToClass
|
8172 |
+
? appearToClass
|
8173 |
+
: enterToClass;
|
8174 |
+
|
8175 |
+
var beforeEnterHook = isAppear
|
8176 |
+
? (beforeAppear || beforeEnter)
|
8177 |
+
: beforeEnter;
|
8178 |
+
var enterHook = isAppear
|
8179 |
+
? (typeof appear === 'function' ? appear : enter)
|
8180 |
+
: enter;
|
8181 |
+
var afterEnterHook = isAppear
|
8182 |
+
? (afterAppear || afterEnter)
|
8183 |
+
: afterEnter;
|
8184 |
+
var enterCancelledHook = isAppear
|
8185 |
+
? (appearCancelled || enterCancelled)
|
8186 |
+
: enterCancelled;
|
8187 |
+
|
8188 |
+
var explicitEnterDuration = toNumber(
|
8189 |
+
isObject(duration)
|
8190 |
+
? duration.enter
|
8191 |
+
: duration
|
8192 |
+
);
|
8193 |
+
|
8194 |
+
if (explicitEnterDuration != null) {
|
8195 |
+
checkDuration(explicitEnterDuration, 'enter', vnode);
|
8196 |
+
}
|
8197 |
+
|
8198 |
+
var expectsCSS = css !== false && !isIE9;
|
8199 |
+
var userWantsControl = getHookArgumentsLength(enterHook);
|
8200 |
+
|
8201 |
+
var cb = el._enterCb = once(function () {
|
8202 |
+
if (expectsCSS) {
|
8203 |
+
removeTransitionClass(el, toClass);
|
8204 |
+
removeTransitionClass(el, activeClass);
|
8205 |
+
}
|
8206 |
+
if (cb.cancelled) {
|
8207 |
+
if (expectsCSS) {
|
8208 |
+
removeTransitionClass(el, startClass);
|
8209 |
+
}
|
8210 |
+
enterCancelledHook && enterCancelledHook(el);
|
8211 |
+
} else {
|
8212 |
+
afterEnterHook && afterEnterHook(el);
|
8213 |
+
}
|
8214 |
+
el._enterCb = null;
|
8215 |
+
});
|
8216 |
+
|
8217 |
+
if (!vnode.data.show) {
|
8218 |
+
// remove pending leave element on enter by injecting an insert hook
|
8219 |
+
mergeVNodeHook(vnode, 'insert', function () {
|
8220 |
+
var parent = el.parentNode;
|
8221 |
+
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
|
8222 |
+
if (pendingNode &&
|
8223 |
+
pendingNode.tag === vnode.tag &&
|
8224 |
+
pendingNode.elm._leaveCb
|
8225 |
+
) {
|
8226 |
+
pendingNode.elm._leaveCb();
|
8227 |
+
}
|
8228 |
+
enterHook && enterHook(el, cb);
|
8229 |
+
});
|
8230 |
+
}
|
8231 |
+
|
8232 |
+
// start enter transition
|
8233 |
+
beforeEnterHook && beforeEnterHook(el);
|
8234 |
+
if (expectsCSS) {
|
8235 |
+
addTransitionClass(el, startClass);
|
8236 |
+
addTransitionClass(el, activeClass);
|
8237 |
+
nextFrame(function () {
|
8238 |
+
removeTransitionClass(el, startClass);
|
8239 |
+
if (!cb.cancelled) {
|
8240 |
+
addTransitionClass(el, toClass);
|
8241 |
+
if (!userWantsControl) {
|
8242 |
+
if (isValidDuration(explicitEnterDuration)) {
|
8243 |
+
setTimeout(cb, explicitEnterDuration);
|
8244 |
+
} else {
|
8245 |
+
whenTransitionEnds(el, type, cb);
|
8246 |
+
}
|
8247 |
+
}
|
8248 |
+
}
|
8249 |
+
});
|
8250 |
+
}
|
8251 |
+
|
8252 |
+
if (vnode.data.show) {
|
8253 |
+
toggleDisplay && toggleDisplay();
|
8254 |
+
enterHook && enterHook(el, cb);
|
8255 |
+
}
|
8256 |
+
|
8257 |
+
if (!expectsCSS && !userWantsControl) {
|
8258 |
+
cb();
|
8259 |
+
}
|
8260 |
+
}
|
8261 |
+
|
8262 |
+
function leave (vnode, rm) {
|
8263 |
+
var el = vnode.elm;
|
8264 |
+
|
8265 |
+
// call enter callback now
|
8266 |
+
if (isDef(el._enterCb)) {
|
8267 |
+
el._enterCb.cancelled = true;
|
8268 |
+
el._enterCb();
|
8269 |
+
}
|
8270 |
+
|
8271 |
+
var data = resolveTransition(vnode.data.transition);
|
8272 |
+
if (isUndef(data) || el.nodeType !== 1) {
|
8273 |
+
return rm()
|
8274 |
+
}
|
8275 |
+
|
8276 |
+
/* istanbul ignore if */
|
8277 |
+
if (isDef(el._leaveCb)) {
|
8278 |
+
return
|
8279 |
+
}
|
8280 |
+
|
8281 |
+
var css = data.css;
|
8282 |
+
var type = data.type;
|
8283 |
+
var leaveClass = data.leaveClass;
|
8284 |
+
var leaveToClass = data.leaveToClass;
|
8285 |
+
var leaveActiveClass = data.leaveActiveClass;
|
8286 |
+
var beforeLeave = data.beforeLeave;
|
8287 |
+
var leave = data.leave;
|
8288 |
+
var afterLeave = data.afterLeave;
|
8289 |
+
var leaveCancelled = data.leaveCancelled;
|
8290 |
+
var delayLeave = data.delayLeave;
|
8291 |
+
var duration = data.duration;
|
8292 |
+
|
8293 |
+
var expectsCSS = css !== false && !isIE9;
|
8294 |
+
var userWantsControl = getHookArgumentsLength(leave);
|
8295 |
+
|
8296 |
+
var explicitLeaveDuration = toNumber(
|
8297 |
+
isObject(duration)
|
8298 |
+
? duration.leave
|
8299 |
+
: duration
|
8300 |
+
);
|
8301 |
+
|
8302 |
+
if (isDef(explicitLeaveDuration)) {
|
8303 |
+
checkDuration(explicitLeaveDuration, 'leave', vnode);
|
8304 |
+
}
|
8305 |
+
|
8306 |
+
var cb = el._leaveCb = once(function () {
|
8307 |
+
if (el.parentNode && el.parentNode._pending) {
|
8308 |
+
el.parentNode._pending[vnode.key] = null;
|
8309 |
+
}
|
8310 |
+
if (expectsCSS) {
|
8311 |
+
removeTransitionClass(el, leaveToClass);
|
8312 |
+
removeTransitionClass(el, leaveActiveClass);
|
8313 |
+
}
|
8314 |
+
if (cb.cancelled) {
|
8315 |
+
if (expectsCSS) {
|
8316 |
+
removeTransitionClass(el, leaveClass);
|
8317 |
+
}
|
8318 |
+
leaveCancelled && leaveCancelled(el);
|
8319 |
+
} else {
|
8320 |
+
rm();
|
8321 |
+
afterLeave && afterLeave(el);
|
8322 |
+
}
|
8323 |
+
el._leaveCb = null;
|
8324 |
+
});
|
8325 |
+
|
8326 |
+
if (delayLeave) {
|
8327 |
+
delayLeave(performLeave);
|
8328 |
+
} else {
|
8329 |
+
performLeave();
|
8330 |
+
}
|
8331 |
+
|
8332 |
+
function performLeave () {
|
8333 |
+
// the delayed leave may have already been cancelled
|
8334 |
+
if (cb.cancelled) {
|
8335 |
+
return
|
8336 |
+
}
|
8337 |
+
// record leaving element
|
8338 |
+
if (!vnode.data.show && el.parentNode) {
|
8339 |
+
(el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
|
8340 |
+
}
|
8341 |
+
beforeLeave && beforeLeave(el);
|
8342 |
+
if (expectsCSS) {
|
8343 |
+
addTransitionClass(el, leaveClass);
|
8344 |
+
addTransitionClass(el, leaveActiveClass);
|
8345 |
+
nextFrame(function () {
|
8346 |
+
removeTransitionClass(el, leaveClass);
|
8347 |
+
if (!cb.cancelled) {
|
8348 |
+
addTransitionClass(el, leaveToClass);
|
8349 |
+
if (!userWantsControl) {
|
8350 |
+
if (isValidDuration(explicitLeaveDuration)) {
|
8351 |
+
setTimeout(cb, explicitLeaveDuration);
|
8352 |
+
} else {
|
8353 |
+
whenTransitionEnds(el, type, cb);
|
8354 |
+
}
|
8355 |
+
}
|
8356 |
+
}
|
8357 |
+
});
|
8358 |
+
}
|
8359 |
+
leave && leave(el, cb);
|
8360 |
+
if (!expectsCSS && !userWantsControl) {
|
8361 |
+
cb();
|
8362 |
+
}
|
8363 |
+
}
|
8364 |
+
}
|
8365 |
+
|
8366 |
+
// only used in dev mode
|
8367 |
+
function checkDuration (val, name, vnode) {
|
8368 |
+
if (typeof val !== 'number') {
|
8369 |
+
warn(
|
8370 |
+
"<transition> explicit " + name + " duration is not a valid number - " +
|
8371 |
+
"got " + (JSON.stringify(val)) + ".",
|
8372 |
+
vnode.context
|
8373 |
+
);
|
8374 |
+
} else if (isNaN(val)) {
|
8375 |
+
warn(
|
8376 |
+
"<transition> explicit " + name + " duration is NaN - " +
|
8377 |
+
'the duration expression might be incorrect.',
|
8378 |
+
vnode.context
|
8379 |
+
);
|
8380 |
+
}
|
8381 |
+
}
|
8382 |
+
|
8383 |
+
function isValidDuration (val) {
|
8384 |
+
return typeof val === 'number' && !isNaN(val)
|
8385 |
+
}
|
8386 |
+
|
8387 |
+
/**
|
8388 |
+
* Normalize a transition hook's argument length. The hook may be:
|
8389 |
+
* - a merged hook (invoker) with the original in .fns
|
8390 |
+
* - a wrapped component method (check ._length)
|
8391 |
+
* - a plain function (.length)
|
8392 |
+
*/
|
8393 |
+
function getHookArgumentsLength (fn) {
|
8394 |
+
if (isUndef(fn)) {
|
8395 |
+
return false
|
8396 |
+
}
|
8397 |
+
var invokerFns = fn.fns;
|
8398 |
+
if (isDef(invokerFns)) {
|
8399 |
+
// invoker
|
8400 |
+
return getHookArgumentsLength(
|
8401 |
+
Array.isArray(invokerFns)
|
8402 |
+
? invokerFns[0]
|
8403 |
+
: invokerFns
|
8404 |
+
)
|
8405 |
+
} else {
|
8406 |
+
return (fn._length || fn.length) > 1
|
8407 |
+
}
|
8408 |
+
}
|
8409 |
+
|
8410 |
+
function _enter (_, vnode) {
|
8411 |
+
if (vnode.data.show !== true) {
|
8412 |
+
enter(vnode);
|
8413 |
+
}
|
8414 |
+
}
|
8415 |
+
|
8416 |
+
var transition = inBrowser ? {
|
8417 |
+
create: _enter,
|
8418 |
+
activate: _enter,
|
8419 |
+
remove: function remove$$1 (vnode, rm) {
|
8420 |
+
/* istanbul ignore else */
|
8421 |
+
if (vnode.data.show !== true) {
|
8422 |
+
leave(vnode, rm);
|
8423 |
+
} else {
|
8424 |
+
rm();
|
8425 |
+
}
|
8426 |
+
}
|
8427 |
+
} : {};
|
8428 |
+
|
8429 |
+
var platformModules = [
|
8430 |
+
attrs,
|
8431 |
+
klass,
|
8432 |
+
events,
|
8433 |
+
domProps,
|
8434 |
+
style,
|
8435 |
+
transition
|
8436 |
+
];
|
8437 |
+
|
8438 |
+
/* */
|
8439 |
+
|
8440 |
+
// the directive module should be applied last, after all
|
8441 |
+
// built-in modules have been applied.
|
8442 |
+
var modules = platformModules.concat(baseModules);
|
8443 |
+
|
8444 |
+
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
|
8445 |
+
|
8446 |
+
/**
|
8447 |
+
* Not type checking this file because flow doesn't like attaching
|
8448 |
+
* properties to Elements.
|
8449 |
+
*/
|
8450 |
+
|
8451 |
+
/* istanbul ignore if */
|
8452 |
+
if (isIE9) {
|
8453 |
+
// http://www.matts411.com/post/internet-explorer-9-oninput/
|
8454 |
+
document.addEventListener('selectionchange', function () {
|
8455 |
+
var el = document.activeElement;
|
8456 |
+
if (el && el.vmodel) {
|
8457 |
+
trigger(el, 'input');
|
8458 |
+
}
|
8459 |
+
});
|
8460 |
+
}
|
8461 |
+
|
8462 |
+
var directive = {
|
8463 |
+
inserted: function inserted (el, binding, vnode, oldVnode) {
|
8464 |
+
if (vnode.tag === 'select') {
|
8465 |
+
// #6903
|
8466 |
+
if (oldVnode.elm && !oldVnode.elm._vOptions) {
|
8467 |
+
mergeVNodeHook(vnode, 'postpatch', function () {
|
8468 |
+
directive.componentUpdated(el, binding, vnode);
|
8469 |
+
});
|
8470 |
+
} else {
|
8471 |
+
setSelected(el, binding, vnode.context);
|
8472 |
+
}
|
8473 |
+
el._vOptions = [].map.call(el.options, getValue);
|
8474 |
+
} else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
|
8475 |
+
el._vModifiers = binding.modifiers;
|
8476 |
+
if (!binding.modifiers.lazy) {
|
8477 |
+
el.addEventListener('compositionstart', onCompositionStart);
|
8478 |
+
el.addEventListener('compositionend', onCompositionEnd);
|
8479 |
+
// Safari < 10.2 & UIWebView doesn't fire compositionend when
|
8480 |
+
// switching focus before confirming composition choice
|
8481 |
+
// this also fixes the issue where some browsers e.g. iOS Chrome
|
8482 |
+
// fires "change" instead of "input" on autocomplete.
|
8483 |
+
el.addEventListener('change', onCompositionEnd);
|
8484 |
+
/* istanbul ignore if */
|
8485 |
+
if (isIE9) {
|
8486 |
+
el.vmodel = true;
|
8487 |
+
}
|
8488 |
+
}
|
8489 |
+
}
|
8490 |
+
},
|
8491 |
+
|
8492 |
+
componentUpdated: function componentUpdated (el, binding, vnode) {
|
8493 |
+
if (vnode.tag === 'select') {
|
8494 |
+
setSelected(el, binding, vnode.context);
|
8495 |
+
// in case the options rendered by v-for have changed,
|
8496 |
+
// it's possible that the value is out-of-sync with the rendered options.
|
8497 |
+
// detect such cases and filter out values that no longer has a matching
|
8498 |
+
// option in the DOM.
|
8499 |
+
var prevOptions = el._vOptions;
|
8500 |
+
var curOptions = el._vOptions = [].map.call(el.options, getValue);
|
8501 |
+
if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
|
8502 |
+
// trigger change event if
|
8503 |
+
// no matching option found for at least one value
|
8504 |
+
var needReset = el.multiple
|
8505 |
+
? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
|
8506 |
+
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
|
8507 |
+
if (needReset) {
|
8508 |
+
trigger(el, 'change');
|
8509 |
+
}
|
8510 |
+
}
|
8511 |
+
}
|
8512 |
+
}
|
8513 |
+
};
|
8514 |
+
|
8515 |
+
function setSelected (el, binding, vm) {
|
8516 |
+
actuallySetSelected(el, binding, vm);
|
8517 |
+
/* istanbul ignore if */
|
8518 |
+
if (isIE || isEdge) {
|
8519 |
+
setTimeout(function () {
|
8520 |
+
actuallySetSelected(el, binding, vm);
|
8521 |
+
}, 0);
|
8522 |
+
}
|
8523 |
+
}
|
8524 |
+
|
8525 |
+
function actuallySetSelected (el, binding, vm) {
|
8526 |
+
var value = binding.value;
|
8527 |
+
var isMultiple = el.multiple;
|
8528 |
+
if (isMultiple && !Array.isArray(value)) {
|
8529 |
+
warn(
|
8530 |
+
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
|
8531 |
+
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
|
8532 |
+
vm
|
8533 |
+
);
|
8534 |
+
return
|
8535 |
+
}
|
8536 |
+
var selected, option;
|
8537 |
+
for (var i = 0, l = el.options.length; i < l; i++) {
|
8538 |
+
option = el.options[i];
|
8539 |
+
if (isMultiple) {
|
8540 |
+
selected = looseIndexOf(value, getValue(option)) > -1;
|
8541 |
+
if (option.selected !== selected) {
|
8542 |
+
option.selected = selected;
|
8543 |
+
}
|
8544 |
+
} else {
|
8545 |
+
if (looseEqual(getValue(option), value)) {
|
8546 |
+
if (el.selectedIndex !== i) {
|
8547 |
+
el.selectedIndex = i;
|
8548 |
+
}
|
8549 |
+
return
|
8550 |
+
}
|
8551 |
+
}
|
8552 |
+
}
|
8553 |
+
if (!isMultiple) {
|
8554 |
+
el.selectedIndex = -1;
|
8555 |
+
}
|
8556 |
+
}
|
8557 |
+
|
8558 |
+
function hasNoMatchingOption (value, options) {
|
8559 |
+
return options.every(function (o) { return !looseEqual(o, value); })
|
8560 |
+
}
|
8561 |
+
|
8562 |
+
function getValue (option) {
|
8563 |
+
return '_value' in option
|
8564 |
+
? option._value
|
8565 |
+
: option.value
|
8566 |
+
}
|
8567 |
+
|
8568 |
+
function onCompositionStart (e) {
|
8569 |
+
e.target.composing = true;
|
8570 |
+
}
|
8571 |
+
|
8572 |
+
function onCompositionEnd (e) {
|
8573 |
+
// prevent triggering an input event for no reason
|
8574 |
+
if (!e.target.composing) { return }
|
8575 |
+
e.target.composing = false;
|
8576 |
+
trigger(e.target, 'input');
|
8577 |
+
}
|
8578 |
+
|
8579 |
+
function trigger (el, type) {
|
8580 |
+
var e = document.createEvent('HTMLEvents');
|
8581 |
+
e.initEvent(type, true, true);
|
8582 |
+
el.dispatchEvent(e);
|
8583 |
+
}
|
8584 |
+
|
8585 |
+
/* */
|
8586 |
+
|
8587 |
+
// recursively search for possible transition defined inside the component root
|
8588 |
+
function locateNode (vnode) {
|
8589 |
+
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
|
8590 |
+
? locateNode(vnode.componentInstance._vnode)
|
8591 |
+
: vnode
|
8592 |
+
}
|
8593 |
+
|
8594 |
+
var show = {
|
8595 |
+
bind: function bind (el, ref, vnode) {
|
8596 |
+
var value = ref.value;
|
8597 |
+
|
8598 |
+
vnode = locateNode(vnode);
|
8599 |
+
var transition$$1 = vnode.data && vnode.data.transition;
|
8600 |
+
var originalDisplay = el.__vOriginalDisplay =
|
8601 |
+
el.style.display === 'none' ? '' : el.style.display;
|
8602 |
+
if (value && transition$$1) {
|
8603 |
+
vnode.data.show = true;
|
8604 |
+
enter(vnode, function () {
|
8605 |
+
el.style.display = originalDisplay;
|
8606 |
+
});
|
8607 |
+
} else {
|
8608 |
+
el.style.display = value ? originalDisplay : 'none';
|
8609 |
+
}
|
8610 |
+
},
|
8611 |
+
|
8612 |
+
update: function update (el, ref, vnode) {
|
8613 |
+
var value = ref.value;
|
8614 |
+
var oldValue = ref.oldValue;
|
8615 |
+
|
8616 |
+
/* istanbul ignore if */
|
8617 |
+
if (!value === !oldValue) { return }
|
8618 |
+
vnode = locateNode(vnode);
|
8619 |
+
var transition$$1 = vnode.data && vnode.data.transition;
|
8620 |
+
if (transition$$1) {
|
8621 |
+
vnode.data.show = true;
|
8622 |
+
if (value) {
|
8623 |
+
enter(vnode, function () {
|
8624 |
+
el.style.display = el.__vOriginalDisplay;
|
8625 |
+
});
|
8626 |
+
} else {
|
8627 |
+
leave(vnode, function () {
|
8628 |
+
el.style.display = 'none';
|
8629 |
+
});
|
8630 |
+
}
|
8631 |
+
} else {
|
8632 |
+
el.style.display = value ? el.__vOriginalDisplay : 'none';
|
8633 |
+
}
|
8634 |
+
},
|
8635 |
+
|
8636 |
+
unbind: function unbind (
|
8637 |
+
el,
|
8638 |
+
binding,
|
8639 |
+
vnode,
|
8640 |
+
oldVnode,
|
8641 |
+
isDestroy
|
8642 |
+
) {
|
8643 |
+
if (!isDestroy) {
|
8644 |
+
el.style.display = el.__vOriginalDisplay;
|
8645 |
+
}
|
8646 |
+
}
|
8647 |
+
};
|
8648 |
+
|
8649 |
+
var platformDirectives = {
|
8650 |
+
model: directive,
|
8651 |
+
show: show
|
8652 |
+
};
|
8653 |
+
|
8654 |
+
/* */
|
8655 |
+
|
8656 |
+
var transitionProps = {
|
8657 |
+
name: String,
|
8658 |
+
appear: Boolean,
|
8659 |
+
css: Boolean,
|
8660 |
+
mode: String,
|
8661 |
+
type: String,
|
8662 |
+
enterClass: String,
|
8663 |
+
leaveClass: String,
|
8664 |
+
enterToClass: String,
|
8665 |
+
leaveToClass: String,
|
8666 |
+
enterActiveClass: String,
|
8667 |
+
leaveActiveClass: String,
|
8668 |
+
appearClass: String,
|
8669 |
+
appearActiveClass: String,
|
8670 |
+
appearToClass: String,
|
8671 |
+
duration: [Number, String, Object]
|
8672 |
+
};
|
8673 |
+
|
8674 |
+
// in case the child is also an abstract component, e.g. <keep-alive>
|
8675 |
+
// we want to recursively retrieve the real component to be rendered
|
8676 |
+
function getRealChild (vnode) {
|
8677 |
+
var compOptions = vnode && vnode.componentOptions;
|
8678 |
+
if (compOptions && compOptions.Ctor.options.abstract) {
|
8679 |
+
return getRealChild(getFirstComponentChild(compOptions.children))
|
8680 |
+
} else {
|
8681 |
+
return vnode
|
8682 |
+
}
|
8683 |
+
}
|
8684 |
+
|
8685 |
+
function extractTransitionData (comp) {
|
8686 |
+
var data = {};
|
8687 |
+
var options = comp.$options;
|
8688 |
+
// props
|
8689 |
+
for (var key in options.propsData) {
|
8690 |
+
data[key] = comp[key];
|
8691 |
+
}
|
8692 |
+
// events.
|
8693 |
+
// extract listeners and pass them directly to the transition methods
|
8694 |
+
var listeners = options._parentListeners;
|
8695 |
+
for (var key$1 in listeners) {
|
8696 |
+
data[camelize(key$1)] = listeners[key$1];
|
8697 |
+
}
|
8698 |
+
return data
|
8699 |
+
}
|
8700 |
+
|
8701 |
+
function placeholder (h, rawChild) {
|
8702 |
+
if (/\d-keep-alive$/.test(rawChild.tag)) {
|
8703 |
+
return h('keep-alive', {
|
8704 |
+
props: rawChild.componentOptions.propsData
|
8705 |
+
})
|
8706 |
+
}
|
8707 |
+
}
|
8708 |
+
|
8709 |
+
function hasParentTransition (vnode) {
|
8710 |
+
while ((vnode = vnode.parent)) {
|
8711 |
+
if (vnode.data.transition) {
|
8712 |
+
return true
|
8713 |
+
}
|
8714 |
+
}
|
8715 |
+
}
|
8716 |
+
|
8717 |
+
function isSameChild (child, oldChild) {
|
8718 |
+
return oldChild.key === child.key && oldChild.tag === child.tag
|
8719 |
+
}
|
8720 |
+
|
8721 |
+
var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
|
8722 |
+
|
8723 |
+
var isVShowDirective = function (d) { return d.name === 'show'; };
|
8724 |
+
|
8725 |
+
var Transition = {
|
8726 |
+
name: 'transition',
|
8727 |
+
props: transitionProps,
|
8728 |
+
abstract: true,
|
8729 |
+
|
8730 |
+
render: function render (h) {
|
8731 |
+
var this$1 = this;
|
8732 |
+
|
8733 |
+
var children = this.$slots.default;
|
8734 |
+
if (!children) {
|
8735 |
+
return
|
8736 |
+
}
|
8737 |
+
|
8738 |
+
// filter out text nodes (possible whitespaces)
|
8739 |
+
children = children.filter(isNotTextNode);
|
8740 |
+
/* istanbul ignore if */
|
8741 |
+
if (!children.length) {
|
8742 |
+
return
|
8743 |
+
}
|
8744 |
+
|
8745 |
+
// warn multiple elements
|
8746 |
+
if (children.length > 1) {
|
8747 |
+
warn(
|
8748 |
+
'<transition> can only be used on a single element. Use ' +
|
8749 |
+
'<transition-group> for lists.',
|
8750 |
+
this.$parent
|
8751 |
+
);
|
8752 |
+
}
|
8753 |
+
|
8754 |
+
var mode = this.mode;
|
8755 |
+
|
8756 |
+
// warn invalid mode
|
8757 |
+
if (mode && mode !== 'in-out' && mode !== 'out-in'
|
8758 |
+
) {
|
8759 |
+
warn(
|
8760 |
+
'invalid <transition> mode: ' + mode,
|
8761 |
+
this.$parent
|
8762 |
+
);
|
8763 |
+
}
|
8764 |
+
|
8765 |
+
var rawChild = children[0];
|
8766 |
+
|
8767 |
+
// if this is a component root node and the component's
|
8768 |
+
// parent container node also has transition, skip.
|
8769 |
+
if (hasParentTransition(this.$vnode)) {
|
8770 |
+
return rawChild
|
8771 |
+
}
|
8772 |
+
|
8773 |
+
// apply transition data to child
|
8774 |
+
// use getRealChild() to ignore abstract components e.g. keep-alive
|
8775 |
+
var child = getRealChild(rawChild);
|
8776 |
+
/* istanbul ignore if */
|
8777 |
+
if (!child) {
|
8778 |
+
return rawChild
|
8779 |
+
}
|
8780 |
+
|
8781 |
+
if (this._leaving) {
|
8782 |
+
return placeholder(h, rawChild)
|
8783 |
+
}
|
8784 |
+
|
8785 |
+
// ensure a key that is unique to the vnode type and to this transition
|
8786 |
+
// component instance. This key will be used to remove pending leaving nodes
|
8787 |
+
// during entering.
|
8788 |
+
var id = "__transition-" + (this._uid) + "-";
|
8789 |
+
child.key = child.key == null
|
8790 |
+
? child.isComment
|
8791 |
+
? id + 'comment'
|
8792 |
+
: id + child.tag
|
8793 |
+
: isPrimitive(child.key)
|
8794 |
+
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
|
8795 |
+
: child.key;
|
8796 |
+
|
8797 |
+
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
|
8798 |
+
var oldRawChild = this._vnode;
|
8799 |
+
var oldChild = getRealChild(oldRawChild);
|
8800 |
+
|
8801 |
+
// mark v-show
|
8802 |
+
// so that the transition module can hand over the control to the directive
|
8803 |
+
if (child.data.directives && child.data.directives.some(isVShowDirective)) {
|
8804 |
+
child.data.show = true;
|
8805 |
+
}
|
8806 |
+
|
8807 |
+
if (
|
8808 |
+
oldChild &&
|
8809 |
+
oldChild.data &&
|
8810 |
+
!isSameChild(child, oldChild) &&
|
8811 |
+
!isAsyncPlaceholder(oldChild) &&
|
8812 |
+
// #6687 component root is a comment node
|
8813 |
+
!(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
|
8814 |
+
) {
|
8815 |
+
// replace old child transition data with fresh one
|
8816 |
+
// important for dynamic transitions!
|
8817 |
+
var oldData = oldChild.data.transition = extend({}, data);
|
8818 |
+
// handle transition mode
|
8819 |
+
if (mode === 'out-in') {
|
8820 |
+
// return placeholder node and queue update when leave finishes
|
8821 |
+
this._leaving = true;
|
8822 |
+
mergeVNodeHook(oldData, 'afterLeave', function () {
|
8823 |
+
this$1._leaving = false;
|
8824 |
+
this$1.$forceUpdate();
|
8825 |
+
});
|
8826 |
+
return placeholder(h, rawChild)
|
8827 |
+
} else if (mode === 'in-out') {
|
8828 |
+
if (isAsyncPlaceholder(child)) {
|
8829 |
+
return oldRawChild
|
8830 |
+
}
|
8831 |
+
var delayedLeave;
|
8832 |
+
var performLeave = function () { delayedLeave(); };
|
8833 |
+
mergeVNodeHook(data, 'afterEnter', performLeave);
|
8834 |
+
mergeVNodeHook(data, 'enterCancelled', performLeave);
|
8835 |
+
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
|
8836 |
+
}
|
8837 |
+
}
|
8838 |
+
|
8839 |
+
return rawChild
|
8840 |
+
}
|
8841 |
+
};
|
8842 |
+
|
8843 |
+
/* */
|
8844 |
+
|
8845 |
+
var props = extend({
|
8846 |
+
tag: String,
|
8847 |
+
moveClass: String
|
8848 |
+
}, transitionProps);
|
8849 |
+
|
8850 |
+
delete props.mode;
|
8851 |
+
|
8852 |
+
var TransitionGroup = {
|
8853 |
+
props: props,
|
8854 |
+
|
8855 |
+
beforeMount: function beforeMount () {
|
8856 |
+
var this$1 = this;
|
8857 |
+
|
8858 |
+
var update = this._update;
|
8859 |
+
this._update = function (vnode, hydrating) {
|
8860 |
+
var restoreActiveInstance = setActiveInstance(this$1);
|
8861 |
+
// force removing pass
|
8862 |
+
this$1.__patch__(
|
8863 |
+
this$1._vnode,
|
8864 |
+
this$1.kept,
|
8865 |
+
false, // hydrating
|
8866 |
+
true // removeOnly (!important, avoids unnecessary moves)
|
8867 |
+
);
|
8868 |
+
this$1._vnode = this$1.kept;
|
8869 |
+
restoreActiveInstance();
|
8870 |
+
update.call(this$1, vnode, hydrating);
|
8871 |
+
};
|
8872 |
+
},
|
8873 |
+
|
8874 |
+
render: function render (h) {
|
8875 |
+
var tag = this.tag || this.$vnode.data.tag || 'span';
|
8876 |
+
var map = Object.create(null);
|
8877 |
+
var prevChildren = this.prevChildren = this.children;
|
8878 |
+
var rawChildren = this.$slots.default || [];
|
8879 |
+
var children = this.children = [];
|
8880 |
+
var transitionData = extractTransitionData(this);
|
8881 |
+
|
8882 |
+
for (var i = 0; i < rawChildren.length; i++) {
|
8883 |
+
var c = rawChildren[i];
|
8884 |
+
if (c.tag) {
|
8885 |
+
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
|
8886 |
+
children.push(c);
|
8887 |
+
map[c.key] = c
|
8888 |
+
;(c.data || (c.data = {})).transition = transitionData;
|
8889 |
+
} else {
|
8890 |
+
var opts = c.componentOptions;
|
8891 |
+
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
|
8892 |
+
warn(("<transition-group> children must be keyed: <" + name + ">"));
|
8893 |
+
}
|
8894 |
+
}
|
8895 |
+
}
|
8896 |
+
|
8897 |
+
if (prevChildren) {
|
8898 |
+
var kept = [];
|
8899 |
+
var removed = [];
|
8900 |
+
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
|
8901 |
+
var c$1 = prevChildren[i$1];
|
8902 |
+
c$1.data.transition = transitionData;
|
8903 |
+
c$1.data.pos = c$1.elm.getBoundingClientRect();
|
8904 |
+
if (map[c$1.key]) {
|
8905 |
+
kept.push(c$1);
|
8906 |
+
} else {
|
8907 |
+
removed.push(c$1);
|
8908 |
+
}
|
8909 |
+
}
|
8910 |
+
this.kept = h(tag, null, kept);
|
8911 |
+
this.removed = removed;
|
8912 |
+
}
|
8913 |
+
|
8914 |
+
return h(tag, null, children)
|
8915 |
+
},
|
8916 |
+
|
8917 |
+
updated: function updated () {
|
8918 |
+
var children = this.prevChildren;
|
8919 |
+
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
|
8920 |
+
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
|
8921 |
+
return
|
8922 |
+
}
|
8923 |
+
|
8924 |
+
// we divide the work into three loops to avoid mixing DOM reads and writes
|
8925 |
+
// in each iteration - which helps prevent layout thrashing.
|
8926 |
+
children.forEach(callPendingCbs);
|
8927 |
+
children.forEach(recordPosition);
|
8928 |
+
children.forEach(applyTranslation);
|
8929 |
+
|
8930 |
+
// force reflow to put everything in position
|
8931 |
+
// assign to this to avoid being removed in tree-shaking
|
8932 |
+
// $flow-disable-line
|
8933 |
+
this._reflow = document.body.offsetHeight;
|
8934 |
+
|
8935 |
+
children.forEach(function (c) {
|
8936 |
+
if (c.data.moved) {
|
8937 |
+
var el = c.elm;
|
8938 |
+
var s = el.style;
|
8939 |
+
addTransitionClass(el, moveClass);
|
8940 |
+
s.transform = s.WebkitTransform = s.transitionDuration = '';
|
8941 |
+
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
|
8942 |
+
if (e && e.target !== el) {
|
8943 |
+
return
|
8944 |
+
}
|
8945 |
+
if (!e || /transform$/.test(e.propertyName)) {
|
8946 |
+
el.removeEventListener(transitionEndEvent, cb);
|
8947 |
+
el._moveCb = null;
|
8948 |
+
removeTransitionClass(el, moveClass);
|
8949 |
+
}
|
8950 |
+
});
|
8951 |
+
}
|
8952 |
+
});
|
8953 |
+
},
|
8954 |
+
|
8955 |
+
methods: {
|
8956 |
+
hasMove: function hasMove (el, moveClass) {
|
8957 |
+
/* istanbul ignore if */
|
8958 |
+
if (!hasTransition) {
|
8959 |
+
return false
|
8960 |
+
}
|
8961 |
+
/* istanbul ignore if */
|
8962 |
+
if (this._hasMove) {
|
8963 |
+
return this._hasMove
|
8964 |
+
}
|
8965 |
+
// Detect whether an element with the move class applied has
|
8966 |
+
// CSS transitions. Since the element may be inside an entering
|
8967 |
+
// transition at this very moment, we make a clone of it and remove
|
8968 |
+
// all other transition classes applied to ensure only the move class
|
8969 |
+
// is applied.
|
8970 |
+
var clone = el.cloneNode();
|
8971 |
+
if (el._transitionClasses) {
|
8972 |
+
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
|
8973 |
+
}
|
8974 |
+
addClass(clone, moveClass);
|
8975 |
+
clone.style.display = 'none';
|
8976 |
+
this.$el.appendChild(clone);
|
8977 |
+
var info = getTransitionInfo(clone);
|
8978 |
+
this.$el.removeChild(clone);
|
8979 |
+
return (this._hasMove = info.hasTransform)
|
8980 |
+
}
|
8981 |
+
}
|
8982 |
+
};
|
8983 |
+
|
8984 |
+
function callPendingCbs (c) {
|
8985 |
+
/* istanbul ignore if */
|
8986 |
+
if (c.elm._moveCb) {
|
8987 |
+
c.elm._moveCb();
|
8988 |
+
}
|
8989 |
+
/* istanbul ignore if */
|
8990 |
+
if (c.elm._enterCb) {
|
8991 |
+
c.elm._enterCb();
|
8992 |
+
}
|
8993 |
+
}
|
8994 |
+
|
8995 |
+
function recordPosition (c) {
|
8996 |
+
c.data.newPos = c.elm.getBoundingClientRect();
|
8997 |
+
}
|
8998 |
+
|
8999 |
+
function applyTranslation (c) {
|
9000 |
+
var oldPos = c.data.pos;
|
9001 |
+
var newPos = c.data.newPos;
|
9002 |
+
var dx = oldPos.left - newPos.left;
|
9003 |
+
var dy = oldPos.top - newPos.top;
|
9004 |
+
if (dx || dy) {
|
9005 |
+
c.data.moved = true;
|
9006 |
+
var s = c.elm.style;
|
9007 |
+
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
|
9008 |
+
s.transitionDuration = '0s';
|
9009 |
+
}
|
9010 |
+
}
|
9011 |
+
|
9012 |
+
var platformComponents = {
|
9013 |
+
Transition: Transition,
|
9014 |
+
TransitionGroup: TransitionGroup
|
9015 |
+
};
|
9016 |
+
|
9017 |
+
/* */
|
9018 |
+
|
9019 |
+
// install platform specific utils
|
9020 |
+
Vue.config.mustUseProp = mustUseProp;
|
9021 |
+
Vue.config.isReservedTag = isReservedTag;
|
9022 |
+
Vue.config.isReservedAttr = isReservedAttr;
|
9023 |
+
Vue.config.getTagNamespace = getTagNamespace;
|
9024 |
+
Vue.config.isUnknownElement = isUnknownElement;
|
9025 |
+
|
9026 |
+
// install platform runtime directives & components
|
9027 |
+
extend(Vue.options.directives, platformDirectives);
|
9028 |
+
extend(Vue.options.components, platformComponents);
|
9029 |
+
|
9030 |
+
// install platform patch function
|
9031 |
+
Vue.prototype.__patch__ = inBrowser ? patch : noop;
|
9032 |
+
|
9033 |
+
// public mount method
|
9034 |
+
Vue.prototype.$mount = function (
|
9035 |
+
el,
|
9036 |
+
hydrating
|
9037 |
+
) {
|
9038 |
+
el = el && inBrowser ? query(el) : undefined;
|
9039 |
+
return mountComponent(this, el, hydrating)
|
9040 |
+
};
|
9041 |
+
|
9042 |
+
// devtools global hook
|
9043 |
+
/* istanbul ignore next */
|
9044 |
+
if (inBrowser) {
|
9045 |
+
setTimeout(function () {
|
9046 |
+
if (config.devtools) {
|
9047 |
+
if (devtools) {
|
9048 |
+
devtools.emit('init', Vue);
|
9049 |
+
} else {
|
9050 |
+
console[console.info ? 'info' : 'log'](
|
9051 |
+
'Download the Vue Devtools extension for a better development experience:\n' +
|
9052 |
+
'https://github.com/vuejs/vue-devtools'
|
9053 |
+
);
|
9054 |
+
}
|
9055 |
+
}
|
9056 |
+
if (config.productionTip !== false &&
|
9057 |
+
typeof console !== 'undefined'
|
9058 |
+
) {
|
9059 |
+
console[console.info ? 'info' : 'log'](
|
9060 |
+
"You are running Vue in development mode.\n" +
|
9061 |
+
"Make sure to turn on production mode when deploying for production.\n" +
|
9062 |
+
"See more tips at https://vuejs.org/guide/deployment.html"
|
9063 |
+
);
|
9064 |
+
}
|
9065 |
+
}, 0);
|
9066 |
+
}
|
9067 |
+
|
9068 |
+
/* */
|
9069 |
+
|
9070 |
+
var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
|
9071 |
+
var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
|
9072 |
+
|
9073 |
+
var buildRegex = cached(function (delimiters) {
|
9074 |
+
var open = delimiters[0].replace(regexEscapeRE, '\\$&');
|
9075 |
+
var close = delimiters[1].replace(regexEscapeRE, '\\$&');
|
9076 |
+
return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
|
9077 |
+
});
|
9078 |
+
|
9079 |
+
|
9080 |
+
|
9081 |
+
function parseText (
|
9082 |
+
text,
|
9083 |
+
delimiters
|
9084 |
+
) {
|
9085 |
+
var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
|
9086 |
+
if (!tagRE.test(text)) {
|
9087 |
+
return
|
9088 |
+
}
|
9089 |
+
var tokens = [];
|
9090 |
+
var rawTokens = [];
|
9091 |
+
var lastIndex = tagRE.lastIndex = 0;
|
9092 |
+
var match, index, tokenValue;
|
9093 |
+
while ((match = tagRE.exec(text))) {
|
9094 |
+
index = match.index;
|
9095 |
+
// push text token
|
9096 |
+
if (index > lastIndex) {
|
9097 |
+
rawTokens.push(tokenValue = text.slice(lastIndex, index));
|
9098 |
+
tokens.push(JSON.stringify(tokenValue));
|
9099 |
+
}
|
9100 |
+
// tag token
|
9101 |
+
var exp = parseFilters(match[1].trim());
|
9102 |
+
tokens.push(("_s(" + exp + ")"));
|
9103 |
+
rawTokens.push({ '@binding': exp });
|
9104 |
+
lastIndex = index + match[0].length;
|
9105 |
+
}
|
9106 |
+
if (lastIndex < text.length) {
|
9107 |
+
rawTokens.push(tokenValue = text.slice(lastIndex));
|
9108 |
+
tokens.push(JSON.stringify(tokenValue));
|
9109 |
+
}
|
9110 |
+
return {
|
9111 |
+
expression: tokens.join('+'),
|
9112 |
+
tokens: rawTokens
|
9113 |
+
}
|
9114 |
+
}
|
9115 |
+
|
9116 |
+
/* */
|
9117 |
+
|
9118 |
+
function transformNode (el, options) {
|
9119 |
+
var warn = options.warn || baseWarn;
|
9120 |
+
var staticClass = getAndRemoveAttr(el, 'class');
|
9121 |
+
if (staticClass) {
|
9122 |
+
var res = parseText(staticClass, options.delimiters);
|
9123 |
+
if (res) {
|
9124 |
+
warn(
|
9125 |
+
"class=\"" + staticClass + "\": " +
|
9126 |
+
'Interpolation inside attributes has been removed. ' +
|
9127 |
+
'Use v-bind or the colon shorthand instead. For example, ' +
|
9128 |
+
'instead of <div class="{{ val }}">, use <div :class="val">.',
|
9129 |
+
el.rawAttrsMap['class']
|
9130 |
+
);
|
9131 |
+
}
|
9132 |
+
}
|
9133 |
+
if (staticClass) {
|
9134 |
+
el.staticClass = JSON.stringify(staticClass);
|
9135 |
+
}
|
9136 |
+
var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
|
9137 |
+
if (classBinding) {
|
9138 |
+
el.classBinding = classBinding;
|
9139 |
+
}
|
9140 |
+
}
|
9141 |
+
|
9142 |
+
function genData (el) {
|
9143 |
+
var data = '';
|
9144 |
+
if (el.staticClass) {
|
9145 |
+
data += "staticClass:" + (el.staticClass) + ",";
|
9146 |
+
}
|
9147 |
+
if (el.classBinding) {
|
9148 |
+
data += "class:" + (el.classBinding) + ",";
|
9149 |
+
}
|
9150 |
+
return data
|
9151 |
+
}
|
9152 |
+
|
9153 |
+
var klass$1 = {
|
9154 |
+
staticKeys: ['staticClass'],
|
9155 |
+
transformNode: transformNode,
|
9156 |
+
genData: genData
|
9157 |
+
};
|
9158 |
+
|
9159 |
+
/* */
|
9160 |
+
|
9161 |
+
function transformNode$1 (el, options) {
|
9162 |
+
var warn = options.warn || baseWarn;
|
9163 |
+
var staticStyle = getAndRemoveAttr(el, 'style');
|
9164 |
+
if (staticStyle) {
|
9165 |
+
/* istanbul ignore if */
|
9166 |
+
{
|
9167 |
+
var res = parseText(staticStyle, options.delimiters);
|
9168 |
+
if (res) {
|
9169 |
+
warn(
|
9170 |
+
"style=\"" + staticStyle + "\": " +
|
9171 |
+
'Interpolation inside attributes has been removed. ' +
|
9172 |
+
'Use v-bind or the colon shorthand instead. For example, ' +
|
9173 |
+
'instead of <div style="{{ val }}">, use <div :style="val">.',
|
9174 |
+
el.rawAttrsMap['style']
|
9175 |
+
);
|
9176 |
+
}
|
9177 |
+
}
|
9178 |
+
el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
|
9179 |
+
}
|
9180 |
+
|
9181 |
+
var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
|
9182 |
+
if (styleBinding) {
|
9183 |
+
el.styleBinding = styleBinding;
|
9184 |
+
}
|
9185 |
+
}
|
9186 |
+
|
9187 |
+
function genData$1 (el) {
|
9188 |
+
var data = '';
|
9189 |
+
if (el.staticStyle) {
|
9190 |
+
data += "staticStyle:" + (el.staticStyle) + ",";
|
9191 |
+
}
|
9192 |
+
if (el.styleBinding) {
|
9193 |
+
data += "style:(" + (el.styleBinding) + "),";
|
9194 |
+
}
|
9195 |
+
return data
|
9196 |
+
}
|
9197 |
+
|
9198 |
+
var style$1 = {
|
9199 |
+
staticKeys: ['staticStyle'],
|
9200 |
+
transformNode: transformNode$1,
|
9201 |
+
genData: genData$1
|
9202 |
+
};
|
9203 |
+
|
9204 |
+
/* */
|
9205 |
+
|
9206 |
+
var decoder;
|
9207 |
+
|
9208 |
+
var he = {
|
9209 |
+
decode: function decode (html) {
|
9210 |
+
decoder = decoder || document.createElement('div');
|
9211 |
+
decoder.innerHTML = html;
|
9212 |
+
return decoder.textContent
|
9213 |
+
}
|
9214 |
+
};
|
9215 |
+
|
9216 |
+
/* */
|
9217 |
+
|
9218 |
+
var isUnaryTag = makeMap(
|
9219 |
+
'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
|
9220 |
+
'link,meta,param,source,track,wbr'
|
9221 |
+
);
|
9222 |
+
|
9223 |
+
// Elements that you can, intentionally, leave open
|
9224 |
+
// (and which close themselves)
|
9225 |
+
var canBeLeftOpenTag = makeMap(
|
9226 |
+
'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
|
9227 |
+
);
|
9228 |
+
|
9229 |
+
// HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
|
9230 |
+
// Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
|
9231 |
+
var isNonPhrasingTag = makeMap(
|
9232 |
+
'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
|
9233 |
+
'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
|
9234 |
+
'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
|
9235 |
+
'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
|
9236 |
+
'title,tr,track'
|
9237 |
+
);
|
9238 |
+
|
9239 |
+
/**
|
9240 |
+
* Not type-checking this file because it's mostly vendor code.
|
9241 |
+
*/
|
9242 |
+
|
9243 |
+
// Regular Expressions for parsing tags and attributes
|
9244 |
+
var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9245 |
+
var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
|
9246 |
+
var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
|
9247 |
+
var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
|
9248 |
+
var startTagOpen = new RegExp(("^<" + qnameCapture));
|
9249 |
+
var startTagClose = /^\s*(\/?)>/;
|
9250 |
+
var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
|
9251 |
+
var doctype = /^<!DOCTYPE [^>]+>/i;
|
9252 |
+
// #7298: escape - to avoid being pased as HTML comment when inlined in page
|
9253 |
+
var comment = /^<!\--/;
|
9254 |
+
var conditionalComment = /^<!\[/;
|
9255 |
+
|
9256 |
+
// Special Elements (can contain anything)
|
9257 |
+
var isPlainTextElement = makeMap('script,style,textarea', true);
|
9258 |
+
var reCache = {};
|
9259 |
+
|
9260 |
+
var decodingMap = {
|
9261 |
+
'<': '<',
|
9262 |
+
'>': '>',
|
9263 |
+
'"': '"',
|
9264 |
+
'&': '&',
|
9265 |
+
' ': '\n',
|
9266 |
+
'	': '\t',
|
9267 |
+
''': "'"
|
9268 |
+
};
|
9269 |
+
var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
|
9270 |
+
var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
|
9271 |
+
|
9272 |
+
// #5992
|
9273 |
+
var isIgnoreNewlineTag = makeMap('pre,textarea', true);
|
9274 |
+
var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
|
9275 |
+
|
9276 |
+
function decodeAttr (value, shouldDecodeNewlines) {
|
9277 |
+
var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
|
9278 |
+
return value.replace(re, function (match) { return decodingMap[match]; })
|
9279 |
+
}
|
9280 |
+
|
9281 |
+
function parseHTML (html, options) {
|
9282 |
+
var stack = [];
|
9283 |
+
var expectHTML = options.expectHTML;
|
9284 |
+
var isUnaryTag$$1 = options.isUnaryTag || no;
|
9285 |
+
var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
|
9286 |
+
var index = 0;
|
9287 |
+
var last, lastTag;
|
9288 |
+
while (html) {
|
9289 |
+
last = html;
|
9290 |
+
// Make sure we're not in a plaintext content element like script/style
|
9291 |
+
if (!lastTag || !isPlainTextElement(lastTag)) {
|
9292 |
+
var textEnd = html.indexOf('<');
|
9293 |
+
if (textEnd === 0) {
|
9294 |
+
// Comment:
|
9295 |
+
if (comment.test(html)) {
|
9296 |
+
var commentEnd = html.indexOf('-->');
|
9297 |
+
|
9298 |
+
if (commentEnd >= 0) {
|
9299 |
+
if (options.shouldKeepComment) {
|
9300 |
+
options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
|
9301 |
+
}
|
9302 |
+
advance(commentEnd + 3);
|
9303 |
+
continue
|
9304 |
+
}
|
9305 |
+
}
|
9306 |
+
|
9307 |
+
// http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
|
9308 |
+
if (conditionalComment.test(html)) {
|
9309 |
+
var conditionalEnd = html.indexOf(']>');
|
9310 |
+
|
9311 |
+
if (conditionalEnd >= 0) {
|
9312 |
+
advance(conditionalEnd + 2);
|
9313 |
+
continue
|
9314 |
+
}
|
9315 |
+
}
|
9316 |
+
|
9317 |
+
// Doctype:
|
9318 |
+
var doctypeMatch = html.match(doctype);
|
9319 |
+
if (doctypeMatch) {
|
9320 |
+
advance(doctypeMatch[0].length);
|
9321 |
+
continue
|
9322 |
+
}
|
9323 |
+
|
9324 |
+
// End tag:
|
9325 |
+
var endTagMatch = html.match(endTag);
|
9326 |
+
if (endTagMatch) {
|
9327 |
+
var curIndex = index;
|
9328 |
+
advance(endTagMatch[0].length);
|
9329 |
+
parseEndTag(endTagMatch[1], curIndex, index);
|
9330 |
+
continue
|
9331 |
+
}
|
9332 |
+
|
9333 |
+
// Start tag:
|
9334 |
+
var startTagMatch = parseStartTag();
|
9335 |
+
if (startTagMatch) {
|
9336 |
+
handleStartTag(startTagMatch);
|
9337 |
+
if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
|
9338 |
+
advance(1);
|
9339 |
+
}
|
9340 |
+
continue
|
9341 |
+
}
|
9342 |
+
}
|
9343 |
+
|
9344 |
+
var text = (void 0), rest = (void 0), next = (void 0);
|
9345 |
+
if (textEnd >= 0) {
|
9346 |
+
rest = html.slice(textEnd);
|
9347 |
+
while (
|
9348 |
+
!endTag.test(rest) &&
|
9349 |
+
!startTagOpen.test(rest) &&
|
9350 |
+
!comment.test(rest) &&
|
9351 |
+
!conditionalComment.test(rest)
|
9352 |
+
) {
|
9353 |
+
// < in plain text, be forgiving and treat it as text
|
9354 |
+
next = rest.indexOf('<', 1);
|
9355 |
+
if (next < 0) { break }
|
9356 |
+
textEnd += next;
|
9357 |
+
rest = html.slice(textEnd);
|
9358 |
+
}
|
9359 |
+
text = html.substring(0, textEnd);
|
9360 |
+
}
|
9361 |
+
|
9362 |
+
if (textEnd < 0) {
|
9363 |
+
text = html;
|
9364 |
+
}
|
9365 |
+
|
9366 |
+
if (text) {
|
9367 |
+
advance(text.length);
|
9368 |
+
}
|
9369 |
+
|
9370 |
+
if (options.chars && text) {
|
9371 |
+
options.chars(text, index - text.length, index);
|
9372 |
+
}
|
9373 |
+
} else {
|
9374 |
+
var endTagLength = 0;
|
9375 |
+
var stackedTag = lastTag.toLowerCase();
|
9376 |
+
var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
|
9377 |
+
var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
|
9378 |
+
endTagLength = endTag.length;
|
9379 |
+
if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
|
9380 |
+
text = text
|
9381 |
+
.replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
|
9382 |
+
.replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
|
9383 |
+
}
|
9384 |
+
if (shouldIgnoreFirstNewline(stackedTag, text)) {
|
9385 |
+
text = text.slice(1);
|
9386 |
+
}
|
9387 |
+
if (options.chars) {
|
9388 |
+
options.chars(text);
|
9389 |
+
}
|
9390 |
+
return ''
|
9391 |
+
});
|
9392 |
+
index += html.length - rest$1.length;
|
9393 |
+
html = rest$1;
|
9394 |
+
parseEndTag(stackedTag, index - endTagLength, index);
|
9395 |
+
}
|
9396 |
+
|
9397 |
+
if (html === last) {
|
9398 |
+
options.chars && options.chars(html);
|
9399 |
+
if (!stack.length && options.warn) {
|
9400 |
+
options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
|
9401 |
+
}
|
9402 |
+
break
|
9403 |
+
}
|
9404 |
+
}
|
9405 |
+
|
9406 |
+
// Clean up any remaining tags
|
9407 |
+
parseEndTag();
|
9408 |
+
|
9409 |
+
function advance (n) {
|
9410 |
+
index += n;
|
9411 |
+
html = html.substring(n);
|
9412 |
+
}
|
9413 |
+
|
9414 |
+
function parseStartTag () {
|
9415 |
+
var start = html.match(startTagOpen);
|
9416 |
+
if (start) {
|
9417 |
+
var match = {
|
9418 |
+
tagName: start[1],
|
9419 |
+
attrs: [],
|
9420 |
+
start: index
|
9421 |
+
};
|
9422 |
+
advance(start[0].length);
|
9423 |
+
var end, attr;
|
9424 |
+
while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
|
9425 |
+
attr.start = index;
|
9426 |
+
advance(attr[0].length);
|
9427 |
+
attr.end = index;
|
9428 |
+
match.attrs.push(attr);
|
9429 |
+
}
|
9430 |
+
if (end) {
|
9431 |
+
match.unarySlash = end[1];
|
9432 |
+
advance(end[0].length);
|
9433 |
+
match.end = index;
|
9434 |
+
return match
|
9435 |
+
}
|
9436 |
+
}
|
9437 |
+
}
|
9438 |
+
|
9439 |
+
function handleStartTag (match) {
|
9440 |
+
var tagName = match.tagName;
|
9441 |
+
var unarySlash = match.unarySlash;
|
9442 |
+
|
9443 |
+
if (expectHTML) {
|
9444 |
+
if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
|
9445 |
+
parseEndTag(lastTag);
|
9446 |
+
}
|
9447 |
+
if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
|
9448 |
+
parseEndTag(tagName);
|
9449 |
+
}
|
9450 |
+
}
|
9451 |
+
|
9452 |
+
var unary = isUnaryTag$$1(tagName) || !!unarySlash;
|
9453 |
+
|
9454 |
+
var l = match.attrs.length;
|
9455 |
+
var attrs = new Array(l);
|
9456 |
+
for (var i = 0; i < l; i++) {
|
9457 |
+
var args = match.attrs[i];
|
9458 |
+
var value = args[3] || args[4] || args[5] || '';
|
9459 |
+
var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
|
9460 |
+
? options.shouldDecodeNewlinesForHref
|
9461 |
+
: options.shouldDecodeNewlines;
|
9462 |
+
attrs[i] = {
|
9463 |
+
name: args[1],
|
9464 |
+
value: decodeAttr(value, shouldDecodeNewlines)
|
9465 |
+
};
|
9466 |
+
if (options.outputSourceRange) {
|
9467 |
+
attrs[i].start = args.start + args[0].match(/^\s*/).length;
|
9468 |
+
attrs[i].end = args.end;
|
9469 |
+
}
|
9470 |
+
}
|
9471 |
+
|
9472 |
+
if (!unary) {
|
9473 |
+
stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
|
9474 |
+
lastTag = tagName;
|
9475 |
+
}
|
9476 |
+
|
9477 |
+
if (options.start) {
|
9478 |
+
options.start(tagName, attrs, unary, match.start, match.end);
|
9479 |
+
}
|
9480 |
+
}
|
9481 |
+
|
9482 |
+
function parseEndTag (tagName, start, end) {
|
9483 |
+
var pos, lowerCasedTagName;
|
9484 |
+
if (start == null) { start = index; }
|
9485 |
+
if (end == null) { end = index; }
|
9486 |
+
|
9487 |
+
// Find the closest opened tag of the same type
|
9488 |
+
if (tagName) {
|
9489 |
+
lowerCasedTagName = tagName.toLowerCase();
|
9490 |
+
for (pos = stack.length - 1; pos >= 0; pos--) {
|
9491 |
+
if (stack[pos].lowerCasedTag === lowerCasedTagName) {
|
9492 |
+
break
|
9493 |
+
}
|
9494 |
+
}
|
9495 |
+
} else {
|
9496 |
+
// If no tag name is provided, clean shop
|
9497 |
+
pos = 0;
|
9498 |
+
}
|
9499 |
+
|
9500 |
+
if (pos >= 0) {
|
9501 |
+
// Close all the open elements, up the stack
|
9502 |
+
for (var i = stack.length - 1; i >= pos; i--) {
|
9503 |
+
if (i > pos || !tagName &&
|
9504 |
+
options.warn
|
9505 |
+
) {
|
9506 |
+
options.warn(
|
9507 |
+
("tag <" + (stack[i].tag) + "> has no matching end tag."),
|
9508 |
+
{ start: stack[i].start, end: stack[i].end }
|
9509 |
+
);
|
9510 |
+
}
|
9511 |
+
if (options.end) {
|
9512 |
+
options.end(stack[i].tag, start, end);
|
9513 |
+
}
|
9514 |
+
}
|
9515 |
+
|
9516 |
+
// Remove the open elements from the stack
|
9517 |
+
stack.length = pos;
|
9518 |
+
lastTag = pos && stack[pos - 1].tag;
|
9519 |
+
} else if (lowerCasedTagName === 'br') {
|
9520 |
+
if (options.start) {
|
9521 |
+
options.start(tagName, [], true, start, end);
|
9522 |
+
}
|
9523 |
+
} else if (lowerCasedTagName === 'p') {
|
9524 |
+
if (options.start) {
|
9525 |
+
options.start(tagName, [], false, start, end);
|
9526 |
+
}
|
9527 |
+
if (options.end) {
|
9528 |
+
options.end(tagName, start, end);
|
9529 |
+
}
|
9530 |
+
}
|
9531 |
+
}
|
9532 |
+
}
|
9533 |
+
|
9534 |
+
/* */
|
9535 |
+
|
9536 |
+
var onRE = /^@|^v-on:/;
|
9537 |
+
var dirRE = /^v-|^@|^:/;
|
9538 |
+
var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
|
9539 |
+
var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
|
9540 |
+
var stripParensRE = /^\(|\)$/g;
|
9541 |
+
var dynamicArgRE = /^\[.*\]$/;
|
9542 |
+
|
9543 |
+
var argRE = /:(.*)$/;
|
9544 |
+
var bindRE = /^:|^\.|^v-bind:/;
|
9545 |
+
var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
|
9546 |
+
|
9547 |
+
var slotRE = /^v-slot(:|$)|^#/;
|
9548 |
+
|
9549 |
+
var lineBreakRE = /[\r\n]/;
|
9550 |
+
var whitespaceRE$1 = /\s+/g;
|
9551 |
+
|
9552 |
+
var invalidAttributeRE = /[\s"'<>\/=]/;
|
9553 |
+
|
9554 |
+
var decodeHTMLCached = cached(he.decode);
|
9555 |
+
|
9556 |
+
var emptySlotScopeToken = "_empty_";
|
9557 |
+
|
9558 |
+
// configurable state
|
9559 |
+
var warn$2;
|
9560 |
+
var delimiters;
|
9561 |
+
var transforms;
|
9562 |
+
var preTransforms;
|
9563 |
+
var postTransforms;
|
9564 |
+
var platformIsPreTag;
|
9565 |
+
var platformMustUseProp;
|
9566 |
+
var platformGetTagNamespace;
|
9567 |
+
var maybeComponent;
|
9568 |
+
|
9569 |
+
function createASTElement (
|
9570 |
+
tag,
|
9571 |
+
attrs,
|
9572 |
+
parent
|
9573 |
+
) {
|
9574 |
+
return {
|
9575 |
+
type: 1,
|
9576 |
+
tag: tag,
|
9577 |
+
attrsList: attrs,
|
9578 |
+
attrsMap: makeAttrsMap(attrs),
|
9579 |
+
rawAttrsMap: {},
|
9580 |
+
parent: parent,
|
9581 |
+
children: []
|
9582 |
+
}
|
9583 |
+
}
|
9584 |
+
|
9585 |
+
/**
|
9586 |
+
* Convert HTML string to AST.
|
9587 |
+
*/
|
9588 |
+
function parse (
|
9589 |
+
template,
|
9590 |
+
options
|
9591 |
+
) {
|
9592 |
+
warn$2 = options.warn || baseWarn;
|
9593 |
+
|
9594 |
+
platformIsPreTag = options.isPreTag || no;
|
9595 |
+
platformMustUseProp = options.mustUseProp || no;
|
9596 |
+
platformGetTagNamespace = options.getTagNamespace || no;
|
9597 |
+
var isReservedTag = options.isReservedTag || no;
|
9598 |
+
maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
9599 |
+
|
9600 |
+
transforms = pluckModuleFunction(options.modules, 'transformNode');
|
9601 |
+
preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
|
9602 |
+
postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
|
9603 |
+
|
9604 |
+
delimiters = options.delimiters;
|
9605 |
+
|
9606 |
+
var stack = [];
|
9607 |
+
var preserveWhitespace = options.preserveWhitespace !== false;
|
9608 |
+
var whitespaceOption = options.whitespace;
|
9609 |
+
var root;
|
9610 |
+
var currentParent;
|
9611 |
+
var inVPre = false;
|
9612 |
+
var inPre = false;
|
9613 |
+
var warned = false;
|
9614 |
+
|
9615 |
+
function warnOnce (msg, range) {
|
9616 |
+
if (!warned) {
|
9617 |
+
warned = true;
|
9618 |
+
warn$2(msg, range);
|
9619 |
+
}
|
9620 |
+
}
|
9621 |
+
|
9622 |
+
function closeElement (element) {
|
9623 |
+
trimEndingWhitespace(element);
|
9624 |
+
if (!inVPre && !element.processed) {
|
9625 |
+
element = processElement(element, options);
|
9626 |
+
}
|
9627 |
+
// tree management
|
9628 |
+
if (!stack.length && element !== root) {
|
9629 |
+
// allow root elements with v-if, v-else-if and v-else
|
9630 |
+
if (root.if && (element.elseif || element.else)) {
|
9631 |
+
{
|
9632 |
+
checkRootConstraints(element);
|
9633 |
+
}
|
9634 |
+
addIfCondition(root, {
|
9635 |
+
exp: element.elseif,
|
9636 |
+
block: element
|
9637 |
+
});
|
9638 |
+
} else {
|
9639 |
+
warnOnce(
|
9640 |
+
"Component template should contain exactly one root element. " +
|
9641 |
+
"If you are using v-if on multiple elements, " +
|
9642 |
+
"use v-else-if to chain them instead.",
|
9643 |
+
{ start: element.start }
|
9644 |
+
);
|
9645 |
+
}
|
9646 |
+
}
|
9647 |
+
if (currentParent && !element.forbidden) {
|
9648 |
+
if (element.elseif || element.else) {
|
9649 |
+
processIfConditions(element, currentParent);
|
9650 |
+
} else {
|
9651 |
+
if (element.slotScope) {
|
9652 |
+
// scoped slot
|
9653 |
+
// keep it in the children list so that v-else(-if) conditions can
|
9654 |
+
// find it as the prev node.
|
9655 |
+
var name = element.slotTarget || '"default"'
|
9656 |
+
;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
|
9657 |
+
}
|
9658 |
+
currentParent.children.push(element);
|
9659 |
+
element.parent = currentParent;
|
9660 |
+
}
|
9661 |
+
}
|
9662 |
+
|
9663 |
+
// final children cleanup
|
9664 |
+
// filter out scoped slots
|
9665 |
+
element.children = element.children.filter(function (c) { return !(c).slotScope; });
|
9666 |
+
// remove trailing whitespace node again
|
9667 |
+
trimEndingWhitespace(element);
|
9668 |
+
|
9669 |
+
// check pre state
|
9670 |
+
if (element.pre) {
|
9671 |
+
inVPre = false;
|
9672 |
+
}
|
9673 |
+
if (platformIsPreTag(element.tag)) {
|
9674 |
+
inPre = false;
|
9675 |
+
}
|
9676 |
+
// apply post-transforms
|
9677 |
+
for (var i = 0; i < postTransforms.length; i++) {
|
9678 |
+
postTransforms[i](element, options);
|
9679 |
+
}
|
9680 |
+
}
|
9681 |
+
|
9682 |
+
function trimEndingWhitespace (el) {
|
9683 |
+
// remove trailing whitespace node
|
9684 |
+
if (!inPre) {
|
9685 |
+
var lastNode;
|
9686 |
+
while (
|
9687 |
+
(lastNode = el.children[el.children.length - 1]) &&
|
9688 |
+
lastNode.type === 3 &&
|
9689 |
+
lastNode.text === ' '
|
9690 |
+
) {
|
9691 |
+
el.children.pop();
|
9692 |
+
}
|
9693 |
+
}
|
9694 |
+
}
|
9695 |
+
|
9696 |
+
function checkRootConstraints (el) {
|
9697 |
+
if (el.tag === 'slot' || el.tag === 'template') {
|
9698 |
+
warnOnce(
|
9699 |
+
"Cannot use <" + (el.tag) + "> as component root element because it may " +
|
9700 |
+
'contain multiple nodes.',
|
9701 |
+
{ start: el.start }
|
9702 |
+
);
|
9703 |
+
}
|
9704 |
+
if (el.attrsMap.hasOwnProperty('v-for')) {
|
9705 |
+
warnOnce(
|
9706 |
+
'Cannot use v-for on stateful component root element because ' +
|
9707 |
+
'it renders multiple elements.',
|
9708 |
+
el.rawAttrsMap['v-for']
|
9709 |
+
);
|
9710 |
+
}
|
9711 |
+
}
|
9712 |
+
|
9713 |
+
parseHTML(template, {
|
9714 |
+
warn: warn$2,
|
9715 |
+
expectHTML: options.expectHTML,
|
9716 |
+
isUnaryTag: options.isUnaryTag,
|
9717 |
+
canBeLeftOpenTag: options.canBeLeftOpenTag,
|
9718 |
+
shouldDecodeNewlines: options.shouldDecodeNewlines,
|
9719 |
+
shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
|
9720 |
+
shouldKeepComment: options.comments,
|
9721 |
+
outputSourceRange: options.outputSourceRange,
|
9722 |
+
start: function start (tag, attrs, unary, start$1, end) {
|
9723 |
+
// check namespace.
|
9724 |
+
// inherit parent ns if there is one
|
9725 |
+
var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
|
9726 |
+
|
9727 |
+
// handle IE svg bug
|
9728 |
+
/* istanbul ignore if */
|
9729 |
+
if (isIE && ns === 'svg') {
|
9730 |
+
attrs = guardIESVGBug(attrs);
|
9731 |
+
}
|
9732 |
+
|
9733 |
+
var element = createASTElement(tag, attrs, currentParent);
|
9734 |
+
if (ns) {
|
9735 |
+
element.ns = ns;
|
9736 |
+
}
|
9737 |
+
|
9738 |
+
{
|
9739 |
+
if (options.outputSourceRange) {
|
9740 |
+
element.start = start$1;
|
9741 |
+
element.end = end;
|
9742 |
+
element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
|
9743 |
+
cumulated[attr.name] = attr;
|
9744 |
+
return cumulated
|
9745 |
+
}, {});
|
9746 |
+
}
|
9747 |
+
attrs.forEach(function (attr) {
|
9748 |
+
if (invalidAttributeRE.test(attr.name)) {
|
9749 |
+
warn$2(
|
9750 |
+
"Invalid dynamic argument expression: attribute names cannot contain " +
|
9751 |
+
"spaces, quotes, <, >, / or =.",
|
9752 |
+
{
|
9753 |
+
start: attr.start + attr.name.indexOf("["),
|
9754 |
+
end: attr.start + attr.name.length
|
9755 |
+
}
|
9756 |
+
);
|
9757 |
+
}
|
9758 |
+
});
|
9759 |
+
}
|
9760 |
+
|
9761 |
+
if (isForbiddenTag(element) && !isServerRendering()) {
|
9762 |
+
element.forbidden = true;
|
9763 |
+
warn$2(
|
9764 |
+
'Templates should only be responsible for mapping the state to the ' +
|
9765 |
+
'UI. Avoid placing tags with side-effects in your templates, such as ' +
|
9766 |
+
"<" + tag + ">" + ', as they will not be parsed.',
|
9767 |
+
{ start: element.start }
|
9768 |
+
);
|
9769 |
+
}
|
9770 |
+
|
9771 |
+
// apply pre-transforms
|
9772 |
+
for (var i = 0; i < preTransforms.length; i++) {
|
9773 |
+
element = preTransforms[i](element, options) || element;
|
9774 |
+
}
|
9775 |
+
|
9776 |
+
if (!inVPre) {
|
9777 |
+
processPre(element);
|
9778 |
+
if (element.pre) {
|
9779 |
+
inVPre = true;
|
9780 |
+
}
|
9781 |
+
}
|
9782 |
+
if (platformIsPreTag(element.tag)) {
|
9783 |
+
inPre = true;
|
9784 |
+
}
|
9785 |
+
if (inVPre) {
|
9786 |
+
processRawAttrs(element);
|
9787 |
+
} else if (!element.processed) {
|
9788 |
+
// structural directives
|
9789 |
+
processFor(element);
|
9790 |
+
processIf(element);
|
9791 |
+
processOnce(element);
|
9792 |
+
}
|
9793 |
+
|
9794 |
+
if (!root) {
|
9795 |
+
root = element;
|
9796 |
+
{
|
9797 |
+
checkRootConstraints(root);
|
9798 |
+
}
|
9799 |
+
}
|
9800 |
+
|
9801 |
+
if (!unary) {
|
9802 |
+
currentParent = element;
|
9803 |
+
stack.push(element);
|
9804 |
+
} else {
|
9805 |
+
closeElement(element);
|
9806 |
+
}
|
9807 |
+
},
|
9808 |
+
|
9809 |
+
end: function end (tag, start, end$1) {
|
9810 |
+
var element = stack[stack.length - 1];
|
9811 |
+
// pop stack
|
9812 |
+
stack.length -= 1;
|
9813 |
+
currentParent = stack[stack.length - 1];
|
9814 |
+
if (options.outputSourceRange) {
|
9815 |
+
element.end = end$1;
|
9816 |
+
}
|
9817 |
+
closeElement(element);
|
9818 |
+
},
|
9819 |
+
|
9820 |
+
chars: function chars (text, start, end) {
|
9821 |
+
if (!currentParent) {
|
9822 |
+
{
|
9823 |
+
if (text === template) {
|
9824 |
+
warnOnce(
|
9825 |
+
'Component template requires a root element, rather than just text.',
|
9826 |
+
{ start: start }
|
9827 |
+
);
|
9828 |
+
} else if ((text = text.trim())) {
|
9829 |
+
warnOnce(
|
9830 |
+
("text \"" + text + "\" outside root element will be ignored."),
|
9831 |
+
{ start: start }
|
9832 |
+
);
|
9833 |
+
}
|
9834 |
+
}
|
9835 |
+
return
|
9836 |
+
}
|
9837 |
+
// IE textarea placeholder bug
|
9838 |
+
/* istanbul ignore if */
|
9839 |
+
if (isIE &&
|
9840 |
+
currentParent.tag === 'textarea' &&
|
9841 |
+
currentParent.attrsMap.placeholder === text
|
9842 |
+
) {
|
9843 |
+
return
|
9844 |
+
}
|
9845 |
+
var children = currentParent.children;
|
9846 |
+
if (inPre || text.trim()) {
|
9847 |
+
text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
|
9848 |
+
} else if (!children.length) {
|
9849 |
+
// remove the whitespace-only node right after an opening tag
|
9850 |
+
text = '';
|
9851 |
+
} else if (whitespaceOption) {
|
9852 |
+
if (whitespaceOption === 'condense') {
|
9853 |
+
// in condense mode, remove the whitespace node if it contains
|
9854 |
+
// line break, otherwise condense to a single space
|
9855 |
+
text = lineBreakRE.test(text) ? '' : ' ';
|
9856 |
+
} else {
|
9857 |
+
text = ' ';
|
9858 |
+
}
|
9859 |
+
} else {
|
9860 |
+
text = preserveWhitespace ? ' ' : '';
|
9861 |
+
}
|
9862 |
+
if (text) {
|
9863 |
+
if (!inPre && whitespaceOption === 'condense') {
|
9864 |
+
// condense consecutive whitespaces into single space
|
9865 |
+
text = text.replace(whitespaceRE$1, ' ');
|
9866 |
+
}
|
9867 |
+
var res;
|
9868 |
+
var child;
|
9869 |
+
if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
|
9870 |
+
child = {
|
9871 |
+
type: 2,
|
9872 |
+
expression: res.expression,
|
9873 |
+
tokens: res.tokens,
|
9874 |
+
text: text
|
9875 |
+
};
|
9876 |
+
} else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
|
9877 |
+
child = {
|
9878 |
+
type: 3,
|
9879 |
+
text: text
|
9880 |
+
};
|
9881 |
+
}
|
9882 |
+
if (child) {
|
9883 |
+
if (options.outputSourceRange) {
|
9884 |
+
child.start = start;
|
9885 |
+
child.end = end;
|
9886 |
+
}
|
9887 |
+
children.push(child);
|
9888 |
+
}
|
9889 |
+
}
|
9890 |
+
},
|
9891 |
+
comment: function comment (text, start, end) {
|
9892 |
+
// adding anyting as a sibling to the root node is forbidden
|
9893 |
+
// comments should still be allowed, but ignored
|
9894 |
+
if (currentParent) {
|
9895 |
+
var child = {
|
9896 |
+
type: 3,
|
9897 |
+
text: text,
|
9898 |
+
isComment: true
|
9899 |
+
};
|
9900 |
+
if (options.outputSourceRange) {
|
9901 |
+
child.start = start;
|
9902 |
+
child.end = end;
|
9903 |
+
}
|
9904 |
+
currentParent.children.push(child);
|
9905 |
+
}
|
9906 |
+
}
|
9907 |
+
});
|
9908 |
+
return root
|
9909 |
+
}
|
9910 |
+
|
9911 |
+
function processPre (el) {
|
9912 |
+
if (getAndRemoveAttr(el, 'v-pre') != null) {
|
9913 |
+
el.pre = true;
|
9914 |
+
}
|
9915 |
+
}
|
9916 |
+
|
9917 |
+
function processRawAttrs (el) {
|
9918 |
+
var list = el.attrsList;
|
9919 |
+
var len = list.length;
|
9920 |
+
if (len) {
|
9921 |
+
var attrs = el.attrs = new Array(len);
|
9922 |
+
for (var i = 0; i < len; i++) {
|
9923 |
+
attrs[i] = {
|
9924 |
+
name: list[i].name,
|
9925 |
+
value: JSON.stringify(list[i].value)
|
9926 |
+
};
|
9927 |
+
if (list[i].start != null) {
|
9928 |
+
attrs[i].start = list[i].start;
|
9929 |
+
attrs[i].end = list[i].end;
|
9930 |
+
}
|
9931 |
+
}
|
9932 |
+
} else if (!el.pre) {
|
9933 |
+
// non root node in pre blocks with no attributes
|
9934 |
+
el.plain = true;
|
9935 |
+
}
|
9936 |
+
}
|
9937 |
+
|
9938 |
+
function processElement (
|
9939 |
+
element,
|
9940 |
+
options
|
9941 |
+
) {
|
9942 |
+
processKey(element);
|
9943 |
+
|
9944 |
+
// determine whether this is a plain element after
|
9945 |
+
// removing structural attributes
|
9946 |
+
element.plain = (
|
9947 |
+
!element.key &&
|
9948 |
+
!element.scopedSlots &&
|
9949 |
+
!element.attrsList.length
|
9950 |
+
);
|
9951 |
+
|
9952 |
+
processRef(element);
|
9953 |
+
processSlotContent(element);
|
9954 |
+
processSlotOutlet(element);
|
9955 |
+
processComponent(element);
|
9956 |
+
for (var i = 0; i < transforms.length; i++) {
|
9957 |
+
element = transforms[i](element, options) || element;
|
9958 |
+
}
|
9959 |
+
processAttrs(element);
|
9960 |
+
return element
|
9961 |
+
}
|
9962 |
+
|
9963 |
+
function processKey (el) {
|
9964 |
+
var exp = getBindingAttr(el, 'key');
|
9965 |
+
if (exp) {
|
9966 |
+
{
|
9967 |
+
if (el.tag === 'template') {
|
9968 |
+
warn$2(
|
9969 |
+
"<template> cannot be keyed. Place the key on real elements instead.",
|
9970 |
+
getRawBindingAttr(el, 'key')
|
9971 |
+
);
|
9972 |
+
}
|
9973 |
+
if (el.for) {
|
9974 |
+
var iterator = el.iterator2 || el.iterator1;
|
9975 |
+
var parent = el.parent;
|
9976 |
+
if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
|
9977 |
+
warn$2(
|
9978 |
+
"Do not use v-for index as key on <transition-group> children, " +
|
9979 |
+
"this is the same as not using keys.",
|
9980 |
+
getRawBindingAttr(el, 'key'),
|
9981 |
+
true /* tip */
|
9982 |
+
);
|
9983 |
+
}
|
9984 |
+
}
|
9985 |
+
}
|
9986 |
+
el.key = exp;
|
9987 |
+
}
|
9988 |
+
}
|
9989 |
+
|
9990 |
+
function processRef (el) {
|
9991 |
+
var ref = getBindingAttr(el, 'ref');
|
9992 |
+
if (ref) {
|
9993 |
+
el.ref = ref;
|
9994 |
+
el.refInFor = checkInFor(el);
|
9995 |
+
}
|
9996 |
+
}
|
9997 |
+
|
9998 |
+
function processFor (el) {
|
9999 |
+
var exp;
|
10000 |
+
if ((exp = getAndRemoveAttr(el, 'v-for'))) {
|
10001 |
+
var res = parseFor(exp);
|
10002 |
+
if (res) {
|
10003 |
+
extend(el, res);
|
10004 |
+
} else {
|
10005 |
+
warn$2(
|
10006 |
+
("Invalid v-for expression: " + exp),
|
10007 |
+
el.rawAttrsMap['v-for']
|
10008 |
+
);
|
10009 |
+
}
|
10010 |
+
}
|
10011 |
+
}
|
10012 |
+
|
10013 |
+
|
10014 |
+
|
10015 |
+
function parseFor (exp) {
|
10016 |
+
var inMatch = exp.match(forAliasRE);
|
10017 |
+
if (!inMatch) { return }
|
10018 |
+
var res = {};
|
10019 |
+
res.for = inMatch[2].trim();
|
10020 |
+
var alias = inMatch[1].trim().replace(stripParensRE, '');
|
10021 |
+
var iteratorMatch = alias.match(forIteratorRE);
|
10022 |
+
if (iteratorMatch) {
|
10023 |
+
res.alias = alias.replace(forIteratorRE, '').trim();
|
10024 |
+
res.iterator1 = iteratorMatch[1].trim();
|
10025 |
+
if (iteratorMatch[2]) {
|
10026 |
+
res.iterator2 = iteratorMatch[2].trim();
|
10027 |
+
}
|
10028 |
+
} else {
|
10029 |
+
res.alias = alias;
|
10030 |
+
}
|
10031 |
+
return res
|
10032 |
+
}
|
10033 |
+
|
10034 |
+
function processIf (el) {
|
10035 |
+
var exp = getAndRemoveAttr(el, 'v-if');
|
10036 |
+
if (exp) {
|
10037 |
+
el.if = exp;
|
10038 |
+
addIfCondition(el, {
|
10039 |
+
exp: exp,
|
10040 |
+
block: el
|
10041 |
+
});
|
10042 |
+
} else {
|
10043 |
+
if (getAndRemoveAttr(el, 'v-else') != null) {
|
10044 |
+
el.else = true;
|
10045 |
+
}
|
10046 |
+
var elseif = getAndRemoveAttr(el, 'v-else-if');
|
10047 |
+
if (elseif) {
|
10048 |
+
el.elseif = elseif;
|
10049 |
+
}
|
10050 |
+
}
|
10051 |
+
}
|
10052 |
+
|
10053 |
+
function processIfConditions (el, parent) {
|
10054 |
+
var prev = findPrevElement(parent.children);
|
10055 |
+
if (prev && prev.if) {
|
10056 |
+
addIfCondition(prev, {
|
10057 |
+
exp: el.elseif,
|
10058 |
+
block: el
|
10059 |
+
});
|
10060 |
+
} else {
|
10061 |
+
warn$2(
|
10062 |
+
"v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
|
10063 |
+
"used on element <" + (el.tag) + "> without corresponding v-if.",
|
10064 |
+
el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
|
10065 |
+
);
|
10066 |
+
}
|
10067 |
+
}
|
10068 |
+
|
10069 |
+
function findPrevElement (children) {
|
10070 |
+
var i = children.length;
|
10071 |
+
while (i--) {
|
10072 |
+
if (children[i].type === 1) {
|
10073 |
+
return children[i]
|
10074 |
+
} else {
|
10075 |
+
if (children[i].text !== ' ') {
|
10076 |
+
warn$2(
|
10077 |
+
"text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
|
10078 |
+
"will be ignored.",
|
10079 |
+
children[i]
|
10080 |
+
);
|
10081 |
+
}
|
10082 |
+
children.pop();
|
10083 |
+
}
|
10084 |
+
}
|
10085 |
+
}
|
10086 |
+
|
10087 |
+
function addIfCondition (el, condition) {
|
10088 |
+
if (!el.ifConditions) {
|
10089 |
+
el.ifConditions = [];
|
10090 |
+
}
|
10091 |
+
el.ifConditions.push(condition);
|
10092 |
+
}
|
10093 |
+
|
10094 |
+
function processOnce (el) {
|
10095 |
+
var once$$1 = getAndRemoveAttr(el, 'v-once');
|
10096 |
+
if (once$$1 != null) {
|
10097 |
+
el.once = true;
|
10098 |
+
}
|
10099 |
+
}
|
10100 |
+
|
10101 |
+
// handle content being passed to a component as slot,
|
10102 |
+
// e.g. <template slot="xxx">, <div slot-scope="xxx">
|
10103 |
+
function processSlotContent (el) {
|
10104 |
+
var slotScope;
|
10105 |
+
if (el.tag === 'template') {
|
10106 |
+
slotScope = getAndRemoveAttr(el, 'scope');
|
10107 |
+
/* istanbul ignore if */
|
10108 |
+
if (slotScope) {
|
10109 |
+
warn$2(
|
10110 |
+
"the \"scope\" attribute for scoped slots have been deprecated and " +
|
10111 |
+
"replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
|
10112 |
+
"can also be used on plain elements in addition to <template> to " +
|
10113 |
+
"denote scoped slots.",
|
10114 |
+
el.rawAttrsMap['scope'],
|
10115 |
+
true
|
10116 |
+
);
|
10117 |
+
}
|
10118 |
+
el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
|
10119 |
+
} else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
|
10120 |
+
/* istanbul ignore if */
|
10121 |
+
if (el.attrsMap['v-for']) {
|
10122 |
+
warn$2(
|
10123 |
+
"Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
|
10124 |
+
"(v-for takes higher priority). Use a wrapper <template> for the " +
|
10125 |
+
"scoped slot to make it clearer.",
|
10126 |
+
el.rawAttrsMap['slot-scope'],
|
10127 |
+
true
|
10128 |
+
);
|
10129 |
+
}
|
10130 |
+
el.slotScope = slotScope;
|
10131 |
+
}
|
10132 |
+
|
10133 |
+
// slot="xxx"
|
10134 |
+
var slotTarget = getBindingAttr(el, 'slot');
|
10135 |
+
if (slotTarget) {
|
10136 |
+
el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
|
10137 |
+
el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
|
10138 |
+
// preserve slot as an attribute for native shadow DOM compat
|
10139 |
+
// only for non-scoped slots.
|
10140 |
+
if (el.tag !== 'template' && !el.slotScope) {
|
10141 |
+
addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
|
10142 |
+
}
|
10143 |
+
}
|
10144 |
+
|
10145 |
+
// 2.6 v-slot syntax
|
10146 |
+
{
|
10147 |
+
if (el.tag === 'template') {
|
10148 |
+
// v-slot on <template>
|
10149 |
+
var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
|
10150 |
+
if (slotBinding) {
|
10151 |
+
{
|
10152 |
+
if (el.slotTarget || el.slotScope) {
|
10153 |
+
warn$2(
|
10154 |
+
"Unexpected mixed usage of different slot syntaxes.",
|
10155 |
+
el
|
10156 |
+
);
|
10157 |
+
}
|
10158 |
+
if (el.parent && !maybeComponent(el.parent)) {
|
10159 |
+
warn$2(
|
10160 |
+
"<template v-slot> can only appear at the root level inside " +
|
10161 |
+
"the receiving the component",
|
10162 |
+
el
|
10163 |
+
);
|
10164 |
+
}
|
10165 |
+
}
|
10166 |
+
var ref = getSlotName(slotBinding);
|
10167 |
+
var name = ref.name;
|
10168 |
+
var dynamic = ref.dynamic;
|
10169 |
+
el.slotTarget = name;
|
10170 |
+
el.slotTargetDynamic = dynamic;
|
10171 |
+
el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
|
10172 |
+
}
|
10173 |
+
} else {
|
10174 |
+
// v-slot on component, denotes default slot
|
10175 |
+
var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
|
10176 |
+
if (slotBinding$1) {
|
10177 |
+
{
|
10178 |
+
if (!maybeComponent(el)) {
|
10179 |
+
warn$2(
|
10180 |
+
"v-slot can only be used on components or <template>.",
|
10181 |
+
slotBinding$1
|
10182 |
+
);
|
10183 |
+
}
|
10184 |
+
if (el.slotScope || el.slotTarget) {
|
10185 |
+
warn$2(
|
10186 |
+
"Unexpected mixed usage of different slot syntaxes.",
|
10187 |
+
el
|
10188 |
+
);
|
10189 |
+
}
|
10190 |
+
if (el.scopedSlots) {
|
10191 |
+
warn$2(
|
10192 |
+
"To avoid scope ambiguity, the default slot should also use " +
|
10193 |
+
"<template> syntax when there are other named slots.",
|
10194 |
+
slotBinding$1
|
10195 |
+
);
|
10196 |
+
}
|
10197 |
+
}
|
10198 |
+
// add the component's children to its default slot
|
10199 |
+
var slots = el.scopedSlots || (el.scopedSlots = {});
|
10200 |
+
var ref$1 = getSlotName(slotBinding$1);
|
10201 |
+
var name$1 = ref$1.name;
|
10202 |
+
var dynamic$1 = ref$1.dynamic;
|
10203 |
+
var slotContainer = slots[name$1] = createASTElement('template', [], el);
|
10204 |
+
slotContainer.slotTarget = name$1;
|
10205 |
+
slotContainer.slotTargetDynamic = dynamic$1;
|
10206 |
+
slotContainer.children = el.children.filter(function (c) {
|
10207 |
+
if (!c.slotScope) {
|
10208 |
+
c.parent = slotContainer;
|
10209 |
+
return true
|
10210 |
+
}
|
10211 |
+
});
|
10212 |
+
slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
|
10213 |
+
// remove children as they are returned from scopedSlots now
|
10214 |
+
el.children = [];
|
10215 |
+
// mark el non-plain so data gets generated
|
10216 |
+
el.plain = false;
|
10217 |
+
}
|
10218 |
+
}
|
10219 |
+
}
|
10220 |
+
}
|
10221 |
+
|
10222 |
+
function getSlotName (binding) {
|
10223 |
+
var name = binding.name.replace(slotRE, '');
|
10224 |
+
if (!name) {
|
10225 |
+
if (binding.name[0] !== '#') {
|
10226 |
+
name = 'default';
|
10227 |
+
} else {
|
10228 |
+
warn$2(
|
10229 |
+
"v-slot shorthand syntax requires a slot name.",
|
10230 |
+
binding
|
10231 |
+
);
|
10232 |
+
}
|
10233 |
+
}
|
10234 |
+
return dynamicArgRE.test(name)
|
10235 |
+
// dynamic [name]
|
10236 |
+
? { name: name.slice(1, -1), dynamic: true }
|
10237 |
+
// static name
|
10238 |
+
: { name: ("\"" + name + "\""), dynamic: false }
|
10239 |
+
}
|
10240 |
+
|
10241 |
+
// handle <slot/> outlets
|
10242 |
+
function processSlotOutlet (el) {
|
10243 |
+
if (el.tag === 'slot') {
|
10244 |
+
el.slotName = getBindingAttr(el, 'name');
|
10245 |
+
if (el.key) {
|
10246 |
+
warn$2(
|
10247 |
+
"`key` does not work on <slot> because slots are abstract outlets " +
|
10248 |
+
"and can possibly expand into multiple elements. " +
|
10249 |
+
"Use the key on a wrapping element instead.",
|
10250 |
+
getRawBindingAttr(el, 'key')
|
10251 |
+
);
|
10252 |
+
}
|
10253 |
+
}
|
10254 |
+
}
|
10255 |
+
|
10256 |
+
function processComponent (el) {
|
10257 |
+
var binding;
|
10258 |
+
if ((binding = getBindingAttr(el, 'is'))) {
|
10259 |
+
el.component = binding;
|
10260 |
+
}
|
10261 |
+
if (getAndRemoveAttr(el, 'inline-template') != null) {
|
10262 |
+
el.inlineTemplate = true;
|
10263 |
+
}
|
10264 |
+
}
|
10265 |
+
|
10266 |
+
function processAttrs (el) {
|
10267 |
+
var list = el.attrsList;
|
10268 |
+
var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
|
10269 |
+
for (i = 0, l = list.length; i < l; i++) {
|
10270 |
+
name = rawName = list[i].name;
|
10271 |
+
value = list[i].value;
|
10272 |
+
if (dirRE.test(name)) {
|
10273 |
+
// mark element as dynamic
|
10274 |
+
el.hasBindings = true;
|
10275 |
+
// modifiers
|
10276 |
+
modifiers = parseModifiers(name.replace(dirRE, ''));
|
10277 |
+
// support .foo shorthand syntax for the .prop modifier
|
10278 |
+
if (modifiers) {
|
10279 |
+
name = name.replace(modifierRE, '');
|
10280 |
+
}
|
10281 |
+
if (bindRE.test(name)) { // v-bind
|
10282 |
+
name = name.replace(bindRE, '');
|
10283 |
+
value = parseFilters(value);
|
10284 |
+
isDynamic = dynamicArgRE.test(name);
|
10285 |
+
if (isDynamic) {
|
10286 |
+
name = name.slice(1, -1);
|
10287 |
+
}
|
10288 |
+
if (
|
10289 |
+
value.trim().length === 0
|
10290 |
+
) {
|
10291 |
+
warn$2(
|
10292 |
+
("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
|
10293 |
+
);
|
10294 |
+
}
|
10295 |
+
if (modifiers) {
|
10296 |
+
if (modifiers.prop && !isDynamic) {
|
10297 |
+
name = camelize(name);
|
10298 |
+
if (name === 'innerHtml') { name = 'innerHTML'; }
|
10299 |
+
}
|
10300 |
+
if (modifiers.camel && !isDynamic) {
|
10301 |
+
name = camelize(name);
|
10302 |
+
}
|
10303 |
+
if (modifiers.sync) {
|
10304 |
+
syncGen = genAssignmentCode(value, "$event");
|
10305 |
+
if (!isDynamic) {
|
10306 |
+
addHandler(
|
10307 |
+
el,
|
10308 |
+
("update:" + (camelize(name))),
|
10309 |
+
syncGen,
|
10310 |
+
null,
|
10311 |
+
false,
|
10312 |
+
warn$2,
|
10313 |
+
list[i]
|
10314 |
+
);
|
10315 |
+
if (hyphenate(name) !== camelize(name)) {
|
10316 |
+
addHandler(
|
10317 |
+
el,
|
10318 |
+
("update:" + (hyphenate(name))),
|
10319 |
+
syncGen,
|
10320 |
+
null,
|
10321 |
+
false,
|
10322 |
+
warn$2,
|
10323 |
+
list[i]
|
10324 |
+
);
|
10325 |
+
}
|
10326 |
+
} else {
|
10327 |
+
// handler w/ dynamic event name
|
10328 |
+
addHandler(
|
10329 |
+
el,
|
10330 |
+
("\"update:\"+(" + name + ")"),
|
10331 |
+
syncGen,
|
10332 |
+
null,
|
10333 |
+
false,
|
10334 |
+
warn$2,
|
10335 |
+
list[i],
|
10336 |
+
true // dynamic
|
10337 |
+
);
|
10338 |
+
}
|
10339 |
+
}
|
10340 |
+
}
|
10341 |
+
if ((modifiers && modifiers.prop) || (
|
10342 |
+
!el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
|
10343 |
+
)) {
|
10344 |
+
addProp(el, name, value, list[i], isDynamic);
|
10345 |
+
} else {
|
10346 |
+
addAttr(el, name, value, list[i], isDynamic);
|
10347 |
+
}
|
10348 |
+
} else if (onRE.test(name)) { // v-on
|
10349 |
+
name = name.replace(onRE, '');
|
10350 |
+
isDynamic = dynamicArgRE.test(name);
|
10351 |
+
if (isDynamic) {
|
10352 |
+
name = name.slice(1, -1);
|
10353 |
+
}
|
10354 |
+
addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
|
10355 |
+
} else { // normal directives
|
10356 |
+
name = name.replace(dirRE, '');
|
10357 |
+
// parse arg
|
10358 |
+
var argMatch = name.match(argRE);
|
10359 |
+
var arg = argMatch && argMatch[1];
|
10360 |
+
isDynamic = false;
|
10361 |
+
if (arg) {
|
10362 |
+
name = name.slice(0, -(arg.length + 1));
|
10363 |
+
if (dynamicArgRE.test(arg)) {
|
10364 |
+
arg = arg.slice(1, -1);
|
10365 |
+
isDynamic = true;
|
10366 |
+
}
|
10367 |
+
}
|
10368 |
+
addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
|
10369 |
+
if (name === 'model') {
|
10370 |
+
checkForAliasModel(el, value);
|
10371 |
+
}
|
10372 |
+
}
|
10373 |
+
} else {
|
10374 |
+
// literal attribute
|
10375 |
+
{
|
10376 |
+
var res = parseText(value, delimiters);
|
10377 |
+
if (res) {
|
10378 |
+
warn$2(
|
10379 |
+
name + "=\"" + value + "\": " +
|
10380 |
+
'Interpolation inside attributes has been removed. ' +
|
10381 |
+
'Use v-bind or the colon shorthand instead. For example, ' +
|
10382 |
+
'instead of <div id="{{ val }}">, use <div :id="val">.',
|
10383 |
+
list[i]
|
10384 |
+
);
|
10385 |
+
}
|
10386 |
+
}
|
10387 |
+
addAttr(el, name, JSON.stringify(value), list[i]);
|
10388 |
+
// #6887 firefox doesn't update muted state if set via attribute
|
10389 |
+
// even immediately after element creation
|
10390 |
+
if (!el.component &&
|
10391 |
+
name === 'muted' &&
|
10392 |
+
platformMustUseProp(el.tag, el.attrsMap.type, name)) {
|
10393 |
+
addProp(el, name, 'true', list[i]);
|
10394 |
+
}
|
10395 |
+
}
|
10396 |
+
}
|
10397 |
+
}
|
10398 |
+
|
10399 |
+
function checkInFor (el) {
|
10400 |
+
var parent = el;
|
10401 |
+
while (parent) {
|
10402 |
+
if (parent.for !== undefined) {
|
10403 |
+
return true
|
10404 |
+
}
|
10405 |
+
parent = parent.parent;
|
10406 |
+
}
|
10407 |
+
return false
|
10408 |
+
}
|
10409 |
+
|
10410 |
+
function parseModifiers (name) {
|
10411 |
+
var match = name.match(modifierRE);
|
10412 |
+
if (match) {
|
10413 |
+
var ret = {};
|
10414 |
+
match.forEach(function (m) { ret[m.slice(1)] = true; });
|
10415 |
+
return ret
|
10416 |
+
}
|
10417 |
+
}
|
10418 |
+
|
10419 |
+
function makeAttrsMap (attrs) {
|
10420 |
+
var map = {};
|
10421 |
+
for (var i = 0, l = attrs.length; i < l; i++) {
|
10422 |
+
if (
|
10423 |
+
map[attrs[i].name] && !isIE && !isEdge
|
10424 |
+
) {
|
10425 |
+
warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
|
10426 |
+
}
|
10427 |
+
map[attrs[i].name] = attrs[i].value;
|
10428 |
+
}
|
10429 |
+
return map
|
10430 |
+
}
|
10431 |
+
|
10432 |
+
// for script (e.g. type="x/template") or style, do not decode content
|
10433 |
+
function isTextTag (el) {
|
10434 |
+
return el.tag === 'script' || el.tag === 'style'
|
10435 |
+
}
|
10436 |
+
|
10437 |
+
function isForbiddenTag (el) {
|
10438 |
+
return (
|
10439 |
+
el.tag === 'style' ||
|
10440 |
+
(el.tag === 'script' && (
|
10441 |
+
!el.attrsMap.type ||
|
10442 |
+
el.attrsMap.type === 'text/javascript'
|
10443 |
+
))
|
10444 |
+
)
|
10445 |
+
}
|
10446 |
+
|
10447 |
+
var ieNSBug = /^xmlns:NS\d+/;
|
10448 |
+
var ieNSPrefix = /^NS\d+:/;
|
10449 |
+
|
10450 |
+
/* istanbul ignore next */
|
10451 |
+
function guardIESVGBug (attrs) {
|
10452 |
+
var res = [];
|
10453 |
+
for (var i = 0; i < attrs.length; i++) {
|
10454 |
+
var attr = attrs[i];
|
10455 |
+
if (!ieNSBug.test(attr.name)) {
|
10456 |
+
attr.name = attr.name.replace(ieNSPrefix, '');
|
10457 |
+
res.push(attr);
|
10458 |
+
}
|
10459 |
+
}
|
10460 |
+
return res
|
10461 |
+
}
|
10462 |
+
|
10463 |
+
function checkForAliasModel (el, value) {
|
10464 |
+
var _el = el;
|
10465 |
+
while (_el) {
|
10466 |
+
if (_el.for && _el.alias === value) {
|
10467 |
+
warn$2(
|
10468 |
+
"<" + (el.tag) + " v-model=\"" + value + "\">: " +
|
10469 |
+
"You are binding v-model directly to a v-for iteration alias. " +
|
10470 |
+
"This will not be able to modify the v-for source array because " +
|
10471 |
+
"writing to the alias is like modifying a function local variable. " +
|
10472 |
+
"Consider using an array of objects and use v-model on an object property instead.",
|
10473 |
+
el.rawAttrsMap['v-model']
|
10474 |
+
);
|
10475 |
+
}
|
10476 |
+
_el = _el.parent;
|
10477 |
+
}
|
10478 |
+
}
|
10479 |
+
|
10480 |
+
/* */
|
10481 |
+
|
10482 |
+
function preTransformNode (el, options) {
|
10483 |
+
if (el.tag === 'input') {
|
10484 |
+
var map = el.attrsMap;
|
10485 |
+
if (!map['v-model']) {
|
10486 |
+
return
|
10487 |
+
}
|
10488 |
+
|
10489 |
+
var typeBinding;
|
10490 |
+
if (map[':type'] || map['v-bind:type']) {
|
10491 |
+
typeBinding = getBindingAttr(el, 'type');
|
10492 |
+
}
|
10493 |
+
if (!map.type && !typeBinding && map['v-bind']) {
|
10494 |
+
typeBinding = "(" + (map['v-bind']) + ").type";
|
10495 |
+
}
|
10496 |
+
|
10497 |
+
if (typeBinding) {
|
10498 |
+
var ifCondition = getAndRemoveAttr(el, 'v-if', true);
|
10499 |
+
var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
|
10500 |
+
var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
|
10501 |
+
var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
|
10502 |
+
// 1. checkbox
|
10503 |
+
var branch0 = cloneASTElement(el);
|
10504 |
+
// process for on the main node
|
10505 |
+
processFor(branch0);
|
10506 |
+
addRawAttr(branch0, 'type', 'checkbox');
|
10507 |
+
processElement(branch0, options);
|
10508 |
+
branch0.processed = true; // prevent it from double-processed
|
10509 |
+
branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
|
10510 |
+
addIfCondition(branch0, {
|
10511 |
+
exp: branch0.if,
|
10512 |
+
block: branch0
|
10513 |
+
});
|
10514 |
+
// 2. add radio else-if condition
|
10515 |
+
var branch1 = cloneASTElement(el);
|
10516 |
+
getAndRemoveAttr(branch1, 'v-for', true);
|
10517 |
+
addRawAttr(branch1, 'type', 'radio');
|
10518 |
+
processElement(branch1, options);
|
10519 |
+
addIfCondition(branch0, {
|
10520 |
+
exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
|
10521 |
+
block: branch1
|
10522 |
+
});
|
10523 |
+
// 3. other
|
10524 |
+
var branch2 = cloneASTElement(el);
|
10525 |
+
getAndRemoveAttr(branch2, 'v-for', true);
|
10526 |
+
addRawAttr(branch2, ':type', typeBinding);
|
10527 |
+
processElement(branch2, options);
|
10528 |
+
addIfCondition(branch0, {
|
10529 |
+
exp: ifCondition,
|
10530 |
+
block: branch2
|
10531 |
+
});
|
10532 |
+
|
10533 |
+
if (hasElse) {
|
10534 |
+
branch0.else = true;
|
10535 |
+
} else if (elseIfCondition) {
|
10536 |
+
branch0.elseif = elseIfCondition;
|
10537 |
+
}
|
10538 |
+
|
10539 |
+
return branch0
|
10540 |
+
}
|
10541 |
+
}
|
10542 |
+
}
|
10543 |
+
|
10544 |
+
function cloneASTElement (el) {
|
10545 |
+
return createASTElement(el.tag, el.attrsList.slice(), el.parent)
|
10546 |
+
}
|
10547 |
+
|
10548 |
+
var model$1 = {
|
10549 |
+
preTransformNode: preTransformNode
|
10550 |
+
};
|
10551 |
+
|
10552 |
+
var modules$1 = [
|
10553 |
+
klass$1,
|
10554 |
+
style$1,
|
10555 |
+
model$1
|
10556 |
+
];
|
10557 |
+
|
10558 |
+
/* */
|
10559 |
+
|
10560 |
+
function text (el, dir) {
|
10561 |
+
if (dir.value) {
|
10562 |
+
addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
|
10563 |
+
}
|
10564 |
+
}
|
10565 |
+
|
10566 |
+
/* */
|
10567 |
+
|
10568 |
+
function html (el, dir) {
|
10569 |
+
if (dir.value) {
|
10570 |
+
addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
|
10571 |
+
}
|
10572 |
+
}
|
10573 |
+
|
10574 |
+
var directives$1 = {
|
10575 |
+
model: model,
|
10576 |
+
text: text,
|
10577 |
+
html: html
|
10578 |
+
};
|
10579 |
+
|
10580 |
+
/* */
|
10581 |
+
|
10582 |
+
var baseOptions = {
|
10583 |
+
expectHTML: true,
|
10584 |
+
modules: modules$1,
|
10585 |
+
directives: directives$1,
|
10586 |
+
isPreTag: isPreTag,
|
10587 |
+
isUnaryTag: isUnaryTag,
|
10588 |
+
mustUseProp: mustUseProp,
|
10589 |
+
canBeLeftOpenTag: canBeLeftOpenTag,
|
10590 |
+
isReservedTag: isReservedTag,
|
10591 |
+
getTagNamespace: getTagNamespace,
|
10592 |
+
staticKeys: genStaticKeys(modules$1)
|
10593 |
+
};
|
10594 |
+
|
10595 |
+
/* */
|
10596 |
+
|
10597 |
+
var isStaticKey;
|
10598 |
+
var isPlatformReservedTag;
|
10599 |
+
|
10600 |
+
var genStaticKeysCached = cached(genStaticKeys$1);
|
10601 |
+
|
10602 |
+
/**
|
10603 |
+
* Goal of the optimizer: walk the generated template AST tree
|
10604 |
+
* and detect sub-trees that are purely static, i.e. parts of
|
10605 |
+
* the DOM that never needs to change.
|
10606 |
+
*
|
10607 |
+
* Once we detect these sub-trees, we can:
|
10608 |
+
*
|
10609 |
+
* 1. Hoist them into constants, so that we no longer need to
|
10610 |
+
* create fresh nodes for them on each re-render;
|
10611 |
+
* 2. Completely skip them in the patching process.
|
10612 |
+
*/
|
10613 |
+
function optimize (root, options) {
|
10614 |
+
if (!root) { return }
|
10615 |
+
isStaticKey = genStaticKeysCached(options.staticKeys || '');
|
10616 |
+
isPlatformReservedTag = options.isReservedTag || no;
|
10617 |
+
// first pass: mark all non-static nodes.
|
10618 |
+
markStatic$1(root);
|
10619 |
+
// second pass: mark static roots.
|
10620 |
+
markStaticRoots(root, false);
|
10621 |
+
}
|
10622 |
+
|
10623 |
+
function genStaticKeys$1 (keys) {
|
10624 |
+
return makeMap(
|
10625 |
+
'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
|
10626 |
+
(keys ? ',' + keys : '')
|
10627 |
+
)
|
10628 |
+
}
|
10629 |
+
|
10630 |
+
function markStatic$1 (node) {
|
10631 |
+
node.static = isStatic(node);
|
10632 |
+
if (node.type === 1) {
|
10633 |
+
// do not make component slot content static. this avoids
|
10634 |
+
// 1. components not able to mutate slot nodes
|
10635 |
+
// 2. static slot content fails for hot-reloading
|
10636 |
+
if (
|
10637 |
+
!isPlatformReservedTag(node.tag) &&
|
10638 |
+
node.tag !== 'slot' &&
|
10639 |
+
node.attrsMap['inline-template'] == null
|
10640 |
+
) {
|
10641 |
+
return
|
10642 |
+
}
|
10643 |
+
for (var i = 0, l = node.children.length; i < l; i++) {
|
10644 |
+
var child = node.children[i];
|
10645 |
+
markStatic$1(child);
|
10646 |
+
if (!child.static) {
|
10647 |
+
node.static = false;
|
10648 |
+
}
|
10649 |
+
}
|
10650 |
+
if (node.ifConditions) {
|
10651 |
+
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10652 |
+
var block = node.ifConditions[i$1].block;
|
10653 |
+
markStatic$1(block);
|
10654 |
+
if (!block.static) {
|
10655 |
+
node.static = false;
|
10656 |
+
}
|
10657 |
+
}
|
10658 |
+
}
|
10659 |
+
}
|
10660 |
+
}
|
10661 |
+
|
10662 |
+
function markStaticRoots (node, isInFor) {
|
10663 |
+
if (node.type === 1) {
|
10664 |
+
if (node.static || node.once) {
|
10665 |
+
node.staticInFor = isInFor;
|
10666 |
+
}
|
10667 |
+
// For a node to qualify as a static root, it should have children that
|
10668 |
+
// are not just static text. Otherwise the cost of hoisting out will
|
10669 |
+
// outweigh the benefits and it's better off to just always render it fresh.
|
10670 |
+
if (node.static && node.children.length && !(
|
10671 |
+
node.children.length === 1 &&
|
10672 |
+
node.children[0].type === 3
|
10673 |
+
)) {
|
10674 |
+
node.staticRoot = true;
|
10675 |
+
return
|
10676 |
+
} else {
|
10677 |
+
node.staticRoot = false;
|
10678 |
+
}
|
10679 |
+
if (node.children) {
|
10680 |
+
for (var i = 0, l = node.children.length; i < l; i++) {
|
10681 |
+
markStaticRoots(node.children[i], isInFor || !!node.for);
|
10682 |
+
}
|
10683 |
+
}
|
10684 |
+
if (node.ifConditions) {
|
10685 |
+
for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
|
10686 |
+
markStaticRoots(node.ifConditions[i$1].block, isInFor);
|
10687 |
+
}
|
10688 |
+
}
|
10689 |
+
}
|
10690 |
+
}
|
10691 |
+
|
10692 |
+
function isStatic (node) {
|
10693 |
+
if (node.type === 2) { // expression
|
10694 |
+
return false
|
10695 |
+
}
|
10696 |
+
if (node.type === 3) { // text
|
10697 |
+
return true
|
10698 |
+
}
|
10699 |
+
return !!(node.pre || (
|
10700 |
+
!node.hasBindings && // no dynamic bindings
|
10701 |
+
!node.if && !node.for && // not v-if or v-for or v-else
|
10702 |
+
!isBuiltInTag(node.tag) && // not a built-in
|
10703 |
+
isPlatformReservedTag(node.tag) && // not a component
|
10704 |
+
!isDirectChildOfTemplateFor(node) &&
|
10705 |
+
Object.keys(node).every(isStaticKey)
|
10706 |
+
))
|
10707 |
+
}
|
10708 |
+
|
10709 |
+
function isDirectChildOfTemplateFor (node) {
|
10710 |
+
while (node.parent) {
|
10711 |
+
node = node.parent;
|
10712 |
+
if (node.tag !== 'template') {
|
10713 |
+
return false
|
10714 |
+
}
|
10715 |
+
if (node.for) {
|
10716 |
+
return true
|
10717 |
+
}
|
10718 |
+
}
|
10719 |
+
return false
|
10720 |
+
}
|
10721 |
+
|
10722 |
+
/* */
|
10723 |
+
|
10724 |
+
var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
|
10725 |
+
var fnInvokeRE = /\([^)]*?\);*$/;
|
10726 |
+
var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
|
10727 |
+
|
10728 |
+
// KeyboardEvent.keyCode aliases
|
10729 |
+
var keyCodes = {
|
10730 |
+
esc: 27,
|
10731 |
+
tab: 9,
|
10732 |
+
enter: 13,
|
10733 |
+
space: 32,
|
10734 |
+
up: 38,
|
10735 |
+
left: 37,
|
10736 |
+
right: 39,
|
10737 |
+
down: 40,
|
10738 |
+
'delete': [8, 46]
|
10739 |
+
};
|
10740 |
+
|
10741 |
+
// KeyboardEvent.key aliases
|
10742 |
+
var keyNames = {
|
10743 |
+
// #7880: IE11 and Edge use `Esc` for Escape key name.
|
10744 |
+
esc: ['Esc', 'Escape'],
|
10745 |
+
tab: 'Tab',
|
10746 |
+
enter: 'Enter',
|
10747 |
+
// #9112: IE11 uses `Spacebar` for Space key name.
|
10748 |
+
space: [' ', 'Spacebar'],
|
10749 |
+
// #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
|
10750 |
+
up: ['Up', 'ArrowUp'],
|
10751 |
+
left: ['Left', 'ArrowLeft'],
|
10752 |
+
right: ['Right', 'ArrowRight'],
|
10753 |
+
down: ['Down', 'ArrowDown'],
|
10754 |
+
// #9112: IE11 uses `Del` for Delete key name.
|
10755 |
+
'delete': ['Backspace', 'Delete', 'Del']
|
10756 |
+
};
|
10757 |
+
|
10758 |
+
// #4868: modifiers that prevent the execution of the listener
|
10759 |
+
// need to explicitly return null so that we can determine whether to remove
|
10760 |
+
// the listener for .once
|
10761 |
+
var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
|
10762 |
+
|
10763 |
+
var modifierCode = {
|
10764 |
+
stop: '$event.stopPropagation();',
|
10765 |
+
prevent: '$event.preventDefault();',
|
10766 |
+
self: genGuard("$event.target !== $event.currentTarget"),
|
10767 |
+
ctrl: genGuard("!$event.ctrlKey"),
|
10768 |
+
shift: genGuard("!$event.shiftKey"),
|
10769 |
+
alt: genGuard("!$event.altKey"),
|
10770 |
+
meta: genGuard("!$event.metaKey"),
|
10771 |
+
left: genGuard("'button' in $event && $event.button !== 0"),
|
10772 |
+
middle: genGuard("'button' in $event && $event.button !== 1"),
|
10773 |
+
right: genGuard("'button' in $event && $event.button !== 2")
|
10774 |
+
};
|
10775 |
+
|
10776 |
+
function genHandlers (
|
10777 |
+
events,
|
10778 |
+
isNative
|
10779 |
+
) {
|
10780 |
+
var prefix = isNative ? 'nativeOn:' : 'on:';
|
10781 |
+
var staticHandlers = "";
|
10782 |
+
var dynamicHandlers = "";
|
10783 |
+
for (var name in events) {
|
10784 |
+
var handlerCode = genHandler(events[name]);
|
10785 |
+
if (events[name] && events[name].dynamic) {
|
10786 |
+
dynamicHandlers += name + "," + handlerCode + ",";
|
10787 |
+
} else {
|
10788 |
+
staticHandlers += "\"" + name + "\":" + handlerCode + ",";
|
10789 |
+
}
|
10790 |
+
}
|
10791 |
+
staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
|
10792 |
+
if (dynamicHandlers) {
|
10793 |
+
return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
|
10794 |
+
} else {
|
10795 |
+
return prefix + staticHandlers
|
10796 |
+
}
|
10797 |
+
}
|
10798 |
+
|
10799 |
+
function genHandler (handler) {
|
10800 |
+
if (!handler) {
|
10801 |
+
return 'function(){}'
|
10802 |
+
}
|
10803 |
+
|
10804 |
+
if (Array.isArray(handler)) {
|
10805 |
+
return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
|
10806 |
+
}
|
10807 |
+
|
10808 |
+
var isMethodPath = simplePathRE.test(handler.value);
|
10809 |
+
var isFunctionExpression = fnExpRE.test(handler.value);
|
10810 |
+
var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
|
10811 |
+
|
10812 |
+
if (!handler.modifiers) {
|
10813 |
+
if (isMethodPath || isFunctionExpression) {
|
10814 |
+
return handler.value
|
10815 |
+
}
|
10816 |
+
return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
|
10817 |
+
} else {
|
10818 |
+
var code = '';
|
10819 |
+
var genModifierCode = '';
|
10820 |
+
var keys = [];
|
10821 |
+
for (var key in handler.modifiers) {
|
10822 |
+
if (modifierCode[key]) {
|
10823 |
+
genModifierCode += modifierCode[key];
|
10824 |
+
// left/right
|
10825 |
+
if (keyCodes[key]) {
|
10826 |
+
keys.push(key);
|
10827 |
+
}
|
10828 |
+
} else if (key === 'exact') {
|
10829 |
+
var modifiers = (handler.modifiers);
|
10830 |
+
genModifierCode += genGuard(
|
10831 |
+
['ctrl', 'shift', 'alt', 'meta']
|
10832 |
+
.filter(function (keyModifier) { return !modifiers[keyModifier]; })
|
10833 |
+
.map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
|
10834 |
+
.join('||')
|
10835 |
+
);
|
10836 |
+
} else {
|
10837 |
+
keys.push(key);
|
10838 |
+
}
|
10839 |
+
}
|
10840 |
+
if (keys.length) {
|
10841 |
+
code += genKeyFilter(keys);
|
10842 |
+
}
|
10843 |
+
// Make sure modifiers like prevent and stop get executed after key filtering
|
10844 |
+
if (genModifierCode) {
|
10845 |
+
code += genModifierCode;
|
10846 |
+
}
|
10847 |
+
var handlerCode = isMethodPath
|
10848 |
+
? ("return " + (handler.value) + "($event)")
|
10849 |
+
: isFunctionExpression
|
10850 |
+
? ("return (" + (handler.value) + ")($event)")
|
10851 |
+
: isFunctionInvocation
|
10852 |
+
? ("return " + (handler.value))
|
10853 |
+
: handler.value;
|
10854 |
+
return ("function($event){" + code + handlerCode + "}")
|
10855 |
+
}
|
10856 |
+
}
|
10857 |
+
|
10858 |
+
function genKeyFilter (keys) {
|
10859 |
+
return (
|
10860 |
+
// make sure the key filters only apply to KeyboardEvents
|
10861 |
+
// #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
|
10862 |
+
// key events that do not have keyCode property...
|
10863 |
+
"if(!$event.type.indexOf('key')&&" +
|
10864 |
+
(keys.map(genFilterCode).join('&&')) + ")return null;"
|
10865 |
+
)
|
10866 |
+
}
|
10867 |
+
|
10868 |
+
function genFilterCode (key) {
|
10869 |
+
var keyVal = parseInt(key, 10);
|
10870 |
+
if (keyVal) {
|
10871 |
+
return ("$event.keyCode!==" + keyVal)
|
10872 |
+
}
|
10873 |
+
var keyCode = keyCodes[key];
|
10874 |
+
var keyName = keyNames[key];
|
10875 |
+
return (
|
10876 |
+
"_k($event.keyCode," +
|
10877 |
+
(JSON.stringify(key)) + "," +
|
10878 |
+
(JSON.stringify(keyCode)) + "," +
|
10879 |
+
"$event.key," +
|
10880 |
+
"" + (JSON.stringify(keyName)) +
|
10881 |
+
")"
|
10882 |
+
)
|
10883 |
+
}
|
10884 |
+
|
10885 |
+
/* */
|
10886 |
+
|
10887 |
+
function on (el, dir) {
|
10888 |
+
if (dir.modifiers) {
|
10889 |
+
warn("v-on without argument does not support modifiers.");
|
10890 |
+
}
|
10891 |
+
el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
|
10892 |
+
}
|
10893 |
+
|
10894 |
+
/* */
|
10895 |
+
|
10896 |
+
function bind$1 (el, dir) {
|
10897 |
+
el.wrapData = function (code) {
|
10898 |
+
return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
|
10899 |
+
};
|
10900 |
+
}
|
10901 |
+
|
10902 |
+
/* */
|
10903 |
+
|
10904 |
+
var baseDirectives = {
|
10905 |
+
on: on,
|
10906 |
+
bind: bind$1,
|
10907 |
+
cloak: noop
|
10908 |
+
};
|
10909 |
+
|
10910 |
+
/* */
|
10911 |
+
|
10912 |
+
|
10913 |
+
|
10914 |
+
|
10915 |
+
|
10916 |
+
var CodegenState = function CodegenState (options) {
|
10917 |
+
this.options = options;
|
10918 |
+
this.warn = options.warn || baseWarn;
|
10919 |
+
this.transforms = pluckModuleFunction(options.modules, 'transformCode');
|
10920 |
+
this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
|
10921 |
+
this.directives = extend(extend({}, baseDirectives), options.directives);
|
10922 |
+
var isReservedTag = options.isReservedTag || no;
|
10923 |
+
this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
|
10924 |
+
this.onceId = 0;
|
10925 |
+
this.staticRenderFns = [];
|
10926 |
+
this.pre = false;
|
10927 |
+
};
|
10928 |
+
|
10929 |
+
|
10930 |
+
|
10931 |
+
function generate (
|
10932 |
+
ast,
|
10933 |
+
options
|
10934 |
+
) {
|
10935 |
+
var state = new CodegenState(options);
|
10936 |
+
var code = ast ? genElement(ast, state) : '_c("div")';
|
10937 |
+
return {
|
10938 |
+
render: ("with(this){return " + code + "}"),
|
10939 |
+
staticRenderFns: state.staticRenderFns
|
10940 |
+
}
|
10941 |
+
}
|
10942 |
+
|
10943 |
+
function genElement (el, state) {
|
10944 |
+
if (el.parent) {
|
10945 |
+
el.pre = el.pre || el.parent.pre;
|
10946 |
+
}
|
10947 |
+
|
10948 |
+
if (el.staticRoot && !el.staticProcessed) {
|
10949 |
+
return genStatic(el, state)
|
10950 |
+
} else if (el.once && !el.onceProcessed) {
|
10951 |
+
return genOnce(el, state)
|
10952 |
+
} else if (el.for && !el.forProcessed) {
|
10953 |
+
return genFor(el, state)
|
10954 |
+
} else if (el.if && !el.ifProcessed) {
|
10955 |
+
return genIf(el, state)
|
10956 |
+
} else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
|
10957 |
+
return genChildren(el, state) || 'void 0'
|
10958 |
+
} else if (el.tag === 'slot') {
|
10959 |
+
return genSlot(el, state)
|
10960 |
+
} else {
|
10961 |
+
// component or element
|
10962 |
+
var code;
|
10963 |
+
if (el.component) {
|
10964 |
+
code = genComponent(el.component, el, state);
|
10965 |
+
} else {
|
10966 |
+
var data;
|
10967 |
+
if (!el.plain || (el.pre && state.maybeComponent(el))) {
|
10968 |
+
data = genData$2(el, state);
|
10969 |
+
}
|
10970 |
+
|
10971 |
+
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
10972 |
+
code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
|
10973 |
+
}
|
10974 |
+
// module transforms
|
10975 |
+
for (var i = 0; i < state.transforms.length; i++) {
|
10976 |
+
code = state.transforms[i](el, code);
|
10977 |
+
}
|
10978 |
+
return code
|
10979 |
+
}
|
10980 |
+
}
|
10981 |
+
|
10982 |
+
// hoist static sub-trees out
|
10983 |
+
function genStatic (el, state) {
|
10984 |
+
el.staticProcessed = true;
|
10985 |
+
// Some elements (templates) need to behave differently inside of a v-pre
|
10986 |
+
// node. All pre nodes are static roots, so we can use this as a location to
|
10987 |
+
// wrap a state change and reset it upon exiting the pre node.
|
10988 |
+
var originalPreState = state.pre;
|
10989 |
+
if (el.pre) {
|
10990 |
+
state.pre = el.pre;
|
10991 |
+
}
|
10992 |
+
state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
|
10993 |
+
state.pre = originalPreState;
|
10994 |
+
return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
|
10995 |
+
}
|
10996 |
+
|
10997 |
+
// v-once
|
10998 |
+
function genOnce (el, state) {
|
10999 |
+
el.onceProcessed = true;
|
11000 |
+
if (el.if && !el.ifProcessed) {
|
11001 |
+
return genIf(el, state)
|
11002 |
+
} else if (el.staticInFor) {
|
11003 |
+
var key = '';
|
11004 |
+
var parent = el.parent;
|
11005 |
+
while (parent) {
|
11006 |
+
if (parent.for) {
|
11007 |
+
key = parent.key;
|
11008 |
+
break
|
11009 |
+
}
|
11010 |
+
parent = parent.parent;
|
11011 |
+
}
|
11012 |
+
if (!key) {
|
11013 |
+
state.warn(
|
11014 |
+
"v-once can only be used inside v-for that is keyed. ",
|
11015 |
+
el.rawAttrsMap['v-once']
|
11016 |
+
);
|
11017 |
+
return genElement(el, state)
|
11018 |
+
}
|
11019 |
+
return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
|
11020 |
+
} else {
|
11021 |
+
return genStatic(el, state)
|
11022 |
+
}
|
11023 |
+
}
|
11024 |
+
|
11025 |
+
function genIf (
|
11026 |
+
el,
|
11027 |
+
state,
|
11028 |
+
altGen,
|
11029 |
+
altEmpty
|
11030 |
+
) {
|
11031 |
+
el.ifProcessed = true; // avoid recursion
|
11032 |
+
return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
|
11033 |
+
}
|
11034 |
+
|
11035 |
+
function genIfConditions (
|
11036 |
+
conditions,
|
11037 |
+
state,
|
11038 |
+
altGen,
|
11039 |
+
altEmpty
|
11040 |
+
) {
|
11041 |
+
if (!conditions.length) {
|
11042 |
+
return altEmpty || '_e()'
|
11043 |
+
}
|
11044 |
+
|
11045 |
+
var condition = conditions.shift();
|
11046 |
+
if (condition.exp) {
|
11047 |
+
return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
|
11048 |
+
} else {
|
11049 |
+
return ("" + (genTernaryExp(condition.block)))
|
11050 |
+
}
|
11051 |
+
|
11052 |
+
// v-if with v-once should generate code like (a)?_m(0):_m(1)
|
11053 |
+
function genTernaryExp (el) {
|
11054 |
+
return altGen
|
11055 |
+
? altGen(el, state)
|
11056 |
+
: el.once
|
11057 |
+
? genOnce(el, state)
|
11058 |
+
: genElement(el, state)
|
11059 |
+
}
|
11060 |
+
}
|
11061 |
+
|
11062 |
+
function genFor (
|
11063 |
+
el,
|
11064 |
+
state,
|
11065 |
+
altGen,
|
11066 |
+
altHelper
|
11067 |
+
) {
|
11068 |
+
var exp = el.for;
|
11069 |
+
var alias = el.alias;
|
11070 |
+
var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
|
11071 |
+
var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
|
11072 |
+
|
11073 |
+
if (state.maybeComponent(el) &&
|
11074 |
+
el.tag !== 'slot' &&
|
11075 |
+
el.tag !== 'template' &&
|
11076 |
+
!el.key
|
11077 |
+
) {
|
11078 |
+
state.warn(
|
11079 |
+
"<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
|
11080 |
+
"v-for should have explicit keys. " +
|
11081 |
+
"See https://vuejs.org/guide/list.html#key for more info.",
|
11082 |
+
el.rawAttrsMap['v-for'],
|
11083 |
+
true /* tip */
|
11084 |
+
);
|
11085 |
+
}
|
11086 |
+
|
11087 |
+
el.forProcessed = true; // avoid recursion
|
11088 |
+
return (altHelper || '_l') + "((" + exp + ")," +
|
11089 |
+
"function(" + alias + iterator1 + iterator2 + "){" +
|
11090 |
+
"return " + ((altGen || genElement)(el, state)) +
|
11091 |
+
'})'
|
11092 |
+
}
|
11093 |
+
|
11094 |
+
function genData$2 (el, state) {
|
11095 |
+
var data = '{';
|
11096 |
+
|
11097 |
+
// directives first.
|
11098 |
+
// directives may mutate the el's other properties before they are generated.
|
11099 |
+
var dirs = genDirectives(el, state);
|
11100 |
+
if (dirs) { data += dirs + ','; }
|
11101 |
+
|
11102 |
+
// key
|
11103 |
+
if (el.key) {
|
11104 |
+
data += "key:" + (el.key) + ",";
|
11105 |
+
}
|
11106 |
+
// ref
|
11107 |
+
if (el.ref) {
|
11108 |
+
data += "ref:" + (el.ref) + ",";
|
11109 |
+
}
|
11110 |
+
if (el.refInFor) {
|
11111 |
+
data += "refInFor:true,";
|
11112 |
+
}
|
11113 |
+
// pre
|
11114 |
+
if (el.pre) {
|
11115 |
+
data += "pre:true,";
|
11116 |
+
}
|
11117 |
+
// record original tag name for components using "is" attribute
|
11118 |
+
if (el.component) {
|
11119 |
+
data += "tag:\"" + (el.tag) + "\",";
|
11120 |
+
}
|
11121 |
+
// module data generation functions
|
11122 |
+
for (var i = 0; i < state.dataGenFns.length; i++) {
|
11123 |
+
data += state.dataGenFns[i](el);
|
11124 |
+
}
|
11125 |
+
// attributes
|
11126 |
+
if (el.attrs) {
|
11127 |
+
data += "attrs:" + (genProps(el.attrs)) + ",";
|
11128 |
+
}
|
11129 |
+
// DOM props
|
11130 |
+
if (el.props) {
|
11131 |
+
data += "domProps:" + (genProps(el.props)) + ",";
|
11132 |
+
}
|
11133 |
+
// event handlers
|
11134 |
+
if (el.events) {
|
11135 |
+
data += (genHandlers(el.events, false)) + ",";
|
11136 |
+
}
|
11137 |
+
if (el.nativeEvents) {
|
11138 |
+
data += (genHandlers(el.nativeEvents, true)) + ",";
|
11139 |
+
}
|
11140 |
+
// slot target
|
11141 |
+
// only for non-scoped slots
|
11142 |
+
if (el.slotTarget && !el.slotScope) {
|
11143 |
+
data += "slot:" + (el.slotTarget) + ",";
|
11144 |
+
}
|
11145 |
+
// scoped slots
|
11146 |
+
if (el.scopedSlots) {
|
11147 |
+
data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
|
11148 |
+
}
|
11149 |
+
// component v-model
|
11150 |
+
if (el.model) {
|
11151 |
+
data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
|
11152 |
+
}
|
11153 |
+
// inline-template
|
11154 |
+
if (el.inlineTemplate) {
|
11155 |
+
var inlineTemplate = genInlineTemplate(el, state);
|
11156 |
+
if (inlineTemplate) {
|
11157 |
+
data += inlineTemplate + ",";
|
11158 |
+
}
|
11159 |
+
}
|
11160 |
+
data = data.replace(/,$/, '') + '}';
|
11161 |
+
// v-bind dynamic argument wrap
|
11162 |
+
// v-bind with dynamic arguments must be applied using the same v-bind object
|
11163 |
+
// merge helper so that class/style/mustUseProp attrs are handled correctly.
|
11164 |
+
if (el.dynamicAttrs) {
|
11165 |
+
data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
|
11166 |
+
}
|
11167 |
+
// v-bind data wrap
|
11168 |
+
if (el.wrapData) {
|
11169 |
+
data = el.wrapData(data);
|
11170 |
+
}
|
11171 |
+
// v-on data wrap
|
11172 |
+
if (el.wrapListeners) {
|
11173 |
+
data = el.wrapListeners(data);
|
11174 |
+
}
|
11175 |
+
return data
|
11176 |
+
}
|
11177 |
+
|
11178 |
+
function genDirectives (el, state) {
|
11179 |
+
var dirs = el.directives;
|
11180 |
+
if (!dirs) { return }
|
11181 |
+
var res = 'directives:[';
|
11182 |
+
var hasRuntime = false;
|
11183 |
+
var i, l, dir, needRuntime;
|
11184 |
+
for (i = 0, l = dirs.length; i < l; i++) {
|
11185 |
+
dir = dirs[i];
|
11186 |
+
needRuntime = true;
|
11187 |
+
var gen = state.directives[dir.name];
|
11188 |
+
if (gen) {
|
11189 |
+
// compile-time directive that manipulates AST.
|
11190 |
+
// returns true if it also needs a runtime counterpart.
|
11191 |
+
needRuntime = !!gen(el, dir, state.warn);
|
11192 |
+
}
|
11193 |
+
if (needRuntime) {
|
11194 |
+
hasRuntime = true;
|
11195 |
+
res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
|
11196 |
+
}
|
11197 |
+
}
|
11198 |
+
if (hasRuntime) {
|
11199 |
+
return res.slice(0, -1) + ']'
|
11200 |
+
}
|
11201 |
+
}
|
11202 |
+
|
11203 |
+
function genInlineTemplate (el, state) {
|
11204 |
+
var ast = el.children[0];
|
11205 |
+
if (el.children.length !== 1 || ast.type !== 1) {
|
11206 |
+
state.warn(
|
11207 |
+
'Inline-template components must have exactly one child element.',
|
11208 |
+
{ start: el.start }
|
11209 |
+
);
|
11210 |
+
}
|
11211 |
+
if (ast && ast.type === 1) {
|
11212 |
+
var inlineRenderFns = generate(ast, state.options);
|
11213 |
+
return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
|
11214 |
+
}
|
11215 |
+
}
|
11216 |
+
|
11217 |
+
function genScopedSlots (
|
11218 |
+
el,
|
11219 |
+
slots,
|
11220 |
+
state
|
11221 |
+
) {
|
11222 |
+
// by default scoped slots are considered "stable", this allows child
|
11223 |
+
// components with only scoped slots to skip forced updates from parent.
|
11224 |
+
// but in some cases we have to bail-out of this optimization
|
11225 |
+
// for example if the slot contains dynamic names, has v-if or v-for on them...
|
11226 |
+
var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
|
11227 |
+
var slot = slots[key];
|
11228 |
+
return (
|
11229 |
+
slot.slotTargetDynamic ||
|
11230 |
+
slot.if ||
|
11231 |
+
slot.for ||
|
11232 |
+
containsSlotChild(slot) // is passing down slot from parent which may be dynamic
|
11233 |
+
)
|
11234 |
+
});
|
11235 |
+
|
11236 |
+
// #9534: if a component with scoped slots is inside a conditional branch,
|
11237 |
+
// it's possible for the same component to be reused but with different
|
11238 |
+
// compiled slot content. To avoid that, we generate a unique key based on
|
11239 |
+
// the generated code of all the slot contents.
|
11240 |
+
var needsKey = !!el.if;
|
11241 |
+
|
11242 |
+
// OR when it is inside another scoped slot or v-for (the reactivity may be
|
11243 |
+
// disconnected due to the intermediate scope variable)
|
11244 |
+
// #9438, #9506
|
11245 |
+
// TODO: this can be further optimized by properly analyzing in-scope bindings
|
11246 |
+
// and skip force updating ones that do not actually use scope variables.
|
11247 |
+
if (!needsForceUpdate) {
|
11248 |
+
var parent = el.parent;
|
11249 |
+
while (parent) {
|
11250 |
+
if (
|
11251 |
+
(parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
|
11252 |
+
parent.for
|
11253 |
+
) {
|
11254 |
+
needsForceUpdate = true;
|
11255 |
+
break
|
11256 |
+
}
|
11257 |
+
if (parent.if) {
|
11258 |
+
needsKey = true;
|
11259 |
+
}
|
11260 |
+
parent = parent.parent;
|
11261 |
+
}
|
11262 |
+
}
|
11263 |
+
|
11264 |
+
var generatedSlots = Object.keys(slots)
|
11265 |
+
.map(function (key) { return genScopedSlot(slots[key], state); })
|
11266 |
+
.join(',');
|
11267 |
+
|
11268 |
+
return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
|
11269 |
+
}
|
11270 |
+
|
11271 |
+
function hash(str) {
|
11272 |
+
var hash = 5381;
|
11273 |
+
var i = str.length;
|
11274 |
+
while(i) {
|
11275 |
+
hash = (hash * 33) ^ str.charCodeAt(--i);
|
11276 |
+
}
|
11277 |
+
return hash >>> 0
|
11278 |
+
}
|
11279 |
+
|
11280 |
+
function containsSlotChild (el) {
|
11281 |
+
if (el.type === 1) {
|
11282 |
+
if (el.tag === 'slot') {
|
11283 |
+
return true
|
11284 |
+
}
|
11285 |
+
return el.children.some(containsSlotChild)
|
11286 |
+
}
|
11287 |
+
return false
|
11288 |
+
}
|
11289 |
+
|
11290 |
+
function genScopedSlot (
|
11291 |
+
el,
|
11292 |
+
state
|
11293 |
+
) {
|
11294 |
+
var isLegacySyntax = el.attrsMap['slot-scope'];
|
11295 |
+
if (el.if && !el.ifProcessed && !isLegacySyntax) {
|
11296 |
+
return genIf(el, state, genScopedSlot, "null")
|
11297 |
+
}
|
11298 |
+
if (el.for && !el.forProcessed) {
|
11299 |
+
return genFor(el, state, genScopedSlot)
|
11300 |
+
}
|
11301 |
+
var slotScope = el.slotScope === emptySlotScopeToken
|
11302 |
+
? ""
|
11303 |
+
: String(el.slotScope);
|
11304 |
+
var fn = "function(" + slotScope + "){" +
|
11305 |
+
"return " + (el.tag === 'template'
|
11306 |
+
? el.if && isLegacySyntax
|
11307 |
+
? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
|
11308 |
+
: genChildren(el, state) || 'undefined'
|
11309 |
+
: genElement(el, state)) + "}";
|
11310 |
+
// reverse proxy v-slot without scope on this.$slots
|
11311 |
+
var reverseProxy = slotScope ? "" : ",proxy:true";
|
11312 |
+
return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
|
11313 |
+
}
|
11314 |
+
|
11315 |
+
function genChildren (
|
11316 |
+
el,
|
11317 |
+
state,
|
11318 |
+
checkSkip,
|
11319 |
+
altGenElement,
|
11320 |
+
altGenNode
|
11321 |
+
) {
|
11322 |
+
var children = el.children;
|
11323 |
+
if (children.length) {
|
11324 |
+
var el$1 = children[0];
|
11325 |
+
// optimize single v-for
|
11326 |
+
if (children.length === 1 &&
|
11327 |
+
el$1.for &&
|
11328 |
+
el$1.tag !== 'template' &&
|
11329 |
+
el$1.tag !== 'slot'
|
11330 |
+
) {
|
11331 |
+
var normalizationType = checkSkip
|
11332 |
+
? state.maybeComponent(el$1) ? ",1" : ",0"
|
11333 |
+
: "";
|
11334 |
+
return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
|
11335 |
+
}
|
11336 |
+
var normalizationType$1 = checkSkip
|
11337 |
+
? getNormalizationType(children, state.maybeComponent)
|
11338 |
+
: 0;
|
11339 |
+
var gen = altGenNode || genNode;
|
11340 |
+
return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
|
11341 |
+
}
|
11342 |
+
}
|
11343 |
+
|
11344 |
+
// determine the normalization needed for the children array.
|
11345 |
+
// 0: no normalization needed
|
11346 |
+
// 1: simple normalization needed (possible 1-level deep nested array)
|
11347 |
+
// 2: full normalization needed
|
11348 |
+
function getNormalizationType (
|
11349 |
+
children,
|
11350 |
+
maybeComponent
|
11351 |
+
) {
|
11352 |
+
var res = 0;
|
11353 |
+
for (var i = 0; i < children.length; i++) {
|
11354 |
+
var el = children[i];
|
11355 |
+
if (el.type !== 1) {
|
11356 |
+
continue
|
11357 |
+
}
|
11358 |
+
if (needsNormalization(el) ||
|
11359 |
+
(el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
|
11360 |
+
res = 2;
|
11361 |
+
break
|
11362 |
+
}
|
11363 |
+
if (maybeComponent(el) ||
|
11364 |
+
(el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
|
11365 |
+
res = 1;
|
11366 |
+
}
|
11367 |
+
}
|
11368 |
+
return res
|
11369 |
+
}
|
11370 |
+
|
11371 |
+
function needsNormalization (el) {
|
11372 |
+
return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
|
11373 |
+
}
|
11374 |
+
|
11375 |
+
function genNode (node, state) {
|
11376 |
+
if (node.type === 1) {
|
11377 |
+
return genElement(node, state)
|
11378 |
+
} else if (node.type === 3 && node.isComment) {
|
11379 |
+
return genComment(node)
|
11380 |
+
} else {
|
11381 |
+
return genText(node)
|
11382 |
+
}
|
11383 |
+
}
|
11384 |
+
|
11385 |
+
function genText (text) {
|
11386 |
+
return ("_v(" + (text.type === 2
|
11387 |
+
? text.expression // no need for () because already wrapped in _s()
|
11388 |
+
: transformSpecialNewlines(JSON.stringify(text.text))) + ")")
|
11389 |
+
}
|
11390 |
+
|
11391 |
+
function genComment (comment) {
|
11392 |
+
return ("_e(" + (JSON.stringify(comment.text)) + ")")
|
11393 |
+
}
|
11394 |
+
|
11395 |
+
function genSlot (el, state) {
|
11396 |
+
var slotName = el.slotName || '"default"';
|
11397 |
+
var children = genChildren(el, state);
|
11398 |
+
var res = "_t(" + slotName + (children ? ("," + children) : '');
|
11399 |
+
var attrs = el.attrs || el.dynamicAttrs
|
11400 |
+
? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
|
11401 |
+
// slot props are camelized
|
11402 |
+
name: camelize(attr.name),
|
11403 |
+
value: attr.value,
|
11404 |
+
dynamic: attr.dynamic
|
11405 |
+
}); }))
|
11406 |
+
: null;
|
11407 |
+
var bind$$1 = el.attrsMap['v-bind'];
|
11408 |
+
if ((attrs || bind$$1) && !children) {
|
11409 |
+
res += ",null";
|
11410 |
+
}
|
11411 |
+
if (attrs) {
|
11412 |
+
res += "," + attrs;
|
11413 |
+
}
|
11414 |
+
if (bind$$1) {
|
11415 |
+
res += (attrs ? '' : ',null') + "," + bind$$1;
|
11416 |
+
}
|
11417 |
+
return res + ')'
|
11418 |
+
}
|
11419 |
+
|
11420 |
+
// componentName is el.component, take it as argument to shun flow's pessimistic refinement
|
11421 |
+
function genComponent (
|
11422 |
+
componentName,
|
11423 |
+
el,
|
11424 |
+
state
|
11425 |
+
) {
|
11426 |
+
var children = el.inlineTemplate ? null : genChildren(el, state, true);
|
11427 |
+
return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
|
11428 |
+
}
|
11429 |
+
|
11430 |
+
function genProps (props) {
|
11431 |
+
var staticProps = "";
|
11432 |
+
var dynamicProps = "";
|
11433 |
+
for (var i = 0; i < props.length; i++) {
|
11434 |
+
var prop = props[i];
|
11435 |
+
var value = transformSpecialNewlines(prop.value);
|
11436 |
+
if (prop.dynamic) {
|
11437 |
+
dynamicProps += (prop.name) + "," + value + ",";
|
11438 |
+
} else {
|
11439 |
+
staticProps += "\"" + (prop.name) + "\":" + value + ",";
|
11440 |
+
}
|
11441 |
+
}
|
11442 |
+
staticProps = "{" + (staticProps.slice(0, -1)) + "}";
|
11443 |
+
if (dynamicProps) {
|
11444 |
+
return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
|
11445 |
+
} else {
|
11446 |
+
return staticProps
|
11447 |
+
}
|
11448 |
+
}
|
11449 |
+
|
11450 |
+
// #3895, #4268
|
11451 |
+
function transformSpecialNewlines (text) {
|
11452 |
+
return text
|
11453 |
+
.replace(/\u2028/g, '\\u2028')
|
11454 |
+
.replace(/\u2029/g, '\\u2029')
|
11455 |
+
}
|
11456 |
+
|
11457 |
+
/* */
|
11458 |
+
|
11459 |
+
|
11460 |
+
|
11461 |
+
// these keywords should not appear inside expressions, but operators like
|
11462 |
+
// typeof, instanceof and in are allowed
|
11463 |
+
var prohibitedKeywordRE = new RegExp('\\b' + (
|
11464 |
+
'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
|
11465 |
+
'super,throw,while,yield,delete,export,import,return,switch,default,' +
|
11466 |
+
'extends,finally,continue,debugger,function,arguments'
|
11467 |
+
).split(',').join('\\b|\\b') + '\\b');
|
11468 |
+
|
11469 |
+
// these unary operators should not be used as property/method names
|
11470 |
+
var unaryOperatorsRE = new RegExp('\\b' + (
|
11471 |
+
'delete,typeof,void'
|
11472 |
+
).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
|
11473 |
+
|
11474 |
+
// strip strings in expressions
|
11475 |
+
var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
|
11476 |
+
|
11477 |
+
// detect problematic expressions in a template
|
11478 |
+
function detectErrors (ast, warn) {
|
11479 |
+
if (ast) {
|
11480 |
+
checkNode(ast, warn);
|
11481 |
+
}
|
11482 |
+
}
|
11483 |
+
|
11484 |
+
function checkNode (node, warn) {
|
11485 |
+
if (node.type === 1) {
|
11486 |
+
for (var name in node.attrsMap) {
|
11487 |
+
if (dirRE.test(name)) {
|
11488 |
+
var value = node.attrsMap[name];
|
11489 |
+
if (value) {
|
11490 |
+
var range = node.rawAttrsMap[name];
|
11491 |
+
if (name === 'v-for') {
|
11492 |
+
checkFor(node, ("v-for=\"" + value + "\""), warn, range);
|
11493 |
+
} else if (onRE.test(name)) {
|
11494 |
+
checkEvent(value, (name + "=\"" + value + "\""), warn, range);
|
11495 |
+
} else {
|
11496 |
+
checkExpression(value, (name + "=\"" + value + "\""), warn, range);
|
11497 |
+
}
|
11498 |
+
}
|
11499 |
+
}
|
11500 |
+
}
|
11501 |
+
if (node.children) {
|
11502 |
+
for (var i = 0; i < node.children.length; i++) {
|
11503 |
+
checkNode(node.children[i], warn);
|
11504 |
+
}
|
11505 |
+
}
|
11506 |
+
} else if (node.type === 2) {
|
11507 |
+
checkExpression(node.expression, node.text, warn, node);
|
11508 |
+
}
|
11509 |
+
}
|
11510 |
+
|
11511 |
+
function checkEvent (exp, text, warn, range) {
|
11512 |
+
var stipped = exp.replace(stripStringRE, '');
|
11513 |
+
var keywordMatch = stipped.match(unaryOperatorsRE);
|
11514 |
+
if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
|
11515 |
+
warn(
|
11516 |
+
"avoid using JavaScript unary operator as property name: " +
|
11517 |
+
"\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
|
11518 |
+
range
|
11519 |
+
);
|
11520 |
+
}
|
11521 |
+
checkExpression(exp, text, warn, range);
|
11522 |
+
}
|
11523 |
+
|
11524 |
+
function checkFor (node, text, warn, range) {
|
11525 |
+
checkExpression(node.for || '', text, warn, range);
|
11526 |
+
checkIdentifier(node.alias, 'v-for alias', text, warn, range);
|
11527 |
+
checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
|
11528 |
+
checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
|
11529 |
+
}
|
11530 |
+
|
11531 |
+
function checkIdentifier (
|
11532 |
+
ident,
|
11533 |
+
type,
|
11534 |
+
text,
|
11535 |
+
warn,
|
11536 |
+
range
|
11537 |
+
) {
|
11538 |
+
if (typeof ident === 'string') {
|
11539 |
+
try {
|
11540 |
+
new Function(("var " + ident + "=_"));
|
11541 |
+
} catch (e) {
|
11542 |
+
warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
|
11543 |
+
}
|
11544 |
+
}
|
11545 |
+
}
|
11546 |
+
|
11547 |
+
function checkExpression (exp, text, warn, range) {
|
11548 |
+
try {
|
11549 |
+
new Function(("return " + exp));
|
11550 |
+
} catch (e) {
|
11551 |
+
var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
|
11552 |
+
if (keywordMatch) {
|
11553 |
+
warn(
|
11554 |
+
"avoid using JavaScript keyword as property name: " +
|
11555 |
+
"\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
|
11556 |
+
range
|
11557 |
+
);
|
11558 |
+
} else {
|
11559 |
+
warn(
|
11560 |
+
"invalid expression: " + (e.message) + " in\n\n" +
|
11561 |
+
" " + exp + "\n\n" +
|
11562 |
+
" Raw expression: " + (text.trim()) + "\n",
|
11563 |
+
range
|
11564 |
+
);
|
11565 |
+
}
|
11566 |
+
}
|
11567 |
+
}
|
11568 |
+
|
11569 |
+
/* */
|
11570 |
+
|
11571 |
+
var range = 2;
|
11572 |
+
|
11573 |
+
function generateCodeFrame (
|
11574 |
+
source,
|
11575 |
+
start,
|
11576 |
+
end
|
11577 |
+
) {
|
11578 |
+
if ( start === void 0 ) start = 0;
|
11579 |
+
if ( end === void 0 ) end = source.length;
|
11580 |
+
|
11581 |
+
var lines = source.split(/\r?\n/);
|
11582 |
+
var count = 0;
|
11583 |
+
var res = [];
|
11584 |
+
for (var i = 0; i < lines.length; i++) {
|
11585 |
+
count += lines[i].length + 1;
|
11586 |
+
if (count >= start) {
|
11587 |
+
for (var j = i - range; j <= i + range || end > count; j++) {
|
11588 |
+
if (j < 0 || j >= lines.length) { continue }
|
11589 |
+
res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
|
11590 |
+
var lineLength = lines[j].length;
|
11591 |
+
if (j === i) {
|
11592 |
+
// push underline
|
11593 |
+
var pad = start - (count - lineLength) + 1;
|
11594 |
+
var length = end > count ? lineLength - pad : end - start;
|
11595 |
+
res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
|
11596 |
+
} else if (j > i) {
|
11597 |
+
if (end > count) {
|
11598 |
+
var length$1 = Math.min(end - count, lineLength);
|
11599 |
+
res.push(" | " + repeat$1("^", length$1));
|
11600 |
+
}
|
11601 |
+
count += lineLength + 1;
|
11602 |
+
}
|
11603 |
+
}
|
11604 |
+
break
|
11605 |
+
}
|
11606 |
+
}
|
11607 |
+
return res.join('\n')
|
11608 |
+
}
|
11609 |
+
|
11610 |
+
function repeat$1 (str, n) {
|
11611 |
+
var result = '';
|
11612 |
+
if (n > 0) {
|
11613 |
+
while (true) { // eslint-disable-line
|
11614 |
+
if (n & 1) { result += str; }
|
11615 |
+
n >>>= 1;
|
11616 |
+
if (n <= 0) { break }
|
11617 |
+
str += str;
|
11618 |
+
}
|
11619 |
+
}
|
11620 |
+
return result
|
11621 |
+
}
|
11622 |
+
|
11623 |
+
/* */
|
11624 |
+
|
11625 |
+
|
11626 |
+
|
11627 |
+
function createFunction (code, errors) {
|
11628 |
+
try {
|
11629 |
+
return new Function(code)
|
11630 |
+
} catch (err) {
|
11631 |
+
errors.push({ err: err, code: code });
|
11632 |
+
return noop
|
11633 |
+
}
|
11634 |
+
}
|
11635 |
+
|
11636 |
+
function createCompileToFunctionFn (compile) {
|
11637 |
+
var cache = Object.create(null);
|
11638 |
+
|
11639 |
+
return function compileToFunctions (
|
11640 |
+
template,
|
11641 |
+
options,
|
11642 |
+
vm
|
11643 |
+
) {
|
11644 |
+
options = extend({}, options);
|
11645 |
+
var warn$$1 = options.warn || warn;
|
11646 |
+
delete options.warn;
|
11647 |
+
|
11648 |
+
/* istanbul ignore if */
|
11649 |
+
{
|
11650 |
+
// detect possible CSP restriction
|
11651 |
+
try {
|
11652 |
+
new Function('return 1');
|
11653 |
+
} catch (e) {
|
11654 |
+
if (e.toString().match(/unsafe-eval|CSP/)) {
|
11655 |
+
warn$$1(
|
11656 |
+
'It seems you are using the standalone build of Vue.js in an ' +
|
11657 |
+
'environment with Content Security Policy that prohibits unsafe-eval. ' +
|
11658 |
+
'The template compiler cannot work in this environment. Consider ' +
|
11659 |
+
'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
|
11660 |
+
'templates into render functions.'
|
11661 |
+
);
|
11662 |
+
}
|
11663 |
+
}
|
11664 |
+
}
|
11665 |
+
|
11666 |
+
// check cache
|
11667 |
+
var key = options.delimiters
|
11668 |
+
? String(options.delimiters) + template
|
11669 |
+
: template;
|
11670 |
+
if (cache[key]) {
|
11671 |
+
return cache[key]
|
11672 |
+
}
|
11673 |
+
|
11674 |
+
// compile
|
11675 |
+
var compiled = compile(template, options);
|
11676 |
+
|
11677 |
+
// check compilation errors/tips
|
11678 |
+
{
|
11679 |
+
if (compiled.errors && compiled.errors.length) {
|
11680 |
+
if (options.outputSourceRange) {
|
11681 |
+
compiled.errors.forEach(function (e) {
|
11682 |
+
warn$$1(
|
11683 |
+
"Error compiling template:\n\n" + (e.msg) + "\n\n" +
|
11684 |
+
generateCodeFrame(template, e.start, e.end),
|
11685 |
+
vm
|
11686 |
+
);
|
11687 |
+
});
|
11688 |
+
} else {
|
11689 |
+
warn$$1(
|
11690 |
+
"Error compiling template:\n\n" + template + "\n\n" +
|
11691 |
+
compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
|
11692 |
+
vm
|
11693 |
+
);
|
11694 |
+
}
|
11695 |
+
}
|
11696 |
+
if (compiled.tips && compiled.tips.length) {
|
11697 |
+
if (options.outputSourceRange) {
|
11698 |
+
compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
|
11699 |
+
} else {
|
11700 |
+
compiled.tips.forEach(function (msg) { return tip(msg, vm); });
|
11701 |
+
}
|
11702 |
+
}
|
11703 |
+
}
|
11704 |
+
|
11705 |
+
// turn code into functions
|
11706 |
+
var res = {};
|
11707 |
+
var fnGenErrors = [];
|
11708 |
+
res.render = createFunction(compiled.render, fnGenErrors);
|
11709 |
+
res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
|
11710 |
+
return createFunction(code, fnGenErrors)
|
11711 |
+
});
|
11712 |
+
|
11713 |
+
// check function generation errors.
|
11714 |
+
// this should only happen if there is a bug in the compiler itself.
|
11715 |
+
// mostly for codegen development use
|
11716 |
+
/* istanbul ignore if */
|
11717 |
+
{
|
11718 |
+
if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
|
11719 |
+
warn$$1(
|
11720 |
+
"Failed to generate render function:\n\n" +
|
11721 |
+
fnGenErrors.map(function (ref) {
|
11722 |
+
var err = ref.err;
|
11723 |
+
var code = ref.code;
|
11724 |
+
|
11725 |
+
return ((err.toString()) + " in\n\n" + code + "\n");
|
11726 |
+
}).join('\n'),
|
11727 |
+
vm
|
11728 |
+
);
|
11729 |
+
}
|
11730 |
+
}
|
11731 |
+
|
11732 |
+
return (cache[key] = res)
|
11733 |
+
}
|
11734 |
+
}
|
11735 |
+
|
11736 |
+
/* */
|
11737 |
+
|
11738 |
+
function createCompilerCreator (baseCompile) {
|
11739 |
+
return function createCompiler (baseOptions) {
|
11740 |
+
function compile (
|
11741 |
+
template,
|
11742 |
+
options
|
11743 |
+
) {
|
11744 |
+
var finalOptions = Object.create(baseOptions);
|
11745 |
+
var errors = [];
|
11746 |
+
var tips = [];
|
11747 |
+
|
11748 |
+
var warn = function (msg, range, tip) {
|
11749 |
+
(tip ? tips : errors).push(msg);
|
11750 |
+
};
|
11751 |
+
|
11752 |
+
if (options) {
|
11753 |
+
if (options.outputSourceRange) {
|
11754 |
+
// $flow-disable-line
|
11755 |
+
var leadingSpaceLength = template.match(/^\s*/)[0].length;
|
11756 |
+
|
11757 |
+
warn = function (msg, range, tip) {
|
11758 |
+
var data = { msg: msg };
|
11759 |
+
if (range) {
|
11760 |
+
if (range.start != null) {
|
11761 |
+
data.start = range.start + leadingSpaceLength;
|
11762 |
+
}
|
11763 |
+
if (range.end != null) {
|
11764 |
+
data.end = range.end + leadingSpaceLength;
|
11765 |
+
}
|
11766 |
+
}
|
11767 |
+
(tip ? tips : errors).push(data);
|
11768 |
+
};
|
11769 |
+
}
|
11770 |
+
// merge custom modules
|
11771 |
+
if (options.modules) {
|
11772 |
+
finalOptions.modules =
|
11773 |
+
(baseOptions.modules || []).concat(options.modules);
|
11774 |
+
}
|
11775 |
+
// merge custom directives
|
11776 |
+
if (options.directives) {
|
11777 |
+
finalOptions.directives = extend(
|
11778 |
+
Object.create(baseOptions.directives || null),
|
11779 |
+
options.directives
|
11780 |
+
);
|
11781 |
+
}
|
11782 |
+
// copy other options
|
11783 |
+
for (var key in options) {
|
11784 |
+
if (key !== 'modules' && key !== 'directives') {
|
11785 |
+
finalOptions[key] = options[key];
|
11786 |
+
}
|
11787 |
+
}
|
11788 |
+
}
|
11789 |
+
|
11790 |
+
finalOptions.warn = warn;
|
11791 |
+
|
11792 |
+
var compiled = baseCompile(template.trim(), finalOptions);
|
11793 |
+
{
|
11794 |
+
detectErrors(compiled.ast, warn);
|
11795 |
+
}
|
11796 |
+
compiled.errors = errors;
|
11797 |
+
compiled.tips = tips;
|
11798 |
+
return compiled
|
11799 |
+
}
|
11800 |
+
|
11801 |
+
return {
|
11802 |
+
compile: compile,
|
11803 |
+
compileToFunctions: createCompileToFunctionFn(compile)
|
11804 |
+
}
|
11805 |
+
}
|
11806 |
+
}
|
11807 |
+
|
11808 |
+
/* */
|
11809 |
+
|
11810 |
+
// `createCompilerCreator` allows creating compilers that use alternative
|
11811 |
+
// parser/optimizer/codegen, e.g the SSR optimizing compiler.
|
11812 |
+
// Here we just export a default compiler using the default parts.
|
11813 |
+
var createCompiler = createCompilerCreator(function baseCompile (
|
11814 |
+
template,
|
11815 |
+
options
|
11816 |
+
) {
|
11817 |
+
var ast = parse(template.trim(), options);
|
11818 |
+
if (options.optimize !== false) {
|
11819 |
+
optimize(ast, options);
|
11820 |
+
}
|
11821 |
+
var code = generate(ast, options);
|
11822 |
+
return {
|
11823 |
+
ast: ast,
|
11824 |
+
render: code.render,
|
11825 |
+
staticRenderFns: code.staticRenderFns
|
11826 |
+
}
|
11827 |
+
});
|
11828 |
+
|
11829 |
+
/* */
|
11830 |
+
|
11831 |
+
var ref$1 = createCompiler(baseOptions);
|
11832 |
+
var compile = ref$1.compile;
|
11833 |
+
var compileToFunctions = ref$1.compileToFunctions;
|
11834 |
+
|
11835 |
+
/* */
|
11836 |
+
|
11837 |
+
// check whether current browser encodes a char inside attribute values
|
11838 |
+
var div;
|
11839 |
+
function getShouldDecode (href) {
|
11840 |
+
div = div || document.createElement('div');
|
11841 |
+
div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
|
11842 |
+
return div.innerHTML.indexOf(' ') > 0
|
11843 |
+
}
|
11844 |
+
|
11845 |
+
// #3663: IE encodes newlines inside attribute values while other browsers don't
|
11846 |
+
var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
|
11847 |
+
// #6828: chrome encodes content in a[href]
|
11848 |
+
var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
|
11849 |
+
|
11850 |
+
/* */
|
11851 |
+
|
11852 |
+
var idToTemplate = cached(function (id) {
|
11853 |
+
var el = query(id);
|
11854 |
+
return el && el.innerHTML
|
11855 |
+
});
|
11856 |
+
|
11857 |
+
var mount = Vue.prototype.$mount;
|
11858 |
+
Vue.prototype.$mount = function (
|
11859 |
+
el,
|
11860 |
+
hydrating
|
11861 |
+
) {
|
11862 |
+
el = el && query(el);
|
11863 |
+
|
11864 |
+
/* istanbul ignore if */
|
11865 |
+
if (el === document.body || el === document.documentElement) {
|
11866 |
+
warn(
|
11867 |
+
"Do not mount Vue to <html> or <body> - mount to normal elements instead."
|
11868 |
+
);
|
11869 |
+
return this
|
11870 |
+
}
|
11871 |
+
|
11872 |
+
var options = this.$options;
|
11873 |
+
// resolve template/el and convert to render function
|
11874 |
+
if (!options.render) {
|
11875 |
+
var template = options.template;
|
11876 |
+
if (template) {
|
11877 |
+
if (typeof template === 'string') {
|
11878 |
+
if (template.charAt(0) === '#') {
|
11879 |
+
template = idToTemplate(template);
|
11880 |
+
/* istanbul ignore if */
|
11881 |
+
if (!template) {
|
11882 |
+
warn(
|
11883 |
+
("Template element not found or is empty: " + (options.template)),
|
11884 |
+
this
|
11885 |
+
);
|
11886 |
+
}
|
11887 |
+
}
|
11888 |
+
} else if (template.nodeType) {
|
11889 |
+
template = template.innerHTML;
|
11890 |
+
} else {
|
11891 |
+
{
|
11892 |
+
warn('invalid template option:' + template, this);
|
11893 |
+
}
|
11894 |
+
return this
|
11895 |
+
}
|
11896 |
+
} else if (el) {
|
11897 |
+
template = getOuterHTML(el);
|
11898 |
+
}
|
11899 |
+
if (template) {
|
11900 |
+
/* istanbul ignore if */
|
11901 |
+
if (config.performance && mark) {
|
11902 |
+
mark('compile');
|
11903 |
+
}
|
11904 |
+
|
11905 |
+
var ref = compileToFunctions(template, {
|
11906 |
+
outputSourceRange: "development" !== 'production',
|
11907 |
+
shouldDecodeNewlines: shouldDecodeNewlines,
|
11908 |
+
shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
|
11909 |
+
delimiters: options.delimiters,
|
11910 |
+
comments: options.comments
|
11911 |
+
}, this);
|
11912 |
+
var render = ref.render;
|
11913 |
+
var staticRenderFns = ref.staticRenderFns;
|
11914 |
+
options.render = render;
|
11915 |
+
options.staticRenderFns = staticRenderFns;
|
11916 |
+
|
11917 |
+
/* istanbul ignore if */
|
11918 |
+
if (config.performance && mark) {
|
11919 |
+
mark('compile end');
|
11920 |
+
measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
|
11921 |
+
}
|
11922 |
+
}
|
11923 |
+
}
|
11924 |
+
return mount.call(this, el, hydrating)
|
11925 |
+
};
|
11926 |
+
|
11927 |
+
/**
|
11928 |
+
* Get outerHTML of elements, taking care
|
11929 |
+
* of SVG elements in IE as well.
|
11930 |
+
*/
|
11931 |
+
function getOuterHTML (el) {
|
11932 |
+
if (el.outerHTML) {
|
11933 |
+
return el.outerHTML
|
11934 |
+
} else {
|
11935 |
+
var container = document.createElement('div');
|
11936 |
+
container.appendChild(el.cloneNode(true));
|
11937 |
+
return container.innerHTML
|
11938 |
+
}
|
11939 |
+
}
|
11940 |
+
|
11941 |
+
Vue.compile = compileToFunctions;
|
11942 |
+
|
11943 |
+
return Vue;
|
11944 |
+
|
11945 |
+
}));
|
assets/js/vendor/vue.min.js
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Vue.js v2.6.10
|
3 |
+
* (c) 2014-2019 Evan You
|
4 |
+
* Released under the MIT License.
|
5 |
+
*/
|
6 |
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Vue=t()}(this,function(){"use strict";var e=Object.freeze({});function t(e){return null==e}function n(e){return null!=e}function r(e){return!0===e}function i(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function o(e){return null!==e&&"object"==typeof e}var a=Object.prototype.toString;function s(e){return"[object Object]"===a.call(e)}function c(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function u(e){return n(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function l(e){return null==e?"":Array.isArray(e)||s(e)&&e.toString===a?JSON.stringify(e,null,2):String(e)}function f(e){var t=parseFloat(e);return isNaN(t)?e:t}function p(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i<r.length;i++)n[r[i]]=!0;return t?function(e){return n[e.toLowerCase()]}:function(e){return n[e]}}var d=p("slot,component",!0),v=p("key,ref,slot,slot-scope,is");function h(e,t){if(e.length){var n=e.indexOf(t);if(n>-1)return e.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function y(e,t){return m.call(e,t)}function g(e){var t=Object.create(null);return function(n){return t[n]||(t[n]=e(n))}}var _=/-(\w)/g,b=g(function(e){return e.replace(_,function(e,t){return t?t.toUpperCase():""})}),$=g(function(e){return e.charAt(0).toUpperCase()+e.slice(1)}),w=/\B([A-Z])/g,C=g(function(e){return e.replace(w,"-$1").toLowerCase()});var x=Function.prototype.bind?function(e,t){return e.bind(t)}:function(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n};function k(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function A(e,t){for(var n in t)e[n]=t[n];return e}function O(e){for(var t={},n=0;n<e.length;n++)e[n]&&A(t,e[n]);return t}function S(e,t,n){}var T=function(e,t,n){return!1},E=function(e){return e};function N(e,t){if(e===t)return!0;var n=o(e),r=o(t);if(!n||!r)return!n&&!r&&String(e)===String(t);try{var i=Array.isArray(e),a=Array.isArray(t);if(i&&a)return e.length===t.length&&e.every(function(e,n){return N(e,t[n])});if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(i||a)return!1;var s=Object.keys(e),c=Object.keys(t);return s.length===c.length&&s.every(function(n){return N(e[n],t[n])})}catch(e){return!1}}function j(e,t){for(var n=0;n<e.length;n++)if(N(e[n],t))return n;return-1}function D(e){var t=!1;return function(){t||(t=!0,e.apply(this,arguments))}}var L="data-server-rendered",M=["component","directive","filter"],I=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured","serverPrefetch"],F={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:T,isReservedAttr:T,isUnknownElement:T,getTagNamespace:S,parsePlatformTagName:E,mustUseProp:T,async:!0,_lifecycleHooks:I},P=/a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;function R(e,t,n,r){Object.defineProperty(e,t,{value:n,enumerable:!!r,writable:!0,configurable:!0})}var H=new RegExp("[^"+P.source+".$_\\d]");var B,U="__proto__"in{},z="undefined"!=typeof window,V="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,K=V&&WXEnvironment.platform.toLowerCase(),J=z&&window.navigator.userAgent.toLowerCase(),q=J&&/msie|trident/.test(J),W=J&&J.indexOf("msie 9.0")>0,Z=J&&J.indexOf("edge/")>0,G=(J&&J.indexOf("android"),J&&/iphone|ipad|ipod|ios/.test(J)||"ios"===K),X=(J&&/chrome\/\d+/.test(J),J&&/phantomjs/.test(J),J&&J.match(/firefox\/(\d+)/)),Y={}.watch,Q=!1;if(z)try{var ee={};Object.defineProperty(ee,"passive",{get:function(){Q=!0}}),window.addEventListener("test-passive",null,ee)}catch(e){}var te=function(){return void 0===B&&(B=!z&&!V&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},ne=z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function re(e){return"function"==typeof e&&/native code/.test(e.toString())}var ie,oe="undefined"!=typeof Symbol&&re(Symbol)&&"undefined"!=typeof Reflect&&re(Reflect.ownKeys);ie="undefined"!=typeof Set&&re(Set)?Set:function(){function e(){this.set=Object.create(null)}return e.prototype.has=function(e){return!0===this.set[e]},e.prototype.add=function(e){this.set[e]=!0},e.prototype.clear=function(){this.set=Object.create(null)},e}();var ae=S,se=0,ce=function(){this.id=se++,this.subs=[]};ce.prototype.addSub=function(e){this.subs.push(e)},ce.prototype.removeSub=function(e){h(this.subs,e)},ce.prototype.depend=function(){ce.target&&ce.target.addDep(this)},ce.prototype.notify=function(){for(var e=this.subs.slice(),t=0,n=e.length;t<n;t++)e[t].update()},ce.target=null;var ue=[];function le(e){ue.push(e),ce.target=e}function fe(){ue.pop(),ce.target=ue[ue.length-1]}var pe=function(e,t,n,r,i,o,a,s){this.tag=e,this.data=t,this.children=n,this.text=r,this.elm=i,this.ns=void 0,this.context=o,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=t&&t.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1},de={child:{configurable:!0}};de.child.get=function(){return this.componentInstance},Object.defineProperties(pe.prototype,de);var ve=function(e){void 0===e&&(e="");var t=new pe;return t.text=e,t.isComment=!0,t};function he(e){return new pe(void 0,void 0,void 0,String(e))}function me(e){var t=new pe(e.tag,e.data,e.children&&e.children.slice(),e.text,e.elm,e.context,e.componentOptions,e.asyncFactory);return t.ns=e.ns,t.isStatic=e.isStatic,t.key=e.key,t.isComment=e.isComment,t.fnContext=e.fnContext,t.fnOptions=e.fnOptions,t.fnScopeId=e.fnScopeId,t.asyncMeta=e.asyncMeta,t.isCloned=!0,t}var ye=Array.prototype,ge=Object.create(ye);["push","pop","shift","unshift","splice","sort","reverse"].forEach(function(e){var t=ye[e];R(ge,e,function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];var i,o=t.apply(this,n),a=this.__ob__;switch(e){case"push":case"unshift":i=n;break;case"splice":i=n.slice(2)}return i&&a.observeArray(i),a.dep.notify(),o})});var _e=Object.getOwnPropertyNames(ge),be=!0;function $e(e){be=e}var we=function(e){var t;this.value=e,this.dep=new ce,this.vmCount=0,R(e,"__ob__",this),Array.isArray(e)?(U?(t=ge,e.__proto__=t):function(e,t,n){for(var r=0,i=n.length;r<i;r++){var o=n[r];R(e,o,t[o])}}(e,ge,_e),this.observeArray(e)):this.walk(e)};function Ce(e,t){var n;if(o(e)&&!(e instanceof pe))return y(e,"__ob__")&&e.__ob__ instanceof we?n=e.__ob__:be&&!te()&&(Array.isArray(e)||s(e))&&Object.isExtensible(e)&&!e._isVue&&(n=new we(e)),t&&n&&n.vmCount++,n}function xe(e,t,n,r,i){var o=new ce,a=Object.getOwnPropertyDescriptor(e,t);if(!a||!1!==a.configurable){var s=a&&a.get,c=a&&a.set;s&&!c||2!==arguments.length||(n=e[t]);var u=!i&&Ce(n);Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:function(){var t=s?s.call(e):n;return ce.target&&(o.depend(),u&&(u.dep.depend(),Array.isArray(t)&&function e(t){for(var n=void 0,r=0,i=t.length;r<i;r++)(n=t[r])&&n.__ob__&&n.__ob__.dep.depend(),Array.isArray(n)&&e(n)}(t))),t},set:function(t){var r=s?s.call(e):n;t===r||t!=t&&r!=r||s&&!c||(c?c.call(e,t):n=t,u=!i&&Ce(t),o.notify())}})}}function ke(e,t,n){if(Array.isArray(e)&&c(t))return e.length=Math.max(e.length,t),e.splice(t,1,n),n;if(t in e&&!(t in Object.prototype))return e[t]=n,n;var r=e.__ob__;return e._isVue||r&&r.vmCount?n:r?(xe(r.value,t,n),r.dep.notify(),n):(e[t]=n,n)}function Ae(e,t){if(Array.isArray(e)&&c(t))e.splice(t,1);else{var n=e.__ob__;e._isVue||n&&n.vmCount||y(e,t)&&(delete e[t],n&&n.dep.notify())}}we.prototype.walk=function(e){for(var t=Object.keys(e),n=0;n<t.length;n++)xe(e,t[n])},we.prototype.observeArray=function(e){for(var t=0,n=e.length;t<n;t++)Ce(e[t])};var Oe=F.optionMergeStrategies;function Se(e,t){if(!t)return e;for(var n,r,i,o=oe?Reflect.ownKeys(t):Object.keys(t),a=0;a<o.length;a++)"__ob__"!==(n=o[a])&&(r=e[n],i=t[n],y(e,n)?r!==i&&s(r)&&s(i)&&Se(r,i):ke(e,n,i));return e}function Te(e,t,n){return n?function(){var r="function"==typeof t?t.call(n,n):t,i="function"==typeof e?e.call(n,n):e;return r?Se(r,i):i}:t?e?function(){return Se("function"==typeof t?t.call(this,this):t,"function"==typeof e?e.call(this,this):e)}:t:e}function Ee(e,t){var n=t?e?e.concat(t):Array.isArray(t)?t:[t]:e;return n?function(e){for(var t=[],n=0;n<e.length;n++)-1===t.indexOf(e[n])&&t.push(e[n]);return t}(n):n}function Ne(e,t,n,r){var i=Object.create(e||null);return t?A(i,t):i}Oe.data=function(e,t,n){return n?Te(e,t,n):t&&"function"!=typeof t?e:Te(e,t)},I.forEach(function(e){Oe[e]=Ee}),M.forEach(function(e){Oe[e+"s"]=Ne}),Oe.watch=function(e,t,n,r){if(e===Y&&(e=void 0),t===Y&&(t=void 0),!t)return Object.create(e||null);if(!e)return t;var i={};for(var o in A(i,e),t){var a=i[o],s=t[o];a&&!Array.isArray(a)&&(a=[a]),i[o]=a?a.concat(s):Array.isArray(s)?s:[s]}return i},Oe.props=Oe.methods=Oe.inject=Oe.computed=function(e,t,n,r){if(!e)return t;var i=Object.create(null);return A(i,e),t&&A(i,t),i},Oe.provide=Te;var je=function(e,t){return void 0===t?e:t};function De(e,t,n){if("function"==typeof t&&(t=t.options),function(e,t){var n=e.props;if(n){var r,i,o={};if(Array.isArray(n))for(r=n.length;r--;)"string"==typeof(i=n[r])&&(o[b(i)]={type:null});else if(s(n))for(var a in n)i=n[a],o[b(a)]=s(i)?i:{type:i};e.props=o}}(t),function(e,t){var n=e.inject;if(n){var r=e.inject={};if(Array.isArray(n))for(var i=0;i<n.length;i++)r[n[i]]={from:n[i]};else if(s(n))for(var o in n){var a=n[o];r[o]=s(a)?A({from:o},a):{from:a}}}}(t),function(e){var t=e.directives;if(t)for(var n in t){var r=t[n];"function"==typeof r&&(t[n]={bind:r,update:r})}}(t),!t._base&&(t.extends&&(e=De(e,t.extends,n)),t.mixins))for(var r=0,i=t.mixins.length;r<i;r++)e=De(e,t.mixins[r],n);var o,a={};for(o in e)c(o);for(o in t)y(e,o)||c(o);function c(r){var i=Oe[r]||je;a[r]=i(e[r],t[r],n,r)}return a}function Le(e,t,n,r){if("string"==typeof n){var i=e[t];if(y(i,n))return i[n];var o=b(n);if(y(i,o))return i[o];var a=$(o);return y(i,a)?i[a]:i[n]||i[o]||i[a]}}function Me(e,t,n,r){var i=t[e],o=!y(n,e),a=n[e],s=Pe(Boolean,i.type);if(s>-1)if(o&&!y(i,"default"))a=!1;else if(""===a||a===C(e)){var c=Pe(String,i.type);(c<0||s<c)&&(a=!0)}if(void 0===a){a=function(e,t,n){if(!y(t,"default"))return;var r=t.default;if(e&&e.$options.propsData&&void 0===e.$options.propsData[n]&&void 0!==e._props[n])return e._props[n];return"function"==typeof r&&"Function"!==Ie(t.type)?r.call(e):r}(r,i,e);var u=be;$e(!0),Ce(a),$e(u)}return a}function Ie(e){var t=e&&e.toString().match(/^\s*function (\w+)/);return t?t[1]:""}function Fe(e,t){return Ie(e)===Ie(t)}function Pe(e,t){if(!Array.isArray(t))return Fe(t,e)?0:-1;for(var n=0,r=t.length;n<r;n++)if(Fe(t[n],e))return n;return-1}function Re(e,t,n){le();try{if(t)for(var r=t;r=r.$parent;){var i=r.$options.errorCaptured;if(i)for(var o=0;o<i.length;o++)try{if(!1===i[o].call(r,e,t,n))return}catch(e){Be(e,r,"errorCaptured hook")}}Be(e,t,n)}finally{fe()}}function He(e,t,n,r,i){var o;try{(o=n?e.apply(t,n):e.call(t))&&!o._isVue&&u(o)&&!o._handled&&(o.catch(function(e){return Re(e,r,i+" (Promise/async)")}),o._handled=!0)}catch(e){Re(e,r,i)}return o}function Be(e,t,n){if(F.errorHandler)try{return F.errorHandler.call(null,e,t,n)}catch(t){t!==e&&Ue(t,null,"config.errorHandler")}Ue(e,t,n)}function Ue(e,t,n){if(!z&&!V||"undefined"==typeof console)throw e;console.error(e)}var ze,Ve=!1,Ke=[],Je=!1;function qe(){Je=!1;var e=Ke.slice(0);Ke.length=0;for(var t=0;t<e.length;t++)e[t]()}if("undefined"!=typeof Promise&&re(Promise)){var We=Promise.resolve();ze=function(){We.then(qe),G&&setTimeout(S)},Ve=!0}else if(q||"undefined"==typeof MutationObserver||!re(MutationObserver)&&"[object MutationObserverConstructor]"!==MutationObserver.toString())ze="undefined"!=typeof setImmediate&&re(setImmediate)?function(){setImmediate(qe)}:function(){setTimeout(qe,0)};else{var Ze=1,Ge=new MutationObserver(qe),Xe=document.createTextNode(String(Ze));Ge.observe(Xe,{characterData:!0}),ze=function(){Ze=(Ze+1)%2,Xe.data=String(Ze)},Ve=!0}function Ye(e,t){var n;if(Ke.push(function(){if(e)try{e.call(t)}catch(e){Re(e,t,"nextTick")}else n&&n(t)}),Je||(Je=!0,ze()),!e&&"undefined"!=typeof Promise)return new Promise(function(e){n=e})}var Qe=new ie;function et(e){!function e(t,n){var r,i;var a=Array.isArray(t);if(!a&&!o(t)||Object.isFrozen(t)||t instanceof pe)return;if(t.__ob__){var s=t.__ob__.dep.id;if(n.has(s))return;n.add(s)}if(a)for(r=t.length;r--;)e(t[r],n);else for(i=Object.keys(t),r=i.length;r--;)e(t[i[r]],n)}(e,Qe),Qe.clear()}var tt=g(function(e){var t="&"===e.charAt(0),n="~"===(e=t?e.slice(1):e).charAt(0),r="!"===(e=n?e.slice(1):e).charAt(0);return{name:e=r?e.slice(1):e,once:n,capture:r,passive:t}});function nt(e,t){function n(){var e=arguments,r=n.fns;if(!Array.isArray(r))return He(r,null,arguments,t,"v-on handler");for(var i=r.slice(),o=0;o<i.length;o++)He(i[o],null,e,t,"v-on handler")}return n.fns=e,n}function rt(e,n,i,o,a,s){var c,u,l,f;for(c in e)u=e[c],l=n[c],f=tt(c),t(u)||(t(l)?(t(u.fns)&&(u=e[c]=nt(u,s)),r(f.once)&&(u=e[c]=a(f.name,u,f.capture)),i(f.name,u,f.capture,f.passive,f.params)):u!==l&&(l.fns=u,e[c]=l));for(c in n)t(e[c])&&o((f=tt(c)).name,n[c],f.capture)}function it(e,i,o){var a;e instanceof pe&&(e=e.data.hook||(e.data.hook={}));var s=e[i];function c(){o.apply(this,arguments),h(a.fns,c)}t(s)?a=nt([c]):n(s.fns)&&r(s.merged)?(a=s).fns.push(c):a=nt([s,c]),a.merged=!0,e[i]=a}function ot(e,t,r,i,o){if(n(t)){if(y(t,r))return e[r]=t[r],o||delete t[r],!0;if(y(t,i))return e[r]=t[i],o||delete t[i],!0}return!1}function at(e){return i(e)?[he(e)]:Array.isArray(e)?function e(o,a){var s=[];var c,u,l,f;for(c=0;c<o.length;c++)t(u=o[c])||"boolean"==typeof u||(l=s.length-1,f=s[l],Array.isArray(u)?u.length>0&&(st((u=e(u,(a||"")+"_"+c))[0])&&st(f)&&(s[l]=he(f.text+u[0].text),u.shift()),s.push.apply(s,u)):i(u)?st(f)?s[l]=he(f.text+u):""!==u&&s.push(he(u)):st(u)&&st(f)?s[l]=he(f.text+u.text):(r(o._isVList)&&n(u.tag)&&t(u.key)&&n(a)&&(u.key="__vlist"+a+"_"+c+"__"),s.push(u)));return s}(e):void 0}function st(e){return n(e)&&n(e.text)&&!1===e.isComment}function ct(e,t){if(e){for(var n=Object.create(null),r=oe?Reflect.ownKeys(e):Object.keys(e),i=0;i<r.length;i++){var o=r[i];if("__ob__"!==o){for(var a=e[o].from,s=t;s;){if(s._provided&&y(s._provided,a)){n[o]=s._provided[a];break}s=s.$parent}if(!s&&"default"in e[o]){var c=e[o].default;n[o]="function"==typeof c?c.call(t):c}}}return n}}function ut(e,t){if(!e||!e.length)return{};for(var n={},r=0,i=e.length;r<i;r++){var o=e[r],a=o.data;if(a&&a.attrs&&a.attrs.slot&&delete a.attrs.slot,o.context!==t&&o.fnContext!==t||!a||null==a.slot)(n.default||(n.default=[])).push(o);else{var s=a.slot,c=n[s]||(n[s]=[]);"template"===o.tag?c.push.apply(c,o.children||[]):c.push(o)}}for(var u in n)n[u].every(lt)&&delete n[u];return n}function lt(e){return e.isComment&&!e.asyncFactory||" "===e.text}function ft(t,n,r){var i,o=Object.keys(n).length>0,a=t?!!t.$stable:!o,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==e&&s===r.$key&&!o&&!r.$hasNormal)return r;for(var c in i={},t)t[c]&&"$"!==c[0]&&(i[c]=pt(n,c,t[c]))}else i={};for(var u in n)u in i||(i[u]=dt(n,u));return t&&Object.isExtensible(t)&&(t._normalized=i),R(i,"$stable",a),R(i,"$key",s),R(i,"$hasNormal",o),i}function pt(e,t,n){var r=function(){var e=arguments.length?n.apply(null,arguments):n({});return(e=e&&"object"==typeof e&&!Array.isArray(e)?[e]:at(e))&&(0===e.length||1===e.length&&e[0].isComment)?void 0:e};return n.proxy&&Object.defineProperty(e,t,{get:r,enumerable:!0,configurable:!0}),r}function dt(e,t){return function(){return e[t]}}function vt(e,t){var r,i,a,s,c;if(Array.isArray(e)||"string"==typeof e)for(r=new Array(e.length),i=0,a=e.length;i<a;i++)r[i]=t(e[i],i);else if("number"==typeof e)for(r=new Array(e),i=0;i<e;i++)r[i]=t(i+1,i);else if(o(e))if(oe&&e[Symbol.iterator]){r=[];for(var u=e[Symbol.iterator](),l=u.next();!l.done;)r.push(t(l.value,r.length)),l=u.next()}else for(s=Object.keys(e),r=new Array(s.length),i=0,a=s.length;i<a;i++)c=s[i],r[i]=t(e[c],c,i);return n(r)||(r=[]),r._isVList=!0,r}function ht(e,t,n,r){var i,o=this.$scopedSlots[e];o?(n=n||{},r&&(n=A(A({},r),n)),i=o(n)||t):i=this.$slots[e]||t;var a=n&&n.slot;return a?this.$createElement("template",{slot:a},i):i}function mt(e){return Le(this.$options,"filters",e)||E}function yt(e,t){return Array.isArray(e)?-1===e.indexOf(t):e!==t}function gt(e,t,n,r,i){var o=F.keyCodes[t]||n;return i&&r&&!F.keyCodes[t]?yt(i,r):o?yt(o,e):r?C(r)!==t:void 0}function _t(e,t,n,r,i){if(n)if(o(n)){var a;Array.isArray(n)&&(n=O(n));var s=function(o){if("class"===o||"style"===o||v(o))a=e;else{var s=e.attrs&&e.attrs.type;a=r||F.mustUseProp(t,s,o)?e.domProps||(e.domProps={}):e.attrs||(e.attrs={})}var c=b(o),u=C(o);c in a||u in a||(a[o]=n[o],i&&((e.on||(e.on={}))["update:"+o]=function(e){n[o]=e}))};for(var c in n)s(c)}else;return e}function bt(e,t){var n=this._staticTrees||(this._staticTrees=[]),r=n[e];return r&&!t?r:(wt(r=n[e]=this.$options.staticRenderFns[e].call(this._renderProxy,null,this),"__static__"+e,!1),r)}function $t(e,t,n){return wt(e,"__once__"+t+(n?"_"+n:""),!0),e}function wt(e,t,n){if(Array.isArray(e))for(var r=0;r<e.length;r++)e[r]&&"string"!=typeof e[r]&&Ct(e[r],t+"_"+r,n);else Ct(e,t,n)}function Ct(e,t,n){e.isStatic=!0,e.key=t,e.isOnce=n}function xt(e,t){if(t)if(s(t)){var n=e.on=e.on?A({},e.on):{};for(var r in t){var i=n[r],o=t[r];n[r]=i?[].concat(i,o):o}}else;return e}function kt(e,t,n,r){t=t||{$stable:!n};for(var i=0;i<e.length;i++){var o=e[i];Array.isArray(o)?kt(o,t,n):o&&(o.proxy&&(o.fn.proxy=!0),t[o.key]=o.fn)}return r&&(t.$key=r),t}function At(e,t){for(var n=0;n<t.length;n+=2){var r=t[n];"string"==typeof r&&r&&(e[t[n]]=t[n+1])}return e}function Ot(e,t){return"string"==typeof e?t+e:e}function St(e){e._o=$t,e._n=f,e._s=l,e._l=vt,e._t=ht,e._q=N,e._i=j,e._m=bt,e._f=mt,e._k=gt,e._b=_t,e._v=he,e._e=ve,e._u=kt,e._g=xt,e._d=At,e._p=Ot}function Tt(t,n,i,o,a){var s,c=this,u=a.options;y(o,"_uid")?(s=Object.create(o))._original=o:(s=o,o=o._original);var l=r(u._compiled),f=!l;this.data=t,this.props=n,this.children=i,this.parent=o,this.listeners=t.on||e,this.injections=ct(u.inject,o),this.slots=function(){return c.$slots||ft(t.scopedSlots,c.$slots=ut(i,o)),c.$slots},Object.defineProperty(this,"scopedSlots",{enumerable:!0,get:function(){return ft(t.scopedSlots,this.slots())}}),l&&(this.$options=u,this.$slots=this.slots(),this.$scopedSlots=ft(t.scopedSlots,this.$slots)),u._scopeId?this._c=function(e,t,n,r){var i=Pt(s,e,t,n,r,f);return i&&!Array.isArray(i)&&(i.fnScopeId=u._scopeId,i.fnContext=o),i}:this._c=function(e,t,n,r){return Pt(s,e,t,n,r,f)}}function Et(e,t,n,r,i){var o=me(e);return o.fnContext=n,o.fnOptions=r,t.slot&&((o.data||(o.data={})).slot=t.slot),o}function Nt(e,t){for(var n in t)e[b(n)]=t[n]}St(Tt.prototype);var jt={init:function(e,t){if(e.componentInstance&&!e.componentInstance._isDestroyed&&e.data.keepAlive){var r=e;jt.prepatch(r,r)}else{(e.componentInstance=function(e,t){var r={_isComponent:!0,_parentVnode:e,parent:t},i=e.data.inlineTemplate;n(i)&&(r.render=i.render,r.staticRenderFns=i.staticRenderFns);return new e.componentOptions.Ctor(r)}(e,Wt)).$mount(t?e.elm:void 0,t)}},prepatch:function(t,n){var r=n.componentOptions;!function(t,n,r,i,o){var a=i.data.scopedSlots,s=t.$scopedSlots,c=!!(a&&!a.$stable||s!==e&&!s.$stable||a&&t.$scopedSlots.$key!==a.$key),u=!!(o||t.$options._renderChildren||c);t.$options._parentVnode=i,t.$vnode=i,t._vnode&&(t._vnode.parent=i);if(t.$options._renderChildren=o,t.$attrs=i.data.attrs||e,t.$listeners=r||e,n&&t.$options.props){$e(!1);for(var l=t._props,f=t.$options._propKeys||[],p=0;p<f.length;p++){var d=f[p],v=t.$options.props;l[d]=Me(d,v,n,t)}$e(!0),t.$options.propsData=n}r=r||e;var h=t.$options._parentListeners;t.$options._parentListeners=r,qt(t,r,h),u&&(t.$slots=ut(o,i.context),t.$forceUpdate())}(n.componentInstance=t.componentInstance,r.propsData,r.listeners,n,r.children)},insert:function(e){var t,n=e.context,r=e.componentInstance;r._isMounted||(r._isMounted=!0,Yt(r,"mounted")),e.data.keepAlive&&(n._isMounted?((t=r)._inactive=!1,en.push(t)):Xt(r,!0))},destroy:function(e){var t=e.componentInstance;t._isDestroyed||(e.data.keepAlive?function e(t,n){if(n&&(t._directInactive=!0,Gt(t)))return;if(!t._inactive){t._inactive=!0;for(var r=0;r<t.$children.length;r++)e(t.$children[r]);Yt(t,"deactivated")}}(t,!0):t.$destroy())}},Dt=Object.keys(jt);function Lt(i,a,s,c,l){if(!t(i)){var f=s.$options._base;if(o(i)&&(i=f.extend(i)),"function"==typeof i){var p;if(t(i.cid)&&void 0===(i=function(e,i){if(r(e.error)&&n(e.errorComp))return e.errorComp;if(n(e.resolved))return e.resolved;var a=Ht;a&&n(e.owners)&&-1===e.owners.indexOf(a)&&e.owners.push(a);if(r(e.loading)&&n(e.loadingComp))return e.loadingComp;if(a&&!n(e.owners)){var s=e.owners=[a],c=!0,l=null,f=null;a.$on("hook:destroyed",function(){return h(s,a)});var p=function(e){for(var t=0,n=s.length;t<n;t++)s[t].$forceUpdate();e&&(s.length=0,null!==l&&(clearTimeout(l),l=null),null!==f&&(clearTimeout(f),f=null))},d=D(function(t){e.resolved=Bt(t,i),c?s.length=0:p(!0)}),v=D(function(t){n(e.errorComp)&&(e.error=!0,p(!0))}),m=e(d,v);return o(m)&&(u(m)?t(e.resolved)&&m.then(d,v):u(m.component)&&(m.component.then(d,v),n(m.error)&&(e.errorComp=Bt(m.error,i)),n(m.loading)&&(e.loadingComp=Bt(m.loading,i),0===m.delay?e.loading=!0:l=setTimeout(function(){l=null,t(e.resolved)&&t(e.error)&&(e.loading=!0,p(!1))},m.delay||200)),n(m.timeout)&&(f=setTimeout(function(){f=null,t(e.resolved)&&v(null)},m.timeout)))),c=!1,e.loading?e.loadingComp:e.resolved}}(p=i,f)))return function(e,t,n,r,i){var o=ve();return o.asyncFactory=e,o.asyncMeta={data:t,context:n,children:r,tag:i},o}(p,a,s,c,l);a=a||{},$n(i),n(a.model)&&function(e,t){var r=e.model&&e.model.prop||"value",i=e.model&&e.model.event||"input";(t.attrs||(t.attrs={}))[r]=t.model.value;var o=t.on||(t.on={}),a=o[i],s=t.model.callback;n(a)?(Array.isArray(a)?-1===a.indexOf(s):a!==s)&&(o[i]=[s].concat(a)):o[i]=s}(i.options,a);var d=function(e,r,i){var o=r.options.props;if(!t(o)){var a={},s=e.attrs,c=e.props;if(n(s)||n(c))for(var u in o){var l=C(u);ot(a,c,u,l,!0)||ot(a,s,u,l,!1)}return a}}(a,i);if(r(i.options.functional))return function(t,r,i,o,a){var s=t.options,c={},u=s.props;if(n(u))for(var l in u)c[l]=Me(l,u,r||e);else n(i.attrs)&&Nt(c,i.attrs),n(i.props)&&Nt(c,i.props);var f=new Tt(i,c,a,o,t),p=s.render.call(null,f._c,f);if(p instanceof pe)return Et(p,i,f.parent,s);if(Array.isArray(p)){for(var d=at(p)||[],v=new Array(d.length),h=0;h<d.length;h++)v[h]=Et(d[h],i,f.parent,s);return v}}(i,d,a,s,c);var v=a.on;if(a.on=a.nativeOn,r(i.options.abstract)){var m=a.slot;a={},m&&(a.slot=m)}!function(e){for(var t=e.hook||(e.hook={}),n=0;n<Dt.length;n++){var r=Dt[n],i=t[r],o=jt[r];i===o||i&&i._merged||(t[r]=i?Mt(o,i):o)}}(a);var y=i.options.name||l;return new pe("vue-component-"+i.cid+(y?"-"+y:""),a,void 0,void 0,void 0,s,{Ctor:i,propsData:d,listeners:v,tag:l,children:c},p)}}}function Mt(e,t){var n=function(n,r){e(n,r),t(n,r)};return n._merged=!0,n}var It=1,Ft=2;function Pt(e,a,s,c,u,l){return(Array.isArray(s)||i(s))&&(u=c,c=s,s=void 0),r(l)&&(u=Ft),function(e,i,a,s,c){if(n(a)&&n(a.__ob__))return ve();n(a)&&n(a.is)&&(i=a.is);if(!i)return ve();Array.isArray(s)&&"function"==typeof s[0]&&((a=a||{}).scopedSlots={default:s[0]},s.length=0);c===Ft?s=at(s):c===It&&(s=function(e){for(var t=0;t<e.length;t++)if(Array.isArray(e[t]))return Array.prototype.concat.apply([],e);return e}(s));var u,l;if("string"==typeof i){var f;l=e.$vnode&&e.$vnode.ns||F.getTagNamespace(i),u=F.isReservedTag(i)?new pe(F.parsePlatformTagName(i),a,s,void 0,void 0,e):a&&a.pre||!n(f=Le(e.$options,"components",i))?new pe(i,a,s,void 0,void 0,e):Lt(f,a,e,s,i)}else u=Lt(i,a,e,s);return Array.isArray(u)?u:n(u)?(n(l)&&function e(i,o,a){i.ns=o;"foreignObject"===i.tag&&(o=void 0,a=!0);if(n(i.children))for(var s=0,c=i.children.length;s<c;s++){var u=i.children[s];n(u.tag)&&(t(u.ns)||r(a)&&"svg"!==u.tag)&&e(u,o,a)}}(u,l),n(a)&&function(e){o(e.style)&&et(e.style);o(e.class)&&et(e.class)}(a),u):ve()}(e,a,s,c,u)}var Rt,Ht=null;function Bt(e,t){return(e.__esModule||oe&&"Module"===e[Symbol.toStringTag])&&(e=e.default),o(e)?t.extend(e):e}function Ut(e){return e.isComment&&e.asyncFactory}function zt(e){if(Array.isArray(e))for(var t=0;t<e.length;t++){var r=e[t];if(n(r)&&(n(r.componentOptions)||Ut(r)))return r}}function Vt(e,t){Rt.$on(e,t)}function Kt(e,t){Rt.$off(e,t)}function Jt(e,t){var n=Rt;return function r(){null!==t.apply(null,arguments)&&n.$off(e,r)}}function qt(e,t,n){Rt=e,rt(t,n||{},Vt,Kt,Jt,e),Rt=void 0}var Wt=null;function Zt(e){var t=Wt;return Wt=e,function(){Wt=t}}function Gt(e){for(;e&&(e=e.$parent);)if(e._inactive)return!0;return!1}function Xt(e,t){if(t){if(e._directInactive=!1,Gt(e))return}else if(e._directInactive)return;if(e._inactive||null===e._inactive){e._inactive=!1;for(var n=0;n<e.$children.length;n++)Xt(e.$children[n]);Yt(e,"activated")}}function Yt(e,t){le();var n=e.$options[t],r=t+" hook";if(n)for(var i=0,o=n.length;i<o;i++)He(n[i],e,null,e,r);e._hasHookEvent&&e.$emit("hook:"+t),fe()}var Qt=[],en=[],tn={},nn=!1,rn=!1,on=0;var an=0,sn=Date.now;if(z&&!q){var cn=window.performance;cn&&"function"==typeof cn.now&&sn()>document.createEvent("Event").timeStamp&&(sn=function(){return cn.now()})}function un(){var e,t;for(an=sn(),rn=!0,Qt.sort(function(e,t){return e.id-t.id}),on=0;on<Qt.length;on++)(e=Qt[on]).before&&e.before(),t=e.id,tn[t]=null,e.run();var n=en.slice(),r=Qt.slice();on=Qt.length=en.length=0,tn={},nn=rn=!1,function(e){for(var t=0;t<e.length;t++)e[t]._inactive=!0,Xt(e[t],!0)}(n),function(e){var t=e.length;for(;t--;){var n=e[t],r=n.vm;r._watcher===n&&r._isMounted&&!r._isDestroyed&&Yt(r,"updated")}}(r),ne&&F.devtools&&ne.emit("flush")}var ln=0,fn=function(e,t,n,r,i){this.vm=e,i&&(e._watcher=this),e._watchers.push(this),r?(this.deep=!!r.deep,this.user=!!r.user,this.lazy=!!r.lazy,this.sync=!!r.sync,this.before=r.before):this.deep=this.user=this.lazy=this.sync=!1,this.cb=n,this.id=++ln,this.active=!0,this.dirty=this.lazy,this.deps=[],this.newDeps=[],this.depIds=new ie,this.newDepIds=new ie,this.expression="","function"==typeof t?this.getter=t:(this.getter=function(e){if(!H.test(e)){var t=e.split(".");return function(e){for(var n=0;n<t.length;n++){if(!e)return;e=e[t[n]]}return e}}}(t),this.getter||(this.getter=S)),this.value=this.lazy?void 0:this.get()};fn.prototype.get=function(){var e;le(this);var t=this.vm;try{e=this.getter.call(t,t)}catch(e){if(!this.user)throw e;Re(e,t,'getter for watcher "'+this.expression+'"')}finally{this.deep&&et(e),fe(),this.cleanupDeps()}return e},fn.prototype.addDep=function(e){var t=e.id;this.newDepIds.has(t)||(this.newDepIds.add(t),this.newDeps.push(e),this.depIds.has(t)||e.addSub(this))},fn.prototype.cleanupDeps=function(){for(var e=this.deps.length;e--;){var t=this.deps[e];this.newDepIds.has(t.id)||t.removeSub(this)}var n=this.depIds;this.depIds=this.newDepIds,this.newDepIds=n,this.newDepIds.clear(),n=this.deps,this.deps=this.newDeps,this.newDeps=n,this.newDeps.length=0},fn.prototype.update=function(){this.lazy?this.dirty=!0:this.sync?this.run():function(e){var t=e.id;if(null==tn[t]){if(tn[t]=!0,rn){for(var n=Qt.length-1;n>on&&Qt[n].id>e.id;)n--;Qt.splice(n+1,0,e)}else Qt.push(e);nn||(nn=!0,Ye(un))}}(this)},fn.prototype.run=function(){if(this.active){var e=this.get();if(e!==this.value||o(e)||this.deep){var t=this.value;if(this.value=e,this.user)try{this.cb.call(this.vm,e,t)}catch(e){Re(e,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,e,t)}}},fn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},fn.prototype.depend=function(){for(var e=this.deps.length;e--;)this.deps[e].depend()},fn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||h(this.vm._watchers,this);for(var e=this.deps.length;e--;)this.deps[e].removeSub(this);this.active=!1}};var pn={enumerable:!0,configurable:!0,get:S,set:S};function dn(e,t,n){pn.get=function(){return this[t][n]},pn.set=function(e){this[t][n]=e},Object.defineProperty(e,n,pn)}function vn(e){e._watchers=[];var t=e.$options;t.props&&function(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[];e.$parent&&$e(!1);var o=function(o){i.push(o);var a=Me(o,t,n,e);xe(r,o,a),o in e||dn(e,"_props",o)};for(var a in t)o(a);$e(!0)}(e,t.props),t.methods&&function(e,t){e.$options.props;for(var n in t)e[n]="function"!=typeof t[n]?S:x(t[n],e)}(e,t.methods),t.data?function(e){var t=e.$options.data;s(t=e._data="function"==typeof t?function(e,t){le();try{return e.call(t,t)}catch(e){return Re(e,t,"data()"),{}}finally{fe()}}(t,e):t||{})||(t={});var n=Object.keys(t),r=e.$options.props,i=(e.$options.methods,n.length);for(;i--;){var o=n[i];r&&y(r,o)||(a=void 0,36!==(a=(o+"").charCodeAt(0))&&95!==a&&dn(e,"_data",o))}var a;Ce(t,!0)}(e):Ce(e._data={},!0),t.computed&&function(e,t){var n=e._computedWatchers=Object.create(null),r=te();for(var i in t){var o=t[i],a="function"==typeof o?o:o.get;r||(n[i]=new fn(e,a||S,S,hn)),i in e||mn(e,i,o)}}(e,t.computed),t.watch&&t.watch!==Y&&function(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i<r.length;i++)_n(e,n,r[i]);else _n(e,n,r)}}(e,t.watch)}var hn={lazy:!0};function mn(e,t,n){var r=!te();"function"==typeof n?(pn.get=r?yn(t):gn(n),pn.set=S):(pn.get=n.get?r&&!1!==n.cache?yn(t):gn(n.get):S,pn.set=n.set||S),Object.defineProperty(e,t,pn)}function yn(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),ce.target&&t.depend(),t.value}}function gn(e){return function(){return e.call(this,this)}}function _n(e,t,n,r){return s(n)&&(r=n,n=n.handler),"string"==typeof n&&(n=e[n]),e.$watch(t,n,r)}var bn=0;function $n(e){var t=e.options;if(e.super){var n=$n(e.super);if(n!==e.superOptions){e.superOptions=n;var r=function(e){var t,n=e.options,r=e.sealedOptions;for(var i in n)n[i]!==r[i]&&(t||(t={}),t[i]=n[i]);return t}(e);r&&A(e.extendOptions,r),(t=e.options=De(n,e.extendOptions)).name&&(t.components[t.name]=e)}}return t}function wn(e){this._init(e)}function Cn(e){e.cid=0;var t=1;e.extend=function(e){e=e||{};var n=this,r=n.cid,i=e._Ctor||(e._Ctor={});if(i[r])return i[r];var o=e.name||n.options.name,a=function(e){this._init(e)};return(a.prototype=Object.create(n.prototype)).constructor=a,a.cid=t++,a.options=De(n.options,e),a.super=n,a.options.props&&function(e){var t=e.options.props;for(var n in t)dn(e.prototype,"_props",n)}(a),a.options.computed&&function(e){var t=e.options.computed;for(var n in t)mn(e.prototype,n,t[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,M.forEach(function(e){a[e]=n[e]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=e,a.sealedOptions=A({},a.options),i[r]=a,a}}function xn(e){return e&&(e.Ctor.options.name||e.tag)}function kn(e,t){return Array.isArray(e)?e.indexOf(t)>-1:"string"==typeof e?e.split(",").indexOf(t)>-1:(n=e,"[object RegExp]"===a.call(n)&&e.test(t));var n}function An(e,t){var n=e.cache,r=e.keys,i=e._vnode;for(var o in n){var a=n[o];if(a){var s=xn(a.componentOptions);s&&!t(s)&&On(n,o,r,i)}}}function On(e,t,n,r){var i=e[t];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),e[t]=null,h(n,t)}!function(t){t.prototype._init=function(t){var n=this;n._uid=bn++,n._isVue=!0,t&&t._isComponent?function(e,t){var n=e.$options=Object.create(e.constructor.options),r=t._parentVnode;n.parent=t.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,t.render&&(n.render=t.render,n.staticRenderFns=t.staticRenderFns)}(n,t):n.$options=De($n(n.constructor),t||{},n),n._renderProxy=n,n._self=n,function(e){var t=e.$options,n=t.parent;if(n&&!t.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(e)}e.$parent=n,e.$root=n?n.$root:e,e.$children=[],e.$refs={},e._watcher=null,e._inactive=null,e._directInactive=!1,e._isMounted=!1,e._isDestroyed=!1,e._isBeingDestroyed=!1}(n),function(e){e._events=Object.create(null),e._hasHookEvent=!1;var t=e.$options._parentListeners;t&&qt(e,t)}(n),function(t){t._vnode=null,t._staticTrees=null;var n=t.$options,r=t.$vnode=n._parentVnode,i=r&&r.context;t.$slots=ut(n._renderChildren,i),t.$scopedSlots=e,t._c=function(e,n,r,i){return Pt(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return Pt(t,e,n,r,i,!0)};var o=r&&r.data;xe(t,"$attrs",o&&o.attrs||e,null,!0),xe(t,"$listeners",n._parentListeners||e,null,!0)}(n),Yt(n,"beforeCreate"),function(e){var t=ct(e.$options.inject,e);t&&($e(!1),Object.keys(t).forEach(function(n){xe(e,n,t[n])}),$e(!0))}(n),vn(n),function(e){var t=e.$options.provide;t&&(e._provided="function"==typeof t?t.call(e):t)}(n),Yt(n,"created"),n.$options.el&&n.$mount(n.$options.el)}}(wn),function(e){var t={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(e.prototype,"$data",t),Object.defineProperty(e.prototype,"$props",n),e.prototype.$set=ke,e.prototype.$delete=Ae,e.prototype.$watch=function(e,t,n){if(s(t))return _n(this,e,t,n);(n=n||{}).user=!0;var r=new fn(this,e,t,n);if(n.immediate)try{t.call(this,r.value)}catch(e){Re(e,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(wn),function(e){var t=/^hook:/;e.prototype.$on=function(e,n){var r=this;if(Array.isArray(e))for(var i=0,o=e.length;i<o;i++)r.$on(e[i],n);else(r._events[e]||(r._events[e]=[])).push(n),t.test(e)&&(r._hasHookEvent=!0);return r},e.prototype.$once=function(e,t){var n=this;function r(){n.$off(e,r),t.apply(n,arguments)}return r.fn=t,n.$on(e,r),n},e.prototype.$off=function(e,t){var n=this;if(!arguments.length)return n._events=Object.create(null),n;if(Array.isArray(e)){for(var r=0,i=e.length;r<i;r++)n.$off(e[r],t);return n}var o,a=n._events[e];if(!a)return n;if(!t)return n._events[e]=null,n;for(var s=a.length;s--;)if((o=a[s])===t||o.fn===t){a.splice(s,1);break}return n},e.prototype.$emit=function(e){var t=this._events[e];if(t){t=t.length>1?k(t):t;for(var n=k(arguments,1),r='event handler for "'+e+'"',i=0,o=t.length;i<o;i++)He(t[i],this,n,this,r)}return this}}(wn),function(e){e.prototype._update=function(e,t){var n=this,r=n.$el,i=n._vnode,o=Zt(n);n._vnode=e,n.$el=i?n.__patch__(i,e):n.__patch__(n.$el,e,t,!1),o(),r&&(r.__vue__=null),n.$el&&(n.$el.__vue__=n),n.$vnode&&n.$parent&&n.$vnode===n.$parent._vnode&&(n.$parent.$el=n.$el)},e.prototype.$forceUpdate=function(){this._watcher&&this._watcher.update()},e.prototype.$destroy=function(){var e=this;if(!e._isBeingDestroyed){Yt(e,"beforeDestroy"),e._isBeingDestroyed=!0;var t=e.$parent;!t||t._isBeingDestroyed||e.$options.abstract||h(t.$children,e),e._watcher&&e._watcher.teardown();for(var n=e._watchers.length;n--;)e._watchers[n].teardown();e._data.__ob__&&e._data.__ob__.vmCount--,e._isDestroyed=!0,e.__patch__(e._vnode,null),Yt(e,"destroyed"),e.$off(),e.$el&&(e.$el.__vue__=null),e.$vnode&&(e.$vnode.parent=null)}}}(wn),function(e){St(e.prototype),e.prototype.$nextTick=function(e){return Ye(e,this)},e.prototype._render=function(){var e,t=this,n=t.$options,r=n.render,i=n._parentVnode;i&&(t.$scopedSlots=ft(i.data.scopedSlots,t.$slots,t.$scopedSlots)),t.$vnode=i;try{Ht=t,e=r.call(t._renderProxy,t.$createElement)}catch(n){Re(n,t,"render"),e=t._vnode}finally{Ht=null}return Array.isArray(e)&&1===e.length&&(e=e[0]),e instanceof pe||(e=ve()),e.parent=i,e}}(wn);var Sn=[String,RegExp,Array],Tn={KeepAlive:{name:"keep-alive",abstract:!0,props:{include:Sn,exclude:Sn,max:[String,Number]},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var e in this.cache)On(this.cache,e,this.keys)},mounted:function(){var e=this;this.$watch("include",function(t){An(e,function(e){return kn(t,e)})}),this.$watch("exclude",function(t){An(e,function(e){return!kn(t,e)})})},render:function(){var e=this.$slots.default,t=zt(e),n=t&&t.componentOptions;if(n){var r=xn(n),i=this.include,o=this.exclude;if(i&&(!r||!kn(i,r))||o&&r&&kn(o,r))return t;var a=this.cache,s=this.keys,c=null==t.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):t.key;a[c]?(t.componentInstance=a[c].componentInstance,h(s,c),s.push(c)):(a[c]=t,s.push(c),this.max&&s.length>parseInt(this.max)&&On(a,s[0],s,this._vnode)),t.data.keepAlive=!0}return t||e&&e[0]}}};!function(e){var t={get:function(){return F}};Object.defineProperty(e,"config",t),e.util={warn:ae,extend:A,mergeOptions:De,defineReactive:xe},e.set=ke,e.delete=Ae,e.nextTick=Ye,e.observable=function(e){return Ce(e),e},e.options=Object.create(null),M.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,A(e.options.components,Tn),function(e){e.use=function(e){var t=this._installedPlugins||(this._installedPlugins=[]);if(t.indexOf(e)>-1)return this;var n=k(arguments,1);return n.unshift(this),"function"==typeof e.install?e.install.apply(e,n):"function"==typeof e&&e.apply(null,n),t.push(e),this}}(e),function(e){e.mixin=function(e){return this.options=De(this.options,e),this}}(e),Cn(e),function(e){M.forEach(function(t){e[t]=function(e,n){return n?("component"===t&&s(n)&&(n.name=n.name||e,n=this.options._base.extend(n)),"directive"===t&&"function"==typeof n&&(n={bind:n,update:n}),this.options[t+"s"][e]=n,n):this.options[t+"s"][e]}})}(e)}(wn),Object.defineProperty(wn.prototype,"$isServer",{get:te}),Object.defineProperty(wn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(wn,"FunctionalRenderContext",{value:Tt}),wn.version="2.6.10";var En=p("style,class"),Nn=p("input,textarea,option,select,progress"),jn=function(e,t,n){return"value"===n&&Nn(e)&&"button"!==t||"selected"===n&&"option"===e||"checked"===n&&"input"===e||"muted"===n&&"video"===e},Dn=p("contenteditable,draggable,spellcheck"),Ln=p("events,caret,typing,plaintext-only"),Mn=function(e,t){return Hn(t)||"false"===t?"false":"contenteditable"===e&&Ln(t)?t:"true"},In=p("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),Fn="http://www.w3.org/1999/xlink",Pn=function(e){return":"===e.charAt(5)&&"xlink"===e.slice(0,5)},Rn=function(e){return Pn(e)?e.slice(6,e.length):""},Hn=function(e){return null==e||!1===e};function Bn(e){for(var t=e.data,r=e,i=e;n(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(t=Un(i.data,t));for(;n(r=r.parent);)r&&r.data&&(t=Un(t,r.data));return function(e,t){if(n(e)||n(t))return zn(e,Vn(t));return""}(t.staticClass,t.class)}function Un(e,t){return{staticClass:zn(e.staticClass,t.staticClass),class:n(e.class)?[e.class,t.class]:t.class}}function zn(e,t){return e?t?e+" "+t:e:t||""}function Vn(e){return Array.isArray(e)?function(e){for
|