vue-for-window.js

解决 vue 在不同模块化应用下使用方式问题,均暴露到 windows 中

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.gf.qytechs.cn/scripts/427043/934576/vue-for-windowjs.js

  1. /*!
  2. * Vue.js v2.6.10
  3. * (c) 2014-2019 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function(global, factory) {
  7. global = global || self;
  8. global.Vue = factory()
  9. }(this, function() {
  10. 'use strict';
  11. /* */
  12.  
  13. var emptyObject = Object.freeze({});
  14.  
  15. // These helpers produce better VM code in JS engines due to their
  16. // explicitness and function inlining.
  17. function isUndef (v) {
  18. return v === undefined || v === null
  19. }
  20.  
  21. function isDef (v) {
  22. return v !== undefined && v !== null
  23. }
  24.  
  25. function isTrue (v) {
  26. return v === true
  27. }
  28.  
  29. function isFalse (v) {
  30. return v === false
  31. }
  32.  
  33. /**
  34. * Check if value is primitive.
  35. */
  36. function isPrimitive (value) {
  37. return (
  38. typeof value === 'string' ||
  39. typeof value === 'number' ||
  40. // $flow-disable-line
  41. typeof value === 'symbol' ||
  42. typeof value === 'boolean'
  43. )
  44. }
  45.  
  46. /**
  47. * Quick object check - this is primarily used to tell
  48. * Objects from primitive values when we know the value
  49. * is a JSON-compliant type.
  50. */
  51. function isObject (obj) {
  52. return obj !== null && typeof obj === 'object'
  53. }
  54.  
  55. /**
  56. * Get the raw type string of a value, e.g., [object Object].
  57. */
  58. var _toString = Object.prototype.toString;
  59.  
  60. function toRawType (value) {
  61. return _toString.call(value).slice(8, -1)
  62. }
  63.  
  64. /**
  65. * Strict object type check. Only returns true
  66. * for plain JavaScript objects.
  67. */
  68. function isPlainObject (obj) {
  69. return _toString.call(obj) === '[object Object]'
  70. }
  71.  
  72. function isRegExp (v) {
  73. return _toString.call(v) === '[object RegExp]'
  74. }
  75.  
  76. /**
  77. * Check if val is a valid array index.
  78. */
  79. function isValidArrayIndex (val) {
  80. var n = parseFloat(String(val));
  81. return n >= 0 && Math.floor(n) === n && isFinite(val)
  82. }
  83.  
  84. function isPromise (val) {
  85. return (
  86. isDef(val) &&
  87. typeof val.then === 'function' &&
  88. typeof val.catch === 'function'
  89. )
  90. }
  91.  
  92. /**
  93. * Convert a value to a string that is actually rendered.
  94. */
  95. function toString (val) {
  96. return val == null
  97. ? ''
  98. : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
  99. ? JSON.stringify(val, null, 2)
  100. : String(val)
  101. }
  102.  
  103. /**
  104. * Convert an input value to a number for persistence.
  105. * If the conversion fails, return original string.
  106. */
  107. function toNumber (val) {
  108. var n = parseFloat(val);
  109. return isNaN(n) ? val : n
  110. }
  111.  
  112. /**
  113. * Make a map and return a function for checking if a key
  114. * is in that map.
  115. */
  116. function makeMap (
  117. str,
  118. expectsLowerCase
  119. ) {
  120. var map = Object.create(null);
  121. var list = str.split(',');
  122. for (var i = 0; i < list.length; i++) {
  123. map[list[i]] = true;
  124. }
  125. return expectsLowerCase
  126. ? function (val) { return map[val.toLowerCase()]; }
  127. : function (val) { return map[val]; }
  128. }
  129.  
  130. /**
  131. * Check if a tag is a built-in tag.
  132. */
  133. var isBuiltInTag = makeMap('slot,component', true);
  134.  
  135. /**
  136. * Check if an attribute is a reserved attribute.
  137. */
  138. var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is');
  139.  
  140. /**
  141. * Remove an item from an array.
  142. */
  143. function remove (arr, item) {
  144. if (arr.length) {
  145. var index = arr.indexOf(item);
  146. if (index > -1) {
  147. return arr.splice(index, 1)
  148. }
  149. }
  150. }
  151.  
  152. /**
  153. * Check whether an object has the property.
  154. */
  155. var hasOwnProperty = Object.prototype.hasOwnProperty;
  156. function hasOwn (obj, key) {
  157. return hasOwnProperty.call(obj, key)
  158. }
  159.  
  160. /**
  161. * Create a cached version of a pure function.
  162. */
  163. function cached (fn) {
  164. var cache = Object.create(null);
  165. return (function cachedFn (str) {
  166. var hit = cache[str];
  167. return hit || (cache[str] = fn(str))
  168. })
  169. }
  170.  
  171. /**
  172. * Camelize a hyphen-delimited string.
  173. */
  174. var camelizeRE = /-(\w)/g;
  175. var camelize = cached(function (str) {
  176. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  177. });
  178.  
  179. /**
  180. * Capitalize a string.
  181. */
  182. var capitalize = cached(function (str) {
  183. return str.charAt(0).toUpperCase() + str.slice(1)
  184. });
  185.  
  186. /**
  187. * Hyphenate a camelCase string.
  188. */
  189. var hyphenateRE = /\B([A-Z])/g;
  190. var hyphenate = cached(function (str) {
  191. return str.replace(hyphenateRE, '-$1').toLowerCase()
  192. });
  193.  
  194. /**
  195. * Simple bind polyfill for environments that do not support it,
  196. * e.g., PhantomJS 1.x. Technically, we don't need this anymore
  197. * since native bind is now performant enough in most browsers.
  198. * But removing it would mean breaking code that was able to run in
  199. * PhantomJS 1.x, so this must be kept for backward compatibility.
  200. */
  201.  
  202. /* istanbul ignore next */
  203. function polyfillBind (fn, ctx) {
  204. function boundFn (a) {
  205. var l = arguments.length;
  206. return l
  207. ? l > 1
  208. ? fn.apply(ctx, arguments)
  209. : fn.call(ctx, a)
  210. : fn.call(ctx)
  211. }
  212.  
  213. boundFn._length = fn.length;
  214. return boundFn
  215. }
  216.  
  217. function nativeBind (fn, ctx) {
  218. return fn.bind(ctx)
  219. }
  220.  
  221. var bind = Function.prototype.bind
  222. ? nativeBind
  223. : polyfillBind;
  224.  
  225. /**
  226. * Convert an Array-like object to a real Array.
  227. */
  228. function toArray (list, start) {
  229. start = start || 0;
  230. var i = list.length - start;
  231. var ret = new Array(i);
  232. while (i--) {
  233. ret[i] = list[i + start];
  234. }
  235. return ret
  236. }
  237.  
  238. /**
  239. * Mix properties into target object.
  240. */
  241. function extend (to, _from) {
  242. for (var key in _from) {
  243. to[key] = _from[key];
  244. }
  245. return to
  246. }
  247.  
  248. /**
  249. * Merge an Array of Objects into a single Object.
  250. */
  251. function toObject (arr) {
  252. var res = {};
  253. for (var i = 0; i < arr.length; i++) {
  254. if (arr[i]) {
  255. extend(res, arr[i]);
  256. }
  257. }
  258. return res
  259. }
  260.  
  261. /* eslint-disable no-unused-vars */
  262.  
  263. /**
  264. * Perform no operation.
  265. * Stubbing args to make Flow happy without leaving useless transpiled code
  266. * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/).
  267. */
  268. function noop (a, b, c) {}
  269.  
  270. /**
  271. * Always return false.
  272. */
  273. var no = function (a, b, c) { return false; };
  274.  
  275. /* eslint-enable no-unused-vars */
  276.  
  277. /**
  278. * Return the same value.
  279. */
  280. var identity = function (_) { return _; };
  281.  
  282. /**
  283. * Generate a string containing static keys from compiler modules.
  284. */
  285. function genStaticKeys (modules) {
  286. return modules.reduce(function (keys, m) {
  287. return keys.concat(m.staticKeys || [])
  288. }, []).join(',')
  289. }
  290.  
  291. /**
  292. * Check if two values are loosely equal - that is,
  293. * if they are plain objects, do they have the same shape?
  294. */
  295. function looseEqual (a, b) {
  296. if (a === b) { return true }
  297. var isObjectA = isObject(a);
  298. var isObjectB = isObject(b);
  299. if (isObjectA && isObjectB) {
  300. try {
  301. var isArrayA = Array.isArray(a);
  302. var isArrayB = Array.isArray(b);
  303. if (isArrayA && isArrayB) {
  304. return a.length === b.length && a.every(function (e, i) {
  305. return looseEqual(e, b[i])
  306. })
  307. } else if (a instanceof Date && b instanceof Date) {
  308. return a.getTime() === b.getTime()
  309. } else if (!isArrayA && !isArrayB) {
  310. var keysA = Object.keys(a);
  311. var keysB = Object.keys(b);
  312. return keysA.length === keysB.length && keysA.every(function (key) {
  313. return looseEqual(a[key], b[key])
  314. })
  315. } else {
  316. /* istanbul ignore next */
  317. return false
  318. }
  319. } catch (e) {
  320. /* istanbul ignore next */
  321. return false
  322. }
  323. } else if (!isObjectA && !isObjectB) {
  324. return String(a) === String(b)
  325. } else {
  326. return false
  327. }
  328. }
  329.  
  330. /**
  331. * Return the first index at which a loosely equal value can be
  332. * found in the array (if value is a plain object, the array must
  333. * contain an object of the same shape), or -1 if it is not present.
  334. */
  335. function looseIndexOf (arr, val) {
  336. for (var i = 0; i < arr.length; i++) {
  337. if (looseEqual(arr[i], val)) { return i }
  338. }
  339. return -1
  340. }
  341.  
  342. /**
  343. * Ensure a function is called only once.
  344. */
  345. function once (fn) {
  346. var called = false;
  347. return function () {
  348. if (!called) {
  349. called = true;
  350. fn.apply(this, arguments);
  351. }
  352. }
  353. }
  354.  
  355. var SSR_ATTR = 'data-server-rendered';
  356.  
  357. var ASSET_TYPES = [
  358. 'component',
  359. 'directive',
  360. 'filter'
  361. ];
  362.  
  363. var LIFECYCLE_HOOKS = [
  364. 'beforeCreate',
  365. 'created',
  366. 'beforeMount',
  367. 'mounted',
  368. 'beforeUpdate',
  369. 'updated',
  370. 'beforeDestroy',
  371. 'destroyed',
  372. 'activated',
  373. 'deactivated',
  374. 'errorCaptured',
  375. 'serverPrefetch'
  376. ];
  377.  
  378. /* */
  379.  
  380.  
  381.  
  382. var config = ({
  383. /**
  384. * Option merge strategies (used in core/util/options)
  385. */
  386. // $flow-disable-line
  387. optionMergeStrategies: Object.create(null),
  388.  
  389. /**
  390. * Whether to suppress warnings.
  391. */
  392. silent: false,
  393.  
  394. /**
  395. * Show production mode tip message on boot?
  396. */
  397. productionTip: "development" !== 'production',
  398.  
  399. /**
  400. * Whether to enable devtools
  401. */
  402. devtools: "development" !== 'production',
  403.  
  404. /**
  405. * Whether to record perf
  406. */
  407. performance: false,
  408.  
  409. /**
  410. * Error handler for watcher errors
  411. */
  412. errorHandler: null,
  413.  
  414. /**
  415. * Warn handler for watcher warns
  416. */
  417. warnHandler: null,
  418.  
  419. /**
  420. * Ignore certain custom elements
  421. */
  422. ignoredElements: [],
  423.  
  424. /**
  425. * Custom user key aliases for v-on
  426. */
  427. // $flow-disable-line
  428. keyCodes: Object.create(null),
  429.  
  430. /**
  431. * Check if a tag is reserved so that it cannot be registered as a
  432. * component. This is platform-dependent and may be overwritten.
  433. */
  434. isReservedTag: no,
  435.  
  436. /**
  437. * Check if an attribute is reserved so that it cannot be used as a component
  438. * prop. This is platform-dependent and may be overwritten.
  439. */
  440. isReservedAttr: no,
  441.  
  442. /**
  443. * Check if a tag is an unknown element.
  444. * Platform-dependent.
  445. */
  446. isUnknownElement: no,
  447.  
  448. /**
  449. * Get the namespace of an element
  450. */
  451. getTagNamespace: noop,
  452.  
  453. /**
  454. * Parse the real tag name for the specific platform.
  455. */
  456. parsePlatformTagName: identity,
  457.  
  458. /**
  459. * Check if an attribute must be bound using property, e.g. value
  460. * Platform-dependent.
  461. */
  462. mustUseProp: no,
  463.  
  464. /**
  465. * Perform updates asynchronously. Intended to be used by Vue Test Utils
  466. * This will significantly reduce performance if set to false.
  467. */
  468. async: true,
  469.  
  470. /**
  471. * Exposed for legacy reasons
  472. */
  473. _lifecycleHooks: LIFECYCLE_HOOKS
  474. });
  475.  
  476. /* */
  477.  
  478. /**
  479. * unicode letters used for parsing html tags, component names and property paths.
  480. * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
  481. * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
  482. */
  483. var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
  484.  
  485. /**
  486. * Check if a string starts with $ or _
  487. */
  488. function isReserved (str) {
  489. var c = (str + '').charCodeAt(0);
  490. return c === 0x24 || c === 0x5F
  491. }
  492.  
  493. /**
  494. * Define a property.
  495. */
  496. function def (obj, key, val, enumerable) {
  497. Object.defineProperty(obj, key, {
  498. value: val,
  499. enumerable: !!enumerable,
  500. writable: true,
  501. configurable: true
  502. });
  503. }
  504.  
  505. /**
  506. * Parse simple path.
  507. */
  508. var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
  509. function parsePath (path) {
  510. if (bailRE.test(path)) {
  511. return
  512. }
  513. var segments = path.split('.');
  514. return function (obj) {
  515. for (var i = 0; i < segments.length; i++) {
  516. if (!obj) { return }
  517. obj = obj[segments[i]];
  518. }
  519. return obj
  520. }
  521. }
  522.  
  523. /* */
  524.  
  525. // can we use __proto__?
  526. var hasProto = '__proto__' in {};
  527.  
  528. // Browser environment sniffing
  529. var inBrowser = typeof window !== 'undefined';
  530. var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform;
  531. var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase();
  532. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  533. var isIE = UA && /msie|trident/.test(UA);
  534. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  535. var isEdge = UA && UA.indexOf('edge/') > 0;
  536. var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android');
  537. var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios');
  538. var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
  539. var isPhantomJS = UA && /phantomjs/.test(UA);
  540. var isFF = UA && UA.match(/firefox\/(\d+)/);
  541.  
  542. // Firefox has a "watch" function on Object.prototype...
  543. var nativeWatch = ({}).watch;
  544.  
  545. var supportsPassive = false;
  546. if (inBrowser) {
  547. try {
  548. var opts = {};
  549. Object.defineProperty(opts, 'passive', ({
  550. get: function get () {
  551. /* istanbul ignore next */
  552. supportsPassive = true;
  553. }
  554. })); // https://github.com/facebook/flow/issues/285
  555. window.addEventListener('test-passive', null, opts);
  556. } catch (e) {}
  557. }
  558.  
  559. // this needs to be lazy-evaled because vue may be required before
  560. // vue-server-renderer can set VUE_ENV
  561. var _isServer;
  562. var isServerRendering = function () {
  563. if (_isServer === undefined) {
  564. /* istanbul ignore if */
  565. if (!inBrowser && !inWeex && typeof global !== 'undefined') {
  566. // detect presence of vue-server-renderer and avoid
  567. // Webpack shimming the process
  568. _isServer = global['process'] && global['process'].env.VUE_ENV === 'server';
  569. } else {
  570. _isServer = false;
  571. }
  572. }
  573. return _isServer
  574. };
  575.  
  576. // detect devtools
  577. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  578.  
  579. /* istanbul ignore next */
  580. function isNative (Ctor) {
  581. return typeof Ctor === 'function' && /native code/.test(Ctor.toString())
  582. }
  583.  
  584. var hasSymbol =
  585. typeof Symbol !== 'undefined' && isNative(Symbol) &&
  586. typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
  587.  
  588. var _Set;
  589. /* istanbul ignore if */ // $flow-disable-line
  590. if (typeof Set !== 'undefined' && isNative(Set)) {
  591. // use native Set when available.
  592. _Set = Set;
  593. } else {
  594. // a non-standard Set polyfill that only works with primitive keys.
  595. _Set = /*@__PURE__*/(function () {
  596. function Set () {
  597. this.set = Object.create(null);
  598. }
  599. Set.prototype.has = function has (key) {
  600. return this.set[key] === true
  601. };
  602. Set.prototype.add = function add (key) {
  603. this.set[key] = true;
  604. };
  605. Set.prototype.clear = function clear () {
  606. this.set = Object.create(null);
  607. };
  608.  
  609. return Set;
  610. }());
  611. }
  612.  
  613. /* */
  614.  
  615. var warn = noop;
  616. var tip = noop;
  617. var generateComponentTrace = (noop); // work around flow check
  618. var formatComponentName = (noop);
  619.  
  620. {
  621. var hasConsole = typeof console !== 'undefined';
  622. var classifyRE = /(?:^|[-_])(\w)/g;
  623. var classify = function (str) { return str
  624. .replace(classifyRE, function (c) { return c.toUpperCase(); })
  625. .replace(/[-_]/g, ''); };
  626.  
  627. warn = function (msg, vm) {
  628. var trace = vm ? generateComponentTrace(vm) : '';
  629.  
  630. if (config.warnHandler) {
  631. config.warnHandler.call(null, msg, vm, trace);
  632. } else if (hasConsole && (!config.silent)) {
  633. console.error(("[Vue warn]: " + msg + trace));
  634. }
  635. };
  636.  
  637. tip = function (msg, vm) {
  638. if (hasConsole && (!config.silent)) {
  639. console.warn("[Vue tip]: " + msg + (
  640. vm ? generateComponentTrace(vm) : ''
  641. ));
  642. }
  643. };
  644.  
  645. formatComponentName = function (vm, includeFile) {
  646. if (vm.$root === vm) {
  647. return '<Root>'
  648. }
  649. var options = typeof vm === 'function' && vm.cid != null
  650. ? vm.options
  651. : vm._isVue
  652. ? vm.$options || vm.constructor.options
  653. : vm;
  654. var name = options.name || options._componentTag;
  655. var file = options.__file;
  656. if (!name && file) {
  657. var match = file.match(/([^/\\]+)\.vue$/);
  658. name = match && match[1];
  659. }
  660.  
  661. return (
  662. (name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
  663. (file && includeFile !== false ? (" at " + file) : '')
  664. )
  665. };
  666.  
  667. var repeat = function (str, n) {
  668. var res = '';
  669. while (n) {
  670. if (n % 2 === 1) { res += str; }
  671. if (n > 1) { str += str; }
  672. n >>= 1;
  673. }
  674. return res
  675. };
  676.  
  677. generateComponentTrace = function (vm) {
  678. if (vm._isVue && vm.$parent) {
  679. var tree = [];
  680. var currentRecursiveSequence = 0;
  681. while (vm) {
  682. if (tree.length > 0) {
  683. var last = tree[tree.length - 1];
  684. if (last.constructor === vm.constructor) {
  685. currentRecursiveSequence++;
  686. vm = vm.$parent;
  687. continue
  688. } else if (currentRecursiveSequence > 0) {
  689. tree[tree.length - 1] = [last, currentRecursiveSequence];
  690. currentRecursiveSequence = 0;
  691. }
  692. }
  693. tree.push(vm);
  694. vm = vm.$parent;
  695. }
  696. return '\n\nfound in\n\n' + tree
  697. .map(function (vm, i) { return ("" + (i === 0 ? '---> ' : repeat(' ', 5 + i * 2)) + (Array.isArray(vm)
  698. ? ((formatComponentName(vm[0])) + "... (" + (vm[1]) + " recursive calls)")
  699. : formatComponentName(vm))); })
  700. .join('\n')
  701. } else {
  702. return ("\n\n(found in " + (formatComponentName(vm)) + ")")
  703. }
  704. };
  705. }
  706.  
  707. /* */
  708.  
  709. var uid = 0;
  710.  
  711. /**
  712. * A dep is an observable that can have multiple
  713. * directives subscribing to it.
  714. */
  715. var Dep = function Dep () {
  716. this.id = uid++;
  717. this.subs = [];
  718. };
  719.  
  720. Dep.prototype.addSub = function addSub (sub) {
  721. this.subs.push(sub);
  722. };
  723.  
  724. Dep.prototype.removeSub = function removeSub (sub) {
  725. remove(this.subs, sub);
  726. };
  727.  
  728. Dep.prototype.depend = function depend () {
  729. if (Dep.target) {
  730. Dep.target.addDep(this);
  731. }
  732. };
  733.  
  734. Dep.prototype.notify = function notify () {
  735. // stabilize the subscriber list first
  736. var subs = this.subs.slice();
  737. if (!config.async) {
  738. // subs aren't sorted in scheduler if not running async
  739. // we need to sort them now to make sure they fire in correct
  740. // order
  741. subs.sort(function (a, b) { return a.id - b.id; });
  742. }
  743. for (var i = 0, l = subs.length; i < l; i++) {
  744. subs[i].update();
  745. }
  746. };
  747.  
  748. // The current target watcher being evaluated.
  749. // This is globally unique because only one watcher
  750. // can be evaluated at a time.
  751. Dep.target = null;
  752. var targetStack = [];
  753.  
  754. function pushTarget (target) {
  755. targetStack.push(target);
  756. Dep.target = target;
  757. }
  758.  
  759. function popTarget () {
  760. targetStack.pop();
  761. Dep.target = targetStack[targetStack.length - 1];
  762. }
  763.  
  764. /* */
  765.  
  766. var VNode = function VNode (
  767. tag,
  768. data,
  769. children,
  770. text,
  771. elm,
  772. context,
  773. componentOptions,
  774. asyncFactory
  775. ) {
  776. this.tag = tag;
  777. this.data = data;
  778. this.children = children;
  779. this.text = text;
  780. this.elm = elm;
  781. this.ns = undefined;
  782. this.context = context;
  783. this.fnContext = undefined;
  784. this.fnOptions = undefined;
  785. this.fnScopeId = undefined;
  786. this.key = data && data.key;
  787. this.componentOptions = componentOptions;
  788. this.componentInstance = undefined;
  789. this.parent = undefined;
  790. this.raw = false;
  791. this.isStatic = false;
  792. this.isRootInsert = true;
  793. this.isComment = false;
  794. this.isCloned = false;
  795. this.isOnce = false;
  796. this.asyncFactory = asyncFactory;
  797. this.asyncMeta = undefined;
  798. this.isAsyncPlaceholder = false;
  799. };
  800.  
  801. var prototypeAccessors = { child: { configurable: true } };
  802.  
  803. // DEPRECATED: alias for componentInstance for backwards compat.
  804. /* istanbul ignore next */
  805. prototypeAccessors.child.get = function () {
  806. return this.componentInstance
  807. };
  808.  
  809. Object.defineProperties( VNode.prototype, prototypeAccessors );
  810.  
  811. var createEmptyVNode = function (text) {
  812. if ( text === void 0 ) text = '';
  813.  
  814. var node = new VNode();
  815. node.text = text;
  816. node.isComment = true;
  817. return node
  818. };
  819.  
  820. function createTextVNode (val) {
  821. return new VNode(undefined, undefined, undefined, String(val))
  822. }
  823.  
  824. // optimized shallow clone
  825. // used for static nodes and slot nodes because they may be reused across
  826. // multiple renders, cloning them avoids errors when DOM manipulations rely
  827. // on their elm reference.
  828. function cloneVNode (vnode) {
  829. var cloned = new VNode(
  830. vnode.tag,
  831. vnode.data,
  832. // #7975
  833. // clone children array to avoid mutating original in case of cloning
  834. // a child.
  835. vnode.children && vnode.children.slice(),
  836. vnode.text,
  837. vnode.elm,
  838. vnode.context,
  839. vnode.componentOptions,
  840. vnode.asyncFactory
  841. );
  842. cloned.ns = vnode.ns;
  843. cloned.isStatic = vnode.isStatic;
  844. cloned.key = vnode.key;
  845. cloned.isComment = vnode.isComment;
  846. cloned.fnContext = vnode.fnContext;
  847. cloned.fnOptions = vnode.fnOptions;
  848. cloned.fnScopeId = vnode.fnScopeId;
  849. cloned.asyncMeta = vnode.asyncMeta;
  850. cloned.isCloned = true;
  851. return cloned
  852. }
  853.  
  854. /*
  855. * not type checking this file because flow doesn't play well with
  856. * dynamically accessing methods on Array prototype
  857. */
  858.  
  859. var arrayProto = Array.prototype;
  860. var arrayMethods = Object.create(arrayProto);
  861.  
  862. var methodsToPatch = [
  863. 'push',
  864. 'pop',
  865. 'shift',
  866. 'unshift',
  867. 'splice',
  868. 'sort',
  869. 'reverse'
  870. ];
  871.  
  872. /**
  873. * Intercept mutating methods and emit events
  874. */
  875. methodsToPatch.forEach(function (method) {
  876. // cache original method
  877. var original = arrayProto[method];
  878. def(arrayMethods, method, function mutator () {
  879. var args = [], len = arguments.length;
  880. while ( len-- ) args[ len ] = arguments[ len ];
  881.  
  882. var result = original.apply(this, args);
  883. var ob = this.__ob__;
  884. var inserted;
  885. switch (method) {
  886. case 'push':
  887. case 'unshift':
  888. inserted = args;
  889. break
  890. case 'splice':
  891. inserted = args.slice(2);
  892. break
  893. }
  894. if (inserted) { ob.observeArray(inserted); }
  895. // notify change
  896. ob.dep.notify();
  897. return result
  898. });
  899. });
  900.  
  901. /* */
  902.  
  903. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  904.  
  905. /**
  906. * In some cases we may want to disable observation inside a component's
  907. * update computation.
  908. */
  909. var shouldObserve = true;
  910.  
  911. function toggleObserving (value) {
  912. shouldObserve = value;
  913. }
  914.  
  915. /**
  916. * Observer class that is attached to each observed
  917. * object. Once attached, the observer converts the target
  918. * object's property keys into getter/setters that
  919. * collect dependencies and dispatch updates.
  920. */
  921. var Observer = function Observer (value) {
  922. this.value = value;
  923. this.dep = new Dep();
  924. this.vmCount = 0;
  925. def(value, '__ob__', this);
  926. if (Array.isArray(value)) {
  927. if (hasProto) {
  928. protoAugment(value, arrayMethods);
  929. } else {
  930. copyAugment(value, arrayMethods, arrayKeys);
  931. }
  932. this.observeArray(value);
  933. } else {
  934. this.walk(value);
  935. }
  936. };
  937.  
  938. /**
  939. * Walk through all properties and convert them into
  940. * getter/setters. This method should only be called when
  941. * value type is Object.
  942. */
  943. Observer.prototype.walk = function walk (obj) {
  944. var keys = Object.keys(obj);
  945. for (var i = 0; i < keys.length; i++) {
  946. defineReactive$$1(obj, keys[i]);
  947. }
  948. };
  949.  
  950. /**
  951. * Observe a list of Array items.
  952. */
  953. Observer.prototype.observeArray = function observeArray (items) {
  954. for (var i = 0, l = items.length; i < l; i++) {
  955. observe(items[i]);
  956. }
  957. };
  958.  
  959. // helpers
  960.  
  961. /**
  962. * Augment a target Object or Array by intercepting
  963. * the prototype chain using __proto__
  964. */
  965. function protoAugment (target, src) {
  966. /* eslint-disable no-proto */
  967. target.__proto__ = src;
  968. /* eslint-enable no-proto */
  969. }
  970.  
  971. /**
  972. * Augment a target Object or Array by defining
  973. * hidden properties.
  974. */
  975. /* istanbul ignore next */
  976. function copyAugment (target, src, keys) {
  977. for (var i = 0, l = keys.length; i < l; i++) {
  978. var key = keys[i];
  979. def(target, key, src[key]);
  980. }
  981. }
  982.  
  983. /**
  984. * Attempt to create an observer instance for a value,
  985. * returns the new observer if successfully observed,
  986. * or the existing observer if the value already has one.
  987. */
  988. function observe (value, asRootData) {
  989. if (!isObject(value) || value instanceof VNode) {
  990. return
  991. }
  992. var ob;
  993. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  994. ob = value.__ob__;
  995. } else if (
  996. shouldObserve &&
  997. !isServerRendering() &&
  998. (Array.isArray(value) || isPlainObject(value)) &&
  999. Object.isExtensible(value) &&
  1000. !value._isVue
  1001. ) {
  1002. ob = new Observer(value);
  1003. }
  1004. if (asRootData && ob) {
  1005. ob.vmCount++;
  1006. }
  1007. return ob
  1008. }
  1009.  
  1010. /**
  1011. * Define a reactive property on an Object.
  1012. */
  1013. function defineReactive$$1 (
  1014. obj,
  1015. key,
  1016. val,
  1017. customSetter,
  1018. shallow
  1019. ) {
  1020. var dep = new Dep();
  1021.  
  1022. var property = Object.getOwnPropertyDescriptor(obj, key);
  1023. if (property && property.configurable === false) {
  1024. return
  1025. }
  1026.  
  1027. // cater for pre-defined getter/setters
  1028. var getter = property && property.get;
  1029. var setter = property && property.set;
  1030. if ((!getter || setter) && arguments.length === 2) {
  1031. val = obj[key];
  1032. }
  1033.  
  1034. var childOb = !shallow && observe(val);
  1035. Object.defineProperty(obj, key, {
  1036. enumerable: true,
  1037. configurable: true,
  1038. get: function reactiveGetter () {
  1039. var value = getter ? getter.call(obj) : val;
  1040. if (Dep.target) {
  1041. dep.depend();
  1042. if (childOb) {
  1043. childOb.dep.depend();
  1044. if (Array.isArray(value)) {
  1045. dependArray(value);
  1046. }
  1047. }
  1048. }
  1049. return value
  1050. },
  1051. set: function reactiveSetter (newVal) {
  1052. var value = getter ? getter.call(obj) : val;
  1053. /* eslint-disable no-self-compare */
  1054. if (newVal === value || (newVal !== newVal && value !== value)) {
  1055. return
  1056. }
  1057. /* eslint-enable no-self-compare */
  1058. if (customSetter) {
  1059. customSetter();
  1060. }
  1061. // #7981: for accessor properties without setter
  1062. if (getter && !setter) { return }
  1063. if (setter) {
  1064. setter.call(obj, newVal);
  1065. } else {
  1066. val = newVal;
  1067. }
  1068. childOb = !shallow && observe(newVal);
  1069. dep.notify();
  1070. }
  1071. });
  1072. }
  1073.  
  1074. /**
  1075. * Set a property on an object. Adds the new property and
  1076. * triggers change notification if the property doesn't
  1077. * already exist.
  1078. */
  1079. function set (target, key, val) {
  1080. if (isUndef(target) || isPrimitive(target)
  1081. ) {
  1082. warn(("Cannot set reactive property on undefined, null, or primitive value: " + ((target))));
  1083. }
  1084. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1085. target.length = Math.max(target.length, key);
  1086. target.splice(key, 1, val);
  1087. return val
  1088. }
  1089. if (key in target && !(key in Object.prototype)) {
  1090. target[key] = val;
  1091. return val
  1092. }
  1093. var ob = (target).__ob__;
  1094. if (target._isVue || (ob && ob.vmCount)) {
  1095. warn(
  1096. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  1097. 'at runtime - declare it upfront in the data option.'
  1098. );
  1099. return val
  1100. }
  1101. if (!ob) {
  1102. target[key] = val;
  1103. return val
  1104. }
  1105. defineReactive$$1(ob.value, key, val);
  1106. ob.dep.notify();
  1107. return val
  1108. }
  1109.  
  1110. /**
  1111. * Delete a property and trigger change if necessary.
  1112. */
  1113. function del (target, key) {
  1114. if (isUndef(target) || isPrimitive(target)
  1115. ) {
  1116. warn(("Cannot delete reactive property on undefined, null, or primitive value: " + ((target))));
  1117. }
  1118. if (Array.isArray(target) && isValidArrayIndex(key)) {
  1119. target.splice(key, 1);
  1120. return
  1121. }
  1122. var ob = (target).__ob__;
  1123. if (target._isVue || (ob && ob.vmCount)) {
  1124. warn(
  1125. 'Avoid deleting properties on a Vue instance or its root $data ' +
  1126. '- just set it to null.'
  1127. );
  1128. return
  1129. }
  1130. if (!hasOwn(target, key)) {
  1131. return
  1132. }
  1133. delete target[key];
  1134. if (!ob) {
  1135. return
  1136. }
  1137. ob.dep.notify();
  1138. }
  1139.  
  1140. /**
  1141. * Collect dependencies on array elements when the array is touched, since
  1142. * we cannot intercept array element access like property getters.
  1143. */
  1144. function dependArray (value) {
  1145. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  1146. e = value[i];
  1147. e && e.__ob__ && e.__ob__.dep.depend();
  1148. if (Array.isArray(e)) {
  1149. dependArray(e);
  1150. }
  1151. }
  1152. }
  1153.  
  1154. /* */
  1155.  
  1156. /**
  1157. * Option overwriting strategies are functions that handle
  1158. * how to merge a parent option value and a child option
  1159. * value into the final value.
  1160. */
  1161. var strats = config.optionMergeStrategies;
  1162.  
  1163. /**
  1164. * Options with restrictions
  1165. */
  1166. {
  1167. strats.el = strats.propsData = function (parent, child, vm, key) {
  1168. if (!vm) {
  1169. warn(
  1170. "option \"" + key + "\" can only be used during instance " +
  1171. 'creation with the `new` keyword.'
  1172. );
  1173. }
  1174. return defaultStrat(parent, child)
  1175. };
  1176. }
  1177.  
  1178. /**
  1179. * Helper that recursively merges two data objects together.
  1180. */
  1181. function mergeData (to, from) {
  1182. if (!from) { return to }
  1183. var key, toVal, fromVal;
  1184.  
  1185. var keys = hasSymbol
  1186. ? Reflect.ownKeys(from)
  1187. : Object.keys(from);
  1188.  
  1189. for (var i = 0; i < keys.length; i++) {
  1190. key = keys[i];
  1191. // in case the object is already observed...
  1192. if (key === '__ob__') { continue }
  1193. toVal = to[key];
  1194. fromVal = from[key];
  1195. if (!hasOwn(to, key)) {
  1196. set(to, key, fromVal);
  1197. } else if (
  1198. toVal !== fromVal &&
  1199. isPlainObject(toVal) &&
  1200. isPlainObject(fromVal)
  1201. ) {
  1202. mergeData(toVal, fromVal);
  1203. }
  1204. }
  1205. return to
  1206. }
  1207.  
  1208. /**
  1209. * Data
  1210. */
  1211. function mergeDataOrFn (
  1212. parentVal,
  1213. childVal,
  1214. vm
  1215. ) {
  1216. if (!vm) {
  1217. // in a Vue.extend merge, both should be functions
  1218. if (!childVal) {
  1219. return parentVal
  1220. }
  1221. if (!parentVal) {
  1222. return childVal
  1223. }
  1224. // when parentVal & childVal are both present,
  1225. // we need to return a function that returns the
  1226. // merged result of both functions... no need to
  1227. // check if parentVal is a function here because
  1228. // it has to be a function to pass previous merges.
  1229. return function mergedDataFn () {
  1230. return mergeData(
  1231. typeof childVal === 'function' ? childVal.call(this, this) : childVal,
  1232. typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal
  1233. )
  1234. }
  1235. } else {
  1236. return function mergedInstanceDataFn () {
  1237. // instance merge
  1238. var instanceData = typeof childVal === 'function'
  1239. ? childVal.call(vm, vm)
  1240. : childVal;
  1241. var defaultData = typeof parentVal === 'function'
  1242. ? parentVal.call(vm, vm)
  1243. : parentVal;
  1244. if (instanceData) {
  1245. return mergeData(instanceData, defaultData)
  1246. } else {
  1247. return defaultData
  1248. }
  1249. }
  1250. }
  1251. }
  1252.  
  1253. strats.data = function (
  1254. parentVal,
  1255. childVal,
  1256. vm
  1257. ) {
  1258. if (!vm) {
  1259. if (childVal && typeof childVal !== 'function') {
  1260. warn(
  1261. 'The "data" option should be a function ' +
  1262. 'that returns a per-instance value in component ' +
  1263. 'definitions.',
  1264. vm
  1265. );
  1266.  
  1267. return parentVal
  1268. }
  1269. return mergeDataOrFn(parentVal, childVal)
  1270. }
  1271.  
  1272. return mergeDataOrFn(parentVal, childVal, vm)
  1273. };
  1274.  
  1275. /**
  1276. * Hooks and props are merged as arrays.
  1277. */
  1278. function mergeHook (
  1279. parentVal,
  1280. childVal
  1281. ) {
  1282. var res = childVal
  1283. ? parentVal
  1284. ? parentVal.concat(childVal)
  1285. : Array.isArray(childVal)
  1286. ? childVal
  1287. : [childVal]
  1288. : parentVal;
  1289. return res
  1290. ? dedupeHooks(res)
  1291. : res
  1292. }
  1293.  
  1294. function dedupeHooks (hooks) {
  1295. var res = [];
  1296. for (var i = 0; i < hooks.length; i++) {
  1297. if (res.indexOf(hooks[i]) === -1) {
  1298. res.push(hooks[i]);
  1299. }
  1300. }
  1301. return res
  1302. }
  1303.  
  1304. LIFECYCLE_HOOKS.forEach(function (hook) {
  1305. strats[hook] = mergeHook;
  1306. });
  1307.  
  1308. /**
  1309. * Assets
  1310. *
  1311. * When a vm is present (instance creation), we need to do
  1312. * a three-way merge between constructor options, instance
  1313. * options and parent options.
  1314. */
  1315. function mergeAssets (
  1316. parentVal,
  1317. childVal,
  1318. vm,
  1319. key
  1320. ) {
  1321. var res = Object.create(parentVal || null);
  1322. if (childVal) {
  1323. assertObjectType(key, childVal, vm);
  1324. return extend(res, childVal)
  1325. } else {
  1326. return res
  1327. }
  1328. }
  1329.  
  1330. ASSET_TYPES.forEach(function (type) {
  1331. strats[type + 's'] = mergeAssets;
  1332. });
  1333.  
  1334. /**
  1335. * Watchers.
  1336. *
  1337. * Watchers hashes should not overwrite one
  1338. * another, so we merge them as arrays.
  1339. */
  1340. strats.watch = function (
  1341. parentVal,
  1342. childVal,
  1343. vm,
  1344. key
  1345. ) {
  1346. // work around Firefox's Object.prototype.watch...
  1347. if (parentVal === nativeWatch) { parentVal = undefined; }
  1348. if (childVal === nativeWatch) { childVal = undefined; }
  1349. /* istanbul ignore if */
  1350. if (!childVal) { return Object.create(parentVal || null) }
  1351. {
  1352. assertObjectType(key, childVal, vm);
  1353. }
  1354. if (!parentVal) { return childVal }
  1355. var ret = {};
  1356. extend(ret, parentVal);
  1357. for (var key$1 in childVal) {
  1358. var parent = ret[key$1];
  1359. var child = childVal[key$1];
  1360. if (parent && !Array.isArray(parent)) {
  1361. parent = [parent];
  1362. }
  1363. ret[key$1] = parent
  1364. ? parent.concat(child)
  1365. : Array.isArray(child) ? child : [child];
  1366. }
  1367. return ret
  1368. };
  1369.  
  1370. /**
  1371. * Other object hashes.
  1372. */
  1373. strats.props =
  1374. strats.methods =
  1375. strats.inject =
  1376. strats.computed = function (
  1377. parentVal,
  1378. childVal,
  1379. vm,
  1380. key
  1381. ) {
  1382. if (childVal && "development" !== 'production') {
  1383. assertObjectType(key, childVal, vm);
  1384. }
  1385. if (!parentVal) { return childVal }
  1386. var ret = Object.create(null);
  1387. extend(ret, parentVal);
  1388. if (childVal) { extend(ret, childVal); }
  1389. return ret
  1390. };
  1391. strats.provide = mergeDataOrFn;
  1392.  
  1393. /**
  1394. * Default strategy.
  1395. */
  1396. var defaultStrat = function (parentVal, childVal) {
  1397. return childVal === undefined
  1398. ? parentVal
  1399. : childVal
  1400. };
  1401.  
  1402. /**
  1403. * Validate component names
  1404. */
  1405. function checkComponents (options) {
  1406. for (var key in options.components) {
  1407. validateComponentName(key);
  1408. }
  1409. }
  1410.  
  1411. function validateComponentName (name) {
  1412. if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
  1413. warn(
  1414. 'Invalid component name: "' + name + '". Component names ' +
  1415. 'should conform to valid custom element name in html5 specification.'
  1416. );
  1417. }
  1418. if (isBuiltInTag(name) || config.isReservedTag(name)) {
  1419. warn(
  1420. 'Do not use built-in or reserved HTML elements as component ' +
  1421. 'id: ' + name
  1422. );
  1423. }
  1424. }
  1425.  
  1426. /**
  1427. * Ensure all props option syntax are normalized into the
  1428. * Object-based format.
  1429. */
  1430. function normalizeProps (options, vm) {
  1431. var props = options.props;
  1432. if (!props) { return }
  1433. var res = {};
  1434. var i, val, name;
  1435. if (Array.isArray(props)) {
  1436. i = props.length;
  1437. while (i--) {
  1438. val = props[i];
  1439. if (typeof val === 'string') {
  1440. name = camelize(val);
  1441. res[name] = { type: null };
  1442. } else {
  1443. warn('props must be strings when using array syntax.');
  1444. }
  1445. }
  1446. } else if (isPlainObject(props)) {
  1447. for (var key in props) {
  1448. val = props[key];
  1449. name = camelize(key);
  1450. res[name] = isPlainObject(val)
  1451. ? val
  1452. : { type: val };
  1453. }
  1454. } else {
  1455. warn(
  1456. "Invalid value for option \"props\": expected an Array or an Object, " +
  1457. "but got " + (toRawType(props)) + ".",
  1458. vm
  1459. );
  1460. }
  1461. options.props = res;
  1462. }
  1463.  
  1464. /**
  1465. * Normalize all injections into Object-based format
  1466. */
  1467. function normalizeInject (options, vm) {
  1468. var inject = options.inject;
  1469. if (!inject) { return }
  1470. var normalized = options.inject = {};
  1471. if (Array.isArray(inject)) {
  1472. for (var i = 0; i < inject.length; i++) {
  1473. normalized[inject[i]] = { from: inject[i] };
  1474. }
  1475. } else if (isPlainObject(inject)) {
  1476. for (var key in inject) {
  1477. var val = inject[key];
  1478. normalized[key] = isPlainObject(val)
  1479. ? extend({ from: key }, val)
  1480. : { from: val };
  1481. }
  1482. } else {
  1483. warn(
  1484. "Invalid value for option \"inject\": expected an Array or an Object, " +
  1485. "but got " + (toRawType(inject)) + ".",
  1486. vm
  1487. );
  1488. }
  1489. }
  1490.  
  1491. /**
  1492. * Normalize raw function directives into object format.
  1493. */
  1494. function normalizeDirectives (options) {
  1495. var dirs = options.directives;
  1496. if (dirs) {
  1497. for (var key in dirs) {
  1498. var def$$1 = dirs[key];
  1499. if (typeof def$$1 === 'function') {
  1500. dirs[key] = { bind: def$$1, update: def$$1 };
  1501. }
  1502. }
  1503. }
  1504. }
  1505.  
  1506. function assertObjectType (name, value, vm) {
  1507. if (!isPlainObject(value)) {
  1508. warn(
  1509. "Invalid value for option \"" + name + "\": expected an Object, " +
  1510. "but got " + (toRawType(value)) + ".",
  1511. vm
  1512. );
  1513. }
  1514. }
  1515.  
  1516. /**
  1517. * Merge two option objects into a new one.
  1518. * Core utility used in both instantiation and inheritance.
  1519. */
  1520. function mergeOptions (
  1521. parent,
  1522. child,
  1523. vm
  1524. ) {
  1525. {
  1526. checkComponents(child);
  1527. }
  1528.  
  1529. if (typeof child === 'function') {
  1530. child = child.options;
  1531. }
  1532.  
  1533. normalizeProps(child, vm);
  1534. normalizeInject(child, vm);
  1535. normalizeDirectives(child);
  1536.  
  1537. // Apply extends and mixins on the child options,
  1538. // but only if it is a raw options object that isn't
  1539. // the result of another mergeOptions call.
  1540. // Only merged options has the _base property.
  1541. if (!child._base) {
  1542. if (child.extends) {
  1543. parent = mergeOptions(parent, child.extends, vm);
  1544. }
  1545. if (child.mixins) {
  1546. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1547. parent = mergeOptions(parent, child.mixins[i], vm);
  1548. }
  1549. }
  1550. }
  1551.  
  1552. var options = {};
  1553. var key;
  1554. for (key in parent) {
  1555. mergeField(key);
  1556. }
  1557. for (key in child) {
  1558. if (!hasOwn(parent, key)) {
  1559. mergeField(key);
  1560. }
  1561. }
  1562. function mergeField (key) {
  1563. var strat = strats[key] || defaultStrat;
  1564. options[key] = strat(parent[key], child[key], vm, key);
  1565. }
  1566. return options
  1567. }
  1568.  
  1569. /**
  1570. * Resolve an asset.
  1571. * This function is used because child instances need access
  1572. * to assets defined in its ancestor chain.
  1573. */
  1574. function resolveAsset (
  1575. options,
  1576. type,
  1577. id,
  1578. warnMissing
  1579. ) {
  1580. /* istanbul ignore if */
  1581. if (typeof id !== 'string') {
  1582. return
  1583. }
  1584. var assets = options[type];
  1585. // check local registration variations first
  1586. if (hasOwn(assets, id)) { return assets[id] }
  1587. var camelizedId = camelize(id);
  1588. if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
  1589. var PascalCaseId = capitalize(camelizedId);
  1590. if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
  1591. // fallback to prototype chain
  1592. var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
  1593. if (warnMissing && !res) {
  1594. warn(
  1595. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1596. options
  1597. );
  1598. }
  1599. return res
  1600. }
  1601.  
  1602. /* */
  1603.  
  1604.  
  1605.  
  1606. function validateProp (
  1607. key,
  1608. propOptions,
  1609. propsData,
  1610. vm
  1611. ) {
  1612. var prop = propOptions[key];
  1613. var absent = !hasOwn(propsData, key);
  1614. var value = propsData[key];
  1615. // boolean casting
  1616. var booleanIndex = getTypeIndex(Boolean, prop.type);
  1617. if (booleanIndex > -1) {
  1618. if (absent && !hasOwn(prop, 'default')) {
  1619. value = false;
  1620. } else if (value === '' || value === hyphenate(key)) {
  1621. // only cast empty string / same name to boolean if
  1622. // boolean has higher priority
  1623. var stringIndex = getTypeIndex(String, prop.type);
  1624. if (stringIndex < 0 || booleanIndex < stringIndex) {
  1625. value = true;
  1626. }
  1627. }
  1628. }
  1629. // check default value
  1630. if (value === undefined) {
  1631. value = getPropDefaultValue(vm, prop, key);
  1632. // since the default value is a fresh copy,
  1633. // make sure to observe it.
  1634. var prevShouldObserve = shouldObserve;
  1635. toggleObserving(true);
  1636. observe(value);
  1637. toggleObserving(prevShouldObserve);
  1638. }
  1639. {
  1640. assertProp(prop, key, value, vm, absent);
  1641. }
  1642. return value
  1643. }
  1644.  
  1645. /**
  1646. * Get the default value of a prop.
  1647. */
  1648. function getPropDefaultValue (vm, prop, key) {
  1649. // no default, return undefined
  1650. if (!hasOwn(prop, 'default')) {
  1651. return undefined
  1652. }
  1653. var def = prop.default;
  1654. // warn against non-factory defaults for Object & Array
  1655. if (isObject(def)) {
  1656. warn(
  1657. 'Invalid default value for prop "' + key + '": ' +
  1658. 'Props with type Object/Array must use a factory function ' +
  1659. 'to return the default value.',
  1660. vm
  1661. );
  1662. }
  1663. // the raw prop value was also undefined from previous render,
  1664. // return previous default value to avoid unnecessary watcher trigger
  1665. if (vm && vm.$options.propsData &&
  1666. vm.$options.propsData[key] === undefined &&
  1667. vm._props[key] !== undefined
  1668. ) {
  1669. return vm._props[key]
  1670. }
  1671. // call factory function for non-Function types
  1672. // a value is Function if its prototype is function even across different execution context
  1673. return typeof def === 'function' && getType(prop.type) !== 'Function'
  1674. ? def.call(vm)
  1675. : def
  1676. }
  1677.  
  1678. /**
  1679. * Assert whether a prop is valid.
  1680. */
  1681. function assertProp (
  1682. prop,
  1683. name,
  1684. value,
  1685. vm,
  1686. absent
  1687. ) {
  1688. if (prop.required && absent) {
  1689. warn(
  1690. 'Missing required prop: "' + name + '"',
  1691. vm
  1692. );
  1693. return
  1694. }
  1695. if (value == null && !prop.required) {
  1696. return
  1697. }
  1698. var type = prop.type;
  1699. var valid = !type || type === true;
  1700. var expectedTypes = [];
  1701. if (type) {
  1702. if (!Array.isArray(type)) {
  1703. type = [type];
  1704. }
  1705. for (var i = 0; i < type.length && !valid; i++) {
  1706. var assertedType = assertType(value, type[i]);
  1707. expectedTypes.push(assertedType.expectedType || '');
  1708. valid = assertedType.valid;
  1709. }
  1710. }
  1711.  
  1712. if (!valid) {
  1713. warn(
  1714. getInvalidTypeMessage(name, value, expectedTypes),
  1715. vm
  1716. );
  1717. return
  1718. }
  1719. var validator = prop.validator;
  1720. if (validator) {
  1721. if (!validator(value)) {
  1722. warn(
  1723. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1724. vm
  1725. );
  1726. }
  1727. }
  1728. }
  1729.  
  1730. var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
  1731.  
  1732. function assertType (value, type) {
  1733. var valid;
  1734. var expectedType = getType(type);
  1735. if (simpleCheckRE.test(expectedType)) {
  1736. var t = typeof value;
  1737. valid = t === expectedType.toLowerCase();
  1738. // for primitive wrapper objects
  1739. if (!valid && t === 'object') {
  1740. valid = value instanceof type;
  1741. }
  1742. } else if (expectedType === 'Object') {
  1743. valid = isPlainObject(value);
  1744. } else if (expectedType === 'Array') {
  1745. valid = Array.isArray(value);
  1746. } else {
  1747. valid = value instanceof type;
  1748. }
  1749. return {
  1750. valid: valid,
  1751. expectedType: expectedType
  1752. }
  1753. }
  1754.  
  1755. /**
  1756. * Use function string name to check built-in types,
  1757. * because a simple equality check will fail when running
  1758. * across different vms / iframes.
  1759. */
  1760. function getType (fn) {
  1761. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1762. return match ? match[1] : ''
  1763. }
  1764.  
  1765. function isSameType (a, b) {
  1766. return getType(a) === getType(b)
  1767. }
  1768.  
  1769. function getTypeIndex (type, expectedTypes) {
  1770. if (!Array.isArray(expectedTypes)) {
  1771. return isSameType(expectedTypes, type) ? 0 : -1
  1772. }
  1773. for (var i = 0, len = expectedTypes.length; i < len; i++) {
  1774. if (isSameType(expectedTypes[i], type)) {
  1775. return i
  1776. }
  1777. }
  1778. return -1
  1779. }
  1780.  
  1781. function getInvalidTypeMessage (name, value, expectedTypes) {
  1782. var message = "Invalid prop: type check failed for prop \"" + name + "\"." +
  1783. " Expected " + (expectedTypes.map(capitalize).join(', '));
  1784. var expectedType = expectedTypes[0];
  1785. var receivedType = toRawType(value);
  1786. var expectedValue = styleValue(value, expectedType);
  1787. var receivedValue = styleValue(value, receivedType);
  1788. // check if we need to specify expected value
  1789. if (expectedTypes.length === 1 &&
  1790. isExplicable(expectedType) &&
  1791. !isBoolean(expectedType, receivedType)) {
  1792. message += " with value " + expectedValue;
  1793. }
  1794. message += ", got " + receivedType + " ";
  1795. // check if we need to specify received value
  1796. if (isExplicable(receivedType)) {
  1797. message += "with value " + receivedValue + ".";
  1798. }
  1799. return message
  1800. }
  1801.  
  1802. function styleValue (value, type) {
  1803. if (type === 'String') {
  1804. return ("\"" + value + "\"")
  1805. } else if (type === 'Number') {
  1806. return ("" + (Number(value)))
  1807. } else {
  1808. return ("" + value)
  1809. }
  1810. }
  1811.  
  1812. function isExplicable (value) {
  1813. var explicitTypes = ['string', 'number', 'boolean'];
  1814. return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
  1815. }
  1816.  
  1817. function isBoolean () {
  1818. var args = [], len = arguments.length;
  1819. while ( len-- ) args[ len ] = arguments[ len ];
  1820.  
  1821. return args.some(function (elem) { return elem.toLowerCase() === 'boolean'; })
  1822. }
  1823.  
  1824. /* */
  1825.  
  1826. function handleError (err, vm, info) {
  1827. // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
  1828. // See: https://github.com/vuejs/vuex/issues/1505
  1829. pushTarget();
  1830. try {
  1831. if (vm) {
  1832. var cur = vm;
  1833. while ((cur = cur.$parent)) {
  1834. var hooks = cur.$options.errorCaptured;
  1835. if (hooks) {
  1836. for (var i = 0; i < hooks.length; i++) {
  1837. try {
  1838. var capture = hooks[i].call(cur, err, vm, info) === false;
  1839. if (capture) { return }
  1840. } catch (e) {
  1841. globalHandleError(e, cur, 'errorCaptured hook');
  1842. }
  1843. }
  1844. }
  1845. }
  1846. }
  1847. globalHandleError(err, vm, info);
  1848. } finally {
  1849. popTarget();
  1850. }
  1851. }
  1852.  
  1853. function invokeWithErrorHandling (
  1854. handler,
  1855. context,
  1856. args,
  1857. vm,
  1858. info
  1859. ) {
  1860. var res;
  1861. try {
  1862. res = args ? handler.apply(context, args) : handler.call(context);
  1863. if (res && !res._isVue && isPromise(res) && !res._handled) {
  1864. res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
  1865. // issue #9511
  1866. // avoid catch triggering multiple times when nested calls
  1867. res._handled = true;
  1868. }
  1869. } catch (e) {
  1870. handleError(e, vm, info);
  1871. }
  1872. return res
  1873. }
  1874.  
  1875. function globalHandleError (err, vm, info) {
  1876. if (config.errorHandler) {
  1877. try {
  1878. return config.errorHandler.call(null, err, vm, info)
  1879. } catch (e) {
  1880. // if the user intentionally throws the original error in the handler,
  1881. // do not log it twice
  1882. if (e !== err) {
  1883. logError(e, null, 'config.errorHandler');
  1884. }
  1885. }
  1886. }
  1887. logError(err, vm, info);
  1888. }
  1889.  
  1890. function logError (err, vm, info) {
  1891. {
  1892. warn(("Error in " + info + ": \"" + (err.toString()) + "\""), vm);
  1893. }
  1894. /* istanbul ignore else */
  1895. if ((inBrowser || inWeex) && typeof console !== 'undefined') {
  1896. console.error(err);
  1897. } else {
  1898. throw err
  1899. }
  1900. }
  1901.  
  1902. /* */
  1903.  
  1904. var isUsingMicroTask = false;
  1905.  
  1906. var callbacks = [];
  1907. var pending = false;
  1908.  
  1909. function flushCallbacks () {
  1910. pending = false;
  1911. var copies = callbacks.slice(0);
  1912. callbacks.length = 0;
  1913. for (var i = 0; i < copies.length; i++) {
  1914. copies[i]();
  1915. }
  1916. }
  1917.  
  1918. // Here we have async deferring wrappers using microtasks.
  1919. // In 2.5 we used (macro) tasks (in combination with microtasks).
  1920. // However, it has subtle problems when state is changed right before repaint
  1921. // (e.g. #6813, out-in transitions).
  1922. // Also, using (macro) tasks in event handler would cause some weird behaviors
  1923. // that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109).
  1924. // So we now use microtasks everywhere, again.
  1925. // A major drawback of this tradeoff is that there are some scenarios
  1926. // where microtasks have too high a priority and fire in between supposedly
  1927. // sequential events (e.g. #4521, #6690, which have workarounds)
  1928. // or even between bubbling of the same event (#6566).
  1929. var timerFunc;
  1930.  
  1931. // The nextTick behavior leverages the microtask queue, which can be accessed
  1932. // via either native Promise.then or MutationObserver.
  1933. // MutationObserver has wider support, however it is seriously bugged in
  1934. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  1935. // completely stops working after triggering a few times... so, if native
  1936. // Promise is available, we will use it:
  1937. /* istanbul ignore next, $flow-disable-line */
  1938. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  1939. var p = Promise.resolve();
  1940. timerFunc = function () {
  1941. p.then(flushCallbacks);
  1942. // In problematic UIWebViews, Promise.then doesn't completely break, but
  1943. // it can get stuck in a weird state where callbacks are pushed into the
  1944. // microtask queue but the queue isn't being flushed, until the browser
  1945. // needs to do some other work, e.g. handle a timer. Therefore we can
  1946. // "force" the microtask queue to be flushed by adding an empty timer.
  1947. if (isIOS) { setTimeout(noop); }
  1948. };
  1949. isUsingMicroTask = true;
  1950. } else if (!isIE && typeof MutationObserver !== 'undefined' && (
  1951. isNative(MutationObserver) ||
  1952. // PhantomJS and iOS 7.x
  1953. MutationObserver.toString() === '[object MutationObserverConstructor]'
  1954. )) {
  1955. // Use MutationObserver where native Promise is not available,
  1956. // e.g. PhantomJS, iOS7, Android 4.4
  1957. // (#6466 MutationObserver is unreliable in IE11)
  1958. var counter = 1;
  1959. var observer = new MutationObserver(flushCallbacks);
  1960. var textNode = document.createTextNode(String(counter));
  1961. observer.observe(textNode, {
  1962. characterData: true
  1963. });
  1964. timerFunc = function () {
  1965. counter = (counter + 1) % 2;
  1966. textNode.data = String(counter);
  1967. };
  1968. isUsingMicroTask = true;
  1969. } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
  1970. // Fallback to setImmediate.
  1971. // Techinically it leverages the (macro) task queue,
  1972. // but it is still a better choice than setTimeout.
  1973. timerFunc = function () {
  1974. setImmediate(flushCallbacks);
  1975. };
  1976. } else {
  1977. // Fallback to setTimeout.
  1978. timerFunc = function () {
  1979. setTimeout(flushCallbacks, 0);
  1980. };
  1981. }
  1982.  
  1983. function nextTick (cb, ctx) {
  1984. var _resolve;
  1985. callbacks.push(function () {
  1986. if (cb) {
  1987. try {
  1988. cb.call(ctx);
  1989. } catch (e) {
  1990. handleError(e, ctx, 'nextTick');
  1991. }
  1992. } else if (_resolve) {
  1993. _resolve(ctx);
  1994. }
  1995. });
  1996. if (!pending) {
  1997. pending = true;
  1998. timerFunc();
  1999. }
  2000. // $flow-disable-line
  2001. if (!cb && typeof Promise !== 'undefined') {
  2002. return new Promise(function (resolve) {
  2003. _resolve = resolve;
  2004. })
  2005. }
  2006. }
  2007.  
  2008. /* */
  2009.  
  2010. var mark;
  2011. var measure;
  2012.  
  2013. {
  2014. var perf = inBrowser && window.performance;
  2015. /* istanbul ignore if */
  2016. if (
  2017. perf &&
  2018. perf.mark &&
  2019. perf.measure &&
  2020. perf.clearMarks &&
  2021. perf.clearMeasures
  2022. ) {
  2023. mark = function (tag) { return perf.mark(tag); };
  2024. measure = function (name, startTag, endTag) {
  2025. perf.measure(name, startTag, endTag);
  2026. perf.clearMarks(startTag);
  2027. perf.clearMarks(endTag);
  2028. // perf.clearMeasures(name)
  2029. };
  2030. }
  2031. }
  2032.  
  2033. /* not type checking this file because flow doesn't play well with Proxy */
  2034.  
  2035. var initProxy;
  2036.  
  2037. {
  2038. var allowedGlobals = makeMap(
  2039. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  2040. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  2041. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  2042. 'require' // for Webpack/Browserify
  2043. );
  2044.  
  2045. var warnNonPresent = function (target, key) {
  2046. warn(
  2047. "Property or method \"" + key + "\" is not defined on the instance but " +
  2048. 'referenced during render. Make sure that this property is reactive, ' +
  2049. 'either in the data option, or for class-based components, by ' +
  2050. 'initializing the property. ' +
  2051. 'See: https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.',
  2052. target
  2053. );
  2054. };
  2055.  
  2056. var warnReservedPrefix = function (target, key) {
  2057. warn(
  2058. "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
  2059. 'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
  2060. 'prevent conflicts with Vue internals' +
  2061. 'See: https://vuejs.org/v2/api/#data',
  2062. target
  2063. );
  2064. };
  2065.  
  2066. var hasProxy =
  2067. typeof Proxy !== 'undefined' && isNative(Proxy);
  2068.  
  2069. if (hasProxy) {
  2070. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact');
  2071. config.keyCodes = new Proxy(config.keyCodes, {
  2072. set: function set (target, key, value) {
  2073. if (isBuiltInModifier(key)) {
  2074. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  2075. return false
  2076. } else {
  2077. target[key] = value;
  2078. return true
  2079. }
  2080. }
  2081. });
  2082. }
  2083.  
  2084. var hasHandler = {
  2085. has: function has (target, key) {
  2086. var has = key in target;
  2087. var isAllowed = allowedGlobals(key) ||
  2088. (typeof key === 'string' && key.charAt(0) === '_' && !(key in target.$data));
  2089. if (!has && !isAllowed) {
  2090. if (key in target.$data) { warnReservedPrefix(target, key); }
  2091. else { warnNonPresent(target, key); }
  2092. }
  2093. return has || !isAllowed
  2094. }
  2095. };
  2096.  
  2097. var getHandler = {
  2098. get: function get (target, key) {
  2099. if (typeof key === 'string' && !(key in target)) {
  2100. if (key in target.$data) { warnReservedPrefix(target, key); }
  2101. else { warnNonPresent(target, key); }
  2102. }
  2103. return target[key]
  2104. }
  2105. };
  2106.  
  2107. initProxy = function initProxy (vm) {
  2108. if (hasProxy) {
  2109. // determine which proxy handler to use
  2110. var options = vm.$options;
  2111. var handlers = options.render && options.render._withStripped
  2112. ? getHandler
  2113. : hasHandler;
  2114. vm._renderProxy = new Proxy(vm, handlers);
  2115. } else {
  2116. vm._renderProxy = vm;
  2117. }
  2118. };
  2119. }
  2120.  
  2121. /* */
  2122.  
  2123. var seenObjects = new _Set();
  2124.  
  2125. /**
  2126. * Recursively traverse an object to evoke all converted
  2127. * getters, so that every nested property inside the object
  2128. * is collected as a "deep" dependency.
  2129. */
  2130. function traverse (val) {
  2131. _traverse(val, seenObjects);
  2132. seenObjects.clear();
  2133. }
  2134.  
  2135. function _traverse (val, seen) {
  2136. var i, keys;
  2137. var isA = Array.isArray(val);
  2138. if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) {
  2139. return
  2140. }
  2141. if (val.__ob__) {
  2142. var depId = val.__ob__.dep.id;
  2143. if (seen.has(depId)) {
  2144. return
  2145. }
  2146. seen.add(depId);
  2147. }
  2148. if (isA) {
  2149. i = val.length;
  2150. while (i--) { _traverse(val[i], seen); }
  2151. } else {
  2152. keys = Object.keys(val);
  2153. i = keys.length;
  2154. while (i--) { _traverse(val[keys[i]], seen); }
  2155. }
  2156. }
  2157.  
  2158. /* */
  2159.  
  2160. var normalizeEvent = cached(function (name) {
  2161. var passive = name.charAt(0) === '&';
  2162. name = passive ? name.slice(1) : name;
  2163. var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
  2164. name = once$$1 ? name.slice(1) : name;
  2165. var capture = name.charAt(0) === '!';
  2166. name = capture ? name.slice(1) : name;
  2167. return {
  2168. name: name,
  2169. once: once$$1,
  2170. capture: capture,
  2171. passive: passive
  2172. }
  2173. });
  2174.  
  2175. function createFnInvoker (fns, vm) {
  2176. function invoker () {
  2177. var arguments$1 = arguments;
  2178.  
  2179. var fns = invoker.fns;
  2180. if (Array.isArray(fns)) {
  2181. var cloned = fns.slice();
  2182. for (var i = 0; i < cloned.length; i++) {
  2183. invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler");
  2184. }
  2185. } else {
  2186. // return handler return value for single handlers
  2187. return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler")
  2188. }
  2189. }
  2190. invoker.fns = fns;
  2191. return invoker
  2192. }
  2193.  
  2194. function updateListeners (
  2195. on,
  2196. oldOn,
  2197. add,
  2198. remove$$1,
  2199. createOnceHandler,
  2200. vm
  2201. ) {
  2202. var name, def$$1, cur, old, event;
  2203. for (name in on) {
  2204. def$$1 = cur = on[name];
  2205. old = oldOn[name];
  2206. event = normalizeEvent(name);
  2207. if (isUndef(cur)) {
  2208. warn(
  2209. "Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
  2210. vm
  2211. );
  2212. } else if (isUndef(old)) {
  2213. if (isUndef(cur.fns)) {
  2214. cur = on[name] = createFnInvoker(cur, vm);
  2215. }
  2216. if (isTrue(event.once)) {
  2217. cur = on[name] = createOnceHandler(event.name, cur, event.capture);
  2218. }
  2219. add(event.name, cur, event.capture, event.passive, event.params);
  2220. } else if (cur !== old) {
  2221. old.fns = cur;
  2222. on[name] = old;
  2223. }
  2224. }
  2225. for (name in oldOn) {
  2226. if (isUndef(on[name])) {
  2227. event = normalizeEvent(name);
  2228. remove$$1(event.name, oldOn[name], event.capture);
  2229. }
  2230. }
  2231. }
  2232.  
  2233. /* */
  2234.  
  2235. function mergeVNodeHook (def, hookKey, hook) {
  2236. if (def instanceof VNode) {
  2237. def = def.data.hook || (def.data.hook = {});
  2238. }
  2239. var invoker;
  2240. var oldHook = def[hookKey];
  2241.  
  2242. function wrappedHook () {
  2243. hook.apply(this, arguments);
  2244. // important: remove merged hook to ensure it's called only once
  2245. // and prevent memory leak
  2246. remove(invoker.fns, wrappedHook);
  2247. }
  2248.  
  2249. if (isUndef(oldHook)) {
  2250. // no existing hook
  2251. invoker = createFnInvoker([wrappedHook]);
  2252. } else {
  2253. /* istanbul ignore if */
  2254. if (isDef(oldHook.fns) && isTrue(oldHook.merged)) {
  2255. // already a merged invoker
  2256. invoker = oldHook;
  2257. invoker.fns.push(wrappedHook);
  2258. } else {
  2259. // existing plain hook
  2260. invoker = createFnInvoker([oldHook, wrappedHook]);
  2261. }
  2262. }
  2263.  
  2264. invoker.merged = true;
  2265. def[hookKey] = invoker;
  2266. }
  2267.  
  2268. /* */
  2269.  
  2270. function extractPropsFromVNodeData (
  2271. data,
  2272. Ctor,
  2273. tag
  2274. ) {
  2275. // we are only extracting raw values here.
  2276. // validation and default values are handled in the child
  2277. // component itself.
  2278. var propOptions = Ctor.options.props;
  2279. if (isUndef(propOptions)) {
  2280. return
  2281. }
  2282. var res = {};
  2283. var attrs = data.attrs;
  2284. var props = data.props;
  2285. if (isDef(attrs) || isDef(props)) {
  2286. for (var key in propOptions) {
  2287. var altKey = hyphenate(key);
  2288. {
  2289. var keyInLowerCase = key.toLowerCase();
  2290. if (
  2291. key !== keyInLowerCase &&
  2292. attrs && hasOwn(attrs, keyInLowerCase)
  2293. ) {
  2294. tip(
  2295. "Prop \"" + keyInLowerCase + "\" is passed to component " +
  2296. (formatComponentName(tag || Ctor)) + ", but the declared prop name is" +
  2297. " \"" + key + "\". " +
  2298. "Note that HTML attributes are case-insensitive and camelCased " +
  2299. "props need to use their kebab-case equivalents when using in-DOM " +
  2300. "templates. You should probably use \"" + altKey + "\" instead of \"" + key + "\"."
  2301. );
  2302. }
  2303. }
  2304. checkProp(res, props, key, altKey, true) ||
  2305. checkProp(res, attrs, key, altKey, false);
  2306. }
  2307. }
  2308. return res
  2309. }
  2310.  
  2311. function checkProp (
  2312. res,
  2313. hash,
  2314. key,
  2315. altKey,
  2316. preserve
  2317. ) {
  2318. if (isDef(hash)) {
  2319. if (hasOwn(hash, key)) {
  2320. res[key] = hash[key];
  2321. if (!preserve) {
  2322. delete hash[key];
  2323. }
  2324. return true
  2325. } else if (hasOwn(hash, altKey)) {
  2326. res[key] = hash[altKey];
  2327. if (!preserve) {
  2328. delete hash[altKey];
  2329. }
  2330. return true
  2331. }
  2332. }
  2333. return false
  2334. }
  2335.  
  2336. /* */
  2337.  
  2338. // The template compiler attempts to minimize the need for normalization by
  2339. // statically analyzing the template at compile time.
  2340. //
  2341. // For plain HTML markup, normalization can be completely skipped because the
  2342. // generated render function is guaranteed to return Array<VNode>. There are
  2343. // two cases where extra normalization is needed:
  2344.  
  2345. // 1. When the children contains components - because a functional component
  2346. // may return an Array instead of a single root. In this case, just a simple
  2347. // normalization is needed - if any child is an Array, we flatten the whole
  2348. // thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
  2349. // because functional components already normalize their own children.
  2350. function simpleNormalizeChildren (children) {
  2351. for (var i = 0; i < children.length; i++) {
  2352. if (Array.isArray(children[i])) {
  2353. return Array.prototype.concat.apply([], children)
  2354. }
  2355. }
  2356. return children
  2357. }
  2358.  
  2359. // 2. When the children contains constructs that always generated nested Arrays,
  2360. // e.g. <template>, <slot>, v-for, or when the children is provided by user
  2361. // with hand-written render functions / JSX. In such cases a full normalization
  2362. // is needed to cater to all possible types of children values.
  2363. function normalizeChildren (children) {
  2364. return isPrimitive(children)
  2365. ? [createTextVNode(children)]
  2366. : Array.isArray(children)
  2367. ? normalizeArrayChildren(children)
  2368. : undefined
  2369. }
  2370.  
  2371. function isTextNode (node) {
  2372. return isDef(node) && isDef(node.text) && isFalse(node.isComment)
  2373. }
  2374.  
  2375. function normalizeArrayChildren (children, nestedIndex) {
  2376. var res = [];
  2377. var i, c, lastIndex, last;
  2378. for (i = 0; i < children.length; i++) {
  2379. c = children[i];
  2380. if (isUndef(c) || typeof c === 'boolean') { continue }
  2381. lastIndex = res.length - 1;
  2382. last = res[lastIndex];
  2383. // nested
  2384. if (Array.isArray(c)) {
  2385. if (c.length > 0) {
  2386. c = normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i));
  2387. // merge adjacent text nodes
  2388. if (isTextNode(c[0]) && isTextNode(last)) {
  2389. res[lastIndex] = createTextVNode(last.text + (c[0]).text);
  2390. c.shift();
  2391. }
  2392. res.push.apply(res, c);
  2393. }
  2394. } else if (isPrimitive(c)) {
  2395. if (isTextNode(last)) {
  2396. // merge adjacent text nodes
  2397. // this is necessary for SSR hydration because text nodes are
  2398. // essentially merged when rendered to HTML strings
  2399. res[lastIndex] = createTextVNode(last.text + c);
  2400. } else if (c !== '') {
  2401. // convert primitive to vnode
  2402. res.push(createTextVNode(c));
  2403. }
  2404. } else {
  2405. if (isTextNode(c) && isTextNode(last)) {
  2406. // merge adjacent text nodes
  2407. res[lastIndex] = createTextVNode(last.text + c.text);
  2408. } else {
  2409. // default key for nested array children (likely generated by v-for)
  2410. if (isTrue(children._isVList) &&
  2411. isDef(c.tag) &&
  2412. isUndef(c.key) &&
  2413. isDef(nestedIndex)) {
  2414. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2415. }
  2416. res.push(c);
  2417. }
  2418. }
  2419. }
  2420. return res
  2421. }
  2422.  
  2423. /* */
  2424.  
  2425. function initProvide (vm) {
  2426. var provide = vm.$options.provide;
  2427. if (provide) {
  2428. vm._provided = typeof provide === 'function'
  2429. ? provide.call(vm)
  2430. : provide;
  2431. }
  2432. }
  2433.  
  2434. function initInjections (vm) {
  2435. var result = resolveInject(vm.$options.inject, vm);
  2436. if (result) {
  2437. toggleObserving(false);
  2438. Object.keys(result).forEach(function (key) {
  2439. /* istanbul ignore else */
  2440. {
  2441. defineReactive$$1(vm, key, result[key], function () {
  2442. warn(
  2443. "Avoid mutating an injected value directly since the changes will be " +
  2444. "overwritten whenever the provided component re-renders. " +
  2445. "injection being mutated: \"" + key + "\"",
  2446. vm
  2447. );
  2448. });
  2449. }
  2450. });
  2451. toggleObserving(true);
  2452. }
  2453. }
  2454.  
  2455. function resolveInject (inject, vm) {
  2456. if (inject) {
  2457. // inject is :any because flow is not smart enough to figure out cached
  2458. var result = Object.create(null);
  2459. var keys = hasSymbol
  2460. ? Reflect.ownKeys(inject)
  2461. : Object.keys(inject);
  2462.  
  2463. for (var i = 0; i < keys.length; i++) {
  2464. var key = keys[i];
  2465. // #6574 in case the inject object is observed...
  2466. if (key === '__ob__') { continue }
  2467. var provideKey = inject[key].from;
  2468. var source = vm;
  2469. while (source) {
  2470. if (source._provided && hasOwn(source._provided, provideKey)) {
  2471. result[key] = source._provided[provideKey];
  2472. break
  2473. }
  2474. source = source.$parent;
  2475. }
  2476. if (!source) {
  2477. if ('default' in inject[key]) {
  2478. var provideDefault = inject[key].default;
  2479. result[key] = typeof provideDefault === 'function'
  2480. ? provideDefault.call(vm)
  2481. : provideDefault;
  2482. } else {
  2483. warn(("Injection \"" + key + "\" not found"), vm);
  2484. }
  2485. }
  2486. }
  2487. return result
  2488. }
  2489. }
  2490.  
  2491. /* */
  2492.  
  2493.  
  2494.  
  2495. /**
  2496. * Runtime helper for resolving raw children VNodes into a slot object.
  2497. */
  2498. function resolveSlots (
  2499. children,
  2500. context
  2501. ) {
  2502. if (!children || !children.length) {
  2503. return {}
  2504. }
  2505. var slots = {};
  2506. for (var i = 0, l = children.length; i < l; i++) {
  2507. var child = children[i];
  2508. var data = child.data;
  2509. // remove slot attribute if the node is resolved as a Vue slot node
  2510. if (data && data.attrs && data.attrs.slot) {
  2511. delete data.attrs.slot;
  2512. }
  2513. // named slots should only be respected if the vnode was rendered in the
  2514. // same context.
  2515. if ((child.context === context || child.fnContext === context) &&
  2516. data && data.slot != null
  2517. ) {
  2518. var name = data.slot;
  2519. var slot = (slots[name] || (slots[name] = []));
  2520. if (child.tag === 'template') {
  2521. slot.push.apply(slot, child.children || []);
  2522. } else {
  2523. slot.push(child);
  2524. }
  2525. } else {
  2526. (slots.default || (slots.default = [])).push(child);
  2527. }
  2528. }
  2529. // ignore slots that contains only whitespace
  2530. for (var name$1 in slots) {
  2531. if (slots[name$1].every(isWhitespace)) {
  2532. delete slots[name$1];
  2533. }
  2534. }
  2535. return slots
  2536. }
  2537.  
  2538. function isWhitespace (node) {
  2539. return (node.isComment && !node.asyncFactory) || node.text === ' '
  2540. }
  2541.  
  2542. /* */
  2543.  
  2544. function normalizeScopedSlots (
  2545. slots,
  2546. normalSlots,
  2547. prevSlots
  2548. ) {
  2549. var res;
  2550. var hasNormalSlots = Object.keys(normalSlots).length > 0;
  2551. var isStable = slots ? !!slots.$stable : !hasNormalSlots;
  2552. var key = slots && slots.$key;
  2553. if (!slots) {
  2554. res = {};
  2555. } else if (slots._normalized) {
  2556. // fast path 1: child component re-render only, parent did not change
  2557. return slots._normalized
  2558. } else if (
  2559. isStable &&
  2560. prevSlots &&
  2561. prevSlots !== emptyObject &&
  2562. key === prevSlots.$key &&
  2563. !hasNormalSlots &&
  2564. !prevSlots.$hasNormal
  2565. ) {
  2566. // fast path 2: stable scoped slots w/ no normal slots to proxy,
  2567. // only need to normalize once
  2568. return prevSlots
  2569. } else {
  2570. res = {};
  2571. for (var key$1 in slots) {
  2572. if (slots[key$1] && key$1[0] !== '$') {
  2573. res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
  2574. }
  2575. }
  2576. }
  2577. // expose normal slots on scopedSlots
  2578. for (var key$2 in normalSlots) {
  2579. if (!(key$2 in res)) {
  2580. res[key$2] = proxyNormalSlot(normalSlots, key$2);
  2581. }
  2582. }
  2583. // avoriaz seems to mock a non-extensible $scopedSlots object
  2584. // and when that is passed down this would cause an error
  2585. if (slots && Object.isExtensible(slots)) {
  2586. (slots)._normalized = res;
  2587. }
  2588. def(res, '$stable', isStable);
  2589. def(res, '$key', key);
  2590. def(res, '$hasNormal', hasNormalSlots);
  2591. return res
  2592. }
  2593.  
  2594. function normalizeScopedSlot(normalSlots, key, fn) {
  2595. var normalized = function () {
  2596. var res = arguments.length ? fn.apply(null, arguments) : fn({});
  2597. res = res && typeof res === 'object' && !Array.isArray(res)
  2598. ? [res] // single vnode
  2599. : normalizeChildren(res);
  2600. return res && (
  2601. res.length === 0 ||
  2602. (res.length === 1 && res[0].isComment) // #9658
  2603. ) ? undefined
  2604. : res
  2605. };
  2606. // this is a slot using the new v-slot syntax without scope. although it is
  2607. // compiled as a scoped slot, render fn users would expect it to be present
  2608. // on this.$slots because the usage is semantically a normal slot.
  2609. if (fn.proxy) {
  2610. Object.defineProperty(normalSlots, key, {
  2611. get: normalized,
  2612. enumerable: true,
  2613. configurable: true
  2614. });
  2615. }
  2616. return normalized
  2617. }
  2618.  
  2619. function proxyNormalSlot(slots, key) {
  2620. return function () { return slots[key]; }
  2621. }
  2622.  
  2623. /* */
  2624.  
  2625. /**
  2626. * Runtime helper for rendering v-for lists.
  2627. */
  2628. function renderList (
  2629. val,
  2630. render
  2631. ) {
  2632. var ret, i, l, keys, key;
  2633. if (Array.isArray(val) || typeof val === 'string') {
  2634. ret = new Array(val.length);
  2635. for (i = 0, l = val.length; i < l; i++) {
  2636. ret[i] = render(val[i], i);
  2637. }
  2638. } else if (typeof val === 'number') {
  2639. ret = new Array(val);
  2640. for (i = 0; i < val; i++) {
  2641. ret[i] = render(i + 1, i);
  2642. }
  2643. } else if (isObject(val)) {
  2644. if (hasSymbol && val[Symbol.iterator]) {
  2645. ret = [];
  2646. var iterator = val[Symbol.iterator]();
  2647. var result = iterator.next();
  2648. while (!result.done) {
  2649. ret.push(render(result.value, ret.length));
  2650. result = iterator.next();
  2651. }
  2652. } else {
  2653. keys = Object.keys(val);
  2654. ret = new Array(keys.length);
  2655. for (i = 0, l = keys.length; i < l; i++) {
  2656. key = keys[i];
  2657. ret[i] = render(val[key], key, i);
  2658. }
  2659. }
  2660. }
  2661. if (!isDef(ret)) {
  2662. ret = [];
  2663. }
  2664. (ret)._isVList = true;
  2665. return ret
  2666. }
  2667.  
  2668. /* */
  2669.  
  2670. /**
  2671. * Runtime helper for rendering <slot>
  2672. */
  2673. function renderSlot (
  2674. name,
  2675. fallback,
  2676. props,
  2677. bindObject
  2678. ) {
  2679. var scopedSlotFn = this.$scopedSlots[name];
  2680. var nodes;
  2681. if (scopedSlotFn) { // scoped slot
  2682. props = props || {};
  2683. if (bindObject) {
  2684. if (!isObject(bindObject)) {
  2685. warn(
  2686. 'slot v-bind without argument expects an Object',
  2687. this
  2688. );
  2689. }
  2690. props = extend(extend({}, bindObject), props);
  2691. }
  2692. nodes = scopedSlotFn(props) || fallback;
  2693. } else {
  2694. nodes = this.$slots[name] || fallback;
  2695. }
  2696.  
  2697. var target = props && props.slot;
  2698. if (target) {
  2699. return this.$createElement('template', { slot: target }, nodes)
  2700. } else {
  2701. return nodes
  2702. }
  2703. }
  2704.  
  2705. /* */
  2706.  
  2707. /**
  2708. * Runtime helper for resolving filters
  2709. */
  2710. function resolveFilter (id) {
  2711. return resolveAsset(this.$options, 'filters', id, true) || identity
  2712. }
  2713.  
  2714. /* */
  2715.  
  2716. function isKeyNotMatch (expect, actual) {
  2717. if (Array.isArray(expect)) {
  2718. return expect.indexOf(actual) === -1
  2719. } else {
  2720. return expect !== actual
  2721. }
  2722. }
  2723.  
  2724. /**
  2725. * Runtime helper for checking keyCodes from config.
  2726. * exposed as Vue.prototype._k
  2727. * passing in eventKeyName as last argument separately for backwards compat
  2728. */
  2729. function checkKeyCodes (
  2730. eventKeyCode,
  2731. key,
  2732. builtInKeyCode,
  2733. eventKeyName,
  2734. builtInKeyName
  2735. ) {
  2736. var mappedKeyCode = config.keyCodes[key] || builtInKeyCode;
  2737. if (builtInKeyName && eventKeyName && !config.keyCodes[key]) {
  2738. return isKeyNotMatch(builtInKeyName, eventKeyName)
  2739. } else if (mappedKeyCode) {
  2740. return isKeyNotMatch(mappedKeyCode, eventKeyCode)
  2741. } else if (eventKeyName) {
  2742. return hyphenate(eventKeyName) !== key
  2743. }
  2744. }
  2745.  
  2746. /* */
  2747.  
  2748. /**
  2749. * Runtime helper for merging v-bind="object" into a VNode's data.
  2750. */
  2751. function bindObjectProps (
  2752. data,
  2753. tag,
  2754. value,
  2755. asProp,
  2756. isSync
  2757. ) {
  2758. if (value) {
  2759. if (!isObject(value)) {
  2760. warn(
  2761. 'v-bind without argument expects an Object or Array value',
  2762. this
  2763. );
  2764. } else {
  2765. if (Array.isArray(value)) {
  2766. value = toObject(value);
  2767. }
  2768. var hash;
  2769. var loop = function ( key ) {
  2770. if (
  2771. key === 'class' ||
  2772. key === 'style' ||
  2773. isReservedAttribute(key)
  2774. ) {
  2775. hash = data;
  2776. } else {
  2777. var type = data.attrs && data.attrs.type;
  2778. hash = asProp || config.mustUseProp(tag, type, key)
  2779. ? data.domProps || (data.domProps = {})
  2780. : data.attrs || (data.attrs = {});
  2781. }
  2782. var camelizedKey = camelize(key);
  2783. var hyphenatedKey = hyphenate(key);
  2784. if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
  2785. hash[key] = value[key];
  2786.  
  2787. if (isSync) {
  2788. var on = data.on || (data.on = {});
  2789. on[("update:" + key)] = function ($event) {
  2790. value[key] = $event;
  2791. };
  2792. }
  2793. }
  2794. };
  2795.  
  2796. for (var key in value) loop( key );
  2797. }
  2798. }
  2799. return data
  2800. }
  2801.  
  2802. /* */
  2803.  
  2804. /**
  2805. * Runtime helper for rendering static trees.
  2806. */
  2807. function renderStatic (
  2808. index,
  2809. isInFor
  2810. ) {
  2811. var cached = this._staticTrees || (this._staticTrees = []);
  2812. var tree = cached[index];
  2813. // if has already-rendered static tree and not inside v-for,
  2814. // we can reuse the same tree.
  2815. if (tree && !isInFor) {
  2816. return tree
  2817. }
  2818. // otherwise, render a fresh tree.
  2819. tree = cached[index] = this.$options.staticRenderFns[index].call(
  2820. this._renderProxy,
  2821. null,
  2822. this // for render fns generated for functional component templates
  2823. );
  2824. markStatic(tree, ("__static__" + index), false);
  2825. return tree
  2826. }
  2827.  
  2828. /**
  2829. * Runtime helper for v-once.
  2830. * Effectively it means marking the node as static with a unique key.
  2831. */
  2832. function markOnce (
  2833. tree,
  2834. index,
  2835. key
  2836. ) {
  2837. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2838. return tree
  2839. }
  2840.  
  2841. function markStatic (
  2842. tree,
  2843. key,
  2844. isOnce
  2845. ) {
  2846. if (Array.isArray(tree)) {
  2847. for (var i = 0; i < tree.length; i++) {
  2848. if (tree[i] && typeof tree[i] !== 'string') {
  2849. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2850. }
  2851. }
  2852. } else {
  2853. markStaticNode(tree, key, isOnce);
  2854. }
  2855. }
  2856.  
  2857. function markStaticNode (node, key, isOnce) {
  2858. node.isStatic = true;
  2859. node.key = key;
  2860. node.isOnce = isOnce;
  2861. }
  2862.  
  2863. /* */
  2864.  
  2865. function bindObjectListeners (data, value) {
  2866. if (value) {
  2867. if (!isPlainObject(value)) {
  2868. warn(
  2869. 'v-on without argument expects an Object value',
  2870. this
  2871. );
  2872. } else {
  2873. var on = data.on = data.on ? extend({}, data.on) : {};
  2874. for (var key in value) {
  2875. var existing = on[key];
  2876. var ours = value[key];
  2877. on[key] = existing ? [].concat(existing, ours) : ours;
  2878. }
  2879. }
  2880. }
  2881. return data
  2882. }
  2883.  
  2884. /* */
  2885.  
  2886. function resolveScopedSlots (
  2887. fns, // see flow/vnode
  2888. res,
  2889. // the following are added in 2.6
  2890. hasDynamicKeys,
  2891. contentHashKey
  2892. ) {
  2893. res = res || { $stable: !hasDynamicKeys };
  2894. for (var i = 0; i < fns.length; i++) {
  2895. var slot = fns[i];
  2896. if (Array.isArray(slot)) {
  2897. resolveScopedSlots(slot, res, hasDynamicKeys);
  2898. } else if (slot) {
  2899. // marker for reverse proxying v-slot without scope on this.$slots
  2900. if (slot.proxy) {
  2901. slot.fn.proxy = true;
  2902. }
  2903. res[slot.key] = slot.fn;
  2904. }
  2905. }
  2906. if (contentHashKey) {
  2907. (res).$key = contentHashKey;
  2908. }
  2909. return res
  2910. }
  2911.  
  2912. /* */
  2913.  
  2914. function bindDynamicKeys (baseObj, values) {
  2915. for (var i = 0; i < values.length; i += 2) {
  2916. var key = values[i];
  2917. if (typeof key === 'string' && key) {
  2918. baseObj[values[i]] = values[i + 1];
  2919. } else if (key !== '' && key !== null) {
  2920. // null is a speical value for explicitly removing a binding
  2921. warn(
  2922. ("Invalid value for dynamic directive argument (expected string or null): " + key),
  2923. this
  2924. );
  2925. }
  2926. }
  2927. return baseObj
  2928. }
  2929.  
  2930. // helper to dynamically append modifier runtime markers to event names.
  2931. // ensure only append when value is already string, otherwise it will be cast
  2932. // to string and cause the type check to miss.
  2933. function prependModifier (value, symbol) {
  2934. return typeof value === 'string' ? symbol + value : value
  2935. }
  2936.  
  2937. /* */
  2938.  
  2939. function installRenderHelpers (target) {
  2940. target._o = markOnce;
  2941. target._n = toNumber;
  2942. target._s = toString;
  2943. target._l = renderList;
  2944. target._t = renderSlot;
  2945. target._q = looseEqual;
  2946. target._i = looseIndexOf;
  2947. target._m = renderStatic;
  2948. target._f = resolveFilter;
  2949. target._k = checkKeyCodes;
  2950. target._b = bindObjectProps;
  2951. target._v = createTextVNode;
  2952. target._e = createEmptyVNode;
  2953. target._u = resolveScopedSlots;
  2954. target._g = bindObjectListeners;
  2955. target._d = bindDynamicKeys;
  2956. target._p = prependModifier;
  2957. }
  2958.  
  2959. /* */
  2960.  
  2961. function FunctionalRenderContext (
  2962. data,
  2963. props,
  2964. children,
  2965. parent,
  2966. Ctor
  2967. ) {
  2968. var this$1 = this;
  2969.  
  2970. var options = Ctor.options;
  2971. // ensure the createElement function in functional components
  2972. // gets a unique context - this is necessary for correct named slot check
  2973. var contextVm;
  2974. if (hasOwn(parent, '_uid')) {
  2975. contextVm = Object.create(parent);
  2976. // $flow-disable-line
  2977. contextVm._original = parent;
  2978. } else {
  2979. // the context vm passed in is a functional context as well.
  2980. // in this case we want to make sure we are able to get a hold to the
  2981. // real context instance.
  2982. contextVm = parent;
  2983. // $flow-disable-line
  2984. parent = parent._original;
  2985. }
  2986. var isCompiled = isTrue(options._compiled);
  2987. var needNormalization = !isCompiled;
  2988.  
  2989. this.data = data;
  2990. this.props = props;
  2991. this.children = children;
  2992. this.parent = parent;
  2993. this.listeners = data.on || emptyObject;
  2994. this.injections = resolveInject(options.inject, parent);
  2995. this.slots = function () {
  2996. if (!this$1.$slots) {
  2997. normalizeScopedSlots(
  2998. data.scopedSlots,
  2999. this$1.$slots = resolveSlots(children, parent)
  3000. );
  3001. }
  3002. return this$1.$slots
  3003. };
  3004.  
  3005. Object.defineProperty(this, 'scopedSlots', ({
  3006. enumerable: true,
  3007. get: function get () {
  3008. return normalizeScopedSlots(data.scopedSlots, this.slots())
  3009. }
  3010. }));
  3011.  
  3012. // support for compiled functional template
  3013. if (isCompiled) {
  3014. // exposing $options for renderStatic()
  3015. this.$options = options;
  3016. // pre-resolve slots for renderSlot()
  3017. this.$slots = this.slots();
  3018. this.$scopedSlots = normalizeScopedSlots(data.scopedSlots, this.$slots);
  3019. }
  3020.  
  3021. if (options._scopeId) {
  3022. this._c = function (a, b, c, d) {
  3023. var vnode = createElement(contextVm, a, b, c, d, needNormalization);
  3024. if (vnode && !Array.isArray(vnode)) {
  3025. vnode.fnScopeId = options._scopeId;
  3026. vnode.fnContext = parent;
  3027. }
  3028. return vnode
  3029. };
  3030. } else {
  3031. this._c = function (a, b, c, d) { return createElement(contextVm, a, b, c, d, needNormalization); };
  3032. }
  3033. }
  3034.  
  3035. installRenderHelpers(FunctionalRenderContext.prototype);
  3036.  
  3037. function createFunctionalComponent (
  3038. Ctor,
  3039. propsData,
  3040. data,
  3041. contextVm,
  3042. children
  3043. ) {
  3044. var options = Ctor.options;
  3045. var props = {};
  3046. var propOptions = options.props;
  3047. if (isDef(propOptions)) {
  3048. for (var key in propOptions) {
  3049. props[key] = validateProp(key, propOptions, propsData || emptyObject);
  3050. }
  3051. } else {
  3052. if (isDef(data.attrs)) { mergeProps(props, data.attrs); }
  3053. if (isDef(data.props)) { mergeProps(props, data.props); }
  3054. }
  3055.  
  3056. var renderContext = new FunctionalRenderContext(
  3057. data,
  3058. props,
  3059. children,
  3060. contextVm,
  3061. Ctor
  3062. );
  3063.  
  3064. var vnode = options.render.call(null, renderContext._c, renderContext);
  3065.  
  3066. if (vnode instanceof VNode) {
  3067. return cloneAndMarkFunctionalResult(vnode, data, renderContext.parent, options, renderContext)
  3068. } else if (Array.isArray(vnode)) {
  3069. var vnodes = normalizeChildren(vnode) || [];
  3070. var res = new Array(vnodes.length);
  3071. for (var i = 0; i < vnodes.length; i++) {
  3072. res[i] = cloneAndMarkFunctionalResult(vnodes[i], data, renderContext.parent, options, renderContext);
  3073. }
  3074. return res
  3075. }
  3076. }
  3077.  
  3078. function cloneAndMarkFunctionalResult (vnode, data, contextVm, options, renderContext) {
  3079. // #7817 clone node before setting fnContext, otherwise if the node is reused
  3080. // (e.g. it was from a cached normal slot) the fnContext causes named slots
  3081. // that should not be matched to match.
  3082. var clone = cloneVNode(vnode);
  3083. clone.fnContext = contextVm;
  3084. clone.fnOptions = options;
  3085. {
  3086. (clone.devtoolsMeta = clone.devtoolsMeta || {}).renderContext = renderContext;
  3087. }
  3088. if (data.slot) {
  3089. (clone.data || (clone.data = {})).slot = data.slot;
  3090. }
  3091. return clone
  3092. }
  3093.  
  3094. function mergeProps (to, from) {
  3095. for (var key in from) {
  3096. to[camelize(key)] = from[key];
  3097. }
  3098. }
  3099.  
  3100. /* */
  3101.  
  3102. /* */
  3103.  
  3104. /* */
  3105.  
  3106. /* */
  3107.  
  3108. // inline hooks to be invoked on component VNodes during patch
  3109. var componentVNodeHooks = {
  3110. init: function init (vnode, hydrating) {
  3111. if (
  3112. vnode.componentInstance &&
  3113. !vnode.componentInstance._isDestroyed &&
  3114. vnode.data.keepAlive
  3115. ) {
  3116. // kept-alive components, treat as a patch
  3117. var mountedNode = vnode; // work around flow
  3118. componentVNodeHooks.prepatch(mountedNode, mountedNode);
  3119. } else {
  3120. var child = vnode.componentInstance = createComponentInstanceForVnode(
  3121. vnode,
  3122. activeInstance
  3123. );
  3124. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  3125. }
  3126. },
  3127.  
  3128. prepatch: function prepatch (oldVnode, vnode) {
  3129. var options = vnode.componentOptions;
  3130. var child = vnode.componentInstance = oldVnode.componentInstance;
  3131. updateChildComponent(
  3132. child,
  3133. options.propsData, // updated props
  3134. options.listeners, // updated listeners
  3135. vnode, // new parent vnode
  3136. options.children // new children
  3137. );
  3138. },
  3139.  
  3140. insert: function insert (vnode) {
  3141. var context = vnode.context;
  3142. var componentInstance = vnode.componentInstance;
  3143. if (!componentInstance._isMounted) {
  3144. componentInstance._isMounted = true;
  3145. callHook(componentInstance, 'mounted');
  3146. }
  3147. if (vnode.data.keepAlive) {
  3148. if (context._isMounted) {
  3149. // vue-router#1212
  3150. // During updates, a kept-alive component's child components may
  3151. // change, so directly walking the tree here may call activated hooks
  3152. // on incorrect children. Instead we push them into a queue which will
  3153. // be processed after the whole patch process ended.
  3154. queueActivatedComponent(componentInstance);
  3155. } else {
  3156. activateChildComponent(componentInstance, true /* direct */);
  3157. }
  3158. }
  3159. },
  3160.  
  3161. destroy: function destroy (vnode) {
  3162. var componentInstance = vnode.componentInstance;
  3163. if (!componentInstance._isDestroyed) {
  3164. if (!vnode.data.keepAlive) {
  3165. componentInstance.$destroy();
  3166. } else {
  3167. deactivateChildComponent(componentInstance, true /* direct */);
  3168. }
  3169. }
  3170. }
  3171. };
  3172.  
  3173. var hooksToMerge = Object.keys(componentVNodeHooks);
  3174.  
  3175. function createComponent (
  3176. Ctor,
  3177. data,
  3178. context,
  3179. children,
  3180. tag
  3181. ) {
  3182. if (isUndef(Ctor)) {
  3183. return
  3184. }
  3185.  
  3186. var baseCtor = context.$options._base;
  3187.  
  3188. // plain options object: turn it into a constructor
  3189. if (isObject(Ctor)) {
  3190. Ctor = baseCtor.extend(Ctor);
  3191. }
  3192.  
  3193. // if at this stage it's not a constructor or an async component factory,
  3194. // reject.
  3195. if (typeof Ctor !== 'function') {
  3196. {
  3197. warn(("Invalid Component definition: " + (String(Ctor))), context);
  3198. }
  3199. return
  3200. }
  3201.  
  3202. // async component
  3203. var asyncFactory;
  3204. if (isUndef(Ctor.cid)) {
  3205. asyncFactory = Ctor;
  3206. Ctor = resolveAsyncComponent(asyncFactory, baseCtor);
  3207. if (Ctor === undefined) {
  3208. // return a placeholder node for async component, which is rendered
  3209. // as a comment node but preserves all the raw information for the node.
  3210. // the information will be used for async server-rendering and hydration.
  3211. return createAsyncPlaceholder(
  3212. asyncFactory,
  3213. data,
  3214. context,
  3215. children,
  3216. tag
  3217. )
  3218. }
  3219. }
  3220.  
  3221. data = data || {};
  3222.  
  3223. // resolve constructor options in case global mixins are applied after
  3224. // component constructor creation
  3225. resolveConstructorOptions(Ctor);
  3226.  
  3227. // transform component v-model data into props & events
  3228. if (isDef(data.model)) {
  3229. transformModel(Ctor.options, data);
  3230. }
  3231.  
  3232. // extract props
  3233. var propsData = extractPropsFromVNodeData(data, Ctor, tag);
  3234.  
  3235. // functional component
  3236. if (isTrue(Ctor.options.functional)) {
  3237. return createFunctionalComponent(Ctor, propsData, data, context, children)
  3238. }
  3239.  
  3240. // extract listeners, since these needs to be treated as
  3241. // child component listeners instead of DOM listeners
  3242. var listeners = data.on;
  3243. // replace with listeners with .native modifier
  3244. // so it gets processed during parent component patch.
  3245. data.on = data.nativeOn;
  3246.  
  3247. if (isTrue(Ctor.options.abstract)) {
  3248. // abstract components do not keep anything
  3249. // other than props & listeners & slot
  3250.  
  3251. // work around flow
  3252. var slot = data.slot;
  3253. data = {};
  3254. if (slot) {
  3255. data.slot = slot;
  3256. }
  3257. }
  3258.  
  3259. // install component management hooks onto the placeholder node
  3260. installComponentHooks(data);
  3261.  
  3262. // return a placeholder vnode
  3263. var name = Ctor.options.name || tag;
  3264. var vnode = new VNode(
  3265. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  3266. data, undefined, undefined, undefined, context,
  3267. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
  3268. asyncFactory
  3269. );
  3270.  
  3271. return vnode
  3272. }
  3273.  
  3274. function createComponentInstanceForVnode (
  3275. vnode, // we know it's MountedComponentVNode but flow doesn't
  3276. parent // activeInstance in lifecycle state
  3277. ) {
  3278. var options = {
  3279. _isComponent: true,
  3280. _parentVnode: vnode,
  3281. parent: parent
  3282. };
  3283. // check inline-template render functions
  3284. var inlineTemplate = vnode.data.inlineTemplate;
  3285. if (isDef(inlineTemplate)) {
  3286. options.render = inlineTemplate.render;
  3287. options.staticRenderFns = inlineTemplate.staticRenderFns;
  3288. }
  3289. return new vnode.componentOptions.Ctor(options)
  3290. }
  3291.  
  3292. function installComponentHooks (data) {
  3293. var hooks = data.hook || (data.hook = {});
  3294. for (var i = 0; i < hooksToMerge.length; i++) {
  3295. var key = hooksToMerge[i];
  3296. var existing = hooks[key];
  3297. var toMerge = componentVNodeHooks[key];
  3298. if (existing !== toMerge && !(existing && existing._merged)) {
  3299. hooks[key] = existing ? mergeHook$1(toMerge, existing) : toMerge;
  3300. }
  3301. }
  3302. }
  3303.  
  3304. function mergeHook$1 (f1, f2) {
  3305. var merged = function (a, b) {
  3306. // flow complains about extra args which is why we use any
  3307. f1(a, b);
  3308. f2(a, b);
  3309. };
  3310. merged._merged = true;
  3311. return merged
  3312. }
  3313.  
  3314. // transform component v-model info (value and callback) into
  3315. // prop and event handler respectively.
  3316. function transformModel (options, data) {
  3317. var prop = (options.model && options.model.prop) || 'value';
  3318. var event = (options.model && options.model.event) || 'input'
  3319. ;(data.attrs || (data.attrs = {}))[prop] = data.model.value;
  3320. var on = data.on || (data.on = {});
  3321. var existing = on[event];
  3322. var callback = data.model.callback;
  3323. if (isDef(existing)) {
  3324. if (
  3325. Array.isArray(existing)
  3326. ? existing.indexOf(callback) === -1
  3327. : existing !== callback
  3328. ) {
  3329. on[event] = [callback].concat(existing);
  3330. }
  3331. } else {
  3332. on[event] = callback;
  3333. }
  3334. }
  3335.  
  3336. /* */
  3337.  
  3338. var SIMPLE_NORMALIZE = 1;
  3339. var ALWAYS_NORMALIZE = 2;
  3340.  
  3341. // wrapper function for providing a more flexible interface
  3342. // without getting yelled at by flow
  3343. function createElement (
  3344. context,
  3345. tag,
  3346. data,
  3347. children,
  3348. normalizationType,
  3349. alwaysNormalize
  3350. ) {
  3351. if (Array.isArray(data) || isPrimitive(data)) {
  3352. normalizationType = children;
  3353. children = data;
  3354. data = undefined;
  3355. }
  3356. if (isTrue(alwaysNormalize)) {
  3357. normalizationType = ALWAYS_NORMALIZE;
  3358. }
  3359. return _createElement(context, tag, data, children, normalizationType)
  3360. }
  3361.  
  3362. function _createElement (
  3363. context,
  3364. tag,
  3365. data,
  3366. children,
  3367. normalizationType
  3368. ) {
  3369. if (isDef(data) && isDef((data).__ob__)) {
  3370. warn(
  3371. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  3372. 'Always create fresh vnode data objects in each render!',
  3373. context
  3374. );
  3375. return createEmptyVNode()
  3376. }
  3377. // object syntax in v-bind
  3378. if (isDef(data) && isDef(data.is)) {
  3379. tag = data.is;
  3380. }
  3381. if (!tag) {
  3382. // in case of component :is set to falsy value
  3383. return createEmptyVNode()
  3384. }
  3385. // warn against non-primitive key
  3386. if (isDef(data) && isDef(data.key) && !isPrimitive(data.key)
  3387. ) {
  3388. {
  3389. warn(
  3390. 'Avoid using non-primitive value as key, ' +
  3391. 'use string/number value instead.',
  3392. context
  3393. );
  3394. }
  3395. }
  3396. // support single function children as default scoped slot
  3397. if (Array.isArray(children) &&
  3398. typeof children[0] === 'function'
  3399. ) {
  3400. data = data || {};
  3401. data.scopedSlots = { default: children[0] };
  3402. children.length = 0;
  3403. }
  3404. if (normalizationType === ALWAYS_NORMALIZE) {
  3405. children = normalizeChildren(children);
  3406. } else if (normalizationType === SIMPLE_NORMALIZE) {
  3407. children = simpleNormalizeChildren(children);
  3408. }
  3409. var vnode, ns;
  3410. if (typeof tag === 'string') {
  3411. var Ctor;
  3412. ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
  3413. if (config.isReservedTag(tag)) {
  3414. // platform built-in elements
  3415. vnode = new VNode(
  3416. config.parsePlatformTagName(tag), data, children,
  3417. undefined, undefined, context
  3418. );
  3419. } else if ((!data || !data.pre) && isDef(Ctor = resolveAsset(context.$options, 'components', tag))) {
  3420. // component
  3421. vnode = createComponent(Ctor, data, context, children, tag);
  3422. } else {
  3423. // unknown or unlisted namespaced elements
  3424. // check at runtime because it may get assigned a namespace when its
  3425. // parent normalizes children
  3426. vnode = new VNode(
  3427. tag, data, children,
  3428. undefined, undefined, context
  3429. );
  3430. }
  3431. } else {
  3432. // direct component options / constructor
  3433. vnode = createComponent(tag, data, context, children);
  3434. }
  3435. if (Array.isArray(vnode)) {
  3436. return vnode
  3437. } else if (isDef(vnode)) {
  3438. if (isDef(ns)) { applyNS(vnode, ns); }
  3439. if (isDef(data)) { registerDeepBindings(data); }
  3440. return vnode
  3441. } else {
  3442. return createEmptyVNode()
  3443. }
  3444. }
  3445.  
  3446. function applyNS (vnode, ns, force) {
  3447. vnode.ns = ns;
  3448. if (vnode.tag === 'foreignObject') {
  3449. // use default namespace inside foreignObject
  3450. ns = undefined;
  3451. force = true;
  3452. }
  3453. if (isDef(vnode.children)) {
  3454. for (var i = 0, l = vnode.children.length; i < l; i++) {
  3455. var child = vnode.children[i];
  3456. if (isDef(child.tag) && (
  3457. isUndef(child.ns) || (isTrue(force) && child.tag !== 'svg'))) {
  3458. applyNS(child, ns, force);
  3459. }
  3460. }
  3461. }
  3462. }
  3463.  
  3464. // ref #5318
  3465. // necessary to ensure parent re-render when deep bindings like :style and
  3466. // :class are used on slot nodes
  3467. function registerDeepBindings (data) {
  3468. if (isObject(data.style)) {
  3469. traverse(data.style);
  3470. }
  3471. if (isObject(data.class)) {
  3472. traverse(data.class);
  3473. }
  3474. }
  3475.  
  3476. /* */
  3477.  
  3478. function initRender (vm) {
  3479. vm._vnode = null; // the root of the child tree
  3480. vm._staticTrees = null; // v-once cached trees
  3481. var options = vm.$options;
  3482. var parentVnode = vm.$vnode = options._parentVnode; // the placeholder node in parent tree
  3483. var renderContext = parentVnode && parentVnode.context;
  3484. vm.$slots = resolveSlots(options._renderChildren, renderContext);
  3485. vm.$scopedSlots = emptyObject;
  3486. // bind the createElement fn to this instance
  3487. // so that we get proper render context inside it.
  3488. // args order: tag, data, children, normalizationType, alwaysNormalize
  3489. // internal version is used by render functions compiled from templates
  3490. vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
  3491. // normalization is always applied for the public version, used in
  3492. // user-written render functions.
  3493. vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
  3494.  
  3495. // $attrs & $listeners are exposed for easier HOC creation.
  3496. // they need to be reactive so that HOCs using them are always updated
  3497. var parentData = parentVnode && parentVnode.data;
  3498.  
  3499. /* istanbul ignore else */
  3500. {
  3501. defineReactive$$1(vm, '$attrs', parentData && parentData.attrs || emptyObject, function () {
  3502. !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
  3503. }, true);
  3504. defineReactive$$1(vm, '$listeners', options._parentListeners || emptyObject, function () {
  3505. !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
  3506. }, true);
  3507. }
  3508. }
  3509.  
  3510. var currentRenderingInstance = null;
  3511.  
  3512. function renderMixin (Vue) {
  3513. // install runtime convenience helpers
  3514. installRenderHelpers(Vue.prototype);
  3515.  
  3516. Vue.prototype.$nextTick = function (fn) {
  3517. return nextTick(fn, this)
  3518. };
  3519.  
  3520. Vue.prototype._render = function () {
  3521. var vm = this;
  3522. var ref = vm.$options;
  3523. var render = ref.render;
  3524. var _parentVnode = ref._parentVnode;
  3525.  
  3526. if (_parentVnode) {
  3527. vm.$scopedSlots = normalizeScopedSlots(
  3528. _parentVnode.data.scopedSlots,
  3529. vm.$slots,
  3530. vm.$scopedSlots
  3531. );
  3532. }
  3533.  
  3534. // set parent vnode. this allows render functions to have access
  3535. // to the data on the placeholder node.
  3536. vm.$vnode = _parentVnode;
  3537. // render self
  3538. var vnode;
  3539. try {
  3540. // There's no need to maintain a stack becaues all render fns are called
  3541. // separately from one another. Nested component's render fns are called
  3542. // when parent component is patched.
  3543. currentRenderingInstance = vm;
  3544. vnode = render.call(vm._renderProxy, vm.$createElement);
  3545. } catch (e) {
  3546. handleError(e, vm, "render");
  3547. // return error render result,
  3548. // or previous vnode to prevent render error causing blank component
  3549. /* istanbul ignore else */
  3550. if (vm.$options.renderError) {
  3551. try {
  3552. vnode = vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e);
  3553. } catch (e) {
  3554. handleError(e, vm, "renderError");
  3555. vnode = vm._vnode;
  3556. }
  3557. } else {
  3558. vnode = vm._vnode;
  3559. }
  3560. } finally {
  3561. currentRenderingInstance = null;
  3562. }
  3563. // if the returned array contains only a single node, allow it
  3564. if (Array.isArray(vnode) && vnode.length === 1) {
  3565. vnode = vnode[0];
  3566. }
  3567. // return empty vnode in case the render function errored out
  3568. if (!(vnode instanceof VNode)) {
  3569. if (Array.isArray(vnode)) {
  3570. warn(
  3571. 'Multiple root nodes returned from render function. Render function ' +
  3572. 'should return a single root node.',
  3573. vm
  3574. );
  3575. }
  3576. vnode = createEmptyVNode();
  3577. }
  3578. // set parent
  3579. vnode.parent = _parentVnode;
  3580. return vnode
  3581. };
  3582. }
  3583.  
  3584. /* */
  3585.  
  3586. function ensureCtor (comp, base) {
  3587. if (
  3588. comp.__esModule ||
  3589. (hasSymbol && comp[Symbol.toStringTag] === 'Module')
  3590. ) {
  3591. comp = comp.default;
  3592. }
  3593. return isObject(comp)
  3594. ? base.extend(comp)
  3595. : comp
  3596. }
  3597.  
  3598. function createAsyncPlaceholder (
  3599. factory,
  3600. data,
  3601. context,
  3602. children,
  3603. tag
  3604. ) {
  3605. var node = createEmptyVNode();
  3606. node.asyncFactory = factory;
  3607. node.asyncMeta = { data: data, context: context, children: children, tag: tag };
  3608. return node
  3609. }
  3610.  
  3611. function resolveAsyncComponent (
  3612. factory,
  3613. baseCtor
  3614. ) {
  3615. if (isTrue(factory.error) && isDef(factory.errorComp)) {
  3616. return factory.errorComp
  3617. }
  3618.  
  3619. if (isDef(factory.resolved)) {
  3620. return factory.resolved
  3621. }
  3622.  
  3623. var owner = currentRenderingInstance;
  3624. if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
  3625. // already pending
  3626. factory.owners.push(owner);
  3627. }
  3628.  
  3629. if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
  3630. return factory.loadingComp
  3631. }
  3632.  
  3633. if (owner && !isDef(factory.owners)) {
  3634. var owners = factory.owners = [owner];
  3635. var sync = true;
  3636. var timerLoading = null;
  3637. var timerTimeout = null
  3638.  
  3639. ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
  3640.  
  3641. var forceRender = function (renderCompleted) {
  3642. for (var i = 0, l = owners.length; i < l; i++) {
  3643. (owners[i]).$forceUpdate();
  3644. }
  3645.  
  3646. if (renderCompleted) {
  3647. owners.length = 0;
  3648. if (timerLoading !== null) {
  3649. clearTimeout(timerLoading);
  3650. timerLoading = null;
  3651. }
  3652. if (timerTimeout !== null) {
  3653. clearTimeout(timerTimeout);
  3654. timerTimeout = null;
  3655. }
  3656. }
  3657. };
  3658.  
  3659. var resolve = once(function (res) {
  3660. // cache resolved
  3661. factory.resolved = ensureCtor(res, baseCtor);
  3662. // invoke callbacks only if this is not a synchronous resolve
  3663. // (async resolves are shimmed as synchronous during SSR)
  3664. if (!sync) {
  3665. forceRender(true);
  3666. } else {
  3667. owners.length = 0;
  3668. }
  3669. });
  3670.  
  3671. var reject = once(function (reason) {
  3672. warn(
  3673. "Failed to resolve async component: " + (String(factory)) +
  3674. (reason ? ("\nReason: " + reason) : '')
  3675. );
  3676. if (isDef(factory.errorComp)) {
  3677. factory.error = true;
  3678. forceRender(true);
  3679. }
  3680. });
  3681.  
  3682. var res = factory(resolve, reject);
  3683.  
  3684. if (isObject(res)) {
  3685. if (isPromise(res)) {
  3686. // () => Promise
  3687. if (isUndef(factory.resolved)) {
  3688. res.then(resolve, reject);
  3689. }
  3690. } else if (isPromise(res.component)) {
  3691. res.component.then(resolve, reject);
  3692.  
  3693. if (isDef(res.error)) {
  3694. factory.errorComp = ensureCtor(res.error, baseCtor);
  3695. }
  3696.  
  3697. if (isDef(res.loading)) {
  3698. factory.loadingComp = ensureCtor(res.loading, baseCtor);
  3699. if (res.delay === 0) {
  3700. factory.loading = true;
  3701. } else {
  3702. timerLoading = setTimeout(function () {
  3703. timerLoading = null;
  3704. if (isUndef(factory.resolved) && isUndef(factory.error)) {
  3705. factory.loading = true;
  3706. forceRender(false);
  3707. }
  3708. }, res.delay || 200);
  3709. }
  3710. }
  3711.  
  3712. if (isDef(res.timeout)) {
  3713. timerTimeout = setTimeout(function () {
  3714. timerTimeout = null;
  3715. if (isUndef(factory.resolved)) {
  3716. reject(
  3717. "timeout (" + (res.timeout) + "ms)"
  3718. );
  3719. }
  3720. }, res.timeout);
  3721. }
  3722. }
  3723. }
  3724.  
  3725. sync = false;
  3726. // return in case resolved synchronously
  3727. return factory.loading
  3728. ? factory.loadingComp
  3729. : factory.resolved
  3730. }
  3731. }
  3732.  
  3733. /* */
  3734.  
  3735. function isAsyncPlaceholder (node) {
  3736. return node.isComment && node.asyncFactory
  3737. }
  3738.  
  3739. /* */
  3740.  
  3741. function getFirstComponentChild (children) {
  3742. if (Array.isArray(children)) {
  3743. for (var i = 0; i < children.length; i++) {
  3744. var c = children[i];
  3745. if (isDef(c) && (isDef(c.componentOptions) || isAsyncPlaceholder(c))) {
  3746. return c
  3747. }
  3748. }
  3749. }
  3750. }
  3751.  
  3752. /* */
  3753.  
  3754. /* */
  3755.  
  3756. function initEvents (vm) {
  3757. vm._events = Object.create(null);
  3758. vm._hasHookEvent = false;
  3759. // init parent attached events
  3760. var listeners = vm.$options._parentListeners;
  3761. if (listeners) {
  3762. updateComponentListeners(vm, listeners);
  3763. }
  3764. }
  3765.  
  3766. var target;
  3767.  
  3768. function add (event, fn) {
  3769. target.$on(event, fn);
  3770. }
  3771.  
  3772. function remove$1 (event, fn) {
  3773. target.$off(event, fn);
  3774. }
  3775.  
  3776. function createOnceHandler (event, fn) {
  3777. var _target = target;
  3778. return function onceHandler () {
  3779. var res = fn.apply(null, arguments);
  3780. if (res !== null) {
  3781. _target.$off(event, onceHandler);
  3782. }
  3783. }
  3784. }
  3785.  
  3786. function updateComponentListeners (
  3787. vm,
  3788. listeners,
  3789. oldListeners
  3790. ) {
  3791. target = vm;
  3792. updateListeners(listeners, oldListeners || {}, add, remove$1, createOnceHandler, vm);
  3793. target = undefined;
  3794. }
  3795.  
  3796. function eventsMixin (Vue) {
  3797. var hookRE = /^hook:/;
  3798. Vue.prototype.$on = function (event, fn) {
  3799. var vm = this;
  3800. if (Array.isArray(event)) {
  3801. for (var i = 0, l = event.length; i < l; i++) {
  3802. vm.$on(event[i], fn);
  3803. }
  3804. } else {
  3805. (vm._events[event] || (vm._events[event] = [])).push(fn);
  3806. // optimize hook:event cost by using a boolean flag marked at registration
  3807. // instead of a hash lookup
  3808. if (hookRE.test(event)) {
  3809. vm._hasHookEvent = true;
  3810. }
  3811. }
  3812. return vm
  3813. };
  3814.  
  3815. Vue.prototype.$once = function (event, fn) {
  3816. var vm = this;
  3817. function on () {
  3818. vm.$off(event, on);
  3819. fn.apply(vm, arguments);
  3820. }
  3821. on.fn = fn;
  3822. vm.$on(event, on);
  3823. return vm
  3824. };
  3825.  
  3826. Vue.prototype.$off = function (event, fn) {
  3827. var vm = this;
  3828. // all
  3829. if (!arguments.length) {
  3830. vm._events = Object.create(null);
  3831. return vm
  3832. }
  3833. // array of events
  3834. if (Array.isArray(event)) {
  3835. for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
  3836. vm.$off(event[i$1], fn);
  3837. }
  3838. return vm
  3839. }
  3840. // specific event
  3841. var cbs = vm._events[event];
  3842. if (!cbs) {
  3843. return vm
  3844. }
  3845. if (!fn) {
  3846. vm._events[event] = null;
  3847. return vm
  3848. }
  3849. // specific handler
  3850. var cb;
  3851. var i = cbs.length;
  3852. while (i--) {
  3853. cb = cbs[i];
  3854. if (cb === fn || cb.fn === fn) {
  3855. cbs.splice(i, 1);
  3856. break
  3857. }
  3858. }
  3859. return vm
  3860. };
  3861.  
  3862. Vue.prototype.$emit = function (event) {
  3863. var vm = this;
  3864. {
  3865. var lowerCaseEvent = event.toLowerCase();
  3866. if (lowerCaseEvent !== event && vm._events[lowerCaseEvent]) {
  3867. tip(
  3868. "Event \"" + lowerCaseEvent + "\" is emitted in component " +
  3869. (formatComponentName(vm)) + " but the handler is registered for \"" + event + "\". " +
  3870. "Note that HTML attributes are case-insensitive and you cannot use " +
  3871. "v-on to listen to camelCase events when using in-DOM templates. " +
  3872. "You should probably use \"" + (hyphenate(event)) + "\" instead of \"" + event + "\"."
  3873. );
  3874. }
  3875. }
  3876. var cbs = vm._events[event];
  3877. if (cbs) {
  3878. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  3879. var args = toArray(arguments, 1);
  3880. var info = "event handler for \"" + event + "\"";
  3881. for (var i = 0, l = cbs.length; i < l; i++) {
  3882. invokeWithErrorHandling(cbs[i], vm, args, vm, info);
  3883. }
  3884. }
  3885. return vm
  3886. };
  3887. }
  3888.  
  3889. /* */
  3890.  
  3891. var activeInstance = null;
  3892. var isUpdatingChildComponent = false;
  3893.  
  3894. function setActiveInstance(vm) {
  3895. var prevActiveInstance = activeInstance;
  3896. activeInstance = vm;
  3897. return function () {
  3898. activeInstance = prevActiveInstance;
  3899. }
  3900. }
  3901.  
  3902. function initLifecycle (vm) {
  3903. var options = vm.$options;
  3904.  
  3905. // locate first non-abstract parent
  3906. var parent = options.parent;
  3907. if (parent && !options.abstract) {
  3908. while (parent.$options.abstract && parent.$parent) {
  3909. parent = parent.$parent;
  3910. }
  3911. parent.$children.push(vm);
  3912. }
  3913.  
  3914. vm.$parent = parent;
  3915. vm.$root = parent ? parent.$root : vm;
  3916.  
  3917. vm.$children = [];
  3918. vm.$refs = {};
  3919.  
  3920. vm._watcher = null;
  3921. vm._inactive = null;
  3922. vm._directInactive = false;
  3923. vm._isMounted = false;
  3924. vm._isDestroyed = false;
  3925. vm._isBeingDestroyed = false;
  3926. }
  3927.  
  3928. function lifecycleMixin (Vue) {
  3929. Vue.prototype._update = function (vnode, hydrating) {
  3930. var vm = this;
  3931. var prevEl = vm.$el;
  3932. var prevVnode = vm._vnode;
  3933. var restoreActiveInstance = setActiveInstance(vm);
  3934. vm._vnode = vnode;
  3935. // Vue.prototype.__patch__ is injected in entry points
  3936. // based on the rendering backend used.
  3937. if (!prevVnode) {
  3938. // initial render
  3939. vm.$el = vm.__patch__(vm.$el, vnode, hydrating, false /* removeOnly */);
  3940. } else {
  3941. // updates
  3942. vm.$el = vm.__patch__(prevVnode, vnode);
  3943. }
  3944. restoreActiveInstance();
  3945. // update __vue__ reference
  3946. if (prevEl) {
  3947. prevEl.__vue__ = null;
  3948. }
  3949. if (vm.$el) {
  3950. vm.$el.__vue__ = vm;
  3951. }
  3952. // if parent is an HOC, update its $el as well
  3953. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  3954. vm.$parent.$el = vm.$el;
  3955. }
  3956. // updated hook is called by the scheduler to ensure that children are
  3957. // updated in a parent's updated hook.
  3958. };
  3959.  
  3960. Vue.prototype.$forceUpdate = function () {
  3961. var vm = this;
  3962. if (vm._watcher) {
  3963. vm._watcher.update();
  3964. }
  3965. };
  3966.  
  3967. Vue.prototype.$destroy = function () {
  3968. var vm = this;
  3969. if (vm._isBeingDestroyed) {
  3970. return
  3971. }
  3972. callHook(vm, 'beforeDestroy');
  3973. vm._isBeingDestroyed = true;
  3974. // remove self from parent
  3975. var parent = vm.$parent;
  3976. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  3977. remove(parent.$children, vm);
  3978. }
  3979. // teardown watchers
  3980. if (vm._watcher) {
  3981. vm._watcher.teardown();
  3982. }
  3983. var i = vm._watchers.length;
  3984. while (i--) {
  3985. vm._watchers[i].teardown();
  3986. }
  3987. // remove reference from data ob
  3988. // frozen object may not have observer.
  3989. if (vm._data.__ob__) {
  3990. vm._data.__ob__.vmCount--;
  3991. }
  3992. // call the last hook...
  3993. vm._isDestroyed = true;
  3994. // invoke destroy hooks on current rendered tree
  3995. vm.__patch__(vm._vnode, null);
  3996. // fire destroyed hook
  3997. callHook(vm, 'destroyed');
  3998. // turn off all instance listeners.
  3999. vm.$off();
  4000. // remove __vue__ reference
  4001. if (vm.$el) {
  4002. vm.$el.__vue__ = null;
  4003. }
  4004. // release circular reference (#6759)
  4005. if (vm.$vnode) {
  4006. vm.$vnode.parent = null;
  4007. }
  4008. };
  4009. }
  4010.  
  4011. function mountComponent (
  4012. vm,
  4013. el,
  4014. hydrating
  4015. ) {
  4016. vm.$el = el;
  4017. if (!vm.$options.render) {
  4018. vm.$options.render = createEmptyVNode;
  4019. {
  4020. /* istanbul ignore if */
  4021. if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
  4022. vm.$options.el || el) {
  4023. warn(
  4024. 'You are using the runtime-only build of Vue where the template ' +
  4025. 'compiler is not available. Either pre-compile the templates into ' +
  4026. 'render functions, or use the compiler-included build.',
  4027. vm
  4028. );
  4029. } else {
  4030. warn(
  4031. 'Failed to mount component: template or render function not defined.',
  4032. vm
  4033. );
  4034. }
  4035. }
  4036. }
  4037. callHook(vm, 'beforeMount');
  4038.  
  4039. var updateComponent;
  4040. /* istanbul ignore if */
  4041. if (config.performance && mark) {
  4042. updateComponent = function () {
  4043. var name = vm._name;
  4044. var id = vm._uid;
  4045. var startTag = "vue-perf-start:" + id;
  4046. var endTag = "vue-perf-end:" + id;
  4047.  
  4048. mark(startTag);
  4049. var vnode = vm._render();
  4050. mark(endTag);
  4051. measure(("vue " + name + " render"), startTag, endTag);
  4052.  
  4053. mark(startTag);
  4054. vm._update(vnode, hydrating);
  4055. mark(endTag);
  4056. measure(("vue " + name + " patch"), startTag, endTag);
  4057. };
  4058. } else {
  4059. updateComponent = function () {
  4060. vm._update(vm._render(), hydrating);
  4061. };
  4062. }
  4063.  
  4064. // we set this to vm._watcher inside the watcher's constructor
  4065. // since the watcher's initial patch may call $forceUpdate (e.g. inside child
  4066. // component's mounted hook), which relies on vm._watcher being already defined
  4067. new Watcher(vm, updateComponent, noop, {
  4068. before: function before () {
  4069. if (vm._isMounted && !vm._isDestroyed) {
  4070. callHook(vm, 'beforeUpdate');
  4071. }
  4072. }
  4073. }, true /* isRenderWatcher */);
  4074. hydrating = false;
  4075.  
  4076. // manually mounted instance, call mounted on self
  4077. // mounted is called for render-created child components in its inserted hook
  4078. if (vm.$vnode == null) {
  4079. vm._isMounted = true;
  4080. callHook(vm, 'mounted');
  4081. }
  4082. return vm
  4083. }
  4084.  
  4085. function updateChildComponent (
  4086. vm,
  4087. propsData,
  4088. listeners,
  4089. parentVnode,
  4090. renderChildren
  4091. ) {
  4092. {
  4093. isUpdatingChildComponent = true;
  4094. }
  4095.  
  4096. // determine whether component has slot children
  4097. // we need to do this before overwriting $options._renderChildren.
  4098.  
  4099. // check if there are dynamic scopedSlots (hand-written or compiled but with
  4100. // dynamic slot names). Static scoped slots compiled from template has the
  4101. // "$stable" marker.
  4102. var newScopedSlots = parentVnode.data.scopedSlots;
  4103. var oldScopedSlots = vm.$scopedSlots;
  4104. var hasDynamicScopedSlot = !!(
  4105. (newScopedSlots && !newScopedSlots.$stable) ||
  4106. (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
  4107. (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
  4108. );
  4109.  
  4110. // Any static slot children from the parent may have changed during parent's
  4111. // update. Dynamic scoped slots may also have changed. In such cases, a forced
  4112. // update is necessary to ensure correctness.
  4113. var needsForceUpdate = !!(
  4114. renderChildren || // has new static slots
  4115. vm.$options._renderChildren || // has old static slots
  4116. hasDynamicScopedSlot
  4117. );
  4118.  
  4119. vm.$options._parentVnode = parentVnode;
  4120. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  4121.  
  4122. if (vm._vnode) { // update child tree's parent
  4123. vm._vnode.parent = parentVnode;
  4124. }
  4125. vm.$options._renderChildren = renderChildren;
  4126.  
  4127. // update $attrs and $listeners hash
  4128. // these are also reactive so they may trigger child update if the child
  4129. // used them during render
  4130. vm.$attrs = parentVnode.data.attrs || emptyObject;
  4131. vm.$listeners = listeners || emptyObject;
  4132.  
  4133. // update props
  4134. if (propsData && vm.$options.props) {
  4135. toggleObserving(false);
  4136. var props = vm._props;
  4137. var propKeys = vm.$options._propKeys || [];
  4138. for (var i = 0; i < propKeys.length; i++) {
  4139. var key = propKeys[i];
  4140. var propOptions = vm.$options.props; // wtf flow?
  4141. props[key] = validateProp(key, propOptions, propsData, vm);
  4142. }
  4143. toggleObserving(true);
  4144. // keep a copy of raw propsData
  4145. vm.$options.propsData = propsData;
  4146. }
  4147.  
  4148. // update listeners
  4149. listeners = listeners || emptyObject;
  4150. var oldListeners = vm.$options._parentListeners;
  4151. vm.$options._parentListeners = listeners;
  4152. updateComponentListeners(vm, listeners, oldListeners);
  4153.  
  4154. // resolve slots + force update if has children
  4155. if (needsForceUpdate) {
  4156. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  4157. vm.$forceUpdate();
  4158. }
  4159.  
  4160. {
  4161. isUpdatingChildComponent = false;
  4162. }
  4163. }
  4164.  
  4165. function isInInactiveTree (vm) {
  4166. while (vm && (vm = vm.$parent)) {
  4167. if (vm._inactive) { return true }
  4168. }
  4169. return false
  4170. }
  4171.  
  4172. function activateChildComponent (vm, direct) {
  4173. if (direct) {
  4174. vm._directInactive = false;
  4175. if (isInInactiveTree(vm)) {
  4176. return
  4177. }
  4178. } else if (vm._directInactive) {
  4179. return
  4180. }
  4181. if (vm._inactive || vm._inactive === null) {
  4182. vm._inactive = false;
  4183. for (var i = 0; i < vm.$children.length; i++) {
  4184. activateChildComponent(vm.$children[i]);
  4185. }
  4186. callHook(vm, 'activated');
  4187. }
  4188. }
  4189.  
  4190. function deactivateChildComponent (vm, direct) {
  4191. if (direct) {
  4192. vm._directInactive = true;
  4193. if (isInInactiveTree(vm)) {
  4194. return
  4195. }
  4196. }
  4197. if (!vm._inactive) {
  4198. vm._inactive = true;
  4199. for (var i = 0; i < vm.$children.length; i++) {
  4200. deactivateChildComponent(vm.$children[i]);
  4201. }
  4202. callHook(vm, 'deactivated');
  4203. }
  4204. }
  4205.  
  4206. function callHook (vm, hook) {
  4207. // #7573 disable dep collection when invoking lifecycle hooks
  4208. pushTarget();
  4209. var handlers = vm.$options[hook];
  4210. var info = hook + " hook";
  4211. if (handlers) {
  4212. for (var i = 0, j = handlers.length; i < j; i++) {
  4213. invokeWithErrorHandling(handlers[i], vm, null, vm, info);
  4214. }
  4215. }
  4216. if (vm._hasHookEvent) {
  4217. vm.$emit('hook:' + hook);
  4218. }
  4219. popTarget();
  4220. }
  4221.  
  4222. /* */
  4223.  
  4224. var MAX_UPDATE_COUNT = 100;
  4225.  
  4226. var queue = [];
  4227. var activatedChildren = [];
  4228. var has = {};
  4229. var circular = {};
  4230. var waiting = false;
  4231. var flushing = false;
  4232. var index = 0;
  4233.  
  4234. /**
  4235. * Reset the scheduler's state.
  4236. */
  4237. function resetSchedulerState () {
  4238. index = queue.length = activatedChildren.length = 0;
  4239. has = {};
  4240. {
  4241. circular = {};
  4242. }
  4243. waiting = flushing = false;
  4244. }
  4245.  
  4246. // Async edge case #6566 requires saving the timestamp when event listeners are
  4247. // attached. However, calling performance.now() has a perf overhead especially
  4248. // if the page has thousands of event listeners. Instead, we take a timestamp
  4249. // every time the scheduler flushes and use that for all event listeners
  4250. // attached during that flush.
  4251. var currentFlushTimestamp = 0;
  4252.  
  4253. // Async edge case fix requires storing an event listener's attach timestamp.
  4254. var getNow = Date.now;
  4255.  
  4256. // Determine what event timestamp the browser is using. Annoyingly, the
  4257. // timestamp can either be hi-res (relative to page load) or low-res
  4258. // (relative to UNIX epoch), so in order to compare time we have to use the
  4259. // same timestamp type when saving the flush timestamp.
  4260. // All IE versions use low-res event timestamps, and have problematic clock
  4261. // implementations (#9632)
  4262. if (inBrowser && !isIE) {
  4263. var performance = window.performance;
  4264. if (
  4265. performance &&
  4266. typeof performance.now === 'function' &&
  4267. getNow() > document.createEvent('Event').timeStamp
  4268. ) {
  4269. // if the event timestamp, although evaluated AFTER the Date.now(), is
  4270. // smaller than it, it means the event is using a hi-res timestamp,
  4271. // and we need to use the hi-res version for event listener timestamps as
  4272. // well.
  4273. getNow = function () { return performance.now(); };
  4274. }
  4275. }
  4276.  
  4277. /**
  4278. * Flush both queues and run the watchers.
  4279. */
  4280. function flushSchedulerQueue () {
  4281. currentFlushTimestamp = getNow();
  4282. flushing = true;
  4283. var watcher, id;
  4284.  
  4285. // Sort queue before flush.
  4286. // This ensures that:
  4287. // 1. Components are updated from parent to child. (because parent is always
  4288. // created before the child)
  4289. // 2. A component's user watchers are run before its render watcher (because
  4290. // user watchers are created before the render watcher)
  4291. // 3. If a component is destroyed during a parent component's watcher run,
  4292. // its watchers can be skipped.
  4293. queue.sort(function (a, b) { return a.id - b.id; });
  4294.  
  4295. // do not cache length because more watchers might be pushed
  4296. // as we run existing watchers
  4297. for (index = 0; index < queue.length; index++) {
  4298. watcher = queue[index];
  4299. if (watcher.before) {
  4300. watcher.before();
  4301. }
  4302. id = watcher.id;
  4303. has[id] = null;
  4304. watcher.run();
  4305. // in dev build, check and stop circular updates.
  4306. if (has[id] != null) {
  4307. circular[id] = (circular[id] || 0) + 1;
  4308. if (circular[id] > MAX_UPDATE_COUNT) {
  4309. warn(
  4310. 'You may have an infinite update loop ' + (
  4311. watcher.user
  4312. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  4313. : "in a component render function."
  4314. ),
  4315. watcher.vm
  4316. );
  4317. break
  4318. }
  4319. }
  4320. }
  4321.  
  4322. // keep copies of post queues before resetting state
  4323. var activatedQueue = activatedChildren.slice();
  4324. var updatedQueue = queue.slice();
  4325.  
  4326. resetSchedulerState();
  4327.  
  4328. // call component updated and activated hooks
  4329. callActivatedHooks(activatedQueue);
  4330. callUpdatedHooks(updatedQueue);
  4331.  
  4332. // devtool hook
  4333. /* istanbul ignore if */
  4334. if (devtools && config.devtools) {
  4335. devtools.emit('flush');
  4336. }
  4337. }
  4338.  
  4339. function callUpdatedHooks (queue) {
  4340. var i = queue.length;
  4341. while (i--) {
  4342. var watcher = queue[i];
  4343. var vm = watcher.vm;
  4344. if (vm._watcher === watcher && vm._isMounted && !vm._isDestroyed) {
  4345. callHook(vm, 'updated');
  4346. }
  4347. }
  4348. }
  4349.  
  4350. /**
  4351. * Queue a kept-alive component that was activated during patch.
  4352. * The queue will be processed after the entire tree has been patched.
  4353. */
  4354. function queueActivatedComponent (vm) {
  4355. // setting _inactive to false here so that a render function can
  4356. // rely on checking whether it's in an inactive tree (e.g. router-view)
  4357. vm._inactive = false;
  4358. activatedChildren.push(vm);
  4359. }
  4360.  
  4361. function callActivatedHooks (queue) {
  4362. for (var i = 0; i < queue.length; i++) {
  4363. queue[i]._inactive = true;
  4364. activateChildComponent(queue[i], true /* true */);
  4365. }
  4366. }
  4367.  
  4368. /**
  4369. * Push a watcher into the watcher queue.
  4370. * Jobs with duplicate IDs will be skipped unless it's
  4371. * pushed when the queue is being flushed.
  4372. */
  4373. function queueWatcher (watcher) {
  4374. var id = watcher.id;
  4375. if (has[id] == null) {
  4376. has[id] = true;
  4377. if (!flushing) {
  4378. queue.push(watcher);
  4379. } else {
  4380. // if already flushing, splice the watcher based on its id
  4381. // if already past its id, it will be run next immediately.
  4382. var i = queue.length - 1;
  4383. while (i > index && queue[i].id > watcher.id) {
  4384. i--;
  4385. }
  4386. queue.splice(i + 1, 0, watcher);
  4387. }
  4388. // queue the flush
  4389. if (!waiting) {
  4390. waiting = true;
  4391.  
  4392. if (!config.async) {
  4393. flushSchedulerQueue();
  4394. return
  4395. }
  4396. nextTick(flushSchedulerQueue);
  4397. }
  4398. }
  4399. }
  4400.  
  4401. /* */
  4402.  
  4403.  
  4404.  
  4405. var uid$2 = 0;
  4406.  
  4407. /**
  4408. * A watcher parses an expression, collects dependencies,
  4409. * and fires callback when the expression value changes.
  4410. * This is used for both the $watch() api and directives.
  4411. */
  4412. var Watcher = function Watcher (
  4413. vm,
  4414. expOrFn,
  4415. cb,
  4416. options,
  4417. isRenderWatcher
  4418. ) {
  4419. this.vm = vm;
  4420. if (isRenderWatcher) {
  4421. vm._watcher = this;
  4422. }
  4423. vm._watchers.push(this);
  4424. // options
  4425. if (options) {
  4426. this.deep = !!options.deep;
  4427. this.user = !!options.user;
  4428. this.lazy = !!options.lazy;
  4429. this.sync = !!options.sync;
  4430. this.before = options.before;
  4431. } else {
  4432. this.deep = this.user = this.lazy = this.sync = false;
  4433. }
  4434. this.cb = cb;
  4435. this.id = ++uid$2; // uid for batching
  4436. this.active = true;
  4437. this.dirty = this.lazy; // for lazy watchers
  4438. this.deps = [];
  4439. this.newDeps = [];
  4440. this.depIds = new _Set();
  4441. this.newDepIds = new _Set();
  4442. this.expression = expOrFn.toString();
  4443. // parse expression for getter
  4444. if (typeof expOrFn === 'function') {
  4445. this.getter = expOrFn;
  4446. } else {
  4447. this.getter = parsePath(expOrFn);
  4448. if (!this.getter) {
  4449. this.getter = noop;
  4450. warn(
  4451. "Failed watching path: \"" + expOrFn + "\" " +
  4452. 'Watcher only accepts simple dot-delimited paths. ' +
  4453. 'For full control, use a function instead.',
  4454. vm
  4455. );
  4456. }
  4457. }
  4458. this.value = this.lazy
  4459. ? undefined
  4460. : this.get();
  4461. };
  4462.  
  4463. /**
  4464. * Evaluate the getter, and re-collect dependencies.
  4465. */
  4466. Watcher.prototype.get = function get () {
  4467. pushTarget(this);
  4468. var value;
  4469. var vm = this.vm;
  4470. try {
  4471. value = this.getter.call(vm, vm);
  4472. } catch (e) {
  4473. if (this.user) {
  4474. handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
  4475. } else {
  4476. throw e
  4477. }
  4478. } finally {
  4479. // "touch" every property so they are all tracked as
  4480. // dependencies for deep watching
  4481. if (this.deep) {
  4482. traverse(value);
  4483. }
  4484. popTarget();
  4485. this.cleanupDeps();
  4486. }
  4487. return value
  4488. };
  4489.  
  4490. /**
  4491. * Add a dependency to this directive.
  4492. */
  4493. Watcher.prototype.addDep = function addDep (dep) {
  4494. var id = dep.id;
  4495. if (!this.newDepIds.has(id)) {
  4496. this.newDepIds.add(id);
  4497. this.newDeps.push(dep);
  4498. if (!this.depIds.has(id)) {
  4499. dep.addSub(this);
  4500. }
  4501. }
  4502. };
  4503.  
  4504. /**
  4505. * Clean up for dependency collection.
  4506. */
  4507. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  4508. var i = this.deps.length;
  4509. while (i--) {
  4510. var dep = this.deps[i];
  4511. if (!this.newDepIds.has(dep.id)) {
  4512. dep.removeSub(this);
  4513. }
  4514. }
  4515. var tmp = this.depIds;
  4516. this.depIds = this.newDepIds;
  4517. this.newDepIds = tmp;
  4518. this.newDepIds.clear();
  4519. tmp = this.deps;
  4520. this.deps = this.newDeps;
  4521. this.newDeps = tmp;
  4522. this.newDeps.length = 0;
  4523. };
  4524.  
  4525. /**
  4526. * Subscriber interface.
  4527. * Will be called when a dependency changes.
  4528. */
  4529. Watcher.prototype.update = function update () {
  4530. /* istanbul ignore else */
  4531. if (this.lazy) {
  4532. this.dirty = true;
  4533. } else if (this.sync) {
  4534. this.run();
  4535. } else {
  4536. queueWatcher(this);
  4537. }
  4538. };
  4539.  
  4540. /**
  4541. * Scheduler job interface.
  4542. * Will be called by the scheduler.
  4543. */
  4544. Watcher.prototype.run = function run () {
  4545. if (this.active) {
  4546. var value = this.get();
  4547. if (
  4548. value !== this.value ||
  4549. // Deep watchers and watchers on Object/Arrays should fire even
  4550. // when the value is the same, because the value may
  4551. // have mutated.
  4552. isObject(value) ||
  4553. this.deep
  4554. ) {
  4555. // set new value
  4556. var oldValue = this.value;
  4557. this.value = value;
  4558. if (this.user) {
  4559. try {
  4560. this.cb.call(this.vm, value, oldValue);
  4561. } catch (e) {
  4562. handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
  4563. }
  4564. } else {
  4565. this.cb.call(this.vm, value, oldValue);
  4566. }
  4567. }
  4568. }
  4569. };
  4570.  
  4571. /**
  4572. * Evaluate the value of the watcher.
  4573. * This only gets called for lazy watchers.
  4574. */
  4575. Watcher.prototype.evaluate = function evaluate () {
  4576. this.value = this.get();
  4577. this.dirty = false;
  4578. };
  4579.  
  4580. /**
  4581. * Depend on all deps collected by this watcher.
  4582. */
  4583. Watcher.prototype.depend = function depend () {
  4584. var i = this.deps.length;
  4585. while (i--) {
  4586. this.deps[i].depend();
  4587. }
  4588. };
  4589.  
  4590. /**
  4591. * Remove self from all dependencies' subscriber list.
  4592. */
  4593. Watcher.prototype.teardown = function teardown () {
  4594. if (this.active) {
  4595. // remove self from vm's watcher list
  4596. // this is a somewhat expensive operation so we skip it
  4597. // if the vm is being destroyed.
  4598. if (!this.vm._isBeingDestroyed) {
  4599. remove(this.vm._watchers, this);
  4600. }
  4601. var i = this.deps.length;
  4602. while (i--) {
  4603. this.deps[i].removeSub(this);
  4604. }
  4605. this.active = false;
  4606. }
  4607. };
  4608.  
  4609. /* */
  4610.  
  4611. var sharedPropertyDefinition = {
  4612. enumerable: true,
  4613. configurable: true,
  4614. get: noop,
  4615. set: noop
  4616. };
  4617.  
  4618. function proxy (target, sourceKey, key) {
  4619. sharedPropertyDefinition.get = function proxyGetter () {
  4620. return this[sourceKey][key]
  4621. };
  4622. sharedPropertyDefinition.set = function proxySetter (val) {
  4623. this[sourceKey][key] = val;
  4624. };
  4625. Object.defineProperty(target, key, sharedPropertyDefinition);
  4626. }
  4627.  
  4628. function initState (vm) {
  4629. vm._watchers = [];
  4630. var opts = vm.$options;
  4631. if (opts.props) { initProps(vm, opts.props); }
  4632. if (opts.methods) { initMethods(vm, opts.methods); }
  4633. if (opts.data) {
  4634. initData(vm);
  4635. } else {
  4636. observe(vm._data = {}, true /* asRootData */);
  4637. }
  4638. if (opts.computed) { initComputed(vm, opts.computed); }
  4639. if (opts.watch && opts.watch !== nativeWatch) {
  4640. initWatch(vm, opts.watch);
  4641. }
  4642. }
  4643.  
  4644. function initProps (vm, propsOptions) {
  4645. var propsData = vm.$options.propsData || {};
  4646. var props = vm._props = {};
  4647. // cache prop keys so that future props updates can iterate using Array
  4648. // instead of dynamic object key enumeration.
  4649. var keys = vm.$options._propKeys = [];
  4650. var isRoot = !vm.$parent;
  4651. // root instance props should be converted
  4652. if (!isRoot) {
  4653. toggleObserving(false);
  4654. }
  4655. var loop = function ( key ) {
  4656. keys.push(key);
  4657. var value = validateProp(key, propsOptions, propsData, vm);
  4658. /* istanbul ignore else */
  4659. {
  4660. var hyphenatedKey = hyphenate(key);
  4661. if (isReservedAttribute(hyphenatedKey) ||
  4662. config.isReservedAttr(hyphenatedKey)) {
  4663. warn(
  4664. ("\"" + hyphenatedKey + "\" is a reserved attribute and cannot be used as component prop."),
  4665. vm
  4666. );
  4667. }
  4668. defineReactive$$1(props, key, value, function () {
  4669. if (!isRoot && !isUpdatingChildComponent) {
  4670. warn(
  4671. "Avoid mutating a prop directly since the value will be " +
  4672. "overwritten whenever the parent component re-renders. " +
  4673. "Instead, use a data or computed property based on the prop's " +
  4674. "value. Prop being mutated: \"" + key + "\"",
  4675. vm
  4676. );
  4677. }
  4678. });
  4679. }
  4680. // static props are already proxied on the component's prototype
  4681. // during Vue.extend(). We only need to proxy props defined at
  4682. // instantiation here.
  4683. if (!(key in vm)) {
  4684. proxy(vm, "_props", key);
  4685. }
  4686. };
  4687.  
  4688. for (var key in propsOptions) loop( key );
  4689. toggleObserving(true);
  4690. }
  4691.  
  4692. function initData (vm) {
  4693. var data = vm.$options.data;
  4694. data = vm._data = typeof data === 'function'
  4695. ? getData(data, vm)
  4696. : data || {};
  4697. if (!isPlainObject(data)) {
  4698. data = {};
  4699. warn(
  4700. 'data functions should return an object:\n' +
  4701. 'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
  4702. vm
  4703. );
  4704. }
  4705. // proxy data on instance
  4706. var keys = Object.keys(data);
  4707. var props = vm.$options.props;
  4708. var methods = vm.$options.methods;
  4709. var i = keys.length;
  4710. while (i--) {
  4711. var key = keys[i];
  4712. {
  4713. if (methods && hasOwn(methods, key)) {
  4714. warn(
  4715. ("Method \"" + key + "\" has already been defined as a data property."),
  4716. vm
  4717. );
  4718. }
  4719. }
  4720. if (props && hasOwn(props, key)) {
  4721. warn(
  4722. "The data property \"" + key + "\" is already declared as a prop. " +
  4723. "Use prop default value instead.",
  4724. vm
  4725. );
  4726. } else if (!isReserved(key)) {
  4727. proxy(vm, "_data", key);
  4728. }
  4729. }
  4730. // observe data
  4731. observe(data, true /* asRootData */);
  4732. }
  4733.  
  4734. function getData (data, vm) {
  4735. // #7573 disable dep collection when invoking data getters
  4736. pushTarget();
  4737. try {
  4738. return data.call(vm, vm)
  4739. } catch (e) {
  4740. handleError(e, vm, "data()");
  4741. return {}
  4742. } finally {
  4743. popTarget();
  4744. }
  4745. }
  4746.  
  4747. var computedWatcherOptions = { lazy: true };
  4748.  
  4749. function initComputed (vm, computed) {
  4750. // $flow-disable-line
  4751. var watchers = vm._computedWatchers = Object.create(null);
  4752. // computed properties are just getters during SSR
  4753. var isSSR = isServerRendering();
  4754.  
  4755. for (var key in computed) {
  4756. var userDef = computed[key];
  4757. var getter = typeof userDef === 'function' ? userDef : userDef.get;
  4758. if (getter == null) {
  4759. warn(
  4760. ("Getter is missing for computed property \"" + key + "\"."),
  4761. vm
  4762. );
  4763. }
  4764.  
  4765. if (!isSSR) {
  4766. // create internal watcher for the computed property.
  4767. watchers[key] = new Watcher(
  4768. vm,
  4769. getter || noop,
  4770. noop,
  4771. computedWatcherOptions
  4772. );
  4773. }
  4774.  
  4775. // component-defined computed properties are already defined on the
  4776. // component prototype. We only need to define computed properties defined
  4777. // at instantiation here.
  4778. if (!(key in vm)) {
  4779. defineComputed(vm, key, userDef);
  4780. } else {
  4781. if (key in vm.$data) {
  4782. warn(("The computed property \"" + key + "\" is already defined in data."), vm);
  4783. } else if (vm.$options.props && key in vm.$options.props) {
  4784. warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
  4785. }
  4786. }
  4787. }
  4788. }
  4789.  
  4790. function defineComputed (
  4791. target,
  4792. key,
  4793. userDef
  4794. ) {
  4795. var shouldCache = !isServerRendering();
  4796. if (typeof userDef === 'function') {
  4797. sharedPropertyDefinition.get = shouldCache
  4798. ? createComputedGetter(key)
  4799. : createGetterInvoker(userDef);
  4800. sharedPropertyDefinition.set = noop;
  4801. } else {
  4802. sharedPropertyDefinition.get = userDef.get
  4803. ? shouldCache && userDef.cache !== false
  4804. ? createComputedGetter(key)
  4805. : createGetterInvoker(userDef.get)
  4806. : noop;
  4807. sharedPropertyDefinition.set = userDef.set || noop;
  4808. }
  4809. if (sharedPropertyDefinition.set === noop) {
  4810. sharedPropertyDefinition.set = function () {
  4811. warn(
  4812. ("Computed property \"" + key + "\" was assigned to but it has no setter."),
  4813. this
  4814. );
  4815. };
  4816. }
  4817. Object.defineProperty(target, key, sharedPropertyDefinition);
  4818. }
  4819.  
  4820. function createComputedGetter (key) {
  4821. return function computedGetter () {
  4822. var watcher = this._computedWatchers && this._computedWatchers[key];
  4823. if (watcher) {
  4824. if (watcher.dirty) {
  4825. watcher.evaluate();
  4826. }
  4827. if (Dep.target) {
  4828. watcher.depend();
  4829. }
  4830. return watcher.value
  4831. }
  4832. }
  4833. }
  4834.  
  4835. function createGetterInvoker(fn) {
  4836. return function computedGetter () {
  4837. return fn.call(this, this)
  4838. }
  4839. }
  4840.  
  4841. function initMethods (vm, methods) {
  4842. var props = vm.$options.props;
  4843. for (var key in methods) {
  4844. {
  4845. if (typeof methods[key] !== 'function') {
  4846. warn(
  4847. "Method \"" + key + "\" has type \"" + (typeof methods[key]) + "\" in the component definition. " +
  4848. "Did you reference the function correctly?",
  4849. vm
  4850. );
  4851. }
  4852. if (props && hasOwn(props, key)) {
  4853. warn(
  4854. ("Method \"" + key + "\" has already been defined as a prop."),
  4855. vm
  4856. );
  4857. }
  4858. if ((key in vm) && isReserved(key)) {
  4859. warn(
  4860. "Method \"" + key + "\" conflicts with an existing Vue instance method. " +
  4861. "Avoid defining component methods that start with _ or $."
  4862. );
  4863. }
  4864. }
  4865. vm[key] = typeof methods[key] !== 'function' ? noop : bind(methods[key], vm);
  4866. }
  4867. }
  4868.  
  4869. function initWatch (vm, watch) {
  4870. for (var key in watch) {
  4871. var handler = watch[key];
  4872. if (Array.isArray(handler)) {
  4873. for (var i = 0; i < handler.length; i++) {
  4874. createWatcher(vm, key, handler[i]);
  4875. }
  4876. } else {
  4877. createWatcher(vm, key, handler);
  4878. }
  4879. }
  4880. }
  4881.  
  4882. function createWatcher (
  4883. vm,
  4884. expOrFn,
  4885. handler,
  4886. options
  4887. ) {
  4888. if (isPlainObject(handler)) {
  4889. options = handler;
  4890. handler = handler.handler;
  4891. }
  4892. if (typeof handler === 'string') {
  4893. handler = vm[handler];
  4894. }
  4895. return vm.$watch(expOrFn, handler, options)
  4896. }
  4897.  
  4898. function stateMixin (Vue) {
  4899. // flow somehow has problems with directly declared definition object
  4900. // when using Object.defineProperty, so we have to procedurally build up
  4901. // the object here.
  4902. var dataDef = {};
  4903. dataDef.get = function () { return this._data };
  4904. var propsDef = {};
  4905. propsDef.get = function () { return this._props };
  4906. {
  4907. dataDef.set = function () {
  4908. warn(
  4909. 'Avoid replacing instance root $data. ' +
  4910. 'Use nested data properties instead.',
  4911. this
  4912. );
  4913. };
  4914. propsDef.set = function () {
  4915. warn("$props is readonly.", this);
  4916. };
  4917. }
  4918. Object.defineProperty(Vue.prototype, '$data', dataDef);
  4919. Object.defineProperty(Vue.prototype, '$props', propsDef);
  4920.  
  4921. Vue.prototype.$set = set;
  4922. Vue.prototype.$delete = del;
  4923.  
  4924. Vue.prototype.$watch = function (
  4925. expOrFn,
  4926. cb,
  4927. options
  4928. ) {
  4929. var vm = this;
  4930. if (isPlainObject(cb)) {
  4931. return createWatcher(vm, expOrFn, cb, options)
  4932. }
  4933. options = options || {};
  4934. options.user = true;
  4935. var watcher = new Watcher(vm, expOrFn, cb, options);
  4936. if (options.immediate) {
  4937. try {
  4938. cb.call(vm, watcher.value);
  4939. } catch (error) {
  4940. handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
  4941. }
  4942. }
  4943. return function unwatchFn () {
  4944. watcher.teardown();
  4945. }
  4946. };
  4947. }
  4948.  
  4949. /* */
  4950.  
  4951. var uid$3 = 0;
  4952.  
  4953. function initMixin (Vue) {
  4954. Vue.prototype._init = function (options) {
  4955. var vm = this;
  4956. // a uid
  4957. vm._uid = uid$3++;
  4958.  
  4959. var startTag, endTag;
  4960. /* istanbul ignore if */
  4961. if (config.performance && mark) {
  4962. startTag = "vue-perf-start:" + (vm._uid);
  4963. endTag = "vue-perf-end:" + (vm._uid);
  4964. mark(startTag);
  4965. }
  4966.  
  4967. // a flag to avoid this being observed
  4968. vm._isVue = true;
  4969. // merge options
  4970. if (options && options._isComponent) {
  4971. // optimize internal component instantiation
  4972. // since dynamic options merging is pretty slow, and none of the
  4973. // internal component options needs special treatment.
  4974. initInternalComponent(vm, options);
  4975. } else {
  4976. vm.$options = mergeOptions(
  4977. resolveConstructorOptions(vm.constructor),
  4978. options || {},
  4979. vm
  4980. );
  4981. }
  4982. /* istanbul ignore else */
  4983. {
  4984. initProxy(vm);
  4985. }
  4986. // expose real self
  4987. vm._self = vm;
  4988. initLifecycle(vm);
  4989. initEvents(vm);
  4990. initRender(vm);
  4991. callHook(vm, 'beforeCreate');
  4992. initInjections(vm); // resolve injections before data/props
  4993. initState(vm);
  4994. initProvide(vm); // resolve provide after data/props
  4995. callHook(vm, 'created');
  4996.  
  4997. /* istanbul ignore if */
  4998. if (config.performance && mark) {
  4999. vm._name = formatComponentName(vm, false);
  5000. mark(endTag);
  5001. measure(("vue " + (vm._name) + " init"), startTag, endTag);
  5002. }
  5003.  
  5004. if (vm.$options.el) {
  5005. vm.$mount(vm.$options.el);
  5006. }
  5007. };
  5008. }
  5009.  
  5010. function initInternalComponent (vm, options) {
  5011. var opts = vm.$options = Object.create(vm.constructor.options);
  5012. // doing this because it's faster than dynamic enumeration.
  5013. var parentVnode = options._parentVnode;
  5014. opts.parent = options.parent;
  5015. opts._parentVnode = parentVnode;
  5016.  
  5017. var vnodeComponentOptions = parentVnode.componentOptions;
  5018. opts.propsData = vnodeComponentOptions.propsData;
  5019. opts._parentListeners = vnodeComponentOptions.listeners;
  5020. opts._renderChildren = vnodeComponentOptions.children;
  5021. opts._componentTag = vnodeComponentOptions.tag;
  5022.  
  5023. if (options.render) {
  5024. opts.render = options.render;
  5025. opts.staticRenderFns = options.staticRenderFns;
  5026. }
  5027. }
  5028.  
  5029. function resolveConstructorOptions (Ctor) {
  5030. var options = Ctor.options;
  5031. if (Ctor.super) {
  5032. var superOptions = resolveConstructorOptions(Ctor.super);
  5033. var cachedSuperOptions = Ctor.superOptions;
  5034. if (superOptions !== cachedSuperOptions) {
  5035. // super option changed,
  5036. // need to resolve new options.
  5037. Ctor.superOptions = superOptions;
  5038. // check if there are any late-modified/attached options (#4976)
  5039. var modifiedOptions = resolveModifiedOptions(Ctor);
  5040. // update base extend options
  5041. if (modifiedOptions) {
  5042. extend(Ctor.extendOptions, modifiedOptions);
  5043. }
  5044. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  5045. if (options.name) {
  5046. options.components[options.name] = Ctor;
  5047. }
  5048. }
  5049. }
  5050. return options
  5051. }
  5052.  
  5053. function resolveModifiedOptions (Ctor) {
  5054. var modified;
  5055. var latest = Ctor.options;
  5056. var sealed = Ctor.sealedOptions;
  5057. for (var key in latest) {
  5058. if (latest[key] !== sealed[key]) {
  5059. if (!modified) { modified = {}; }
  5060. modified[key] = latest[key];
  5061. }
  5062. }
  5063. return modified
  5064. }
  5065.  
  5066. function Vue (options) {
  5067. if (!(this instanceof Vue)
  5068. ) {
  5069. warn('Vue is a constructor and should be called with the `new` keyword');
  5070. }
  5071. this._init(options);
  5072. }
  5073.  
  5074. initMixin(Vue);
  5075. stateMixin(Vue);
  5076. eventsMixin(Vue);
  5077. lifecycleMixin(Vue);
  5078. renderMixin(Vue);
  5079.  
  5080. /* */
  5081.  
  5082. function initUse (Vue) {
  5083. Vue.use = function (plugin) {
  5084. var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
  5085. if (installedPlugins.indexOf(plugin) > -1) {
  5086. return this
  5087. }
  5088.  
  5089. // additional parameters
  5090. var args = toArray(arguments, 1);
  5091. args.unshift(this);
  5092. if (typeof plugin.install === 'function') {
  5093. plugin.install.apply(plugin, args);
  5094. } else if (typeof plugin === 'function') {
  5095. plugin.apply(null, args);
  5096. }
  5097. installedPlugins.push(plugin);
  5098. return this
  5099. };
  5100. }
  5101.  
  5102. /* */
  5103.  
  5104. function initMixin$1 (Vue) {
  5105. Vue.mixin = function (mixin) {
  5106. this.options = mergeOptions(this.options, mixin);
  5107. return this
  5108. };
  5109. }
  5110.  
  5111. /* */
  5112.  
  5113. function initExtend (Vue) {
  5114. /**
  5115. * Each instance constructor, including Vue, has a unique
  5116. * cid. This enables us to create wrapped "child
  5117. * constructors" for prototypal inheritance and cache them.
  5118. */
  5119. Vue.cid = 0;
  5120. var cid = 1;
  5121.  
  5122. /**
  5123. * Class inheritance
  5124. */
  5125. Vue.extend = function (extendOptions) {
  5126. extendOptions = extendOptions || {};
  5127. var Super = this;
  5128. var SuperId = Super.cid;
  5129. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  5130. if (cachedCtors[SuperId]) {
  5131. return cachedCtors[SuperId]
  5132. }
  5133.  
  5134. var name = extendOptions.name || Super.options.name;
  5135. if (name) {
  5136. validateComponentName(name);
  5137. }
  5138.  
  5139. var Sub = function VueComponent (options) {
  5140. this._init(options);
  5141. };
  5142. Sub.prototype = Object.create(Super.prototype);
  5143. Sub.prototype.constructor = Sub;
  5144. Sub.cid = cid++;
  5145. Sub.options = mergeOptions(
  5146. Super.options,
  5147. extendOptions
  5148. );
  5149. Sub['super'] = Super;
  5150.  
  5151. // For props and computed properties, we define the proxy getters on
  5152. // the Vue instances at extension time, on the extended prototype. This
  5153. // avoids Object.defineProperty calls for each instance created.
  5154. if (Sub.options.props) {
  5155. initProps$1(Sub);
  5156. }
  5157. if (Sub.options.computed) {
  5158. initComputed$1(Sub);
  5159. }
  5160.  
  5161. // allow further extension/mixin/plugin usage
  5162. Sub.extend = Super.extend;
  5163. Sub.mixin = Super.mixin;
  5164. Sub.use = Super.use;
  5165.  
  5166. // create asset registers, so extended classes
  5167. // can have their private assets too.
  5168. ASSET_TYPES.forEach(function (type) {
  5169. Sub[type] = Super[type];
  5170. });
  5171. // enable recursive self-lookup
  5172. if (name) {
  5173. Sub.options.components[name] = Sub;
  5174. }
  5175.  
  5176. // keep a reference to the super options at extension time.
  5177. // later at instantiation we can check if Super's options have
  5178. // been updated.
  5179. Sub.superOptions = Super.options;
  5180. Sub.extendOptions = extendOptions;
  5181. Sub.sealedOptions = extend({}, Sub.options);
  5182.  
  5183. // cache constructor
  5184. cachedCtors[SuperId] = Sub;
  5185. return Sub
  5186. };
  5187. }
  5188.  
  5189. function initProps$1 (Comp) {
  5190. var props = Comp.options.props;
  5191. for (var key in props) {
  5192. proxy(Comp.prototype, "_props", key);
  5193. }
  5194. }
  5195.  
  5196. function initComputed$1 (Comp) {
  5197. var computed = Comp.options.computed;
  5198. for (var key in computed) {
  5199. defineComputed(Comp.prototype, key, computed[key]);
  5200. }
  5201. }
  5202.  
  5203. /* */
  5204.  
  5205. function initAssetRegisters (Vue) {
  5206. /**
  5207. * Create asset registration methods.
  5208. */
  5209. ASSET_TYPES.forEach(function (type) {
  5210. Vue[type] = function (
  5211. id,
  5212. definition
  5213. ) {
  5214. if (!definition) {
  5215. return this.options[type + 's'][id]
  5216. } else {
  5217. /* istanbul ignore if */
  5218. if (type === 'component') {
  5219. validateComponentName(id);
  5220. }
  5221. if (type === 'component' && isPlainObject(definition)) {
  5222. definition.name = definition.name || id;
  5223. definition = this.options._base.extend(definition);
  5224. }
  5225. if (type === 'directive' && typeof definition === 'function') {
  5226. definition = { bind: definition, update: definition };
  5227. }
  5228. this.options[type + 's'][id] = definition;
  5229. return definition
  5230. }
  5231. };
  5232. });
  5233. }
  5234.  
  5235. /* */
  5236.  
  5237.  
  5238.  
  5239. function getComponentName (opts) {
  5240. return opts && (opts.Ctor.options.name || opts.tag)
  5241. }
  5242.  
  5243. function matches (pattern, name) {
  5244. if (Array.isArray(pattern)) {
  5245. return pattern.indexOf(name) > -1
  5246. } else if (typeof pattern === 'string') {
  5247. return pattern.split(',').indexOf(name) > -1
  5248. } else if (isRegExp(pattern)) {
  5249. return pattern.test(name)
  5250. }
  5251. /* istanbul ignore next */
  5252. return false
  5253. }
  5254.  
  5255. function pruneCache (keepAliveInstance, filter) {
  5256. var cache = keepAliveInstance.cache;
  5257. var keys = keepAliveInstance.keys;
  5258. var _vnode = keepAliveInstance._vnode;
  5259. for (var key in cache) {
  5260. var cachedNode = cache[key];
  5261. if (cachedNode) {
  5262. var name = getComponentName(cachedNode.componentOptions);
  5263. if (name && !filter(name)) {
  5264. pruneCacheEntry(cache, key, keys, _vnode);
  5265. }
  5266. }
  5267. }
  5268. }
  5269.  
  5270. function pruneCacheEntry (
  5271. cache,
  5272. key,
  5273. keys,
  5274. current
  5275. ) {
  5276. var cached$$1 = cache[key];
  5277. if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
  5278. cached$$1.componentInstance.$destroy();
  5279. }
  5280. cache[key] = null;
  5281. remove(keys, key);
  5282. }
  5283.  
  5284. var patternTypes = [String, RegExp, Array];
  5285.  
  5286. var KeepAlive = {
  5287. name: 'keep-alive',
  5288. abstract: true,
  5289.  
  5290. props: {
  5291. include: patternTypes,
  5292. exclude: patternTypes,
  5293. max: [String, Number]
  5294. },
  5295.  
  5296. created: function created () {
  5297. this.cache = Object.create(null);
  5298. this.keys = [];
  5299. },
  5300.  
  5301. destroyed: function destroyed () {
  5302. for (var key in this.cache) {
  5303. pruneCacheEntry(this.cache, key, this.keys);
  5304. }
  5305. },
  5306.  
  5307. mounted: function mounted () {
  5308. var this$1 = this;
  5309.  
  5310. this.$watch('include', function (val) {
  5311. pruneCache(this$1, function (name) { return matches(val, name); });
  5312. });
  5313. this.$watch('exclude', function (val) {
  5314. pruneCache(this$1, function (name) { return !matches(val, name); });
  5315. });
  5316. },
  5317.  
  5318. render: function render () {
  5319. var slot = this.$slots.default;
  5320. var vnode = getFirstComponentChild(slot);
  5321. var componentOptions = vnode && vnode.componentOptions;
  5322. if (componentOptions) {
  5323. // check pattern
  5324. var name = getComponentName(componentOptions);
  5325. var ref = this;
  5326. var include = ref.include;
  5327. var exclude = ref.exclude;
  5328. if (
  5329. // not included
  5330. (include && (!name || !matches(include, name))) ||
  5331. // excluded
  5332. (exclude && name && matches(exclude, name))
  5333. ) {
  5334. return vnode
  5335. }
  5336.  
  5337. var ref$1 = this;
  5338. var cache = ref$1.cache;
  5339. var keys = ref$1.keys;
  5340. var key = vnode.key == null
  5341. // same constructor may get registered as different local components
  5342. // so cid alone is not enough (#3269)
  5343. ? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
  5344. : vnode.key;
  5345. if (cache[key]) {
  5346. vnode.componentInstance = cache[key].componentInstance;
  5347. // make current key freshest
  5348. remove(keys, key);
  5349. keys.push(key);
  5350. } else {
  5351. cache[key] = vnode;
  5352. keys.push(key);
  5353. // prune oldest entry
  5354. if (this.max && keys.length > parseInt(this.max)) {
  5355. pruneCacheEntry(cache, keys[0], keys, this._vnode);
  5356. }
  5357. }
  5358.  
  5359. vnode.data.keepAlive = true;
  5360. }
  5361. return vnode || (slot && slot[0])
  5362. }
  5363. };
  5364.  
  5365. var builtInComponents = {
  5366. KeepAlive: KeepAlive
  5367. };
  5368.  
  5369. /* */
  5370.  
  5371. function initGlobalAPI (Vue) {
  5372. // config
  5373. var configDef = {};
  5374. configDef.get = function () { return config; };
  5375. {
  5376. configDef.set = function () {
  5377. warn(
  5378. 'Do not replace the Vue.config object, set individual fields instead.'
  5379. );
  5380. };
  5381. }
  5382. Object.defineProperty(Vue, 'config', configDef);
  5383.  
  5384. // exposed util methods.
  5385. // NOTE: these are not considered part of the public API - avoid relying on
  5386. // them unless you are aware of the risk.
  5387. Vue.util = {
  5388. warn: warn,
  5389. extend: extend,
  5390. mergeOptions: mergeOptions,
  5391. defineReactive: defineReactive$$1
  5392. };
  5393.  
  5394. Vue.set = set;
  5395. Vue.delete = del;
  5396. Vue.nextTick = nextTick;
  5397.  
  5398. // 2.6 explicit observable API
  5399. Vue.observable = function (obj) {
  5400. observe(obj);
  5401. return obj
  5402. };
  5403.  
  5404. Vue.options = Object.create(null);
  5405. ASSET_TYPES.forEach(function (type) {
  5406. Vue.options[type + 's'] = Object.create(null);
  5407. });
  5408.  
  5409. // this is used to identify the "base" constructor to extend all plain-object
  5410. // components with in Weex's multi-instance scenarios.
  5411. Vue.options._base = Vue;
  5412.  
  5413. extend(Vue.options.components, builtInComponents);
  5414.  
  5415. initUse(Vue);
  5416. initMixin$1(Vue);
  5417. initExtend(Vue);
  5418. initAssetRegisters(Vue);
  5419. }
  5420.  
  5421. initGlobalAPI(Vue);
  5422.  
  5423. Object.defineProperty(Vue.prototype, '$isServer', {
  5424. get: isServerRendering
  5425. });
  5426.  
  5427. Object.defineProperty(Vue.prototype, '$ssrContext', {
  5428. get: function get () {
  5429. /* istanbul ignore next */
  5430. return this.$vnode && this.$vnode.ssrContext
  5431. }
  5432. });
  5433.  
  5434. // expose FunctionalRenderContext for ssr runtime helper installation
  5435. Object.defineProperty(Vue, 'FunctionalRenderContext', {
  5436. value: FunctionalRenderContext
  5437. });
  5438.  
  5439. Vue.version = '2.6.10';
  5440.  
  5441. /* */
  5442.  
  5443. // these are reserved for web because they are directly compiled away
  5444. // during template compilation
  5445. var isReservedAttr = makeMap('style,class');
  5446.  
  5447. // attributes that should be using props for binding
  5448. var acceptValue = makeMap('input,textarea,option,select,progress');
  5449. var mustUseProp = function (tag, type, attr) {
  5450. return (
  5451. (attr === 'value' && acceptValue(tag)) && type !== 'button' ||
  5452. (attr === 'selected' && tag === 'option') ||
  5453. (attr === 'checked' && tag === 'input') ||
  5454. (attr === 'muted' && tag === 'video')
  5455. )
  5456. };
  5457.  
  5458. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  5459.  
  5460. var isValidContentEditableValue = makeMap('events,caret,typing,plaintext-only');
  5461.  
  5462. var convertEnumeratedValue = function (key, value) {
  5463. return isFalsyAttrValue(value) || value === 'false'
  5464. ? 'false'
  5465. // allow arbitrary string value for contenteditable
  5466. : key === 'contenteditable' && isValidContentEditableValue(value)
  5467. ? value
  5468. : 'true'
  5469. };
  5470.  
  5471. var isBooleanAttr = makeMap(
  5472. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  5473. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  5474. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  5475. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  5476. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  5477. 'truespeed,typemustmatch,visible'
  5478. );
  5479.  
  5480. var xlinkNS = 'http://www.w3.org/1999/xlink';
  5481.  
  5482. var isXlink = function (name) {
  5483. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  5484. };
  5485.  
  5486. var getXlinkProp = function (name) {
  5487. return isXlink(name) ? name.slice(6, name.length) : ''
  5488. };
  5489.  
  5490. var isFalsyAttrValue = function (val) {
  5491. return val == null || val === false
  5492. };
  5493.  
  5494. /* */
  5495.  
  5496. function genClassForVnode (vnode) {
  5497. var data = vnode.data;
  5498. var parentNode = vnode;
  5499. var childNode = vnode;
  5500. while (isDef(childNode.componentInstance)) {
  5501. childNode = childNode.componentInstance._vnode;
  5502. if (childNode && childNode.data) {
  5503. data = mergeClassData(childNode.data, data);
  5504. }
  5505. }
  5506. while (isDef(parentNode = parentNode.parent)) {
  5507. if (parentNode && parentNode.data) {
  5508. data = mergeClassData(data, parentNode.data);
  5509. }
  5510. }
  5511. return renderClass(data.staticClass, data.class)
  5512. }
  5513.  
  5514. function mergeClassData (child, parent) {
  5515. return {
  5516. staticClass: concat(child.staticClass, parent.staticClass),
  5517. class: isDef(child.class)
  5518. ? [child.class, parent.class]
  5519. : parent.class
  5520. }
  5521. }
  5522.  
  5523. function renderClass (
  5524. staticClass,
  5525. dynamicClass
  5526. ) {
  5527. if (isDef(staticClass) || isDef(dynamicClass)) {
  5528. return concat(staticClass, stringifyClass(dynamicClass))
  5529. }
  5530. /* istanbul ignore next */
  5531. return ''
  5532. }
  5533.  
  5534. function concat (a, b) {
  5535. return a ? b ? (a + ' ' + b) : a : (b || '')
  5536. }
  5537.  
  5538. function stringifyClass (value) {
  5539. if (Array.isArray(value)) {
  5540. return stringifyArray(value)
  5541. }
  5542. if (isObject(value)) {
  5543. return stringifyObject(value)
  5544. }
  5545. if (typeof value === 'string') {
  5546. return value
  5547. }
  5548. /* istanbul ignore next */
  5549. return ''
  5550. }
  5551.  
  5552. function stringifyArray (value) {
  5553. var res = '';
  5554. var stringified;
  5555. for (var i = 0, l = value.length; i < l; i++) {
  5556. if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
  5557. if (res) { res += ' '; }
  5558. res += stringified;
  5559. }
  5560. }
  5561. return res
  5562. }
  5563.  
  5564. function stringifyObject (value) {
  5565. var res = '';
  5566. for (var key in value) {
  5567. if (value[key]) {
  5568. if (res) { res += ' '; }
  5569. res += key;
  5570. }
  5571. }
  5572. return res
  5573. }
  5574.  
  5575. /* */
  5576.  
  5577. var namespaceMap = {
  5578. svg: 'http://www.w3.org/2000/svg',
  5579. math: 'http://www.w3.org/1998/Math/MathML'
  5580. };
  5581.  
  5582. var isHTMLTag = makeMap(
  5583. 'html,body,base,head,link,meta,style,title,' +
  5584. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  5585. 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
  5586. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  5587. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  5588. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  5589. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  5590. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  5591. 'output,progress,select,textarea,' +
  5592. 'details,dialog,menu,menuitem,summary,' +
  5593. 'content,element,shadow,template,blockquote,iframe,tfoot'
  5594. );
  5595.  
  5596. // this map is intentionally selective, only covering SVG elements that may
  5597. // contain child elements.
  5598. var isSVG = makeMap(
  5599. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
  5600. 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  5601. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  5602. true
  5603. );
  5604.  
  5605. var isPreTag = function (tag) { return tag === 'pre'; };
  5606.  
  5607. var isReservedTag = function (tag) {
  5608. return isHTMLTag(tag) || isSVG(tag)
  5609. };
  5610.  
  5611. function getTagNamespace (tag) {
  5612. if (isSVG(tag)) {
  5613. return 'svg'
  5614. }
  5615. // basic support for MathML
  5616. // note it doesn't support other MathML elements being component roots
  5617. if (tag === 'math') {
  5618. return 'math'
  5619. }
  5620. }
  5621.  
  5622. var unknownElementCache = Object.create(null);
  5623. function isUnknownElement (tag) {
  5624. /* istanbul ignore if */
  5625. if (!inBrowser) {
  5626. return true
  5627. }
  5628. if (isReservedTag(tag)) {
  5629. return false
  5630. }
  5631. tag = tag.toLowerCase();
  5632. /* istanbul ignore if */
  5633. if (unknownElementCache[tag] != null) {
  5634. return unknownElementCache[tag]
  5635. }
  5636. var el = document.createElement(tag);
  5637. if (tag.indexOf('-') > -1) {
  5638. // http://stackoverflow.com/a/28210364/1070244
  5639. return (unknownElementCache[tag] = (
  5640. el.constructor === window.HTMLUnknownElement ||
  5641. el.constructor === window.HTMLElement
  5642. ))
  5643. } else {
  5644. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  5645. }
  5646. }
  5647.  
  5648. var isTextInputType = makeMap('text,number,password,search,email,tel,url');
  5649.  
  5650. /* */
  5651.  
  5652. /**
  5653. * Query an element selector if it's not an element already.
  5654. */
  5655. function query (el) {
  5656. if (typeof el === 'string') {
  5657. var selected = document.querySelector(el);
  5658. if (!selected) {
  5659. warn(
  5660. 'Cannot find element: ' + el
  5661. );
  5662. return document.createElement('div')
  5663. }
  5664. return selected
  5665. } else {
  5666. return el
  5667. }
  5668. }
  5669.  
  5670. /* */
  5671.  
  5672. function createElement$1 (tagName, vnode) {
  5673. var elm = document.createElement(tagName);
  5674. if (tagName !== 'select') {
  5675. return elm
  5676. }
  5677. // false or null will remove the attribute but undefined will not
  5678. if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
  5679. elm.setAttribute('multiple', 'multiple');
  5680. }
  5681. return elm
  5682. }
  5683.  
  5684. function createElementNS (namespace, tagName) {
  5685. return document.createElementNS(namespaceMap[namespace], tagName)
  5686. }
  5687.  
  5688. function createTextNode (text) {
  5689. return document.createTextNode(text)
  5690. }
  5691.  
  5692. function createComment (text) {
  5693. return document.createComment(text)
  5694. }
  5695.  
  5696. function insertBefore (parentNode, newNode, referenceNode) {
  5697. parentNode.insertBefore(newNode, referenceNode);
  5698. }
  5699.  
  5700. function removeChild (node, child) {
  5701. node.removeChild(child);
  5702. }
  5703.  
  5704. function appendChild (node, child) {
  5705. node.appendChild(child);
  5706. }
  5707.  
  5708. function parentNode (node) {
  5709. return node.parentNode
  5710. }
  5711.  
  5712. function nextSibling (node) {
  5713. return node.nextSibling
  5714. }
  5715.  
  5716. function tagName (node) {
  5717. return node.tagName
  5718. }
  5719.  
  5720. function setTextContent (node, text) {
  5721. node.textContent = text;
  5722. }
  5723.  
  5724. function setStyleScope (node, scopeId) {
  5725. node.setAttribute(scopeId, '');
  5726. }
  5727.  
  5728. var nodeOps = /*#__PURE__*/Object.freeze({
  5729. createElement: createElement$1,
  5730. createElementNS: createElementNS,
  5731. createTextNode: createTextNode,
  5732. createComment: createComment,
  5733. insertBefore: insertBefore,
  5734. removeChild: removeChild,
  5735. appendChild: appendChild,
  5736. parentNode: parentNode,
  5737. nextSibling: nextSibling,
  5738. tagName: tagName,
  5739. setTextContent: setTextContent,
  5740. setStyleScope: setStyleScope
  5741. });
  5742.  
  5743. /* */
  5744.  
  5745. var ref = {
  5746. create: function create (_, vnode) {
  5747. registerRef(vnode);
  5748. },
  5749. update: function update (oldVnode, vnode) {
  5750. if (oldVnode.data.ref !== vnode.data.ref) {
  5751. registerRef(oldVnode, true);
  5752. registerRef(vnode);
  5753. }
  5754. },
  5755. destroy: function destroy (vnode) {
  5756. registerRef(vnode, true);
  5757. }
  5758. };
  5759.  
  5760. function registerRef (vnode, isRemoval) {
  5761. var key = vnode.data.ref;
  5762. if (!isDef(key)) { return }
  5763.  
  5764. var vm = vnode.context;
  5765. var ref = vnode.componentInstance || vnode.elm;
  5766. var refs = vm.$refs;
  5767. if (isRemoval) {
  5768. if (Array.isArray(refs[key])) {
  5769. remove(refs[key], ref);
  5770. } else if (refs[key] === ref) {
  5771. refs[key] = undefined;
  5772. }
  5773. } else {
  5774. if (vnode.data.refInFor) {
  5775. if (!Array.isArray(refs[key])) {
  5776. refs[key] = [ref];
  5777. } else if (refs[key].indexOf(ref) < 0) {
  5778. // $flow-disable-line
  5779. refs[key].push(ref);
  5780. }
  5781. } else {
  5782. refs[key] = ref;
  5783. }
  5784. }
  5785. }
  5786.  
  5787. /**
  5788. * Virtual DOM patching algorithm based on Snabbdom by
  5789. * Simon Friis Vindum (@paldepind)
  5790. * Licensed under the MIT License
  5791. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  5792. *
  5793. * modified by Evan You (@yyx990803)
  5794. *
  5795. * Not type-checking this because this file is perf-critical and the cost
  5796. * of making flow understand it is not worth it.
  5797. */
  5798.  
  5799. var emptyNode = new VNode('', {}, []);
  5800.  
  5801. var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
  5802.  
  5803. function sameVnode (a, b) {
  5804. return (
  5805. a.key === b.key && (
  5806. (
  5807. a.tag === b.tag &&
  5808. a.isComment === b.isComment &&
  5809. isDef(a.data) === isDef(b.data) &&
  5810. sameInputType(a, b)
  5811. ) || (
  5812. isTrue(a.isAsyncPlaceholder) &&
  5813. a.asyncFactory === b.asyncFactory &&
  5814. isUndef(b.asyncFactory.error)
  5815. )
  5816. )
  5817. )
  5818. }
  5819.  
  5820. function sameInputType (a, b) {
  5821. if (a.tag !== 'input') { return true }
  5822. var i;
  5823. var typeA = isDef(i = a.data) && isDef(i = i.attrs) && i.type;
  5824. var typeB = isDef(i = b.data) && isDef(i = i.attrs) && i.type;
  5825. return typeA === typeB || isTextInputType(typeA) && isTextInputType(typeB)
  5826. }
  5827.  
  5828. function createKeyToOldIdx (children, beginIdx, endIdx) {
  5829. var i, key;
  5830. var map = {};
  5831. for (i = beginIdx; i <= endIdx; ++i) {
  5832. key = children[i].key;
  5833. if (isDef(key)) { map[key] = i; }
  5834. }
  5835. return map
  5836. }
  5837.  
  5838. function createPatchFunction (backend) {
  5839. var i, j;
  5840. var cbs = {};
  5841.  
  5842. var modules = backend.modules;
  5843. var nodeOps = backend.nodeOps;
  5844.  
  5845. for (i = 0; i < hooks.length; ++i) {
  5846. cbs[hooks[i]] = [];
  5847. for (j = 0; j < modules.length; ++j) {
  5848. if (isDef(modules[j][hooks[i]])) {
  5849. cbs[hooks[i]].push(modules[j][hooks[i]]);
  5850. }
  5851. }
  5852. }
  5853.  
  5854. function emptyNodeAt (elm) {
  5855. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  5856. }
  5857.  
  5858. function createRmCb (childElm, listeners) {
  5859. function remove$$1 () {
  5860. if (--remove$$1.listeners === 0) {
  5861. removeNode(childElm);
  5862. }
  5863. }
  5864. remove$$1.listeners = listeners;
  5865. return remove$$1
  5866. }
  5867.  
  5868. function removeNode (el) {
  5869. var parent = nodeOps.parentNode(el);
  5870. // element may have already been removed due to v-html / v-text
  5871. if (isDef(parent)) {
  5872. nodeOps.removeChild(parent, el);
  5873. }
  5874. }
  5875.  
  5876. function isUnknownElement$$1 (vnode, inVPre) {
  5877. return (
  5878. !inVPre &&
  5879. !vnode.ns &&
  5880. !(
  5881. config.ignoredElements.length &&
  5882. config.ignoredElements.some(function (ignore) {
  5883. return isRegExp(ignore)
  5884. ? ignore.test(vnode.tag)
  5885. : ignore === vnode.tag
  5886. })
  5887. ) &&
  5888. config.isUnknownElement(vnode.tag)
  5889. )
  5890. }
  5891.  
  5892. var creatingElmInVPre = 0;
  5893.  
  5894. function createElm (
  5895. vnode,
  5896. insertedVnodeQueue,
  5897. parentElm,
  5898. refElm,
  5899. nested,
  5900. ownerArray,
  5901. index
  5902. ) {
  5903. if (isDef(vnode.elm) && isDef(ownerArray)) {
  5904. // This vnode was used in a previous render!
  5905. // now it's used as a new node, overwriting its elm would cause
  5906. // potential patch errors down the road when it's used as an insertion
  5907. // reference node. Instead, we clone the node on-demand before creating
  5908. // associated DOM element for it.
  5909. vnode = ownerArray[index] = cloneVNode(vnode);
  5910. }
  5911.  
  5912. vnode.isRootInsert = !nested; // for transition enter check
  5913. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  5914. return
  5915. }
  5916.  
  5917. var data = vnode.data;
  5918. var children = vnode.children;
  5919. var tag = vnode.tag;
  5920. if (isDef(tag)) {
  5921. {
  5922. if (data && data.pre) {
  5923. creatingElmInVPre++;
  5924. }
  5925. if (isUnknownElement$$1(vnode, creatingElmInVPre)) {
  5926. warn(
  5927. 'Unknown custom element: <' + tag + '> - did you ' +
  5928. 'register the component correctly? For recursive components, ' +
  5929. 'make sure to provide the "name" option.',
  5930. vnode.context
  5931. );
  5932. }
  5933. }
  5934.  
  5935. vnode.elm = vnode.ns
  5936. ? nodeOps.createElementNS(vnode.ns, tag)
  5937. : nodeOps.createElement(tag, vnode);
  5938. setScope(vnode);
  5939.  
  5940. /* istanbul ignore if */
  5941. {
  5942. createChildren(vnode, children, insertedVnodeQueue);
  5943. if (isDef(data)) {
  5944. invokeCreateHooks(vnode, insertedVnodeQueue);
  5945. }
  5946. insert(parentElm, vnode.elm, refElm);
  5947. }
  5948.  
  5949. if (data && data.pre) {
  5950. creatingElmInVPre--;
  5951. }
  5952. } else if (isTrue(vnode.isComment)) {
  5953. vnode.elm = nodeOps.createComment(vnode.text);
  5954. insert(parentElm, vnode.elm, refElm);
  5955. } else {
  5956. vnode.elm = nodeOps.createTextNode(vnode.text);
  5957. insert(parentElm, vnode.elm, refElm);
  5958. }
  5959. }
  5960.  
  5961. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  5962. var i = vnode.data;
  5963. if (isDef(i)) {
  5964. var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
  5965. if (isDef(i = i.hook) && isDef(i = i.init)) {
  5966. i(vnode, false /* hydrating */);
  5967. }
  5968. // after calling the init hook, if the vnode is a child component
  5969. // it should've created a child instance and mounted it. the child
  5970. // component also has set the placeholder vnode's elm.
  5971. // in that case we can just return the element and be done.
  5972. if (isDef(vnode.componentInstance)) {
  5973. initComponent(vnode, insertedVnodeQueue);
  5974. insert(parentElm, vnode.elm, refElm);
  5975. if (isTrue(isReactivated)) {
  5976. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  5977. }
  5978. return true
  5979. }
  5980. }
  5981. }
  5982.  
  5983. function initComponent (vnode, insertedVnodeQueue) {
  5984. if (isDef(vnode.data.pendingInsert)) {
  5985. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  5986. vnode.data.pendingInsert = null;
  5987. }
  5988. vnode.elm = vnode.componentInstance.$el;
  5989. if (isPatchable(vnode)) {
  5990. invokeCreateHooks(vnode, insertedVnodeQueue);
  5991. setScope(vnode);
  5992. } else {
  5993. // empty component root.
  5994. // skip all element-related modules except for ref (#3455)
  5995. registerRef(vnode);
  5996. // make sure to invoke the insert hook
  5997. insertedVnodeQueue.push(vnode);
  5998. }
  5999. }
  6000.  
  6001. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  6002. var i;
  6003. // hack for #4339: a reactivated component with inner transition
  6004. // does not trigger because the inner node's created hooks are not called
  6005. // again. It's not ideal to involve module-specific logic in here but
  6006. // there doesn't seem to be a better way to do it.
  6007. var innerNode = vnode;
  6008. while (innerNode.componentInstance) {
  6009. innerNode = innerNode.componentInstance._vnode;
  6010. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  6011. for (i = 0; i < cbs.activate.length; ++i) {
  6012. cbs.activate[i](emptyNode, innerNode);
  6013. }
  6014. insertedVnodeQueue.push(innerNode);
  6015. break
  6016. }
  6017. }
  6018. // unlike a newly created component,
  6019. // a reactivated keep-alive component doesn't insert itself
  6020. insert(parentElm, vnode.elm, refElm);
  6021. }
  6022.  
  6023. function insert (parent, elm, ref$$1) {
  6024. if (isDef(parent)) {
  6025. if (isDef(ref$$1)) {
  6026. if (nodeOps.parentNode(ref$$1) === parent) {
  6027. nodeOps.insertBefore(parent, elm, ref$$1);
  6028. }
  6029. } else {
  6030. nodeOps.appendChild(parent, elm);
  6031. }
  6032. }
  6033. }
  6034.  
  6035. function createChildren (vnode, children, insertedVnodeQueue) {
  6036. if (Array.isArray(children)) {
  6037. {
  6038. checkDuplicateKeys(children);
  6039. }
  6040. for (var i = 0; i < children.length; ++i) {
  6041. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true, children, i);
  6042. }
  6043. } else if (isPrimitive(vnode.text)) {
  6044. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(String(vnode.text)));
  6045. }
  6046. }
  6047.  
  6048. function isPatchable (vnode) {
  6049. while (vnode.componentInstance) {
  6050. vnode = vnode.componentInstance._vnode;
  6051. }
  6052. return isDef(vnode.tag)
  6053. }
  6054.  
  6055. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  6056. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  6057. cbs.create[i$1](emptyNode, vnode);
  6058. }
  6059. i = vnode.data.hook; // Reuse variable
  6060. if (isDef(i)) {
  6061. if (isDef(i.create)) { i.create(emptyNode, vnode); }
  6062. if (isDef(i.insert)) { insertedVnodeQueue.push(vnode); }
  6063. }
  6064. }
  6065.  
  6066. // set scope id attribute for scoped CSS.
  6067. // this is implemented as a special case to avoid the overhead
  6068. // of going through the normal attribute patching process.
  6069. function setScope (vnode) {
  6070. var i;
  6071. if (isDef(i = vnode.fnScopeId)) {
  6072. nodeOps.setStyleScope(vnode.elm, i);
  6073. } else {
  6074. var ancestor = vnode;
  6075. while (ancestor) {
  6076. if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
  6077. nodeOps.setStyleScope(vnode.elm, i);
  6078. }
  6079. ancestor = ancestor.parent;
  6080. }
  6081. }
  6082. // for slot content they should also get the scopeId from the host instance.
  6083. if (isDef(i = activeInstance) &&
  6084. i !== vnode.context &&
  6085. i !== vnode.fnContext &&
  6086. isDef(i = i.$options._scopeId)
  6087. ) {
  6088. nodeOps.setStyleScope(vnode.elm, i);
  6089. }
  6090. }
  6091.  
  6092. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  6093. for (; startIdx <= endIdx; ++startIdx) {
  6094. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm, false, vnodes, startIdx);
  6095. }
  6096. }
  6097.  
  6098. function invokeDestroyHook (vnode) {
  6099. var i, j;
  6100. var data = vnode.data;
  6101. if (isDef(data)) {
  6102. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  6103. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  6104. }
  6105. if (isDef(i = vnode.children)) {
  6106. for (j = 0; j < vnode.children.length; ++j) {
  6107. invokeDestroyHook(vnode.children[j]);
  6108. }
  6109. }
  6110. }
  6111.  
  6112. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  6113. for (; startIdx <= endIdx; ++startIdx) {
  6114. var ch = vnodes[startIdx];
  6115. if (isDef(ch)) {
  6116. if (isDef(ch.tag)) {
  6117. removeAndInvokeRemoveHook(ch);
  6118. invokeDestroyHook(ch);
  6119. } else { // Text node
  6120. removeNode(ch.elm);
  6121. }
  6122. }
  6123. }
  6124. }
  6125.  
  6126. function removeAndInvokeRemoveHook (vnode, rm) {
  6127. if (isDef(rm) || isDef(vnode.data)) {
  6128. var i;
  6129. var listeners = cbs.remove.length + 1;
  6130. if (isDef(rm)) {
  6131. // we have a recursively passed down rm callback
  6132. // increase the listeners count
  6133. rm.listeners += listeners;
  6134. } else {
  6135. // directly removing
  6136. rm = createRmCb(vnode.elm, listeners);
  6137. }
  6138. // recursively invoke hooks on child component root node
  6139. if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
  6140. removeAndInvokeRemoveHook(i, rm);
  6141. }
  6142. for (i = 0; i < cbs.remove.length; ++i) {
  6143. cbs.remove[i](vnode, rm);
  6144. }
  6145. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  6146. i(vnode, rm);
  6147. } else {
  6148. rm();
  6149. }
  6150. } else {
  6151. removeNode(vnode.elm);
  6152. }
  6153. }
  6154.  
  6155. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  6156. var oldStartIdx = 0;
  6157. var newStartIdx = 0;
  6158. var oldEndIdx = oldCh.length - 1;
  6159. var oldStartVnode = oldCh[0];
  6160. var oldEndVnode = oldCh[oldEndIdx];
  6161. var newEndIdx = newCh.length - 1;
  6162. var newStartVnode = newCh[0];
  6163. var newEndVnode = newCh[newEndIdx];
  6164. var oldKeyToIdx, idxInOld, vnodeToMove, refElm;
  6165.  
  6166. // removeOnly is a special flag used only by <transition-group>
  6167. // to ensure removed elements stay in correct relative positions
  6168. // during leaving transitions
  6169. var canMove = !removeOnly;
  6170.  
  6171. {
  6172. checkDuplicateKeys(newCh);
  6173. }
  6174.  
  6175. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  6176. if (isUndef(oldStartVnode)) {
  6177. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  6178. } else if (isUndef(oldEndVnode)) {
  6179. oldEndVnode = oldCh[--oldEndIdx];
  6180. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  6181. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6182. oldStartVnode = oldCh[++oldStartIdx];
  6183. newStartVnode = newCh[++newStartIdx];
  6184. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  6185. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6186. oldEndVnode = oldCh[--oldEndIdx];
  6187. newEndVnode = newCh[--newEndIdx];
  6188. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  6189. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue, newCh, newEndIdx);
  6190. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  6191. oldStartVnode = oldCh[++oldStartIdx];
  6192. newEndVnode = newCh[--newEndIdx];
  6193. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  6194. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6195. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  6196. oldEndVnode = oldCh[--oldEndIdx];
  6197. newStartVnode = newCh[++newStartIdx];
  6198. } else {
  6199. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  6200. idxInOld = isDef(newStartVnode.key)
  6201. ? oldKeyToIdx[newStartVnode.key]
  6202. : findIdxInOld(newStartVnode, oldCh, oldStartIdx, oldEndIdx);
  6203. if (isUndef(idxInOld)) { // New element
  6204. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6205. } else {
  6206. vnodeToMove = oldCh[idxInOld];
  6207. if (sameVnode(vnodeToMove, newStartVnode)) {
  6208. patchVnode(vnodeToMove, newStartVnode, insertedVnodeQueue, newCh, newStartIdx);
  6209. oldCh[idxInOld] = undefined;
  6210. canMove && nodeOps.insertBefore(parentElm, vnodeToMove.elm, oldStartVnode.elm);
  6211. } else {
  6212. // same key but different element. treat as new element
  6213. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm, false, newCh, newStartIdx);
  6214. }
  6215. }
  6216. newStartVnode = newCh[++newStartIdx];
  6217. }
  6218. }
  6219. if (oldStartIdx > oldEndIdx) {
  6220. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  6221. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  6222. } else if (newStartIdx > newEndIdx) {
  6223. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  6224. }
  6225. }
  6226.  
  6227. function checkDuplicateKeys (children) {
  6228. var seenKeys = {};
  6229. for (var i = 0; i < children.length; i++) {
  6230. var vnode = children[i];
  6231. var key = vnode.key;
  6232. if (isDef(key)) {
  6233. if (seenKeys[key]) {
  6234. warn(
  6235. ("Duplicate keys detected: '" + key + "'. This may cause an update error."),
  6236. vnode.context
  6237. );
  6238. } else {
  6239. seenKeys[key] = true;
  6240. }
  6241. }
  6242. }
  6243. }
  6244.  
  6245. function findIdxInOld (node, oldCh, start, end) {
  6246. for (var i = start; i < end; i++) {
  6247. var c = oldCh[i];
  6248. if (isDef(c) && sameVnode(node, c)) { return i }
  6249. }
  6250. }
  6251.  
  6252. function patchVnode (
  6253. oldVnode,
  6254. vnode,
  6255. insertedVnodeQueue,
  6256. ownerArray,
  6257. index,
  6258. removeOnly
  6259. ) {
  6260. if (oldVnode === vnode) {
  6261. return
  6262. }
  6263.  
  6264. if (isDef(vnode.elm) && isDef(ownerArray)) {
  6265. // clone reused vnode
  6266. vnode = ownerArray[index] = cloneVNode(vnode);
  6267. }
  6268.  
  6269. var elm = vnode.elm = oldVnode.elm;
  6270.  
  6271. if (isTrue(oldVnode.isAsyncPlaceholder)) {
  6272. if (isDef(vnode.asyncFactory.resolved)) {
  6273. hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
  6274. } else {
  6275. vnode.isAsyncPlaceholder = true;
  6276. }
  6277. return
  6278. }
  6279.  
  6280. // reuse element for static trees.
  6281. // note we only do this if the vnode is cloned -
  6282. // if the new node is not cloned it means the render functions have been
  6283. // reset by the hot-reload-api and we need to do a proper re-render.
  6284. if (isTrue(vnode.isStatic) &&
  6285. isTrue(oldVnode.isStatic) &&
  6286. vnode.key === oldVnode.key &&
  6287. (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
  6288. ) {
  6289. vnode.componentInstance = oldVnode.componentInstance;
  6290. return
  6291. }
  6292.  
  6293. var i;
  6294. var data = vnode.data;
  6295. if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  6296. i(oldVnode, vnode);
  6297. }
  6298.  
  6299. var oldCh = oldVnode.children;
  6300. var ch = vnode.children;
  6301. if (isDef(data) && isPatchable(vnode)) {
  6302. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  6303. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  6304. }
  6305. if (isUndef(vnode.text)) {
  6306. if (isDef(oldCh) && isDef(ch)) {
  6307. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  6308. } else if (isDef(ch)) {
  6309. {
  6310. checkDuplicateKeys(ch);
  6311. }
  6312. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  6313. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  6314. } else if (isDef(oldCh)) {
  6315. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  6316. } else if (isDef(oldVnode.text)) {
  6317. nodeOps.setTextContent(elm, '');
  6318. }
  6319. } else if (oldVnode.text !== vnode.text) {
  6320. nodeOps.setTextContent(elm, vnode.text);
  6321. }
  6322. if (isDef(data)) {
  6323. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  6324. }
  6325. }
  6326.  
  6327. function invokeInsertHook (vnode, queue, initial) {
  6328. // delay insert hooks for component root nodes, invoke them after the
  6329. // element is really inserted
  6330. if (isTrue(initial) && isDef(vnode.parent)) {
  6331. vnode.parent.data.pendingInsert = queue;
  6332. } else {
  6333. for (var i = 0; i < queue.length; ++i) {
  6334. queue[i].data.hook.insert(queue[i]);
  6335. }
  6336. }
  6337. }
  6338.  
  6339. var hydrationBailed = false;
  6340. // list of modules that can skip create hook during hydration because they
  6341. // are already rendered on the client or has no need for initialization
  6342. // Note: style is excluded because it relies on initial clone for future
  6343. // deep updates (#7063).
  6344. var isRenderedModule = makeMap('attrs,class,staticClass,staticStyle,key');
  6345.  
  6346. // Note: this is a browser-only function so we can assume elms are DOM nodes.
  6347. function hydrate (elm, vnode, insertedVnodeQueue, inVPre) {
  6348. var i;
  6349. var tag = vnode.tag;
  6350. var data = vnode.data;
  6351. var children = vnode.children;
  6352. inVPre = inVPre || (data && data.pre);
  6353. vnode.elm = elm;
  6354.  
  6355. if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
  6356. vnode.isAsyncPlaceholder = true;
  6357. return true
  6358. }
  6359. // assert node match
  6360. {
  6361. if (!assertNodeMatch(elm, vnode, inVPre)) {
  6362. return false
  6363. }
  6364. }
  6365. if (isDef(data)) {
  6366. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  6367. if (isDef(i = vnode.componentInstance)) {
  6368. // child component. it should have hydrated its own tree.
  6369. initComponent(vnode, insertedVnodeQueue);
  6370. return true
  6371. }
  6372. }
  6373. if (isDef(tag)) {
  6374. if (isDef(children)) {
  6375. // empty element, allow client to pick up and populate children
  6376. if (!elm.hasChildNodes()) {
  6377. createChildren(vnode, children, insertedVnodeQueue);
  6378. } else {
  6379. // v-html and domProps: innerHTML
  6380. if (isDef(i = data) && isDef(i = i.domProps) && isDef(i = i.innerHTML)) {
  6381. if (i !== elm.innerHTML) {
  6382. /* istanbul ignore if */
  6383. if (typeof console !== 'undefined' &&
  6384. !hydrationBailed
  6385. ) {
  6386. hydrationBailed = true;
  6387. console.warn('Parent: ', elm);
  6388. console.warn('server innerHTML: ', i);
  6389. console.warn('client innerHTML: ', elm.innerHTML);
  6390. }
  6391. return false
  6392. }
  6393. } else {
  6394. // iterate and compare children lists
  6395. var childrenMatch = true;
  6396. var childNode = elm.firstChild;
  6397. for (var i$1 = 0; i$1 < children.length; i$1++) {
  6398. if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue, inVPre)) {
  6399. childrenMatch = false;
  6400. break
  6401. }
  6402. childNode = childNode.nextSibling;
  6403. }
  6404. // if childNode is not null, it means the actual childNodes list is
  6405. // longer than the virtual children list.
  6406. if (!childrenMatch || childNode) {
  6407. /* istanbul ignore if */
  6408. if (typeof console !== 'undefined' &&
  6409. !hydrationBailed
  6410. ) {
  6411. hydrationBailed = true;
  6412. console.warn('Parent: ', elm);
  6413. console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
  6414. }
  6415. return false
  6416. }
  6417. }
  6418. }
  6419. }
  6420. if (isDef(data)) {
  6421. var fullInvoke = false;
  6422. for (var key in data) {
  6423. if (!isRenderedModule(key)) {
  6424. fullInvoke = true;
  6425. invokeCreateHooks(vnode, insertedVnodeQueue);
  6426. break
  6427. }
  6428. }
  6429. if (!fullInvoke && data['class']) {
  6430. // ensure collecting deps for deep class bindings for future updates
  6431. traverse(data['class']);
  6432. }
  6433. }
  6434. } else if (elm.data !== vnode.text) {
  6435. elm.data = vnode.text;
  6436. }
  6437. return true
  6438. }
  6439.  
  6440. function assertNodeMatch (node, vnode, inVPre) {
  6441. if (isDef(vnode.tag)) {
  6442. return vnode.tag.indexOf('vue-component') === 0 || (
  6443. !isUnknownElement$$1(vnode, inVPre) &&
  6444. vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
  6445. )
  6446. } else {
  6447. return node.nodeType === (vnode.isComment ? 8 : 3)
  6448. }
  6449. }
  6450.  
  6451. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  6452. if (isUndef(vnode)) {
  6453. if (isDef(oldVnode)) { invokeDestroyHook(oldVnode); }
  6454. return
  6455. }
  6456.  
  6457. var isInitialPatch = false;
  6458. var insertedVnodeQueue = [];
  6459.  
  6460. if (isUndef(oldVnode)) {
  6461. // empty mount (likely as component), create new root element
  6462. isInitialPatch = true;
  6463. createElm(vnode, insertedVnodeQueue);
  6464. } else {
  6465. var isRealElement = isDef(oldVnode.nodeType);
  6466. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  6467. // patch existing root node
  6468. patchVnode(oldVnode, vnode, insertedVnodeQueue, null, null, removeOnly);
  6469. } else {
  6470. if (isRealElement) {
  6471. // mounting to a real element
  6472. // check if this is server-rendered content and if we can perform
  6473. // a successful hydration.
  6474. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute(SSR_ATTR)) {
  6475. oldVnode.removeAttribute(SSR_ATTR);
  6476. hydrating = true;
  6477. }
  6478. if (isTrue(hydrating)) {
  6479. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  6480. invokeInsertHook(vnode, insertedVnodeQueue, true);
  6481. return oldVnode
  6482. } else {
  6483. warn(
  6484. 'The client-side rendered virtual DOM tree is not matching ' +
  6485. 'server-rendered content. This is likely caused by incorrect ' +
  6486. 'HTML markup, for example nesting block-level elements inside ' +
  6487. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  6488. 'full client-side render.'
  6489. );
  6490. }
  6491. }
  6492. // either not server-rendered, or hydration failed.
  6493. // create an empty node and replace it
  6494. oldVnode = emptyNodeAt(oldVnode);
  6495. }
  6496.  
  6497. // replacing existing element
  6498. var oldElm = oldVnode.elm;
  6499. var parentElm = nodeOps.parentNode(oldElm);
  6500.  
  6501. // create new node
  6502. createElm(
  6503. vnode,
  6504. insertedVnodeQueue,
  6505. // extremely rare edge case: do not insert if old element is in a
  6506. // leaving transition. Only happens when combining transition +
  6507. // keep-alive + HOCs. (#4590)
  6508. oldElm._leaveCb ? null : parentElm,
  6509. nodeOps.nextSibling(oldElm)
  6510. );
  6511.  
  6512. // update parent placeholder node element, recursively
  6513. if (isDef(vnode.parent)) {
  6514. var ancestor = vnode.parent;
  6515. var patchable = isPatchable(vnode);
  6516. while (ancestor) {
  6517. for (var i = 0; i < cbs.destroy.length; ++i) {
  6518. cbs.destroy[i](ancestor);
  6519. }
  6520. ancestor.elm = vnode.elm;
  6521. if (patchable) {
  6522. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  6523. cbs.create[i$1](emptyNode, ancestor);
  6524. }
  6525. // #6513
  6526. // invoke insert hooks that may have been merged by create hooks.
  6527. // e.g. for directives that uses the "inserted" hook.
  6528. var insert = ancestor.data.hook.insert;
  6529. if (insert.merged) {
  6530. // start at index 1 to avoid re-invoking component mounted hook
  6531. for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {
  6532. insert.fns[i$2]();
  6533. }
  6534. }
  6535. } else {
  6536. registerRef(ancestor);
  6537. }
  6538. ancestor = ancestor.parent;
  6539. }
  6540. }
  6541.  
  6542. // destroy old node
  6543. if (isDef(parentElm)) {
  6544. removeVnodes(parentElm, [oldVnode], 0, 0);
  6545. } else if (isDef(oldVnode.tag)) {
  6546. invokeDestroyHook(oldVnode);
  6547. }
  6548. }
  6549. }
  6550.  
  6551. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  6552. return vnode.elm
  6553. }
  6554. }
  6555.  
  6556. /* */
  6557.  
  6558. var directives = {
  6559. create: updateDirectives,
  6560. update: updateDirectives,
  6561. destroy: function unbindDirectives (vnode) {
  6562. updateDirectives(vnode, emptyNode);
  6563. }
  6564. };
  6565.  
  6566. function updateDirectives (oldVnode, vnode) {
  6567. if (oldVnode.data.directives || vnode.data.directives) {
  6568. _update(oldVnode, vnode);
  6569. }
  6570. }
  6571.  
  6572. function _update (oldVnode, vnode) {
  6573. var isCreate = oldVnode === emptyNode;
  6574. var isDestroy = vnode === emptyNode;
  6575. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  6576. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  6577.  
  6578. var dirsWithInsert = [];
  6579. var dirsWithPostpatch = [];
  6580.  
  6581. var key, oldDir, dir;
  6582. for (key in newDirs) {
  6583. oldDir = oldDirs[key];
  6584. dir = newDirs[key];
  6585. if (!oldDir) {
  6586. // new directive, bind
  6587. callHook$1(dir, 'bind', vnode, oldVnode);
  6588. if (dir.def && dir.def.inserted) {
  6589. dirsWithInsert.push(dir);
  6590. }
  6591. } else {
  6592. // existing directive, update
  6593. dir.oldValue = oldDir.value;
  6594. dir.oldArg = oldDir.arg;
  6595. callHook$1(dir, 'update', vnode, oldVnode);
  6596. if (dir.def && dir.def.componentUpdated) {
  6597. dirsWithPostpatch.push(dir);
  6598. }
  6599. }
  6600. }
  6601.  
  6602. if (dirsWithInsert.length) {
  6603. var callInsert = function () {
  6604. for (var i = 0; i < dirsWithInsert.length; i++) {
  6605. callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
  6606. }
  6607. };
  6608. if (isCreate) {
  6609. mergeVNodeHook(vnode, 'insert', callInsert);
  6610. } else {
  6611. callInsert();
  6612. }
  6613. }
  6614.  
  6615. if (dirsWithPostpatch.length) {
  6616. mergeVNodeHook(vnode, 'postpatch', function () {
  6617. for (var i = 0; i < dirsWithPostpatch.length; i++) {
  6618. callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
  6619. }
  6620. });
  6621. }
  6622.  
  6623. if (!isCreate) {
  6624. for (key in oldDirs) {
  6625. if (!newDirs[key]) {
  6626. // no longer present, unbind
  6627. callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
  6628. }
  6629. }
  6630. }
  6631. }
  6632.  
  6633. var emptyModifiers = Object.create(null);
  6634.  
  6635. function normalizeDirectives$1 (
  6636. dirs,
  6637. vm
  6638. ) {
  6639. var res = Object.create(null);
  6640. if (!dirs) {
  6641. // $flow-disable-line
  6642. return res
  6643. }
  6644. var i, dir;
  6645. for (i = 0; i < dirs.length; i++) {
  6646. dir = dirs[i];
  6647. if (!dir.modifiers) {
  6648. // $flow-disable-line
  6649. dir.modifiers = emptyModifiers;
  6650. }
  6651. res[getRawDirName(dir)] = dir;
  6652. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  6653. }
  6654. // $flow-disable-line
  6655. return res
  6656. }
  6657.  
  6658. function getRawDirName (dir) {
  6659. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  6660. }
  6661.  
  6662. function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
  6663. var fn = dir.def && dir.def[hook];
  6664. if (fn) {
  6665. try {
  6666. fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
  6667. } catch (e) {
  6668. handleError(e, vnode.context, ("directive " + (dir.name) + " " + hook + " hook"));
  6669. }
  6670. }
  6671. }
  6672.  
  6673. var baseModules = [
  6674. ref,
  6675. directives
  6676. ];
  6677.  
  6678. /* */
  6679.  
  6680. function updateAttrs (oldVnode, vnode) {
  6681. var opts = vnode.componentOptions;
  6682. if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
  6683. return
  6684. }
  6685. if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
  6686. return
  6687. }
  6688. var key, cur, old;
  6689. var elm = vnode.elm;
  6690. var oldAttrs = oldVnode.data.attrs || {};
  6691. var attrs = vnode.data.attrs || {};
  6692. // clone observed objects, as the user probably wants to mutate it
  6693. if (isDef(attrs.__ob__)) {
  6694. attrs = vnode.data.attrs = extend({}, attrs);
  6695. }
  6696.  
  6697. for (key in attrs) {
  6698. cur = attrs[key];
  6699. old = oldAttrs[key];
  6700. if (old !== cur) {
  6701. setAttr(elm, key, cur);
  6702. }
  6703. }
  6704. // #4391: in IE9, setting type can reset value for input[type=radio]
  6705. // #6666: IE/Edge forces progress value down to 1 before setting a max
  6706. /* istanbul ignore if */
  6707. if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {
  6708. setAttr(elm, 'value', attrs.value);
  6709. }
  6710. for (key in oldAttrs) {
  6711. if (isUndef(attrs[key])) {
  6712. if (isXlink(key)) {
  6713. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6714. } else if (!isEnumeratedAttr(key)) {
  6715. elm.removeAttribute(key);
  6716. }
  6717. }
  6718. }
  6719. }
  6720.  
  6721. function setAttr (el, key, value) {
  6722. if (el.tagName.indexOf('-') > -1) {
  6723. baseSetAttr(el, key, value);
  6724. } else if (isBooleanAttr(key)) {
  6725. // set attribute for blank value
  6726. // e.g. <option disabled>Select one</option>
  6727. if (isFalsyAttrValue(value)) {
  6728. el.removeAttribute(key);
  6729. } else {
  6730. // technically allowfullscreen is a boolean attribute for <iframe>,
  6731. // but Flash expects a value of "true" when used on <embed> tag
  6732. value = key === 'allowfullscreen' && el.tagName === 'EMBED'
  6733. ? 'true'
  6734. : key;
  6735. el.setAttribute(key, value);
  6736. }
  6737. } else if (isEnumeratedAttr(key)) {
  6738. el.setAttribute(key, convertEnumeratedValue(key, value));
  6739. } else if (isXlink(key)) {
  6740. if (isFalsyAttrValue(value)) {
  6741. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  6742. } else {
  6743. el.setAttributeNS(xlinkNS, key, value);
  6744. }
  6745. } else {
  6746. baseSetAttr(el, key, value);
  6747. }
  6748. }
  6749.  
  6750. function baseSetAttr (el, key, value) {
  6751. if (isFalsyAttrValue(value)) {
  6752. el.removeAttribute(key);
  6753. } else {
  6754. // #7138: IE10 & 11 fires input event when setting placeholder on
  6755. // <textarea>... block the first input event and remove the blocker
  6756. // immediately.
  6757. /* istanbul ignore if */
  6758. if (
  6759. isIE && !isIE9 &&
  6760. el.tagName === 'TEXTAREA' &&
  6761. key === 'placeholder' && value !== '' && !el.__ieph
  6762. ) {
  6763. var blocker = function (e) {
  6764. e.stopImmediatePropagation();
  6765. el.removeEventListener('input', blocker);
  6766. };
  6767. el.addEventListener('input', blocker);
  6768. // $flow-disable-line
  6769. el.__ieph = true; /* IE placeholder patched */
  6770. }
  6771. el.setAttribute(key, value);
  6772. }
  6773. }
  6774.  
  6775. var attrs = {
  6776. create: updateAttrs,
  6777. update: updateAttrs
  6778. };
  6779.  
  6780. /* */
  6781.  
  6782. function updateClass (oldVnode, vnode) {
  6783. var el = vnode.elm;
  6784. var data = vnode.data;
  6785. var oldData = oldVnode.data;
  6786. if (
  6787. isUndef(data.staticClass) &&
  6788. isUndef(data.class) && (
  6789. isUndef(oldData) || (
  6790. isUndef(oldData.staticClass) &&
  6791. isUndef(oldData.class)
  6792. )
  6793. )
  6794. ) {
  6795. return
  6796. }
  6797.  
  6798. var cls = genClassForVnode(vnode);
  6799.  
  6800. // handle transition classes
  6801. var transitionClass = el._transitionClasses;
  6802. if (isDef(transitionClass)) {
  6803. cls = concat(cls, stringifyClass(transitionClass));
  6804. }
  6805.  
  6806. // set the class
  6807. if (cls !== el._prevClass) {
  6808. el.setAttribute('class', cls);
  6809. el._prevClass = cls;
  6810. }
  6811. }
  6812.  
  6813. var klass = {
  6814. create: updateClass,
  6815. update: updateClass
  6816. };
  6817.  
  6818. /* */
  6819.  
  6820. var validDivisionCharRE = /[\w).+\-_$\]]/;
  6821.  
  6822. function parseFilters (exp) {
  6823. var inSingle = false;
  6824. var inDouble = false;
  6825. var inTemplateString = false;
  6826. var inRegex = false;
  6827. var curly = 0;
  6828. var square = 0;
  6829. var paren = 0;
  6830. var lastFilterIndex = 0;
  6831. var c, prev, i, expression, filters;
  6832.  
  6833. for (i = 0; i < exp.length; i++) {
  6834. prev = c;
  6835. c = exp.charCodeAt(i);
  6836. if (inSingle) {
  6837. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  6838. } else if (inDouble) {
  6839. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  6840. } else if (inTemplateString) {
  6841. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  6842. } else if (inRegex) {
  6843. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  6844. } else if (
  6845. c === 0x7C && // pipe
  6846. exp.charCodeAt(i + 1) !== 0x7C &&
  6847. exp.charCodeAt(i - 1) !== 0x7C &&
  6848. !curly && !square && !paren
  6849. ) {
  6850. if (expression === undefined) {
  6851. // first filter, end of expression
  6852. lastFilterIndex = i + 1;
  6853. expression = exp.slice(0, i).trim();
  6854. } else {
  6855. pushFilter();
  6856. }
  6857. } else {
  6858. switch (c) {
  6859. case 0x22: inDouble = true; break // "
  6860. case 0x27: inSingle = true; break // '
  6861. case 0x60: inTemplateString = true; break // `
  6862. case 0x28: paren++; break // (
  6863. case 0x29: paren--; break // )
  6864. case 0x5B: square++; break // [
  6865. case 0x5D: square--; break // ]
  6866. case 0x7B: curly++; break // {
  6867. case 0x7D: curly--; break // }
  6868. }
  6869. if (c === 0x2f) { // /
  6870. var j = i - 1;
  6871. var p = (void 0);
  6872. // find first non-whitespace prev char
  6873. for (; j >= 0; j--) {
  6874. p = exp.charAt(j);
  6875. if (p !== ' ') { break }
  6876. }
  6877. if (!p || !validDivisionCharRE.test(p)) {
  6878. inRegex = true;
  6879. }
  6880. }
  6881. }
  6882. }
  6883.  
  6884. if (expression === undefined) {
  6885. expression = exp.slice(0, i).trim();
  6886. } else if (lastFilterIndex !== 0) {
  6887. pushFilter();
  6888. }
  6889.  
  6890. function pushFilter () {
  6891. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  6892. lastFilterIndex = i + 1;
  6893. }
  6894.  
  6895. if (filters) {
  6896. for (i = 0; i < filters.length; i++) {
  6897. expression = wrapFilter(expression, filters[i]);
  6898. }
  6899. }
  6900.  
  6901. return expression
  6902. }
  6903.  
  6904. function wrapFilter (exp, filter) {
  6905. var i = filter.indexOf('(');
  6906. if (i < 0) {
  6907. // _f: resolveFilter
  6908. return ("_f(\"" + filter + "\")(" + exp + ")")
  6909. } else {
  6910. var name = filter.slice(0, i);
  6911. var args = filter.slice(i + 1);
  6912. return ("_f(\"" + name + "\")(" + exp + (args !== ')' ? ',' + args : args))
  6913. }
  6914. }
  6915.  
  6916. /* */
  6917.  
  6918.  
  6919.  
  6920. /* eslint-disable no-unused-vars */
  6921. function baseWarn (msg, range) {
  6922. console.error(("[Vue compiler]: " + msg));
  6923. }
  6924. /* eslint-enable no-unused-vars */
  6925.  
  6926. function pluckModuleFunction (
  6927. modules,
  6928. key
  6929. ) {
  6930. return modules
  6931. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  6932. : []
  6933. }
  6934.  
  6935. function addProp (el, name, value, range, dynamic) {
  6936. (el.props || (el.props = [])).push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6937. el.plain = false;
  6938. }
  6939.  
  6940. function addAttr (el, name, value, range, dynamic) {
  6941. var attrs = dynamic
  6942. ? (el.dynamicAttrs || (el.dynamicAttrs = []))
  6943. : (el.attrs || (el.attrs = []));
  6944. attrs.push(rangeSetItem({ name: name, value: value, dynamic: dynamic }, range));
  6945. el.plain = false;
  6946. }
  6947.  
  6948. // add a raw attr (use this in preTransforms)
  6949. function addRawAttr (el, name, value, range) {
  6950. el.attrsMap[name] = value;
  6951. el.attrsList.push(rangeSetItem({ name: name, value: value }, range));
  6952. }
  6953.  
  6954. function addDirective (
  6955. el,
  6956. name,
  6957. rawName,
  6958. value,
  6959. arg,
  6960. isDynamicArg,
  6961. modifiers,
  6962. range
  6963. ) {
  6964. (el.directives || (el.directives = [])).push(rangeSetItem({
  6965. name: name,
  6966. rawName: rawName,
  6967. value: value,
  6968. arg: arg,
  6969. isDynamicArg: isDynamicArg,
  6970. modifiers: modifiers
  6971. }, range));
  6972. el.plain = false;
  6973. }
  6974.  
  6975. function prependModifierMarker (symbol, name, dynamic) {
  6976. return dynamic
  6977. ? ("_p(" + name + ",\"" + symbol + "\")")
  6978. : symbol + name // mark the event as captured
  6979. }
  6980.  
  6981. function addHandler (
  6982. el,
  6983. name,
  6984. value,
  6985. modifiers,
  6986. important,
  6987. warn,
  6988. range,
  6989. dynamic
  6990. ) {
  6991. modifiers = modifiers || emptyObject;
  6992. // warn prevent and passive modifier
  6993. /* istanbul ignore if */
  6994. if (
  6995. warn &&
  6996. modifiers.prevent && modifiers.passive
  6997. ) {
  6998. warn(
  6999. 'passive and prevent can\'t be used together. ' +
  7000. 'Passive handler can\'t prevent default event.',
  7001. range
  7002. );
  7003. }
  7004.  
  7005. // normalize click.right and click.middle since they don't actually fire
  7006. // this is technically browser-specific, but at least for now browsers are
  7007. // the only target envs that have right/middle clicks.
  7008. if (modifiers.right) {
  7009. if (dynamic) {
  7010. name = "(" + name + ")==='click'?'contextmenu':(" + name + ")";
  7011. } else if (name === 'click') {
  7012. name = 'contextmenu';
  7013. delete modifiers.right;
  7014. }
  7015. } else if (modifiers.middle) {
  7016. if (dynamic) {
  7017. name = "(" + name + ")==='click'?'mouseup':(" + name + ")";
  7018. } else if (name === 'click') {
  7019. name = 'mouseup';
  7020. }
  7021. }
  7022.  
  7023. // check capture modifier
  7024. if (modifiers.capture) {
  7025. delete modifiers.capture;
  7026. name = prependModifierMarker('!', name, dynamic);
  7027. }
  7028. if (modifiers.once) {
  7029. delete modifiers.once;
  7030. name = prependModifierMarker('~', name, dynamic);
  7031. }
  7032. /* istanbul ignore if */
  7033. if (modifiers.passive) {
  7034. delete modifiers.passive;
  7035. name = prependModifierMarker('&', name, dynamic);
  7036. }
  7037.  
  7038. var events;
  7039. if (modifiers.native) {
  7040. delete modifiers.native;
  7041. events = el.nativeEvents || (el.nativeEvents = {});
  7042. } else {
  7043. events = el.events || (el.events = {});
  7044. }
  7045.  
  7046. var newHandler = rangeSetItem({ value: value.trim(), dynamic: dynamic }, range);
  7047. if (modifiers !== emptyObject) {
  7048. newHandler.modifiers = modifiers;
  7049. }
  7050.  
  7051. var handlers = events[name];
  7052. /* istanbul ignore if */
  7053. if (Array.isArray(handlers)) {
  7054. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  7055. } else if (handlers) {
  7056. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  7057. } else {
  7058. events[name] = newHandler;
  7059. }
  7060.  
  7061. el.plain = false;
  7062. }
  7063.  
  7064. function getRawBindingAttr (
  7065. el,
  7066. name
  7067. ) {
  7068. return el.rawAttrsMap[':' + name] ||
  7069. el.rawAttrsMap['v-bind:' + name] ||
  7070. el.rawAttrsMap[name]
  7071. }
  7072.  
  7073. function getBindingAttr (
  7074. el,
  7075. name,
  7076. getStatic
  7077. ) {
  7078. var dynamicValue =
  7079. getAndRemoveAttr(el, ':' + name) ||
  7080. getAndRemoveAttr(el, 'v-bind:' + name);
  7081. if (dynamicValue != null) {
  7082. return parseFilters(dynamicValue)
  7083. } else if (getStatic !== false) {
  7084. var staticValue = getAndRemoveAttr(el, name);
  7085. if (staticValue != null) {
  7086. return JSON.stringify(staticValue)
  7087. }
  7088. }
  7089. }
  7090.  
  7091. // note: this only removes the attr from the Array (attrsList) so that it
  7092. // doesn't get processed by processAttrs.
  7093. // By default it does NOT remove it from the map (attrsMap) because the map is
  7094. // needed during codegen.
  7095. function getAndRemoveAttr (
  7096. el,
  7097. name,
  7098. removeFromMap
  7099. ) {
  7100. var val;
  7101. if ((val = el.attrsMap[name]) != null) {
  7102. var list = el.attrsList;
  7103. for (var i = 0, l = list.length; i < l; i++) {
  7104. if (list[i].name === name) {
  7105. list.splice(i, 1);
  7106. break
  7107. }
  7108. }
  7109. }
  7110. if (removeFromMap) {
  7111. delete el.attrsMap[name];
  7112. }
  7113. return val
  7114. }
  7115.  
  7116. function getAndRemoveAttrByRegex (
  7117. el,
  7118. name
  7119. ) {
  7120. var list = el.attrsList;
  7121. for (var i = 0, l = list.length; i < l; i++) {
  7122. var attr = list[i];
  7123. if (name.test(attr.name)) {
  7124. list.splice(i, 1);
  7125. return attr
  7126. }
  7127. }
  7128. }
  7129.  
  7130. function rangeSetItem (
  7131. item,
  7132. range
  7133. ) {
  7134. if (range) {
  7135. if (range.start != null) {
  7136. item.start = range.start;
  7137. }
  7138. if (range.end != null) {
  7139. item.end = range.end;
  7140. }
  7141. }
  7142. return item
  7143. }
  7144.  
  7145. /* */
  7146.  
  7147. /**
  7148. * Cross-platform code generation for component v-model
  7149. */
  7150. function genComponentModel (
  7151. el,
  7152. value,
  7153. modifiers
  7154. ) {
  7155. var ref = modifiers || {};
  7156. var number = ref.number;
  7157. var trim = ref.trim;
  7158.  
  7159. var baseValueExpression = '$$v';
  7160. var valueExpression = baseValueExpression;
  7161. if (trim) {
  7162. valueExpression =
  7163. "(typeof " + baseValueExpression + " === 'string'" +
  7164. "? " + baseValueExpression + ".trim()" +
  7165. ": " + baseValueExpression + ")";
  7166. }
  7167. if (number) {
  7168. valueExpression = "_n(" + valueExpression + ")";
  7169. }
  7170. var assignment = genAssignmentCode(value, valueExpression);
  7171.  
  7172. el.model = {
  7173. value: ("(" + value + ")"),
  7174. expression: JSON.stringify(value),
  7175. callback: ("function (" + baseValueExpression + ") {" + assignment + "}")
  7176. };
  7177. }
  7178.  
  7179. /**
  7180. * Cross-platform codegen helper for generating v-model value assignment code.
  7181. */
  7182. function genAssignmentCode (
  7183. value,
  7184. assignment
  7185. ) {
  7186. var res = parseModel(value);
  7187. if (res.key === null) {
  7188. return (value + "=" + assignment)
  7189. } else {
  7190. return ("$set(" + (res.exp) + ", " + (res.key) + ", " + assignment + ")")
  7191. }
  7192. }
  7193.  
  7194. /**
  7195. * Parse a v-model expression into a base path and a final key segment.
  7196. * Handles both dot-path and possible square brackets.
  7197. *
  7198. * Possible cases:
  7199. *
  7200. * - test
  7201. * - test[key]
  7202. * - test[test1[key]]
  7203. * - test["a"][key]
  7204. * - xxx.test[a[a].test1[key]]
  7205. * - test.xxx.a["asa"][test1[key]]
  7206. *
  7207. */
  7208.  
  7209. var len, str, chr, index$1, expressionPos, expressionEndPos;
  7210.  
  7211.  
  7212.  
  7213. function parseModel (val) {
  7214. // Fix https://github.com/vuejs/vue/pull/7730
  7215. // allow v-model="obj.val " (trailing whitespace)
  7216. val = val.trim();
  7217. len = val.length;
  7218.  
  7219. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  7220. index$1 = val.lastIndexOf('.');
  7221. if (index$1 > -1) {
  7222. return {
  7223. exp: val.slice(0, index$1),
  7224. key: '"' + val.slice(index$1 + 1) + '"'
  7225. }
  7226. } else {
  7227. return {
  7228. exp: val,
  7229. key: null
  7230. }
  7231. }
  7232. }
  7233.  
  7234. str = val;
  7235. index$1 = expressionPos = expressionEndPos = 0;
  7236.  
  7237. while (!eof()) {
  7238. chr = next();
  7239. /* istanbul ignore if */
  7240. if (isStringStart(chr)) {
  7241. parseString(chr);
  7242. } else if (chr === 0x5B) {
  7243. parseBracket(chr);
  7244. }
  7245. }
  7246.  
  7247. return {
  7248. exp: val.slice(0, expressionPos),
  7249. key: val.slice(expressionPos + 1, expressionEndPos)
  7250. }
  7251. }
  7252.  
  7253. function next () {
  7254. return str.charCodeAt(++index$1)
  7255. }
  7256.  
  7257. function eof () {
  7258. return index$1 >= len
  7259. }
  7260.  
  7261. function isStringStart (chr) {
  7262. return chr === 0x22 || chr === 0x27
  7263. }
  7264.  
  7265. function parseBracket (chr) {
  7266. var inBracket = 1;
  7267. expressionPos = index$1;
  7268. while (!eof()) {
  7269. chr = next();
  7270. if (isStringStart(chr)) {
  7271. parseString(chr);
  7272. continue
  7273. }
  7274. if (chr === 0x5B) { inBracket++; }
  7275. if (chr === 0x5D) { inBracket--; }
  7276. if (inBracket === 0) {
  7277. expressionEndPos = index$1;
  7278. break
  7279. }
  7280. }
  7281. }
  7282.  
  7283. function parseString (chr) {
  7284. var stringQuote = chr;
  7285. while (!eof()) {
  7286. chr = next();
  7287. if (chr === stringQuote) {
  7288. break
  7289. }
  7290. }
  7291. }
  7292.  
  7293. /* */
  7294.  
  7295. var warn$1;
  7296.  
  7297. // in some cases, the event used has to be determined at runtime
  7298. // so we used some reserved tokens during compile.
  7299. var RANGE_TOKEN = '__r';
  7300. var CHECKBOX_RADIO_TOKEN = '__c';
  7301.  
  7302. function model (
  7303. el,
  7304. dir,
  7305. _warn
  7306. ) {
  7307. warn$1 = _warn;
  7308. var value = dir.value;
  7309. var modifiers = dir.modifiers;
  7310. var tag = el.tag;
  7311. var type = el.attrsMap.type;
  7312.  
  7313. {
  7314. // inputs with type="file" are read only and setting the input's
  7315. // value will throw an error.
  7316. if (tag === 'input' && type === 'file') {
  7317. warn$1(
  7318. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  7319. "File inputs are read only. Use a v-on:change listener instead.",
  7320. el.rawAttrsMap['v-model']
  7321. );
  7322. }
  7323. }
  7324.  
  7325. if (el.component) {
  7326. genComponentModel(el, value, modifiers);
  7327. // component v-model doesn't need extra runtime
  7328. return false
  7329. } else if (tag === 'select') {
  7330. genSelect(el, value, modifiers);
  7331. } else if (tag === 'input' && type === 'checkbox') {
  7332. genCheckboxModel(el, value, modifiers);
  7333. } else if (tag === 'input' && type === 'radio') {
  7334. genRadioModel(el, value, modifiers);
  7335. } else if (tag === 'input' || tag === 'textarea') {
  7336. genDefaultModel(el, value, modifiers);
  7337. } else if (!config.isReservedTag(tag)) {
  7338. genComponentModel(el, value, modifiers);
  7339. // component v-model doesn't need extra runtime
  7340. return false
  7341. } else {
  7342. warn$1(
  7343. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  7344. "v-model is not supported on this element type. " +
  7345. 'If you are working with contenteditable, it\'s recommended to ' +
  7346. 'wrap a library dedicated for that purpose inside a custom component.',
  7347. el.rawAttrsMap['v-model']
  7348. );
  7349. }
  7350.  
  7351. // ensure runtime directive metadata
  7352. return true
  7353. }
  7354.  
  7355. function genCheckboxModel (
  7356. el,
  7357. value,
  7358. modifiers
  7359. ) {
  7360. var number = modifiers && modifiers.number;
  7361. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7362. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7363. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7364. addProp(el, 'checked',
  7365. "Array.isArray(" + value + ")" +
  7366. "?_i(" + value + "," + valueBinding + ")>-1" + (
  7367. trueValueBinding === 'true'
  7368. ? (":(" + value + ")")
  7369. : (":_q(" + value + "," + trueValueBinding + ")")
  7370. )
  7371. );
  7372. addHandler(el, 'change',
  7373. "var $$a=" + value + "," +
  7374. '$$el=$event.target,' +
  7375. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  7376. 'if(Array.isArray($$a)){' +
  7377. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  7378. '$$i=_i($$a,$$v);' +
  7379. "if($$el.checked){$$i<0&&(" + (genAssignmentCode(value, '$$a.concat([$$v])')) + ")}" +
  7380. "else{$$i>-1&&(" + (genAssignmentCode(value, '$$a.slice(0,$$i).concat($$a.slice($$i+1))')) + ")}" +
  7381. "}else{" + (genAssignmentCode(value, '$$c')) + "}",
  7382. null, true
  7383. );
  7384. }
  7385.  
  7386. function genRadioModel (
  7387. el,
  7388. value,
  7389. modifiers
  7390. ) {
  7391. var number = modifiers && modifiers.number;
  7392. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7393. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  7394. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  7395. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7396. }
  7397.  
  7398. function genSelect (
  7399. el,
  7400. value,
  7401. modifiers
  7402. ) {
  7403. var number = modifiers && modifiers.number;
  7404. var selectedVal = "Array.prototype.filter" +
  7405. ".call($event.target.options,function(o){return o.selected})" +
  7406. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  7407. "return " + (number ? '_n(val)' : 'val') + "})";
  7408.  
  7409. var assignment = '$event.target.multiple ? $$selectedVal : $$selectedVal[0]';
  7410. var code = "var $$selectedVal = " + selectedVal + ";";
  7411. code = code + " " + (genAssignmentCode(value, assignment));
  7412. addHandler(el, 'change', code, null, true);
  7413. }
  7414.  
  7415. function genDefaultModel (
  7416. el,
  7417. value,
  7418. modifiers
  7419. ) {
  7420. var type = el.attrsMap.type;
  7421.  
  7422. // warn if v-bind:value conflicts with v-model
  7423. // except for inputs with v-bind:type
  7424. {
  7425. var value$1 = el.attrsMap['v-bind:value'] || el.attrsMap[':value'];
  7426. var typeBinding = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7427. if (value$1 && !typeBinding) {
  7428. var binding = el.attrsMap['v-bind:value'] ? 'v-bind:value' : ':value';
  7429. warn$1(
  7430. binding + "=\"" + value$1 + "\" conflicts with v-model on the same element " +
  7431. 'because the latter already expands to a value binding internally',
  7432. el.rawAttrsMap[binding]
  7433. );
  7434. }
  7435. }
  7436.  
  7437. var ref = modifiers || {};
  7438. var lazy = ref.lazy;
  7439. var number = ref.number;
  7440. var trim = ref.trim;
  7441. var needCompositionGuard = !lazy && type !== 'range';
  7442. var event = lazy
  7443. ? 'change'
  7444. : type === 'range'
  7445. ? RANGE_TOKEN
  7446. : 'input';
  7447.  
  7448. var valueExpression = '$event.target.value';
  7449. if (trim) {
  7450. valueExpression = "$event.target.value.trim()";
  7451. }
  7452. if (number) {
  7453. valueExpression = "_n(" + valueExpression + ")";
  7454. }
  7455.  
  7456. var code = genAssignmentCode(value, valueExpression);
  7457. if (needCompositionGuard) {
  7458. code = "if($event.target.composing)return;" + code;
  7459. }
  7460.  
  7461. addProp(el, 'value', ("(" + value + ")"));
  7462. addHandler(el, event, code, null, true);
  7463. if (trim || number) {
  7464. addHandler(el, 'blur', '$forceUpdate()');
  7465. }
  7466. }
  7467.  
  7468. /* */
  7469.  
  7470. // normalize v-model event tokens that can only be determined at runtime.
  7471. // it's important to place the event as the first in the array because
  7472. // the whole point is ensuring the v-model callback gets called before
  7473. // user-attached handlers.
  7474. function normalizeEvents (on) {
  7475. /* istanbul ignore if */
  7476. if (isDef(on[RANGE_TOKEN])) {
  7477. // IE input[type=range] only supports `change` event
  7478. var event = isIE ? 'change' : 'input';
  7479. on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
  7480. delete on[RANGE_TOKEN];
  7481. }
  7482. // This was originally intended to fix #4521 but no longer necessary
  7483. // after 2.5. Keeping it for backwards compat with generated code from < 2.4
  7484. /* istanbul ignore if */
  7485. if (isDef(on[CHECKBOX_RADIO_TOKEN])) {
  7486. on.change = [].concat(on[CHECKBOX_RADIO_TOKEN], on.change || []);
  7487. delete on[CHECKBOX_RADIO_TOKEN];
  7488. }
  7489. }
  7490.  
  7491. var target$1;
  7492.  
  7493. function createOnceHandler$1 (event, handler, capture) {
  7494. var _target = target$1; // save current target element in closure
  7495. return function onceHandler () {
  7496. var res = handler.apply(null, arguments);
  7497. if (res !== null) {
  7498. remove$2(event, onceHandler, capture, _target);
  7499. }
  7500. }
  7501. }
  7502.  
  7503. // #9446: Firefox <= 53 (in particular, ESR 52) has incorrect Event.timeStamp
  7504. // implementation and does not fire microtasks in between event propagation, so
  7505. // safe to exclude.
  7506. var useMicrotaskFix = isUsingMicroTask && !(isFF && Number(isFF[1]) <= 53);
  7507.  
  7508. function add$1 (
  7509. name,
  7510. handler,
  7511. capture,
  7512. passive
  7513. ) {
  7514. // async edge case #6566: inner click event triggers patch, event handler
  7515. // attached to outer element during patch, and triggered again. This
  7516. // happens because browsers fire microtask ticks between event propagation.
  7517. // the solution is simple: we save the timestamp when a handler is attached,
  7518. // and the handler would only fire if the event passed to it was fired
  7519. // AFTER it was attached.
  7520. if (useMicrotaskFix) {
  7521. var attachedTimestamp = currentFlushTimestamp;
  7522. var original = handler;
  7523. handler = original._wrapper = function (e) {
  7524. if (
  7525. // no bubbling, should always fire.
  7526. // this is just a safety net in case event.timeStamp is unreliable in
  7527. // certain weird environments...
  7528. e.target === e.currentTarget ||
  7529. // event is fired after handler attachment
  7530. e.timeStamp >= attachedTimestamp ||
  7531. // bail for environments that have buggy event.timeStamp implementations
  7532. // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
  7533. // #9681 QtWebEngine event.timeStamp is negative value
  7534. e.timeStamp <= 0 ||
  7535. // #9448 bail if event is fired in another document in a multi-page
  7536. // electron/nw.js app, since event.timeStamp will be using a different
  7537. // starting reference
  7538. e.target.ownerDocument !== document
  7539. ) {
  7540. return original.apply(this, arguments)
  7541. }
  7542. };
  7543. }
  7544. target$1.addEventListener(
  7545. name,
  7546. handler,
  7547. supportsPassive
  7548. ? { capture: capture, passive: passive }
  7549. : capture
  7550. );
  7551. }
  7552.  
  7553. function remove$2 (
  7554. name,
  7555. handler,
  7556. capture,
  7557. _target
  7558. ) {
  7559. (_target || target$1).removeEventListener(
  7560. name,
  7561. handler._wrapper || handler,
  7562. capture
  7563. );
  7564. }
  7565.  
  7566. function updateDOMListeners (oldVnode, vnode) {
  7567. if (isUndef(oldVnode.data.on) && isUndef(vnode.data.on)) {
  7568. return
  7569. }
  7570. var on = vnode.data.on || {};
  7571. var oldOn = oldVnode.data.on || {};
  7572. target$1 = vnode.elm;
  7573. normalizeEvents(on);
  7574. updateListeners(on, oldOn, add$1, remove$2, createOnceHandler$1, vnode.context);
  7575. target$1 = undefined;
  7576. }
  7577.  
  7578. var events = {
  7579. create: updateDOMListeners,
  7580. update: updateDOMListeners
  7581. };
  7582.  
  7583. /* */
  7584.  
  7585. var svgContainer;
  7586.  
  7587. function updateDOMProps (oldVnode, vnode) {
  7588. if (isUndef(oldVnode.data.domProps) && isUndef(vnode.data.domProps)) {
  7589. return
  7590. }
  7591. var key, cur;
  7592. var elm = vnode.elm;
  7593. var oldProps = oldVnode.data.domProps || {};
  7594. var props = vnode.data.domProps || {};
  7595. // clone observed objects, as the user probably wants to mutate it
  7596. if (isDef(props.__ob__)) {
  7597. props = vnode.data.domProps = extend({}, props);
  7598. }
  7599.  
  7600. for (key in oldProps) {
  7601. if (!(key in props)) {
  7602. elm[key] = '';
  7603. }
  7604. }
  7605.  
  7606. for (key in props) {
  7607. cur = props[key];
  7608. // ignore children if the node has textContent or innerHTML,
  7609. // as these will throw away existing DOM nodes and cause removal errors
  7610. // on subsequent patches (#3360)
  7611. if (key === 'textContent' || key === 'innerHTML') {
  7612. if (vnode.children) { vnode.children.length = 0; }
  7613. if (cur === oldProps[key]) { continue }
  7614. // #6601 work around Chrome version <= 55 bug where single textNode
  7615. // replaced by innerHTML/textContent retains its parentNode property
  7616. if (elm.childNodes.length === 1) {
  7617. elm.removeChild(elm.childNodes[0]);
  7618. }
  7619. }
  7620.  
  7621. if (key === 'value' && elm.tagName !== 'PROGRESS') {
  7622. // store value as _value as well since
  7623. // non-string values will be stringified
  7624. elm._value = cur;
  7625. // avoid resetting cursor position when value is the same
  7626. var strCur = isUndef(cur) ? '' : String(cur);
  7627. if (shouldUpdateValue(elm, strCur)) {
  7628. elm.value = strCur;
  7629. }
  7630. } else if (key === 'innerHTML' && isSVG(elm.tagName) && isUndef(elm.innerHTML)) {
  7631. // IE doesn't support innerHTML for SVG elements
  7632. svgContainer = svgContainer || document.createElement('div');
  7633. svgContainer.innerHTML = "<svg>" + cur + "</svg>";
  7634. var svg = svgContainer.firstChild;
  7635. while (elm.firstChild) {
  7636. elm.removeChild(elm.firstChild);
  7637. }
  7638. while (svg.firstChild) {
  7639. elm.appendChild(svg.firstChild);
  7640. }
  7641. } else if (
  7642. // skip the update if old and new VDOM state is the same.
  7643. // `value` is handled separately because the DOM value may be temporarily
  7644. // out of sync with VDOM state due to focus, composition and modifiers.
  7645. // This #4521 by skipping the unnecesarry `checked` update.
  7646. cur !== oldProps[key]
  7647. ) {
  7648. // some property updates can throw
  7649. // e.g. `value` on <progress> w/ non-finite value
  7650. try {
  7651. elm[key] = cur;
  7652. } catch (e) {}
  7653. }
  7654. }
  7655. }
  7656.  
  7657. // check platforms/web/util/attrs.js acceptValue
  7658.  
  7659.  
  7660. function shouldUpdateValue (elm, checkVal) {
  7661. return (!elm.composing && (
  7662. elm.tagName === 'OPTION' ||
  7663. isNotInFocusAndDirty(elm, checkVal) ||
  7664. isDirtyWithModifiers(elm, checkVal)
  7665. ))
  7666. }
  7667.  
  7668. function isNotInFocusAndDirty (elm, checkVal) {
  7669. // return true when textbox (.number and .trim) loses focus and its value is
  7670. // not equal to the updated value
  7671. var notInFocus = true;
  7672. // #6157
  7673. // work around IE bug when accessing document.activeElement in an iframe
  7674. try { notInFocus = document.activeElement !== elm; } catch (e) {}
  7675. return notInFocus && elm.value !== checkVal
  7676. }
  7677.  
  7678. function isDirtyWithModifiers (elm, newVal) {
  7679. var value = elm.value;
  7680. var modifiers = elm._vModifiers; // injected by v-model runtime
  7681. if (isDef(modifiers)) {
  7682. if (modifiers.number) {
  7683. return toNumber(value) !== toNumber(newVal)
  7684. }
  7685. if (modifiers.trim) {
  7686. return value.trim() !== newVal.trim()
  7687. }
  7688. }
  7689. return value !== newVal
  7690. }
  7691.  
  7692. var domProps = {
  7693. create: updateDOMProps,
  7694. update: updateDOMProps
  7695. };
  7696.  
  7697. /* */
  7698.  
  7699. var parseStyleText = cached(function (cssText) {
  7700. var res = {};
  7701. var listDelimiter = /;(?![^(]*\))/g;
  7702. var propertyDelimiter = /:(.+)/;
  7703. cssText.split(listDelimiter).forEach(function (item) {
  7704. if (item) {
  7705. var tmp = item.split(propertyDelimiter);
  7706. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  7707. }
  7708. });
  7709. return res
  7710. });
  7711.  
  7712. // merge static and dynamic style data on the same vnode
  7713. function normalizeStyleData (data) {
  7714. var style = normalizeStyleBinding(data.style);
  7715. // static style is pre-processed into an object during compilation
  7716. // and is always a fresh object, so it's safe to merge into it
  7717. return data.staticStyle
  7718. ? extend(data.staticStyle, style)
  7719. : style
  7720. }
  7721.  
  7722. // normalize possible array / string values into Object
  7723. function normalizeStyleBinding (bindingStyle) {
  7724. if (Array.isArray(bindingStyle)) {
  7725. return toObject(bindingStyle)
  7726. }
  7727. if (typeof bindingStyle === 'string') {
  7728. return parseStyleText(bindingStyle)
  7729. }
  7730. return bindingStyle
  7731. }
  7732.  
  7733. /**
  7734. * parent component style should be after child's
  7735. * so that parent component's style could override it
  7736. */
  7737. function getStyle (vnode, checkChild) {
  7738. var res = {};
  7739. var styleData;
  7740.  
  7741. if (checkChild) {
  7742. var childNode = vnode;
  7743. while (childNode.componentInstance) {
  7744. childNode = childNode.componentInstance._vnode;
  7745. if (
  7746. childNode && childNode.data &&
  7747. (styleData = normalizeStyleData(childNode.data))
  7748. ) {
  7749. extend(res, styleData);
  7750. }
  7751. }
  7752. }
  7753.  
  7754. if ((styleData = normalizeStyleData(vnode.data))) {
  7755. extend(res, styleData);
  7756. }
  7757.  
  7758. var parentNode = vnode;
  7759. while ((parentNode = parentNode.parent)) {
  7760. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  7761. extend(res, styleData);
  7762. }
  7763. }
  7764. return res
  7765. }
  7766.  
  7767. /* */
  7768.  
  7769. var cssVarRE = /^--/;
  7770. var importantRE = /\s*!important$/;
  7771. var setProp = function (el, name, val) {
  7772. /* istanbul ignore if */
  7773. if (cssVarRE.test(name)) {
  7774. el.style.setProperty(name, val);
  7775. } else if (importantRE.test(val)) {
  7776. el.style.setProperty(hyphenate(name), val.replace(importantRE, ''), 'important');
  7777. } else {
  7778. var normalizedName = normalize(name);
  7779. if (Array.isArray(val)) {
  7780. // Support values array created by autoprefixer, e.g.
  7781. // {display: ["-webkit-box", "-ms-flexbox", "flex"]}
  7782. // Set them one by one, and the browser will only set those it can recognize
  7783. for (var i = 0, len = val.length; i < len; i++) {
  7784. el.style[normalizedName] = val[i];
  7785. }
  7786. } else {
  7787. el.style[normalizedName] = val;
  7788. }
  7789. }
  7790. };
  7791.  
  7792. var vendorNames = ['Webkit', 'Moz', 'ms'];
  7793.  
  7794. var emptyStyle;
  7795. var normalize = cached(function (prop) {
  7796. emptyStyle = emptyStyle || document.createElement('div').style;
  7797. prop = camelize(prop);
  7798. if (prop !== 'filter' && (prop in emptyStyle)) {
  7799. return prop
  7800. }
  7801. var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
  7802. for (var i = 0; i < vendorNames.length; i++) {
  7803. var name = vendorNames[i] + capName;
  7804. if (name in emptyStyle) {
  7805. return name
  7806. }
  7807. }
  7808. });
  7809.  
  7810. function updateStyle (oldVnode, vnode) {
  7811. var data = vnode.data;
  7812. var oldData = oldVnode.data;
  7813.  
  7814. if (isUndef(data.staticStyle) && isUndef(data.style) &&
  7815. isUndef(oldData.staticStyle) && isUndef(oldData.style)
  7816. ) {
  7817. return
  7818. }
  7819.  
  7820. var cur, name;
  7821. var el = vnode.elm;
  7822. var oldStaticStyle = oldData.staticStyle;
  7823. var oldStyleBinding = oldData.normalizedStyle || oldData.style || {};
  7824.  
  7825. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  7826. var oldStyle = oldStaticStyle || oldStyleBinding;
  7827.  
  7828. var style = normalizeStyleBinding(vnode.data.style) || {};
  7829.  
  7830. // store normalized style under a different key for next diff
  7831. // make sure to clone it if it's reactive, since the user likely wants
  7832. // to mutate it.
  7833. vnode.data.normalizedStyle = isDef(style.__ob__)
  7834. ? extend({}, style)
  7835. : style;
  7836.  
  7837. var newStyle = getStyle(vnode, true);
  7838.  
  7839. for (name in oldStyle) {
  7840. if (isUndef(newStyle[name])) {
  7841. setProp(el, name, '');
  7842. }
  7843. }
  7844. for (name in newStyle) {
  7845. cur = newStyle[name];
  7846. if (cur !== oldStyle[name]) {
  7847. // ie9 setting to null has no effect, must use empty string
  7848. setProp(el, name, cur == null ? '' : cur);
  7849. }
  7850. }
  7851. }
  7852.  
  7853. var style = {
  7854. create: updateStyle,
  7855. update: updateStyle
  7856. };
  7857.  
  7858. /* */
  7859.  
  7860. var whitespaceRE = /\s+/;
  7861.  
  7862. /**
  7863. * Add class with compatibility for SVG since classList is not supported on
  7864. * SVG elements in IE
  7865. */
  7866. function addClass (el, cls) {
  7867. /* istanbul ignore if */
  7868. if (!cls || !(cls = cls.trim())) {
  7869. return
  7870. }
  7871.  
  7872. /* istanbul ignore else */
  7873. if (el.classList) {
  7874. if (cls.indexOf(' ') > -1) {
  7875. cls.split(whitespaceRE).forEach(function (c) { return el.classList.add(c); });
  7876. } else {
  7877. el.classList.add(cls);
  7878. }
  7879. } else {
  7880. var cur = " " + (el.getAttribute('class') || '') + " ";
  7881. if (cur.indexOf(' ' + cls + ' ') < 0) {
  7882. el.setAttribute('class', (cur + cls).trim());
  7883. }
  7884. }
  7885. }
  7886.  
  7887. /**
  7888. * Remove class with compatibility for SVG since classList is not supported on
  7889. * SVG elements in IE
  7890. */
  7891. function removeClass (el, cls) {
  7892. /* istanbul ignore if */
  7893. if (!cls || !(cls = cls.trim())) {
  7894. return
  7895. }
  7896.  
  7897. /* istanbul ignore else */
  7898. if (el.classList) {
  7899. if (cls.indexOf(' ') > -1) {
  7900. cls.split(whitespaceRE).forEach(function (c) { return el.classList.remove(c); });
  7901. } else {
  7902. el.classList.remove(cls);
  7903. }
  7904. if (!el.classList.length) {
  7905. el.removeAttribute('class');
  7906. }
  7907. } else {
  7908. var cur = " " + (el.getAttribute('class') || '') + " ";
  7909. var tar = ' ' + cls + ' ';
  7910. while (cur.indexOf(tar) >= 0) {
  7911. cur = cur.replace(tar, ' ');
  7912. }
  7913. cur = cur.trim();
  7914. if (cur) {
  7915. el.setAttribute('class', cur);
  7916. } else {
  7917. el.removeAttribute('class');
  7918. }
  7919. }
  7920. }
  7921.  
  7922. /* */
  7923.  
  7924. function resolveTransition (def$$1) {
  7925. if (!def$$1) {
  7926. return
  7927. }
  7928. /* istanbul ignore else */
  7929. if (typeof def$$1 === 'object') {
  7930. var res = {};
  7931. if (def$$1.css !== false) {
  7932. extend(res, autoCssTransition(def$$1.name || 'v'));
  7933. }
  7934. extend(res, def$$1);
  7935. return res
  7936. } else if (typeof def$$1 === 'string') {
  7937. return autoCssTransition(def$$1)
  7938. }
  7939. }
  7940.  
  7941. var autoCssTransition = cached(function (name) {
  7942. return {
  7943. enterClass: (name + "-enter"),
  7944. enterToClass: (name + "-enter-to"),
  7945. enterActiveClass: (name + "-enter-active"),
  7946. leaveClass: (name + "-leave"),
  7947. leaveToClass: (name + "-leave-to"),
  7948. leaveActiveClass: (name + "-leave-active")
  7949. }
  7950. });
  7951.  
  7952. var hasTransition = inBrowser && !isIE9;
  7953. var TRANSITION = 'transition';
  7954. var ANIMATION = 'animation';
  7955.  
  7956. // Transition property/event sniffing
  7957. var transitionProp = 'transition';
  7958. var transitionEndEvent = 'transitionend';
  7959. var animationProp = 'animation';
  7960. var animationEndEvent = 'animationend';
  7961. if (hasTransition) {
  7962. /* istanbul ignore if */
  7963. if (window.ontransitionend === undefined &&
  7964. window.onwebkittransitionend !== undefined
  7965. ) {
  7966. transitionProp = 'WebkitTransition';
  7967. transitionEndEvent = 'webkitTransitionEnd';
  7968. }
  7969. if (window.onanimationend === undefined &&
  7970. window.onwebkitanimationend !== undefined
  7971. ) {
  7972. animationProp = 'WebkitAnimation';
  7973. animationEndEvent = 'webkitAnimationEnd';
  7974. }
  7975. }
  7976.  
  7977. // binding to window is necessary to make hot reload work in IE in strict mode
  7978. var raf = inBrowser
  7979. ? window.requestAnimationFrame
  7980. ? window.requestAnimationFrame.bind(window)
  7981. : setTimeout
  7982. : /* istanbul ignore next */ function (fn) { return fn(); };
  7983.  
  7984. function nextFrame (fn) {
  7985. raf(function () {
  7986. raf(fn);
  7987. });
  7988. }
  7989.  
  7990. function addTransitionClass (el, cls) {
  7991. var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
  7992. if (transitionClasses.indexOf(cls) < 0) {
  7993. transitionClasses.push(cls);
  7994. addClass(el, cls);
  7995. }
  7996. }
  7997.  
  7998. function removeTransitionClass (el, cls) {
  7999. if (el._transitionClasses) {
  8000. remove(el._transitionClasses, cls);
  8001. }
  8002. removeClass(el, cls);
  8003. }
  8004.  
  8005. function whenTransitionEnds (
  8006. el,
  8007. expectedType,
  8008. cb
  8009. ) {
  8010. var ref = getTransitionInfo(el, expectedType);
  8011. var type = ref.type;
  8012. var timeout = ref.timeout;
  8013. var propCount = ref.propCount;
  8014. if (!type) { return cb() }
  8015. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  8016. var ended = 0;
  8017. var end = function () {
  8018. el.removeEventListener(event, onEnd);
  8019. cb();
  8020. };
  8021. var onEnd = function (e) {
  8022. if (e.target === el) {
  8023. if (++ended >= propCount) {
  8024. end();
  8025. }
  8026. }
  8027. };
  8028. setTimeout(function () {
  8029. if (ended < propCount) {
  8030. end();
  8031. }
  8032. }, timeout + 1);
  8033. el.addEventListener(event, onEnd);
  8034. }
  8035.  
  8036. var transformRE = /\b(transform|all)(,|$)/;
  8037.  
  8038. function getTransitionInfo (el, expectedType) {
  8039. var styles = window.getComputedStyle(el);
  8040. // JSDOM may return undefined for transition properties
  8041. var transitionDelays = (styles[transitionProp + 'Delay'] || '').split(', ');
  8042. var transitionDurations = (styles[transitionProp + 'Duration'] || '').split(', ');
  8043. var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
  8044. var animationDelays = (styles[animationProp + 'Delay'] || '').split(', ');
  8045. var animationDurations = (styles[animationProp + 'Duration'] || '').split(', ');
  8046. var animationTimeout = getTimeout(animationDelays, animationDurations);
  8047.  
  8048. var type;
  8049. var timeout = 0;
  8050. var propCount = 0;
  8051. /* istanbul ignore if */
  8052. if (expectedType === TRANSITION) {
  8053. if (transitionTimeout > 0) {
  8054. type = TRANSITION;
  8055. timeout = transitionTimeout;
  8056. propCount = transitionDurations.length;
  8057. }
  8058. } else if (expectedType === ANIMATION) {
  8059. if (animationTimeout > 0) {
  8060. type = ANIMATION;
  8061. timeout = animationTimeout;
  8062. propCount = animationDurations.length;
  8063. }
  8064. } else {
  8065. timeout = Math.max(transitionTimeout, animationTimeout);
  8066. type = timeout > 0
  8067. ? transitionTimeout > animationTimeout
  8068. ? TRANSITION
  8069. : ANIMATION
  8070. : null;
  8071. propCount = type
  8072. ? type === TRANSITION
  8073. ? transitionDurations.length
  8074. : animationDurations.length
  8075. : 0;
  8076. }
  8077. var hasTransform =
  8078. type === TRANSITION &&
  8079. transformRE.test(styles[transitionProp + 'Property']);
  8080. return {
  8081. type: type,
  8082. timeout: timeout,
  8083. propCount: propCount,
  8084. hasTransform: hasTransform
  8085. }
  8086. }
  8087.  
  8088. function getTimeout (delays, durations) {
  8089. /* istanbul ignore next */
  8090. while (delays.length < durations.length) {
  8091. delays = delays.concat(delays);
  8092. }
  8093.  
  8094. return Math.max.apply(null, durations.map(function (d, i) {
  8095. return toMs(d) + toMs(delays[i])
  8096. }))
  8097. }
  8098.  
  8099. // Old versions of Chromium (below 61.0.3163.100) formats floating pointer numbers
  8100. // in a locale-dependent way, using a comma instead of a dot.
  8101. // If comma is not replaced with a dot, the input will be rounded down (i.e. acting
  8102. // as a floor function) causing unexpected behaviors
  8103. function toMs (s) {
  8104. return Number(s.slice(0, -1).replace(',', '.')) * 1000
  8105. }
  8106.  
  8107. /* */
  8108.  
  8109. function enter (vnode, toggleDisplay) {
  8110. var el = vnode.elm;
  8111.  
  8112. // call leave callback now
  8113. if (isDef(el._leaveCb)) {
  8114. el._leaveCb.cancelled = true;
  8115. el._leaveCb();
  8116. }
  8117.  
  8118. var data = resolveTransition(vnode.data.transition);
  8119. if (isUndef(data)) {
  8120. return
  8121. }
  8122.  
  8123. /* istanbul ignore if */
  8124. if (isDef(el._enterCb) || el.nodeType !== 1) {
  8125. return
  8126. }
  8127.  
  8128. var css = data.css;
  8129. var type = data.type;
  8130. var enterClass = data.enterClass;
  8131. var enterToClass = data.enterToClass;
  8132. var enterActiveClass = data.enterActiveClass;
  8133. var appearClass = data.appearClass;
  8134. var appearToClass = data.appearToClass;
  8135. var appearActiveClass = data.appearActiveClass;
  8136. var beforeEnter = data.beforeEnter;
  8137. var enter = data.enter;
  8138. var afterEnter = data.afterEnter;
  8139. var enterCancelled = data.enterCancelled;
  8140. var beforeAppear = data.beforeAppear;
  8141. var appear = data.appear;
  8142. var afterAppear = data.afterAppear;
  8143. var appearCancelled = data.appearCancelled;
  8144. var duration = data.duration;
  8145.  
  8146. // activeInstance will always be the <transition> component managing this
  8147. // transition. One edge case to check is when the <transition> is placed
  8148. // as the root node of a child component. In that case we need to check
  8149. // <transition>'s parent for appear check.
  8150. var context = activeInstance;
  8151. var transitionNode = activeInstance.$vnode;
  8152. while (transitionNode && transitionNode.parent) {
  8153. context = transitionNode.context;
  8154. transitionNode = transitionNode.parent;
  8155. }
  8156.  
  8157. var isAppear = !context._isMounted || !vnode.isRootInsert;
  8158.  
  8159. if (isAppear && !appear && appear !== '') {
  8160. return
  8161. }
  8162.  
  8163. var startClass = isAppear && appearClass
  8164. ? appearClass
  8165. : enterClass;
  8166. var activeClass = isAppear && appearActiveClass
  8167. ? appearActiveClass
  8168. : enterActiveClass;
  8169. var toClass = isAppear && appearToClass
  8170. ? appearToClass
  8171. : enterToClass;
  8172.  
  8173. var beforeEnterHook = isAppear
  8174. ? (beforeAppear || beforeEnter)
  8175. : beforeEnter;
  8176. var enterHook = isAppear
  8177. ? (typeof appear === 'function' ? appear : enter)
  8178. : enter;
  8179. var afterEnterHook = isAppear
  8180. ? (afterAppear || afterEnter)
  8181. : afterEnter;
  8182. var enterCancelledHook = isAppear
  8183. ? (appearCancelled || enterCancelled)
  8184. : enterCancelled;
  8185.  
  8186. var explicitEnterDuration = toNumber(
  8187. isObject(duration)
  8188. ? duration.enter
  8189. : duration
  8190. );
  8191.  
  8192. if (explicitEnterDuration != null) {
  8193. checkDuration(explicitEnterDuration, 'enter', vnode);
  8194. }
  8195.  
  8196. var expectsCSS = css !== false && !isIE9;
  8197. var userWantsControl = getHookArgumentsLength(enterHook);
  8198.  
  8199. var cb = el._enterCb = once(function () {
  8200. if (expectsCSS) {
  8201. removeTransitionClass(el, toClass);
  8202. removeTransitionClass(el, activeClass);
  8203. }
  8204. if (cb.cancelled) {
  8205. if (expectsCSS) {
  8206. removeTransitionClass(el, startClass);
  8207. }
  8208. enterCancelledHook && enterCancelledHook(el);
  8209. } else {
  8210. afterEnterHook && afterEnterHook(el);
  8211. }
  8212. el._enterCb = null;
  8213. });
  8214.  
  8215. if (!vnode.data.show) {
  8216. // remove pending leave element on enter by injecting an insert hook
  8217. mergeVNodeHook(vnode, 'insert', function () {
  8218. var parent = el.parentNode;
  8219. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  8220. if (pendingNode &&
  8221. pendingNode.tag === vnode.tag &&
  8222. pendingNode.elm._leaveCb
  8223. ) {
  8224. pendingNode.elm._leaveCb();
  8225. }
  8226. enterHook && enterHook(el, cb);
  8227. });
  8228. }
  8229.  
  8230. // start enter transition
  8231. beforeEnterHook && beforeEnterHook(el);
  8232. if (expectsCSS) {
  8233. addTransitionClass(el, startClass);
  8234. addTransitionClass(el, activeClass);
  8235. nextFrame(function () {
  8236. removeTransitionClass(el, startClass);
  8237. if (!cb.cancelled) {
  8238. addTransitionClass(el, toClass);
  8239. if (!userWantsControl) {
  8240. if (isValidDuration(explicitEnterDuration)) {
  8241. setTimeout(cb, explicitEnterDuration);
  8242. } else {
  8243. whenTransitionEnds(el, type, cb);
  8244. }
  8245. }
  8246. }
  8247. });
  8248. }
  8249.  
  8250. if (vnode.data.show) {
  8251. toggleDisplay && toggleDisplay();
  8252. enterHook && enterHook(el, cb);
  8253. }
  8254.  
  8255. if (!expectsCSS && !userWantsControl) {
  8256. cb();
  8257. }
  8258. }
  8259.  
  8260. function leave (vnode, rm) {
  8261. var el = vnode.elm;
  8262.  
  8263. // call enter callback now
  8264. if (isDef(el._enterCb)) {
  8265. el._enterCb.cancelled = true;
  8266. el._enterCb();
  8267. }
  8268.  
  8269. var data = resolveTransition(vnode.data.transition);
  8270. if (isUndef(data) || el.nodeType !== 1) {
  8271. return rm()
  8272. }
  8273.  
  8274. /* istanbul ignore if */
  8275. if (isDef(el._leaveCb)) {
  8276. return
  8277. }
  8278.  
  8279. var css = data.css;
  8280. var type = data.type;
  8281. var leaveClass = data.leaveClass;
  8282. var leaveToClass = data.leaveToClass;
  8283. var leaveActiveClass = data.leaveActiveClass;
  8284. var beforeLeave = data.beforeLeave;
  8285. var leave = data.leave;
  8286. var afterLeave = data.afterLeave;
  8287. var leaveCancelled = data.leaveCancelled;
  8288. var delayLeave = data.delayLeave;
  8289. var duration = data.duration;
  8290.  
  8291. var expectsCSS = css !== false && !isIE9;
  8292. var userWantsControl = getHookArgumentsLength(leave);
  8293.  
  8294. var explicitLeaveDuration = toNumber(
  8295. isObject(duration)
  8296. ? duration.leave
  8297. : duration
  8298. );
  8299.  
  8300. if (isDef(explicitLeaveDuration)) {
  8301. checkDuration(explicitLeaveDuration, 'leave', vnode);
  8302. }
  8303.  
  8304. var cb = el._leaveCb = once(function () {
  8305. if (el.parentNode && el.parentNode._pending) {
  8306. el.parentNode._pending[vnode.key] = null;
  8307. }
  8308. if (expectsCSS) {
  8309. removeTransitionClass(el, leaveToClass);
  8310. removeTransitionClass(el, leaveActiveClass);
  8311. }
  8312. if (cb.cancelled) {
  8313. if (expectsCSS) {
  8314. removeTransitionClass(el, leaveClass);
  8315. }
  8316. leaveCancelled && leaveCancelled(el);
  8317. } else {
  8318. rm();
  8319. afterLeave && afterLeave(el);
  8320. }
  8321. el._leaveCb = null;
  8322. });
  8323.  
  8324. if (delayLeave) {
  8325. delayLeave(performLeave);
  8326. } else {
  8327. performLeave();
  8328. }
  8329.  
  8330. function performLeave () {
  8331. // the delayed leave may have already been cancelled
  8332. if (cb.cancelled) {
  8333. return
  8334. }
  8335. // record leaving element
  8336. if (!vnode.data.show && el.parentNode) {
  8337. (el.parentNode._pending || (el.parentNode._pending = {}))[(vnode.key)] = vnode;
  8338. }
  8339. beforeLeave && beforeLeave(el);
  8340. if (expectsCSS) {
  8341. addTransitionClass(el, leaveClass);
  8342. addTransitionClass(el, leaveActiveClass);
  8343. nextFrame(function () {
  8344. removeTransitionClass(el, leaveClass);
  8345. if (!cb.cancelled) {
  8346. addTransitionClass(el, leaveToClass);
  8347. if (!userWantsControl) {
  8348. if (isValidDuration(explicitLeaveDuration)) {
  8349. setTimeout(cb, explicitLeaveDuration);
  8350. } else {
  8351. whenTransitionEnds(el, type, cb);
  8352. }
  8353. }
  8354. }
  8355. });
  8356. }
  8357. leave && leave(el, cb);
  8358. if (!expectsCSS && !userWantsControl) {
  8359. cb();
  8360. }
  8361. }
  8362. }
  8363.  
  8364. // only used in dev mode
  8365. function checkDuration (val, name, vnode) {
  8366. if (typeof val !== 'number') {
  8367. warn(
  8368. "<transition> explicit " + name + " duration is not a valid number - " +
  8369. "got " + (JSON.stringify(val)) + ".",
  8370. vnode.context
  8371. );
  8372. } else if (isNaN(val)) {
  8373. warn(
  8374. "<transition> explicit " + name + " duration is NaN - " +
  8375. 'the duration expression might be incorrect.',
  8376. vnode.context
  8377. );
  8378. }
  8379. }
  8380.  
  8381. function isValidDuration (val) {
  8382. return typeof val === 'number' && !isNaN(val)
  8383. }
  8384.  
  8385. /**
  8386. * Normalize a transition hook's argument length. The hook may be:
  8387. * - a merged hook (invoker) with the original in .fns
  8388. * - a wrapped component method (check ._length)
  8389. * - a plain function (.length)
  8390. */
  8391. function getHookArgumentsLength (fn) {
  8392. if (isUndef(fn)) {
  8393. return false
  8394. }
  8395. var invokerFns = fn.fns;
  8396. if (isDef(invokerFns)) {
  8397. // invoker
  8398. return getHookArgumentsLength(
  8399. Array.isArray(invokerFns)
  8400. ? invokerFns[0]
  8401. : invokerFns
  8402. )
  8403. } else {
  8404. return (fn._length || fn.length) > 1
  8405. }
  8406. }
  8407.  
  8408. function _enter (_, vnode) {
  8409. if (vnode.data.show !== true) {
  8410. enter(vnode);
  8411. }
  8412. }
  8413.  
  8414. var transition = inBrowser ? {
  8415. create: _enter,
  8416. activate: _enter,
  8417. remove: function remove$$1 (vnode, rm) {
  8418. /* istanbul ignore else */
  8419. if (vnode.data.show !== true) {
  8420. leave(vnode, rm);
  8421. } else {
  8422. rm();
  8423. }
  8424. }
  8425. } : {};
  8426.  
  8427. var platformModules = [
  8428. attrs,
  8429. klass,
  8430. events,
  8431. domProps,
  8432. style,
  8433. transition
  8434. ];
  8435.  
  8436. /* */
  8437.  
  8438. // the directive module should be applied last, after all
  8439. // built-in modules have been applied.
  8440. var modules = platformModules.concat(baseModules);
  8441.  
  8442. var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  8443.  
  8444. /**
  8445. * Not type checking this file because flow doesn't like attaching
  8446. * properties to Elements.
  8447. */
  8448.  
  8449. /* istanbul ignore if */
  8450. if (isIE9) {
  8451. // http://www.matts411.com/post/internet-explorer-9-oninput/
  8452. document.addEventListener('selectionchange', function () {
  8453. var el = document.activeElement;
  8454. if (el && el.vmodel) {
  8455. trigger(el, 'input');
  8456. }
  8457. });
  8458. }
  8459.  
  8460. var directive = {
  8461. inserted: function inserted (el, binding, vnode, oldVnode) {
  8462. if (vnode.tag === 'select') {
  8463. // #6903
  8464. if (oldVnode.elm && !oldVnode.elm._vOptions) {
  8465. mergeVNodeHook(vnode, 'postpatch', function () {
  8466. directive.componentUpdated(el, binding, vnode);
  8467. });
  8468. } else {
  8469. setSelected(el, binding, vnode.context);
  8470. }
  8471. el._vOptions = [].map.call(el.options, getValue);
  8472. } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
  8473. el._vModifiers = binding.modifiers;
  8474. if (!binding.modifiers.lazy) {
  8475. el.addEventListener('compositionstart', onCompositionStart);
  8476. el.addEventListener('compositionend', onCompositionEnd);
  8477. // Safari < 10.2 & UIWebView doesn't fire compositionend when
  8478. // switching focus before confirming composition choice
  8479. // this also fixes the issue where some browsers e.g. iOS Chrome
  8480. // fires "change" instead of "input" on autocomplete.
  8481. el.addEventListener('change', onCompositionEnd);
  8482. /* istanbul ignore if */
  8483. if (isIE9) {
  8484. el.vmodel = true;
  8485. }
  8486. }
  8487. }
  8488. },
  8489.  
  8490. componentUpdated: function componentUpdated (el, binding, vnode) {
  8491. if (vnode.tag === 'select') {
  8492. setSelected(el, binding, vnode.context);
  8493. // in case the options rendered by v-for have changed,
  8494. // it's possible that the value is out-of-sync with the rendered options.
  8495. // detect such cases and filter out values that no longer has a matching
  8496. // option in the DOM.
  8497. var prevOptions = el._vOptions;
  8498. var curOptions = el._vOptions = [].map.call(el.options, getValue);
  8499. if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
  8500. // trigger change event if
  8501. // no matching option found for at least one value
  8502. var needReset = el.multiple
  8503. ? binding.value.some(function (v) { return hasNoMatchingOption(v, curOptions); })
  8504. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, curOptions);
  8505. if (needReset) {
  8506. trigger(el, 'change');
  8507. }
  8508. }
  8509. }
  8510. }
  8511. };
  8512.  
  8513. function setSelected (el, binding, vm) {
  8514. actuallySetSelected(el, binding, vm);
  8515. /* istanbul ignore if */
  8516. if (isIE || isEdge) {
  8517. setTimeout(function () {
  8518. actuallySetSelected(el, binding, vm);
  8519. }, 0);
  8520. }
  8521. }
  8522.  
  8523. function actuallySetSelected (el, binding, vm) {
  8524. var value = binding.value;
  8525. var isMultiple = el.multiple;
  8526. if (isMultiple && !Array.isArray(value)) {
  8527. warn(
  8528. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  8529. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  8530. vm
  8531. );
  8532. return
  8533. }
  8534. var selected, option;
  8535. for (var i = 0, l = el.options.length; i < l; i++) {
  8536. option = el.options[i];
  8537. if (isMultiple) {
  8538. selected = looseIndexOf(value, getValue(option)) > -1;
  8539. if (option.selected !== selected) {
  8540. option.selected = selected;
  8541. }
  8542. } else {
  8543. if (looseEqual(getValue(option), value)) {
  8544. if (el.selectedIndex !== i) {
  8545. el.selectedIndex = i;
  8546. }
  8547. return
  8548. }
  8549. }
  8550. }
  8551. if (!isMultiple) {
  8552. el.selectedIndex = -1;
  8553. }
  8554. }
  8555.  
  8556. function hasNoMatchingOption (value, options) {
  8557. return options.every(function (o) { return !looseEqual(o, value); })
  8558. }
  8559.  
  8560. function getValue (option) {
  8561. return '_value' in option
  8562. ? option._value
  8563. : option.value
  8564. }
  8565.  
  8566. function onCompositionStart (e) {
  8567. e.target.composing = true;
  8568. }
  8569.  
  8570. function onCompositionEnd (e) {
  8571. // prevent triggering an input event for no reason
  8572. if (!e.target.composing) { return }
  8573. e.target.composing = false;
  8574. trigger(e.target, 'input');
  8575. }
  8576.  
  8577. function trigger (el, type) {
  8578. var e = document.createEvent('HTMLEvents');
  8579. e.initEvent(type, true, true);
  8580. el.dispatchEvent(e);
  8581. }
  8582.  
  8583. /* */
  8584.  
  8585. // recursively search for possible transition defined inside the component root
  8586. function locateNode (vnode) {
  8587. return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
  8588. ? locateNode(vnode.componentInstance._vnode)
  8589. : vnode
  8590. }
  8591.  
  8592. var show = {
  8593. bind: function bind (el, ref, vnode) {
  8594. var value = ref.value;
  8595.  
  8596. vnode = locateNode(vnode);
  8597. var transition$$1 = vnode.data && vnode.data.transition;
  8598. var originalDisplay = el.__vOriginalDisplay =
  8599. el.style.display === 'none' ? '' : el.style.display;
  8600. if (value && transition$$1) {
  8601. vnode.data.show = true;
  8602. enter(vnode, function () {
  8603. el.style.display = originalDisplay;
  8604. });
  8605. } else {
  8606. el.style.display = value ? originalDisplay : 'none';
  8607. }
  8608. },
  8609.  
  8610. update: function update (el, ref, vnode) {
  8611. var value = ref.value;
  8612. var oldValue = ref.oldValue;
  8613.  
  8614. /* istanbul ignore if */
  8615. if (!value === !oldValue) { return }
  8616. vnode = locateNode(vnode);
  8617. var transition$$1 = vnode.data && vnode.data.transition;
  8618. if (transition$$1) {
  8619. vnode.data.show = true;
  8620. if (value) {
  8621. enter(vnode, function () {
  8622. el.style.display = el.__vOriginalDisplay;
  8623. });
  8624. } else {
  8625. leave(vnode, function () {
  8626. el.style.display = 'none';
  8627. });
  8628. }
  8629. } else {
  8630. el.style.display = value ? el.__vOriginalDisplay : 'none';
  8631. }
  8632. },
  8633.  
  8634. unbind: function unbind (
  8635. el,
  8636. binding,
  8637. vnode,
  8638. oldVnode,
  8639. isDestroy
  8640. ) {
  8641. if (!isDestroy) {
  8642. el.style.display = el.__vOriginalDisplay;
  8643. }
  8644. }
  8645. };
  8646.  
  8647. var platformDirectives = {
  8648. model: directive,
  8649. show: show
  8650. };
  8651.  
  8652. /* */
  8653.  
  8654. var transitionProps = {
  8655. name: String,
  8656. appear: Boolean,
  8657. css: Boolean,
  8658. mode: String,
  8659. type: String,
  8660. enterClass: String,
  8661. leaveClass: String,
  8662. enterToClass: String,
  8663. leaveToClass: String,
  8664. enterActiveClass: String,
  8665. leaveActiveClass: String,
  8666. appearClass: String,
  8667. appearActiveClass: String,
  8668. appearToClass: String,
  8669. duration: [Number, String, Object]
  8670. };
  8671.  
  8672. // in case the child is also an abstract component, e.g. <keep-alive>
  8673. // we want to recursively retrieve the real component to be rendered
  8674. function getRealChild (vnode) {
  8675. var compOptions = vnode && vnode.componentOptions;
  8676. if (compOptions && compOptions.Ctor.options.abstract) {
  8677. return getRealChild(getFirstComponentChild(compOptions.children))
  8678. } else {
  8679. return vnode
  8680. }
  8681. }
  8682.  
  8683. function extractTransitionData (comp) {
  8684. var data = {};
  8685. var options = comp.$options;
  8686. // props
  8687. for (var key in options.propsData) {
  8688. data[key] = comp[key];
  8689. }
  8690. // events.
  8691. // extract listeners and pass them directly to the transition methods
  8692. var listeners = options._parentListeners;
  8693. for (var key$1 in listeners) {
  8694. data[camelize(key$1)] = listeners[key$1];
  8695. }
  8696. return data
  8697. }
  8698.  
  8699. function placeholder (h, rawChild) {
  8700. if (/\d-keep-alive$/.test(rawChild.tag)) {
  8701. return h('keep-alive', {
  8702. props: rawChild.componentOptions.propsData
  8703. })
  8704. }
  8705. }
  8706.  
  8707. function hasParentTransition (vnode) {
  8708. while ((vnode = vnode.parent)) {
  8709. if (vnode.data.transition) {
  8710. return true
  8711. }
  8712. }
  8713. }
  8714.  
  8715. function isSameChild (child, oldChild) {
  8716. return oldChild.key === child.key && oldChild.tag === child.tag
  8717. }
  8718.  
  8719. var isNotTextNode = function (c) { return c.tag || isAsyncPlaceholder(c); };
  8720.  
  8721. var isVShowDirective = function (d) { return d.name === 'show'; };
  8722.  
  8723. var Transition = {
  8724. name: 'transition',
  8725. props: transitionProps,
  8726. abstract: true,
  8727.  
  8728. render: function render (h) {
  8729. var this$1 = this;
  8730.  
  8731. var children = this.$slots.default;
  8732. if (!children) {
  8733. return
  8734. }
  8735.  
  8736. // filter out text nodes (possible whitespaces)
  8737. children = children.filter(isNotTextNode);
  8738. /* istanbul ignore if */
  8739. if (!children.length) {
  8740. return
  8741. }
  8742.  
  8743. // warn multiple elements
  8744. if (children.length > 1) {
  8745. warn(
  8746. '<transition> can only be used on a single element. Use ' +
  8747. '<transition-group> for lists.',
  8748. this.$parent
  8749. );
  8750. }
  8751.  
  8752. var mode = this.mode;
  8753.  
  8754. // warn invalid mode
  8755. if (mode && mode !== 'in-out' && mode !== 'out-in'
  8756. ) {
  8757. warn(
  8758. 'invalid <transition> mode: ' + mode,
  8759. this.$parent
  8760. );
  8761. }
  8762.  
  8763. var rawChild = children[0];
  8764.  
  8765. // if this is a component root node and the component's
  8766. // parent container node also has transition, skip.
  8767. if (hasParentTransition(this.$vnode)) {
  8768. return rawChild
  8769. }
  8770.  
  8771. // apply transition data to child
  8772. // use getRealChild() to ignore abstract components e.g. keep-alive
  8773. var child = getRealChild(rawChild);
  8774. /* istanbul ignore if */
  8775. if (!child) {
  8776. return rawChild
  8777. }
  8778.  
  8779. if (this._leaving) {
  8780. return placeholder(h, rawChild)
  8781. }
  8782.  
  8783. // ensure a key that is unique to the vnode type and to this transition
  8784. // component instance. This key will be used to remove pending leaving nodes
  8785. // during entering.
  8786. var id = "__transition-" + (this._uid) + "-";
  8787. child.key = child.key == null
  8788. ? child.isComment
  8789. ? id + 'comment'
  8790. : id + child.tag
  8791. : isPrimitive(child.key)
  8792. ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
  8793. : child.key;
  8794.  
  8795. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  8796. var oldRawChild = this._vnode;
  8797. var oldChild = getRealChild(oldRawChild);
  8798.  
  8799. // mark v-show
  8800. // so that the transition module can hand over the control to the directive
  8801. if (child.data.directives && child.data.directives.some(isVShowDirective)) {
  8802. child.data.show = true;
  8803. }
  8804.  
  8805. if (
  8806. oldChild &&
  8807. oldChild.data &&
  8808. !isSameChild(child, oldChild) &&
  8809. !isAsyncPlaceholder(oldChild) &&
  8810. // #6687 component root is a comment node
  8811. !(oldChild.componentInstance && oldChild.componentInstance._vnode.isComment)
  8812. ) {
  8813. // replace old child transition data with fresh one
  8814. // important for dynamic transitions!
  8815. var oldData = oldChild.data.transition = extend({}, data);
  8816. // handle transition mode
  8817. if (mode === 'out-in') {
  8818. // return placeholder node and queue update when leave finishes
  8819. this._leaving = true;
  8820. mergeVNodeHook(oldData, 'afterLeave', function () {
  8821. this$1._leaving = false;
  8822. this$1.$forceUpdate();
  8823. });
  8824. return placeholder(h, rawChild)
  8825. } else if (mode === 'in-out') {
  8826. if (isAsyncPlaceholder(child)) {
  8827. return oldRawChild
  8828. }
  8829. var delayedLeave;
  8830. var performLeave = function () { delayedLeave(); };
  8831. mergeVNodeHook(data, 'afterEnter', performLeave);
  8832. mergeVNodeHook(data, 'enterCancelled', performLeave);
  8833. mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
  8834. }
  8835. }
  8836.  
  8837. return rawChild
  8838. }
  8839. };
  8840.  
  8841. /* */
  8842.  
  8843. var props = extend({
  8844. tag: String,
  8845. moveClass: String
  8846. }, transitionProps);
  8847.  
  8848. delete props.mode;
  8849.  
  8850. var TransitionGroup = {
  8851. props: props,
  8852.  
  8853. beforeMount: function beforeMount () {
  8854. var this$1 = this;
  8855.  
  8856. var update = this._update;
  8857. this._update = function (vnode, hydrating) {
  8858. var restoreActiveInstance = setActiveInstance(this$1);
  8859. // force removing pass
  8860. this$1.__patch__(
  8861. this$1._vnode,
  8862. this$1.kept,
  8863. false, // hydrating
  8864. true // removeOnly (!important, avoids unnecessary moves)
  8865. );
  8866. this$1._vnode = this$1.kept;
  8867. restoreActiveInstance();
  8868. update.call(this$1, vnode, hydrating);
  8869. };
  8870. },
  8871.  
  8872. render: function render (h) {
  8873. var tag = this.tag || this.$vnode.data.tag || 'span';
  8874. var map = Object.create(null);
  8875. var prevChildren = this.prevChildren = this.children;
  8876. var rawChildren = this.$slots.default || [];
  8877. var children = this.children = [];
  8878. var transitionData = extractTransitionData(this);
  8879.  
  8880. for (var i = 0; i < rawChildren.length; i++) {
  8881. var c = rawChildren[i];
  8882. if (c.tag) {
  8883. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  8884. children.push(c);
  8885. map[c.key] = c
  8886. ;(c.data || (c.data = {})).transition = transitionData;
  8887. } else {
  8888. var opts = c.componentOptions;
  8889. var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
  8890. warn(("<transition-group> children must be keyed: <" + name + ">"));
  8891. }
  8892. }
  8893. }
  8894.  
  8895. if (prevChildren) {
  8896. var kept = [];
  8897. var removed = [];
  8898. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  8899. var c$1 = prevChildren[i$1];
  8900. c$1.data.transition = transitionData;
  8901. c$1.data.pos = c$1.elm.getBoundingClientRect();
  8902. if (map[c$1.key]) {
  8903. kept.push(c$1);
  8904. } else {
  8905. removed.push(c$1);
  8906. }
  8907. }
  8908. this.kept = h(tag, null, kept);
  8909. this.removed = removed;
  8910. }
  8911.  
  8912. return h(tag, null, children)
  8913. },
  8914.  
  8915. updated: function updated () {
  8916. var children = this.prevChildren;
  8917. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  8918. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  8919. return
  8920. }
  8921.  
  8922. // we divide the work into three loops to avoid mixing DOM reads and writes
  8923. // in each iteration - which helps prevent layout thrashing.
  8924. children.forEach(callPendingCbs);
  8925. children.forEach(recordPosition);
  8926. children.forEach(applyTranslation);
  8927.  
  8928. // force reflow to put everything in position
  8929. // assign to this to avoid being removed in tree-shaking
  8930. // $flow-disable-line
  8931. this._reflow = document.body.offsetHeight;
  8932.  
  8933. children.forEach(function (c) {
  8934. if (c.data.moved) {
  8935. var el = c.elm;
  8936. var s = el.style;
  8937. addTransitionClass(el, moveClass);
  8938. s.transform = s.WebkitTransform = s.transitionDuration = '';
  8939. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  8940. if (e && e.target !== el) {
  8941. return
  8942. }
  8943. if (!e || /transform$/.test(e.propertyName)) {
  8944. el.removeEventListener(transitionEndEvent, cb);
  8945. el._moveCb = null;
  8946. removeTransitionClass(el, moveClass);
  8947. }
  8948. });
  8949. }
  8950. });
  8951. },
  8952.  
  8953. methods: {
  8954. hasMove: function hasMove (el, moveClass) {
  8955. /* istanbul ignore if */
  8956. if (!hasTransition) {
  8957. return false
  8958. }
  8959. /* istanbul ignore if */
  8960. if (this._hasMove) {
  8961. return this._hasMove
  8962. }
  8963. // Detect whether an element with the move class applied has
  8964. // CSS transitions. Since the element may be inside an entering
  8965. // transition at this very moment, we make a clone of it and remove
  8966. // all other transition classes applied to ensure only the move class
  8967. // is applied.
  8968. var clone = el.cloneNode();
  8969. if (el._transitionClasses) {
  8970. el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
  8971. }
  8972. addClass(clone, moveClass);
  8973. clone.style.display = 'none';
  8974. this.$el.appendChild(clone);
  8975. var info = getTransitionInfo(clone);
  8976. this.$el.removeChild(clone);
  8977. return (this._hasMove = info.hasTransform)
  8978. }
  8979. }
  8980. };
  8981.  
  8982. function callPendingCbs (c) {
  8983. /* istanbul ignore if */
  8984. if (c.elm._moveCb) {
  8985. c.elm._moveCb();
  8986. }
  8987. /* istanbul ignore if */
  8988. if (c.elm._enterCb) {
  8989. c.elm._enterCb();
  8990. }
  8991. }
  8992.  
  8993. function recordPosition (c) {
  8994. c.data.newPos = c.elm.getBoundingClientRect();
  8995. }
  8996.  
  8997. function applyTranslation (c) {
  8998. var oldPos = c.data.pos;
  8999. var newPos = c.data.newPos;
  9000. var dx = oldPos.left - newPos.left;
  9001. var dy = oldPos.top - newPos.top;
  9002. if (dx || dy) {
  9003. c.data.moved = true;
  9004. var s = c.elm.style;
  9005. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  9006. s.transitionDuration = '0s';
  9007. }
  9008. }
  9009.  
  9010. var platformComponents = {
  9011. Transition: Transition,
  9012. TransitionGroup: TransitionGroup
  9013. };
  9014.  
  9015. /* */
  9016.  
  9017. // install platform specific utils
  9018. Vue.config.mustUseProp = mustUseProp;
  9019. Vue.config.isReservedTag = isReservedTag;
  9020. Vue.config.isReservedAttr = isReservedAttr;
  9021. Vue.config.getTagNamespace = getTagNamespace;
  9022. Vue.config.isUnknownElement = isUnknownElement;
  9023.  
  9024. // install platform runtime directives & components
  9025. extend(Vue.options.directives, platformDirectives);
  9026. extend(Vue.options.components, platformComponents);
  9027.  
  9028. // install platform patch function
  9029. Vue.prototype.__patch__ = inBrowser ? patch : noop;
  9030.  
  9031. // public mount method
  9032. Vue.prototype.$mount = function (
  9033. el,
  9034. hydrating
  9035. ) {
  9036. el = el && inBrowser ? query(el) : undefined;
  9037. return mountComponent(this, el, hydrating)
  9038. };
  9039.  
  9040. // devtools global hook
  9041. /* istanbul ignore next */
  9042. if (inBrowser) {
  9043. setTimeout(function () {
  9044. if (config.devtools) {
  9045. if (devtools) {
  9046. devtools.emit('init', Vue);
  9047. } else {
  9048. console[console.info ? 'info' : 'log'](
  9049. 'Download the Vue Devtools extension for a better development experience:\n' +
  9050. 'https://github.com/vuejs/vue-devtools'
  9051. );
  9052. }
  9053. }
  9054. if (config.productionTip !== false &&
  9055. typeof console !== 'undefined'
  9056. ) {
  9057. console[console.info ? 'info' : 'log'](
  9058. "You are running Vue in development mode.\n" +
  9059. "Make sure to turn on production mode when deploying for production.\n" +
  9060. "See more tips at https://vuejs.org/guide/deployment.html"
  9061. );
  9062. }
  9063. }, 0);
  9064. }
  9065.  
  9066. /* */
  9067.  
  9068. var defaultTagRE = /\{\{((?:.|\r?\n)+?)\}\}/g;
  9069. var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
  9070.  
  9071. var buildRegex = cached(function (delimiters) {
  9072. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  9073. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  9074. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  9075. });
  9076.  
  9077.  
  9078.  
  9079. function parseText (
  9080. text,
  9081. delimiters
  9082. ) {
  9083. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  9084. if (!tagRE.test(text)) {
  9085. return
  9086. }
  9087. var tokens = [];
  9088. var rawTokens = [];
  9089. var lastIndex = tagRE.lastIndex = 0;
  9090. var match, index, tokenValue;
  9091. while ((match = tagRE.exec(text))) {
  9092. index = match.index;
  9093. // push text token
  9094. if (index > lastIndex) {
  9095. rawTokens.push(tokenValue = text.slice(lastIndex, index));
  9096. tokens.push(JSON.stringify(tokenValue));
  9097. }
  9098. // tag token
  9099. var exp = parseFilters(match[1].trim());
  9100. tokens.push(("_s(" + exp + ")"));
  9101. rawTokens.push({ '@binding': exp });
  9102. lastIndex = index + match[0].length;
  9103. }
  9104. if (lastIndex < text.length) {
  9105. rawTokens.push(tokenValue = text.slice(lastIndex));
  9106. tokens.push(JSON.stringify(tokenValue));
  9107. }
  9108. return {
  9109. expression: tokens.join('+'),
  9110. tokens: rawTokens
  9111. }
  9112. }
  9113.  
  9114. /* */
  9115.  
  9116. function transformNode (el, options) {
  9117. var warn = options.warn || baseWarn;
  9118. var staticClass = getAndRemoveAttr(el, 'class');
  9119. if (staticClass) {
  9120. var res = parseText(staticClass, options.delimiters);
  9121. if (res) {
  9122. warn(
  9123. "class=\"" + staticClass + "\": " +
  9124. 'Interpolation inside attributes has been removed. ' +
  9125. 'Use v-bind or the colon shorthand instead. For example, ' +
  9126. 'instead of <div class="{{ val }}">, use <div :class="val">.',
  9127. el.rawAttrsMap['class']
  9128. );
  9129. }
  9130. }
  9131. if (staticClass) {
  9132. el.staticClass = JSON.stringify(staticClass);
  9133. }
  9134. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  9135. if (classBinding) {
  9136. el.classBinding = classBinding;
  9137. }
  9138. }
  9139.  
  9140. function genData (el) {
  9141. var data = '';
  9142. if (el.staticClass) {
  9143. data += "staticClass:" + (el.staticClass) + ",";
  9144. }
  9145. if (el.classBinding) {
  9146. data += "class:" + (el.classBinding) + ",";
  9147. }
  9148. return data
  9149. }
  9150.  
  9151. var klass$1 = {
  9152. staticKeys: ['staticClass'],
  9153. transformNode: transformNode,
  9154. genData: genData
  9155. };
  9156.  
  9157. /* */
  9158.  
  9159. function transformNode$1 (el, options) {
  9160. var warn = options.warn || baseWarn;
  9161. var staticStyle = getAndRemoveAttr(el, 'style');
  9162. if (staticStyle) {
  9163. /* istanbul ignore if */
  9164. {
  9165. var res = parseText(staticStyle, options.delimiters);
  9166. if (res) {
  9167. warn(
  9168. "style=\"" + staticStyle + "\": " +
  9169. 'Interpolation inside attributes has been removed. ' +
  9170. 'Use v-bind or the colon shorthand instead. For example, ' +
  9171. 'instead of <div style="{{ val }}">, use <div :style="val">.',
  9172. el.rawAttrsMap['style']
  9173. );
  9174. }
  9175. }
  9176. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  9177. }
  9178.  
  9179. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  9180. if (styleBinding) {
  9181. el.styleBinding = styleBinding;
  9182. }
  9183. }
  9184.  
  9185. function genData$1 (el) {
  9186. var data = '';
  9187. if (el.staticStyle) {
  9188. data += "staticStyle:" + (el.staticStyle) + ",";
  9189. }
  9190. if (el.styleBinding) {
  9191. data += "style:(" + (el.styleBinding) + "),";
  9192. }
  9193. return data
  9194. }
  9195.  
  9196. var style$1 = {
  9197. staticKeys: ['staticStyle'],
  9198. transformNode: transformNode$1,
  9199. genData: genData$1
  9200. };
  9201.  
  9202. /* */
  9203.  
  9204. var decoder;
  9205.  
  9206. var he = {
  9207. decode: function decode (html) {
  9208. decoder = decoder || document.createElement('div');
  9209. decoder.innerHTML = html;
  9210. return decoder.textContent
  9211. }
  9212. };
  9213.  
  9214. /* */
  9215.  
  9216. var isUnaryTag = makeMap(
  9217. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  9218. 'link,meta,param,source,track,wbr'
  9219. );
  9220.  
  9221. // Elements that you can, intentionally, leave open
  9222. // (and which close themselves)
  9223. var canBeLeftOpenTag = makeMap(
  9224. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source'
  9225. );
  9226.  
  9227. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  9228. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  9229. var isNonPhrasingTag = makeMap(
  9230. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  9231. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  9232. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  9233. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  9234. 'title,tr,track'
  9235. );
  9236.  
  9237. /**
  9238. * Not type-checking this file because it's mostly vendor code.
  9239. */
  9240.  
  9241. // Regular Expressions for parsing tags and attributes
  9242. var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9243. var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
  9244. var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
  9245. var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
  9246. var startTagOpen = new RegExp(("^<" + qnameCapture));
  9247. var startTagClose = /^\s*(\/?)>/;
  9248. var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
  9249. var doctype = /^<!DOCTYPE [^>]+>/i;
  9250. // #7298: escape - to avoid being pased as HTML comment when inlined in page
  9251. var comment = /^<!\--/;
  9252. var conditionalComment = /^<!\[/;
  9253.  
  9254. // Special Elements (can contain anything)
  9255. var isPlainTextElement = makeMap('script,style,textarea', true);
  9256. var reCache = {};
  9257.  
  9258. var decodingMap = {
  9259. '&lt;': '<',
  9260. '&gt;': '>',
  9261. '&quot;': '"',
  9262. '&amp;': '&',
  9263. '&#10;': '\n',
  9264. '&#9;': '\t',
  9265. '&#39;': "'"
  9266. };
  9267. var encodedAttr = /&(?:lt|gt|quot|amp|#39);/g;
  9268. var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#39|#10|#9);/g;
  9269.  
  9270. // #5992
  9271. var isIgnoreNewlineTag = makeMap('pre,textarea', true);
  9272. var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
  9273.  
  9274. function decodeAttr (value, shouldDecodeNewlines) {
  9275. var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
  9276. return value.replace(re, function (match) { return decodingMap[match]; })
  9277. }
  9278.  
  9279. function parseHTML (html, options) {
  9280. var stack = [];
  9281. var expectHTML = options.expectHTML;
  9282. var isUnaryTag$$1 = options.isUnaryTag || no;
  9283. var canBeLeftOpenTag$$1 = options.canBeLeftOpenTag || no;
  9284. var index = 0;
  9285. var last, lastTag;
  9286. while (html) {
  9287. last = html;
  9288. // Make sure we're not in a plaintext content element like script/style
  9289. if (!lastTag || !isPlainTextElement(lastTag)) {
  9290. var textEnd = html.indexOf('<');
  9291. if (textEnd === 0) {
  9292. // Comment:
  9293. if (comment.test(html)) {
  9294. var commentEnd = html.indexOf('-->');
  9295.  
  9296. if (commentEnd >= 0) {
  9297. if (options.shouldKeepComment) {
  9298. options.comment(html.substring(4, commentEnd), index, index + commentEnd + 3);
  9299. }
  9300. advance(commentEnd + 3);
  9301. continue
  9302. }
  9303. }
  9304.  
  9305. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  9306. if (conditionalComment.test(html)) {
  9307. var conditionalEnd = html.indexOf(']>');
  9308.  
  9309. if (conditionalEnd >= 0) {
  9310. advance(conditionalEnd + 2);
  9311. continue
  9312. }
  9313. }
  9314.  
  9315. // Doctype:
  9316. var doctypeMatch = html.match(doctype);
  9317. if (doctypeMatch) {
  9318. advance(doctypeMatch[0].length);
  9319. continue
  9320. }
  9321.  
  9322. // End tag:
  9323. var endTagMatch = html.match(endTag);
  9324. if (endTagMatch) {
  9325. var curIndex = index;
  9326. advance(endTagMatch[0].length);
  9327. parseEndTag(endTagMatch[1], curIndex, index);
  9328. continue
  9329. }
  9330.  
  9331. // Start tag:
  9332. var startTagMatch = parseStartTag();
  9333. if (startTagMatch) {
  9334. handleStartTag(startTagMatch);
  9335. if (shouldIgnoreFirstNewline(startTagMatch.tagName, html)) {
  9336. advance(1);
  9337. }
  9338. continue
  9339. }
  9340. }
  9341.  
  9342. var text = (void 0), rest = (void 0), next = (void 0);
  9343. if (textEnd >= 0) {
  9344. rest = html.slice(textEnd);
  9345. while (
  9346. !endTag.test(rest) &&
  9347. !startTagOpen.test(rest) &&
  9348. !comment.test(rest) &&
  9349. !conditionalComment.test(rest)
  9350. ) {
  9351. // < in plain text, be forgiving and treat it as text
  9352. next = rest.indexOf('<', 1);
  9353. if (next < 0) { break }
  9354. textEnd += next;
  9355. rest = html.slice(textEnd);
  9356. }
  9357. text = html.substring(0, textEnd);
  9358. }
  9359.  
  9360. if (textEnd < 0) {
  9361. text = html;
  9362. }
  9363.  
  9364. if (text) {
  9365. advance(text.length);
  9366. }
  9367.  
  9368. if (options.chars && text) {
  9369. options.chars(text, index - text.length, index);
  9370. }
  9371. } else {
  9372. var endTagLength = 0;
  9373. var stackedTag = lastTag.toLowerCase();
  9374. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  9375. var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
  9376. endTagLength = endTag.length;
  9377. if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
  9378. text = text
  9379. .replace(/<!\--([\s\S]*?)-->/g, '$1') // #7298
  9380. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  9381. }
  9382. if (shouldIgnoreFirstNewline(stackedTag, text)) {
  9383. text = text.slice(1);
  9384. }
  9385. if (options.chars) {
  9386. options.chars(text);
  9387. }
  9388. return ''
  9389. });
  9390. index += html.length - rest$1.length;
  9391. html = rest$1;
  9392. parseEndTag(stackedTag, index - endTagLength, index);
  9393. }
  9394.  
  9395. if (html === last) {
  9396. options.chars && options.chars(html);
  9397. if (!stack.length && options.warn) {
  9398. options.warn(("Mal-formatted tag at end of template: \"" + html + "\""), { start: index + html.length });
  9399. }
  9400. break
  9401. }
  9402. }
  9403.  
  9404. // Clean up any remaining tags
  9405. parseEndTag();
  9406.  
  9407. function advance (n) {
  9408. index += n;
  9409. html = html.substring(n);
  9410. }
  9411.  
  9412. function parseStartTag () {
  9413. var start = html.match(startTagOpen);
  9414. if (start) {
  9415. var match = {
  9416. tagName: start[1],
  9417. attrs: [],
  9418. start: index
  9419. };
  9420. advance(start[0].length);
  9421. var end, attr;
  9422. while (!(end = html.match(startTagClose)) && (attr = html.match(dynamicArgAttribute) || html.match(attribute))) {
  9423. attr.start = index;
  9424. advance(attr[0].length);
  9425. attr.end = index;
  9426. match.attrs.push(attr);
  9427. }
  9428. if (end) {
  9429. match.unarySlash = end[1];
  9430. advance(end[0].length);
  9431. match.end = index;
  9432. return match
  9433. }
  9434. }
  9435. }
  9436.  
  9437. function handleStartTag (match) {
  9438. var tagName = match.tagName;
  9439. var unarySlash = match.unarySlash;
  9440.  
  9441. if (expectHTML) {
  9442. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  9443. parseEndTag(lastTag);
  9444. }
  9445. if (canBeLeftOpenTag$$1(tagName) && lastTag === tagName) {
  9446. parseEndTag(tagName);
  9447. }
  9448. }
  9449.  
  9450. var unary = isUnaryTag$$1(tagName) || !!unarySlash;
  9451.  
  9452. var l = match.attrs.length;
  9453. var attrs = new Array(l);
  9454. for (var i = 0; i < l; i++) {
  9455. var args = match.attrs[i];
  9456. var value = args[3] || args[4] || args[5] || '';
  9457. var shouldDecodeNewlines = tagName === 'a' && args[1] === 'href'
  9458. ? options.shouldDecodeNewlinesForHref
  9459. : options.shouldDecodeNewlines;
  9460. attrs[i] = {
  9461. name: args[1],
  9462. value: decodeAttr(value, shouldDecodeNewlines)
  9463. };
  9464. if (options.outputSourceRange) {
  9465. attrs[i].start = args.start + args[0].match(/^\s*/).length;
  9466. attrs[i].end = args.end;
  9467. }
  9468. }
  9469.  
  9470. if (!unary) {
  9471. stack.push({ tag: tagName, lowerCasedTag: tagName.toLowerCase(), attrs: attrs, start: match.start, end: match.end });
  9472. lastTag = tagName;
  9473. }
  9474.  
  9475. if (options.start) {
  9476. options.start(tagName, attrs, unary, match.start, match.end);
  9477. }
  9478. }
  9479.  
  9480. function parseEndTag (tagName, start, end) {
  9481. var pos, lowerCasedTagName;
  9482. if (start == null) { start = index; }
  9483. if (end == null) { end = index; }
  9484.  
  9485. // Find the closest opened tag of the same type
  9486. if (tagName) {
  9487. lowerCasedTagName = tagName.toLowerCase();
  9488. for (pos = stack.length - 1; pos >= 0; pos--) {
  9489. if (stack[pos].lowerCasedTag === lowerCasedTagName) {
  9490. break
  9491. }
  9492. }
  9493. } else {
  9494. // If no tag name is provided, clean shop
  9495. pos = 0;
  9496. }
  9497.  
  9498. if (pos >= 0) {
  9499. // Close all the open elements, up the stack
  9500. for (var i = stack.length - 1; i >= pos; i--) {
  9501. if (i > pos || !tagName &&
  9502. options.warn
  9503. ) {
  9504. options.warn(
  9505. ("tag <" + (stack[i].tag) + "> has no matching end tag."),
  9506. { start: stack[i].start, end: stack[i].end }
  9507. );
  9508. }
  9509. if (options.end) {
  9510. options.end(stack[i].tag, start, end);
  9511. }
  9512. }
  9513.  
  9514. // Remove the open elements from the stack
  9515. stack.length = pos;
  9516. lastTag = pos && stack[pos - 1].tag;
  9517. } else if (lowerCasedTagName === 'br') {
  9518. if (options.start) {
  9519. options.start(tagName, [], true, start, end);
  9520. }
  9521. } else if (lowerCasedTagName === 'p') {
  9522. if (options.start) {
  9523. options.start(tagName, [], false, start, end);
  9524. }
  9525. if (options.end) {
  9526. options.end(tagName, start, end);
  9527. }
  9528. }
  9529. }
  9530. }
  9531.  
  9532. /* */
  9533.  
  9534. var onRE = /^@|^v-on:/;
  9535. var dirRE = /^v-|^@|^:/;
  9536. var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
  9537. var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
  9538. var stripParensRE = /^\(|\)$/g;
  9539. var dynamicArgRE = /^\[.*\]$/;
  9540.  
  9541. var argRE = /:(.*)$/;
  9542. var bindRE = /^:|^\.|^v-bind:/;
  9543. var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
  9544.  
  9545. var slotRE = /^v-slot(:|$)|^#/;
  9546.  
  9547. var lineBreakRE = /[\r\n]/;
  9548. var whitespaceRE$1 = /\s+/g;
  9549.  
  9550. var invalidAttributeRE = /[\s"'<>\/=]/;
  9551.  
  9552. var decodeHTMLCached = cached(he.decode);
  9553.  
  9554. var emptySlotScopeToken = "_empty_";
  9555.  
  9556. // configurable state
  9557. var warn$2;
  9558. var delimiters;
  9559. var transforms;
  9560. var preTransforms;
  9561. var postTransforms;
  9562. var platformIsPreTag;
  9563. var platformMustUseProp;
  9564. var platformGetTagNamespace;
  9565. var maybeComponent;
  9566.  
  9567. function createASTElement (
  9568. tag,
  9569. attrs,
  9570. parent
  9571. ) {
  9572. return {
  9573. type: 1,
  9574. tag: tag,
  9575. attrsList: attrs,
  9576. attrsMap: makeAttrsMap(attrs),
  9577. rawAttrsMap: {},
  9578. parent: parent,
  9579. children: []
  9580. }
  9581. }
  9582.  
  9583. /**
  9584. * Convert HTML string to AST.
  9585. */
  9586. function parse (
  9587. template,
  9588. options
  9589. ) {
  9590. warn$2 = options.warn || baseWarn;
  9591.  
  9592. platformIsPreTag = options.isPreTag || no;
  9593. platformMustUseProp = options.mustUseProp || no;
  9594. platformGetTagNamespace = options.getTagNamespace || no;
  9595. var isReservedTag = options.isReservedTag || no;
  9596. maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  9597.  
  9598. transforms = pluckModuleFunction(options.modules, 'transformNode');
  9599. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  9600. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  9601.  
  9602. delimiters = options.delimiters;
  9603.  
  9604. var stack = [];
  9605. var preserveWhitespace = options.preserveWhitespace !== false;
  9606. var whitespaceOption = options.whitespace;
  9607. var root;
  9608. var currentParent;
  9609. var inVPre = false;
  9610. var inPre = false;
  9611. var warned = false;
  9612.  
  9613. function warnOnce (msg, range) {
  9614. if (!warned) {
  9615. warned = true;
  9616. warn$2(msg, range);
  9617. }
  9618. }
  9619.  
  9620. function closeElement (element) {
  9621. trimEndingWhitespace(element);
  9622. if (!inVPre && !element.processed) {
  9623. element = processElement(element, options);
  9624. }
  9625. // tree management
  9626. if (!stack.length && element !== root) {
  9627. // allow root elements with v-if, v-else-if and v-else
  9628. if (root.if && (element.elseif || element.else)) {
  9629. {
  9630. checkRootConstraints(element);
  9631. }
  9632. addIfCondition(root, {
  9633. exp: element.elseif,
  9634. block: element
  9635. });
  9636. } else {
  9637. warnOnce(
  9638. "Component template should contain exactly one root element. " +
  9639. "If you are using v-if on multiple elements, " +
  9640. "use v-else-if to chain them instead.",
  9641. { start: element.start }
  9642. );
  9643. }
  9644. }
  9645. if (currentParent && !element.forbidden) {
  9646. if (element.elseif || element.else) {
  9647. processIfConditions(element, currentParent);
  9648. } else {
  9649. if (element.slotScope) {
  9650. // scoped slot
  9651. // keep it in the children list so that v-else(-if) conditions can
  9652. // find it as the prev node.
  9653. var name = element.slotTarget || '"default"'
  9654. ;(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  9655. }
  9656. currentParent.children.push(element);
  9657. element.parent = currentParent;
  9658. }
  9659. }
  9660.  
  9661. // final children cleanup
  9662. // filter out scoped slots
  9663. element.children = element.children.filter(function (c) { return !(c).slotScope; });
  9664. // remove trailing whitespace node again
  9665. trimEndingWhitespace(element);
  9666.  
  9667. // check pre state
  9668. if (element.pre) {
  9669. inVPre = false;
  9670. }
  9671. if (platformIsPreTag(element.tag)) {
  9672. inPre = false;
  9673. }
  9674. // apply post-transforms
  9675. for (var i = 0; i < postTransforms.length; i++) {
  9676. postTransforms[i](element, options);
  9677. }
  9678. }
  9679.  
  9680. function trimEndingWhitespace (el) {
  9681. // remove trailing whitespace node
  9682. if (!inPre) {
  9683. var lastNode;
  9684. while (
  9685. (lastNode = el.children[el.children.length - 1]) &&
  9686. lastNode.type === 3 &&
  9687. lastNode.text === ' '
  9688. ) {
  9689. el.children.pop();
  9690. }
  9691. }
  9692. }
  9693.  
  9694. function checkRootConstraints (el) {
  9695. if (el.tag === 'slot' || el.tag === 'template') {
  9696. warnOnce(
  9697. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  9698. 'contain multiple nodes.',
  9699. { start: el.start }
  9700. );
  9701. }
  9702. if (el.attrsMap.hasOwnProperty('v-for')) {
  9703. warnOnce(
  9704. 'Cannot use v-for on stateful component root element because ' +
  9705. 'it renders multiple elements.',
  9706. el.rawAttrsMap['v-for']
  9707. );
  9708. }
  9709. }
  9710.  
  9711. parseHTML(template, {
  9712. warn: warn$2,
  9713. expectHTML: options.expectHTML,
  9714. isUnaryTag: options.isUnaryTag,
  9715. canBeLeftOpenTag: options.canBeLeftOpenTag,
  9716. shouldDecodeNewlines: options.shouldDecodeNewlines,
  9717. shouldDecodeNewlinesForHref: options.shouldDecodeNewlinesForHref,
  9718. shouldKeepComment: options.comments,
  9719. outputSourceRange: options.outputSourceRange,
  9720. start: function start (tag, attrs, unary, start$1, end) {
  9721. // check namespace.
  9722. // inherit parent ns if there is one
  9723. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  9724.  
  9725. // handle IE svg bug
  9726. /* istanbul ignore if */
  9727. if (isIE && ns === 'svg') {
  9728. attrs = guardIESVGBug(attrs);
  9729. }
  9730.  
  9731. var element = createASTElement(tag, attrs, currentParent);
  9732. if (ns) {
  9733. element.ns = ns;
  9734. }
  9735.  
  9736. {
  9737. if (options.outputSourceRange) {
  9738. element.start = start$1;
  9739. element.end = end;
  9740. element.rawAttrsMap = element.attrsList.reduce(function (cumulated, attr) {
  9741. cumulated[attr.name] = attr;
  9742. return cumulated
  9743. }, {});
  9744. }
  9745. attrs.forEach(function (attr) {
  9746. if (invalidAttributeRE.test(attr.name)) {
  9747. warn$2(
  9748. "Invalid dynamic argument expression: attribute names cannot contain " +
  9749. "spaces, quotes, <, >, / or =.",
  9750. {
  9751. start: attr.start + attr.name.indexOf("["),
  9752. end: attr.start + attr.name.length
  9753. }
  9754. );
  9755. }
  9756. });
  9757. }
  9758.  
  9759. if (isForbiddenTag(element) && !isServerRendering()) {
  9760. element.forbidden = true;
  9761. warn$2(
  9762. 'Templates should only be responsible for mapping the state to the ' +
  9763. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  9764. "<" + tag + ">" + ', as they will not be parsed.',
  9765. { start: element.start }
  9766. );
  9767. }
  9768.  
  9769. // apply pre-transforms
  9770. for (var i = 0; i < preTransforms.length; i++) {
  9771. element = preTransforms[i](element, options) || element;
  9772. }
  9773.  
  9774. if (!inVPre) {
  9775. processPre(element);
  9776. if (element.pre) {
  9777. inVPre = true;
  9778. }
  9779. }
  9780. if (platformIsPreTag(element.tag)) {
  9781. inPre = true;
  9782. }
  9783. if (inVPre) {
  9784. processRawAttrs(element);
  9785. } else if (!element.processed) {
  9786. // structural directives
  9787. processFor(element);
  9788. processIf(element);
  9789. processOnce(element);
  9790. }
  9791.  
  9792. if (!root) {
  9793. root = element;
  9794. {
  9795. checkRootConstraints(root);
  9796. }
  9797. }
  9798.  
  9799. if (!unary) {
  9800. currentParent = element;
  9801. stack.push(element);
  9802. } else {
  9803. closeElement(element);
  9804. }
  9805. },
  9806.  
  9807. end: function end (tag, start, end$1) {
  9808. var element = stack[stack.length - 1];
  9809. // pop stack
  9810. stack.length -= 1;
  9811. currentParent = stack[stack.length - 1];
  9812. if (options.outputSourceRange) {
  9813. element.end = end$1;
  9814. }
  9815. closeElement(element);
  9816. },
  9817.  
  9818. chars: function chars (text, start, end) {
  9819. if (!currentParent) {
  9820. {
  9821. if (text === template) {
  9822. warnOnce(
  9823. 'Component template requires a root element, rather than just text.',
  9824. { start: start }
  9825. );
  9826. } else if ((text = text.trim())) {
  9827. warnOnce(
  9828. ("text \"" + text + "\" outside root element will be ignored."),
  9829. { start: start }
  9830. );
  9831. }
  9832. }
  9833. return
  9834. }
  9835. // IE textarea placeholder bug
  9836. /* istanbul ignore if */
  9837. if (isIE &&
  9838. currentParent.tag === 'textarea' &&
  9839. currentParent.attrsMap.placeholder === text
  9840. ) {
  9841. return
  9842. }
  9843. var children = currentParent.children;
  9844. if (inPre || text.trim()) {
  9845. text = isTextTag(currentParent) ? text : decodeHTMLCached(text);
  9846. } else if (!children.length) {
  9847. // remove the whitespace-only node right after an opening tag
  9848. text = '';
  9849. } else if (whitespaceOption) {
  9850. if (whitespaceOption === 'condense') {
  9851. // in condense mode, remove the whitespace node if it contains
  9852. // line break, otherwise condense to a single space
  9853. text = lineBreakRE.test(text) ? '' : ' ';
  9854. } else {
  9855. text = ' ';
  9856. }
  9857. } else {
  9858. text = preserveWhitespace ? ' ' : '';
  9859. }
  9860. if (text) {
  9861. if (!inPre && whitespaceOption === 'condense') {
  9862. // condense consecutive whitespaces into single space
  9863. text = text.replace(whitespaceRE$1, ' ');
  9864. }
  9865. var res;
  9866. var child;
  9867. if (!inVPre && text !== ' ' && (res = parseText(text, delimiters))) {
  9868. child = {
  9869. type: 2,
  9870. expression: res.expression,
  9871. tokens: res.tokens,
  9872. text: text
  9873. };
  9874. } else if (text !== ' ' || !children.length || children[children.length - 1].text !== ' ') {
  9875. child = {
  9876. type: 3,
  9877. text: text
  9878. };
  9879. }
  9880. if (child) {
  9881. if (options.outputSourceRange) {
  9882. child.start = start;
  9883. child.end = end;
  9884. }
  9885. children.push(child);
  9886. }
  9887. }
  9888. },
  9889. comment: function comment (text, start, end) {
  9890. // adding anyting as a sibling to the root node is forbidden
  9891. // comments should still be allowed, but ignored
  9892. if (currentParent) {
  9893. var child = {
  9894. type: 3,
  9895. text: text,
  9896. isComment: true
  9897. };
  9898. if (options.outputSourceRange) {
  9899. child.start = start;
  9900. child.end = end;
  9901. }
  9902. currentParent.children.push(child);
  9903. }
  9904. }
  9905. });
  9906. return root
  9907. }
  9908.  
  9909. function processPre (el) {
  9910. if (getAndRemoveAttr(el, 'v-pre') != null) {
  9911. el.pre = true;
  9912. }
  9913. }
  9914.  
  9915. function processRawAttrs (el) {
  9916. var list = el.attrsList;
  9917. var len = list.length;
  9918. if (len) {
  9919. var attrs = el.attrs = new Array(len);
  9920. for (var i = 0; i < len; i++) {
  9921. attrs[i] = {
  9922. name: list[i].name,
  9923. value: JSON.stringify(list[i].value)
  9924. };
  9925. if (list[i].start != null) {
  9926. attrs[i].start = list[i].start;
  9927. attrs[i].end = list[i].end;
  9928. }
  9929. }
  9930. } else if (!el.pre) {
  9931. // non root node in pre blocks with no attributes
  9932. el.plain = true;
  9933. }
  9934. }
  9935.  
  9936. function processElement (
  9937. element,
  9938. options
  9939. ) {
  9940. processKey(element);
  9941.  
  9942. // determine whether this is a plain element after
  9943. // removing structural attributes
  9944. element.plain = (
  9945. !element.key &&
  9946. !element.scopedSlots &&
  9947. !element.attrsList.length
  9948. );
  9949.  
  9950. processRef(element);
  9951. processSlotContent(element);
  9952. processSlotOutlet(element);
  9953. processComponent(element);
  9954. for (var i = 0; i < transforms.length; i++) {
  9955. element = transforms[i](element, options) || element;
  9956. }
  9957. processAttrs(element);
  9958. return element
  9959. }
  9960.  
  9961. function processKey (el) {
  9962. var exp = getBindingAttr(el, 'key');
  9963. if (exp) {
  9964. {
  9965. if (el.tag === 'template') {
  9966. warn$2(
  9967. "<template> cannot be keyed. Place the key on real elements instead.",
  9968. getRawBindingAttr(el, 'key')
  9969. );
  9970. }
  9971. if (el.for) {
  9972. var iterator = el.iterator2 || el.iterator1;
  9973. var parent = el.parent;
  9974. if (iterator && iterator === exp && parent && parent.tag === 'transition-group') {
  9975. warn$2(
  9976. "Do not use v-for index as key on <transition-group> children, " +
  9977. "this is the same as not using keys.",
  9978. getRawBindingAttr(el, 'key'),
  9979. true /* tip */
  9980. );
  9981. }
  9982. }
  9983. }
  9984. el.key = exp;
  9985. }
  9986. }
  9987.  
  9988. function processRef (el) {
  9989. var ref = getBindingAttr(el, 'ref');
  9990. if (ref) {
  9991. el.ref = ref;
  9992. el.refInFor = checkInFor(el);
  9993. }
  9994. }
  9995.  
  9996. function processFor (el) {
  9997. var exp;
  9998. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  9999. var res = parseFor(exp);
  10000. if (res) {
  10001. extend(el, res);
  10002. } else {
  10003. warn$2(
  10004. ("Invalid v-for expression: " + exp),
  10005. el.rawAttrsMap['v-for']
  10006. );
  10007. }
  10008. }
  10009. }
  10010.  
  10011.  
  10012.  
  10013. function parseFor (exp) {
  10014. var inMatch = exp.match(forAliasRE);
  10015. if (!inMatch) { return }
  10016. var res = {};
  10017. res.for = inMatch[2].trim();
  10018. var alias = inMatch[1].trim().replace(stripParensRE, '');
  10019. var iteratorMatch = alias.match(forIteratorRE);
  10020. if (iteratorMatch) {
  10021. res.alias = alias.replace(forIteratorRE, '').trim();
  10022. res.iterator1 = iteratorMatch[1].trim();
  10023. if (iteratorMatch[2]) {
  10024. res.iterator2 = iteratorMatch[2].trim();
  10025. }
  10026. } else {
  10027. res.alias = alias;
  10028. }
  10029. return res
  10030. }
  10031.  
  10032. function processIf (el) {
  10033. var exp = getAndRemoveAttr(el, 'v-if');
  10034. if (exp) {
  10035. el.if = exp;
  10036. addIfCondition(el, {
  10037. exp: exp,
  10038. block: el
  10039. });
  10040. } else {
  10041. if (getAndRemoveAttr(el, 'v-else') != null) {
  10042. el.else = true;
  10043. }
  10044. var elseif = getAndRemoveAttr(el, 'v-else-if');
  10045. if (elseif) {
  10046. el.elseif = elseif;
  10047. }
  10048. }
  10049. }
  10050.  
  10051. function processIfConditions (el, parent) {
  10052. var prev = findPrevElement(parent.children);
  10053. if (prev && prev.if) {
  10054. addIfCondition(prev, {
  10055. exp: el.elseif,
  10056. block: el
  10057. });
  10058. } else {
  10059. warn$2(
  10060. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  10061. "used on element <" + (el.tag) + "> without corresponding v-if.",
  10062. el.rawAttrsMap[el.elseif ? 'v-else-if' : 'v-else']
  10063. );
  10064. }
  10065. }
  10066.  
  10067. function findPrevElement (children) {
  10068. var i = children.length;
  10069. while (i--) {
  10070. if (children[i].type === 1) {
  10071. return children[i]
  10072. } else {
  10073. if (children[i].text !== ' ') {
  10074. warn$2(
  10075. "text \"" + (children[i].text.trim()) + "\" between v-if and v-else(-if) " +
  10076. "will be ignored.",
  10077. children[i]
  10078. );
  10079. }
  10080. children.pop();
  10081. }
  10082. }
  10083. }
  10084.  
  10085. function addIfCondition (el, condition) {
  10086. if (!el.ifConditions) {
  10087. el.ifConditions = [];
  10088. }
  10089. el.ifConditions.push(condition);
  10090. }
  10091.  
  10092. function processOnce (el) {
  10093. var once$$1 = getAndRemoveAttr(el, 'v-once');
  10094. if (once$$1 != null) {
  10095. el.once = true;
  10096. }
  10097. }
  10098.  
  10099. // handle content being passed to a component as slot,
  10100. // e.g. <template slot="xxx">, <div slot-scope="xxx">
  10101. function processSlotContent (el) {
  10102. var slotScope;
  10103. if (el.tag === 'template') {
  10104. slotScope = getAndRemoveAttr(el, 'scope');
  10105. /* istanbul ignore if */
  10106. if (slotScope) {
  10107. warn$2(
  10108. "the \"scope\" attribute for scoped slots have been deprecated and " +
  10109. "replaced by \"slot-scope\" since 2.5. The new \"slot-scope\" attribute " +
  10110. "can also be used on plain elements in addition to <template> to " +
  10111. "denote scoped slots.",
  10112. el.rawAttrsMap['scope'],
  10113. true
  10114. );
  10115. }
  10116. el.slotScope = slotScope || getAndRemoveAttr(el, 'slot-scope');
  10117. } else if ((slotScope = getAndRemoveAttr(el, 'slot-scope'))) {
  10118. /* istanbul ignore if */
  10119. if (el.attrsMap['v-for']) {
  10120. warn$2(
  10121. "Ambiguous combined usage of slot-scope and v-for on <" + (el.tag) + "> " +
  10122. "(v-for takes higher priority). Use a wrapper <template> for the " +
  10123. "scoped slot to make it clearer.",
  10124. el.rawAttrsMap['slot-scope'],
  10125. true
  10126. );
  10127. }
  10128. el.slotScope = slotScope;
  10129. }
  10130.  
  10131. // slot="xxx"
  10132. var slotTarget = getBindingAttr(el, 'slot');
  10133. if (slotTarget) {
  10134. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  10135. el.slotTargetDynamic = !!(el.attrsMap[':slot'] || el.attrsMap['v-bind:slot']);
  10136. // preserve slot as an attribute for native shadow DOM compat
  10137. // only for non-scoped slots.
  10138. if (el.tag !== 'template' && !el.slotScope) {
  10139. addAttr(el, 'slot', slotTarget, getRawBindingAttr(el, 'slot'));
  10140. }
  10141. }
  10142.  
  10143. // 2.6 v-slot syntax
  10144. {
  10145. if (el.tag === 'template') {
  10146. // v-slot on <template>
  10147. var slotBinding = getAndRemoveAttrByRegex(el, slotRE);
  10148. if (slotBinding) {
  10149. {
  10150. if (el.slotTarget || el.slotScope) {
  10151. warn$2(
  10152. "Unexpected mixed usage of different slot syntaxes.",
  10153. el
  10154. );
  10155. }
  10156. if (el.parent && !maybeComponent(el.parent)) {
  10157. warn$2(
  10158. "<template v-slot> can only appear at the root level inside " +
  10159. "the receiving the component",
  10160. el
  10161. );
  10162. }
  10163. }
  10164. var ref = getSlotName(slotBinding);
  10165. var name = ref.name;
  10166. var dynamic = ref.dynamic;
  10167. el.slotTarget = name;
  10168. el.slotTargetDynamic = dynamic;
  10169. el.slotScope = slotBinding.value || emptySlotScopeToken; // force it into a scoped slot for perf
  10170. }
  10171. } else {
  10172. // v-slot on component, denotes default slot
  10173. var slotBinding$1 = getAndRemoveAttrByRegex(el, slotRE);
  10174. if (slotBinding$1) {
  10175. {
  10176. if (!maybeComponent(el)) {
  10177. warn$2(
  10178. "v-slot can only be used on components or <template>.",
  10179. slotBinding$1
  10180. );
  10181. }
  10182. if (el.slotScope || el.slotTarget) {
  10183. warn$2(
  10184. "Unexpected mixed usage of different slot syntaxes.",
  10185. el
  10186. );
  10187. }
  10188. if (el.scopedSlots) {
  10189. warn$2(
  10190. "To avoid scope ambiguity, the default slot should also use " +
  10191. "<template> syntax when there are other named slots.",
  10192. slotBinding$1
  10193. );
  10194. }
  10195. }
  10196. // add the component's children to its default slot
  10197. var slots = el.scopedSlots || (el.scopedSlots = {});
  10198. var ref$1 = getSlotName(slotBinding$1);
  10199. var name$1 = ref$1.name;
  10200. var dynamic$1 = ref$1.dynamic;
  10201. var slotContainer = slots[name$1] = createASTElement('template', [], el);
  10202. slotContainer.slotTarget = name$1;
  10203. slotContainer.slotTargetDynamic = dynamic$1;
  10204. slotContainer.children = el.children.filter(function (c) {
  10205. if (!c.slotScope) {
  10206. c.parent = slotContainer;
  10207. return true
  10208. }
  10209. });
  10210. slotContainer.slotScope = slotBinding$1.value || emptySlotScopeToken;
  10211. // remove children as they are returned from scopedSlots now
  10212. el.children = [];
  10213. // mark el non-plain so data gets generated
  10214. el.plain = false;
  10215. }
  10216. }
  10217. }
  10218. }
  10219.  
  10220. function getSlotName (binding) {
  10221. var name = binding.name.replace(slotRE, '');
  10222. if (!name) {
  10223. if (binding.name[0] !== '#') {
  10224. name = 'default';
  10225. } else {
  10226. warn$2(
  10227. "v-slot shorthand syntax requires a slot name.",
  10228. binding
  10229. );
  10230. }
  10231. }
  10232. return dynamicArgRE.test(name)
  10233. // dynamic [name]
  10234. ? { name: name.slice(1, -1), dynamic: true }
  10235. // static name
  10236. : { name: ("\"" + name + "\""), dynamic: false }
  10237. }
  10238.  
  10239. // handle <slot/> outlets
  10240. function processSlotOutlet (el) {
  10241. if (el.tag === 'slot') {
  10242. el.slotName = getBindingAttr(el, 'name');
  10243. if (el.key) {
  10244. warn$2(
  10245. "`key` does not work on <slot> because slots are abstract outlets " +
  10246. "and can possibly expand into multiple elements. " +
  10247. "Use the key on a wrapping element instead.",
  10248. getRawBindingAttr(el, 'key')
  10249. );
  10250. }
  10251. }
  10252. }
  10253.  
  10254. function processComponent (el) {
  10255. var binding;
  10256. if ((binding = getBindingAttr(el, 'is'))) {
  10257. el.component = binding;
  10258. }
  10259. if (getAndRemoveAttr(el, 'inline-template') != null) {
  10260. el.inlineTemplate = true;
  10261. }
  10262. }
  10263.  
  10264. function processAttrs (el) {
  10265. var list = el.attrsList;
  10266. var i, l, name, rawName, value, modifiers, syncGen, isDynamic;
  10267. for (i = 0, l = list.length; i < l; i++) {
  10268. name = rawName = list[i].name;
  10269. value = list[i].value;
  10270. if (dirRE.test(name)) {
  10271. // mark element as dynamic
  10272. el.hasBindings = true;
  10273. // modifiers
  10274. modifiers = parseModifiers(name.replace(dirRE, ''));
  10275. // support .foo shorthand syntax for the .prop modifier
  10276. if (modifiers) {
  10277. name = name.replace(modifierRE, '');
  10278. }
  10279. if (bindRE.test(name)) { // v-bind
  10280. name = name.replace(bindRE, '');
  10281. value = parseFilters(value);
  10282. isDynamic = dynamicArgRE.test(name);
  10283. if (isDynamic) {
  10284. name = name.slice(1, -1);
  10285. }
  10286. if (
  10287. value.trim().length === 0
  10288. ) {
  10289. warn$2(
  10290. ("The value for a v-bind expression cannot be empty. Found in \"v-bind:" + name + "\"")
  10291. );
  10292. }
  10293. if (modifiers) {
  10294. if (modifiers.prop && !isDynamic) {
  10295. name = camelize(name);
  10296. if (name === 'innerHtml') { name = 'innerHTML'; }
  10297. }
  10298. if (modifiers.camel && !isDynamic) {
  10299. name = camelize(name);
  10300. }
  10301. if (modifiers.sync) {
  10302. syncGen = genAssignmentCode(value, "$event");
  10303. if (!isDynamic) {
  10304. addHandler(
  10305. el,
  10306. ("update:" + (camelize(name))),
  10307. syncGen,
  10308. null,
  10309. false,
  10310. warn$2,
  10311. list[i]
  10312. );
  10313. if (hyphenate(name) !== camelize(name)) {
  10314. addHandler(
  10315. el,
  10316. ("update:" + (hyphenate(name))),
  10317. syncGen,
  10318. null,
  10319. false,
  10320. warn$2,
  10321. list[i]
  10322. );
  10323. }
  10324. } else {
  10325. // handler w/ dynamic event name
  10326. addHandler(
  10327. el,
  10328. ("\"update:\"+(" + name + ")"),
  10329. syncGen,
  10330. null,
  10331. false,
  10332. warn$2,
  10333. list[i],
  10334. true // dynamic
  10335. );
  10336. }
  10337. }
  10338. }
  10339. if ((modifiers && modifiers.prop) || (
  10340. !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
  10341. )) {
  10342. addProp(el, name, value, list[i], isDynamic);
  10343. } else {
  10344. addAttr(el, name, value, list[i], isDynamic);
  10345. }
  10346. } else if (onRE.test(name)) { // v-on
  10347. name = name.replace(onRE, '');
  10348. isDynamic = dynamicArgRE.test(name);
  10349. if (isDynamic) {
  10350. name = name.slice(1, -1);
  10351. }
  10352. addHandler(el, name, value, modifiers, false, warn$2, list[i], isDynamic);
  10353. } else { // normal directives
  10354. name = name.replace(dirRE, '');
  10355. // parse arg
  10356. var argMatch = name.match(argRE);
  10357. var arg = argMatch && argMatch[1];
  10358. isDynamic = false;
  10359. if (arg) {
  10360. name = name.slice(0, -(arg.length + 1));
  10361. if (dynamicArgRE.test(arg)) {
  10362. arg = arg.slice(1, -1);
  10363. isDynamic = true;
  10364. }
  10365. }
  10366. addDirective(el, name, rawName, value, arg, isDynamic, modifiers, list[i]);
  10367. if (name === 'model') {
  10368. checkForAliasModel(el, value);
  10369. }
  10370. }
  10371. } else {
  10372. // literal attribute
  10373. {
  10374. var res = parseText(value, delimiters);
  10375. if (res) {
  10376. warn$2(
  10377. name + "=\"" + value + "\": " +
  10378. 'Interpolation inside attributes has been removed. ' +
  10379. 'Use v-bind or the colon shorthand instead. For example, ' +
  10380. 'instead of <div id="{{ val }}">, use <div :id="val">.',
  10381. list[i]
  10382. );
  10383. }
  10384. }
  10385. addAttr(el, name, JSON.stringify(value), list[i]);
  10386. // #6887 firefox doesn't update muted state if set via attribute
  10387. // even immediately after element creation
  10388. if (!el.component &&
  10389. name === 'muted' &&
  10390. platformMustUseProp(el.tag, el.attrsMap.type, name)) {
  10391. addProp(el, name, 'true', list[i]);
  10392. }
  10393. }
  10394. }
  10395. }
  10396.  
  10397. function checkInFor (el) {
  10398. var parent = el;
  10399. while (parent) {
  10400. if (parent.for !== undefined) {
  10401. return true
  10402. }
  10403. parent = parent.parent;
  10404. }
  10405. return false
  10406. }
  10407.  
  10408. function parseModifiers (name) {
  10409. var match = name.match(modifierRE);
  10410. if (match) {
  10411. var ret = {};
  10412. match.forEach(function (m) { ret[m.slice(1)] = true; });
  10413. return ret
  10414. }
  10415. }
  10416.  
  10417. function makeAttrsMap (attrs) {
  10418. var map = {};
  10419. for (var i = 0, l = attrs.length; i < l; i++) {
  10420. if (
  10421. map[attrs[i].name] && !isIE && !isEdge
  10422. ) {
  10423. warn$2('duplicate attribute: ' + attrs[i].name, attrs[i]);
  10424. }
  10425. map[attrs[i].name] = attrs[i].value;
  10426. }
  10427. return map
  10428. }
  10429.  
  10430. // for script (e.g. type="x/template") or style, do not decode content
  10431. function isTextTag (el) {
  10432. return el.tag === 'script' || el.tag === 'style'
  10433. }
  10434.  
  10435. function isForbiddenTag (el) {
  10436. return (
  10437. el.tag === 'style' ||
  10438. (el.tag === 'script' && (
  10439. !el.attrsMap.type ||
  10440. el.attrsMap.type === 'text/javascript'
  10441. ))
  10442. )
  10443. }
  10444.  
  10445. var ieNSBug = /^xmlns:NS\d+/;
  10446. var ieNSPrefix = /^NS\d+:/;
  10447.  
  10448. /* istanbul ignore next */
  10449. function guardIESVGBug (attrs) {
  10450. var res = [];
  10451. for (var i = 0; i < attrs.length; i++) {
  10452. var attr = attrs[i];
  10453. if (!ieNSBug.test(attr.name)) {
  10454. attr.name = attr.name.replace(ieNSPrefix, '');
  10455. res.push(attr);
  10456. }
  10457. }
  10458. return res
  10459. }
  10460.  
  10461. function checkForAliasModel (el, value) {
  10462. var _el = el;
  10463. while (_el) {
  10464. if (_el.for && _el.alias === value) {
  10465. warn$2(
  10466. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  10467. "You are binding v-model directly to a v-for iteration alias. " +
  10468. "This will not be able to modify the v-for source array because " +
  10469. "writing to the alias is like modifying a function local variable. " +
  10470. "Consider using an array of objects and use v-model on an object property instead.",
  10471. el.rawAttrsMap['v-model']
  10472. );
  10473. }
  10474. _el = _el.parent;
  10475. }
  10476. }
  10477.  
  10478. /* */
  10479.  
  10480. function preTransformNode (el, options) {
  10481. if (el.tag === 'input') {
  10482. var map = el.attrsMap;
  10483. if (!map['v-model']) {
  10484. return
  10485. }
  10486.  
  10487. var typeBinding;
  10488. if (map[':type'] || map['v-bind:type']) {
  10489. typeBinding = getBindingAttr(el, 'type');
  10490. }
  10491. if (!map.type && !typeBinding && map['v-bind']) {
  10492. typeBinding = "(" + (map['v-bind']) + ").type";
  10493. }
  10494.  
  10495. if (typeBinding) {
  10496. var ifCondition = getAndRemoveAttr(el, 'v-if', true);
  10497. var ifConditionExtra = ifCondition ? ("&&(" + ifCondition + ")") : "";
  10498. var hasElse = getAndRemoveAttr(el, 'v-else', true) != null;
  10499. var elseIfCondition = getAndRemoveAttr(el, 'v-else-if', true);
  10500. // 1. checkbox
  10501. var branch0 = cloneASTElement(el);
  10502. // process for on the main node
  10503. processFor(branch0);
  10504. addRawAttr(branch0, 'type', 'checkbox');
  10505. processElement(branch0, options);
  10506. branch0.processed = true; // prevent it from double-processed
  10507. branch0.if = "(" + typeBinding + ")==='checkbox'" + ifConditionExtra;
  10508. addIfCondition(branch0, {
  10509. exp: branch0.if,
  10510. block: branch0
  10511. });
  10512. // 2. add radio else-if condition
  10513. var branch1 = cloneASTElement(el);
  10514. getAndRemoveAttr(branch1, 'v-for', true);
  10515. addRawAttr(branch1, 'type', 'radio');
  10516. processElement(branch1, options);
  10517. addIfCondition(branch0, {
  10518. exp: "(" + typeBinding + ")==='radio'" + ifConditionExtra,
  10519. block: branch1
  10520. });
  10521. // 3. other
  10522. var branch2 = cloneASTElement(el);
  10523. getAndRemoveAttr(branch2, 'v-for', true);
  10524. addRawAttr(branch2, ':type', typeBinding);
  10525. processElement(branch2, options);
  10526. addIfCondition(branch0, {
  10527. exp: ifCondition,
  10528. block: branch2
  10529. });
  10530.  
  10531. if (hasElse) {
  10532. branch0.else = true;
  10533. } else if (elseIfCondition) {
  10534. branch0.elseif = elseIfCondition;
  10535. }
  10536.  
  10537. return branch0
  10538. }
  10539. }
  10540. }
  10541.  
  10542. function cloneASTElement (el) {
  10543. return createASTElement(el.tag, el.attrsList.slice(), el.parent)
  10544. }
  10545.  
  10546. var model$1 = {
  10547. preTransformNode: preTransformNode
  10548. };
  10549.  
  10550. var modules$1 = [
  10551. klass$1,
  10552. style$1,
  10553. model$1
  10554. ];
  10555.  
  10556. /* */
  10557.  
  10558. function text (el, dir) {
  10559. if (dir.value) {
  10560. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"), dir);
  10561. }
  10562. }
  10563.  
  10564. /* */
  10565.  
  10566. function html (el, dir) {
  10567. if (dir.value) {
  10568. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"), dir);
  10569. }
  10570. }
  10571.  
  10572. var directives$1 = {
  10573. model: model,
  10574. text: text,
  10575. html: html
  10576. };
  10577.  
  10578. /* */
  10579.  
  10580. var baseOptions = {
  10581. expectHTML: true,
  10582. modules: modules$1,
  10583. directives: directives$1,
  10584. isPreTag: isPreTag,
  10585. isUnaryTag: isUnaryTag,
  10586. mustUseProp: mustUseProp,
  10587. canBeLeftOpenTag: canBeLeftOpenTag,
  10588. isReservedTag: isReservedTag,
  10589. getTagNamespace: getTagNamespace,
  10590. staticKeys: genStaticKeys(modules$1)
  10591. };
  10592.  
  10593. /* */
  10594.  
  10595. var isStaticKey;
  10596. var isPlatformReservedTag;
  10597.  
  10598. var genStaticKeysCached = cached(genStaticKeys$1);
  10599.  
  10600. /**
  10601. * Goal of the optimizer: walk the generated template AST tree
  10602. * and detect sub-trees that are purely static, i.e. parts of
  10603. * the DOM that never needs to change.
  10604. *
  10605. * Once we detect these sub-trees, we can:
  10606. *
  10607. * 1. Hoist them into constants, so that we no longer need to
  10608. * create fresh nodes for them on each re-render;
  10609. * 2. Completely skip them in the patching process.
  10610. */
  10611. function optimize (root, options) {
  10612. if (!root) { return }
  10613. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  10614. isPlatformReservedTag = options.isReservedTag || no;
  10615. // first pass: mark all non-static nodes.
  10616. markStatic$1(root);
  10617. // second pass: mark static roots.
  10618. markStaticRoots(root, false);
  10619. }
  10620.  
  10621. function genStaticKeys$1 (keys) {
  10622. return makeMap(
  10623. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap' +
  10624. (keys ? ',' + keys : '')
  10625. )
  10626. }
  10627.  
  10628. function markStatic$1 (node) {
  10629. node.static = isStatic(node);
  10630. if (node.type === 1) {
  10631. // do not make component slot content static. this avoids
  10632. // 1. components not able to mutate slot nodes
  10633. // 2. static slot content fails for hot-reloading
  10634. if (
  10635. !isPlatformReservedTag(node.tag) &&
  10636. node.tag !== 'slot' &&
  10637. node.attrsMap['inline-template'] == null
  10638. ) {
  10639. return
  10640. }
  10641. for (var i = 0, l = node.children.length; i < l; i++) {
  10642. var child = node.children[i];
  10643. markStatic$1(child);
  10644. if (!child.static) {
  10645. node.static = false;
  10646. }
  10647. }
  10648. if (node.ifConditions) {
  10649. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  10650. var block = node.ifConditions[i$1].block;
  10651. markStatic$1(block);
  10652. if (!block.static) {
  10653. node.static = false;
  10654. }
  10655. }
  10656. }
  10657. }
  10658. }
  10659.  
  10660. function markStaticRoots (node, isInFor) {
  10661. if (node.type === 1) {
  10662. if (node.static || node.once) {
  10663. node.staticInFor = isInFor;
  10664. }
  10665. // For a node to qualify as a static root, it should have children that
  10666. // are not just static text. Otherwise the cost of hoisting out will
  10667. // outweigh the benefits and it's better off to just always render it fresh.
  10668. if (node.static && node.children.length && !(
  10669. node.children.length === 1 &&
  10670. node.children[0].type === 3
  10671. )) {
  10672. node.staticRoot = true;
  10673. return
  10674. } else {
  10675. node.staticRoot = false;
  10676. }
  10677. if (node.children) {
  10678. for (var i = 0, l = node.children.length; i < l; i++) {
  10679. markStaticRoots(node.children[i], isInFor || !!node.for);
  10680. }
  10681. }
  10682. if (node.ifConditions) {
  10683. for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
  10684. markStaticRoots(node.ifConditions[i$1].block, isInFor);
  10685. }
  10686. }
  10687. }
  10688. }
  10689.  
  10690. function isStatic (node) {
  10691. if (node.type === 2) { // expression
  10692. return false
  10693. }
  10694. if (node.type === 3) { // text
  10695. return true
  10696. }
  10697. return !!(node.pre || (
  10698. !node.hasBindings && // no dynamic bindings
  10699. !node.if && !node.for && // not v-if or v-for or v-else
  10700. !isBuiltInTag(node.tag) && // not a built-in
  10701. isPlatformReservedTag(node.tag) && // not a component
  10702. !isDirectChildOfTemplateFor(node) &&
  10703. Object.keys(node).every(isStaticKey)
  10704. ))
  10705. }
  10706.  
  10707. function isDirectChildOfTemplateFor (node) {
  10708. while (node.parent) {
  10709. node = node.parent;
  10710. if (node.tag !== 'template') {
  10711. return false
  10712. }
  10713. if (node.for) {
  10714. return true
  10715. }
  10716. }
  10717. return false
  10718. }
  10719.  
  10720. /* */
  10721.  
  10722. var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/;
  10723. var fnInvokeRE = /\([^)]*?\);*$/;
  10724. var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
  10725.  
  10726. // KeyboardEvent.keyCode aliases
  10727. var keyCodes = {
  10728. esc: 27,
  10729. tab: 9,
  10730. enter: 13,
  10731. space: 32,
  10732. up: 38,
  10733. left: 37,
  10734. right: 39,
  10735. down: 40,
  10736. 'delete': [8, 46]
  10737. };
  10738.  
  10739. // KeyboardEvent.key aliases
  10740. var keyNames = {
  10741. // #7880: IE11 and Edge use `Esc` for Escape key name.
  10742. esc: ['Esc', 'Escape'],
  10743. tab: 'Tab',
  10744. enter: 'Enter',
  10745. // #9112: IE11 uses `Spacebar` for Space key name.
  10746. space: [' ', 'Spacebar'],
  10747. // #7806: IE11 uses key names without `Arrow` prefix for arrow keys.
  10748. up: ['Up', 'ArrowUp'],
  10749. left: ['Left', 'ArrowLeft'],
  10750. right: ['Right', 'ArrowRight'],
  10751. down: ['Down', 'ArrowDown'],
  10752. // #9112: IE11 uses `Del` for Delete key name.
  10753. 'delete': ['Backspace', 'Delete', 'Del']
  10754. };
  10755.  
  10756. // #4868: modifiers that prevent the execution of the listener
  10757. // need to explicitly return null so that we can determine whether to remove
  10758. // the listener for .once
  10759. var genGuard = function (condition) { return ("if(" + condition + ")return null;"); };
  10760.  
  10761. var modifierCode = {
  10762. stop: '$event.stopPropagation();',
  10763. prevent: '$event.preventDefault();',
  10764. self: genGuard("$event.target !== $event.currentTarget"),
  10765. ctrl: genGuard("!$event.ctrlKey"),
  10766. shift: genGuard("!$event.shiftKey"),
  10767. alt: genGuard("!$event.altKey"),
  10768. meta: genGuard("!$event.metaKey"),
  10769. left: genGuard("'button' in $event && $event.button !== 0"),
  10770. middle: genGuard("'button' in $event && $event.button !== 1"),
  10771. right: genGuard("'button' in $event && $event.button !== 2")
  10772. };
  10773.  
  10774. function genHandlers (
  10775. events,
  10776. isNative
  10777. ) {
  10778. var prefix = isNative ? 'nativeOn:' : 'on:';
  10779. var staticHandlers = "";
  10780. var dynamicHandlers = "";
  10781. for (var name in events) {
  10782. var handlerCode = genHandler(events[name]);
  10783. if (events[name] && events[name].dynamic) {
  10784. dynamicHandlers += name + "," + handlerCode + ",";
  10785. } else {
  10786. staticHandlers += "\"" + name + "\":" + handlerCode + ",";
  10787. }
  10788. }
  10789. staticHandlers = "{" + (staticHandlers.slice(0, -1)) + "}";
  10790. if (dynamicHandlers) {
  10791. return prefix + "_d(" + staticHandlers + ",[" + (dynamicHandlers.slice(0, -1)) + "])"
  10792. } else {
  10793. return prefix + staticHandlers
  10794. }
  10795. }
  10796.  
  10797. function genHandler (handler) {
  10798. if (!handler) {
  10799. return 'function(){}'
  10800. }
  10801.  
  10802. if (Array.isArray(handler)) {
  10803. return ("[" + (handler.map(function (handler) { return genHandler(handler); }).join(',')) + "]")
  10804. }
  10805.  
  10806. var isMethodPath = simplePathRE.test(handler.value);
  10807. var isFunctionExpression = fnExpRE.test(handler.value);
  10808. var isFunctionInvocation = simplePathRE.test(handler.value.replace(fnInvokeRE, ''));
  10809.  
  10810. if (!handler.modifiers) {
  10811. if (isMethodPath || isFunctionExpression) {
  10812. return handler.value
  10813. }
  10814. return ("function($event){" + (isFunctionInvocation ? ("return " + (handler.value)) : handler.value) + "}") // inline statement
  10815. } else {
  10816. var code = '';
  10817. var genModifierCode = '';
  10818. var keys = [];
  10819. for (var key in handler.modifiers) {
  10820. if (modifierCode[key]) {
  10821. genModifierCode += modifierCode[key];
  10822. // left/right
  10823. if (keyCodes[key]) {
  10824. keys.push(key);
  10825. }
  10826. } else if (key === 'exact') {
  10827. var modifiers = (handler.modifiers);
  10828. genModifierCode += genGuard(
  10829. ['ctrl', 'shift', 'alt', 'meta']
  10830. .filter(function (keyModifier) { return !modifiers[keyModifier]; })
  10831. .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
  10832. .join('||')
  10833. );
  10834. } else {
  10835. keys.push(key);
  10836. }
  10837. }
  10838. if (keys.length) {
  10839. code += genKeyFilter(keys);
  10840. }
  10841. // Make sure modifiers like prevent and stop get executed after key filtering
  10842. if (genModifierCode) {
  10843. code += genModifierCode;
  10844. }
  10845. var handlerCode = isMethodPath
  10846. ? ("return " + (handler.value) + "($event)")
  10847. : isFunctionExpression
  10848. ? ("return (" + (handler.value) + ")($event)")
  10849. : isFunctionInvocation
  10850. ? ("return " + (handler.value))
  10851. : handler.value;
  10852. return ("function($event){" + code + handlerCode + "}")
  10853. }
  10854. }
  10855.  
  10856. function genKeyFilter (keys) {
  10857. return (
  10858. // make sure the key filters only apply to KeyboardEvents
  10859. // #9441: can't use 'keyCode' in $event because Chrome autofill fires fake
  10860. // key events that do not have keyCode property...
  10861. "if(!$event.type.indexOf('key')&&" +
  10862. (keys.map(genFilterCode).join('&&')) + ")return null;"
  10863. )
  10864. }
  10865.  
  10866. function genFilterCode (key) {
  10867. var keyVal = parseInt(key, 10);
  10868. if (keyVal) {
  10869. return ("$event.keyCode!==" + keyVal)
  10870. }
  10871. var keyCode = keyCodes[key];
  10872. var keyName = keyNames[key];
  10873. return (
  10874. "_k($event.keyCode," +
  10875. (JSON.stringify(key)) + "," +
  10876. (JSON.stringify(keyCode)) + "," +
  10877. "$event.key," +
  10878. "" + (JSON.stringify(keyName)) +
  10879. ")"
  10880. )
  10881. }
  10882.  
  10883. /* */
  10884.  
  10885. function on (el, dir) {
  10886. if (dir.modifiers) {
  10887. warn("v-on without argument does not support modifiers.");
  10888. }
  10889. el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
  10890. }
  10891.  
  10892. /* */
  10893.  
  10894. function bind$1 (el, dir) {
  10895. el.wrapData = function (code) {
  10896. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
  10897. };
  10898. }
  10899.  
  10900. /* */
  10901.  
  10902. var baseDirectives = {
  10903. on: on,
  10904. bind: bind$1,
  10905. cloak: noop
  10906. };
  10907.  
  10908. /* */
  10909.  
  10910.  
  10911.  
  10912.  
  10913.  
  10914. var CodegenState = function CodegenState (options) {
  10915. this.options = options;
  10916. this.warn = options.warn || baseWarn;
  10917. this.transforms = pluckModuleFunction(options.modules, 'transformCode');
  10918. this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
  10919. this.directives = extend(extend({}, baseDirectives), options.directives);
  10920. var isReservedTag = options.isReservedTag || no;
  10921. this.maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
  10922. this.onceId = 0;
  10923. this.staticRenderFns = [];
  10924. this.pre = false;
  10925. };
  10926.  
  10927.  
  10928.  
  10929. function generate (
  10930. ast,
  10931. options
  10932. ) {
  10933. var state = new CodegenState(options);
  10934. var code = ast ? genElement(ast, state) : '_c("div")';
  10935. return {
  10936. render: ("with(this){return " + code + "}"),
  10937. staticRenderFns: state.staticRenderFns
  10938. }
  10939. }
  10940.  
  10941. function genElement (el, state) {
  10942. if (el.parent) {
  10943. el.pre = el.pre || el.parent.pre;
  10944. }
  10945.  
  10946. if (el.staticRoot && !el.staticProcessed) {
  10947. return genStatic(el, state)
  10948. } else if (el.once && !el.onceProcessed) {
  10949. return genOnce(el, state)
  10950. } else if (el.for && !el.forProcessed) {
  10951. return genFor(el, state)
  10952. } else if (el.if && !el.ifProcessed) {
  10953. return genIf(el, state)
  10954. } else if (el.tag === 'template' && !el.slotTarget && !state.pre) {
  10955. return genChildren(el, state) || 'void 0'
  10956. } else if (el.tag === 'slot') {
  10957. return genSlot(el, state)
  10958. } else {
  10959. // component or element
  10960. var code;
  10961. if (el.component) {
  10962. code = genComponent(el.component, el, state);
  10963. } else {
  10964. var data;
  10965. if (!el.plain || (el.pre && state.maybeComponent(el))) {
  10966. data = genData$2(el, state);
  10967. }
  10968.  
  10969. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  10970. code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  10971. }
  10972. // module transforms
  10973. for (var i = 0; i < state.transforms.length; i++) {
  10974. code = state.transforms[i](el, code);
  10975. }
  10976. return code
  10977. }
  10978. }
  10979.  
  10980. // hoist static sub-trees out
  10981. function genStatic (el, state) {
  10982. el.staticProcessed = true;
  10983. // Some elements (templates) need to behave differently inside of a v-pre
  10984. // node. All pre nodes are static roots, so we can use this as a location to
  10985. // wrap a state change and reset it upon exiting the pre node.
  10986. var originalPreState = state.pre;
  10987. if (el.pre) {
  10988. state.pre = el.pre;
  10989. }
  10990. state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
  10991. state.pre = originalPreState;
  10992. return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  10993. }
  10994.  
  10995. // v-once
  10996. function genOnce (el, state) {
  10997. el.onceProcessed = true;
  10998. if (el.if && !el.ifProcessed) {
  10999. return genIf(el, state)
  11000. } else if (el.staticInFor) {
  11001. var key = '';
  11002. var parent = el.parent;
  11003. while (parent) {
  11004. if (parent.for) {
  11005. key = parent.key;
  11006. break
  11007. }
  11008. parent = parent.parent;
  11009. }
  11010. if (!key) {
  11011. state.warn(
  11012. "v-once can only be used inside v-for that is keyed. ",
  11013. el.rawAttrsMap['v-once']
  11014. );
  11015. return genElement(el, state)
  11016. }
  11017. return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + "," + key + ")")
  11018. } else {
  11019. return genStatic(el, state)
  11020. }
  11021. }
  11022.  
  11023. function genIf (
  11024. el,
  11025. state,
  11026. altGen,
  11027. altEmpty
  11028. ) {
  11029. el.ifProcessed = true; // avoid recursion
  11030. return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
  11031. }
  11032.  
  11033. function genIfConditions (
  11034. conditions,
  11035. state,
  11036. altGen,
  11037. altEmpty
  11038. ) {
  11039. if (!conditions.length) {
  11040. return altEmpty || '_e()'
  11041. }
  11042.  
  11043. var condition = conditions.shift();
  11044. if (condition.exp) {
  11045. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
  11046. } else {
  11047. return ("" + (genTernaryExp(condition.block)))
  11048. }
  11049.  
  11050. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  11051. function genTernaryExp (el) {
  11052. return altGen
  11053. ? altGen(el, state)
  11054. : el.once
  11055. ? genOnce(el, state)
  11056. : genElement(el, state)
  11057. }
  11058. }
  11059.  
  11060. function genFor (
  11061. el,
  11062. state,
  11063. altGen,
  11064. altHelper
  11065. ) {
  11066. var exp = el.for;
  11067. var alias = el.alias;
  11068. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  11069. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  11070.  
  11071. if (state.maybeComponent(el) &&
  11072. el.tag !== 'slot' &&
  11073. el.tag !== 'template' &&
  11074. !el.key
  11075. ) {
  11076. state.warn(
  11077. "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
  11078. "v-for should have explicit keys. " +
  11079. "See https://vuejs.org/guide/list.html#key for more info.",
  11080. el.rawAttrsMap['v-for'],
  11081. true /* tip */
  11082. );
  11083. }
  11084.  
  11085. el.forProcessed = true; // avoid recursion
  11086. return (altHelper || '_l') + "((" + exp + ")," +
  11087. "function(" + alias + iterator1 + iterator2 + "){" +
  11088. "return " + ((altGen || genElement)(el, state)) +
  11089. '})'
  11090. }
  11091.  
  11092. function genData$2 (el, state) {
  11093. var data = '{';
  11094.  
  11095. // directives first.
  11096. // directives may mutate the el's other properties before they are generated.
  11097. var dirs = genDirectives(el, state);
  11098. if (dirs) { data += dirs + ','; }
  11099.  
  11100. // key
  11101. if (el.key) {
  11102. data += "key:" + (el.key) + ",";
  11103. }
  11104. // ref
  11105. if (el.ref) {
  11106. data += "ref:" + (el.ref) + ",";
  11107. }
  11108. if (el.refInFor) {
  11109. data += "refInFor:true,";
  11110. }
  11111. // pre
  11112. if (el.pre) {
  11113. data += "pre:true,";
  11114. }
  11115. // record original tag name for components using "is" attribute
  11116. if (el.component) {
  11117. data += "tag:\"" + (el.tag) + "\",";
  11118. }
  11119. // module data generation functions
  11120. for (var i = 0; i < state.dataGenFns.length; i++) {
  11121. data += state.dataGenFns[i](el);
  11122. }
  11123. // attributes
  11124. if (el.attrs) {
  11125. data += "attrs:" + (genProps(el.attrs)) + ",";
  11126. }
  11127. // DOM props
  11128. if (el.props) {
  11129. data += "domProps:" + (genProps(el.props)) + ",";
  11130. }
  11131. // event handlers
  11132. if (el.events) {
  11133. data += (genHandlers(el.events, false)) + ",";
  11134. }
  11135. if (el.nativeEvents) {
  11136. data += (genHandlers(el.nativeEvents, true)) + ",";
  11137. }
  11138. // slot target
  11139. // only for non-scoped slots
  11140. if (el.slotTarget && !el.slotScope) {
  11141. data += "slot:" + (el.slotTarget) + ",";
  11142. }
  11143. // scoped slots
  11144. if (el.scopedSlots) {
  11145. data += (genScopedSlots(el, el.scopedSlots, state)) + ",";
  11146. }
  11147. // component v-model
  11148. if (el.model) {
  11149. data += "model:{value:" + (el.model.value) + ",callback:" + (el.model.callback) + ",expression:" + (el.model.expression) + "},";
  11150. }
  11151. // inline-template
  11152. if (el.inlineTemplate) {
  11153. var inlineTemplate = genInlineTemplate(el, state);
  11154. if (inlineTemplate) {
  11155. data += inlineTemplate + ",";
  11156. }
  11157. }
  11158. data = data.replace(/,$/, '') + '}';
  11159. // v-bind dynamic argument wrap
  11160. // v-bind with dynamic arguments must be applied using the same v-bind object
  11161. // merge helper so that class/style/mustUseProp attrs are handled correctly.
  11162. if (el.dynamicAttrs) {
  11163. data = "_b(" + data + ",\"" + (el.tag) + "\"," + (genProps(el.dynamicAttrs)) + ")";
  11164. }
  11165. // v-bind data wrap
  11166. if (el.wrapData) {
  11167. data = el.wrapData(data);
  11168. }
  11169. // v-on data wrap
  11170. if (el.wrapListeners) {
  11171. data = el.wrapListeners(data);
  11172. }
  11173. return data
  11174. }
  11175.  
  11176. function genDirectives (el, state) {
  11177. var dirs = el.directives;
  11178. if (!dirs) { return }
  11179. var res = 'directives:[';
  11180. var hasRuntime = false;
  11181. var i, l, dir, needRuntime;
  11182. for (i = 0, l = dirs.length; i < l; i++) {
  11183. dir = dirs[i];
  11184. needRuntime = true;
  11185. var gen = state.directives[dir.name];
  11186. if (gen) {
  11187. // compile-time directive that manipulates AST.
  11188. // returns true if it also needs a runtime counterpart.
  11189. needRuntime = !!gen(el, dir, state.warn);
  11190. }
  11191. if (needRuntime) {
  11192. hasRuntime = true;
  11193. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:" + (dir.isDynamicArg ? dir.arg : ("\"" + (dir.arg) + "\""))) : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  11194. }
  11195. }
  11196. if (hasRuntime) {
  11197. return res.slice(0, -1) + ']'
  11198. }
  11199. }
  11200.  
  11201. function genInlineTemplate (el, state) {
  11202. var ast = el.children[0];
  11203. if (el.children.length !== 1 || ast.type !== 1) {
  11204. state.warn(
  11205. 'Inline-template components must have exactly one child element.',
  11206. { start: el.start }
  11207. );
  11208. }
  11209. if (ast && ast.type === 1) {
  11210. var inlineRenderFns = generate(ast, state.options);
  11211. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  11212. }
  11213. }
  11214.  
  11215. function genScopedSlots (
  11216. el,
  11217. slots,
  11218. state
  11219. ) {
  11220. // by default scoped slots are considered "stable", this allows child
  11221. // components with only scoped slots to skip forced updates from parent.
  11222. // but in some cases we have to bail-out of this optimization
  11223. // for example if the slot contains dynamic names, has v-if or v-for on them...
  11224. var needsForceUpdate = el.for || Object.keys(slots).some(function (key) {
  11225. var slot = slots[key];
  11226. return (
  11227. slot.slotTargetDynamic ||
  11228. slot.if ||
  11229. slot.for ||
  11230. containsSlotChild(slot) // is passing down slot from parent which may be dynamic
  11231. )
  11232. });
  11233.  
  11234. // #9534: if a component with scoped slots is inside a conditional branch,
  11235. // it's possible for the same component to be reused but with different
  11236. // compiled slot content. To avoid that, we generate a unique key based on
  11237. // the generated code of all the slot contents.
  11238. var needsKey = !!el.if;
  11239.  
  11240. // OR when it is inside another scoped slot or v-for (the reactivity may be
  11241. // disconnected due to the intermediate scope variable)
  11242. // #9438, #9506
  11243. // TODO: this can be further optimized by properly analyzing in-scope bindings
  11244. // and skip force updating ones that do not actually use scope variables.
  11245. if (!needsForceUpdate) {
  11246. var parent = el.parent;
  11247. while (parent) {
  11248. if (
  11249. (parent.slotScope && parent.slotScope !== emptySlotScopeToken) ||
  11250. parent.for
  11251. ) {
  11252. needsForceUpdate = true;
  11253. break
  11254. }
  11255. if (parent.if) {
  11256. needsKey = true;
  11257. }
  11258. parent = parent.parent;
  11259. }
  11260. }
  11261.  
  11262. var generatedSlots = Object.keys(slots)
  11263. .map(function (key) { return genScopedSlot(slots[key], state); })
  11264. .join(',');
  11265.  
  11266. return ("scopedSlots:_u([" + generatedSlots + "]" + (needsForceUpdate ? ",null,true" : "") + (!needsForceUpdate && needsKey ? (",null,false," + (hash(generatedSlots))) : "") + ")")
  11267. }
  11268.  
  11269. function hash(str) {
  11270. var hash = 5381;
  11271. var i = str.length;
  11272. while(i) {
  11273. hash = (hash * 33) ^ str.charCodeAt(--i);
  11274. }
  11275. return hash >>> 0
  11276. }
  11277.  
  11278. function containsSlotChild (el) {
  11279. if (el.type === 1) {
  11280. if (el.tag === 'slot') {
  11281. return true
  11282. }
  11283. return el.children.some(containsSlotChild)
  11284. }
  11285. return false
  11286. }
  11287.  
  11288. function genScopedSlot (
  11289. el,
  11290. state
  11291. ) {
  11292. var isLegacySyntax = el.attrsMap['slot-scope'];
  11293. if (el.if && !el.ifProcessed && !isLegacySyntax) {
  11294. return genIf(el, state, genScopedSlot, "null")
  11295. }
  11296. if (el.for && !el.forProcessed) {
  11297. return genFor(el, state, genScopedSlot)
  11298. }
  11299. var slotScope = el.slotScope === emptySlotScopeToken
  11300. ? ""
  11301. : String(el.slotScope);
  11302. var fn = "function(" + slotScope + "){" +
  11303. "return " + (el.tag === 'template'
  11304. ? el.if && isLegacySyntax
  11305. ? ("(" + (el.if) + ")?" + (genChildren(el, state) || 'undefined') + ":undefined")
  11306. : genChildren(el, state) || 'undefined'
  11307. : genElement(el, state)) + "}";
  11308. // reverse proxy v-slot without scope on this.$slots
  11309. var reverseProxy = slotScope ? "" : ",proxy:true";
  11310. return ("{key:" + (el.slotTarget || "\"default\"") + ",fn:" + fn + reverseProxy + "}")
  11311. }
  11312.  
  11313. function genChildren (
  11314. el,
  11315. state,
  11316. checkSkip,
  11317. altGenElement,
  11318. altGenNode
  11319. ) {
  11320. var children = el.children;
  11321. if (children.length) {
  11322. var el$1 = children[0];
  11323. // optimize single v-for
  11324. if (children.length === 1 &&
  11325. el$1.for &&
  11326. el$1.tag !== 'template' &&
  11327. el$1.tag !== 'slot'
  11328. ) {
  11329. var normalizationType = checkSkip
  11330. ? state.maybeComponent(el$1) ? ",1" : ",0"
  11331. : "";
  11332. return ("" + ((altGenElement || genElement)(el$1, state)) + normalizationType)
  11333. }
  11334. var normalizationType$1 = checkSkip
  11335. ? getNormalizationType(children, state.maybeComponent)
  11336. : 0;
  11337. var gen = altGenNode || genNode;
  11338. return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType$1 ? ("," + normalizationType$1) : ''))
  11339. }
  11340. }
  11341.  
  11342. // determine the normalization needed for the children array.
  11343. // 0: no normalization needed
  11344. // 1: simple normalization needed (possible 1-level deep nested array)
  11345. // 2: full normalization needed
  11346. function getNormalizationType (
  11347. children,
  11348. maybeComponent
  11349. ) {
  11350. var res = 0;
  11351. for (var i = 0; i < children.length; i++) {
  11352. var el = children[i];
  11353. if (el.type !== 1) {
  11354. continue
  11355. }
  11356. if (needsNormalization(el) ||
  11357. (el.ifConditions && el.ifConditions.some(function (c) { return needsNormalization(c.block); }))) {
  11358. res = 2;
  11359. break
  11360. }
  11361. if (maybeComponent(el) ||
  11362. (el.ifConditions && el.ifConditions.some(function (c) { return maybeComponent(c.block); }))) {
  11363. res = 1;
  11364. }
  11365. }
  11366. return res
  11367. }
  11368.  
  11369. function needsNormalization (el) {
  11370. return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
  11371. }
  11372.  
  11373. function genNode (node, state) {
  11374. if (node.type === 1) {
  11375. return genElement(node, state)
  11376. } else if (node.type === 3 && node.isComment) {
  11377. return genComment(node)
  11378. } else {
  11379. return genText(node)
  11380. }
  11381. }
  11382.  
  11383. function genText (text) {
  11384. return ("_v(" + (text.type === 2
  11385. ? text.expression // no need for () because already wrapped in _s()
  11386. : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
  11387. }
  11388.  
  11389. function genComment (comment) {
  11390. return ("_e(" + (JSON.stringify(comment.text)) + ")")
  11391. }
  11392.  
  11393. function genSlot (el, state) {
  11394. var slotName = el.slotName || '"default"';
  11395. var children = genChildren(el, state);
  11396. var res = "_t(" + slotName + (children ? ("," + children) : '');
  11397. var attrs = el.attrs || el.dynamicAttrs
  11398. ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
  11399. // slot props are camelized
  11400. name: camelize(attr.name),
  11401. value: attr.value,
  11402. dynamic: attr.dynamic
  11403. }); }))
  11404. : null;
  11405. var bind$$1 = el.attrsMap['v-bind'];
  11406. if ((attrs || bind$$1) && !children) {
  11407. res += ",null";
  11408. }
  11409. if (attrs) {
  11410. res += "," + attrs;
  11411. }
  11412. if (bind$$1) {
  11413. res += (attrs ? '' : ',null') + "," + bind$$1;
  11414. }
  11415. return res + ')'
  11416. }
  11417.  
  11418. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  11419. function genComponent (
  11420. componentName,
  11421. el,
  11422. state
  11423. ) {
  11424. var children = el.inlineTemplate ? null : genChildren(el, state, true);
  11425. return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
  11426. }
  11427.  
  11428. function genProps (props) {
  11429. var staticProps = "";
  11430. var dynamicProps = "";
  11431. for (var i = 0; i < props.length; i++) {
  11432. var prop = props[i];
  11433. var value = transformSpecialNewlines(prop.value);
  11434. if (prop.dynamic) {
  11435. dynamicProps += (prop.name) + "," + value + ",";
  11436. } else {
  11437. staticProps += "\"" + (prop.name) + "\":" + value + ",";
  11438. }
  11439. }
  11440. staticProps = "{" + (staticProps.slice(0, -1)) + "}";
  11441. if (dynamicProps) {
  11442. return ("_d(" + staticProps + ",[" + (dynamicProps.slice(0, -1)) + "])")
  11443. } else {
  11444. return staticProps
  11445. }
  11446. }
  11447.  
  11448. // #3895, #4268
  11449. function transformSpecialNewlines (text) {
  11450. return text
  11451. .replace(/\u2028/g, '\\u2028')
  11452. .replace(/\u2029/g, '\\u2029')
  11453. }
  11454.  
  11455. /* */
  11456.  
  11457.  
  11458.  
  11459. // these keywords should not appear inside expressions, but operators like
  11460. // typeof, instanceof and in are allowed
  11461. var prohibitedKeywordRE = new RegExp('\\b' + (
  11462. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  11463. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  11464. 'extends,finally,continue,debugger,function,arguments'
  11465. ).split(',').join('\\b|\\b') + '\\b');
  11466.  
  11467. // these unary operators should not be used as property/method names
  11468. var unaryOperatorsRE = new RegExp('\\b' + (
  11469. 'delete,typeof,void'
  11470. ).split(',').join('\\s*\\([^\\)]*\\)|\\b') + '\\s*\\([^\\)]*\\)');
  11471.  
  11472. // strip strings in expressions
  11473. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  11474.  
  11475. // detect problematic expressions in a template
  11476. function detectErrors (ast, warn) {
  11477. if (ast) {
  11478. checkNode(ast, warn);
  11479. }
  11480. }
  11481.  
  11482. function checkNode (node, warn) {
  11483. if (node.type === 1) {
  11484. for (var name in node.attrsMap) {
  11485. if (dirRE.test(name)) {
  11486. var value = node.attrsMap[name];
  11487. if (value) {
  11488. var range = node.rawAttrsMap[name];
  11489. if (name === 'v-for') {
  11490. checkFor(node, ("v-for=\"" + value + "\""), warn, range);
  11491. } else if (onRE.test(name)) {
  11492. checkEvent(value, (name + "=\"" + value + "\""), warn, range);
  11493. } else {
  11494. checkExpression(value, (name + "=\"" + value + "\""), warn, range);
  11495. }
  11496. }
  11497. }
  11498. }
  11499. if (node.children) {
  11500. for (var i = 0; i < node.children.length; i++) {
  11501. checkNode(node.children[i], warn);
  11502. }
  11503. }
  11504. } else if (node.type === 2) {
  11505. checkExpression(node.expression, node.text, warn, node);
  11506. }
  11507. }
  11508.  
  11509. function checkEvent (exp, text, warn, range) {
  11510. var stipped = exp.replace(stripStringRE, '');
  11511. var keywordMatch = stipped.match(unaryOperatorsRE);
  11512. if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
  11513. warn(
  11514. "avoid using JavaScript unary operator as property name: " +
  11515. "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
  11516. range
  11517. );
  11518. }
  11519. checkExpression(exp, text, warn, range);
  11520. }
  11521.  
  11522. function checkFor (node, text, warn, range) {
  11523. checkExpression(node.for || '', text, warn, range);
  11524. checkIdentifier(node.alias, 'v-for alias', text, warn, range);
  11525. checkIdentifier(node.iterator1, 'v-for iterator', text, warn, range);
  11526. checkIdentifier(node.iterator2, 'v-for iterator', text, warn, range);
  11527. }
  11528.  
  11529. function checkIdentifier (
  11530. ident,
  11531. type,
  11532. text,
  11533. warn,
  11534. range
  11535. ) {
  11536. if (typeof ident === 'string') {
  11537. try {
  11538. new Function(("var " + ident + "=_"));
  11539. } catch (e) {
  11540. warn(("invalid " + type + " \"" + ident + "\" in expression: " + (text.trim())), range);
  11541. }
  11542. }
  11543. }
  11544.  
  11545. function checkExpression (exp, text, warn, range) {
  11546. try {
  11547. new Function(("return " + exp));
  11548. } catch (e) {
  11549. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  11550. if (keywordMatch) {
  11551. warn(
  11552. "avoid using JavaScript keyword as property name: " +
  11553. "\"" + (keywordMatch[0]) + "\"\n Raw expression: " + (text.trim()),
  11554. range
  11555. );
  11556. } else {
  11557. warn(
  11558. "invalid expression: " + (e.message) + " in\n\n" +
  11559. " " + exp + "\n\n" +
  11560. " Raw expression: " + (text.trim()) + "\n",
  11561. range
  11562. );
  11563. }
  11564. }
  11565. }
  11566.  
  11567. /* */
  11568.  
  11569. var range = 2;
  11570.  
  11571. function generateCodeFrame (
  11572. source,
  11573. start,
  11574. end
  11575. ) {
  11576. if ( start === void 0 ) start = 0;
  11577. if ( end === void 0 ) end = source.length;
  11578.  
  11579. var lines = source.split(/\r?\n/);
  11580. var count = 0;
  11581. var res = [];
  11582. for (var i = 0; i < lines.length; i++) {
  11583. count += lines[i].length + 1;
  11584. if (count >= start) {
  11585. for (var j = i - range; j <= i + range || end > count; j++) {
  11586. if (j < 0 || j >= lines.length) { continue }
  11587. res.push(("" + (j + 1) + (repeat$1(" ", 3 - String(j + 1).length)) + "| " + (lines[j])));
  11588. var lineLength = lines[j].length;
  11589. if (j === i) {
  11590. // push underline
  11591. var pad = start - (count - lineLength) + 1;
  11592. var length = end > count ? lineLength - pad : end - start;
  11593. res.push(" | " + repeat$1(" ", pad) + repeat$1("^", length));
  11594. } else if (j > i) {
  11595. if (end > count) {
  11596. var length$1 = Math.min(end - count, lineLength);
  11597. res.push(" | " + repeat$1("^", length$1));
  11598. }
  11599. count += lineLength + 1;
  11600. }
  11601. }
  11602. break
  11603. }
  11604. }
  11605. return res.join('\n')
  11606. }
  11607.  
  11608. function repeat$1 (str, n) {
  11609. var result = '';
  11610. if (n > 0) {
  11611. while (true) { // eslint-disable-line
  11612. if (n & 1) { result += str; }
  11613. n >>>= 1;
  11614. if (n <= 0) { break }
  11615. str += str;
  11616. }
  11617. }
  11618. return result
  11619. }
  11620.  
  11621. /* */
  11622.  
  11623.  
  11624.  
  11625. function createFunction (code, errors) {
  11626. try {
  11627. return new Function(code)
  11628. } catch (err) {
  11629. errors.push({ err: err, code: code });
  11630. return noop
  11631. }
  11632. }
  11633.  
  11634. function createCompileToFunctionFn (compile) {
  11635. var cache = Object.create(null);
  11636.  
  11637. return function compileToFunctions (
  11638. template,
  11639. options,
  11640. vm
  11641. ) {
  11642. options = extend({}, options);
  11643. var warn$$1 = options.warn || warn;
  11644. delete options.warn;
  11645.  
  11646. /* istanbul ignore if */
  11647. {
  11648. // detect possible CSP restriction
  11649. try {
  11650. new Function('return 1');
  11651. } catch (e) {
  11652. if (e.toString().match(/unsafe-eval|CSP/)) {
  11653. warn$$1(
  11654. 'It seems you are using the standalone build of Vue.js in an ' +
  11655. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  11656. 'The template compiler cannot work in this environment. Consider ' +
  11657. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  11658. 'templates into render functions.'
  11659. );
  11660. }
  11661. }
  11662. }
  11663.  
  11664. // check cache
  11665. var key = options.delimiters
  11666. ? String(options.delimiters) + template
  11667. : template;
  11668. if (cache[key]) {
  11669. return cache[key]
  11670. }
  11671.  
  11672. // compile
  11673. var compiled = compile(template, options);
  11674.  
  11675. // check compilation errors/tips
  11676. {
  11677. if (compiled.errors && compiled.errors.length) {
  11678. if (options.outputSourceRange) {
  11679. compiled.errors.forEach(function (e) {
  11680. warn$$1(
  11681. "Error compiling template:\n\n" + (e.msg) + "\n\n" +
  11682. generateCodeFrame(template, e.start, e.end),
  11683. vm
  11684. );
  11685. });
  11686. } else {
  11687. warn$$1(
  11688. "Error compiling template:\n\n" + template + "\n\n" +
  11689. compiled.errors.map(function (e) { return ("- " + e); }).join('\n') + '\n',
  11690. vm
  11691. );
  11692. }
  11693. }
  11694. if (compiled.tips && compiled.tips.length) {
  11695. if (options.outputSourceRange) {
  11696. compiled.tips.forEach(function (e) { return tip(e.msg, vm); });
  11697. } else {
  11698. compiled.tips.forEach(function (msg) { return tip(msg, vm); });
  11699. }
  11700. }
  11701. }
  11702.  
  11703. // turn code into functions
  11704. var res = {};
  11705. var fnGenErrors = [];
  11706. res.render = createFunction(compiled.render, fnGenErrors);
  11707. res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
  11708. return createFunction(code, fnGenErrors)
  11709. });
  11710.  
  11711. // check function generation errors.
  11712. // this should only happen if there is a bug in the compiler itself.
  11713. // mostly for codegen development use
  11714. /* istanbul ignore if */
  11715. {
  11716. if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) {
  11717. warn$$1(
  11718. "Failed to generate render function:\n\n" +
  11719. fnGenErrors.map(function (ref) {
  11720. var err = ref.err;
  11721. var code = ref.code;
  11722.  
  11723. return ((err.toString()) + " in\n\n" + code + "\n");
  11724. }).join('\n'),
  11725. vm
  11726. );
  11727. }
  11728. }
  11729.  
  11730. return (cache[key] = res)
  11731. }
  11732. }
  11733.  
  11734. /* */
  11735.  
  11736. function createCompilerCreator (baseCompile) {
  11737. return function createCompiler (baseOptions) {
  11738. function compile (
  11739. template,
  11740. options
  11741. ) {
  11742. var finalOptions = Object.create(baseOptions);
  11743. var errors = [];
  11744. var tips = [];
  11745.  
  11746. var warn = function (msg, range, tip) {
  11747. (tip ? tips : errors).push(msg);
  11748. };
  11749.  
  11750. if (options) {
  11751. if (options.outputSourceRange) {
  11752. // $flow-disable-line
  11753. var leadingSpaceLength = template.match(/^\s*/)[0].length;
  11754.  
  11755. warn = function (msg, range, tip) {
  11756. var data = { msg: msg };
  11757. if (range) {
  11758. if (range.start != null) {
  11759. data.start = range.start + leadingSpaceLength;
  11760. }
  11761. if (range.end != null) {
  11762. data.end = range.end + leadingSpaceLength;
  11763. }
  11764. }
  11765. (tip ? tips : errors).push(data);
  11766. };
  11767. }
  11768. // merge custom modules
  11769. if (options.modules) {
  11770. finalOptions.modules =
  11771. (baseOptions.modules || []).concat(options.modules);
  11772. }
  11773. // merge custom directives
  11774. if (options.directives) {
  11775. finalOptions.directives = extend(
  11776. Object.create(baseOptions.directives || null),
  11777. options.directives
  11778. );
  11779. }
  11780. // copy other options
  11781. for (var key in options) {
  11782. if (key !== 'modules' && key !== 'directives') {
  11783. finalOptions[key] = options[key];
  11784. }
  11785. }
  11786. }
  11787.  
  11788. finalOptions.warn = warn;
  11789.  
  11790. var compiled = baseCompile(template.trim(), finalOptions);
  11791. {
  11792. detectErrors(compiled.ast, warn);
  11793. }
  11794. compiled.errors = errors;
  11795. compiled.tips = tips;
  11796. return compiled
  11797. }
  11798.  
  11799. return {
  11800. compile: compile,
  11801. compileToFunctions: createCompileToFunctionFn(compile)
  11802. }
  11803. }
  11804. }
  11805.  
  11806. /* */
  11807.  
  11808. // `createCompilerCreator` allows creating compilers that use alternative
  11809. // parser/optimizer/codegen, e.g the SSR optimizing compiler.
  11810. // Here we just export a default compiler using the default parts.
  11811. var createCompiler = createCompilerCreator(function baseCompile (
  11812. template,
  11813. options
  11814. ) {
  11815. var ast = parse(template.trim(), options);
  11816. if (options.optimize !== false) {
  11817. optimize(ast, options);
  11818. }
  11819. var code = generate(ast, options);
  11820. return {
  11821. ast: ast,
  11822. render: code.render,
  11823. staticRenderFns: code.staticRenderFns
  11824. }
  11825. });
  11826.  
  11827. /* */
  11828.  
  11829. var ref$1 = createCompiler(baseOptions);
  11830. var compile = ref$1.compile;
  11831. var compileToFunctions = ref$1.compileToFunctions;
  11832.  
  11833. /* */
  11834.  
  11835. // check whether current browser encodes a char inside attribute values
  11836. var div;
  11837. function getShouldDecode (href) {
  11838. div = div || document.createElement('div');
  11839. div.innerHTML = href ? "<a href=\"\n\"/>" : "<div a=\"\n\"/>";
  11840. return div.innerHTML.indexOf('&#10;') > 0
  11841. }
  11842.  
  11843. // #3663: IE encodes newlines inside attribute values while other browsers don't
  11844. var shouldDecodeNewlines = inBrowser ? getShouldDecode(false) : false;
  11845. // #6828: chrome encodes content in a[href]
  11846. var shouldDecodeNewlinesForHref = inBrowser ? getShouldDecode(true) : false;
  11847.  
  11848. /* */
  11849.  
  11850. var idToTemplate = cached(function (id) {
  11851. var el = query(id);
  11852. return el && el.innerHTML
  11853. });
  11854.  
  11855. var mount = Vue.prototype.$mount;
  11856. Vue.prototype.$mount = function (
  11857. el,
  11858. hydrating
  11859. ) {
  11860. el = el && query(el);
  11861.  
  11862. /* istanbul ignore if */
  11863. if (el === document.body || el === document.documentElement) {
  11864. warn(
  11865. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  11866. );
  11867. return this
  11868. }
  11869.  
  11870. var options = this.$options;
  11871. // resolve template/el and convert to render function
  11872. if (!options.render) {
  11873. var template = options.template;
  11874. if (template) {
  11875. if (typeof template === 'string') {
  11876. if (template.charAt(0) === '#') {
  11877. template = idToTemplate(template);
  11878. /* istanbul ignore if */
  11879. if (!template) {
  11880. warn(
  11881. ("Template element not found or is empty: " + (options.template)),
  11882. this
  11883. );
  11884. }
  11885. }
  11886. } else if (template.nodeType) {
  11887. template = template.innerHTML;
  11888. } else {
  11889. {
  11890. warn('invalid template option:' + template, this);
  11891. }
  11892. return this
  11893. }
  11894. } else if (el) {
  11895. template = getOuterHTML(el);
  11896. }
  11897. if (template) {
  11898. /* istanbul ignore if */
  11899. if (config.performance && mark) {
  11900. mark('compile');
  11901. }
  11902.  
  11903. var ref = compileToFunctions(template, {
  11904. outputSourceRange: "development" !== 'production',
  11905. shouldDecodeNewlines: shouldDecodeNewlines,
  11906. shouldDecodeNewlinesForHref: shouldDecodeNewlinesForHref,
  11907. delimiters: options.delimiters,
  11908. comments: options.comments
  11909. }, this);
  11910. var render = ref.render;
  11911. var staticRenderFns = ref.staticRenderFns;
  11912. options.render = render;
  11913. options.staticRenderFns = staticRenderFns;
  11914.  
  11915. /* istanbul ignore if */
  11916. if (config.performance && mark) {
  11917. mark('compile end');
  11918. measure(("vue " + (this._name) + " compile"), 'compile', 'compile end');
  11919. }
  11920. }
  11921. }
  11922. return mount.call(this, el, hydrating)
  11923. };
  11924.  
  11925. /**
  11926. * Get outerHTML of elements, taking care
  11927. * of SVG elements in IE as well.
  11928. */
  11929. function getOuterHTML (el) {
  11930. if (el.outerHTML) {
  11931. return el.outerHTML
  11932. } else {
  11933. var container = document.createElement('div');
  11934. container.appendChild(el.cloneNode(true));
  11935. return container.innerHTML
  11936. }
  11937. }
  11938.  
  11939. Vue.compile = compileToFunctions;
  11940.  
  11941. return Vue;
  11942.  
  11943. }));

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址