Image optimization & Lazy Load by Optimole - Version 2.0.7

Version Description

Download this release

Release Info

Developer optimole
Plugin Icon 128x128 Image optimization & Lazy Load by Optimole
Version 2.0.7
Comparing to
See all releases

Code changes from version 2.0.6 to 2.0.7

CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
#### [Version 2.0.6](https://github.com/Codeinwp/optimole-wp/compare/v2.0.5...v2.0.6) (2019-03-29)
2
3
* **Bug Fixes**
1
+ #### [Version 2.0.7](https://github.com/Codeinwp/optimole-wp/compare/v2.0.6...v2.0.7) (2019-05-29)
2
+
3
+ * **Bug Fixes**
4
+ * **rest:** WordPress core routes were called with double slashes ([2e47fe0](https://github.com/Codeinwp/optimole-wp/commit/2e47fe0))
5
+ * better replacement for relative paths ([c18be2f](https://github.com/Codeinwp/optimole-wp/commit/c18be2f))
6
+ * image replacement was breaking non-image urls with query strings ([2ef2212](https://github.com/Codeinwp/optimole-wp/commit/2ef2212))
7
+ * improve admin bar quota looking and copyright [#99](https://github.com/Codeinwp/optimole-wp/issues/99) ([200e746](https://github.com/Codeinwp/optimole-wp/commit/200e746))
8
+ * improve CDN domain label naming [#97](https://github.com/Codeinwp/optimole-wp/issues/97) ([8a2da71](https://github.com/Codeinwp/optimole-wp/commit/8a2da71))
9
+ * improve error reporting on connection to the service ([11ee514](https://github.com/Codeinwp/optimole-wp/commit/11ee514))
10
+ * remove image replacement on Thrive Architect editor ([3a8c46b](https://github.com/Codeinwp/optimole-wp/commit/3a8c46b))
11
+ * removes redundant api request parameters ([4385f68](https://github.com/Codeinwp/optimole-wp/commit/4385f68))
12
+
13
+ * **Documentation**
14
+ * improve readme description ([4134b05](https://github.com/Codeinwp/optimole-wp/commit/4134b05))
15
+
16
+ * **Features**
17
+ * **api:** adds filter before url replacement, for individual image args ([d936944](https://github.com/Codeinwp/optimole-wp/commit/d936944))
18
+ * adds possible conflicts tab which reports the most common problems that Optimole might have with various plugins ([3b1ec3f](https://github.com/Codeinwp/optimole-wp/commit/3b1ec3f))
19
+
20
#### [Version 2.0.6](https://github.com/Codeinwp/optimole-wp/compare/v2.0.5...v2.0.6) (2019-03-29)
21
22
* **Bug Fixes**
README.md CHANGED
@@ -1,29 +1,26 @@
1
# Image optimization service by Optimole #
2
**Contributors:** [optimole](https://profiles.wordpress.org/optimole)
3
- **Tags:** image optimization, cdn, image compression, compress image, images, optimization, perfomance, photos
4
**Requires at least:** 4.7
5
- **Tested up to:** 5.1
6
**Requires PHP:** 5.4
7
**License:** GPLv3
8
**License URI:** https://www.gnu.org/licenses/gpl-3.0.en.html
9
10
- End-to-end image processing
11
- With OptiMole, your site’s images will be cropped, optimized and processed on-the-fly.
12
-
13
14
## Description ##
15
16
> **What makes Optimole so special?**
17
>
18
> * Smaller images. Same quality
19
- > * Optimizes based on the visitor's actual device
20
> * Fully automated; set and forget
21
> * Supports all image types
22
> * Supports both Retina and WebP images
23
> * Serves images from a global CDN for free
24
> * Optimizes based on the visitor's actual device (no more guesswork and width estimations)
25
> * Full support for page builders like Elementor
26
- > * Lazy loading without jQuery (better)
27
> * Fully functional free version (we have paid plans as well)
28
>
29
@@ -45,13 +42,13 @@ With the basic plan, you will be able to optimize 1GB of images per month with 5
45
Better yet. The free version is fully functional and includes all of the following great features.
46
47
**Format Based Optimization**
48
- Our cloud-based transformation process means we can offer optimizations based on the format. If your visitor is using a WebP capable browser, then Optimole will send a WebP image to their device.
49
50
**Image Optimization**
51
Our algorithms crunch the numbers to provide the best lossy or lossless optimization for the best-looking image at the smallest size.
52
53
**Exact Used Size**
54
- Optimole will use just one image and resize it to fit perfectly on your visitors' devices. No more awkward guesses at potential screen widths.
55
56
**Retina Support**
57
Optimole can detect Retina screens and deliver an image with the perfect Digital Pixel Ratio (DPR).
@@ -71,7 +68,7 @@ Optimole provides an option to downgrade the image quality when it detects a slo
71
Optimole loves page builders and has unique tweaks to solve image replacements. It also has full compatibility with the new block editor in WordPress 5.0
72
73
**CDN**
74
- Optimole provides free access to a CDN with 7 edge locations around the world. Even more with the Pro version.
75
76
**What About Security?**
77
The stripped EXGIF data is not stored on our service. Optimole likes to work behind the scenes, and won't interact with your site's visitors. No data is collected but you can check the [Terms of Service](https://optimole.com/terms/)
@@ -91,6 +88,27 @@ Premium users will be able to optimize 10GB images per month with a 50GB viewing
91
92
## Changelog ##
93
94
#### [Version 2.0.6](https://github.com/Codeinwp/optimole-wp/compare/v2.0.5...v2.0.6) (2019-03-29)
95
96
* **Bug Fixes**
@@ -263,24 +281,24 @@ Premium users will be able to optimize 10GB images per month with a 50GB viewing
263
264
### 1.1.1 - 2018-12-10 ###
265
266
- * Improve the lazy loading mechanism and adds compatibility with the new javascript library.
267
- * Improve sample images and quality selector integration.
268
- * Adds a notice when the Rest API is not available.
269
- * Adds notice for new users on how the plugin works.
270
- * Tested up with WordPress 5.0, all working smooth.
271
* Fix possible issues with thumbnails when the original image is available on a different url scheme.
272
* Ignore lazyload replacement on feed/amp pages.
273
274
275
### 1.1.0 - 2018-11-16 ###
276
277
- * Integrates lazy load feature with support for low-quality placeholders ( LQIP ).
278
* Integrates Javascript library which delivers images at the right size for each device, including Retina.
279
* Improve image replacement algorithm.
280
- * Improves compatibility with Elementor and Gutenberg.
281
* Adds support for Custom CNAME and Client hints.
282
- * Improves support for custom CDN.
283
- * Improves AMP support.
284
* Improves compatibility with WordPress Multisites.
285
286
@@ -342,7 +360,7 @@ Once you exceed these, we will contact you and kindly ask to upgrade to the plan
342
343
### What Content Delivery Network (CDN) do you use? ###
344
345
- Our FREE plan uses our custom made CDN built with 7 locations around the globe. For the paid plans, we have direct integration with Amazon Cloudfront, with more than 130 locations around the globe.
346
347
### I'm already using a CDN, can I use that instead of yours ? ###
348
1
# Image optimization service by Optimole #
2
**Contributors:** [optimole](https://profiles.wordpress.org/optimole)
3
+ **Tags:** image optimization, convert webp, responsive images, lazy load, images, optimization, performance, photos
4
**Requires at least:** 4.7
5
+ **Tested up to:** 5.2
6
**Requires PHP:** 5.4
7
**License:** GPLv3
8
**License URI:** https://www.gnu.org/licenses/gpl-3.0.en.html
9
10
+ Improve your site loading speed by delivering optimized image for each device. Lazy load included.
11
12
## Description ##
13
14
> **What makes Optimole so special?**
15
>
16
> * Smaller images. Same quality
17
> * Fully automated; set and forget
18
> * Supports all image types
19
> * Supports both Retina and WebP images
20
> * Serves images from a global CDN for free
21
> * Optimizes based on the visitor's actual device (no more guesswork and width estimations)
22
> * Full support for page builders like Elementor
23
+ > * Lazy load without jQuery (better)
24
> * Fully functional free version (we have paid plans as well)
25
>
26
42
Better yet. The free version is fully functional and includes all of the following great features.
43
44
**Format Based Optimization**
45
+ Our cloud-based transformation process means we can offer optimizations based on the format. If your visitor is using a WebP capable browser, then Optimole will convert to WebP the image and send it to their device.
46
47
**Image Optimization**
48
Our algorithms crunch the numbers to provide the best lossy or lossless optimization for the best-looking image at the smallest size.
49
50
**Exact Used Size**
51
+ Optimole will use just one image and resize it delivering a responsive image to fit perfectly on your visitors' devices. No more awkward guesses at potential screen widths.
52
53
**Retina Support**
54
Optimole can detect Retina screens and deliver an image with the perfect Digital Pixel Ratio (DPR).
68
Optimole loves page builders and has unique tweaks to solve image replacements. It also has full compatibility with the new block editor in WordPress 5.0
69
70
**CDN**
71
+ Optimole provides free access to a AWS CloudFront CDN with edge locations in Europe and North America. Even more with the Pro version.
72
73
**What About Security?**
74
The stripped EXGIF data is not stored on our service. Optimole likes to work behind the scenes, and won't interact with your site's visitors. No data is collected but you can check the [Terms of Service](https://optimole.com/terms/)
88
89
## Changelog ##
90
91
+ #### [Version 2.0.7](https://github.com/Codeinwp/optimole-wp/compare/v2.0.6...v2.0.7) (2019-05-29)
92
+
93
+ * **Bug Fixes**
94
+ * **rest:** WordPress core routes were called with double slashes ([2e47fe0](https://github.com/Codeinwp/optimole-wp/commit/2e47fe0))
95
+ * better replacement for relative paths ([c18be2f](https://github.com/Codeinwp/optimole-wp/commit/c18be2f))
96
+ * image replacement was breaking non-image urls with query strings ([2ef2212](https://github.com/Codeinwp/optimole-wp/commit/2ef2212))
97
+ * improve admin bar quota looking and copyright [#99](https://github.com/Codeinwp/optimole-wp/issues/99) ([200e746](https://github.com/Codeinwp/optimole-wp/commit/200e746))
98
+ * improve CDN domain label naming [#97](https://github.com/Codeinwp/optimole-wp/issues/97) ([8a2da71](https://github.com/Codeinwp/optimole-wp/commit/8a2da71))
99
+ * improve error reporting on connection to the service ([11ee514](https://github.com/Codeinwp/optimole-wp/commit/11ee514))
100
+ * remove image replacement on Thrive Architect editor ([3a8c46b](https://github.com/Codeinwp/optimole-wp/commit/3a8c46b))
101
+ * removes redundant api request parameters ([4385f68](https://github.com/Codeinwp/optimole-wp/commit/4385f68))
102
+
103
+ * **Documentation**
104
+ * improve readme description ([4134b05](https://github.com/Codeinwp/optimole-wp/commit/4134b05))
105
+
106
+ * **Features**
107
+ * **api:** adds filter before url replacement, for individual image args ([d936944](https://github.com/Codeinwp/optimole-wp/commit/d936944))
108
+ * adds possible conflicts tab which reports the most common problems that Optimole might have with various plugins ([3b1ec3f](https://github.com/Codeinwp/optimole-wp/commit/3b1ec3f))
109
+
110
+
111
+
112
#### [Version 2.0.6](https://github.com/Codeinwp/optimole-wp/compare/v2.0.5...v2.0.6) (2019-03-29)
113
114
* **Bug Fixes**
281
282
### 1.1.1 - 2018-12-10 ###
283
284
+ * Improve the lazy loading mechanism and adds compatibility with the new javascript library.
285
+ * Improve sample images and quality selector integration.
286
+ * Adds a notice when the Rest API is not available.
287
+ * Adds notice for new users on how the plugin works.
288
+ * Tested up with WordPress 5.0, all working smooth.
289
* Fix possible issues with thumbnails when the original image is available on a different url scheme.
290
* Ignore lazyload replacement on feed/amp pages.
291
292
293
### 1.1.0 - 2018-11-16 ###
294
295
+ * Integrates lazy load feature with support for low-quality placeholders ( LQIP ).
296
* Integrates Javascript library which delivers images at the right size for each device, including Retina.
297
* Improve image replacement algorithm.
298
+ * Improves compatibility with Elementor and Gutenberg.
299
* Adds support for Custom CNAME and Client hints.
300
+ * Improves support for custom CDN.
301
+ * Improves AMP support.
302
* Improves compatibility with WordPress Multisites.
303
304
360
361
### What Content Delivery Network (CDN) do you use? ###
362
363
+ Our FREE plan uses our AWS CloudFront CDN with locations only in Europe and North America. For the paid plans, we have a global full coverage, with more than 130 locations around the globe.
364
365
### I'm already using a CDN, can I use that instead of yours ? ###
366
assets/js/assets/img/optimole-logo.png DELETED
Binary file
assets/js/bundle.js DELETED
@@ -1,21174 +0,0 @@
1
- /******/ (function(modules) { // webpackBootstrap
2
- /******/ // The module cache
3
- /******/ var installedModules = {};
4
- /******/
5
- /******/ // The require function
6
- /******/ function __webpack_require__(moduleId) {
7
- /******/
8
- /******/ // Check if module is in cache
9
- /******/ if(installedModules[moduleId]) {
10
- /******/ return installedModules[moduleId].exports;
11
- /******/ }
12
- /******/ // Create a new module (and put it into the cache)
13
- /******/ var module = installedModules[moduleId] = {
14
- /******/ i: moduleId,
15
- /******/ l: false,
16
- /******/ exports: {}
17
- /******/ };
18
- /******/
19
- /******/ // Execute the module function
20
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
- /******/
22
- /******/ // Flag the module as loaded
23
- /******/ module.l = true;
24
- /******/
25
- /******/ // Return the exports of the module
26
- /******/ return module.exports;
27
- /******/ }
28
- /******/
29
- /******/
30
- /******/ // expose the modules object (__webpack_modules__)
31
- /******/ __webpack_require__.m = modules;
32
- /******/
33
- /******/ // expose the module cache
34
- /******/ __webpack_require__.c = installedModules;
35
- /******/
36
- /******/ // define getter function for harmony exports
37
- /******/ __webpack_require__.d = function(exports, name, getter) {
38
- /******/ if(!__webpack_require__.o(exports, name)) {
39
- /******/ Object.defineProperty(exports, name, {
40
- /******/ configurable: false,
41
- /******/ enumerable: true,
42
- /******/ get: getter
43
- /******/ });
44
- /******/ }
45
- /******/ };
46
- /******/
47
- /******/ // getDefaultExport function for compatibility with non-harmony modules
48
- /******/ __webpack_require__.n = function(module) {
49
- /******/ var getter = module && module.__esModule ?
50
- /******/ function getDefault() { return module['default']; } :
51
- /******/ function getModuleExports() { return module; };
52
- /******/ __webpack_require__.d(getter, 'a', getter);
53
- /******/ return getter;
54
- /******/ };
55
- /******/
56
- /******/ // Object.prototype.hasOwnProperty.call
57
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
58
- /******/
59
- /******/ // __webpack_public_path__
60
- /******/ __webpack_require__.p = "/";
61
- /******/
62
- /******/ // Load entry module and return exports
63
- /******/ return __webpack_require__(__webpack_require__.s = 7);
64
- /******/ })
65
- /************************************************************************/
66
- /******/ ([
67
- /* 0 */
68
- /***/ (function(module, exports) {
69
-
70
- /*
71
- MIT License http://www.opensource.org/licenses/mit-license.php
72
- Author Tobias Koppers @sokra
73
- */
74
- // css base code, injected by the css-loader
75
- module.exports = function() {
76
- var list = [];
77
-
78
- // return the list of modules as css string
79
- list.toString = function toString() {
80
- var result = [];
81
- for(var i = 0; i < this.length; i++) {
82
- var item = this[i];
83
- if(item[2]) {
84
- result.push("@media " + item[2] + "{" + item[1] + "}");
85
- } else {
86
- result.push(item[1]);
87
- }
88
- }
89
- return result.join("");
90
- };
91
-
92
- // import a list of modules into the list
93
- list.i = function(modules, mediaQuery) {
94
- if(typeof modules === "string")
95
- modules = [[null, modules, ""]];
96
- var alreadyImportedModules = {};
97
- for(var i = 0; i < this.length; i++) {
98
- var id = this[i][0];
99
- if(typeof id === "number")
100
- alreadyImportedModules[id] = true;
101
- }
102
- for(i = 0; i < modules.length; i++) {
103
- var item = modules[i];
104
- // skip already imported module
105
- // this implementation is not 100% perfect for weird media query combinations
106
- // when a module is imported multiple times with different media queries.
107
- // I hope this will never occur (Hey this way we have smaller bundles)
108
- if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
109
- if(mediaQuery && !item[2]) {
110
- item[2] = mediaQuery;
111
- } else if(mediaQuery) {
112
- item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
113
- }
114
- list.push(item);
115
- }
116
- }
117
- };
118
- return list;
119
- };
120
-
121
-
122
- /***/ }),
123
- /* 1 */
124
- /***/ (function(module, exports) {
125
-
126
- /*
127
- MIT License http://www.opensource.org/licenses/mit-license.php
128
- Author Tobias Koppers @sokra
129
- */
130
- var stylesInDom = {},
131
- memoize = function(fn) {
132
- var memo;
133
- return function () {
134
- if (typeof memo === "undefined") memo = fn.apply(this, arguments);
135
- return memo;
136
- };
137
- },
138
- isOldIE = memoize(function() {
139
- return /msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase());
140
- }),
141
- getHeadElement = memoize(function () {
142
- return document.head || document.getElementsByTagName("head")[0];
143
- }),
144
- singletonElement = null,
145
- singletonCounter = 0,
146
- styleElementsInsertedAtTop = [];
147
-
148
- module.exports = function(list, options) {
149
- if(typeof DEBUG !== "undefined" && DEBUG) {
150
- if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
151
- }
152
-
153
- options = options || {};
154
- // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
155
- // tags it will allow on a page
156
- if (typeof options.singleton === "undefined") options.singleton = isOldIE();
157
-
158
- // By default, add <style> tags to the bottom of <head>.
159
- if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
160
-
161
- var styles = listToStyles(list);
162
- addStylesToDom(styles, options);
163
-
164
- return function update(newList) {
165
- var mayRemove = [];
166
- for(var i = 0; i < styles.length; i++) {
167
- var item = styles[i];
168
- var domStyle = stylesInDom[item.id];
169
- domStyle.refs--;
170
- mayRemove.push(domStyle);
171
- }
172
- if(newList) {
173
- var newStyles = listToStyles(newList);
174
- addStylesToDom(newStyles, options);
175
- }
176
- for(var i = 0; i < mayRemove.length; i++) {
177
- var domStyle = mayRemove[i];
178
- if(domStyle.refs === 0) {
179
- for(var j = 0; j < domStyle.parts.length; j++)
180
- domStyle.parts[j]();
181
- delete stylesInDom[domStyle.id];
182
- }
183
- }
184
- };
185
- }
186
-
187
- function addStylesToDom(styles, options) {
188
- for(var i = 0; i < styles.length; i++) {
189
- var item = styles[i];
190
- var domStyle = stylesInDom[item.id];
191
- if(domStyle) {
192
- domStyle.refs++;
193
- for(var j = 0; j < domStyle.parts.length; j++) {
194
- domStyle.parts[j](item.parts[j]);
195
- }
196
- for(; j < item.parts.length; j++) {
197
- domStyle.parts.push(addStyle(item.parts[j], options));
198
- }
199
- } else {
200
- var parts = [];
201
- for(var j = 0; j < item.parts.length; j++) {
202
- parts.push(addStyle(item.parts[j], options));
203
- }
204
- stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
205
- }
206
- }
207
- }
208
-
209
- function listToStyles(list) {
210
- var styles = [];
211
- var newStyles = {};
212
- for(var i = 0; i < list.length; i++) {
213
- var item = list[i];
214
- var id = item[0];
215
- var css = item[1];
216
- var media = item[2];
217
- var sourceMap = item[3];
218
- var part = {css: css, media: media, sourceMap: sourceMap};
219
- if(!newStyles[id])
220
- styles.push(newStyles[id] = {id: id, parts: [part]});
221
- else
222
- newStyles[id].parts.push(part);
223
- }
224
- return styles;
225
- }
226
-
227
- function insertStyleElement(options, styleElement) {
228
- var head = getHeadElement();
229
- var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
230
- if (options.insertAt === "top") {
231
- if(!lastStyleElementInsertedAtTop) {
232
- head.insertBefore(styleElement, head.firstChild);
233
- } else if(lastStyleElementInsertedAtTop.nextSibling) {
234
- head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
235
- } else {
236
- head.appendChild(styleElement);
237
- }
238
- styleElementsInsertedAtTop.push(styleElement);
239
- } else if (options.insertAt === "bottom") {
240
- head.appendChild(styleElement);
241
- } else {
242
- throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
243
- }
244
- }
245
-
246
- function removeStyleElement(styleElement) {
247
- styleElement.parentNode.removeChild(styleElement);
248
- var idx = styleElementsInsertedAtTop.indexOf(styleElement);
249
- if(idx >= 0) {
250
- styleElementsInsertedAtTop.splice(idx, 1);
251
- }
252
- }
253
-
254
- function createStyleElement(options) {
255
- var styleElement = document.createElement("style");
256
- styleElement.type = "text/css";
257
- insertStyleElement(options, styleElement);
258
- return styleElement;
259
- }
260
-
261
- function createLinkElement(options) {
262
- var linkElement = document.createElement("link");
263
- linkElement.rel = "stylesheet";
264
- insertStyleElement(options, linkElement);
265
- return linkElement;
266
- }
267
-
268
- function addStyle(obj, options) {
269
- var styleElement, update, remove;
270
-
271
- if (options.singleton) {
272
- var styleIndex = singletonCounter++;
273
- styleElement = singletonElement || (singletonElement = createStyleElement(options));
274
- update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
275
- remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
276
- } else if(obj.sourceMap &&
277
- typeof URL === "function" &&
278
- typeof URL.createObjectURL === "function" &&
279
- typeof URL.revokeObjectURL === "function" &&
280
- typeof Blob === "function" &&
281
- typeof btoa === "function") {
282
- styleElement = createLinkElement(options);
283
- update = updateLink.bind(null, styleElement);
284
- remove = function() {
285
- removeStyleElement(styleElement);
286
- if(styleElement.href)
287
- URL.revokeObjectURL(styleElement.href);
288
- };
289
- } else {
290
- styleElement = createStyleElement(options);
291
- update = applyToTag.bind(null, styleElement);
292
- remove = function() {
293
- removeStyleElement(styleElement);
294
- };
295
- }
296
-
297
- update(obj);
298
-
299
- return function updateStyle(newObj) {
300
- if(newObj) {
301
- if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
302
- return;
303
- update(obj = newObj);
304
- } else {
305
- remove();
306
- }
307
- };
308
- }
309
-
310
- var replaceText = (function () {
311
- var textStore = [];
312
-
313
- return function (index, replacement) {
314
- textStore[index] = replacement;
315
- return textStore.filter(Boolean).join('\n');
316
- };
317
- })();
318
-
319
- function applyToSingletonTag(styleElement, index, remove, obj) {
320
- var css = remove ? "" : obj.css;
321
-
322
- if (styleElement.styleSheet) {
323
- styleElement.styleSheet.cssText = replaceText(index, css);
324
- } else {
325
- var cssNode = document.createTextNode(css);
326
- var childNodes = styleElement.childNodes;
327
- if (childNodes[index]) styleElement.removeChild(childNodes[index]);
328
- if (childNodes.length) {
329
- styleElement.insertBefore(cssNode, childNodes[index]);
330
- } else {
331
- styleElement.appendChild(cssNode);
332
- }
333
- }
334
- }
335
-
336
- function applyToTag(styleElement, obj) {
337
- var css = obj.css;
338
- var media = obj.media;
339
-
340
- if(media) {
341
- styleElement.setAttribute("media", media)
342
- }
343
-
344
- if(styleElement.styleSheet) {
345
- styleElement.styleSheet.cssText = css;
346
- } else {
347
- while(styleElement.firstChild) {
348
- styleElement.removeChild(styleElement.firstChild);
349
- }
350
- styleElement.appendChild(document.createTextNode(css));
351
- }
352
- }
353
-
354
- function updateLink(linkElement, obj) {
355
- var css = obj.css;
356
- var sourceMap = obj.sourceMap;
357
-
358
- if(sourceMap) {
359
- // http://stackoverflow.com/a/26603875
360
- css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
361
- }
362
-
363
- var blob = new Blob([css], { type: "text/css" });
364
-
365
- var oldSrc = linkElement.href;
366
-
367
- linkElement.href = URL.createObjectURL(blob);
368
-
369
- if(oldSrc)
370
- URL.revokeObjectURL(oldSrc);
371
- }
372
-
373
-
374
- /***/ }),
375
- /* 2 */
376
- /***/ (function(module, exports) {
377
-
378
- var g;
379
-
380
- // This works in non-strict mode
381
- g = (function() {
382
- return this;
383
- })();
384
-
385
- try {
386
- // This works if eval is allowed (see CSP)
387
- g = g || Function("return this")() || (1,eval)("this");
388
- } catch(e) {
389
- // This works if the window reference is available
390
- if(typeof window === "object")
391
- g = window;
392
- }
393
-
394
- // g can still be undefined, but nothing to do about it...
395
- // We return undefined, instead of nothing here, so it's
396
- // easier to handle this case. if(!global) { ...}
397
-
398
- module.exports = g;
399
-
400
-
401
- /***/ }),
402
- /* 3 */
403
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
404
-
405
- "use strict";
406
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
407
- /* WEBPACK VAR INJECTION */(function(process, global, setImmediate) {/*!
408
- * Vue.js v2.6.6
409
- * (c) 2014-2019 Evan You
410
- * Released under the MIT License.
411
- */
412
- /* */
413
-
414
- var emptyObject = Object.freeze({});
415
-
416
- // These helpers produce better VM code in JS engines due to their
417
- // explicitness and function inlining.
418
- function isUndef (v) {
419
- return v === undefined || v === null
420
- }
421
-
422
- function isDef (v) {
423
- return v !== undefined && v !== null
424
- }
425
-
426
- function isTrue (v) {
427
- return v === true
428
- }
429
-
430
- function isFalse (v) {
431
- return v === false
432
- }
433
-
434
- /**
435
- * Check if value is primitive.
436
- */
437
- function isPrimitive (value) {
438
- return (
439
- typeof value === 'string' ||
440
- typeof value === 'number' ||
441
- // $flow-disable-line
442
- typeof value === 'symbol' ||
443
- typeof value === 'boolean'
444
- )
445
- }
446
-
447
- /**
448
- * Quick object check - this is primarily used to tell
449
- * Objects from primitive values when we know the value
450
- * is a JSON-compliant type.
451
- */
452
- function isObject (obj) {
453
- return obj !== null && typeof obj === 'object'
454
- }
455
-
456
- /**
457
- * Get the raw type string of a value, e.g., [object Object].
458
- */
459
- var _toString = Object.prototype.toString;
460
-
461
- function toRawType (value) {
462
- return _toString.call(value).slice(8, -1)
463
- }
464
-
465
- /**
466
- * Strict object type check. Only returns true
467
- * for plain JavaScript objects.
468
- */
469
- function isPlainObject (obj) {
470
- return _toString.call(obj) === '[object Object]'
471
- }
472
-
473
- function isRegExp (v) {
474
- return _toString.call(v) === '[object RegExp]'
475
- }
476
-
477
- /**
478
- * Check if val is a valid array index.
479
- */
480
- function isValidArrayIndex (val) {
481
- var n = parseFloat(String(val));
482
- return n >= 0 && Math.floor(n) === n && isFinite(val)
483
- }
484
-
485
- function isPromise (val) {
486
- return (
487
- isDef(val) &&
488
- typeof val.then === 'function' &&
489
- typeof val.catch === 'function'
490
- )
491
- }
492
-
493
- /**
494
- * Convert a value to a string that is actually rendered.
495
- */
496
- function toString (val) {
497
- return val == null
498
- ? ''
499
- : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
500
- ? JSON.stringify(val, null, 2)
501
- : String(val)
502
- }
503
-
504
- /**
505
- * Convert an input value to a number for persistence.
506
- * If the conversion fails, return original string.
507
- */
508
- function toNumber (val) {
509
- var n = parseFloat(val);
510
- return isNaN(n) ? val : n
511
- }
512
-
513
- /**
514
- * Make a map and return a function for checking if a key
515
- * is in that map.
516
- */
517
- function makeMap (
518
- str,
519
- expectsLowerCase
520
- ) {
521
- var map = Object.create(null);
522
- var list = str.split(',');
523
- for (var i = 0; i < list.length; i++) {
524
- map[list[i]] = true;
525
- }
526
- return expectsLowerCase
527
- ? function (val) { return map[val.toLowerCase()]; }
528
- : function (val) { return map[val]; }
529
- }
530
-
531
- /**
532
- * Check if a tag is a built-in tag.
533
- */
534
- var isBuiltInTag = makeMap('slot,component', true);
535
-
536
- /**
537
- * Check if an attribute is a reserved attribute.
538
- */
539
- var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
540
-
541
- /**
542
- * Remove an item from an array.
543
- */
544
- function remove (arr, item) {
545
- if (arr.length) {
546
- var index = arr.indexOf(item);
547
- if (index > -1) {
548
- return arr.splice(index, 1)
549
- }
550
- }
551
- }
552
-
553
- /**
554
- * Check whether an object has the property.
555
- */
556
- var hasOwnProperty = Object.prototype.hasOwnProperty;
557
- function hasOwn (obj, key) {
558
- return hasOwnProperty.call(obj, key)
559
- }
560
-
561
- /**
562
- * Create a cached version of a pure function.
563
- */
564
- function cached (fn) {
565
- var cache = Object.create(null);
566
- return (function cachedFn (str) {
567
- var hit = cache[str];
568
- return hit || (cache[str] = fn(str))
569
- })
570
- }
571
-
572
- /**
573
- * Camelize a hyphen-delimited string.
574
- */
575
- var camelizeRE = /-(\w)/g;
576
- var camelize = cached(function (str) {
577
- return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
578
- });
579
-
580
- /**
581
- * Capitalize a string.
582
- */
583
- var capitalize = cached(function (str) {
584
- return str.charAt(0).toUpperCase() + str.slice(1)
585
- });
586
-
587
- /**
588
- * Hyphenate a camelCase string.
589
- */
590
- var hyphenateRE = /\B([A-Z])/g;
591
- var hyphenate = cached(function (str) {
592
- return str.replace(hyphenateRE, '-$1').toLowerCase()
593
- });
594
-
595
- /**
596
- * Simple bind polyfill for environments that do not support it,
597
- * e.g., PhantomJS 1.x. Technically, we don't need this anymore
598
- * since native bind is now performant enough in most browsers.
599
- * But removing it would mean breaking code that was able to run in
600
- * PhantomJS 1.x, so this must be kept for backward compatibility.
601
- */
602
-
603
- /* istanbul ignore next */
604
- function polyfillBind (fn, ctx) {
605
- function boundFn (a) {
606
- var l = arguments.length;
607
- return l
608
- ? l > 1
609
- ? fn.apply(ctx, arguments)
610
- : fn.call(ctx, a)
611
- : fn.call(ctx)
612
- }
613
-
614
- boundFn._length = fn.length;
615
- return boundFn
616
- }
617
-
618
- function nativeBind (fn, ctx) {
619
- return fn.bind(ctx)
620
- }
621
-
622
- var bind = Function.prototype.bind
623
- ? nativeBind
624
- : polyfillBind;
625
-
626
- /**
627
- * Convert an Array-like object to a real Array.
628
- */
629
- function toArray (list, start) {
630
- start = start || 0;
631
- var i = list.length - start;
632
- var ret = new Array(i);
633
- while (i--) {
634
- ret[i] = list[i + start];
635
- }
636
- return ret
637
- }
638
-
639
- /**
640
- * Mix properties into target object.
641
- */
642
- function extend (to, _from) {
643
- for (var key in _from) {
644
- to[key] = _from[key];
645
- }
646
- return to
647
- }
648
-
649
- /**
650
- * Merge an Array of Objects into a single Object.
651
- */
652
- function toObject (arr) {
653
- var res = {};
654
- for (var i = 0; i < arr.length; i++) {
655
- if (arr[i]) {
656
- extend(res, arr[i]);
657
- }
658
- }
659
- return res
660
- }
661
-
662
- /* eslint-disable no-unused-vars */
663
-
664
- /**
665
- * Perform no operation.
666
- * Stubbing args to make Flow happy without leaving useless transpiled code
667
- * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
668
- */
669
- function noop (a, b, c) {}
670
-
671
- /**
672
- * Always return false.
673
- */
674
- var no = function (a, b, c) { return false; };
675
-
676
- /* eslint-enable no-unused-vars */
677
-
678
- /**
679
- * Return the same value.
680
- */
681
- var identity = function (_) { return _; };
682
-
683
- /**
684
- * Generate a string containing static keys from compiler modules.
685
- */
686
- function genStaticKeys (modules) {
687
- return modules.reduce(function (keys, m) {
688
- return keys.concat(m.staticKeys || [])
689
- }, []).join(',')
690
- }
691
-
692
- /**
693
- * Check if two values are loosely equal - that is,
694
- * if they are plain objects, do they have the same shape?
695
- */
696
- function looseEqual (a, b) {
697
- if (a === b) { return true }
698
- var isObjectA = isObject(a);
699
- var isObjectB = isObject(b);
700
- if (isObjectA && isObjectB) {
701
- try {
702
- var isArrayA = Array.isArray(a);
703
- var isArrayB = Array.isArray(b);
704
- if (isArrayA && isArrayB) {
705
- return a.length === b.length && a.every(function (e, i) {
706
- return looseEqual(e, b[i])
707
- })
708
- } else if (a instanceof Date && b instanceof Date) {
709
- return a.getTime() === b.getTime()
710
- } else if (!isArrayA && !isArrayB) {
711
- var keysA = Object.keys(a);
712
- var keysB = Object.keys(b);
713
- return keysA.length === keysB.length && keysA.every(function (key) {
714
- return looseEqual(a[key], b[key])
715
- })
716
- } else {
717
- /* istanbul ignore next */
718
- return false
719
- }
720
- } catch (e) {
721
- /* istanbul ignore next */
722
- return false
723
- }
724
- } else if (!isObjectA && !isObjectB) {
725
- return String(a) === String(b)
726
- } else {
727
- return false
728
- }
729
- }
730
-
731
- /**
732
- * Return the first index at which a loosely equal value can be
733
- * found in the array (if value is a plain object, the array must
734
- * contain an object of the same shape), or -1 if it is not present.
735
- */
736
- function looseIndexOf (arr, val) {
737
- for (var i = 0; i < arr.length; i++) {
738
- if (looseEqual(arr[i], val)) { return i }
739
- }
740
- return -1
741
- }
742
-
743
- /**
744
- * Ensure a function is called only once.
745
- */
746
- function once (fn) {
747
- var called = false;
748
- return function () {
749
- if (!called) {
750
- called = true;
751
- fn.apply(this, arguments);
752
- }
753
- }
754
- }
755
-
756
- var SSR_ATTR = 'data-server-rendered';
757
-
758
- var ASSET_TYPES = [
759
- 'component',
760
- 'directive',
761
- 'filter'
762
- ];
763
-
764
- var LIFECYCLE_HOOKS = [
765
- 'beforeCreate',
766
- 'created',
767
- 'beforeMount',
768
- 'mounted',
769
- 'beforeUpdate',
770
- 'updated',
771
- 'beforeDestroy',
772
- 'destroyed',
773
- 'activated',
774
- 'deactivated',
775
- 'errorCaptured',
776
- 'serverPrefetch'
777
- ];
778
-
779
- /* */
780
-
781
-
782
-
783
- var config = ({
784
- /**
785
- * Option merge strategies (used in core/util/options)
786
- */
787
- // $flow-disable-line
788
- optionMergeStrategies: Object.create(null),
789
-
790
- /**
791
- * Whether to suppress warnings.
792
- */
793
- silent: false,
794
-
795
- /**
796
- * Show production mode tip message on boot?
797
- */
798
- productionTip: process.env.NODE_ENV !== 'production',
799
-
800
- /**
801
- * Whether to enable devtools
802
- */
803
- devtools: process.env.NODE_ENV !== 'production',
804
-
805
- /**
806
- * Whether to record perf
807
- */
808
- performance: false,
809
-
810
- /**
811
- * Error handler for watcher errors
812
- */
813
- errorHandler: null,
814
-
815
- /**
816
- * Warn handler for watcher warns
817
- */
818
- warnHandler: null,
819
-
820
- /**
821
- * Ignore certain custom elements
822
- */
823
- ignoredElements: [],
824
-
825
- /**
826
- * Custom user key aliases for v-on
827
- */
828
- // $flow-disable-line
829
- keyCodes: Object.create(null),
830
-
831
- /**
832
- * Check if a tag is reserved so that it cannot be registered as a
833
- * component. This is platform-dependent and may be overwritten.
834
- */
835
- isReservedTag: no,
836
-
837
- /**
838
- * Check if an attribute is reserved so that it cannot be used as a component
839
- * prop. This is platform-dependent and may be overwritten.
840
- */
841
- isReservedAttr: no,
842
-
843
- /**
844
- * Check if a tag is an unknown element.
845
- * Platform-dependent.
846
- */
847
- isUnknownElement: no,
848
-
849
- /**
850
- * Get the namespace of an element
851
- */
852
- getTagNamespace: noop,
853
-
854
- /**
855
- * Parse the real tag name for the specific platform.
856
- */
857
- parsePlatformTagName: identity,
858
-
859
- /**
860
- * Check if an attribute must be bound using property, e.g. value
861
- * Platform-dependent.
862
- */
863
- mustUseProp: no,
864
-
865
- /**
866
- * Perform updates asynchronously. Intended to be used by Vue Test Utils
867
- * This will significantly reduce performance if set to false.
868
- */
869
- async: true,
870
-
871
- /**
872
- * Exposed for legacy reasons
873
- */
874
- _lifecycleHooks: LIFECYCLE_HOOKS
875
- });
876
-
877
- /* */
878
-
879
- /**
880
- * unicode letters used for parsing html tags, component names and property paths.
881
- * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
882
- * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
883
- */
884
- var unicodeLetters = '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';
885
-
886
- /**
887
- * Check if a string starts with $ or _
888
- */
889
- function isReserved (str) {
890
- var c = (str + '').charCodeAt(0);
891
- return c === 0x24 || c === 0x5F
892
- }
893
-
894
- /**
895
- * Define a property.
896
- */
897
- function def (obj, key, val, enumerable) {
898
- Object.defineProperty(obj, key, {
899
- value: val,
900
- enumerable: !!enumerable,
901
- writable: true,
902
- configurable: true
903
- });
904
- }
905
-
906
- /**
907
- * Parse simple path.
908
- */
909
- var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
910
- function parsePath (path) {
911
- if (bailRE.test(path)) {
912
- return
913
- }
914
- var segments = path.split('.');
915
- return function (obj) {
916
- for (var i = 0; i < segments.length; i++) {
917
- if (!obj) { return }
918
- obj = obj[segments[i]];
919
- }
920
- return obj
921
- }
922
- }
923
-
924
- /* */
925
-
926
- // can we use __proto__?
927
- var hasProto = '__proto__' in {};
928
-
929
- // Browser environment sniffing
930
- var inBrowser = typeof window !== 'undefined';
931
- var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
932
- var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
933
- var UA = inBrowser && window.navigator.userAgent.toLowerCase();
934
- var isIE = UA && /msie|trident/.test(UA);
935
- var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
936
- var isEdge = UA && UA.indexOf('edge/') > 0;
937
- var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
938
- var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
939
- var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
940
- var isPhantomJS = UA && /phantomjs/.test(UA);
941
- var isFF = UA && UA.match(/firefox\/(\d+)/);
942
-
943
- // Firefox has a "watch" function on Object.prototype...
944
- var nativeWatch = ({}).watch;
945
-
946
- var supportsPassive = false;
947
- if (inBrowser) {
948
- try {
949
- var opts = {};
950
- Object.defineProperty(opts, 'passive', ({
951
- get: function get () {
952
- /* istanbul ignore next */
953
- supportsPassive = true;
954
- }
955
- })); // https://github.com/facebook/flow/issues/285
956
- window.addEventListener('test-passive', null, opts);
957
- } catch (e) {}
958
- }
959
-
960
- // this needs to be lazy-evaled because vue may be required before
961
- // vue-server-renderer can set VUE_ENV
962
- var _isServer;
963
- var isServerRendering = function () {
964
- if (_isServer === undefined) {
965
- /* istanbul ignore if */
966
- if (!inBrowser && !inWeex && typeof global !== 'undefined') {
967
- // detect presence of vue-server-renderer and avoid
968
- // Webpack shimming the process
969
- _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
970
- } else {
971
- _isServer = false;
972
- }
973
- }
974
- return _isServer
975
- };
976
-
977
- // detect devtools
978
- var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
979
-
980
- /* istanbul ignore next */
981
- function isNative (Ctor) {
982
- return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
983
- }
984
-
985
- var hasSymbol =
986
- typeof Symbol !== 'undefined' && isNative(Symbol) &&
987
- typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
988
-
989
- var _Set;
990
- /* istanbul ignore if */ // $flow-disable-line
991
- if (typeof Set !== 'undefined' && isNative(Set)) {
992
- // use native Set when available.
993
- _Set = Set;
994
- } else {
995
- // a non-standard Set polyfill that only works with primitive keys.
996
- _Set = /*@__PURE__*/(function () {
997
- function Set () {
998
- this.set = Object.create(null);
999
- }
1000
- Set.prototype.has = function has (key) {
1001
- return this.set[key] === true
1002
- };
1003
- Set.prototype.add = function add (key) {
1004
- this.set[key] = true;
1005
- };
1006
- Set.prototype.clear = function clear () {
1007
- this.set = Object.create(null);
1008
- };
1009
-
1010
- return Set;
1011
- }());
1012
- }
1013
-
1014
- /* */
1015
-
1016
- var warn = noop;
1017
- var tip = noop;
1018
- var generateComponentTrace = (noop); // work around flow check
1019
- var formatComponentName = (noop);
1020
-
1021
- if (process.env.NODE_ENV !== 'production') {
1022
- var hasConsole = typeof console !== 'undefined';
1023
- var classifyRE = /(?:^|[-_])(\w)/g;
1024
- var classify = function (str) { return str
1025
- .replace(classifyRE, function (c) { return c.toUpperCase(); })
1026
- .replace(/[-_]/g, ''); };
1027
-
1028
- warn = function (msg, vm) {
1029
- var trace = vm ? generateComponentTrace(vm) : '';
1030
-
1031
- if (config.warnHandler) {
1032
- config.warnHandler.call(null, msg, vm, trace);
1033
- } else if (hasConsole && (!config.silent)) {
1034
- console.error(("[Vue warn]: " + msg + trace));
1035
- }
1036
- };
1037
-
1038
- tip = function (msg, vm) {
1039
- if (hasConsole && (!config.silent)) {
1040
- console.warn("[Vue tip]: " + msg + (
1041
- vm ? generateComponentTrace(vm) : ''
1042
- ));
1043
- }
1044
- };
1045
-
1046
- formatComponentName = function (vm, includeFile) {
1047
- if (vm.$root === vm) {
1048
- return '<Root>'
1049
- }
1050
- var options = typeof vm === 'function' && vm.cid != null
1051
- ? vm.options
1052
- : vm._isVue
1053
- ? vm.$options || vm.constructor.options
1054
- : vm;
1055
- var name = options.name || options._componentTag;
1056
- var file = options.__file;
1057
- if (!name && file) {
1058
- var match = file.match(/([^/\\]+)\.vue#x2F;);
1059
- name = match && match[1];
1060
- }
1061
-
1062
- return (
1063
- (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
1064
- (file && includeFile !== false ? (" at " + file) : '')
1065
- )
1066
- };
1067
-
1068
- var repeat = function (str, n) {
1069
- var res = '';
1070
- while (n) {
1071
- if (n % 2 === 1) { res += str; }
1072
- if (n > 1) { str += str; }
1073
- n >>= 1;
1074
- }
1075
- return res
1076
- };
1077
-
1078
- generateComponentTrace = function (vm) {
1079
- if (vm._isVue && vm.$parent) {
1080
- var tree = [];
1081
- var currentRecursiveSequence = 0;
1082
- while (vm) {
1083
- if (tree.length > 0) {
1084
- var last = tree[tree.length - 1];
1085
- if (last.constructor === vm.constructor) {
1086
- currentRecursiveSequence++;
1087
- vm = vm.$parent;
1088
- continue
1089
- } else if (currentRecursiveSequence > 0) {
1090
- tree[tree.length - 1] = [last, currentRecursiveSequence];
1091
- currentRecursiveSequence = 0;
1092
- }
1093
- }
1094
- tree.push(vm);
1095
- vm = vm.$parent;
1096
- }
1097
- return '\n\nfound in\n\n' + tree
1098
- .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
1099
- ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
1100
- : formatComponentName(vm))); })
1101
- .join('\n')
1102
- } else {
1103
- return ("\n\n(found in " + (formatComponentName(vm)) + ")")
1104
- }
1105
- };
1106
- }
1107
-
1108
- /* */
1109
-
1110
- var uid = 0;
1111
-
1112
- /**
1113
- * A dep is an observable that can have multiple
1114
- * directives subscribing to it.
1115
- */
1116
- var Dep = function Dep () {
1117
- this.id = uid++;
1118
- this.subs = [];
1119
- };
1120
-
1121
- Dep.prototype.addSub = function addSub (sub) {
1122
- this.subs.push(sub);
1123
- };
1124
-
1125
- Dep.prototype.removeSub = function removeSub (sub) {
1126
- remove(this.subs, sub);
1127
- };
1128
-
1129
- Dep.prototype.depend = function depend () {
1130
- if (Dep.target) {
1131
- Dep.target.addDep(this);
1132
- }
1133
- };
1134
-
1135
- Dep.prototype.notify = function notify () {
1136
- // stabilize the subscriber list first
1137
- var subs = this.subs.slice();
1138
- if (process.env.NODE_ENV !== 'production' && !config.async) {
1139
- // subs aren't sorted in scheduler if not running async
1140
- // we need to sort them now to make sure they fire in correct
1141
- // order
1142
- subs.sort(function (a, b) { return a.id - b.id; });
1143
- }
1144
- for (var i = 0, l = subs.length; i < l; i++) {
1145
- subs[i].update();
1146
- }
1147
- };
1148
-
1149
- // The current target watcher being evaluated.
1150
- // This is globally unique because only one watcher
1151
- // can be evaluated at a time.
1152
- Dep.target = null;
1153
- var targetStack = [];
1154
-
1155
- function pushTarget (target) {
1156
- targetStack.push(target);
1157
- Dep.target = target;
1158
- }
1159
-
1160
- function popTarget () {
1161
- targetStack.pop();
1162
- Dep.target = targetStack[targetStack.length - 1];
1163
- }
1164
-
1165
- /* */
1166
-
1167
- var VNode = function VNode (
1168
- tag,
1169
- data,
1170
- children,
1171
- text,
1172
- elm,
1173
- context,
1174
- componentOptions,
1175
- asyncFactory
1176
- ) {
1177
- this.tag = tag;
1178
- this.data = data;
1179
- this.children = children;
1180
- this.text = text;
1181
- this.elm = elm;
1182
- this.ns = undefined;
1183
- this.context = context;
1184
- this.fnContext = undefined;
1185
- this.fnOptions = undefined;
1186
- this.fnScopeId = undefined;
1187
- this.key = data && data.key;
1188
- this.componentOptions = componentOptions;
1189
- this.componentInstance = undefined;
1190
- this.parent = undefined;
1191
- this.raw = false;
1192
- this.isStatic = false;
1193
- this.isRootInsert = true;
1194
- this.isComment = false;
1195
- this.isCloned = false;
1196
- this.isOnce = false;
1197
- this.asyncFactory = asyncFactory;
1198
- this.asyncMeta = undefined;
1199
- this.isAsyncPlaceholder = false;
1200
- };
1201
-
1202
- var prototypeAccessors = { child: { configurable: true } };
1203
-
1204
- // DEPRECATED: alias for componentInstance for backwards compat.
1205
- /* istanbul ignore next */
1206
- prototypeAccessors.child.get = function () {
1207
- return this.componentInstance
1208
- };
1209
-
1210
- Object.defineProperties( VNode.prototype, prototypeAccessors );
1211
-
1212
- var createEmptyVNode = function (text) {
1213
- if ( text === void 0 ) text = '';
1214
-
1215
- var node = new VNode();
1216
- node.text = text;
1217
- node.isComment = true;
1218
- return node
1219
- };
1220
-
1221
- function createTextVNode (val) {
1222
- return new VNode(undefined, undefined, undefined, String(val))
1223
- }
1224
-
1225
- // optimized shallow clone
1226
- // used for static nodes and slot nodes because they may be reused across
1227
- // multiple renders, cloning them avoids errors when DOM manipulations rely
1228
- // on their elm reference.
1229
- function cloneVNode (vnode) {
1230
- var cloned = new VNode(
1231
- vnode.tag,
1232
- vnode.data,
1233
- // #7975
1234
- // clone children array to avoid mutating original in case of cloning
1235
- // a child.
1236
- vnode.children && vnode.children.slice(),
1237
- vnode.text,
1238
- vnode.elm,
1239
- vnode.context,
1240
- vnode.componentOptions,
1241
- vnode.asyncFactory
1242
- );
1243
- cloned.ns = vnode.ns;
1244
- cloned.isStatic = vnode.isStatic;
1245
- cloned.key = vnode.key;
1246
- cloned.isComment = vnode.isComment;
1247
- cloned.fnContext = vnode.fnContext;
1248
- cloned.fnOptions = vnode.fnOptions;
1249
- cloned.fnScopeId = vnode.fnScopeId;
1250
- cloned.asyncMeta = vnode.asyncMeta;
1251
- cloned.isCloned = true;
1252
- return cloned
1253
- }
1254
-
1255
- /*
1256
- * not type checking this file because flow doesn't play well with
1257
- * dynamically accessing methods on Array prototype
1258
- */
1259
-
1260
- var arrayProto = Array.prototype;
1261
- var arrayMethods = Object.create(arrayProto);
1262
-
1263
- var methodsToPatch = [
1264
- 'push',
1265
- 'pop',
1266
- 'shift',
1267
- 'unshift',
1268
- 'splice',
1269
- 'sort',
1270
- 'reverse'
1271
- ];
1272
-
1273
- /**
1274
- * Intercept mutating methods and emit events
1275
- */
1276
- methodsToPatch.forEach(function (method) {
1277
- // cache original method
1278
- var original = arrayProto[method];
1279
- def(arrayMethods, method, function mutator () {
1280
- var args = [], len = arguments.length;
1281
- while ( len-- ) args[ len ] = arguments[ len ];
1282
-
1283
- var result = original.apply(this, args);
1284
- var ob = this.__ob__;
1285
- var inserted;
1286
- switch (method) {
1287
- case 'push':
1288
- case 'unshift':
1289
- inserted = args;
1290
- break
1291
- case 'splice':
1292
- inserted = args.slice(2);
1293
- break
1294
- }
1295
- if (inserted) { ob.observeArray(inserted); }
1296
- // notify change
1297
- ob.dep.notify();
1298
- return result
1299
- });
1300
- });
1301
-
1302
- /* */
1303
-
1304
- var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
1305
-
1306
- /**
1307
- * In some cases we may want to disable observation inside a component's
1308
- * update computation.
1309
- */
1310
- var shouldObserve = true;
1311
-
1312
- function toggleObserving (value) {
1313
- shouldObserve = value;
1314
- }
1315
-
1316
- /**
1317
- * Observer class that is attached to each observed
1318
- * object. Once attached, the observer converts the target
1319
- * object's property keys into getter/setters that
1320
- * collect dependencies and dispatch updates.
1321
- */
1322
- var Observer = function Observer (value) {
1323
- this.value = value;
1324
- this.dep = new Dep();
1325
- this.vmCount = 0;
1326
- def(value, '__ob__', this);
1327
- if (Array.isArray(value)) {
1328
- if (hasProto) {
1329
- protoAugment(value, arrayMethods);
1330
- } else {
1331
- copyAugment(value, arrayMethods, arrayKeys);
1332
- }
1333
- this.observeArray(value);
1334
- } else {
1335
- this.walk(value);
1336
- }
1337
- };
1338
-
1339
- /**
1340
- * Walk through all properties and convert them into
1341
- * getter/setters. This method should only be called when
1342
- * value type is Object.
1343
- */
1344
- Observer.prototype.walk = function walk (obj) {
1345
- var keys = Object.keys(obj);
1346
- for (var i = 0; i < keys.length; i++) {
1347
- defineReactive$1(obj, keys[i]);
1348
- }
1349
- };
1350
-
1351
- /**
1352
- * Observe a list of Array items.
1353
- */
1354
- Observer.prototype.observeArray = function observeArray (items) {
1355
- for (var i = 0, l = items.length; i < l; i++) {
1356
- observe(items[i]);
1357
- }
1358
- };
1359
-
1360
- // helpers
1361
-
1362
- /**
1363
- * Augment a target Object or Array by intercepting
1364
- * the prototype chain using __proto__
1365
- */
1366
- function protoAugment (target, src) {
1367
- /* eslint-disable no-proto */
1368
- target.__proto__ = src;
1369
- /* eslint-enable no-proto */
1370
- }
1371
-
1372
- /**
1373
- * Augment a target Object or Array by defining
1374
- * hidden properties.
1375
- */
1376
- /* istanbul ignore next */
1377
- function copyAugment (target, src, keys) {
1378
- for (var i = 0, l = keys.length; i < l; i++) {
1379
- var key = keys[i];
1380
- def(target, key, src[key]);
1381
- }
1382
- }
1383
-
1384
- /**
1385
- * Attempt to create an observer instance for a value,
1386
- * returns the new observer if successfully observed,
1387
- * or the existing observer if the value already has one.
1388
- */
1389
- function observe (value, asRootData) {
1390
- if (!isObject(value) || value instanceof VNode) {
1391
- return
1392
- }
1393
- var ob;
1394
- if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
1395
- ob = value.__ob__;
1396
- } else if (
1397
- shouldObserve &&
1398
- !isServerRendering() &&
1399
- (Array.isArray(value) || isPlainObject(value)) &&
1400
- Object.isExtensible(value) &&
1401
- !value._isVue
1402
- ) {
1403
- ob = new Observer(value);
1404
- }
1405
- if (asRootData && ob) {
1406
- ob.vmCount++;
1407
- }
1408
- return ob
1409
- }
1410
-
1411
- /**
1412
- * Define a reactive property on an Object.
1413
- */
1414
- function defineReactive$1 (
1415
- obj,
1416
- key,
1417
- val,
1418
- customSetter,
1419
- shallow
1420
- ) {
1421
- var dep = new Dep();
1422
-
1423
- var property = Object.getOwnPropertyDescriptor(obj, key);
1424
- if (property && property.configurable === false) {
1425
- return
1426
- }
1427
-
1428
- // cater for pre-defined getter/setters
1429
- var getter = property && property.get;
1430
- var setter = property && property.set;
1431
- if ((!getter || setter) && arguments.length === 2) {
1432
- val = obj[key];
1433
- }
1434
-
1435
- var childOb = !shallow && observe(val);
1436
- Object.defineProperty(obj, key, {
1437
- enumerable: true,
1438
- configurable: true,
1439
- get: function reactiveGetter () {
1440
- var value = getter ? getter.call(obj) : val;
1441
- if (Dep.target) {
1442
- dep.depend();
1443
- if (childOb) {
1444
- childOb.dep.depend();
1445
- if (Array.isArray(value)) {
1446
- dependArray(value);
1447
- }
1448
- }
1449
- }
1450
- return value
1451
- },
1452
- set: function reactiveSetter (newVal) {
1453
- var value = getter ? getter.call(obj) : val;
1454
- /* eslint-disable no-self-compare */
1455
- if (newVal === value || (newVal !== newVal && value !== value)) {
1456
- return
1457
- }
1458
- /* eslint-enable no-self-compare */
1459
- if (process.env.NODE_ENV !== 'production' && customSetter) {
1460
- customSetter();
1461
- }
1462
- // #7981: for accessor properties without setter
1463
- if (getter && !setter) { return }
1464
- if (setter) {
1465
- setter.call(obj, newVal);
1466
- } else {
1467
- val = newVal;
1468
- }
1469
- childOb = !shallow && observe(newVal);
1470
- dep.notify();
1471
- }
1472
- });
1473
- }
1474
-
1475
- /**
1476
- * Set a property on an object. Adds the new property and
1477
- * triggers change notification if the property doesn't
1478
- * already exist.
1479
- */
1480
- function set (target, key, val) {
1481
- if (process.env.NODE_ENV !== 'production' &&
1482
- (isUndef(target) || isPrimitive(target))
1483
- ) {
1484
- warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
1485
- }
1486
- if (Array.isArray(target) && isValidArrayIndex(key)) {
1487
- target.length = Math.max(target.length, key);
1488
- target.splice(key, 1, val);
1489
- return val
1490
- }
1491
- if (key in target && !(key in Object.prototype)) {
1492
- target[key] = val;
1493
- return val
1494
- }
1495
- var ob = (target).__ob__;
1496
- if (target._isVue || (ob && ob.vmCount)) {
1497
- process.env.NODE_ENV !== 'production' && warn(
1498
- 'Avoid adding reactive properties to a Vue instance or its root $data ' +
1499
- 'at runtime - declare it upfront in the data option.'
1500
- );
1501
- return val
1502
- }
1503
- if (!ob) {
1504
- target[key] = val;
1505
- return val
1506
- }
1507
- defineReactive$1(ob.value, key, val);
1508
- ob.dep.notify();
1509
- return val
1510
- }
1511
-
1512
- /**
1513
- * Delete a property and trigger change if necessary.
1514
- */
1515
- function del (target, key) {
1516
- if (process.env.NODE_ENV !== 'production' &&
1517
- (isUndef(target) || isPrimitive(target))
1518
- ) {
1519
- warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
1520
- }
1521
- if (Array.isArray(target) && isValidArrayIndex(key)) {
1522
- target.splice(key, 1);
1523
- return
1524
- }
1525
- var ob = (target).__ob__;
1526
- if (target._isVue || (ob && ob.vmCount)) {
1527
- process.env.NODE_ENV !== 'production' && warn(
1528
- 'Avoid deleting properties on a Vue instance or its root $data ' +
1529
- '- just set it to null.'
1530
- );
1531
- return
1532
- }
1533
- if (!hasOwn(target, key)) {
1534
- return
1535
- }
1536
- delete target[key];
1537
- if (!ob) {
1538
- return
1539
- }
1540
- ob.dep.notify();
1541
- }
1542
-
1543
- /**
1544
- * Collect dependencies on array elements when the array is touched, since
1545
- * we cannot intercept array element access like property getters.
1546
- */
1547
- function dependArray (value) {
1548
- for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
1549
- e = value[i];
1550
- e && e.__ob__ && e.__ob__.dep.depend();
1551
- if (Array.isArray(e)) {
1552
- dependArray(e);
1553
- }
1554
- }
1555
- }
1556
-
1557
- /* */
1558
-
1559
- /**
1560
- * Option overwriting strategies are functions that handle
1561
- * how to merge a parent option value and a child option
1562
- * value into the final value.
1563
- */
1564
- var strats = config.optionMergeStrategies;
1565
-
1566
- /**
1567
- * Options with restrictions
1568
- */
1569
- if (process.env.NODE_ENV !== 'production') {
1570
- strats.el = strats.propsData = function (parent, child, vm, key) {
1571
- if (!vm) {
1572
- warn(
1573
- "option \"" + key + "\" can only be used during instance " +
1574
- 'creation with the `new` keyword.'
1575
- );
1576
- }
1577
- return defaultStrat(parent, child)
1578
- };
1579
- }
1580
-
1581
- /**
1582
- * Helper that recursively merges two data objects together.
1583
- */
1584
- function mergeData (to, from) {
1585
- if (!from) { return to }
1586
- var key, toVal, fromVal;
1587
-
1588
- var keys = hasSymbol
1589
- ? Reflect.ownKeys(from)
1590
- : Object.keys(from);
1591
-
1592
- for (var i = 0; i < keys.length; i++) {
1593
- key = keys[i];
1594
- // in case the object is already observed...
1595
- if (key === '__ob__') { continue }
1596
- toVal = to[key];
1597
- fromVal = from[key];
1598
- if (!hasOwn(to, key)) {
1599
- set(to, key, fromVal);
1600
- } else if (
1601
- toVal !== fromVal &&
1602
- isPlainObject(toVal) &&
1603
- isPlainObject(fromVal)
1604
- ) {
1605
- mergeData(toVal, fromVal);
1606
- }
1607
- }
1608
- return to
1609
- }
1610
-
1611
- /**
1612
- * Data
1613
- */
1614
- function mergeDataOrFn (
1615
- parentVal,
1616
- childVal,
1617
- vm
1618
- ) {
1619
- if (!vm) {
1620
- // in a Vue.extend merge, both should be functions
1621
- if (!childVal) {
1622
- return parentVal
1623
- }
1624
- if (!parentVal) {
1625
- return childVal
1626
- }
1627
- // when parentVal & childVal are both present,
1628
- // we need to return a function that returns the
1629
- // merged result of both functions... no need to
1630
- // check if parentVal is a function here because
1631
- // it has to be a function to pass previous merges.
1632
- return function mergedDataFn () {
1633
- return mergeData(
1634
- typeof childVal === 'function' ? childVal.call(this, this) : childVal,
1635
- typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
1636
- )
1637
- }
1638
- } else {
1639
- return function mergedInstanceDataFn () {
1640
- // instance merge
1641
- var instanceData = typeof childVal === 'function'
1642
- ? childVal.call(vm, vm)
1643
- : childVal;
1644
- var defaultData = typeof parentVal === 'function'
1645
- ? parentVal.call(vm, vm)
1646
- : parentVal;
1647
- if (instanceData) {
1648
- return mergeData(instanceData, defaultData)
1649
- } else {
1650
- return defaultData
1651
- }
1652
- }
1653
- }
1654
- }
1655
-
1656
- strats.data = function (
1657
- parentVal,
1658
- childVal,
1659
- vm
1660
- ) {
1661
- if (!vm) {
1662
- if (childVal && typeof childVal !== 'function') {
1663
- process.env.NODE_ENV !== 'production' && warn(
1664
- 'The "data" option should be a function ' +
1665
- 'that returns a per-instance value in component ' +
1666
- 'definitions.',
1667
- vm
1668
- );
1669
-
1670
- return parentVal
1671
- }
1672
- return mergeDataOrFn(parentVal, childVal)
1673
- }
1674
-
1675
- return mergeDataOrFn(parentVal, childVal, vm)
1676
- };
1677
-
1678
- /**
1679
- * Hooks and props are merged as arrays.
1680
- */
1681
- function mergeHook (
1682
- parentVal,
1683
- childVal
1684
- ) {
1685
- var res = childVal
1686
- ? parentVal
1687
- ? parentVal.concat(childVal)
1688
- : Array.isArray(childVal)
1689
- ? childVal
1690
- : [childVal]
1691
- : parentVal;
1692
- return res
1693
- ? dedupeHooks(res)
1694
- : res
1695
- }
1696
-
1697
- function dedupeHooks (hooks) {
1698
- var res = [];
1699
- for (var i = 0; i < hooks.length; i++) {
1700
- if (res.indexOf(hooks[i]) === -1) {
1701
- res.push(hooks[i]);
1702
- }
1703
- }
1704
- return res
1705
- }
1706
-
1707
- LIFECYCLE_HOOKS.forEach(function (hook) {
1708
- strats[hook] = mergeHook;
1709
- });
1710
-
1711
- /**
1712
- * Assets
1713
- *
1714
- * When a vm is present (instance creation), we need to do
1715
- * a three-way merge between constructor options, instance
1716
- * options and parent options.
1717
- */
1718
- function mergeAssets (
1719
- parentVal,
1720
- childVal,
1721
- vm,
1722
- key
1723
- ) {
1724
- var res = Object.create(parentVal || null);
1725
- if (childVal) {
1726
- process.env.NODE_ENV !== 'production' && assertObjectType(key, childVal, vm);
1727
- return extend(res, childVal)
1728
- } else {
1729
- return res
1730
- }
1731
- }
1732
-
1733
- ASSET_TYPES.forEach(function (type) {
1734
- strats[type + 's'] = mergeAssets;
1735
- });
1736
-
1737
- /**
1738
- * Watchers.
1739
- *
1740
- * Watchers hashes should not overwrite one
1741
- * another, so we merge them as arrays.
1742
- */
1743
- strats.watch = function (
1744
- parentVal,
1745
- childVal,
1746
- vm,
1747
- key
1748
- ) {
1749
- // work around Firefox's Object.prototype.watch...
1750
- if (parentVal === nativeWatch) { parentVal = undefined; }
1751
- if (childVal === nativeWatch) { childVal = undefined; }
1752
- /* istanbul ignore if */
1753
- if (!childVal) { return Object.create(parentVal || null) }
1754
- if (process.env.NODE_ENV !== 'production') {
1755
- assertObjectType(key, childVal, vm);
1756
- }
1757
- if (!parentVal) { return childVal }
1758
- var ret = {};
1759
- extend(ret, parentVal);
1760
- for (var key$1 in childVal) {
1761
- var parent = ret[key$1];
1762
- var child = childVal[key$1];
1763
- if (parent && !Array.isArray(parent)) {
1764
- parent = [parent];
1765
- }
1766
- ret[key$1] = parent
1767
- ? parent.concat(child)
1768
- : Array.isArray(child) ? child : [child];
1769
- }
1770
- return ret
1771
- };
1772
-
1773
- /**
1774
- * Other object hashes.
1775
- */
1776
- strats.props =
1777
- strats.methods =
1778
- strats.inject =
1779
- strats.computed = function (
1780
- parentVal,
1781
- childVal,
1782
- vm,
1783
- key
1784
- ) {
1785
- if (childVal && process.env.NODE_ENV !== 'production') {
1786
- assertObjectType(key, childVal, vm);
1787
- }
1788
- if (!parentVal) { return childVal }
1789
- var ret = Object.create(null);
1790
- extend(ret, parentVal);
1791
- if (childVal) { extend(ret, childVal); }
1792
- return ret
1793
- };
1794
- strats.provide = mergeDataOrFn;
1795
-
1796
- /**
1797
- * Default strategy.
1798
- */
1799
- var defaultStrat = function (parentVal, childVal) {
1800
- return childVal === undefined
1801
- ? parentVal
1802
- : childVal
1803
- };
1804
-
1805
- /**
1806
- * Validate component names
1807
- */
1808
- function checkComponents (options) {
1809
- for (var key in options.components) {
1810
- validateComponentName(key);
1811
- }
1812
- }
1813
-
1814
- function validateComponentName (name) {
1815
- if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*quot;)).test(name)) {
1816
- warn(
1817
- 'Invalid component name: "' + name + '". Component names ' +
1818
- 'should conform to valid custom element name in html5 specification.'
1819
- );
1820
- }
1821
- if (isBuiltInTag(name) || config.isReservedTag(name)) {
1822
- warn(
1823
- 'Do not use built-in or reserved HTML elements as component ' +
1824
- 'id: ' + name
1825
- );
1826
- }
1827
- }
1828
-
1829
- /**
1830
- * Ensure all props option syntax are normalized into the
1831
- * Object-based format.
1832
- */
1833
- function normalizeProps (options, vm) {
1834
- var props = options.props;
1835
- if (!props) { return }
1836
- var res = {};
1837
- var i, val, name;
1838
- if (Array.isArray(props)) {
1839
- i = props.length;
1840
- while (i--) {
1841
- val = props[i];
1842
- if (typeof val === 'string') {
1843
- name = camelize(val);
1844
- res[name] = { type: null };
1845
- } else if (process.env.NODE_ENV !== 'production') {
1846
- warn('props must be strings when using array syntax.');
1847
- }
1848
- }
1849
- } else if (isPlainObject(props)) {
1850
- for (var key in props) {
1851
- val = props[key];
1852
- name = camelize(key);
1853
- res[name] = isPlainObject(val)
1854
- ? val
1855
- : { type: val };
1856
- }
1857
- } else if (process.env.NODE_ENV !== 'production') {
1858
- warn(
1859
- "Invalid value for option \"props\": expected an Array or an Object, " +
1860
- "but got " + (toRawType(props)) + ".",
1861
- vm
1862
- );
1863
- }
1864
- options.props = res;
1865
- }
1866
-
1867
- /**
1868
- * Normalize all injections into Object-based format
1869
- */
1870
- function normalizeInject (options, vm) {
1871
- var inject = options.inject;
1872
- if (!inject) { return }
1873
- var normalized = options.inject = {};
1874
- if (Array.isArray(inject)) {
1875
- for (var i = 0; i < inject.length; i++) {
1876
- normalized[inject[i]] = { from: inject[i] };
1877
- }
1878
- } else if (isPlainObject(inject)) {
1879
- for (var key in inject) {
1880
- var val = inject[key];
1881
- normalized[key] = isPlainObject(val)
1882
- ? extend({ from: key }, val)
1883
- : { from: val };
1884
- }
1885
- } else if (process.env.NODE_ENV !== 'production') {
1886
- warn(
1887
- "Invalid value for option \"inject\": expected an Array or an Object, " +
1888
- "but got " + (toRawType(inject)) + ".",
1889
- vm
1890
- );
1891
- }
1892
- }
1893
-
1894
- /**
1895
- * Normalize raw function directives into object format.
1896
- */
1897
- function normalizeDirectives (options) {
1898
- var dirs = options.directives;
1899
- if (dirs) {
1900
- for (var key in dirs) {
1901
- var def$1 = dirs[key];
1902
- if (typeof def$1 === 'function') {
1903
- dirs[key] = { bind: def$1, update: def$1 };
1904
- }
1905
- }
1906
- }
1907
- }
1908
-
1909
- function assertObjectType (name, value, vm) {
1910
- if (!isPlainObject(value)) {
1911
- warn(
1912
- "Invalid value for option \"" + name + "\": expected an Object, " +
1913
- "but got " + (toRawType(value)) + ".",
1914
- vm
1915
- );
1916
- }
1917
- }
1918
-
1919
- /**
1920
- * Merge two option objects into a new one.
1921
- * Core utility used in both instantiation and inheritance.
1922
- */
1923
- function mergeOptions (
1924
- parent,
1925
- child,
1926
- vm
1927
- ) {
1928
- if (process.env.NODE_ENV !== 'production') {
1929
- checkComponents(child);
1930
- }
1931
-
1932
- if (typeof child === 'function') {
1933
- child = child.options;
1934
- }
1935
-
1936
- normalizeProps(child, vm);
1937
- normalizeInject(child, vm);
1938
- normalizeDirectives(child);
1939
-
1940
- // Apply extends and mixins on the child options,
1941
- // but only if it is a raw options object that isn't
1942
- // the result of another mergeOptions call.
1943
- // Only merged options has the _base property.
1944
- if (!child._base) {
1945
- if (child.extends) {
1946
- parent = mergeOptions(parent, child.extends, vm);
1947
- }
1948
- if (child.mixins) {
1949
- for (var i = 0, l = child.mixins.length; i < l; i++) {
1950
- parent = mergeOptions(parent, child.mixins[i], vm);
1951
- }
1952
- }
1953
- }
1954
-
1955
- var options = {};
1956
- var key;
1957
- for (key in parent) {
1958
- mergeField(key);
1959
- }
1960
- for (key in child) {
1961
- if (!hasOwn(parent, key)) {
1962
- mergeField(key);
1963
- }
1964
- }
1965
- function mergeField (key) {
1966
- var strat = strats[key] || defaultStrat;
1967
- options[key] = strat(parent[key], child[key], vm, key);
1968
- }
1969
- return options
1970
- }
1971
-
1972
- /**
1973
- * Resolve an asset.
1974
- * This function is used because child instances need access
1975
- * to assets defined in its ancestor chain.
1976
- */
1977
- function resolveAsset (
1978
- options,
1979
- type,
1980
- id,
1981
- warnMissing
1982
- ) {
1983
- /* istanbul ignore if */
1984
- if (typeof id !== 'string') {
1985
- return
1986
- }
1987
- var assets = options[type];
1988
- // check local registration variations first
1989
- if (hasOwn(assets, id)) { return assets[id] }
1990
- var camelizedId = camelize(id);
1991
- if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
1992
- var PascalCaseId = capitalize(camelizedId);
1993
- if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
1994
- // fallback to prototype chain
1995
- var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
1996
- if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
1997
- warn(
1998
- 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
1999
- options
2000
- );
2001
- }
2002
- return res
2003
- }
2004
-
2005
- /* */
2006
-
2007
-
2008
-
2009
- function validateProp (
2010
- key,
2011
- propOptions,
2012
- propsData,
2013
- vm
2014
- ) {
2015
- var prop = propOptions[key];
2016
- var absent = !hasOwn(propsData, key);
2017
- var value = propsData[key];
2018
- // boolean casting
2019
- var booleanIndex = getTypeIndex(Boolean, prop.type);
2020
- if (booleanIndex > -1) {
2021
- if (absent && !hasOwn(prop, 'default')) {
2022
- value = false;
2023
- } else if (value === '' || value === hyphenate(key)) {
2024
- // only cast empty string / same name to boolean if
2025
- // boolean has higher priority
2026
- var stringIndex = getTypeIndex(String, prop.type);
2027
- if (stringIndex < 0 || booleanIndex < stringIndex) {
2028
- value = true;
2029
- }
2030
- }
2031
- }
2032
- // check default value
2033
- if (value === undefined) {
2034
- value = getPropDefaultValue(vm, prop, key);
2035
- // since the default value is a fresh copy,
2036
- // make sure to observe it.
2037
- var prevShouldObserve = shouldObserve;
2038
- toggleObserving(true);
2039
- observe(value);
2040
- toggleObserving(prevShouldObserve);
2041
- }
2042
- if (
2043
- process.env.NODE_ENV !== 'production' &&
2044
- // skip validation for weex recycle-list child component props
2045
- !(false)
2046
- ) {
2047
- assertProp(prop, key, value, vm, absent);
2048
- }
2049
- return value
2050
- }
2051
-
2052
- /**
2053
- * Get the default value of a prop.
2054
- */
2055
- function getPropDefaultValue (vm, prop, key) {
2056
- // no default, return undefined
2057
- if (!hasOwn(prop, 'default')) {
2058
- return undefined
2059
- }
2060
- var def = prop.default;
2061
- // warn against non-factory defaults for Object & Array
2062
- if (process.env.NODE_ENV !== 'production' && isObject(def)) {
2063
- warn(
2064
- 'Invalid default value for prop "' + key + '": ' +
2065
- 'Props with type Object/Array must use a factory function ' +
2066
- 'to return the default value.',
2067
- vm
2068
- );
2069
- }
2070
- // the raw prop value was also undefined from previous render,
2071
- // return previous default value to avoid unnecessary watcher trigger
2072
- if (vm && vm.$options.propsData &&
2073
- vm.$options.propsData[key] === undefined &&
2074
- vm._props[key] !== undefined
2075
- ) {
2076
- return vm._props[key]
2077
- }
2078
- // call factory function for non-Function types
2079
- // a value is Function if its prototype is function even across different execution context
2080
- return typeof def === 'function' && getType(prop.type) !== 'Function'
2081
- ? def.call(vm)
2082
- : def
2083
- }
2084
-
2085
- /**
2086
- * Assert whether a prop is valid.
2087
- */
2088
- function assertProp (
2089
- prop,
2090
- name,
2091
- value,
2092
- vm,
2093
- absent
2094
- ) {
2095
- if (prop.required && absent) {
2096
- warn(
2097
- 'Missing required prop: "' + name + '"',
2098
- vm
2099
- );
2100
- return
2101
- }
2102
- if (value == null && !prop.required) {
2103
- return
2104
- }
2105
- var type = prop.type;
2106
- var valid = !type || type === true;
2107
- var expectedTypes = [];
2108
- if (type) {
2109
- if (!Array.isArray(type)) {
2110
- type = [type];
2111
- }
2112
- for (var i = 0; i < type.length && !valid; i++) {
2113
- var assertedType = assertType(value, type[i]);
2114
- expectedTypes.push(assertedType.expectedType || '');
2115
- valid = assertedType.valid;
2116
- }
2117
- }
2118
-
2119
- if (!valid) {
2120
- warn(
2121
- getInvalidTypeMessage(name, value, expectedTypes),
2122
- vm
2123
- );
2124
- return
2125
- }
2126
- var validator = prop.validator;
2127
- if (validator) {
2128
- if (!validator(value)) {
2129
- warn(
2130
- 'Invalid prop: custom validator check failed for prop "' + name + '".',
2131
- vm
2132
- );
2133
- }
2134
- }
2135
- }
2136
-
2137
- var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)#x2F;;
2138
-
2139
- function assertType (value, type) {
2140
- var valid;
2141
- var expectedType = getType(type);
2142
- if (simpleCheckRE.test(expectedType)) {
2143
- var t = typeof value;
2144
- valid = t === expectedType.toLowerCase();
2145
- // for primitive wrapper objects
2146
- if (!valid && t === 'object') {
2147
- valid = value instanceof type;
2148
- }
2149
- } else if (expectedType === 'Object') {
2150
- valid = isPlainObject(value);
2151
- } else if (expectedType === 'Array') {
2152
- valid = Array.isArray(value);
2153
- } else {
2154
- valid = value instanceof type;
2155
- }
2156
- return {
2157
- valid: valid,
2158
- expectedType: expectedType
2159
- }
2160
- }
2161
-
2162
- /**
2163
- * Use function string name to check built-in types,
2164
- * because a simple equality check will fail when running
2165
- * across different vms / iframes.
2166
- */
2167
- function getType (fn) {
2168
- var match = fn && fn.toString().match(/^\s*function (\w+)/);
2169
- return match ? match[1] : ''
2170
- }
2171
-
2172
- function isSameType (a, b) {
2173
- return getType(a) === getType(b)
2174
- }
2175
-
2176
- function getTypeIndex (type, expectedTypes) {
2177
- if (!Array.isArray(expectedTypes)) {
2178
- return isSameType(expectedTypes, type) ? 0 : -1
2179
- }
2180
- for (var i = 0, len = expectedTypes.length; i < len; i++) {
2181
- if (isSameType(expectedTypes[i], type)) {
2182
- return i
2183
- }
2184
- }
2185
- return -1
2186
- }
2187
-
2188
- function getInvalidTypeMessage (name, value, expectedTypes) {
2189
- var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
2190
- " Expected " + (expectedTypes.map(capitalize).join(', '));
2191
- var expectedType = expectedTypes[0];
2192
- var receivedType = toRawType(value);
2193
- var expectedValue = styleValue(value, expectedType);
2194
- var receivedValue = styleValue(value, receivedType);
2195
- // check if we need to specify expected value
2196
- if (expectedTypes.length === 1 &&
2197
- isExplicable(expectedType) &&
2198
- !isBoolean(expectedType, receivedType)) {
2199
- message += " with value " + expectedValue;
2200
- }
2201
- message += ", got " + receivedType + " ";
2202
- // check if we need to specify received value
2203
- if (isExplicable(receivedType)) {
2204
- message += "with value " + receivedValue + ".";
2205
- }
2206
- return message
2207
- }
2208
-
2209
- function styleValue (value, type) {
2210
- if (type === 'String') {
2211
- return ("\"" + value + "\"")
2212
- } else if (type === 'Number') {
2213
- return ("" + (Number(value)))
2214
- } else {
2215
- return ("" + value)
2216
- }
2217
- }
2218
-
2219
- function isExplicable (value) {
2220
- var explicitTypes = ['string', 'number', 'boolean'];
2221
- return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
2222
- }
2223
-
2224
- function isBoolean () {
2225
- var args = [], len = arguments.length;
2226
- while ( len-- ) args[ len ] = arguments[ len ];
2227
-
2228
- return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
2229
- }
2230
-
2231
- /* */
2232
-
2233
- function handleError (err, vm, info) {
2234
- if (vm) {
2235
- var cur = vm;
2236
- while ((cur = cur.$parent)) {
2237
- var hooks = cur.$options.errorCaptured;
2238
- if (hooks) {
2239
- for (var i = 0; i < hooks.length; i++) {
2240
- try {
2241
- var capture = hooks[i].call(cur, err, vm, info) === false;
2242
- if (capture) { return }
2243
- } catch (e) {
2244
- globalHandleError(e, cur, 'errorCaptured hook');
2245
- }
2246
- }
2247
- }
2248
- }
2249
- }
2250
- globalHandleError(err, vm, info);
2251
- }
2252
-
2253
- function invokeWithErrorHandling (
2254
- handler,
2255
- context,
2256
- args,
2257
- vm,
2258
- info
2259
- ) {
2260
- var res;
2261
- try {
2262
- res = args ? handler.apply(context, args) : handler.call(context);
2263
- if (res && !res._isVue && isPromise(res)) {
2264
- res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
2265
- }
2266
- } catch (e) {
2267
- handleError(e, vm, info);
2268
- }
2269
- return res
2270
- }
2271
-
2272
- function globalHandleError (err, vm, info) {
2273
- if (config.errorHandler) {
2274
- try {
2275
- return config.errorHandler.call(null, err, vm, info)
2276
- } catch (e) {
2277
- // if the user intentionally throws the original error in the handler,
2278
- // do not log it twice
2279
- if (e !== err) {
2280
- logError(e, null, 'config.errorHandler');
2281
- }
2282
- }
2283
- }
2284
- logError(err, vm, info);
2285
- }
2286
-
2287
- function logError (err, vm, info) {
2288
- if (process.env.NODE_ENV !== 'production') {
2289
- warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
2290
- }
2291
- /* istanbul ignore else */
2292
- if ((inBrowser || inWeex) && typeof console !== 'undefined') {
2293
- console.error(err);
2294
- } else {
2295
- throw err
2296
- }
2297
- }
2298
-
2299
- /* */
2300
-
2301
- var isUsingMicroTask = false;
2302
-
2303
- var callbacks = [];
2304
- var pending = false;
2305
-
2306
- function flushCallbacks () {
2307
- pending = false;
2308
- var copies = callbacks.slice(0);
2309
- callbacks.length = 0;
2310
- for (var i = 0; i < copies.length; i++) {
2311
- copies[i]();
2312
- }
2313
- }
2314
-
2315
- // Here we have async deferring wrappers using microtasks.
2316
- // In 2.5 we used (macro) tasks (in combination with microtasks).
2317
- // However, it has subtle problems when state is changed right before repaint
2318
- // (e.g. #6813, out-in transitions).
2319
- // Also, using (macro) tasks in event handler would cause some weird behaviors
2320
- // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
2321
- // So we now use microtasks everywhere, again.
2322
- // A major drawback of this tradeoff is that there are some scenarios
2323
- // where microtasks have too high a priority and fire in between supposedly
2324
- // sequential events (e.g. #4521, #6690, which have workarounds)
2325
- // or even between bubbling of the same event (#6566).
2326
- var timerFunc;
2327
-
2328
- // The nextTick behavior leverages the microtask queue, which can be accessed
2329
- // via either native Promise.then or MutationObserver.
2330
- // MutationObserver has wider support, however it is seriously bugged in
2331
- // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
2332
- // completely stops working after triggering a few times... so, if native
2333
- // Promise is available, we will use it:
2334
- /* istanbul ignore next, $flow-disable-line */
2335
- if (typeof Promise !== 'undefined' && isNative(Promise)) {
2336
- var p = Promise.resolve();
2337
- timerFunc = function () {
2338
- p.then(flushCallbacks);
2339
- // In problematic UIWebViews, Promise.then doesn't completely break, but
2340
- // it can get stuck in a weird state where callbacks are pushed into the
2341
- // microtask queue but the queue isn't being flushed, until the browser
2342
- // needs to do some other work, e.g. handle a timer. Therefore we can
2343
- // "force" the microtask queue to be flushed by adding an empty timer.
2344
- if (isIOS) { setTimeout(noop); }
2345
- };
2346
- isUsingMicroTask = true;
2347
- } else if (!isIE && typeof MutationObserver !== 'undefined' && (
2348
- isNative(MutationObserver) ||
2349
- // PhantomJS and iOS 7.x
2350
- MutationObserver.toString() === '[object MutationObserverConstructor]'
2351
- )) {
2352
- // Use MutationObserver where native Promise is not available,
2353
- // e.g. PhantomJS, iOS7, Android 4.4
2354
- // (#6466 MutationObserver is unreliable in IE11)
2355
- var counter = 1;
2356
- var observer = new MutationObserver(flushCallbacks);
2357
- var textNode = document.createTextNode(String(counter));
2358
- observer.observe(textNode, {
2359
- characterData: true
2360
- });
2361
- timerFunc = function () {
2362
- counter = (counter + 1) % 2;
2363
- textNode.data = String(counter);
2364
- };
2365
- isUsingMicroTask = true;
2366
- } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
2367
- // Fallback to setImmediate.
2368
- // Techinically it leverages the (macro) task queue,
2369
- // but it is still a better choice than setTimeout.
2370
- timerFunc = function () {
2371
- setImmediate(flushCallbacks);
2372
- };
2373
- } else {
2374
- // Fallback to setTimeout.
2375
- timerFunc = function () {
2376
- setTimeout(flushCallbacks, 0);
2377
- };
2378
- }
2379
-
2380
- function nextTick (cb, ctx) {
2381
- var _resolve;
2382
- callbacks.push(function () {
2383
- if (cb) {
2384
- try {
2385
- cb.call(ctx);
2386
- } catch (e) {
2387
- handleError(e, ctx, 'nextTick');
2388
- }
2389
- } else if (_resolve) {
2390
- _resolve(ctx);
2391
- }
2392
- });
2393
- if (!pending) {
2394
- pending = true;
2395
- timerFunc();
2396
- }
2397
- // $flow-disable-line
2398
- if (!cb && typeof Promise !== 'undefined') {
2399
- return new Promise(function (resolve) {
2400
- _resolve = resolve;
2401
- })
2402
- }
2403
- }
2404
-
2405
- /* */
2406
-
2407
- var mark;
2408
- var measure;
2409
-
2410
- if (process.env.NODE_ENV !== 'production') {
2411
- var perf = inBrowser && window.performance;
2412
- /* istanbul ignore if */
2413
- if (
2414
- perf &&
2415
- perf.mark &&
2416
- perf.measure &&
2417
- perf.clearMarks &&
2418
- perf.clearMeasures
2419
- ) {
2420
- mark = function (tag) { return perf.mark(tag); };
2421
- measure = function (name, startTag, endTag) {
2422
- perf.measure(name, startTag, endTag);
2423
- perf.clearMarks(startTag);
2424
- perf.clearMarks(endTag);
2425
- // perf.clearMeasures(name)
2426
- };
2427
- }
2428
- }
2429
-
2430
- /* not type checking this file because flow doesn't play well with Proxy */
2431
-
2432
- var initProxy;
2433
-
2434
- if (process.env.NODE_ENV !== 'production') {
2435
- var allowedGlobals = makeMap(
2436
- 'Infinity,undefined,NaN,isFinite,isNaN,' +
2437
- 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
2438
- 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
2439
- 'require' // for Webpack/Browserify
2440
- );
2441
-
2442
- var warnNonPresent = function (target, key) {
2443
- warn(
2444
- "Property or method \"" + key + "\" is not defined on the instance but " +
2445
- 'referenced during render. Make sure that this property is reactive, ' +
2446
- 'either in the data option, or for class-based components, by ' +
2447
- 'initializing the property. ' +
2448
- 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
2449
- target
2450
- );
2451
- };
2452
-
2453
- var warnReservedPrefix = function (target, key) {
2454
- warn(
2455
- "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2456
- 'properties starting with "quot; or "_" are not proxied in the Vue instance to ' +
2457
- 'prevent conflicts with Vue internals' +
2458
- 'See: https://vuejs.org/v2/api/#data',
2459
- target
2460
- );
2461
- };
2462
-
2463
- var hasProxy =
2464
- typeof Proxy !== 'undefined' && isNative(Proxy);
2465
-
2466
- if (hasProxy) {
2467
- var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
2468
- config.keyCodes = new Proxy(config.keyCodes, {
2469
- set: function set (target, key, value) {
2470
- if (isBuiltInModifier(key)) {
2471
- warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
2472
- return false
2473
- } else {
2474
- target[key] = value;
2475
- return true
2476
- }
2477
- }
2478
- });
2479
- }
2480
-
2481
- var hasHandler = {
2482
- has: function has (target, key) {
2483
- var has = key in target;
2484
- var isAllowed = allowedGlobals(key) ||
2485
- (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
2486
- if (!has && !isAllowed) {
2487
- if (key in target.$data) { warnReservedPrefix(target, key); }
2488
- else { warnNonPresent(target, key); }
2489
- }
2490
- return has || !isAllowed
2491
- }
2492
- };
2493
-
2494
- var getHandler = {
2495
- get: function get (target, key) {
2496
- if (typeof key === 'string' && !(key in target)) {
2497
- if (key in target.$data) { warnReservedPrefix(target, key); }
2498
- else { warnNonPresent(target, key); }
2499
- }
2500
- return target[key]
2501
- }
2502
- };
2503
-
2504
- initProxy = function initProxy (vm) {
2505
- if (hasProxy) {
2506
- // determine which proxy handler to use
2507
- var options = vm.$options;
2508
- var handlers = options.render && options.render._withStripped
2509
- ? getHandler
2510
- : hasHandler;
2511
- vm._renderProxy = new Proxy(vm, handlers);
2512
- } else {
2513
- vm._renderProxy = vm;
2514
- }
2515
- };
2516
- }
2517
-
2518
- /* */
2519
-
2520
- var seenObjects = new _Set();
2521
-
2522
- /**
2523
- * Recursively traverse an object to evoke all converted
2524
- * getters, so that every nested property inside the object
2525
- * is collected as a "deep" dependency.
2526
- */
2527
- function traverse (val) {
2528
- _traverse(val, seenObjects);
2529
- seenObjects.clear();
2530
- }
2531
-
2532
- function _traverse (val, seen) {
2533
- var i, keys;
2534
- var isA = Array.isArray(val);
2535
- if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
2536
- return
2537
- }
2538
- if (val.__ob__) {
2539
- var depId = val.__ob__.dep.id;
2540
- if (seen.has(depId)) {
2541
- return
2542
- }
2543
- seen.add(depId);
2544
- }
2545
- if (isA) {
2546
- i = val.length;
2547
- while (i--) { _traverse(val[i], seen); }
2548
- } else {
2549
- keys = Object.keys(val);
2550
- i = keys.length;
2551
- while (i--) { _traverse(val[keys[i]], seen); }
2552
- }
2553
- }
2554
-
2555
- /* */
2556
-
2557
- var normalizeEvent = cached(function (name) {
2558
- var passive = name.charAt(0) === '&';
2559
- name = passive ? name.slice(1) : name;
2560
- var once$1 = name.charAt(0) === '~'; // Prefixed last, checked first
2561
- name = once$1 ? name.slice(1) : name;
2562
- var capture = name.charAt(0) === '!';
2563
- name = capture ? name.slice(1) : name;
2564
- return {
2565
- name: name,
2566
- once: once$1,
2567
- capture: capture,
2568
- passive: passive
2569
- }
2570
- });
2571
-
2572
- function createFnInvoker (fns, vm) {
2573
- function invoker () {
2574
- var arguments$1 = arguments;
2575
-
2576
- var fns = invoker.fns;
2577
- if (Array.isArray(fns)) {
2578
- var cloned = fns.slice();
2579
- for (var i = 0; i < cloned.length; i++) {
2580
- invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
2581
- }
2582
- } else {
2583
- // return handler return value for single handlers
2584
- return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
2585
- }
2586
- }
2587
- invoker.fns = fns;
2588
- return invoker
2589
- }
2590
-
2591
- function updateListeners (
2592
- on,
2593
- oldOn,
2594
- add,
2595
- remove$1,
2596
- createOnceHandler,
2597
- vm
2598
- ) {
2599
- var name, def$1, cur, old, event;
2600
- for (name in on) {
2601
- def$1 = cur = on[name];
2602
- old = oldOn[name];
2603
- event = normalizeEvent(name);
2604
- if (isUndef(cur)) {
2605
- process.env.NODE_ENV !== 'production' && warn(
2606
- "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
2607
- vm
2608
- );
2609
- } else if (isUndef(old)) {
2610
- if (isUndef(cur.fns)) {
2611
- cur = on[name] = createFnInvoker(cur, vm);
2612
- }
2613
- if (isTrue(event.once)) {
2614
- cur = on[name] = createOnceHandler(event.name, cur, event.capture);
2615
- }
2616
- add(event.name, cur, event.capture, event.passive, event.params);
2617
- } else if (cur !== old) {
2618
- old.fns = cur;
2619
- on[name] = old;
2620
- }
2621
- }
2622
- for (name in oldOn) {
2623
- if (isUndef(on[name])) {
2624
- event = normalizeEvent(name);
2625
- remove$1(event.name, oldOn[name], event.capture);
2626
- }
2627
- }
2628
- }
2629
-
2630
- /* */
2631
-
2632
- function mergeVNodeHook (def, hookKey, hook) {
2633
- if (def instanceof VNode) {
2634
- def = def.data.hook || (def.data.hook = {});
2635
- }
2636
- var invoker;
2637
- var oldHook = def[hookKey];
2638
-
2639
- function wrappedHook () {
2640
- hook.apply(this, arguments);
2641
- // important: remove merged hook to ensure it's called only once
2642
- // and prevent memory leak
2643
- remove(invoker.fns, wrappedHook);
2644
- }
2645
-
2646
- if (isUndef(oldHook)) {
2647
- // no existing hook
2648
- invoker = createFnInvoker([wrappedHook]);
2649
- } else {
2650
- /* istanbul ignore if */
2651
- if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
2652
- // already a merged invoker
2653
- invoker = oldHook;
2654
- invoker.fns.push(wrappedHook);
2655
- } else {
2656
- // existing plain hook
2657
- invoker = createFnInvoker([oldHook, wrappedHook]);
2658
- }
2659
- }
2660
-
2661
- invoker.merged = true;
2662
- def[hookKey] = invoker;
2663
- }
2664
-
2665
- /* */
2666
-
2667
- function extractPropsFromVNodeData (
2668
- data,
2669
- Ctor,
2670
- tag
2671
- ) {
2672
- // we are only extracting raw values here.
2673
- // validation and default values are handled in the child
2674
- // component itself.
2675
- var propOptions = Ctor.options.props;
2676
- if (isUndef(propOptions)) {
2677
- return
2678
- }
2679
- var res = {};
2680
- var attrs = data.attrs;
2681
- var props = data.props;
2682
- if (isDef(attrs) || isDef(props)) {
2683
- for (var key in propOptions) {
2684
- var altKey = hyphenate(key);
2685
- if (process.env.NODE_ENV !== 'production') {
2686
- var keyInLowerCase = key.toLowerCase();
2687
- if (
2688
- key !== keyInLowerCase &&
2689
- attrs && hasOwn(attrs, keyInLowerCase)
2690
- ) {
2691
- tip(
2692
- "Prop \"" + keyInLowerCase + "\" is passed to component " +
2693
- (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
2694
- " \"" + key + "\". " +
2695
- "Note that HTML attributes are case-insensitive and camelCased " +
2696
- "props need to use their kebab-case equivalents when using in-DOM " +
2697
- "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
2698
- );
2699
- }
2700
- }
2701
- checkProp(res, props, key, altKey, true) ||
2702
- checkProp(res, attrs, key, altKey, false);
2703
- }
2704
- }
2705
- return res
2706
- }
2707
-
2708
- function checkProp (
2709
- res,
2710
- hash,
2711
- key,
2712
- altKey,
2713
- preserve
2714
- ) {
2715
- if (isDef(hash)) {
2716
- if (hasOwn(hash, key)) {
2717
- res[key] = hash[key];
2718
- if (!preserve) {
2719
- delete hash[key];
2720
- }
2721
- return true
2722
- } else if (hasOwn(hash, altKey)) {
2723
- res[key] = hash[altKey];
2724
- if (!preserve) {
2725
- delete hash[altKey];
2726
- }
2727
- return true
2728
- }
2729
- }
2730
- return false
2731
- }
2732
-
2733
- /* */
2734
-
2735
- // The template compiler attempts to minimize the need for normalization by
2736
- // statically analyzing the template at compile time.
2737
- //
2738
- // For plain HTML markup, normalization can be completely skipped because the
2739
- // generated render function is guaranteed to return Array<VNode>. There are
2740
- // two cases where extra normalization is needed:
2741
-
2742
- // 1. When the children contains components - because a functional component
2743
- // may return an Array instead of a single root. In this case, just a simple
2744
- // normalization is needed - if any child is an Array, we flatten the whole
2745
- // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
2746
- // because functional components already normalize their own children.
2747
- function simpleNormalizeChildren (children) {
2748
- for (var i = 0; i < children.length; i++) {
2749
- if (Array.isArray(children[i])) {
2750
- return Array.prototype.concat.apply([], children)
2751
- }
2752
- }
2753
- return children
2754
- }
2755
-
2756
- // 2. When the children contains constructs that always generated nested Arrays,
2757
- // e.g. <template>, <slot>, v-for, or when the children is provided by user
2758
- // with hand-written render functions / JSX. In such cases a full normalization
2759
- // is needed to cater to all possible types of children values.
2760
- function normalizeChildren (children) {
2761
- return isPrimitive(children)
2762
- ? [createTextVNode(children)]
2763
- : Array.isArray(children)
2764
- ? normalizeArrayChildren(children)
2765
- : undefined
2766
- }
2767
-
2768
- function isTextNode (node) {
2769
- return isDef(node) && isDef(node.text) && isFalse(node.isComment)
2770
- }
2771
-
2772
- function normalizeArrayChildren (children, nestedIndex) {
2773
- var res = [];
2774
- var i, c, lastIndex, last;
2775
- for (i = 0; i < children.length; i++) {
2776
- c = children[i];
2777
- if (isUndef(c) || typeof c === 'boolean') { continue }
2778
- lastIndex = res.length - 1;
2779
- last = res[lastIndex];
2780
- // nested
2781
- if (Array.isArray(c)) {
2782
- if (c.length > 0) {
2783
- c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
2784
- // merge adjacent text nodes
2785
- if (isTextNode(c[0]) && isTextNode(last)) {
2786
- res[lastIndex] = createTextVNode(last.text + (c[0]).text);
2787
- c.shift();
2788
- }
2789
- res.push.apply(res, c);
2790
- }
2791
- } else if (isPrimitive(c)) {
2792
- if (isTextNode(last)) {
2793
- // merge adjacent text nodes
2794
- // this is necessary for SSR hydration because text nodes are
2795
- // essentially merged when rendered to HTML strings
2796
- res[lastIndex] = createTextVNode(last.text + c);
2797
- } else if (c !== '') {
2798
- // convert primitive to vnode
2799
- res.push(createTextVNode(c));
2800
- }
2801
- } else {
2802
- if (isTextNode(c) && isTextNode(last)) {
2803
- // merge adjacent text nodes
2804
- res[lastIndex] = createTextVNode(last.text + c.text);
2805
- } else {
2806
- // default key for nested array children (likely generated by v-for)
2807
- if (isTrue(children._isVList) &&
2808
- isDef(c.tag) &&
2809
- isUndef(c.key) &&
2810
- isDef(nestedIndex)) {
2811
- c.key = "__vlist" + nestedIndex + "_" + i + "__";
2812
- }
2813
- res.push(c);
2814
- }
2815
- }
2816
- }
2817
- return res
2818
- }
2819
-
2820
- /* */
2821
-
2822
- function initProvide (vm) {
2823
- var provide = vm.$options.provide;
2824
- if (provide) {
2825
- vm._provided = typeof provide === 'function'
2826
- ? provide.call(vm)
2827
- : provide;
2828
- }
2829
- }
2830
-
2831
- function initInjections (vm) {
2832
- var result = resolveInject(vm.$options.inject, vm);
2833
- if (result) {
2834
- toggleObserving(false);
2835
- Object.keys(result).forEach(function (key) {
2836
- /* istanbul ignore else */
2837
- if (process.env.NODE_ENV !== 'production') {
2838
- defineReactive$1(vm, key, result[key], function () {
2839
- warn(
2840
- "Avoid mutating an injected value directly since the changes will be " +
2841
- "overwritten whenever the provided component re-renders. " +
2842
- "injection being mutated: \"" + key + "\"",
2843
- vm
2844
- );
2845
- });
2846
- } else {
2847
- defineReactive$1(vm, key, result[key]);
2848
- }
2849
- });
2850
- toggleObserving(true);
2851
- }
2852
- }
2853
-
2854
- function resolveInject (inject, vm) {
2855
- if (inject) {
2856
- // inject is :any because flow is not smart enough to figure out cached
2857
- var result = Object.create(null);
2858
- var keys = hasSymbol
2859
- ? Reflect.ownKeys(inject)
2860
- : Object.keys(inject);
2861
-
2862
- for (var i = 0; i < keys.length; i++) {
2863
- var key = keys[i];
2864
- // #6574 in case the inject object is observed...
2865
- if (key === '__ob__') { continue }
2866
- var provideKey = inject[key].from;
2867
- var source = vm;
2868
- while (source) {
2869
- if (source._provided && hasOwn(source._provided, provideKey)) {
2870
- result[key] = source._provided[provideKey];
2871
- break
2872
- }
2873
- source = source.$parent;
2874
- }
2875
- if (!source) {
2876
- if ('default' in inject[key]) {
2877
- var provideDefault = inject[key].default;
2878
- result[key] = typeof provideDefault === 'function'
2879
- ? provideDefault.call(vm)
2880
- : provideDefault;
2881
- } else if (process.env.NODE_ENV !== 'production') {
2882
- warn(("Injection \"" + key + "\" not found"), vm);
2883
- }
2884
- }
2885
- }
2886
- return result
2887
- }
2888
- }
2889
-
2890
- /* */
2891
-
2892
-
2893
-
2894
- /**
2895
- * Runtime helper for resolving raw children VNodes into a slot object.
2896
- */
2897
- function resolveSlots (
2898
- children,
2899
- context
2900
- ) {
2901
- if (!children || !children.length) {
2902
- return {}
2903
- }
2904
- var slots = {};
2905
- for (var i = 0, l = children.length; i < l; i++) {
2906
- var child = children[i];
2907
- var data = child.data;
2908
- // remove slot attribute if the node is resolved as a Vue slot node
2909
- if (data && data.attrs && data.attrs.slot) {
2910
- delete data.attrs.slot;
2911
- }
2912
- // named slots should only be respected if the vnode was rendered in the
2913
- // same context.
2914
- if ((child.context === context || child.fnContext === context) &&
2915
- data && data.slot != null
2916
- ) {
2917
- var name = data.slot;
2918
- var slot = (slots[name] || (slots[name] = []));
2919
- if (child.tag === 'template') {
2920
- slot.push.apply(slot, child.children || []);
2921