From 8e145ed15776bf8cfe5ce9df598cf7170490aa07 Mon Sep 17 00:00:00 2001 From: Sergey Goliney Date: Thu, 13 Apr 2017 00:22:37 +0300 Subject: [PATCH] feat(client): Introduce Vuejs Convert sidebar logic to vuejs Closes #18 --- .eslintrc | 10 +- README.md | 6 +- example/source/10__Item 1/index.html | 2 +- .../10__Nested Folder 1/10__Item 2/index.html | 2 +- .../source/20__Folder 1/20__Item 3/index.html | 2 +- .../20__Nested Folder 2/10__Item 4/index.html | 2 +- example/source/30__Item 5/index.html | 2 +- lib/coderoom.js | 22 +- lib/room.class.js | 11 + lib/settings.js | 1 + lib/templates/default/scss/_sidebar.scss | 17 +- lib/templates/default/static/js/base.js | 42 ++-- lib/templates/default/static/js/search.js | 205 +++++++----------- .../default/static/js/vendor/vue-2.2.0.min.js | 8 + lib/templates/default/tpls/index.html | 40 +++- lib/templates/default/tpls/partials/menu.html | 4 +- package.json | 2 +- test/room.class.spec.js | 53 ++++- 18 files changed, 237 insertions(+), 194 deletions(-) create mode 100644 lib/templates/default/static/js/vendor/vue-2.2.0.min.js diff --git a/.eslintrc b/.eslintrc index 25a2fd9..8547209 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,6 +8,11 @@ "es6": true }, "extends": "eslint:recommended", + "parserOptions": { + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } + }, "rules": { "comma-dangle": [ "error", @@ -32,6 +37,9 @@ "no-console": "off" }, "globals": { - "ace": true + "ace": true, + "Vue": true, + "ROOT": true, + "DEPTH": true } } \ No newline at end of file diff --git a/README.md b/README.md index 0d4d9ea..80ce68f 100644 --- a/README.md +++ b/README.md @@ -93,9 +93,9 @@ Example: ``` ### Complex preview -If you want to include to preview more than just html, you have to create a folder with `index.html` in it. If you -place any css or javascript files into that folder, they will become a part of a "room", and you will be able to -switch among them on live presentation. +If you want to include in preview more than just html, you have to create a folder with `index.html` in it. Place any +css or javascript files into that folder, they will become a part of a "room", and you'll be able to switch between +them on live presentation. ## Automation - [grunt-coderoom](https://github.com/goliney/grunt-coderoom) diff --git a/example/source/10__Item 1/index.html b/example/source/10__Item 1/index.html index 92cd1d9..326a7b4 100644 --- a/example/source/10__Item 1/index.html +++ b/example/source/10__Item 1/index.html @@ -1 +1 @@ -

This is from index.html

\ No newline at end of file +

This is from index.html (ITEM 1)

\ No newline at end of file diff --git a/example/source/20__Folder 1/10__Nested Folder 1/10__Item 2/index.html b/example/source/20__Folder 1/10__Nested Folder 1/10__Item 2/index.html index 92cd1d9..c524137 100644 --- a/example/source/20__Folder 1/10__Nested Folder 1/10__Item 2/index.html +++ b/example/source/20__Folder 1/10__Nested Folder 1/10__Item 2/index.html @@ -1 +1 @@ -

This is from index.html

\ No newline at end of file +

This is from index.html (ITEM 2)

\ No newline at end of file diff --git a/example/source/20__Folder 1/20__Item 3/index.html b/example/source/20__Folder 1/20__Item 3/index.html index 92cd1d9..358f615 100644 --- a/example/source/20__Folder 1/20__Item 3/index.html +++ b/example/source/20__Folder 1/20__Item 3/index.html @@ -1 +1 @@ -

This is from index.html

\ No newline at end of file +

This is from index.html (ITEM 3)

\ No newline at end of file diff --git a/example/source/20__Folder 1/20__Nested Folder 2/10__Item 4/index.html b/example/source/20__Folder 1/20__Nested Folder 2/10__Item 4/index.html index 92cd1d9..c998440 100644 --- a/example/source/20__Folder 1/20__Nested Folder 2/10__Item 4/index.html +++ b/example/source/20__Folder 1/20__Nested Folder 2/10__Item 4/index.html @@ -1 +1 @@ -

This is from index.html

\ No newline at end of file +

This is from index.html (ITEM 4)

\ No newline at end of file diff --git a/example/source/30__Item 5/index.html b/example/source/30__Item 5/index.html index 92cd1d9..4a51f88 100644 --- a/example/source/30__Item 5/index.html +++ b/example/source/30__Item 5/index.html @@ -1 +1 @@ -

This is from index.html

\ No newline at end of file +

This is from index.html (ITEM 5)

\ No newline at end of file diff --git a/lib/coderoom.js b/lib/coderoom.js index 36ebb1e..fcac7a8 100644 --- a/lib/coderoom.js +++ b/lib/coderoom.js @@ -172,16 +172,16 @@ function generateHtml() { ); } }); - - // entry point index.html - fs.writeFileSync( - path.join(targetDir, 'index.html'), - handlebars.compile(index)({ - settings, - root, - config: root.config, - depth: 0, - }) - ); } + + // entry point index.html + fs.writeFileSync( + path.join(targetDir, 'index.html'), + handlebars.compile(index)({ + settings, + root, + config: root.config, + depth: 0, + }) + ); } \ No newline at end of file diff --git a/lib/room.class.js b/lib/room.class.js index 5eb49a8..660f570 100644 --- a/lib/room.class.js +++ b/lib/room.class.js @@ -68,6 +68,13 @@ module.exports = class Room { return assets; } + getStructure() { + return { + title: this.config.title, + items: this.items.map(i => i.getStructure()), + }; + } + get hasFiles() { return this.files.length > 0; } @@ -109,6 +116,10 @@ module.exports = class Room { }); } + get stringifiedStructure() { + return JSON.stringify(this.getStructure()); + } + static parseFilePatterns(patterns) { patterns = _.isArray(patterns) ? patterns : [patterns]; return patterns.reduce((acc, pattern) => { diff --git a/lib/settings.js b/lib/settings.js index 44cb770..56556e1 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -16,6 +16,7 @@ module.exports = { 'static/js/vendor/ace/ace.js', 'static/js/vendor/ace/mode-html.js', 'static/js/vendor/jquery-2.2.3.min.js', + 'static/js/vendor/vue-2.2.0.min.js', 'static/js/base.js', 'static/js/editor.js', 'static/js/search.js', diff --git a/lib/templates/default/scss/_sidebar.scss b/lib/templates/default/scss/_sidebar.scss index d33ab8c..72d042b 100644 --- a/lib/templates/default/scss/_sidebar.scss +++ b/lib/templates/default/scss/_sidebar.scss @@ -33,7 +33,6 @@ } .fa-remove { - display: none; position: absolute; right: 0; padding: 0 $sidebar_gutter 0 10px; @@ -47,13 +46,8 @@ } } - &.has-query .fa-remove { - display: inline-block; - } - &:hover .fa-search, - &.has-query .fa-search, - &.focus .fa-search { // .focus - not :focus + &.active .fa-search { color: $sidebar_color_bright; } @@ -124,16 +118,13 @@ } } - [no-items-label] { - display: none; + .no-items-label { padding: $sidebar_gutter; padding-top: $sidebar_gutter * 2; font-style: italic; } - &.no-search-results { - [no-items-label] { - display: block; - } + &:not(.mounted) .no-items-label { + display: none; } } \ No newline at end of file diff --git a/lib/templates/default/static/js/base.js b/lib/templates/default/static/js/base.js index 0ca68aa..8b48b6b 100644 --- a/lib/templates/default/static/js/base.js +++ b/lib/templates/default/static/js/base.js @@ -3,40 +3,29 @@ var editor; (function () { 'use strict'; - var $menuEl = $('#menu'); - var $contentEl = $('#content'); - var $editorEl = $('#editor'); - var $iframeEl = $('#iframe'); - var $backdrop = $('#backdrop'); + const $contentEl = $('#content'); + const $editorEl = $('#editor'); + const $iframeEl = $('#iframe'); + const $backdrop = $('#backdrop'); - markActiveMenu(); activateResizable(); - function markActiveMenu() { - var links = $menuEl.find('.link'); - for (var i = 0; i < links.length; i++) { - var href = (links[i].getAttribute('href')).replace(/\.\.\//g, ''); - if (document.URL.indexOf(href) !== -1) { - links[i].classList.add('active'); - } - } - } - function activateResizable() { - var minWidth = 200; - var $handle = $('#resize-handle'); + const minWidth = 200; + const $handle = $('#resize-handle'); + $handle.bind('mousedown', function (e) { - var initialX; - var contentWidth; - var iframeWidth; - var editorWidth; + let initialX = e.pageX; + let contentWidth = $contentEl.outerWidth(); + let iframeWidth = $iframeEl.outerWidth(); + let editorWidth = $editorEl.outerWidth(); $backdrop.removeClass('hidden'); $backdrop.bind({ mousemove: function (e) { - var delta = initialX - e.pageX; + const delta = initialX - e.pageX; if (editorWidth - delta > minWidth && iframeWidth + delta > minWidth) { - var percentage = (iframeWidth + delta) * 100 / contentWidth; + const percentage = (iframeWidth + delta) * 100 / contentWidth; $iframeEl.css('width', percentage + '%'); editor.resize(); } @@ -46,11 +35,6 @@ var editor; $backdrop.addClass('hidden'); }, }); - - initialX = e.pageX; - contentWidth = $contentEl.outerWidth(); - iframeWidth = $iframeEl.outerWidth(); - editorWidth = $editorEl.outerWidth(); }); } })(); \ No newline at end of file diff --git a/lib/templates/default/static/js/search.js b/lib/templates/default/static/js/search.js index 9c24b49..e5a3ded 100644 --- a/lib/templates/default/static/js/search.js +++ b/lib/templates/default/static/js/search.js @@ -1,128 +1,91 @@ (function () { 'use strict'; - var FILTERED_OUT_CLASS = 'filtered-out'; - var FILTERED_IN_CLASS = 'filtered-in'; - var DIR_FILTERED_IN_CLASS = 'dir-filtered-in'; - var HAS_QUERY_CLASS = 'has-query'; - var NO_ITEMS_AVAILABLE_CLASS = 'no-search-results'; - var SEARCH_DATA_KEY = 'SEARCH_DATA_KEY'; - var $sidebar = $('#sidebar'); - var $searchWrap = $sidebar.find('.search'); - var $input = $searchWrap.find('input'); - var $clear = $searchWrap.find('[clear]'); - - var $items = $sidebar.find('li:not(.search)'); - - activate(); - - function activate() { - $input.focus(); - bindEvents(); - prepareTreeData(); - } - - function bindEvents() { - $input.on('focus', function () { - $searchWrap.addClass('focus'); - }); - - $input.on('blur', function () { - $searchWrap.removeClass('focus'); - }); - - $input.on('keydown', function (e) { - if (e.keyCode == 27) { // ESC - $input.val(''); - $input.change(); - } - }); - - $input.on('propertychange change click keyup input paste', function () { - var value = $input.val().trim(); - if ($input.data('oldVal') != value) { - $input.data('oldVal', value); - - if (value.length > 0) { - $searchWrap.addClass(HAS_QUERY_CLASS); - filter(value); - } else { - $searchWrap.removeClass(HAS_QUERY_CLASS); - clearFilter(); - } - checkItemsAvailability(); - } - }); - - $clear.on('click', function () { - $input.val(''); - $input.change(); - $input.focus(); + updateRooms(ROOT); + function updateRooms(room, depth = 1) { + room.items.forEach((item, index) => { + item.index = index; + updateRooms(item, depth + 1); }); } - function prepareTreeData() { - $items.each(function () { - var $item = $(this); - var $childDir = $item.children('.dir-name'); - var $children = $item.find('.link, .dir-name'); - var $arrayOfNames = $children.map(function () { - return $(this).text().toLowerCase(); - }); - var isDir = $childDir.length > 0; - - $item.data(SEARCH_DATA_KEY, { - isDir: isDir, - dirName: isDir ? $childDir.text().toLowerCase() : '', - allNames: $arrayOfNames.get(), - }); - }); - } - - function filter(query) { - query = query.toLowerCase(); - $items.each(function () { - var $item = $(this); - var childrenNames = $item.data(SEARCH_DATA_KEY).allNames; - var isDir = $item.data(SEARCH_DATA_KEY).isDir; - var dirName = $item.data(SEARCH_DATA_KEY).dirName; - - var hasMatchedChild = childrenNames.some(function (name) { - return name.indexOf(query) !== -1; - }); - - var isDirMatch = isDir && dirName.indexOf(query) !== -1; - var hasParentDirMatch = $item.parents('.' + DIR_FILTERED_IN_CLASS).length > 0; - - // if dir name matches search - set class to dir - if (isDirMatch) { - $item.addClass(DIR_FILTERED_IN_CLASS); - } else { - $item.removeClass(DIR_FILTERED_IN_CLASS); - } - - if (hasMatchedChild || hasParentDirMatch) { - $item.addClass(FILTERED_IN_CLASS); - $item.removeClass(FILTERED_OUT_CLASS); - } else { - $item.addClass(FILTERED_OUT_CLASS); - $item.removeClass(FILTERED_IN_CLASS); - } - }); - } - - function clearFilter() { - $items.removeClass(FILTERED_IN_CLASS); - $items.removeClass(FILTERED_OUT_CLASS); - } - - function checkItemsAvailability() { - var hasAvailableItems = $items.filter('.' + FILTERED_IN_CLASS).length > 0; - var hasQuery = $input.val().length > 0; - if (hasAvailableItems || !hasQuery) { - $sidebar.removeClass(NO_ITEMS_AVAILABLE_CLASS); - } else { - $sidebar.addClass(NO_ITEMS_AVAILABLE_CLASS); - } - } + // menu item + Vue.component('menu-item', { + delimiters: ['${', '}'], + props: ['room', 'pathToParent'], + template: '#menu-item-tpl', + methods: { + getRoomUrl() { + const pathToRoot = Array(DEPTH).join('../'); + return `./${pathToRoot}tpls/${this.pathToRoom}index.html`; + }, + }, + computed: { + pathToRoom() { + return `${this.pathToParent || ''}${this.room.index}/`; + }, + isActive() { + // TODO: must be better way of doing this + const href = this.getRoomUrl().replace(/.+?(?=\/tpls)/, ''); + return document.URL.indexOf(href) !== -1; + }, + }, + }); + + // Sidebar + new Vue({ + delimiters: ['${', '}'], + el: '#sidebar', + data: { + root: ROOT, + search: '', + mounted: false, + isSearchFocused: false, + }, + mounted() { + this.mounted = true; + this.focusSearch(); + }, + computed: { + /** + * Return rooms which title or children title contains search query. + * Nesting is preserved + * + * @returns {Array} - root items which satisfy query + */ + filteredItems() { + const query = this.search.toLowerCase().trim(); + const filteredRoot = _traverse({...this.root, title: ''}); + return filteredRoot ? filteredRoot.items : []; + + function _traverse(room) { + // return whole room with items if title matches + if (room.title.toLowerCase().indexOf(query) > -1) { + return room; + } + // find items that match + const items = room.items.reduce((acc, item) => { + const traversedItem = _traverse(item); + if (traversedItem) { + acc.push(traversedItem); + } + return acc; + }, []); + // return room with only those items, that match + if (items.length > 0) { + return {...room, items}; + } + } + }, + }, + methods: { + clearSearch() { + this.search = ''; + this.focusSearch(); + }, + focusSearch() { + this.$refs.search.focus(); + }, + }, + }); })(); \ No newline at end of file diff --git a/lib/templates/default/static/js/vendor/vue-2.2.0.min.js b/lib/templates/default/static/js/vendor/vue-2.2.0.min.js new file mode 100644 index 0000000..d0cecce --- /dev/null +++ b/lib/templates/default/static/js/vendor/vue-2.2.0.min.js @@ -0,0 +1,8 @@ +/*! + * Vue.js v2.2.0 + * (c) 2014-2017 Evan You + * Released under the MIT License. + */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Vue=t()}(this,function(){"use strict";function e(e){return null==e?"":"object"==typeof e?JSON.stringify(e,null,2):String(e)}function t(e){var t=parseFloat(e);return isNaN(t)?e:t}function n(e,t){for(var n=Object.create(null),r=e.split(","),i=0;i-1)return e.splice(n,1)}}function i(e,t){return Ei.call(e,t)}function o(e){return"string"==typeof e||"number"==typeof e}function a(e){var t=Object.create(null);return function(n){var r=t[n];return r||(t[n]=e(n))}}function s(e,t){function n(n){var r=arguments.length;return r?r>1?e.apply(t,arguments):e.call(t,n):e.call(t)}return n._length=e.length,n}function c(e,t){t=t||0;for(var n=e.length-t,r=new Array(n);n--;)r[n]=e[n+t];return r}function u(e,t){for(var n in t)e[n]=t[n];return e}function l(e){return null!==e&&"object"==typeof e}function f(e){return Mi.call(e)===Pi}function p(e){for(var t={},n=0;n1?c(n):n;for(var r=c(arguments,1),i=0,o=n.length;i=0&&bo[n].id>e.id;)n--;bo.splice(Math.max(n,xo)+1,0,e)}else bo.push(e);wo||(wo=!0,Xi(he))}}function ge(e){Oo.clear(),ye(e,Oo)}function ye(e,t){var n,r,i=Array.isArray(e);if((i||l(e))&&Object.isExtensible(e)){if(e.__ob__){var o=e.__ob__.dep.id;if(t.has(o))return;t.add(o)}if(i)for(n=e.length;n--;)ye(e[n],t);else for(r=Object.keys(e),n=r.length;n--;)ye(e[r[n]],t)}}function _e(e,t,n){So.get=function(){return this[t][n]},So.set=function(e){this[t][n]=e},Object.defineProperty(e,n,So)}function be(e){e._watchers=[];var t=e.$options;t.props&&$e(e,t.props),t.methods&&Ae(e,t.methods),t.data?we(e):A(e._data={},!0),t.computed&&Ce(e,t.computed),t.watch&&Oe(e,t.watch)}function $e(e,t){var n=e.$options.propsData||{},r=e._props={},i=e.$options._propKeys=[],o=!e.$parent;uo.shouldConvert=o;var a=function(o){i.push(o);var a=R(o,t,n,e);O(r,o,a),o in e||_e(e,"_props",o)};for(var s in t)a(s);uo.shouldConvert=!0}function we(e){var t=e.$options.data;t=e._data="function"==typeof t?t.call(e):t||{},f(t)||(t={});for(var n=Object.keys(t),r=e.$options.props,o=n.length;o--;)r&&i(r,n[o])||_(n[o])||_e(e,"_data",n[o]);A(t,!0)}function Ce(e,t){var n=e._computedWatchers=Object.create(null);for(var r in t){var i=t[r],o="function"==typeof i?i:i.get;n[r]=new Ao(e,o,d,To),r in e||xe(e,r,i)}}function xe(e,t,n){"function"==typeof n?(So.get=ke(t),So.set=d):(So.get=n.get?n.cache!==!1?ke(t):n.get:d,So.set=n.set?n.set:d),Object.defineProperty(e,t,So)}function ke(e){return function(){var t=this._computedWatchers&&this._computedWatchers[e];if(t)return t.dirty&&t.evaluate(),io.target&&t.depend(),t.value}}function Ae(e,t){e.$options.props;for(var n in t)e[n]=null==t[n]?d:s(t[n],e)}function Oe(e,t){for(var n in t){var r=t[n];if(Array.isArray(r))for(var i=0;i-1:e instanceof RegExp&&e.test(t)}function yt(e,t){for(var n in e){var r=e[n];if(r){var i=mt(r.componentOptions);i&&!t(i)&&(_t(r),e[n]=null)}}}function _t(e){e&&(e.componentInstance._inactive||de(e.componentInstance,"deactivated"),e.componentInstance.$destroy())}function bt(e){var t={};t.get=function(){return Hi},Object.defineProperty(e,"config",t),e.util={warn:no,extend:u,mergeOptions:M,defineReactive:O},e.set=S,e.delete=T,e.nextTick=Xi,e.options=Object.create(null),Hi._assetTypes.forEach(function(t){e.options[t+"s"]=Object.create(null)}),e.options._base=e,u(e.options.components,Po),lt(e),ft(e),pt(e),ht(e)}function $t(e){for(var t=e.data,n=e,r=e;r.componentInstance;)r=r.componentInstance._vnode,r.data&&(t=wt(r.data,t));for(;n=n.parent;)n.data&&(t=wt(t,n.data));return Ct(t)}function wt(e,t){return{staticClass:xt(e.staticClass,t.staticClass),class:e.class?[e.class,t.class]:t.class}}function Ct(e){var t=e.class,n=e.staticClass;return n||t?xt(n,kt(t)):""}function xt(e,t){return e?t?e+" "+t:e:t||""}function kt(e){var t="";if(!e)return t;if("string"==typeof e)return e;if(Array.isArray(e)){for(var n,r=0,i=e.length;r-1?aa[e]=t.constructor===window.HTMLUnknownElement||t.constructor===window.HTMLElement:aa[e]=/HTMLUnknownElement/.test(t.toString())}function St(e){if("string"==typeof e){var t=document.querySelector(e);return t?t:document.createElement("div")}return e}function Tt(e,t){var n=document.createElement(e);return"select"!==e?n:(t.data&&t.data.attrs&&void 0!==t.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)}function Et(e,t){return document.createElementNS(ta[e],t)}function jt(e){return document.createTextNode(e)}function Nt(e){return document.createComment(e)}function It(e,t,n){e.insertBefore(t,n)}function Lt(e,t){e.removeChild(t)}function Dt(e,t){e.appendChild(t)}function Mt(e){return e.parentNode}function Pt(e){return e.nextSibling}function Rt(e){return e.tagName}function Ft(e,t){e.textContent=t}function Ht(e,t,n){e.setAttribute(t,n)}function Ut(e,t){var n=e.data.ref;if(n){var i=e.context,o=e.componentInstance||e.elm,a=i.$refs;t?Array.isArray(a[n])?r(a[n],o):a[n]===o&&(a[n]=void 0):e.data.refInFor?Array.isArray(a[n])&&a[n].indexOf(o)<0?a[n].push(o):a[n]=[o]:a[n]=o}}function Bt(e){return null==e}function Vt(e){return null!=e}function zt(e,t){return e.key===t.key&&e.tag===t.tag&&e.isComment===t.isComment&&!e.data==!t.data}function Jt(e,t,n){var r,i,o={};for(r=t;r<=n;++r)i=e[r].key,Vt(i)&&(o[i]=r);return o}function Kt(e){function t(e){return new vo(O.tagName(e).toLowerCase(),{},[],void 0,e)}function r(e,t){function n(){0===--n.listeners&&i(e)}return n.listeners=t,n}function i(e){var t=O.parentNode(e);t&&O.removeChild(t,e)}function a(e,t,n,r,i){if(e.isRootInsert=!i,!s(e,t,n,r)){var o=e.data,a=e.children,c=e.tag;Vt(c)?(e.elm=e.ns?O.createElementNS(e.ns,c):O.createElement(c,e),v(e),f(e,a,t),Vt(o)&&d(e,t),l(n,e.elm,r)):e.isComment?(e.elm=O.createComment(e.text),l(n,e.elm,r)):(e.elm=O.createTextNode(e.text),l(n,e.elm,r))}}function s(e,t,n,r){var i=e.data;if(Vt(i)){var o=Vt(e.componentInstance)&&i.keepAlive;if(Vt(i=i.hook)&&Vt(i=i.init)&&i(e,!1,n,r),Vt(e.componentInstance))return c(e,t),o&&u(e,t,n,r),!0}}function c(e,t){e.data.pendingInsert&&t.push.apply(t,e.data.pendingInsert),e.elm=e.componentInstance.$el,p(e)?(d(e,t),v(e)):(Ut(e),t.push(e))}function u(e,t,n,r){for(var i,o=e;o.componentInstance;)if(o=o.componentInstance._vnode,Vt(i=o.data)&&Vt(i=i.transition)){for(i=0;ip?(u=Bt(n[m+1])?null:n[m+1].elm,h(e,u,n,f,m,r)):f>m&&g(e,t,l,p)}function b(e,t,n,r){if(e!==t){if(t.isStatic&&e.isStatic&&t.key===e.key&&(t.isCloned||t.isOnce))return t.elm=e.elm,void(t.componentInstance=e.componentInstance);var i,o=t.data,a=Vt(o);a&&Vt(i=o.hook)&&Vt(i=i.prepatch)&&i(e,t);var s=t.elm=e.elm,c=e.children,u=t.children;if(a&&p(t)){for(i=0;i=0&&(m=e.charAt(h)," "===m);h--);m&&ma.test(m)||(l=!0)}}else void 0===o?(v=i+1,o=e.slice(0,i).trim()):t();if(void 0===o?o=e.slice(0,i).trim():0!==v&&t(),a)for(i=0;i=Ro}function gn(e){return 34===e||39===e}function yn(e){var t=1;for(Bo=Uo;!mn();)if(e=hn(),gn(e))_n(e);else if(91===e&&t++,93===e&&t--,0===t){Vo=Uo;break}}function _n(e){for(var t=e;!mn()&&(e=hn(),e!==t););}function bn(e,t,n){zo=n;var r=t.value,i=t.modifiers,o=e.tag,a=e.attrsMap.type;if("select"===o)Cn(e,r,i);else if("input"===o&&"checkbox"===a)$n(e,r,i);else if("input"===o&&"radio"===a)wn(e,r,i);else if("input"===o||"textarea"===o)xn(e,r,i);else if(!Hi.isReservedTag(o))return pn(e,r,i),!1;return!0}function $n(e,t,n){var r=n&&n.number,i=ln(e,"value")||"null",o=ln(e,"true-value")||"true",a=ln(e,"false-value")||"false";an(e,"checked","Array.isArray("+t+")?_i("+t+","+i+")>-1"+("true"===o?":("+t+")":":_q("+t+","+o+")")),un(e,ya,"var $$a="+t+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+a+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$c){$$i<0&&("+t+"=$$a.concat($$v))}else{$$i>-1&&("+t+"=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}}else{"+t+"=$$c}",null,!0)}function wn(e,t,n){var r=n&&n.number,i=ln(e,"value")||"null";i=r?"_n("+i+")":i,an(e,"checked","_q("+t+","+i+")"),un(e,ya,dn(t,i),null,!0)}function Cn(e,t,n){var r=n&&n.number,i='Array.prototype.filter.call($event.target.options,function(o){return o.selected}).map(function(o){var val = "_value" in o ? o._value : o.value;return '+(r?"_n(val)":"val")+"})",o="$event.target.multiple ? $$selectedVal : $$selectedVal[0]",a="var $$selectedVal = "+i+";";a=a+" "+dn(t,o),un(e,"change",a,null,!0)}function xn(e,t,n){var r=e.attrsMap.type,i=n||{},o=i.lazy,a=i.number,s=i.trim,c=!o&&"range"!==r,u=o?"change":"range"===r?ga:"input",l="$event.target.value";s&&(l="$event.target.value.trim()"),a&&(l="_n("+l+")");var f=dn(t,l);c&&(f="if($event.target.composing)return;"+f),an(e,"value","("+t+")"),un(e,u,f,null,!0),(s||a||"number"===r)&&un(e,"blur","$forceUpdate()")}function kn(e){var t;e[ga]&&(t=zi?"change":"input",e[t]=[].concat(e[ga],e[t]||[]),delete e[ga]),e[ya]&&(t=Zi?"click":"change",e[t]=[].concat(e[ya],e[t]||[]),delete e[ya])}function An(e,t,n,r){if(n){var i=t,o=Jo;t=function(n){var a=1===arguments.length?i(n):i.apply(null,arguments);null!==a&&On(e,t,r,o)}}Jo.addEventListener(e,t,r)}function On(e,t,n,r){(r||Jo).removeEventListener(e,t,n)}function Sn(e,t){if(e.data.on||t.data.on){var n=t.data.on||{},r=e.data.on||{};Jo=t.elm,kn(n),q(n,r,An,On,t.context)}}function Tn(e,t){if(e.data.domProps||t.data.domProps){var n,r,i=t.elm,o=e.data.domProps||{},a=t.data.domProps||{};a.__ob__&&(a=t.data.domProps=u({},a));for(n in o)null==a[n]&&(i[n]="");for(n in a)if(r=a[n],"textContent"!==n&&"innerHTML"!==n||(t.children&&(t.children.length=0),r!==o[n]))if("value"===n){i._value=r;var s=null==r?"":String(r);En(i,t,s)&&(i.value=s)}else i[n]=r}}function En(e,t,n){return!e.composing&&("option"===t.tag||jn(e,n)||Nn(e,n))}function jn(e,t){return document.activeElement!==e&&e.value!==t}function Nn(e,n){var r=e.value,i=e._vModifiers;return i&&i.number||"number"===e.type?t(r)!==t(n):i&&i.trim?r.trim()!==n.trim():r!==n}function In(e){var t=Ln(e.style);return e.staticStyle?u(e.staticStyle,t):t}function Ln(e){return Array.isArray(e)?p(e):"string"==typeof e?$a(e):e}function Dn(e,t){var n,r={};if(t)for(var i=e;i.componentInstance;)i=i.componentInstance._vnode,i.data&&(n=In(i.data))&&u(r,n);(n=In(e.data))&&u(r,n);for(var o=e;o=o.parent;)o.data&&(n=In(o.data))&&u(r,n);return r}function Mn(e,t){var n=t.data,r=e.data;if(n.staticStyle||n.style||r.staticStyle||r.style){var i,o,a=t.elm,s=e.data.staticStyle,c=e.data.style||{},l=s||c,f=Ln(t.data.style)||{};t.data.style=f.__ob__?u({},f):f;var p=Dn(t,!0);for(o in l)null==p[o]&&xa(a,o,"");for(o in p)i=p[o],i!==l[o]&&xa(a,o,null==i?"":i)}}function Pn(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.add(t)}):e.classList.add(t);else{var n=" "+(e.getAttribute("class")||"")+" ";n.indexOf(" "+t+" ")<0&&e.setAttribute("class",(n+t).trim())}}function Rn(e,t){if(t&&(t=t.trim()))if(e.classList)t.indexOf(" ")>-1?t.split(/\s+/).forEach(function(t){return e.classList.remove(t)}):e.classList.remove(t);else{for(var n=" "+(e.getAttribute("class")||"")+" ",r=" "+t+" ";n.indexOf(r)>=0;)n=n.replace(r," ");e.setAttribute("class",n.trim())}}function Fn(e){if(e){if("object"==typeof e){var t={};return e.css!==!1&&u(t,Sa(e.name||"v")),u(t,e),t}return"string"==typeof e?Sa(e):void 0}}function Hn(e){Ma(function(){Ma(e)})}function Un(e,t){(e._transitionClasses||(e._transitionClasses=[])).push(t),Pn(e,t)}function Bn(e,t){e._transitionClasses&&r(e._transitionClasses,t),Rn(e,t)}function Vn(e,t,n){var r=zn(e,t),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===Ea?Ia:Da,c=0,u=function(){e.removeEventListener(s,l),n()},l=function(t){t.target===e&&++c>=a&&u()};setTimeout(function(){c0&&(n=Ea,l=a,f=o.length):t===ja?u>0&&(n=ja,l=u,f=c.length):(l=Math.max(a,u),n=l>0?a>u?Ea:ja:null,f=n?n===Ea?o.length:c.length:0);var p=n===Ea&&Pa.test(r[Na+"Property"]);return{type:n,timeout:l,propCount:f,hasTransform:p}}function Jn(e,t){for(;e.length1}function Yn(e,t){t.data.show||qn(t)}function Qn(e,t,n){var r=t.value,i=e.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=e.options.length;s-1,a.selected!==o&&(a.selected=o);else if(h(er(a),r))return void(e.selectedIndex!==s&&(e.selectedIndex=s));i||(e.selectedIndex=-1)}}function Xn(e,t){for(var n=0,r=t.length;n',n.innerHTML.indexOf(t)>0}function vr(e){return Ga=Ga||document.createElement("div"),Ga.innerHTML=e,Ga.textContent}function hr(e,t){var n=t?Ms:Ds;return e.replace(n,function(e){return Ls[e]})}function mr(e,t){function n(t){f+=t,e=e.substring(t)}function r(){var t=e.match(ss);if(t){var r={tagName:t[1],attrs:[],start:f};n(t[0].length);for(var i,o;!(i=e.match(cs))&&(o=e.match(is));)n(o[0].length),r.attrs.push(o);if(i)return r.unarySlash=i[1],n(i[0].length),r.end=f,r}}function i(e){var n=e.tagName,r=e.unarySlash;u&&("p"===s&&es(n)&&o(s),Xa(n)&&s===n&&o(n));for(var i=l(n)||"html"===n&&"head"===s||!!r,a=e.attrs.length,f=new Array(a),p=0;p=0&&c[i].lowerCasedTag!==o;i--);else i=0;if(i>=0){for(var a=c.length-1;a>=i;a--)t.end&&t.end(c[a].tag,n,r);c.length=i,s=i&&c[i-1].tag}else"br"===o?t.start&&t.start(e,[],!0,n,r):"p"===o&&(t.start&&t.start(e,[],!1,n,r),t.end&&t.end(e,n,r))}for(var a,s,c=[],u=t.expectHTML,l=t.isUnaryTag||Ri,f=0;e;){if(a=e,s&&Ns(s)){var p=s.toLowerCase(),d=Is[p]||(Is[p]=new RegExp("([\\s\\S]*?)(]*>)","i")),v=0,h=e.replace(d,function(e,n,r){return v=r.length,"script"!==p&&"style"!==p&&"noscript"!==p&&(n=n.replace(//g,"$1").replace(//g,"$1")),t.chars&&t.chars(n),""});f+=e.length-h.length,e=h,o(p,f-v,f)}else{var m=e.indexOf("<");if(0===m){if(fs.test(e)){var g=e.indexOf("-->");if(g>=0){n(g+3);continue}}if(ps.test(e)){var y=e.indexOf("]>");if(y>=0){n(y+2);continue}}var _=e.match(ls);if(_){n(_[0].length);continue}var b=e.match(us);if(b){var $=f;n(b[0].length),o(b[1],$,f);continue}var w=r();if(w){i(w);continue}}var C=void 0,x=void 0,k=void 0;if(m>=0){for(x=e.slice(m);!(us.test(x)||ss.test(x)||fs.test(x)||ps.test(x)||(k=x.indexOf("<",1),k<0));)m+=k,x=e.slice(m);C=e.substring(0,m),n(m)}m<0&&(C=e,e=""),t.chars&&C&&t.chars(C)}if(e===a){t.chars&&t.chars(e);break}}o()}function gr(e,t){var n=t?Fs(t):Ps;if(n.test(e)){for(var r,i,o=[],a=n.lastIndex=0;r=n.exec(e);){i=r.index,i>a&&o.push(JSON.stringify(e.slice(a,i)));var s=tn(r[1].trim());o.push("_s("+s+")"),a=i+r[0].length}return a0,Ki=Vi&&Vi.indexOf("edge/")>0,qi=Vi&&Vi.indexOf("android")>0,Wi=Vi&&/iphone|ipad|ipod|ios/.test(Vi),Zi=Vi&&/chrome\/\d+/.test(Vi)&&!Ki,Gi=function(){return void 0===Oi&&(Oi=!Bi&&"undefined"!=typeof global&&"server"===global.process.env.VUE_ENV),Oi},Yi=Bi&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,Qi="undefined"!=typeof Symbol&&y(Symbol)&&"undefined"!=typeof Reflect&&y(Reflect.ownKeys),Xi=function(){function e(){r=!1;var e=n.slice(0);n.length=0;for(var t=0;t1&&(t[n[0].trim()]=n[1].trim())}}),t}),wa=/^--/,Ca=/\s*!important$/,xa=function(e,t,n){wa.test(t)?e.style.setProperty(t,n):Ca.test(n)?e.style.setProperty(t,n.replace(Ca,""),"important"):e.style[Aa(t)]=n},ka=["Webkit","Moz","ms"],Aa=a(function(e){if(Ko=Ko||document.createElement("div"),e=Ni(e),"filter"!==e&&e in Ko.style)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=0;n\/=]+)/,ns=/(?:=)/,rs=[/"([^"]*)"+/.source,/'([^']*)'+/.source,/([^\s"'=<>`]+)/.source],is=new RegExp("^\\s*"+ts.source+"(?:\\s*("+ns.source+")\\s*(?:"+rs.join("|")+"))?"),os="[a-zA-Z_][\\w\\-\\.]*",as="((?:"+os+"\\:)?"+os+")",ss=new RegExp("^<"+as),cs=/^\s*(\/?)>/,us=new RegExp("^<\\/"+as+"[^>]*>"),ls=/^]+>/i,fs=/^ -