text: "use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var i=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){return!t||"object"!==_typeof(t)&&"function"!=typeof t?_assertThisInitialized(e):t}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _createClass(e,t,r){return t&&_defineProperties(e.prototype,t),r&&_defineProperties(e,r),e}function _createForOfIteratorHelper(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){var e=this;function t(e,t){return e.split("-").map((function(e,r){return r||t?e[0].toUpperCase()+e.slice(1):e})).join("")}function r(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null===t||"object"!==_typeof(t))throw new Error("Unable to update a Model with "+t+". Expected an object.");var i={},o=0,a={},s=0,l={},c=0;for(var f in t){var u=t[f],h=void 0;void 0===u?f in e&&(delete e[f],l[f]=!0,c++):n||e[f]instanceof m?(e[f]instanceof m||(i[f]=!0,o++,e[f]=new n(e[f])),h=e[f].set(u instanceof m?u.value:u)):null===u||"object"!==_typeof(u)?e[f]!==u&&(f in e||(i[f]=!0,o++),e[f]=u,a[f]=!0,s++):(e[f]&&"object"===_typeof(e[f])||(e[f]={},i[f]=!0,o++),h=r(e[f],u)),h&&(i[f]=h.created,o+=h.creates,a[f]=h.changed,s+=h.changes,l[f]=h.deleted,c+=h.deletes)}return{created:i,creates:o,changed:a,changes:s,deleted:l,deletes:c}}function n(e){var t=Object.assign({},e.dataset);for(var r in t)""===t[r]&&(t[r]=!0);return new m(t)}[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(e){e.hasOwnProperty("remove")||Object.defineProperty(e,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this)}})}));var i,o=/\s+/,a=/[:.\/]+/,s=0,l=function e(t,r,n,i,a){if(n&&"object"===_typeof(n))for(var s in void 0!==i&&"context"in a&&void 0===a.context&&(a.context=i),n)r=e(t,r,s,n[s],a);else if(n&&o.test(n)){var l,c=_createForOfIteratorHelper(n.split(o));try{for(c.s();!(l=c.n()).done;){r=t(r,l.value,i,a)}}catch(e){c.e(e)}finally{c.f()}}else r=t(r,n,i,a);return r},c=function(e,t,r,n){if(r){var i=e;if((t="all"===t?"*":t)&&a.test(t)){var o,s=_createForOfIteratorHelper(t.split(a));try{for(s.s();!(o=s.n()).done;){var l=o.value;i=i[l]||(i[l]={})}}catch(e){s.e(e)}finally{s.f()}}else i=i[t]||(i[t]={});!function(e,t,r,n){var i=e[t="#"===t?"*":"+"===t?"?":t]||(e[t]=[]),o=n.context,a=n.ctx,s=n.listening;s&&s.count++,i.push({callback:r,context:o,ctx:o||a,listening:s})}(i,"$",r,n)}return e},f=function(e,t,r,n){var i=n.context,o=n.listeners;if(e){if(t||i||r)return function e(t,r,n,i,o){var a;if(r)if(r.length){var s=r.shift();"**"==s?(a=Object.keys(t),r=null):a=[s]}else a=["$"];else a=Object.keys(t);var l,c=_createForOfIteratorHelper(a);try{for(c.s();!(l=c.n()).done;){var f=l.value,u=t[f];if(u)if("$"===f){var h,v=[],p=_createForOfIteratorHelper(u);try{for(p.s();!(h=p.n()).done;){var d=h.value;if(n&&n!==d.callback&&n!==d.callback._callback||i&&i!==d.context)v.push(d);else{var y=d.listening;y&&y.off(f,n)}}}catch(e){p.e(e)}finally{p.f()}v.length?t[f]=v:delete t[f]}else e(u,r,n,i,o),Object.keys(u).length||delete t[f]}}catch(e){c.e(e)}finally{c.f()}}(e,(t="all"===t?"*":t)&&t.split(a),r,i,o),e;var s,l=_createForOfIteratorHelper(o);try{for(l.s();!(s=l.n()).done;){s.value.cleanup()}}catch(e){l.e(e)}finally{l.f()}}},u=function e(t,r,n,i){var o=t[n.shift()];n.length?(o&&e(o,r,n.slice(),i),t["?"]&&e(t["?"],r,n,i)):o&&o.$&&v(o.$,i.concat([r])),t["*"]&&v(t["*"].$,i.concat([r]))},h=function(e,t,r){return e&&("string"==typeof t?u(e,t,t.split(a),r):function e(t,r,n,i){if(Array.isArray(n)){var o,s=_createForOfIteratorHelper(n);try{for(s.s();!(o=s.n()).done;){var l=o.value;u(t,r,l.split(a),i)}}catch(e){s.e(e)}finally{s.f()}}else for(var c in n){var f=n[c],h=t[c];!0===f?h&&h.$&&v(h.$,i.concat([r])):(h&&e(h,r,f,i),t["?"]&&e(t["?"],r,f,i))}t["*"]&&v(t["*"].$,i.concat([r]))}(e,t,t,r)),e},v=function(e,t){var r,n=-1,i=e.length,o=t[0],a=t[1],s=t[2];switch(t.length){case 0:for(;++n<i;)(r=e[n]).callback.call(r.ctx);return;case 1:for(;++n<i;)(r=e[n]).callback.call(r.ctx,o);return;case 2:for(;++n<i;)(r=e[n]).callback.call(r.ctx,o,a);return;case 3:for(;++n<i;)(r=e[n]).callback.call(r.ctx,o,a,s);return;default:for(;++n<i;)(r=e[n]).callback.apply(r.ctx,t);return}},p=function(e,t,r,n){if(r){var i=!1,o=e[t]=function(){i||(i=!0,n(t,o),r.apply(this,arguments))};o._callback=r}return e},d=function(){function e(){_classCallCheck(this,e)}return _createClass(e,[{key:"on",value:function(e,t,r){(this._events=l(c,this._events||{},e,t,{context:r,ctx:this,listening:i}),i)&&((this._listeners||(this._listeners={}))[i.id]=i,i.interop=!1);return this}},{key:"listenTo",value:function(e,t,r){if(!e)return this;var n=e._listenId||(e._listenId=++s),o=this._listeningTo||(this._listeningTo={}),a=i=o[n];a||(this._listenId||(this._listenId=++s),a=i=o[n]=new Listening(this,e));var l=function(e,t,r,n){try{e.on(t,r,n)}catch(e){return e}}(e,t,r,this);if(i=void 0,l)throw l;return a.interop&&a.on(t,r),this}},{key:"off",value:function(e,t,r){return this._events?(this._events=l(f,this._events,e,t,{context:r,listeners:this._listeners}),this):this}},{key:"stopListening",value:function(e,t,r){var n=this._listeningTo;if(!n)return this;for(var i=e?[e._listenId]:Object.keys(n),o=0;o<i.length;o++){var a=n[i[o]];if(!a)break;a.obj.off(t,r,this),a.interop&&a.off(t,r)}return 0===Object.keys(n).length&&(this._listeningTo=void 0),this}},{key:"once",value:function(e,t,r){var n=l(p,{},e,t,this.off.bind(this));return"string"==typeof e&&null==r&&(t=void 0),this.on(n,t,r)}},{key:"listenToOnce",value:function(e,t,r){var n=l(p,{},t,r,this.stopListening.bind(this,e));return this.listenTo(e,n)}},{key:"trigger",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return this._events&&h(this._events,e,r),this}}]),e}();d.prototype.bind=d.prototype.on,d.prototype.unbind=d.prototype.off;var y=function(e){_inherits(r,e);var t=_createSuper(r);function r(){return _classCallCheck(this,r),t.apply(this,arguments)}return _createClass(r,[{key:"mount",value:function(e){return this._finishInit&&(this._finishInit(),delete this._finishInit),(e=e||this._stub)&&e.parentNode&&e.parentNode.replaceChild(this.el,e),this}},{key:"insert",value:function(e,t){return e.insertBefore(this.el,t),this}},{key:"unmount",value:function(e){return(e=e||this.el).parentNode?(this._stub=this._stub||document.createComment(""),e.parentNode.replaceChild(this._stub,e),this):this}},{key:"remove",value:function(){this.off(),this.el.remove(),b.instances.delete(this.el)}},{key:"childContent",value:function(e,t){var n=this[e];n instanceof r?n.data.set("content",t):n.textContent=t}},{key:"childHTML",value:function(e,t){var n=this[e];n instanceof r?n.data.set("html",t):n.innerHTML=t}},{key:"childToggle",value:function(e,t,n){var i=this[e];i instanceof r?i.data.set(t,n):i.classList.toggle(t.split(/(?=[A-Z])/g).map((function(e){return e.toLowerCase()})).join("-"),!!n)}},{key:"childProp",value:function(e,t,n){var i=this[e];if(i instanceof r){var o={};o[t]=n,i.data.set(o)}else i[t]=n}},{key:"watch",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];for(var i=r[0]&&r[0].constructor===Object?r.shift():{},o=[];r[r.length-1]instanceof Function||r[r.length-1]&&r[r.length-1].constructor===Object;)o.unshift(r.pop());var a,s=o[0],l=Array.isArray(r[0]),c=l?r[0]:[r],f=i.initial?i.initial:{},u={},h=function(e,t){f[e]!==t&&(f[e]=t,a())},v=function(t){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var o=e.watch.apply(e,[{initial:{index:t}}].concat(n));return u[t]=u[t]||[],u[t].push(o),o}},p=function(e){if(u[e]){var t,r=_createForOfIteratorHelper(u[e]);try{for(r.s();!(t=r.n()).done;){t.value.unwatch()}}catch(e){r.e(e)}finally{r.f()}delete u[e]}};if(!l&&c[0][0]instanceof _){var d=c[0][0],y=[],b=function(t,r,n){var i=v(r),a=s.add&&s.add.call(e,t,r,n,i);a&&(o.length>1?i.apply(e,a.concat(o.slice(1))):(y[r]=a,s.container&&s.container.insertBefore(a.el||a,y[r+1]&&y[r+1].el||y[r+1]||null)))};a=function(t,r){var n=r.add,i=r.move,o=r.remove;if(o)for(var a in o){var l=parseInt(a);p(l);var c=s.remove&&s.remove.call(e,o[l],l,t);y[l]&&!1!==c&&(y[l].remove&&y[l].remove(),delete y[l])}if(i){var f={},h={},v=[];for(var d in i){var m=parseInt(d);if(v.push(m),i[m]in u){f[m]=u[i[m]];var g,_=_createForOfIteratorHelper(u[i[m]]);try{for(_.s();!(g=_.n()).done;){g.value.update("index",m)}}catch(e){_.e(e)}finally{_.f()}delete u[i[m]]}s.move&&s.move(t[m],m,i[m],t),i[m]in y&&(h[m]=y[i[m]],delete y[i[m]])}for(var k=v.length-1;k>=0;k--){var w=v[k];w in f?u[w]=f[w]:delete u[w],w in h?(y[w]=h[w],s.container&&s.container.insertBefore(y[w].el||y[w],y[w+1]&&y[w+1].el||y[w+1]||null)):delete y[w]}}if(n){var A=[];for(var O in n)A.push(parseInt(O));for(var I=A.length-1;I>=0;I--)b(n[A[I]],A[I],t)}console.log(y)},d.on("*",a);for(var k=0;k<d.items.length;k++)b(d.items[k],k,d.items)}else{a=function(){var t,r=[],n=_createForOfIteratorHelper(c);try{for(n.s();!(t=n.n()).done;){var i=t.value,a=i[0];if("string"==typeof a)r.push(f[a]);else if(a instanceof m)r.push(i.length>1&&!Array.isArray(i[1])?a.get(i[1]):a.value);else if(a instanceof g){var l=i[1];if(Array.isArray(l)){var u,h={},d=_createForOfIteratorHelper(l);try{for(d.s();!(u=d.n()).done;){var y=u.value;h[y]=a.get(y)}}catch(e){d.e(e)}finally{d.f()}r.push(h)}else r.push(a.get(l))}}}catch(e){n.e(e)}finally{n.f()}p(0);var _=v(0);r.push(_);var b=s.apply(e,r);b&&o.length>1&&_.apply(e,b.concat(o.slice(1)))};var w,A=_createForOfIteratorHelper(c);try{for(A.s();!(w=A.n()).done;){var O=w.value,I=O[0];if("string"==typeof I);else if(I instanceof m){var C=O.length>1?O[1]:"*";I.on("change:"+(Array.isArray(C)?"("+C.join(",")+")":C),a)}else{if(!(I instanceof g))throw I instanceof _?new Error("A list can only be a single data source."):(console.error("Unsupported data source: ",I,". Expected a Model, Store or List instance."),new Error("Unsupported data source"));var j=O[1],x=O.length>2?O[2]:"*";I.on("change:"+(Array.isArray(j)?"("+j.join(",")+")":j)+":"+(Array.isArray(x)?"("+x.join(",")+")":x),a)}}}catch(e){A.e(e)}finally{A.f()}a()}return{update:h,unwatch:function(){for(var t in u){var r,n=_createForOfIteratorHelper(u[t]);try{for(n.s();!(r=n.n()).done;){r.value.unwatch()}}catch(e){n.e(e)}finally{n.f()}}e.off(null,a)}}}}]),r}(d),m=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r;if(_classCallCheck(this,n),r=t.call(this),void 0!==e&&(!e||e.constructor!==Object))throw new Error("Unable to create a Model from "+e+". Expected an object.");return r.value=e||{},r}return _createClass(n,[{key:"id",value:function(){return this.value.id}},{key:"get",value:function(e){return function e(t,r){if(!r)return t;var n=t[(r=Array.isArray(r)?r:r.split(".")).shift()];return r.length&&n?e(n,r):n||null}(this.value,e)}},{key:"set",value:function(e,t){void 0===t&&(t=e,e=null);var n=r(this.value,t);if(n.creates||n.changes||n.deletes){var i={};n.creates&&(i.create=n.created),n.changes&&(i.change=n.changed),n.deletes&&(i.delete=n.deleted),this.trigger(i,this.value)}return n}}]),n}(d),g=function(e){_inherits(n,e);var t=_createSuper(n);function n(e){var r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:m;if(_classCallCheck(this,n),(r=t.call(this)).items={},r.model=i,Array.isArray(e)){var o,a=_createForOfIteratorHelper(e);try{for(a.s();!(o=a.n()).done;){var s=o.value;r.items[r.modelId(s)]=s instanceof m?s:new i(s)}}catch(e){a.e(e)}finally{a.f()}}else if(e instanceof Object)for(var l in e){var c=e[l];r.items[l]=c instanceof m?c:new i(c)}return r}return _createClass(n,[{key:"modelId",value:function(e){return e instanceof this.model?e.id():e.id}},{key:"get",value:function(e,t){var r=this.items[e]||null;return t?r&&r.get(t):r}},{key:"put",value:function(e){Array.isArray(e)||(e=[e]);var t,r={},n=_createForOfIteratorHelper(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r[this.modelId(i)]=i}}catch(e){n.e(e)}finally{n.f()}return this.set(r)}},{key:"set",value:function(e,t,n){var i={};void 0===t&&void 0===n?i=e:void 0===n?(i[e]=t,t=null):i[e]=n;var o=r(this.items,i,this.model);if(o.creates||o.changes||o.deletes){var a={};o.creates&&(a.create=o.created),o.changes&&(a.change=o.changed),o.deletes&&(a.delete=o.deleted),this.trigger(a,this.value)}}}]),n}(d),_=function(e){_inherits(r,e);var t=_createSuper(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(_classCallCheck(this,r),(e=t.call(this)).filtered={},e.items=n,i instanceof m)e.model=i,e.items=n.map((function(e){return e instanceof i?e:new i(e)}));else if(i instanceof g||i instanceof Function)e.store=i;else if(null!==i)throw new Error("Unable to use "+i+" as a backing store for List. Expected Model, Store or a function (id => model).");return e}return _createClass(r,[{key:"normaliseItems",value:function(e){var t=this;return this.model?e.map((function(e){return e instanceof t.model?e:new t.model(e)})):e}},{key:"idAt",value:function(e){return this.model?items[e].id():items[e]}},{key:"get",value:function(e){var t=this.items[e];return this.store?this.store instanceof Function?this.store(t):this.store.get(t):t}},{key:"set",value:function(e,t,r){if(void 0===r){r=this.normaliseItems([t])[0];var n={add:{},remove:{}};n.remove[e]=this.items[e],n.add[e]=r,this.items[e]=r,this.trigger(n,this.items)}else if(this.store)this.store.set(this.items[e],t,r);else{if(!this.items[e].set)throw new Error("Unable to set "+r+" for path "+t+" in "+this.items[e]+", as it has no set method.");this.items[e].set(t,r)}}},{key:"splice",value:function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];(e=Math.min(e,this.items.length))<0&&(e=Math.max(0,this.items.length+e)),t=Math.min(Math.max(0,t),this.items.length-e),n=this.normaliseItems(n);var i={};if(t>0){i.remove={};for(var o=e;o<t;o++)i.remove[o]=this.items[o]}if(t!==n.length&&e<this.items.length){i.move={};for(var a=e+t;a<this.items.length;a++)i.move[a+n.length-t]=a}if(n.length>0){i.add={};for(var s=0;s<n.length;s++)i.add[e+s]=n[s]}(r=this.items).splice.apply(r,[e,t].concat(_toConsumableArray(n))),this.trigger(i,this.items)}},{key:"remove",value:function(e){var t,r={},n={remove:{}},i=[],o=_createForOfIteratorHelper(e);try{for(o.s();!(t=o.n()).done;){r[t.value]=!0}}catch(e){o.e(e)}finally{o.f()}for(var a=0,s=0;s<this.items.length;s++)this.idAt(s)in r?(i.push(this.items[s]),n.remove[s]=this.items[s]):(a<s&&(this.items[a]=this.items[s],n.move||(n.move={}),n.move[a]=s),a++);return this.items.length=a,this.trigger(n,this.items),i}},{key:"removeAt",value:function(e){var t,r={},n={remove:{}},i=[],o=_createForOfIteratorHelper(e);try{for(o.s();!(t=o.n()).done;){r[t.value]=!0}}catch(e){o.e(e)}finally{o.f()}for(var a=0,s=0;s<this.items.length;s++)s in r?(i.push(this.items[s]),n.remove[s]=this.items[s]):(a<s&&(this.items[a]=this.items[s],n.move||(n.move={}),n.move[a]=s),a++);return this.items.length=a,this.trigger(n,this.items),i}},{key:"reset",value:function(e){this.splice(0,this.items.length,e)}},{key:"insert",value:function(e,t){this.splice(e,0,t)}},{key:"append",value:function(e){this.splice(this.items.length,0,e)}},{key:"prepend",value:function(e){this.splice(0,0,e)}},{key:"push",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.splice(this.items.length,0,t)}},{key:"unshift",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.splice(0,0,t)}},{key:"shift",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.splice(0,e)}},{key:"pop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.splice(this.items.length-e,e)}},{key:"swap",value:function(e,t){if(e=Math.max(0,Math.min(e,this.items.length-1)),(t=Math.max(0,Math.min(t,this.items.length-1)))!==e){var r={move:{}};r.move[t]=e,r.move[e]=t;var n=this.items[e];this.items[e]=this.items[t],this.items[t]=n,this.trigger(r,this.items)}}},{key:"move",value:function(e,t){if(e=Math.max(0,Math.min(e,this.items.length-1)),(t=Math.max(0,Math.min(t,this.items.length-1)))!==e){var r={move:{}},n=this.items[e];if(t<e)for(var i=e;i>t;i--)r.move[i]=i-1,this.items[i]=this.items[i-1];else for(var o=e;o<t;o++)r.move[o]=o+1,this.items[o]=this.items[o+1];r.move[t]=e,this.items[t]=n,this.trigger(r,this.items)}}},{key:"reorder",value:function(e){for(var t=[],r={move:{}},n=0;n<Math.min(this.items.length,e.length);n++)t[n]=this.items[e[n]],r.move[n]=e[n];this.items=t,this.trigger(r,this.items)}},{key:"sort",value:function(e,t){}},{key:"filter",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.filterFn=e;var t={},r={};if(e)for(var n=0;n<this.items.length;n++){var i=this.idAt(n),o=!(i in this.filtered),a=e.call(this,this.get(n),n,this.items);o!=a&&(t[i]=a,r[i]=!0,a?delete this.filtered[i]:this.filtered[i]=!0)}else{for(var s in this.filtered)t[s]=r[s]=!0;this.filtered={}}this.trigger({filter:r},t)}}]),r}(d),b={Eventer:d,Model:m,Store:g,List:_,Component:y,templates:{},components:{},instances:new WeakMap,component:function(e,r,i){var o=i.name||t(e,!0),a=function(o,a){var s=this;null!==o&&o.constructor!==Object||(o=new m(o||{})),this.el=a||(i.el||b.templates[e]).cloneNode(!0),this.data=o,b.instances.set(this.el,this);var l=function(){for(var i=0,a=Array.from(s.el.querySelectorAll('[class^="'.concat(e,'__"]')));i<a.length;i++){var l=a[i],c=t(l.classList[0].substr(e.length+2)),f=l;if(l.classList[1]){var u=t(l.classList[1],!0);if(u in b.components){var h=n(l);f=new b.components[u](h),h.get("isUnmounted")?f.unmount(l):f.mount(l)}}s[c]=f}r&&r.call(s,o,s.watch.bind(s))};o.get("isUnmounted")?this._finishInit=l:l()};return Object.defineProperty(a,"name",{value:o}),a.prototype=new b.Component,a.props=i.props||{},b.components[o]=a,a},registerTemplates:function(e){for(e||(e=document.getElementById("templates"));e.childElementCount;){var t=e.firstElementChild,r=t.classList[0];b.templates[r]=t,t.remove()}e.remove()}},k=[],w=!1;b.mount=function(r){if(w){r=r||document.getElementById("app");for(var i=0,o=Array.from(r.children);i<o.length;i++){var a=o[i];if(a.classList[0]){var s=t(a.classList[0],!0);if(s in b.components){var l=n(a),c=new b.components[s](l,l.get("isRendered")?a:null);!l.get("isRendered")&&c.mount(a);continue}}b.mount(a)}}else k.push(b.mount.bind(e,r))},document.addEventListener("DOMContentLoaded",(function(){b.registerTemplates(document.getElementById("templates")),w=!0;var e,t=_createForOfIteratorHelper(k);try{for(t.s();!(e=t.n()).done;){(0,e.value)()}}catch(e){t.e(e)}finally{t.f()}})),window.Swick=b,"Sw"in window||(window.Sw=b)}();