You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8220 lines
208 KiB

3 days ago
  1. /*!
  2. * Vue.js v2.1.4
  3. * (c) 2014-2016 Evan You
  4. * Released under the MIT License.
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global.Vue = factory());
  10. }(this, (function () { 'use strict';
  11. /* */
  12. /**
  13. * Convert a value to a string that is actually rendered.
  14. */
  15. function _toString (val) {
  16. return val == null
  17. ? ''
  18. : typeof val === 'object'
  19. ? JSON.stringify(val, null, 2)
  20. : String(val)
  21. }
  22. /**
  23. * Convert a input value to a number for persistence.
  24. * If the conversion fails, return original string.
  25. */
  26. function toNumber (val) {
  27. var n = parseFloat(val, 10);
  28. return (n || n === 0) ? n : val
  29. }
  30. /**
  31. * Make a map and return a function for checking if a key
  32. * is in that map.
  33. */
  34. function makeMap (
  35. str,
  36. expectsLowerCase
  37. ) {
  38. var map = Object.create(null);
  39. var list = str.split(',');
  40. for (var i = 0; i < list.length; i++) {
  41. map[list[i]] = true;
  42. }
  43. return expectsLowerCase
  44. ? function (val) { return map[val.toLowerCase()]; }
  45. : function (val) { return map[val]; }
  46. }
  47. /**
  48. * Check if a tag is a built-in tag.
  49. */
  50. var isBuiltInTag = makeMap('slot,component', true);
  51. /**
  52. * Remove an item from an array
  53. */
  54. function remove$1 (arr, item) {
  55. if (arr.length) {
  56. var index = arr.indexOf(item);
  57. if (index > -1) {
  58. return arr.splice(index, 1)
  59. }
  60. }
  61. }
  62. /**
  63. * Check whether the object has the property.
  64. */
  65. var hasOwnProperty = Object.prototype.hasOwnProperty;
  66. function hasOwn (obj, key) {
  67. return hasOwnProperty.call(obj, key)
  68. }
  69. /**
  70. * Check if value is primitive
  71. */
  72. function isPrimitive (value) {
  73. return typeof value === 'string' || typeof value === 'number'
  74. }
  75. /**
  76. * Create a cached version of a pure function.
  77. */
  78. function cached (fn) {
  79. var cache = Object.create(null);
  80. return function cachedFn (str) {
  81. var hit = cache[str];
  82. return hit || (cache[str] = fn(str))
  83. }
  84. }
  85. /**
  86. * Camelize a hyphen-delmited string.
  87. */
  88. var camelizeRE = /-(\w)/g;
  89. var camelize = cached(function (str) {
  90. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  91. });
  92. /**
  93. * Capitalize a string.
  94. */
  95. var capitalize = cached(function (str) {
  96. return str.charAt(0).toUpperCase() + str.slice(1)
  97. });
  98. /**
  99. * Hyphenate a camelCase string.
  100. */
  101. var hyphenateRE = /([^-])([A-Z])/g;
  102. var hyphenate = cached(function (str) {
  103. return str
  104. .replace(hyphenateRE, '$1-$2')
  105. .replace(hyphenateRE, '$1-$2')
  106. .toLowerCase()
  107. });
  108. /**
  109. * Simple bind, faster than native
  110. */
  111. function bind$1 (fn, ctx) {
  112. function boundFn (a) {
  113. var l = arguments.length;
  114. return l
  115. ? l > 1
  116. ? fn.apply(ctx, arguments)
  117. : fn.call(ctx, a)
  118. : fn.call(ctx)
  119. }
  120. // record original fn length
  121. boundFn._length = fn.length;
  122. return boundFn
  123. }
  124. /**
  125. * Convert an Array-like object to a real Array.
  126. */
  127. function toArray (list, start) {
  128. start = start || 0;
  129. var i = list.length - start;
  130. var ret = new Array(i);
  131. while (i--) {
  132. ret[i] = list[i + start];
  133. }
  134. return ret
  135. }
  136. /**
  137. * Mix properties into target object.
  138. */
  139. function extend (to, _from) {
  140. for (var key in _from) {
  141. to[key] = _from[key];
  142. }
  143. return to
  144. }
  145. /**
  146. * Quick object check - this is primarily used to tell
  147. * Objects from primitive values when we know the value
  148. * is a JSON-compliant type.
  149. */
  150. function isObject (obj) {
  151. return obj !== null && typeof obj === 'object'
  152. }
  153. /**
  154. * Strict object type check. Only returns true
  155. * for plain JavaScript objects.
  156. */
  157. var toString = Object.prototype.toString;
  158. var OBJECT_STRING = '[object Object]';
  159. function isPlainObject (obj) {
  160. return toString.call(obj) === OBJECT_STRING
  161. }
  162. /**
  163. * Merge an Array of Objects into a single Object.
  164. */
  165. function toObject (arr) {
  166. var res = {};
  167. for (var i = 0; i < arr.length; i++) {
  168. if (arr[i]) {
  169. extend(res, arr[i]);
  170. }
  171. }
  172. return res
  173. }
  174. /**
  175. * Perform no operation.
  176. */
  177. function noop () {}
  178. /**
  179. * Always return false.
  180. */
  181. var no = function () { return false; };
  182. /**
  183. * Generate a static keys string from compiler modules.
  184. */
  185. function genStaticKeys (modules) {
  186. return modules.reduce(function (keys, m) {
  187. return keys.concat(m.staticKeys || [])
  188. }, []).join(',')
  189. }
  190. /**
  191. * Check if two values are loosely equal - that is,
  192. * if they are plain objects, do they have the same shape?
  193. */
  194. function looseEqual (a, b) {
  195. /* eslint-disable eqeqeq */
  196. return a == b || (
  197. isObject(a) && isObject(b)
  198. ? JSON.stringify(a) === JSON.stringify(b)
  199. : false
  200. )
  201. /* eslint-enable eqeqeq */
  202. }
  203. function looseIndexOf (arr, val) {
  204. for (var i = 0; i < arr.length; i++) {
  205. if (looseEqual(arr[i], val)) { return i }
  206. }
  207. return -1
  208. }
  209. /* */
  210. var config = {
  211. /**
  212. * Option merge strategies (used in core/util/options)
  213. */
  214. optionMergeStrategies: Object.create(null),
  215. /**
  216. * Whether to suppress warnings.
  217. */
  218. silent: false,
  219. /**
  220. * Whether to enable devtools
  221. */
  222. devtools: "development" !== 'production',
  223. /**
  224. * Error handler for watcher errors
  225. */
  226. errorHandler: null,
  227. /**
  228. * Ignore certain custom elements
  229. */
  230. ignoredElements: null,
  231. /**
  232. * Custom user key aliases for v-on
  233. */
  234. keyCodes: Object.create(null),
  235. /**
  236. * Check if a tag is reserved so that it cannot be registered as a
  237. * component. This is platform-dependent and may be overwritten.
  238. */
  239. isReservedTag: no,
  240. /**
  241. * Check if a tag is an unknown element.
  242. * Platform-dependent.
  243. */
  244. isUnknownElement: no,
  245. /**
  246. * Get the namespace of an element
  247. */
  248. getTagNamespace: noop,
  249. /**
  250. * Check if an attribute must be bound using property, e.g. value
  251. * Platform-dependent.
  252. */
  253. mustUseProp: no,
  254. /**
  255. * List of asset types that a component can own.
  256. */
  257. _assetTypes: [
  258. 'component',
  259. 'directive',
  260. 'filter'
  261. ],
  262. /**
  263. * List of lifecycle hooks.
  264. */
  265. _lifecycleHooks: [
  266. 'beforeCreate',
  267. 'created',
  268. 'beforeMount',
  269. 'mounted',
  270. 'beforeUpdate',
  271. 'updated',
  272. 'beforeDestroy',
  273. 'destroyed',
  274. 'activated',
  275. 'deactivated'
  276. ],
  277. /**
  278. * Max circular updates allowed in a scheduler flush cycle.
  279. */
  280. _maxUpdateCount: 100
  281. };
  282. /* */
  283. /**
  284. * Check if a string starts with $ or _
  285. */
  286. function isReserved (str) {
  287. var c = (str + '').charCodeAt(0);
  288. return c === 0x24 || c === 0x5F
  289. }
  290. /**
  291. * Define a property.
  292. */
  293. function def (obj, key, val, enumerable) {
  294. Object.defineProperty(obj, key, {
  295. value: val,
  296. enumerable: !!enumerable,
  297. writable: true,
  298. configurable: true
  299. });
  300. }
  301. /**
  302. * Parse simple path.
  303. */
  304. var bailRE = /[^\w.$]/;
  305. function parsePath (path) {
  306. if (bailRE.test(path)) {
  307. return
  308. } else {
  309. var segments = path.split('.');
  310. return function (obj) {
  311. for (var i = 0; i < segments.length; i++) {
  312. if (!obj) { return }
  313. obj = obj[segments[i]];
  314. }
  315. return obj
  316. }
  317. }
  318. }
  319. /* */
  320. /* globals MutationObserver */
  321. // can we use __proto__?
  322. var hasProto = '__proto__' in {};
  323. // Browser environment sniffing
  324. var inBrowser = typeof window !== 'undefined';
  325. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  326. var isIE = UA && /msie|trident/.test(UA);
  327. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  328. var isEdge = UA && UA.indexOf('edge/') > 0;
  329. var isAndroid = UA && UA.indexOf('android') > 0;
  330. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  331. // this needs to be lazy-evaled because vue may be required before
  332. // vue-server-renderer can set VUE_ENV
  333. var _isServer;
  334. var isServerRendering = function () {
  335. if (_isServer === undefined) {
  336. /* istanbul ignore if */
  337. if (!inBrowser && typeof global !== 'undefined') {
  338. // detect presence of vue-server-renderer and avoid
  339. // Webpack shimming the process
  340. _isServer = global['process'].env.VUE_ENV === 'server';
  341. } else {
  342. _isServer = false;
  343. }
  344. }
  345. return _isServer
  346. };
  347. // detect devtools
  348. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  349. /* istanbul ignore next */
  350. function isNative (Ctor) {
  351. return /native code/.test(Ctor.toString())
  352. }
  353. /**
  354. * Defer a task to execute it asynchronously.
  355. */
  356. var nextTick = (function () {
  357. var callbacks = [];
  358. var pending = false;
  359. var timerFunc;
  360. function nextTickHandler () {
  361. pending = false;
  362. var copies = callbacks.slice(0);
  363. callbacks.length = 0;
  364. for (var i = 0; i < copies.length; i++) {
  365. copies[i]();
  366. }
  367. }
  368. // the nextTick behavior leverages the microtask queue, which can be accessed
  369. // via either native Promise.then or MutationObserver.
  370. // MutationObserver has wider support, however it is seriously bugged in
  371. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  372. // completely stops working after triggering a few times... so, if native
  373. // Promise is available, we will use it:
  374. /* istanbul ignore if */
  375. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  376. var p = Promise.resolve();
  377. var logError = function (err) { console.error(err); };
  378. timerFunc = function () {
  379. p.then(nextTickHandler).catch(logError);
  380. // in problematic UIWebViews, Promise.then doesn't completely break, but
  381. // it can get stuck in a weird state where callbacks are pushed into the
  382. // microtask queue but the queue isn't being flushed, until the browser
  383. // needs to do some other work, e.g. handle a timer. Therefore we can
  384. // "force" the microtask queue to be flushed by adding an empty timer.
  385. if (isIOS) { setTimeout(noop); }
  386. };
  387. } else if (typeof MutationObserver !== 'undefined' && (
  388. isNative(MutationObserver) ||
  389. // PhantomJS and iOS 7.x
  390. MutationObserver.toString() === '[object MutationObserverConstructor]'
  391. )) {
  392. // use MutationObserver where native Promise is not available,
  393. // e.g. PhantomJS IE11, iOS7, Android 4.4
  394. var counter = 1;
  395. var observer = new MutationObserver(nextTickHandler);
  396. var textNode = document.createTextNode(String(counter));
  397. observer.observe(textNode, {
  398. characterData: true
  399. });
  400. timerFunc = function () {
  401. counter = (counter + 1) % 2;
  402. textNode.data = String(counter);
  403. };
  404. } else {
  405. // fallback to setTimeout
  406. /* istanbul ignore next */
  407. timerFunc = function () {
  408. setTimeout(nextTickHandler, 0);
  409. };
  410. }
  411. return function queueNextTick (cb, ctx) {
  412. var _resolve;
  413. callbacks.push(function () {
  414. if (cb) { cb.call(ctx); }
  415. if (_resolve) { _resolve(ctx); }
  416. });
  417. if (!pending) {
  418. pending = true;
  419. timerFunc();
  420. }
  421. if (!cb && typeof Promise !== 'undefined') {
  422. return new Promise(function (resolve) {
  423. _resolve = resolve;
  424. })
  425. }
  426. }
  427. })();
  428. var _Set;
  429. /* istanbul ignore if */
  430. if (typeof Set !== 'undefined' && isNative(Set)) {
  431. // use native Set when available.
  432. _Set = Set;
  433. } else {
  434. // a non-standard Set polyfill that only works with primitive keys.
  435. _Set = (function () {
  436. function Set () {
  437. this.set = Object.create(null);
  438. }
  439. Set.prototype.has = function has (key) {
  440. return this.set[key] !== undefined
  441. };
  442. Set.prototype.add = function add (key) {
  443. this.set[key] = 1;
  444. };
  445. Set.prototype.clear = function clear () {
  446. this.set = Object.create(null);
  447. };
  448. return Set;
  449. }());
  450. }
  451. var warn = noop;
  452. var formatComponentName;
  453. {
  454. var hasConsole = typeof console !== 'undefined';
  455. warn = function (msg, vm) {
  456. if (hasConsole && (!config.silent)) {
  457. console.error("[Vue warn]: " + msg + " " + (
  458. vm ? formatLocation(formatComponentName(vm)) : ''
  459. ));
  460. }
  461. };
  462. formatComponentName = function (vm) {
  463. if (vm.$root === vm) {
  464. return 'root instance'
  465. }
  466. var name = vm._isVue
  467. ? vm.$options.name || vm.$options._componentTag
  468. : vm.name;
  469. return (
  470. (name ? ("component <" + name + ">") : "anonymous component") +
  471. (vm._isVue && vm.$options.__file ? (" at " + (vm.$options.__file)) : '')
  472. )
  473. };
  474. var formatLocation = function (str) {
  475. if (str === 'anonymous component') {
  476. str += " - use the \"name\" option for better debugging messages.";
  477. }
  478. return ("\n(found in " + str + ")")
  479. };
  480. }
  481. /* */
  482. var uid$1 = 0;
  483. /**
  484. * A dep is an observable that can have multiple
  485. * directives subscribing to it.
  486. */
  487. var Dep = function Dep () {
  488. this.id = uid$1++;
  489. this.subs = [];
  490. };
  491. Dep.prototype.addSub = function addSub (sub) {
  492. this.subs.push(sub);
  493. };
  494. Dep.prototype.removeSub = function removeSub (sub) {
  495. remove$1(this.subs, sub);
  496. };
  497. Dep.prototype.depend = function depend () {
  498. if (Dep.target) {
  499. Dep.target.addDep(this);
  500. }
  501. };
  502. Dep.prototype.notify = function notify () {
  503. // stablize the subscriber list first
  504. var subs = this.subs.slice();
  505. for (var i = 0, l = subs.length; i < l; i++) {
  506. subs[i].update();
  507. }
  508. };
  509. // the current target watcher being evaluated.
  510. // this is globally unique because there could be only one
  511. // watcher being evaluated at any time.
  512. Dep.target = null;
  513. var targetStack = [];
  514. function pushTarget (_target) {
  515. if (Dep.target) { targetStack.push(Dep.target); }
  516. Dep.target = _target;
  517. }
  518. function popTarget () {
  519. Dep.target = targetStack.pop();
  520. }
  521. /*
  522. * not type checking this file because flow doesn't play well with
  523. * dynamically accessing methods on Array prototype
  524. */
  525. var arrayProto = Array.prototype;
  526. var arrayMethods = Object.create(arrayProto);[
  527. 'push',
  528. 'pop',
  529. 'shift',
  530. 'unshift',
  531. 'splice',
  532. 'sort',
  533. 'reverse'
  534. ]
  535. .forEach(function (method) {
  536. // cache original method
  537. var original = arrayProto[method];
  538. def(arrayMethods, method, function mutator () {
  539. var arguments$1 = arguments;
  540. // avoid leaking arguments:
  541. // http://jsperf.com/closure-with-arguments
  542. var i = arguments.length;
  543. var args = new Array(i);
  544. while (i--) {
  545. args[i] = arguments$1[i];
  546. }
  547. var result = original.apply(this, args);
  548. var ob = this.__ob__;
  549. var inserted;
  550. switch (method) {
  551. case 'push':
  552. inserted = args;
  553. break
  554. case 'unshift':
  555. inserted = args;
  556. break
  557. case 'splice':
  558. inserted = args.slice(2);
  559. break
  560. }
  561. if (inserted) { ob.observeArray(inserted); }
  562. // notify change
  563. ob.dep.notify();
  564. return result
  565. });
  566. });
  567. /* */
  568. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  569. /**
  570. * By default, when a reactive property is set, the new value is
  571. * also converted to become reactive. However when passing down props,
  572. * we don't want to force conversion because the value may be a nested value
  573. * under a frozen data structure. Converting it would defeat the optimization.
  574. */
  575. var observerState = {
  576. shouldConvert: true,
  577. isSettingProps: false
  578. };
  579. /**
  580. * Observer class that are attached to each observed
  581. * object. Once attached, the observer converts target
  582. * object's property keys into getter/setters that
  583. * collect dependencies and dispatches updates.
  584. */
  585. var Observer = function Observer (value) {
  586. this.value = value;
  587. this.dep = new Dep();
  588. this.vmCount = 0;
  589. def(value, '__ob__', this);
  590. if (Array.isArray(value)) {
  591. var augment = hasProto
  592. ? protoAugment
  593. : copyAugment;
  594. augment(value, arrayMethods, arrayKeys);
  595. this.observeArray(value);
  596. } else {
  597. this.walk(value);
  598. }
  599. };
  600. /**
  601. * Walk through each property and convert them into
  602. * getter/setters. This method should only be called when
  603. * value type is Object.
  604. */
  605. Observer.prototype.walk = function walk (obj) {
  606. var keys = Object.keys(obj);
  607. for (var i = 0; i < keys.length; i++) {
  608. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  609. }
  610. };
  611. /**
  612. * Observe a list of Array items.
  613. */
  614. Observer.prototype.observeArray = function observeArray (items) {
  615. for (var i = 0, l = items.length; i < l; i++) {
  616. observe(items[i]);
  617. }
  618. };
  619. // helpers
  620. /**
  621. * Augment an target Object or Array by intercepting
  622. * the prototype chain using __proto__
  623. */
  624. function protoAugment (target, src) {
  625. /* eslint-disable no-proto */
  626. target.__proto__ = src;
  627. /* eslint-enable no-proto */
  628. }
  629. /**
  630. * Augment an target Object or Array by defining
  631. * hidden properties.
  632. *
  633. * istanbul ignore next
  634. */
  635. function copyAugment (target, src, keys) {
  636. for (var i = 0, l = keys.length; i < l; i++) {
  637. var key = keys[i];
  638. def(target, key, src[key]);
  639. }
  640. }
  641. /**
  642. * Attempt to create an observer instance for a value,
  643. * returns the new observer if successfully observed,
  644. * or the existing observer if the value already has one.
  645. */
  646. function observe (value) {
  647. if (!isObject(value)) {
  648. return
  649. }
  650. var ob;
  651. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  652. ob = value.__ob__;
  653. } else if (
  654. observerState.shouldConvert &&
  655. !isServerRendering() &&
  656. (Array.isArray(value) || isPlainObject(value)) &&
  657. Object.isExtensible(value) &&
  658. !value._isVue
  659. ) {
  660. ob = new Observer(value);
  661. }
  662. return ob
  663. }
  664. /**
  665. * Define a reactive property on an Object.
  666. */
  667. function defineReactive$$1 (
  668. obj,
  669. key,
  670. val,
  671. customSetter
  672. ) {
  673. var dep = new Dep();
  674. var property = Object.getOwnPropertyDescriptor(obj, key);
  675. if (property && property.configurable === false) {
  676. return
  677. }
  678. // cater for pre-defined getter/setters
  679. var getter = property && property.get;
  680. var setter = property && property.set;
  681. var childOb = observe(val);
  682. Object.defineProperty(obj, key, {
  683. enumerable: true,
  684. configurable: true,
  685. get: function reactiveGetter () {
  686. var value = getter ? getter.call(obj) : val;
  687. if (Dep.target) {
  688. dep.depend();
  689. if (childOb) {
  690. childOb.dep.depend();
  691. }
  692. if (Array.isArray(value)) {
  693. dependArray(value);
  694. }
  695. }
  696. return value
  697. },
  698. set: function reactiveSetter (newVal) {
  699. var value = getter ? getter.call(obj) : val;
  700. /* eslint-disable no-self-compare */
  701. if (newVal === value || (newVal !== newVal && value !== value)) {
  702. return
  703. }
  704. /* eslint-enable no-self-compare */
  705. if ("development" !== 'production' && customSetter) {
  706. customSetter();
  707. }
  708. if (setter) {
  709. setter.call(obj, newVal);
  710. } else {
  711. val = newVal;
  712. }
  713. childOb = observe(newVal);
  714. dep.notify();
  715. }
  716. });
  717. }
  718. /**
  719. * Set a property on an object. Adds the new property and
  720. * triggers change notification if the property doesn't
  721. * already exist.
  722. */
  723. function set$1 (obj, key, val) {
  724. if (Array.isArray(obj)) {
  725. obj.length = Math.max(obj.length, key);
  726. obj.splice(key, 1, val);
  727. return val
  728. }
  729. if (hasOwn(obj, key)) {
  730. obj[key] = val;
  731. return
  732. }
  733. var ob = obj.__ob__;
  734. if (obj._isVue || (ob && ob.vmCount)) {
  735. "development" !== 'production' && warn(
  736. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  737. 'at runtime - declare it upfront in the data option.'
  738. );
  739. return
  740. }
  741. if (!ob) {
  742. obj[key] = val;
  743. return
  744. }
  745. defineReactive$$1(ob.value, key, val);
  746. ob.dep.notify();
  747. return val
  748. }
  749. /**
  750. * Delete a property and trigger change if necessary.
  751. */
  752. function del (obj, key) {
  753. var ob = obj.__ob__;
  754. if (obj._isVue || (ob && ob.vmCount)) {
  755. "development" !== 'production' && warn(
  756. 'Avoid deleting properties on a Vue instance or its root $data ' +
  757. '- just set it to null.'
  758. );
  759. return
  760. }
  761. if (!hasOwn(obj, key)) {
  762. return
  763. }
  764. delete obj[key];
  765. if (!ob) {
  766. return
  767. }
  768. ob.dep.notify();
  769. }
  770. /**
  771. * Collect dependencies on array elements when the array is touched, since
  772. * we cannot intercept array element access like property getters.
  773. */
  774. function dependArray (value) {
  775. for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
  776. e = value[i];
  777. e && e.__ob__ && e.__ob__.dep.depend();
  778. if (Array.isArray(e)) {
  779. dependArray(e);
  780. }
  781. }
  782. }
  783. /* */
  784. /**
  785. * Option overwriting strategies are functions that handle
  786. * how to merge a parent option value and a child option
  787. * value into the final value.
  788. */
  789. var strats = config.optionMergeStrategies;
  790. /**
  791. * Options with restrictions
  792. */
  793. {
  794. strats.el = strats.propsData = function (parent, child, vm, key) {
  795. if (!vm) {
  796. warn(
  797. "option \"" + key + "\" can only be used during instance " +
  798. 'creation with the `new` keyword.'
  799. );
  800. }
  801. return defaultStrat(parent, child)
  802. };
  803. }
  804. /**
  805. * Helper that recursively merges two data objects together.
  806. */
  807. function mergeData (to, from) {
  808. if (!from) { return to }
  809. var key, toVal, fromVal;
  810. var keys = Object.keys(from);
  811. for (var i = 0; i < keys.length; i++) {
  812. key = keys[i];
  813. toVal = to[key];
  814. fromVal = from[key];
  815. if (!hasOwn(to, key)) {
  816. set$1(to, key, fromVal);
  817. } else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
  818. mergeData(toVal, fromVal);
  819. }
  820. }
  821. return to
  822. }
  823. /**
  824. * Data
  825. */
  826. strats.data = function (
  827. parentVal,
  828. childVal,
  829. vm
  830. ) {
  831. if (!vm) {
  832. // in a Vue.extend merge, both should be functions
  833. if (!childVal) {
  834. return parentVal
  835. }
  836. if (typeof childVal !== 'function') {
  837. "development" !== 'production' && warn(
  838. 'The "data" option should be a function ' +
  839. 'that returns a per-instance value in component ' +
  840. 'definitions.',
  841. vm
  842. );
  843. return parentVal
  844. }
  845. if (!parentVal) {
  846. return childVal
  847. }
  848. // when parentVal & childVal are both present,
  849. // we need to return a function that returns the
  850. // merged result of both functions... no need to
  851. // check if parentVal is a function here because
  852. // it has to be a function to pass previous merges.
  853. return function mergedDataFn () {
  854. return mergeData(
  855. childVal.call(this),
  856. parentVal.call(this)
  857. )
  858. }
  859. } else if (parentVal || childVal) {
  860. return function mergedInstanceDataFn () {
  861. // instance merge
  862. var instanceData = typeof childVal === 'function'
  863. ? childVal.call(vm)
  864. : childVal;
  865. var defaultData = typeof parentVal === 'function'
  866. ? parentVal.call(vm)
  867. : undefined;
  868. if (instanceData) {
  869. return mergeData(instanceData, defaultData)
  870. } else {
  871. return defaultData
  872. }
  873. }
  874. }
  875. };
  876. /**
  877. * Hooks and param attributes are merged as arrays.
  878. */
  879. function mergeHook (
  880. parentVal,
  881. childVal
  882. ) {
  883. return childVal
  884. ? parentVal
  885. ? parentVal.concat(childVal)
  886. : Array.isArray(childVal)
  887. ? childVal
  888. : [childVal]
  889. : parentVal
  890. }
  891. config._lifecycleHooks.forEach(function (hook) {
  892. strats[hook] = mergeHook;
  893. });
  894. /**
  895. * Assets
  896. *
  897. * When a vm is present (instance creation), we need to do
  898. * a three-way merge between constructor options, instance
  899. * options and parent options.
  900. */
  901. function mergeAssets (parentVal, childVal) {
  902. var res = Object.create(parentVal || null);
  903. return childVal
  904. ? extend(res, childVal)
  905. : res
  906. }
  907. config._assetTypes.forEach(function (type) {
  908. strats[type + 's'] = mergeAssets;
  909. });
  910. /**
  911. * Watchers.
  912. *
  913. * Watchers hashes should not overwrite one
  914. * another, so we merge them as arrays.
  915. */
  916. strats.watch = function (parentVal, childVal) {
  917. /* istanbul ignore if */
  918. if (!childVal) { return parentVal }
  919. if (!parentVal) { return childVal }
  920. var ret = {};
  921. extend(ret, parentVal);
  922. for (var key in childVal) {
  923. var parent = ret[key];
  924. var child = childVal[key];
  925. if (parent && !Array.isArray(parent)) {
  926. parent = [parent];
  927. }
  928. ret[key] = parent
  929. ? parent.concat(child)
  930. : [child];
  931. }
  932. return ret
  933. };
  934. /**
  935. * Other object hashes.
  936. */
  937. strats.props =
  938. strats.methods =
  939. strats.computed = function (parentVal, childVal) {
  940. if (!childVal) { return parentVal }
  941. if (!parentVal) { return childVal }
  942. var ret = Object.create(null);
  943. extend(ret, parentVal);
  944. extend(ret, childVal);
  945. return ret
  946. };
  947. /**
  948. * Default strategy.
  949. */
  950. var defaultStrat = function (parentVal, childVal) {
  951. return childVal === undefined
  952. ? parentVal
  953. : childVal
  954. };
  955. /**
  956. * Validate component names
  957. */
  958. function checkComponents (options) {
  959. for (var key in options.components) {
  960. var lower = key.toLowerCase();
  961. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  962. warn(
  963. 'Do not use built-in or reserved HTML elements as component ' +
  964. 'id: ' + key
  965. );
  966. }
  967. }
  968. }
  969. /**
  970. * Ensure all props option syntax are normalized into the
  971. * Object-based format.
  972. */
  973. function normalizeProps (options) {
  974. var props = options.props;
  975. if (!props) { return }
  976. var res = {};
  977. var i, val, name;
  978. if (Array.isArray(props)) {
  979. i = props.length;
  980. while (i--) {
  981. val = props[i];
  982. if (typeof val === 'string') {
  983. name = camelize(val);
  984. res[name] = { type: null };
  985. } else {
  986. warn('props must be strings when using array syntax.');
  987. }
  988. }
  989. } else if (isPlainObject(props)) {
  990. for (var key in props) {
  991. val = props[key];
  992. name = camelize(key);
  993. res[name] = isPlainObject(val)
  994. ? val
  995. : { type: val };
  996. }
  997. }
  998. options.props = res;
  999. }
  1000. /**
  1001. * Normalize raw function directives into object format.
  1002. */
  1003. function normalizeDirectives (options) {
  1004. var dirs = options.directives;
  1005. if (dirs) {
  1006. for (var key in dirs) {
  1007. var def = dirs[key];
  1008. if (typeof def === 'function') {
  1009. dirs[key] = { bind: def, update: def };
  1010. }
  1011. }
  1012. }
  1013. }
  1014. /**
  1015. * Merge two option objects into a new one.
  1016. * Core utility used in both instantiation and inheritance.
  1017. */
  1018. function mergeOptions (
  1019. parent,
  1020. child,
  1021. vm
  1022. ) {
  1023. {
  1024. checkComponents(child);
  1025. }
  1026. normalizeProps(child);
  1027. normalizeDirectives(child);
  1028. var extendsFrom = child.extends;
  1029. if (extendsFrom) {
  1030. parent = typeof extendsFrom === 'function'
  1031. ? mergeOptions(parent, extendsFrom.options, vm)
  1032. : mergeOptions(parent, extendsFrom, vm);
  1033. }
  1034. if (child.mixins) {
  1035. for (var i = 0, l = child.mixins.length; i < l; i++) {
  1036. var mixin = child.mixins[i];
  1037. if (mixin.prototype instanceof Vue$3) {
  1038. mixin = mixin.options;
  1039. }
  1040. parent = mergeOptions(parent, mixin, vm);
  1041. }
  1042. }
  1043. var options = {};
  1044. var key;
  1045. for (key in parent) {
  1046. mergeField(key);
  1047. }
  1048. for (key in child) {
  1049. if (!hasOwn(parent, key)) {
  1050. mergeField(key);
  1051. }
  1052. }
  1053. function mergeField (key) {
  1054. var strat = strats[key] || defaultStrat;
  1055. options[key] = strat(parent[key], child[key], vm, key);
  1056. }
  1057. return options
  1058. }
  1059. /**
  1060. * Resolve an asset.
  1061. * This function is used because child instances need access
  1062. * to assets defined in its ancestor chain.
  1063. */
  1064. function resolveAsset (
  1065. options,
  1066. type,
  1067. id,
  1068. warnMissing
  1069. ) {
  1070. /* istanbul ignore if */
  1071. if (typeof id !== 'string') {
  1072. return
  1073. }
  1074. var assets = options[type];
  1075. var res = assets[id] ||
  1076. // camelCase ID
  1077. assets[camelize(id)] ||
  1078. // Pascal Case ID
  1079. assets[capitalize(camelize(id))];
  1080. if ("development" !== 'production' && warnMissing && !res) {
  1081. warn(
  1082. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  1083. options
  1084. );
  1085. }
  1086. return res
  1087. }
  1088. /* */
  1089. function validateProp (
  1090. key,
  1091. propOptions,
  1092. propsData,
  1093. vm
  1094. ) {
  1095. var prop = propOptions[key];
  1096. var absent = !hasOwn(propsData, key);
  1097. var value = propsData[key];
  1098. // handle boolean props
  1099. if (isBooleanType(prop.type)) {
  1100. if (absent && !hasOwn(prop, 'default')) {
  1101. value = false;
  1102. } else if (value === '' || value === hyphenate(key)) {
  1103. value = true;
  1104. }
  1105. }
  1106. // check default value
  1107. if (value === undefined) {
  1108. value = getPropDefaultValue(vm, prop, key);
  1109. // since the default value is a fresh copy,
  1110. // make sure to observe it.
  1111. var prevShouldConvert = observerState.shouldConvert;
  1112. observerState.shouldConvert = true;
  1113. observe(value);
  1114. observerState.shouldConvert = prevShouldConvert;
  1115. }
  1116. {
  1117. assertProp(prop, key, value, vm, absent);
  1118. }
  1119. return value
  1120. }
  1121. /**
  1122. * Get the default value of a prop.
  1123. */
  1124. function getPropDefaultValue (vm, prop, key) {
  1125. // no default, return undefined
  1126. if (!hasOwn(prop, 'default')) {
  1127. return undefined
  1128. }
  1129. var def = prop.default;
  1130. // warn against non-factory defaults for Object & Array
  1131. if (isObject(def)) {
  1132. "development" !== 'production' && warn(
  1133. 'Invalid default value for prop "' + key + '": ' +
  1134. 'Props with type Object/Array must use a factory function ' +
  1135. 'to return the default value.',
  1136. vm
  1137. );
  1138. }
  1139. // the raw prop value was also undefined from previous render,
  1140. // return previous default value to avoid unnecessary watcher trigger
  1141. if (vm && vm.$options.propsData &&
  1142. vm.$options.propsData[key] === undefined &&
  1143. vm[key] !== undefined) {
  1144. return vm[key]
  1145. }
  1146. // call factory function for non-Function types
  1147. return typeof def === 'function' && prop.type !== Function
  1148. ? def.call(vm)
  1149. : def
  1150. }
  1151. /**
  1152. * Assert whether a prop is valid.
  1153. */
  1154. function assertProp (
  1155. prop,
  1156. name,
  1157. value,
  1158. vm,
  1159. absent
  1160. ) {
  1161. if (prop.required && absent) {
  1162. warn(
  1163. 'Missing required prop: "' + name + '"',
  1164. vm
  1165. );
  1166. return
  1167. }
  1168. if (value == null && !prop.required) {
  1169. return
  1170. }
  1171. var type = prop.type;
  1172. var valid = !type || type === true;
  1173. var expectedTypes = [];
  1174. if (type) {
  1175. if (!Array.isArray(type)) {
  1176. type = [type];
  1177. }
  1178. for (var i = 0; i < type.length && !valid; i++) {
  1179. var assertedType = assertType(value, type[i]);
  1180. expectedTypes.push(assertedType.expectedType);
  1181. valid = assertedType.valid;
  1182. }
  1183. }
  1184. if (!valid) {
  1185. warn(
  1186. 'Invalid prop: type check failed for prop "' + name + '".' +
  1187. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  1188. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  1189. vm
  1190. );
  1191. return
  1192. }
  1193. var validator = prop.validator;
  1194. if (validator) {
  1195. if (!validator(value)) {
  1196. warn(
  1197. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  1198. vm
  1199. );
  1200. }
  1201. }
  1202. }
  1203. /**
  1204. * Assert the type of a value
  1205. */
  1206. function assertType (value, type) {
  1207. var valid;
  1208. var expectedType = getType(type);
  1209. if (expectedType === 'String') {
  1210. valid = typeof value === (expectedType = 'string');
  1211. } else if (expectedType === 'Number') {
  1212. valid = typeof value === (expectedType = 'number');
  1213. } else if (expectedType === 'Boolean') {
  1214. valid = typeof value === (expectedType = 'boolean');
  1215. } else if (expectedType === 'Function') {
  1216. valid = typeof value === (expectedType = 'function');
  1217. } else if (expectedType === 'Object') {
  1218. valid = isPlainObject(value);
  1219. } else if (expectedType === 'Array') {
  1220. valid = Array.isArray(value);
  1221. } else {
  1222. valid = value instanceof type;
  1223. }
  1224. return {
  1225. valid: valid,
  1226. expectedType: expectedType
  1227. }
  1228. }
  1229. /**
  1230. * Use function string name to check built-in types,
  1231. * because a simple equality check will fail when running
  1232. * across different vms / iframes.
  1233. */
  1234. function getType (fn) {
  1235. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  1236. return match && match[1]
  1237. }
  1238. function isBooleanType (fn) {
  1239. if (!Array.isArray(fn)) {
  1240. return getType(fn) === 'Boolean'
  1241. }
  1242. for (var i = 0, len = fn.length; i < len; i++) {
  1243. if (getType(fn[i]) === 'Boolean') {
  1244. return true
  1245. }
  1246. }
  1247. /* istanbul ignore next */
  1248. return false
  1249. }
  1250. var util = Object.freeze({
  1251. defineReactive: defineReactive$$1,
  1252. _toString: _toString,
  1253. toNumber: toNumber,
  1254. makeMap: makeMap,
  1255. isBuiltInTag: isBuiltInTag,
  1256. remove: remove$1,
  1257. hasOwn: hasOwn,
  1258. isPrimitive: isPrimitive,
  1259. cached: cached,
  1260. camelize: camelize,
  1261. capitalize: capitalize,
  1262. hyphenate: hyphenate,
  1263. bind: bind$1,
  1264. toArray: toArray,
  1265. extend: extend,
  1266. isObject: isObject,
  1267. isPlainObject: isPlainObject,
  1268. toObject: toObject,
  1269. noop: noop,
  1270. no: no,
  1271. genStaticKeys: genStaticKeys,
  1272. looseEqual: looseEqual,
  1273. looseIndexOf: looseIndexOf,
  1274. isReserved: isReserved,
  1275. def: def,
  1276. parsePath: parsePath,
  1277. hasProto: hasProto,
  1278. inBrowser: inBrowser,
  1279. UA: UA,
  1280. isIE: isIE,
  1281. isIE9: isIE9,
  1282. isEdge: isEdge,
  1283. isAndroid: isAndroid,
  1284. isIOS: isIOS,
  1285. isServerRendering: isServerRendering,
  1286. devtools: devtools,
  1287. nextTick: nextTick,
  1288. get _Set () { return _Set; },
  1289. mergeOptions: mergeOptions,
  1290. resolveAsset: resolveAsset,
  1291. get warn () { return warn; },
  1292. get formatComponentName () { return formatComponentName; },
  1293. validateProp: validateProp
  1294. });
  1295. /* not type checking this file because flow doesn't play well with Proxy */
  1296. var initProxy;
  1297. {
  1298. var allowedGlobals = makeMap(
  1299. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  1300. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  1301. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  1302. 'require' // for Webpack/Browserify
  1303. );
  1304. var warnNonPresent = function (target, key) {
  1305. warn(
  1306. "Property or method \"" + key + "\" is not defined on the instance but " +
  1307. "referenced during render. Make sure to declare reactive data " +
  1308. "properties in the data option.",
  1309. target
  1310. );
  1311. };
  1312. var hasProxy =
  1313. typeof Proxy !== 'undefined' &&
  1314. Proxy.toString().match(/native code/);
  1315. if (hasProxy) {
  1316. var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
  1317. config.keyCodes = new Proxy(config.keyCodes, {
  1318. set: function set (target, key, value) {
  1319. if (isBuiltInModifier(key)) {
  1320. warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
  1321. return false
  1322. } else {
  1323. target[key] = value;
  1324. return true
  1325. }
  1326. }
  1327. });
  1328. }
  1329. var hasHandler = {
  1330. has: function has (target, key) {
  1331. var has = key in target;
  1332. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  1333. if (!has && !isAllowed) {
  1334. warnNonPresent(target, key);
  1335. }
  1336. return has || !isAllowed
  1337. }
  1338. };
  1339. var getHandler = {
  1340. get: function get (target, key) {
  1341. if (typeof key === 'string' && !(key in target)) {
  1342. warnNonPresent(target, key);
  1343. }
  1344. return target[key]
  1345. }
  1346. };
  1347. initProxy = function initProxy (vm) {
  1348. if (hasProxy) {
  1349. // determine which proxy handler to use
  1350. var options = vm.$options;
  1351. var handlers = options.render && options.render._withStripped
  1352. ? getHandler
  1353. : hasHandler;
  1354. vm._renderProxy = new Proxy(vm, handlers);
  1355. } else {
  1356. vm._renderProxy = vm;
  1357. }
  1358. };
  1359. }
  1360. /* */
  1361. var queue = [];
  1362. var has$1 = {};
  1363. var circular = {};
  1364. var waiting = false;
  1365. var flushing = false;
  1366. var index = 0;
  1367. /**
  1368. * Reset the scheduler's state.
  1369. */
  1370. function resetSchedulerState () {
  1371. queue.length = 0;
  1372. has$1 = {};
  1373. {
  1374. circular = {};
  1375. }
  1376. waiting = flushing = false;
  1377. }
  1378. /**
  1379. * Flush both queues and run the watchers.
  1380. */
  1381. function flushSchedulerQueue () {
  1382. flushing = true;
  1383. // Sort queue before flush.
  1384. // This ensures that:
  1385. // 1. Components are updated from parent to child. (because parent is always
  1386. // created before the child)
  1387. // 2. A component's user watchers are run before its render watcher (because
  1388. // user watchers are created before the render watcher)
  1389. // 3. If a component is destroyed during a parent component's watcher run,
  1390. // its watchers can be skipped.
  1391. queue.sort(function (a, b) { return a.id - b.id; });
  1392. // do not cache length because more watchers might be pushed
  1393. // as we run existing watchers
  1394. for (index = 0; index < queue.length; index++) {
  1395. var watcher = queue[index];
  1396. var id = watcher.id;
  1397. has$1[id] = null;
  1398. watcher.run();
  1399. // in dev build, check and stop circular updates.
  1400. if ("development" !== 'production' && has$1[id] != null) {
  1401. circular[id] = (circular[id] || 0) + 1;
  1402. if (circular[id] > config._maxUpdateCount) {
  1403. warn(
  1404. 'You may have an infinite update loop ' + (
  1405. watcher.user
  1406. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  1407. : "in a component render function."
  1408. ),
  1409. watcher.vm
  1410. );
  1411. break
  1412. }
  1413. }
  1414. }
  1415. // devtool hook
  1416. /* istanbul ignore if */
  1417. if (devtools && config.devtools) {
  1418. devtools.emit('flush');
  1419. }
  1420. resetSchedulerState();
  1421. }
  1422. /**
  1423. * Push a watcher into the watcher queue.
  1424. * Jobs with duplicate IDs will be skipped unless it's
  1425. * pushed when the queue is being flushed.
  1426. */
  1427. function queueWatcher (watcher) {
  1428. var id = watcher.id;
  1429. if (has$1[id] == null) {
  1430. has$1[id] = true;
  1431. if (!flushing) {
  1432. queue.push(watcher);
  1433. } else {
  1434. // if already flushing, splice the watcher based on its id
  1435. // if already past its id, it will be run next immediately.
  1436. var i = queue.length - 1;
  1437. while (i >= 0 && queue[i].id > watcher.id) {
  1438. i--;
  1439. }
  1440. queue.splice(Math.max(i, index) + 1, 0, watcher);
  1441. }
  1442. // queue the flush
  1443. if (!waiting) {
  1444. waiting = true;
  1445. nextTick(flushSchedulerQueue);
  1446. }
  1447. }
  1448. }
  1449. /* */
  1450. var uid$2 = 0;
  1451. /**
  1452. * A watcher parses an expression, collects dependencies,
  1453. * and fires callback when the expression value changes.
  1454. * This is used for both the $watch() api and directives.
  1455. */
  1456. var Watcher = function Watcher (
  1457. vm,
  1458. expOrFn,
  1459. cb,
  1460. options
  1461. ) {
  1462. if ( options === void 0 ) options = {};
  1463. this.vm = vm;
  1464. vm._watchers.push(this);
  1465. // options
  1466. this.deep = !!options.deep;
  1467. this.user = !!options.user;
  1468. this.lazy = !!options.lazy;
  1469. this.sync = !!options.sync;
  1470. this.expression = expOrFn.toString();
  1471. this.cb = cb;
  1472. this.id = ++uid$2; // uid for batching
  1473. this.active = true;
  1474. this.dirty = this.lazy; // for lazy watchers
  1475. this.deps = [];
  1476. this.newDeps = [];
  1477. this.depIds = new _Set();
  1478. this.newDepIds = new _Set();
  1479. // parse expression for getter
  1480. if (typeof expOrFn === 'function') {
  1481. this.getter = expOrFn;
  1482. } else {
  1483. this.getter = parsePath(expOrFn);
  1484. if (!this.getter) {
  1485. this.getter = function () {};
  1486. "development" !== 'production' && warn(
  1487. "Failed watching path: \"" + expOrFn + "\" " +
  1488. 'Watcher only accepts simple dot-delimited paths. ' +
  1489. 'For full control, use a function instead.',
  1490. vm
  1491. );
  1492. }
  1493. }
  1494. this.value = this.lazy
  1495. ? undefined
  1496. : this.get();
  1497. };
  1498. /**
  1499. * Evaluate the getter, and re-collect dependencies.
  1500. */
  1501. Watcher.prototype.get = function get () {
  1502. pushTarget(this);
  1503. var value = this.getter.call(this.vm, this.vm);
  1504. // "touch" every property so they are all tracked as
  1505. // dependencies for deep watching
  1506. if (this.deep) {
  1507. traverse(value);
  1508. }
  1509. popTarget();
  1510. this.cleanupDeps();
  1511. return value
  1512. };
  1513. /**
  1514. * Add a dependency to this directive.
  1515. */
  1516. Watcher.prototype.addDep = function addDep (dep) {
  1517. var id = dep.id;
  1518. if (!this.newDepIds.has(id)) {
  1519. this.newDepIds.add(id);
  1520. this.newDeps.push(dep);
  1521. if (!this.depIds.has(id)) {
  1522. dep.addSub(this);
  1523. }
  1524. }
  1525. };
  1526. /**
  1527. * Clean up for dependency collection.
  1528. */
  1529. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  1530. var this$1 = this;
  1531. var i = this.deps.length;
  1532. while (i--) {
  1533. var dep = this$1.deps[i];
  1534. if (!this$1.newDepIds.has(dep.id)) {
  1535. dep.removeSub(this$1);
  1536. }
  1537. }
  1538. var tmp = this.depIds;
  1539. this.depIds = this.newDepIds;
  1540. this.newDepIds = tmp;
  1541. this.newDepIds.clear();
  1542. tmp = this.deps;
  1543. this.deps = this.newDeps;
  1544. this.newDeps = tmp;
  1545. this.newDeps.length = 0;
  1546. };
  1547. /**
  1548. * Subscriber interface.
  1549. * Will be called when a dependency changes.
  1550. */
  1551. Watcher.prototype.update = function update () {
  1552. /* istanbul ignore else */
  1553. if (this.lazy) {
  1554. this.dirty = true;
  1555. } else if (this.sync) {
  1556. this.run();
  1557. } else {
  1558. queueWatcher(this);
  1559. }
  1560. };
  1561. /**
  1562. * Scheduler job interface.
  1563. * Will be called by the scheduler.
  1564. */
  1565. Watcher.prototype.run = function run () {
  1566. if (this.active) {
  1567. var value = this.get();
  1568. if (
  1569. value !== this.value ||
  1570. // Deep watchers and watchers on Object/Arrays should fire even
  1571. // when the value is the same, because the value may
  1572. // have mutated.
  1573. isObject(value) ||
  1574. this.deep
  1575. ) {
  1576. // set new value
  1577. var oldValue = this.value;
  1578. this.value = value;
  1579. if (this.user) {
  1580. try {
  1581. this.cb.call(this.vm, value, oldValue);
  1582. } catch (e) {
  1583. /* istanbul ignore else */
  1584. if (config.errorHandler) {
  1585. config.errorHandler.call(null, e, this.vm);
  1586. } else {
  1587. "development" !== 'production' && warn(
  1588. ("Error in watcher \"" + (this.expression) + "\""),
  1589. this.vm
  1590. );
  1591. throw e
  1592. }
  1593. }
  1594. } else {
  1595. this.cb.call(this.vm, value, oldValue);
  1596. }
  1597. }
  1598. }
  1599. };
  1600. /**
  1601. * Evaluate the value of the watcher.
  1602. * This only gets called for lazy watchers.
  1603. */
  1604. Watcher.prototype.evaluate = function evaluate () {
  1605. this.value = this.get();
  1606. this.dirty = false;
  1607. };
  1608. /**
  1609. * Depend on all deps collected by this watcher.
  1610. */
  1611. Watcher.prototype.depend = function depend () {
  1612. var this$1 = this;
  1613. var i = this.deps.length;
  1614. while (i--) {
  1615. this$1.deps[i].depend();
  1616. }
  1617. };
  1618. /**
  1619. * Remove self from all dependencies' subscriber list.
  1620. */
  1621. Watcher.prototype.teardown = function teardown () {
  1622. var this$1 = this;
  1623. if (this.active) {
  1624. // remove self from vm's watcher list
  1625. // this is a somewhat expensive operation so we skip it
  1626. // if the vm is being destroyed or is performing a v-for
  1627. // re-render (the watcher list is then filtered by v-for).
  1628. if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {
  1629. remove$1(this.vm._watchers, this);
  1630. }
  1631. var i = this.deps.length;
  1632. while (i--) {
  1633. this$1.deps[i].removeSub(this$1);
  1634. }
  1635. this.active = false;
  1636. }
  1637. };
  1638. /**
  1639. * Recursively traverse an object to evoke all converted
  1640. * getters, so that every nested property inside the object
  1641. * is collected as a "deep" dependency.
  1642. */
  1643. var seenObjects = new _Set();
  1644. function traverse (val) {
  1645. seenObjects.clear();
  1646. _traverse(val, seenObjects);
  1647. }
  1648. function _traverse (val, seen) {
  1649. var i, keys;
  1650. var isA = Array.isArray(val);
  1651. if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
  1652. return
  1653. }
  1654. if (val.__ob__) {
  1655. var depId = val.__ob__.dep.id;
  1656. if (seen.has(depId)) {
  1657. return
  1658. }
  1659. seen.add(depId);
  1660. }
  1661. if (isA) {
  1662. i = val.length;
  1663. while (i--) { _traverse(val[i], seen); }
  1664. } else {
  1665. keys = Object.keys(val);
  1666. i = keys.length;
  1667. while (i--) { _traverse(val[keys[i]], seen); }
  1668. }
  1669. }
  1670. /* */
  1671. function initState (vm) {
  1672. vm._watchers = [];
  1673. initProps(vm);
  1674. initMethods(vm);
  1675. initData(vm);
  1676. initComputed(vm);
  1677. initWatch(vm);
  1678. }
  1679. var isReservedProp = { key: 1, ref: 1, slot: 1 };
  1680. function initProps (vm) {
  1681. var props = vm.$options.props;
  1682. if (props) {
  1683. var propsData = vm.$options.propsData || {};
  1684. var keys = vm.$options._propKeys = Object.keys(props);
  1685. var isRoot = !vm.$parent;
  1686. // root instance props should be converted
  1687. observerState.shouldConvert = isRoot;
  1688. var loop = function ( i ) {
  1689. var key = keys[i];
  1690. /* istanbul ignore else */
  1691. {
  1692. if (isReservedProp[key]) {
  1693. warn(
  1694. ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
  1695. vm
  1696. );
  1697. }
  1698. defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
  1699. if (vm.$parent && !observerState.isSettingProps) {
  1700. warn(
  1701. "Avoid mutating a prop directly since the value will be " +
  1702. "overwritten whenever the parent component re-renders. " +
  1703. "Instead, use a data or computed property based on the prop's " +
  1704. "value. Prop being mutated: \"" + key + "\"",
  1705. vm
  1706. );
  1707. }
  1708. });
  1709. }
  1710. };
  1711. for (var i = 0; i < keys.length; i++) loop( i );
  1712. observerState.shouldConvert = true;
  1713. }
  1714. }
  1715. function initData (vm) {
  1716. var data = vm.$options.data;
  1717. data = vm._data = typeof data === 'function'
  1718. ? data.call(vm)
  1719. : data || {};
  1720. if (!isPlainObject(data)) {
  1721. data = {};
  1722. "development" !== 'production' && warn(
  1723. 'data functions should return an object.',
  1724. vm
  1725. );
  1726. }
  1727. // proxy data on instance
  1728. var keys = Object.keys(data);
  1729. var props = vm.$options.props;
  1730. var i = keys.length;
  1731. while (i--) {
  1732. if (props && hasOwn(props, keys[i])) {
  1733. "development" !== 'production' && warn(
  1734. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  1735. "Use prop default value instead.",
  1736. vm
  1737. );
  1738. } else {
  1739. proxy(vm, keys[i]);
  1740. }
  1741. }
  1742. // observe data
  1743. observe(data);
  1744. data.__ob__ && data.__ob__.vmCount++;
  1745. }
  1746. var computedSharedDefinition = {
  1747. enumerable: true,
  1748. configurable: true,
  1749. get: noop,
  1750. set: noop
  1751. };
  1752. function initComputed (vm) {
  1753. var computed = vm.$options.computed;
  1754. if (computed) {
  1755. for (var key in computed) {
  1756. var userDef = computed[key];
  1757. if (typeof userDef === 'function') {
  1758. computedSharedDefinition.get = makeComputedGetter(userDef, vm);
  1759. computedSharedDefinition.set = noop;
  1760. } else {
  1761. computedSharedDefinition.get = userDef.get
  1762. ? userDef.cache !== false
  1763. ? makeComputedGetter(userDef.get, vm)
  1764. : bind$1(userDef.get, vm)
  1765. : noop;
  1766. computedSharedDefinition.set = userDef.set
  1767. ? bind$1(userDef.set, vm)
  1768. : noop;
  1769. }
  1770. Object.defineProperty(vm, key, computedSharedDefinition);
  1771. }
  1772. }
  1773. }
  1774. function makeComputedGetter (getter, owner) {
  1775. var watcher = new Watcher(owner, getter, noop, {
  1776. lazy: true
  1777. });
  1778. return function computedGetter () {
  1779. if (watcher.dirty) {
  1780. watcher.evaluate();
  1781. }
  1782. if (Dep.target) {
  1783. watcher.depend();
  1784. }
  1785. return watcher.value
  1786. }
  1787. }
  1788. function initMethods (vm) {
  1789. var methods = vm.$options.methods;
  1790. if (methods) {
  1791. for (var key in methods) {
  1792. vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm);
  1793. if ("development" !== 'production' && methods[key] == null) {
  1794. warn(
  1795. "method \"" + key + "\" has an undefined value in the component definition. " +
  1796. "Did you reference the function correctly?",
  1797. vm
  1798. );
  1799. }
  1800. }
  1801. }
  1802. }
  1803. function initWatch (vm) {
  1804. var watch = vm.$options.watch;
  1805. if (watch) {
  1806. for (var key in watch) {
  1807. var handler = watch[key];
  1808. if (Array.isArray(handler)) {
  1809. for (var i = 0; i < handler.length; i++) {
  1810. createWatcher(vm, key, handler[i]);
  1811. }
  1812. } else {
  1813. createWatcher(vm, key, handler);
  1814. }
  1815. }
  1816. }
  1817. }
  1818. function createWatcher (vm, key, handler) {
  1819. var options;
  1820. if (isPlainObject(handler)) {
  1821. options = handler;
  1822. handler = handler.handler;
  1823. }
  1824. if (typeof handler === 'string') {
  1825. handler = vm[handler];
  1826. }
  1827. vm.$watch(key, handler, options);
  1828. }
  1829. function stateMixin (Vue) {
  1830. // flow somehow has problems with directly declared definition object
  1831. // when using Object.defineProperty, so we have to procedurally build up
  1832. // the object here.
  1833. var dataDef = {};
  1834. dataDef.get = function () {
  1835. return this._data
  1836. };
  1837. {
  1838. dataDef.set = function (newData) {
  1839. warn(
  1840. 'Avoid replacing instance root $data. ' +
  1841. 'Use nested data properties instead.',
  1842. this
  1843. );
  1844. };
  1845. }
  1846. Object.defineProperty(Vue.prototype, '$data', dataDef);
  1847. Vue.prototype.$set = set$1;
  1848. Vue.prototype.$delete = del;
  1849. Vue.prototype.$watch = function (
  1850. expOrFn,
  1851. cb,
  1852. options
  1853. ) {
  1854. var vm = this;
  1855. options = options || {};
  1856. options.user = true;
  1857. var watcher = new Watcher(vm, expOrFn, cb, options);
  1858. if (options.immediate) {
  1859. cb.call(vm, watcher.value);
  1860. }
  1861. return function unwatchFn () {
  1862. watcher.teardown();
  1863. }
  1864. };
  1865. }
  1866. function proxy (vm, key) {
  1867. if (!isReserved(key)) {
  1868. Object.defineProperty(vm, key, {
  1869. configurable: true,
  1870. enumerable: true,
  1871. get: function proxyGetter () {
  1872. return vm._data[key]
  1873. },
  1874. set: function proxySetter (val) {
  1875. vm._data[key] = val;
  1876. }
  1877. });
  1878. }
  1879. }
  1880. /* */
  1881. var VNode = function VNode (
  1882. tag,
  1883. data,
  1884. children,
  1885. text,
  1886. elm,
  1887. ns,
  1888. context,
  1889. componentOptions
  1890. ) {
  1891. this.tag = tag;
  1892. this.data = data;
  1893. this.children = children;
  1894. this.text = text;
  1895. this.elm = elm;
  1896. this.ns = ns;
  1897. this.context = context;
  1898. this.functionalContext = undefined;
  1899. this.key = data && data.key;
  1900. this.componentOptions = componentOptions;
  1901. this.child = undefined;
  1902. this.parent = undefined;
  1903. this.raw = false;
  1904. this.isStatic = false;
  1905. this.isRootInsert = true;
  1906. this.isComment = false;
  1907. this.isCloned = false;
  1908. this.isOnce = false;
  1909. };
  1910. var emptyVNode = function () {
  1911. var node = new VNode();
  1912. node.text = '';
  1913. node.isComment = true;
  1914. return node
  1915. };
  1916. // optimized shallow clone
  1917. // used for static nodes and slot nodes because they may be reused across
  1918. // multiple renders, cloning them avoids errors when DOM manipulations rely
  1919. // on their elm reference.
  1920. function cloneVNode (vnode) {
  1921. var cloned = new VNode(
  1922. vnode.tag,
  1923. vnode.data,
  1924. vnode.children,
  1925. vnode.text,
  1926. vnode.elm,
  1927. vnode.ns,
  1928. vnode.context,
  1929. vnode.componentOptions
  1930. );
  1931. cloned.isStatic = vnode.isStatic;
  1932. cloned.key = vnode.key;
  1933. cloned.isCloned = true;
  1934. return cloned
  1935. }
  1936. function cloneVNodes (vnodes) {
  1937. var res = new Array(vnodes.length);
  1938. for (var i = 0; i < vnodes.length; i++) {
  1939. res[i] = cloneVNode(vnodes[i]);
  1940. }
  1941. return res
  1942. }
  1943. /* */
  1944. function mergeVNodeHook (def, hookKey, hook, key) {
  1945. key = key + hookKey;
  1946. var injectedHash = def.__injected || (def.__injected = {});
  1947. if (!injectedHash[key]) {
  1948. injectedHash[key] = true;
  1949. var oldHook = def[hookKey];
  1950. if (oldHook) {
  1951. def[hookKey] = function () {
  1952. oldHook.apply(this, arguments);
  1953. hook.apply(this, arguments);
  1954. };
  1955. } else {
  1956. def[hookKey] = hook;
  1957. }
  1958. }
  1959. }
  1960. /* */
  1961. function updateListeners (
  1962. on,
  1963. oldOn,
  1964. add,
  1965. remove$$1,
  1966. vm
  1967. ) {
  1968. var name, cur, old, fn, event, capture, once;
  1969. for (name in on) {
  1970. cur = on[name];
  1971. old = oldOn[name];
  1972. if (!cur) {
  1973. "development" !== 'production' && warn(
  1974. "Invalid handler for event \"" + name + "\": got " + String(cur),
  1975. vm
  1976. );
  1977. } else if (!old) {
  1978. once = name.charAt(0) === '~'; // Prefixed last, checked first
  1979. event = once ? name.slice(1) : name;
  1980. capture = event.charAt(0) === '!';
  1981. event = capture ? event.slice(1) : event;
  1982. if (Array.isArray(cur)) {
  1983. add(event, (cur.invoker = arrInvoker(cur)), once, capture);
  1984. } else {
  1985. if (!cur.invoker) {
  1986. fn = cur;
  1987. cur = on[name] = {};
  1988. cur.fn = fn;
  1989. cur.invoker = fnInvoker(cur);
  1990. }
  1991. add(event, cur.invoker, once, capture);
  1992. }
  1993. } else if (cur !== old) {
  1994. if (Array.isArray(old)) {
  1995. old.length = cur.length;
  1996. for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
  1997. on[name] = old;
  1998. } else {
  1999. old.fn = cur;
  2000. on[name] = old;
  2001. }
  2002. }
  2003. }
  2004. for (name in oldOn) {
  2005. if (!on[name]) {
  2006. once = name.charAt(0) === '~'; // Prefixed last, checked first
  2007. event = once ? name.slice(1) : name;
  2008. capture = event.charAt(0) === '!';
  2009. event = capture ? event.slice(1) : event;
  2010. remove$$1(event, oldOn[name].invoker, capture);
  2011. }
  2012. }
  2013. }
  2014. function arrInvoker (arr) {
  2015. return function (ev) {
  2016. var arguments$1 = arguments;
  2017. var single = arguments.length === 1;
  2018. for (var i = 0; i < arr.length; i++) {
  2019. single ? arr[i](ev) : arr[i].apply(null, arguments$1);
  2020. }
  2021. }
  2022. }
  2023. function fnInvoker (o) {
  2024. return function (ev) {
  2025. var single = arguments.length === 1;
  2026. single ? o.fn(ev) : o.fn.apply(null, arguments);
  2027. }
  2028. }
  2029. /* */
  2030. function normalizeChildren (
  2031. children,
  2032. ns,
  2033. nestedIndex
  2034. ) {
  2035. if (isPrimitive(children)) {
  2036. return [createTextVNode(children)]
  2037. }
  2038. if (Array.isArray(children)) {
  2039. var res = [];
  2040. for (var i = 0, l = children.length; i < l; i++) {
  2041. var c = children[i];
  2042. var last = res[res.length - 1];
  2043. // nested
  2044. if (Array.isArray(c)) {
  2045. res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
  2046. } else if (isPrimitive(c)) {
  2047. if (last && last.text) {
  2048. last.text += String(c);
  2049. } else if (c !== '') {
  2050. // convert primitive to vnode
  2051. res.push(createTextVNode(c));
  2052. }
  2053. } else if (c instanceof VNode) {
  2054. if (c.text && last && last.text) {
  2055. if (!last.isCloned) {
  2056. last.text += c.text;
  2057. }
  2058. } else {
  2059. // inherit parent namespace
  2060. if (ns) {
  2061. applyNS(c, ns);
  2062. }
  2063. // default key for nested array children (likely generated by v-for)
  2064. if (c.tag && c.key == null && nestedIndex != null) {
  2065. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  2066. }
  2067. res.push(c);
  2068. }
  2069. }
  2070. }
  2071. return res
  2072. }
  2073. }
  2074. function createTextVNode (val) {
  2075. return new VNode(undefined, undefined, undefined, String(val))
  2076. }
  2077. function applyNS (vnode, ns) {
  2078. if (vnode.tag && !vnode.ns) {
  2079. vnode.ns = ns;
  2080. if (vnode.children) {
  2081. for (var i = 0, l = vnode.children.length; i < l; i++) {
  2082. applyNS(vnode.children[i], ns);
  2083. }
  2084. }
  2085. }
  2086. }
  2087. /* */
  2088. function getFirstComponentChild (children) {
  2089. return children && children.filter(function (c) { return c && c.componentOptions; })[0]
  2090. }
  2091. /* */
  2092. var activeInstance = null;
  2093. function initLifecycle (vm) {
  2094. var options = vm.$options;
  2095. // locate first non-abstract parent
  2096. var parent = options.parent;
  2097. if (parent && !options.abstract) {
  2098. while (parent.$options.abstract && parent.$parent) {
  2099. parent = parent.$parent;
  2100. }
  2101. parent.$children.push(vm);
  2102. }
  2103. vm.$parent = parent;
  2104. vm.$root = parent ? parent.$root : vm;
  2105. vm.$children = [];
  2106. vm.$refs = {};
  2107. vm._watcher = null;
  2108. vm._inactive = false;
  2109. vm._isMounted = false;
  2110. vm._isDestroyed = false;
  2111. vm._isBeingDestroyed = false;
  2112. }
  2113. function lifecycleMixin (Vue) {
  2114. Vue.prototype._mount = function (
  2115. el,
  2116. hydrating
  2117. ) {
  2118. var vm = this;
  2119. vm.$el = el;
  2120. if (!vm.$options.render) {
  2121. vm.$options.render = emptyVNode;
  2122. {
  2123. /* istanbul ignore if */
  2124. if (vm.$options.template && vm.$options.template.charAt(0) !== '#') {
  2125. warn(
  2126. 'You are using the runtime-only build of Vue where the template ' +
  2127. 'option is not available. Either pre-compile the templates into ' +
  2128. 'render functions, or use the compiler-included build.',
  2129. vm
  2130. );
  2131. } else {
  2132. warn(
  2133. 'Failed to mount component: template or render function not defined.',
  2134. vm
  2135. );
  2136. }
  2137. }
  2138. }
  2139. callHook(vm, 'beforeMount');
  2140. vm._watcher = new Watcher(vm, function () {
  2141. vm._update(vm._render(), hydrating);
  2142. }, noop);
  2143. hydrating = false;
  2144. // manually mounted instance, call mounted on self
  2145. // mounted is called for render-created child components in its inserted hook
  2146. if (vm.$vnode == null) {
  2147. vm._isMounted = true;
  2148. callHook(vm, 'mounted');
  2149. }
  2150. return vm
  2151. };
  2152. Vue.prototype._update = function (vnode, hydrating) {
  2153. var vm = this;
  2154. if (vm._isMounted) {
  2155. callHook(vm, 'beforeUpdate');
  2156. }
  2157. var prevEl = vm.$el;
  2158. var prevVnode = vm._vnode;
  2159. var prevActiveInstance = activeInstance;
  2160. activeInstance = vm;
  2161. vm._vnode = vnode;
  2162. // Vue.prototype.__patch__ is injected in entry points
  2163. // based on the rendering backend used.
  2164. if (!prevVnode) {
  2165. // initial render
  2166. vm.$el = vm.__patch__(
  2167. vm.$el, vnode, hydrating, false /* removeOnly */,
  2168. vm.$options._parentElm,
  2169. vm.$options._refElm
  2170. );
  2171. } else {
  2172. // updates
  2173. vm.$el = vm.__patch__(prevVnode, vnode);
  2174. }
  2175. activeInstance = prevActiveInstance;
  2176. // update __vue__ reference
  2177. if (prevEl) {
  2178. prevEl.__vue__ = null;
  2179. }
  2180. if (vm.$el) {
  2181. vm.$el.__vue__ = vm;
  2182. }
  2183. // if parent is an HOC, update its $el as well
  2184. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  2185. vm.$parent.$el = vm.$el;
  2186. }
  2187. if (vm._isMounted) {
  2188. callHook(vm, 'updated');
  2189. }
  2190. };
  2191. Vue.prototype._updateFromParent = function (
  2192. propsData,
  2193. listeners,
  2194. parentVnode,
  2195. renderChildren
  2196. ) {
  2197. var vm = this;
  2198. var hasChildren = !!(vm.$options._renderChildren || renderChildren);
  2199. vm.$options._parentVnode = parentVnode;
  2200. vm.$vnode = parentVnode; // update vm's placeholder node without re-render
  2201. if (vm._vnode) { // update child tree's parent
  2202. vm._vnode.parent = parentVnode;
  2203. }
  2204. vm.$options._renderChildren = renderChildren;
  2205. // update props
  2206. if (propsData && vm.$options.props) {
  2207. observerState.shouldConvert = false;
  2208. {
  2209. observerState.isSettingProps = true;
  2210. }
  2211. var propKeys = vm.$options._propKeys || [];
  2212. for (var i = 0; i < propKeys.length; i++) {
  2213. var key = propKeys[i];
  2214. vm[key] = validateProp(key, vm.$options.props, propsData, vm);
  2215. }
  2216. observerState.shouldConvert = true;
  2217. {
  2218. observerState.isSettingProps = false;
  2219. }
  2220. vm.$options.propsData = propsData;
  2221. }
  2222. // update listeners
  2223. if (listeners) {
  2224. var oldListeners = vm.$options._parentListeners;
  2225. vm.$options._parentListeners = listeners;
  2226. vm._updateListeners(listeners, oldListeners);
  2227. }
  2228. // resolve slots + force update if has children
  2229. if (hasChildren) {
  2230. vm.$slots = resolveSlots(renderChildren, parentVnode.context);
  2231. vm.$forceUpdate();
  2232. }
  2233. };
  2234. Vue.prototype.$forceUpdate = function () {
  2235. var vm = this;
  2236. if (vm._watcher) {
  2237. vm._watcher.update();
  2238. }
  2239. };
  2240. Vue.prototype.$destroy = function () {
  2241. var vm = this;
  2242. if (vm._isBeingDestroyed) {
  2243. return
  2244. }
  2245. callHook(vm, 'beforeDestroy');
  2246. vm._isBeingDestroyed = true;
  2247. // remove self from parent
  2248. var parent = vm.$parent;
  2249. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  2250. remove$1(parent.$children, vm);
  2251. }
  2252. // teardown watchers
  2253. if (vm._watcher) {
  2254. vm._watcher.teardown();
  2255. }
  2256. var i = vm._watchers.length;
  2257. while (i--) {
  2258. vm._watchers[i].teardown();
  2259. }
  2260. // remove reference from data ob
  2261. // frozen object may not have observer.
  2262. if (vm._data.__ob__) {
  2263. vm._data.__ob__.vmCount--;
  2264. }
  2265. // call the last hook...
  2266. vm._isDestroyed = true;
  2267. callHook(vm, 'destroyed');
  2268. // turn off all instance listeners.
  2269. vm.$off();
  2270. // remove __vue__ reference
  2271. if (vm.$el) {
  2272. vm.$el.__vue__ = null;
  2273. }
  2274. // invoke destroy hooks on current rendered tree
  2275. vm.__patch__(vm._vnode, null);
  2276. };
  2277. }
  2278. function callHook (vm, hook) {
  2279. var handlers = vm.$options[hook];
  2280. if (handlers) {
  2281. for (var i = 0, j = handlers.length; i < j; i++) {
  2282. handlers[i].call(vm);
  2283. }
  2284. }
  2285. vm.$emit('hook:' + hook);
  2286. }
  2287. /* */
  2288. var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy$1 };
  2289. var hooksToMerge = Object.keys(hooks);
  2290. function createComponent (
  2291. Ctor,
  2292. data,
  2293. context,
  2294. children,
  2295. tag
  2296. ) {
  2297. if (!Ctor) {
  2298. return
  2299. }
  2300. var baseCtor = context.$options._base;
  2301. if (isObject(Ctor)) {
  2302. Ctor = baseCtor.extend(Ctor);
  2303. }
  2304. if (typeof Ctor !== 'function') {
  2305. {
  2306. warn(("Invalid Component definition: " + (String(Ctor))), context);
  2307. }
  2308. return
  2309. }
  2310. // async component
  2311. if (!Ctor.cid) {
  2312. if (Ctor.resolved) {
  2313. Ctor = Ctor.resolved;
  2314. } else {
  2315. Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
  2316. // it's ok to queue this on every render because
  2317. // $forceUpdate is buffered by the scheduler.
  2318. context.$forceUpdate();
  2319. });
  2320. if (!Ctor) {
  2321. // return nothing if this is indeed an async component
  2322. // wait for the callback to trigger parent update.
  2323. return
  2324. }
  2325. }
  2326. }
  2327. // resolve constructor options in case global mixins are applied after
  2328. // component constructor creation
  2329. resolveConstructorOptions(Ctor);
  2330. data = data || {};
  2331. // extract props
  2332. var propsData = extractProps(data, Ctor);
  2333. // functional component
  2334. if (Ctor.options.functional) {
  2335. return createFunctionalComponent(Ctor, propsData, data, context, children)
  2336. }
  2337. // extract listeners, since these needs to be treated as
  2338. // child component listeners instead of DOM listeners
  2339. var listeners = data.on;
  2340. // replace with listeners with .native modifier
  2341. data.on = data.nativeOn;
  2342. if (Ctor.options.abstract) {
  2343. // abstract components do not keep anything
  2344. // other than props & listeners
  2345. data = {};
  2346. }
  2347. // merge component management hooks onto the placeholder node
  2348. mergeHooks(data);
  2349. // return a placeholder vnode
  2350. var name = Ctor.options.name || tag;
  2351. var vnode = new VNode(
  2352. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  2353. data, undefined, undefined, undefined, undefined, context,
  2354. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  2355. );
  2356. return vnode
  2357. }
  2358. function createFunctionalComponent (
  2359. Ctor,
  2360. propsData,
  2361. data,
  2362. context,
  2363. children
  2364. ) {
  2365. var props = {};
  2366. var propOptions = Ctor.options.props;
  2367. if (propOptions) {
  2368. for (var key in propOptions) {
  2369. props[key] = validateProp(key, propOptions, propsData);
  2370. }
  2371. }
  2372. var vnode = Ctor.options.render.call(
  2373. null,
  2374. // ensure the createElement function in functional components
  2375. // gets a unique context - this is necessary for correct named slot check
  2376. bind$1(createElement, { _self: Object.create(context) }),
  2377. {
  2378. props: props,
  2379. data: data,
  2380. parent: context,
  2381. children: normalizeChildren(children),
  2382. slots: function () { return resolveSlots(children, context); }
  2383. }
  2384. );
  2385. if (vnode instanceof VNode) {
  2386. vnode.functionalContext = context;
  2387. if (data.slot) {
  2388. (vnode.data || (vnode.data = {})).slot = data.slot;
  2389. }
  2390. }
  2391. return vnode
  2392. }
  2393. function createComponentInstanceForVnode (
  2394. vnode, // we know it's MountedComponentVNode but flow doesn't
  2395. parent, // activeInstance in lifecycle state
  2396. parentElm,
  2397. refElm
  2398. ) {
  2399. var vnodeComponentOptions = vnode.componentOptions;
  2400. var options = {
  2401. _isComponent: true,
  2402. parent: parent,
  2403. propsData: vnodeComponentOptions.propsData,
  2404. _componentTag: vnodeComponentOptions.tag,
  2405. _parentVnode: vnode,
  2406. _parentListeners: vnodeComponentOptions.listeners,
  2407. _renderChildren: vnodeComponentOptions.children,
  2408. _parentElm: parentElm || null,
  2409. _refElm: refElm || null
  2410. };
  2411. // check inline-template render functions
  2412. var inlineTemplate = vnode.data.inlineTemplate;
  2413. if (inlineTemplate) {
  2414. options.render = inlineTemplate.render;
  2415. options.staticRenderFns = inlineTemplate.staticRenderFns;
  2416. }
  2417. return new vnodeComponentOptions.Ctor(options)
  2418. }
  2419. function init (
  2420. vnode,
  2421. hydrating,
  2422. parentElm,
  2423. refElm
  2424. ) {
  2425. if (!vnode.child || vnode.child._isDestroyed) {
  2426. var child = vnode.child = createComponentInstanceForVnode(
  2427. vnode,
  2428. activeInstance,
  2429. parentElm,
  2430. refElm
  2431. );
  2432. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  2433. } else if (vnode.data.keepAlive) {
  2434. // kept-alive components, treat as a patch
  2435. var mountedNode = vnode; // work around flow
  2436. prepatch(mountedNode, mountedNode);
  2437. }
  2438. }
  2439. function prepatch (
  2440. oldVnode,
  2441. vnode
  2442. ) {
  2443. var options = vnode.componentOptions;
  2444. var child = vnode.child = oldVnode.child;
  2445. child._updateFromParent(
  2446. options.propsData, // updated props
  2447. options.listeners, // updated listeners
  2448. vnode, // new parent vnode
  2449. options.children // new children
  2450. );
  2451. }
  2452. function insert (vnode) {
  2453. if (!vnode.child._isMounted) {
  2454. vnode.child._isMounted = true;
  2455. callHook(vnode.child, 'mounted');
  2456. }
  2457. if (vnode.data.keepAlive) {
  2458. vnode.child._inactive = false;
  2459. callHook(vnode.child, 'activated');
  2460. }
  2461. }
  2462. function destroy$1 (vnode) {
  2463. if (!vnode.child._isDestroyed) {
  2464. if (!vnode.data.keepAlive) {
  2465. vnode.child.$destroy();
  2466. } else {
  2467. vnode.child._inactive = true;
  2468. callHook(vnode.child, 'deactivated');
  2469. }
  2470. }
  2471. }
  2472. function resolveAsyncComponent (
  2473. factory,
  2474. baseCtor,
  2475. cb
  2476. ) {
  2477. if (factory.requested) {
  2478. // pool callbacks
  2479. factory.pendingCallbacks.push(cb);
  2480. } else {
  2481. factory.requested = true;
  2482. var cbs = factory.pendingCallbacks = [cb];
  2483. var sync = true;
  2484. var resolve = function (res) {
  2485. if (isObject(res)) {
  2486. res = baseCtor.extend(res);
  2487. }
  2488. // cache resolved
  2489. factory.resolved = res;
  2490. // invoke callbacks only if this is not a synchronous resolve
  2491. // (async resolves are shimmed as synchronous during SSR)
  2492. if (!sync) {
  2493. for (var i = 0, l = cbs.length; i < l; i++) {
  2494. cbs[i](res);
  2495. }
  2496. }
  2497. };
  2498. var reject = function (reason) {
  2499. "development" !== 'production' && warn(
  2500. "Failed to resolve async component: " + (String(factory)) +
  2501. (reason ? ("\nReason: " + reason) : '')
  2502. );
  2503. };
  2504. var res = factory(resolve, reject);
  2505. // handle promise
  2506. if (res && typeof res.then === 'function' && !factory.resolved) {
  2507. res.then(resolve, reject);
  2508. }
  2509. sync = false;
  2510. // return in case resolved synchronously
  2511. return factory.resolved
  2512. }
  2513. }
  2514. function extractProps (data, Ctor) {
  2515. // we are only extracting raw values here.
  2516. // validation and default values are handled in the child
  2517. // component itself.
  2518. var propOptions = Ctor.options.props;
  2519. if (!propOptions) {
  2520. return
  2521. }
  2522. var res = {};
  2523. var attrs = data.attrs;
  2524. var props = data.props;
  2525. var domProps = data.domProps;
  2526. if (attrs || props || domProps) {
  2527. for (var key in propOptions) {
  2528. var altKey = hyphenate(key);
  2529. checkProp(res, props, key, altKey, true) ||
  2530. checkProp(res, attrs, key, altKey) ||
  2531. checkProp(res, domProps, key, altKey);
  2532. }
  2533. }
  2534. return res
  2535. }
  2536. function checkProp (
  2537. res,
  2538. hash,
  2539. key,
  2540. altKey,
  2541. preserve
  2542. ) {
  2543. if (hash) {
  2544. if (hasOwn(hash, key)) {
  2545. res[key] = hash[key];
  2546. if (!preserve) {
  2547. delete hash[key];
  2548. }
  2549. return true
  2550. } else if (hasOwn(hash, altKey)) {
  2551. res[key] = hash[altKey];
  2552. if (!preserve) {
  2553. delete hash[altKey];
  2554. }
  2555. return true
  2556. }
  2557. }
  2558. return false
  2559. }
  2560. function mergeHooks (data) {
  2561. if (!data.hook) {
  2562. data.hook = {};
  2563. }
  2564. for (var i = 0; i < hooksToMerge.length; i++) {
  2565. var key = hooksToMerge[i];
  2566. var fromParent = data.hook[key];
  2567. var ours = hooks[key];
  2568. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  2569. }
  2570. }
  2571. function mergeHook$1 (one, two) {
  2572. return function (a, b, c, d) {
  2573. one(a, b, c, d);
  2574. two(a, b, c, d);
  2575. }
  2576. }
  2577. /* */
  2578. // wrapper function for providing a more flexible interface
  2579. // without getting yelled at by flow
  2580. function createElement (
  2581. tag,
  2582. data,
  2583. children
  2584. ) {
  2585. if (data && (Array.isArray(data) || typeof data !== 'object')) {
  2586. children = data;
  2587. data = undefined;
  2588. }
  2589. // make sure to use real instance instead of proxy as context
  2590. return _createElement(this._self, tag, data, children)
  2591. }
  2592. function _createElement (
  2593. context,
  2594. tag,
  2595. data,
  2596. children
  2597. ) {
  2598. if (data && data.__ob__) {
  2599. "development" !== 'production' && warn(
  2600. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  2601. 'Always create fresh vnode data objects in each render!',
  2602. context
  2603. );
  2604. return
  2605. }
  2606. if (!tag) {
  2607. // in case of component :is set to falsy value
  2608. return emptyVNode()
  2609. }
  2610. // support single function children as default scoped slot
  2611. if (Array.isArray(children) &&
  2612. typeof children[0] === 'function') {
  2613. data = data || {};
  2614. data.scopedSlots = { default: children[0] };
  2615. children.length = 0;
  2616. }
  2617. if (typeof tag === 'string') {
  2618. var Ctor;
  2619. var ns = config.getTagNamespace(tag);
  2620. if (config.isReservedTag(tag)) {
  2621. // platform built-in elements
  2622. return new VNode(
  2623. tag, data, normalizeChildren(children, ns),
  2624. undefined, undefined, ns, context
  2625. )
  2626. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  2627. // component
  2628. return createComponent(Ctor, data, context, children, tag)
  2629. } else {
  2630. // unknown or unlisted namespaced elements
  2631. // check at runtime because it may get assigned a namespace when its
  2632. // parent normalizes children
  2633. var childNs = tag === 'foreignObject' ? 'xhtml' : ns;
  2634. return new VNode(
  2635. tag, data, normalizeChildren(children, childNs),
  2636. undefined, undefined, ns, context
  2637. )
  2638. }
  2639. } else {
  2640. // direct component options / constructor
  2641. return createComponent(tag, data, context, children)
  2642. }
  2643. }
  2644. /* */
  2645. function initRender (vm) {
  2646. vm.$vnode = null; // the placeholder node in parent tree
  2647. vm._vnode = null; // the root of the child tree
  2648. vm._staticTrees = null;
  2649. var parentVnode = vm.$options._parentVnode;
  2650. var renderContext = parentVnode && parentVnode.context;
  2651. vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
  2652. vm.$scopedSlots = {};
  2653. // bind the public createElement fn to this instance
  2654. // so that we get proper render context inside it.
  2655. vm.$createElement = bind$1(createElement, vm);
  2656. if (vm.$options.el) {
  2657. vm.$mount(vm.$options.el);
  2658. }
  2659. }
  2660. function renderMixin (Vue) {
  2661. Vue.prototype.$nextTick = function (fn) {
  2662. return nextTick(fn, this)
  2663. };
  2664. Vue.prototype._render = function () {
  2665. var vm = this;
  2666. var ref = vm.$options;
  2667. var render = ref.render;
  2668. var staticRenderFns = ref.staticRenderFns;
  2669. var _parentVnode = ref._parentVnode;
  2670. if (vm._isMounted) {
  2671. // clone slot nodes on re-renders
  2672. for (var key in vm.$slots) {
  2673. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  2674. }
  2675. }
  2676. if (_parentVnode && _parentVnode.data.scopedSlots) {
  2677. vm.$scopedSlots = _parentVnode.data.scopedSlots;
  2678. }
  2679. if (staticRenderFns && !vm._staticTrees) {
  2680. vm._staticTrees = [];
  2681. }
  2682. // set parent vnode. this allows render functions to have access
  2683. // to the data on the placeholder node.
  2684. vm.$vnode = _parentVnode;
  2685. // render self
  2686. var vnode;
  2687. try {
  2688. vnode = render.call(vm._renderProxy, vm.$createElement);
  2689. } catch (e) {
  2690. /* istanbul ignore else */
  2691. if (config.errorHandler) {
  2692. config.errorHandler.call(null, e, vm);
  2693. } else {
  2694. {
  2695. warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
  2696. }
  2697. throw e
  2698. }
  2699. // return previous vnode to prevent render error causing blank component
  2700. vnode = vm._vnode;
  2701. }
  2702. // return empty vnode in case the render function errored out
  2703. if (!(vnode instanceof VNode)) {
  2704. if ("development" !== 'production' && Array.isArray(vnode)) {
  2705. warn(
  2706. 'Multiple root nodes returned from render function. Render function ' +
  2707. 'should return a single root node.',
  2708. vm
  2709. );
  2710. }
  2711. vnode = emptyVNode();
  2712. }
  2713. // set parent
  2714. vnode.parent = _parentVnode;
  2715. return vnode
  2716. };
  2717. // shorthands used in render functions
  2718. Vue.prototype._h = createElement;
  2719. // toString for mustaches
  2720. Vue.prototype._s = _toString;
  2721. // number conversion
  2722. Vue.prototype._n = toNumber;
  2723. // empty vnode
  2724. Vue.prototype._e = emptyVNode;
  2725. // loose equal
  2726. Vue.prototype._q = looseEqual;
  2727. // loose indexOf
  2728. Vue.prototype._i = looseIndexOf;
  2729. // render static tree by index
  2730. Vue.prototype._m = function renderStatic (
  2731. index,
  2732. isInFor
  2733. ) {
  2734. var tree = this._staticTrees[index];
  2735. // if has already-rendered static tree and not inside v-for,
  2736. // we can reuse the same tree by doing a shallow clone.
  2737. if (tree && !isInFor) {
  2738. return Array.isArray(tree)
  2739. ? cloneVNodes(tree)
  2740. : cloneVNode(tree)
  2741. }
  2742. // otherwise, render a fresh tree.
  2743. tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
  2744. markStatic(tree, ("__static__" + index), false);
  2745. return tree
  2746. };
  2747. // mark node as static (v-once)
  2748. Vue.prototype._o = function markOnce (
  2749. tree,
  2750. index,
  2751. key
  2752. ) {
  2753. markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
  2754. return tree
  2755. };
  2756. function markStatic (tree, key, isOnce) {
  2757. if (Array.isArray(tree)) {
  2758. for (var i = 0; i < tree.length; i++) {
  2759. if (tree[i] && typeof tree[i] !== 'string') {
  2760. markStaticNode(tree[i], (key + "_" + i), isOnce);
  2761. }
  2762. }
  2763. } else {
  2764. markStaticNode(tree, key, isOnce);
  2765. }
  2766. }
  2767. function markStaticNode (node, key, isOnce) {
  2768. node.isStatic = true;
  2769. node.key = key;
  2770. node.isOnce = isOnce;
  2771. }
  2772. // filter resolution helper
  2773. var identity = function (_) { return _; };
  2774. Vue.prototype._f = function resolveFilter (id) {
  2775. return resolveAsset(this.$options, 'filters', id, true) || identity
  2776. };
  2777. // render v-for
  2778. Vue.prototype._l = function renderList (
  2779. val,
  2780. render
  2781. ) {
  2782. var ret, i, l, keys, key;
  2783. if (Array.isArray(val)) {
  2784. ret = new Array(val.length);
  2785. for (i = 0, l = val.length; i < l; i++) {
  2786. ret[i] = render(val[i], i);
  2787. }
  2788. } else if (typeof val === 'number') {
  2789. ret = new Array(val);
  2790. for (i = 0; i < val; i++) {
  2791. ret[i] = render(i + 1, i);
  2792. }
  2793. } else if (isObject(val)) {
  2794. keys = Object.keys(val);
  2795. ret = new Array(keys.length);
  2796. for (i = 0, l = keys.length; i < l; i++) {
  2797. key = keys[i];
  2798. ret[i] = render(val[key], key, i);
  2799. }
  2800. }
  2801. return ret
  2802. };
  2803. // renderSlot
  2804. Vue.prototype._t = function (
  2805. name,
  2806. fallback,
  2807. props
  2808. ) {
  2809. var scopedSlotFn = this.$scopedSlots[name];
  2810. if (scopedSlotFn) { // scoped slot
  2811. return scopedSlotFn(props || {}) || fallback
  2812. } else {
  2813. var slotNodes = this.$slots[name];
  2814. // warn duplicate slot usage
  2815. if (slotNodes && "development" !== 'production') {
  2816. slotNodes._rendered && warn(
  2817. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  2818. "- this will likely cause render errors.",
  2819. this
  2820. );
  2821. slotNodes._rendered = true;
  2822. }
  2823. return slotNodes || fallback
  2824. }
  2825. };
  2826. // apply v-bind object
  2827. Vue.prototype._b = function bindProps (
  2828. data,
  2829. tag,
  2830. value,
  2831. asProp
  2832. ) {
  2833. if (value) {
  2834. if (!isObject(value)) {
  2835. "development" !== 'production' && warn(
  2836. 'v-bind without argument expects an Object or Array value',
  2837. this
  2838. );
  2839. } else {
  2840. if (Array.isArray(value)) {
  2841. value = toObject(value);
  2842. }
  2843. for (var key in value) {
  2844. if (key === 'class' || key === 'style') {
  2845. data[key] = value[key];
  2846. } else {
  2847. var hash = asProp || config.mustUseProp(tag, key)
  2848. ? data.domProps || (data.domProps = {})
  2849. : data.attrs || (data.attrs = {});
  2850. hash[key] = value[key];
  2851. }
  2852. }
  2853. }
  2854. }
  2855. return data
  2856. };
  2857. // check v-on keyCodes
  2858. Vue.prototype._k = function checkKeyCodes (
  2859. eventKeyCode,
  2860. key,
  2861. builtInAlias
  2862. ) {
  2863. var keyCodes = config.keyCodes[key] || builtInAlias;
  2864. if (Array.isArray(keyCodes)) {
  2865. return keyCodes.indexOf(eventKeyCode) === -1
  2866. } else {
  2867. return keyCodes !== eventKeyCode
  2868. }
  2869. };
  2870. }
  2871. function resolveSlots (
  2872. renderChildren,
  2873. context
  2874. ) {
  2875. var slots = {};
  2876. if (!renderChildren) {
  2877. return slots
  2878. }
  2879. var children = normalizeChildren(renderChildren) || [];
  2880. var defaultSlot = [];
  2881. var name, child;
  2882. for (var i = 0, l = children.length; i < l; i++) {
  2883. child = children[i];
  2884. // named slots should only be respected if the vnode was rendered in the
  2885. // same context.
  2886. if ((child.context === context || child.functionalContext === context) &&
  2887. child.data && (name = child.data.slot)) {
  2888. var slot = (slots[name] || (slots[name] = []));
  2889. if (child.tag === 'template') {
  2890. slot.push.apply(slot, child.children);
  2891. } else {
  2892. slot.push(child);
  2893. }
  2894. } else {
  2895. defaultSlot.push(child);
  2896. }
  2897. }
  2898. // ignore single whitespace
  2899. if (defaultSlot.length && !(
  2900. defaultSlot.length === 1 &&
  2901. (defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
  2902. )) {
  2903. slots.default = defaultSlot;
  2904. }
  2905. return slots
  2906. }
  2907. /* */
  2908. function initEvents (vm) {
  2909. vm._events = Object.create(null);
  2910. // init parent attached events
  2911. var listeners = vm.$options._parentListeners;
  2912. var add = function (event, fn, once) {
  2913. once ? vm.$once(event, fn) : vm.$on(event, fn);
  2914. };
  2915. var remove$$1 = bind$1(vm.$off, vm);
  2916. vm._updateListeners = function (listeners, oldListeners) {
  2917. updateListeners(listeners, oldListeners || {}, add, remove$$1, vm);
  2918. };
  2919. if (listeners) {
  2920. vm._updateListeners(listeners);
  2921. }
  2922. }
  2923. function eventsMixin (Vue) {
  2924. Vue.prototype.$on = function (event, fn) {
  2925. var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn);
  2926. return vm
  2927. };
  2928. Vue.prototype.$once = function (event, fn) {
  2929. var vm = this;
  2930. function on () {
  2931. vm.$off(event, on);
  2932. fn.apply(vm, arguments);
  2933. }
  2934. on.fn = fn;
  2935. vm.$on(event, on);
  2936. return vm
  2937. };
  2938. Vue.prototype.$off = function (event, fn) {
  2939. var vm = this;
  2940. // all
  2941. if (!arguments.length) {
  2942. vm._events = Object.create(null);
  2943. return vm
  2944. }
  2945. // specific event
  2946. var cbs = vm._events[event];
  2947. if (!cbs) {
  2948. return vm
  2949. }
  2950. if (arguments.length === 1) {
  2951. vm._events[event] = null;
  2952. return vm
  2953. }
  2954. // specific handler
  2955. var cb;
  2956. var i = cbs.length;
  2957. while (i--) {
  2958. cb = cbs[i];
  2959. if (cb === fn || cb.fn === fn) {
  2960. cbs.splice(i, 1);
  2961. break
  2962. }
  2963. }
  2964. return vm
  2965. };
  2966. Vue.prototype.$emit = function (event) {
  2967. var vm = this;
  2968. var cbs = vm._events[event];
  2969. if (cbs) {
  2970. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  2971. var args = toArray(arguments, 1);
  2972. for (var i = 0, l = cbs.length; i < l; i++) {
  2973. cbs[i].apply(vm, args);
  2974. }
  2975. }
  2976. return vm
  2977. };
  2978. }
  2979. /* */
  2980. var uid = 0;
  2981. function initMixin (Vue) {
  2982. Vue.prototype._init = function (options) {
  2983. var vm = this;
  2984. // a uid
  2985. vm._uid = uid++;
  2986. // a flag to avoid this being observed
  2987. vm._isVue = true;
  2988. // merge options
  2989. if (options && options._isComponent) {
  2990. // optimize internal component instantiation
  2991. // since dynamic options merging is pretty slow, and none of the
  2992. // internal component options needs special treatment.
  2993. initInternalComponent(vm, options);
  2994. } else {
  2995. vm.$options = mergeOptions(
  2996. resolveConstructorOptions(vm.constructor),
  2997. options || {},
  2998. vm
  2999. );
  3000. }
  3001. /* istanbul ignore else */
  3002. {
  3003. initProxy(vm);
  3004. }
  3005. // expose real self
  3006. vm._self = vm;
  3007. initLifecycle(vm);
  3008. initEvents(vm);
  3009. callHook(vm, 'beforeCreate');
  3010. initState(vm);
  3011. callHook(vm, 'created');
  3012. initRender(vm);
  3013. };
  3014. }
  3015. function initInternalComponent (vm, options) {
  3016. var opts = vm.$options = Object.create(vm.constructor.options);
  3017. // doing this because it's faster than dynamic enumeration.
  3018. opts.parent = options.parent;
  3019. opts.propsData = options.propsData;
  3020. opts._parentVnode = options._parentVnode;
  3021. opts._parentListeners = options._parentListeners;
  3022. opts._renderChildren = options._renderChildren;
  3023. opts._componentTag = options._componentTag;
  3024. opts._parentElm = options._parentElm;
  3025. opts._refElm = options._refElm;
  3026. if (options.render) {
  3027. opts.render = options.render;
  3028. opts.staticRenderFns = options.staticRenderFns;
  3029. }
  3030. }
  3031. function resolveConstructorOptions (Ctor) {
  3032. var options = Ctor.options;
  3033. if (Ctor.super) {
  3034. var superOptions = Ctor.super.options;
  3035. var cachedSuperOptions = Ctor.superOptions;
  3036. var extendOptions = Ctor.extendOptions;
  3037. if (superOptions !== cachedSuperOptions) {
  3038. // super option changed
  3039. Ctor.superOptions = superOptions;
  3040. extendOptions.render = options.render;
  3041. extendOptions.staticRenderFns = options.staticRenderFns;
  3042. extendOptions._scopeId = options._scopeId;
  3043. options = Ctor.options = mergeOptions(superOptions, extendOptions);
  3044. if (options.name) {
  3045. options.components[options.name] = Ctor;
  3046. }
  3047. }
  3048. }
  3049. return options
  3050. }
  3051. function Vue$3 (options) {
  3052. if ("development" !== 'production' &&
  3053. !(this instanceof Vue$3)) {
  3054. warn('Vue is a constructor and should be called with the `new` keyword');
  3055. }
  3056. this._init(options);
  3057. }
  3058. initMixin(Vue$3);
  3059. stateMixin(Vue$3);
  3060. eventsMixin(Vue$3);
  3061. lifecycleMixin(Vue$3);
  3062. renderMixin(Vue$3);
  3063. /* */
  3064. function initUse (Vue) {
  3065. Vue.use = function (plugin) {
  3066. /* istanbul ignore if */
  3067. if (plugin.installed) {
  3068. return
  3069. }
  3070. // additional parameters
  3071. var args = toArray(arguments, 1);
  3072. args.unshift(this);
  3073. if (typeof plugin.install === 'function') {
  3074. plugin.install.apply(plugin, args);
  3075. } else {
  3076. plugin.apply(null, args);
  3077. }
  3078. plugin.installed = true;
  3079. return this
  3080. };
  3081. }
  3082. /* */
  3083. function initMixin$1 (Vue) {
  3084. Vue.mixin = function (mixin) {
  3085. this.options = mergeOptions(this.options, mixin);
  3086. };
  3087. }
  3088. /* */
  3089. function initExtend (Vue) {
  3090. /**
  3091. * Each instance constructor, including Vue, has a unique
  3092. * cid. This enables us to create wrapped "child
  3093. * constructors" for prototypal inheritance and cache them.
  3094. */
  3095. Vue.cid = 0;
  3096. var cid = 1;
  3097. /**
  3098. * Class inheritance
  3099. */
  3100. Vue.extend = function (extendOptions) {
  3101. extendOptions = extendOptions || {};
  3102. var Super = this;
  3103. var SuperId = Super.cid;
  3104. var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
  3105. if (cachedCtors[SuperId]) {
  3106. return cachedCtors[SuperId]
  3107. }
  3108. var name = extendOptions.name || Super.options.name;
  3109. {
  3110. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  3111. warn(
  3112. 'Invalid component name: "' + name + '". Component names ' +
  3113. 'can only contain alphanumeric characaters and the hyphen.'
  3114. );
  3115. }
  3116. }
  3117. var Sub = function VueComponent (options) {
  3118. this._init(options);
  3119. };
  3120. Sub.prototype = Object.create(Super.prototype);
  3121. Sub.prototype.constructor = Sub;
  3122. Sub.cid = cid++;
  3123. Sub.options = mergeOptions(
  3124. Super.options,
  3125. extendOptions
  3126. );
  3127. Sub['super'] = Super;
  3128. // allow further extension/mixin/plugin usage
  3129. Sub.extend = Super.extend;
  3130. Sub.mixin = Super.mixin;
  3131. Sub.use = Super.use;
  3132. // create asset registers, so extended classes
  3133. // can have their private assets too.
  3134. config._assetTypes.forEach(function (type) {
  3135. Sub[type] = Super[type];
  3136. });
  3137. // enable recursive self-lookup
  3138. if (name) {
  3139. Sub.options.components[name] = Sub;
  3140. }
  3141. // keep a reference to the super options at extension time.
  3142. // later at instantiation we can check if Super's options have
  3143. // been updated.
  3144. Sub.superOptions = Super.options;
  3145. Sub.extendOptions = extendOptions;
  3146. // cache constructor
  3147. cachedCtors[SuperId] = Sub;
  3148. return Sub
  3149. };
  3150. }
  3151. /* */
  3152. function initAssetRegisters (Vue) {
  3153. /**
  3154. * Create asset registration methods.
  3155. */
  3156. config._assetTypes.forEach(function (type) {
  3157. Vue[type] = function (
  3158. id,
  3159. definition
  3160. ) {
  3161. if (!definition) {
  3162. return this.options[type + 's'][id]
  3163. } else {
  3164. /* istanbul ignore if */
  3165. {
  3166. if (type === 'component' && config.isReservedTag(id)) {
  3167. warn(
  3168. 'Do not use built-in or reserved HTML elements as component ' +
  3169. 'id: ' + id
  3170. );
  3171. }
  3172. }
  3173. if (type === 'component' && isPlainObject(definition)) {
  3174. definition.name = definition.name || id;
  3175. definition = this.options._base.extend(definition);
  3176. }
  3177. if (type === 'directive' && typeof definition === 'function') {
  3178. definition = { bind: definition, update: definition };
  3179. }
  3180. this.options[type + 's'][id] = definition;
  3181. return definition
  3182. }
  3183. };
  3184. });
  3185. }
  3186. /* */
  3187. var patternTypes = [String, RegExp];
  3188. function matches (pattern, name) {
  3189. if (typeof pattern === 'string') {
  3190. return pattern.split(',').indexOf(name) > -1
  3191. } else {
  3192. return pattern.test(name)
  3193. }
  3194. }
  3195. var KeepAlive = {
  3196. name: 'keep-alive',
  3197. abstract: true,
  3198. props: {
  3199. include: patternTypes,
  3200. exclude: patternTypes
  3201. },
  3202. created: function created () {
  3203. this.cache = Object.create(null);
  3204. },
  3205. render: function render () {
  3206. var vnode = getFirstComponentChild(this.$slots.default);
  3207. if (vnode && vnode.componentOptions) {
  3208. var opts = vnode.componentOptions;
  3209. // check pattern
  3210. var name = opts.Ctor.options.name || opts.tag;
  3211. if (name && (
  3212. (this.include && !matches(this.include, name)) ||
  3213. (this.exclude && matches(this.exclude, name))
  3214. )) {
  3215. return vnode
  3216. }
  3217. var key = vnode.key == null
  3218. // same constructor may get registered as different local components
  3219. // so cid alone is not enough (#3269)
  3220. ? opts.Ctor.cid + (opts.tag ? ("::" + (opts.tag)) : '')
  3221. : vnode.key;
  3222. if (this.cache[key]) {
  3223. vnode.child = this.cache[key].child;
  3224. } else {
  3225. this.cache[key] = vnode;
  3226. }
  3227. vnode.data.keepAlive = true;
  3228. }
  3229. return vnode
  3230. },
  3231. destroyed: function destroyed () {
  3232. var this$1 = this;
  3233. for (var key in this.cache) {
  3234. var vnode = this$1.cache[key];
  3235. callHook(vnode.child, 'deactivated');
  3236. vnode.child.$destroy();
  3237. }
  3238. }
  3239. };
  3240. var builtInComponents = {
  3241. KeepAlive: KeepAlive
  3242. };
  3243. /* */
  3244. function initGlobalAPI (Vue) {
  3245. // config
  3246. var configDef = {};
  3247. configDef.get = function () { return config; };
  3248. {
  3249. configDef.set = function () {
  3250. warn(
  3251. 'Do not replace the Vue.config object, set individual fields instead.'
  3252. );
  3253. };
  3254. }
  3255. Object.defineProperty(Vue, 'config', configDef);
  3256. Vue.util = util;
  3257. Vue.set = set$1;
  3258. Vue.delete = del;
  3259. Vue.nextTick = nextTick;
  3260. Vue.options = Object.create(null);
  3261. config._assetTypes.forEach(function (type) {
  3262. Vue.options[type + 's'] = Object.create(null);
  3263. });
  3264. // this is used to identify the "base" constructor to extend all plain-object
  3265. // components with in Weex's multi-instance scenarios.
  3266. Vue.options._base = Vue;
  3267. extend(Vue.options.components, builtInComponents);
  3268. initUse(Vue);
  3269. initMixin$1(Vue);
  3270. initExtend(Vue);
  3271. initAssetRegisters(Vue);
  3272. }
  3273. initGlobalAPI(Vue$3);
  3274. Object.defineProperty(Vue$3.prototype, '$isServer', {
  3275. get: isServerRendering
  3276. });
  3277. Vue$3.version = '2.1.4';
  3278. /* */
  3279. // attributes that should be using props for binding
  3280. var mustUseProp = function (tag, attr) {
  3281. return (
  3282. (attr === 'value' && (tag === 'input' || tag === 'textarea' || tag === 'option')) ||
  3283. (attr === 'selected' && tag === 'option') ||
  3284. (attr === 'checked' && tag === 'input') ||
  3285. (attr === 'muted' && tag === 'video')
  3286. )
  3287. };
  3288. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  3289. var isBooleanAttr = makeMap(
  3290. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  3291. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  3292. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  3293. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  3294. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  3295. 'truespeed,typemustmatch,visible'
  3296. );
  3297. var xlinkNS = 'http://www.w3.org/1999/xlink';
  3298. var isXlink = function (name) {
  3299. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  3300. };
  3301. var getXlinkProp = function (name) {
  3302. return isXlink(name) ? name.slice(6, name.length) : ''
  3303. };
  3304. var isFalsyAttrValue = function (val) {
  3305. return val == null || val === false
  3306. };
  3307. /* */
  3308. function genClassForVnode (vnode) {
  3309. var data = vnode.data;
  3310. var parentNode = vnode;
  3311. var childNode = vnode;
  3312. while (childNode.child) {
  3313. childNode = childNode.child._vnode;
  3314. if (childNode.data) {
  3315. data = mergeClassData(childNode.data, data);
  3316. }
  3317. }
  3318. while ((parentNode = parentNode.parent)) {
  3319. if (parentNode.data) {
  3320. data = mergeClassData(data, parentNode.data);
  3321. }
  3322. }
  3323. return genClassFromData(data)
  3324. }
  3325. function mergeClassData (child, parent) {
  3326. return {
  3327. staticClass: concat(child.staticClass, parent.staticClass),
  3328. class: child.class
  3329. ? [child.class, parent.class]
  3330. : parent.class
  3331. }
  3332. }
  3333. function genClassFromData (data) {
  3334. var dynamicClass = data.class;
  3335. var staticClass = data.staticClass;
  3336. if (staticClass || dynamicClass) {
  3337. return concat(staticClass, stringifyClass(dynamicClass))
  3338. }
  3339. /* istanbul ignore next */
  3340. return ''
  3341. }
  3342. function concat (a, b) {
  3343. return a ? b ? (a + ' ' + b) : a : (b || '')
  3344. }
  3345. function stringifyClass (value) {
  3346. var res = '';
  3347. if (!value) {
  3348. return res
  3349. }
  3350. if (typeof value === 'string') {
  3351. return value
  3352. }
  3353. if (Array.isArray(value)) {
  3354. var stringified;
  3355. for (var i = 0, l = value.length; i < l; i++) {
  3356. if (value[i]) {
  3357. if ((stringified = stringifyClass(value[i]))) {
  3358. res += stringified + ' ';
  3359. }
  3360. }
  3361. }
  3362. return res.slice(0, -1)
  3363. }
  3364. if (isObject(value)) {
  3365. for (var key in value) {
  3366. if (value[key]) { res += key + ' '; }
  3367. }
  3368. return res.slice(0, -1)
  3369. }
  3370. /* istanbul ignore next */
  3371. return res
  3372. }
  3373. /* */
  3374. var namespaceMap = {
  3375. svg: 'http://www.w3.org/2000/svg',
  3376. math: 'http://www.w3.org/1998/Math/MathML',
  3377. xhtml: 'http://www.w3.org/1999/xhtml'
  3378. };
  3379. var isHTMLTag = makeMap(
  3380. 'html,body,base,head,link,meta,style,title,' +
  3381. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  3382. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  3383. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  3384. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  3385. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  3386. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  3387. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  3388. 'output,progress,select,textarea,' +
  3389. 'details,dialog,menu,menuitem,summary,' +
  3390. 'content,element,shadow,template'
  3391. );
  3392. // this map is intentionally selective, only covering SVG elements that may
  3393. // contain child elements.
  3394. var isSVG = makeMap(
  3395. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font,' +
  3396. 'font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  3397. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  3398. true
  3399. );
  3400. var isPreTag = function (tag) { return tag === 'pre'; };
  3401. var isReservedTag = function (tag) {
  3402. return isHTMLTag(tag) || isSVG(tag)
  3403. };
  3404. function getTagNamespace (tag) {
  3405. if (isSVG(tag)) {
  3406. return 'svg'
  3407. }
  3408. // basic support for MathML
  3409. // note it doesn't support other MathML elements being component roots
  3410. if (tag === 'math') {
  3411. return 'math'
  3412. }
  3413. }
  3414. var unknownElementCache = Object.create(null);
  3415. function isUnknownElement (tag) {
  3416. /* istanbul ignore if */
  3417. if (!inBrowser) {
  3418. return true
  3419. }
  3420. if (isReservedTag(tag)) {
  3421. return false
  3422. }
  3423. tag = tag.toLowerCase();
  3424. /* istanbul ignore if */
  3425. if (unknownElementCache[tag] != null) {
  3426. return unknownElementCache[tag]
  3427. }
  3428. var el = document.createElement(tag);
  3429. if (tag.indexOf('-') > -1) {
  3430. // http://stackoverflow.com/a/28210364/1070244
  3431. return (unknownElementCache[tag] = (
  3432. el.constructor === window.HTMLUnknownElement ||
  3433. el.constructor === window.HTMLElement
  3434. ))
  3435. } else {
  3436. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  3437. }
  3438. }
  3439. /* */
  3440. /**
  3441. * Query an element selector if it's not an element already.
  3442. */
  3443. function query (el) {
  3444. if (typeof el === 'string') {
  3445. var selector = el;
  3446. el = document.querySelector(el);
  3447. if (!el) {
  3448. "development" !== 'production' && warn(
  3449. 'Cannot find element: ' + selector
  3450. );
  3451. return document.createElement('div')
  3452. }
  3453. }
  3454. return el
  3455. }
  3456. /* */
  3457. function createElement$1 (tagName, vnode) {
  3458. var elm = document.createElement(tagName);
  3459. if (tagName !== 'select') {
  3460. return elm
  3461. }
  3462. if (vnode.data && vnode.data.attrs && 'multiple' in vnode.data.attrs) {
  3463. elm.setAttribute('multiple', 'multiple');
  3464. }
  3465. return elm
  3466. }
  3467. function createElementNS (namespace, tagName) {
  3468. return document.createElementNS(namespaceMap[namespace], tagName)
  3469. }
  3470. function createTextNode (text) {
  3471. return document.createTextNode(text)
  3472. }
  3473. function createComment (text) {
  3474. return document.createComment(text)
  3475. }
  3476. function insertBefore (parentNode, newNode, referenceNode) {
  3477. parentNode.insertBefore(newNode, referenceNode);
  3478. }
  3479. function removeChild (node, child) {
  3480. node.removeChild(child);
  3481. }
  3482. function appendChild (node, child) {
  3483. node.appendChild(child);
  3484. }
  3485. function parentNode (node) {
  3486. return node.parentNode
  3487. }
  3488. function nextSibling (node) {
  3489. return node.nextSibling
  3490. }
  3491. function tagName (node) {
  3492. return node.tagName
  3493. }
  3494. function setTextContent (node, text) {
  3495. node.textContent = text;
  3496. }
  3497. function childNodes (node) {
  3498. return node.childNodes
  3499. }
  3500. function setAttribute (node, key, val) {
  3501. node.setAttribute(key, val);
  3502. }
  3503. var nodeOps = Object.freeze({
  3504. createElement: createElement$1,
  3505. createElementNS: createElementNS,
  3506. createTextNode: createTextNode,
  3507. createComment: createComment,
  3508. insertBefore: insertBefore,
  3509. removeChild: removeChild,
  3510. appendChild: appendChild,
  3511. parentNode: parentNode,
  3512. nextSibling: nextSibling,
  3513. tagName: tagName,
  3514. setTextContent: setTextContent,
  3515. childNodes: childNodes,
  3516. setAttribute: setAttribute
  3517. });
  3518. /* */
  3519. var ref = {
  3520. create: function create (_, vnode) {
  3521. registerRef(vnode);
  3522. },
  3523. update: function update (oldVnode, vnode) {
  3524. if (oldVnode.data.ref !== vnode.data.ref) {
  3525. registerRef(oldVnode, true);
  3526. registerRef(vnode);
  3527. }
  3528. },
  3529. destroy: function destroy (vnode) {
  3530. registerRef(vnode, true);
  3531. }
  3532. };
  3533. function registerRef (vnode, isRemoval) {
  3534. var key = vnode.data.ref;
  3535. if (!key) { return }
  3536. var vm = vnode.context;
  3537. var ref = vnode.child || vnode.elm;
  3538. var refs = vm.$refs;
  3539. if (isRemoval) {
  3540. if (Array.isArray(refs[key])) {
  3541. remove$1(refs[key], ref);
  3542. } else if (refs[key] === ref) {
  3543. refs[key] = undefined;
  3544. }
  3545. } else {
  3546. if (vnode.data.refInFor) {
  3547. if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
  3548. refs[key].push(ref);
  3549. } else {
  3550. refs[key] = [ref];
  3551. }
  3552. } else {
  3553. refs[key] = ref;
  3554. }
  3555. }
  3556. }
  3557. /**
  3558. * Virtual DOM patching algorithm based on Snabbdom by
  3559. * Simon Friis Vindum (@paldepind)
  3560. * Licensed under the MIT License
  3561. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  3562. *
  3563. * modified by Evan You (@yyx990803)
  3564. *
  3565. /*
  3566. * Not type-checking this because this file is perf-critical and the cost
  3567. * of making flow understand it is not worth it.
  3568. */
  3569. var emptyNode = new VNode('', {}, []);
  3570. var hooks$1 = ['create', 'activate', 'update', 'remove', 'destroy'];
  3571. function isUndef (s) {
  3572. return s == null
  3573. }
  3574. function isDef (s) {
  3575. return s != null
  3576. }
  3577. function sameVnode (vnode1, vnode2) {
  3578. return (
  3579. vnode1.key === vnode2.key &&
  3580. vnode1.tag === vnode2.tag &&
  3581. vnode1.isComment === vnode2.isComment &&
  3582. !vnode1.data === !vnode2.data
  3583. )
  3584. }
  3585. function createKeyToOldIdx (children, beginIdx, endIdx) {
  3586. var i, key;
  3587. var map = {};
  3588. for (i = beginIdx; i <= endIdx; ++i) {
  3589. key = children[i].key;
  3590. if (isDef(key)) { map[key] = i; }
  3591. }
  3592. return map
  3593. }
  3594. function createPatchFunction (backend) {
  3595. var i, j;
  3596. var cbs = {};
  3597. var modules = backend.modules;
  3598. var nodeOps = backend.nodeOps;
  3599. for (i = 0; i < hooks$1.length; ++i) {
  3600. cbs[hooks$1[i]] = [];
  3601. for (j = 0; j < modules.length; ++j) {
  3602. if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); }
  3603. }
  3604. }
  3605. function emptyNodeAt (elm) {
  3606. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  3607. }
  3608. function createRmCb (childElm, listeners) {
  3609. function remove$$1 () {
  3610. if (--remove$$1.listeners === 0) {
  3611. removeElement(childElm);
  3612. }
  3613. }
  3614. remove$$1.listeners = listeners;
  3615. return remove$$1
  3616. }
  3617. function removeElement (el) {
  3618. var parent = nodeOps.parentNode(el);
  3619. // element may have already been removed due to v-html
  3620. if (parent) {
  3621. nodeOps.removeChild(parent, el);
  3622. }
  3623. }
  3624. var inPre = 0;
  3625. function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
  3626. vnode.isRootInsert = !nested; // for transition enter check
  3627. if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
  3628. return
  3629. }
  3630. var data = vnode.data;
  3631. var children = vnode.children;
  3632. var tag = vnode.tag;
  3633. if (isDef(tag)) {
  3634. {
  3635. if (data && data.pre) {
  3636. inPre++;
  3637. }
  3638. if (
  3639. !inPre &&
  3640. !vnode.ns &&
  3641. !(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
  3642. config.isUnknownElement(tag)
  3643. ) {
  3644. warn(
  3645. 'Unknown custom element: <' + tag + '> - did you ' +
  3646. 'register the component correctly? For recursive components, ' +
  3647. 'make sure to provide the "name" option.',
  3648. vnode.context
  3649. );
  3650. }
  3651. }
  3652. vnode.elm = vnode.ns
  3653. ? nodeOps.createElementNS(vnode.ns, tag)
  3654. : nodeOps.createElement(tag, vnode);
  3655. setScope(vnode);
  3656. /* istanbul ignore if */
  3657. {
  3658. createChildren(vnode, children, insertedVnodeQueue);
  3659. if (isDef(data)) {
  3660. invokeCreateHooks(vnode, insertedVnodeQueue);
  3661. }
  3662. insert(parentElm, vnode.elm, refElm);
  3663. }
  3664. if ("development" !== 'production' && data && data.pre) {
  3665. inPre--;
  3666. }
  3667. } else if (vnode.isComment) {
  3668. vnode.elm = nodeOps.createComment(vnode.text);
  3669. insert(parentElm, vnode.elm, refElm);
  3670. } else {
  3671. vnode.elm = nodeOps.createTextNode(vnode.text);
  3672. insert(parentElm, vnode.elm, refElm);
  3673. }
  3674. }
  3675. function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  3676. var i = vnode.data;
  3677. if (isDef(i)) {
  3678. var isReactivated = isDef(vnode.child) && i.keepAlive;
  3679. if (isDef(i = i.hook) && isDef(i = i.init)) {
  3680. i(vnode, false /* hydrating */, parentElm, refElm);
  3681. }
  3682. // after calling the init hook, if the vnode is a child component
  3683. // it should've created a child instance and mounted it. the child
  3684. // component also has set the placeholder vnode's elm.
  3685. // in that case we can just return the element and be done.
  3686. if (isDef(vnode.child)) {
  3687. initComponent(vnode, insertedVnodeQueue);
  3688. if (isReactivated) {
  3689. reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
  3690. }
  3691. return true
  3692. }
  3693. }
  3694. }
  3695. function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
  3696. var i;
  3697. // hack for #4339: a reactivated component with inner transition
  3698. // does not trigger because the inner node's created hooks are not called
  3699. // again. It's not ideal to involve module-specific logic in here but
  3700. // there doesn't seem to be a better way to do it.
  3701. var innerNode = vnode;
  3702. while (innerNode.child) {
  3703. innerNode = innerNode.child._vnode;
  3704. if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
  3705. for (i = 0; i < cbs.activate.length; ++i) {
  3706. cbs.activate[i](emptyNode, innerNode);
  3707. }
  3708. insertedVnodeQueue.push(innerNode);
  3709. break
  3710. }
  3711. }
  3712. // unlike a newly created component,
  3713. // a reactivated keep-alive component doesn't insert itself
  3714. insert(parentElm, vnode.elm, refElm);
  3715. }
  3716. function insert (parent, elm, ref) {
  3717. if (parent) {
  3718. nodeOps.insertBefore(parent, elm, ref);
  3719. }
  3720. }
  3721. function createChildren (vnode, children, insertedVnodeQueue) {
  3722. if (Array.isArray(children)) {
  3723. for (var i = 0; i < children.length; ++i) {
  3724. createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
  3725. }
  3726. } else if (isPrimitive(vnode.text)) {
  3727. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  3728. }
  3729. }
  3730. function isPatchable (vnode) {
  3731. while (vnode.child) {
  3732. vnode = vnode.child._vnode;
  3733. }
  3734. return isDef(vnode.tag)
  3735. }
  3736. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  3737. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  3738. cbs.create[i$1](emptyNode, vnode);
  3739. }
  3740. i = vnode.data.hook; // Reuse variable
  3741. if (isDef(i)) {
  3742. if (i.create) { i.create(emptyNode, vnode); }
  3743. if (i.insert) { insertedVnodeQueue.push(vnode); }
  3744. }
  3745. }
  3746. function initComponent (vnode, insertedVnodeQueue) {
  3747. if (vnode.data.pendingInsert) {
  3748. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  3749. }
  3750. vnode.elm = vnode.child.$el;
  3751. if (isPatchable(vnode)) {
  3752. invokeCreateHooks(vnode, insertedVnodeQueue);
  3753. setScope(vnode);
  3754. } else {
  3755. // empty component root.
  3756. // skip all element-related modules except for ref (#3455)
  3757. registerRef(vnode);
  3758. // make sure to invoke the insert hook
  3759. insertedVnodeQueue.push(vnode);
  3760. }
  3761. }
  3762. // set scope id attribute for scoped CSS.
  3763. // this is implemented as a special case to avoid the overhead
  3764. // of going through the normal attribute patching process.
  3765. function setScope (vnode) {
  3766. var i;
  3767. if (isDef(i = vnode.context) && isDef(i = i.$options._scopeId)) {
  3768. nodeOps.setAttribute(vnode.elm, i, '');
  3769. }
  3770. if (isDef(i = activeInstance) &&
  3771. i !== vnode.context &&
  3772. isDef(i = i.$options._scopeId)) {
  3773. nodeOps.setAttribute(vnode.elm, i, '');
  3774. }
  3775. }
  3776. function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  3777. for (; startIdx <= endIdx; ++startIdx) {
  3778. createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
  3779. }
  3780. }
  3781. function invokeDestroyHook (vnode) {
  3782. var i, j;
  3783. var data = vnode.data;
  3784. if (isDef(data)) {
  3785. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  3786. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  3787. }
  3788. if (isDef(i = vnode.children)) {
  3789. for (j = 0; j < vnode.children.length; ++j) {
  3790. invokeDestroyHook(vnode.children[j]);
  3791. }
  3792. }
  3793. }
  3794. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  3795. for (; startIdx <= endIdx; ++startIdx) {
  3796. var ch = vnodes[startIdx];
  3797. if (isDef(ch)) {
  3798. if (isDef(ch.tag)) {
  3799. removeAndInvokeRemoveHook(ch);
  3800. invokeDestroyHook(ch);
  3801. } else { // Text node
  3802. nodeOps.removeChild(parentElm, ch.elm);
  3803. }
  3804. }
  3805. }
  3806. }
  3807. function removeAndInvokeRemoveHook (vnode, rm) {
  3808. if (rm || isDef(vnode.data)) {
  3809. var listeners = cbs.remove.length + 1;
  3810. if (!rm) {
  3811. // directly removing
  3812. rm = createRmCb(vnode.elm, listeners);
  3813. } else {
  3814. // we have a recursively passed down rm callback
  3815. // increase the listeners count
  3816. rm.listeners += listeners;
  3817. }
  3818. // recursively invoke hooks on child component root node
  3819. if (isDef(i = vnode.child) && isDef(i = i._vnode) && isDef(i.data)) {
  3820. removeAndInvokeRemoveHook(i, rm);
  3821. }
  3822. for (i = 0; i < cbs.remove.length; ++i) {
  3823. cbs.remove[i](vnode, rm);
  3824. }
  3825. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  3826. i(vnode, rm);
  3827. } else {
  3828. rm();
  3829. }
  3830. } else {
  3831. removeElement(vnode.elm);
  3832. }
  3833. }
  3834. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  3835. var oldStartIdx = 0;
  3836. var newStartIdx = 0;
  3837. var oldEndIdx = oldCh.length - 1;
  3838. var oldStartVnode = oldCh[0];
  3839. var oldEndVnode = oldCh[oldEndIdx];
  3840. var newEndIdx = newCh.length - 1;
  3841. var newStartVnode = newCh[0];
  3842. var newEndVnode = newCh[newEndIdx];
  3843. var oldKeyToIdx, idxInOld, elmToMove, refElm;
  3844. // removeOnly is a special flag used only by <transition-group>
  3845. // to ensure removed elements stay in correct relative positions
  3846. // during leaving transitions
  3847. var canMove = !removeOnly;
  3848. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  3849. if (isUndef(oldStartVnode)) {
  3850. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  3851. } else if (isUndef(oldEndVnode)) {
  3852. oldEndVnode = oldCh[--oldEndIdx];
  3853. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  3854. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  3855. oldStartVnode = oldCh[++oldStartIdx];
  3856. newStartVnode = newCh[++newStartIdx];
  3857. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  3858. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  3859. oldEndVnode = oldCh[--oldEndIdx];
  3860. newEndVnode = newCh[--newEndIdx];
  3861. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  3862. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  3863. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  3864. oldStartVnode = oldCh[++oldStartIdx];
  3865. newEndVnode = newCh[--newEndIdx];
  3866. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  3867. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  3868. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  3869. oldEndVnode = oldCh[--oldEndIdx];
  3870. newStartVnode = newCh[++newStartIdx];
  3871. } else {
  3872. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  3873. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  3874. if (isUndef(idxInOld)) { // New element
  3875. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  3876. newStartVnode = newCh[++newStartIdx];
  3877. } else {
  3878. elmToMove = oldCh[idxInOld];
  3879. /* istanbul ignore if */
  3880. if ("development" !== 'production' && !elmToMove) {
  3881. warn(
  3882. 'It seems there are duplicate keys that is causing an update error. ' +
  3883. 'Make sure each v-for item has a unique key.'
  3884. );
  3885. }
  3886. if (elmToMove.tag !== newStartVnode.tag) {
  3887. // same key but different element. treat as new element
  3888. createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
  3889. newStartVnode = newCh[++newStartIdx];
  3890. } else {
  3891. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  3892. oldCh[idxInOld] = undefined;
  3893. canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
  3894. newStartVnode = newCh[++newStartIdx];
  3895. }
  3896. }
  3897. }
  3898. }
  3899. if (oldStartIdx > oldEndIdx) {
  3900. refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  3901. addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  3902. } else if (newStartIdx > newEndIdx) {
  3903. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  3904. }
  3905. }
  3906. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  3907. if (oldVnode === vnode) {
  3908. return
  3909. }
  3910. // reuse element for static trees.
  3911. // note we only do this if the vnode is cloned -
  3912. // if the new node is not cloned it means the render functions have been
  3913. // reset by the hot-reload-api and we need to do a proper re-render.
  3914. if (vnode.isStatic &&
  3915. oldVnode.isStatic &&
  3916. vnode.key === oldVnode.key &&
  3917. (vnode.isCloned || vnode.isOnce)) {
  3918. vnode.elm = oldVnode.elm;
  3919. vnode.child = oldVnode.child;
  3920. return
  3921. }
  3922. var i;
  3923. var data = vnode.data;
  3924. var hasData = isDef(data);
  3925. if (hasData && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  3926. i(oldVnode, vnode);
  3927. }
  3928. var elm = vnode.elm = oldVnode.elm;
  3929. var oldCh = oldVnode.children;
  3930. var ch = vnode.children;
  3931. if (hasData && isPatchable(vnode)) {
  3932. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  3933. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  3934. }
  3935. if (isUndef(vnode.text)) {
  3936. if (isDef(oldCh) && isDef(ch)) {
  3937. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  3938. } else if (isDef(ch)) {
  3939. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  3940. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  3941. } else if (isDef(oldCh)) {
  3942. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  3943. } else if (isDef(oldVnode.text)) {
  3944. nodeOps.setTextContent(elm, '');
  3945. }
  3946. } else if (oldVnode.text !== vnode.text) {
  3947. nodeOps.setTextContent(elm, vnode.text);
  3948. }
  3949. if (hasData) {
  3950. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  3951. }
  3952. }
  3953. function invokeInsertHook (vnode, queue, initial) {
  3954. // delay insert hooks for component root nodes, invoke them after the
  3955. // element is really inserted
  3956. if (initial && vnode.parent) {
  3957. vnode.parent.data.pendingInsert = queue;
  3958. } else {
  3959. for (var i = 0; i < queue.length; ++i) {
  3960. queue[i].data.hook.insert(queue[i]);
  3961. }
  3962. }
  3963. }
  3964. var bailed = false;
  3965. function hydrate (elm, vnode, insertedVnodeQueue) {
  3966. {
  3967. if (!assertNodeMatch(elm, vnode)) {
  3968. return false
  3969. }
  3970. }
  3971. vnode.elm = elm;
  3972. var tag = vnode.tag;
  3973. var data = vnode.data;
  3974. var children = vnode.children;
  3975. if (isDef(data)) {
  3976. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  3977. if (isDef(i = vnode.child)) {
  3978. // child component. it should have hydrated its own tree.
  3979. initComponent(vnode, insertedVnodeQueue);
  3980. return true
  3981. }
  3982. }
  3983. if (isDef(tag)) {
  3984. if (isDef(children)) {
  3985. var childNodes = nodeOps.childNodes(elm);
  3986. // empty element, allow client to pick up and populate children
  3987. if (!childNodes.length) {
  3988. createChildren(vnode, children, insertedVnodeQueue);
  3989. } else {
  3990. var childrenMatch = true;
  3991. if (childNodes.length !== children.length) {
  3992. childrenMatch = false;
  3993. } else {
  3994. for (var i$1 = 0; i$1 < children.length; i$1++) {
  3995. if (!hydrate(childNodes[i$1], children[i$1], insertedVnodeQueue)) {
  3996. childrenMatch = false;
  3997. break
  3998. }
  3999. }
  4000. }
  4001. if (!childrenMatch) {
  4002. if ("development" !== 'production' &&
  4003. typeof console !== 'undefined' &&
  4004. !bailed) {
  4005. bailed = true;
  4006. console.warn('Parent: ', elm);
  4007. console.warn('Mismatching childNodes vs. VNodes: ', childNodes, children);
  4008. }
  4009. return false
  4010. }
  4011. }
  4012. }
  4013. if (isDef(data)) {
  4014. invokeCreateHooks(vnode, insertedVnodeQueue);
  4015. }
  4016. }
  4017. return true
  4018. }
  4019. function assertNodeMatch (node, vnode) {
  4020. if (vnode.tag) {
  4021. return (
  4022. vnode.tag.indexOf('vue-component') === 0 ||
  4023. vnode.tag.toLowerCase() === nodeOps.tagName(node).toLowerCase()
  4024. )
  4025. } else {
  4026. return _toString(vnode.text) === node.data
  4027. }
  4028. }
  4029. return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
  4030. if (!vnode) {
  4031. if (oldVnode) { invokeDestroyHook(oldVnode); }
  4032. return
  4033. }
  4034. var elm, parent;
  4035. var isInitialPatch = false;
  4036. var insertedVnodeQueue = [];
  4037. if (!oldVnode) {
  4038. // empty mount (likely as component), create new root element
  4039. isInitialPatch = true;
  4040. createElm(vnode, insertedVnodeQueue, parentElm, refElm);
  4041. } else {
  4042. var isRealElement = isDef(oldVnode.nodeType);
  4043. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  4044. // patch existing root node
  4045. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  4046. } else {
  4047. if (isRealElement) {
  4048. // mounting to a real element
  4049. // check if this is server-rendered content and if we can perform
  4050. // a successful hydration.
  4051. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
  4052. oldVnode.removeAttribute('server-rendered');
  4053. hydrating = true;
  4054. }
  4055. if (hydrating) {
  4056. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  4057. invokeInsertHook(vnode, insertedVnodeQueue, true);
  4058. return oldVnode
  4059. } else {
  4060. warn(
  4061. 'The client-side rendered virtual DOM tree is not matching ' +
  4062. 'server-rendered content. This is likely caused by incorrect ' +
  4063. 'HTML markup, for example nesting block-level elements inside ' +
  4064. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  4065. 'full client-side render.'
  4066. );
  4067. }
  4068. }
  4069. // either not server-rendered, or hydration failed.
  4070. // create an empty node and replace it
  4071. oldVnode = emptyNodeAt(oldVnode);
  4072. }
  4073. // replacing existing element
  4074. elm = oldVnode.elm;
  4075. parent = nodeOps.parentNode(elm);
  4076. createElm(vnode, insertedVnodeQueue, parent, nodeOps.nextSibling(elm));
  4077. if (vnode.parent) {
  4078. // component root element replaced.
  4079. // update parent placeholder node element, recursively
  4080. var ancestor = vnode.parent;
  4081. while (ancestor) {
  4082. ancestor.elm = vnode.elm;
  4083. ancestor = ancestor.parent;
  4084. }
  4085. if (isPatchable(vnode)) {
  4086. for (var i = 0; i < cbs.create.length; ++i) {
  4087. cbs.create[i](emptyNode, vnode.parent);
  4088. }
  4089. }
  4090. }
  4091. if (parent !== null) {
  4092. removeVnodes(parent, [oldVnode], 0, 0);
  4093. } else if (isDef(oldVnode.tag)) {
  4094. invokeDestroyHook(oldVnode);
  4095. }
  4096. }
  4097. }
  4098. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  4099. return vnode.elm
  4100. }
  4101. }
  4102. /* */
  4103. var directives = {
  4104. create: updateDirectives,
  4105. update: updateDirectives,
  4106. destroy: function unbindDirectives (vnode) {
  4107. updateDirectives(vnode, emptyNode);
  4108. }
  4109. };
  4110. function updateDirectives (
  4111. oldVnode,
  4112. vnode
  4113. ) {
  4114. if (!oldVnode.data.directives && !vnode.data.directives) {
  4115. return
  4116. }
  4117. var isCreate = oldVnode === emptyNode;
  4118. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  4119. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  4120. var dirsWithInsert = [];
  4121. var dirsWithPostpatch = [];
  4122. var key, oldDir, dir;
  4123. for (key in newDirs) {
  4124. oldDir = oldDirs[key];
  4125. dir = newDirs[key];
  4126. if (!oldDir) {
  4127. // new directive, bind
  4128. callHook$1(dir, 'bind', vnode, oldVnode);
  4129. if (dir.def && dir.def.inserted) {
  4130. dirsWithInsert.push(dir);
  4131. }
  4132. } else {
  4133. // existing directive, update
  4134. dir.oldValue = oldDir.value;
  4135. callHook$1(dir, 'update', vnode, oldVnode);
  4136. if (dir.def && dir.def.componentUpdated) {
  4137. dirsWithPostpatch.push(dir);
  4138. }
  4139. }
  4140. }
  4141. if (dirsWithInsert.length) {
  4142. var callInsert = function () {
  4143. dirsWithInsert.forEach(function (dir) {
  4144. callHook$1(dir, 'inserted', vnode, oldVnode);
  4145. });
  4146. };
  4147. if (isCreate) {
  4148. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert, 'dir-insert');
  4149. } else {
  4150. callInsert();
  4151. }
  4152. }
  4153. if (dirsWithPostpatch.length) {
  4154. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  4155. dirsWithPostpatch.forEach(function (dir) {
  4156. callHook$1(dir, 'componentUpdated', vnode, oldVnode);
  4157. });
  4158. }, 'dir-postpatch');
  4159. }
  4160. if (!isCreate) {
  4161. for (key in oldDirs) {
  4162. if (!newDirs[key]) {
  4163. // no longer present, unbind
  4164. callHook$1(oldDirs[key], 'unbind', oldVnode);
  4165. }
  4166. }
  4167. }
  4168. }
  4169. var emptyModifiers = Object.create(null);
  4170. function normalizeDirectives$1 (
  4171. dirs,
  4172. vm
  4173. ) {
  4174. var res = Object.create(null);
  4175. if (!dirs) {
  4176. return res
  4177. }
  4178. var i, dir;
  4179. for (i = 0; i < dirs.length; i++) {
  4180. dir = dirs[i];
  4181. if (!dir.modifiers) {
  4182. dir.modifiers = emptyModifiers;
  4183. }
  4184. res[getRawDirName(dir)] = dir;
  4185. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  4186. }
  4187. return res
  4188. }
  4189. function getRawDirName (dir) {
  4190. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  4191. }
  4192. function callHook$1 (dir, hook, vnode, oldVnode) {
  4193. var fn = dir.def && dir.def[hook];
  4194. if (fn) {
  4195. fn(vnode.elm, dir, vnode, oldVnode);
  4196. }
  4197. }
  4198. var baseModules = [
  4199. ref,
  4200. directives
  4201. ];
  4202. /* */
  4203. function updateAttrs (oldVnode, vnode) {
  4204. if (!oldVnode.data.attrs && !vnode.data.attrs) {
  4205. return
  4206. }
  4207. var key, cur, old;
  4208. var elm = vnode.elm;
  4209. var oldAttrs = oldVnode.data.attrs || {};
  4210. var attrs = vnode.data.attrs || {};
  4211. // clone observed objects, as the user probably wants to mutate it
  4212. if (attrs.__ob__) {
  4213. attrs = vnode.data.attrs = extend({}, attrs);
  4214. }
  4215. for (key in attrs) {
  4216. cur = attrs[key];
  4217. old = oldAttrs[key];
  4218. if (old !== cur) {
  4219. setAttr(elm, key, cur);
  4220. }
  4221. }
  4222. for (key in oldAttrs) {
  4223. if (attrs[key] == null) {
  4224. if (isXlink(key)) {
  4225. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  4226. } else if (!isEnumeratedAttr(key)) {
  4227. elm.removeAttribute(key);
  4228. }
  4229. }
  4230. }
  4231. }
  4232. function setAttr (el, key, value) {
  4233. if (isBooleanAttr(key)) {
  4234. // set attribute for blank value
  4235. // e.g. <option disabled>Select one</option>
  4236. if (isFalsyAttrValue(value)) {
  4237. el.removeAttribute(key);
  4238. } else {
  4239. el.setAttribute(key, key);
  4240. }
  4241. } else if (isEnumeratedAttr(key)) {
  4242. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  4243. } else if (isXlink(key)) {
  4244. if (isFalsyAttrValue(value)) {
  4245. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  4246. } else {
  4247. el.setAttributeNS(xlinkNS, key, value);
  4248. }
  4249. } else {
  4250. if (isFalsyAttrValue(value)) {
  4251. el.removeAttribute(key);
  4252. } else {
  4253. el.setAttribute(key, value);
  4254. }
  4255. }
  4256. }
  4257. var attrs = {
  4258. create: updateAttrs,
  4259. update: updateAttrs
  4260. };
  4261. /* */
  4262. function updateClass (oldVnode, vnode) {
  4263. var el = vnode.elm;
  4264. var data = vnode.data;
  4265. var oldData = oldVnode.data;
  4266. if (!data.staticClass && !data.class &&
  4267. (!oldData || (!oldData.staticClass && !oldData.class))) {
  4268. return
  4269. }
  4270. var cls = genClassForVnode(vnode);
  4271. // handle transition classes
  4272. var transitionClass = el._transitionClasses;
  4273. if (transitionClass) {
  4274. cls = concat(cls, stringifyClass(transitionClass));
  4275. }
  4276. // set the class
  4277. if (cls !== el._prevClass) {
  4278. el.setAttribute('class', cls);
  4279. el._prevClass = cls;
  4280. }
  4281. }
  4282. var klass = {
  4283. create: updateClass,
  4284. update: updateClass
  4285. };
  4286. // skip type checking this file because we need to attach private properties
  4287. // to elements
  4288. function updateDOMListeners (oldVnode, vnode) {
  4289. if (!oldVnode.data.on && !vnode.data.on) {
  4290. return
  4291. }
  4292. var on = vnode.data.on || {};
  4293. var oldOn = oldVnode.data.on || {};
  4294. var add = vnode.elm._v_add || (
  4295. vnode.elm._v_add = function (event, handler, once, capture) {
  4296. if (once) {
  4297. var oldHandler = handler;
  4298. handler = function (ev) {
  4299. remove(event, handler, capture);
  4300. arguments.length === 1
  4301. ? oldHandler(ev)
  4302. : oldHandler.apply(null, arguments);
  4303. };
  4304. }
  4305. vnode.elm.addEventListener(event, handler, capture);
  4306. }
  4307. );
  4308. var remove = vnode.elm._v_remove || (
  4309. vnode.elm._v_remove = function (event, handler, capture) {
  4310. vnode.elm.removeEventListener(event, handler, capture);
  4311. }
  4312. );
  4313. updateListeners(on, oldOn, add, remove, vnode.context);
  4314. }
  4315. var events = {
  4316. create: updateDOMListeners,
  4317. update: updateDOMListeners
  4318. };
  4319. /* */
  4320. function updateDOMProps (oldVnode, vnode) {
  4321. if (!oldVnode.data.domProps && !vnode.data.domProps) {
  4322. return
  4323. }
  4324. var key, cur;
  4325. var elm = vnode.elm;
  4326. var oldProps = oldVnode.data.domProps || {};
  4327. var props = vnode.data.domProps || {};
  4328. // clone observed objects, as the user probably wants to mutate it
  4329. if (props.__ob__) {
  4330. props = vnode.data.domProps = extend({}, props);
  4331. }
  4332. for (key in oldProps) {
  4333. if (props[key] == null) {
  4334. elm[key] = '';
  4335. }
  4336. }
  4337. for (key in props) {
  4338. cur = props[key];
  4339. // ignore children if the node has textContent or innerHTML,
  4340. // as these will throw away existing DOM nodes and cause removal errors
  4341. // on subsequent patches (#3360)
  4342. if (key === 'textContent' || key === 'innerHTML') {
  4343. if (vnode.children) { vnode.children.length = 0; }
  4344. if (cur === oldProps[key]) { continue }
  4345. }
  4346. if (key === 'value') {
  4347. // store value as _value as well since
  4348. // non-string values will be stringified
  4349. elm._value = cur;
  4350. // avoid resetting cursor position when value is the same
  4351. var strCur = cur == null ? '' : String(cur);
  4352. if (elm.value !== strCur && !elm.composing) {
  4353. elm.value = strCur;
  4354. }
  4355. } else {
  4356. elm[key] = cur;
  4357. }
  4358. }
  4359. }
  4360. var domProps = {
  4361. create: updateDOMProps,
  4362. update: updateDOMProps
  4363. };
  4364. /* */
  4365. var parseStyleText = cached(function (cssText) {
  4366. var res = {};
  4367. var listDelimiter = /;(?![^(]*\))/g;
  4368. var propertyDelimiter = /:(.+)/;
  4369. cssText.split(listDelimiter).forEach(function (item) {
  4370. if (item) {
  4371. var tmp = item.split(propertyDelimiter);
  4372. tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
  4373. }
  4374. });
  4375. return res
  4376. });
  4377. // merge static and dynamic style data on the same vnode
  4378. function normalizeStyleData (data) {
  4379. var style = normalizeStyleBinding(data.style);
  4380. // static style is pre-processed into an object during compilation
  4381. // and is always a fresh object, so it's safe to merge into it
  4382. return data.staticStyle
  4383. ? extend(data.staticStyle, style)
  4384. : style
  4385. }
  4386. // normalize possible array / string values into Object
  4387. function normalizeStyleBinding (bindingStyle) {
  4388. if (Array.isArray(bindingStyle)) {
  4389. return toObject(bindingStyle)
  4390. }
  4391. if (typeof bindingStyle === 'string') {
  4392. return parseStyleText(bindingStyle)
  4393. }
  4394. return bindingStyle
  4395. }
  4396. /**
  4397. * parent component style should be after child's
  4398. * so that parent component's style could override it
  4399. */
  4400. function getStyle (vnode, checkChild) {
  4401. var res = {};
  4402. var styleData;
  4403. if (checkChild) {
  4404. var childNode = vnode;
  4405. while (childNode.child) {
  4406. childNode = childNode.child._vnode;
  4407. if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
  4408. extend(res, styleData);
  4409. }
  4410. }
  4411. }
  4412. if ((styleData = normalizeStyleData(vnode.data))) {
  4413. extend(res, styleData);
  4414. }
  4415. var parentNode = vnode;
  4416. while ((parentNode = parentNode.parent)) {
  4417. if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
  4418. extend(res, styleData);
  4419. }
  4420. }
  4421. return res
  4422. }
  4423. /* */
  4424. var cssVarRE = /^--/;
  4425. var importantRE = /\s*!important$/;
  4426. var setProp = function (el, name, val) {
  4427. /* istanbul ignore if */
  4428. if (cssVarRE.test(name)) {
  4429. el.style.setProperty(name, val);
  4430. } else if (importantRE.test(val)) {
  4431. el.style.setProperty(name, val.replace(importantRE, ''), 'important');
  4432. } else {
  4433. el.style[normalize(name)] = val;
  4434. }
  4435. };
  4436. var prefixes = ['Webkit', 'Moz', 'ms'];
  4437. var testEl;
  4438. var normalize = cached(function (prop) {
  4439. testEl = testEl || document.createElement('div');
  4440. prop = camelize(prop);
  4441. if (prop !== 'filter' && (prop in testEl.style)) {
  4442. return prop
  4443. }
  4444. var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  4445. for (var i = 0; i < prefixes.length; i++) {
  4446. var prefixed = prefixes[i] + upper;
  4447. if (prefixed in testEl.style) {
  4448. return prefixed
  4449. }
  4450. }
  4451. });
  4452. function updateStyle (oldVnode, vnode) {
  4453. var data = vnode.data;
  4454. var oldData = oldVnode.data;
  4455. if (!data.staticStyle && !data.style &&
  4456. !oldData.staticStyle && !oldData.style) {
  4457. return
  4458. }
  4459. var cur, name;
  4460. var el = vnode.elm;
  4461. var oldStaticStyle = oldVnode.data.staticStyle;
  4462. var oldStyleBinding = oldVnode.data.style || {};
  4463. // if static style exists, stylebinding already merged into it when doing normalizeStyleData
  4464. var oldStyle = oldStaticStyle || oldStyleBinding;
  4465. var style = normalizeStyleBinding(vnode.data.style) || {};
  4466. vnode.data.style = style.__ob__ ? extend({}, style) : style;
  4467. var newStyle = getStyle(vnode, true);
  4468. for (name in oldStyle) {
  4469. if (newStyle[name] == null) {
  4470. setProp(el, name, '');
  4471. }
  4472. }
  4473. for (name in newStyle) {
  4474. cur = newStyle[name];
  4475. if (cur !== oldStyle[name]) {
  4476. // ie9 setting to null has no effect, must use empty string
  4477. setProp(el, name, cur == null ? '' : cur);
  4478. }
  4479. }
  4480. }
  4481. var style = {
  4482. create: updateStyle,
  4483. update: updateStyle
  4484. };
  4485. /* */
  4486. /**
  4487. * Add class with compatibility for SVG since classList is not supported on
  4488. * SVG elements in IE
  4489. */
  4490. function addClass (el, cls) {
  4491. /* istanbul ignore if */
  4492. if (!cls || !cls.trim()) {
  4493. return
  4494. }
  4495. /* istanbul ignore else */
  4496. if (el.classList) {
  4497. if (cls.indexOf(' ') > -1) {
  4498. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  4499. } else {
  4500. el.classList.add(cls);
  4501. }
  4502. } else {
  4503. var cur = ' ' + el.getAttribute('class') + ' ';
  4504. if (cur.indexOf(' ' + cls + ' ') < 0) {
  4505. el.setAttribute('class', (cur + cls).trim());
  4506. }
  4507. }
  4508. }
  4509. /**
  4510. * Remove class with compatibility for SVG since classList is not supported on
  4511. * SVG elements in IE
  4512. */
  4513. function removeClass (el, cls) {
  4514. /* istanbul ignore if */
  4515. if (!cls || !cls.trim()) {
  4516. return
  4517. }
  4518. /* istanbul ignore else */
  4519. if (el.classList) {
  4520. if (cls.indexOf(' ') > -1) {
  4521. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  4522. } else {
  4523. el.classList.remove(cls);
  4524. }
  4525. } else {
  4526. var cur = ' ' + el.getAttribute('class') + ' ';
  4527. var tar = ' ' + cls + ' ';
  4528. while (cur.indexOf(tar) >= 0) {
  4529. cur = cur.replace(tar, ' ');
  4530. }
  4531. el.setAttribute('class', cur.trim());
  4532. }
  4533. }
  4534. /* */
  4535. var hasTransition = inBrowser && !isIE9;
  4536. var TRANSITION = 'transition';
  4537. var ANIMATION = 'animation';
  4538. // Transition property/event sniffing
  4539. var transitionProp = 'transition';
  4540. var transitionEndEvent = 'transitionend';
  4541. var animationProp = 'animation';
  4542. var animationEndEvent = 'animationend';
  4543. if (hasTransition) {
  4544. /* istanbul ignore if */
  4545. if (window.ontransitionend === undefined &&
  4546. window.onwebkittransitionend !== undefined) {
  4547. transitionProp = 'WebkitTransition';
  4548. transitionEndEvent = 'webkitTransitionEnd';
  4549. }
  4550. if (window.onanimationend === undefined &&
  4551. window.onwebkitanimationend !== undefined) {
  4552. animationProp = 'WebkitAnimation';
  4553. animationEndEvent = 'webkitAnimationEnd';
  4554. }
  4555. }
  4556. var raf = (inBrowser && window.requestAnimationFrame) || setTimeout;
  4557. function nextFrame (fn) {
  4558. raf(function () {
  4559. raf(fn);
  4560. });
  4561. }
  4562. function addTransitionClass (el, cls) {
  4563. (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  4564. addClass(el, cls);
  4565. }
  4566. function removeTransitionClass (el, cls) {
  4567. if (el._transitionClasses) {
  4568. remove$1(el._transitionClasses, cls);
  4569. }
  4570. removeClass(el, cls);
  4571. }
  4572. function whenTransitionEnds (
  4573. el,
  4574. expectedType,
  4575. cb
  4576. ) {
  4577. var ref = getTransitionInfo(el, expectedType);
  4578. var type = ref.type;
  4579. var timeout = ref.timeout;
  4580. var propCount = ref.propCount;
  4581. if (!type) { return cb() }
  4582. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  4583. var ended = 0;
  4584. var end = function () {
  4585. el.removeEventListener(event, onEnd);
  4586. cb();
  4587. };
  4588. var onEnd = function (e) {
  4589. if (e.target === el) {
  4590. if (++ended >= propCount) {
  4591. end();
  4592. }
  4593. }
  4594. };
  4595. setTimeout(function () {
  4596. if (ended < propCount) {
  4597. end();
  4598. }
  4599. }, timeout + 1);
  4600. el.addEventListener(event, onEnd);
  4601. }
  4602. var transformRE = /\b(transform|all)(,|$)/;
  4603. function getTransitionInfo (el, expectedType) {
  4604. var styles = window.getComputedStyle(el);
  4605. var transitioneDelays = styles[transitionProp + 'Delay'].split(', ');
  4606. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  4607. var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
  4608. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  4609. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  4610. var animationTimeout = getTimeout(animationDelays, animationDurations);
  4611. var type;
  4612. var timeout = 0;
  4613. var propCount = 0;
  4614. /* istanbul ignore if */
  4615. if (expectedType === TRANSITION) {
  4616. if (transitionTimeout > 0) {
  4617. type = TRANSITION;
  4618. timeout = transitionTimeout;
  4619. propCount = transitionDurations.length;
  4620. }
  4621. } else if (expectedType === ANIMATION) {
  4622. if (animationTimeout > 0) {
  4623. type = ANIMATION;
  4624. timeout = animationTimeout;
  4625. propCount = animationDurations.length;
  4626. }
  4627. } else {
  4628. timeout = Math.max(transitionTimeout, animationTimeout);
  4629. type = timeout > 0
  4630. ? transitionTimeout > animationTimeout
  4631. ? TRANSITION
  4632. : ANIMATION
  4633. : null;
  4634. propCount = type
  4635. ? type === TRANSITION
  4636. ? transitionDurations.length
  4637. : animationDurations.length
  4638. : 0;
  4639. }
  4640. var hasTransform =
  4641. type === TRANSITION &&
  4642. transformRE.test(styles[transitionProp + 'Property']);
  4643. return {
  4644. type: type,
  4645. timeout: timeout,
  4646. propCount: propCount,
  4647. hasTransform: hasTransform
  4648. }
  4649. }
  4650. function getTimeout (delays, durations) {
  4651. /* istanbul ignore next */
  4652. while (delays.length < durations.length) {
  4653. delays = delays.concat(delays);
  4654. }
  4655. return Math.max.apply(null, durations.map(function (d, i) {
  4656. return toMs(d) + toMs(delays[i])
  4657. }))
  4658. }
  4659. function toMs (s) {
  4660. return Number(s.slice(0, -1)) * 1000
  4661. }
  4662. /* */
  4663. function enter (vnode) {
  4664. var el = vnode.elm;
  4665. // call leave callback now
  4666. if (el._leaveCb) {
  4667. el._leaveCb.cancelled = true;
  4668. el._leaveCb();
  4669. }
  4670. var data = resolveTransition(vnode.data.transition);
  4671. if (!data) {
  4672. return
  4673. }
  4674. /* istanbul ignore if */
  4675. if (el._enterCb || el.nodeType !== 1) {
  4676. return
  4677. }
  4678. var css = data.css;
  4679. var type = data.type;
  4680. var enterClass = data.enterClass;
  4681. var enterActiveClass = data.enterActiveClass;
  4682. var appearClass = data.appearClass;
  4683. var appearActiveClass = data.appearActiveClass;
  4684. var beforeEnter = data.beforeEnter;
  4685. var enter = data.enter;
  4686. var afterEnter = data.afterEnter;
  4687. var enterCancelled = data.enterCancelled;
  4688. var beforeAppear = data.beforeAppear;
  4689. var appear = data.appear;
  4690. var afterAppear = data.afterAppear;
  4691. var appearCancelled = data.appearCancelled;
  4692. // activeInstance will always be the <transition> component managing this
  4693. // transition. One edge case to check is when the <transition> is placed
  4694. // as the root node of a child component. In that case we need to check
  4695. // <transition>'s parent for appear check.
  4696. var context = activeInstance;
  4697. var transitionNode = activeInstance.$vnode;
  4698. while (transitionNode && transitionNode.parent) {
  4699. transitionNode = transitionNode.parent;
  4700. context = transitionNode.context;
  4701. }
  4702. var isAppear = !context._isMounted || !vnode.isRootInsert;
  4703. if (isAppear && !appear && appear !== '') {
  4704. return
  4705. }
  4706. var startClass = isAppear ? appearClass : enterClass;
  4707. var activeClass = isAppear ? appearActiveClass : enterActiveClass;
  4708. var beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter;
  4709. var enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter;
  4710. var afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter;
  4711. var enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled;
  4712. var expectsCSS = css !== false && !isIE9;
  4713. var userWantsControl =
  4714. enterHook &&
  4715. // enterHook may be a bound method which exposes
  4716. // the length of original fn as _length
  4717. (enterHook._length || enterHook.length) > 1;
  4718. var cb = el._enterCb = once(function () {
  4719. if (expectsCSS) {
  4720. removeTransitionClass(el, activeClass);
  4721. }
  4722. if (cb.cancelled) {
  4723. if (expectsCSS) {
  4724. removeTransitionClass(el, startClass);
  4725. }
  4726. enterCancelledHook && enterCancelledHook(el);
  4727. } else {
  4728. afterEnterHook && afterEnterHook(el);
  4729. }
  4730. el._enterCb = null;
  4731. });
  4732. if (!vnode.data.show) {
  4733. // remove pending leave element on enter by injecting an insert hook
  4734. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  4735. var parent = el.parentNode;
  4736. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  4737. if (pendingNode &&
  4738. pendingNode.context === vnode.context &&
  4739. pendingNode.tag === vnode.tag &&
  4740. pendingNode.elm._leaveCb) {
  4741. pendingNode.elm._leaveCb();
  4742. }
  4743. enterHook && enterHook(el, cb);
  4744. }, 'transition-insert');
  4745. }
  4746. // start enter transition
  4747. beforeEnterHook && beforeEnterHook(el);
  4748. if (expectsCSS) {
  4749. addTransitionClass(el, startClass);
  4750. addTransitionClass(el, activeClass);
  4751. nextFrame(function () {
  4752. removeTransitionClass(el, startClass);
  4753. if (!cb.cancelled && !userWantsControl) {
  4754. whenTransitionEnds(el, type, cb);
  4755. }
  4756. });
  4757. }
  4758. if (vnode.data.show) {
  4759. enterHook && enterHook(el, cb);
  4760. }
  4761. if (!expectsCSS && !userWantsControl) {
  4762. cb();
  4763. }
  4764. }
  4765. function leave (vnode, rm) {
  4766. var el = vnode.elm;
  4767. // call enter callback now
  4768. if (el._enterCb) {
  4769. el._enterCb.cancelled = true;
  4770. el._enterCb();
  4771. }
  4772. var data = resolveTransition(vnode.data.transition);
  4773. if (!data) {
  4774. return rm()
  4775. }
  4776. /* istanbul ignore if */
  4777. if (el._leaveCb || el.nodeType !== 1) {
  4778. return
  4779. }
  4780. var css = data.css;
  4781. var type = data.type;
  4782. var leaveClass = data.leaveClass;
  4783. var leaveActiveClass = data.leaveActiveClass;
  4784. var beforeLeave = data.beforeLeave;
  4785. var leave = data.leave;
  4786. var afterLeave = data.afterLeave;
  4787. var leaveCancelled = data.leaveCancelled;
  4788. var delayLeave = data.delayLeave;
  4789. var expectsCSS = css !== false && !isIE9;
  4790. var userWantsControl =
  4791. leave &&
  4792. // leave hook may be a bound method which exposes
  4793. // the length of original fn as _length
  4794. (leave._length || leave.length) > 1;
  4795. var cb = el._leaveCb = once(function () {
  4796. if (el.parentNode && el.parentNode._pending) {
  4797. el.parentNode._pending[vnode.key] = null;
  4798. }
  4799. if (expectsCSS) {
  4800. removeTransitionClass(el, leaveActiveClass);
  4801. }
  4802. if (cb.cancelled) {
  4803. if (expectsCSS) {
  4804. removeTransitionClass(el, leaveClass);
  4805. }
  4806. leaveCancelled && leaveCancelled(el);
  4807. } else {
  4808. rm();
  4809. afterLeave && afterLeave(el);
  4810. }
  4811. el._leaveCb = null;
  4812. });
  4813. if (delayLeave) {
  4814. delayLeave(performLeave);
  4815. } else {
  4816. performLeave();
  4817. }
  4818. function performLeave () {
  4819. // the delayed leave may have already been cancelled
  4820. if (cb.cancelled) {
  4821. return
  4822. }
  4823. // record leaving element
  4824. if (!vnode.data.show) {
  4825. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
  4826. }
  4827. beforeLeave && beforeLeave(el);
  4828. if (expectsCSS) {
  4829. addTransitionClass(el, leaveClass);
  4830. addTransitionClass(el, leaveActiveClass);
  4831. nextFrame(function () {
  4832. removeTransitionClass(el, leaveClass);
  4833. if (!cb.cancelled && !userWantsControl) {
  4834. whenTransitionEnds(el, type, cb);
  4835. }
  4836. });
  4837. }
  4838. leave && leave(el, cb);
  4839. if (!expectsCSS && !userWantsControl) {
  4840. cb();
  4841. }
  4842. }
  4843. }
  4844. function resolveTransition (def$$1) {
  4845. if (!def$$1) {
  4846. return
  4847. }
  4848. /* istanbul ignore else */
  4849. if (typeof def$$1 === 'object') {
  4850. var res = {};
  4851. if (def$$1.css !== false) {
  4852. extend(res, autoCssTransition(def$$1.name || 'v'));
  4853. }
  4854. extend(res, def$$1);
  4855. return res
  4856. } else if (typeof def$$1 === 'string') {
  4857. return autoCssTransition(def$$1)
  4858. }
  4859. }
  4860. var autoCssTransition = cached(function (name) {
  4861. return {
  4862. enterClass: (name + "-enter"),
  4863. leaveClass: (name + "-leave"),
  4864. appearClass: (name + "-enter"),
  4865. enterActiveClass: (name + "-enter-active"),
  4866. leaveActiveClass: (name + "-leave-active"),
  4867. appearActiveClass: (name + "-enter-active")
  4868. }
  4869. });
  4870. function once (fn) {
  4871. var called = false;
  4872. return function () {
  4873. if (!called) {
  4874. called = true;
  4875. fn();
  4876. }
  4877. }
  4878. }
  4879. function _enter (_, vnode) {
  4880. if (!vnode.data.show) {
  4881. enter(vnode);
  4882. }
  4883. }
  4884. var transition = inBrowser ? {
  4885. create: _enter,
  4886. activate: _enter,
  4887. remove: function remove (vnode, rm) {
  4888. /* istanbul ignore else */
  4889. if (!vnode.data.show) {
  4890. leave(vnode, rm);
  4891. } else {
  4892. rm();
  4893. }
  4894. }
  4895. } : {};
  4896. var platformModules = [
  4897. attrs,
  4898. klass,
  4899. events,
  4900. domProps,
  4901. style,
  4902. transition
  4903. ];
  4904. /* */
  4905. // the directive module should be applied last, after all
  4906. // built-in modules have been applied.
  4907. var modules = platformModules.concat(baseModules);
  4908. var patch$1 = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  4909. /**
  4910. * Not type checking this file because flow doesn't like attaching
  4911. * properties to Elements.
  4912. */
  4913. var modelableTagRE = /^input|select|textarea|vue-component-[0-9]+(-[0-9a-zA-Z_-]*)?$/;
  4914. /* istanbul ignore if */
  4915. if (isIE9) {
  4916. // http://www.matts411.com/post/internet-explorer-9-oninput/
  4917. document.addEventListener('selectionchange', function () {
  4918. var el = document.activeElement;
  4919. if (el && el.vmodel) {
  4920. trigger(el, 'input');
  4921. }
  4922. });
  4923. }
  4924. var model = {
  4925. inserted: function inserted (el, binding, vnode) {
  4926. {
  4927. if (!modelableTagRE.test(vnode.tag)) {
  4928. warn(
  4929. "v-model is not supported on element type: <" + (vnode.tag) + ">. " +
  4930. 'If you are working with contenteditable, it\'s recommended to ' +
  4931. 'wrap a library dedicated for that purpose inside a custom component.',
  4932. vnode.context
  4933. );
  4934. }
  4935. }
  4936. if (vnode.tag === 'select') {
  4937. var cb = function () {
  4938. setSelected(el, binding, vnode.context);
  4939. };
  4940. cb();
  4941. /* istanbul ignore if */
  4942. if (isIE || isEdge) {
  4943. setTimeout(cb, 0);
  4944. }
  4945. } else if (
  4946. (vnode.tag === 'textarea' || el.type === 'text') &&
  4947. !binding.modifiers.lazy
  4948. ) {
  4949. if (!isAndroid) {
  4950. el.addEventListener('compositionstart', onCompositionStart);
  4951. el.addEventListener('compositionend', onCompositionEnd);
  4952. }
  4953. /* istanbul ignore if */
  4954. if (isIE9) {
  4955. el.vmodel = true;
  4956. }
  4957. }
  4958. },
  4959. componentUpdated: function componentUpdated (el, binding, vnode) {
  4960. if (vnode.tag === 'select') {
  4961. setSelected(el, binding, vnode.context);
  4962. // in case the options rendered by v-for have changed,
  4963. // it's possible that the value is out-of-sync with the rendered options.
  4964. // detect such cases and filter out values that no longer has a matching
  4965. // option in the DOM.
  4966. var needReset = el.multiple
  4967. ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
  4968. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
  4969. if (needReset) {
  4970. trigger(el, 'change');
  4971. }
  4972. }
  4973. }
  4974. };
  4975. function setSelected (el, binding, vm) {
  4976. var value = binding.value;
  4977. var isMultiple = el.multiple;
  4978. if (isMultiple && !Array.isArray(value)) {
  4979. "development" !== 'production' && warn(
  4980. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  4981. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  4982. vm
  4983. );
  4984. return
  4985. }
  4986. var selected, option;
  4987. for (var i = 0, l = el.options.length; i < l; i++) {
  4988. option = el.options[i];
  4989. if (isMultiple) {
  4990. selected = looseIndexOf(value, getValue(option)) > -1;
  4991. if (option.selected !== selected) {
  4992. option.selected = selected;
  4993. }
  4994. } else {
  4995. if (looseEqual(getValue(option), value)) {
  4996. if (el.selectedIndex !== i) {
  4997. el.selectedIndex = i;
  4998. }
  4999. return
  5000. }
  5001. }
  5002. }
  5003. if (!isMultiple) {
  5004. el.selectedIndex = -1;
  5005. }
  5006. }
  5007. function hasNoMatchingOption (value, options) {
  5008. for (var i = 0, l = options.length; i < l; i++) {
  5009. if (looseEqual(getValue(options[i]), value)) {
  5010. return false
  5011. }
  5012. }
  5013. return true
  5014. }
  5015. function getValue (option) {
  5016. return '_value' in option
  5017. ? option._value
  5018. : option.value
  5019. }
  5020. function onCompositionStart (e) {
  5021. e.target.composing = true;
  5022. }
  5023. function onCompositionEnd (e) {
  5024. e.target.composing = false;
  5025. trigger(e.target, 'input');
  5026. }
  5027. function trigger (el, type) {
  5028. var e = document.createEvent('HTMLEvents');
  5029. e.initEvent(type, true, true);
  5030. el.dispatchEvent(e);
  5031. }
  5032. /* */
  5033. // recursively search for possible transition defined inside the component root
  5034. function locateNode (vnode) {
  5035. return vnode.child && (!vnode.data || !vnode.data.transition)
  5036. ? locateNode(vnode.child._vnode)
  5037. : vnode
  5038. }
  5039. var show = {
  5040. bind: function bind (el, ref, vnode) {
  5041. var value = ref.value;
  5042. vnode = locateNode(vnode);
  5043. var transition = vnode.data && vnode.data.transition;
  5044. if (value && transition && !isIE9) {
  5045. enter(vnode);
  5046. }
  5047. var originalDisplay = el.style.display === 'none' ? '' : el.style.display;
  5048. el.style.display = value ? originalDisplay : 'none';
  5049. el.__vOriginalDisplay = originalDisplay;
  5050. },
  5051. update: function update (el, ref, vnode) {
  5052. var value = ref.value;
  5053. var oldValue = ref.oldValue;
  5054. /* istanbul ignore if */
  5055. if (value === oldValue) { return }
  5056. vnode = locateNode(vnode);
  5057. var transition = vnode.data && vnode.data.transition;
  5058. if (transition && !isIE9) {
  5059. if (value) {
  5060. enter(vnode);
  5061. el.style.display = el.__vOriginalDisplay;
  5062. } else {
  5063. leave(vnode, function () {
  5064. el.style.display = 'none';
  5065. });
  5066. }
  5067. } else {
  5068. el.style.display = value ? el.__vOriginalDisplay : 'none';
  5069. }
  5070. }
  5071. };
  5072. var platformDirectives = {
  5073. model: model,
  5074. show: show
  5075. };
  5076. /* */
  5077. // Provides transition support for a single element/component.
  5078. // supports transition mode (out-in / in-out)
  5079. var transitionProps = {
  5080. name: String,
  5081. appear: Boolean,
  5082. css: Boolean,
  5083. mode: String,
  5084. type: String,
  5085. enterClass: String,
  5086. leaveClass: String,
  5087. enterActiveClass: String,
  5088. leaveActiveClass: String,
  5089. appearClass: String,
  5090. appearActiveClass: String
  5091. };
  5092. // in case the child is also an abstract component, e.g. <keep-alive>
  5093. // we want to recursively retrieve the real component to be rendered
  5094. function getRealChild (vnode) {
  5095. var compOptions = vnode && vnode.componentOptions;
  5096. if (compOptions && compOptions.Ctor.options.abstract) {
  5097. return getRealChild(getFirstComponentChild(compOptions.children))
  5098. } else {
  5099. return vnode
  5100. }
  5101. }
  5102. function extractTransitionData (comp) {
  5103. var data = {};
  5104. var options = comp.$options;
  5105. // props
  5106. for (var key in options.propsData) {
  5107. data[key] = comp[key];
  5108. }
  5109. // events.
  5110. // extract listeners and pass them directly to the transition methods
  5111. var listeners = options._parentListeners;
  5112. for (var key$1 in listeners) {
  5113. data[camelize(key$1)] = listeners[key$1].fn;
  5114. }
  5115. return data
  5116. }
  5117. function placeholder (h, rawChild) {
  5118. return /\d-keep-alive$/.test(rawChild.tag)
  5119. ? h('keep-alive')
  5120. : null
  5121. }
  5122. function hasParentTransition (vnode) {
  5123. while ((vnode = vnode.parent)) {
  5124. if (vnode.data.transition) {
  5125. return true
  5126. }
  5127. }
  5128. }
  5129. var Transition = {
  5130. name: 'transition',
  5131. props: transitionProps,
  5132. abstract: true,
  5133. render: function render (h) {
  5134. var this$1 = this;
  5135. var children = this.$slots.default;
  5136. if (!children) {
  5137. return
  5138. }
  5139. // filter out text nodes (possible whitespaces)
  5140. children = children.filter(function (c) { return c.tag; });
  5141. /* istanbul ignore if */
  5142. if (!children.length) {
  5143. return
  5144. }
  5145. // warn multiple elements
  5146. if ("development" !== 'production' && children.length > 1) {
  5147. warn(
  5148. '<transition> can only be used on a single element. Use ' +
  5149. '<transition-group> for lists.',
  5150. this.$parent
  5151. );
  5152. }
  5153. var mode = this.mode;
  5154. // warn invalid mode
  5155. if ("development" !== 'production' &&
  5156. mode && mode !== 'in-out' && mode !== 'out-in') {
  5157. warn(
  5158. 'invalid <transition> mode: ' + mode,
  5159. this.$parent
  5160. );
  5161. }
  5162. var rawChild = children[0];
  5163. // if this is a component root node and the component's
  5164. // parent container node also has transition, skip.
  5165. if (hasParentTransition(this.$vnode)) {
  5166. return rawChild
  5167. }
  5168. // apply transition data to child
  5169. // use getRealChild() to ignore abstract components e.g. keep-alive
  5170. var child = getRealChild(rawChild);
  5171. /* istanbul ignore if */
  5172. if (!child) {
  5173. return rawChild
  5174. }
  5175. if (this._leaving) {
  5176. return placeholder(h, rawChild)
  5177. }
  5178. var key = child.key = child.key == null || child.isStatic
  5179. ? ("__v" + (child.tag + this._uid) + "__")
  5180. : child.key;
  5181. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  5182. var oldRawChild = this._vnode;
  5183. var oldChild = getRealChild(oldRawChild);
  5184. // mark v-show
  5185. // so that the transition module can hand over the control to the directive
  5186. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  5187. child.data.show = true;
  5188. }
  5189. if (oldChild && oldChild.data && oldChild.key !== key) {
  5190. // replace old child transition data with fresh one
  5191. // important for dynamic transitions!
  5192. var oldData = oldChild.data.transition = extend({}, data);
  5193. // handle transition mode
  5194. if (mode === 'out-in') {
  5195. // return placeholder node and queue update when leave finishes
  5196. this._leaving = true;
  5197. mergeVNodeHook(oldData, 'afterLeave', function () {
  5198. this$1._leaving = false;
  5199. this$1.$forceUpdate();
  5200. }, key);
  5201. return placeholder(h, rawChild)
  5202. } else if (mode === 'in-out') {
  5203. var delayedLeave;
  5204. var performLeave = function () { delayedLeave(); };
  5205. mergeVNodeHook(data, 'afterEnter', performLeave, key);
  5206. mergeVNodeHook(data, 'enterCancelled', performLeave, key);
  5207. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  5208. delayedLeave = leave;
  5209. }, key);
  5210. }
  5211. }
  5212. return rawChild
  5213. }
  5214. };
  5215. /* */
  5216. // Provides transition support for list items.
  5217. // supports move transitions using the FLIP technique.
  5218. // Because the vdom's children update algorithm is "unstable" - i.e.
  5219. // it doesn't guarantee the relative positioning of removed elements,
  5220. // we force transition-group to update its children into two passes:
  5221. // in the first pass, we remove all nodes that need to be removed,
  5222. // triggering their leaving transition; in the second pass, we insert/move
  5223. // into the final disired state. This way in the second pass removed
  5224. // nodes will remain where they should be.
  5225. var props = extend({
  5226. tag: String,
  5227. moveClass: String
  5228. }, transitionProps);
  5229. delete props.mode;
  5230. var TransitionGroup = {
  5231. props: props,
  5232. render: function render (h) {
  5233. var tag = this.tag || this.$vnode.data.tag || 'span';
  5234. var map = Object.create(null);
  5235. var prevChildren = this.prevChildren = this.children;
  5236. var rawChildren = this.$slots.default || [];
  5237. var children = this.children = [];
  5238. var transitionData = extractTransitionData(this);
  5239. for (var i = 0; i < rawChildren.length; i++) {
  5240. var c = rawChildren[i];
  5241. if (c.tag) {
  5242. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  5243. children.push(c);
  5244. map[c.key] = c
  5245. ;(c.data || (c.data = {})).transition = transitionData;
  5246. } else {
  5247. var opts = c.componentOptions;
  5248. var name = opts
  5249. ? (opts.Ctor.options.name || opts.tag)
  5250. : c.tag;
  5251. warn(("<transition-group> children must be keyed: <" + name + ">"));
  5252. }
  5253. }
  5254. }
  5255. if (prevChildren) {
  5256. var kept = [];
  5257. var removed = [];
  5258. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  5259. var c$1 = prevChildren[i$1];
  5260. c$1.data.transition = transitionData;
  5261. c$1.data.pos = c$1.elm.getBoundingClientRect();
  5262. if (map[c$1.key]) {
  5263. kept.push(c$1);
  5264. } else {
  5265. removed.push(c$1);
  5266. }
  5267. }
  5268. this.kept = h(tag, null, kept);
  5269. this.removed = removed;
  5270. }
  5271. return h(tag, null, children)
  5272. },
  5273. beforeUpdate: function beforeUpdate () {
  5274. // force removing pass
  5275. this.__patch__(
  5276. this._vnode,
  5277. this.kept,
  5278. false, // hydrating
  5279. true // removeOnly (!important, avoids unnecessary moves)
  5280. );
  5281. this._vnode = this.kept;
  5282. },
  5283. updated: function updated () {
  5284. var children = this.prevChildren;
  5285. var moveClass = this.moveClass || ((this.name || 'v') + '-move');
  5286. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  5287. return
  5288. }
  5289. // we divide the work into three loops to avoid mixing DOM reads and writes
  5290. // in each iteration - which helps prevent layout thrashing.
  5291. children.forEach(callPendingCbs);
  5292. children.forEach(recordPosition);
  5293. children.forEach(applyTranslation);
  5294. // force reflow to put everything in position
  5295. var f = document.body.offsetHeight; // eslint-disable-line
  5296. children.forEach(function (c) {
  5297. if (c.data.moved) {
  5298. var el = c.elm;
  5299. var s = el.style;
  5300. addTransitionClass(el, moveClass);
  5301. s.transform = s.WebkitTransform = s.transitionDuration = '';
  5302. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  5303. if (!e || /transform$/.test(e.propertyName)) {
  5304. el.removeEventListener(transitionEndEvent, cb);
  5305. el._moveCb = null;
  5306. removeTransitionClass(el, moveClass);
  5307. }
  5308. });
  5309. }
  5310. });
  5311. },
  5312. methods: {
  5313. hasMove: function hasMove (el, moveClass) {
  5314. /* istanbul ignore if */
  5315. if (!hasTransition) {
  5316. return false
  5317. }
  5318. if (this._hasMove != null) {
  5319. return this._hasMove
  5320. }
  5321. addTransitionClass(el, moveClass);
  5322. var info = getTransitionInfo(el);
  5323. removeTransitionClass(el, moveClass);
  5324. return (this._hasMove = info.hasTransform)
  5325. }
  5326. }
  5327. };
  5328. function callPendingCbs (c) {
  5329. /* istanbul ignore if */
  5330. if (c.elm._moveCb) {
  5331. c.elm._moveCb();
  5332. }
  5333. /* istanbul ignore if */
  5334. if (c.elm._enterCb) {
  5335. c.elm._enterCb();
  5336. }
  5337. }
  5338. function recordPosition (c) {
  5339. c.data.newPos = c.elm.getBoundingClientRect();
  5340. }
  5341. function applyTranslation (c) {
  5342. var oldPos = c.data.pos;
  5343. var newPos = c.data.newPos;
  5344. var dx = oldPos.left - newPos.left;
  5345. var dy = oldPos.top - newPos.top;
  5346. if (dx || dy) {
  5347. c.data.moved = true;
  5348. var s = c.elm.style;
  5349. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  5350. s.transitionDuration = '0s';
  5351. }
  5352. }
  5353. var platformComponents = {
  5354. Transition: Transition,
  5355. TransitionGroup: TransitionGroup
  5356. };
  5357. /* */
  5358. // install platform specific utils
  5359. Vue$3.config.isUnknownElement = isUnknownElement;
  5360. Vue$3.config.isReservedTag = isReservedTag;
  5361. Vue$3.config.getTagNamespace = getTagNamespace;
  5362. Vue$3.config.mustUseProp = mustUseProp;
  5363. // install platform runtime directives & components
  5364. extend(Vue$3.options.directives, platformDirectives);
  5365. extend(Vue$3.options.components, platformComponents);
  5366. // install platform patch function
  5367. Vue$3.prototype.__patch__ = inBrowser ? patch$1 : noop;
  5368. // wrap mount
  5369. Vue$3.prototype.$mount = function (
  5370. el,
  5371. hydrating
  5372. ) {
  5373. el = el && inBrowser ? query(el) : undefined;
  5374. return this._mount(el, hydrating)
  5375. };
  5376. // devtools global hook
  5377. /* istanbul ignore next */
  5378. setTimeout(function () {
  5379. if (config.devtools) {
  5380. if (devtools) {
  5381. devtools.emit('init', Vue$3);
  5382. } else if (
  5383. "development" !== 'production' &&
  5384. inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
  5385. ) {
  5386. console.log(
  5387. 'Download the Vue Devtools for a better development experience:\n' +
  5388. 'https://github.com/vuejs/vue-devtools'
  5389. );
  5390. }
  5391. }
  5392. }, 0);
  5393. /* */
  5394. // check whether current browser encodes a char inside attribute values
  5395. function shouldDecode (content, encoded) {
  5396. var div = document.createElement('div');
  5397. div.innerHTML = "<div a=\"" + content + "\">";
  5398. return div.innerHTML.indexOf(encoded) > 0
  5399. }
  5400. // #3663
  5401. // IE encodes newlines inside attribute values while other browsers don't
  5402. var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
  5403. /* */
  5404. var decoder;
  5405. function decode (html) {
  5406. decoder = decoder || document.createElement('div');
  5407. decoder.innerHTML = html;
  5408. return decoder.textContent
  5409. }
  5410. /* */
  5411. var isUnaryTag = makeMap(
  5412. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  5413. 'link,meta,param,source,track,wbr',
  5414. true
  5415. );
  5416. // Elements that you can, intentionally, leave open
  5417. // (and which close themselves)
  5418. var canBeLeftOpenTag = makeMap(
  5419. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
  5420. true
  5421. );
  5422. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  5423. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  5424. var isNonPhrasingTag = makeMap(
  5425. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  5426. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  5427. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  5428. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  5429. 'title,tr,track',
  5430. true
  5431. );
  5432. /**
  5433. * Not type-checking this file because it's mostly vendor code.
  5434. */
  5435. /*!
  5436. * HTML Parser By John Resig (ejohn.org)
  5437. * Modified by Juriy "kangax" Zaytsev
  5438. * Original code by Erik Arvidsson, Mozilla Public License
  5439. * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
  5440. */
  5441. // Regular Expressions for parsing tags and attributes
  5442. var singleAttrIdentifier = /([^\s"'<>/=]+)/;
  5443. var singleAttrAssign = /(?:=)/;
  5444. var singleAttrValues = [
  5445. // attr value double quotes
  5446. /"([^"]*)"+/.source,
  5447. // attr value, single quotes
  5448. /'([^']*)'+/.source,
  5449. // attr value, no quotes
  5450. /([^\s"'=<>`]+)/.source
  5451. ];
  5452. var attribute = new RegExp(
  5453. '^\\s*' + singleAttrIdentifier.source +
  5454. '(?:\\s*(' + singleAttrAssign.source + ')' +
  5455. '\\s*(?:' + singleAttrValues.join('|') + '))?'
  5456. );
  5457. // could use https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-QName
  5458. // but for Vue templates we can enforce a simple charset
  5459. var ncname = '[a-zA-Z_][\\w\\-\\.]*';
  5460. var qnameCapture = '((?:' + ncname + '\\:)?' + ncname + ')';
  5461. var startTagOpen = new RegExp('^<' + qnameCapture);
  5462. var startTagClose = /^\s*(\/?)>/;
  5463. var endTag = new RegExp('^<\\/' + qnameCapture + '[^>]*>');
  5464. var doctype = /^<!DOCTYPE [^>]+>/i;
  5465. var comment = /^<!--/;
  5466. var conditionalComment = /^<!\[/;
  5467. var IS_REGEX_CAPTURING_BROKEN = false;
  5468. 'x'.replace(/x(.)?/g, function (m, g) {
  5469. IS_REGEX_CAPTURING_BROKEN = g === '';
  5470. });
  5471. // Special Elements (can contain anything)
  5472. var isScriptOrStyle = makeMap('script,style', true);
  5473. var hasLang = function (attr) { return attr.name === 'lang' && attr.value !== 'html'; };
  5474. var isSpecialTag = function (tag, isSFC, stack) {
  5475. if (isScriptOrStyle(tag)) {
  5476. return true
  5477. }
  5478. if (isSFC && stack.length === 1) {
  5479. // top-level template that has no pre-processor
  5480. if (tag === 'template' && !stack[0].attrs.some(hasLang)) {
  5481. return false
  5482. } else {
  5483. return true
  5484. }
  5485. }
  5486. return false
  5487. };
  5488. var reCache = {};
  5489. var ltRE = /&lt;/g;
  5490. var gtRE = /&gt;/g;
  5491. var nlRE = /&#10;/g;
  5492. var ampRE = /&amp;/g;
  5493. var quoteRE = /&quot;/g;
  5494. function decodeAttr (value, shouldDecodeNewlines) {
  5495. if (shouldDecodeNewlines) {
  5496. value = value.replace(nlRE, '\n');
  5497. }
  5498. return value
  5499. .replace(ltRE, '<')
  5500. .replace(gtRE, '>')
  5501. .replace(ampRE, '&')
  5502. .replace(quoteRE, '"')
  5503. }
  5504. function parseHTML (html, options) {
  5505. var stack = [];
  5506. var expectHTML = options.expectHTML;
  5507. var isUnaryTag$$1 = options.isUnaryTag || no;
  5508. var index = 0;
  5509. var last, lastTag;
  5510. while (html) {
  5511. last = html;
  5512. // Make sure we're not in a script or style element
  5513. if (!lastTag || !isSpecialTag(lastTag, options.sfc, stack)) {
  5514. var textEnd = html.indexOf('<');
  5515. if (textEnd === 0) {
  5516. // Comment:
  5517. if (comment.test(html)) {
  5518. var commentEnd = html.indexOf('-->');
  5519. if (commentEnd >= 0) {
  5520. advance(commentEnd + 3);
  5521. continue
  5522. }
  5523. }
  5524. // http://en.wikipedia.org/wiki/Conditional_comment#Downlevel-revealed_conditional_comment
  5525. if (conditionalComment.test(html)) {
  5526. var conditionalEnd = html.indexOf(']>');
  5527. if (conditionalEnd >= 0) {
  5528. advance(conditionalEnd + 2);
  5529. continue
  5530. }
  5531. }
  5532. // Doctype:
  5533. var doctypeMatch = html.match(doctype);
  5534. if (doctypeMatch) {
  5535. advance(doctypeMatch[0].length);
  5536. continue
  5537. }
  5538. // End tag:
  5539. var endTagMatch = html.match(endTag);
  5540. if (endTagMatch) {
  5541. var curIndex = index;
  5542. advance(endTagMatch[0].length);
  5543. parseEndTag(endTagMatch[0], endTagMatch[1], curIndex, index);
  5544. continue
  5545. }
  5546. // Start tag:
  5547. var startTagMatch = parseStartTag();
  5548. if (startTagMatch) {
  5549. handleStartTag(startTagMatch);
  5550. continue
  5551. }
  5552. }
  5553. var text = (void 0), rest$1 = (void 0), next = (void 0);
  5554. if (textEnd > 0) {
  5555. rest$1 = html.slice(textEnd);
  5556. while (
  5557. !endTag.test(rest$1) &&
  5558. !startTagOpen.test(rest$1) &&
  5559. !comment.test(rest$1) &&
  5560. !conditionalComment.test(rest$1)
  5561. ) {
  5562. // < in plain text, be forgiving and treat it as text
  5563. next = rest$1.indexOf('<', 1);
  5564. if (next < 0) { break }
  5565. textEnd += next;
  5566. rest$1 = html.slice(textEnd);
  5567. }
  5568. text = html.substring(0, textEnd);
  5569. advance(textEnd);
  5570. }
  5571. if (textEnd < 0) {
  5572. text = html;
  5573. html = '';
  5574. }
  5575. if (options.chars && text) {
  5576. options.chars(text);
  5577. }
  5578. } else {
  5579. var stackedTag = lastTag.toLowerCase();
  5580. var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
  5581. var endTagLength = 0;
  5582. var rest = html.replace(reStackedTag, function (all, text, endTag) {
  5583. endTagLength = endTag.length;
  5584. if (stackedTag !== 'script' && stackedTag !== 'style' && stackedTag !== 'noscript') {
  5585. text = text
  5586. .replace(/<!--([\s\S]*?)-->/g, '$1')
  5587. .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
  5588. }
  5589. if (options.chars) {
  5590. options.chars(text);
  5591. }
  5592. return ''
  5593. });
  5594. index += html.length - rest.length;
  5595. html = rest;
  5596. parseEndTag('</' + stackedTag + '>', stackedTag, index - endTagLength, index);
  5597. }
  5598. if (html === last && options.chars) {
  5599. options.chars(html);
  5600. break
  5601. }
  5602. }
  5603. // Clean up any remaining tags
  5604. parseEndTag();
  5605. function advance (n) {
  5606. index += n;
  5607. html = html.substring(n);
  5608. }
  5609. function parseStartTag () {
  5610. var start = html.match(startTagOpen);
  5611. if (start) {
  5612. var match = {
  5613. tagName: start[1],
  5614. attrs: [],
  5615. start: index
  5616. };
  5617. advance(start[0].length);
  5618. var end, attr;
  5619. while (!(end = html.match(startTagClose)) && (attr = html.match(attribute))) {
  5620. advance(attr[0].length);
  5621. match.attrs.push(attr);
  5622. }
  5623. if (end) {
  5624. match.unarySlash = end[1];
  5625. advance(end[0].length);
  5626. match.end = index;
  5627. return match
  5628. }
  5629. }
  5630. }
  5631. function handleStartTag (match) {
  5632. var tagName = match.tagName;
  5633. var unarySlash = match.unarySlash;
  5634. if (expectHTML) {
  5635. if (lastTag === 'p' && isNonPhrasingTag(tagName)) {
  5636. parseEndTag('', lastTag);
  5637. }
  5638. if (canBeLeftOpenTag(tagName) && lastTag === tagName) {
  5639. parseEndTag('', tagName);
  5640. }
  5641. }
  5642. var unary = isUnaryTag$$1(tagName) || tagName === 'html' && lastTag === 'head' || !!unarySlash;
  5643. var l = match.attrs.length;
  5644. var attrs = new Array(l);
  5645. for (var i = 0; i < l; i++) {
  5646. var args = match.attrs[i];
  5647. // hackish work around FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=369778
  5648. if (IS_REGEX_CAPTURING_BROKEN && args[0].indexOf('""') === -1) {
  5649. if (args[3] === '') { delete args[3]; }
  5650. if (args[4] === '') { delete args[4]; }
  5651. if (args[5] === '') { delete args[5]; }
  5652. }
  5653. var value = args[3] || args[4] || args[5] || '';
  5654. attrs[i] = {
  5655. name: args[1],
  5656. value: decodeAttr(
  5657. value,
  5658. options.shouldDecodeNewlines
  5659. )
  5660. };
  5661. }
  5662. if (!unary) {
  5663. stack.push({ tag: tagName, attrs: attrs });
  5664. lastTag = tagName;
  5665. unarySlash = '';
  5666. }
  5667. if (options.start) {
  5668. options.start(tagName, attrs, unary, match.start, match.end);
  5669. }
  5670. }
  5671. function parseEndTag (tag, tagName, start, end) {
  5672. var pos;
  5673. if (start == null) { start = index; }
  5674. if (end == null) { end = index; }
  5675. // Find the closest opened tag of the same type
  5676. if (tagName) {
  5677. var needle = tagName.toLowerCase();
  5678. for (pos = stack.length - 1; pos >= 0; pos--) {
  5679. if (stack[pos].tag.toLowerCase() === needle) {
  5680. break
  5681. }
  5682. }
  5683. } else {
  5684. // If no tag name is provided, clean shop
  5685. pos = 0;
  5686. }
  5687. if (pos >= 0) {
  5688. // Close all the open elements, up the stack
  5689. for (var i = stack.length - 1; i >= pos; i--) {
  5690. if (options.end) {
  5691. options.end(stack[i].tag, start, end);
  5692. }
  5693. }
  5694. // Remove the open elements from the stack
  5695. stack.length = pos;
  5696. lastTag = pos && stack[pos - 1].tag;
  5697. } else if (tagName.toLowerCase() === 'br') {
  5698. if (options.start) {
  5699. options.start(tagName, [], true, start, end);
  5700. }
  5701. } else if (tagName.toLowerCase() === 'p') {
  5702. if (options.start) {
  5703. options.start(tagName, [], false, start, end);
  5704. }
  5705. if (options.end) {
  5706. options.end(tagName, start, end);
  5707. }
  5708. }
  5709. }
  5710. }
  5711. /* */
  5712. function parseFilters (exp) {
  5713. var inSingle = false;
  5714. var inDouble = false;
  5715. var inTemplateString = false;
  5716. var inRegex = false;
  5717. var curly = 0;
  5718. var square = 0;
  5719. var paren = 0;
  5720. var lastFilterIndex = 0;
  5721. var c, prev, i, expression, filters;
  5722. for (i = 0; i < exp.length; i++) {
  5723. prev = c;
  5724. c = exp.charCodeAt(i);
  5725. if (inSingle) {
  5726. if (c === 0x27 && prev !== 0x5C) { inSingle = false; }
  5727. } else if (inDouble) {
  5728. if (c === 0x22 && prev !== 0x5C) { inDouble = false; }
  5729. } else if (inTemplateString) {
  5730. if (c === 0x60 && prev !== 0x5C) { inTemplateString = false; }
  5731. } else if (inRegex) {
  5732. if (c === 0x2f && prev !== 0x5C) { inRegex = false; }
  5733. } else if (
  5734. c === 0x7C && // pipe
  5735. exp.charCodeAt(i + 1) !== 0x7C &&
  5736. exp.charCodeAt(i - 1) !== 0x7C &&
  5737. !curly && !square && !paren
  5738. ) {
  5739. if (expression === undefined) {
  5740. // first filter, end of expression
  5741. lastFilterIndex = i + 1;
  5742. expression = exp.slice(0, i).trim();
  5743. } else {
  5744. pushFilter();
  5745. }
  5746. } else {
  5747. switch (c) {
  5748. case 0x22: inDouble = true; break // "
  5749. case 0x27: inSingle = true; break // '
  5750. case 0x60: inTemplateString = true; break // `
  5751. case 0x2f: inRegex = true; break // /
  5752. case 0x28: paren++; break // (
  5753. case 0x29: paren--; break // )
  5754. case 0x5B: square++; break // [
  5755. case 0x5D: square--; break // ]
  5756. case 0x7B: curly++; break // {
  5757. case 0x7D: curly--; break // }
  5758. }
  5759. }
  5760. }
  5761. if (expression === undefined) {
  5762. expression = exp.slice(0, i).trim();
  5763. } else if (lastFilterIndex !== 0) {
  5764. pushFilter();
  5765. }
  5766. function pushFilter () {
  5767. (filters || (filters = [])).push(exp.slice(lastFilterIndex, i).trim());
  5768. lastFilterIndex = i + 1;
  5769. }
  5770. if (filters) {
  5771. for (i = 0; i < filters.length; i++) {
  5772. expression = wrapFilter(expression, filters[i]);
  5773. }
  5774. }
  5775. return expression
  5776. }
  5777. function wrapFilter (exp, filter) {
  5778. var i = filter.indexOf('(');
  5779. if (i < 0) {
  5780. // _f: resolveFilter
  5781. return ("_f(\"" + filter + "\")(" + exp + ")")
  5782. } else {
  5783. var name = filter.slice(0, i);
  5784. var args = filter.slice(i + 1);
  5785. return ("_f(\"" + name + "\")(" + exp + "," + args)
  5786. }
  5787. }
  5788. /* */
  5789. var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
  5790. var regexEscapeRE = /[-.*+?^${}()|[\]/\\]/g;
  5791. var buildRegex = cached(function (delimiters) {
  5792. var open = delimiters[0].replace(regexEscapeRE, '\\$&');
  5793. var close = delimiters[1].replace(regexEscapeRE, '\\$&');
  5794. return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
  5795. });
  5796. function parseText (
  5797. text,
  5798. delimiters
  5799. ) {
  5800. var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
  5801. if (!tagRE.test(text)) {
  5802. return
  5803. }
  5804. var tokens = [];
  5805. var lastIndex = tagRE.lastIndex = 0;
  5806. var match, index;
  5807. while ((match = tagRE.exec(text))) {
  5808. index = match.index;
  5809. // push text token
  5810. if (index > lastIndex) {
  5811. tokens.push(JSON.stringify(text.slice(lastIndex, index)));
  5812. }
  5813. // tag token
  5814. var exp = parseFilters(match[1].trim());
  5815. tokens.push(("_s(" + exp + ")"));
  5816. lastIndex = index + match[0].length;
  5817. }
  5818. if (lastIndex < text.length) {
  5819. tokens.push(JSON.stringify(text.slice(lastIndex)));
  5820. }
  5821. return tokens.join('+')
  5822. }
  5823. /* */
  5824. function baseWarn (msg) {
  5825. console.error(("[Vue parser]: " + msg));
  5826. }
  5827. function pluckModuleFunction (
  5828. modules,
  5829. key
  5830. ) {
  5831. return modules
  5832. ? modules.map(function (m) { return m[key]; }).filter(function (_) { return _; })
  5833. : []
  5834. }
  5835. function addProp (el, name, value) {
  5836. (el.props || (el.props = [])).push({ name: name, value: value });
  5837. }
  5838. function addAttr (el, name, value) {
  5839. (el.attrs || (el.attrs = [])).push({ name: name, value: value });
  5840. }
  5841. function addDirective (
  5842. el,
  5843. name,
  5844. rawName,
  5845. value,
  5846. arg,
  5847. modifiers
  5848. ) {
  5849. (el.directives || (el.directives = [])).push({ name: name, rawName: rawName, value: value, arg: arg, modifiers: modifiers });
  5850. }
  5851. function addHandler (
  5852. el,
  5853. name,
  5854. value,
  5855. modifiers,
  5856. important
  5857. ) {
  5858. // check capture modifier
  5859. if (modifiers && modifiers.capture) {
  5860. delete modifiers.capture;
  5861. name = '!' + name; // mark the event as captured
  5862. }
  5863. if (modifiers && modifiers.once) {
  5864. delete modifiers.once;
  5865. name = '~' + name; // mark the event as once
  5866. }
  5867. var events;
  5868. if (modifiers && modifiers.native) {
  5869. delete modifiers.native;
  5870. events = el.nativeEvents || (el.nativeEvents = {});
  5871. } else {
  5872. events = el.events || (el.events = {});
  5873. }
  5874. var newHandler = { value: value, modifiers: modifiers };
  5875. var handlers = events[name];
  5876. /* istanbul ignore if */
  5877. if (Array.isArray(handlers)) {
  5878. important ? handlers.unshift(newHandler) : handlers.push(newHandler);
  5879. } else if (handlers) {
  5880. events[name] = important ? [newHandler, handlers] : [handlers, newHandler];
  5881. } else {
  5882. events[name] = newHandler;
  5883. }
  5884. }
  5885. function getBindingAttr (
  5886. el,
  5887. name,
  5888. getStatic
  5889. ) {
  5890. var dynamicValue =
  5891. getAndRemoveAttr(el, ':' + name) ||
  5892. getAndRemoveAttr(el, 'v-bind:' + name);
  5893. if (dynamicValue != null) {
  5894. return parseFilters(dynamicValue)
  5895. } else if (getStatic !== false) {
  5896. var staticValue = getAndRemoveAttr(el, name);
  5897. if (staticValue != null) {
  5898. return JSON.stringify(staticValue)
  5899. }
  5900. }
  5901. }
  5902. function getAndRemoveAttr (el, name) {
  5903. var val;
  5904. if ((val = el.attrsMap[name]) != null) {
  5905. var list = el.attrsList;
  5906. for (var i = 0, l = list.length; i < l; i++) {
  5907. if (list[i].name === name) {
  5908. list.splice(i, 1);
  5909. break
  5910. }
  5911. }
  5912. }
  5913. return val
  5914. }
  5915. var len;
  5916. var str;
  5917. var chr;
  5918. var index$1;
  5919. var expressionPos;
  5920. var expressionEndPos;
  5921. /**
  5922. * parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
  5923. *
  5924. * for loop possible cases:
  5925. *
  5926. * - test
  5927. * - test[idx]
  5928. * - test[test1[idx]]
  5929. * - test["a"][idx]
  5930. * - xxx.test[a[a].test1[idx]]
  5931. * - test.xxx.a["asa"][test1[idx]]
  5932. *
  5933. */
  5934. function parseModel (val) {
  5935. str = val;
  5936. len = str.length;
  5937. index$1 = expressionPos = expressionEndPos = 0;
  5938. if (val.indexOf('[') < 0 || val.lastIndexOf(']') < len - 1) {
  5939. return {
  5940. exp: val,
  5941. idx: null
  5942. }
  5943. }
  5944. while (!eof()) {
  5945. chr = next();
  5946. /* istanbul ignore if */
  5947. if (isStringStart(chr)) {
  5948. parseString(chr);
  5949. } else if (chr === 0x5B) {
  5950. parseBracket(chr);
  5951. }
  5952. }
  5953. return {
  5954. exp: val.substring(0, expressionPos),
  5955. idx: val.substring(expressionPos + 1, expressionEndPos)
  5956. }
  5957. }
  5958. function next () {
  5959. return str.charCodeAt(++index$1)
  5960. }
  5961. function eof () {
  5962. return index$1 >= len
  5963. }
  5964. function isStringStart (chr) {
  5965. return chr === 0x22 || chr === 0x27
  5966. }
  5967. function parseBracket (chr) {
  5968. var inBracket = 1;
  5969. expressionPos = index$1;
  5970. while (!eof()) {
  5971. chr = next();
  5972. if (isStringStart(chr)) {
  5973. parseString(chr);
  5974. continue
  5975. }
  5976. if (chr === 0x5B) { inBracket++; }
  5977. if (chr === 0x5D) { inBracket--; }
  5978. if (inBracket === 0) {
  5979. expressionEndPos = index$1;
  5980. break
  5981. }
  5982. }
  5983. }
  5984. function parseString (chr) {
  5985. var stringQuote = chr;
  5986. while (!eof()) {
  5987. chr = next();
  5988. if (chr === stringQuote) {
  5989. break
  5990. }
  5991. }
  5992. }
  5993. /* */
  5994. var dirRE = /^v-|^@|^:/;
  5995. var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
  5996. var forIteratorRE = /\((\{[^}]*\}|[^,]*),([^,]*)(?:,([^,]*))?\)/;
  5997. var bindRE = /^:|^v-bind:/;
  5998. var onRE = /^@|^v-on:/;
  5999. var argRE = /:(.*)$/;
  6000. var modifierRE = /\.[^.]+/g;
  6001. var decodeHTMLCached = cached(decode);
  6002. // configurable state
  6003. var warn$1;
  6004. var platformGetTagNamespace;
  6005. var platformMustUseProp;
  6006. var platformIsPreTag;
  6007. var preTransforms;
  6008. var transforms;
  6009. var postTransforms;
  6010. var delimiters;
  6011. /**
  6012. * Convert HTML string to AST.
  6013. */
  6014. function parse (
  6015. template,
  6016. options
  6017. ) {
  6018. warn$1 = options.warn || baseWarn;
  6019. platformGetTagNamespace = options.getTagNamespace || no;
  6020. platformMustUseProp = options.mustUseProp || no;
  6021. platformIsPreTag = options.isPreTag || no;
  6022. preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
  6023. transforms = pluckModuleFunction(options.modules, 'transformNode');
  6024. postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
  6025. delimiters = options.delimiters;
  6026. var stack = [];
  6027. var preserveWhitespace = options.preserveWhitespace !== false;
  6028. var root;
  6029. var currentParent;
  6030. var inVPre = false;
  6031. var inPre = false;
  6032. var warned = false;
  6033. parseHTML(template, {
  6034. expectHTML: options.expectHTML,
  6035. isUnaryTag: options.isUnaryTag,
  6036. shouldDecodeNewlines: options.shouldDecodeNewlines,
  6037. start: function start (tag, attrs, unary) {
  6038. // check namespace.
  6039. // inherit parent ns if there is one
  6040. var ns = (currentParent && currentParent.ns) || platformGetTagNamespace(tag);
  6041. // handle IE svg bug
  6042. /* istanbul ignore if */
  6043. if (isIE && ns === 'svg') {
  6044. attrs = guardIESVGBug(attrs);
  6045. }
  6046. var element = {
  6047. type: 1,
  6048. tag: tag,
  6049. attrsList: attrs,
  6050. attrsMap: makeAttrsMap(attrs),
  6051. parent: currentParent,
  6052. children: []
  6053. };
  6054. if (ns) {
  6055. element.ns = ns;
  6056. }
  6057. if (isForbiddenTag(element) && !isServerRendering()) {
  6058. element.forbidden = true;
  6059. "development" !== 'production' && warn$1(
  6060. 'Templates should only be responsible for mapping the state to the ' +
  6061. 'UI. Avoid placing tags with side-effects in your templates, such as ' +
  6062. "<" + tag + ">."
  6063. );
  6064. }
  6065. // apply pre-transforms
  6066. for (var i = 0; i < preTransforms.length; i++) {
  6067. preTransforms[i](element, options);
  6068. }
  6069. if (!inVPre) {
  6070. processPre(element);
  6071. if (element.pre) {
  6072. inVPre = true;
  6073. }
  6074. }
  6075. if (platformIsPreTag(element.tag)) {
  6076. inPre = true;
  6077. }
  6078. if (inVPre) {
  6079. processRawAttrs(element);
  6080. } else {
  6081. processFor(element);
  6082. processIf(element);
  6083. processOnce(element);
  6084. processKey(element);
  6085. // determine whether this is a plain element after
  6086. // removing structural attributes
  6087. element.plain = !element.key && !attrs.length;
  6088. processRef(element);
  6089. processSlot(element);
  6090. processComponent(element);
  6091. for (var i$1 = 0; i$1 < transforms.length; i$1++) {
  6092. transforms[i$1](element, options);
  6093. }
  6094. processAttrs(element);
  6095. }
  6096. function checkRootConstraints (el) {
  6097. if ("development" !== 'production' && !warned) {
  6098. if (el.tag === 'slot' || el.tag === 'template') {
  6099. warned = true;
  6100. warn$1(
  6101. "Cannot use <" + (el.tag) + "> as component root element because it may " +
  6102. 'contain multiple nodes:\n' + template
  6103. );
  6104. }
  6105. if (el.attrsMap.hasOwnProperty('v-for')) {
  6106. warned = true;
  6107. warn$1(
  6108. 'Cannot use v-for on stateful component root element because ' +
  6109. 'it renders multiple elements:\n' + template
  6110. );
  6111. }
  6112. }
  6113. }
  6114. // tree management
  6115. if (!root) {
  6116. root = element;
  6117. checkRootConstraints(root);
  6118. } else if (!stack.length) {
  6119. // allow root elements with v-if, v-else-if and v-else
  6120. if (root.if && (element.elseif || element.else)) {
  6121. checkRootConstraints(element);
  6122. addIfCondition(root, {
  6123. exp: element.elseif,
  6124. block: element
  6125. });
  6126. } else if ("development" !== 'production' && !warned) {
  6127. warned = true;
  6128. warn$1(
  6129. "Component template should contain exactly one root element:" +
  6130. "\n\n" + template + "\n\n" +
  6131. "If you are using v-if on multiple elements, " +
  6132. "use v-else-if to chain them instead."
  6133. );
  6134. }
  6135. }
  6136. if (currentParent && !element.forbidden) {
  6137. if (element.elseif || element.else) {
  6138. processIfConditions(element, currentParent);
  6139. } else if (element.slotScope) { // scoped slot
  6140. currentParent.plain = false;
  6141. var name = element.slotTarget || 'default';(currentParent.scopedSlots || (currentParent.scopedSlots = {}))[name] = element;
  6142. } else {
  6143. currentParent.children.push(element);
  6144. element.parent = currentParent;
  6145. }
  6146. }
  6147. if (!unary) {
  6148. currentParent = element;
  6149. stack.push(element);
  6150. }
  6151. // apply post-transforms
  6152. for (var i$2 = 0; i$2 < postTransforms.length; i$2++) {
  6153. postTransforms[i$2](element, options);
  6154. }
  6155. },
  6156. end: function end () {
  6157. // remove trailing whitespace
  6158. var element = stack[stack.length - 1];
  6159. var lastNode = element.children[element.children.length - 1];
  6160. if (lastNode && lastNode.type === 3 && lastNode.text === ' ') {
  6161. element.children.pop();
  6162. }
  6163. // pop stack
  6164. stack.length -= 1;
  6165. currentParent = stack[stack.length - 1];
  6166. // check pre state
  6167. if (element.pre) {
  6168. inVPre = false;
  6169. }
  6170. if (platformIsPreTag(element.tag)) {
  6171. inPre = false;
  6172. }
  6173. },
  6174. chars: function chars (text) {
  6175. if (!currentParent) {
  6176. if ("development" !== 'production' && !warned && text === template) {
  6177. warned = true;
  6178. warn$1(
  6179. 'Component template requires a root element, rather than just text:\n\n' + template
  6180. );
  6181. }
  6182. return
  6183. }
  6184. // IE textarea placeholder bug
  6185. /* istanbul ignore if */
  6186. if (isIE &&
  6187. currentParent.tag === 'textarea' &&
  6188. currentParent.attrsMap.placeholder === text) {
  6189. return
  6190. }
  6191. text = inPre || text.trim()
  6192. ? decodeHTMLCached(text)
  6193. // only preserve whitespace if its not right after a starting tag
  6194. : preserveWhitespace && currentParent.children.length ? ' ' : '';
  6195. if (text) {
  6196. var expression;
  6197. if (!inVPre && text !== ' ' && (expression = parseText(text, delimiters))) {
  6198. currentParent.children.push({
  6199. type: 2,
  6200. expression: expression,
  6201. text: text
  6202. });
  6203. } else {
  6204. currentParent.children.push({
  6205. type: 3,
  6206. text: text
  6207. });
  6208. }
  6209. }
  6210. }
  6211. });
  6212. return root
  6213. }
  6214. function processPre (el) {
  6215. if (getAndRemoveAttr(el, 'v-pre') != null) {
  6216. el.pre = true;
  6217. }
  6218. }
  6219. function processRawAttrs (el) {
  6220. var l = el.attrsList.length;
  6221. if (l) {
  6222. var attrs = el.attrs = new Array(l);
  6223. for (var i = 0; i < l; i++) {
  6224. attrs[i] = {
  6225. name: el.attrsList[i].name,
  6226. value: JSON.stringify(el.attrsList[i].value)
  6227. };
  6228. }
  6229. } else if (!el.pre) {
  6230. // non root node in pre blocks with no attributes
  6231. el.plain = true;
  6232. }
  6233. }
  6234. function processKey (el) {
  6235. var exp = getBindingAttr(el, 'key');
  6236. if (exp) {
  6237. if ("development" !== 'production' && el.tag === 'template') {
  6238. warn$1("<template> cannot be keyed. Place the key on real elements instead.");
  6239. }
  6240. el.key = exp;
  6241. }
  6242. }
  6243. function processRef (el) {
  6244. var ref = getBindingAttr(el, 'ref');
  6245. if (ref) {
  6246. el.ref = ref;
  6247. el.refInFor = checkInFor(el);
  6248. }
  6249. }
  6250. function processFor (el) {
  6251. var exp;
  6252. if ((exp = getAndRemoveAttr(el, 'v-for'))) {
  6253. var inMatch = exp.match(forAliasRE);
  6254. if (!inMatch) {
  6255. "development" !== 'production' && warn$1(
  6256. ("Invalid v-for expression: " + exp)
  6257. );
  6258. return
  6259. }
  6260. el.for = inMatch[2].trim();
  6261. var alias = inMatch[1].trim();
  6262. var iteratorMatch = alias.match(forIteratorRE);
  6263. if (iteratorMatch) {
  6264. el.alias = iteratorMatch[1].trim();
  6265. el.iterator1 = iteratorMatch[2].trim();
  6266. if (iteratorMatch[3]) {
  6267. el.iterator2 = iteratorMatch[3].trim();
  6268. }
  6269. } else {
  6270. el.alias = alias;
  6271. }
  6272. }
  6273. }
  6274. function processIf (el) {
  6275. var exp = getAndRemoveAttr(el, 'v-if');
  6276. if (exp) {
  6277. el.if = exp;
  6278. addIfCondition(el, {
  6279. exp: exp,
  6280. block: el
  6281. });
  6282. } else {
  6283. if (getAndRemoveAttr(el, 'v-else') != null) {
  6284. el.else = true;
  6285. }
  6286. var elseif = getAndRemoveAttr(el, 'v-else-if');
  6287. if (elseif) {
  6288. el.elseif = elseif;
  6289. }
  6290. }
  6291. }
  6292. function processIfConditions (el, parent) {
  6293. var prev = findPrevElement(parent.children);
  6294. if (prev && prev.if) {
  6295. addIfCondition(prev, {
  6296. exp: el.elseif,
  6297. block: el
  6298. });
  6299. } else {
  6300. warn$1(
  6301. "v-" + (el.elseif ? ('else-if="' + el.elseif + '"') : 'else') + " " +
  6302. "used on element <" + (el.tag) + "> without corresponding v-if."
  6303. );
  6304. }
  6305. }
  6306. function addIfCondition (el, condition) {
  6307. if (!el.ifConditions) {
  6308. el.ifConditions = [];
  6309. }
  6310. el.ifConditions.push(condition);
  6311. }
  6312. function processOnce (el) {
  6313. var once = getAndRemoveAttr(el, 'v-once');
  6314. if (once != null) {
  6315. el.once = true;
  6316. }
  6317. }
  6318. function processSlot (el) {
  6319. if (el.tag === 'slot') {
  6320. el.slotName = getBindingAttr(el, 'name');
  6321. if ("development" !== 'production' && el.key) {
  6322. warn$1(
  6323. "`key` does not work on <slot> because slots are abstract outlets " +
  6324. "and can possibly expand into multiple elements. " +
  6325. "Use the key on a wrapping element instead."
  6326. );
  6327. }
  6328. } else {
  6329. var slotTarget = getBindingAttr(el, 'slot');
  6330. if (slotTarget) {
  6331. el.slotTarget = slotTarget === '""' ? '"default"' : slotTarget;
  6332. }
  6333. if (el.tag === 'template') {
  6334. el.slotScope = getAndRemoveAttr(el, 'scope');
  6335. }
  6336. }
  6337. }
  6338. function processComponent (el) {
  6339. var binding;
  6340. if ((binding = getBindingAttr(el, 'is'))) {
  6341. el.component = binding;
  6342. }
  6343. if (getAndRemoveAttr(el, 'inline-template') != null) {
  6344. el.inlineTemplate = true;
  6345. }
  6346. }
  6347. function processAttrs (el) {
  6348. var list = el.attrsList;
  6349. var i, l, name, rawName, value, arg, modifiers, isProp;
  6350. for (i = 0, l = list.length; i < l; i++) {
  6351. name = rawName = list[i].name;
  6352. value = list[i].value;
  6353. if (dirRE.test(name)) {
  6354. // mark element as dynamic
  6355. el.hasBindings = true;
  6356. // modifiers
  6357. modifiers = parseModifiers(name);
  6358. if (modifiers) {
  6359. name = name.replace(modifierRE, '');
  6360. }
  6361. if (bindRE.test(name)) { // v-bind
  6362. name = name.replace(bindRE, '');
  6363. value = parseFilters(value);
  6364. if (modifiers) {
  6365. if (modifiers.prop) {
  6366. isProp = true;
  6367. name = camelize(name);
  6368. if (name === 'innerHtml') { name = 'innerHTML'; }
  6369. }
  6370. if (modifiers.camel) {
  6371. name = camelize(name);
  6372. }
  6373. }
  6374. if (isProp || platformMustUseProp(el.tag, name)) {
  6375. addProp(el, name, value);
  6376. } else {
  6377. addAttr(el, name, value);
  6378. }
  6379. } else if (onRE.test(name)) { // v-on
  6380. name = name.replace(onRE, '');
  6381. addHandler(el, name, value, modifiers);
  6382. } else { // normal directives
  6383. name = name.replace(dirRE, '');
  6384. // parse arg
  6385. var argMatch = name.match(argRE);
  6386. if (argMatch && (arg = argMatch[1])) {
  6387. name = name.slice(0, -(arg.length + 1));
  6388. }
  6389. addDirective(el, name, rawName, value, arg, modifiers);
  6390. if ("development" !== 'production' && name === 'model') {
  6391. checkForAliasModel(el, value);
  6392. }
  6393. }
  6394. } else {
  6395. // literal attribute
  6396. {
  6397. var expression = parseText(value, delimiters);
  6398. if (expression) {
  6399. warn$1(
  6400. name + "=\"" + value + "\": " +
  6401. 'Interpolation inside attributes has been removed. ' +
  6402. 'Use v-bind or the colon shorthand instead. For example, ' +
  6403. 'instead of <div id="{{ val }}">, use <div :id="val">.'
  6404. );
  6405. }
  6406. }
  6407. addAttr(el, name, JSON.stringify(value));
  6408. }
  6409. }
  6410. }
  6411. function checkInFor (el) {
  6412. var parent = el;
  6413. while (parent) {
  6414. if (parent.for !== undefined) {
  6415. return true
  6416. }
  6417. parent = parent.parent;
  6418. }
  6419. return false
  6420. }
  6421. function parseModifiers (name) {
  6422. var match = name.match(modifierRE);
  6423. if (match) {
  6424. var ret = {};
  6425. match.forEach(function (m) { ret[m.slice(1)] = true; });
  6426. return ret
  6427. }
  6428. }
  6429. function makeAttrsMap (attrs) {
  6430. var map = {};
  6431. for (var i = 0, l = attrs.length; i < l; i++) {
  6432. if ("development" !== 'production' && map[attrs[i].name] && !isIE) {
  6433. warn$1('duplicate attribute: ' + attrs[i].name);
  6434. }
  6435. map[attrs[i].name] = attrs[i].value;
  6436. }
  6437. return map
  6438. }
  6439. function findPrevElement (children) {
  6440. var i = children.length;
  6441. while (i--) {
  6442. if (children[i].tag) { return children[i] }
  6443. }
  6444. }
  6445. function isForbiddenTag (el) {
  6446. return (
  6447. el.tag === 'style' ||
  6448. (el.tag === 'script' && (
  6449. !el.attrsMap.type ||
  6450. el.attrsMap.type === 'text/javascript'
  6451. ))
  6452. )
  6453. }
  6454. var ieNSBug = /^xmlns:NS\d+/;
  6455. var ieNSPrefix = /^NS\d+:/;
  6456. /* istanbul ignore next */
  6457. function guardIESVGBug (attrs) {
  6458. var res = [];
  6459. for (var i = 0; i < attrs.length; i++) {
  6460. var attr = attrs[i];
  6461. if (!ieNSBug.test(attr.name)) {
  6462. attr.name = attr.name.replace(ieNSPrefix, '');
  6463. res.push(attr);
  6464. }
  6465. }
  6466. return res
  6467. }
  6468. function checkForAliasModel (el, value) {
  6469. var _el = el;
  6470. while (_el) {
  6471. if (_el.for && _el.alias === value) {
  6472. warn$1(
  6473. "<" + (el.tag) + " v-model=\"" + value + "\">: " +
  6474. "You are binding v-model directly to a v-for iteration alias. " +
  6475. "This will not be able to modify the v-for source array because " +
  6476. "writing to the alias is like modifying a function local variable. " +
  6477. "Consider using an array of objects and use v-model on an object property instead."
  6478. );
  6479. }
  6480. _el = _el.parent;
  6481. }
  6482. }
  6483. /* */
  6484. var isStaticKey;
  6485. var isPlatformReservedTag;
  6486. var genStaticKeysCached = cached(genStaticKeys$1);
  6487. /**
  6488. * Goal of the optimizer: walk the generated template AST tree
  6489. * and detect sub-trees that are purely static, i.e. parts of
  6490. * the DOM that never needs to change.
  6491. *
  6492. * Once we detect these sub-trees, we can:
  6493. *
  6494. * 1. Hoist them into constants, so that we no longer need to
  6495. * create fresh nodes for them on each re-render;
  6496. * 2. Completely skip them in the patching process.
  6497. */
  6498. function optimize (root, options) {
  6499. if (!root) { return }
  6500. isStaticKey = genStaticKeysCached(options.staticKeys || '');
  6501. isPlatformReservedTag = options.isReservedTag || no;
  6502. // first pass: mark all non-static nodes.
  6503. markStatic(root);
  6504. // second pass: mark static roots.
  6505. markStaticRoots(root, false);
  6506. }
  6507. function genStaticKeys$1 (keys) {
  6508. return makeMap(
  6509. 'type,tag,attrsList,attrsMap,plain,parent,children,attrs' +
  6510. (keys ? ',' + keys : '')
  6511. )
  6512. }
  6513. function markStatic (node) {
  6514. node.static = isStatic(node);
  6515. if (node.type === 1) {
  6516. // do not make component slot content static. this avoids
  6517. // 1. components not able to mutate slot nodes
  6518. // 2. static slot content fails for hot-reloading
  6519. if (
  6520. !isPlatformReservedTag(node.tag) &&
  6521. node.tag !== 'slot' &&
  6522. node.attrsMap['inline-template'] == null
  6523. ) {
  6524. return
  6525. }
  6526. for (var i = 0, l = node.children.length; i < l; i++) {
  6527. var child = node.children[i];
  6528. markStatic(child);
  6529. if (!child.static) {
  6530. node.static = false;
  6531. }
  6532. }
  6533. }
  6534. }
  6535. function markStaticRoots (node, isInFor) {
  6536. if (node.type === 1) {
  6537. if (node.static || node.once) {
  6538. node.staticInFor = isInFor;
  6539. }
  6540. // For a node to qualify as a static root, it should have children that
  6541. // are not just static text. Otherwise the cost of hoisting out will
  6542. // outweigh the benefits and it's better off to just always render it fresh.
  6543. if (node.static && node.children.length && !(
  6544. node.children.length === 1 &&
  6545. node.children[0].type === 3
  6546. )) {
  6547. node.staticRoot = true;
  6548. return
  6549. } else {
  6550. node.staticRoot = false;
  6551. }
  6552. if (node.children) {
  6553. for (var i = 0, l = node.children.length; i < l; i++) {
  6554. markStaticRoots(node.children[i], isInFor || !!node.for);
  6555. }
  6556. }
  6557. if (node.ifConditions) {
  6558. walkThroughConditionsBlocks(node.ifConditions, isInFor);
  6559. }
  6560. }
  6561. }
  6562. function walkThroughConditionsBlocks (conditionBlocks, isInFor) {
  6563. for (var i = 1, len = conditionBlocks.length; i < len; i++) {
  6564. markStaticRoots(conditionBlocks[i].block, isInFor);
  6565. }
  6566. }
  6567. function isStatic (node) {
  6568. if (node.type === 2) { // expression
  6569. return false
  6570. }
  6571. if (node.type === 3) { // text
  6572. return true
  6573. }
  6574. return !!(node.pre || (
  6575. !node.hasBindings && // no dynamic bindings
  6576. !node.if && !node.for && // not v-if or v-for or v-else
  6577. !isBuiltInTag(node.tag) && // not a built-in
  6578. isPlatformReservedTag(node.tag) && // not a component
  6579. !isDirectChildOfTemplateFor(node) &&
  6580. Object.keys(node).every(isStaticKey)
  6581. ))
  6582. }
  6583. function isDirectChildOfTemplateFor (node) {
  6584. while (node.parent) {
  6585. node = node.parent;
  6586. if (node.tag !== 'template') {
  6587. return false
  6588. }
  6589. if (node.for) {
  6590. return true
  6591. }
  6592. }
  6593. return false
  6594. }
  6595. /* */
  6596. var fnExpRE = /^\s*([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
  6597. var simplePathRE = /^\s*[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?']|\[".*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*\s*$/;
  6598. // keyCode aliases
  6599. var keyCodes = {
  6600. esc: 27,
  6601. tab: 9,
  6602. enter: 13,
  6603. space: 32,
  6604. up: 38,
  6605. left: 37,
  6606. right: 39,
  6607. down: 40,
  6608. 'delete': [8, 46]
  6609. };
  6610. var modifierCode = {
  6611. stop: '$event.stopPropagation();',
  6612. prevent: '$event.preventDefault();',
  6613. self: 'if($event.target !== $event.currentTarget)return;',
  6614. ctrl: 'if(!$event.ctrlKey)return;',
  6615. shift: 'if(!$event.shiftKey)return;',
  6616. alt: 'if(!$event.altKey)return;',
  6617. meta: 'if(!$event.metaKey)return;'
  6618. };
  6619. function genHandlers (events, native) {
  6620. var res = native ? 'nativeOn:{' : 'on:{';
  6621. for (var name in events) {
  6622. res += "\"" + name + "\":" + (genHandler(name, events[name])) + ",";
  6623. }
  6624. return res.slice(0, -1) + '}'
  6625. }
  6626. function genHandler (
  6627. name,
  6628. handler
  6629. ) {
  6630. if (!handler) {
  6631. return 'function(){}'
  6632. } else if (Array.isArray(handler)) {
  6633. return ("[" + (handler.map(function (handler) { return genHandler(name, handler); }).join(',')) + "]")
  6634. } else if (!handler.modifiers) {
  6635. return fnExpRE.test(handler.value) || simplePathRE.test(handler.value)
  6636. ? handler.value
  6637. : ("function($event){" + (handler.value) + "}")
  6638. } else {
  6639. var code = '';
  6640. var keys = [];
  6641. for (var key in handler.modifiers) {
  6642. if (modifierCode[key]) {
  6643. code += modifierCode[key];
  6644. } else {
  6645. keys.push(key);
  6646. }
  6647. }
  6648. if (keys.length) {
  6649. code = genKeyFilter(keys) + code;
  6650. }
  6651. var handlerCode = simplePathRE.test(handler.value)
  6652. ? handler.value + '($event)'
  6653. : handler.value;
  6654. return 'function($event){' + code + handlerCode + '}'
  6655. }
  6656. }
  6657. function genKeyFilter (keys) {
  6658. return ("if(" + (keys.map(genFilterCode).join('&&')) + ")return;")
  6659. }
  6660. function genFilterCode (key) {
  6661. var keyVal = parseInt(key, 10);
  6662. if (keyVal) {
  6663. return ("$event.keyCode!==" + keyVal)
  6664. }
  6665. var alias = keyCodes[key];
  6666. return ("_k($event.keyCode," + (JSON.stringify(key)) + (alias ? ',' + JSON.stringify(alias) : '') + ")")
  6667. }
  6668. /* */
  6669. function bind$2 (el, dir) {
  6670. el.wrapData = function (code) {
  6671. return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
  6672. };
  6673. }
  6674. var baseDirectives = {
  6675. bind: bind$2,
  6676. cloak: noop
  6677. };
  6678. /* */
  6679. // configurable state
  6680. var warn$2;
  6681. var transforms$1;
  6682. var dataGenFns;
  6683. var platformDirectives$1;
  6684. var staticRenderFns;
  6685. var onceCount;
  6686. var currentOptions;
  6687. function generate (
  6688. ast,
  6689. options
  6690. ) {
  6691. // save previous staticRenderFns so generate calls can be nested
  6692. var prevStaticRenderFns = staticRenderFns;
  6693. var currentStaticRenderFns = staticRenderFns = [];
  6694. var prevOnceCount = onceCount;
  6695. onceCount = 0;
  6696. currentOptions = options;
  6697. warn$2 = options.warn || baseWarn;
  6698. transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
  6699. dataGenFns = pluckModuleFunction(options.modules, 'genData');
  6700. platformDirectives$1 = options.directives || {};
  6701. var code = ast ? genElement(ast) : '_h("div")';
  6702. staticRenderFns = prevStaticRenderFns;
  6703. onceCount = prevOnceCount;
  6704. return {
  6705. render: ("with(this){return " + code + "}"),
  6706. staticRenderFns: currentStaticRenderFns
  6707. }
  6708. }
  6709. function genElement (el) {
  6710. if (el.staticRoot && !el.staticProcessed) {
  6711. return genStatic(el)
  6712. } else if (el.once && !el.onceProcessed) {
  6713. return genOnce(el)
  6714. } else if (el.for && !el.forProcessed) {
  6715. return genFor(el)
  6716. } else if (el.if && !el.ifProcessed) {
  6717. return genIf(el)
  6718. } else if (el.tag === 'template' && !el.slotTarget) {
  6719. return genChildren(el) || 'void 0'
  6720. } else if (el.tag === 'slot') {
  6721. return genSlot(el)
  6722. } else {
  6723. // component or element
  6724. var code;
  6725. if (el.component) {
  6726. code = genComponent(el.component, el);
  6727. } else {
  6728. var data = el.plain ? undefined : genData(el);
  6729. var children = el.inlineTemplate ? null : genChildren(el);
  6730. code = "_h('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
  6731. }
  6732. // module transforms
  6733. for (var i = 0; i < transforms$1.length; i++) {
  6734. code = transforms$1[i](el, code);
  6735. }
  6736. return code
  6737. }
  6738. }
  6739. // hoist static sub-trees out
  6740. function genStatic (el) {
  6741. el.staticProcessed = true;
  6742. staticRenderFns.push(("with(this){return " + (genElement(el)) + "}"));
  6743. return ("_m(" + (staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
  6744. }
  6745. // v-once
  6746. function genOnce (el) {
  6747. el.onceProcessed = true;
  6748. if (el.if && !el.ifProcessed) {
  6749. return genIf(el)
  6750. } else if (el.staticInFor) {
  6751. var key = '';
  6752. var parent = el.parent;
  6753. while (parent) {
  6754. if (parent.for) {
  6755. key = parent.key;
  6756. break
  6757. }
  6758. parent = parent.parent;
  6759. }
  6760. if (!key) {
  6761. "development" !== 'production' && warn$2(
  6762. "v-once can only be used inside v-for that is keyed. "
  6763. );
  6764. return genElement(el)
  6765. }
  6766. return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
  6767. } else {
  6768. return genStatic(el)
  6769. }
  6770. }
  6771. function genIf (el) {
  6772. el.ifProcessed = true; // avoid recursion
  6773. return genIfConditions(el.ifConditions.slice())
  6774. }
  6775. function genIfConditions (conditions) {
  6776. if (!conditions.length) {
  6777. return '_e()'
  6778. }
  6779. var condition = conditions.shift();
  6780. if (condition.exp) {
  6781. return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions)))
  6782. } else {
  6783. return ("" + (genTernaryExp(condition.block)))
  6784. }
  6785. // v-if with v-once should generate code like (a)?_m(0):_m(1)
  6786. function genTernaryExp (el) {
  6787. return el.once ? genOnce(el) : genElement(el)
  6788. }
  6789. }
  6790. function genFor (el) {
  6791. var exp = el.for;
  6792. var alias = el.alias;
  6793. var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
  6794. var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
  6795. el.forProcessed = true; // avoid recursion
  6796. return "_l((" + exp + ")," +
  6797. "function(" + alias + iterator1 + iterator2 + "){" +
  6798. "return " + (genElement(el)) +
  6799. '})'
  6800. }
  6801. function genData (el) {
  6802. var data = '{';
  6803. // directives first.
  6804. // directives may mutate the el's other properties before they are generated.
  6805. var dirs = genDirectives(el);
  6806. if (dirs) { data += dirs + ','; }
  6807. // key
  6808. if (el.key) {
  6809. data += "key:" + (el.key) + ",";
  6810. }
  6811. // ref
  6812. if (el.ref) {
  6813. data += "ref:" + (el.ref) + ",";
  6814. }
  6815. if (el.refInFor) {
  6816. data += "refInFor:true,";
  6817. }
  6818. // pre
  6819. if (el.pre) {
  6820. data += "pre:true,";
  6821. }
  6822. // record original tag name for components using "is" attribute
  6823. if (el.component) {
  6824. data += "tag:\"" + (el.tag) + "\",";
  6825. }
  6826. // module data generation functions
  6827. for (var i = 0; i < dataGenFns.length; i++) {
  6828. data += dataGenFns[i](el);
  6829. }
  6830. // attributes
  6831. if (el.attrs) {
  6832. data += "attrs:{" + (genProps(el.attrs)) + "},";
  6833. }
  6834. // DOM props
  6835. if (el.props) {
  6836. data += "domProps:{" + (genProps(el.props)) + "},";
  6837. }
  6838. // event handlers
  6839. if (el.events) {
  6840. data += (genHandlers(el.events)) + ",";
  6841. }
  6842. if (el.nativeEvents) {
  6843. data += (genHandlers(el.nativeEvents, true)) + ",";
  6844. }
  6845. // slot target
  6846. if (el.slotTarget) {
  6847. data += "slot:" + (el.slotTarget) + ",";
  6848. }
  6849. // scoped slots
  6850. if (el.scopedSlots) {
  6851. data += (genScopedSlots(el.scopedSlots)) + ",";
  6852. }
  6853. // inline-template
  6854. if (el.inlineTemplate) {
  6855. var inlineTemplate = genInlineTemplate(el);
  6856. if (inlineTemplate) {
  6857. data += inlineTemplate + ",";
  6858. }
  6859. }
  6860. data = data.replace(/,$/, '') + '}';
  6861. // v-bind data wrap
  6862. if (el.wrapData) {
  6863. data = el.wrapData(data);
  6864. }
  6865. return data
  6866. }
  6867. function genDirectives (el) {
  6868. var dirs = el.directives;
  6869. if (!dirs) { return }
  6870. var res = 'directives:[';
  6871. var hasRuntime = false;
  6872. var i, l, dir, needRuntime;
  6873. for (i = 0, l = dirs.length; i < l; i++) {
  6874. dir = dirs[i];
  6875. needRuntime = true;
  6876. var gen = platformDirectives$1[dir.name] || baseDirectives[dir.name];
  6877. if (gen) {
  6878. // compile-time directive that manipulates AST.
  6879. // returns true if it also needs a runtime counterpart.
  6880. needRuntime = !!gen(el, dir, warn$2);
  6881. }
  6882. if (needRuntime) {
  6883. hasRuntime = true;
  6884. res += "{name:\"" + (dir.name) + "\",rawName:\"" + (dir.rawName) + "\"" + (dir.value ? (",value:(" + (dir.value) + "),expression:" + (JSON.stringify(dir.value))) : '') + (dir.arg ? (",arg:\"" + (dir.arg) + "\"") : '') + (dir.modifiers ? (",modifiers:" + (JSON.stringify(dir.modifiers))) : '') + "},";
  6885. }
  6886. }
  6887. if (hasRuntime) {
  6888. return res.slice(0, -1) + ']'
  6889. }
  6890. }
  6891. function genInlineTemplate (el) {
  6892. var ast = el.children[0];
  6893. if ("development" !== 'production' && (
  6894. el.children.length > 1 || ast.type !== 1
  6895. )) {
  6896. warn$2('Inline-template components must have exactly one child element.');
  6897. }
  6898. if (ast.type === 1) {
  6899. var inlineRenderFns = generate(ast, currentOptions);
  6900. return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
  6901. }
  6902. }
  6903. function genScopedSlots (slots) {
  6904. return ("scopedSlots:{" + (Object.keys(slots).map(function (key) { return genScopedSlot(key, slots[key]); }).join(',')) + "}")
  6905. }
  6906. function genScopedSlot (key, el) {
  6907. return key + ":function(" + (String(el.attrsMap.scope)) + "){" +
  6908. "return " + (el.tag === 'template'
  6909. ? genChildren(el) || 'void 0'
  6910. : genElement(el)) + "}"
  6911. }
  6912. function genChildren (el) {
  6913. if (el.children.length) {
  6914. return '[' + el.children.map(genNode).join(',') + ']'
  6915. }
  6916. }
  6917. function genNode (node) {
  6918. if (node.type === 1) {
  6919. return genElement(node)
  6920. } else {
  6921. return genText(node)
  6922. }
  6923. }
  6924. function genText (text) {
  6925. return text.type === 2
  6926. ? text.expression // no need for () because already wrapped in _s()
  6927. : transformSpecialNewlines(JSON.stringify(text.text))
  6928. }
  6929. function genSlot (el) {
  6930. var slotName = el.slotName || '"default"';
  6931. var children = genChildren(el);
  6932. return ("_t(" + slotName + (children ? ("," + children) : '') + (el.attrs ? ((children ? '' : ',null') + ",{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}") : '') + ")")
  6933. }
  6934. // componentName is el.component, take it as argument to shun flow's pessimistic refinement
  6935. function genComponent (componentName, el) {
  6936. var children = el.inlineTemplate ? null : genChildren(el);
  6937. return ("_h(" + componentName + "," + (genData(el)) + (children ? ("," + children) : '') + ")")
  6938. }
  6939. function genProps (props) {
  6940. var res = '';
  6941. for (var i = 0; i < props.length; i++) {
  6942. var prop = props[i];
  6943. res += "\"" + (prop.name) + "\":" + (transformSpecialNewlines(prop.value)) + ",";
  6944. }
  6945. return res.slice(0, -1)
  6946. }
  6947. // #3895, #4268
  6948. function transformSpecialNewlines (text) {
  6949. return text
  6950. .replace(/\u2028/g, '\\u2028')
  6951. .replace(/\u2029/g, '\\u2029')
  6952. }
  6953. /* */
  6954. /**
  6955. * Compile a template.
  6956. */
  6957. function compile$1 (
  6958. template,
  6959. options
  6960. ) {
  6961. var ast = parse(template.trim(), options);
  6962. optimize(ast, options);
  6963. var code = generate(ast, options);
  6964. return {
  6965. ast: ast,
  6966. render: code.render,
  6967. staticRenderFns: code.staticRenderFns
  6968. }
  6969. }
  6970. /* */
  6971. // operators like typeof, instanceof and in are allowed
  6972. var prohibitedKeywordRE = new RegExp('\\b' + (
  6973. 'do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
  6974. 'super,throw,while,yield,delete,export,import,return,switch,default,' +
  6975. 'extends,finally,continue,debugger,function,arguments'
  6976. ).split(',').join('\\b|\\b') + '\\b');
  6977. // check valid identifier for v-for
  6978. var identRE = /[A-Za-z_$][\w$]*/;
  6979. // strip strings in expressions
  6980. var stripStringRE = /'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*\$\{|\}(?:[^`\\]|\\.)*`|`(?:[^`\\]|\\.)*`/g;
  6981. // detect problematic expressions in a template
  6982. function detectErrors (ast) {
  6983. var errors = [];
  6984. if (ast) {
  6985. checkNode(ast, errors);
  6986. }
  6987. return errors
  6988. }
  6989. function checkNode (node, errors) {
  6990. if (node.type === 1) {
  6991. for (var name in node.attrsMap) {
  6992. if (dirRE.test(name)) {
  6993. var value = node.attrsMap[name];
  6994. if (value) {
  6995. if (name === 'v-for') {
  6996. checkFor(node, ("v-for=\"" + value + "\""), errors);
  6997. } else {
  6998. checkExpression(value, (name + "=\"" + value + "\""), errors);
  6999. }
  7000. }
  7001. }
  7002. }
  7003. if (node.children) {
  7004. for (var i = 0; i < node.children.length; i++) {
  7005. checkNode(node.children[i], errors);
  7006. }
  7007. }
  7008. } else if (node.type === 2) {
  7009. checkExpression(node.expression, node.text, errors);
  7010. }
  7011. }
  7012. function checkFor (node, text, errors) {
  7013. checkExpression(node.for || '', text, errors);
  7014. checkIdentifier(node.alias, 'v-for alias', text, errors);
  7015. checkIdentifier(node.iterator1, 'v-for iterator', text, errors);
  7016. checkIdentifier(node.iterator2, 'v-for iterator', text, errors);
  7017. }
  7018. function checkIdentifier (ident, type, text, errors) {
  7019. if (typeof ident === 'string' && !identRE.test(ident)) {
  7020. errors.push(("- invalid " + type + " \"" + ident + "\" in expression: " + text));
  7021. }
  7022. }
  7023. function checkExpression (exp, text, errors) {
  7024. try {
  7025. new Function(("return " + exp));
  7026. } catch (e) {
  7027. var keywordMatch = exp.replace(stripStringRE, '').match(prohibitedKeywordRE);
  7028. if (keywordMatch) {
  7029. errors.push(
  7030. "- avoid using JavaScript keyword as property name: " +
  7031. "\"" + (keywordMatch[0]) + "\" in expression " + text
  7032. );
  7033. } else {
  7034. errors.push(("- invalid expression: " + text));
  7035. }
  7036. }
  7037. }
  7038. /* */
  7039. function transformNode (el, options) {
  7040. var warn = options.warn || baseWarn;
  7041. var staticClass = getAndRemoveAttr(el, 'class');
  7042. if ("development" !== 'production' && staticClass) {
  7043. var expression = parseText(staticClass, options.delimiters);
  7044. if (expression) {
  7045. warn(
  7046. "class=\"" + staticClass + "\": " +
  7047. 'Interpolation inside attributes has been removed. ' +
  7048. 'Use v-bind or the colon shorthand instead. For example, ' +
  7049. 'instead of <div class="{{ val }}">, use <div :class="val">.'
  7050. );
  7051. }
  7052. }
  7053. if (staticClass) {
  7054. el.staticClass = JSON.stringify(staticClass);
  7055. }
  7056. var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
  7057. if (classBinding) {
  7058. el.classBinding = classBinding;
  7059. }
  7060. }
  7061. function genData$1 (el) {
  7062. var data = '';
  7063. if (el.staticClass) {
  7064. data += "staticClass:" + (el.staticClass) + ",";
  7065. }
  7066. if (el.classBinding) {
  7067. data += "class:" + (el.classBinding) + ",";
  7068. }
  7069. return data
  7070. }
  7071. var klass$1 = {
  7072. staticKeys: ['staticClass'],
  7073. transformNode: transformNode,
  7074. genData: genData$1
  7075. };
  7076. /* */
  7077. function transformNode$1 (el, options) {
  7078. var warn = options.warn || baseWarn;
  7079. var staticStyle = getAndRemoveAttr(el, 'style');
  7080. if (staticStyle) {
  7081. /* istanbul ignore if */
  7082. {
  7083. var expression = parseText(staticStyle, options.delimiters);
  7084. if (expression) {
  7085. warn(
  7086. "style=\"" + staticStyle + "\": " +
  7087. 'Interpolation inside attributes has been removed. ' +
  7088. 'Use v-bind or the colon shorthand instead. For example, ' +
  7089. 'instead of <div style="{{ val }}">, use <div :style="val">.'
  7090. );
  7091. }
  7092. }
  7093. el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
  7094. }
  7095. var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
  7096. if (styleBinding) {
  7097. el.styleBinding = styleBinding;
  7098. }
  7099. }
  7100. function genData$2 (el) {
  7101. var data = '';
  7102. if (el.staticStyle) {
  7103. data += "staticStyle:" + (el.staticStyle) + ",";
  7104. }
  7105. if (el.styleBinding) {
  7106. data += "style:(" + (el.styleBinding) + "),";
  7107. }
  7108. return data
  7109. }
  7110. var style$1 = {
  7111. staticKeys: ['staticStyle'],
  7112. transformNode: transformNode$1,
  7113. genData: genData$2
  7114. };
  7115. var modules$1 = [
  7116. klass$1,
  7117. style$1
  7118. ];
  7119. /* */
  7120. var warn$3;
  7121. function model$1 (
  7122. el,
  7123. dir,
  7124. _warn
  7125. ) {
  7126. warn$3 = _warn;
  7127. var value = dir.value;
  7128. var modifiers = dir.modifiers;
  7129. var tag = el.tag;
  7130. var type = el.attrsMap.type;
  7131. {
  7132. var dynamicType = el.attrsMap['v-bind:type'] || el.attrsMap[':type'];
  7133. if (tag === 'input' && dynamicType) {
  7134. warn$3(
  7135. "<input :type=\"" + dynamicType + "\" v-model=\"" + value + "\">:\n" +
  7136. "v-model does not support dynamic input types. Use v-if branches instead."
  7137. );
  7138. }
  7139. }
  7140. if (tag === 'select') {
  7141. genSelect(el, value, modifiers);
  7142. } else if (tag === 'input' && type === 'checkbox') {
  7143. genCheckboxModel(el, value, modifiers);
  7144. } else if (tag === 'input' && type === 'radio') {
  7145. genRadioModel(el, value, modifiers);
  7146. } else {
  7147. genDefaultModel(el, value, modifiers);
  7148. }
  7149. // ensure runtime directive metadata
  7150. return true
  7151. }
  7152. function genCheckboxModel (
  7153. el,
  7154. value,
  7155. modifiers
  7156. ) {
  7157. if ("development" !== 'production' &&
  7158. el.attrsMap.checked != null) {
  7159. warn$3(
  7160. "<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
  7161. "inline checked attributes will be ignored when using v-model. " +
  7162. 'Declare initial values in the component\'s data option instead.'
  7163. );
  7164. }
  7165. var number = modifiers && modifiers.number;
  7166. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7167. var trueValueBinding = getBindingAttr(el, 'true-value') || 'true';
  7168. var falseValueBinding = getBindingAttr(el, 'false-value') || 'false';
  7169. addProp(el, 'checked',
  7170. "Array.isArray(" + value + ")" +
  7171. "?_i(" + value + "," + valueBinding + ")>-1" +
  7172. ":_q(" + value + "," + trueValueBinding + ")"
  7173. );
  7174. addHandler(el, 'change',
  7175. "var $$a=" + value + "," +
  7176. '$$el=$event.target,' +
  7177. "$$c=$$el.checked?(" + trueValueBinding + "):(" + falseValueBinding + ");" +
  7178. 'if(Array.isArray($$a)){' +
  7179. "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
  7180. '$$i=_i($$a,$$v);' +
  7181. "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
  7182. "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
  7183. "}else{" + value + "=$$c}",
  7184. null, true
  7185. );
  7186. }
  7187. function genRadioModel (
  7188. el,
  7189. value,
  7190. modifiers
  7191. ) {
  7192. if ("development" !== 'production' &&
  7193. el.attrsMap.checked != null) {
  7194. warn$3(
  7195. "<" + (el.tag) + " v-model=\"" + value + "\" checked>:\n" +
  7196. "inline checked attributes will be ignored when using v-model. " +
  7197. 'Declare initial values in the component\'s data option instead.'
  7198. );
  7199. }
  7200. var number = modifiers && modifiers.number;
  7201. var valueBinding = getBindingAttr(el, 'value') || 'null';
  7202. valueBinding = number ? ("_n(" + valueBinding + ")") : valueBinding;
  7203. addProp(el, 'checked', ("_q(" + value + "," + valueBinding + ")"));
  7204. addHandler(el, 'change', genAssignmentCode(value, valueBinding), null, true);
  7205. }
  7206. function genDefaultModel (
  7207. el,
  7208. value,
  7209. modifiers
  7210. ) {
  7211. {
  7212. if (el.tag === 'input' && el.attrsMap.value) {
  7213. warn$3(
  7214. "<" + (el.tag) + " v-model=\"" + value + "\" value=\"" + (el.attrsMap.value) + "\">:\n" +
  7215. 'inline value attributes will be ignored when using v-model. ' +
  7216. 'Declare initial values in the component\'s data option instead.'
  7217. );
  7218. }
  7219. if (el.tag === 'textarea' && el.children.length) {
  7220. warn$3(
  7221. "<textarea v-model=\"" + value + "\">:\n" +
  7222. 'inline content inside <textarea> will be ignored when using v-model. ' +
  7223. 'Declare initial values in the component\'s data option instead.'
  7224. );
  7225. }
  7226. }
  7227. var type = el.attrsMap.type;
  7228. var ref = modifiers || {};
  7229. var lazy = ref.lazy;
  7230. var number = ref.number;
  7231. var trim = ref.trim;
  7232. var event = lazy || (isIE && type === 'range') ? 'change' : 'input';
  7233. var needCompositionGuard = !lazy && type !== 'range';
  7234. var isNative = el.tag === 'input' || el.tag === 'textarea';
  7235. var valueExpression = isNative
  7236. ? ("$event.target.value" + (trim ? '.trim()' : ''))
  7237. : trim ? "(typeof $event === 'string' ? $event.trim() : $event)" : "$event";
  7238. valueExpression = number || type === 'number'
  7239. ? ("_n(" + valueExpression + ")")
  7240. : valueExpression;
  7241. var code = genAssignmentCode(value, valueExpression);
  7242. if (isNative && needCompositionGuard) {
  7243. code = "if($event.target.composing)return;" + code;
  7244. }
  7245. // inputs with type="file" are read only and setting the input's
  7246. // value will throw an error.
  7247. if ("development" !== 'production' &&
  7248. type === 'file') {
  7249. warn$3(
  7250. "<" + (el.tag) + " v-model=\"" + value + "\" type=\"file\">:\n" +
  7251. "File inputs are read only. Use a v-on:change listener instead."
  7252. );
  7253. }
  7254. addProp(el, 'value', isNative ? ("_s(" + value + ")") : ("(" + value + ")"));
  7255. addHandler(el, event, code, null, true);
  7256. }
  7257. function genSelect (
  7258. el,
  7259. value,
  7260. modifiers
  7261. ) {
  7262. {
  7263. el.children.some(checkOptionWarning);
  7264. }
  7265. var number = modifiers && modifiers.number;
  7266. var assignment = "Array.prototype.filter" +
  7267. ".call($event.target.options,function(o){return o.selected})" +
  7268. ".map(function(o){var val = \"_value\" in o ? o._value : o.value;" +
  7269. "return " + (number ? '_n(val)' : 'val') + "})" +
  7270. (el.attrsMap.multiple == null ? '[0]' : '');
  7271. var code = genAssignmentCode(value, assignment);
  7272. addHandler(el, 'change', code, null, true);
  7273. }
  7274. function checkOptionWarning (option) {
  7275. if (option.type === 1 &&
  7276. option.tag === 'option' &&
  7277. option.attrsMap.selected != null) {
  7278. warn$3(
  7279. "<select v-model=\"" + (option.parent.attrsMap['v-model']) + "\">:\n" +
  7280. 'inline selected attributes on <option> will be ignored when using v-model. ' +
  7281. 'Declare initial values in the component\'s data option instead.'
  7282. );
  7283. return true
  7284. }
  7285. return false
  7286. }
  7287. function genAssignmentCode (value, assignment) {
  7288. var modelRs = parseModel(value);
  7289. if (modelRs.idx === null) {
  7290. return (value + "=" + assignment)
  7291. } else {
  7292. return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
  7293. "if (!Array.isArray($$exp)){" +
  7294. value + "=" + assignment + "}" +
  7295. "else{$$exp.splice($$idx, 1, " + assignment + ")}"
  7296. }
  7297. }
  7298. /* */
  7299. function text (el, dir) {
  7300. if (dir.value) {
  7301. addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
  7302. }
  7303. }
  7304. /* */
  7305. function html (el, dir) {
  7306. if (dir.value) {
  7307. addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
  7308. }
  7309. }
  7310. var directives$1 = {
  7311. model: model$1,
  7312. text: text,
  7313. html: html
  7314. };
  7315. /* */
  7316. var cache = Object.create(null);
  7317. var baseOptions = {
  7318. expectHTML: true,
  7319. modules: modules$1,
  7320. staticKeys: genStaticKeys(modules$1),
  7321. directives: directives$1,
  7322. isReservedTag: isReservedTag,
  7323. isUnaryTag: isUnaryTag,
  7324. mustUseProp: mustUseProp,
  7325. getTagNamespace: getTagNamespace,
  7326. isPreTag: isPreTag
  7327. };
  7328. function compile$$1 (
  7329. template,
  7330. options
  7331. ) {
  7332. options = options
  7333. ? extend(extend({}, baseOptions), options)
  7334. : baseOptions;
  7335. return compile$1(template, options)
  7336. }
  7337. function compileToFunctions (
  7338. template,
  7339. options,
  7340. vm
  7341. ) {
  7342. var _warn = (options && options.warn) || warn;
  7343. // detect possible CSP restriction
  7344. /* istanbul ignore if */
  7345. {
  7346. try {
  7347. new Function('return 1');
  7348. } catch (e) {
  7349. if (e.toString().match(/unsafe-eval|CSP/)) {
  7350. _warn(
  7351. 'It seems you are using the standalone build of Vue.js in an ' +
  7352. 'environment with Content Security Policy that prohibits unsafe-eval. ' +
  7353. 'The template compiler cannot work in this environment. Consider ' +
  7354. 'relaxing the policy to allow unsafe-eval or pre-compiling your ' +
  7355. 'templates into render functions.'
  7356. );
  7357. }
  7358. }
  7359. }
  7360. var key = options && options.delimiters
  7361. ? String(options.delimiters) + template
  7362. : template;
  7363. if (cache[key]) {
  7364. return cache[key]
  7365. }
  7366. var res = {};
  7367. var compiled = compile$$1(template, options);
  7368. res.render = makeFunction(compiled.render);
  7369. var l = compiled.staticRenderFns.length;
  7370. res.staticRenderFns = new Array(l);
  7371. for (var i = 0; i < l; i++) {
  7372. res.staticRenderFns[i] = makeFunction(compiled.staticRenderFns[i]);
  7373. }
  7374. {
  7375. if (res.render === noop || res.staticRenderFns.some(function (fn) { return fn === noop; })) {
  7376. _warn(
  7377. "failed to compile template:\n\n" + template + "\n\n" +
  7378. detectErrors(compiled.ast).join('\n') +
  7379. '\n\n',
  7380. vm
  7381. );
  7382. }
  7383. }
  7384. return (cache[key] = res)
  7385. }
  7386. function makeFunction (code) {
  7387. try {
  7388. return new Function(code)
  7389. } catch (e) {
  7390. return noop
  7391. }
  7392. }
  7393. /* */
  7394. var idToTemplate = cached(function (id) {
  7395. var el = query(id);
  7396. return el && el.innerHTML
  7397. });
  7398. var mount = Vue$3.prototype.$mount;
  7399. Vue$3.prototype.$mount = function (
  7400. el,
  7401. hydrating
  7402. ) {
  7403. el = el && query(el);
  7404. /* istanbul ignore if */
  7405. if (el === document.body || el === document.documentElement) {
  7406. "development" !== 'production' && warn(
  7407. "Do not mount Vue to <html> or <body> - mount to normal elements instead."
  7408. );
  7409. return this
  7410. }
  7411. var options = this.$options;
  7412. // resolve template/el and convert to render function
  7413. if (!options.render) {
  7414. var template = options.template;
  7415. if (template) {
  7416. if (typeof template === 'string') {
  7417. if (template.charAt(0) === '#') {
  7418. template = idToTemplate(template);
  7419. /* istanbul ignore if */
  7420. if ("development" !== 'production' && !template) {
  7421. warn(
  7422. ("Template element not found or is empty: " + (options.template)),
  7423. this
  7424. );
  7425. }
  7426. }
  7427. } else if (template.nodeType) {
  7428. template = template.innerHTML;
  7429. } else {
  7430. {
  7431. warn('invalid template option:' + template, this);
  7432. }
  7433. return this
  7434. }
  7435. } else if (el) {
  7436. template = getOuterHTML(el);
  7437. }
  7438. if (template) {
  7439. var ref = compileToFunctions(template, {
  7440. warn: warn,
  7441. shouldDecodeNewlines: shouldDecodeNewlines,
  7442. delimiters: options.delimiters
  7443. }, this);
  7444. var render = ref.render;
  7445. var staticRenderFns = ref.staticRenderFns;
  7446. options.render = render;
  7447. options.staticRenderFns = staticRenderFns;
  7448. }
  7449. }
  7450. return mount.call(this, el, hydrating)
  7451. };
  7452. /**
  7453. * Get outerHTML of elements, taking care
  7454. * of SVG elements in IE as well.
  7455. */
  7456. function getOuterHTML (el) {
  7457. if (el.outerHTML) {
  7458. return el.outerHTML
  7459. } else {
  7460. var container = document.createElement('div');
  7461. container.appendChild(el.cloneNode(true));
  7462. return container.innerHTML
  7463. }
  7464. }
  7465. Vue$3.compile = compileToFunctions;
  7466. return Vue$3;
  7467. })));