Guest User

Untitled

a guest
Aug 26th, 2016
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. module.exports = require('./lib/axios');
  3. },{"./lib/axios":3}],2:[function(require,module,exports){
  4. (function (process){
  5. 'use strict';
  6.  
  7. var utils = require('./../utils');
  8. var settle = require('./../core/settle');
  9. var buildURL = require('./../helpers/buildURL');
  10. var parseHeaders = require('./../helpers/parseHeaders');
  11. var isURLSameOrigin = require('./../helpers/isURLSameOrigin');
  12. var createError = require('../core/createError');
  13. var btoa = (typeof window !== 'undefined' && window.btoa) || require('./../helpers/btoa');
  14.  
  15. module.exports = function xhrAdapter(config) {
  16.   return new Promise(function dispatchXhrRequest(resolve, reject) {
  17.     var requestData = config.data;
  18.     var requestHeaders = config.headers;
  19.  
  20.     if (utils.isFormData(requestData)) {
  21.       delete requestHeaders['Content-Type']; // Let the browser set it
  22.     }
  23.  
  24.     var request = new XMLHttpRequest();
  25.     var loadEvent = 'onreadystatechange';
  26.     var xDomain = false;
  27.  
  28.     // For IE 8/9 CORS support
  29.     // Only supports POST and GET calls and doesn't returns the response headers.
  30.     // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  31.     if (process.env.NODE_ENV !== 'test' &&
  32.         typeof window !== 'undefined' &&
  33.         window.XDomainRequest && !('withCredentials' in request) &&
  34.         !isURLSameOrigin(config.url)) {
  35.       request = new window.XDomainRequest();
  36.       loadEvent = 'onload';
  37.       xDomain = true;
  38.       request.onprogress = function handleProgress() {};
  39.       request.ontimeout = function handleTimeout() {};
  40.     }
  41.  
  42.     // HTTP basic authentication
  43.     if (config.auth) {
  44.       var username = config.auth.username || '';
  45.       var password = config.auth.password || '';
  46.       requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  47.     }
  48.  
  49.     request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  50.  
  51.     // Set the request timeout in MS
  52.     request.timeout = config.timeout;
  53.  
  54.     // Listen for ready state
  55.     request[loadEvent] = function handleLoad() {
  56.       if (!request || (request.readyState !== 4 && !xDomain)) {
  57.         return;
  58.       }
  59.  
  60.       // The request errored out and we didn't get a response, this will be
  61.       // handled by onerror instead
  62.       if (request.status === 0) {
  63.         return;
  64.       }
  65.  
  66.       // Prepare the response
  67.       var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  68.       var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  69.       var response = {
  70.         data: responseData,
  71.         // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  72.         status: request.status === 1223 ? 204 : request.status,
  73.         statusText: request.status === 1223 ? 'No Content' : request.statusText,
  74.         headers: responseHeaders,
  75.         config: config,
  76.         request: request
  77.       };
  78.  
  79.       settle(resolve, reject, response);
  80.  
  81.       // Clean up request
  82.       request = null;
  83.     };
  84.  
  85.     // Handle low level network errors
  86.     request.onerror = function handleError() {
  87.       // Real errors are hidden from us by the browser
  88.       // onerror should only fire if it's a network error
  89.       reject(createError('Network Error', config));
  90.  
  91.       // Clean up request
  92.       request = null;
  93.     };
  94.  
  95.     // Handle timeout
  96.     request.ontimeout = function handleTimeout() {
  97.       reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
  98.  
  99.       // Clean up request
  100.       request = null;
  101.     };
  102.  
  103.     // Add xsrf header
  104.     // This is only done if running in a standard browser environment.
  105.     // Specifically not if we're in a web worker, or react-native.
  106.     if (utils.isStandardBrowserEnv()) {
  107.       var cookies = require('./../helpers/cookies');
  108.  
  109.       // Add xsrf header
  110.       var xsrfValue = config.withCredentials || isURLSameOrigin(config.url) ?
  111.           cookies.read(config.xsrfCookieName) :
  112.           undefined;
  113.  
  114.       if (xsrfValue) {
  115.         requestHeaders[config.xsrfHeaderName] = xsrfValue;
  116.       }
  117.     }
  118.  
  119.     // Add headers to the request
  120.     if ('setRequestHeader' in request) {
  121.       utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  122.         if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  123.           // Remove Content-Type if data is undefined
  124.           delete requestHeaders[key];
  125.         } else {
  126.           // Otherwise add header to the request
  127.           request.setRequestHeader(key, val);
  128.         }
  129.       });
  130.     }
  131.  
  132.     // Add withCredentials to request if needed
  133.     if (config.withCredentials) {
  134.       request.withCredentials = true;
  135.     }
  136.  
  137.     // Add responseType to request if needed
  138.     if (config.responseType) {
  139.       try {
  140.         request.responseType = config.responseType;
  141.       } catch (e) {
  142.         if (request.responseType !== 'json') {
  143.           throw e;
  144.         }
  145.       }
  146.     }
  147.  
  148.     // Handle progress if needed
  149.     if (typeof config.progress === 'function') {
  150.       if (config.method === 'post' || config.method === 'put') {
  151.         request.upload.addEventListener('progress', config.progress);
  152.       } else if (config.method === 'get') {
  153.         request.addEventListener('progress', config.progress);
  154.       }
  155.     }
  156.  
  157.     if (requestData === undefined) {
  158.       requestData = null;
  159.     }
  160.  
  161.     // Send the request
  162.     request.send(requestData);
  163.   });
  164. };
  165.  
  166. }).call(this,require('_process'))
  167. },{"../core/createError":6,"./../core/settle":9,"./../helpers/btoa":13,"./../helpers/buildURL":14,"./../helpers/cookies":16,"./../helpers/isURLSameOrigin":18,"./../helpers/parseHeaders":20,"./../utils":22,"_process":23}],3:[function(require,module,exports){
  168. 'use strict';
  169.  
  170. var utils = require('./utils');
  171. var bind = require('./helpers/bind');
  172. var Axios = require('./core/Axios');
  173.  
  174. /**
  175.  * Create an instance of Axios
  176.  *
  177.  * @param {Object} defaultConfig The default config for the instance
  178.  * @return {Axios} A new instance of Axios
  179.  */
  180. function createInstance(defaultConfig) {
  181.   var context = new Axios(defaultConfig);
  182.   var instance = bind(Axios.prototype.request, context);
  183.  
  184.   // Copy axios.prototype to instance
  185.   utils.extend(instance, Axios.prototype, context);
  186.  
  187.   // Copy context to instance
  188.   utils.extend(instance, context);
  189.  
  190.   return instance;
  191. }
  192.  
  193. // Create the default instance to be exported
  194. var axios = module.exports = createInstance();
  195.  
  196. // Expose Axios class to allow class inheritance
  197. axios.Axios = Axios;
  198.  
  199. // Factory for creating new instances
  200. axios.create = function create(defaultConfig) {
  201.   return createInstance(defaultConfig);
  202. };
  203.  
  204. // Expose all/spread
  205. axios.all = function all(promises) {
  206.   return Promise.all(promises);
  207. };
  208. axios.spread = require('./helpers/spread');
  209.  
  210. },{"./core/Axios":4,"./helpers/bind":12,"./helpers/spread":21,"./utils":22}],4:[function(require,module,exports){
  211. 'use strict';
  212.  
  213. var defaults = require('./../defaults');
  214. var utils = require('./../utils');
  215. var InterceptorManager = require('./InterceptorManager');
  216. var dispatchRequest = require('./dispatchRequest');
  217. var isAbsoluteURL = require('./../helpers/isAbsoluteURL');
  218. var combineURLs = require('./../helpers/combineURLs');
  219.  
  220. /**
  221.  * Create a new instance of Axios
  222.  *
  223.  * @param {Object} defaultConfig The default config for the instance
  224.  */
  225. function Axios(defaultConfig) {
  226.   this.defaults = utils.merge(defaults, defaultConfig);
  227.   this.interceptors = {
  228.     request: new InterceptorManager(),
  229.     response: new InterceptorManager()
  230.   };
  231. }
  232.  
  233. /**
  234.  * Dispatch a request
  235.  *
  236.  * @param {Object} config The config specific for this request (merged with this.defaults)
  237.  */
  238. Axios.prototype.request = function request(config) {
  239.   /*eslint no-param-reassign:0*/
  240.   // Allow for axios('example/url'[, config]) a la fetch API
  241.   if (typeof config === 'string') {
  242.     config = utils.merge({
  243.       url: arguments[0]
  244.     }, arguments[1]);
  245.   }
  246.  
  247.   config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  248.  
  249.   // Support baseURL config
  250.   if (config.baseURL && !isAbsoluteURL(config.url)) {
  251.     config.url = combineURLs(config.baseURL, config.url);
  252.   }
  253.  
  254.   // Hook up interceptors middleware
  255.   var chain = [dispatchRequest, undefined];
  256.   var promise = Promise.resolve(config);
  257.  
  258.   this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  259.     chain.unshift(interceptor.fulfilled, interceptor.rejected);
  260.   });
  261.  
  262.   this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  263.     chain.push(interceptor.fulfilled, interceptor.rejected);
  264.   });
  265.  
  266.   while (chain.length) {
  267.     promise = promise.then(chain.shift(), chain.shift());
  268.   }
  269.  
  270.   return promise;
  271. };
  272.  
  273. // Provide aliases for supported request methods
  274. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  275.   /*eslint func-names:0*/
  276.   Axios.prototype[method] = function(url, config) {
  277.     return this.request(utils.merge(config || {}, {
  278.       method: method,
  279.       url: url
  280.     }));
  281.   };
  282. });
  283.  
  284. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  285.   /*eslint func-names:0*/
  286.   Axios.prototype[method] = function(url, data, config) {
  287.     return this.request(utils.merge(config || {}, {
  288.       method: method,
  289.       url: url,
  290.       data: data
  291.     }));
  292.   };
  293. });
  294.  
  295. module.exports = Axios;
  296.  
  297. },{"./../defaults":11,"./../helpers/combineURLs":15,"./../helpers/isAbsoluteURL":17,"./../utils":22,"./InterceptorManager":5,"./dispatchRequest":7}],5:[function(require,module,exports){
  298. 'use strict';
  299.  
  300. var utils = require('./../utils');
  301.  
  302. function InterceptorManager() {
  303.   this.handlers = [];
  304. }
  305.  
  306. /**
  307.  * Add a new interceptor to the stack
  308.  *
  309.  * @param {Function} fulfilled The function to handle `then` for a `Promise`
  310.  * @param {Function} rejected The function to handle `reject` for a `Promise`
  311.  *
  312.  * @return {Number} An ID used to remove interceptor later
  313.  */
  314. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  315.   this.handlers.push({
  316.     fulfilled: fulfilled,
  317.     rejected: rejected
  318.   });
  319.   return this.handlers.length - 1;
  320. };
  321.  
  322. /**
  323.  * Remove an interceptor from the stack
  324.  *
  325.  * @param {Number} id The ID that was returned by `use`
  326.  */
  327. InterceptorManager.prototype.eject = function eject(id) {
  328.   if (this.handlers[id]) {
  329.     this.handlers[id] = null;
  330.   }
  331. };
  332.  
  333. /**
  334.  * Iterate over all the registered interceptors
  335.  *
  336.  * This method is particularly useful for skipping over any
  337.  * interceptors that may have become `null` calling `eject`.
  338.  *
  339.  * @param {Function} fn The function to call for each interceptor
  340.  */
  341. InterceptorManager.prototype.forEach = function forEach(fn) {
  342.   utils.forEach(this.handlers, function forEachHandler(h) {
  343.     if (h !== null) {
  344.       fn(h);
  345.     }
  346.   });
  347. };
  348.  
  349. module.exports = InterceptorManager;
  350.  
  351. },{"./../utils":22}],6:[function(require,module,exports){
  352. 'use strict';
  353.  
  354. var enhanceError = require('./enhanceError');
  355.  
  356. /**
  357.  * Create an Error with the specified message, config, error code, and response.
  358.  *
  359.  * @param {string} message The error message.
  360.  * @param {Object} config The config.
  361.  * @param {string} [code] The error code (for example, 'ECONNABORTED').
  362.  @ @param {Object} [response] The response.
  363.  * @returns {Error} The created error.
  364.  */
  365. module.exports = function createError(message, config, code, response) {
  366.   var error = new Error(message);
  367.   return enhanceError(error, config, code, response);
  368. };
  369.  
  370. },{"./enhanceError":8}],7:[function(require,module,exports){
  371. (function (process){
  372. 'use strict';
  373.  
  374. var utils = require('./../utils');
  375. var transformData = require('./transformData');
  376.  
  377. /**
  378.  * Dispatch a request to the server using whichever adapter
  379.  * is supported by the current environment.
  380.  *
  381.  * @param {object} config The config that is to be used for the request
  382.  * @returns {Promise} The Promise to be fulfilled
  383.  */
  384. module.exports = function dispatchRequest(config) {
  385.   // Ensure headers exist
  386.   config.headers = config.headers || {};
  387.  
  388.   // Transform request data
  389.   config.data = transformData(
  390.     config.data,
  391.     config.headers,
  392.     config.transformRequest
  393.   );
  394.  
  395.   // Flatten headers
  396.   config.headers = utils.merge(
  397.     config.headers.common || {},
  398.     config.headers[config.method] || {},
  399.     config.headers || {}
  400.   );
  401.  
  402.   utils.forEach(
  403.     ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  404.     function cleanHeaderConfig(method) {
  405.       delete config.headers[method];
  406.     }
  407.   );
  408.  
  409.   var adapter;
  410.  
  411.   if (typeof config.adapter === 'function') {
  412.     // For custom adapter support
  413.     adapter = config.adapter;
  414.   } else if (typeof XMLHttpRequest !== 'undefined') {
  415.     // For browsers use XHR adapter
  416.     adapter = require('../adapters/xhr');
  417.   } else if (typeof process !== 'undefined') {
  418.     // For node use HTTP adapter
  419.     adapter = require('../adapters/http');
  420.   }
  421.  
  422.   return Promise.resolve(config)
  423.     // Wrap synchronous adapter errors and pass configuration
  424.     .then(adapter)
  425.     .then(function onFulfilled(response) {
  426.       // Transform response data
  427.       response.data = transformData(
  428.         response.data,
  429.         response.headers,
  430.         config.transformResponse
  431.       );
  432.  
  433.       return response;
  434.     }, function onRejected(error) {
  435.       // Transform response data
  436.       if (error && error.response) {
  437.         error.response.data = transformData(
  438.           error.response.data,
  439.           error.response.headers,
  440.           config.transformResponse
  441.         );
  442.       }
  443.  
  444.       return Promise.reject(error);
  445.     });
  446. };
  447.  
  448. }).call(this,require('_process'))
  449. },{"../adapters/http":2,"../adapters/xhr":2,"./../utils":22,"./transformData":10,"_process":23}],8:[function(require,module,exports){
  450. 'use strict';
  451.  
  452. /**
  453.  * Update an Error with the specified config, error code, and response.
  454.  *
  455.  * @param {Error} error The error to update.
  456.  * @param {Object} config The config.
  457.  * @param {string} [code] The error code (for example, 'ECONNABORTED').
  458.  @ @param {Object} [response] The response.
  459.  * @returns {Error} The error.
  460.  */
  461. module.exports = function enhanceError(error, config, code, response) {
  462.   error.config = config;
  463.   if (code) {
  464.     error.code = code;
  465.   }
  466.   error.response = response;
  467.   return error;
  468. };
  469.  
  470. },{}],9:[function(require,module,exports){
  471. 'use strict';
  472.  
  473. var createError = require('./createError');
  474.  
  475. /**
  476.  * Resolve or reject a Promise based on response status.
  477.  *
  478.  * @param {Function} resolve A function that resolves the promise.
  479.  * @param {Function} reject A function that rejects the promise.
  480.  * @param {object} response The response.
  481.  */
  482. module.exports = function settle(resolve, reject, response) {
  483.   var validateStatus = response.config.validateStatus;
  484.   // Note: status is not exposed by XDomainRequest
  485.   if (!response.status || !validateStatus || validateStatus(response.status)) {
  486.     resolve(response);
  487.   } else {
  488.     reject(createError(
  489.       'Request failed with status code ' + response.status,
  490.       response.config,
  491.       null,
  492.       response
  493.     ));
  494.   }
  495. };
  496.  
  497. },{"./createError":6}],10:[function(require,module,exports){
  498. 'use strict';
  499.  
  500. var utils = require('./../utils');
  501.  
  502. /**
  503.  * Transform the data for a request or a response
  504.  *
  505.  * @param {Object|String} data The data to be transformed
  506.  * @param {Array} headers The headers for the request or response
  507.  * @param {Array|Function} fns A single function or Array of functions
  508.  * @returns {*} The resulting transformed data
  509.  */
  510. module.exports = function transformData(data, headers, fns) {
  511.   /*eslint no-param-reassign:0*/
  512.   utils.forEach(fns, function transform(fn) {
  513.     data = fn(data, headers);
  514.   });
  515.  
  516.   return data;
  517. };
  518.  
  519. },{"./../utils":22}],11:[function(require,module,exports){
  520. 'use strict';
  521.  
  522. var utils = require('./utils');
  523. var normalizeHeaderName = require('./helpers/normalizeHeaderName');
  524.  
  525. var PROTECTION_PREFIX = /^\)\]\}',?\n/;
  526. var DEFAULT_CONTENT_TYPE = {
  527.   'Content-Type': 'application/x-www-form-urlencoded'
  528. };
  529.  
  530. function setContentTypeIfUnset(headers, value) {
  531.   if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  532.     headers['Content-Type'] = value;
  533.   }
  534. }
  535.  
  536. module.exports = {
  537.   transformRequest: [function transformRequest(data, headers) {
  538.     normalizeHeaderName(headers, 'Content-Type');
  539.     if (utils.isFormData(data) ||
  540.       utils.isArrayBuffer(data) ||
  541.       utils.isStream(data) ||
  542.       utils.isFile(data) ||
  543.       utils.isBlob(data)
  544.     ) {
  545.       return data;
  546.     }
  547.     if (utils.isArrayBufferView(data)) {
  548.       return data.buffer;
  549.     }
  550.     if (utils.isURLSearchParams(data)) {
  551.       setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  552.       return data.toString();
  553.     }
  554.     if (utils.isObject(data)) {
  555.       setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  556.       return JSON.stringify(data);
  557.     }
  558.     return data;
  559.   }],
  560.  
  561.   transformResponse: [function transformResponse(data) {
  562.     /*eslint no-param-reassign:0*/
  563.     if (typeof data === 'string') {
  564.       data = data.replace(PROTECTION_PREFIX, '');
  565.       try {
  566.         data = JSON.parse(data);
  567.       } catch (e) { /* Ignore */ }
  568.     }
  569.     return data;
  570.   }],
  571.  
  572.   headers: {
  573.     common: {
  574.       'Accept': 'application/json, text/plain, */*'
  575.     },
  576.     patch: utils.merge(DEFAULT_CONTENT_TYPE),
  577.     post: utils.merge(DEFAULT_CONTENT_TYPE),
  578.     put: utils.merge(DEFAULT_CONTENT_TYPE)
  579.   },
  580.  
  581.   timeout: 0,
  582.  
  583.   xsrfCookieName: 'XSRF-TOKEN',
  584.   xsrfHeaderName: 'X-XSRF-TOKEN',
  585.  
  586.   maxContentLength: -1,
  587.  
  588.   validateStatus: function validateStatus(status) {
  589.     return status >= 200 && status < 300;
  590.   }
  591. };
  592.  
  593. },{"./helpers/normalizeHeaderName":19,"./utils":22}],12:[function(require,module,exports){
  594. 'use strict';
  595.  
  596. module.exports = function bind(fn, thisArg) {
  597.   return function wrap() {
  598.     var args = new Array(arguments.length);
  599.     for (var i = 0; i < args.length; i++) {
  600.       args[i] = arguments[i];
  601.     }
  602.     return fn.apply(thisArg, args);
  603.   };
  604. };
  605.  
  606. },{}],13:[function(require,module,exports){
  607. 'use strict';
  608.  
  609. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  610.  
  611. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  612.  
  613. function E() {
  614.   this.message = 'String contains an invalid character';
  615. }
  616. E.prototype = new Error;
  617. E.prototype.code = 5;
  618. E.prototype.name = 'InvalidCharacterError';
  619.  
  620. function btoa(input) {
  621.   var str = String(input);
  622.   var output = '';
  623.   for (
  624.     // initialize result and counter
  625.     var block, charCode, idx = 0, map = chars;
  626.     // if the next str index does not exist:
  627.     //   change the mapping table to "="
  628.     //   check if d has no fractional digits
  629.     str.charAt(idx | 0) || (map = '=', idx % 1);
  630.     // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  631.     output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  632.   ) {
  633.     charCode = str.charCodeAt(idx += 3 / 4);
  634.     if (charCode > 0xFF) {
  635.       throw new E();
  636.     }
  637.     block = block << 8 | charCode;
  638.   }
  639.   return output;
  640. }
  641.  
  642. module.exports = btoa;
  643.  
  644. },{}],14:[function(require,module,exports){
  645. 'use strict';
  646.  
  647. var utils = require('./../utils');
  648.  
  649. function encode(val) {
  650.   return encodeURIComponent(val).
  651.     replace(/%40/gi, '@').
  652.     replace(/%3A/gi, ':').
  653.     replace(/%24/g, '$').
  654.     replace(/%2C/gi, ',').
  655.     replace(/%20/g, '+').
  656.     replace(/%5B/gi, '[').
  657.     replace(/%5D/gi, ']');
  658. }
  659.  
  660. /**
  661.  * Build a URL by appending params to the end
  662.  *
  663.  * @param {string} url The base of the url (e.g., http://www.google.com)
  664.  * @param {object} [params] The params to be appended
  665.  * @returns {string} The formatted url
  666.  */
  667. module.exports = function buildURL(url, params, paramsSerializer) {
  668.   /*eslint no-param-reassign:0*/
  669.   if (!params) {
  670.     return url;
  671.   }
  672.  
  673.   var serializedParams;
  674.   if (paramsSerializer) {
  675.     serializedParams = paramsSerializer(params);
  676.   } else if (utils.isURLSearchParams(params)) {
  677.     serializedParams = params.toString();
  678.   } else {
  679.     var parts = [];
  680.  
  681.     utils.forEach(params, function serialize(val, key) {
  682.       if (val === null || typeof val === 'undefined') {
  683.         return;
  684.       }
  685.  
  686.       if (utils.isArray(val)) {
  687.         key = key + '[]';
  688.       }
  689.  
  690.       if (!utils.isArray(val)) {
  691.         val = [val];
  692.       }
  693.  
  694.       utils.forEach(val, function parseValue(v) {
  695.         if (utils.isDate(v)) {
  696.           v = v.toISOString();
  697.         } else if (utils.isObject(v)) {
  698.           v = JSON.stringify(v);
  699.         }
  700.         parts.push(encode(key) + '=' + encode(v));
  701.       });
  702.     });
  703.  
  704.     serializedParams = parts.join('&');
  705.   }
  706.  
  707.   if (serializedParams) {
  708.     url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  709.   }
  710.  
  711.   return url;
  712. };
  713.  
  714. },{"./../utils":22}],15:[function(require,module,exports){
  715. 'use strict';
  716.  
  717. /**
  718.  * Creates a new URL by combining the specified URLs
  719.  *
  720.  * @param {string} baseURL The base URL
  721.  * @param {string} relativeURL The relative URL
  722.  * @returns {string} The combined URL
  723.  */
  724. module.exports = function combineURLs(baseURL, relativeURL) {
  725.   return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
  726. };
  727.  
  728. },{}],16:[function(require,module,exports){
  729. 'use strict';
  730.  
  731. var utils = require('./../utils');
  732.  
  733. module.exports = (
  734.   utils.isStandardBrowserEnv() ?
  735.  
  736.   // Standard browser envs support document.cookie
  737.   (function standardBrowserEnv() {
  738.     return {
  739.       write: function write(name, value, expires, path, domain, secure) {
  740.         var cookie = [];
  741.         cookie.push(name + '=' + encodeURIComponent(value));
  742.  
  743.         if (utils.isNumber(expires)) {
  744.           cookie.push('expires=' + new Date(expires).toGMTString());
  745.         }
  746.  
  747.         if (utils.isString(path)) {
  748.           cookie.push('path=' + path);
  749.         }
  750.  
  751.         if (utils.isString(domain)) {
  752.           cookie.push('domain=' + domain);
  753.         }
  754.  
  755.         if (secure === true) {
  756.           cookie.push('secure');
  757.         }
  758.  
  759.         document.cookie = cookie.join('; ');
  760.       },
  761.  
  762.       read: function read(name) {
  763.         var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  764.         return (match ? decodeURIComponent(match[3]) : null);
  765.       },
  766.  
  767.       remove: function remove(name) {
  768.         this.write(name, '', Date.now() - 86400000);
  769.       }
  770.     };
  771.   })() :
  772.  
  773.   // Non standard browser env (web workers, react-native) lack needed support.
  774.   (function nonStandardBrowserEnv() {
  775.     return {
  776.       write: function write() {},
  777.       read: function read() { return null; },
  778.       remove: function remove() {}
  779.     };
  780.   })()
  781. );
  782.  
  783. },{"./../utils":22}],17:[function(require,module,exports){
  784. 'use strict';
  785.  
  786. /**
  787.  * Determines whether the specified URL is absolute
  788.  *
  789.  * @param {string} url The URL to test
  790.  * @returns {boolean} True if the specified URL is absolute, otherwise false
  791.  */
  792. module.exports = function isAbsoluteURL(url) {
  793.   // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  794.   // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  795.   // by any combination of letters, digits, plus, period, or hyphen.
  796.   return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  797. };
  798.  
  799. },{}],18:[function(require,module,exports){
  800. 'use strict';
  801.  
  802. var utils = require('./../utils');
  803.  
  804. module.exports = (
  805.   utils.isStandardBrowserEnv() ?
  806.  
  807.   // Standard browser envs have full support of the APIs needed to test
  808.   // whether the request URL is of the same origin as current location.
  809.   (function standardBrowserEnv() {
  810.     var msie = /(msie|trident)/i.test(navigator.userAgent);
  811.     var urlParsingNode = document.createElement('a');
  812.     var originURL;
  813.  
  814.     /**
  815.     * Parse a URL to discover it's components
  816.     *
  817.     * @param {String} url The URL to be parsed
  818.     * @returns {Object}
  819.     */
  820.     function resolveURL(url) {
  821.       var href = url;
  822.  
  823.       if (msie) {
  824.         // IE needs attribute set twice to normalize properties
  825.         urlParsingNode.setAttribute('href', href);
  826.         href = urlParsingNode.href;
  827.       }
  828.  
  829.       urlParsingNode.setAttribute('href', href);
  830.  
  831.       // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  832.       return {
  833.         href: urlParsingNode.href,
  834.         protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  835.         host: urlParsingNode.host,
  836.         search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  837.         hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  838.         hostname: urlParsingNode.hostname,
  839.         port: urlParsingNode.port,
  840.         pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  841.                   urlParsingNode.pathname :
  842.                   '/' + urlParsingNode.pathname
  843.       };
  844.     }
  845.  
  846.     originURL = resolveURL(window.location.href);
  847.  
  848.     /**
  849.     * Determine if a URL shares the same origin as the current location
  850.     *
  851.     * @param {String} requestURL The URL to test
  852.     * @returns {boolean} True if URL shares the same origin, otherwise false
  853.     */
  854.     return function isURLSameOrigin(requestURL) {
  855.       var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  856.       return (parsed.protocol === originURL.protocol &&
  857.             parsed.host === originURL.host);
  858.     };
  859.   })() :
  860.  
  861.   // Non standard browser envs (web workers, react-native) lack needed support.
  862.   (function nonStandardBrowserEnv() {
  863.     return function isURLSameOrigin() {
  864.       return true;
  865.     };
  866.   })()
  867. );
  868.  
  869. },{"./../utils":22}],19:[function(require,module,exports){
  870. 'use strict';
  871.  
  872. var utils = require('../utils');
  873.  
  874. module.exports = function normalizeHeaderName(headers, normalizedName) {
  875.   utils.forEach(headers, function processHeader(value, name) {
  876.     if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  877.       headers[normalizedName] = value;
  878.       delete headers[name];
  879.     }
  880.   });
  881. };
  882.  
  883. },{"../utils":22}],20:[function(require,module,exports){
  884. 'use strict';
  885.  
  886. var utils = require('./../utils');
  887.  
  888. /**
  889.  * Parse headers into an object
  890.  *
  891.  * ```
  892.  * Date: Wed, 27 Aug 2014 08:58:49 GMT
  893.  * Content-Type: application/json
  894.  * Connection: keep-alive
  895.  * Transfer-Encoding: chunked
  896.  * ```
  897.  *
  898.  * @param {String} headers Headers needing to be parsed
  899.  * @returns {Object} Headers parsed into an object
  900.  */
  901. module.exports = function parseHeaders(headers) {
  902.   var parsed = {};
  903.   var key;
  904.   var val;
  905.   var i;
  906.  
  907.   if (!headers) { return parsed; }
  908.  
  909.   utils.forEach(headers.split('\n'), function parser(line) {
  910.     i = line.indexOf(':');
  911.     key = utils.trim(line.substr(0, i)).toLowerCase();
  912.     val = utils.trim(line.substr(i + 1));
  913.  
  914.     if (key) {
  915.       parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  916.     }
  917.   });
  918.  
  919.   return parsed;
  920. };
  921.  
  922. },{"./../utils":22}],21:[function(require,module,exports){
  923. 'use strict';
  924.  
  925. /**
  926.  * Syntactic sugar for invoking a function and expanding an array for arguments.
  927.  *
  928.  * Common use case would be to use `Function.prototype.apply`.
  929.  *
  930.  *  ```js
  931.  *  function f(x, y, z) {}
  932.  *  var args = [1, 2, 3];
  933.  *  f.apply(null, args);
  934.  *  ```
  935.  *
  936.  * With `spread` this example can be re-written.
  937.  *
  938.  *  ```js
  939.  *  spread(function(x, y, z) {})([1, 2, 3]);
  940.  *  ```
  941.  *
  942.  * @param {Function} callback
  943.  * @returns {Function}
  944.  */
  945. module.exports = function spread(callback) {
  946.   return function wrap(arr) {
  947.     return callback.apply(null, arr);
  948.   };
  949. };
  950.  
  951. },{}],22:[function(require,module,exports){
  952. 'use strict';
  953.  
  954. var bind = require('./helpers/bind');
  955.  
  956. /*global toString:true*/
  957.  
  958. // utils is a library of generic helper functions non-specific to axios
  959.  
  960. var toString = Object.prototype.toString;
  961.  
  962. /**
  963.  * Determine if a value is an Array
  964.  *
  965.  * @param {Object} val The value to test
  966.  * @returns {boolean} True if value is an Array, otherwise false
  967.  */
  968. function isArray(val) {
  969.   return toString.call(val) === '[object Array]';
  970. }
  971.  
  972. /**
  973.  * Determine if a value is an ArrayBuffer
  974.  *
  975.  * @param {Object} val The value to test
  976.  * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  977.  */
  978. function isArrayBuffer(val) {
  979.   return toString.call(val) === '[object ArrayBuffer]';
  980. }
  981.  
  982. /**
  983.  * Determine if a value is a FormData
  984.  *
  985.  * @param {Object} val The value to test
  986.  * @returns {boolean} True if value is an FormData, otherwise false
  987.  */
  988. function isFormData(val) {
  989.   return (typeof FormData !== 'undefined') && (val instanceof FormData);
  990. }
  991.  
  992. /**
  993.  * Determine if a value is a view on an ArrayBuffer
  994.  *
  995.  * @param {Object} val The value to test
  996.  * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  997.  */
  998. function isArrayBufferView(val) {
  999.   var result;
  1000.   if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  1001.     result = ArrayBuffer.isView(val);
  1002.   } else {
  1003.     result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  1004.   }
  1005.   return result;
  1006. }
  1007.  
  1008. /**
  1009.  * Determine if a value is a String
  1010.  *
  1011.  * @param {Object} val The value to test
  1012.  * @returns {boolean} True if value is a String, otherwise false
  1013.  */
  1014. function isString(val) {
  1015.   return typeof val === 'string';
  1016. }
  1017.  
  1018. /**
  1019.  * Determine if a value is a Number
  1020.  *
  1021.  * @param {Object} val The value to test
  1022.  * @returns {boolean} True if value is a Number, otherwise false
  1023.  */
  1024. function isNumber(val) {
  1025.   return typeof val === 'number';
  1026. }
  1027.  
  1028. /**
  1029.  * Determine if a value is undefined
  1030.  *
  1031.  * @param {Object} val The value to test
  1032.  * @returns {boolean} True if the value is undefined, otherwise false
  1033.  */
  1034. function isUndefined(val) {
  1035.   return typeof val === 'undefined';
  1036. }
  1037.  
  1038. /**
  1039.  * Determine if a value is an Object
  1040.  *
  1041.  * @param {Object} val The value to test
  1042.  * @returns {boolean} True if value is an Object, otherwise false
  1043.  */
  1044. function isObject(val) {
  1045.   return val !== null && typeof val === 'object';
  1046. }
  1047.  
  1048. /**
  1049.  * Determine if a value is a Date
  1050.  *
  1051.  * @param {Object} val The value to test
  1052.  * @returns {boolean} True if value is a Date, otherwise false
  1053.  */
  1054. function isDate(val) {
  1055.   return toString.call(val) === '[object Date]';
  1056. }
  1057.  
  1058. /**
  1059.  * Determine if a value is a File
  1060.  *
  1061.  * @param {Object} val The value to test
  1062.  * @returns {boolean} True if value is a File, otherwise false
  1063.  */
  1064. function isFile(val) {
  1065.   return toString.call(val) === '[object File]';
  1066. }
  1067.  
  1068. /**
  1069.  * Determine if a value is a Blob
  1070.  *
  1071.  * @param {Object} val The value to test
  1072.  * @returns {boolean} True if value is a Blob, otherwise false
  1073.  */
  1074. function isBlob(val) {
  1075.   return toString.call(val) === '[object Blob]';
  1076. }
  1077.  
  1078. /**
  1079.  * Determine if a value is a Function
  1080.  *
  1081.  * @param {Object} val The value to test
  1082.  * @returns {boolean} True if value is a Function, otherwise false
  1083.  */
  1084. function isFunction(val) {
  1085.   return toString.call(val) === '[object Function]';
  1086. }
  1087.  
  1088. /**
  1089.  * Determine if a value is a Stream
  1090.  *
  1091.  * @param {Object} val The value to test
  1092.  * @returns {boolean} True if value is a Stream, otherwise false
  1093.  */
  1094. function isStream(val) {
  1095.   return isObject(val) && isFunction(val.pipe);
  1096. }
  1097.  
  1098. /**
  1099.  * Determine if a value is a URLSearchParams object
  1100.  *
  1101.  * @param {Object} val The value to test
  1102.  * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  1103.  */
  1104. function isURLSearchParams(val) {
  1105.   return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  1106. }
  1107.  
  1108. /**
  1109.  * Trim excess whitespace off the beginning and end of a string
  1110.  *
  1111.  * @param {String} str The String to trim
  1112.  * @returns {String} The String freed of excess whitespace
  1113.  */
  1114. function trim(str) {
  1115.   return str.replace(/^\s*/, '').replace(/\s*$/, '');
  1116. }
  1117.  
  1118. /**
  1119.  * Determine if we're running in a standard browser environment
  1120.  *
  1121.  * This allows axios to run in a web worker, and react-native.
  1122.  * Both environments support XMLHttpRequest, but not fully standard globals.
  1123.  *
  1124.  * web workers:
  1125.  *  typeof window -> undefined
  1126.  *  typeof document -> undefined
  1127.  *
  1128.  * react-native:
  1129.  *  typeof document.createElement -> undefined
  1130.  */
  1131. function isStandardBrowserEnv() {
  1132.   return (
  1133.     typeof window !== 'undefined' &&
  1134.     typeof document !== 'undefined' &&
  1135.     typeof document.createElement === 'function'
  1136.   );
  1137. }
  1138.  
  1139. /**
  1140.  * Iterate over an Array or an Object invoking a function for each item.
  1141.  *
  1142.  * If `obj` is an Array callback will be called passing
  1143.  * the value, index, and complete array for each item.
  1144.  *
  1145.  * If 'obj' is an Object callback will be called passing
  1146.  * the value, key, and complete object for each property.
  1147.  *
  1148.  * @param {Object|Array} obj The object to iterate
  1149.  * @param {Function} fn The callback to invoke for each item
  1150.  */
  1151. function forEach(obj, fn) {
  1152.   // Don't bother if no value provided
  1153.   if (obj === null || typeof obj === 'undefined') {
  1154.     return;
  1155.   }
  1156.  
  1157.   // Force an array if not already something iterable
  1158.   if (typeof obj !== 'object' && !isArray(obj)) {
  1159.     /*eslint no-param-reassign:0*/
  1160.     obj = [obj];
  1161.   }
  1162.  
  1163.   if (isArray(obj)) {
  1164.     // Iterate over array values
  1165.     for (var i = 0, l = obj.length; i < l; i++) {
  1166.       fn.call(null, obj[i], i, obj);
  1167.     }
  1168.   } else {
  1169.     // Iterate over object keys
  1170.     for (var key in obj) {
  1171.       if (obj.hasOwnProperty(key)) {
  1172.         fn.call(null, obj[key], key, obj);
  1173.       }
  1174.     }
  1175.   }
  1176. }
  1177.  
  1178. /**
  1179.  * Accepts varargs expecting each argument to be an object, then
  1180.  * immutably merges the properties of each object and returns result.
  1181.  *
  1182.  * When multiple objects contain the same key the later object in
  1183.  * the arguments list will take precedence.
  1184.  *
  1185.  * Example:
  1186.  *
  1187.  * ```js
  1188.  * var result = merge({foo: 123}, {foo: 456});
  1189.  * console.log(result.foo); // outputs 456
  1190.  * ```
  1191.  *
  1192.  * @param {Object} obj1 Object to merge
  1193.  * @returns {Object} Result of all merge properties
  1194.  */
  1195. function merge(/* obj1, obj2, obj3, ... */) {
  1196.   var result = {};
  1197.   function assignValue(val, key) {
  1198.     if (typeof result[key] === 'object' && typeof val === 'object') {
  1199.       result[key] = merge(result[key], val);
  1200.     } else {
  1201.       result[key] = val;
  1202.     }
  1203.   }
  1204.  
  1205.   for (var i = 0, l = arguments.length; i < l; i++) {
  1206.     forEach(arguments[i], assignValue);
  1207.   }
  1208.   return result;
  1209. }
  1210.  
  1211. /**
  1212.  * Extends object a by mutably adding to it the properties of object b.
  1213.  *
  1214.  * @param {Object} a The object to be extended
  1215.  * @param {Object} b The object to copy properties from
  1216.  * @param {Object} thisArg The object to bind function to
  1217.  * @return {Object} The resulting value of object a
  1218.  */
  1219. function extend(a, b, thisArg) {
  1220.   forEach(b, function assignValue(val, key) {
  1221.     if (thisArg && typeof val === 'function') {
  1222.       a[key] = bind(val, thisArg);
  1223.     } else {
  1224.       a[key] = val;
  1225.     }
  1226.   });
  1227.   return a;
  1228. }
  1229.  
  1230. module.exports = {
  1231.   isArray: isArray,
  1232.   isArrayBuffer: isArrayBuffer,
  1233.   isFormData: isFormData,
  1234.   isArrayBufferView: isArrayBufferView,
  1235.   isString: isString,
  1236.   isNumber: isNumber,
  1237.   isObject: isObject,
  1238.   isUndefined: isUndefined,
  1239.   isDate: isDate,
  1240.   isFile: isFile,
  1241.   isBlob: isBlob,
  1242.   isFunction: isFunction,
  1243.   isStream: isStream,
  1244.   isURLSearchParams: isURLSearchParams,
  1245.   isStandardBrowserEnv: isStandardBrowserEnv,
  1246.   forEach: forEach,
  1247.   merge: merge,
  1248.   extend: extend,
  1249.   trim: trim
  1250. };
  1251.  
  1252. },{"./helpers/bind":12}],23:[function(require,module,exports){
  1253. // shim for using process in browser
  1254.  
  1255. var process = module.exports = {};
  1256.  
  1257. // cached from whatever global is present so that test runners that stub it
  1258. // don't break things.  But we need to wrap it in a try catch in case it is
  1259. // wrapped in strict mode code which doesn't define any globals.  It's inside a
  1260. // function because try/catches deoptimize in certain engines.
  1261.  
  1262. var cachedSetTimeout;
  1263. var cachedClearTimeout;
  1264.  
  1265. (function () {
  1266.   try {
  1267.     cachedSetTimeout = setTimeout;
  1268.   } catch (e) {
  1269.     cachedSetTimeout = function () {
  1270.       throw new Error('setTimeout is not defined');
  1271.     }
  1272.   }
  1273.   try {
  1274.     cachedClearTimeout = clearTimeout;
  1275.   } catch (e) {
  1276.     cachedClearTimeout = function () {
  1277.       throw new Error('clearTimeout is not defined');
  1278.     }
  1279.   }
  1280. } ())
  1281. var queue = [];
  1282. var draining = false;
  1283. var currentQueue;
  1284. var queueIndex = -1;
  1285.  
  1286. function cleanUpNextTick() {
  1287.     if (!draining || !currentQueue) {
  1288.         return;
  1289.     }
  1290.     draining = false;
  1291.     if (currentQueue.length) {
  1292.         queue = currentQueue.concat(queue);
  1293.     } else {
  1294.         queueIndex = -1;
  1295.     }
  1296.     if (queue.length) {
  1297.         drainQueue();
  1298.     }
  1299. }
  1300.  
  1301. function drainQueue() {
  1302.     if (draining) {
  1303.         return;
  1304.     }
  1305.     var timeout = cachedSetTimeout(cleanUpNextTick);
  1306.     draining = true;
  1307.  
  1308.     var len = queue.length;
  1309.     while(len) {
  1310.         currentQueue = queue;
  1311.         queue = [];
  1312.         while (++queueIndex < len) {
  1313.             if (currentQueue) {
  1314.                 currentQueue[queueIndex].run();
  1315.             }
  1316.         }
  1317.         queueIndex = -1;
  1318.         len = queue.length;
  1319.     }
  1320.     currentQueue = null;
  1321.     draining = false;
  1322.     cachedClearTimeout(timeout);
  1323. }
  1324.  
  1325. process.nextTick = function (fun) {
  1326.     var args = new Array(arguments.length - 1);
  1327.     if (arguments.length > 1) {
  1328.         for (var i = 1; i < arguments.length; i++) {
  1329.             args[i - 1] = arguments[i];
  1330.         }
  1331.     }
  1332.     queue.push(new Item(fun, args));
  1333.     if (queue.length === 1 && !draining) {
  1334.         cachedSetTimeout(drainQueue, 0);
  1335.     }
  1336. };
  1337.  
  1338. // v8 likes predictible objects
  1339. function Item(fun, array) {
  1340.     this.fun = fun;
  1341.     this.array = array;
  1342. }
  1343. Item.prototype.run = function () {
  1344.     this.fun.apply(null, this.array);
  1345. };
  1346. process.title = 'browser';
  1347. process.browser = true;
  1348. process.env = {};
  1349. process.argv = [];
  1350. process.version = ''; // empty string to avoid regexp issues
  1351. process.versions = {};
  1352.  
  1353. function noop() {}
  1354.  
  1355. process.on = noop;
  1356. process.addListener = noop;
  1357. process.once = noop;
  1358. process.off = noop;
  1359. process.removeListener = noop;
  1360. process.removeAllListeners = noop;
  1361. process.emit = noop;
  1362.  
  1363. process.binding = function (name) {
  1364.     throw new Error('process.binding is not supported');
  1365. };
  1366.  
  1367. process.cwd = function () { return '/' };
  1368. process.chdir = function (dir) {
  1369.     throw new Error('process.chdir is not supported');
  1370. };
  1371. process.umask = function() { return 0; };
  1372.  
  1373. },{}],24:[function(require,module,exports){
  1374. (function (process,global){
  1375. /*!
  1376.  * Vue.js v1.0.26
  1377.  * (c) 2016 Evan You
  1378.  * Released under the MIT License.
  1379.  */
  1380. 'use strict';
  1381.  
  1382. function set(obj, key, val) {
  1383.   if (hasOwn(obj, key)) {
  1384.     obj[key] = val;
  1385.     return;
  1386.   }
  1387.   if (obj._isVue) {
  1388.     set(obj._data, key, val);
  1389.     return;
  1390.   }
  1391.   var ob = obj.__ob__;
  1392.   if (!ob) {
  1393.     obj[key] = val;
  1394.     return;
  1395.   }
  1396.   ob.convert(key, val);
  1397.   ob.dep.notify();
  1398.   if (ob.vms) {
  1399.     var i = ob.vms.length;
  1400.     while (i--) {
  1401.       var vm = ob.vms[i];
  1402.       vm._proxy(key);
  1403.       vm._digest();
  1404.     }
  1405.   }
  1406.   return val;
  1407. }
  1408.  
  1409. /**
  1410.  * Delete a property and trigger change if necessary.
  1411.  *
  1412.  * @param {Object} obj
  1413.  * @param {String} key
  1414.  */
  1415.  
  1416. function del(obj, key) {
  1417.   if (!hasOwn(obj, key)) {
  1418.     return;
  1419.   }
  1420.   delete obj[key];
  1421.   var ob = obj.__ob__;
  1422.   if (!ob) {
  1423.     if (obj._isVue) {
  1424.       delete obj._data[key];
  1425.       obj._digest();
  1426.     }
  1427.     return;
  1428.   }
  1429.   ob.dep.notify();
  1430.   if (ob.vms) {
  1431.     var i = ob.vms.length;
  1432.     while (i--) {
  1433.       var vm = ob.vms[i];
  1434.       vm._unproxy(key);
  1435.       vm._digest();
  1436.     }
  1437.   }
  1438. }
  1439.  
  1440. var hasOwnProperty = Object.prototype.hasOwnProperty;
  1441. /**
  1442.  * Check whether the object has the property.
  1443.  *
  1444.  * @param {Object} obj
  1445.  * @param {String} key
  1446.  * @return {Boolean}
  1447.  */
  1448.  
  1449. function hasOwn(obj, key) {
  1450.   return hasOwnProperty.call(obj, key);
  1451. }
  1452.  
  1453. /**
  1454.  * Check if an expression is a literal value.
  1455.  *
  1456.  * @param {String} exp
  1457.  * @return {Boolean}
  1458.  */
  1459.  
  1460. var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/;
  1461.  
  1462. function isLiteral(exp) {
  1463.   return literalValueRE.test(exp);
  1464. }
  1465.  
  1466. /**
  1467.  * Check if a string starts with $ or _
  1468.  *
  1469.  * @param {String} str
  1470.  * @return {Boolean}
  1471.  */
  1472.  
  1473. function isReserved(str) {
  1474.   var c = (str + '').charCodeAt(0);
  1475.   return c === 0x24 || c === 0x5F;
  1476. }
  1477.  
  1478. /**
  1479.  * Guard text output, make sure undefined outputs
  1480.  * empty string
  1481.  *
  1482.  * @param {*} value
  1483.  * @return {String}
  1484.  */
  1485.  
  1486. function _toString(value) {
  1487.   return value == null ? '' : value.toString();
  1488. }
  1489.  
  1490. /**
  1491.  * Check and convert possible numeric strings to numbers
  1492.  * before setting back to data
  1493.  *
  1494.  * @param {*} value
  1495.  * @return {*|Number}
  1496.  */
  1497.  
  1498. function toNumber(value) {
  1499.   if (typeof value !== 'string') {
  1500.     return value;
  1501.   } else {
  1502.     var parsed = Number(value);
  1503.     return isNaN(parsed) ? value : parsed;
  1504.   }
  1505. }
  1506.  
  1507. /**
  1508.  * Convert string boolean literals into real booleans.
  1509.  *
  1510.  * @param {*} value
  1511.  * @return {*|Boolean}
  1512.  */
  1513.  
  1514. function toBoolean(value) {
  1515.   return value === 'true' ? true : value === 'false' ? false : value;
  1516. }
  1517.  
  1518. /**
  1519.  * Strip quotes from a string
  1520.  *
  1521.  * @param {String} str
  1522.  * @return {String | false}
  1523.  */
  1524.  
  1525. function stripQuotes(str) {
  1526.   var a = str.charCodeAt(0);
  1527.   var b = str.charCodeAt(str.length - 1);
  1528.   return a === b && (a === 0x22 || a === 0x27) ? str.slice(1, -1) : str;
  1529. }
  1530.  
  1531. /**
  1532.  * Camelize a hyphen-delmited string.
  1533.  *
  1534.  * @param {String} str
  1535.  * @return {String}
  1536.  */
  1537.  
  1538. var camelizeRE = /-(\w)/g;
  1539.  
  1540. function camelize(str) {
  1541.   return str.replace(camelizeRE, toUpper);
  1542. }
  1543.  
  1544. function toUpper(_, c) {
  1545.   return c ? c.toUpperCase() : '';
  1546. }
  1547.  
  1548. /**
  1549.  * Hyphenate a camelCase string.
  1550.  *
  1551.  * @param {String} str
  1552.  * @return {String}
  1553.  */
  1554.  
  1555. var hyphenateRE = /([a-z\d])([A-Z])/g;
  1556.  
  1557. function hyphenate(str) {
  1558.   return str.replace(hyphenateRE, '$1-$2').toLowerCase();
  1559. }
  1560.  
  1561. /**
  1562.  * Converts hyphen/underscore/slash delimitered names into
  1563.  * camelized classNames.
  1564.  *
  1565.  * e.g. my-component => MyComponent
  1566.  *      some_else    => SomeElse
  1567.  *      some/comp    => SomeComp
  1568.  *
  1569.  * @param {String} str
  1570.  * @return {String}
  1571.  */
  1572.  
  1573. var classifyRE = /(?:^|[-_\/])(\w)/g;
  1574.  
  1575. function classify(str) {
  1576.   return str.replace(classifyRE, toUpper);
  1577. }
  1578.  
  1579. /**
  1580.  * Simple bind, faster than native
  1581.  *
  1582.  * @param {Function} fn
  1583.  * @param {Object} ctx
  1584.  * @return {Function}
  1585.  */
  1586.  
  1587. function bind(fn, ctx) {
  1588.   return function (a) {
  1589.     var l = arguments.length;
  1590.     return l ? l > 1 ? fn.apply(ctx, arguments) : fn.call(ctx, a) : fn.call(ctx);
  1591.   };
  1592. }
  1593.  
  1594. /**
  1595.  * Convert an Array-like object to a real Array.
  1596.  *
  1597.  * @param {Array-like} list
  1598.  * @param {Number} [start] - start index
  1599.  * @return {Array}
  1600.  */
  1601.  
  1602. function toArray(list, start) {
  1603.   start = start || 0;
  1604.   var i = list.length - start;
  1605.   var ret = new Array(i);
  1606.   while (i--) {
  1607.     ret[i] = list[i + start];
  1608.   }
  1609.   return ret;
  1610. }
  1611.  
  1612. /**
  1613.  * Mix properties into target object.
  1614.  *
  1615.  * @param {Object} to
  1616.  * @param {Object} from
  1617.  */
  1618.  
  1619. function extend(to, from) {
  1620.   var keys = Object.keys(from);
  1621.   var i = keys.length;
  1622.   while (i--) {
  1623.     to[keys[i]] = from[keys[i]];
  1624.   }
  1625.   return to;
  1626. }
  1627.  
  1628. /**
  1629.  * Quick object check - this is primarily used to tell
  1630.  * Objects from primitive values when we know the value
  1631.  * is a JSON-compliant type.
  1632.  *
  1633.  * @param {*} obj
  1634.  * @return {Boolean}
  1635.  */
  1636.  
  1637. function isObject(obj) {
  1638.   return obj !== null && typeof obj === 'object';
  1639. }
  1640.  
  1641. /**
  1642.  * Strict object type check. Only returns true
  1643.  * for plain JavaScript objects.
  1644.  *
  1645.  * @param {*} obj
  1646.  * @return {Boolean}
  1647.  */
  1648.  
  1649. var toString = Object.prototype.toString;
  1650. var OBJECT_STRING = '[object Object]';
  1651.  
  1652. function isPlainObject(obj) {
  1653.   return toString.call(obj) === OBJECT_STRING;
  1654. }
  1655.  
  1656. /**
  1657.  * Array type check.
  1658.  *
  1659.  * @param {*} obj
  1660.  * @return {Boolean}
  1661.  */
  1662.  
  1663. var isArray = Array.isArray;
  1664.  
  1665. /**
  1666.  * Define a property.
  1667.  *
  1668.  * @param {Object} obj
  1669.  * @param {String} key
  1670.  * @param {*} val
  1671.  * @param {Boolean} [enumerable]
  1672.  */
  1673.  
  1674. function def(obj, key, val, enumerable) {
  1675.   Object.defineProperty(obj, key, {
  1676.     value: val,
  1677.     enumerable: !!enumerable,
  1678.     writable: true,
  1679.     configurable: true
  1680.   });
  1681. }
  1682.  
  1683. /**
  1684.  * Debounce a function so it only gets called after the
  1685.  * input stops arriving after the given wait period.
  1686.  *
  1687.  * @param {Function} func
  1688.  * @param {Number} wait
  1689.  * @return {Function} - the debounced function
  1690.  */
  1691.  
  1692. function _debounce(func, wait) {
  1693.   var timeout, args, context, timestamp, result;
  1694.   var later = function later() {
  1695.     var last = Date.now() - timestamp;
  1696.     if (last < wait && last >= 0) {
  1697.       timeout = setTimeout(later, wait - last);
  1698.     } else {
  1699.       timeout = null;
  1700.       result = func.apply(context, args);
  1701.       if (!timeout) context = args = null;
  1702.     }
  1703.   };
  1704.   return function () {
  1705.     context = this;
  1706.     args = arguments;
  1707.     timestamp = Date.now();
  1708.     if (!timeout) {
  1709.       timeout = setTimeout(later, wait);
  1710.     }
  1711.     return result;
  1712.   };
  1713. }
  1714.  
  1715. /**
  1716.  * Manual indexOf because it's slightly faster than
  1717.  * native.
  1718.  *
  1719.  * @param {Array} arr
  1720.  * @param {*} obj
  1721.  */
  1722.  
  1723. function indexOf(arr, obj) {
  1724.   var i = arr.length;
  1725.   while (i--) {
  1726.     if (arr[i] === obj) return i;
  1727.   }
  1728.   return -1;
  1729. }
  1730.  
  1731. /**
  1732.  * Make a cancellable version of an async callback.
  1733.  *
  1734.  * @param {Function} fn
  1735.  * @return {Function}
  1736.  */
  1737.  
  1738. function cancellable(fn) {
  1739.   var cb = function cb() {
  1740.     if (!cb.cancelled) {
  1741.       return fn.apply(this, arguments);
  1742.     }
  1743.   };
  1744.   cb.cancel = function () {
  1745.     cb.cancelled = true;
  1746.   };
  1747.   return cb;
  1748. }
  1749.  
  1750. /**
  1751.  * Check if two values are loosely equal - that is,
  1752.  * if they are plain objects, do they have the same shape?
  1753.  *
  1754.  * @param {*} a
  1755.  * @param {*} b
  1756.  * @return {Boolean}
  1757.  */
  1758.  
  1759. function looseEqual(a, b) {
  1760.   /* eslint-disable eqeqeq */
  1761.   return a == b || (isObject(a) && isObject(b) ? JSON.stringify(a) === JSON.stringify(b) : false);
  1762.   /* eslint-enable eqeqeq */
  1763. }
  1764.  
  1765. var hasProto = ('__proto__' in {});
  1766.  
  1767. // Browser environment sniffing
  1768. var inBrowser = typeof window !== 'undefined' && Object.prototype.toString.call(window) !== '[object Object]';
  1769.  
  1770. // detect devtools
  1771. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  1772.  
  1773. // UA sniffing for working around browser-specific quirks
  1774. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  1775. var isIE = UA && UA.indexOf('trident') > 0;
  1776. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  1777. var isAndroid = UA && UA.indexOf('android') > 0;
  1778. var isIos = UA && /(iphone|ipad|ipod|ios)/i.test(UA);
  1779. var iosVersionMatch = isIos && UA.match(/os ([\d_]+)/);
  1780. var iosVersion = iosVersionMatch && iosVersionMatch[1].split('_');
  1781.  
  1782. // detecting iOS UIWebView by indexedDB
  1783. var hasMutationObserverBug = iosVersion && Number(iosVersion[0]) >= 9 && Number(iosVersion[1]) >= 3 && !window.indexedDB;
  1784.  
  1785. var transitionProp = undefined;
  1786. var transitionEndEvent = undefined;
  1787. var animationProp = undefined;
  1788. var animationEndEvent = undefined;
  1789.  
  1790. // Transition property/event sniffing
  1791. if (inBrowser && !isIE9) {
  1792.   var isWebkitTrans = window.ontransitionend === undefined && window.onwebkittransitionend !== undefined;
  1793.   var isWebkitAnim = window.onanimationend === undefined && window.onwebkitanimationend !== undefined;
  1794.   transitionProp = isWebkitTrans ? 'WebkitTransition' : 'transition';
  1795.   transitionEndEvent = isWebkitTrans ? 'webkitTransitionEnd' : 'transitionend';
  1796.   animationProp = isWebkitAnim ? 'WebkitAnimation' : 'animation';
  1797.   animationEndEvent = isWebkitAnim ? 'webkitAnimationEnd' : 'animationend';
  1798. }
  1799.  
  1800. /**
  1801.  * Defer a task to execute it asynchronously. Ideally this
  1802.  * should be executed as a microtask, so we leverage
  1803.  * MutationObserver if it's available, and fallback to
  1804.  * setTimeout(0).
  1805.  *
  1806.  * @param {Function} cb
  1807.  * @param {Object} ctx
  1808.  */
  1809.  
  1810. var nextTick = (function () {
  1811.   var callbacks = [];
  1812.   var pending = false;
  1813.   var timerFunc;
  1814.   function nextTickHandler() {
  1815.     pending = false;
  1816.     var copies = callbacks.slice(0);
  1817.     callbacks = [];
  1818.     for (var i = 0; i < copies.length; i++) {
  1819.       copies[i]();
  1820.     }
  1821.   }
  1822.  
  1823.   /* istanbul ignore if */
  1824.   if (typeof MutationObserver !== 'undefined' && !hasMutationObserverBug) {
  1825.     var counter = 1;
  1826.     var observer = new MutationObserver(nextTickHandler);
  1827.     var textNode = document.createTextNode(counter);
  1828.     observer.observe(textNode, {
  1829.       characterData: true
  1830.     });
  1831.     timerFunc = function () {
  1832.       counter = (counter + 1) % 2;
  1833.       textNode.data = counter;
  1834.     };
  1835.   } else {
  1836.     // webpack attempts to inject a shim for setImmediate
  1837.     // if it is used as a global, so we have to work around that to
  1838.     // avoid bundling unnecessary code.
  1839.     var context = inBrowser ? window : typeof global !== 'undefined' ? global : {};
  1840.     timerFunc = context.setImmediate || setTimeout;
  1841.   }
  1842.   return function (cb, ctx) {
  1843.     var func = ctx ? function () {
  1844.       cb.call(ctx);
  1845.     } : cb;
  1846.     callbacks.push(func);
  1847.     if (pending) return;
  1848.     pending = true;
  1849.     timerFunc(nextTickHandler, 0);
  1850.   };
  1851. })();
  1852.  
  1853. var _Set = undefined;
  1854. /* istanbul ignore if */
  1855. if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) {
  1856.   // use native Set when available.
  1857.   _Set = Set;
  1858. } else {
  1859.   // a non-standard Set polyfill that only works with primitive keys.
  1860.   _Set = function () {
  1861.     this.set = Object.create(null);
  1862.   };
  1863.   _Set.prototype.has = function (key) {
  1864.     return this.set[key] !== undefined;
  1865.   };
  1866.   _Set.prototype.add = function (key) {
  1867.     this.set[key] = 1;
  1868.   };
  1869.   _Set.prototype.clear = function () {
  1870.     this.set = Object.create(null);
  1871.   };
  1872. }
  1873.  
  1874. function Cache(limit) {
  1875.   this.size = 0;
  1876.   this.limit = limit;
  1877.   this.head = this.tail = undefined;
  1878.   this._keymap = Object.create(null);
  1879. }
  1880.  
  1881. var p = Cache.prototype;
  1882.  
  1883. /**
  1884.  * Put <value> into the cache associated with <key>.
  1885.  * Returns the entry which was removed to make room for
  1886.  * the new entry. Otherwise undefined is returned.
  1887.  * (i.e. if there was enough room already).
  1888.  *
  1889.  * @param {String} key
  1890.  * @param {*} value
  1891.  * @return {Entry|undefined}
  1892.  */
  1893.  
  1894. p.put = function (key, value) {
  1895.   var removed;
  1896.  
  1897.   var entry = this.get(key, true);
  1898.   if (!entry) {
  1899.     if (this.size === this.limit) {
  1900.       removed = this.shift();
  1901.     }
  1902.     entry = {
  1903.       key: key
  1904.     };
  1905.     this._keymap[key] = entry;
  1906.     if (this.tail) {
  1907.       this.tail.newer = entry;
  1908.       entry.older = this.tail;
  1909.     } else {
  1910.       this.head = entry;
  1911.     }
  1912.     this.tail = entry;
  1913.     this.size++;
  1914.   }
  1915.   entry.value = value;
  1916.  
  1917.   return removed;
  1918. };
  1919.  
  1920. /**
  1921.  * Purge the least recently used (oldest) entry from the
  1922.  * cache. Returns the removed entry or undefined if the
  1923.  * cache was empty.
  1924.  */
  1925.  
  1926. p.shift = function () {
  1927.   var entry = this.head;
  1928.   if (entry) {
  1929.     this.head = this.head.newer;
  1930.     this.head.older = undefined;
  1931.     entry.newer = entry.older = undefined;
  1932.     this._keymap[entry.key] = undefined;
  1933.     this.size--;
  1934.   }
  1935.   return entry;
  1936. };
  1937.  
  1938. /**
  1939.  * Get and register recent use of <key>. Returns the value
  1940.  * associated with <key> or undefined if not in cache.
  1941.  *
  1942.  * @param {String} key
  1943.  * @param {Boolean} returnEntry
  1944.  * @return {Entry|*}
  1945.  */
  1946.  
  1947. p.get = function (key, returnEntry) {
  1948.   var entry = this._keymap[key];
  1949.   if (entry === undefined) return;
  1950.   if (entry === this.tail) {
  1951.     return returnEntry ? entry : entry.value;
  1952.   }
  1953.   // HEAD--------------TAIL
  1954.   //   <.older   .newer>
  1955.   //  <--- add direction --
  1956.   //   A  B  C  <D>  E
  1957.   if (entry.newer) {
  1958.     if (entry === this.head) {
  1959.       this.head = entry.newer;
  1960.     }
  1961.     entry.newer.older = entry.older; // C <-- E.
  1962.   }
  1963.   if (entry.older) {
  1964.     entry.older.newer = entry.newer; // C. --> E
  1965.   }
  1966.   entry.newer = undefined; // D --x
  1967.   entry.older = this.tail; // D. --> E
  1968.   if (this.tail) {
  1969.     this.tail.newer = entry; // E. <-- D
  1970.   }
  1971.   this.tail = entry;
  1972.   return returnEntry ? entry : entry.value;
  1973. };
  1974.  
  1975. var cache$1 = new Cache(1000);
  1976. var filterTokenRE = /[^\s'"]+|'[^']*'|"[^"]*"/g;
  1977. var reservedArgRE = /^in$|^-?\d+/;
  1978.  
  1979. /**
  1980.  * Parser state
  1981.  */
  1982.  
  1983. var str;
  1984. var dir;
  1985. var c;
  1986. var prev;
  1987. var i;
  1988. var l;
  1989. var lastFilterIndex;
  1990. var inSingle;
  1991. var inDouble;
  1992. var curly;
  1993. var square;
  1994. var paren;
  1995. /**
  1996.  * Push a filter to the current directive object
  1997.  */
  1998.  
  1999. function pushFilter() {
  2000.   var exp = str.slice(lastFilterIndex, i).trim();
  2001.   var filter;
  2002.   if (exp) {
  2003.     filter = {};
  2004.     var tokens = exp.match(filterTokenRE);
  2005.     filter.name = tokens[0];
  2006.     if (tokens.length > 1) {
  2007.       filter.args = tokens.slice(1).map(processFilterArg);
  2008.     }
  2009.   }
  2010.   if (filter) {
  2011.     (dir.filters = dir.filters || []).push(filter);
  2012.   }
  2013.   lastFilterIndex = i + 1;
  2014. }
  2015.  
  2016. /**
  2017.  * Check if an argument is dynamic and strip quotes.
  2018.  *
  2019.  * @param {String} arg
  2020.  * @return {Object}
  2021.  */
  2022.  
  2023. function processFilterArg(arg) {
  2024.   if (reservedArgRE.test(arg)) {
  2025.     return {
  2026.       value: toNumber(arg),
  2027.       dynamic: false
  2028.     };
  2029.   } else {
  2030.     var stripped = stripQuotes(arg);
  2031.     var dynamic = stripped === arg;
  2032.     return {
  2033.       value: dynamic ? arg : stripped,
  2034.       dynamic: dynamic
  2035.     };
  2036.   }
  2037. }
  2038.  
  2039. /**
  2040.  * Parse a directive value and extract the expression
  2041.  * and its filters into a descriptor.
  2042.  *
  2043.  * Example:
  2044.  *
  2045.  * "a + 1 | uppercase" will yield:
  2046.  * {
  2047.  *   expression: 'a + 1',
  2048.  *   filters: [
  2049.  *     { name: 'uppercase', args: null }
  2050.  *   ]
  2051.  * }
  2052.  *
  2053.  * @param {String} s
  2054.  * @return {Object}
  2055.  */
  2056.  
  2057. function parseDirective(s) {
  2058.   var hit = cache$1.get(s);
  2059.   if (hit) {
  2060.     return hit;
  2061.   }
  2062.  
  2063.   // reset parser state
  2064.   str = s;
  2065.   inSingle = inDouble = false;
  2066.   curly = square = paren = 0;
  2067.   lastFilterIndex = 0;
  2068.   dir = {};
  2069.  
  2070.   for (i = 0, l = str.length; i < l; i++) {
  2071.     prev = c;
  2072.     c = str.charCodeAt(i);
  2073.     if (inSingle) {
  2074.       // check single quote
  2075.       if (c === 0x27 && prev !== 0x5C) inSingle = !inSingle;
  2076.     } else if (inDouble) {
  2077.       // check double quote
  2078.       if (c === 0x22 && prev !== 0x5C) inDouble = !inDouble;
  2079.     } else if (c === 0x7C && // pipe
  2080.     str.charCodeAt(i + 1) !== 0x7C && str.charCodeAt(i - 1) !== 0x7C) {
  2081.       if (dir.expression == null) {
  2082.         // first filter, end of expression
  2083.         lastFilterIndex = i + 1;
  2084.         dir.expression = str.slice(0, i).trim();
  2085.       } else {
  2086.         // already has filter
  2087.         pushFilter();
  2088.       }
  2089.     } else {
  2090.       switch (c) {
  2091.         case 0x22:
  2092.           inDouble = true;break; // "
  2093.         case 0x27:
  2094.           inSingle = true;break; // '
  2095.         case 0x28:
  2096.           paren++;break; // (
  2097.         case 0x29:
  2098.           paren--;break; // )
  2099.         case 0x5B:
  2100.           square++;break; // [
  2101.         case 0x5D:
  2102.           square--;break; // ]
  2103.         case 0x7B:
  2104.           curly++;break; // {
  2105.         case 0x7D:
  2106.           curly--;break; // }
  2107.       }
  2108.     }
  2109.   }
  2110.  
  2111.   if (dir.expression == null) {
  2112.     dir.expression = str.slice(0, i).trim();
  2113.   } else if (lastFilterIndex !== 0) {
  2114.     pushFilter();
  2115.   }
  2116.  
  2117.   cache$1.put(s, dir);
  2118.   return dir;
  2119. }
  2120.  
  2121. var directive = Object.freeze({
  2122.   parseDirective: parseDirective
  2123. });
  2124.  
  2125. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  2126. var cache = undefined;
  2127. var tagRE = undefined;
  2128. var htmlRE = undefined;
  2129. /**
  2130.  * Escape a string so it can be used in a RegExp
  2131.  * constructor.
  2132.  *
  2133.  * @param {String} str
  2134.  */
  2135.  
  2136. function escapeRegex(str) {
  2137.   return str.replace(regexEscapeRE, '\\$&');
  2138. }
  2139.  
  2140. function compileRegex() {
  2141.   var open = escapeRegex(config.delimiters[0]);
  2142.   var close = escapeRegex(config.delimiters[1]);
  2143.   var unsafeOpen = escapeRegex(config.unsafeDelimiters[0]);
  2144.   var unsafeClose = escapeRegex(config.unsafeDelimiters[1]);
  2145.   tagRE = new RegExp(unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\n)+?)' + close, 'g');
  2146.   htmlRE = new RegExp('^' + unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '$');
  2147.   // reset cache
  2148.   cache = new Cache(1000);
  2149. }
  2150.  
  2151. /**
  2152.  * Parse a template text string into an array of tokens.
  2153.  *
  2154.  * @param {String} text
  2155.  * @return {Array<Object> | null}
  2156.  *               - {String} type
  2157.  *               - {String} value
  2158.  *               - {Boolean} [html]
  2159.  *               - {Boolean} [oneTime]
  2160.  */
  2161.  
  2162. function parseText(text) {
  2163.   if (!cache) {
  2164.     compileRegex();
  2165.   }
  2166.   var hit = cache.get(text);
  2167.   if (hit) {
  2168.     return hit;
  2169.   }
  2170.   if (!tagRE.test(text)) {
  2171.     return null;
  2172.   }
  2173.   var tokens = [];
  2174.   var lastIndex = tagRE.lastIndex = 0;
  2175.   var match, index, html, value, first, oneTime;
  2176.   /* eslint-disable no-cond-assign */
  2177.   while (match = tagRE.exec(text)) {
  2178.     /* eslint-enable no-cond-assign */
  2179.     index = match.index;
  2180.     // push text token
  2181.     if (index > lastIndex) {
  2182.       tokens.push({
  2183.         value: text.slice(lastIndex, index)
  2184.       });
  2185.     }
  2186.     // tag token
  2187.     html = htmlRE.test(match[0]);
  2188.     value = html ? match[1] : match[2];
  2189.     first = value.charCodeAt(0);
  2190.     oneTime = first === 42; // *
  2191.     value = oneTime ? value.slice(1) : value;
  2192.     tokens.push({
  2193.       tag: true,
  2194.       value: value.trim(),
  2195.       html: html,
  2196.       oneTime: oneTime
  2197.     });
  2198.     lastIndex = index + match[0].length;
  2199.   }
  2200.   if (lastIndex < text.length) {
  2201.     tokens.push({
  2202.       value: text.slice(lastIndex)
  2203.     });
  2204.   }
  2205.   cache.put(text, tokens);
  2206.   return tokens;
  2207. }
  2208.  
  2209. /**
  2210.  * Format a list of tokens into an expression.
  2211.  * e.g. tokens parsed from 'a {{b}} c' can be serialized
  2212.  * into one single expression as '"a " + b + " c"'.
  2213.  *
  2214.  * @param {Array} tokens
  2215.  * @param {Vue} [vm]
  2216.  * @return {String}
  2217.  */
  2218.  
  2219. function tokensToExp(tokens, vm) {
  2220.   if (tokens.length > 1) {
  2221.     return tokens.map(function (token) {
  2222.       return formatToken(token, vm);
  2223.     }).join('+');
  2224.   } else {
  2225.     return formatToken(tokens[0], vm, true);
  2226.   }
  2227. }
  2228.  
  2229. /**
  2230.  * Format a single token.
  2231.  *
  2232.  * @param {Object} token
  2233.  * @param {Vue} [vm]
  2234.  * @param {Boolean} [single]
  2235.  * @return {String}
  2236.  */
  2237.  
  2238. function formatToken(token, vm, single) {
  2239.   return token.tag ? token.oneTime && vm ? '"' + vm.$eval(token.value) + '"' : inlineFilters(token.value, single) : '"' + token.value + '"';
  2240. }
  2241.  
  2242. /**
  2243.  * For an attribute with multiple interpolation tags,
  2244.  * e.g. attr="some-{{thing | filter}}", in order to combine
  2245.  * the whole thing into a single watchable expression, we
  2246.  * have to inline those filters. This function does exactly
  2247.  * that. This is a bit hacky but it avoids heavy changes
  2248.  * to directive parser and watcher mechanism.
  2249.  *
  2250.  * @param {String} exp
  2251.  * @param {Boolean} single
  2252.  * @return {String}
  2253.  */
  2254.  
  2255. var filterRE = /[^|]\|[^|]/;
  2256. function inlineFilters(exp, single) {
  2257.   if (!filterRE.test(exp)) {
  2258.     return single ? exp : '(' + exp + ')';
  2259.   } else {
  2260.     var dir = parseDirective(exp);
  2261.     if (!dir.filters) {
  2262.       return '(' + exp + ')';
  2263.     } else {
  2264.       return 'this._applyFilters(' + dir.expression + // value
  2265.       ',null,' + // oldValue (null for read)
  2266.       JSON.stringify(dir.filters) + // filter descriptors
  2267.       ',false)'; // write?
  2268.     }
  2269.   }
  2270. }
  2271.  
  2272. var text = Object.freeze({
  2273.   compileRegex: compileRegex,
  2274.   parseText: parseText,
  2275.   tokensToExp: tokensToExp
  2276. });
  2277.  
  2278. var delimiters = ['{{', '}}'];
  2279. var unsafeDelimiters = ['{{{', '}}}'];
  2280.  
  2281. var config = Object.defineProperties({
  2282.  
  2283.   /**
  2284.    * Whether to print debug messages.
  2285.    * Also enables stack trace for warnings.
  2286.    *
  2287.    * @type {Boolean}
  2288.    */
  2289.  
  2290.   debug: false,
  2291.  
  2292.   /**
  2293.    * Whether to suppress warnings.
  2294.    *
  2295.    * @type {Boolean}
  2296.    */
  2297.  
  2298.   silent: false,
  2299.  
  2300.   /**
  2301.    * Whether to use async rendering.
  2302.    */
  2303.  
  2304.   async: true,
  2305.  
  2306.   /**
  2307.    * Whether to warn against errors caught when evaluating
  2308.    * expressions.
  2309.    */
  2310.  
  2311.   warnExpressionErrors: true,
  2312.  
  2313.   /**
  2314.    * Whether to allow devtools inspection.
  2315.    * Disabled by default in production builds.
  2316.    */
  2317.  
  2318.   devtools: process.env.NODE_ENV !== 'production',
  2319.  
  2320.   /**
  2321.    * Internal flag to indicate the delimiters have been
  2322.    * changed.
  2323.    *
  2324.    * @type {Boolean}
  2325.    */
  2326.  
  2327.   _delimitersChanged: true,
  2328.  
  2329.   /**
  2330.    * List of asset types that a component can own.
  2331.    *
  2332.    * @type {Array}
  2333.    */
  2334.  
  2335.   _assetTypes: ['component', 'directive', 'elementDirective', 'filter', 'transition', 'partial'],
  2336.  
  2337.   /**
  2338.    * prop binding modes
  2339.    */
  2340.  
  2341.   _propBindingModes: {
  2342.     ONE_WAY: 0,
  2343.     TWO_WAY: 1,
  2344.     ONE_TIME: 2
  2345.   },
  2346.  
  2347.   /**
  2348.    * Max circular updates allowed in a batcher flush cycle.
  2349.    */
  2350.  
  2351.   _maxUpdateCount: 100
  2352.  
  2353. }, {
  2354.   delimiters: { /**
  2355.                  * Interpolation delimiters. Changing these would trigger
  2356.                  * the text parser to re-compile the regular expressions.
  2357.                  *
  2358.                  * @type {Array<String>}
  2359.                  */
  2360.  
  2361.     get: function get() {
  2362.       return delimiters;
  2363.     },
  2364.     set: function set(val) {
  2365.       delimiters = val;
  2366.       compileRegex();
  2367.     },
  2368.     configurable: true,
  2369.     enumerable: true
  2370.   },
  2371.   unsafeDelimiters: {
  2372.     get: function get() {
  2373.       return unsafeDelimiters;
  2374.     },
  2375.     set: function set(val) {
  2376.       unsafeDelimiters = val;
  2377.       compileRegex();
  2378.     },
  2379.     configurable: true,
  2380.     enumerable: true
  2381.   }
  2382. });
  2383.  
  2384. var warn = undefined;
  2385. var formatComponentName = undefined;
  2386.  
  2387. if (process.env.NODE_ENV !== 'production') {
  2388.   (function () {
  2389.     var hasConsole = typeof console !== 'undefined';
  2390.  
  2391.     warn = function (msg, vm) {
  2392.       if (hasConsole && !config.silent) {
  2393.         console.error('[Vue warn]: ' + msg + (vm ? formatComponentName(vm) : ''));
  2394.       }
  2395.     };
  2396.  
  2397.     formatComponentName = function (vm) {
  2398.       var name = vm._isVue ? vm.$options.name : vm.name;
  2399.       return name ? ' (found in component: <' + hyphenate(name) + '>)' : '';
  2400.     };
  2401.   })();
  2402. }
  2403.  
  2404. /**
  2405.  * Append with transition.
  2406.  *
  2407.  * @param {Element} el
  2408.  * @param {Element} target
  2409.  * @param {Vue} vm
  2410.  * @param {Function} [cb]
  2411.  */
  2412.  
  2413. function appendWithTransition(el, target, vm, cb) {
  2414.   applyTransition(el, 1, function () {
  2415.     target.appendChild(el);
  2416.   }, vm, cb);
  2417. }
  2418.  
  2419. /**
  2420.  * InsertBefore with transition.
  2421.  *
  2422.  * @param {Element} el
  2423.  * @param {Element} target
  2424.  * @param {Vue} vm
  2425.  * @param {Function} [cb]
  2426.  */
  2427.  
  2428. function beforeWithTransition(el, target, vm, cb) {
  2429.   applyTransition(el, 1, function () {
  2430.     before(el, target);
  2431.   }, vm, cb);
  2432. }
  2433.  
  2434. /**
  2435.  * Remove with transition.
  2436.  *
  2437.  * @param {Element} el
  2438.  * @param {Vue} vm
  2439.  * @param {Function} [cb]
  2440.  */
  2441.  
  2442. function removeWithTransition(el, vm, cb) {
  2443.   applyTransition(el, -1, function () {
  2444.     remove(el);
  2445.   }, vm, cb);
  2446. }
  2447.  
  2448. /**
  2449.  * Apply transitions with an operation callback.
  2450.  *
  2451.  * @param {Element} el
  2452.  * @param {Number} direction
  2453.  *                  1: enter
  2454.  *                 -1: leave
  2455.  * @param {Function} op - the actual DOM operation
  2456.  * @param {Vue} vm
  2457.  * @param {Function} [cb]
  2458.  */
  2459.  
  2460. function applyTransition(el, direction, op, vm, cb) {
  2461.   var transition = el.__v_trans;
  2462.   if (!transition ||
  2463.   // skip if there are no js hooks and CSS transition is
  2464.   // not supported
  2465.   !transition.hooks && !transitionEndEvent ||
  2466.   // skip transitions for initial compile
  2467.   !vm._isCompiled ||
  2468.   // if the vm is being manipulated by a parent directive
  2469.   // during the parent's compilation phase, skip the
  2470.   // animation.
  2471.   vm.$parent && !vm.$parent._isCompiled) {
  2472.     op();
  2473.     if (cb) cb();
  2474.     return;
  2475.   }
  2476.   var action = direction > 0 ? 'enter' : 'leave';
  2477.   transition[action](op, cb);
  2478. }
  2479.  
  2480. var transition = Object.freeze({
  2481.   appendWithTransition: appendWithTransition,
  2482.   beforeWithTransition: beforeWithTransition,
  2483.   removeWithTransition: removeWithTransition,
  2484.   applyTransition: applyTransition
  2485. });
  2486.  
  2487. /**
  2488.  * Query an element selector if it's not an element already.
  2489.  *
  2490.  * @param {String|Element} el
  2491.  * @return {Element}
  2492.  */
  2493.  
  2494. function query(el) {
  2495.   if (typeof el === 'string') {
  2496.     var selector = el;
  2497.     el = document.querySelector(el);
  2498.     if (!el) {
  2499.       process.env.NODE_ENV !== 'production' && warn('Cannot find element: ' + selector);
  2500.     }
  2501.   }
  2502.   return el;
  2503. }
  2504.  
  2505. /**
  2506.  * Check if a node is in the document.
  2507.  * Note: document.documentElement.contains should work here
  2508.  * but always returns false for comment nodes in phantomjs,
  2509.  * making unit tests difficult. This is fixed by doing the
  2510.  * contains() check on the node's parentNode instead of
  2511.  * the node itself.
  2512.  *
  2513.  * @param {Node} node
  2514.  * @return {Boolean}
  2515.  */
  2516.  
  2517. function inDoc(node) {
  2518.   if (!node) return false;
  2519.   var doc = node.ownerDocument.documentElement;
  2520.   var parent = node.parentNode;
  2521.   return doc === node || doc === parent || !!(parent && parent.nodeType === 1 && doc.contains(parent));
  2522. }
  2523.  
  2524. /**
  2525.  * Get and remove an attribute from a node.
  2526.  *
  2527.  * @param {Node} node
  2528.  * @param {String} _attr
  2529.  */
  2530.  
  2531. function getAttr(node, _attr) {
  2532.   var val = node.getAttribute(_attr);
  2533.   if (val !== null) {
  2534.     node.removeAttribute(_attr);
  2535.   }
  2536.   return val;
  2537. }
  2538.  
  2539. /**
  2540.  * Get an attribute with colon or v-bind: prefix.
  2541.  *
  2542.  * @param {Node} node
  2543.  * @param {String} name
  2544.  * @return {String|null}
  2545.  */
  2546.  
  2547. function getBindAttr(node, name) {
  2548.   var val = getAttr(node, ':' + name);
  2549.   if (val === null) {
  2550.     val = getAttr(node, 'v-bind:' + name);
  2551.   }
  2552.   return val;
  2553. }
  2554.  
  2555. /**
  2556.  * Check the presence of a bind attribute.
  2557.  *
  2558.  * @param {Node} node
  2559.  * @param {String} name
  2560.  * @return {Boolean}
  2561.  */
  2562.  
  2563. function hasBindAttr(node, name) {
  2564.   return node.hasAttribute(name) || node.hasAttribute(':' + name) || node.hasAttribute('v-bind:' + name);
  2565. }
  2566.  
  2567. /**
  2568.  * Insert el before target
  2569.  *
  2570.  * @param {Element} el
  2571.  * @param {Element} target
  2572.  */
  2573.  
  2574. function before(el, target) {
  2575.   target.parentNode.insertBefore(el, target);
  2576. }
  2577.  
  2578. /**
  2579.  * Insert el after target
  2580.  *
  2581.  * @param {Element} el
  2582.  * @param {Element} target
  2583.  */
  2584.  
  2585. function after(el, target) {
  2586.   if (target.nextSibling) {
  2587.     before(el, target.nextSibling);
  2588.   } else {
  2589.     target.parentNode.appendChild(el);
  2590.   }
  2591. }
  2592.  
  2593. /**
  2594.  * Remove el from DOM
  2595.  *
  2596.  * @param {Element} el
  2597.  */
  2598.  
  2599. function remove(el) {
  2600.   el.parentNode.removeChild(el);
  2601. }
  2602.  
  2603. /**
  2604.  * Prepend el to target
  2605.  *
  2606.  * @param {Element} el
  2607.  * @param {Element} target
  2608.  */
  2609.  
  2610. function prepend(el, target) {
  2611.   if (target.firstChild) {
  2612.     before(el, target.firstChild);
  2613.   } else {
  2614.     target.appendChild(el);
  2615.   }
  2616. }
  2617.  
  2618. /**
  2619.  * Replace target with el
  2620.  *
  2621.  * @param {Element} target
  2622.  * @param {Element} el
  2623.  */
  2624.  
  2625. function replace(target, el) {
  2626.   var parent = target.parentNode;
  2627.   if (parent) {
  2628.     parent.replaceChild(el, target);
  2629.   }
  2630. }
  2631.  
  2632. /**
  2633.  * Add event listener shorthand.
  2634.  *
  2635.  * @param {Element} el
  2636.  * @param {String} event
  2637.  * @param {Function} cb
  2638.  * @param {Boolean} [useCapture]
  2639.  */
  2640.  
  2641. function on(el, event, cb, useCapture) {
  2642.   el.addEventListener(event, cb, useCapture);
  2643. }
  2644.  
  2645. /**
  2646.  * Remove event listener shorthand.
  2647.  *
  2648.  * @param {Element} el
  2649.  * @param {String} event
  2650.  * @param {Function} cb
  2651.  */
  2652.  
  2653. function off(el, event, cb) {
  2654.   el.removeEventListener(event, cb);
  2655. }
  2656.  
  2657. /**
  2658.  * For IE9 compat: when both class and :class are present
  2659.  * getAttribute('class') returns wrong value...
  2660.  *
  2661.  * @param {Element} el
  2662.  * @return {String}
  2663.  */
  2664.  
  2665. function getClass(el) {
  2666.   var classname = el.className;
  2667.   if (typeof classname === 'object') {
  2668.     classname = classname.baseVal || '';
  2669.   }
  2670.   return classname;
  2671. }
  2672.  
  2673. /**
  2674.  * In IE9, setAttribute('class') will result in empty class
  2675.  * if the element also has the :class attribute; However in
  2676.  * PhantomJS, setting `className` does not work on SVG elements...
  2677.  * So we have to do a conditional check here.
  2678.  *
  2679.  * @param {Element} el
  2680.  * @param {String} cls
  2681.  */
  2682.  
  2683. function setClass(el, cls) {
  2684.   /* istanbul ignore if */
  2685.   if (isIE9 && !/svg$/.test(el.namespaceURI)) {
  2686.     el.className = cls;
  2687.   } else {
  2688.     el.setAttribute('class', cls);
  2689.   }
  2690. }
  2691.  
  2692. /**
  2693.  * Add class with compatibility for IE & SVG
  2694.  *
  2695.  * @param {Element} el
  2696.  * @param {String} cls
  2697.  */
  2698.  
  2699. function addClass(el, cls) {
  2700.   if (el.classList) {
  2701.     el.classList.add(cls);
  2702.   } else {
  2703.     var cur = ' ' + getClass(el) + ' ';
  2704.     if (cur.indexOf(' ' + cls + ' ') < 0) {
  2705.       setClass(el, (cur + cls).trim());
  2706.     }
  2707.   }
  2708. }
  2709.  
  2710. /**
  2711.  * Remove class with compatibility for IE & SVG
  2712.  *
  2713.  * @param {Element} el
  2714.  * @param {String} cls
  2715.  */
  2716.  
  2717. function removeClass(el, cls) {
  2718.   if (el.classList) {
  2719.     el.classList.remove(cls);
  2720.   } else {
  2721.     var cur = ' ' + getClass(el) + ' ';
  2722.     var tar = ' ' + cls + ' ';
  2723.     while (cur.indexOf(tar) >= 0) {
  2724.       cur = cur.replace(tar, ' ');
  2725.     }
  2726.     setClass(el, cur.trim());
  2727.   }
  2728.   if (!el.className) {
  2729.     el.removeAttribute('class');
  2730.   }
  2731. }
  2732.  
  2733. /**
  2734.  * Extract raw content inside an element into a temporary
  2735.  * container div
  2736.  *
  2737.  * @param {Element} el
  2738.  * @param {Boolean} asFragment
  2739.  * @return {Element|DocumentFragment}
  2740.  */
  2741.  
  2742. function extractContent(el, asFragment) {
  2743.   var child;
  2744.   var rawContent;
  2745.   /* istanbul ignore if */
  2746.   if (isTemplate(el) && isFragment(el.content)) {
  2747.     el = el.content;
  2748.   }
  2749.   if (el.hasChildNodes()) {
  2750.     trimNode(el);
  2751.     rawContent = asFragment ? document.createDocumentFragment() : document.createElement('div');
  2752.     /* eslint-disable no-cond-assign */
  2753.     while (child = el.firstChild) {
  2754.       /* eslint-enable no-cond-assign */
  2755.       rawContent.appendChild(child);
  2756.     }
  2757.   }
  2758.   return rawContent;
  2759. }
  2760.  
  2761. /**
  2762.  * Trim possible empty head/tail text and comment
  2763.  * nodes inside a parent.
  2764.  *
  2765.  * @param {Node} node
  2766.  */
  2767.  
  2768. function trimNode(node) {
  2769.   var child;
  2770.   /* eslint-disable no-sequences */
  2771.   while ((child = node.firstChild, isTrimmable(child))) {
  2772.     node.removeChild(child);
  2773.   }
  2774.   while ((child = node.lastChild, isTrimmable(child))) {
  2775.     node.removeChild(child);
  2776.   }
  2777.   /* eslint-enable no-sequences */
  2778. }
  2779.  
  2780. function isTrimmable(node) {
  2781.   return node && (node.nodeType === 3 && !node.data.trim() || node.nodeType === 8);
  2782. }
  2783.  
  2784. /**
  2785.  * Check if an element is a template tag.
  2786.  * Note if the template appears inside an SVG its tagName
  2787.  * will be in lowercase.
  2788.  *
  2789.  * @param {Element} el
  2790.  */
  2791.  
  2792. function isTemplate(el) {
  2793.   return el.tagName && el.tagName.toLowerCase() === 'template';
  2794. }
  2795.  
  2796. /**
  2797.  * Create an "anchor" for performing dom insertion/removals.
  2798.  * This is used in a number of scenarios:
  2799.  * - fragment instance
  2800.  * - v-html
  2801.  * - v-if
  2802.  * - v-for
  2803.  * - component
  2804.  *
  2805.  * @param {String} content
  2806.  * @param {Boolean} persist - IE trashes empty textNodes on
  2807.  *                            cloneNode(true), so in certain
  2808.  *                            cases the anchor needs to be
  2809.  *                            non-empty to be persisted in
  2810.  *                            templates.
  2811.  * @return {Comment|Text}
  2812.  */
  2813.  
  2814. function createAnchor(content, persist) {
  2815.   var anchor = config.debug ? document.createComment(content) : document.createTextNode(persist ? ' ' : '');
  2816.   anchor.__v_anchor = true;
  2817.   return anchor;
  2818. }
  2819.  
  2820. /**
  2821.  * Find a component ref attribute that starts with $.
  2822.  *
  2823.  * @param {Element} node
  2824.  * @return {String|undefined}
  2825.  */
  2826.  
  2827. var refRE = /^v-ref:/;
  2828.  
  2829. function findRef(node) {
  2830.   if (node.hasAttributes()) {
  2831.     var attrs = node.attributes;
  2832.     for (var i = 0, l = attrs.length; i < l; i++) {
  2833.       var name = attrs[i].name;
  2834.       if (refRE.test(name)) {
  2835.         return camelize(name.replace(refRE, ''));
  2836.       }
  2837.     }
  2838.   }
  2839. }
  2840.  
  2841. /**
  2842.  * Map a function to a range of nodes .
  2843.  *
  2844.  * @param {Node} node
  2845.  * @param {Node} end
  2846.  * @param {Function} op
  2847.  */
  2848.  
  2849. function mapNodeRange(node, end, op) {
  2850.   var next;
  2851.   while (node !== end) {
  2852.     next = node.nextSibling;
  2853.     op(node);
  2854.     node = next;
  2855.   }
  2856.   op(end);
  2857. }
  2858.  
  2859. /**
  2860.  * Remove a range of nodes with transition, store
  2861.  * the nodes in a fragment with correct ordering,
  2862.  * and call callback when done.
  2863.  *
  2864.  * @param {Node} start
  2865.  * @param {Node} end
  2866.  * @param {Vue} vm
  2867.  * @param {DocumentFragment} frag
  2868.  * @param {Function} cb
  2869.  */
  2870.  
  2871. function removeNodeRange(start, end, vm, frag, cb) {
  2872.   var done = false;
  2873.   var removed = 0;
  2874.   var nodes = [];
  2875.   mapNodeRange(start, end, function (node) {
  2876.     if (node === end) done = true;
  2877.     nodes.push(node);
  2878.     removeWithTransition(node, vm, onRemoved);
  2879.   });
  2880.   function onRemoved() {
  2881.     removed++;
  2882.     if (done && removed >= nodes.length) {
  2883.       for (var i = 0; i < nodes.length; i++) {
  2884.         frag.appendChild(nodes[i]);
  2885.       }
  2886.       cb && cb();
  2887.     }
  2888.   }
  2889. }
  2890.  
  2891. /**
  2892.  * Check if a node is a DocumentFragment.
  2893.  *
  2894.  * @param {Node} node
  2895.  * @return {Boolean}
  2896.  */
  2897.  
  2898. function isFragment(node) {
  2899.   return node && node.nodeType === 11;
  2900. }
  2901.  
  2902. /**
  2903.  * Get outerHTML of elements, taking care
  2904.  * of SVG elements in IE as well.
  2905.  *
  2906.  * @param {Element} el
  2907.  * @return {String}
  2908.  */
  2909.  
  2910. function getOuterHTML(el) {
  2911.   if (el.outerHTML) {
  2912.     return el.outerHTML;
  2913.   } else {
  2914.     var container = document.createElement('div');
  2915.     container.appendChild(el.cloneNode(true));
  2916.     return container.innerHTML;
  2917.   }
  2918. }
  2919.  
  2920. var commonTagRE = /^(div|p|span|img|a|b|i|br|ul|ol|li|h1|h2|h3|h4|h5|h6|code|pre|table|th|td|tr|form|label|input|select|option|nav|article|section|header|footer)$/i;
  2921. var reservedTagRE = /^(slot|partial|component)$/i;
  2922.  
  2923. var isUnknownElement = undefined;
  2924. if (process.env.NODE_ENV !== 'production') {
  2925.   isUnknownElement = function (el, tag) {
  2926.     if (tag.indexOf('-') > -1) {
  2927.       // http://stackoverflow.com/a/28210364/1070244
  2928.       return el.constructor === window.HTMLUnknownElement || el.constructor === window.HTMLElement;
  2929.     } else {
  2930.       return (/HTMLUnknownElement/.test(el.toString()) &&
  2931.         // Chrome returns unknown for several HTML5 elements.
  2932.         // https://code.google.com/p/chromium/issues/detail?id=540526
  2933.         // Firefox returns unknown for some "Interactive elements."
  2934.         !/^(data|time|rtc|rb|details|dialog|summary)$/.test(tag)
  2935.       );
  2936.     }
  2937.   };
  2938. }
  2939.  
  2940. /**
  2941.  * Check if an element is a component, if yes return its
  2942.  * component id.
  2943.  *
  2944.  * @param {Element} el
  2945.  * @param {Object} options
  2946.  * @return {Object|undefined}
  2947.  */
  2948.  
  2949. function checkComponentAttr(el, options) {
  2950.   var tag = el.tagName.toLowerCase();
  2951.   var hasAttrs = el.hasAttributes();
  2952.   if (!commonTagRE.test(tag) && !reservedTagRE.test(tag)) {
  2953.     if (resolveAsset(options, 'components', tag)) {
  2954.       return { id: tag };
  2955.     } else {
  2956.       var is = hasAttrs && getIsBinding(el, options);
  2957.       if (is) {
  2958.         return is;
  2959.       } else if (process.env.NODE_ENV !== 'production') {
  2960.         var expectedTag = options._componentNameMap && options._componentNameMap[tag];
  2961.         if (expectedTag) {
  2962.           warn('Unknown custom element: <' + tag + '> - ' + 'did you mean <' + expectedTag + '>? ' + 'HTML is case-insensitive, remember to use kebab-case in templates.');
  2963.         } else if (isUnknownElement(el, tag)) {
  2964.           warn('Unknown custom element: <' + tag + '> - did you ' + 'register the component correctly? For recursive components, ' + 'make sure to provide the "name" option.');
  2965.         }
  2966.       }
  2967.     }
  2968.   } else if (hasAttrs) {
  2969.     return getIsBinding(el, options);
  2970.   }
  2971. }
  2972.  
  2973. /**
  2974.  * Get "is" binding from an element.
  2975.  *
  2976.  * @param {Element} el
  2977.  * @param {Object} options
  2978.  * @return {Object|undefined}
  2979.  */
  2980.  
  2981. function getIsBinding(el, options) {
  2982.   // dynamic syntax
  2983.   var exp = el.getAttribute('is');
  2984.   if (exp != null) {
  2985.     if (resolveAsset(options, 'components', exp)) {
  2986.       el.removeAttribute('is');
  2987.       return { id: exp };
  2988.     }
  2989.   } else {
  2990.     exp = getBindAttr(el, 'is');
  2991.     if (exp != null) {
  2992.       return { id: exp, dynamic: true };
  2993.     }
  2994.   }
  2995. }
  2996.  
  2997. /**
  2998.  * Option overwriting strategies are functions that handle
  2999.  * how to merge a parent option value and a child option
  3000.  * value into the final value.
  3001.  *
  3002.  * All strategy functions follow the same signature:
  3003.  *
  3004.  * @param {*} parentVal
  3005.  * @param {*} childVal
  3006.  * @param {Vue} [vm]
  3007.  */
  3008.  
  3009. var strats = config.optionMergeStrategies = Object.create(null);
  3010.  
  3011. /**
  3012.  * Helper that recursively merges two data objects together.
  3013.  */
  3014.  
  3015. function mergeData(to, from) {
  3016.   var key, toVal, fromVal;
  3017.   for (key in from) {
  3018.     toVal = to[key];
  3019.     fromVal = from[key];
  3020.     if (!hasOwn(to, key)) {
  3021.       set(to, key, fromVal);
  3022.     } else if (isObject(toVal) && isObject(fromVal)) {
  3023.       mergeData(toVal, fromVal);
  3024.     }
  3025.   }
  3026.   return to;
  3027. }
  3028.  
  3029. /**
  3030.  * Data
  3031.  */
  3032.  
  3033. strats.data = function (parentVal, childVal, vm) {
  3034.   if (!vm) {
  3035.     // in a Vue.extend merge, both should be functions
  3036.     if (!childVal) {
  3037.       return parentVal;
  3038.     }
  3039.     if (typeof childVal !== 'function') {
  3040.       process.env.NODE_ENV !== 'production' && warn('The "data" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);
  3041.       return parentVal;
  3042.     }
  3043.     if (!parentVal) {
  3044.       return childVal;
  3045.     }
  3046.     // when parentVal & childVal are both present,
  3047.     // we need to return a function that returns the
  3048.     // merged result of both functions... no need to
  3049.     // check if parentVal is a function here because
  3050.     // it has to be a function to pass previous merges.
  3051.     return function mergedDataFn() {
  3052.       return mergeData(childVal.call(this), parentVal.call(this));
  3053.     };
  3054.   } else if (parentVal || childVal) {
  3055.     return function mergedInstanceDataFn() {
  3056.       // instance merge
  3057.       var instanceData = typeof childVal === 'function' ? childVal.call(vm) : childVal;
  3058.       var defaultData = typeof parentVal === 'function' ? parentVal.call(vm) : undefined;
  3059.       if (instanceData) {
  3060.         return mergeData(instanceData, defaultData);
  3061.       } else {
  3062.         return defaultData;
  3063.       }
  3064.     };
  3065.   }
  3066. };
  3067.  
  3068. /**
  3069.  * El
  3070.  */
  3071.  
  3072. strats.el = function (parentVal, childVal, vm) {
  3073.   if (!vm && childVal && typeof childVal !== 'function') {
  3074.     process.env.NODE_ENV !== 'production' && warn('The "el" option should be a function ' + 'that returns a per-instance value in component ' + 'definitions.', vm);
  3075.     return;
  3076.   }
  3077.   var ret = childVal || parentVal;
  3078.   // invoke the element factory if this is instance merge
  3079.   return vm && typeof ret === 'function' ? ret.call(vm) : ret;
  3080. };
  3081.  
  3082. /**
  3083.  * Hooks and param attributes are merged as arrays.
  3084.  */
  3085.  
  3086. strats.init = strats.created = strats.ready = strats.attached = strats.detached = strats.beforeCompile = strats.compiled = strats.beforeDestroy = strats.destroyed = strats.activate = function (parentVal, childVal) {
  3087.   return childVal ? parentVal ? parentVal.concat(childVal) : isArray(childVal) ? childVal : [childVal] : parentVal;
  3088. };
  3089.  
  3090. /**
  3091.  * Assets
  3092.  *
  3093.  * When a vm is present (instance creation), we need to do
  3094.  * a three-way merge between constructor options, instance
  3095.  * options and parent options.
  3096.  */
  3097.  
  3098. function mergeAssets(parentVal, childVal) {
  3099.   var res = Object.create(parentVal || null);
  3100.   return childVal ? extend(res, guardArrayAssets(childVal)) : res;
  3101. }
  3102.  
  3103. config._assetTypes.forEach(function (type) {
  3104.   strats[type + 's'] = mergeAssets;
  3105. });
  3106.  
  3107. /**
  3108.  * Events & Watchers.
  3109.  *
  3110.  * Events & watchers hashes should not overwrite one
  3111.  * another, so we merge them as arrays.
  3112.  */
  3113.  
  3114. strats.watch = strats.events = function (parentVal, childVal) {
  3115.   if (!childVal) return parentVal;
  3116.   if (!parentVal) return childVal;
  3117.   var ret = {};
  3118.   extend(ret, parentVal);
  3119.   for (var key in childVal) {
  3120.     var parent = ret[key];
  3121.     var child = childVal[key];
  3122.     if (parent && !isArray(parent)) {
  3123.       parent = [parent];
  3124.     }
  3125.     ret[key] = parent ? parent.concat(child) : [child];
  3126.   }
  3127.   return ret;
  3128. };
  3129.  
  3130. /**
  3131.  * Other object hashes.
  3132.  */
  3133.  
  3134. strats.props = strats.methods = strats.computed = function (parentVal, childVal) {
  3135.   if (!childVal) return parentVal;
  3136.   if (!parentVal) return childVal;
  3137.   var ret = Object.create(null);
  3138.   extend(ret, parentVal);
  3139.   extend(ret, childVal);
  3140.   return ret;
  3141. };
  3142.  
  3143. /**
  3144.  * Default strategy.
  3145.  */
  3146.  
  3147. var defaultStrat = function defaultStrat(parentVal, childVal) {
  3148.   return childVal === undefined ? parentVal : childVal;
  3149. };
  3150.  
  3151. /**
  3152.  * Make sure component options get converted to actual
  3153.  * constructors.
  3154.  *
  3155.  * @param {Object} options
  3156.  */
  3157.  
  3158. function guardComponents(options) {
  3159.   if (options.components) {
  3160.     var components = options.components = guardArrayAssets(options.components);
  3161.     var ids = Object.keys(components);
  3162.     var def;
  3163.     if (process.env.NODE_ENV !== 'production') {
  3164.       var map = options._componentNameMap = {};
  3165.     }
  3166.     for (var i = 0, l = ids.length; i < l; i++) {
  3167.       var key = ids[i];
  3168.       if (commonTagRE.test(key) || reservedTagRE.test(key)) {
  3169.         process.env.NODE_ENV !== 'production' && warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + key);
  3170.         continue;
  3171.       }
  3172.       // record a all lowercase <-> kebab-case mapping for
  3173.       // possible custom element case error warning
  3174.       if (process.env.NODE_ENV !== 'production') {
  3175.         map[key.replace(/-/g, '').toLowerCase()] = hyphenate(key);
  3176.       }
  3177.       def = components[key];
  3178.       if (isPlainObject(def)) {
  3179.         components[key] = Vue.extend(def);
  3180.       }
  3181.     }
  3182.   }
  3183. }
  3184.  
  3185. /**
  3186.  * Ensure all props option syntax are normalized into the
  3187.  * Object-based format.
  3188.  *
  3189.  * @param {Object} options
  3190.  */
  3191.  
  3192. function guardProps(options) {
  3193.   var props = options.props;
  3194.   var i, val;
  3195.   if (isArray(props)) {
  3196.     options.props = {};
  3197.     i = props.length;
  3198.     while (i--) {
  3199.       val = props[i];
  3200.       if (typeof val === 'string') {
  3201.         options.props[val] = null;
  3202.       } else if (val.name) {
  3203.         options.props[val.name] = val;
  3204.       }
  3205.     }
  3206.   } else if (isPlainObject(props)) {
  3207.     var keys = Object.keys(props);
  3208.     i = keys.length;
  3209.     while (i--) {
  3210.       val = props[keys[i]];
  3211.       if (typeof val === 'function') {
  3212.         props[keys[i]] = { type: val };
  3213.       }
  3214.     }
  3215.   }
  3216. }
  3217.  
  3218. /**
  3219.  * Guard an Array-format assets option and converted it
  3220.  * into the key-value Object format.
  3221.  *
  3222.  * @param {Object|Array} assets
  3223.  * @return {Object}
  3224.  */
  3225.  
  3226. function guardArrayAssets(assets) {
  3227.   if (isArray(assets)) {
  3228.     var res = {};
  3229.     var i = assets.length;
  3230.     var asset;
  3231.     while (i--) {
  3232.       asset = assets[i];
  3233.       var id = typeof asset === 'function' ? asset.options && asset.options.name || asset.id : asset.name || asset.id;
  3234.       if (!id) {
  3235.         process.env.NODE_ENV !== 'production' && warn('Array-syntax assets must provide a "name" or "id" field.');
  3236.       } else {
  3237.         res[id] = asset;
  3238.       }
  3239.     }
  3240.     return res;
  3241.   }
  3242.   return assets;
  3243. }
  3244.  
  3245. /**
  3246.  * Merge two option objects into a new one.
  3247.  * Core utility used in both instantiation and inheritance.
  3248.  *
  3249.  * @param {Object} parent
  3250.  * @param {Object} child
  3251.  * @param {Vue} [vm] - if vm is present, indicates this is
  3252.  *                     an instantiation merge.
  3253.  */
  3254.  
  3255. function mergeOptions(parent, child, vm) {
  3256.   guardComponents(child);
  3257.   guardProps(child);
  3258.   if (process.env.NODE_ENV !== 'production') {
  3259.     if (child.propsData && !vm) {
  3260.       warn('propsData can only be used as an instantiation option.');
  3261.     }
  3262.   }
  3263.   var options = {};
  3264.   var key;
  3265.   if (child['extends']) {
  3266.     parent = typeof child['extends'] === 'function' ? mergeOptions(parent, child['extends'].options, vm) : mergeOptions(parent, child['extends'], vm);
  3267.   }
  3268.   if (child.mixins) {
  3269.     for (var i = 0, l = child.mixins.length; i < l; i++) {
  3270.       var mixin = child.mixins[i];
  3271.       var mixinOptions = mixin.prototype instanceof Vue ? mixin.options : mixin;
  3272.       parent = mergeOptions(parent, mixinOptions, vm);
  3273.     }
  3274.   }
  3275.   for (key in parent) {
  3276.     mergeField(key);
  3277.   }
  3278.   for (key in child) {
  3279.     if (!hasOwn(parent, key)) {
  3280.       mergeField(key);
  3281.     }
  3282.   }
  3283.   function mergeField(key) {
  3284.     var strat = strats[key] || defaultStrat;
  3285.     options[key] = strat(parent[key], child[key], vm, key);
  3286.   }
  3287.   return options;
  3288. }
  3289.  
  3290. /**
  3291.  * Resolve an asset.
  3292.  * This function is used because child instances need access
  3293.  * to assets defined in its ancestor chain.
  3294.  *
  3295.  * @param {Object} options
  3296.  * @param {String} type
  3297.  * @param {String} id
  3298.  * @param {Boolean} warnMissing
  3299.  * @return {Object|Function}
  3300.  */
  3301.  
  3302. function resolveAsset(options, type, id, warnMissing) {
  3303.   /* istanbul ignore if */
  3304.   if (typeof id !== 'string') {
  3305.     return;
  3306.   }
  3307.   var assets = options[type];
  3308.   var camelizedId;
  3309.   var res = assets[id] ||
  3310.   // camelCase ID
  3311.   assets[camelizedId = camelize(id)] ||
  3312.   // Pascal Case ID
  3313.   assets[camelizedId.charAt(0).toUpperCase() + camelizedId.slice(1)];
  3314.   if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  3315.     warn('Failed to resolve ' + type.slice(0, -1) + ': ' + id, options);
  3316.   }
  3317.   return res;
  3318. }
  3319.  
  3320. var uid$1 = 0;
  3321.  
  3322. /**
  3323.  * A dep is an observable that can have multiple
  3324.  * directives subscribing to it.
  3325.  *
  3326.  * @constructor
  3327.  */
  3328. function Dep() {
  3329.   this.id = uid$1++;
  3330.   this.subs = [];
  3331. }
  3332.  
  3333. // the current target watcher being evaluated.
  3334. // this is globally unique because there could be only one
  3335. // watcher being evaluated at any time.
  3336. Dep.target = null;
  3337.  
  3338. /**
  3339.  * Add a directive subscriber.
  3340.  *
  3341.  * @param {Directive} sub
  3342.  */
  3343.  
  3344. Dep.prototype.addSub = function (sub) {
  3345.   this.subs.push(sub);
  3346. };
  3347.  
  3348. /**
  3349.  * Remove a directive subscriber.
  3350.  *
  3351.  * @param {Directive} sub
  3352.  */
  3353.  
  3354. Dep.prototype.removeSub = function (sub) {
  3355.   this.subs.$remove(sub);
  3356. };
  3357.  
  3358. /**
  3359.  * Add self as a dependency to the target watcher.
  3360.  */
  3361.  
  3362. Dep.prototype.depend = function () {
  3363.   Dep.target.addDep(this);
  3364. };
  3365.  
  3366. /**
  3367.  * Notify all subscribers of a new value.
  3368.  */
  3369.  
  3370. Dep.prototype.notify = function () {
  3371.   // stablize the subscriber list first
  3372.   var subs = toArray(this.subs);
  3373.   for (var i = 0, l = subs.length; i < l; i++) {
  3374.     subs[i].update();
  3375.   }
  3376. };
  3377.  
  3378. var arrayProto = Array.prototype;
  3379. var arrayMethods = Object.create(arrayProto)
  3380.  
  3381. /**
  3382.  * Intercept mutating methods and emit events
  3383.  */
  3384.  
  3385. ;['push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse'].forEach(function (method) {
  3386.   // cache original method
  3387.   var original = arrayProto[method];
  3388.   def(arrayMethods, method, function mutator() {
  3389.     // avoid leaking arguments:
  3390.     // http://jsperf.com/closure-with-arguments
  3391.     var i = arguments.length;
  3392.     var args = new Array(i);
  3393.     while (i--) {
  3394.       args[i] = arguments[i];
  3395.     }
  3396.     var result = original.apply(this, args);
  3397.     var ob = this.__ob__;
  3398.     var inserted;
  3399.     switch (method) {
  3400.       case 'push':
  3401.         inserted = args;
  3402.         break;
  3403.       case 'unshift':
  3404.         inserted = args;
  3405.         break;
  3406.       case 'splice':
  3407.         inserted = args.slice(2);
  3408.         break;
  3409.     }
  3410.     if (inserted) ob.observeArray(inserted);
  3411.     // notify change
  3412.     ob.dep.notify();
  3413.     return result;
  3414.   });
  3415. });
  3416.  
  3417. /**
  3418.  * Swap the element at the given index with a new value
  3419.  * and emits corresponding event.
  3420.  *
  3421.  * @param {Number} index
  3422.  * @param {*} val
  3423.  * @return {*} - replaced element
  3424.  */
  3425.  
  3426. def(arrayProto, '$set', function $set(index, val) {
  3427.   if (index >= this.length) {
  3428.     this.length = Number(index) + 1;
  3429.   }
  3430.   return this.splice(index, 1, val)[0];
  3431. });
  3432.  
  3433. /**
  3434.  * Convenience method to remove the element at given index or target element reference.
  3435.  *
  3436.  * @param {*} item
  3437.  */
  3438.  
  3439. def(arrayProto, '$remove', function $remove(item) {
  3440.   /* istanbul ignore if */
  3441.   if (!this.length) return;
  3442.   var index = indexOf(this, item);
  3443.   if (index > -1) {
  3444.     return this.splice(index, 1);
  3445.   }
  3446. });
  3447.  
  3448. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  3449.  
  3450. /**
  3451.  * By default, when a reactive property is set, the new value is
  3452.  * also converted to become reactive. However in certain cases, e.g.
  3453.  * v-for scope alias and props, we don't want to force conversion
  3454.  * because the value may be a nested value under a frozen data structure.
  3455.  *
  3456.  * So whenever we want to set a reactive property without forcing
  3457.  * conversion on the new value, we wrap that call inside this function.
  3458.  */
  3459.  
  3460. var shouldConvert = true;
  3461.  
  3462. function withoutConversion(fn) {
  3463.   shouldConvert = false;
  3464.   fn();
  3465.   shouldConvert = true;
  3466. }
  3467.  
  3468. /**
  3469.  * Observer class that are attached to each observed
  3470.  * object. Once attached, the observer converts target
  3471.  * object's property keys into getter/setters that
  3472.  * collect dependencies and dispatches updates.
  3473.  *
  3474.  * @param {Array|Object} value
  3475.  * @constructor
  3476.  */
  3477.  
  3478. function Observer(value) {
  3479.   this.value = value;
  3480.   this.dep = new Dep();
  3481.   def(value, '__ob__', this);
  3482.   if (isArray(value)) {
  3483.     var augment = hasProto ? protoAugment : copyAugment;
  3484.     augment(value, arrayMethods, arrayKeys);
  3485.     this.observeArray(value);
  3486.   } else {
  3487.     this.walk(value);
  3488.   }
  3489. }
  3490.  
  3491. // Instance methods
  3492.  
  3493. /**
  3494.  * Walk through each property and convert them into
  3495.  * getter/setters. This method should only be called when
  3496.  * value type is Object.
  3497.  *
  3498.  * @param {Object} obj
  3499.  */
  3500.  
  3501. Observer.prototype.walk = function (obj) {
  3502.   var keys = Object.keys(obj);
  3503.   for (var i = 0, l = keys.length; i < l; i++) {
  3504.     this.convert(keys[i], obj[keys[i]]);
  3505.   }
  3506. };
  3507.  
  3508. /**
  3509.  * Observe a list of Array items.
  3510.  *
  3511.  * @param {Array} items
  3512.  */
  3513.  
  3514. Observer.prototype.observeArray = function (items) {
  3515.   for (var i = 0, l = items.length; i < l; i++) {
  3516.     observe(items[i]);
  3517.   }
  3518. };
  3519.  
  3520. /**
  3521.  * Convert a property into getter/setter so we can emit
  3522.  * the events when the property is accessed/changed.
  3523.  *
  3524.  * @param {String} key
  3525.  * @param {*} val
  3526.  */
  3527.  
  3528. Observer.prototype.convert = function (key, val) {
  3529.   defineReactive(this.value, key, val);
  3530. };
  3531.  
  3532. /**
  3533.  * Add an owner vm, so that when $set/$delete mutations
  3534.  * happen we can notify owner vms to proxy the keys and
  3535.  * digest the watchers. This is only called when the object
  3536.  * is observed as an instance's root $data.
  3537.  *
  3538.  * @param {Vue} vm
  3539.  */
  3540.  
  3541. Observer.prototype.addVm = function (vm) {
  3542.   (this.vms || (this.vms = [])).push(vm);
  3543. };
  3544.  
  3545. /**
  3546.  * Remove an owner vm. This is called when the object is
  3547.  * swapped out as an instance's $data object.
  3548.  *
  3549.  * @param {Vue} vm
  3550.  */
  3551.  
  3552. Observer.prototype.removeVm = function (vm) {
  3553.   this.vms.$remove(vm);
  3554. };
  3555.  
  3556. // helpers
  3557.  
  3558. /**
  3559.  * Augment an target Object or Array by intercepting
  3560.  * the prototype chain using __proto__
  3561.  *
  3562.  * @param {Object|Array} target
  3563.  * @param {Object} src
  3564.  */
  3565.  
  3566. function protoAugment(target, src) {
  3567.   /* eslint-disable no-proto */
  3568.   target.__proto__ = src;
  3569.   /* eslint-enable no-proto */
  3570. }
  3571.  
  3572. /**
  3573.  * Augment an target Object or Array by defining
  3574.  * hidden properties.
  3575.  *
  3576.  * @param {Object|Array} target
  3577.  * @param {Object} proto
  3578.  */
  3579.  
  3580. function copyAugment(target, src, keys) {
  3581.   for (var i = 0, l = keys.length; i < l; i++) {
  3582.     var key = keys[i];
  3583.     def(target, key, src[key]);
  3584.   }
  3585. }
  3586.  
  3587. /**
  3588.  * Attempt to create an observer instance for a value,
  3589.  * returns the new observer if successfully observed,
  3590.  * or the existing observer if the value already has one.
  3591.  *
  3592.  * @param {*} value
  3593.  * @param {Vue} [vm]
  3594.  * @return {Observer|undefined}
  3595.  * @static
  3596.  */
  3597.  
  3598. function observe(value, vm) {
  3599.   if (!value || typeof value !== 'object') {
  3600.     return;
  3601.   }
  3602.   var ob;
  3603.   if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  3604.     ob = value.__ob__;
  3605.   } else if (shouldConvert && (isArray(value) || isPlainObject(value)) && Object.isExtensible(value) && !value._isVue) {
  3606.     ob = new Observer(value);
  3607.   }
  3608.   if (ob && vm) {
  3609.     ob.addVm(vm);
  3610.   }
  3611.   return ob;
  3612. }
  3613.  
  3614. /**
  3615.  * Define a reactive property on an Object.
  3616.  *
  3617.  * @param {Object} obj
  3618.  * @param {String} key
  3619.  * @param {*} val
  3620.  */
  3621.  
  3622. function defineReactive(obj, key, val) {
  3623.   var dep = new Dep();
  3624.  
  3625.   var property = Object.getOwnPropertyDescriptor(obj, key);
  3626.   if (property && property.configurable === false) {
  3627.     return;
  3628.   }
  3629.  
  3630.   // cater for pre-defined getter/setters
  3631.   var getter = property && property.get;
  3632.   var setter = property && property.set;
  3633.  
  3634.   var childOb = observe(val);
  3635.   Object.defineProperty(obj, key, {
  3636.     enumerable: true,
  3637.     configurable: true,
  3638.     get: function reactiveGetter() {
  3639.       var value = getter ? getter.call(obj) : val;
  3640.       if (Dep.target) {
  3641.         dep.depend();
  3642.         if (childOb) {
  3643.           childOb.dep.depend();
  3644.         }
  3645.         if (isArray(value)) {
  3646.           for (var e, i = 0, l = value.length; i < l; i++) {
  3647.             e = value[i];
  3648.             e && e.__ob__ && e.__ob__.dep.depend();
  3649.           }
  3650.         }
  3651.       }
  3652.       return value;
  3653.     },
  3654.     set: function reactiveSetter(newVal) {
  3655.       var value = getter ? getter.call(obj) : val;
  3656.       if (newVal === value) {
  3657.         return;
  3658.       }
  3659.       if (setter) {
  3660.         setter.call(obj, newVal);
  3661.       } else {
  3662.         val = newVal;
  3663.       }
  3664.       childOb = observe(newVal);
  3665.       dep.notify();
  3666.     }
  3667.   });
  3668. }
  3669.  
  3670.  
  3671.  
  3672. var util = Object.freeze({
  3673.     defineReactive: defineReactive,
  3674.     set: set,
  3675.     del: del,
  3676.     hasOwn: hasOwn,
  3677.     isLiteral: isLiteral,
  3678.     isReserved: isReserved,
  3679.     _toString: _toString,
  3680.     toNumber: toNumber,
  3681.     toBoolean: toBoolean,
  3682.     stripQuotes: stripQuotes,
  3683.     camelize: camelize,
  3684.     hyphenate: hyphenate,
  3685.     classify: classify,
  3686.     bind: bind,
  3687.     toArray: toArray,
  3688.     extend: extend,
  3689.     isObject: isObject,
  3690.     isPlainObject: isPlainObject,
  3691.     def: def,
  3692.     debounce: _debounce,
  3693.     indexOf: indexOf,
  3694.     cancellable: cancellable,
  3695.     looseEqual: looseEqual,
  3696.     isArray: isArray,
  3697.     hasProto: hasProto,
  3698.     inBrowser: inBrowser,
  3699.     devtools: devtools,
  3700.     isIE: isIE,
  3701.     isIE9: isIE9,
  3702.     isAndroid: isAndroid,
  3703.     isIos: isIos,
  3704.     iosVersionMatch: iosVersionMatch,
  3705.     iosVersion: iosVersion,
  3706.     hasMutationObserverBug: hasMutationObserverBug,
  3707.     get transitionProp () { return transitionProp; },
  3708.     get transitionEndEvent () { return transitionEndEvent; },
  3709.     get animationProp () { return animationProp; },
  3710.     get animationEndEvent () { return animationEndEvent; },
  3711.     nextTick: nextTick,
  3712.     get _Set () { return _Set; },
  3713.     query: query,
  3714.     inDoc: inDoc,
  3715.     getAttr: getAttr,
  3716.     getBindAttr: getBindAttr,
  3717.     hasBindAttr: hasBindAttr,
  3718.     before: before,
  3719.     after: after,
  3720.     remove: remove,
  3721.     prepend: prepend,
  3722.     replace: replace,
  3723.     on: on,
  3724.     off: off,
  3725.     setClass: setClass,
  3726.     addClass: addClass,
  3727.     removeClass: removeClass,
  3728.     extractContent: extractContent,
  3729.     trimNode: trimNode,
  3730.     isTemplate: isTemplate,
  3731.     createAnchor: createAnchor,
  3732.     findRef: findRef,
  3733.     mapNodeRange: mapNodeRange,
  3734.     removeNodeRange: removeNodeRange,
  3735.     isFragment: isFragment,
  3736.     getOuterHTML: getOuterHTML,
  3737.     mergeOptions: mergeOptions,
  3738.     resolveAsset: resolveAsset,
  3739.     checkComponentAttr: checkComponentAttr,
  3740.     commonTagRE: commonTagRE,
  3741.     reservedTagRE: reservedTagRE,
  3742.     get warn () { return warn; }
  3743. });
  3744.  
  3745. var uid = 0;
  3746.  
  3747. function initMixin (Vue) {
  3748.   /**
  3749.    * The main init sequence. This is called for every
  3750.    * instance, including ones that are created from extended
  3751.    * constructors.
  3752.    *
  3753.    * @param {Object} options - this options object should be
  3754.    *                           the result of merging class
  3755.    *                           options and the options passed
  3756.    *                           in to the constructor.
  3757.    */
  3758.  
  3759.   Vue.prototype._init = function (options) {
  3760.     options = options || {};
  3761.  
  3762.     this.$el = null;
  3763.     this.$parent = options.parent;
  3764.     this.$root = this.$parent ? this.$parent.$root : this;
  3765.     this.$children = [];
  3766.     this.$refs = {}; // child vm references
  3767.     this.$els = {}; // element references
  3768.     this._watchers = []; // all watchers as an array
  3769.     this._directives = []; // all directives
  3770.  
  3771.     // a uid
  3772.     this._uid = uid++;
  3773.  
  3774.     // a flag to avoid this being observed
  3775.     this._isVue = true;
  3776.  
  3777.     // events bookkeeping
  3778.     this._events = {}; // registered callbacks
  3779.     this._eventsCount = {}; // for $broadcast optimization
  3780.  
  3781.     // fragment instance properties
  3782.     this._isFragment = false;
  3783.     this._fragment = // @type {DocumentFragment}
  3784.     this._fragmentStart = // @type {Text|Comment}
  3785.     this._fragmentEnd = null; // @type {Text|Comment}
  3786.  
  3787.     // lifecycle state
  3788.     this._isCompiled = this._isDestroyed = this._isReady = this._isAttached = this._isBeingDestroyed = this._vForRemoving = false;
  3789.     this._unlinkFn = null;
  3790.  
  3791.     // context:
  3792.     // if this is a transcluded component, context
  3793.     // will be the common parent vm of this instance
  3794.     // and its host.
  3795.     this._context = options._context || this.$parent;
  3796.  
  3797.     // scope:
  3798.     // if this is inside an inline v-for, the scope
  3799.     // will be the intermediate scope created for this
  3800.     // repeat fragment. this is used for linking props
  3801.     // and container directives.
  3802.     this._scope = options._scope;
  3803.  
  3804.     // fragment:
  3805.     // if this instance is compiled inside a Fragment, it
  3806.     // needs to reigster itself as a child of that fragment
  3807.     // for attach/detach to work properly.
  3808.     this._frag = options._frag;
  3809.     if (this._frag) {
  3810.       this._frag.children.push(this);
  3811.     }
  3812.  
  3813.     // push self into parent / transclusion host
  3814.     if (this.$parent) {
  3815.       this.$parent.$children.push(this);
  3816.     }
  3817.  
  3818.     // merge options.
  3819.     options = this.$options = mergeOptions(this.constructor.options, options, this);
  3820.  
  3821.     // set ref
  3822.     this._updateRef();
  3823.  
  3824.     // initialize data as empty object.
  3825.     // it will be filled up in _initData().
  3826.     this._data = {};
  3827.  
  3828.     // call init hook
  3829.     this._callHook('init');
  3830.  
  3831.     // initialize data observation and scope inheritance.
  3832.     this._initState();
  3833.  
  3834.     // setup event system and option events.
  3835.     this._initEvents();
  3836.  
  3837.     // call created hook
  3838.     this._callHook('created');
  3839.  
  3840.     // if `el` option is passed, start compilation.
  3841.     if (options.el) {
  3842.       this.$mount(options.el);
  3843.     }
  3844.   };
  3845. }
  3846.  
  3847. var pathCache = new Cache(1000);
  3848.  
  3849. // actions
  3850. var APPEND = 0;
  3851. var PUSH = 1;
  3852. var INC_SUB_PATH_DEPTH = 2;
  3853. var PUSH_SUB_PATH = 3;
  3854.  
  3855. // states
  3856. var BEFORE_PATH = 0;
  3857. var IN_PATH = 1;
  3858. var BEFORE_IDENT = 2;
  3859. var IN_IDENT = 3;
  3860. var IN_SUB_PATH = 4;
  3861. var IN_SINGLE_QUOTE = 5;
  3862. var IN_DOUBLE_QUOTE = 6;
  3863. var AFTER_PATH = 7;
  3864. var ERROR = 8;
  3865.  
  3866. var pathStateMachine = [];
  3867.  
  3868. pathStateMachine[BEFORE_PATH] = {
  3869.   'ws': [BEFORE_PATH],
  3870.   'ident': [IN_IDENT, APPEND],
  3871.   '[': [IN_SUB_PATH],
  3872.   'eof': [AFTER_PATH]
  3873. };
  3874.  
  3875. pathStateMachine[IN_PATH] = {
  3876.   'ws': [IN_PATH],
  3877.   '.': [BEFORE_IDENT],
  3878.   '[': [IN_SUB_PATH],
  3879.   'eof': [AFTER_PATH]
  3880. };
  3881.  
  3882. pathStateMachine[BEFORE_IDENT] = {
  3883.   'ws': [BEFORE_IDENT],
  3884.   'ident': [IN_IDENT, APPEND]
  3885. };
  3886.  
  3887. pathStateMachine[IN_IDENT] = {
  3888.   'ident': [IN_IDENT, APPEND],
  3889.   '0': [IN_IDENT, APPEND],
  3890.   'number': [IN_IDENT, APPEND],
  3891.   'ws': [IN_PATH, PUSH],
  3892.   '.': [BEFORE_IDENT, PUSH],
  3893.   '[': [IN_SUB_PATH, PUSH],
  3894.   'eof': [AFTER_PATH, PUSH]
  3895. };
  3896.  
  3897. pathStateMachine[IN_SUB_PATH] = {
  3898.   "'": [IN_SINGLE_QUOTE, APPEND],
  3899.   '"': [IN_DOUBLE_QUOTE, APPEND],
  3900.   '[': [IN_SUB_PATH, INC_SUB_PATH_DEPTH],
  3901.   ']': [IN_PATH, PUSH_SUB_PATH],
  3902.   'eof': ERROR,
  3903.   'else': [IN_SUB_PATH, APPEND]
  3904. };
  3905.  
  3906. pathStateMachine[IN_SINGLE_QUOTE] = {
  3907.   "'": [IN_SUB_PATH, APPEND],
  3908.   'eof': ERROR,
  3909.   'else': [IN_SINGLE_QUOTE, APPEND]
  3910. };
  3911.  
  3912. pathStateMachine[IN_DOUBLE_QUOTE] = {
  3913.   '"': [IN_SUB_PATH, APPEND],
  3914.   'eof': ERROR,
  3915.   'else': [IN_DOUBLE_QUOTE, APPEND]
  3916. };
  3917.  
  3918. /**
  3919.  * Determine the type of a character in a keypath.
  3920.  *
  3921.  * @param {Char} ch
  3922.  * @return {String} type
  3923.  */
  3924.  
  3925. function getPathCharType(ch) {
  3926.   if (ch === undefined) {
  3927.     return 'eof';
  3928.   }
  3929.  
  3930.   var code = ch.charCodeAt(0);
  3931.  
  3932.   switch (code) {
  3933.     case 0x5B: // [
  3934.     case 0x5D: // ]
  3935.     case 0x2E: // .
  3936.     case 0x22: // "
  3937.     case 0x27: // '
  3938.     case 0x30:
  3939.       // 0
  3940.       return ch;
  3941.  
  3942.     case 0x5F: // _
  3943.     case 0x24:
  3944.       // $
  3945.       return 'ident';
  3946.  
  3947.     case 0x20: // Space
  3948.     case 0x09: // Tab
  3949.     case 0x0A: // Newline
  3950.     case 0x0D: // Return
  3951.     case 0xA0: // No-break space
  3952.     case 0xFEFF: // Byte Order Mark
  3953.     case 0x2028: // Line Separator
  3954.     case 0x2029:
  3955.       // Paragraph Separator
  3956.       return 'ws';
  3957.   }
  3958.  
  3959.   // a-z, A-Z
  3960.   if (code >= 0x61 && code <= 0x7A || code >= 0x41 && code <= 0x5A) {
  3961.     return 'ident';
  3962.   }
  3963.  
  3964.   // 1-9
  3965.   if (code >= 0x31 && code <= 0x39) {
  3966.     return 'number';
  3967.   }
  3968.  
  3969.   return 'else';
  3970. }
  3971.  
  3972. /**
  3973.  * Format a subPath, return its plain form if it is
  3974.  * a literal string or number. Otherwise prepend the
  3975.  * dynamic indicator (*).
  3976.  *
  3977.  * @param {String} path
  3978.  * @return {String}
  3979.  */
  3980.  
  3981. function formatSubPath(path) {
  3982.   var trimmed = path.trim();
  3983.   // invalid leading 0
  3984.   if (path.charAt(0) === '0' && isNaN(path)) {
  3985.     return false;
  3986.   }
  3987.   return isLiteral(trimmed) ? stripQuotes(trimmed) : '*' + trimmed;
  3988. }
  3989.  
  3990. /**
  3991.  * Parse a string path into an array of segments
  3992.  *
  3993.  * @param {String} path
  3994.  * @return {Array|undefined}
  3995.  */
  3996.  
  3997. function parse(path) {
  3998.   var keys = [];
  3999.   var index = -1;
  4000.   var mode = BEFORE_PATH;
  4001.   var subPathDepth = 0;
  4002.   var c, newChar, key, type, transition, action, typeMap;
  4003.  
  4004.   var actions = [];
  4005.  
  4006.   actions[PUSH] = function () {
  4007.     if (key !== undefined) {
  4008.       keys.push(key);
  4009.       key = undefined;
  4010.     }
  4011.   };
  4012.  
  4013.   actions[APPEND] = function () {
  4014.     if (key === undefined) {
  4015.       key = newChar;
  4016.     } else {
  4017.       key += newChar;
  4018.     }
  4019.   };
  4020.  
  4021.   actions[INC_SUB_PATH_DEPTH] = function () {
  4022.     actions[APPEND]();
  4023.     subPathDepth++;
  4024.   };
  4025.  
  4026.   actions[PUSH_SUB_PATH] = function () {
  4027.     if (subPathDepth > 0) {
  4028.       subPathDepth--;
  4029.       mode = IN_SUB_PATH;
  4030.       actions[APPEND]();
  4031.     } else {
  4032.       subPathDepth = 0;
  4033.       key = formatSubPath(key);
  4034.       if (key === false) {
  4035.         return false;
  4036.       } else {
  4037.         actions[PUSH]();
  4038.       }
  4039.     }
  4040.   };
  4041.  
  4042.   function maybeUnescapeQuote() {
  4043.     var nextChar = path[index + 1];
  4044.     if (mode === IN_SINGLE_QUOTE && nextChar === "'" || mode === IN_DOUBLE_QUOTE && nextChar === '"') {
  4045.       index++;
  4046.       newChar = '\\' + nextChar;
  4047.       actions[APPEND]();
  4048.       return true;
  4049.     }
  4050.   }
  4051.  
  4052.   while (mode != null) {
  4053.     index++;
  4054.     c = path[index];
  4055.  
  4056.     if (c === '\\' && maybeUnescapeQuote()) {
  4057.       continue;
  4058.     }
  4059.  
  4060.     type = getPathCharType(c);
  4061.     typeMap = pathStateMachine[mode];
  4062.     transition = typeMap[type] || typeMap['else'] || ERROR;
  4063.  
  4064.     if (transition === ERROR) {
  4065.       return; // parse error
  4066.     }
  4067.  
  4068.     mode = transition[0];
  4069.     action = actions[transition[1]];
  4070.     if (action) {
  4071.       newChar = transition[2];
  4072.       newChar = newChar === undefined ? c : newChar;
  4073.       if (action() === false) {
  4074.         return;
  4075.       }
  4076.     }
  4077.  
  4078.     if (mode === AFTER_PATH) {
  4079.       keys.raw = path;
  4080.       return keys;
  4081.     }
  4082.   }
  4083. }
  4084.  
  4085. /**
  4086.  * External parse that check for a cache hit first
  4087.  *
  4088.  * @param {String} path
  4089.  * @return {Array|undefined}
  4090.  */
  4091.  
  4092. function parsePath(path) {
  4093.   var hit = pathCache.get(path);
  4094.   if (!hit) {
  4095.     hit = parse(path);
  4096.     if (hit) {
  4097.       pathCache.put(path, hit);
  4098.     }
  4099.   }
  4100.   return hit;
  4101. }
  4102.  
  4103. /**
  4104.  * Get from an object from a path string
  4105.  *
  4106.  * @param {Object} obj
  4107.  * @param {String} path
  4108.  */
  4109.  
  4110. function getPath(obj, path) {
  4111.   return parseExpression(path).get(obj);
  4112. }
  4113.  
  4114. /**
  4115.  * Warn against setting non-existent root path on a vm.
  4116.  */
  4117.  
  4118. var warnNonExistent;
  4119. if (process.env.NODE_ENV !== 'production') {
  4120.   warnNonExistent = function (path, vm) {
  4121.     warn('You are setting a non-existent path "' + path.raw + '" ' + 'on a vm instance. Consider pre-initializing the property ' + 'with the "data" option for more reliable reactivity ' + 'and better performance.', vm);
  4122.   };
  4123. }
  4124.  
  4125. /**
  4126.  * Set on an object from a path
  4127.  *
  4128.  * @param {Object} obj
  4129.  * @param {String | Array} path
  4130.  * @param {*} val
  4131.  */
  4132.  
  4133. function setPath(obj, path, val) {
  4134.   var original = obj;
  4135.   if (typeof path === 'string') {
  4136.     path = parse(path);
  4137.   }
  4138.   if (!path || !isObject(obj)) {
  4139.     return false;
  4140.   }
  4141.   var last, key;
  4142.   for (var i = 0, l = path.length; i < l; i++) {
  4143.     last = obj;
  4144.     key = path[i];
  4145.     if (key.charAt(0) === '*') {
  4146.       key = parseExpression(key.slice(1)).get.call(original, original);
  4147.     }
  4148.     if (i < l - 1) {
  4149.       obj = obj[key];
  4150.       if (!isObject(obj)) {
  4151.         obj = {};
  4152.         if (process.env.NODE_ENV !== 'production' && last._isVue) {
  4153.           warnNonExistent(path, last);
  4154.         }
  4155.         set(last, key, obj);
  4156.       }
  4157.     } else {
  4158.       if (isArray(obj)) {
  4159.         obj.$set(key, val);
  4160.       } else if (key in obj) {
  4161.         obj[key] = val;
  4162.       } else {
  4163.         if (process.env.NODE_ENV !== 'production' && obj._isVue) {
  4164.           warnNonExistent(path, obj);
  4165.         }
  4166.         set(obj, key, val);
  4167.       }
  4168.     }
  4169.   }
  4170.   return true;
  4171. }
  4172.  
  4173. var path = Object.freeze({
  4174.   parsePath: parsePath,
  4175.   getPath: getPath,
  4176.   setPath: setPath
  4177. });
  4178.  
  4179. var expressionCache = new Cache(1000);
  4180.  
  4181. var allowedKeywords = 'Math,Date,this,true,false,null,undefined,Infinity,NaN,' + 'isNaN,isFinite,decodeURI,decodeURIComponent,encodeURI,' + 'encodeURIComponent,parseInt,parseFloat';
  4182. var allowedKeywordsRE = new RegExp('^(' + allowedKeywords.replace(/,/g, '\\b|') + '\\b)');
  4183.  
  4184. // keywords that don't make sense inside expressions
  4185. var improperKeywords = 'break,case,class,catch,const,continue,debugger,default,' + 'delete,do,else,export,extends,finally,for,function,if,' + 'import,in,instanceof,let,return,super,switch,throw,try,' + 'var,while,with,yield,enum,await,implements,package,' + 'protected,static,interface,private,public';
  4186. var improperKeywordsRE = new RegExp('^(' + improperKeywords.replace(/,/g, '\\b|') + '\\b)');
  4187.  
  4188. var wsRE = /\s/g;
  4189. var newlineRE = /\n/g;
  4190. var saveRE = /[\{,]\s*[\w\$_]+\s*:|('(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`)|new |typeof |void /g;
  4191. var restoreRE = /"(\d+)"/g;
  4192. var pathTestRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/;
  4193. var identRE = /[^\w$\.](?:[A-Za-z_$][\w$]*)/g;
  4194. var literalValueRE$1 = /^(?:true|false|null|undefined|Infinity|NaN)$/;
  4195.  
  4196. function noop() {}
  4197.  
  4198. /**
  4199. * Save / Rewrite / Restore
  4200. *
  4201. * When rewriting paths found in an expression, it is
  4202. * possible for the same letter sequences to be found in
  4203. * strings and Object literal property keys. Therefore we
  4204. * remove and store these parts in a temporary array, and
  4205. * restore them after the path rewrite.
  4206. */
  4207.  
  4208. var saved = [];
  4209.  
  4210. /**
  4211. * Save replacer
  4212. *
  4213. * The save regex can match two possible cases:
  4214. * 1. An opening object literal
  4215. * 2. A string
  4216. * If matched as a plain string, we need to escape its
  4217. * newlines, since the string needs to be preserved when
  4218. * generating the function body.
  4219. *
  4220. * @param {String} str
  4221. * @param {String} isString - str if matched as a string
  4222. * @return {String} - placeholder with index
  4223. */
  4224.  
  4225. function save(str, isString) {
  4226.  var i = saved.length;
  4227.  saved[i] = isString ? str.replace(newlineRE, '\\n') : str;
  4228.  return '"' + i + '"';
  4229. }
  4230.  
  4231. /**
  4232. * Path rewrite replacer
  4233. *
  4234. * @param {String} raw
  4235. * @return {String}
  4236. */
  4237.  
  4238. function rewrite(raw) {
  4239.  var c = raw.charAt(0);
  4240.  var path = raw.slice(1);
  4241.  if (allowedKeywordsRE.test(path)) {
  4242.    return raw;
  4243.  } else {
  4244.    path = path.indexOf('"') > -1 ? path.replace(restoreRE, restore) : path;
  4245.    return c + 'scope.' + path;
  4246.  }
  4247. }
  4248.  
  4249. /**
  4250. * Restore replacer
  4251. *
  4252. * @param {String} str
  4253. * @param {String} i - matched save index
  4254. * @return {String}
  4255. */
  4256.  
  4257. function restore(str, i) {
  4258.  return saved[i];
  4259. }
  4260.  
  4261. /**
  4262. * Rewrite an expression, prefixing all path accessors with
  4263. * `scope.` and generate getter/setter functions.
  4264. *
  4265. * @param {String} exp
  4266. * @return {Function}
  4267. */
  4268.  
  4269. function compileGetter(exp) {
  4270.  if (improperKeywordsRE.test(exp)) {
  4271.    process.env.NODE_ENV !== 'production' && warn('Avoid using reserved keywords in expression: ' + exp);
  4272.  }
  4273.  // reset state
  4274.  saved.length = 0;
  4275.  // save strings and object literal keys
  4276.  var body = exp.replace(saveRE, save).replace(wsRE, '');
  4277.  // rewrite all paths
  4278.  // pad 1 space here because the regex matches 1 extra char
  4279.  body = (' ' + body).replace(identRE, rewrite).replace(restoreRE, restore);
  4280.  return makeGetterFn(body);
  4281. }
  4282.  
  4283. /**
  4284. * Build a getter function. Requires eval.
  4285. *
  4286. * We isolate the try/catch so it doesn't affect the
  4287. * optimization of the parse function when it is not called.
  4288. *
  4289. * @param {String} body
  4290. * @return {Function|undefined}
  4291. */
  4292.  
  4293. function makeGetterFn(body) {
  4294.  try {
  4295.    /* eslint-disable no-new-func */
  4296.    return new Function('scope', 'return ' + body + ';');
  4297.    /* eslint-enable no-new-func */
  4298.  } catch (e) {
  4299.    if (process.env.NODE_ENV !== 'production') {
  4300.      /* istanbul ignore if */
  4301.      if (e.toString().match(/unsafe-eval|CSP/)) {
  4302.        warn('It seems you are using the default build of Vue.js in an environment ' + 'with Content Security Policy that prohibits unsafe-eval. ' + 'Use the CSP-compliant build instead: ' + 'http://vuejs.org/guide/installation.html#CSP-compliant-build');
  4303.      } else {
  4304.        warn('Invalid expression. ' + 'Generated function body: ' + body);
  4305.      }
  4306.    }
  4307.    return noop;
  4308.  }
  4309. }
  4310.  
  4311. /**
  4312. * Compile a setter function for the expression.
  4313. *
  4314. * @param {String} exp
  4315. * @return {Function|undefined}
  4316. */
  4317.  
  4318. function compileSetter(exp) {
  4319.  var path = parsePath(exp);
  4320.  if (path) {
  4321.    return function (scope, val) {
  4322.      setPath(scope, path, val);
  4323.    };
  4324.  } else {
  4325.    process.env.NODE_ENV !== 'production' && warn('Invalid setter expression: ' + exp);
  4326.  }
  4327. }
  4328.  
  4329. /**
  4330. * Parse an expression into re-written getter/setters.
  4331. *
  4332. * @param {String} exp
  4333. * @param {Boolean} needSet
  4334. * @return {Function}
  4335. */
  4336.  
  4337. function parseExpression(exp, needSet) {
  4338.  exp = exp.trim();
  4339.  // try cache
  4340.  var hit = expressionCache.get(exp);
  4341.  if (hit) {
  4342.    if (needSet && !hit.set) {
  4343.      hit.set = compileSetter(hit.exp);
  4344.    }
  4345.    return hit;
  4346.  }
  4347.  var res = { exp: exp };
  4348.  res.get = isSimplePath(exp) && exp.indexOf('[') < 0
  4349.  // optimized super simple getter
  4350.  ? makeGetterFn('scope.' + exp)
  4351.  // dynamic getter
  4352.  : compileGetter(exp);
  4353.  if (needSet) {
  4354.    res.set = compileSetter(exp);
  4355.  }
  4356.  expressionCache.put(exp, res);
  4357.  return res;
  4358. }
  4359.  
  4360. /**
  4361. * Check if an expression is a simple path.
  4362. *
  4363. * @param {String} exp
  4364. * @return {Boolean}
  4365. */
  4366.  
  4367. function isSimplePath(exp) {
  4368.  return pathTestRE.test(exp) &&
  4369.  // don't treat literal values as paths
  4370.  !literalValueRE$1.test(exp) &&
  4371.  // Math constants e.g. Math.PI, Math.E etc.
  4372.  exp.slice(0, 5) !== 'Math.';
  4373. }
  4374.  
  4375. var expression = Object.freeze({
  4376.  parseExpression: parseExpression,
  4377.  isSimplePath: isSimplePath
  4378. });
  4379.  
  4380. // we have two separate queues: one for directive updates
  4381. // and one for user watcher registered via $watch().
  4382. // we want to guarantee directive updates to be called
  4383. // before user watchers so that when user watchers are
  4384. // triggered, the DOM would have already been in updated
  4385. // state.
  4386.  
  4387. var queue = [];
  4388. var userQueue = [];
  4389. var has = {};
  4390. var circular = {};
  4391. var waiting = false;
  4392.  
  4393. /**
  4394. * Reset the batcher's state.
  4395. */
  4396.  
  4397. function resetBatcherState() {
  4398.  queue.length = 0;
  4399.  userQueue.length = 0;
  4400.  has = {};
  4401.  circular = {};
  4402.  waiting = false;
  4403. }
  4404.  
  4405. /**
  4406. * Flush both queues and run the watchers.
  4407. */
  4408.  
  4409. function flushBatcherQueue() {
  4410.  var _again = true;
  4411.  
  4412.  _function: while (_again) {
  4413.    _again = false;
  4414.  
  4415.    runBatcherQueue(queue);
  4416.    runBatcherQueue(userQueue);
  4417.    // user watchers triggered more watchers,
  4418.    // keep flushing until it depletes
  4419.    if (queue.length) {
  4420.      _again = true;
  4421.      continue _function;
  4422.    }
  4423.    // dev tool hook
  4424.    /* istanbul ignore if */
  4425.    if (devtools && config.devtools) {
  4426.      devtools.emit('flush');
  4427.    }
  4428.    resetBatcherState();
  4429.  }
  4430. }
  4431.  
  4432. /**
  4433. * Run the watchers in a single queue.
  4434. *
  4435. * @param {Array} queue
  4436. */
  4437.  
  4438. function runBatcherQueue(queue) {
  4439.  // do not cache length because more watchers might be pushed
  4440.  // as we run existing watchers
  4441.  for (var i = 0; i < queue.length; i++) {
  4442.    var watcher = queue[i];
  4443.    var id = watcher.id;
  4444.    has[id] = null;
  4445.    watcher.run();
  4446.    // in dev build, check and stop circular updates.
  4447.    if (process.env.NODE_ENV !== 'production' && has[id] != null) {
  4448.      circular[id] = (circular[id] || 0) + 1;
  4449.      if (circular[id] > config._maxUpdateCount) {
  4450.        warn('You may have an infinite update loop for watcher ' + 'with expression "' + watcher.expression + '"', watcher.vm);
  4451.        break;
  4452.      }
  4453.    }
  4454.  }
  4455.  queue.length = 0;
  4456. }
  4457.  
  4458. /**
  4459. * Push a watcher into the watcher queue.
  4460. * Jobs with duplicate IDs will be skipped unless it's
  4461. * pushed when the queue is being flushed.
  4462. *
  4463. * @param {Watcher} watcher
  4464. *   properties:
  4465. *   - {Number} id
  4466. *   - {Function} run
  4467. */
  4468.  
  4469. function pushWatcher(watcher) {
  4470.  var id = watcher.id;
  4471.  if (has[id] == null) {
  4472.    // push watcher into appropriate queue
  4473.    var q = watcher.user ? userQueue : queue;
  4474.    has[id] = q.length;
  4475.    q.push(watcher);
  4476.    // queue the flush
  4477.    if (!waiting) {
  4478.      waiting = true;
  4479.      nextTick(flushBatcherQueue);
  4480.    }
  4481.  }
  4482. }
  4483.  
  4484. var uid$2 = 0;
  4485.  
  4486. /**
  4487. * A watcher parses an expression, collects dependencies,
  4488. * and fires callback when the expression value changes.
  4489. * This is used for both the $watch() api and directives.
  4490. *
  4491. * @param {Vue} vm
  4492. * @param {String|Function} expOrFn
  4493. * @param {Function} cb
  4494. * @param {Object} options
  4495. *                 - {Array} filters
  4496. *                 - {Boolean} twoWay
  4497. *                 - {Boolean} deep
  4498. *                 - {Boolean} user
  4499. *                 - {Boolean} sync
  4500. *                 - {Boolean} lazy
  4501. *                 - {Function} [preProcess]
  4502. *                 - {Function} [postProcess]
  4503. * @constructor
  4504. */
  4505. function Watcher(vm, expOrFn, cb, options) {
  4506.  // mix in options
  4507.  if (options) {
  4508.    extend(this, options);
  4509.  }
  4510.  var isFn = typeof expOrFn === 'function';
  4511.  this.vm = vm;
  4512.  vm._watchers.push(this);
  4513.  this.expression = expOrFn;
  4514.  this.cb = cb;
  4515.  this.id = ++uid$2; // uid for batching
  4516.  this.active = true;
  4517.  this.dirty = this.lazy; // for lazy watchers
  4518.  this.deps = [];
  4519.  this.newDeps = [];
  4520.  this.depIds = new _Set();
  4521.  this.newDepIds = new _Set();
  4522.  this.prevError = null; // for async error stacks
  4523.  // parse expression for getter/setter
  4524.  if (isFn) {
  4525.    this.getter = expOrFn;
  4526.    this.setter = undefined;
  4527.  } else {
  4528.    var res = parseExpression(expOrFn, this.twoWay);
  4529.    this.getter = res.get;
  4530.    this.setter = res.set;
  4531.  }
  4532.  this.value = this.lazy ? undefined : this.get();
  4533.  // state for avoiding false triggers for deep and Array
  4534.  // watchers during vm._digest()
  4535.  this.queued = this.shallow = false;
  4536. }
  4537.  
  4538. /**
  4539. * Evaluate the getter, and re-collect dependencies.
  4540. */
  4541.  
  4542. Watcher.prototype.get = function () {
  4543.  this.beforeGet();
  4544.  var scope = this.scope || this.vm;
  4545.  var value;
  4546.  try {
  4547.    value = this.getter.call(scope, scope);
  4548.  } catch (e) {
  4549.    if (process.env.NODE_ENV !== 'production' && config.warnExpressionErrors) {
  4550.      warn('Error when evaluating expression ' + '"' + this.expression + '": ' + e.toString(), this.vm);
  4551.    }
  4552.  }
  4553.  // "touch" every property so they are all tracked as
  4554.  // dependencies for deep watching
  4555.  if (this.deep) {
  4556.    traverse(value);
  4557.  }
  4558.  if (this.preProcess) {
  4559.    value = this.preProcess(value);
  4560.  }
  4561.  if (this.filters) {
  4562.    value = scope._applyFilters(value, null, this.filters, false);
  4563.  }
  4564.  if (this.postProcess) {
  4565.    value = this.postProcess(value);
  4566.  }
  4567.  this.afterGet();
  4568.  return value;
  4569. };
  4570.  
  4571. /**
  4572. * Set the corresponding value with the setter.
  4573. *
  4574. * @param {*} value
  4575. */
  4576.  
  4577. Watcher.prototype.set = function (value) {
  4578.  var scope = this.scope || this.vm;
  4579.  if (this.filters) {
  4580.    value = scope._applyFilters(value, this.value, this.filters, true);
  4581.  }
  4582.  try {
  4583.    this.setter.call(scope, scope, value);
  4584.  } catch (e) {
  4585.    if (process.env.NODE_ENV !== 'production' && config.warnExpressionErrors) {
  4586.      warn('Error when evaluating setter ' + '"' + this.expression + '": ' + e.toString(), this.vm);
  4587.    }
  4588.  }
  4589.  // two-way sync for v-for alias
  4590.  var forContext = scope.$forContext;
  4591.  if (forContext && forContext.alias === this.expression) {
  4592.    if (forContext.filters) {
  4593.      process.env.NODE_ENV !== 'production' && warn('It seems you are using two-way binding on ' + 'a v-for alias (' + this.expression + '), and the ' + 'v-for has filters. This will not work properly. ' + 'Either remove the filters or use an array of ' + 'objects and bind to object properties instead.', this.vm);
  4594.      return;
  4595.    }
  4596.    forContext._withLock(function () {
  4597.      if (scope.$key) {
  4598.        // original is an object
  4599.        forContext.rawValue[scope.$key] = value;
  4600.      } else {
  4601.        forContext.rawValue.$set(scope.$index, value);
  4602.      }
  4603.    });
  4604.  }
  4605. };
  4606.  
  4607. /**
  4608. * Prepare for dependency collection.
  4609. */
  4610.  
  4611. Watcher.prototype.beforeGet = function () {
  4612.  Dep.target = this;
  4613. };
  4614.  
  4615. /**
  4616. * Add a dependency to this directive.
  4617. *
  4618. * @param {Dep} dep
  4619. */
  4620.  
  4621. Watcher.prototype.addDep = function (dep) {
  4622.  var id = dep.id;
  4623.  if (!this.newDepIds.has(id)) {
  4624.    this.newDepIds.add(id);
  4625.    this.newDeps.push(dep);
  4626.    if (!this.depIds.has(id)) {
  4627.      dep.addSub(this);
  4628.    }
  4629.  }
  4630. };
  4631.  
  4632. /**
  4633. * Clean up for dependency collection.
  4634. */
  4635.  
  4636. Watcher.prototype.afterGet = function () {
  4637.  Dep.target = null;
  4638.  var i = this.deps.length;
  4639.  while (i--) {
  4640.    var dep = this.deps[i];
  4641.    if (!this.newDepIds.has(dep.id)) {
  4642.      dep.removeSub(this);
  4643.    }
  4644.  }
  4645.  var tmp = this.depIds;
  4646.  this.depIds = this.newDepIds;
  4647.  this.newDepIds = tmp;
  4648.  this.newDepIds.clear();
  4649.  tmp = this.deps;
  4650.  this.deps = this.newDeps;
  4651.  this.newDeps = tmp;
  4652.  this.newDeps.length = 0;
  4653. };
  4654.  
  4655. /**
  4656. * Subscriber interface.
  4657. * Will be called when a dependency changes.
  4658. *
  4659. * @param {Boolean} shallow
  4660. */
  4661.  
  4662. Watcher.prototype.update = function (shallow) {
  4663.  if (this.lazy) {
  4664.    this.dirty = true;
  4665.  } else if (this.sync || !config.async) {
  4666.    this.run();
  4667.  } else {
  4668.    // if queued, only overwrite shallow with non-shallow,
  4669.    // but not the other way around.
  4670.    this.shallow = this.queued ? shallow ? this.shallow : false : !!shallow;
  4671.    this.queued = true;
  4672.    // record before-push error stack in debug mode
  4673.    /* istanbul ignore if */
  4674.    if (process.env.NODE_ENV !== 'production' && config.debug) {
  4675.      this.prevError = new Error('[vue] async stack trace');
  4676.    }
  4677.    pushWatcher(this);
  4678.  }
  4679. };
  4680.  
  4681. /**
  4682. * Batcher job interface.
  4683. * Will be called by the batcher.
  4684. */
  4685.  
  4686. Watcher.prototype.run = function () {
  4687.  if (this.active) {
  4688.    var value = this.get();
  4689.    if (value !== this.value ||
  4690.    // Deep watchers and watchers on Object/Arrays should fire even
  4691.    // when the value is the same, because the value may
  4692.    // have mutated; but only do so if this is a
  4693.    // non-shallow update (caused by a vm digest).
  4694.    (isObject(value) || this.deep) && !this.shallow) {
  4695.      // set new value
  4696.      var oldValue = this.value;
  4697.      this.value = value;
  4698.      // in debug + async mode, when a watcher callbacks
  4699.      // throws, we also throw the saved before-push error
  4700.      // so the full cross-tick stack trace is available.
  4701.      var prevError = this.prevError;
  4702.      /* istanbul ignore if */
  4703.      if (process.env.NODE_ENV !== 'production' && config.debug && prevError) {
  4704.        this.prevError = null;
  4705.        try {
  4706.          this.cb.call(this.vm, value, oldValue);
  4707.        } catch (e) {
  4708.          nextTick(function () {
  4709.            throw prevError;
  4710.          }, 0);
  4711.          throw e;
  4712.        }
  4713.      } else {
  4714.        this.cb.call(this.vm, value, oldValue);
  4715.      }
  4716.    }
  4717.    this.queued = this.shallow = false;
  4718.  }
  4719. };
  4720.  
  4721. /**
  4722. * Evaluate the value of the watcher.
  4723. * This only gets called for lazy watchers.
  4724. */
  4725.  
  4726. Watcher.prototype.evaluate = function () {
  4727.  // avoid overwriting another watcher that is being
  4728.  // collected.
  4729.  var current = Dep.target;
  4730.  this.value = this.get();
  4731.  this.dirty = false;
  4732.  Dep.target = current;
  4733. };
  4734.  
  4735. /**
  4736. * Depend on all deps collected by this watcher.
  4737. */
  4738.  
  4739. Watcher.prototype.depend = function () {
  4740.  var i = this.deps.length;
  4741.  while (i--) {
  4742.    this.deps[i].depend();
  4743.  }
  4744. };
  4745.  
  4746. /**
  4747. * Remove self from all dependencies' subcriber list.
  4748. */
  4749.  
  4750. Watcher.prototype.teardown = function () {
  4751.  if (this.active) {
  4752.    // remove self from vm's watcher list
  4753.    // this is a somewhat expensive operation so we skip it
  4754.    // if the vm is being destroyed or is performing a v-for
  4755.    // re-render (the watcher list is then filtered by v-for).
  4756.    if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {
  4757.      this.vm._watchers.$remove(this);
  4758.    }
  4759.    var i = this.deps.length;
  4760.    while (i--) {
  4761.      this.deps[i].removeSub(this);
  4762.    }
  4763.    this.active = false;
  4764.    this.vm = this.cb = this.value = null;
  4765.  }
  4766. };
  4767.  
  4768. /**
  4769. * Recrusively traverse an object to evoke all converted
  4770. * getters, so that every nested property inside the object
  4771. * is collected as a "deep" dependency.
  4772. *
  4773. * @param {*} val
  4774. */
  4775.  
  4776. var seenObjects = new _Set();
  4777. function traverse(val, seen) {
  4778.  var i = undefined,
  4779.      keys = undefined;
  4780.  if (!seen) {
  4781.    seen = seenObjects;
  4782.    seen.clear();
  4783.  }
  4784.  var isA = isArray(val);
  4785.  var isO = isObject(val);
  4786.  if ((isA || isO) && Object.isExtensible(val)) {
  4787.    if (val.__ob__) {
  4788.      var depId = val.__ob__.dep.id;
  4789.      if (seen.has(depId)) {
  4790.        return;
  4791.      } else {
  4792.        seen.add(depId);
  4793.      }
  4794.    }
  4795.    if (isA) {
  4796.      i = val.length;
  4797.      while (i--) traverse(val[i], seen);
  4798.    } else if (isO) {
  4799.      keys = Object.keys(val);
  4800.      i = keys.length;
  4801.      while (i--) traverse(val[keys[i]], seen);
  4802.    }
  4803.  }
  4804. }
  4805.  
  4806. var text$1 = {
  4807.  
  4808.  bind: function bind() {
  4809.    this.attr = this.el.nodeType === 3 ? 'data' : 'textContent';
  4810.  },
  4811.  
  4812.  update: function update(value) {
  4813.    this.el[this.attr] = _toString(value);
  4814.  }
  4815. };
  4816.  
  4817. var templateCache = new Cache(1000);
  4818. var idSelectorCache = new Cache(1000);
  4819.  
  4820. var map = {
  4821.  efault: [0, '', ''],
  4822.  legend: [1, '<fieldset>', '</fieldset>'],
  4823.  tr: [2, '<table><tbody>', '</tbody></table>'],
  4824.  col: [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>']
  4825. };
  4826.  
  4827. map.td = map.th = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
  4828.  
  4829. map.option = map.optgroup = [1, '<select multiple="multiple">', '</select>'];
  4830.  
  4831. map.thead = map.tbody = map.colgroup = map.caption = map.tfoot = [1, '<table>', '</table>'];
  4832.  
  4833. map.g = map.defs = map.symbol = map.use = map.image = map.text = map.circle = map.ellipse = map.line = map.path = map.polygon = map.polyline = map.rect = [1, '<svg ' + 'xmlns="http://www.w3.org/2000/svg" ' + 'xmlns:xlink="http://www.w3.org/1999/xlink" ' + 'xmlns:ev="http://www.w3.org/2001/xml-events"' + 'version="1.1">', '</svg>'];
  4834.  
  4835. /**
  4836.  * Check if a node is a supported template node with a
  4837.  * DocumentFragment content.
  4838.  *
  4839.  * @param {Node} node
  4840.  * @return {Boolean}
  4841.  */
  4842.  
  4843. function isRealTemplate(node) {
  4844.   return isTemplate(node) && isFragment(node.content);
  4845. }
  4846.  
  4847. var tagRE$1 = /<([\w:-]+)/;
  4848. var entityRE = /&#?\w+?;/;
  4849. var commentRE = /<!--/;
  4850.  
  4851. /**
  4852.  * Convert a string template to a DocumentFragment.
  4853.  * Determines correct wrapping by tag types. Wrapping
  4854.  * strategy found in jQuery & component/domify.
  4855.  *
  4856.  * @param {String} templateString
  4857.  * @param {Boolean} raw
  4858.  * @return {DocumentFragment}
  4859.  */
  4860.  
  4861. function stringToFragment(templateString, raw) {
  4862.   // try a cache hit first
  4863.   var cacheKey = raw ? templateString : templateString.trim();
  4864.   var hit = templateCache.get(cacheKey);
  4865.   if (hit) {
  4866.     return hit;
  4867.   }
  4868.  
  4869.   var frag = document.createDocumentFragment();
  4870.   var tagMatch = templateString.match(tagRE$1);
  4871.   var entityMatch = entityRE.test(templateString);
  4872.   var commentMatch = commentRE.test(templateString);
  4873.  
  4874.   if (!tagMatch && !entityMatch && !commentMatch) {
  4875.     // text only, return a single text node.
  4876.     frag.appendChild(document.createTextNode(templateString));
  4877.   } else {
  4878.     var tag = tagMatch && tagMatch[1];
  4879.     var wrap = map[tag] || map.efault;
  4880.     var depth = wrap[0];
  4881.     var prefix = wrap[1];
  4882.     var suffix = wrap[2];
  4883.     var node = document.createElement('div');
  4884.  
  4885.     node.innerHTML = prefix + templateString + suffix;
  4886.     while (depth--) {
  4887.       node = node.lastChild;
  4888.     }
  4889.  
  4890.     var child;
  4891.     /* eslint-disable no-cond-assign */
  4892.     while (child = node.firstChild) {
  4893.       /* eslint-enable no-cond-assign */
  4894.       frag.appendChild(child);
  4895.     }
  4896.   }
  4897.   if (!raw) {
  4898.     trimNode(frag);
  4899.   }
  4900.   templateCache.put(cacheKey, frag);
  4901.   return frag;
  4902. }
  4903.  
  4904. /**
  4905.  * Convert a template node to a DocumentFragment.
  4906.  *
  4907.  * @param {Node} node
  4908.  * @return {DocumentFragment}
  4909.  */
  4910.  
  4911. function nodeToFragment(node) {
  4912.   // if its a template tag and the browser supports it,
  4913.   // its content is already a document fragment. However, iOS Safari has
  4914.   // bug when using directly cloned template content with touch
  4915.   // events and can cause crashes when the nodes are removed from DOM, so we
  4916.   // have to treat template elements as string templates. (#2805)
  4917.   /* istanbul ignore if */
  4918.   if (isRealTemplate(node)) {
  4919.     return stringToFragment(node.innerHTML);
  4920.   }
  4921.   // script template
  4922.   if (node.tagName === 'SCRIPT') {
  4923.     return stringToFragment(node.textContent);
  4924.   }
  4925.   // normal node, clone it to avoid mutating the original
  4926.   var clonedNode = cloneNode(node);
  4927.   var frag = document.createDocumentFragment();
  4928.   var child;
  4929.   /* eslint-disable no-cond-assign */
  4930.   while (child = clonedNode.firstChild) {
  4931.     /* eslint-enable no-cond-assign */
  4932.     frag.appendChild(child);
  4933.   }
  4934.   trimNode(frag);
  4935.   return frag;
  4936. }
  4937.  
  4938. // Test for the presence of the Safari template cloning bug
  4939. // https://bugs.webkit.org/showug.cgi?id=137755
  4940. var hasBrokenTemplate = (function () {
  4941.   /* istanbul ignore else */
  4942.   if (inBrowser) {
  4943.     var a = document.createElement('div');
  4944.     a.innerHTML = '<template>1</template>';
  4945.     return !a.cloneNode(true).firstChild.innerHTML;
  4946.   } else {
  4947.     return false;
  4948.   }
  4949. })();
  4950.  
  4951. // Test for IE10/11 textarea placeholder clone bug
  4952. var hasTextareaCloneBug = (function () {
  4953.   /* istanbul ignore else */
  4954.   if (inBrowser) {
  4955.     var t = document.createElement('textarea');
  4956.     t.placeholder = 't';
  4957.     return t.cloneNode(true).value === 't';
  4958.   } else {
  4959.     return false;
  4960.   }
  4961. })();
  4962.  
  4963. /**
  4964.  * 1. Deal with Safari cloning nested <template> bug by
  4965.  *    manually cloning all template instances.
  4966.  * 2. Deal with IE10/11 textarea placeholder bug by setting
  4967.  *    the correct value after cloning.
  4968.  *
  4969.  * @param {Element|DocumentFragment} node
  4970.  * @return {Element|DocumentFragment}
  4971.  */
  4972.  
  4973. function cloneNode(node) {
  4974.   /* istanbul ignore if */
  4975.   if (!node.querySelectorAll) {
  4976.     return node.cloneNode();
  4977.   }
  4978.   var res = node.cloneNode(true);
  4979.   var i, original, cloned;
  4980.   /* istanbul ignore if */
  4981.   if (hasBrokenTemplate) {
  4982.     var tempClone = res;
  4983.     if (isRealTemplate(node)) {
  4984.       node = node.content;
  4985.       tempClone = res.content;
  4986.     }
  4987.     original = node.querySelectorAll('template');
  4988.     if (original.length) {
  4989.       cloned = tempClone.querySelectorAll('template');
  4990.       i = cloned.length;
  4991.       while (i--) {
  4992.         cloned[i].parentNode.replaceChild(cloneNode(original[i]), cloned[i]);
  4993.       }
  4994.     }
  4995.   }
  4996.   /* istanbul ignore if */
  4997.   if (hasTextareaCloneBug) {
  4998.     if (node.tagName === 'TEXTAREA') {
  4999.       res.value = node.value;
  5000.     } else {
  5001.       original = node.querySelectorAll('textarea');
  5002.       if (original.length) {
  5003.         cloned = res.querySelectorAll('textarea');
  5004.         i = cloned.length;
  5005.         while (i--) {
  5006.           cloned[i].value = original[i].value;
  5007.         }
  5008.       }
  5009.     }
  5010.   }
  5011.   return res;
  5012. }
  5013.  
  5014. /**
  5015.  * Process the template option and normalizes it into a
  5016.  * a DocumentFragment that can be used as a partial or a
  5017.  * instance template.
  5018.  *
  5019.  * @param {*} template
  5020.  *        Possible values include:
  5021.  *        - DocumentFragment object
  5022.  *        - Node object of type Template
  5023.  *        - id selector: '#some-template-id'
  5024.  *        - template string: '<div><span>{{msg}}</span></div>'
  5025.  * @param {Boolean} shouldClone
  5026.  * @param {Boolean} raw
  5027.  *        inline HTML interpolation. Do not check for id
  5028.  *        selector and keep whitespace in the string.
  5029.  * @return {DocumentFragment|undefined}
  5030.  */
  5031.  
  5032. function parseTemplate(template, shouldClone, raw) {
  5033.   var node, frag;
  5034.  
  5035.   // if the template is already a document fragment,
  5036.   // do nothing
  5037.   if (isFragment(template)) {
  5038.     trimNode(template);
  5039.     return shouldClone ? cloneNode(template) : template;
  5040.   }
  5041.  
  5042.   if (typeof template === 'string') {
  5043.     // id selector
  5044.     if (!raw && template.charAt(0) === '#') {
  5045.       // id selector can be cached too
  5046.       frag = idSelectorCache.get(template);
  5047.       if (!frag) {
  5048.         node = document.getElementById(template.slice(1));
  5049.         if (node) {
  5050.           frag = nodeToFragment(node);
  5051.           // save selector to cache
  5052.           idSelectorCache.put(template, frag);
  5053.         }
  5054.       }
  5055.     } else {
  5056.       // normal string template
  5057.       frag = stringToFragment(template, raw);
  5058.     }
  5059.   } else if (template.nodeType) {
  5060.     // a direct node
  5061.     frag = nodeToFragment(template);
  5062.   }
  5063.  
  5064.   return frag && shouldClone ? cloneNode(frag) : frag;
  5065. }
  5066.  
  5067. var template = Object.freeze({
  5068.   cloneNode: cloneNode,
  5069.   parseTemplate: parseTemplate
  5070. });
  5071.  
  5072. var html = {
  5073.  
  5074.   bind: function bind() {
  5075.     // a comment node means this is a binding for
  5076.     // {{{ inline unescaped html }}}
  5077.     if (this.el.nodeType === 8) {
  5078.       // hold nodes
  5079.       this.nodes = [];
  5080.       // replace the placeholder with proper anchor
  5081.       this.anchor = createAnchor('v-html');
  5082.       replace(this.el, this.anchor);
  5083.     }
  5084.   },
  5085.  
  5086.   update: function update(value) {
  5087.     value = _toString(value);
  5088.     if (this.nodes) {
  5089.       this.swap(value);
  5090.     } else {
  5091.       this.el.innerHTML = value;
  5092.     }
  5093.   },
  5094.  
  5095.   swap: function swap(value) {
  5096.     // remove old nodes
  5097.     var i = this.nodes.length;
  5098.     while (i--) {
  5099.       remove(this.nodes[i]);
  5100.     }
  5101.     // convert new value to a fragment
  5102.     // do not attempt to retrieve from id selector
  5103.     var frag = parseTemplate(value, true, true);
  5104.     // save a reference to these nodes so we can remove later
  5105.     this.nodes = toArray(frag.childNodes);
  5106.     before(frag, this.anchor);
  5107.   }
  5108. };
  5109.  
  5110. /**
  5111.  * Abstraction for a partially-compiled fragment.
  5112.  * Can optionally compile content with a child scope.
  5113.  *
  5114.  * @param {Function} linker
  5115.  * @param {Vue} vm
  5116.  * @param {DocumentFragment} frag
  5117.  * @param {Vue} [host]
  5118.  * @param {Object} [scope]
  5119.  * @param {Fragment} [parentFrag]
  5120.  */
  5121. function Fragment(linker, vm, frag, host, scope, parentFrag) {
  5122.   this.children = [];
  5123.   this.childFrags = [];
  5124.   this.vm = vm;
  5125.   this.scope = scope;
  5126.   this.inserted = false;
  5127.   this.parentFrag = parentFrag;
  5128.   if (parentFrag) {
  5129.     parentFrag.childFrags.push(this);
  5130.   }
  5131.   this.unlink = linker(vm, frag, host, scope, this);
  5132.   var single = this.single = frag.childNodes.length === 1 &&
  5133.   // do not go single mode if the only node is an anchor
  5134.   !frag.childNodes[0].__v_anchor;
  5135.   if (single) {
  5136.     this.node = frag.childNodes[0];
  5137.     this.before = singleBefore;
  5138.     this.remove = singleRemove;
  5139.   } else {
  5140.     this.node = createAnchor('fragment-start');
  5141.     this.end = createAnchor('fragment-end');
  5142.     this.frag = frag;
  5143.     prepend(this.node, frag);
  5144.     frag.appendChild(this.end);
  5145.     this.before = multiBefore;
  5146.     this.remove = multiRemove;
  5147.   }
  5148.   this.node.__v_frag = this;
  5149. }
  5150.  
  5151. /**
  5152.  * Call attach/detach for all components contained within
  5153.  * this fragment. Also do so recursively for all child
  5154.  * fragments.
  5155.  *
  5156.  * @param {Function} hook
  5157.  */
  5158.  
  5159. Fragment.prototype.callHook = function (hook) {
  5160.   var i, l;
  5161.   for (i = 0, l = this.childFrags.length; i < l; i++) {
  5162.     this.childFrags[i].callHook(hook);
  5163.   }
  5164.   for (i = 0, l = this.children.length; i < l; i++) {
  5165.     hook(this.children[i]);
  5166.   }
  5167. };
  5168.  
  5169. /**
  5170.  * Insert fragment before target, single node version
  5171.  *
  5172.  * @param {Node} target
  5173.  * @param {Boolean} withTransition
  5174.  */
  5175.  
  5176. function singleBefore(target, withTransition) {
  5177.   this.inserted = true;
  5178.   var method = withTransition !== false ? beforeWithTransition : before;
  5179.   method(this.node, target, this.vm);
  5180.   if (inDoc(this.node)) {
  5181.     this.callHook(attach);
  5182.   }
  5183. }
  5184.  
  5185. /**
  5186.  * Remove fragment, single node version
  5187.  */
  5188.  
  5189. function singleRemove() {
  5190.   this.inserted = false;
  5191.   var shouldCallRemove = inDoc(this.node);
  5192.   var self = this;
  5193.   this.beforeRemove();
  5194.   removeWithTransition(this.node, this.vm, function () {
  5195.     if (shouldCallRemove) {
  5196.       self.callHook(detach);
  5197.     }
  5198.     self.destroy();
  5199.   });
  5200. }
  5201.  
  5202. /**
  5203.  * Insert fragment before target, multi-nodes version
  5204.  *
  5205.  * @param {Node} target
  5206.  * @param {Boolean} withTransition
  5207.  */
  5208.  
  5209. function multiBefore(target, withTransition) {
  5210.   this.inserted = true;
  5211.   var vm = this.vm;
  5212.   var method = withTransition !== false ? beforeWithTransition : before;
  5213.   mapNodeRange(this.node, this.end, function (node) {
  5214.     method(node, target, vm);
  5215.   });
  5216.   if (inDoc(this.node)) {
  5217.     this.callHook(attach);
  5218.   }
  5219. }
  5220.  
  5221. /**
  5222.  * Remove fragment, multi-nodes version
  5223.  */
  5224.  
  5225. function multiRemove() {
  5226.   this.inserted = false;
  5227.   var self = this;
  5228.   var shouldCallRemove = inDoc(this.node);
  5229.   this.beforeRemove();
  5230.   removeNodeRange(this.node, this.end, this.vm, this.frag, function () {
  5231.     if (shouldCallRemove) {
  5232.       self.callHook(detach);
  5233.     }
  5234.     self.destroy();
  5235.   });
  5236. }
  5237.  
  5238. /**
  5239.  * Prepare the fragment for removal.
  5240.  */
  5241.  
  5242. Fragment.prototype.beforeRemove = function () {
  5243.   var i, l;
  5244.   for (i = 0, l = this.childFrags.length; i < l; i++) {
  5245.     // call the same method recursively on child
  5246.     // fragments, depth-first
  5247.     this.childFrags[i].beforeRemove(false);
  5248.   }
  5249.   for (i = 0, l = this.children.length; i < l; i++) {
  5250.     // Call destroy for all contained instances,
  5251.     // with remove:false and defer:true.
  5252.     // Defer is necessary because we need to
  5253.     // keep the children to call detach hooks
  5254.     // on them.
  5255.     this.children[i].$destroy(false, true);
  5256.   }
  5257.   var dirs = this.unlink.dirs;
  5258.   for (i = 0, l = dirs.length; i < l; i++) {
  5259.     // disable the watchers on all the directives
  5260.     // so that the rendered content stays the same
  5261.     // during removal.
  5262.     dirs[i]._watcher && dirs[i]._watcher.teardown();
  5263.   }
  5264. };
  5265.  
  5266. /**
  5267.  * Destroy the fragment.
  5268.  */
  5269.  
  5270. Fragment.prototype.destroy = function () {
  5271.   if (this.parentFrag) {
  5272.     this.parentFrag.childFrags.$remove(this);
  5273.   }
  5274.   this.node.__v_frag = null;
  5275.   this.unlink();
  5276. };
  5277.  
  5278. /**
  5279.  * Call attach hook for a Vue instance.
  5280.  *
  5281.  * @param {Vue} child
  5282.  */
  5283.  
  5284. function attach(child) {
  5285.   if (!child._isAttached && inDoc(child.$el)) {
  5286.     child._callHook('attached');
  5287.   }
  5288. }
  5289.  
  5290. /**
  5291.  * Call detach hook for a Vue instance.
  5292.  *
  5293.  * @param {Vue} child
  5294.  */
  5295.  
  5296. function detach(child) {
  5297.   if (child._isAttached && !inDoc(child.$el)) {
  5298.     child._callHook('detached');
  5299.   }
  5300. }
  5301.  
  5302. var linkerCache = new Cache(5000);
  5303.  
  5304. /**
  5305.  * A factory that can be used to create instances of a
  5306.  * fragment. Caches the compiled linker if possible.
  5307.  *
  5308.  * @param {Vue} vm
  5309.  * @param {Element|String} el
  5310.  */
  5311. function FragmentFactory(vm, el) {
  5312.   this.vm = vm;
  5313.   var template;
  5314.   var isString = typeof el === 'string';
  5315.   if (isString || isTemplate(el) && !el.hasAttribute('v-if')) {
  5316.     template = parseTemplate(el, true);
  5317.   } else {
  5318.     template = document.createDocumentFragment();
  5319.     template.appendChild(el);
  5320.   }
  5321.   this.template = template;
  5322.   // linker can be cached, but only for components
  5323.   var linker;
  5324.   var cid = vm.constructor.cid;
  5325.   if (cid > 0) {
  5326.     var cacheId = cid + (isString ? el : getOuterHTML(el));
  5327.     linker = linkerCache.get(cacheId);
  5328.     if (!linker) {
  5329.       linker = compile(template, vm.$options, true);
  5330.       linkerCache.put(cacheId, linker);
  5331.     }
  5332.   } else {
  5333.     linker = compile(template, vm.$options, true);
  5334.   }
  5335.   this.linker = linker;
  5336. }
  5337.  
  5338. /**
  5339.  * Create a fragment instance with given host and scope.
  5340.  *
  5341.  * @param {Vue} host
  5342.  * @param {Object} scope
  5343.  * @param {Fragment} parentFrag
  5344.  */
  5345.  
  5346. FragmentFactory.prototype.create = function (host, scope, parentFrag) {
  5347.   var frag = cloneNode(this.template);
  5348.   return new Fragment(this.linker, this.vm, frag, host, scope, parentFrag);
  5349. };
  5350.  
  5351. var ON = 700;
  5352. var MODEL = 800;
  5353. var BIND = 850;
  5354. var TRANSITION = 1100;
  5355. var EL = 1500;
  5356. var COMPONENT = 1500;
  5357. var PARTIAL = 1750;
  5358. var IF = 2100;
  5359. var FOR = 2200;
  5360. var SLOT = 2300;
  5361.  
  5362. var uid$3 = 0;
  5363.  
  5364. var vFor = {
  5365.  
  5366.   priority: FOR,
  5367.   terminal: true,
  5368.  
  5369.   params: ['track-by', 'stagger', 'enter-stagger', 'leave-stagger'],
  5370.  
  5371.   bind: function bind() {
  5372.     // support "item in/of items" syntax
  5373.     var inMatch = this.expression.match(/(.*) (?:in|of) (.*)/);
  5374.     if (inMatch) {
  5375.       var itMatch = inMatch[1].match(/\((.*),(.*)\)/);
  5376.       if (itMatch) {
  5377.         this.iterator = itMatch[1].trim();
  5378.         this.alias = itMatch[2].trim();
  5379.       } else {
  5380.         this.alias = inMatch[1].trim();
  5381.       }
  5382.       this.expression = inMatch[2];
  5383.     }
  5384.  
  5385.     if (!this.alias) {
  5386.       process.env.NODE_ENV !== 'production' && warn('Invalid v-for expression "' + this.descriptor.raw + '": ' + 'alias is required.', this.vm);
  5387.       return;
  5388.     }
  5389.  
  5390.     // uid as a cache identifier
  5391.     this.id = '__v-for__' + ++uid$3;
  5392.  
  5393.     // check if this is an option list,
  5394.     // so that we know if we need to update the <select>'s
  5395.     // v-model when the option list has changed.
  5396.     // because v-model has a lower priority than v-for,
  5397.     // the v-model is not bound here yet, so we have to
  5398.     // retrive it in the actual updateModel() function.
  5399.     var tag = this.el.tagName;
  5400.     this.isOption = (tag === 'OPTION' || tag === 'OPTGROUP') && this.el.parentNode.tagName === 'SELECT';
  5401.  
  5402.     // setup anchor nodes
  5403.     this.start = createAnchor('v-for-start');
  5404.     this.end = createAnchor('v-for-end');
  5405.     replace(this.el, this.end);
  5406.     before(this.start, this.end);
  5407.  
  5408.     // cache
  5409.     this.cache = Object.create(null);
  5410.  
  5411.     // fragment factory
  5412.     this.factory = new FragmentFactory(this.vm, this.el);
  5413.   },
  5414.  
  5415.   update: function update(data) {
  5416.     this.diff(data);
  5417.     this.updateRef();
  5418.     this.updateModel();
  5419.   },
  5420.  
  5421.   /**
  5422.    * Diff, based on new data and old data, determine the
  5423.    * minimum amount of DOM manipulations needed to make the
  5424.    * DOM reflect the new data Array.
  5425.    *
  5426.    * The algorithm diffs the new data Array by storing a
  5427.    * hidden reference to an owner vm instance on previously
  5428.    * seen data. This allows us to achieve O(n) which is
  5429.    * better than a levenshtein distance based algorithm,
  5430.    * which is O(m * n).
  5431.    *
  5432.    * @param {Array} data
  5433.    */
  5434.  
  5435.   diff: function diff(data) {
  5436.     // check if the Array was converted from an Object
  5437.     var item = data[0];
  5438.     var convertedFromObject = this.fromObject = isObject(item) && hasOwn(item, '$key') && hasOwn(item, '$value');
  5439.  
  5440.     var trackByKey = this.params.trackBy;
  5441.     var oldFrags = this.frags;
  5442.     var frags = this.frags = new Array(data.length);
  5443.     var alias = this.alias;
  5444.     var iterator = this.iterator;
  5445.     var start = this.start;
  5446.     var end = this.end;
  5447.     var inDocument = inDoc(start);
  5448.     var init = !oldFrags;
  5449.     var i, l, frag, key, value, primitive;
  5450.  
  5451.     // First pass, go through the new Array and fill up
  5452.     // the new frags array. If a piece of data has a cached
  5453.     // instance for it, we reuse it. Otherwise build a new
  5454.     // instance.
  5455.     for (i = 0, l = data.length; i < l; i++) {
  5456.       item = data[i];
  5457.       key = convertedFromObject ? item.$key : null;
  5458.       value = convertedFromObject ? item.$value : item;
  5459.       primitive = !isObject(value);
  5460.       frag = !init && this.getCachedFrag(value, i, key);
  5461.       if (frag) {
  5462.         // reusable fragment
  5463.         frag.reused = true;
  5464.         // update $index
  5465.         frag.scope.$index = i;
  5466.         // update $key
  5467.         if (key) {
  5468.           frag.scope.$key = key;
  5469.         }
  5470.         // update iterator
  5471.         if (iterator) {
  5472.           frag.scope[iterator] = key !== null ? key : i;
  5473.         }
  5474.         // update data for track-by, object repeat &
  5475.         // primitive values.
  5476.         if (trackByKey || convertedFromObject || primitive) {
  5477.           withoutConversion(function () {
  5478.             frag.scope[alias] = value;
  5479.           });
  5480.         }
  5481.       } else {
  5482.         // new isntance
  5483.         frag = this.create(value, alias, i, key);
  5484.         frag.fresh = !init;
  5485.       }
  5486.       frags[i] = frag;
  5487.       if (init) {
  5488.         frag.before(end);
  5489.       }
  5490.     }
  5491.  
  5492.     // we're done for the initial render.
  5493.     if (init) {
  5494.       return;
  5495.     }
  5496.  
  5497.     // Second pass, go through the old fragments and
  5498.     // destroy those who are not reused (and remove them
  5499.     // from cache)
  5500.     var removalIndex = 0;
  5501.     var totalRemoved = oldFrags.length - frags.length;
  5502.     // when removing a large number of fragments, watcher removal
  5503.     // turns out to be a perf bottleneck, so we batch the watcher
  5504.     // removals into a single filter call!
  5505.     this.vm._vForRemoving = true;
  5506.     for (i = 0, l = oldFrags.length; i < l; i++) {
  5507.       frag = oldFrags[i];
  5508.       if (!frag.reused) {
  5509.         this.deleteCachedFrag(frag);
  5510.         this.remove(frag, removalIndex++, totalRemoved, inDocument);
  5511.       }
  5512.     }
  5513.     this.vm._vForRemoving = false;
  5514.     if (removalIndex) {
  5515.       this.vm._watchers = this.vm._watchers.filter(function (w) {
  5516.         return w.active;
  5517.       });
  5518.     }
  5519.  
  5520.     // Final pass, move/insert new fragments into the
  5521.     // right place.
  5522.     var targetPrev, prevEl, currentPrev;
  5523.     var insertionIndex = 0;
  5524.     for (i = 0, l = frags.length; i < l; i++) {
  5525.       frag = frags[i];
  5526.       // this is the frag that we should be after
  5527.       targetPrev = frags[i - 1];
  5528.       prevEl = targetPrev ? targetPrev.staggerCb ? targetPrev.staggerAnchor : targetPrev.end || targetPrev.node : start;
  5529.       if (frag.reused && !frag.staggerCb) {
  5530.         currentPrev = findPrevFrag(frag, start, this.id);
  5531.         if (currentPrev !== targetPrev && (!currentPrev ||
  5532.         // optimization for moving a single item.
  5533.         // thanks to suggestions by @livoras in #1807
  5534.         findPrevFrag(currentPrev, start, this.id) !== targetPrev)) {
  5535.           this.move(frag, prevEl);
  5536.         }
  5537.       } else {
  5538.         // new instance, or still in stagger.
  5539.         // insert with updated stagger index.
  5540.         this.insert(frag, insertionIndex++, prevEl, inDocument);
  5541.       }
  5542.       frag.reused = frag.fresh = false;
  5543.     }
  5544.   },
  5545.  
  5546.   /**
  5547.    * Create a new fragment instance.
  5548.    *
  5549.    * @param {*} value
  5550.    * @param {String} alias
  5551.    * @param {Number} index
  5552.    * @param {String} [key]
  5553.    * @return {Fragment}
  5554.    */
  5555.  
  5556.   create: function create(value, alias, index, key) {
  5557.     var host = this._host;
  5558.     // create iteration scope
  5559.     var parentScope = this._scope || this.vm;
  5560.     var scope = Object.create(parentScope);
  5561.     // ref holder for the scope
  5562.     scope.$refs = Object.create(parentScope.$refs);
  5563.     scope.$els = Object.create(parentScope.$els);
  5564.     // make sure point $parent to parent scope
  5565.     scope.$parent = parentScope;
  5566.     // for two-way binding on alias
  5567.     scope.$forContext = this;
  5568.     // define scope properties
  5569.     // important: define the scope alias without forced conversion
  5570.     // so that frozen data structures remain non-reactive.
  5571.     withoutConversion(function () {
  5572.       defineReactive(scope, alias, value);
  5573.     });
  5574.     defineReactive(scope, '$index', index);
  5575.     if (key) {
  5576.       defineReactive(scope, '$key', key);
  5577.     } else if (scope.$key) {
  5578.       // avoid accidental fallback
  5579.       def(scope, '$key', null);
  5580.     }
  5581.     if (this.iterator) {
  5582.       defineReactive(scope, this.iterator, key !== null ? key : index);
  5583.     }
  5584.     var frag = this.factory.create(host, scope, this._frag);
  5585.     frag.forId = this.id;
  5586.     this.cacheFrag(value, frag, index, key);
  5587.     return frag;
  5588.   },
  5589.  
  5590.   /**
  5591.    * Update the v-ref on owner vm.
  5592.    */
  5593.  
  5594.   updateRef: function updateRef() {
  5595.     var ref = this.descriptor.ref;
  5596.     if (!ref) return;
  5597.     var hash = (this._scope || this.vm).$refs;
  5598.     var refs;
  5599.     if (!this.fromObject) {
  5600.       refs = this.frags.map(findVmFromFrag);
  5601.     } else {
  5602.       refs = {};
  5603.       this.frags.forEach(function (frag) {
  5604.         refs[frag.scope.$key] = findVmFromFrag(frag);
  5605.       });
  5606.     }
  5607.     hash[ref] = refs;
  5608.   },
  5609.  
  5610.   /**
  5611.    * For option lists, update the containing v-model on
  5612.    * parent <select>.
  5613.    */
  5614.  
  5615.   updateModel: function updateModel() {
  5616.     if (this.isOption) {
  5617.       var parent = this.start.parentNode;
  5618.       var model = parent && parent.__v_model;
  5619.       if (model) {
  5620.         model.forceUpdate();
  5621.       }
  5622.     }
  5623.   },
  5624.  
  5625.   /**
  5626.    * Insert a fragment. Handles staggering.
  5627.    *
  5628.    * @param {Fragment} frag
  5629.    * @param {Number} index
  5630.    * @param {Node} prevEl
  5631.    * @param {Boolean} inDocument
  5632.    */
  5633.  
  5634.   insert: function insert(frag, index, prevEl, inDocument) {
  5635.     if (frag.staggerCb) {
  5636.       frag.staggerCb.cancel();
  5637.       frag.staggerCb = null;
  5638.     }
  5639.     var staggerAmount = this.getStagger(frag, index, null, 'enter');
  5640.     if (inDocument && staggerAmount) {
  5641.       // create an anchor and insert it synchronously,
  5642.       // so that we can resolve the correct order without
  5643.       // worrying about some elements not inserted yet
  5644.       var anchor = frag.staggerAnchor;
  5645.       if (!anchor) {
  5646.         anchor = frag.staggerAnchor = createAnchor('stagger-anchor');
  5647.         anchor.__v_frag = frag;
  5648.       }
  5649.       after(anchor, prevEl);
  5650.       var op = frag.staggerCb = cancellable(function () {
  5651.         frag.staggerCb = null;
  5652.         frag.before(anchor);
  5653.         remove(anchor);
  5654.       });
  5655.       setTimeout(op, staggerAmount);
  5656.     } else {
  5657.       var target = prevEl.nextSibling;
  5658.       /* istanbul ignore if */
  5659.       if (!target) {
  5660.         // reset end anchor position in case the position was messed up
  5661.         // by an external drag-n-drop library.
  5662.         after(this.end, prevEl);
  5663.         target = this.end;
  5664.       }
  5665.       frag.before(target);
  5666.     }
  5667.   },
  5668.  
  5669.   /**
  5670.    * Remove a fragment. Handles staggering.
  5671.    *
  5672.    * @param {Fragment} frag
  5673.    * @param {Number} index
  5674.    * @param {Number} total
  5675.    * @param {Boolean} inDocument
  5676.    */
  5677.  
  5678.   remove: function remove(frag, index, total, inDocument) {
  5679.     if (frag.staggerCb) {
  5680.       frag.staggerCb.cancel();
  5681.       frag.staggerCb = null;
  5682.       // it's not possible for the same frag to be removed
  5683.       // twice, so if we have a pending stagger callback,
  5684.       // it means this frag is queued for enter but removed
  5685.       // before its transition started. Since it is already
  5686.       // destroyed, we can just leave it in detached state.
  5687.       return;
  5688.     }
  5689.     var staggerAmount = this.getStagger(frag, index, total, 'leave');
  5690.     if (inDocument && staggerAmount) {
  5691.       var op = frag.staggerCb = cancellable(function () {
  5692.         frag.staggerCb = null;
  5693.         frag.remove();
  5694.       });
  5695.       setTimeout(op, staggerAmount);
  5696.     } else {
  5697.       frag.remove();
  5698.     }
  5699.   },
  5700.  
  5701.   /**
  5702.    * Move a fragment to a new position.
  5703.    * Force no transition.
  5704.    *
  5705.    * @param {Fragment} frag
  5706.    * @param {Node} prevEl
  5707.    */
  5708.  
  5709.   move: function move(frag, prevEl) {
  5710.     // fix a common issue with Sortable:
  5711.     // if prevEl doesn't have nextSibling, this means it's
  5712.     // been dragged after the end anchor. Just re-position
  5713.     // the end anchor to the end of the container.
  5714.     /* istanbul ignore if */
  5715.     if (!prevEl.nextSibling) {
  5716.       this.end.parentNode.appendChild(this.end);
  5717.     }
  5718.     frag.before(prevEl.nextSibling, false);
  5719.   },
  5720.  
  5721.   /**
  5722.    * Cache a fragment using track-by or the object key.
  5723.    *
  5724.    * @param {*} value
  5725.    * @param {Fragment} frag
  5726.    * @param {Number} index
  5727.    * @param {String} [key]
  5728.    */
  5729.  
  5730.   cacheFrag: function cacheFrag(value, frag, index, key) {
  5731.     var trackByKey = this.params.trackBy;
  5732.     var cache = this.cache;
  5733.     var primitive = !isObject(value);
  5734.     var id;
  5735.     if (key || trackByKey || primitive) {
  5736.       id = getTrackByKey(index, key, value, trackByKey);
  5737.       if (!cache[id]) {
  5738.         cache[id] = frag;
  5739.       } else if (trackByKey !== '$index') {
  5740.         process.env.NODE_ENV !== 'production' && this.warnDuplicate(value);
  5741.       }
  5742.     } else {
  5743.       id = this.id;
  5744.       if (hasOwn(value, id)) {
  5745.         if (value[id] === null) {
  5746.           value[id] = frag;
  5747.         } else {
  5748.           process.env.NODE_ENV !== 'production' && this.warnDuplicate(value);
  5749.         }
  5750.       } else if (Object.isExtensible(value)) {
  5751.         def(value, id, frag);
  5752.       } else if (process.env.NODE_ENV !== 'production') {
  5753.         warn('Frozen v-for objects cannot be automatically tracked, make sure to ' + 'provide a track-by key.');
  5754.       }
  5755.     }
  5756.     frag.raw = value;
  5757.   },
  5758.  
  5759.   /**
  5760.    * Get a cached fragment from the value/index/key
  5761.    *
  5762.    * @param {*} value
  5763.    * @param {Number} index
  5764.    * @param {String} key
  5765.    * @return {Fragment}
  5766.    */
  5767.  
  5768.   getCachedFrag: function getCachedFrag(value, index, key) {
  5769.     var trackByKey = this.params.trackBy;
  5770.     var primitive = !isObject(value);
  5771.     var frag;
  5772.     if (key || trackByKey || primitive) {
  5773.       var id = getTrackByKey(index, key, value, trackByKey);
  5774.       frag = this.cache[id];
  5775.     } else {
  5776.       frag = value[this.id];
  5777.     }
  5778.     if (frag && (frag.reused || frag.fresh)) {
  5779.       process.env.NODE_ENV !== 'production' && this.warnDuplicate(value);
  5780.     }
  5781.     return frag;
  5782.   },
  5783.  
  5784.   /**
  5785.    * Delete a fragment from cache.
  5786.    *
  5787.    * @param {Fragment} frag
  5788.    */
  5789.  
  5790.   deleteCachedFrag: function deleteCachedFrag(frag) {
  5791.     var value = frag.raw;
  5792.     var trackByKey = this.params.trackBy;
  5793.     var scope = frag.scope;
  5794.     var index = scope.$index;
  5795.     // fix #948: avoid accidentally fall through to
  5796.     // a parent repeater which happens to have $key.
  5797.     var key = hasOwn(scope, '$key') && scope.$key;
  5798.     var primitive = !isObject(value);
  5799.     if (trackByKey || key || primitive) {
  5800.       var id = getTrackByKey(index, key, value, trackByKey);
  5801.       this.cache[id] = null;
  5802.     } else {
  5803.       value[this.id] = null;
  5804.       frag.raw = null;
  5805.     }
  5806.   },
  5807.  
  5808.   /**
  5809.    * Get the stagger amount for an insertion/removal.
  5810.    *
  5811.    * @param {Fragment} frag
  5812.    * @param {Number} index
  5813.    * @param {Number} total
  5814.    * @param {String} type
  5815.    */
  5816.  
  5817.   getStagger: function getStagger(frag, index, total, type) {
  5818.     type = type + 'Stagger';
  5819.     var trans = frag.node.__v_trans;
  5820.     var hooks = trans && trans.hooks;
  5821.     var hook = hooks && (hooks[type] || hooks.stagger);
  5822.     return hook ? hook.call(frag, index, total) : index * parseInt(this.params[type] || this.params.stagger, 10);
  5823.   },
  5824.  
  5825.   /**
  5826.    * Pre-process the value before piping it through the
  5827.    * filters. This is passed to and called by the watcher.
  5828.    */
  5829.  
  5830.   _preProcess: function _preProcess(value) {
  5831.     // regardless of type, store the un-filtered raw value.
  5832.     this.rawValue = value;
  5833.     return value;
  5834.   },
  5835.  
  5836.   /**
  5837.    * Post-process the value after it has been piped through
  5838.    * the filters. This is passed to and called by the watcher.
  5839.    *
  5840.    * It is necessary for this to be called during the
  5841.    * watcher's dependency collection phase because we want
  5842.    * the v-for to update when the source Object is mutated.
  5843.    */
  5844.  
  5845.   _postProcess: function _postProcess(value) {
  5846.     if (isArray(value)) {
  5847.       return value;
  5848.     } else if (isPlainObject(value)) {
  5849.       // convert plain object to array.
  5850.       var keys = Object.keys(value);
  5851.       var i = keys.length;
  5852.       var res = new Array(i);
  5853.       var key;
  5854.       while (i--) {
  5855.         key = keys[i];
  5856.         res[i] = {
  5857.           $key: key,
  5858.           $value: value[key]
  5859.         };
  5860.       }
  5861.       return res;
  5862.     } else {
  5863.       if (typeof value === 'number' && !isNaN(value)) {
  5864.         value = range(value);
  5865.       }
  5866.       return value || [];
  5867.     }
  5868.   },
  5869.  
  5870.   unbind: function unbind() {
  5871.     if (this.descriptor.ref) {
  5872.       (this._scope || this.vm).$refs[this.descriptor.ref] = null;
  5873.     }
  5874.     if (this.frags) {
  5875.       var i = this.frags.length;
  5876.       var frag;
  5877.       while (i--) {
  5878.         frag = this.frags[i];
  5879.         this.deleteCachedFrag(frag);
  5880.         frag.destroy();
  5881.       }
  5882.     }
  5883.   }
  5884. };
  5885.  
  5886. /**
  5887.  * Helper to find the previous element that is a fragment
  5888.  * anchor. This is necessary because a destroyed frag's
  5889.  * element could still be lingering in the DOM before its
  5890.  * leaving transition finishes, but its inserted flag
  5891.  * should have been set to false so we can skip them.
  5892.  *
  5893.  * If this is a block repeat, we want to make sure we only
  5894.  * return frag that is bound to this v-for. (see #929)
  5895.  *
  5896.  * @param {Fragment} frag
  5897.  * @param {Comment|Text} anchor
  5898.  * @param {String} id
  5899.  * @return {Fragment}
  5900.  */
  5901.  
  5902. function findPrevFrag(frag, anchor, id) {
  5903.   var el = frag.node.previousSibling;
  5904.   /* istanbul ignore if */
  5905.   if (!el) return;
  5906.   frag = el.__v_frag;
  5907.   while ((!frag || frag.forId !== id || !frag.inserted) && el !== anchor) {
  5908.     el = el.previousSibling;
  5909.     /* istanbul ignore if */
  5910.     if (!el) return;
  5911.     frag = el.__v_frag;
  5912.   }
  5913.   return frag;
  5914. }
  5915.  
  5916. /**
  5917.  * Find a vm from a fragment.
  5918.  *
  5919.  * @param {Fragment} frag
  5920.  * @return {Vue|undefined}
  5921.  */
  5922.  
  5923. function findVmFromFrag(frag) {
  5924.   var node = frag.node;
  5925.   // handle multi-node frag
  5926.   if (frag.end) {
  5927.     while (!node.__vue__ && node !== frag.end && node.nextSibling) {
  5928.       node = node.nextSibling;
  5929.     }
  5930.   }
  5931.   return node.__vue__;
  5932. }
  5933.  
  5934. /**
  5935.  * Create a range array from given number.
  5936.  *
  5937.  * @param {Number} n
  5938.  * @return {Array}
  5939.  */
  5940.  
  5941. function range(n) {
  5942.   var i = -1;
  5943.   var ret = new Array(Math.floor(n));
  5944.   while (++i < n) {
  5945.     ret[i] = i;
  5946.   }
  5947.   return ret;
  5948. }
  5949.  
  5950. /**
  5951.  * Get the track by key for an item.
  5952.  *
  5953.  * @param {Number} index
  5954.  * @param {String} key
  5955.  * @param {*} value
  5956.  * @param {String} [trackByKey]
  5957.  */
  5958.  
  5959. function getTrackByKey(index, key, value, trackByKey) {
  5960.   return trackByKey ? trackByKey === '$index' ? index : trackByKey.charAt(0).match(/\w/) ? getPath(value, trackByKey) : value[trackByKey] : key || value;
  5961. }
  5962.  
  5963. if (process.env.NODE_ENV !== 'production') {
  5964.   vFor.warnDuplicate = function (value) {
  5965.     warn('Duplicate value found in v-for="' + this.descriptor.raw + '": ' + JSON.stringify(value) + '. Use track-by="$index" if ' + 'you are expecting duplicate values.', this.vm);
  5966.   };
  5967. }
  5968.  
  5969. var vIf = {
  5970.  
  5971.   priority: IF,
  5972.   terminal: true,
  5973.  
  5974.   bind: function bind() {
  5975.     var el = this.el;
  5976.     if (!el.__vue__) {
  5977.       // check else block
  5978.       var next = el.nextElementSibling;
  5979.       if (next && getAttr(next, 'v-else') !== null) {
  5980.         remove(next);
  5981.         this.elseEl = next;
  5982.       }
  5983.       // check main block
  5984.       this.anchor = createAnchor('v-if');
  5985.       replace(el, this.anchor);
  5986.     } else {
  5987.       process.env.NODE_ENV !== 'production' && warn('v-if="' + this.expression + '" cannot be ' + 'used on an instance root element.', this.vm);
  5988.       this.invalid = true;
  5989.     }
  5990.   },
  5991.  
  5992.   update: function update(value) {
  5993.     if (this.invalid) return;
  5994.     if (value) {
  5995.       if (!this.frag) {
  5996.         this.insert();
  5997.       }
  5998.     } else {
  5999.       this.remove();
  6000.     }
  6001.   },
  6002.  
  6003.   insert: function insert() {
  6004.     if (this.elseFrag) {
  6005.       this.elseFrag.remove();
  6006.       this.elseFrag = null;
  6007.     }
  6008.     // lazy init factory
  6009.     if (!this.factory) {
  6010.       this.factory = new FragmentFactory(this.vm, this.el);
  6011.     }
  6012.     this.frag = this.factory.create(this._host, this._scope, this._frag);
  6013.     this.frag.before(this.anchor);
  6014.   },
  6015.  
  6016.   remove: function remove() {
  6017.     if (this.frag) {
  6018.       this.frag.remove();
  6019.       this.frag = null;
  6020.     }
  6021.     if (this.elseEl && !this.elseFrag) {
  6022.       if (!this.elseFactory) {
  6023.         this.elseFactory = new FragmentFactory(this.elseEl._context || this.vm, this.elseEl);
  6024.       }
  6025.       this.elseFrag = this.elseFactory.create(this._host, this._scope, this._frag);
  6026.       this.elseFrag.before(this.anchor);
  6027.     }
  6028.   },
  6029.  
  6030.   unbind: function unbind() {
  6031.     if (this.frag) {
  6032.       this.frag.destroy();
  6033.     }
  6034.     if (this.elseFrag) {
  6035.       this.elseFrag.destroy();
  6036.     }
  6037.   }
  6038. };
  6039.  
  6040. var show = {
  6041.  
  6042.   bind: function bind() {
  6043.     // check else block
  6044.     var next = this.el.nextElementSibling;
  6045.     if (next && getAttr(next, 'v-else') !== null) {
  6046.       this.elseEl = next;
  6047.     }
  6048.   },
  6049.  
  6050.   update: function update(value) {
  6051.     this.apply(this.el, value);
  6052.     if (this.elseEl) {
  6053.       this.apply(this.elseEl, !value);
  6054.     }
  6055.   },
  6056.  
  6057.   apply: function apply(el, value) {
  6058.     if (inDoc(el)) {
  6059.       applyTransition(el, value ? 1 : -1, toggle, this.vm);
  6060.     } else {
  6061.       toggle();
  6062.     }
  6063.     function toggle() {
  6064.       el.style.display = value ? '' : 'none';
  6065.     }
  6066.   }
  6067. };
  6068.  
  6069. var text$2 = {
  6070.  
  6071.   bind: function bind() {
  6072.     var self = this;
  6073.     var el = this.el;
  6074.     var isRange = el.type === 'range';
  6075.     var lazy = this.params.lazy;
  6076.     var number = this.params.number;
  6077.     var debounce = this.params.debounce;
  6078.  
  6079.     // handle composition events.
  6080.     //   http://blog.evanyou.me/2014/01/03/composition-event/
  6081.     // skip this for Android because it handles composition
  6082.     // events quite differently. Android doesn't trigger
  6083.     // composition events for language input methods e.g.
  6084.     // Chinese, but instead triggers them for spelling
  6085.     // suggestions... (see Discussion/#162)
  6086.     var composing = false;
  6087.     if (!isAndroid && !isRange) {
  6088.       this.on('compositionstart', function () {
  6089.         composing = true;
  6090.       });
  6091.       this.on('compositionend', function () {
  6092.         composing = false;
  6093.         // in IE11 the "compositionend" event fires AFTER
  6094.         // the "input" event, so the input handler is blocked
  6095.         // at the end... have to call it here.
  6096.         //
  6097.         // #1327: in lazy mode this is unecessary.
  6098.         if (!lazy) {
  6099.           self.listener();
  6100.         }
  6101.       });
  6102.     }
  6103.  
  6104.     // prevent messing with the input when user is typing,
  6105.     // and force update on blur.
  6106.     this.focused = false;
  6107.     if (!isRange && !lazy) {
  6108.       this.on('focus', function () {
  6109.         self.focused = true;
  6110.       });
  6111.       this.on('blur', function () {
  6112.         self.focused = false;
  6113.         // do not sync value after fragment removal (#2017)
  6114.         if (!self._frag || self._frag.inserted) {
  6115.           self.rawListener();
  6116.         }
  6117.       });
  6118.     }
  6119.  
  6120.     // Now attach the main listener
  6121.     this.listener = this.rawListener = function () {
  6122.       if (composing || !self._bound) {
  6123.         return;
  6124.       }
  6125.       var val = number || isRange ? toNumber(el.value) : el.value;
  6126.       self.set(val);
  6127.       // force update on next tick to avoid lock & same value
  6128.       // also only update when user is not typing
  6129.       nextTick(function () {
  6130.         if (self._bound && !self.focused) {
  6131.           self.update(self._watcher.value);
  6132.         }
  6133.       });
  6134.     };
  6135.  
  6136.     // apply debounce
  6137.     if (debounce) {
  6138.       this.listener = _debounce(this.listener, debounce);
  6139.     }
  6140.  
  6141.     // Support jQuery events, since jQuery.trigger() doesn't
  6142.     // trigger native events in some cases and some plugins
  6143.     // rely on $.trigger()
  6144.     //
  6145.     // We want to make sure if a listener is attached using
  6146.     // jQuery, it is also removed with jQuery, that's why
  6147.     // we do the check for each directive instance and
  6148.     // store that check result on itself. This also allows
  6149.     // easier test coverage control by unsetting the global
  6150.     // jQuery variable in tests.
  6151.     this.hasjQuery = typeof jQuery === 'function';
  6152.     if (this.hasjQuery) {
  6153.       var method = jQuery.fn.on ? 'on' : 'bind';
  6154.       jQuery(el)[method]('change', this.rawListener);
  6155.       if (!lazy) {
  6156.         jQuery(el)[method]('input', this.listener);
  6157.       }
  6158.     } else {
  6159.       this.on('change', this.rawListener);
  6160.       if (!lazy) {
  6161.         this.on('input', this.listener);
  6162.       }
  6163.     }
  6164.  
  6165.     // IE9 doesn't fire input event on backspace/del/cut
  6166.     if (!lazy && isIE9) {
  6167.       this.on('cut', function () {
  6168.         nextTick(self.listener);
  6169.       });
  6170.       this.on('keyup', function (e) {
  6171.         if (e.keyCode === 46 || e.keyCode === 8) {
  6172.           self.listener();
  6173.         }
  6174.       });
  6175.     }
  6176.  
  6177.     // set initial value if present
  6178.     if (el.hasAttribute('value') || el.tagName === 'TEXTAREA' && el.value.trim()) {
  6179.       this.afterBind = this.listener;
  6180.     }
  6181.   },
  6182.  
  6183.   update: function update(value) {
  6184.     // #3029 only update when the value changes. This prevent
  6185.     // browsers from overwriting values like selectionStart
  6186.     value = _toString(value);
  6187.     if (value !== this.el.value) this.el.value = value;
  6188.   },
  6189.  
  6190.   unbind: function unbind() {
  6191.     var el = this.el;
  6192.     if (this.hasjQuery) {
  6193.       var method = jQuery.fn.off ? 'off' : 'unbind';
  6194.       jQuery(el)[method]('change', this.listener);
  6195.       jQuery(el)[method]('input', this.listener);
  6196.     }
  6197.   }
  6198. };
  6199.  
  6200. var radio = {
  6201.  
  6202.   bind: function bind() {
  6203.     var self = this;
  6204.     var el = this.el;
  6205.  
  6206.     this.getValue = function () {
  6207.       // value overwrite via v-bind:value
  6208.       if (el.hasOwnProperty('_value')) {
  6209.         return el._value;
  6210.       }
  6211.       var val = el.value;
  6212.       if (self.params.number) {
  6213.         val = toNumber(val);
  6214.       }
  6215.       return val;
  6216.     };
  6217.  
  6218.     this.listener = function () {
  6219.       self.set(self.getValue());
  6220.     };
  6221.     this.on('change', this.listener);
  6222.  
  6223.     if (el.hasAttribute('checked')) {
  6224.       this.afterBind = this.listener;
  6225.     }
  6226.   },
  6227.  
  6228.   update: function update(value) {
  6229.     this.el.checked = looseEqual(value, this.getValue());
  6230.   }
  6231. };
  6232.  
  6233. var select = {
  6234.  
  6235.   bind: function bind() {
  6236.     var _this = this;
  6237.  
  6238.     var self = this;
  6239.     var el = this.el;
  6240.  
  6241.     // method to force update DOM using latest value.
  6242.     this.forceUpdate = function () {
  6243.       if (self._watcher) {
  6244.         self.update(self._watcher.get());
  6245.       }
  6246.     };
  6247.  
  6248.     // check if this is a multiple select
  6249.     var multiple = this.multiple = el.hasAttribute('multiple');
  6250.  
  6251.     // attach listener
  6252.     this.listener = function () {
  6253.       var value = getValue(el, multiple);
  6254.       value = self.params.number ? isArray(value) ? value.map(toNumber) : toNumber(value) : value;
  6255.       self.set(value);
  6256.     };
  6257.     this.on('change', this.listener);
  6258.  
  6259.     // if has initial value, set afterBind
  6260.     var initValue = getValue(el, multiple, true);
  6261.     if (multiple && initValue.length || !multiple && initValue !== null) {
  6262.       this.afterBind = this.listener;
  6263.     }
  6264.  
  6265.     // All major browsers except Firefox resets
  6266.     // selectedIndex with value -1 to 0 when the element
  6267.     // is appended to a new parent, therefore we have to
  6268.     // force a DOM update whenever that happens...
  6269.     this.vm.$on('hook:attached', function () {
  6270.       nextTick(_this.forceUpdate);
  6271.     });
  6272.     if (!inDoc(el)) {
  6273.       nextTick(this.forceUpdate);
  6274.     }
  6275.   },
  6276.  
  6277.   update: function update(value) {
  6278.     var el = this.el;
  6279.     el.selectedIndex = -1;
  6280.     var multi = this.multiple && isArray(value);
  6281.     var options = el.options;
  6282.     var i = options.length;
  6283.     var op, val;
  6284.     while (i--) {
  6285.       op = options[i];
  6286.       val = op.hasOwnProperty('_value') ? op._value : op.value;
  6287.       /* eslint-disable eqeqeq */
  6288.       op.selected = multi ? indexOf$1(value, val) > -1 : looseEqual(value, val);
  6289.       /* eslint-enable eqeqeq */
  6290.     }
  6291.   },
  6292.  
  6293.   unbind: function unbind() {
  6294.     /* istanbul ignore next */
  6295.     this.vm.$off('hook:attached', this.forceUpdate);
  6296.   }
  6297. };
  6298.  
  6299. /**
  6300.  * Get select value
  6301.  *
  6302.  * @param {SelectElement} el
  6303.  * @param {Boolean} multi
  6304.  * @param {Boolean} init
  6305.  * @return {Array|*}
  6306.  */
  6307.  
  6308. function getValue(el, multi, init) {
  6309.   var res = multi ? [] : null;
  6310.   var op, val, selected;
  6311.   for (var i = 0, l = el.options.length; i < l; i++) {
  6312.     op = el.options[i];
  6313.     selected = init ? op.hasAttribute('selected') : op.selected;
  6314.     if (selected) {
  6315.       val = op.hasOwnProperty('_value') ? op._value : op.value;
  6316.       if (multi) {
  6317.         res.push(val);
  6318.       } else {
  6319.         return val;
  6320.       }
  6321.     }
  6322.   }
  6323.   return res;
  6324. }
  6325.  
  6326. /**
  6327.  * Native Array.indexOf uses strict equal, but in this
  6328.  * case we need to match string/numbers with custom equal.
  6329.  *
  6330.  * @param {Array} arr
  6331.  * @param {*} val
  6332.  */
  6333.  
  6334. function indexOf$1(arr, val) {
  6335.   var i = arr.length;
  6336.   while (i--) {
  6337.     if (looseEqual(arr[i], val)) {
  6338.       return i;
  6339.     }
  6340.   }
  6341.   return -1;
  6342. }
  6343.  
  6344. var checkbox = {
  6345.  
  6346.   bind: function bind() {
  6347.     var self = this;
  6348.     var el = this.el;
  6349.  
  6350.     this.getValue = function () {
  6351.       return el.hasOwnProperty('_value') ? el._value : self.params.number ? toNumber(el.value) : el.value;
  6352.     };
  6353.  
  6354.     function getBooleanValue() {
  6355.       var val = el.checked;
  6356.       if (val && el.hasOwnProperty('_trueValue')) {
  6357.         return el._trueValue;
  6358.       }
  6359.       if (!val && el.hasOwnProperty('_falseValue')) {
  6360.         return el._falseValue;
  6361.       }
  6362.       return val;
  6363.     }
  6364.  
  6365.     this.listener = function () {
  6366.       var model = self._watcher.value;
  6367.       if (isArray(model)) {
  6368.         var val = self.getValue();
  6369.         if (el.checked) {
  6370.           if (indexOf(model, val) < 0) {
  6371.             model.push(val);
  6372.           }
  6373.         } else {
  6374.           model.$remove(val);
  6375.         }
  6376.       } else {
  6377.         self.set(getBooleanValue());
  6378.       }
  6379.     };
  6380.  
  6381.     this.on('change', this.listener);
  6382.     if (el.hasAttribute('checked')) {
  6383.       this.afterBind = this.listener;
  6384.     }
  6385.   },
  6386.  
  6387.   update: function update(value) {
  6388.     var el = this.el;
  6389.     if (isArray(value)) {
  6390.       el.checked = indexOf(value, this.getValue()) > -1;
  6391.     } else {
  6392.       if (el.hasOwnProperty('_trueValue')) {
  6393.         el.checked = looseEqual(value, el._trueValue);
  6394.       } else {
  6395.         el.checked = !!value;
  6396.       }
  6397.     }
  6398.   }
  6399. };
  6400.  
  6401. var handlers = {
  6402.   text: text$2,
  6403.   radio: radio,
  6404.   select: select,
  6405.   checkbox: checkbox
  6406. };
  6407.  
  6408. var model = {
  6409.  
  6410.   priority: MODEL,
  6411.   twoWay: true,
  6412.   handlers: handlers,
  6413.   params: ['lazy', 'number', 'debounce'],
  6414.  
  6415.   /**
  6416.    * Possible elements:
  6417.    *   <select>
  6418.    *   <textarea>
  6419.    *   <input type="*">
  6420.    *     - text
  6421.    *     - checkbox
  6422.    *     - radio
  6423.    *     - number
  6424.    */
  6425.  
  6426.   bind: function bind() {
  6427.     // friendly warning...
  6428.     this.checkFilters();
  6429.     if (this.hasRead && !this.hasWrite) {
  6430.       process.env.NODE_ENV !== 'production' && warn('It seems you are using a read-only filter with ' + 'v-model="' + this.descriptor.raw + '". ' + 'You might want to use a two-way filter to ensure correct behavior.', this.vm);
  6431.     }
  6432.     var el = this.el;
  6433.     var tag = el.tagName;
  6434.     var handler;
  6435.     if (tag === 'INPUT') {
  6436.       handler = handlers[el.type] || handlers.text;
  6437.     } else if (tag === 'SELECT') {
  6438.       handler = handlers.select;
  6439.     } else if (tag === 'TEXTAREA') {
  6440.       handler = handlers.text;
  6441.     } else {
  6442.       process.env.NODE_ENV !== 'production' && warn('v-model does not support element type: ' + tag, this.vm);
  6443.       return;
  6444.     }
  6445.     el.__v_model = this;
  6446.     handler.bind.call(this);
  6447.     this.update = handler.update;
  6448.     this._unbind = handler.unbind;
  6449.   },
  6450.  
  6451.   /**
  6452.    * Check read/write filter stats.
  6453.    */
  6454.  
  6455.   checkFilters: function checkFilters() {
  6456.     var filters = this.filters;
  6457.     if (!filters) return;
  6458.     var i = filters.length;
  6459.     while (i--) {
  6460.       var filter = resolveAsset(this.vm.$options, 'filters', filters[i].name);
  6461.       if (typeof filter === 'function' || filter.read) {
  6462.         this.hasRead = true;
  6463.       }
  6464.       if (filter.write) {
  6465.         this.hasWrite = true;
  6466.       }
  6467.     }
  6468.   },
  6469.  
  6470.   unbind: function unbind() {
  6471.     this.el.__v_model = null;
  6472.     this._unbind && this._unbind();
  6473.   }
  6474. };
  6475.  
  6476. // keyCode aliases
  6477. var keyCodes = {
  6478.   esc: 27,
  6479.   tab: 9,
  6480.   enter: 13,
  6481.   space: 32,
  6482.   'delete': [8, 46],
  6483.   up: 38,
  6484.   left: 37,
  6485.   right: 39,
  6486.   down: 40
  6487. };
  6488.  
  6489. function keyFilter(handler, keys) {
  6490.   var codes = keys.map(function (key) {
  6491.     var charCode = key.charCodeAt(0);
  6492.     if (charCode > 47 && charCode < 58) {
  6493.       return parseInt(key, 10);
  6494.     }
  6495.     if (key.length === 1) {
  6496.       charCode = key.toUpperCase().charCodeAt(0);
  6497.       if (charCode > 64 && charCode < 91) {
  6498.         return charCode;
  6499.       }
  6500.     }
  6501.     return keyCodes[key];
  6502.   });
  6503.   codes = [].concat.apply([], codes);
  6504.   return function keyHandler(e) {
  6505.     if (codes.indexOf(e.keyCode) > -1) {
  6506.       return handler.call(this, e);
  6507.     }
  6508.   };
  6509. }
  6510.  
  6511. function stopFilter(handler) {
  6512.   return function stopHandler(e) {
  6513.     e.stopPropagation();
  6514.     return handler.call(this, e);
  6515.   };
  6516. }
  6517.  
  6518. function preventFilter(handler) {
  6519.   return function preventHandler(e) {
  6520.     e.preventDefault();
  6521.     return handler.call(this, e);
  6522.   };
  6523. }
  6524.  
  6525. function selfFilter(handler) {
  6526.   return function selfHandler(e) {
  6527.     if (e.target === e.currentTarget) {
  6528.       return handler.call(this, e);
  6529.     }
  6530.   };
  6531. }
  6532.  
  6533. var on$1 = {
  6534.  
  6535.   priority: ON,
  6536.   acceptStatement: true,
  6537.   keyCodes: keyCodes,
  6538.  
  6539.   bind: function bind() {
  6540.     // deal with iframes
  6541.     if (this.el.tagName === 'IFRAME' && this.arg !== 'load') {
  6542.       var self = this;
  6543.       this.iframeBind = function () {
  6544.         on(self.el.contentWindow, self.arg, self.handler, self.modifiers.capture);
  6545.       };
  6546.       this.on('load', this.iframeBind);
  6547.     }
  6548.   },
  6549.  
  6550.   update: function update(handler) {
  6551.     // stub a noop for v-on with no value,
  6552.     // e.g. @mousedown.prevent
  6553.     if (!this.descriptor.raw) {
  6554.       handler = function () {};
  6555.     }
  6556.  
  6557.     if (typeof handler !== 'function') {
  6558.       process.env.NODE_ENV !== 'production' && warn('v-on:' + this.arg + '="' + this.expression + '" expects a function value, ' + 'got ' + handler, this.vm);
  6559.       return;
  6560.     }
  6561.  
  6562.     // apply modifiers
  6563.     if (this.modifiers.stop) {
  6564.       handler = stopFilter(handler);
  6565.     }
  6566.     if (this.modifiers.prevent) {
  6567.       handler = preventFilter(handler);
  6568.     }
  6569.     if (this.modifiers.self) {
  6570.       handler = selfFilter(handler);
  6571.     }
  6572.     // key filter
  6573.     var keys = Object.keys(this.modifiers).filter(function (key) {
  6574.       return key !== 'stop' && key !== 'prevent' && key !== 'self' && key !== 'capture';
  6575.     });
  6576.     if (keys.length) {
  6577.       handler = keyFilter(handler, keys);
  6578.     }
  6579.  
  6580.     this.reset();
  6581.     this.handler = handler;
  6582.  
  6583.     if (this.iframeBind) {
  6584.       this.iframeBind();
  6585.     } else {
  6586.       on(this.el, this.arg, this.handler, this.modifiers.capture);
  6587.     }
  6588.   },
  6589.  
  6590.   reset: function reset() {
  6591.     var el = this.iframeBind ? this.el.contentWindow : this.el;
  6592.     if (this.handler) {
  6593.       off(el, this.arg, this.handler);
  6594.     }
  6595.   },
  6596.  
  6597.   unbind: function unbind() {
  6598.     this.reset();
  6599.   }
  6600. };
  6601.  
  6602. var prefixes = ['-webkit-', '-moz-', '-ms-'];
  6603. var camelPrefixes = ['Webkit', 'Moz', 'ms'];
  6604. var importantRE = /!important;?$/;
  6605. var propCache = Object.create(null);
  6606.  
  6607. var testEl = null;
  6608.  
  6609. var style = {
  6610.  
  6611.   deep: true,
  6612.  
  6613.   update: function update(value) {
  6614.     if (typeof value === 'string') {
  6615.       this.el.style.cssText = value;
  6616.     } else if (isArray(value)) {
  6617.       this.handleObject(value.reduce(extend, {}));
  6618.     } else {
  6619.       this.handleObject(value || {});
  6620.     }
  6621.   },
  6622.  
  6623.   handleObject: function handleObject(value) {
  6624.     // cache object styles so that only changed props
  6625.     // are actually updated.
  6626.     var cache = this.cache || (this.cache = {});
  6627.     var name, val;
  6628.     for (name in cache) {
  6629.       if (!(name in value)) {
  6630.         this.handleSingle(name, null);
  6631.         delete cache[name];
  6632.       }
  6633.     }
  6634.     for (name in value) {
  6635.       val = value[name];
  6636.       if (val !== cache[name]) {
  6637.         cache[name] = val;
  6638.         this.handleSingle(name, val);
  6639.       }
  6640.     }
  6641.   },
  6642.  
  6643.   handleSingle: function handleSingle(prop, value) {
  6644.     prop = normalize(prop);
  6645.     if (!prop) return; // unsupported prop
  6646.     // cast possible numbers/booleans into strings
  6647.     if (value != null) value += '';
  6648.     if (value) {
  6649.       var isImportant = importantRE.test(value) ? 'important' : '';
  6650.       if (isImportant) {
  6651.         /* istanbul ignore if */
  6652.         if (process.env.NODE_ENV !== 'production') {
  6653.           warn('It\'s probably a bad idea to use !important with inline rules. ' + 'This feature will be deprecated in a future version of Vue.');
  6654.         }
  6655.         value = value.replace(importantRE, '').trim();
  6656.         this.el.style.setProperty(prop.kebab, value, isImportant);
  6657.       } else {
  6658.         this.el.style[prop.camel] = value;
  6659.       }
  6660.     } else {
  6661.       this.el.style[prop.camel] = '';
  6662.     }
  6663.   }
  6664.  
  6665. };
  6666.  
  6667. /**
  6668.  * Normalize a CSS property name.
  6669.  * - cache result
  6670.  * - auto prefix
  6671.  * - camelCase -> dash-case
  6672.  *
  6673.  * @param {String} prop
  6674.  * @return {String}
  6675.  */
  6676.  
  6677. function normalize(prop) {
  6678.   if (propCache[prop]) {
  6679.     return propCache[prop];
  6680.   }
  6681.   var res = prefix(prop);
  6682.   propCache[prop] = propCache[res] = res;
  6683.   return res;
  6684. }
  6685.  
  6686. /**
  6687.  * Auto detect the appropriate prefix for a CSS property.
  6688.  * https://gist.github.com/paulirish/523692
  6689.  *
  6690.  * @param {String} prop
  6691.  * @return {String}
  6692.  */
  6693.  
  6694. function prefix(prop) {
  6695.   prop = hyphenate(prop);
  6696.   var camel = camelize(prop);
  6697.   var upper = camel.charAt(0).toUpperCase() + camel.slice(1);
  6698.   if (!testEl) {
  6699.     testEl = document.createElement('div');
  6700.   }
  6701.   var i = prefixes.length;
  6702.   var prefixed;
  6703.   if (camel !== 'filter' && camel in testEl.style) {
  6704.     return {
  6705.       kebab: prop,
  6706.       camel: camel
  6707.     };
  6708.   }
  6709.   while (i--) {
  6710.     prefixed = camelPrefixes[i] + upper;
  6711.     if (prefixed in testEl.style) {
  6712.       return {
  6713.         kebab: prefixes[i] + prop,
  6714.         camel: prefixed
  6715.       };
  6716.     }
  6717.   }
  6718. }
  6719.  
  6720. // xlink
  6721. var xlinkNS = 'http://www.w3.org/1999/xlink';
  6722. var xlinkRE = /^xlink:/;
  6723.  
  6724. // check for attributes that prohibit interpolations
  6725. var disallowedInterpAttrRE = /^v-|^:|^@|^(?:is|transition|transition-mode|debounce|track-by|stagger|enter-stagger|leave-stagger)$/;
  6726. // these attributes should also set their corresponding properties
  6727. // because they only affect the initial state of the element
  6728. var attrWithPropsRE = /^(?:value|checked|selected|muted)$/;
  6729. // these attributes expect enumrated values of "true" or "false"
  6730. // but are not boolean attributes
  6731. var enumeratedAttrRE = /^(?:draggable|contenteditable|spellcheck)$/;
  6732.  
  6733. // these attributes should set a hidden property for
  6734. // binding v-model to object values
  6735. var modelProps = {
  6736.   value: '_value',
  6737.   'true-value': '_trueValue',
  6738.   'false-value': '_falseValue'
  6739. };
  6740.  
  6741. var bind$1 = {
  6742.  
  6743.   priority: BIND,
  6744.  
  6745.   bind: function bind() {
  6746.     var attr = this.arg;
  6747.     var tag = this.el.tagName;
  6748.     // should be deep watch on object mode
  6749.     if (!attr) {
  6750.       this.deep = true;
  6751.     }
  6752.     // handle interpolation bindings
  6753.     var descriptor = this.descriptor;
  6754.     var tokens = descriptor.interp;
  6755.     if (tokens) {
  6756.       // handle interpolations with one-time tokens
  6757.       if (descriptor.hasOneTime) {
  6758.         this.expression = tokensToExp(tokens, this._scope || this.vm);
  6759.       }
  6760.  
  6761.       // only allow binding on native attributes
  6762.       if (disallowedInterpAttrRE.test(attr) || attr === 'name' && (tag === 'PARTIAL' || tag === 'SLOT')) {
  6763.         process.env.NODE_ENV !== 'production' && warn(attr + '="' + descriptor.raw + '": ' + 'attribute interpolation is not allowed in Vue.js ' + 'directives and special attributes.', this.vm);
  6764.         this.el.removeAttribute(attr);
  6765.         this.invalid = true;
  6766.       }
  6767.  
  6768.       /* istanbul ignore if */
  6769.       if (process.env.NODE_ENV !== 'production') {
  6770.         var raw = attr + '="' + descriptor.raw + '": ';
  6771.         // warn src
  6772.         if (attr === 'src') {
  6773.           warn(raw + 'interpolation in "src" attribute will cause ' + 'a 404 request. Use v-bind:src instead.', this.vm);
  6774.         }
  6775.  
  6776.         // warn style
  6777.         if (attr === 'style') {
  6778.           warn(raw + 'interpolation in "style" attribute will cause ' + 'the attribute to be discarded in Internet Explorer. ' + 'Use v-bind:style instead.', this.vm);
  6779.         }
  6780.       }
  6781.     }
  6782.   },
  6783.  
  6784.   update: function update(value) {
  6785.     if (this.invalid) {
  6786.       return;
  6787.     }
  6788.     var attr = this.arg;
  6789.     if (this.arg) {
  6790.       this.handleSingle(attr, value);
  6791.     } else {
  6792.       this.handleObject(value || {});
  6793.     }
  6794.   },
  6795.  
  6796.   // share object handler with v-bind:class
  6797.   handleObject: style.handleObject,
  6798.  
  6799.   handleSingle: function handleSingle(attr, value) {
  6800.     var el = this.el;
  6801.     var interp = this.descriptor.interp;
  6802.     if (this.modifiers.camel) {
  6803.       attr = camelize(attr);
  6804.     }
  6805.     if (!interp && attrWithPropsRE.test(attr) && attr in el) {
  6806.       var attrValue = attr === 'value' ? value == null // IE9 will set input.value to "null" for null...
  6807.       ? '' : value : value;
  6808.  
  6809.       if (el[attr] !== attrValue) {
  6810.         el[attr] = attrValue;
  6811.       }
  6812.     }
  6813.     // set model props
  6814.     var modelProp = modelProps[attr];
  6815.     if (!interp && modelProp) {
  6816.       el[modelProp] = value;
  6817.       // update v-model if present
  6818.       var model = el.__v_model;
  6819.       if (model) {
  6820.         model.listener();
  6821.       }
  6822.     }
  6823.     // do not set value attribute for textarea
  6824.     if (attr === 'value' && el.tagName === 'TEXTAREA') {
  6825.       el.removeAttribute(attr);
  6826.       return;
  6827.     }
  6828.     // update attribute
  6829.     if (enumeratedAttrRE.test(attr)) {
  6830.       el.setAttribute(attr, value ? 'true' : 'false');
  6831.     } else if (value != null && value !== false) {
  6832.       if (attr === 'class') {
  6833.         // handle edge case #1960:
  6834.         // class interpolation should not overwrite Vue transition class
  6835.         if (el.__v_trans) {
  6836.           value += ' ' + el.__v_trans.id + '-transition';
  6837.         }
  6838.         setClass(el, value);
  6839.       } else if (xlinkRE.test(attr)) {
  6840.         el.setAttributeNS(xlinkNS, attr, value === true ? '' : value);
  6841.       } else {
  6842.         el.setAttribute(attr, value === true ? '' : value);
  6843.       }
  6844.     } else {
  6845.       el.removeAttribute(attr);
  6846.     }
  6847.   }
  6848. };
  6849.  
  6850. var el = {
  6851.  
  6852.   priority: EL,
  6853.  
  6854.   bind: function bind() {
  6855.     /* istanbul ignore if */
  6856.     if (!this.arg) {
  6857.       return;
  6858.     }
  6859.     var id = this.id = camelize(this.arg);
  6860.     var refs = (this._scope || this.vm).$els;
  6861.     if (hasOwn(refs, id)) {
  6862.       refs[id] = this.el;
  6863.     } else {
  6864.       defineReactive(refs, id, this.el);
  6865.     }
  6866.   },
  6867.  
  6868.   unbind: function unbind() {
  6869.     var refs = (this._scope || this.vm).$els;
  6870.     if (refs[this.id] === this.el) {
  6871.       refs[this.id] = null;
  6872.     }
  6873.   }
  6874. };
  6875.  
  6876. var ref = {
  6877.   bind: function bind() {
  6878.     process.env.NODE_ENV !== 'production' && warn('v-ref:' + this.arg + ' must be used on a child ' + 'component. Found on <' + this.el.tagName.toLowerCase() + '>.', this.vm);
  6879.   }
  6880. };
  6881.  
  6882. var cloak = {
  6883.   bind: function bind() {
  6884.     var el = this.el;
  6885.     this.vm.$once('pre-hook:compiled', function () {
  6886.       el.removeAttribute('v-cloak');
  6887.     });
  6888.   }
  6889. };
  6890.  
  6891. // must export plain object
  6892. var directives = {
  6893.   text: text$1,
  6894.   html: html,
  6895.   'for': vFor,
  6896.   'if': vIf,
  6897.   show: show,
  6898.   model: model,
  6899.   on: on$1,
  6900.   bind: bind$1,
  6901.   el: el,
  6902.   ref: ref,
  6903.   cloak: cloak
  6904. };
  6905.  
  6906. var vClass = {
  6907.  
  6908.   deep: true,
  6909.  
  6910.   update: function update(value) {
  6911.     if (!value) {
  6912.       this.cleanup();
  6913.     } else if (typeof value === 'string') {
  6914.       this.setClass(value.trim().split(/\s+/));
  6915.     } else {
  6916.       this.setClass(normalize$1(value));
  6917.     }
  6918.   },
  6919.  
  6920.   setClass: function setClass(value) {
  6921.     this.cleanup(value);
  6922.     for (var i = 0, l = value.length; i < l; i++) {
  6923.       var val = value[i];
  6924.       if (val) {
  6925.         apply(this.el, val, addClass);
  6926.       }
  6927.     }
  6928.     this.prevKeys = value;
  6929.   },
  6930.  
  6931.   cleanup: function cleanup(value) {
  6932.     var prevKeys = this.prevKeys;
  6933.     if (!prevKeys) return;
  6934.     var i = prevKeys.length;
  6935.     while (i--) {
  6936.       var key = prevKeys[i];
  6937.       if (!value || value.indexOf(key) < 0) {
  6938.         apply(this.el, key, removeClass);
  6939.       }
  6940.     }
  6941.   }
  6942. };
  6943.  
  6944. /**
  6945.  * Normalize objects and arrays (potentially containing objects)
  6946.  * into array of strings.
  6947.  *
  6948.  * @param {Object|Array<String|Object>} value
  6949.  * @return {Array<String>}
  6950.  */
  6951.  
  6952. function normalize$1(value) {
  6953.   var res = [];
  6954.   if (isArray(value)) {
  6955.     for (var i = 0, l = value.length; i < l; i++) {
  6956.       var _key = value[i];
  6957.       if (_key) {
  6958.         if (typeof _key === 'string') {
  6959.           res.push(_key);
  6960.         } else {
  6961.           for (var k in _key) {
  6962.             if (_key[k]) res.push(k);
  6963.           }
  6964.         }
  6965.       }
  6966.     }
  6967.   } else if (isObject(value)) {
  6968.     for (var key in value) {
  6969.       if (value[key]) res.push(key);
  6970.     }
  6971.   }
  6972.   return res;
  6973. }
  6974.  
  6975. /**
  6976.  * Add or remove a class/classes on an element
  6977.  *
  6978.  * @param {Element} el
  6979.  * @param {String} key The class name. This may or may not
  6980.  *                     contain a space character, in such a
  6981.  *                     case we'll deal with multiple class
  6982.  *                     names at once.
  6983.  * @param {Function} fn
  6984.  */
  6985.  
  6986. function apply(el, key, fn) {
  6987.   key = key.trim();
  6988.   if (key.indexOf(' ') === -1) {
  6989.     fn(el, key);
  6990.     return;
  6991.   }
  6992.   // The key contains one or more space characters.
  6993.   // Since a class name doesn't accept such characters, we
  6994.   // treat it as multiple classes.
  6995.   var keys = key.split(/\s+/);
  6996.   for (var i = 0, l = keys.length; i < l; i++) {
  6997.     fn(el, keys[i]);
  6998.   }
  6999. }
  7000.  
  7001. var component = {
  7002.  
  7003.   priority: COMPONENT,
  7004.  
  7005.   params: ['keep-alive', 'transition-mode', 'inline-template'],
  7006.  
  7007.   /**
  7008.    * Setup. Two possible usages:
  7009.    *
  7010.    * - static:
  7011.    *   <comp> or <div v-component="comp">
  7012.    *
  7013.    * - dynamic:
  7014.    *   <component :is="view">
  7015.    */
  7016.  
  7017.   bind: function bind() {
  7018.     if (!this.el.__vue__) {
  7019.       // keep-alive cache
  7020.       this.keepAlive = this.params.keepAlive;
  7021.       if (this.keepAlive) {
  7022.         this.cache = {};
  7023.       }
  7024.       // check inline-template
  7025.       if (this.params.inlineTemplate) {
  7026.         // extract inline template as a DocumentFragment
  7027.         this.inlineTemplate = extractContent(this.el, true);
  7028.       }
  7029.       // component resolution related state
  7030.       this.pendingComponentCb = this.Component = null;
  7031.       // transition related state
  7032.       this.pendingRemovals = 0;
  7033.       this.pendingRemovalCb = null;
  7034.       // create a ref anchor
  7035.       this.anchor = createAnchor('v-component');
  7036.       replace(this.el, this.anchor);
  7037.       // remove is attribute.
  7038.       // this is removed during compilation, but because compilation is
  7039.       // cached, when the component is used elsewhere this attribute
  7040.       // will remain at link time.
  7041.       this.el.removeAttribute('is');
  7042.       this.el.removeAttribute(':is');
  7043.       // remove ref, same as above
  7044.       if (this.descriptor.ref) {
  7045.         this.el.removeAttribute('v-ref:' + hyphenate(this.descriptor.ref));
  7046.       }
  7047.       // if static, build right now.
  7048.       if (this.literal) {
  7049.         this.setComponent(this.expression);
  7050.       }
  7051.     } else {
  7052.       process.env.NODE_ENV !== 'production' && warn('cannot mount component "' + this.expression + '" ' + 'on already mounted element: ' + this.el);
  7053.     }
  7054.   },
  7055.  
  7056.   /**
  7057.    * Public update, called by the watcher in the dynamic
  7058.    * literal scenario, e.g. <component :is="view">
  7059.    */
  7060.  
  7061.   update: function update(value) {
  7062.     if (!this.literal) {
  7063.       this.setComponent(value);
  7064.     }
  7065.   },
  7066.  
  7067.   /**
  7068.    * Switch dynamic components. May resolve the component
  7069.    * asynchronously, and perform transition based on
  7070.    * specified transition mode. Accepts a few additional
  7071.    * arguments specifically for vue-router.
  7072.    *
  7073.    * The callback is called when the full transition is
  7074.    * finished.
  7075.    *
  7076.    * @param {String} value
  7077.    * @param {Function} [cb]
  7078.    */
  7079.  
  7080.   setComponent: function setComponent(value, cb) {
  7081.     this.invalidatePending();
  7082.     if (!value) {
  7083.       // just remove current
  7084.       this.unbuild(true);
  7085.       this.remove(this.childVM, cb);
  7086.       this.childVM = null;
  7087.     } else {
  7088.       var self = this;
  7089.       this.resolveComponent(value, function () {
  7090.         self.mountComponent(cb);
  7091.       });
  7092.     }
  7093.   },
  7094.  
  7095.   /**
  7096.    * Resolve the component constructor to use when creating
  7097.    * the child vm.
  7098.    *
  7099.    * @param {String|Function} value
  7100.    * @param {Function} cb
  7101.    */
  7102.  
  7103.   resolveComponent: function resolveComponent(value, cb) {
  7104.     var self = this;
  7105.     this.pendingComponentCb = cancellable(function (Component) {
  7106.       self.ComponentName = Component.options.name || (typeof value === 'string' ? value : null);
  7107.       self.Component = Component;
  7108.       cb();
  7109.     });
  7110.     this.vm._resolveComponent(value, this.pendingComponentCb);
  7111.   },
  7112.  
  7113.   /**
  7114.    * Create a new instance using the current constructor and
  7115.    * replace the existing instance. This method doesn't care
  7116.    * whether the new component and the old one are actually
  7117.    * the same.
  7118.    *
  7119.    * @param {Function} [cb]
  7120.    */
  7121.  
  7122.   mountComponent: function mountComponent(cb) {
  7123.     // actual mount
  7124.     this.unbuild(true);
  7125.     var self = this;
  7126.     var activateHooks = this.Component.options.activate;
  7127.     var cached = this.getCached();
  7128.     var newComponent = this.build();
  7129.     if (activateHooks && !cached) {
  7130.       this.waitingFor = newComponent;
  7131.       callActivateHooks(activateHooks, newComponent, function () {
  7132.         if (self.waitingFor !== newComponent) {
  7133.           return;
  7134.         }
  7135.         self.waitingFor = null;
  7136.         self.transition(newComponent, cb);
  7137.       });
  7138.     } else {
  7139.       // update ref for kept-alive component
  7140.       if (cached) {
  7141.         newComponent._updateRef();
  7142.       }
  7143.       this.transition(newComponent, cb);
  7144.     }
  7145.   },
  7146.  
  7147.   /**
  7148.    * When the component changes or unbinds before an async
  7149.    * constructor is resolved, we need to invalidate its
  7150.    * pending callback.
  7151.    */
  7152.  
  7153.   invalidatePending: function invalidatePending() {
  7154.     if (this.pendingComponentCb) {
  7155.       this.pendingComponentCb.cancel();
  7156.       this.pendingComponentCb = null;
  7157.     }
  7158.   },
  7159.  
  7160.   /**
  7161.    * Instantiate/insert a new child vm.
  7162.    * If keep alive and has cached instance, insert that
  7163.    * instance; otherwise build a new one and cache it.
  7164.    *
  7165.    * @param {Object} [extraOptions]
  7166.    * @return {Vue} - the created instance
  7167.    */
  7168.  
  7169.   build: function build(extraOptions) {
  7170.     var cached = this.getCached();
  7171.     if (cached) {
  7172.       return cached;
  7173.     }
  7174.     if (this.Component) {
  7175.       // default options
  7176.       var options = {
  7177.         name: this.ComponentName,
  7178.         el: cloneNode(this.el),
  7179.         template: this.inlineTemplate,
  7180.         // make sure to add the child with correct parent
  7181.         // if this is a transcluded component, its parent
  7182.         // should be the transclusion host.
  7183.         parent: this._host || this.vm,
  7184.         // if no inline-template, then the compiled
  7185.         // linker can be cached for better performance.
  7186.         _linkerCachable: !this.inlineTemplate,
  7187.         _ref: this.descriptor.ref,
  7188.         _asComponent: true,
  7189.         _isRouterView: this._isRouterView,
  7190.         // if this is a transcluded component, context
  7191.         // will be the common parent vm of this instance
  7192.         // and its host.
  7193.         _context: this.vm,
  7194.         // if this is inside an inline v-for, the scope
  7195.         // will be the intermediate scope created for this
  7196.         // repeat fragment. this is used for linking props
  7197.         // and container directives.
  7198.         _scope: this._scope,
  7199.         // pass in the owner fragment of this component.
  7200.         // this is necessary so that the fragment can keep
  7201.         // track of its contained components in order to
  7202.         // call attach/detach hooks for them.
  7203.         _frag: this._frag
  7204.       };
  7205.       // extra options
  7206.       // in 1.0.0 this is used by vue-router only
  7207.       /* istanbul ignore if */
  7208.       if (extraOptions) {
  7209.         extend(options, extraOptions);
  7210.       }
  7211.       var child = new this.Component(options);
  7212.       if (this.keepAlive) {
  7213.         this.cache[this.Component.cid] = child;
  7214.       }
  7215.       /* istanbul ignore if */
  7216.       if (process.env.NODE_ENV !== 'production' && this.el.hasAttribute('transition') && child._isFragment) {
  7217.         warn('Transitions will not work on a fragment instance. ' + 'Template: ' + child.$options.template, child);
  7218.       }
  7219.       return child;
  7220.     }
  7221.   },
  7222.  
  7223.   /**
  7224.    * Try to get a cached instance of the current component.
  7225.    *
  7226.    * @return {Vue|undefined}
  7227.    */
  7228.  
  7229.   getCached: function getCached() {
  7230.     return this.keepAlive && this.cache[this.Component.cid];
  7231.   },
  7232.  
  7233.   /**
  7234.    * Teardown the current child, but defers cleanup so
  7235.    * that we can separate the destroy and removal steps.
  7236.    *
  7237.    * @param {Boolean} defer
  7238.    */
  7239.  
  7240.   unbuild: function unbuild(defer) {
  7241.     if (this.waitingFor) {
  7242.       if (!this.keepAlive) {
  7243.         this.waitingFor.$destroy();
  7244.       }
  7245.       this.waitingFor = null;
  7246.     }
  7247.     var child = this.childVM;
  7248.     if (!child || this.keepAlive) {
  7249.       if (child) {
  7250.         // remove ref
  7251.         child._inactive = true;
  7252.         child._updateRef(true);
  7253.       }
  7254.       return;
  7255.     }
  7256.     // the sole purpose of `deferCleanup` is so that we can
  7257.     // "deactivate" the vm right now and perform DOM removal
  7258.     // later.
  7259.     child.$destroy(false, defer);
  7260.   },
  7261.  
  7262.   /**
  7263.    * Remove current destroyed child and manually do
  7264.    * the cleanup after removal.
  7265.    *
  7266.    * @param {Function} cb
  7267.    */
  7268.  
  7269.   remove: function remove(child, cb) {
  7270.     var keepAlive = this.keepAlive;
  7271.     if (child) {
  7272.       // we may have a component switch when a previous
  7273.       // component is still being transitioned out.
  7274.       // we want to trigger only one lastest insertion cb
  7275.       // when the existing transition finishes. (#1119)
  7276.       this.pendingRemovals++;
  7277.       this.pendingRemovalCb = cb;
  7278.       var self = this;
  7279.       child.$remove(function () {
  7280.         self.pendingRemovals--;
  7281.         if (!keepAlive) child._cleanup();
  7282.         if (!self.pendingRemovals && self.pendingRemovalCb) {
  7283.           self.pendingRemovalCb();
  7284.           self.pendingRemovalCb = null;
  7285.         }
  7286.       });
  7287.     } else if (cb) {
  7288.       cb();
  7289.     }
  7290.   },
  7291.  
  7292.   /**
  7293.    * Actually swap the components, depending on the
  7294.    * transition mode. Defaults to simultaneous.
  7295.    *
  7296.    * @param {Vue} target
  7297.    * @param {Function} [cb]
  7298.    */
  7299.  
  7300.   transition: function transition(target, cb) {
  7301.     var self = this;
  7302.     var current = this.childVM;
  7303.     // for devtool inspection
  7304.     if (current) current._inactive = true;
  7305.     target._inactive = false;
  7306.     this.childVM = target;
  7307.     switch (self.params.transitionMode) {
  7308.       case 'in-out':
  7309.         target.$before(self.anchor, function () {
  7310.           self.remove(current, cb);
  7311.         });
  7312.         break;
  7313.       case 'out-in':
  7314.         self.remove(current, function () {
  7315.           target.$before(self.anchor, cb);
  7316.         });
  7317.         break;
  7318.       default:
  7319.         self.remove(current);
  7320.         target.$before(self.anchor, cb);
  7321.     }
  7322.   },
  7323.  
  7324.   /**
  7325.    * Unbind.
  7326.    */
  7327.  
  7328.   unbind: function unbind() {
  7329.     this.invalidatePending();
  7330.     // Do not defer cleanup when unbinding
  7331.     this.unbuild();
  7332.     // destroy all keep-alive cached instances
  7333.     if (this.cache) {
  7334.       for (var key in this.cache) {
  7335.         this.cache[key].$destroy();
  7336.       }
  7337.       this.cache = null;
  7338.     }
  7339.   }
  7340. };
  7341.  
  7342. /**
  7343.  * Call activate hooks in order (asynchronous)
  7344.  *
  7345.  * @param {Array} hooks
  7346.  * @param {Vue} vm
  7347.  * @param {Function} cb
  7348.  */
  7349.  
  7350. function callActivateHooks(hooks, vm, cb) {
  7351.   var total = hooks.length;
  7352.   var called = 0;
  7353.   hooks[0].call(vm, next);
  7354.   function next() {
  7355.     if (++called >= total) {
  7356.       cb();
  7357.     } else {
  7358.       hooks[called].call(vm, next);
  7359.     }
  7360.   }
  7361. }
  7362.  
  7363. var propBindingModes = config._propBindingModes;
  7364. var empty = {};
  7365.  
  7366. // regexes
  7367. var identRE$1 = /^[$_a-zA-Z]+[\w$]*$/;
  7368. var settablePathRE = /^[A-Za-z_$][\w$]*(\.[A-Za-z_$][\w$]*|\[[^\[\]]+\])*$/;
  7369.  
  7370. /**
  7371.  * Compile props on a root element and return
  7372.  * a props link function.
  7373.  *
  7374.  * @param {Element|DocumentFragment} el
  7375.  * @param {Array} propOptions
  7376.  * @param {Vue} vm
  7377.  * @return {Function} propsLinkFn
  7378.  */
  7379.  
  7380. function compileProps(el, propOptions, vm) {
  7381.   var props = [];
  7382.   var names = Object.keys(propOptions);
  7383.   var i = names.length;
  7384.   var options, name, attr, value, path, parsed, prop;
  7385.   while (i--) {
  7386.     name = names[i];
  7387.     options = propOptions[name] || empty;
  7388.  
  7389.     if (process.env.NODE_ENV !== 'production' && name === '$data') {
  7390.       warn('Do not use $data as prop.', vm);
  7391.       continue;
  7392.     }
  7393.  
  7394.     // props could contain dashes, which will be
  7395.     // interpreted as minus calculations by the parser
  7396.     // so we need to camelize the path here
  7397.     path = camelize(name);
  7398.     if (!identRE$1.test(path)) {
  7399.       process.env.NODE_ENV !== 'production' && warn('Invalid prop key: "' + name + '". Prop keys ' + 'must be valid identifiers.', vm);
  7400.       continue;
  7401.     }
  7402.  
  7403.     prop = {
  7404.       name: name,
  7405.       path: path,
  7406.       options: options,
  7407.       mode: propBindingModes.ONE_WAY,
  7408.       raw: null
  7409.     };
  7410.  
  7411.     attr = hyphenate(name);
  7412.     // first check dynamic version
  7413.     if ((value = getBindAttr(el, attr)) === null) {
  7414.       if ((value = getBindAttr(el, attr + '.sync')) !== null) {
  7415.         prop.mode = propBindingModes.TWO_WAY;
  7416.       } else if ((value = getBindAttr(el, attr + '.once')) !== null) {
  7417.         prop.mode = propBindingModes.ONE_TIME;
  7418.       }
  7419.     }
  7420.     if (value !== null) {
  7421.       // has dynamic binding!
  7422.       prop.raw = value;
  7423.       parsed = parseDirective(value);
  7424.       value = parsed.expression;
  7425.       prop.filters = parsed.filters;
  7426.       // check binding type
  7427.       if (isLiteral(value) && !parsed.filters) {
  7428.         // for expressions containing literal numbers and
  7429.         // booleans, there's no need to setup a prop binding,
  7430.         // so we can optimize them as a one-time set.
  7431.         prop.optimizedLiteral = true;
  7432.       } else {
  7433.         prop.dynamic = true;
  7434.         // check non-settable path for two-way bindings
  7435.         if (process.env.NODE_ENV !== 'production' && prop.mode === propBindingModes.TWO_WAY && !settablePathRE.test(value)) {
  7436.           prop.mode = propBindingModes.ONE_WAY;
  7437.           warn('Cannot bind two-way prop with non-settable ' + 'parent path: ' + value, vm);
  7438.         }
  7439.       }
  7440.       prop.parentPath = value;
  7441.  
  7442.       // warn required two-way
  7443.       if (process.env.NODE_ENV !== 'production' && options.twoWay && prop.mode !== propBindingModes.TWO_WAY) {
  7444.         warn('Prop "' + name + '" expects a two-way binding type.', vm);
  7445.       }
  7446.     } else if ((value = getAttr(el, attr)) !== null) {
  7447.       // has literal binding!
  7448.       prop.raw = value;
  7449.     } else if (process.env.NODE_ENV !== 'production') {
  7450.       // check possible camelCase prop usage
  7451.       var lowerCaseName = path.toLowerCase();
  7452.       value = /[A-Z\-]/.test(name) && (el.getAttribute(lowerCaseName) || el.getAttribute(':' + lowerCaseName) || el.getAttribute('v-bind:' + lowerCaseName) || el.getAttribute(':' + lowerCaseName + '.once') || el.getAttribute('v-bind:' + lowerCaseName + '.once') || el.getAttribute(':' + lowerCaseName + '.sync') || el.getAttribute('v-bind:' + lowerCaseName + '.sync'));
  7453.       if (value) {
  7454.         warn('Possible usage error for prop `' + lowerCaseName + '` - ' + 'did you mean `' + attr + '`? HTML is case-insensitive, remember to use ' + 'kebab-case for props in templates.', vm);
  7455.       } else if (options.required) {
  7456.         // warn missing required
  7457.         warn('Missing required prop: ' + name, vm);
  7458.       }
  7459.     }
  7460.     // push prop
  7461.     props.push(prop);
  7462.   }
  7463.   return makePropsLinkFn(props);
  7464. }
  7465.  
  7466. /**
  7467.  * Build a function that applies props to a vm.
  7468.  *
  7469.  * @param {Array} props
  7470.  * @return {Function} propsLinkFn
  7471.  */
  7472.  
  7473. function makePropsLinkFn(props) {
  7474.   return function propsLinkFn(vm, scope) {
  7475.     // store resolved props info
  7476.     vm._props = {};
  7477.     var inlineProps = vm.$options.propsData;
  7478.     var i = props.length;
  7479.     var prop, path, options, value, raw;
  7480.     while (i--) {
  7481.       prop = props[i];
  7482.       raw = prop.raw;
  7483.       path = prop.path;
  7484.       options = prop.options;
  7485.       vm._props[path] = prop;
  7486.       if (inlineProps && hasOwn(inlineProps, path)) {
  7487.         initProp(vm, prop, inlineProps[path]);
  7488.       }if (raw === null) {
  7489.         // initialize absent prop
  7490.         initProp(vm, prop, undefined);
  7491.       } else if (prop.dynamic) {
  7492.         // dynamic prop
  7493.         if (prop.mode === propBindingModes.ONE_TIME) {
  7494.           // one time binding
  7495.           value = (scope || vm._context || vm).$get(prop.parentPath);
  7496.           initProp(vm, prop, value);
  7497.         } else {
  7498.           if (vm._context) {
  7499.             // dynamic binding
  7500.             vm._bindDir({
  7501.               name: 'prop',
  7502.               def: propDef,
  7503.               prop: prop
  7504.             }, null, null, scope); // el, host, scope
  7505.           } else {
  7506.               // root instance
  7507.               initProp(vm, prop, vm.$get(prop.parentPath));
  7508.             }
  7509.         }
  7510.       } else if (prop.optimizedLiteral) {
  7511.         // optimized literal, cast it and just set once
  7512.         var stripped = stripQuotes(raw);
  7513.         value = stripped === raw ? toBoolean(toNumber(raw)) : stripped;
  7514.         initProp(vm, prop, value);
  7515.       } else {
  7516.         // string literal, but we need to cater for
  7517.         // Boolean props with no value, or with same
  7518.         // literal value (e.g. disabled="disabled")
  7519.         // see https://github.com/vuejs/vue-loader/issues/182
  7520.         value = options.type === Boolean && (raw === '' || raw === hyphenate(prop.name)) ? true : raw;
  7521.         initProp(vm, prop, value);
  7522.       }
  7523.     }
  7524.   };
  7525. }
  7526.  
  7527. /**
  7528.  * Process a prop with a rawValue, applying necessary coersions,
  7529.  * default values & assertions and call the given callback with
  7530.  * processed value.
  7531.  *
  7532.  * @param {Vue} vm
  7533.  * @param {Object} prop
  7534.  * @param {*} rawValue
  7535.  * @param {Function} fn
  7536.  */
  7537.  
  7538. function processPropValue(vm, prop, rawValue, fn) {
  7539.   var isSimple = prop.dynamic && isSimplePath(prop.parentPath);
  7540.   var value = rawValue;
  7541.   if (value === undefined) {
  7542.     value = getPropDefaultValue(vm, prop);
  7543.   }
  7544.   value = coerceProp(prop, value, vm);
  7545.   var coerced = value !== rawValue;
  7546.   if (!assertProp(prop, value, vm)) {
  7547.     value = undefined;
  7548.   }
  7549.   if (isSimple && !coerced) {
  7550.     withoutConversion(function () {
  7551.       fn(value);
  7552.     });
  7553.   } else {
  7554.     fn(value);
  7555.   }
  7556. }
  7557.  
  7558. /**
  7559.  * Set a prop's initial value on a vm and its data object.
  7560.  *
  7561.  * @param {Vue} vm
  7562.  * @param {Object} prop
  7563.  * @param {*} value
  7564.  */
  7565.  
  7566. function initProp(vm, prop, value) {
  7567.   processPropValue(vm, prop, value, function (value) {
  7568.     defineReactive(vm, prop.path, value);
  7569.   });
  7570. }
  7571.  
  7572. /**
  7573.  * Update a prop's value on a vm.
  7574.  *
  7575.  * @param {Vue} vm
  7576.  * @param {Object} prop
  7577.  * @param {*} value
  7578.  */
  7579.  
  7580. function updateProp(vm, prop, value) {
  7581.   processPropValue(vm, prop, value, function (value) {
  7582.     vm[prop.path] = value;
  7583.   });
  7584. }
  7585.  
  7586. /**
  7587.  * Get the default value of a prop.
  7588.  *
  7589.  * @param {Vue} vm
  7590.  * @param {Object} prop
  7591.  * @return {*}
  7592.  */
  7593.  
  7594. function getPropDefaultValue(vm, prop) {
  7595.   // no default, return undefined
  7596.   var options = prop.options;
  7597.   if (!hasOwn(options, 'default')) {
  7598.     // absent boolean value defaults to false
  7599.     return options.type === Boolean ? false : undefined;
  7600.   }
  7601.   var def = options['default'];
  7602.   // warn against non-factory defaults for Object & Array
  7603.   if (isObject(def)) {
  7604.     process.env.NODE_ENV !== 'production' && warn('Invalid default value for prop "' + prop.name + '": ' + 'Props with type Object/Array must use a factory function ' + 'to return the default value.', vm);
  7605.   }
  7606.   // call factory function for non-Function types
  7607.   return typeof def === 'function' && options.type !== Function ? def.call(vm) : def;
  7608. }
  7609.  
  7610. /**
  7611.  * Assert whether a prop is valid.
  7612.  *
  7613.  * @param {Object} prop
  7614.  * @param {*} value
  7615.  * @param {Vue} vm
  7616.  */
  7617.  
  7618. function assertProp(prop, value, vm) {
  7619.   if (!prop.options.required && ( // non-required
  7620.   prop.raw === null || // abscent
  7621.   value == null) // null or undefined
  7622.   ) {
  7623.       return true;
  7624.     }
  7625.   var options = prop.options;
  7626.   var type = options.type;
  7627.   var valid = !type;
  7628.   var expectedTypes = [];
  7629.   if (type) {
  7630.     if (!isArray(type)) {
  7631.       type = [type];
  7632.     }
  7633.     for (var i = 0; i < type.length && !valid; i++) {
  7634.       var assertedType = assertType(value, type[i]);
  7635.       expectedTypes.push(assertedType.expectedType);
  7636.       valid = assertedType.valid;
  7637.     }
  7638.   }
  7639.   if (!valid) {
  7640.     if (process.env.NODE_ENV !== 'production') {
  7641.       warn('Invalid prop: type check failed for prop "' + prop.name + '".' + ' Expected ' + expectedTypes.map(formatType).join(', ') + ', got ' + formatValue(value) + '.', vm);
  7642.     }
  7643.     return false;
  7644.   }
  7645.   var validator = options.validator;
  7646.   if (validator) {
  7647.     if (!validator(value)) {
  7648.       process.env.NODE_ENV !== 'production' && warn('Invalid prop: custom validator check failed for prop "' + prop.name + '".', vm);
  7649.       return false;
  7650.     }
  7651.   }
  7652.   return true;
  7653. }
  7654.  
  7655. /**
  7656.  * Force parsing value with coerce option.
  7657.  *
  7658.  * @param {*} value
  7659.  * @param {Object} options
  7660.  * @return {*}
  7661.  */
  7662.  
  7663. function coerceProp(prop, value, vm) {
  7664.   var coerce = prop.options.coerce;
  7665.   if (!coerce) {
  7666.     return value;
  7667.   }
  7668.   if (typeof coerce === 'function') {
  7669.     return coerce(value);
  7670.   } else {
  7671.     process.env.NODE_ENV !== 'production' && warn('Invalid coerce for prop "' + prop.name + '": expected function, got ' + typeof coerce + '.', vm);
  7672.     return value;
  7673.   }
  7674. }
  7675.  
  7676. /**
  7677.  * Assert the type of a value
  7678.  *
  7679.  * @param {*} value
  7680.  * @param {Function} type
  7681.  * @return {Object}
  7682.  */
  7683.  
  7684. function assertType(value, type) {
  7685.   var valid;
  7686.   var expectedType;
  7687.   if (type === String) {
  7688.     expectedType = 'string';
  7689.     valid = typeof value === expectedType;
  7690.   } else if (type === Number) {
  7691.     expectedType = 'number';
  7692.     valid = typeof value === expectedType;
  7693.   } else if (type === Boolean) {
  7694.     expectedType = 'boolean';
  7695.     valid = typeof value === expectedType;
  7696.   } else if (type === Function) {
  7697.     expectedType = 'function';
  7698.     valid = typeof value === expectedType;
  7699.   } else if (type === Object) {
  7700.     expectedType = 'object';
  7701.     valid = isPlainObject(value);
  7702.   } else if (type === Array) {
  7703.     expectedType = 'array';
  7704.     valid = isArray(value);
  7705.   } else {
  7706.     valid = value instanceof type;
  7707.   }
  7708.   return {
  7709.     valid: valid,
  7710.     expectedType: expectedType
  7711.   };
  7712. }
  7713.  
  7714. /**
  7715.  * Format type for output
  7716.  *
  7717.  * @param {String} type
  7718.  * @return {String}
  7719.  */
  7720.  
  7721. function formatType(type) {
  7722.   return type ? type.charAt(0).toUpperCase() + type.slice(1) : 'custom type';
  7723. }
  7724.  
  7725. /**
  7726.  * Format value
  7727.  *
  7728.  * @param {*} value
  7729.  * @return {String}
  7730.  */
  7731.  
  7732. function formatValue(val) {
  7733.   return Object.prototype.toString.call(val).slice(8, -1);
  7734. }
  7735.  
  7736. var bindingModes = config._propBindingModes;
  7737.  
  7738. var propDef = {
  7739.  
  7740.   bind: function bind() {
  7741.     var child = this.vm;
  7742.     var parent = child._context;
  7743.     // passed in from compiler directly
  7744.     var prop = this.descriptor.prop;
  7745.     var childKey = prop.path;
  7746.     var parentKey = prop.parentPath;
  7747.     var twoWay = prop.mode === bindingModes.TWO_WAY;
  7748.  
  7749.     var parentWatcher = this.parentWatcher = new Watcher(parent, parentKey, function (val) {
  7750.       updateProp(child, prop, val);
  7751.     }, {
  7752.       twoWay: twoWay,
  7753.       filters: prop.filters,
  7754.       // important: props need to be observed on the
  7755.       // v-for scope if present
  7756.       scope: this._scope
  7757.     });
  7758.  
  7759.     // set the child initial value.
  7760.     initProp(child, prop, parentWatcher.value);
  7761.  
  7762.     // setup two-way binding
  7763.     if (twoWay) {
  7764.       // important: defer the child watcher creation until
  7765.       // the created hook (after data observation)
  7766.       var self = this;
  7767.       child.$once('pre-hook:created', function () {
  7768.         self.childWatcher = new Watcher(child, childKey, function (val) {
  7769.           parentWatcher.set(val);
  7770.         }, {
  7771.           // ensure sync upward before parent sync down.
  7772.           // this is necessary in cases e.g. the child
  7773.           // mutates a prop array, then replaces it. (#1683)
  7774.           sync: true
  7775.         });
  7776.       });
  7777.     }
  7778.   },
  7779.  
  7780.   unbind: function unbind() {
  7781.     this.parentWatcher.teardown();
  7782.     if (this.childWatcher) {
  7783.       this.childWatcher.teardown();
  7784.     }
  7785.   }
  7786. };
  7787.  
  7788. var queue$1 = [];
  7789. var queued = false;
  7790.  
  7791. /**
  7792.  * Push a job into the queue.
  7793.  *
  7794.  * @param {Function} job
  7795.  */
  7796.  
  7797. function pushJob(job) {
  7798.   queue$1.push(job);
  7799.   if (!queued) {
  7800.     queued = true;
  7801.     nextTick(flush);
  7802.   }
  7803. }
  7804.  
  7805. /**
  7806.  * Flush the queue, and do one forced reflow before
  7807.  * triggering transitions.
  7808.  */
  7809.  
  7810. function flush() {
  7811.   // Force layout
  7812.   var f = document.documentElement.offsetHeight;
  7813.   for (var i = 0; i < queue$1.length; i++) {
  7814.     queue$1[i]();
  7815.   }
  7816.   queue$1 = [];
  7817.   queued = false;
  7818.   // dummy return, so js linters don't complain about
  7819.   // unused variable f
  7820.   return f;
  7821. }
  7822.  
  7823. var TYPE_TRANSITION = 'transition';
  7824. var TYPE_ANIMATION = 'animation';
  7825. var transDurationProp = transitionProp + 'Duration';
  7826. var animDurationProp = animationProp + 'Duration';
  7827.  
  7828. /**
  7829.  * If a just-entered element is applied the
  7830.  * leave class while its enter transition hasn't started yet,
  7831.  * and the transitioned property has the same value for both
  7832.  * enter/leave, then the leave transition will be skipped and
  7833.  * the transitionend event never fires. This function ensures
  7834.  * its callback to be called after a transition has started
  7835.  * by waiting for double raf.
  7836.  *
  7837.  * It falls back to setTimeout on devices that support CSS
  7838.  * transitions but not raf (e.g. Android 4.2 browser) - since
  7839.  * these environments are usually slow, we are giving it a
  7840.  * relatively large timeout.
  7841.  */
  7842.  
  7843. var raf = inBrowser && window.requestAnimationFrame;
  7844. var waitForTransitionStart = raf
  7845. /* istanbul ignore next */
  7846. ? function (fn) {
  7847.   raf(function () {
  7848.     raf(fn);
  7849.   });
  7850. } : function (fn) {
  7851.   setTimeout(fn, 50);
  7852. };
  7853.  
  7854. /**
  7855.  * A Transition object that encapsulates the state and logic
  7856.  * of the transition.
  7857.  *
  7858.  * @param {Element} el
  7859.  * @param {String} id
  7860.  * @param {Object} hooks
  7861.  * @param {Vue} vm
  7862.  */
  7863. function Transition(el, id, hooks, vm) {
  7864.   this.id = id;
  7865.   this.el = el;
  7866.   this.enterClass = hooks && hooks.enterClass || id + '-enter';
  7867.   this.leaveClass = hooks && hooks.leaveClass || id + '-leave';
  7868.   this.hooks = hooks;
  7869.   this.vm = vm;
  7870.   // async state
  7871.   this.pendingCssEvent = this.pendingCssCb = this.cancel = this.pendingJsCb = this.op = this.cb = null;
  7872.   this.justEntered = false;
  7873.   this.entered = this.left = false;
  7874.   this.typeCache = {};
  7875.   // check css transition type
  7876.   this.type = hooks && hooks.type;
  7877.   /* istanbul ignore if */
  7878.   if (process.env.NODE_ENV !== 'production') {
  7879.     if (this.type && this.type !== TYPE_TRANSITION && this.type !== TYPE_ANIMATION) {
  7880.       warn('invalid CSS transition type for transition="' + this.id + '": ' + this.type, vm);
  7881.     }
  7882.   }
  7883.   // bind
  7884.   var self = this;['enterNextTick', 'enterDone', 'leaveNextTick', 'leaveDone'].forEach(function (m) {
  7885.     self[m] = bind(self[m], self);
  7886.   });
  7887. }
  7888.  
  7889. var p$1 = Transition.prototype;
  7890.  
  7891. /**
  7892.  * Start an entering transition.
  7893.  *
  7894.  * 1. enter transition triggered
  7895.  * 2. call beforeEnter hook
  7896.  * 3. add enter class
  7897.  * 4. insert/show element
  7898.  * 5. call enter hook (with possible explicit js callback)
  7899.  * 6. reflow
  7900.  * 7. based on transition type:
  7901.  *    - transition:
  7902.  *        remove class now, wait for transitionend,
  7903.  *        then done if there's no explicit js callback.
  7904.  *    - animation:
  7905.  *        wait for animationend, remove class,
  7906.  *        then done if there's no explicit js callback.
  7907.  *    - no css transition:
  7908.  *        done now if there's no explicit js callback.
  7909.  * 8. wait for either done or js callback, then call
  7910.  *    afterEnter hook.
  7911.  *
  7912.  * @param {Function} op - insert/show the element
  7913.  * @param {Function} [cb]
  7914.  */
  7915.  
  7916. p$1.enter = function (op, cb) {
  7917.   this.cancelPending();
  7918.   this.callHook('beforeEnter');
  7919.   this.cb = cb;
  7920.   addClass(this.el, this.enterClass);
  7921.   op();
  7922.   this.entered = false;
  7923.   this.callHookWithCb('enter');
  7924.   if (this.entered) {
  7925.     return; // user called done synchronously.
  7926.   }
  7927.   this.cancel = this.hooks && this.hooks.enterCancelled;
  7928.   pushJob(this.enterNextTick);
  7929. };
  7930.  
  7931. /**
  7932.  * The "nextTick" phase of an entering transition, which is
  7933.  * to be pushed into a queue and executed after a reflow so
  7934.  * that removing the class can trigger a CSS transition.
  7935.  */
  7936.  
  7937. p$1.enterNextTick = function () {
  7938.   var _this = this;
  7939.  
  7940.   // prevent transition skipping
  7941.   this.justEntered = true;
  7942.   waitForTransitionStart(function () {
  7943.     _this.justEntered = false;
  7944.   });
  7945.   var enterDone = this.enterDone;
  7946.   var type = this.getCssTransitionType(this.enterClass);
  7947.   if (!this.pendingJsCb) {
  7948.     if (type === TYPE_TRANSITION) {
  7949.       // trigger transition by removing enter class now
  7950.       removeClass(this.el, this.enterClass);
  7951.       this.setupCssCb(transitionEndEvent, enterDone);
  7952.     } else if (type === TYPE_ANIMATION) {
  7953.       this.setupCssCb(animationEndEvent, enterDone);
  7954.     } else {
  7955.       enterDone();
  7956.     }
  7957.   } else if (type === TYPE_TRANSITION) {
  7958.     removeClass(this.el, this.enterClass);
  7959.   }
  7960. };
  7961.  
  7962. /**
  7963.  * The "cleanup" phase of an entering transition.
  7964.  */
  7965.  
  7966. p$1.enterDone = function () {
  7967.   this.entered = true;
  7968.   this.cancel = this.pendingJsCb = null;
  7969.   removeClass(this.el, this.enterClass);
  7970.   this.callHook('afterEnter');
  7971.   if (this.cb) this.cb();
  7972. };
  7973.  
  7974. /**
  7975.  * Start a leaving transition.
  7976.  *
  7977.  * 1. leave transition triggered.
  7978.  * 2. call beforeLeave hook
  7979.  * 3. add leave class (trigger css transition)
  7980.  * 4. call leave hook (with possible explicit js callback)
  7981.  * 5. reflow if no explicit js callback is provided
  7982.  * 6. based on transition type:
  7983.  *    - transition or animation:
  7984.  *        wait for end event, remove class, then done if
  7985.  *        there's no explicit js callback.
  7986.  *    - no css transition:
  7987.  *        done if there's no explicit js callback.
  7988.  * 7. wait for either done or js callback, then call
  7989.  *    afterLeave hook.
  7990.  *
  7991.  * @param {Function} op - remove/hide the element
  7992.  * @param {Function} [cb]
  7993.  */
  7994.  
  7995. p$1.leave = function (op, cb) {
  7996.   this.cancelPending();
  7997.   this.callHook('beforeLeave');
  7998.   this.op = op;
  7999.   this.cb = cb;
  8000.   addClass(this.el, this.leaveClass);
  8001.   this.left = false;
  8002.   this.callHookWithCb('leave');
  8003.   if (this.left) {
  8004.     return; // user called done synchronously.
  8005.   }
  8006.   this.cancel = this.hooks && this.hooks.leaveCancelled;
  8007.   // only need to handle leaveDone if
  8008.   // 1. the transition is already done (synchronously called
  8009.   //    by the user, which causes this.op set to null)
  8010.   // 2. there's no explicit js callback
  8011.   if (this.op && !this.pendingJsCb) {
  8012.     // if a CSS transition leaves immediately after enter,
  8013.     // the transitionend event never fires. therefore we
  8014.     // detect such cases and end the leave immediately.
  8015.     if (this.justEntered) {
  8016.       this.leaveDone();
  8017.     } else {
  8018.       pushJob(this.leaveNextTick);
  8019.     }
  8020.   }
  8021. };
  8022.  
  8023. /**
  8024.  * The "nextTick" phase of a leaving transition.
  8025.  */
  8026.  
  8027. p$1.leaveNextTick = function () {
  8028.   var type = this.getCssTransitionType(this.leaveClass);
  8029.   if (type) {
  8030.     var event = type === TYPE_TRANSITION ? transitionEndEvent : animationEndEvent;
  8031.     this.setupCssCb(event, this.leaveDone);
  8032.   } else {
  8033.     this.leaveDone();
  8034.   }
  8035. };
  8036.  
  8037. /**
  8038.  * The "cleanup" phase of a leaving transition.
  8039.  */
  8040.  
  8041. p$1.leaveDone = function () {
  8042.   this.left = true;
  8043.   this.cancel = this.pendingJsCb = null;
  8044.   this.op();
  8045.   removeClass(this.el, this.leaveClass);
  8046.   this.callHook('afterLeave');
  8047.   if (this.cb) this.cb();
  8048.   this.op = null;
  8049. };
  8050.  
  8051. /**
  8052.  * Cancel any pending callbacks from a previously running
  8053.  * but not finished transition.
  8054.  */
  8055.  
  8056. p$1.cancelPending = function () {
  8057.   this.op = this.cb = null;
  8058.   var hasPending = false;
  8059.   if (this.pendingCssCb) {
  8060.     hasPending = true;
  8061.     off(this.el, this.pendingCssEvent, this.pendingCssCb);
  8062.     this.pendingCssEvent = this.pendingCssCb = null;
  8063.   }
  8064.   if (this.pendingJsCb) {
  8065.     hasPending = true;
  8066.     this.pendingJsCb.cancel();
  8067.     this.pendingJsCb = null;
  8068.   }
  8069.   if (hasPending) {
  8070.     removeClass(this.el, this.enterClass);
  8071.     removeClass(this.el, this.leaveClass);
  8072.   }
  8073.   if (this.cancel) {
  8074.     this.cancel.call(this.vm, this.el);
  8075.     this.cancel = null;
  8076.   }
  8077. };
  8078.  
  8079. /**
  8080.  * Call a user-provided synchronous hook function.
  8081.  *
  8082.  * @param {String} type
  8083.  */
  8084.  
  8085. p$1.callHook = function (type) {
  8086.   if (this.hooks && this.hooks[type]) {
  8087.     this.hooks[type].call(this.vm, this.el);
  8088.   }
  8089. };
  8090.  
  8091. /**
  8092.  * Call a user-provided, potentially-async hook function.
  8093.  * We check for the length of arguments to see if the hook
  8094.  * expects a `done` callback. If true, the transition's end
  8095.  * will be determined by when the user calls that callback;
  8096.  * otherwise, the end is determined by the CSS transition or
  8097.  * animation.
  8098.  *
  8099.  * @param {String} type
  8100.  */
  8101.  
  8102. p$1.callHookWithCb = function (type) {
  8103.   var hook = this.hooks && this.hooks[type];
  8104.   if (hook) {
  8105.     if (hook.length > 1) {
  8106.       this.pendingJsCb = cancellable(this[type + 'Done']);
  8107.     }
  8108.     hook.call(this.vm, this.el, this.pendingJsCb);
  8109.   }
  8110. };
  8111.  
  8112. /**
  8113.  * Get an element's transition type based on the
  8114.  * calculated styles.
  8115.  *
  8116.  * @param {String} className
  8117.  * @return {Number}
  8118.  */
  8119.  
  8120. p$1.getCssTransitionType = function (className) {
  8121.   /* istanbul ignore if */
  8122.   if (!transitionEndEvent ||
  8123.   // skip CSS transitions if page is not visible -
  8124.   // this solves the issue of transitionend events not
  8125.   // firing until the page is visible again.
  8126.   // pageVisibility API is supported in IE10+, same as
  8127.   // CSS transitions.
  8128.   document.hidden ||
  8129.   // explicit js-only transition
  8130.   this.hooks && this.hooks.css === false ||
  8131.   // element is hidden
  8132.   isHidden(this.el)) {
  8133.     return;
  8134.   }
  8135.   var type = this.type || this.typeCache[className];
  8136.   if (type) return type;
  8137.   var inlineStyles = this.el.style;
  8138.   var computedStyles = window.getComputedStyle(this.el);
  8139.   var transDuration = inlineStyles[transDurationProp] || computedStyles[transDurationProp];
  8140.   if (transDuration && transDuration !== '0s') {
  8141.     type = TYPE_TRANSITION;
  8142.   } else {
  8143.     var animDuration = inlineStyles[animDurationProp] || computedStyles[animDurationProp];
  8144.     if (animDuration && animDuration !== '0s') {
  8145.       type = TYPE_ANIMATION;
  8146.     }
  8147.   }
  8148.   if (type) {
  8149.     this.typeCache[className] = type;
  8150.   }
  8151.   return type;
  8152. };
  8153.  
  8154. /**
  8155.  * Setup a CSS transitionend/animationend callback.
  8156.  *
  8157.  * @param {String} event
  8158.  * @param {Function} cb
  8159.  */
  8160.  
  8161. p$1.setupCssCb = function (event, cb) {
  8162.   this.pendingCssEvent = event;
  8163.   var self = this;
  8164.   var el = this.el;
  8165.   var onEnd = this.pendingCssCb = function (e) {
  8166.     if (e.target === el) {
  8167.       off(el, event, onEnd);
  8168.       self.pendingCssEvent = self.pendingCssCb = null;
  8169.       if (!self.pendingJsCb && cb) {
  8170.         cb();
  8171.       }
  8172.     }
  8173.   };
  8174.   on(el, event, onEnd);
  8175. };
  8176.  
  8177. /**
  8178.  * Check if an element is hidden - in that case we can just
  8179.  * skip the transition alltogether.
  8180.  *
  8181.  * @param {Element} el
  8182.  * @return {Boolean}
  8183.  */
  8184.  
  8185. function isHidden(el) {
  8186.   if (/svg$/.test(el.namespaceURI)) {
  8187.     // SVG elements do not have offset(Width|Height)
  8188.     // so we need to check the client rect
  8189.     var rect = el.getBoundingClientRect();
  8190.     return !(rect.width || rect.height);
  8191.   } else {
  8192.     return !(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
  8193.   }
  8194. }
  8195.  
  8196. var transition$1 = {
  8197.  
  8198.   priority: TRANSITION,
  8199.  
  8200.   update: function update(id, oldId) {
  8201.     var el = this.el;
  8202.     // resolve on owner vm
  8203.     var hooks = resolveAsset(this.vm.$options, 'transitions', id);
  8204.     id = id || 'v';
  8205.     oldId = oldId || 'v';
  8206.     el.__v_trans = new Transition(el, id, hooks, this.vm);
  8207.     removeClass(el, oldId + '-transition');
  8208.     addClass(el, id + '-transition');
  8209.   }
  8210. };
  8211.  
  8212. var internalDirectives = {
  8213.   style: style,
  8214.   'class': vClass,
  8215.   component: component,
  8216.   prop: propDef,
  8217.   transition: transition$1
  8218. };
  8219.  
  8220. // special binding prefixes
  8221. var bindRE = /^v-bind:|^:/;
  8222. var onRE = /^v-on:|^@/;
  8223. var dirAttrRE = /^v-([^:]+)(?:$|:(.*)$)/;
  8224. var modifierRE = /\.[^\.]+/g;
  8225. var transitionRE = /^(v-bind:|:)?transition$/;
  8226.  
  8227. // default directive priority
  8228. var DEFAULT_PRIORITY = 1000;
  8229. var DEFAULT_TERMINAL_PRIORITY = 2000;
  8230.  
  8231. /**
  8232.  * Compile a template and return a reusable composite link
  8233.  * function, which recursively contains more link functions
  8234.  * inside. This top level compile function would normally
  8235.  * be called on instance root nodes, but can also be used
  8236.  * for partial compilation if the partial argument is true.
  8237.  *
  8238.  * The returned composite link function, when called, will
  8239.  * return an unlink function that tearsdown all directives
  8240.  * created during the linking phase.
  8241.  *
  8242.  * @param {Element|DocumentFragment} el
  8243.  * @param {Object} options
  8244.  * @param {Boolean} partial
  8245.  * @return {Function}
  8246.  */
  8247.  
  8248. function compile(el, options, partial) {
  8249.   // link function for the node itself.
  8250.   var nodeLinkFn = partial || !options._asComponent ? compileNode(el, options) : null;
  8251.   // link function for the childNodes
  8252.   var childLinkFn = !(nodeLinkFn && nodeLinkFn.terminal) && !isScript(el) && el.hasChildNodes() ? compileNodeList(el.childNodes, options) : null;
  8253.  
  8254.   /**
  8255.    * A composite linker function to be called on a already
  8256.    * compiled piece of DOM, which instantiates all directive
  8257.    * instances.
  8258.    *
  8259.    * @param {Vue} vm
  8260.    * @param {Element|DocumentFragment} el
  8261.    * @param {Vue} [host] - host vm of transcluded content
  8262.    * @param {Object} [scope] - v-for scope
  8263.    * @param {Fragment} [frag] - link context fragment
  8264.    * @return {Function|undefined}
  8265.    */
  8266.  
  8267.   return function compositeLinkFn(vm, el, host, scope, frag) {
  8268.     // cache childNodes before linking parent, fix #657
  8269.     var childNodes = toArray(el.childNodes);
  8270.     // link
  8271.     var dirs = linkAndCapture(function compositeLinkCapturer() {
  8272.       if (nodeLinkFn) nodeLinkFn(vm, el, host, scope, frag);
  8273.       if (childLinkFn) childLinkFn(vm, childNodes, host, scope, frag);
  8274.     }, vm);
  8275.     return makeUnlinkFn(vm, dirs);
  8276.   };
  8277. }
  8278.  
  8279. /**
  8280.  * Apply a linker to a vm/element pair and capture the
  8281.  * directives created during the process.
  8282.  *
  8283.  * @param {Function} linker
  8284.  * @param {Vue} vm
  8285.  */
  8286.  
  8287. function linkAndCapture(linker, vm) {
  8288.   /* istanbul ignore if */
  8289.   if (process.env.NODE_ENV === 'production') {
  8290.     // reset directives before every capture in production
  8291.     // mode, so that when unlinking we don't need to splice
  8292.     // them out (which turns out to be a perf hit).
  8293.     // they are kept in development mode because they are
  8294.     // useful for Vue's own tests.
  8295.     vm._directives = [];
  8296.   }
  8297.   var originalDirCount = vm._directives.length;
  8298.   linker();
  8299.   var dirs = vm._directives.slice(originalDirCount);
  8300.   dirs.sort(directiveComparator);
  8301.   for (var i = 0, l = dirs.length; i < l; i++) {
  8302.     dirs[i]._bind();
  8303.   }
  8304.   return dirs;
  8305. }
  8306.  
  8307. /**
  8308.  * Directive priority sort comparator
  8309.  *
  8310.  * @param {Object} a
  8311.  * @param {Object} b
  8312.  */
  8313.  
  8314. function directiveComparator(a, b) {
  8315.   a = a.descriptor.def.priority || DEFAULT_PRIORITY;
  8316.   b = b.descriptor.def.priority || DEFAULT_PRIORITY;
  8317.   return a > b ? -1 : a === b ? 0 : 1;
  8318. }
  8319.  
  8320. /**
  8321.  * Linker functions return an unlink function that
  8322.  * tearsdown all directives instances generated during
  8323.  * the process.
  8324.  *
  8325.  * We create unlink functions with only the necessary
  8326.  * information to avoid retaining additional closures.
  8327.  *
  8328.  * @param {Vue} vm
  8329.  * @param {Array} dirs
  8330.  * @param {Vue} [context]
  8331.  * @param {Array} [contextDirs]
  8332.  * @return {Function}
  8333.  */
  8334.  
  8335. function makeUnlinkFn(vm, dirs, context, contextDirs) {
  8336.   function unlink(destroying) {
  8337.     teardownDirs(vm, dirs, destroying);
  8338.     if (context && contextDirs) {
  8339.       teardownDirs(context, contextDirs);
  8340.     }
  8341.   }
  8342.   // expose linked directives
  8343.   unlink.dirs = dirs;
  8344.   return unlink;
  8345. }
  8346.  
  8347. /**
  8348.  * Teardown partial linked directives.
  8349.  *
  8350.  * @param {Vue} vm
  8351.  * @param {Array} dirs
  8352.  * @param {Boolean} destroying
  8353.  */
  8354.  
  8355. function teardownDirs(vm, dirs, destroying) {
  8356.   var i = dirs.length;
  8357.   while (i--) {
  8358.     dirs[i]._teardown();
  8359.     if (process.env.NODE_ENV !== 'production' && !destroying) {
  8360.       vm._directives.$remove(dirs[i]);
  8361.     }
  8362.   }
  8363. }
  8364.  
  8365. /**
  8366.  * Compile link props on an instance.
  8367.  *
  8368.  * @param {Vue} vm
  8369.  * @param {Element} el
  8370.  * @param {Object} props
  8371.  * @param {Object} [scope]
  8372.  * @return {Function}
  8373.  */
  8374.  
  8375. function compileAndLinkProps(vm, el, props, scope) {
  8376.   var propsLinkFn = compileProps(el, props, vm);
  8377.   var propDirs = linkAndCapture(function () {
  8378.     propsLinkFn(vm, scope);
  8379.   }, vm);
  8380.   return makeUnlinkFn(vm, propDirs);
  8381. }
  8382.  
  8383. /**
  8384.  * Compile the root element of an instance.
  8385.  *
  8386.  * 1. attrs on context container (context scope)
  8387.  * 2. attrs on the component template root node, if
  8388.  *    replace:true (child scope)
  8389.  *
  8390.  * If this is a fragment instance, we only need to compile 1.
  8391.  *
  8392.  * @param {Element} el
  8393.  * @param {Object} options
  8394.  * @param {Object} contextOptions
  8395.  * @return {Function}
  8396.  */
  8397.  
  8398. function compileRoot(el, options, contextOptions) {
  8399.   var containerAttrs = options._containerAttrs;
  8400.   var replacerAttrs = options._replacerAttrs;
  8401.   var contextLinkFn, replacerLinkFn;
  8402.  
  8403.   // only need to compile other attributes for
  8404.   // non-fragment instances
  8405.   if (el.nodeType !== 11) {
  8406.     // for components, container and replacer need to be
  8407.     // compiled separately and linked in different scopes.
  8408.     if (options._asComponent) {
  8409.       // 2. container attributes
  8410.       if (containerAttrs && contextOptions) {
  8411.         contextLinkFn = compileDirectives(containerAttrs, contextOptions);
  8412.       }
  8413.       if (replacerAttrs) {
  8414.         // 3. replacer attributes
  8415.         replacerLinkFn = compileDirectives(replacerAttrs, options);
  8416.       }
  8417.     } else {
  8418.       // non-component, just compile as a normal element.
  8419.       replacerLinkFn = compileDirectives(el.attributes, options);
  8420.     }
  8421.   } else if (process.env.NODE_ENV !== 'production' && containerAttrs) {
  8422.     // warn container directives for fragment instances
  8423.     var names = containerAttrs.filter(function (attr) {
  8424.       // allow vue-loader/vueify scoped css attributes
  8425.       return attr.name.indexOf('_v-') < 0 &&
  8426.       // allow event listeners
  8427.       !onRE.test(attr.name) &&
  8428.       // allow slots
  8429.       attr.name !== 'slot';
  8430.     }).map(function (attr) {
  8431.       return '"' + attr.name + '"';
  8432.     });
  8433.     if (names.length) {
  8434.       var plural = names.length > 1;
  8435.       warn('Attribute' + (plural ? 's ' : ' ') + names.join(', ') + (plural ? ' are' : ' is') + ' ignored on component ' + '<' + options.el.tagName.toLowerCase() + '> because ' + 'the component is a fragment instance: ' + 'http://vuejs.org/guide/components.html#Fragment-Instance');
  8436.     }
  8437.   }
  8438.  
  8439.   options._containerAttrs = options._replacerAttrs = null;
  8440.   return function rootLinkFn(vm, el, scope) {
  8441.     // link context scope dirs
  8442.     var context = vm._context;
  8443.     var contextDirs;
  8444.     if (context && contextLinkFn) {
  8445.       contextDirs = linkAndCapture(function () {
  8446.         contextLinkFn(context, el, null, scope);
  8447.       }, context);
  8448.     }
  8449.  
  8450.     // link self
  8451.     var selfDirs = linkAndCapture(function () {
  8452.       if (replacerLinkFn) replacerLinkFn(vm, el);
  8453.     }, vm);
  8454.  
  8455.     // return the unlink function that tearsdown context
  8456.     // container directives.
  8457.     return makeUnlinkFn(vm, selfDirs, context, contextDirs);
  8458.   };
  8459. }
  8460.  
  8461. /**
  8462.  * Compile a node and return a nodeLinkFn based on the
  8463.  * node type.
  8464.  *
  8465.  * @param {Node} node
  8466.  * @param {Object} options
  8467.  * @return {Function|null}
  8468.  */
  8469.  
  8470. function compileNode(node, options) {
  8471.   var type = node.nodeType;
  8472.   if (type === 1 && !isScript(node)) {
  8473.     return compileElement(node, options);
  8474.   } else if (type === 3 && node.data.trim()) {
  8475.     return compileTextNode(node, options);
  8476.   } else {
  8477.     return null;
  8478.   }
  8479. }
  8480.  
  8481. /**
  8482.  * Compile an element and return a nodeLinkFn.
  8483.  *
  8484.  * @param {Element} el
  8485.  * @param {Object} options
  8486.  * @return {Function|null}
  8487.  */
  8488.  
  8489. function compileElement(el, options) {
  8490.   // preprocess textareas.
  8491.   // textarea treats its text content as the initial value.
  8492.   // just bind it as an attr directive for value.
  8493.   if (el.tagName === 'TEXTAREA') {
  8494.     var tokens = parseText(el.value);
  8495.     if (tokens) {
  8496.       el.setAttribute(':value', tokensToExp(tokens));
  8497.       el.value = '';
  8498.     }
  8499.   }
  8500.   var linkFn;
  8501.   var hasAttrs = el.hasAttributes();
  8502.   var attrs = hasAttrs && toArray(el.attributes);
  8503.   // check terminal directives (for & if)
  8504.   if (hasAttrs) {
  8505.     linkFn = checkTerminalDirectives(el, attrs, options);
  8506.   }
  8507.   // check element directives
  8508.   if (!linkFn) {
  8509.     linkFn = checkElementDirectives(el, options);
  8510.   }
  8511.   // check component
  8512.   if (!linkFn) {
  8513.     linkFn = checkComponent(el, options);
  8514.   }
  8515.   // normal directives
  8516.   if (!linkFn && hasAttrs) {
  8517.     linkFn = compileDirectives(attrs, options);
  8518.   }
  8519.   return linkFn;
  8520. }
  8521.  
  8522. /**
  8523.  * Compile a textNode and return a nodeLinkFn.
  8524.  *
  8525.  * @param {TextNode} node
  8526.  * @param {Object} options
  8527.  * @return {Function|null} textNodeLinkFn
  8528.  */
  8529.  
  8530. function compileTextNode(node, options) {
  8531.   // skip marked text nodes
  8532.   if (node._skip) {
  8533.     return removeText;
  8534.   }
  8535.  
  8536.   var tokens = parseText(node.wholeText);
  8537.   if (!tokens) {
  8538.     return null;
  8539.   }
  8540.  
  8541.   // mark adjacent text nodes as skipped,
  8542.   // because we are using node.wholeText to compile
  8543.   // all adjacent text nodes together. This fixes
  8544.   // issues in IE where sometimes it splits up a single
  8545.   // text node into multiple ones.
  8546.   var next = node.nextSibling;
  8547.   while (next && next.nodeType === 3) {
  8548.     next._skip = true;
  8549.     next = next.nextSibling;
  8550.   }
  8551.  
  8552.   var frag = document.createDocumentFragment();
  8553.   var el, token;
  8554.   for (var i = 0, l = tokens.length; i < l; i++) {
  8555.     token = tokens[i];
  8556.     el = token.tag ? processTextToken(token, options) : document.createTextNode(token.value);
  8557.     frag.appendChild(el);
  8558.   }
  8559.   return makeTextNodeLinkFn(tokens, frag, options);
  8560. }
  8561.  
  8562. /**
  8563.  * Linker for an skipped text node.
  8564.  *
  8565.  * @param {Vue} vm
  8566.  * @param {Text} node
  8567.  */
  8568.  
  8569. function removeText(vm, node) {
  8570.   remove(node);
  8571. }
  8572.  
  8573. /**
  8574.  * Process a single text token.
  8575.  *
  8576.  * @param {Object} token
  8577.  * @param {Object} options
  8578.  * @return {Node}
  8579.  */
  8580.  
  8581. function processTextToken(token, options) {
  8582.   var el;
  8583.   if (token.oneTime) {
  8584.     el = document.createTextNode(token.value);
  8585.   } else {
  8586.     if (token.html) {
  8587.       el = document.createComment('v-html');
  8588.       setTokenType('html');
  8589.     } else {
  8590.       // IE will clean up empty textNodes during
  8591.       // frag.cloneNode(true), so we have to give it
  8592.       // something here...
  8593.       el = document.createTextNode(' ');
  8594.       setTokenType('text');
  8595.     }
  8596.   }
  8597.   function setTokenType(type) {
  8598.     if (token.descriptor) return;
  8599.     var parsed = parseDirective(token.value);
  8600.     token.descriptor = {
  8601.       name: type,
  8602.       def: directives[type],
  8603.       expression: parsed.expression,
  8604.       filters: parsed.filters
  8605.     };
  8606.   }
  8607.   return el;
  8608. }
  8609.  
  8610. /**
  8611.  * Build a function that processes a textNode.
  8612.  *
  8613.  * @param {Array<Object>} tokens
  8614.  * @param {DocumentFragment} frag
  8615.  */
  8616.  
  8617. function makeTextNodeLinkFn(tokens, frag) {
  8618.   return function textNodeLinkFn(vm, el, host, scope) {
  8619.     var fragClone = frag.cloneNode(true);
  8620.     var childNodes = toArray(fragClone.childNodes);
  8621.     var token, value, node;
  8622.     for (var i = 0, l = tokens.length; i < l; i++) {
  8623.       token = tokens[i];
  8624.       value = token.value;
  8625.       if (token.tag) {
  8626.         node = childNodes[i];
  8627.         if (token.oneTime) {
  8628.           value = (scope || vm).$eval(value);
  8629.           if (token.html) {
  8630.             replace(node, parseTemplate(value, true));
  8631.           } else {
  8632.             node.data = _toString(value);
  8633.           }
  8634.         } else {
  8635.           vm._bindDir(token.descriptor, node, host, scope);
  8636.         }
  8637.       }
  8638.     }
  8639.     replace(el, fragClone);
  8640.   };
  8641. }
  8642.  
  8643. /**
  8644.  * Compile a node list and return a childLinkFn.
  8645.  *
  8646.  * @param {NodeList} nodeList
  8647.  * @param {Object} options
  8648.  * @return {Function|undefined}
  8649.  */
  8650.  
  8651. function compileNodeList(nodeList, options) {
  8652.   var linkFns = [];
  8653.   var nodeLinkFn, childLinkFn, node;
  8654.   for (var i = 0, l = nodeList.length; i < l; i++) {
  8655.     node = nodeList[i];
  8656.     nodeLinkFn = compileNode(node, options);
  8657.     childLinkFn = !(nodeLinkFn && nodeLinkFn.terminal) && node.tagName !== 'SCRIPT' && node.hasChildNodes() ? compileNodeList(node.childNodes, options) : null;
  8658.     linkFns.push(nodeLinkFn, childLinkFn);
  8659.   }
  8660.   return linkFns.length ? makeChildLinkFn(linkFns) : null;
  8661. }
  8662.  
  8663. /**
  8664.  * Make a child link function for a node's childNodes.
  8665.  *
  8666.  * @param {Array<Function>} linkFns
  8667.  * @return {Function} childLinkFn
  8668.  */
  8669.  
  8670. function makeChildLinkFn(linkFns) {
  8671.   return function childLinkFn(vm, nodes, host, scope, frag) {
  8672.     var node, nodeLinkFn, childrenLinkFn;
  8673.     for (var i = 0, n = 0, l = linkFns.length; i < l; n++) {
  8674.       node = nodes[n];
  8675.       nodeLinkFn = linkFns[i++];
  8676.       childrenLinkFn = linkFns[i++];
  8677.       // cache childNodes before linking parent, fix #657
  8678.       var childNodes = toArray(node.childNodes);
  8679.       if (nodeLinkFn) {
  8680.         nodeLinkFn(vm, node, host, scope, frag);
  8681.       }
  8682.       if (childrenLinkFn) {
  8683.         childrenLinkFn(vm, childNodes, host, scope, frag);
  8684.       }
  8685.     }
  8686.   };
  8687. }
  8688.  
  8689. /**
  8690.  * Check for element directives (custom elements that should
  8691.  * be resovled as terminal directives).
  8692.  *
  8693.  * @param {Element} el
  8694.  * @param {Object} options
  8695.  */
  8696.  
  8697. function checkElementDirectives(el, options) {
  8698.   var tag = el.tagName.toLowerCase();
  8699.   if (commonTagRE.test(tag)) {
  8700.     return;
  8701.   }
  8702.   var def = resolveAsset(options, 'elementDirectives', tag);
  8703.   if (def) {
  8704.     return makeTerminalNodeLinkFn(el, tag, '', options, def);
  8705.   }
  8706. }
  8707.  
  8708. /**
  8709.  * Check if an element is a component. If yes, return
  8710.  * a component link function.
  8711.  *
  8712.  * @param {Element} el
  8713.  * @param {Object} options
  8714.  * @return {Function|undefined}
  8715.  */
  8716.  
  8717. function checkComponent(el, options) {
  8718.   var component = checkComponentAttr(el, options);
  8719.   if (component) {
  8720.     var ref = findRef(el);
  8721.     var descriptor = {
  8722.       name: 'component',
  8723.       ref: ref,
  8724.       expression: component.id,
  8725.       def: internalDirectives.component,
  8726.       modifiers: {
  8727.         literal: !component.dynamic
  8728.       }
  8729.     };
  8730.     var componentLinkFn = function componentLinkFn(vm, el, host, scope, frag) {
  8731.       if (ref) {
  8732.         defineReactive((scope || vm).$refs, ref, null);
  8733.       }
  8734.       vm._bindDir(descriptor, el, host, scope, frag);
  8735.     };
  8736.     componentLinkFn.terminal = true;
  8737.     return componentLinkFn;
  8738.   }
  8739. }
  8740.  
  8741. /**
  8742.  * Check an element for terminal directives in fixed order.
  8743.  * If it finds one, return a terminal link function.
  8744.  *
  8745.  * @param {Element} el
  8746.  * @param {Array} attrs
  8747.  * @param {Object} options
  8748.  * @return {Function} terminalLinkFn
  8749.  */
  8750.  
  8751. function checkTerminalDirectives(el, attrs, options) {
  8752.   // skip v-pre
  8753.   if (getAttr(el, 'v-pre') !== null) {
  8754.     return skip;
  8755.   }
  8756.   // skip v-else block, but only if following v-if
  8757.   if (el.hasAttribute('v-else')) {
  8758.     var prev = el.previousElementSibling;
  8759.     if (prev && prev.hasAttribute('v-if')) {
  8760.       return skip;
  8761.     }
  8762.   }
  8763.  
  8764.   var attr, name, value, modifiers, matched, dirName, rawName, arg, def, termDef;
  8765.   for (var i = 0, j = attrs.length; i < j; i++) {
  8766.     attr = attrs[i];
  8767.     name = attr.name.replace(modifierRE, '');
  8768.     if (matched = name.match(dirAttrRE)) {
  8769.       def = resolveAsset(options, 'directives', matched[1]);
  8770.       if (def && def.terminal) {
  8771.         if (!termDef || (def.priority || DEFAULT_TERMINAL_PRIORITY) > termDef.priority) {
  8772.           termDef = def;
  8773.           rawName = attr.name;
  8774.           modifiers = parseModifiers(attr.name);
  8775.           value = attr.value;
  8776.           dirName = matched[1];
  8777.           arg = matched[2];
  8778.         }
  8779.       }
  8780.     }
  8781.   }
  8782.  
  8783.   if (termDef) {
  8784.     return makeTerminalNodeLinkFn(el, dirName, value, options, termDef, rawName, arg, modifiers);
  8785.   }
  8786. }
  8787.  
  8788. function skip() {}
  8789. skip.terminal = true;
  8790.  
  8791. /**
  8792.  * Build a node link function for a terminal directive.
  8793.  * A terminal link function terminates the current
  8794.  * compilation recursion and handles compilation of the
  8795.  * subtree in the directive.
  8796.  *
  8797.  * @param {Element} el
  8798.  * @param {String} dirName
  8799.  * @param {String} value
  8800.  * @param {Object} options
  8801.  * @param {Object} def
  8802.  * @param {String} [rawName]
  8803.  * @param {String} [arg]
  8804.  * @param {Object} [modifiers]
  8805.  * @return {Function} terminalLinkFn
  8806.  */
  8807.  
  8808. function makeTerminalNodeLinkFn(el, dirName, value, options, def, rawName, arg, modifiers) {
  8809.   var parsed = parseDirective(value);
  8810.   var descriptor = {
  8811.     name: dirName,
  8812.     arg: arg,
  8813.     expression: parsed.expression,
  8814.     filters: parsed.filters,
  8815.     raw: value,
  8816.     attr: rawName,
  8817.     modifiers: modifiers,
  8818.     def: def
  8819.   };
  8820.   // check ref for v-for and router-view
  8821.   if (dirName === 'for' || dirName === 'router-view') {
  8822.     descriptor.ref = findRef(el);
  8823.   }
  8824.   var fn = function terminalNodeLinkFn(vm, el, host, scope, frag) {
  8825.     if (descriptor.ref) {
  8826.       defineReactive((scope || vm).$refs, descriptor.ref, null);
  8827.     }
  8828.     vm._bindDir(descriptor, el, host, scope, frag);
  8829.   };
  8830.   fn.terminal = true;
  8831.   return fn;
  8832. }
  8833.  
  8834. /**
  8835.  * Compile the directives on an element and return a linker.
  8836.  *
  8837.  * @param {Array|NamedNodeMap} attrs
  8838.  * @param {Object} options
  8839.  * @return {Function}
  8840.  */
  8841.  
  8842. function compileDirectives(attrs, options) {
  8843.   var i = attrs.length;
  8844.   var dirs = [];
  8845.   var attr, name, value, rawName, rawValue, dirName, arg, modifiers, dirDef, tokens, matched;
  8846.   while (i--) {
  8847.     attr = attrs[i];
  8848.     name = rawName = attr.name;
  8849.     value = rawValue = attr.value;
  8850.     tokens = parseText(value);
  8851.     // reset arg
  8852.     arg = null;
  8853.     // check modifiers
  8854.     modifiers = parseModifiers(name);
  8855.     name = name.replace(modifierRE, '');
  8856.  
  8857.     // attribute interpolations
  8858.     if (tokens) {
  8859.       value = tokensToExp(tokens);
  8860.       arg = name;
  8861.       pushDir('bind', directives.bind, tokens);
  8862.       // warn against mixing mustaches with v-bind
  8863.       if (process.env.NODE_ENV !== 'production') {
  8864.         if (name === 'class' && Array.prototype.some.call(attrs, function (attr) {
  8865.           return attr.name === ':class' || attr.name === 'v-bind:class';
  8866.         })) {
  8867.           warn('class="' + rawValue + '": Do not mix mustache interpolation ' + 'and v-bind for "class" on the same element. Use one or the other.', options);
  8868.         }
  8869.       }
  8870.     } else
  8871.  
  8872.       // special attribute: transition
  8873.       if (transitionRE.test(name)) {
  8874.         modifiers.literal = !bindRE.test(name);
  8875.         pushDir('transition', internalDirectives.transition);
  8876.       } else
  8877.  
  8878.         // event handlers
  8879.         if (onRE.test(name)) {
  8880.           arg = name.replace(onRE, '');
  8881.           pushDir('on', directives.on);
  8882.         } else
  8883.  
  8884.           // attribute bindings
  8885.           if (bindRE.test(name)) {
  8886.             dirName = name.replace(bindRE, '');
  8887.             if (dirName === 'style' || dirName === 'class') {
  8888.               pushDir(dirName, internalDirectives[dirName]);
  8889.             } else {
  8890.               arg = dirName;
  8891.               pushDir('bind', directives.bind);
  8892.             }
  8893.           } else
  8894.  
  8895.             // normal directives
  8896.             if (matched = name.match(dirAttrRE)) {
  8897.               dirName = matched[1];
  8898.               arg = matched[2];
  8899.  
  8900.               // skip v-else (when used with v-show)
  8901.               if (dirName === 'else') {
  8902.                 continue;
  8903.               }
  8904.  
  8905.               dirDef = resolveAsset(options, 'directives', dirName, true);
  8906.               if (dirDef) {
  8907.                 pushDir(dirName, dirDef);
  8908.               }
  8909.             }
  8910.   }
  8911.  
  8912.   /**
  8913.    * Push a directive.
  8914.    *
  8915.    * @param {String} dirName
  8916.    * @param {Object|Function} def
  8917.    * @param {Array} [interpTokens]
  8918.    */
  8919.  
  8920.   function pushDir(dirName, def, interpTokens) {
  8921.     var hasOneTimeToken = interpTokens && hasOneTime(interpTokens);
  8922.     var parsed = !hasOneTimeToken && parseDirective(value);
  8923.     dirs.push({
  8924.       name: dirName,
  8925.       attr: rawName,
  8926.       raw: rawValue,
  8927.       def: def,
  8928.       arg: arg,
  8929.       modifiers: modifiers,
  8930.       // conversion from interpolation strings with one-time token
  8931.       // to expression is differed until directive bind time so that we
  8932.       // have access to the actual vm context for one-time bindings.
  8933.       expression: parsed && parsed.expression,
  8934.       filters: parsed && parsed.filters,
  8935.       interp: interpTokens,
  8936.       hasOneTime: hasOneTimeToken
  8937.     });
  8938.   }
  8939.  
  8940.   if (dirs.length) {
  8941.     return makeNodeLinkFn(dirs);
  8942.   }
  8943. }
  8944.  
  8945. /**
  8946.  * Parse modifiers from directive attribute name.
  8947.  *
  8948.  * @param {String} name
  8949.  * @return {Object}
  8950.  */
  8951.  
  8952. function parseModifiers(name) {
  8953.   var res = Object.create(null);
  8954.   var match = name.match(modifierRE);
  8955.   if (match) {
  8956.     var i = match.length;
  8957.     while (i--) {
  8958.       res[match[i].slice(1)] = true;
  8959.     }
  8960.   }
  8961.   return res;
  8962. }
  8963.  
  8964. /**
  8965.  * Build a link function for all directives on a single node.
  8966.  *
  8967.  * @param {Array} directives
  8968.  * @return {Function} directivesLinkFn
  8969.  */
  8970.  
  8971. function makeNodeLinkFn(directives) {
  8972.   return function nodeLinkFn(vm, el, host, scope, frag) {
  8973.     // reverse apply because it's sorted low to high
  8974.     var i = directives.length;
  8975.     while (i--) {
  8976.       vm._bindDir(directives[i], el, host, scope, frag);
  8977.     }
  8978.   };
  8979. }
  8980.  
  8981. /**
  8982.  * Check if an interpolation string contains one-time tokens.
  8983.  *
  8984.  * @param {Array} tokens
  8985.  * @return {Boolean}
  8986.  */
  8987.  
  8988. function hasOneTime(tokens) {
  8989.   var i = tokens.length;
  8990.   while (i--) {
  8991.     if (tokens[i].oneTime) return true;
  8992.   }
  8993. }
  8994.  
  8995. function isScript(el) {
  8996.   return el.tagName === 'SCRIPT' && (!el.hasAttribute('type') || el.getAttribute('type') === 'text/javascript');
  8997. }
  8998.  
  8999. var specialCharRE = /[^\w\-:\.]/;
  9000.  
  9001. /**
  9002.  * Process an element or a DocumentFragment based on a
  9003.  * instance option object. This allows us to transclude
  9004.  * a template node/fragment before the instance is created,
  9005.  * so the processed fragment can then be cloned and reused
  9006.  * in v-for.
  9007.  *
  9008.  * @param {Element} el
  9009.  * @param {Object} options
  9010.  * @return {Element|DocumentFragment}
  9011.  */
  9012.  
  9013. function transclude(el, options) {
  9014.   // extract container attributes to pass them down
  9015.   // to compiler, because they need to be compiled in
  9016.   // parent scope. we are mutating the options object here
  9017.   // assuming the same object will be used for compile
  9018.   // right after this.
  9019.   if (options) {
  9020.     options._containerAttrs = extractAttrs(el);
  9021.   }
  9022.   // for template tags, what we want is its content as
  9023.   // a documentFragment (for fragment instances)
  9024.   if (isTemplate(el)) {
  9025.     el = parseTemplate(el);
  9026.   }
  9027.   if (options) {
  9028.     if (options._asComponent && !options.template) {
  9029.       options.template = '<slot></slot>';
  9030.     }
  9031.     if (options.template) {
  9032.       options._content = extractContent(el);
  9033.       el = transcludeTemplate(el, options);
  9034.     }
  9035.   }
  9036.   if (isFragment(el)) {
  9037.     // anchors for fragment instance
  9038.     // passing in `persist: true` to avoid them being
  9039.     // discarded by IE during template cloning
  9040.     prepend(createAnchor('v-start', true), el);
  9041.     el.appendChild(createAnchor('v-end', true));
  9042.   }
  9043.   return el;
  9044. }
  9045.  
  9046. /**
  9047.  * Process the template option.
  9048.  * If the replace option is true this will swap the $el.
  9049.  *
  9050.  * @param {Element} el
  9051.  * @param {Object} options
  9052.  * @return {Element|DocumentFragment}
  9053.  */
  9054.  
  9055. function transcludeTemplate(el, options) {
  9056.   var template = options.template;
  9057.   var frag = parseTemplate(template, true);
  9058.   if (frag) {
  9059.     var replacer = frag.firstChild;
  9060.     var tag = replacer.tagName && replacer.tagName.toLowerCase();
  9061.     if (options.replace) {
  9062.       /* istanbul ignore if */
  9063.       if (el === document.body) {
  9064.         process.env.NODE_ENV !== 'production' && warn('You are mounting an instance with a template to ' + '<body>. This will replace <body> entirely. You ' + 'should probably use `replace: false` here.');
  9065.       }
  9066.       // there are many cases where the instance must
  9067.       // become a fragment instance: basically anything that
  9068.       // can create more than 1 root nodes.
  9069.       if (
  9070.       // multi-children template
  9071.       frag.childNodes.length > 1 ||
  9072.       // non-element template
  9073.       replacer.nodeType !== 1 ||
  9074.       // single nested component
  9075.       tag === 'component' || resolveAsset(options, 'components', tag) || hasBindAttr(replacer, 'is') ||
  9076.       // element directive
  9077.       resolveAsset(options, 'elementDirectives', tag) ||
  9078.       // for block
  9079.       replacer.hasAttribute('v-for') ||
  9080.       // if block
  9081.       replacer.hasAttribute('v-if')) {
  9082.         return frag;
  9083.       } else {
  9084.         options._replacerAttrs = extractAttrs(replacer);
  9085.         mergeAttrs(el, replacer);
  9086.         return replacer;
  9087.       }
  9088.     } else {
  9089.       el.appendChild(frag);
  9090.       return el;
  9091.     }
  9092.   } else {
  9093.     process.env.NODE_ENV !== 'production' && warn('Invalid template option: ' + template);
  9094.   }
  9095. }
  9096.  
  9097. /**
  9098.  * Helper to extract a component container's attributes
  9099.  * into a plain object array.
  9100.  *
  9101.  * @param {Element} el
  9102.  * @return {Array}
  9103.  */
  9104.  
  9105. function extractAttrs(el) {
  9106.   if (el.nodeType === 1 && el.hasAttributes()) {
  9107.     return toArray(el.attributes);
  9108.   }
  9109. }
  9110.  
  9111. /**
  9112.  * Merge the attributes of two elements, and make sure
  9113.  * the class names are merged properly.
  9114.  *
  9115.  * @param {Element} from
  9116.  * @param {Element} to
  9117.  */
  9118.  
  9119. function mergeAttrs(from, to) {
  9120.   var attrs = from.attributes;
  9121.   var i = attrs.length;
  9122.   var name, value;
  9123.   while (i--) {
  9124.     name = attrs[i].name;
  9125.     value = attrs[i].value;
  9126.     if (!to.hasAttribute(name) && !specialCharRE.test(name)) {
  9127.       to.setAttribute(name, value);
  9128.     } else if (name === 'class' && !parseText(value) && (value = value.trim())) {
  9129.       value.split(/\s+/).forEach(function (cls) {
  9130.         addClass(to, cls);
  9131.       });
  9132.     }
  9133.   }
  9134. }
  9135.  
  9136. /**
  9137.  * Scan and determine slot content distribution.
  9138.  * We do this during transclusion instead at compile time so that
  9139.  * the distribution is decoupled from the compilation order of
  9140.  * the slots.
  9141.  *
  9142.  * @param {Element|DocumentFragment} template
  9143.  * @param {Element} content
  9144.  * @param {Vue} vm
  9145.  */
  9146.  
  9147. function resolveSlots(vm, content) {
  9148.   if (!content) {
  9149.     return;
  9150.   }
  9151.   var contents = vm._slotContents = Object.create(null);
  9152.   var el, name;
  9153.   for (var i = 0, l = content.children.length; i < l; i++) {
  9154.     el = content.children[i];
  9155.     /* eslint-disable no-cond-assign */
  9156.     if (name = el.getAttribute('slot')) {
  9157.       (contents[name] || (contents[name] = [])).push(el);
  9158.     }
  9159.     /* eslint-enable no-cond-assign */
  9160.     if (process.env.NODE_ENV !== 'production' && getBindAttr(el, 'slot')) {
  9161.       warn('The "slot" attribute must be static.', vm.$parent);
  9162.     }
  9163.   }
  9164.   for (name in contents) {
  9165.     contents[name] = extractFragment(contents[name], content);
  9166.   }
  9167.   if (content.hasChildNodes()) {
  9168.     var nodes = content.childNodes;
  9169.     if (nodes.length === 1 && nodes[0].nodeType === 3 && !nodes[0].data.trim()) {
  9170.       return;
  9171.     }
  9172.     contents['default'] = extractFragment(content.childNodes, content);
  9173.   }
  9174. }
  9175.  
  9176. /**
  9177.  * Extract qualified content nodes from a node list.
  9178.  *
  9179.  * @param {NodeList} nodes
  9180.  * @return {DocumentFragment}
  9181.  */
  9182.  
  9183. function extractFragment(nodes, parent) {
  9184.   var frag = document.createDocumentFragment();
  9185.   nodes = toArray(nodes);
  9186.   for (var i = 0, l = nodes.length; i < l; i++) {
  9187.     var node = nodes[i];
  9188.     if (isTemplate(node) && !node.hasAttribute('v-if') && !node.hasAttribute('v-for')) {
  9189.       parent.removeChild(node);
  9190.       node = parseTemplate(node, true);
  9191.     }
  9192.     frag.appendChild(node);
  9193.   }
  9194.   return frag;
  9195. }
  9196.  
  9197.  
  9198.  
  9199. var compiler = Object.freeze({
  9200.     compile: compile,
  9201.     compileAndLinkProps: compileAndLinkProps,
  9202.     compileRoot: compileRoot,
  9203.     transclude: transclude,
  9204.     resolveSlots: resolveSlots
  9205. });
  9206.  
  9207. function stateMixin (Vue) {
  9208.   /**
  9209.    * Accessor for `$data` property, since setting $data
  9210.    * requires observing the new object and updating
  9211.    * proxied properties.
  9212.    */
  9213.  
  9214.   Object.defineProperty(Vue.prototype, '$data', {
  9215.     get: function get() {
  9216.       return this._data;
  9217.     },
  9218.     set: function set(newData) {
  9219.       if (newData !== this._data) {
  9220.         this._setData(newData);
  9221.       }
  9222.     }
  9223.   });
  9224.  
  9225.   /**
  9226.    * Setup the scope of an instance, which contains:
  9227.    * - observed data
  9228.    * - computed properties
  9229.    * - user methods
  9230.    * - meta properties
  9231.    */
  9232.  
  9233.   Vue.prototype._initState = function () {
  9234.     this._initProps();
  9235.     this._initMeta();
  9236.     this._initMethods();
  9237.     this._initData();
  9238.     this._initComputed();
  9239.   };
  9240.  
  9241.   /**
  9242.    * Initialize props.
  9243.    */
  9244.  
  9245.   Vue.prototype._initProps = function () {
  9246.     var options = this.$options;
  9247.     var el = options.el;
  9248.     var props = options.props;
  9249.     if (props && !el) {
  9250.       process.env.NODE_ENV !== 'production' && warn('Props will not be compiled if no `el` option is ' + 'provided at instantiation.', this);
  9251.     }
  9252.     // make sure to convert string selectors into element now
  9253.     el = options.el = query(el);
  9254.     this._propsUnlinkFn = el && el.nodeType === 1 && props
  9255.     // props must be linked in proper scope if inside v-for
  9256.     ? compileAndLinkProps(this, el, props, this._scope) : null;
  9257.   };
  9258.  
  9259.   /**
  9260.    * Initialize the data.
  9261.    */
  9262.  
  9263.   Vue.prototype._initData = function () {
  9264.     var dataFn = this.$options.data;
  9265.     var data = this._data = dataFn ? dataFn() : {};
  9266.     if (!isPlainObject(data)) {
  9267.       data = {};
  9268.       process.env.NODE_ENV !== 'production' && warn('data functions should return an object.', this);
  9269.     }
  9270.     var props = this._props;
  9271.     // proxy data on instance
  9272.     var keys = Object.keys(data);
  9273.     var i, key;
  9274.     i = keys.length;
  9275.     while (i--) {
  9276.       key = keys[i];
  9277.       // there are two scenarios where we can proxy a data key:
  9278.       // 1. it's not already defined as a prop
  9279.       // 2. it's provided via a instantiation option AND there are no
  9280.       //    template prop present
  9281.       if (!props || !hasOwn(props, key)) {
  9282.         this._proxy(key);
  9283.       } else if (process.env.NODE_ENV !== 'production') {
  9284.         warn('Data field "' + key + '" is already defined ' + 'as a prop. To provide default value for a prop, use the "default" ' + 'prop option; if you want to pass prop values to an instantiation ' + 'call, use the "propsData" option.', this);
  9285.       }
  9286.     }
  9287.     // observe data
  9288.     observe(data, this);
  9289.   };
  9290.  
  9291.   /**
  9292.    * Swap the instance's $data. Called in $data's setter.
  9293.    *
  9294.    * @param {Object} newData
  9295.    */
  9296.  
  9297.   Vue.prototype._setData = function (newData) {
  9298.     newData = newData || {};
  9299.     var oldData = this._data;
  9300.     this._data = newData;
  9301.     var keys, key, i;
  9302.     // unproxy keys not present in new data
  9303.     keys = Object.keys(oldData);
  9304.     i = keys.length;
  9305.     while (i--) {
  9306.       key = keys[i];
  9307.       if (!(key in newData)) {
  9308.         this._unproxy(key);
  9309.       }
  9310.     }
  9311.     // proxy keys not already proxied,
  9312.     // and trigger change for changed values
  9313.     keys = Object.keys(newData);
  9314.     i = keys.length;
  9315.     while (i--) {
  9316.       key = keys[i];
  9317.       if (!hasOwn(this, key)) {
  9318.         // new property
  9319.         this._proxy(key);
  9320.       }
  9321.     }
  9322.     oldData.__ob__.removeVm(this);
  9323.     observe(newData, this);
  9324.     this._digest();
  9325.   };
  9326.  
  9327.   /**
  9328.    * Proxy a property, so that
  9329.    * vm.prop === vm._data.prop
  9330.    *
  9331.    * @param {String} key
  9332.    */
  9333.  
  9334.   Vue.prototype._proxy = function (key) {
  9335.     if (!isReserved(key)) {
  9336.       // need to store ref to self here
  9337.       // because these getter/setters might
  9338.       // be called by child scopes via
  9339.       // prototype inheritance.
  9340.       var self = this;
  9341.       Object.defineProperty(self, key, {
  9342.         configurable: true,
  9343.         enumerable: true,
  9344.         get: function proxyGetter() {
  9345.           return self._data[key];
  9346.         },
  9347.         set: function proxySetter(val) {
  9348.           self._data[key] = val;
  9349.         }
  9350.       });
  9351.     }
  9352.   };
  9353.  
  9354.   /**
  9355.    * Unproxy a property.
  9356.    *
  9357.    * @param {String} key
  9358.    */
  9359.  
  9360.   Vue.prototype._unproxy = function (key) {
  9361.     if (!isReserved(key)) {
  9362.       delete this[key];
  9363.     }
  9364.   };
  9365.  
  9366.   /**
  9367.    * Force update on every watcher in scope.
  9368.    */
  9369.  
  9370.   Vue.prototype._digest = function () {
  9371.     for (var i = 0, l = this._watchers.length; i < l; i++) {
  9372.       this._watchers[i].update(true); // shallow updates
  9373.     }
  9374.   };
  9375.  
  9376.   /**
  9377.    * Setup computed properties. They are essentially
  9378.    * special getter/setters
  9379.    */
  9380.  
  9381.   function noop() {}
  9382.   Vue.prototype._initComputed = function () {
  9383.     var computed = this.$options.computed;
  9384.     if (computed) {
  9385.       for (var key in computed) {
  9386.         var userDef = computed[key];
  9387.         var def = {
  9388.           enumerable: true,
  9389.           configurable: true
  9390.         };
  9391.         if (typeof userDef === 'function') {
  9392.           def.get = makeComputedGetter(userDef, this);
  9393.           def.set = noop;
  9394.         } else {
  9395.           def.get = userDef.get ? userDef.cache !== false ? makeComputedGetter(userDef.get, this) : bind(userDef.get, this) : noop;
  9396.           def.set = userDef.set ? bind(userDef.set, this) : noop;
  9397.         }
  9398.         Object.defineProperty(this, key, def);
  9399.       }
  9400.     }
  9401.   };
  9402.  
  9403.   function makeComputedGetter(getter, owner) {
  9404.     var watcher = new Watcher(owner, getter, null, {
  9405.       lazy: true
  9406.     });
  9407.     return function computedGetter() {
  9408.       if (watcher.dirty) {
  9409.         watcher.evaluate();
  9410.       }
  9411.       if (Dep.target) {
  9412.         watcher.depend();
  9413.       }
  9414.       return watcher.value;
  9415.     };
  9416.   }
  9417.  
  9418.   /**
  9419.    * Setup instance methods. Methods must be bound to the
  9420.    * instance since they might be passed down as a prop to
  9421.    * child components.
  9422.    */
  9423.  
  9424.   Vue.prototype._initMethods = function () {
  9425.     var methods = this.$options.methods;
  9426.     if (methods) {
  9427.       for (var key in methods) {
  9428.         this[key] = bind(methods[key], this);
  9429.       }
  9430.     }
  9431.   };
  9432.  
  9433.   /**
  9434.    * Initialize meta information like $index, $key & $value.
  9435.    */
  9436.  
  9437.   Vue.prototype._initMeta = function () {
  9438.     var metas = this.$options._meta;
  9439.     if (metas) {
  9440.       for (var key in metas) {
  9441.         defineReactive(this, key, metas[key]);
  9442.       }
  9443.     }
  9444.   };
  9445. }
  9446.  
  9447. var eventRE = /^v-on:|^@/;
  9448.  
  9449. function eventsMixin (Vue) {
  9450.   /**
  9451.    * Setup the instance's option events & watchers.
  9452.    * If the value is a string, we pull it from the
  9453.    * instance's methods by name.
  9454.    */
  9455.  
  9456.   Vue.prototype._initEvents = function () {
  9457.     var options = this.$options;
  9458.     if (options._asComponent) {
  9459.       registerComponentEvents(this, options.el);
  9460.     }
  9461.     registerCallbacks(this, '$on', options.events);
  9462.     registerCallbacks(this, '$watch', options.watch);
  9463.   };
  9464.  
  9465.   /**
  9466.    * Register v-on events on a child component
  9467.    *
  9468.    * @param {Vue} vm
  9469.    * @param {Element} el
  9470.    */
  9471.  
  9472.   function registerComponentEvents(vm, el) {
  9473.     var attrs = el.attributes;
  9474.     var name, value, handler;
  9475.     for (var i = 0, l = attrs.length; i < l; i++) {
  9476.       name = attrs[i].name;
  9477.       if (eventRE.test(name)) {
  9478.         name = name.replace(eventRE, '');
  9479.         // force the expression into a statement so that
  9480.         // it always dynamically resolves the method to call (#2670)
  9481.         // kinda ugly hack, but does the job.
  9482.         value = attrs[i].value;
  9483.         if (isSimplePath(value)) {
  9484.           value += '.apply(this, $arguments)';
  9485.         }
  9486.         handler = (vm._scope || vm._context).$eval(value, true);
  9487.         handler._fromParent = true;
  9488.         vm.$on(name.replace(eventRE), handler);
  9489.       }
  9490.     }
  9491.   }
  9492.  
  9493.   /**
  9494.    * Register callbacks for option events and watchers.
  9495.    *
  9496.    * @param {Vue} vm
  9497.    * @param {String} action
  9498.    * @param {Object} hash
  9499.    */
  9500.  
  9501.   function registerCallbacks(vm, action, hash) {
  9502.     if (!hash) return;
  9503.     var handlers, key, i, j;
  9504.     for (key in hash) {
  9505.       handlers = hash[key];
  9506.       if (isArray(handlers)) {
  9507.         for (i = 0, j = handlers.length; i < j; i++) {
  9508.           register(vm, action, key, handlers[i]);
  9509.         }
  9510.       } else {
  9511.         register(vm, action, key, handlers);
  9512.       }
  9513.     }
  9514.   }
  9515.  
  9516.   /**
  9517.    * Helper to register an event/watch callback.
  9518.    *
  9519.    * @param {Vue} vm
  9520.    * @param {String} action
  9521.    * @param {String} key
  9522.    * @param {Function|String|Object} handler
  9523.    * @param {Object} [options]
  9524.    */
  9525.  
  9526.   function register(vm, action, key, handler, options) {
  9527.     var type = typeof handler;
  9528.     if (type === 'function') {
  9529.       vm[action](key, handler, options);
  9530.     } else if (type === 'string') {
  9531.       var methods = vm.$options.methods;
  9532.       var method = methods && methods[handler];
  9533.       if (method) {
  9534.         vm[action](key, method, options);
  9535.       } else {
  9536.         process.env.NODE_ENV !== 'production' && warn('Unknown method: "' + handler + '" when ' + 'registering callback for ' + action + ': "' + key + '".', vm);
  9537.       }
  9538.     } else if (handler && type === 'object') {
  9539.       register(vm, action, key, handler.handler, handler);
  9540.     }
  9541.   }
  9542.  
  9543.   /**
  9544.    * Setup recursive attached/detached calls
  9545.    */
  9546.  
  9547.   Vue.prototype._initDOMHooks = function () {
  9548.     this.$on('hook:attached', onAttached);
  9549.     this.$on('hook:detached', onDetached);
  9550.   };
  9551.  
  9552.   /**
  9553.    * Callback to recursively call attached hook on children
  9554.    */
  9555.  
  9556.   function onAttached() {
  9557.     if (!this._isAttached) {
  9558.       this._isAttached = true;
  9559.       this.$children.forEach(callAttach);
  9560.     }
  9561.   }
  9562.  
  9563.   /**
  9564.    * Iterator to call attached hook
  9565.    *
  9566.    * @param {Vue} child
  9567.    */
  9568.  
  9569.   function callAttach(child) {
  9570.     if (!child._isAttached && inDoc(child.$el)) {
  9571.       child._callHook('attached');
  9572.     }
  9573.   }
  9574.  
  9575.   /**
  9576.    * Callback to recursively call detached hook on children
  9577.    */
  9578.  
  9579.   function onDetached() {
  9580.     if (this._isAttached) {
  9581.       this._isAttached = false;
  9582.       this.$children.forEach(callDetach);
  9583.     }
  9584.   }
  9585.  
  9586.   /**
  9587.    * Iterator to call detached hook
  9588.    *
  9589.    * @param {Vue} child
  9590.    */
  9591.  
  9592.   function callDetach(child) {
  9593.     if (child._isAttached && !inDoc(child.$el)) {
  9594.       child._callHook('detached');
  9595.     }
  9596.   }
  9597.  
  9598.   /**
  9599.    * Trigger all handlers for a hook
  9600.    *
  9601.    * @param {String} hook
  9602.    */
  9603.  
  9604.   Vue.prototype._callHook = function (hook) {
  9605.     this.$emit('pre-hook:' + hook);
  9606.     var handlers = this.$options[hook];
  9607.     if (handlers) {
  9608.       for (var i = 0, j = handlers.length; i < j; i++) {
  9609.         handlers[i].call(this);
  9610.       }
  9611.     }
  9612.     this.$emit('hook:' + hook);
  9613.   };
  9614. }
  9615.  
  9616. function noop$1() {}
  9617.  
  9618. /**
  9619.  * A directive links a DOM element with a piece of data,
  9620.  * which is the result of evaluating an expression.
  9621.  * It registers a watcher with the expression and calls
  9622.  * the DOM update function when a change is triggered.
  9623.  *
  9624.  * @param {Object} descriptor
  9625.  *                 - {String} name
  9626.  *                 - {Object} def
  9627.  *                 - {String} expression
  9628.  *                 - {Array<Object>} [filters]
  9629.  *                 - {Object} [modifiers]
  9630.  *                 - {Boolean} literal
  9631.  *                 - {String} attr
  9632.  *                 - {String} arg
  9633.  *                 - {String} raw
  9634.  *                 - {String} [ref]
  9635.  *                 - {Array<Object>} [interp]
  9636.  *                 - {Boolean} [hasOneTime]
  9637.  * @param {Vue} vm
  9638.  * @param {Node} el
  9639.  * @param {Vue} [host] - transclusion host component
  9640.  * @param {Object} [scope] - v-for scope
  9641.  * @param {Fragment} [frag] - owner fragment
  9642.  * @constructor
  9643.  */
  9644. function Directive(descriptor, vm, el, host, scope, frag) {
  9645.   this.vm = vm;
  9646.   this.el = el;
  9647.   // copy descriptor properties
  9648.   this.descriptor = descriptor;
  9649.   this.name = descriptor.name;
  9650.   this.expression = descriptor.expression;
  9651.   this.arg = descriptor.arg;
  9652.   this.modifiers = descriptor.modifiers;
  9653.   this.filters = descriptor.filters;
  9654.   this.literal = this.modifiers && this.modifiers.literal;
  9655.   // private
  9656.   this._locked = false;
  9657.   this._bound = false;
  9658.   this._listeners = null;
  9659.   // link context
  9660.   this._host = host;
  9661.   this._scope = scope;
  9662.   this._frag = frag;
  9663.   // store directives on node in dev mode
  9664.   if (process.env.NODE_ENV !== 'production' && this.el) {
  9665.     this.el._vue_directives = this.el._vue_directives || [];
  9666.     this.el._vue_directives.push(this);
  9667.   }
  9668. }
  9669.  
  9670. /**
  9671.  * Initialize the directive, mixin definition properties,
  9672.  * setup the watcher, call definition bind() and update()
  9673.  * if present.
  9674.  */
  9675.  
  9676. Directive.prototype._bind = function () {
  9677.   var name = this.name;
  9678.   var descriptor = this.descriptor;
  9679.  
  9680.   // remove attribute
  9681.   if ((name !== 'cloak' || this.vm._isCompiled) && this.el && this.el.removeAttribute) {
  9682.     var attr = descriptor.attr || 'v-' + name;
  9683.     this.el.removeAttribute(attr);
  9684.   }
  9685.  
  9686.   // copy def properties
  9687.   var def = descriptor.def;
  9688.   if (typeof def === 'function') {
  9689.     this.update = def;
  9690.   } else {
  9691.     extend(this, def);
  9692.   }
  9693.  
  9694.   // setup directive params
  9695.   this._setupParams();
  9696.  
  9697.   // initial bind
  9698.   if (this.bind) {
  9699.     this.bind();
  9700.   }
  9701.   this._bound = true;
  9702.  
  9703.   if (this.literal) {
  9704.     this.update && this.update(descriptor.raw);
  9705.   } else if ((this.expression || this.modifiers) && (this.update || this.twoWay) && !this._checkStatement()) {
  9706.     // wrapped updater for context
  9707.     var dir = this;
  9708.     if (this.update) {
  9709.       this._update = function (val, oldVal) {
  9710.         if (!dir._locked) {
  9711.           dir.update(val, oldVal);
  9712.         }
  9713.       };
  9714.     } else {
  9715.       this._update = noop$1;
  9716.     }
  9717.     var preProcess = this._preProcess ? bind(this._preProcess, this) : null;
  9718.     var postProcess = this._postProcess ? bind(this._postProcess, this) : null;
  9719.     var watcher = this._watcher = new Watcher(this.vm, this.expression, this._update, // callback
  9720.     {
  9721.       filters: this.filters,
  9722.       twoWay: this.twoWay,
  9723.       deep: this.deep,
  9724.       preProcess: preProcess,
  9725.       postProcess: postProcess,
  9726.       scope: this._scope
  9727.     });
  9728.     // v-model with inital inline value need to sync back to
  9729.     // model instead of update to DOM on init. They would
  9730.     // set the afterBind hook to indicate that.
  9731.     if (this.afterBind) {
  9732.       this.afterBind();
  9733.     } else if (this.update) {
  9734.       this.update(watcher.value);
  9735.     }
  9736.   }
  9737. };
  9738.  
  9739. /**
  9740.  * Setup all param attributes, e.g. track-by,
  9741.  * transition-mode, etc...
  9742.  */
  9743.  
  9744. Directive.prototype._setupParams = function () {
  9745.   if (!this.params) {
  9746.     return;
  9747.   }
  9748.   var params = this.params;
  9749.   // swap the params array with a fresh object.
  9750.   this.params = Object.create(null);
  9751.   var i = params.length;
  9752.   var key, val, mappedKey;
  9753.   while (i--) {
  9754.     key = hyphenate(params[i]);
  9755.     mappedKey = camelize(key);
  9756.     val = getBindAttr(this.el, key);
  9757.     if (val != null) {
  9758.       // dynamic
  9759.       this._setupParamWatcher(mappedKey, val);
  9760.     } else {
  9761.       // static
  9762.       val = getAttr(this.el, key);
  9763.       if (val != null) {
  9764.         this.params[mappedKey] = val === '' ? true : val;
  9765.       }
  9766.     }
  9767.   }
  9768. };
  9769.  
  9770. /**
  9771.  * Setup a watcher for a dynamic param.
  9772.  *
  9773.  * @param {String} key
  9774.  * @param {String} expression
  9775.  */
  9776.  
  9777. Directive.prototype._setupParamWatcher = function (key, expression) {
  9778.   var self = this;
  9779.   var called = false;
  9780.   var unwatch = (this._scope || this.vm).$watch(expression, function (val, oldVal) {
  9781.     self.params[key] = val;
  9782.     // since we are in immediate mode,
  9783.     // only call the param change callbacks if this is not the first update.
  9784.     if (called) {
  9785.       var cb = self.paramWatchers && self.paramWatchers[key];
  9786.       if (cb) {
  9787.         cb.call(self, val, oldVal);
  9788.       }
  9789.     } else {
  9790.       called = true;
  9791.     }
  9792.   }, {
  9793.     immediate: true,
  9794.     user: false
  9795.   });(this._paramUnwatchFns || (this._paramUnwatchFns = [])).push(unwatch);
  9796. };
  9797.  
  9798. /**
  9799.  * Check if the directive is a function caller
  9800.  * and if the expression is a callable one. If both true,
  9801.  * we wrap up the expression and use it as the event
  9802.  * handler.
  9803.  *
  9804.  * e.g. on-click="a++"
  9805.  *
  9806.  * @return {Boolean}
  9807.  */
  9808.  
  9809. Directive.prototype._checkStatement = function () {
  9810.   var expression = this.expression;
  9811.   if (expression && this.acceptStatement && !isSimplePath(expression)) {
  9812.     var fn = parseExpression(expression).get;
  9813.     var scope = this._scope || this.vm;
  9814.     var handler = function handler(e) {
  9815.       scope.$event = e;
  9816.       fn.call(scope, scope);
  9817.       scope.$event = null;
  9818.     };
  9819.     if (this.filters) {
  9820.       handler = scope._applyFilters(handler, null, this.filters);
  9821.     }
  9822.     this.update(handler);
  9823.     return true;
  9824.   }
  9825. };
  9826.  
  9827. /**
  9828.  * Set the corresponding value with the setter.
  9829.  * This should only be used in two-way directives
  9830.  * e.g. v-model.
  9831.  *
  9832.  * @param {*} value
  9833.  * @public
  9834.  */
  9835.  
  9836. Directive.prototype.set = function (value) {
  9837.   /* istanbul ignore else */
  9838.   if (this.twoWay) {
  9839.     this._withLock(function () {
  9840.       this._watcher.set(value);
  9841.     });
  9842.   } else if (process.env.NODE_ENV !== 'production') {
  9843.     warn('Directive.set() can only be used inside twoWay' + 'directives.');
  9844.   }
  9845. };
  9846.  
  9847. /**
  9848.  * Execute a function while preventing that function from
  9849.  * triggering updates on this directive instance.
  9850.  *
  9851.  * @param {Function} fn
  9852.  */
  9853.  
  9854. Directive.prototype._withLock = function (fn) {
  9855.   var self = this;
  9856.   self._locked = true;
  9857.   fn.call(self);
  9858.   nextTick(function () {
  9859.     self._locked = false;
  9860.   });
  9861. };
  9862.  
  9863. /**
  9864.  * Convenience method that attaches a DOM event listener
  9865.  * to the directive element and autometically tears it down
  9866.  * during unbind.
  9867.  *
  9868.  * @param {String} event
  9869.  * @param {Function} handler
  9870.  * @param {Boolean} [useCapture]
  9871.  */
  9872.  
  9873. Directive.prototype.on = function (event, handler, useCapture) {
  9874.   on(this.el, event, handler, useCapture);(this._listeners || (this._listeners = [])).push([event, handler]);
  9875. };
  9876.  
  9877. /**
  9878.  * Teardown the watcher and call unbind.
  9879.  */
  9880.  
  9881. Directive.prototype._teardown = function () {
  9882.   if (this._bound) {
  9883.     this._bound = false;
  9884.     if (this.unbind) {
  9885.       this.unbind();
  9886.     }
  9887.     if (this._watcher) {
  9888.       this._watcher.teardown();
  9889.     }
  9890.     var listeners = this._listeners;
  9891.     var i;
  9892.     if (listeners) {
  9893.       i = listeners.length;
  9894.       while (i--) {
  9895.         off(this.el, listeners[i][0], listeners[i][1]);
  9896.       }
  9897.     }
  9898.     var unwatchFns = this._paramUnwatchFns;
  9899.     if (unwatchFns) {
  9900.       i = unwatchFns.length;
  9901.       while (i--) {
  9902.         unwatchFns[i]();
  9903.       }
  9904.     }
  9905.     if (process.env.NODE_ENV !== 'production' && this.el) {
  9906.       this.el._vue_directives.$remove(this);
  9907.     }
  9908.     this.vm = this.el = this._watcher = this._listeners = null;
  9909.   }
  9910. };
  9911.  
  9912. function lifecycleMixin (Vue) {
  9913.   /**
  9914.    * Update v-ref for component.
  9915.    *
  9916.    * @param {Boolean} remove
  9917.    */
  9918.  
  9919.   Vue.prototype._updateRef = function (remove) {
  9920.     var ref = this.$options._ref;
  9921.     if (ref) {
  9922.       var refs = (this._scope || this._context).$refs;
  9923.       if (remove) {
  9924.         if (refs[ref] === this) {
  9925.           refs[ref] = null;
  9926.         }
  9927.       } else {
  9928.         refs[ref] = this;
  9929.       }
  9930.     }
  9931.   };
  9932.  
  9933.   /**
  9934.    * Transclude, compile and link element.
  9935.    *
  9936.    * If a pre-compiled linker is available, that means the
  9937.    * passed in element will be pre-transcluded and compiled
  9938.    * as well - all we need to do is to call the linker.
  9939.    *
  9940.    * Otherwise we need to call transclude/compile/link here.
  9941.    *
  9942.    * @param {Element} el
  9943.    */
  9944.  
  9945.   Vue.prototype._compile = function (el) {
  9946.     var options = this.$options;
  9947.  
  9948.     // transclude and init element
  9949.     // transclude can potentially replace original
  9950.     // so we need to keep reference; this step also injects
  9951.     // the template and caches the original attributes
  9952.     // on the container node and replacer node.
  9953.     var original = el;
  9954.     el = transclude(el, options);
  9955.     this._initElement(el);
  9956.  
  9957.     // handle v-pre on root node (#2026)
  9958.     if (el.nodeType === 1 && getAttr(el, 'v-pre') !== null) {
  9959.       return;
  9960.     }
  9961.  
  9962.     // root is always compiled per-instance, because
  9963.     // container attrs and props can be different every time.
  9964.     var contextOptions = this._context && this._context.$options;
  9965.     var rootLinker = compileRoot(el, options, contextOptions);
  9966.  
  9967.     // resolve slot distribution
  9968.     resolveSlots(this, options._content);
  9969.  
  9970.     // compile and link the rest
  9971.     var contentLinkFn;
  9972.     var ctor = this.constructor;
  9973.     // component compilation can be cached
  9974.     // as long as it's not using inline-template
  9975.     if (options._linkerCachable) {
  9976.       contentLinkFn = ctor.linker;
  9977.       if (!contentLinkFn) {
  9978.         contentLinkFn = ctor.linker = compile(el, options);
  9979.       }
  9980.     }
  9981.  
  9982.     // link phase
  9983.     // make sure to link root with prop scope!
  9984.     var rootUnlinkFn = rootLinker(this, el, this._scope);
  9985.     var contentUnlinkFn = contentLinkFn ? contentLinkFn(this, el) : compile(el, options)(this, el);
  9986.  
  9987.     // register composite unlink function
  9988.     // to be called during instance destruction
  9989.     this._unlinkFn = function () {
  9990.       rootUnlinkFn();
  9991.       // passing destroying: true to avoid searching and
  9992.       // splicing the directives
  9993.       contentUnlinkFn(true);
  9994.     };
  9995.  
  9996.     // finally replace original
  9997.     if (options.replace) {
  9998.       replace(original, el);
  9999.     }
  10000.  
  10001.     this._isCompiled = true;
  10002.     this._callHook('compiled');
  10003.   };
  10004.  
  10005.   /**
  10006.    * Initialize instance element. Called in the public
  10007.    * $mount() method.
  10008.    *
  10009.    * @param {Element} el
  10010.    */
  10011.  
  10012.   Vue.prototype._initElement = function (el) {
  10013.     if (isFragment(el)) {
  10014.       this._isFragment = true;
  10015.       this.$el = this._fragmentStart = el.firstChild;
  10016.       this._fragmentEnd = el.lastChild;
  10017.       // set persisted text anchors to empty
  10018.       if (this._fragmentStart.nodeType === 3) {
  10019.         this._fragmentStart.data = this._fragmentEnd.data = '';
  10020.       }
  10021.       this._fragment = el;
  10022.     } else {
  10023.       this.$el = el;
  10024.     }
  10025.     this.$el.__vue__ = this;
  10026.     this._callHook('beforeCompile');
  10027.   };
  10028.  
  10029.   /**
  10030.    * Create and bind a directive to an element.
  10031.    *
  10032.    * @param {Object} descriptor - parsed directive descriptor
  10033.    * @param {Node} node   - target node
  10034.    * @param {Vue} [host] - transclusion host component
  10035.    * @param {Object} [scope] - v-for scope
  10036.    * @param {Fragment} [frag] - owner fragment
  10037.    */
  10038.  
  10039.   Vue.prototype._bindDir = function (descriptor, node, host, scope, frag) {
  10040.     this._directives.push(new Directive(descriptor, this, node, host, scope, frag));
  10041.   };
  10042.  
  10043.   /**
  10044.    * Teardown an instance, unobserves the data, unbind all the
  10045.    * directives, turn off all the event listeners, etc.
  10046.    *
  10047.    * @param {Boolean} remove - whether to remove the DOM node.
  10048.    * @param {Boolean} deferCleanup - if true, defer cleanup to
  10049.    *                                 be called later
  10050.    */
  10051.  
  10052.   Vue.prototype._destroy = function (remove, deferCleanup) {
  10053.     if (this._isBeingDestroyed) {
  10054.       if (!deferCleanup) {
  10055.         this._cleanup();
  10056.       }
  10057.       return;
  10058.     }
  10059.  
  10060.     var destroyReady;
  10061.     var pendingRemoval;
  10062.  
  10063.     var self = this;
  10064.     // Cleanup should be called either synchronously or asynchronoysly as
  10065.     // callback of this.$remove(), or if remove and deferCleanup are false.
  10066.     // In any case it should be called after all other removing, unbinding and
  10067.     // turning of is done
  10068.     var cleanupIfPossible = function cleanupIfPossible() {
  10069.       if (destroyReady && !pendingRemoval && !deferCleanup) {
  10070.         self._cleanup();
  10071.       }
  10072.     };
  10073.  
  10074.     // remove DOM element
  10075.     if (remove && this.$el) {
  10076.       pendingRemoval = true;
  10077.       this.$remove(function () {
  10078.         pendingRemoval = false;
  10079.         cleanupIfPossible();
  10080.       });
  10081.     }
  10082.  
  10083.     this._callHook('beforeDestroy');
  10084.     this._isBeingDestroyed = true;
  10085.     var i;
  10086.     // remove self from parent. only necessary
  10087.     // if parent is not being destroyed as well.
  10088.     var parent = this.$parent;
  10089.     if (parent && !parent._isBeingDestroyed) {
  10090.       parent.$children.$remove(this);
  10091.       // unregister ref (remove: true)
  10092.       this._updateRef(true);
  10093.     }
  10094.     // destroy all children.
  10095.     i = this.$children.length;
  10096.     while (i--) {
  10097.       this.$children[i].$destroy();
  10098.     }
  10099.     // teardown props
  10100.     if (this._propsUnlinkFn) {
  10101.       this._propsUnlinkFn();
  10102.     }
  10103.     // teardown all directives. this also tearsdown all
  10104.     // directive-owned watchers.
  10105.     if (this._unlinkFn) {
  10106.       this._unlinkFn();
  10107.     }
  10108.     i = this._watchers.length;
  10109.     while (i--) {
  10110.       this._watchers[i].teardown();
  10111.     }
  10112.     // remove reference to self on $el
  10113.     if (this.$el) {
  10114.       this.$el.__vue__ = null;
  10115.     }
  10116.  
  10117.     destroyReady = true;
  10118.     cleanupIfPossible();
  10119.   };
  10120.  
  10121.   /**
  10122.    * Clean up to ensure garbage collection.
  10123.    * This is called after the leave transition if there
  10124.    * is any.
  10125.    */
  10126.  
  10127.   Vue.prototype._cleanup = function () {
  10128.     if (this._isDestroyed) {
  10129.       return;
  10130.     }
  10131.     // remove self from owner fragment
  10132.     // do it in cleanup so that we can call $destroy with
  10133.     // defer right when a fragment is about to be removed.
  10134.     if (this._frag) {
  10135.       this._frag.children.$remove(this);
  10136.     }
  10137.     // remove reference from data ob
  10138.     // frozen object may not have observer.
  10139.     if (this._data && this._data.__ob__) {
  10140.       this._data.__ob__.removeVm(this);
  10141.     }
  10142.     // Clean up references to private properties and other
  10143.     // instances. preserve reference to _data so that proxy
  10144.     // accessors still work. The only potential side effect
  10145.     // here is that mutating the instance after it's destroyed
  10146.     // may affect the state of other components that are still
  10147.     // observing the same object, but that seems to be a
  10148.     // reasonable responsibility for the user rather than
  10149.     // always throwing an error on them.
  10150.     this.$el = this.$parent = this.$root = this.$children = this._watchers = this._context = this._scope = this._directives = null;
  10151.     // call the last hook...
  10152.     this._isDestroyed = true;
  10153.     this._callHook('destroyed');
  10154.     // turn off all instance listeners.
  10155.     this.$off();
  10156.   };
  10157. }
  10158.  
  10159. function miscMixin (Vue) {
  10160.   /**
  10161.    * Apply a list of filter (descriptors) to a value.
  10162.    * Using plain for loops here because this will be called in
  10163.    * the getter of any watcher with filters so it is very
  10164.    * performance sensitive.
  10165.    *
  10166.    * @param {*} value
  10167.    * @param {*} [oldValue]
  10168.    * @param {Array} filters
  10169.    * @param {Boolean} write
  10170.    * @return {*}
  10171.    */
  10172.  
  10173.   Vue.prototype._applyFilters = function (value, oldValue, filters, write) {
  10174.     var filter, fn, args, arg, offset, i, l, j, k;
  10175.     for (i = 0, l = filters.length; i < l; i++) {
  10176.       filter = filters[write ? l - i - 1 : i];
  10177.       fn = resolveAsset(this.$options, 'filters', filter.name, true);
  10178.       if (!fn) continue;
  10179.       fn = write ? fn.write : fn.read || fn;
  10180.       if (typeof fn !== 'function') continue;
  10181.       args = write ? [value, oldValue] : [value];
  10182.       offset = write ? 2 : 1;
  10183.       if (filter.args) {
  10184.         for (j = 0, k = filter.args.length; j < k; j++) {
  10185.           arg = filter.args[j];
  10186.           args[j + offset] = arg.dynamic ? this.$get(arg.value) : arg.value;
  10187.         }
  10188.       }
  10189.       value = fn.apply(this, args);
  10190.     }
  10191.     return value;
  10192.   };
  10193.  
  10194.   /**
  10195.    * Resolve a component, depending on whether the component
  10196.    * is defined normally or using an async factory function.
  10197.    * Resolves synchronously if already resolved, otherwise
  10198.    * resolves asynchronously and caches the resolved
  10199.    * constructor on the factory.
  10200.    *
  10201.    * @param {String|Function} value
  10202.    * @param {Function} cb
  10203.    */
  10204.  
  10205.   Vue.prototype._resolveComponent = function (value, cb) {
  10206.     var factory;
  10207.     if (typeof value === 'function') {
  10208.       factory = value;
  10209.     } else {
  10210.       factory = resolveAsset(this.$options, 'components', value, true);
  10211.     }
  10212.     /* istanbul ignore if */
  10213.     if (!factory) {
  10214.       return;
  10215.     }
  10216.     // async component factory
  10217.     if (!factory.options) {
  10218.       if (factory.resolved) {
  10219.         // cached
  10220.         cb(factory.resolved);
  10221.       } else if (factory.requested) {
  10222.         // pool callbacks
  10223.         factory.pendingCallbacks.push(cb);
  10224.       } else {
  10225.         factory.requested = true;
  10226.         var cbs = factory.pendingCallbacks = [cb];
  10227.         factory.call(this, function resolve(res) {
  10228.           if (isPlainObject(res)) {
  10229.             res = Vue.extend(res);
  10230.           }
  10231.           // cache resolved
  10232.           factory.resolved = res;
  10233.           // invoke callbacks
  10234.           for (var i = 0, l = cbs.length; i < l; i++) {
  10235.             cbs[i](res);
  10236.           }
  10237.         }, function reject(reason) {
  10238.           process.env.NODE_ENV !== 'production' && warn('Failed to resolve async component' + (typeof value === 'string' ? ': ' + value : '') + '. ' + (reason ? '\nReason: ' + reason : ''));
  10239.         });
  10240.       }
  10241.     } else {
  10242.       // normal component
  10243.       cb(factory);
  10244.     }
  10245.   };
  10246. }
  10247.  
  10248. var filterRE$1 = /[^|]\|[^|]/;
  10249.  
  10250. function dataAPI (Vue) {
  10251.   /**
  10252.    * Get the value from an expression on this vm.
  10253.    *
  10254.    * @param {String} exp
  10255.    * @param {Boolean} [asStatement]
  10256.    * @return {*}
  10257.    */
  10258.  
  10259.   Vue.prototype.$get = function (exp, asStatement) {
  10260.     var res = parseExpression(exp);
  10261.     if (res) {
  10262.       if (asStatement) {
  10263.         var self = this;
  10264.         return function statementHandler() {
  10265.           self.$arguments = toArray(arguments);
  10266.           var result = res.get.call(self, self);
  10267.           self.$arguments = null;
  10268.           return result;
  10269.         };
  10270.       } else {
  10271.         try {
  10272.           return res.get.call(this, this);
  10273.         } catch (e) {}
  10274.       }
  10275.     }
  10276.   };
  10277.  
  10278.   /**
  10279.    * Set the value from an expression on this vm.
  10280.    * The expression must be a valid left-hand
  10281.    * expression in an assignment.
  10282.    *
  10283.    * @param {String} exp
  10284.    * @param {*} val
  10285.    */
  10286.  
  10287.   Vue.prototype.$set = function (exp, val) {
  10288.     var res = parseExpression(exp, true);
  10289.     if (res && res.set) {
  10290.       res.set.call(this, this, val);
  10291.     }
  10292.   };
  10293.  
  10294.   /**
  10295.    * Delete a property on the VM
  10296.    *
  10297.    * @param {String} key
  10298.    */
  10299.  
  10300.   Vue.prototype.$delete = function (key) {
  10301.     del(this._data, key);
  10302.   };
  10303.  
  10304.   /**
  10305.    * Watch an expression, trigger callback when its
  10306.    * value changes.
  10307.    *
  10308.    * @param {String|Function} expOrFn
  10309.    * @param {Function} cb
  10310.    * @param {Object} [options]
  10311.    *                 - {Boolean} deep
  10312.    *                 - {Boolean} immediate
  10313.    * @return {Function} - unwatchFn
  10314.    */
  10315.  
  10316.   Vue.prototype.$watch = function (expOrFn, cb, options) {
  10317.     var vm = this;
  10318.     var parsed;
  10319.     if (typeof expOrFn === 'string') {
  10320.       parsed = parseDirective(expOrFn);
  10321.       expOrFn = parsed.expression;
  10322.     }
  10323.     var watcher = new Watcher(vm, expOrFn, cb, {
  10324.       deep: options && options.deep,
  10325.       sync: options && options.sync,
  10326.       filters: parsed && parsed.filters,
  10327.       user: !options || options.user !== false
  10328.     });
  10329.     if (options && options.immediate) {
  10330.       cb.call(vm, watcher.value);
  10331.     }
  10332.     return function unwatchFn() {
  10333.       watcher.teardown();
  10334.     };
  10335.   };
  10336.  
  10337.   /**
  10338.    * Evaluate a text directive, including filters.
  10339.    *
  10340.    * @param {String} text
  10341.    * @param {Boolean} [asStatement]
  10342.    * @return {String}
  10343.    */
  10344.  
  10345.   Vue.prototype.$eval = function (text, asStatement) {
  10346.     // check for filters.
  10347.     if (filterRE$1.test(text)) {
  10348.       var dir = parseDirective(text);
  10349.       // the filter regex check might give false positive
  10350.       // for pipes inside strings, so it's possible that
  10351.       // we don't get any filters here
  10352.       var val = this.$get(dir.expression, asStatement);
  10353.       return dir.filters ? this._applyFilters(val, null, dir.filters) : val;
  10354.     } else {
  10355.       // no filter
  10356.       return this.$get(text, asStatement);
  10357.     }
  10358.   };
  10359.  
  10360.   /**
  10361.    * Interpolate a piece of template text.
  10362.    *
  10363.    * @param {String} text
  10364.    * @return {String}
  10365.    */
  10366.  
  10367.   Vue.prototype.$interpolate = function (text) {
  10368.     var tokens = parseText(text);
  10369.     var vm = this;
  10370.     if (tokens) {
  10371.       if (tokens.length === 1) {
  10372.         return vm.$eval(tokens[0].value) + '';
  10373.       } else {
  10374.         return tokens.map(function (token) {
  10375.           return token.tag ? vm.$eval(token.value) : token.value;
  10376.         }).join('');
  10377.       }
  10378.     } else {
  10379.       return text;
  10380.     }
  10381.   };
  10382.  
  10383.   /**
  10384.    * Log instance data as a plain JS object
  10385.    * so that it is easier to inspect in console.
  10386.    * This method assumes console is available.
  10387.    *
  10388.    * @param {String} [path]
  10389.    */
  10390.  
  10391.   Vue.prototype.$log = function (path) {
  10392.     var data = path ? getPath(this._data, path) : this._data;
  10393.     if (data) {
  10394.       data = clean(data);
  10395.     }
  10396.     // include computed fields
  10397.     if (!path) {
  10398.       var key;
  10399.       for (key in this.$options.computed) {
  10400.         data[key] = clean(this[key]);
  10401.       }
  10402.       if (this._props) {
  10403.         for (key in this._props) {
  10404.           data[key] = clean(this[key]);
  10405.         }
  10406.       }
  10407.     }
  10408.     console.log(data);
  10409.   };
  10410.  
  10411.   /**
  10412.    * "clean" a getter/setter converted object into a plain
  10413.    * object copy.
  10414.    *
  10415.    * @param {Object} - obj
  10416.    * @return {Object}
  10417.    */
  10418.  
  10419.   function clean(obj) {
  10420.     return JSON.parse(JSON.stringify(obj));
  10421.   }
  10422. }
  10423.  
  10424. function domAPI (Vue) {
  10425.   /**
  10426.    * Convenience on-instance nextTick. The callback is
  10427.    * auto-bound to the instance, and this avoids component
  10428.    * modules having to rely on the global Vue.
  10429.    *
  10430.    * @param {Function} fn
  10431.    */
  10432.  
  10433.   Vue.prototype.$nextTick = function (fn) {
  10434.     nextTick(fn, this);
  10435.   };
  10436.  
  10437.   /**
  10438.    * Append instance to target
  10439.    *
  10440.    * @param {Node} target
  10441.    * @param {Function} [cb]
  10442.    * @param {Boolean} [withTransition] - defaults to true
  10443.    */
  10444.  
  10445.   Vue.prototype.$appendTo = function (target, cb, withTransition) {
  10446.     return insert(this, target, cb, withTransition, append, appendWithTransition);
  10447.   };
  10448.  
  10449.   /**
  10450.    * Prepend instance to target
  10451.    *
  10452.    * @param {Node} target
  10453.    * @param {Function} [cb]
  10454.    * @param {Boolean} [withTransition] - defaults to true
  10455.    */
  10456.  
  10457.   Vue.prototype.$prependTo = function (target, cb, withTransition) {
  10458.     target = query(target);
  10459.     if (target.hasChildNodes()) {
  10460.       this.$before(target.firstChild, cb, withTransition);
  10461.     } else {
  10462.       this.$appendTo(target, cb, withTransition);
  10463.     }
  10464.     return this;
  10465.   };
  10466.  
  10467.   /**
  10468.    * Insert instance before target
  10469.    *
  10470.    * @param {Node} target
  10471.    * @param {Function} [cb]
  10472.    * @param {Boolean} [withTransition] - defaults to true
  10473.    */
  10474.  
  10475.   Vue.prototype.$before = function (target, cb, withTransition) {
  10476.     return insert(this, target, cb, withTransition, beforeWithCb, beforeWithTransition);
  10477.   };
  10478.  
  10479.   /**
  10480.    * Insert instance after target
  10481.    *
  10482.    * @param {Node} target
  10483.    * @param {Function} [cb]
  10484.    * @param {Boolean} [withTransition] - defaults to true
  10485.    */
  10486.  
  10487.   Vue.prototype.$after = function (target, cb, withTransition) {
  10488.     target = query(target);
  10489.     if (target.nextSibling) {
  10490.       this.$before(target.nextSibling, cb, withTransition);
  10491.     } else {
  10492.       this.$appendTo(target.parentNode, cb, withTransition);
  10493.     }
  10494.     return this;
  10495.   };
  10496.  
  10497.   /**
  10498.    * Remove instance from DOM
  10499.    *
  10500.    * @param {Function} [cb]
  10501.    * @param {Boolean} [withTransition] - defaults to true
  10502.    */
  10503.  
  10504.   Vue.prototype.$remove = function (cb, withTransition) {
  10505.     if (!this.$el.parentNode) {
  10506.       return cb && cb();
  10507.     }
  10508.     var inDocument = this._isAttached && inDoc(this.$el);
  10509.     // if we are not in document, no need to check
  10510.     // for transitions
  10511.     if (!inDocument) withTransition = false;
  10512.     var self = this;
  10513.     var realCb = function realCb() {
  10514.       if (inDocument) self._callHook('detached');
  10515.       if (cb) cb();
  10516.     };
  10517.     if (this._isFragment) {
  10518.       removeNodeRange(this._fragmentStart, this._fragmentEnd, this, this._fragment, realCb);
  10519.     } else {
  10520.       var op = withTransition === false ? removeWithCb : removeWithTransition;
  10521.       op(this.$el, this, realCb);
  10522.     }
  10523.     return this;
  10524.   };
  10525.  
  10526.   /**
  10527.    * Shared DOM insertion function.
  10528.    *
  10529.    * @param {Vue} vm
  10530.    * @param {Element} target
  10531.    * @param {Function} [cb]
  10532.    * @param {Boolean} [withTransition]
  10533.    * @param {Function} op1 - op for non-transition insert
  10534.    * @param {Function} op2 - op for transition insert
  10535.    * @return vm
  10536.    */
  10537.  
  10538.   function insert(vm, target, cb, withTransition, op1, op2) {
  10539.     target = query(target);
  10540.     var targetIsDetached = !inDoc(target);
  10541.     var op = withTransition === false || targetIsDetached ? op1 : op2;
  10542.     var shouldCallHook = !targetIsDetached && !vm._isAttached && !inDoc(vm.$el);
  10543.     if (vm._isFragment) {
  10544.       mapNodeRange(vm._fragmentStart, vm._fragmentEnd, function (node) {
  10545.         op(node, target, vm);
  10546.       });
  10547.       cb && cb();
  10548.     } else {
  10549.       op(vm.$el, target, vm, cb);
  10550.     }
  10551.     if (shouldCallHook) {
  10552.       vm._callHook('attached');
  10553.     }
  10554.     return vm;
  10555.   }
  10556.  
  10557.   /**
  10558.    * Check for selectors
  10559.    *
  10560.    * @param {String|Element} el
  10561.    */
  10562.  
  10563.   function query(el) {
  10564.     return typeof el === 'string' ? document.querySelector(el) : el;
  10565.   }
  10566.  
  10567.   /**
  10568.    * Append operation that takes a callback.
  10569.    *
  10570.    * @param {Node} el
  10571.    * @param {Node} target
  10572.    * @param {Vue} vm - unused
  10573.    * @param {Function} [cb]
  10574.    */
  10575.  
  10576.   function append(el, target, vm, cb) {
  10577.     target.appendChild(el);
  10578.     if (cb) cb();
  10579.   }
  10580.  
  10581.   /**
  10582.    * InsertBefore operation that takes a callback.
  10583.    *
  10584.    * @param {Node} el
  10585.    * @param {Node} target
  10586.    * @param {Vue} vm - unused
  10587.    * @param {Function} [cb]
  10588.    */
  10589.  
  10590.   function beforeWithCb(el, target, vm, cb) {
  10591.     before(el, target);
  10592.     if (cb) cb();
  10593.   }
  10594.  
  10595.   /**
  10596.    * Remove operation that takes a callback.
  10597.    *
  10598.    * @param {Node} el
  10599.    * @param {Vue} vm - unused
  10600.    * @param {Function} [cb]
  10601.    */
  10602.  
  10603.   function removeWithCb(el, vm, cb) {
  10604.     remove(el);
  10605.     if (cb) cb();
  10606.   }
  10607. }
  10608.  
  10609. function eventsAPI (Vue) {
  10610.   /**
  10611.    * Listen on the given `event` with `fn`.
  10612.    *
  10613.    * @param {String} event
  10614.    * @param {Function} fn
  10615.    */
  10616.  
  10617.   Vue.prototype.$on = function (event, fn) {
  10618.     (this._events[event] || (this._events[event] = [])).push(fn);
  10619.     modifyListenerCount(this, event, 1);
  10620.     return this;
  10621.   };
  10622.  
  10623.   /**
  10624.    * Adds an `event` listener that will be invoked a single
  10625.    * time then automatically removed.
  10626.    *
  10627.    * @param {String} event
  10628.    * @param {Function} fn
  10629.    */
  10630.  
  10631.   Vue.prototype.$once = function (event, fn) {
  10632.     var self = this;
  10633.     function on() {
  10634.       self.$off(event, on);
  10635.       fn.apply(this, arguments);
  10636.     }
  10637.     on.fn = fn;
  10638.     this.$on(event, on);
  10639.     return this;
  10640.   };
  10641.  
  10642.   /**
  10643.    * Remove the given callback for `event` or all
  10644.    * registered callbacks.
  10645.    *
  10646.    * @param {String} event
  10647.    * @param {Function} fn
  10648.    */
  10649.  
  10650.   Vue.prototype.$off = function (event, fn) {
  10651.     var cbs;
  10652.     // all
  10653.     if (!arguments.length) {
  10654.       if (this.$parent) {
  10655.         for (event in this._events) {
  10656.           cbs = this._events[event];
  10657.           if (cbs) {
  10658.             modifyListenerCount(this, event, -cbs.length);
  10659.           }
  10660.         }
  10661.       }
  10662.       this._events = {};
  10663.       return this;
  10664.     }
  10665.     // specific event
  10666.     cbs = this._events[event];
  10667.     if (!cbs) {
  10668.       return this;
  10669.     }
  10670.     if (arguments.length === 1) {
  10671.       modifyListenerCount(this, event, -cbs.length);
  10672.       this._events[event] = null;
  10673.       return this;
  10674.     }
  10675.     // specific handler
  10676.     var cb;
  10677.     var i = cbs.length;
  10678.     while (i--) {
  10679.       cb = cbs[i];
  10680.       if (cb === fn || cb.fn === fn) {
  10681.         modifyListenerCount(this, event, -1);
  10682.         cbs.splice(i, 1);
  10683.         break;
  10684.       }
  10685.     }
  10686.     return this;
  10687.   };
  10688.  
  10689.   /**
  10690.    * Trigger an event on self.
  10691.    *
  10692.    * @param {String|Object} event
  10693.    * @return {Boolean} shouldPropagate
  10694.    */
  10695.  
  10696.   Vue.prototype.$emit = function (event) {
  10697.     var isSource = typeof event === 'string';
  10698.     event = isSource ? event : event.name;
  10699.     var cbs = this._events[event];
  10700.     var shouldPropagate = isSource || !cbs;
  10701.     if (cbs) {
  10702.       cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  10703.       // this is a somewhat hacky solution to the question raised
  10704.       // in #2102: for an inline component listener like <comp @test="doThis">,
  10705.       // the propagation handling is somewhat broken. Therefore we
  10706.       // need to treat these inline callbacks differently.
  10707.       var hasParentCbs = isSource && cbs.some(function (cb) {
  10708.         return cb._fromParent;
  10709.       });
  10710.       if (hasParentCbs) {
  10711.         shouldPropagate = false;
  10712.       }
  10713.       var args = toArray(arguments, 1);
  10714.       for (var i = 0, l = cbs.length; i < l; i++) {
  10715.         var cb = cbs[i];
  10716.         var res = cb.apply(this, args);
  10717.         if (res === true && (!hasParentCbs || cb._fromParent)) {
  10718.           shouldPropagate = true;
  10719.         }
  10720.       }
  10721.     }
  10722.     return shouldPropagate;
  10723.   };
  10724.  
  10725.   /**
  10726.    * Recursively broadcast an event to all children instances.
  10727.    *
  10728.    * @param {String|Object} event
  10729.    * @param {...*} additional arguments
  10730.    */
  10731.  
  10732.   Vue.prototype.$broadcast = function (event) {
  10733.     var isSource = typeof event === 'string';
  10734.     event = isSource ? event : event.name;
  10735.     // if no child has registered for this event,
  10736.     // then there's no need to broadcast.
  10737.     if (!this._eventsCount[event]) return;
  10738.     var children = this.$children;
  10739.     var args = toArray(arguments);
  10740.     if (isSource) {
  10741.       // use object event to indicate non-source emit
  10742.       // on children
  10743.       args[0] = { name: event, source: this };
  10744.     }
  10745.     for (var i = 0, l = children.length; i < l; i++) {
  10746.       var child = children[i];
  10747.       var shouldPropagate = child.$emit.apply(child, args);
  10748.       if (shouldPropagate) {
  10749.         child.$broadcast.apply(child, args);
  10750.       }
  10751.     }
  10752.     return this;
  10753.   };
  10754.  
  10755.   /**
  10756.    * Recursively propagate an event up the parent chain.
  10757.    *
  10758.    * @param {String} event
  10759.    * @param {...*} additional arguments
  10760.    */
  10761.  
  10762.   Vue.prototype.$dispatch = function (event) {
  10763.     var shouldPropagate = this.$emit.apply(this, arguments);
  10764.     if (!shouldPropagate) return;
  10765.     var parent = this.$parent;
  10766.     var args = toArray(arguments);
  10767.     // use object event to indicate non-source emit
  10768.     // on parents
  10769.     args[0] = { name: event, source: this };
  10770.     while (parent) {
  10771.       shouldPropagate = parent.$emit.apply(parent, args);
  10772.       parent = shouldPropagate ? parent.$parent : null;
  10773.     }
  10774.     return this;
  10775.   };
  10776.  
  10777.   /**
  10778.    * Modify the listener counts on all parents.
  10779.    * This bookkeeping allows $broadcast to return early when
  10780.    * no child has listened to a certain event.
  10781.    *
  10782.    * @param {Vue} vm
  10783.    * @param {String} event
  10784.    * @param {Number} count
  10785.    */
  10786.  
  10787.   var hookRE = /^hook:/;
  10788.   function modifyListenerCount(vm, event, count) {
  10789.     var parent = vm.$parent;
  10790.     // hooks do not get broadcasted so no need
  10791.     // to do bookkeeping for them
  10792.     if (!parent || !count || hookRE.test(event)) return;
  10793.     while (parent) {
  10794.       parent._eventsCount[event] = (parent._eventsCount[event] || 0) + count;
  10795.       parent = parent.$parent;
  10796.     }
  10797.   }
  10798. }
  10799.  
  10800. function lifecycleAPI (Vue) {
  10801.   /**
  10802.    * Set instance target element and kick off the compilation
  10803.    * process. The passed in `el` can be a selector string, an
  10804.    * existing Element, or a DocumentFragment (for block
  10805.    * instances).
  10806.    *
  10807.    * @param {Element|DocumentFragment|string} el
  10808.    * @public
  10809.    */
  10810.  
  10811.   Vue.prototype.$mount = function (el) {
  10812.     if (this._isCompiled) {
  10813.       process.env.NODE_ENV !== 'production' && warn('$mount() should be called only once.', this);
  10814.       return;
  10815.     }
  10816.     el = query(el);
  10817.     if (!el) {
  10818.       el = document.createElement('div');
  10819.     }
  10820.     this._compile(el);
  10821.     this._initDOMHooks();
  10822.     if (inDoc(this.$el)) {
  10823.       this._callHook('attached');
  10824.       ready.call(this);
  10825.     } else {
  10826.       this.$once('hook:attached', ready);
  10827.     }
  10828.     return this;
  10829.   };
  10830.  
  10831.   /**
  10832.    * Mark an instance as ready.
  10833.    */
  10834.  
  10835.   function ready() {
  10836.     this._isAttached = true;
  10837.     this._isReady = true;
  10838.     this._callHook('ready');
  10839.   }
  10840.  
  10841.   /**
  10842.    * Teardown the instance, simply delegate to the internal
  10843.    * _destroy.
  10844.    *
  10845.    * @param {Boolean} remove
  10846.    * @param {Boolean} deferCleanup
  10847.    */
  10848.  
  10849.   Vue.prototype.$destroy = function (remove, deferCleanup) {
  10850.     this._destroy(remove, deferCleanup);
  10851.   };
  10852.  
  10853.   /**
  10854.    * Partially compile a piece of DOM and return a
  10855.    * decompile function.
  10856.    *
  10857.    * @param {Element|DocumentFragment} el
  10858.    * @param {Vue} [host]
  10859.    * @param {Object} [scope]
  10860.    * @param {Fragment} [frag]
  10861.    * @return {Function}
  10862.    */
  10863.  
  10864.   Vue.prototype.$compile = function (el, host, scope, frag) {
  10865.     return compile(el, this.$options, true)(this, el, host, scope, frag);
  10866.   };
  10867. }
  10868.  
  10869. /**
  10870.  * The exposed Vue constructor.
  10871.  *
  10872.  * API conventions:
  10873.  * - public API methods/properties are prefixed with `$`
  10874.  * - internal methods/properties are prefixed with `_`
  10875.  * - non-prefixed properties are assumed to be proxied user
  10876.  *   data.
  10877.  *
  10878.  * @constructor
  10879.  * @param {Object} [options]
  10880.  * @public
  10881.  */
  10882.  
  10883. function Vue(options) {
  10884.   this._init(options);
  10885. }
  10886.  
  10887. // install internals
  10888. initMixin(Vue);
  10889. stateMixin(Vue);
  10890. eventsMixin(Vue);
  10891. lifecycleMixin(Vue);
  10892. miscMixin(Vue);
  10893.  
  10894. // install instance APIs
  10895. dataAPI(Vue);
  10896. domAPI(Vue);
  10897. eventsAPI(Vue);
  10898. lifecycleAPI(Vue);
  10899.  
  10900. var slot = {
  10901.  
  10902.   priority: SLOT,
  10903.   params: ['name'],
  10904.  
  10905.   bind: function bind() {
  10906.     // this was resolved during component transclusion
  10907.     var name = this.params.name || 'default';
  10908.     var content = this.vm._slotContents && this.vm._slotContents[name];
  10909.     if (!content || !content.hasChildNodes()) {
  10910.       this.fallback();
  10911.     } else {
  10912.       this.compile(content.cloneNode(true), this.vm._context, this.vm);
  10913.     }
  10914.   },
  10915.  
  10916.   compile: function compile(content, context, host) {
  10917.     if (content && context) {
  10918.       if (this.el.hasChildNodes() && content.childNodes.length === 1 && content.childNodes[0].nodeType === 1 && content.childNodes[0].hasAttribute('v-if')) {
  10919.         // if the inserted slot has v-if
  10920.         // inject fallback content as the v-else
  10921.         var elseBlock = document.createElement('template');
  10922.         elseBlock.setAttribute('v-else', '');
  10923.         elseBlock.innerHTML = this.el.innerHTML;
  10924.         // the else block should be compiled in child scope
  10925.         elseBlock._context = this.vm;
  10926.         content.appendChild(elseBlock);
  10927.       }
  10928.       var scope = host ? host._scope : this._scope;
  10929.       this.unlink = context.$compile(content, host, scope, this._frag);
  10930.     }
  10931.     if (content) {
  10932.       replace(this.el, content);
  10933.     } else {
  10934.       remove(this.el);
  10935.     }
  10936.   },
  10937.  
  10938.   fallback: function fallback() {
  10939.     this.compile(extractContent(this.el, true), this.vm);
  10940.   },
  10941.  
  10942.   unbind: function unbind() {
  10943.     if (this.unlink) {
  10944.       this.unlink();
  10945.     }
  10946.   }
  10947. };
  10948.  
  10949. var partial = {
  10950.  
  10951.   priority: PARTIAL,
  10952.  
  10953.   params: ['name'],
  10954.  
  10955.   // watch changes to name for dynamic partials
  10956.   paramWatchers: {
  10957.     name: function name(value) {
  10958.       vIf.remove.call(this);
  10959.       if (value) {
  10960.         this.insert(value);
  10961.       }
  10962.     }
  10963.   },
  10964.  
  10965.   bind: function bind() {
  10966.     this.anchor = createAnchor('v-partial');
  10967.     replace(this.el, this.anchor);
  10968.     this.insert(this.params.name);
  10969.   },
  10970.  
  10971.   insert: function insert(id) {
  10972.     var partial = resolveAsset(this.vm.$options, 'partials', id, true);
  10973.     if (partial) {
  10974.       this.factory = new FragmentFactory(this.vm, partial);
  10975.       vIf.insert.call(this);
  10976.     }
  10977.   },
  10978.  
  10979.   unbind: function unbind() {
  10980.     if (this.frag) {
  10981.       this.frag.destroy();
  10982.     }
  10983.   }
  10984. };
  10985.  
  10986. var elementDirectives = {
  10987.   slot: slot,
  10988.   partial: partial
  10989. };
  10990.  
  10991. var convertArray = vFor._postProcess;
  10992.  
  10993. /**
  10994.  * Limit filter for arrays
  10995.  *
  10996.  * @param {Number} n
  10997.  * @param {Number} offset (Decimal expected)
  10998.  */
  10999.  
  11000. function limitBy(arr, n, offset) {
  11001.   offset = offset ? parseInt(offset, 10) : 0;
  11002.   n = toNumber(n);
  11003.   return typeof n === 'number' ? arr.slice(offset, offset + n) : arr;
  11004. }
  11005.  
  11006. /**
  11007.  * Filter filter for arrays
  11008.  *
  11009.  * @param {String} search
  11010.  * @param {String} [delimiter]
  11011.  * @param {String} ...dataKeys
  11012.  */
  11013.  
  11014. function filterBy(arr, search, delimiter) {
  11015.   arr = convertArray(arr);
  11016.   if (search == null) {
  11017.     return arr;
  11018.   }
  11019.   if (typeof search === 'function') {
  11020.     return arr.filter(search);
  11021.   }
  11022.   // cast to lowercase string
  11023.   search = ('' + search).toLowerCase();
  11024.   // allow optional `in` delimiter
  11025.   // because why not
  11026.   var n = delimiter === 'in' ? 3 : 2;
  11027.   // extract and flatten keys
  11028.   var keys = Array.prototype.concat.apply([], toArray(arguments, n));
  11029.   var res = [];
  11030.   var item, key, val, j;
  11031.   for (var i = 0, l = arr.length; i < l; i++) {
  11032.     item = arr[i];
  11033.     val = item && item.$value || item;
  11034.     j = keys.length;
  11035.     if (j) {
  11036.       while (j--) {
  11037.         key = keys[j];
  11038.         if (key === '$key' && contains(item.$key, search) || contains(getPath(val, key), search)) {
  11039.           res.push(item);
  11040.           break;
  11041.         }
  11042.       }
  11043.     } else if (contains(item, search)) {
  11044.       res.push(item);
  11045.     }
  11046.   }
  11047.   return res;
  11048. }
  11049.  
  11050. /**
  11051.  * Filter filter for arrays
  11052.  *
  11053.  * @param {String|Array<String>|Function} ...sortKeys
  11054.  * @param {Number} [order]
  11055.  */
  11056.  
  11057. function orderBy(arr) {
  11058.   var comparator = null;
  11059.   var sortKeys = undefined;
  11060.   arr = convertArray(arr);
  11061.  
  11062.   // determine order (last argument)
  11063.   var args = toArray(arguments, 1);
  11064.   var order = args[args.length - 1];
  11065.   if (typeof order === 'number') {
  11066.     order = order < 0 ? -1 : 1;
  11067.     args = args.length > 1 ? args.slice(0, -1) : args;
  11068.   } else {
  11069.     order = 1;
  11070.   }
  11071.  
  11072.   // determine sortKeys & comparator
  11073.   var firstArg = args[0];
  11074.   if (!firstArg) {
  11075.     return arr;
  11076.   } else if (typeof firstArg === 'function') {
  11077.     // custom comparator
  11078.     comparator = function (a, b) {
  11079.       return firstArg(a, b) * order;
  11080.     };
  11081.   } else {
  11082.     // string keys. flatten first
  11083.     sortKeys = Array.prototype.concat.apply([], args);
  11084.     comparator = function (a, b, i) {
  11085.       i = i || 0;
  11086.       return i >= sortKeys.length - 1 ? baseCompare(a, b, i) : baseCompare(a, b, i) || comparator(a, b, i + 1);
  11087.     };
  11088.   }
  11089.  
  11090.   function baseCompare(a, b, sortKeyIndex) {
  11091.     var sortKey = sortKeys[sortKeyIndex];
  11092.     if (sortKey) {
  11093.       if (sortKey !== '$key') {
  11094.         if (isObject(a) && '$value' in a) a = a.$value;
  11095.         if (isObject(b) && '$value' in b) b = b.$value;
  11096.       }
  11097.       a = isObject(a) ? getPath(a, sortKey) : a;
  11098.       b = isObject(b) ? getPath(b, sortKey) : b;
  11099.     }
  11100.     return a === b ? 0 : a > b ? order : -order;
  11101.   }
  11102.  
  11103.   // sort on a copy to avoid mutating original array
  11104.   return arr.slice().sort(comparator);
  11105. }
  11106.  
  11107. /**
  11108.  * String contain helper
  11109.  *
  11110.  * @param {*} val
  11111.  * @param {String} search
  11112.  */
  11113.  
  11114. function contains(val, search) {
  11115.   var i;
  11116.   if (isPlainObject(val)) {
  11117.     var keys = Object.keys(val);
  11118.     i = keys.length;
  11119.     while (i--) {
  11120.       if (contains(val[keys[i]], search)) {
  11121.         return true;
  11122.       }
  11123.     }
  11124.   } else if (isArray(val)) {
  11125.     i = val.length;
  11126.     while (i--) {
  11127.       if (contains(val[i], search)) {
  11128.         return true;
  11129.       }
  11130.     }
  11131.   } else if (val != null) {
  11132.     return val.toString().toLowerCase().indexOf(search) > -1;
  11133.   }
  11134. }
  11135.  
  11136. var digitsRE = /(\d{3})(?=\d)/g;
  11137.  
  11138. // asset collections must be a plain object.
  11139. var filters = {
  11140.  
  11141.   orderBy: orderBy,
  11142.   filterBy: filterBy,
  11143.   limitBy: limitBy,
  11144.  
  11145.   /**
  11146.    * Stringify value.
  11147.    *
  11148.    * @param {Number} indent
  11149.    */
  11150.  
  11151.   json: {
  11152.     read: function read(value, indent) {
  11153.       return typeof value === 'string' ? value : JSON.stringify(value, null, arguments.length > 1 ? indent : 2);
  11154.     },
  11155.     write: function write(value) {
  11156.       try {
  11157.         return JSON.parse(value);
  11158.       } catch (e) {
  11159.         return value;
  11160.       }
  11161.     }
  11162.   },
  11163.  
  11164.   /**
  11165.    * 'abc' => 'Abc'
  11166.    */
  11167.  
  11168.   capitalize: function capitalize(value) {
  11169.     if (!value && value !== 0) return '';
  11170.     value = value.toString();
  11171.     return value.charAt(0).toUpperCase() + value.slice(1);
  11172.   },
  11173.  
  11174.   /**
  11175.    * 'abc' => 'ABC'
  11176.    */
  11177.  
  11178.   uppercase: function uppercase(value) {
  11179.     return value || value === 0 ? value.toString().toUpperCase() : '';
  11180.   },
  11181.  
  11182.   /**
  11183.    * 'AbC' => 'abc'
  11184.    */
  11185.  
  11186.   lowercase: function lowercase(value) {
  11187.     return value || value === 0 ? value.toString().toLowerCase() : '';
  11188.   },
  11189.  
  11190.   /**
  11191.    * 12345 => $12,345.00
  11192.    *
  11193.    * @param {String} sign
  11194.    * @param {Number} decimals Decimal places
  11195.    */
  11196.  
  11197.   currency: function currency(value, _currency, decimals) {
  11198.     value = parseFloat(value);
  11199.     if (!isFinite(value) || !value && value !== 0) return '';
  11200.     _currency = _currency != null ? _currency : '$';
  11201.     decimals = decimals != null ? decimals : 2;
  11202.     var stringified = Math.abs(value).toFixed(decimals);
  11203.     var _int = decimals ? stringified.slice(0, -1 - decimals) : stringified;
  11204.     var i = _int.length % 3;
  11205.     var head = i > 0 ? _int.slice(0, i) + (_int.length > 3 ? ',' : '') : '';
  11206.     var _float = decimals ? stringified.slice(-1 - decimals) : '';
  11207.     var sign = value < 0 ? '-' : '';
  11208.     return sign + _currency + head + _int.slice(i).replace(digitsRE, '$1,') + _float;
  11209.   },
  11210.  
  11211.   /**
  11212.    * 'item' => 'items'
  11213.    *
  11214.    * @params
  11215.    *  an array of strings corresponding to
  11216.    *  the single, double, triple ... forms of the word to
  11217.    *  be pluralized. When the number to be pluralized
  11218.    *  exceeds the length of the args, it will use the last
  11219.    *  entry in the array.
  11220.    *
  11221.    *  e.g. ['single', 'double', 'triple', 'multiple']
  11222.    */
  11223.  
  11224.   pluralize: function pluralize(value) {
  11225.     var args = toArray(arguments, 1);
  11226.     var length = args.length;
  11227.     if (length > 1) {
  11228.       var index = value % 10 - 1;
  11229.       return index in args ? args[index] : args[length - 1];
  11230.     } else {
  11231.       return args[0] + (value === 1 ? '' : 's');
  11232.     }
  11233.   },
  11234.  
  11235.   /**
  11236.    * Debounce a handler function.
  11237.    *
  11238.    * @param {Function} handler
  11239.    * @param {Number} delay = 300
  11240.    * @return {Function}
  11241.    */
  11242.  
  11243.   debounce: function debounce(handler, delay) {
  11244.     if (!handler) return;
  11245.     if (!delay) {
  11246.       delay = 300;
  11247.     }
  11248.     return _debounce(handler, delay);
  11249.   }
  11250. };
  11251.  
  11252. function installGlobalAPI (Vue) {
  11253.   /**
  11254.    * Vue and every constructor that extends Vue has an
  11255.    * associated options object, which can be accessed during
  11256.    * compilation steps as `this.constructor.options`.
  11257.    *
  11258.    * These can be seen as the default options of every
  11259.    * Vue instance.
  11260.    */
  11261.  
  11262.   Vue.options = {
  11263.     directives: directives,
  11264.     elementDirectives: elementDirectives,
  11265.     filters: filters,
  11266.     transitions: {},
  11267.     components: {},
  11268.     partials: {},
  11269.     replace: true
  11270.   };
  11271.  
  11272.   /**
  11273.    * Expose useful internals
  11274.    */
  11275.  
  11276.   Vue.util = util;
  11277.   Vue.config = config;
  11278.   Vue.set = set;
  11279.   Vue['delete'] = del;
  11280.   Vue.nextTick = nextTick;
  11281.  
  11282.   /**
  11283.    * The following are exposed for advanced usage / plugins
  11284.    */
  11285.  
  11286.   Vue.compiler = compiler;
  11287.   Vue.FragmentFactory = FragmentFactory;
  11288.   Vue.internalDirectives = internalDirectives;
  11289.   Vue.parsers = {
  11290.     path: path,
  11291.     text: text,
  11292.     template: template,
  11293.     directive: directive,
  11294.     expression: expression
  11295.   };
  11296.  
  11297.   /**
  11298.    * Each instance constructor, including Vue, has a unique
  11299.    * cid. This enables us to create wrapped "child
  11300.    * constructors" for prototypal inheritance and cache them.
  11301.    */
  11302.  
  11303.   Vue.cid = 0;
  11304.   var cid = 1;
  11305.  
  11306.   /**
  11307.    * Class inheritance
  11308.    *
  11309.    * @param {Object} extendOptions
  11310.    */
  11311.  
  11312.   Vue.extend = function (extendOptions) {
  11313.     extendOptions = extendOptions || {};
  11314.     var Super = this;
  11315.     var isFirstExtend = Super.cid === 0;
  11316.     if (isFirstExtend && extendOptions._Ctor) {
  11317.       return extendOptions._Ctor;
  11318.     }
  11319.     var name = extendOptions.name || Super.options.name;
  11320.     if (process.env.NODE_ENV !== 'production') {
  11321.       if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  11322.         warn('Invalid component name: "' + name + '". Component names ' + 'can only contain alphanumeric characaters and the hyphen.');
  11323.         name = null;
  11324.       }
  11325.     }
  11326.     var Sub = createClass(name || 'VueComponent');
  11327.     Sub.prototype = Object.create(Super.prototype);
  11328.     Sub.prototype.constructor = Sub;
  11329.     Sub.cid = cid++;
  11330.     Sub.options = mergeOptions(Super.options, extendOptions);
  11331.     Sub['super'] = Super;
  11332.     // allow further extension
  11333.     Sub.extend = Super.extend;
  11334.     // create asset registers, so extended classes
  11335.     // can have their private assets too.
  11336.     config._assetTypes.forEach(function (type) {
  11337.       Sub[type] = Super[type];
  11338.     });
  11339.     // enable recursive self-lookup
  11340.     if (name) {
  11341.       Sub.options.components[name] = Sub;
  11342.     }
  11343.     // cache constructor
  11344.     if (isFirstExtend) {
  11345.       extendOptions._Ctor = Sub;
  11346.     }
  11347.     return Sub;
  11348.   };
  11349.  
  11350.   /**
  11351.    * A function that returns a sub-class constructor with the
  11352.    * given name. This gives us much nicer output when
  11353.    * logging instances in the console.
  11354.    *
  11355.    * @param {String} name
  11356.    * @return {Function}
  11357.    */
  11358.  
  11359.   function createClass(name) {
  11360.     /* eslint-disable no-new-func */
  11361.     return new Function('return function ' + classify(name) + ' (options) { this._init(options) }')();
  11362.     /* eslint-enable no-new-func */
  11363.   }
  11364.  
  11365.   /**
  11366.    * Plugin system
  11367.    *
  11368.    * @param {Object} plugin
  11369.    */
  11370.  
  11371.   Vue.use = function (plugin) {
  11372.     /* istanbul ignore if */
  11373.     if (plugin.installed) {
  11374.       return;
  11375.     }
  11376.     // additional parameters
  11377.     var args = toArray(arguments, 1);
  11378.     args.unshift(this);
  11379.     if (typeof plugin.install === 'function') {
  11380.       plugin.install.apply(plugin, args);
  11381.     } else {
  11382.       plugin.apply(null, args);
  11383.     }
  11384.     plugin.installed = true;
  11385.     return this;
  11386.   };
  11387.  
  11388.   /**
  11389.    * Apply a global mixin by merging it into the default
  11390.    * options.
  11391.    */
  11392.  
  11393.   Vue.mixin = function (mixin) {
  11394.     Vue.options = mergeOptions(Vue.options, mixin);
  11395.   };
  11396.  
  11397.   /**
  11398.    * Create asset registration methods with the following
  11399.    * signature:
  11400.    *
  11401.    * @param {String} id
  11402.    * @param {*} definition
  11403.    */
  11404.  
  11405.   config._assetTypes.forEach(function (type) {
  11406.     Vue[type] = function (id, definition) {
  11407.       if (!definition) {
  11408.         return this.options[type + 's'][id];
  11409.       } else {
  11410.         /* istanbul ignore if */
  11411.         if (process.env.NODE_ENV !== 'production') {
  11412.           if (type === 'component' && (commonTagRE.test(id) || reservedTagRE.test(id))) {
  11413.             warn('Do not use built-in or reserved HTML elements as component ' + 'id: ' + id);
  11414.           }
  11415.         }
  11416.         if (type === 'component' && isPlainObject(definition)) {
  11417.           if (!definition.name) {
  11418.             definition.name = id;
  11419.           }
  11420.           definition = Vue.extend(definition);
  11421.         }
  11422.         this.options[type + 's'][id] = definition;
  11423.         return definition;
  11424.       }
  11425.     };
  11426.   });
  11427.  
  11428.   // expose internal transition API
  11429.   extend(Vue.transition, transition);
  11430. }
  11431.  
  11432. installGlobalAPI(Vue);
  11433.  
  11434. Vue.version = '1.0.26';
  11435.  
  11436. // devtools global hook
  11437. /* istanbul ignore next */
  11438. setTimeout(function () {
  11439.   if (config.devtools) {
  11440.     if (devtools) {
  11441.       devtools.emit('init', Vue);
  11442.     } else if (process.env.NODE_ENV !== 'production' && inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)) {
  11443.       console.log('Download the Vue Devtools for a better development experience:\n' + 'https://github.com/vuejs/vue-devtools');
  11444.     }
  11445.   }
  11446. }, 0);
  11447.  
  11448. module.exports = Vue;
  11449. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  11450. },{"_process":23}],25:[function(require,module,exports){
  11451. var Vue // late bind
  11452. var map = Object.create(null)
  11453. var shimmed = false
  11454. var isBrowserify = false
  11455.  
  11456. /**
  11457.  * Determine compatibility and apply patch.
  11458.  *
  11459.  * @param {Function} vue
  11460.  * @param {Boolean} browserify
  11461.  */
  11462.  
  11463. exports.install = function (vue, browserify) {
  11464.   if (shimmed) return
  11465.   shimmed = true
  11466.  
  11467.   Vue = vue
  11468.   isBrowserify = browserify
  11469.  
  11470.   exports.compatible = !!Vue.internalDirectives
  11471.   if (!exports.compatible) {
  11472.     console.warn(
  11473.       '[HMR] vue-loader hot reload is only compatible with ' +
  11474.       'Vue.js 1.0.0+.'
  11475.     )
  11476.     return
  11477.   }
  11478.  
  11479.   // patch view directive
  11480.   patchView(Vue.internalDirectives.component)
  11481.   console.log('[HMR] Vue component hot reload shim applied.')
  11482.   // shim router-view if present
  11483.   var routerView = Vue.elementDirective('router-view')
  11484.   if (routerView) {
  11485.     patchView(routerView)
  11486.     console.log('[HMR] vue-router <router-view> hot reload shim applied.')
  11487.   }
  11488. }
  11489.  
  11490. /**
  11491.  * Shim the view directive (component or router-view).
  11492.  *
  11493.  * @param {Object} View
  11494.  */
  11495.  
  11496. function patchView (View) {
  11497.   var unbuild = View.unbuild
  11498.   View.unbuild = function (defer) {
  11499.     if (!this.hotUpdating) {
  11500.       var prevComponent = this.childVM && this.childVM.constructor
  11501.       removeView(prevComponent, this)
  11502.       // defer = true means we are transitioning to a new
  11503.       // Component. Register this new component to the list.
  11504.       if (defer) {
  11505.         addView(this.Component, this)
  11506.       }
  11507.     }
  11508.     // call original
  11509.     return unbuild.call(this, defer)
  11510.   }
  11511. }
  11512.  
  11513. /**
  11514.  * Add a component view to a Component's hot list
  11515.  *
  11516.  * @param {Function} Component
  11517.  * @param {Directive} view - view directive instance
  11518.  */
  11519.  
  11520. function addView (Component, view) {
  11521.   var id = Component && Component.options.hotID
  11522.   if (id) {
  11523.     if (!map[id]) {
  11524.       map[id] = {
  11525.         Component: Component,
  11526.         views: [],
  11527.         instances: []
  11528.       }
  11529.     }
  11530.     map[id].views.push(view)
  11531.   }
  11532. }
  11533.  
  11534. /**
  11535.  * Remove a component view from a Component's hot list
  11536.  *
  11537.  * @param {Function} Component
  11538.  * @param {Directive} view - view directive instance
  11539.  */
  11540.  
  11541. function removeView (Component, view) {
  11542.   var id = Component && Component.options.hotID
  11543.   if (id) {
  11544.     map[id].views.$remove(view)
  11545.   }
  11546. }
  11547.  
  11548. /**
  11549.  * Create a record for a hot module, which keeps track of its construcotr,
  11550.  * instnaces and views (component directives or router-views).
  11551.  *
  11552.  * @param {String} id
  11553.  * @param {Object} options
  11554.  */
  11555.  
  11556. exports.createRecord = function (id, options) {
  11557.   if (typeof options === 'function') {
  11558.     options = options.options
  11559.   }
  11560.   if (typeof options.el !== 'string' && typeof options.data !== 'object') {
  11561.     makeOptionsHot(id, options)
  11562.     map[id] = {
  11563.       Component: null,
  11564.       views: [],
  11565.       instances: []
  11566.     }
  11567.   }
  11568. }
  11569.  
  11570. /**
  11571.  * Make a Component options object hot.
  11572.  *
  11573.  * @param {String} id
  11574.  * @param {Object} options
  11575.  */
  11576.  
  11577. function makeOptionsHot (id, options) {
  11578.   options.hotID = id
  11579.   injectHook(options, 'created', function () {
  11580.     var record = map[id]
  11581.     if (!record.Component) {
  11582.       record.Component = this.constructor
  11583.     }
  11584.     record.instances.push(this)
  11585.   })
  11586.   injectHook(options, 'beforeDestroy', function () {
  11587.     map[id].instances.$remove(this)
  11588.   })
  11589. }
  11590.  
  11591. /**
  11592.  * Inject a hook to a hot reloadable component so that
  11593.  * we can keep track of it.
  11594.  *
  11595.  * @param {Object} options
  11596.  * @param {String} name
  11597.  * @param {Function} hook
  11598.  */
  11599.  
  11600. function injectHook (options, name, hook) {
  11601.   var existing = options[name]
  11602.   options[name] = existing
  11603.     ? Array.isArray(existing)
  11604.       ? existing.concat(hook)
  11605.       : [existing, hook]
  11606.     : [hook]
  11607. }
  11608.  
  11609. /**
  11610.  * Update a hot component.
  11611.  *
  11612.  * @param {String} id
  11613.  * @param {Object|null} newOptions
  11614.  * @param {String|null} newTemplate
  11615.  */
  11616.  
  11617. exports.update = function (id, newOptions, newTemplate) {
  11618.   var record = map[id]
  11619.   // force full-reload if an instance of the component is active but is not
  11620.   // managed by a view
  11621.   if (!record || (record.instances.length && !record.views.length)) {
  11622.     console.log('[HMR] Root or manually-mounted instance modified. Full reload may be required.')
  11623.     if (!isBrowserify) {
  11624.       window.location.reload()
  11625.     } else {
  11626.       // browserify-hmr somehow sends incomplete bundle if we reload here
  11627.       return
  11628.     }
  11629.   }
  11630.   if (!isBrowserify) {
  11631.     // browserify-hmr already logs this
  11632.     console.log('[HMR] Updating component: ' + format(id))
  11633.   }
  11634.   var Component = record.Component
  11635.   // update constructor
  11636.   if (newOptions) {
  11637.     // in case the user exports a constructor
  11638.     Component = record.Component = typeof newOptions === 'function'
  11639.       ? newOptions
  11640.       : Vue.extend(newOptions)
  11641.     makeOptionsHot(id, Component.options)
  11642.   }
  11643.   if (newTemplate) {
  11644.     Component.options.template = newTemplate
  11645.   }
  11646.   // handle recursive lookup
  11647.   if (Component.options.name) {
  11648.     Component.options.components[Component.options.name] = Component
  11649.   }
  11650.   // reset constructor cached linker
  11651.   Component.linker = null
  11652.   // reload all views
  11653.   record.views.forEach(function (view) {
  11654.     updateView(view, Component)
  11655.   })
  11656.   // flush devtools
  11657.   if (window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
  11658.     window.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit('flush')
  11659.   }
  11660. }
  11661.  
  11662. /**
  11663.  * Update a component view instance
  11664.  *
  11665.  * @param {Directive} view
  11666.  * @param {Function} Component
  11667.  */
  11668.  
  11669. function updateView (view, Component) {
  11670.   if (!view._bound) {
  11671.     return
  11672.   }
  11673.   view.Component = Component
  11674.   view.hotUpdating = true
  11675.   // disable transitions
  11676.   view.vm._isCompiled = false
  11677.   // save state
  11678.   var state = extractState(view.childVM)
  11679.   // remount, make sure to disable keep-alive
  11680.   var keepAlive = view.keepAlive
  11681.   view.keepAlive = false
  11682.   view.mountComponent()
  11683.   view.keepAlive = keepAlive
  11684.   // restore state
  11685.   restoreState(view.childVM, state, true)
  11686.   // re-eanble transitions
  11687.   view.vm._isCompiled = true
  11688.   view.hotUpdating = false
  11689. }
  11690.  
  11691. /**
  11692.  * Extract state from a Vue instance.
  11693.  *
  11694.  * @param {Vue} vm
  11695.  * @return {Object}
  11696.  */
  11697.  
  11698. function extractState (vm) {
  11699.   return {
  11700.     cid: vm.constructor.cid,
  11701.     data: vm.$data,
  11702.     children: vm.$children.map(extractState)
  11703.   }
  11704. }
  11705.  
  11706. /**
  11707.  * Restore state to a reloaded Vue instance.
  11708.  *
  11709.  * @param {Vue} vm
  11710.  * @param {Object} state
  11711.  */
  11712.  
  11713. function restoreState (vm, state, isRoot) {
  11714.   var oldAsyncConfig
  11715.   if (isRoot) {
  11716.     // set Vue into sync mode during state rehydration
  11717.     oldAsyncConfig = Vue.config.async
  11718.     Vue.config.async = false
  11719.   }
  11720.   // actual restore
  11721.   if (isRoot || !vm._props) {
  11722.     vm.$data = state.data
  11723.   } else {
  11724.     Object.keys(state.data).forEach(function (key) {
  11725.       if (!vm._props[key]) {
  11726.         // for non-root, only restore non-props fields
  11727.         vm.$data[key] = state.data[key]
  11728.       }
  11729.     })
  11730.   }
  11731.   // verify child consistency
  11732.   var hasSameChildren = vm.$children.every(function (c, i) {
  11733.     return state.children[i] && state.children[i].cid === c.constructor.cid
  11734.   })
  11735.   if (hasSameChildren) {
  11736.     // rehydrate children
  11737.     vm.$children.forEach(function (c, i) {
  11738.       restoreState(c, state.children[i])
  11739.     })
  11740.   }
  11741.   if (isRoot) {
  11742.     Vue.config.async = oldAsyncConfig
  11743.   }
  11744. }
  11745.  
  11746. function format (id) {
  11747.   var match = id.match(/[^\/]+\.vue$/)
  11748.   return match ? match[0] : id
  11749. }
  11750.  
  11751. },{}],26:[function(require,module,exports){
  11752. 'use strict';
  11753.  
  11754. var Vue = require('vue');
  11755.  
  11756. var axios = require('axios');
  11757.  
  11758. var app = new Vue({
  11759.     el: '#app',
  11760.     data: {
  11761.         tasks: []
  11762.     },
  11763.  
  11764.     components: {
  11765.         'countdown': require('./vue/countdown.vue'),
  11766.         'task-list': require('./vue/task-list.vue')
  11767.     },
  11768.  
  11769.     created: function created() {
  11770.         var url = laroute.route('task.index', []);
  11771.         var self = this;
  11772.  
  11773.         axios.get(url).then(function (response) {
  11774.             self.tasks = response.data;
  11775.         });
  11776.  
  11777.         this.$on('task:start', function (task) {
  11778.             this.$broadcast('countdown:start', task);
  11779.         });
  11780.  
  11781.         this.$on('task:delete', function (task) {
  11782.             var self = this;
  11783.             axios.delete(laroute.route('task.delete', { task: task.id })).then(function () {
  11784.                 self.tasks.$remove(task);
  11785.             });
  11786.         });
  11787.     }
  11788. });
  11789.  
  11790. },{"./vue/countdown.vue":29,"./vue/task-list.vue":30,"axios":1,"vue":24}],27:[function(require,module,exports){
  11791. "use strict";
  11792.  
  11793. var axios = require('axios');
  11794.  
  11795. var Resource = function Resource(routeParamMatcher) {
  11796.     var route_to_url = function route_to_url(name, params, paramMatcher) {
  11797.         paramMatcher = paramMatcher || function () {};
  11798.  
  11799.         var url = laroute.route(name);
  11800.         if (!url) {
  11801.             throw new Error("Route " + name + " not defined");
  11802.         }
  11803.  
  11804.         url = url.replace(/\{(.*?)\??\}/g, paramMatcher);
  11805.         return url;
  11806.     };
  11807.  
  11808.     var request = function request(method, route, data) {
  11809.         data = data || {};
  11810.         var url = route_to_url(route, data, routeParamMatcher.bind(data));
  11811.         return axios.request({
  11812.             method: method,
  11813.             url: url,
  11814.             data: data
  11815.         });
  11816.     };
  11817.     this.get = function (route, data) {
  11818.         return request('get', route, data);
  11819.     };
  11820.  
  11821.     this.post = function (route, data) {
  11822.         return request('post', route, data);
  11823.     };
  11824.  
  11825.     this.delete = function (route, data) {
  11826.         return request('delete', route, data);
  11827.     };
  11828.  
  11829.     this.put = function (route, data) {
  11830.         return request('put', route, data);
  11831.     };
  11832.  
  11833.     this.patch = function (route, data) {
  11834.         return request('patch', route, data);
  11835.     };
  11836.  
  11837.     this.update = function (route, data) {
  11838.         return request('patch', route, data);
  11839.     };
  11840. };
  11841.  
  11842. module.exports = Resource;
  11843.  
  11844. },{"axios":1}],28:[function(require,module,exports){
  11845. 'use strict';
  11846.  
  11847. var Resource = require('./resource.js');
  11848.  
  11849. var resource = new Resource(function (a, key) {
  11850.     if (key === 'task') {
  11851.         return this.id;
  11852.     }
  11853. });
  11854.  
  11855. module.exports = {
  11856.     get: function get() {
  11857.         return resource.get('task.index');
  11858.     },
  11859.     update: function update(task) {
  11860.         return resource.update('task.update', task);
  11861.     },
  11862.     delete: function _delete(task) {
  11863.         return resource.delete('task.delete', task);
  11864.     }
  11865. };
  11866.  
  11867. },{"./resource.js":27}],29:[function(require,module,exports){
  11868. 'use strict';
  11869.  
  11870. // @todo: move to some config loaded from server
  11871. var default_time = 60 * 25 * 1000;
  11872.  
  11873. /**
  11874.  * add leading zero to a number
  11875.  * @param  {int} n
  11876.  * @return {string}
  11877.  */
  11878. var leading_zero = function leading_zero(number, num_zeros) {
  11879.     var s = number.toString();
  11880.     while (s.length < num_zeros) {
  11881.         s = "0" + s;
  11882.     }
  11883.     return s;
  11884. };
  11885.  
  11886. module.exports = {
  11887.     data: function data() {
  11888.         return {
  11889.             countdown_time: default_time,
  11890.             time: 0,
  11891.             started_at: null,
  11892.             task: null,
  11893.             interval_handle: null
  11894.         };
  11895.     },
  11896.  
  11897.     computed: {
  11898.         time_minutes: function time_minutes() {
  11899.             var minutes = this.time / 1000 / 60 | 0;
  11900.             return leading_zero(minutes, 2);
  11901.         },
  11902.         time_seconds: function time_seconds() {
  11903.             var seconds = this.time % (60 * 1000) / 1000 | 0;
  11904.             return leading_zero(seconds, 2);
  11905.         }
  11906.     },
  11907.  
  11908.     methods: {
  11909.         start: function start() {
  11910.             this.stop();
  11911.             this.started_at = Date.now();
  11912.             this.interval_handle = setInterval(this.update.bind(this), 1000);
  11913.         },
  11914.         update: function update() {
  11915.             this.time = this.countdown_time - (Date.now() - this.started_at);
  11916.  
  11917.             if (this.time <= 0) {
  11918.                 this.time = 0;
  11919.                 this.$dispatch('countdown:finished', this.task);
  11920.             }
  11921.         },
  11922.         stop: function stop() {
  11923.             clearInterval(this.interval_handle);
  11924.             this.time = 0;
  11925.         }
  11926.     },
  11927.  
  11928.     events: {
  11929.         'countdown:start': function countdownStart(task) {
  11930.             this.start();
  11931.             this.task = task;
  11932.             this.time = default_time;
  11933.         }
  11934.     }
  11935. };
  11936. if (module.exports.__esModule) module.exports = module.exports.default
  11937. ;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n<div class=\"countdown\">\n    <div class=\"countdown__inner\">\n        {{ time_minutes }}:{{time_seconds}}\n    </div>\n</div>\n"
  11938. if (module.hot) {(function () {  module.hot.accept()
  11939.   var hotAPI = require("/home/brzez/workspace/tracker/code/node_modules/vueify/node_modules/vue-hot-reload-api/index.js")
  11940.   hotAPI.install(require("vue"), true)
  11941.   if (!hotAPI.compatible) return
  11942.   var id = "/home/brzez/workspace/tracker/code/resources/assets/js/vue/countdown.vue"
  11943.   if (!module.hot.data) {
  11944.     hotAPI.createRecord(id, module.exports)
  11945.   } else {
  11946.     hotAPI.update(id, module.exports, (typeof module.exports === "function" ? module.exports.options : module.exports).template)
  11947.   }
  11948. })()}
  11949. },{"/home/brzez/workspace/tracker/code/node_modules/vueify/node_modules/vue-hot-reload-api/index.js":25,"vue":24}],30:[function(require,module,exports){
  11950. 'use strict';
  11951.  
  11952. module.exports = {
  11953.     props: ['tasks'],
  11954.     components: {
  11955.         'task': require('./task.vue')
  11956.     }
  11957. };
  11958. if (module.exports.__esModule) module.exports = module.exports.default
  11959. ;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n<div class=\"task__wrapper\">\n    <task v-for=\"task in tasks\" :task=\"task\">\n</task></div>\n"
  11960. if (module.hot) {(function () {  module.hot.accept()
  11961.   var hotAPI = require("/home/brzez/workspace/tracker/code/node_modules/vueify/node_modules/vue-hot-reload-api/index.js")
  11962.   hotAPI.install(require("vue"), true)
  11963.   if (!hotAPI.compatible) return
  11964.   var id = "/home/brzez/workspace/tracker/code/resources/assets/js/vue/task-list.vue"
  11965.   if (!module.hot.data) {
  11966.     hotAPI.createRecord(id, module.exports)
  11967.   } else {
  11968.     hotAPI.update(id, module.exports, (typeof module.exports === "function" ? module.exports.options : module.exports).template)
  11969.   }
  11970. })()}
  11971. },{"./task.vue":31,"/home/brzez/workspace/tracker/code/node_modules/vueify/node_modules/vue-hot-reload-api/index.js":25,"vue":24}],31:[function(require,module,exports){
  11972. 'use strict';
  11973.  
  11974. var axios = require('axios');
  11975.  
  11976. var taskResource = require('../resource/task.js');
  11977.  
  11978. module.exports = {
  11979.     props: ['task'],
  11980.     data: function data() {
  11981.         return {
  11982.             edit_mode: false,
  11983.             loading: false
  11984.         };
  11985.     },
  11986.     methods: {
  11987.         start: function start(e) {
  11988.             e.preventDefault();
  11989.  
  11990.             this.$dispatch('task:start', this.task);
  11991.         },
  11992.         delete: function _delete(e) {
  11993.             e.preventDefault();
  11994.  
  11995.             this.$dispatch('task:delete', this.task);
  11996.         },
  11997.         update: function update(e) {
  11998.             e.preventDefault();
  11999.  
  12000.             this.edit_mode = false;
  12001.             this.loading = true;
  12002.  
  12003.             taskResource.update(this.task).then(function (response) {
  12004.                 this.task = response.data;
  12005.                 this.loading = false;
  12006.             }.bind(this));
  12007.         },
  12008.  
  12009.         edit: function edit(e) {
  12010.             e.preventDefault();
  12011.  
  12012.             this.edit_mode = true;
  12013.             var self = this;
  12014.             setTimeout(function () {
  12015.                 self.$els.nameEdit.focus();
  12016.             }, 0);
  12017.         }
  12018.     }
  12019. };
  12020. if (module.exports.__esModule) module.exports = module.exports.default
  12021. ;(typeof module.exports === "function"? module.exports.options: module.exports).template = "\n<div class=\"task\">\n    <div class=\"task__spinner\">\n        <i class=\"fa fa-spin fa-cog\" v-if=\"loading\"></i>\n    </div>\n    <div class=\"task__col\">\n        <input v-el:name-edit=\"\" class=\"task__name_input\" v-show=\"edit_mode\" type=\"text\" v-model=\"task.name\" @keyup.enter=\"update\" @onblur=\"update\">\n        <span @click=\"edit\">{{task.name}}</span>\n    </div>\n    <div class=\"task__col\">\n        <i class=\"fa fa-certificate\" style=\"color: #c4472b\"></i>\n        <i class=\"fa fa-times\"></i>\n        {{task.num_intervals}}\n    </div>\n    <div class=\"task__col\">\n        <a href=\"#\" @click=\"start\"><i class=\"fa fa-play\"></i></a>\n        <a href=\"#\" @click=\"delete\"><i class=\"fa fa-times\"></i></a>\n    </div>\n</div>\n"
  12022. if (module.hot) {(function () {  module.hot.accept()
  12023.   var hotAPI = require("/home/brzez/workspace/tracker/code/node_modules/vueify/node_modules/vue-hot-reload-api/index.js")
  12024.   hotAPI.install(require("vue"), true)
  12025.   if (!hotAPI.compatible) return
  12026.   var id = "/home/brzez/workspace/tracker/code/resources/assets/js/vue/task.vue"
  12027.   if (!module.hot.data) {
  12028.     hotAPI.createRecord(id, module.exports)
  12029.   } else {
  12030.     hotAPI.update(id, module.exports, (typeof module.exports === "function" ? module.exports.options : module.exports).template)
  12031.   }
  12032. })()}
  12033. },{"../resource/task.js":28,"/home/brzez/workspace/tracker/code/node_modules/vueify/node_modules/vue-hot-reload-api/index.js":25,"axios":1,"vue":24}]},{},[26]);
  12034.  
  12035. //# sourceMappingURL=index.js.map
Add Comment
Please, Sign In to add comment