-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcircular.min.js
2 lines (2 loc) · 60.3 KB
/
circular.min.js
1
2
!function(e){"use strict";var t=e.Math.random,n=document.createElement("a"),r=e.document.createDocumentFragment(),o=f.modules={},i={};function a(){return"_module_"+(t()+t())}function l(e){var t,r=/(?:^\!|^http[s]*:|.*\.js$)/.test(e)?"":".js";return e=(f.development[e]||f.options.devMocks&&f.mocks[e]||""||f.paths[e]||e).replace(/^[!%]/,""),t=function(e){return n.href=e,(-1!==e.indexOf(n.host)?n.origin:"")+n.pathname+n.search}((f.baseUrl||".")+"/"+e+r).replace(/^.\//,""),f.mapPath?f.mapPath(e,r,t):t}function s(e){var t={mapPath:"function",baseUrl:"string"},n=["lookaheadMap","paths","options","mapPath","baseUrl","lazyPackages","development","mocks"];if(!f[n[0]])for(var r=n.length;r--;)f[n[r]]="string"===t[n[r]]?"":"function"===t[n[r]]?null:{};for(var o in e)if(-1!==n.indexOf(o))if(t[o])f[o]=e[o];else for(var i in e[o])f[o][i]=e[o][i];return f}function c(e){var t=f.lookaheadMap[e],n=f.options.minifyPrefix;if(t&&-1===(f.development[e]||f.options.devMocks&&f.mocks[e]||""||f.paths[e]||"").indexOf(n)){f(t);for(var r=0,i=t.length;r<i;r++)o[t[r]]||c(t[r])}}function u(e){for(var t=e.deps,n=!0,r=t.length;r--;)o[t[r]]&&void 0===o[t[r]].done&&(n=!1);n&&p(e)}function p(e){var t=e.parents||[];e.factory&&!e.isFile?(e.done=e.factory.apply(null,e.deps.map(function(e){return o[e].done})),delete e.factory):void 0===e.done&&delete o[e.name];for(var n=t.length;n--;)o[t[n]]&&u(o[t[n]])}function d(t,n){var r,a=e.document.createElement("script");return a.type="text/javascript",a.async=a.defer=!n,a.charset="utf-8",a.onload=a.onreadystatechange=(r=t,function(e){var t=e.currentTarget||e.srcElement;"load"!==e.type&&"complete"!==t.readyState||(a.onload=a.onreadystatechange=null,function(e){var e=o[e.name];if(0===i.name.indexOf("_module_")){e.done=i.done,e.factory=i.factory,e.deps=i.deps;for(var t=e.deps.length,n={};t--;)(n=o[e.deps[t]].parents)[n.indexOf(i.name)]=e.name;delete o[i.name]}u(e)}(r))}),a.src=t.path,a}function f(e,t,n,r){e.constructor===Array?h(a(),e,t,n,r):h(a(),[],e,t,n)}function h(e,t,n,s,h){var v={};if("string"!=typeof e)return f(e,t,n,s);(!e&&n&&n.name||s)&&(e=s||n.name),e=e||a(),v=o[e],function(e,t,n){for(var i=t.length,a={},s="";i--;)s=t[i],o[s]?o[s].parents.push(e):(a=o[s]={name:s,isInline:"%"===s.charAt(0),isFile:"!"===s.charAt(0),path:l(s),parents:[e]}).isFile?f.getFile(a,p):a.isInline||(r.appendChild(d(a,n)),c(s));r.children.length&&document.head.appendChild(r)}(e,t,h),v?(v.deps=t,v.factory=n,v.isInline&&p(v)):u(v=o[e]={name:e,deps:t,factory:n,parents:[]}),i=v}e.define&&e.define.amd||(h.amd={},f.config=s,f.getFile=function(e,t){return e},f.debug=function(){return{modules:o,executed:i}},e.define=h,e.require=f,s({}))}(this),define([],function(){"use strict";var e=document.createElement("a"),t={undefined:void 0,null:null,NaN:NaN,true:!0,false:!1},n={convertToType:function(e){return t.hasOwnProperty(e)?t[e]:e.toString&&+e.toString()===e?+e:e},closest:function(e,t,r){if(e.closest)n.closest=function(e,t){return e.closest(t)};else{var o=e.msMatchesSelector||e.webkitMatchesSelector||e.matches;n.closest=function(e,t){if(!(r||document.documentElement).contains(e))return null;do{if(o.call(e,t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null}}return n.closest(e,t,r)},findParent:function(e,t,n){do{if(e[t||"cr-id"])return e;e=e.parentElement||e.parentNode}while(null!==e&&e!==n&&1===e.nodeType);return null},$create:function(e,t){var n=document.createElement(e);return t&&(n.className=t),n},$:function(e,t){return"string"==typeof e?(t||document).querySelector(e):e},$$:function(e,t){return(t||document).querySelectorAll(e)},keys:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t},cloneObject:function(e,t){var n=function(e,t,n){t[n]=e[n]};for(var r in t)n(t,e,r);return e},isArray:Array.isArray||function(e){return e&&e.constructor===Array},addEvent:function(e,t,n,r){return r=void 0!==r?r:!!/(?:focus|blur|mouseenter|mouseleave|scroll)/.test(t),e.addEventListener(t,n,r),function(){return e.removeEventListener(t,n,r),e=n=t=r=null}},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},storageHelper:{fetch:function(e,t){var n=localStorage.getItem(e),r=n?JSON.parse(n):n;return t&&n?r[t]:r},saveLazy:function(e,t,r){n.lazy(function(){n.storageHelper.save(e,t)},r||n.storageHelper)},save:function(e,t,r){var o;if(null===e)return localStorage.removeItem(t);r?((o=n.storageHelper.fetch(t)||{})[r]=e,localStorage.setItem(t,JSON.stringify(o))):localStorage.setItem(t,JSON.stringify(e))}},lazy:function(e,t,n){clearTimeout(t._timer),t._timer=setTimeout(e,0,n)},normalizePath:function(t){return e.href=t,(-1!==t.indexOf(e.host)?e.origin:"")+e.pathname+e.search},ajax:function(e,t){var o,i,a=null,l=(new Date).getTime();return t=t||{},e=n.normalizePath(e),i=r[e]&&r[e].time||0,a=(a=(o=!0===t.cache?l+1e8:t.cache?i>l?i:l+t.cache:0)&&!t.resetCache&&i>l?r[e]:null)||new n.Promise(function(n,r){var o,i,a=new XMLHttpRequest,l=(t.method||t.type||"GET").toUpperCase();if(a||r("Giving up :( Cannot create an XMLHTTP instance"),t||(e=(t=e).url),a.onreadystatechange=function(){var e=function(e,t,n){try{if(e.readyState===XMLHttpRequest.DONE){if(!(e.status<200||e.status>299))return e["xml"===t?"responseXML":"raw"===t?"response":"responseText"];var r=new Error(e.statusText);r.response=e.response,n(r)}}catch(e){n("Caught Exception: "+e.stack)}}(this,t.dataType,r);if(void 0!==e){if("json"===t.dataType)try{e=JSON.parse(e)}catch(e){return void r("Caught Exception: "+e.stack)}n(e)}},a.open(l,e,t.async||!0,t.username,t.password),"raw"===t.dataType&&(a.responseType="blob"),"xml"===t.dataType&&a.setRequestHeader("Content-Type","text/xml"),"json"===t.dataType&&a.setRequestHeader("Content-Type","application/json"),"GET"!==l&&t.csrf&&a.setRequestHeader("X-XSRF-TOKEN",(o=t.csrf,(i=document.cookie.split(o+"=")[1])&&i.split(";")[0])),t.headers)for(var s in t.headers)a.setRequestHeader(s,t.headers[s]);return a.send(t.data),function(){a.abort()}}),o?(r[e]=a,r[e].time=o):delete r[e],a},errorHandler:function(e){console.error(e)},Promise:o},r={};function o(e,t){this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],this._returnFn=c(e,this),this._staticData=t}function i(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,setTimeout(function(){var n,r=1===e._state?t.onFulfilled:t.onRejected;if(null!==r){try{n=r(e._value)}catch(e){return void l(t.promise,e)}a(t.promise,n)}else(1===e._state?a:l)(t.promise,e._value)})):e._deferreds.push(t)}function a(e,t){try{if(t){var n=t.then;if(t instanceof o)return e._state=3,e._value=t,void s(e);if("function"==typeof n)return c(n.bind(t),e)}e._cancelFn=null,e._state=1,e._value=t,s(e)}catch(t){l(e,t)}}function l(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e._deferreds.length&&setTimeout(function(){e._handled||console.warn("Possible Unhandled Promise Rejection:",e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)i(e,e._deferreds[t]);e._deferreds=null}function c(e,t){var n=!1,r=function(e){n||(n=!0,l(t,e))};try{return e(function(e){n||(n=!0,a(t,e))},r)}catch(e){r(e)}}return o._cache={},o.prototype.catch=function(e){return this.then(null,e||function(e){console.error(e)})},o.prototype.then=function(e,t){var n=this._returnFn,r=new o(function(){return n});return i(this,{onFulfilled:e||null,onRejected:t||null,promise:r}),r},o.prototype.cancel=function(e,t){var n=o._cache[e];return o._cache[e]=this,n?(1!==n._state?(n._returnFn&&"function"==typeof n._returnFn&&n._returnFn(),n._deferreds=[],n.then=n.catch=function(){},n._handled=!0,n._state=1,n._cancelFn&&n._cancelFn()):this._cancelFn=t,n._returnFn=null,n._cancelFn=null,this):this},o.all=function(e){var t=[];return e.reduce(function(e,n){return e.then(function(){return n}).then(function(e){return t.push(e)})},new o(function(e,t){e(null)})).then(function(){return t})},window.require&&(require.getFile=function(e,t){var r=e.name.substring(e.name.lastIndexOf(".")+1).toLowerCase(),o=/^(?:json|xml)$/.test(r)?r:"";n.ajax(e.path,{cache:"!!"!==e.name.substr(0,2),dataType:o}).then(function(n){e.done=n,t(e)})}),n},"toolbox"),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],function(){return t()},"schnauzer"):"object"==typeof exports?exports.Schnauzer=t():e.Schnauzer=t()}(this&&this.window||global,function(){"use strict";var e=Object.keys||function(e){var t=[],n="";for(n in e)hasOwnProperty.call(e,n)&&t.push(n);return t},t=function(e,t,n){t[n]=e[n]},n=function(e,n){for(var r in n)t(n,e,r);return e},r=function(e,t){return t.push.apply(t,e),t},o={start:/^\s*/,end:/\s*$/},i=function(e,t){this.version="2.0.9",this.partials={},this.helpers={},this.regexps={},this.controls={active:!1,stop:!1,loop:[]},this.options={tags:["{{","}}"],entityMap:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="},helpers:{},partials:{},self:"self",escapeHTML:!0,limitPartialScope:!0,loopHelper:null,renderHook:null},a(this,t||{},e)},a=function(e,t,r){"string"!=typeof r&&(t=r,r=""),s(e,(t=n(e.options,t)).tags),e.helpers=t.helpers,e.registerPartial(t.partials),void 0!==r&&e.parse(r),delete t.helpers,delete t.partials},l=i.SafeString=function(e){this.string=e};return l.prototype.toString=l.prototype.toHTML=function(){return""+this.string},i.getObjectKeys=e,i.cloneObject=n,i.concatArrays=r,i.isEmpty=function(t){return!t||(t.constructor===Array?!t.length:"object"==typeof t?!e(t).length:!t)},i.prototype={render:function(e,t){var n=u(this,"","",0,e,null,[{scope:e}]);return[this.partials[this.options.self]({blocks:{},extra:t,scopes:[{scope:e,helpers:n,level:[],values:null,alias:{}}]}),this.controls.active=!0][0]},parse:function(e){return this.registerPartial(this.options.self,e)},registerHelper:function(e,t){if("string"==typeof e)return this.helpers[e]=t;for(var n in e)this.helpers[n]=e[n]},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if("string"==typeof e)return this.partials[e]=this.partials[e]||(t.constructor===Function?t:function(e,t,n){var r=t.split(e.regexps.tags);n.push({text:r[0]});for(var o=1,i="",a="",l="",s=0,c="",u=[],p=[],d=/^[!-]+/,f=/^else\s*/,h={"#":"B","^":"B","/":"C",E:"E"},v={},g="",m="",y={},b=r.length;o<b;o+=5)i=r[1+o].replace("~",""),a=r[2+o],l=k(r[4+o],r[3+o],r[6+o]||""),"\\"===r[o].charAt(0)||d.test(i)||(s=a.indexOf(" "),c="/"!==i&&a.substring(0,s)||a,m=h[(g="^"===i&&(-1!==s||""===a)||"else"===c?"E":i).charAt(0)]||"I","#>"===i&&(u.unshift("@"+c),p.unshift("@"+a)),"E"===g&&(a=a.replace(f,"")),y="/"===i?{tag:"C",text:l,vars:a}:O(e,a,i,r[o],m,l),"^"===i&&"B"===m&&(y.alt=y.vars[0].orig),"#*"===i&&(y.isPartial=!0),n=w(e,n,y,r[o]),"C"===m&&(n[n.length-1].isPartial||u[0])&&(y=n.splice(-1,1,u[0]?O(e,p[0],">",r[o],"I",y.text):{text:y.text})[0],(v=y.children[0]).children.unshift({text:v.text}),e.registerPartial(u[0]||y.vars[0].value,v.bodyFn),u.shift(),p.shift()));if(n.parent)throw"Schnauzer Error: Missing closing tag(s)";return r=t=null,S(e,{children:n})}(this,t,[]));for(var n in e)this.registerPartial(n,e[n])},unregisterPartial:function(e){delete this.partials[e]},setTags:function(e){s(this,e)},escapeExpression:function(e){return c(this,e,!0)}},i;function s(t,n){var r=function(e){for(var t=e.length;t--;)e[t]="("+e[t]+")";return e}("{{"===n[0]?["{{2,3}","[~}]{2,4}"]:n);t.regexps={tags:new RegExp(r[0]+"([#~^/!>*-]*)\\s*([^~}]*)"+r[1]),entity:new RegExp("["+e(t.options.entityMap).join("")+"]","g")}}function c(e,t,n){return null==t?"":t.constructor===i.SafeString?t.string:n&&e.options.escapeHTML?String(t).replace(e.regexps.entity,function(t){return e.options.entityMap[t]}):t}function u(e,t,n,r,o,i,a){return r?{"@index":t,"@number":t+1,"@key":n,"@odd":t%2!=0,"@last":t===r-1,"@first":0===t,"@length":r,"@depth":e.options.limitPartialScope?void 0:a.length-2,"@loop":i,"@parent":a[1].scope,"@root":a[a.length-1].scope,this:o,".":o}:{"@parent":i,"@root":a[a.length-1].scope,this:o,".":o}}function p(e,t,o){var i=e.scopes,a=e.alias?[e.alias]:[],l=r(i[0].level,a),s=e.values,c=i[1]?n({},i[1].alias):{};return e.alias=null,e.values=null,o=o?n(c,o):c,e.scopes=r(i,[{scope:t,helpers:i[0].helpers,level:l,values:s,alias:o}]),function(){e.scopes=i}}function d(e,t){var n=e.scope;return e.scope=t||{},function(){e.scope=n}}function f(e,t,n){if("."===t.value||"this"===t.value)return{value:e,variable:t};if("key"!==t.type)return{value:t.value,variable:t};for(var r="@root"===t.path[0]?1:0,o=t.path.length;r<o;r++)if(!(e=e[t.path[r]]))return{variable:t};return{value:e[t.value],parent:e,variable:t,alias:n||!1}}function h(e,t,n,r){for(var o=0,i=e.length;o<i;o++)if(void 0!==(r=f(e[o],t,!0)).value)return(n=n.alias[r.variable.value])&&(r.parent=n.parent,r.key=n.key),r;return{variable:t}}function v(e,t,n,r,o){void 0!==o.value&&void 0!==r&&(n[e]||(n[e]={}),n[e][r]=o.value,t&&(t.alias[r]={parent:o.parent,key:o.variable.value}))}function g(e,t,n,r){var o=n.vars,i=!!e.options.renderHook;if(!o)return r;for(var a,l=0,s=o.length,c={},u={},p={},d=[];l<s;l++)(u=(c=o[l]).path&&"@root"===c.path[0]?t.scopes[t.scopes.length-1]:t.scopes[c.depth||0])?(void 0===(p={value:u.helpers[c.value],variable:c,parent:a="@"===(c.value+"").charAt(0)?u.helpers:u.scope}).value&&u.values&&(p=h([u.values],c,u,p)),void 0!==p.value||c.isStrict||(p=h(u.level,c,u,p)),void 0===p.value&&(p=c.helper?{value:y(e,d=g(e,t,c,[]),t,c)}:f(u.scope,c)),void 0===p.value&&t.extra&&(p=f(t.extra,c)),void 0===p.value&&a&&(p.parent=u.helpers),c.alias&&v("alias",i&&u,t,c.alias[0],p),c.name&&v("values",i&&u,t,c.name,p),p.type=p.value&&p.value.constructor===Array?"array":typeof p.value,p.variable||(p.variable=c),i&&c.helper&&(p.renderArgs=d),i&&e.controls.loop[0]&&(p.loop=e.controls.loop[0]),r.push(p)):r.push(p);return i&&n.helper&&!n.tag&&(n.renderFn=function(r){return y(e,r,t,n)}),r}function m(t,n,r){var o=t.value,i="object"===t.type;return"each"!==n&&"with"!==n&&("array"!==t.type||"if"!==n&&"unless"!==n)||void 0===o?o:(i&&(r.keys=e(o)),i?r.keys.length&&o:o.length&&o)}function y(t,o,a,l,s){var c,u=!l.helper&&l.children&&(o[0]?b:void 0)||l.helperFn,p=[],h=a.scopes[0].values;return u?u(t,o,a,l,s):((u=function(e,t,n){var r=t.scopes[n.helper.depth||0].scope,o=e.helpers[n.helper.orig];return n.helperFn||(n.helper.isStrict||!o?f(r,n.helper).value:o)}(t,a,l))||1!==o.length||"function"!==o[0].type||(u=o.shift().value),a.values&&(a.scopes[0].values=a.values),o.length&&p.push(function(t,o,a,l,s,c){var u=null,p=a.helper?a.helper.orig:"",f=o.scopes[0].helpers,h=a.children,v={name:p,hash:{},data:{root:f["@root"],scope:f.this,parent:f["@parent"]},escapeExpression:function(e){return t.escapeExpression(e)},SafeString:i.SafeString,keys:e,extend:n,concat:r,getDataDetails:function(){return l},isEmpty:i.isEmpty};f["@length"]&&n(v.data,{loop:f["@loop"],depth:f["@depth"],index:f["@index"],number:f["@number"],length:f["@length"],first:f["@first"],last:f["@last"],key:f["@key"],odd:f["@odd"]});for(var g=l.length;g--;)l[g].variable.name?v.hash[l[g].variable.name]=l[g].value:s.unshift(l[g].value);return h&&(v.fn=function(e){return c.fnIdx=0,c.checkFn&&c.checkFn(0),u=d(o.scopes[0],e),[h[0].text+h[0].bodyFn(o),u()][0]},v.inverse=h[1]&&function(e){return c.fnIdx=1,c.checkFn&&c.checkFn(1),u=d(o.scopes[0],e),[h[1].text+h[1].bodyFn(o),u()][0]}||function(){return""}),v}(t,a,l,o,p,s)),c=u?u.apply(a.scopes[0].scope,p):"",a.scopes[0].values=h,void 0===c?"":c)}function b(e,t,n,r,o){for(var i=0,a={keys:[]},l=r.children,s=l[i],c=r.helper,d="if"===c||"each"===c||"with"===c,f=!c&&1===t.length,h=t[0]||{},v=m(h,c,a),y=(d||f)&&v||"unless"===c&&!v,b=null;l[i+1]&&!y;)d="if"===(c=(s=l[++i]).helper)||"each"===c||"with"===c,t=s.vars.length?g(e,n,s,[]):[],f=!c&&1===t.length,v=m(h=t[0]||{},c,a),y=(d||f)&&v||"unless"===c&&!v||!c&&!t.length&&s.bodyFn;if(o.fnIdx=y?i:i+1,o.checkFn&&o.checkFn(i),f&&"array"===h.type&&(c="each"),e.controls.stop&&"string"!=typeof e.controls.stop&&"each"===c)return"";if(f&&!c&&(c="with"),"with"===c||"each"===c){if(b=p(n,v,"with"===c&&n.scopes[0].alias),"each"===c)return function(e,t,n,r,o,i,a,l){var s=o.bodyFn,c=r.scopes[0],p=n.variable.alias,d=c.level[0],f="array"===n.type,h=f||"object"===n.type?f?t:i:[],v=r.scopes,g=a&&function(i,l){return r.scopes=v,r.scopes[0].scope=i,r.scopes[0].helpers=u(e,l,l,n.value.length,i,t,r.scopes),e.controls.loop.unshift(c.helpers),[a(e,o.text+s(r),n,+l,g,!0),e.controls.loop.shift()][0]};p&&a&&(c.alias[p[0]]={parent:t});if(e.controls.stop)return["",a(e,g,n),l()][0];a&&e.controls.loop.unshift(null);for(var m=0,y=h.length,b="",x="";m<y;m++)b=f?m:h[m],c.helpers=u(e,m,b,y,t[b],t,r.scopes),c.scope=t[b],p&&(p[1]&&(d[p[1]]=b),d[p[0]]=t[b],a&&(c.alias[p[0]].key=b)),a&&(e.controls.loop[0]=c.helpers),x+=g?a(e,(a(e,b,n),o.text+s(r)),n,m,g):o.text+s(r);return[x,l(),a&&e.controls.loop.shift()][0]}(e,v,h,n,s,a.keys,e.options.loopHelper,b);n.scopes[0].helpers=u(e,"","",0,f?v:n.scopes[0].scope,n.scopes[1].scope,n.scopes)}return[y?s.text+s.bodyFn(n):"",b&&b()][0]}function x(e,t,n,r,o,i,a){return t.values=null,e.options.renderHook&&"B"===r.tag&&(t={extra:t.extra,scopes:t.scopes,alias:t.alias,blocks:t.blocks}),e.options.renderHook&&n.length&&!e.controls.active?e.options.renderHook(e,o,t.scopes[0],n,function(n,o,l){return o&&(t.scopes[0].helpers=o),n[0].parent&&(t.scopes[0].scope=n[0].parent),l&&(e.controls.stop=l),[i(e,r,n,t,a||{fnIdx:0}),e.controls.stop=!1,e.controls.active=!0][0]},r,"B"===r.tag?a||{fnIdx:0}:void 0,r.children&&r.children[1]&&"E"===r.children[1].tag?function(n){return g(e,t,n,[])}:null):o}function _(e,t,n,r){var o=n[0]&&n[0].type,i=t.partial?function(e,t,n,r){var o=r.partial.vars&&g(e,n,r.partial,[]),i=r.partial.helper&&y(e,o,n,r.partial),a=r.partial.orig||o&&(i||o[0].value)||"",l="@partial-block"===a,s=!l&&"@"===a.charAt(0),c=e.partials[s?a.substring(1):a]||n.extra&&n.extra[a],u=p(n,t[0]&&!t[0].variable.name?t[0].value:n.scopes[0].scope,n.scopes[0].alias);return n.scopes[0].level=[],!c&&s&&(c=e.partials[a]),s?n.blocks[a]=e.partials[a]:l&&(c=n.blocks[a]),e.options.limitPartialScope?n.scopes=[n.scopes[0]]:n.scopes.splice(1,1),[c?c(n):"",u()][0]}(e,n,r,t):c(e,t.helper||"function"===o?y(e,n,r,t):n[0]&&n[0].value,"boolean"!==o&&"number"!==o&&t.isEscaped);return x(e,r,n,t,i,_,null)}function N(e,t,n,r,o){var i=o||{fnIdx:0},a=y(e,n,r,t,i);return o?a:x(e,r,n,t,a,N,i)}function k(e,t,n){return-1!==t.indexOf("~")&&(e=e.replace(o.start,"")),-1!==n.indexOf("~")?e.replace(o.end,""):e}function C(e,t){return t?e:"true"===e||"false"!==e&&(isNaN(e)||""===e?e:+e)}function A(e,t,n){var r=!1,o=e.replace(/@parent[/.]/,"../").replace(/\[.*?]/g,function(e){return e.substring(1,e.length-1).replace(/\./g,function(){return r=!0,"^"})}),i=n?[]:o.split("../"),a=i[1]?i[0]:"",l=i.length-1,s=n?o:i[l];if(n||"."===s||"this"===s||+s==s)return{value:s,path:[],depth:l,type:"key"};if(i=function(e,t){return e.replace(/^(?:this[/.]|\.\/|\|)/,function(e){return e&&(t.isStrict=!0),""})}(s,t).split(/[./]/),r){for(var c=i.length;c--;)i[c]=i[c].replace(/\^/g,".");o=o.replace(/\^/g,".")}return{value:a+i.pop(),path:i,depth:l,orig:o}}function P(e,t,n){for(var r=e.length,o=[];r--;)o.unshift(e[r].value);if(n)for(;o.length;)t[t.length-o.length].name=o.shift();else t[t.length-1].alias=o}function E(e,t,r,o){for(var i="string"===o?[e]:e.split(/[,;]*\s+[,;]*/),a="alias"===o||"string"===o,l=0,s=i.length,c=/--(\d+)--/,u=/%+/,p="",d=[],f="",h={},v={},g=!1;l<s;l++)if(i[l]&&""!==(f=void 0!==(d=i[l].split("="))[1]?d[1]:d[0])&&"as"!==f){if("object"===(p=typeof(h=t[(f.match(c)||[])[1]]||{value:f,type:"key"}).value)&&h.value[0]&&h.value[0].single)return h.value;void 0!==d[1]&&(h.name=d[0]),"string"===h.type?h.value=h.value[0]&&h.value[0].value||"":h.value&&"string"===p&&(h.value=h.value.replace(u,function(e){return h.active=e.length,""}),v=A(h.value,h,a),g=a||v.orig&&v.orig!==v.value,h.value=C(v.value,g),"string"!==(p=typeof h.value)?h.type=p:v.path&&!a&&n(h,v)),"alias"===h.type?P(h.value,r,l>3):r.push(h)}return r}function O(e,t,n,r,o,i){var a=t?function(e,t){var n=/\([^()]*\)/g,r=function(e){var n={vars:E(e.substring(1,e.length-1),t,[],"fn")};return n.vars.length>1&&(n.helper=n.vars.shift()),"--"+(t.push(n)-1)+"--"};for(e=e.replace(/(['"|])(?:[^\\'"]|\\+['"]|['"])*?\1/g,function(n,r){var o={type:"|"!==r?"string":"alias",value:""};return-1!==e.indexOf("["+r)||-1!==e.indexOf(r+"=")?n:(o.value=n===e?[{value:n.substring(1,n.length-1),path:[],depth:0,single:!0,type:"key"}]:E(n.substring(1,n.length-1),t,[],o.type),"--"+(t.push(o)-1)+"--")});e!==(e=e.replace(n,r)););return E(e,t,[],"")}(t,[]):[],l="^"===n?"unless":/^(?:if|each|with|unless)$/.test((a[0]||{}).value)?a.shift().value:"";return{partial:">"===n?a.shift():void 0,helper:l||(">"!==n&&a.length>1?a.shift():""),helperFn:l?b:void 0,isEscaped:r.lastIndexOf(e.options.tags[0])<1,bodyFn:null,vars:a,isInline:"B"!==o,tag:o,text:i,children:null}}function S(e,t){return t.bodyFn="B"===t.tag?void 0:function(n){return function(e,t,n){for(var r=0,o=t.length,i="";r<o;r++)i+=("B"===t[r].tag?N:_)(e,t[r],g(e,n,t[r],[]),n)+t[r].text;return i}(e,t.children,n)}}function w(e,t,n,r){var o='Schnauzer Error: Wrong closing tag: "/'+n.vars+'"',i=t.parent,a=[],l=function(n,o){n.children=a=[],a.parent=t,t=a,o&&(t.push(O(e,"","",r,"",n.text)),l(t[t.length-1]),t.isElse=!0)},s=function(){delete t.parent,delete t.isElse,i=(t=i).parent,S(e,t[t.length-1])};if("C"===n.tag){if(!t.parent)throw o;if(t.isElse&&s(),s(),t.lastBlock!==n.vars)throw o;delete t.lastBlock,t[t.length-1].text=n.text}else"B"===n.tag?(t.push(n),t.lastBlock=n.alt||n.helper.value||n.helper||n.vars[0].orig,l(n,!0)):"E"===n.tag?(t.isElse&&s(),t.push(n),l(n),t.isElse=!0):t.push(n);return t}}),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(e,require("schnauzer")):"function"==typeof define&&define.amd?define(["schnauzer"],function(n){return t(e,n)},"blick"):"object"==typeof exports?exports.Blick=t(e,require("schnauzer")):e.Blick=t(e,e.Blick)}(this,function(e,t,n){"use strict";var r=document.implementation.createHTMLDocument(),o=function(e,t){for(var o in t)t[o]=r.createElement(t[o]);return function(o,i,a){var l="string"==typeof o?((o||"").match(e)||[])[1]:n,s=t[l]||t.default;return i&&(s="boolean"==typeof i?s.cloneNode():i),a?o?s.textContent=o:s.appendChild(r.createTextNode("")):s.insertAdjacentHTML("afterbegin",o||""),s}}(/<\s*(\w*)[\s\S]*?>/,{option:"select",legend:"fieldset",area:"map",param:"object",thead:"table",tr:"tbody",col:"colgroup",td:"tr",default:"div"}),i=r.createDocumentFragment();return function(e,t){var i=function(o,i){e.call(this,o,i),this.options=t(this.options,{registerLoopItem:function(e,t,n,r){},isDynamic:function(e,t,n,r,o){return!1},scanHTML:function(e,t,n,r,o,i){},loopHelperName:"loop-helper",loopFnName:"__loopFn",loopLimitsName:"__loopLimits",limiters:["{{#","{{END:","}}"],forceUpdate:!1,missingProperty:n,debugMode:"",debugLevel:2,attributes:{value:s,disabled:l,hidden:l,checked:l,autocomplete:l,contenteditable:l,readonly:l,required:l,selected:l}}),this.version={blick:"1.0.5",schnauzer:this.version},this.collector={destroyers:{},updaters:{},movers:{},helpers:{},element:{}},this.returnFragment=r.createDocumentFragment(),this.dataDump=[],this._firstTimeLoop=null,this._tempNode=null,a(this,i||{},o)},a=function(e,n,r){var o;"string"!=typeof r&&(n=r),t(n.attributes||{},e.options.attributes),t(e.options,n),delete e.options.helpers,delete e.options.partials,e.options.renderHook=h,e.options.loopHelper=C,o=e.options.limiters,e.xpath={xpath:['//text()[contains(., "'+o[0]+'") or contains(., "'+o[1]+'")]','//@*[contains(., "'+o[0]+'")]'].join(" | "),regex:new RegExp("("+o[0]+"|"+o[1]+")(\\d+)"+o[2],"g"),startTag:o[0],type:XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE}};return function(e,t){function n(){this.constructor=e}for(var r in t)t[r]&&(e[r]=t[r]);n.prototype=t.prototype,e.prototype=new n}(i,e),i.setScroll=T,t(i.prototype,{renderHTML:function(e,t){return function(e,t,n,i){var a=e.returnFragment.childNodes.length?r.createDocumentFragment():e.returnFragment;for(e.controls.active=!1,i=p(e,e.dataDump,o(e.render(t,n),!0)).childNodes;i.length;)a.appendChild(i[0]);return a}(this,e,t,[])},destroyInstance:function(e){!function(e,t){for(var n in t){for(var r in e.destroyers[n])k(e,n+":"+r);delete e.destroyers[n]}}(this.collector,e)},removeChild:function(e,t,n){return E(this,e,t,n)},moveChild:function(e,t,n,r,o,i){return function(e,t,n,r,o,i,a){var l=e.options,s=o[l.loopLimitsName],c=n!==o,u=s[r+(c||n===o&&r<t?0:1)],p=n[l.loopLimitsName][t+1];if(t===r&&n===o)return;u||s.push(u=e._tempNode);e._tempNode=null,u.nextSibling?u.parentNode.insertBefore(E(e,t,n,n[t],!0,c),u.nextSibling):u.parentNode.appendChild(E(e,t,n,n[t],!0,c));s.splice(r+1,0,p),!a&&e.controls.helpers&&P(e,t,n,c?o[r]:n[t],!1,r,o,i)}(this,e,t,n,r,o,i)},addChild:function(e,t,n){return function(e,t,n,r){var i=e.options,a=Node.COMMENT_NODE,l=n[i.loopLimitsName],s=n[i.loopFnName],c=(l||{})[t],u=c,d=c;if(!l)throw"Blick error:\n- Template might have wrong notation(s).\n- Check %variable.";if(2===l.length&&1===n.length&&l[0].parentNode.childNodes.length>4)return;if(!s||!c)return;e.controls.active=!1,d=e._firstTimeLoop||p(e,e.dataDump,o(s(r,t))),e.controls.active=!0,i.scanHTML(e,d,n[t],n);for(var f=d.childNodes,h=f.length;h--;)f[h].nodeType!==a||f[h].textContent!==i.loopHelperName?(1===f[h].nodeType&&(e.collector.element[n[t]["cr-id"].split(":")[1]]=f[h]),c=c.parentNode.insertBefore(f[h],c)):(f[h].parentNode.removeChild(f[h]),l.splice(t+1,0,u=f[--h]),c=c.nextSibling?c.parentNode.insertBefore(u,c.nextSibling):c.parentNode.appendChild(u));e._firstTimeLoop&&(l.splice(1,1),e._firstTimeLoop=null);e.controls.helpers&&P(e,t,n)}(this,e,t,n)},findElement:function(e){return this.collector.element[e["cr-id"].split(":")[1]]}}).constructor}(t,t.cloneObject);function a(t,n){!t.options.debugMode||t.options.debugLevel>n||e.console&&e.console[t.options.debugMode]&&e.console[t.options.debugMode].apply(null,[].slice.call(arguments).slice(2))}function l(e,t,n){var r=-1!==n.indexOf("focus"),o=r&&-1!==n.indexOf(":end");return!0===n||"true"===n||n&&!1!==n&&"false"!==n&&!r?(e.setAttribute(t,"selected"===t?t:""),function(){e[t]=!0}):(e.removeAttribute(t),r&&e.focus(),o&&(e.selectionStart=e.selectionEnd=e.value.length),function(){e[t]=!1})}function s(e,t,n){return e.setAttribute(t,n),e.value=n,function(){}}function c(e,t){var n=r.createTextNode("");return t?e.insertBefore(n,e.childNodes[0]):e.appendChild(n)}function u(e,t,n,r,o,i,a){var l=!!n;l?t=[n[0].parentNode]:(o=c(a=(t=Array.prototype.slice.call(t))[0].parentNode,!0),e[e.length-1].node=c(a));for(var s=e.length-(l?0:1),u=(t[0],s);u--;)if("each"===r[e[u].id].tagData.helper){if(!l&&e[u].id===e[s].id){e[u].node=o;break}!l&&!e[u].isStart||l&&e[u].isStart?(a=t.pop().childNodes[0].parentNode,i=!l&&c(a,!l),e[u].node=c(a,l)):e[u].node=i||c(t[0],!l)}}function p(e,t,i,l,s){var c,p,d=t.length&&function(e,t,i,a,l){for(var s,c,p,d=r.evaluate(e.xpath,t,null,e.type,null),f=[],h=0,v=0;s=d.snapshotItem(h++);){f=[],v=0,s.textContent=s.textContent.replace(e.regex,function(t,n,r,o){return p={id:+r,isStart:n===e.startTag,index:o-v},f.push(p),v+=t.length,""}),s.nodeType===Node.ATTRIBUTE_NODE?(c=s,s=o(s.textContent,!0,!0).firstChild):c=n,(s.nextSibling&&(s.nextSibling.rows||s.parentNode.rows)&&"each"===a[p.id].tagData.helper||s.parentNode.rows)&&u(f,s.nextSibling.rows,(s.parentNode.rows||[{}])[0].cells,a);for(var g=f.length;g--;)i[(p=f[g]).id]||(i[p.id]={start:p.node||s,end:s,attr:c}),p.node?i[p.id][p.isStart?"start":"end"]=p.node:p.isStart?i[p.id].start=s.splitText(p.index).splitText(0).previousSibling:i[p.id].end=s.splitText(p.index)}return i}(e.xpath,i,[],t,e.options.loopHelperName);for(s&&d&&(e._tempNode=d[t[0].id].start);c=t.shift();)(p=d[c.id]?d[c.id].attr?O:"B"!==c.tagData.tag?S:w:null)?p(e,d[c.id],c,t,l):a(e,3,"Missing NodeElement in template:",{template:i.innerHTML});return i}function d(e,t,r){for(var o=0,i={},a=e.length;o<a;o++)i=e[o].variable,e[o].renderArgs&&d(e[o].renderArgs,e[o],r),i.active&&t.value!==n&&(t.renderArgs[o].parentHelper=t,r.push(t.renderArgs[o]))}function f(e,t,r,o,i,l){var s,c=o.variable,u=o.value!==n,p=o.key||c.value,f=l.partial&&l.partial.value,h=t.helpers["@parent"]||t.helpers.this;if("cr-scroll"===c.value&&i[0].variable.active&&(i[0].scrollers={}),o.renderArgs&&!f&&d(o.renderArgs,o,r),c&&c.active&&f!==c.value){if("@"===p.charAt(0)&&(o.parent[p]===n&&(o.parent[p]=""),u=!0,c.depth&&(o.movingParent=!0)),"@root"===c.path[0]&&(o.isFromRoot=!0),o.loop?(o.parent.parent||Object.defineProperty(o.parent,"__cr-id",{value:o.loop["@root"]["__cr-id"]}),o.parent["cr-id"]||o.parent.this||Object.defineProperty(o.parent,"cr-id",{value:o.loop.this["cr-id"]||o.loop["@parent"]["cr-id"]})):(o.parent["__cr-id"]||Object.defineProperty(o.parent,"__cr-id",{value:h["__cr-id"]}),o.parent["cr-id"]||Object.defineProperty(o.parent,"cr-id",{value:h["cr-id"]})),null===(s=e.options.isDynamic(o,p,e.options.forceUpdate)))return a(e,3,"No subscriber defined for:",'"'+p+'"',"in:",o.parent);e.options.debugMode&&function(e,t,r,o,i,l,s){t?1===r?a(e,1,"Engaging property",o.helper&&o.helper.value||o.helper||"-",'"'+s+'" ->',i.value,l.length,r):a(e,2,2===r?'Added model activity: "'+s+'" ->':'Missing model activity: "'+s+'" ->',i.value):t||e.options.missingProperty===n?t||e.options.missingProperty!==n||a(e,3,'Property "'+s+'", defined in template'+(o.helper?' by block "'+(o.helper.value||o.helper)+'"':"")+", is missing in model."):a(e,2,"Installing",i,"not supported yet if not in model")}(e,u,s,l,o,i,p),u&&r.push(o)}}function h(e,t,n,r,o,i,a,l){for(var s=e.options.limiters,c=e.dataDump.length+s[2],u="B"!==i.tag&&(i.helper&&!i.helperFn||!!i.partial),p=[],h=0,v=r.length;h<v;h++)r[h].parent?f(e,n,p,r[h],r,i):r[h].renderArgs&&d(r[h].renderArgs,r[h],p);return l&&function(e,t,n,r,o,i){for(var a,l=1,s=n.length;l<s;l++)if(n[l].vars.length)for(var c=(a=r(n[l])).length;c--;)f(e,t,i,a[c],a,o)}(e,n,i.children,l,i,p),0===p.length||i.partial?t:(e.dataDump.push({id:e.dataDump.length,out:t,track:a,bodyFn:o,data:r,actives:p,tagData:i,helperFn:u?o:null}),s[0]+c+t+s[1]+c)}function v(e,t,r,o){var i=e.parentHelper,a=i&&i.variable.renderFn,l=i&&i.renderArgs,s=!!e.variable.path.length;return function(c,u,p){var d=c!==n&&null!==c&&(c[o]||"").length,f="array"===e.type;s&&p!==e.parent||!f&&c===e.value&&e.variable.active<2||(e.value=c,a&&(l!==t[0].renderArgs&&function e(t,n){if(t.value=t.variable.renderFn(t.renderArgs),n)for(var r=n.length;r--;)n[r].renderArgs&&t.renderArgs!==n[r].renderArgs&&e(n[r])}(i,t[0].renderArgs),t[0].value=a(t[0].renderArgs)),r(t,e.loop,u||d&&(!f||0!==c.length),e.scrollers))}}function g(e,t,n,r){return e[t]||(e[t]={}),e[t][n]?e[t][n].push(r):e[t][n]=[r],e[t][n]}function m(e,t){var r=e[t[0]]=e[t[0]]||{};return t[1]===n&&(t[1]="root"),r[t[1]]=r[t[1]]||[]}function y(e,t){return function(){return e.splice(e.indexOf(t),1)[0]}}function b(e,t,n,r,o){var i=y(e,n);return function(e){var n=i(),a=(t.updaters,o);if(e){for(;a;)e=e.parentNode||{},a--;t.updaters[e["cr-id"]][r].push(n)}}}function x(e,t,n,r,o){e.controls.helpers||(e.controls.helpers=!0),t[r]=t[r]||{},t[r][o]=n.parent}function _(e,t,r,o,i,a){for(var l,s,c=i.length,u={},p="",d="",f="";c--;)p=(u=i[c]).key||u.variable.value,l=v(u,o,t,e.options.loopLimitsName),f=u.loop&&u.loop.this["cr-id"],d=u.parent.this!==n?u.parent.this["cr-id"]:u.parent["cr-id"],u.parent["cr-id"]===n&&Object.defineProperty(u.parent,"cr-id",{value:d}),m(r.destroyers,d.split(":")),s=g(r.updaters,d,p,l),"@"===p.charAt(0)&&x(e,e.collector.helpers,u,d,p),u.movingParent&&g(r.movers,f,p,b(s,r,l,p,u.variable.depth)),u.isFromRoot&&m(r.destroyers,f.split(":")).push(y(s,l));a&&function(e,t,n,r,o,i){for(var a=r[0].value.length,l=t.length,s=e.options;l--;)8===t[l].nodeType&&t[l].textContent===s.loopHelperName?(i.unshift(t[l-1]),t[l].parentNode.removeChild(t[l]),a--):3!==t[l].nodeType&&(e.collector.element[r[0].value[a]["cr-id"].split(":")[1]]=t[l],t[l].__loopItem=!0,s.registerLoopItem(t[l],r[0].value[a],s.debugMode));o[0].value[s.loopLimitsName]||Object.defineProperty(o[0].value,s.loopLimitsName,{value:i})}(e,a,0,o,i,[])}function N(e,t,n,r){var o,i=r.destroyers[n[0]];if(delete t[e],i[n[1]]){for(;o=i[n[1]].shift();)o();delete i[n[1]]}}function k(e,t,n,r){var o=e.updaters,i=t.split(":"),a=e.movers;for(var l in delete e.element[i[1]],"root"===i[1]&&(t=i[0]),o[t])N(l,o[t],i,e);if(delete o[t],delete e.helpers[t],a=e.movers[t]){for(var s in a)for(var c=a[s].length;c--;)a[s][c]();delete e.movers[t]}if(n){var u=r(n);for(c=u.length;c--;)k(e,u[c]["cr-id"],u[c],r)}}function C(e,t,n,r,o,i){var l=e.options.loopFnName,s=n.variable.active,c=n.value,u=s?" \x3c!--"+e.options.loopHelperName+"--\x3e":"";if("function"!=typeof t)return o?(a(e,0,"loopHelper:","->",n),c&&!c[l]&&s&&Object.defineProperty(c,l,{value:o}),!c||c["cr-id"]||s||(c["cr-id"]=n.parent["cr-id"]),(r||i?"":u)+t+u):c&&c.length?"":u;!c[l]&&s&&Object.defineProperty(c,l,{value:t})}function A(e){for(var t=0;e&&e.parent;)t++,e=e.parent;return t}function P(e,t,r,o,i,a,l,s){var c,u,p=["@index","@key","@number","@odd","@first","@last","@length","@depth"],d=e.collector.helpers,f=d[(r[0]||o)["cr-id"]],h=0,v=0,g="",m=o||r[t],y=e.collector.updaters[m["cr-id"]],b=l&&l[a],x=!(!i&&f)||y["@length"],_=f&&function(e,t,r){!function(e,t,r,o){var i=e.length,a=o.length,l="",s=t;if(t)for(;a--;)t[l=o[a]]!==n&&(s=t[l],0===a?s[l]=r:1===a?s[l]=Array.isArray(e)?r:Object.keys(e)[r]:2===a?s[l]=r+1:3===a?s[l]=r%2!=0:4===a?s[l]=0===r:5===a?s[l]=r===i-1:6===a?s[l]=i:7===a&&(s[l]=A(e)))}(r,d[r[e]["cr-id"]],e-t,p)};if(f)if(i)for(h=x?0:t,v=r.length;h<v;h++)_(h,0,r);else if(o){if(o){if(r!==l)for(g in c=e.collector.movers[b["cr-id"]])for(;u=c[g].shift();)u(m);for(h=x?0:a,v=l.length;h<v;h++)_(h,0,l);for(h=x?0:t,v=r.length;h<v;h++)_(h,0,r);y["@depth"]&&s&&function e(t,n,r,o){for(var i=t[o].length,a=t,l="",s=0;i--;){l=(a=t[o][i])["cr-id"],n.updaters[l][r].length&&(s=A(t[o]));for(var c=n.updaters[l][r].length;c--;)n.helpers[l][r][r]=s;a[o].length&&e(a,n,r,o)}}(b,e.collector,"@depth",s)}}else for(h=x?0:t+1,v=r.length;h<v;h++)_(h,0,r)}function E(e,t,n,r,o,l){var s=e.options,c=n[s.loopLimitsName],u=c&&c[t].nextSibling,p=c&&c[t+1].nextSibling,d=u;if(!c)throw"Blick error: Array is not defined as being dynamically mutable";if(!u||!p||c.length!==n.length+(o?1:2)&&!l)return a(e,3,"Blick error: model doesn't match view. \nModel:",n);for(;(u=d)&&u!==p&&(d=u.nextSibling);)i.appendChild(u);return c.splice(t+1,1),o?i:(k(e.collector,r[["cr-id"]],r,s.scanHTML(e,i,r,n,!1,!0)),e.controls.helpers&&P(e,t,n,r,!0),i)}function O(e,t,n,r){var o=/>/g,i=t.attr.ownerElement,a=t.attr.nodeName,l=e.options.attributes[a],s=function(e){var n=e.parentNode;if(11!==n.nodeType)return l?l(i,a,n.textContent)():void(t.attr.textContent=n.textContent.replace(o,""))};return s("B"!==n.tagData.tag?S(e,t,n,r,s):w(e,t,n,r,s))}function S(e,t,n,i,a){var l=t.start;return _(e,function(e,t,n,i,a){var l=n||i?null:r.createDocumentFragment(),s=e.nextSibling;return function(r,c){var u=[],p=a?a(r,c):r[0].value,d=e,f=null;if(i||n&&!a)return s.textContent=p,i&&i(s),p;for(u=o(p+"").childNodes;d.nextSibling!==t;)u.length?(d.parentNode.replaceChild(f=u[0],d.nextSibling),d=f):d.parentNode.removeChild(d.nextSibling);if(u.length){for(;u.length;)l.appendChild(u[0]);t.parentNode.insertBefore(l,t)}}}(l,t.end,n.tagData.isEscaped,a,n.helperFn),e.collector,n.data,n.actives),l}function w(e,t,i,a,l){var s="each"===i.tagData.helper||!i.tagData.helper&&!i.data[1]&&"array"===i.data[0].type,c=t.start,u=s?[]:n,d=s?t.start.nextSibling:t.start;if(s)for(;c&&c!==t.end.nextSibling;)u.push(c),c=c.nextSibling;else i.data[0].scrollers&&T(!0,i.data[0],i.track.fnIdx,d.parentNode);return _(e,function(e,t,i,a,l,s,c,u,d){var f=[],h=l.fnIdx,v=[],g=e.options;return v[h]=r.createDocumentFragment(),f[h]=s.length>0,l.checkFn=function(t){f[t]||(e.controls.active=!1)},function(s,m,y,b){b&&T(!0,s[0],h);var x=s[0].value&&s[0].value.length,_=a(s,m,y),N=t,k=t,C=!f[l.fnIdx],A=h>l.fnIdx&&d&&f[l.fnIdx]===n,P=s[0].loop&&s[0].loop.this,E=h!==l.fnIdx;if(h!==l.fnIdx||!_)for(;(k=t.nextSibling)&&k!==i;)v[h].appendChild(k);if(h=l.fnIdx,C){for(v[h]=v[h]||r.createDocumentFragment(),N=p(e,c,o(_),u,y===g.loopHelperName),b&&T(!0,s[0],h,N);k=N.childNodes[0];)v[h].appendChild(k);f[h]=!!_}if(A&&s[0].value[g.loopLimitsName]&&x)return e._firstTimeLoop=v[h],s[0].value[g.loopLimitsName].push(t),"";C&&_&&!u&&g.scanHTML(e,v[h],P,s[0].renderArgs?s[0]:s[0].parent["__cr-id"]&&s[0].parent||s[0].value,"skip"),_&&i.parentNode.insertBefore(v[h],i),b&&_&&T(!1,s[0],h),u&&(E||(t.nextSibling.textContent=_),u(t)),c.length&&c.splice(0,c.length)}}(e,d,t.end,i.bodyFn,i.track,i.out,a,l,s),e.collector,i.data,i.actives,u),d}function T(e,t,n,r){r&&(t.scrollers[n]=r.querySelectorAll("[cr-scroll]"));for(var o=t.scrollers[n].length,i=t;o--;)i=t.scrollers[n][o],r&&i.removeAttribute("cr-scroll"),e?i.__scroll={y:i.scrollTop,x:i.scrollLeft}:(i.scrollTop=i.__scroll.y,i.scrollLeft=i.__scroll.x);return t}}),function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],function(){return t()},"VArray"):"object"==typeof exports?exports.VArray=t():e.VArray=t()}(this&&this.window||global,function(){"use strict";var e=void 0,t=Array.prototype,n=0,r={},o=function(e,t){for(var n=e.length;n--;)t.unshift(e[n]);return t},i=function(){return t=i,n=arguments,(e=[]).push.apply(e,n),Object.setPrototypeOf(e,t.prototype);var e,t,n};return i.prototype=Object.create(Array.prototype),i.prototype.constructor=Array,i.adopt=function(e,t){return v(e,t)},(e=i.prototype).shift=function(){return s(e=this,e[0]);var e},e.pop=function(){return s(e=this,e[e.length-1]);var e},e.unshift=function(){return function(e,t){for(var n=t.length;n--;)l(e,t[n],0,0===n);return e.length}(this,o(arguments,[]))},e.push=function(){return function(e,t){for(var n=0,r=t.length;n<r;n++)l(e,t[n],e.length,n===r-1);return e.length}(this,o(arguments,[]))},e.splice=function(){return function(e,t){var n=e._onChange._options.children,r=t[0]<0?e.length+t[0]:t[0],o=t[1],i=0,a=0,c=[];for(i=0;i<o&&t[i+2]&&e[r+i];i++)c.push(e.replace(t[i+2],r+i)),void 0!==t[i+2].index&&t[i+2][n].parent.remove(t[i+2]);for(a=i;a<o&&e[r+i];a++)c.push(s(e,e[r+i]));r>e.length&&(r=e.length);for(i+=2;i<t.length;i++)l(e,t[i],r+(i-2),i>=t.length);return c}(this,o(arguments,[]))},e.sort=function(e){return a(this,e)},e.reverse=function(){return function(e){for(var n=e._onChange._options.idProperty,r={},o=e.length;o--;)r[e[o][n]]=o;return a(e,t.reverse.call(e),r)}(this)},e.fill=function(e,t,n){return function(e,t,n,r){if(n=+n||0,r=void 0===r?e.length:Math.min(+r,e.length),NaN===n||n>=r)return e;for(var o=r-n;o--;)l(e.getCleanModel(t),n,!!o);return e}(this,e,t,n)},e.copyWithin=function(e,t,n){return function(e,t,n,r){if(n=+n||0,r=void 0===r?e.length:Math.min(+r||0,e.length),NaN===n||n>=r)return e;for(var o=n;o<r;o++)l(e.getCleanModel(e[o]),t,o<r);return e}(this,e,t,n)},e.move=function(e,t){return l(this,e,t)},e.remove=function(e){return s(this,e)},e.replace=function(e,t){return f(this[t],e),this[t]},e.filterAll=function(e,t){return function(e,t,n,o){var i=e._onChange._options.children,a=r[e[e._onChange._options.idProperty].split(":")[0]],l=!e.parent,s=a,c="";n&&(t=t.bind(n));for(c in a)s=a[c],!l&&!p(s[i].parent,e)||t&&!t(s,c,a)||o.push(s);return o}(this,e,t,[])},e.getElementById=function(e,t){var n=t?e.substring(0,e.indexOf(":")):"",o=r[n||this[this._onChange._options.idProperty]];return o?o[e.substring(e.indexOf(":")+1)]:null},e.addSubscriber=function(e,t){var n=Array.isArray(e)?e:e.split(/[./]/),r=function(e,t){for(var n=0,r=t.length,o=e;n<r;n++){if("*"===t[n])return{model:o,value:e,path:t};o=e,e=e&&e[t[n]]}return{model:o,value:e,path:t}}(t,n);if(r.model)return x(r.model,n[n.length-1],{},n,this._onChange._options.promoter)},e.getCleanModel=function(e){return JSON.parse(JSON.stringify(e||this))},e.updateModel=function(e){return d(this,e)},e.destroy=function(e){for(var t in e="object"!=typeof e?e:this[this._onChange._options.idProperty].split(":")[0],r[e])delete r[e][t];delete r[e]},i;function a(e,n,r){var o,i,a=e._onChange._options.idProperty,l=r||{},s=0,u=0,p=!r&&function(e,t){for(var n in e)e[t]<e[n]&&--e[n];delete e[t]};if(!r)for(s=e.length;s--;)l[e[s][a]]=s;for(i="function"==typeof n||void 0===n?t.sort.call(e,n):n,s=0,o=e.length;s<o;s++)e._onChange(c,{action:"sort",index:(u=l[e[s][a]],p&&p(l,e[s][a]),u),item:e[s],parent:e,last:s===o-1});return i}function l(e,n,r,o){var i=e._onChange._options,a=i.children,l=void 0!==n.index,s=l?n.parentNode:void 0,p=l?n[a].parent:void 0,d=l?n.index:r,f=l?void 0:function(e){for(;e.parent;)e=e.parent;return e}(e),h=t.splice;h.call(e,r,0,l?h.call(p,d,1)[0]:n),p&&p!==e&&function(e,t,n){var r=e.parentNode;e[n].parent=t,(r=t.parent&&t.parent[u(t,e.index,n)])?void 0!==e.parentNode?e.parentNode=r:b(e,"parentNode",r,!0,!1,!0):delete e.parentNode}(n,e,a),l||(n=m(n,u(e,r,a),i,e.parent,f),a&&(n[a]=v(n[a]||[],i,e,f,r))),e._onChange(c,{action:l?"move":"add",index:d,parent:e,previousParent:p,previousNode:s,item:n,last:void 0===o||o})}function s(e,n){var r=n.index,o=t.splice.call(e,r,1);return e._onChange(c,{action:"remove",index:r,parent:e,item:n,last:!0}),o[0]}function c(e,t,n){if(e!==c)return n.error&&n.error("VArray._onChange() only for internal use",1);"remove"===t.action&&function e(t,n){var o=r[t[0]];var i=o[t[1]][n.children]||[];var a=i.length;for(;a--;)e(i[a][n.idProperty].split(":"),n);delete o[t[1]]}(t.item[n.idProperty].split(":"),n),n.promoter.onChange(t)}function u(e,t,n){var r=e[t-1]||e[t+1],o=r?r.parentNode&&r.parentNode.index:-1;return(!r&&e.parent?e.parent.find(function(t,r){if(t[n]===e)return o=r,!0}):void 0)||r?o:t}function p(e,t){for(;e&&e!==t;)e=e.parent;return e}function d(e,t){for(var n=0,r=e.length;n<r;n++)void 0!==t[n]?h(e,t,n):e.pop();if(t&&r<t.length)for(n=r,r=t.length;n<r;n++)e._onChange?l(e,t[n],n,n===r-1):e.push(t[n])}function f(e,t){for(var n=Object.keys(e),r=0,o=n.length;r<o;r++)h(e,t,n[r])}function h(e,t,n){var r=e._onChange&&e._onChange._options.promoter.onUpdate;r&&r(e[n],t[n],n,e),e[n]&&Array.isArray(e[n])?d(e[n],t[n]):e[n]&&"object"==typeof e[n]?f(e[n],t[n]):e[n]!==t[n]&&void 0!==t[n]&&(e[n]=t[n])}function v(e,t,o,a,l){var s=!Array.isArray(e),u=i.apply(null,s?[e]:e);return b(u,"_onChange",a?a._onChange:function(e,n){c(e,n,t)},!1),a||b(u._onChange,"_options",t,!1),s&&b(u[0],t.idProperty,""+n++,!1),s?g(u[0],t)&&u:function(e,t,o,i,a){i||(r[n]={});b(e,t.idProperty,(i?i[t.idProperty]+":":"")+n++,!1),o&&b(e,"parent",o,!0);for(var l=0,s=e.length;l<s;l++)m(e[l],a,t,o,i||e),t.children&&(e[l][t.children]=v(e[l][t.children]||[],t,e,i||e,l));return e}(u,t||{},o,a,l)}function g(e,t){for(var n,r=t.listeners.length;r--;)(n=k(e,t.listeners[r].split("."),0,0,t.promoter))&&x(n.model,n.key,{},n.path,t.promoter);return e}function m(e,t,o,i,a){return o.promoter.interseptor&&o.promoter.interseptor(e,i&&i[t],i,a,y),r[a[o.idProperty].split(":")[0]][n]=e,b(e,o.idProperty,a[o.idProperty]+":"+n++,!1),i&&b(e,"parentNode",i[t],!0,!1,!0),function(e,t,n){Object.defineProperty(e,"index",{get:function(){return(e[t]&&e[t].parent||n).indexOf(e)}})}(e,o.children,a),g(e,o),e}function y(e,t,n){for(var r in(n=n||{}).force=void 0===n.force||n.force,t)(void 0===e[r]||n.force)&&b(e,r,t[r],!0,!!n.show,!0)}function b(e,t,n,r,o,i){return Object.defineProperty(e,t,{enumerable:!!o,configurable:void 0!==i&&i,writable:void 0===r||!!r,value:n})}function x(e,t,n,r,o){return n[t]=e[t],Object.defineProperty(e,t,{get:function(){return n[t]},set:function(i){var a=n[t];if(a&&a._onChange&&i!==a)return d(a,i);n[t]=i,!1===o.onChange({action:"change",value:i,oldValue:a,path:r,item:e,key:t})&&(n[t]=a)}})}function _(e,t,n,r,o,i,a){var l="object"==typeof e,s=l&&k(e[t],n,r+o+1,t,a),c=r+2===n.length;if(s&&l&&(s.path=s.path.slice(0),s.path[r]=""+t,o&&"*"===s.path[o-1]&&(s.path[o-1]=""+i),"*"===s.key&&(s=k(e,s.path,r,0,a)),s))return x(c?s.model:e,c?s.key:t,{},s.path,a)}function N(e,t,n,r,o,i){if(Array.isArray(e))for(var a=0,l=e.length;a<l;a++)_(e,a,t,n,r,o,i);else for(var s in e)_(e,s,t,n,r,o,i)}function k(e,t,n,r,o){for(var i=e,a=n,l=t.length;a<l;a++){if("*"===t[a])return N(e[t[a-1]]||e,t,a,n,r,o);if(void 0===i[t[a]])return;e=i,i=i[t[a]]}return{model:e,path:t,key:t[t.length-1]}}}),define(["toolbox"],function(e){return function(t,n){var r={},o={};function i(e,t,n){for(var r=0,o=t.length;r<o;r++)t[r]&&t[r].call(e,n)}function a(e){return decodeURI(e?location.hash.substring(e.length):location.pathname+location.search)}function l(e,t){var n=e.regexp&&e.regexp.exec(t),r={};if(!n)return null;for(var o=0,i=(n=n.slice(1)).length;o<i;o++)n[o]=n[o]?o===i-1?n[o]:decodeURIComponent(n[o]):null,e.names[o]&&(r[e.names[o]]=n[o]);return n.parameters=r,n.queries=function(e){for(var t=0,n=(e=e?e.split("&"):[]).length,r={},o=[];t<n;t++)r[(o=e[t].split("="))[0]]=o[1];return r}(n[i-1]),n.path=t.replace(/^\//,"").split("/"),n}for(var s in o.triggerEvent=function(t,n,r){var o,i=r||{},a=i.ownerDocument===document?e.findParent(r,"cr-id"):void 0,l=!a&&i.parentOnly?this.getParentComponent(i.parentOnly).element:void 0;i.detail=n,i.element=a||l||i.element||window,i.bubbles=!l&&(void 0===i.bubbles||i.bubbles),o=new CustomEvent(t,i),i.element.dispatchEvent(o)},o.installEvent=function(t,n,r,o){return e.addEvent(t||window,n,r,o)},o.getView=function(t,n){return e.$('[cr-view="'+t+'"]',n["cr-id"]?n:e.findParent(n))},o.subscribe=function(e,t,n,o,i){var a=this,l=t;if(e=e?e.name||e.components&&e.components[t]||e:this.name,r[e]=r[e]||{},(t=r[e][t]=r[e][t]||{})[n]=t[n]||[],o&&(t[n].push(o.callback||o),o.regexp&&!t[n].regexp&&(t[n].regexp=o.regexp,t[n].names=o.names)),n&&t[n])return i&&void 0!==t[n].value&&(o.callback||o).call(this,t[n].value),function(){a.unsubscribe(e,l,n,o)};delete r[e]},o.publish=function(e,t,n,o){return e="string"==typeof e?e:this.name,r[e]=r[e]||{},r[e]&&((t=r[e][t]=r[e][t]||{})[n]=t[n]||[],t[n].value=o,t[n][0]&&i(this,t[n],o)),t[n]&&t[n].length?o:void 0},o.unsubscribe=function(e,t,n,o){var i=-1,a={};return e="string"==typeof e?e:e.name||this.name,r[e]&&r[e][t]&&r[e][t][n]&&-1!==(i=(a=r[e][t][n]).indexOf(o.callback||o))&&a.splice(i,1),o.callback||o},o.addRoute=function(t,n,o){var s,c,u=this,p="object"==typeof t.path?{regexp:t.path}:(s=t.path,c=[],s=s.replace(/[\-{}\[\]+?.,\\\^$|#\s]/g,"\\$&").replace(/\((.*?)\)/g,"(?:$1)?").replace(/(\(\?)?:\w+/g,function(e,t){return c.push(e.substring(1)),t?e:"([^/?]+)"}).replace(/\*/g,"([^?]*?)"),{regexp:new RegExp("^"+s+"(?:\\?([\\s\\S]*))?$"),names:c}),d=o||this.options.hash,f=l(p,a(d)),h=r[this.name]&&r[this.name].__router,v={};return this.subscribe(null,"__router",t.path,{callback:t.callback,names:p.names,regexp:p.regexp||p},n),n&&f&&t.callback.call(this,f),v=!h&&function(t,n,r){var o=void 0!==window.onpopstate?"popstate":"hashchange";return e.addEvent(window,o,function(e){var o={};for(var s in t)(o=l(t[s],a(r)))&&i(n,t[s],o)},n.id)}(r[this.name].__router,this,d),function(){u.removeRoute(t),!h&&v()}},o.removeRoute=function(e){return this.unsubscribe(null,"__router",e.path,e.callback)},o.toggleRoute=function(e,t){var n=r[this.name].__router,o=n[e.path].paused||n[e.path];n[e.path]=t?o:[],n[e.path].paused=t?null:o},Object.defineProperties(n,{Toolbox:{value:e},CreateInstance:{value:function(e,t,r){var o,i,a=!!n.circular,l=n.circular||Object.defineProperties(n,{circular:{value:new n(e,t)}}).circular;return r&&require([r],function(){}),!a&&l.options.debug&&(o=l.version,(i=document.createElement("meta")).setAttribute("mvc-name","CircularJS"),i.setAttribute("version",o),document.head.insertBefore(i,document.head.children[0])),l}}}),o)t[s]={value:o[s]};return t}},"api"),define(["toolbox"],function(e){"use strict";function t(e){this.element=e||document.body,this.listeners={},this.store=Object.create(null),this.root=Object.create(null)}return t.prototype={installEvent:function(t,n,r,o){!function(t,n,r,o,i){var a=r.length-(r=r.replace(/\!/g,"")).length,l=r.length-(r=r.replace(/\?/g,"")).length,s=!!/(?:focus|blur|mouseenter|mouseleave|scroll)/.test(r),c=n.model===i,u=(c?"__":"")+n.idTag,p=t.store[n.model[u]];p||(p=t.store[n.model[u]]=Object.create(null));p[r]||(p[r]=Object.create(null));p=p[r],n.delegate=l,(l||c)&&(t.root[r]=i["__"+u]||t.element[n.idTag]);for(var d=o.length,f="";d--;)(f=o[d]=o[d].replace(/[?!]/g,""))&&(p[f]?p[f].push(n):p[f]=[n]);if(t.listeners[r])return;t.listeners[r]=e.addEvent(t.element,r,function(r){!function t(n,r,o,i,a,l,s,c){var u=function t(n,r,o,i,a,l,s,c){var u=i?null:e.findParent(o,s,a)||o;var p=i?i[s]:u[s]||a[s];var d=c[p]||o===a?null:u&&u.parentNode||e.findParent(l,s);return d?t(n,r,d,i,a,l,s,c):c[p]||{}}(n,r.type,r.target,c,a,l,i,s)[r.type];var p=r.path||r.composedPath&&r.composedPath();var d=[];var f=0,h=0;var v=null;var g="";var m=!1;var y=v&&v.model;var b=a;var x=y;var _=Object.create(null);!n.store[n.root[r.type]]||c||u||(u=n.store[n.root[r.type]][r.type]);for(g in u)for(h=u[g].length;h--;)(v=u[g][h]).index=p.indexOf(v.element),-1!==v.index&&d.push(v);d.sort(function(e,t){return t.index-e.index});for(f=d.length;!m&&f--;)for(h=d[f].callbacks.length;h--;)g=d[f].callbacks[h],o[g]&&(v=d[f],b=v.delegate?e.findParent(r.target,i,v.element):v.element,y=v.delegate?b&&v.getElementById(b[i],!0):v.model,x=y&&y[v.children]&&y[v.children].parent,y&&(m=!1===o[g](r,b,y,x,x&&(v.delegate?b:e.findParent(r.target,i,v.element)))||r.cancelBubble||m));!m&&v&&(v.model.parentNode||v.children)&&(_[i]=v.model["__"+i],t(n,r,o,i,b,l,s,v.model.parentNode||_))}(t,r,i,n.idTag,t.element,t.element.parentNode,t.store)},!!(s||a>1)||1!==a&&void 0)}(this,n,t,r,o)},removeEvent:function(e){n(this,e)},destroy:function(){var t=this;return e.keys(this.listeners).forEach(function(e){n(t,e)}),this.element=this.root=this.store=null},removeItem:function(e){delete this.store[e]}},t;function n(e,t){var n=e.listeners[t];n&&(e.listeners[t]=n(),delete e.listeners[t])}},"controller"),define(["toolbox","blick","VArray","api","controller"],function(e,t,n,r,o){"use strict";var i=0,a={},l={},s=e.$,c=e.$$,u=e.$create,p=e.isArray,d=e.keys,f=e.cloneObject,h=function(e,t){this.controls={initPartials:!1},this.version="2.0.5",this.id=0,this.name="",this.options={hash:"#",partials:{},helpers:{},attributes:{},debug:0},v(this,e,t||{})},v=function(e,t,n){var r="string"==typeof t;for(var o in r||(n=t||{}),n)e.options[o]=n[o];e.id="cr_"+i++,e.name=r?t:e.id,l[e.id]={}};return Object.defineProperties(h.prototype,r({createComponent:{value:function(e,t,n,r,o){var i=g(n["__cr-id"]),a=document.createElement(e);for(var l in t)a.setAttribute(l,t[l]);return o&&(a.innerHTML=o),(r||i.element).appendChild(a),x(i,r||i.element,e,!0),a}},hideComponent:{value:function(e){var n=e&&e._tracker||document.createTextNode(""),r=e&&g(e["cr-id"]);if(e&&(e.__scrollers=e.__scrollers?t.setScroll(!0,e.__scrollers,0):t.setScroll(!0,{scrollers:[]},0,e)),e&&e.parentNode)return e._tracker||(e._tracker=e.parentNode.insertBefore(n,e)),e.parentNode.removeChild(e),function(o){return o&&e._tracker&&o!==e._tracker.parentNode?(e._tracker.parentNode.removeChild(e._tracker),delete e._tracker):o=void 0,o?o.appendChild(e):n.parentNode.insertBefore(e,e._tracker),t.setScroll(!1,e.__scrollers,0),y(e,r),e}}},getChildComponents:{value:function(e){for(var t=e["__cr-id"].split(":"),n=l[t[0]][t[1]].children,r=[],o=n.length;o--;)t=n[o].split(":"),r.push(m(this,t[1],t[0]));return r}},getParentComponent:{value:function(e){return m(this,l[this.id][e["__cr-id"].split(":")[1]].parent.split(":")[1])}},destroyComponent:{value:function(e,t){e&&(b(e["cr-id"],g(g(e["cr-id"]).parent)),t&&e.parentNode.removeChild(e))}},getModelElement:{value:function(e,t){return l[this.id][e["__cr-id"].split(":")[1]].template.blick.findElement(t)}}},h)),Object.defineProperties(h,{Service:{value:function(e,t){}},App:{value:function(e,t){return e.selector||(e.selector="app"),e.initialize=!0,h.Component(e,t)}},Component:{value:function(t,r){var c,v,m,b,E=!!a[t.selector],T=t.circular||h.CreateInstance(),F=!E&&function(e,t){var n=d(e);e.this||(e.this=[]);for(var r=n.length,o="",i=[];r--;)if(o=n[r],!((i=o.split(":")).length<2))for(var a=i.length;a--;)a>0?t[i[a-1]]=i[a].replace(/\]/g,""):(e[i[a]]=e[o],delete e[o]);return t}(t.subscribe$||(t.subscribe$={}),{}),j=E?a[t.selector]:a[t.selector]={Klass:r,selector:t.selector,subscribe$:t.subscribe$,childNames:F,template:t.template&&t.template.blick?t.template:S(t.template||"",function(e,t){return{helpers:f(f({},e.helpers),t.helpers||{}),partials:f(f({},e.partials),t.partials||{}),attributes:f(f({},e.attributes),t.attributes||{}),forceUpdate:!0,limitPartialScope:!1,debugMode:e.debug?"warn":"",debugLevel:e.debug,registerLoopItem:C,isDynamic:P,scanHTML:A}}(T.options,t)),styles:(c=t.styles,v=t.selector,m=c?p(c)?c.join("\n"):c:"",b=m&&u("style"),b?(b.setAttribute("name",v),b.innerHTML="\n"+m+"\n",document.head.appendChild(b)):null),singleton:!1,initialize:!1,crInst:T,init:function(r,a,c,u){return t.initialize&&(j.initialised=!0),function(t,r,a,s,c,u){var f=r.crInst,h=i++,v=t["cr-id"],m=v&&!s,b=r.template,C=m?null:l[f.id][h]={instance:{},controller:{},models:[],parent:"",template:b,element:t,crInst:f,children:[],views:{},listeners:{},destroyers:[]},A=e.trim(t.innerHTML),P=f.id+":"+h,E=r.template.blick.options,T=r.template.blick.partials;if(m||r.singleton&&!s)return g(v);r.singleton=!!a.singleton||a.initialised,s||(t["cr-id"]=P,C.crInst.options.debug&&t.setAttribute("cr-id",P));A&&(t.innerHTML=function(e,t,n){var r=t.replace(/cr-src/g,"src"),o=S(r,n,!0),i=e.childComponents;e.enableEvents=e.enableEvents||o.enableEvents;for(var a=o.childComponents.length;a--;)-1===i.indexOf(o.childComponents[a])&&i.push(o.childComponents[a]);return e.blick.registerPartial("@content",r),""}(b,A,E),a.extra||(a.extra=Object.create(null)),a.extra["@content"]=T["@content"],T["@content"]=null);C.name=a.selector,C.controller=new o(t),c&&(C.parent=c["__cr-id"],g(C.parent).children.push(P));C.instance=function(e,t,n,r){return new e.Klass(t.element,function(e,n){return function(e,t,n,r){var o=n.parent&&n.parent.split(":"),i=n.parent&&(l[o[0]][o[1]]||{})||{};!1!==t&&(t=!0),w(n.element,"cr-input",function(o,a,l){!function(e,t,n,r,o,i){var a=e.split(/\s*=\s*/),l=a[1]&&(0===a[1].indexOf('"')||0===a[1].indexOf("'")),s=a[1]&&"!"===a[1].charAt(0),c=(e=s?a[1].substring(1):a[1])||a[0];e=l?e.substring(1,e.length-1):"true"===e||"false"!==e&&(+e==e?+e:void 0),hasOwnProperty.call(t,a[0])&&(void 0!==e?t[a[0]]=e:hasOwnProperty.call(r.instance,c)&&(t[a[0]]=r.instance[c],!n||l||s||function(e,t,n,r,o,i){e[o]||(e[o]={}),e[o][r]={scope:t,key:i},n.push(function(){delete e[o][r]})}(r.listeners,t,o.destroyers,i,c,a[0])))}(a,e,t,i,n,r)}),n.crInst.options.debug||n.element.removeAttribute("cr-input")}(e,n,t,r)},t.crInst)}(r,C,0,P),Object.defineProperty(C.instance,"__cr-id",{value:P}),C.models=d(r.subscribe$).sort(function(e){return"this"===e?-1:1}).reduce(function(e,t){var o=function(e,t,r){var r=r.instance,o=e.split(/[./]/),i=function(e,t){for(var n=0,r=e.length;n<r;n++)c=t,t=t[e[n]];return{parent:c,data:t}}(o,r),a=i.data,s=p(a)?t.childNames[e]:null,u=function(e,t,r,o,i){var a=e+"$PR",s=e+"$Update",c={collector:t.template.blick.collector,inst:r,blick:t.template.blick,name:e,childNodes:i};return n.adopt("this"===e?r:o||[],{idProperty:"cr-id",children:i,listeners:t.subscribe$[e],instId:r["__cr-id"],error:_,promoter:{interseptor:r[a]&&r[a].bind(r),onUpdate:r[s]&&r[s].bind(r),onChange:function(e){return"change"===e.action?function(e,t){var n=e.childNodes,r=e.inst,o=e.collector.updaters[t.item["cr-id"]],i=o&&o[t.key],a=e.name+"$",s=e.inst["__cr-id"].split(":");if(r[a]&&!1===r[a](t.key,t.item,t.value,t.oldValue))return!1;if(i)for(var c=i.length;c--;)i[c](t.value,null,t.item);if(r=l[s[0]][s[1]].listeners[t.key])for(n in r)r[n].scope[r[n].key||t.key]=t.value}(c,e):function(e,t,n,r,o,i,a,l){var s=l.blick,c=r!==n?r:n,u=n.length,p=l.name+"$Move";"move"===e?(r!==n&&1===u&&k(l,t.parentNode,s.options.loopHelperName),s.moveChild(i,c,t.index,n,l.childNodes,a),0===r.length&&k(l,o)):"add"===e?(1===u&&N(t,n,l),s.addChild(i,n,t)):"remove"===e?(s.removeChild(i,n,t),0===u&&N(t,n,l)):"sort"===e&&s.moveChild(i,n,u-1,n,l.childNodes,a),l.inst[p]&&l.inst[p](e,n.parent?l.childNodes:l.name,t,n,r,o)}(e.action,e.item,e.parent,e.previousParent,e.previousNode,e.index,!e.last,c)}}})}(e,t,r,a,s);return"this"!==e&&p(a)?(i.parent[o[o.length-1]]=u,{model:u,id:u["cr-id"]}):{model:u,standalone:!0,id:r["cr-id"]}}(t,r,C);return e[o.id]=o,e},{}),b&&function(e,t){var n=e.template.blick.renderHTML(e.instance,t),r=d(e.models)[0],o=e.models[r].model;x(e,n),O(e,o,n),e.element.removeAttribute("cr-cloak"),e.element.appendChild(n)}(C,a.extra);C.instance.onInit&&C.instance.onInit(t,f),u&&y(t,C);return C}(s(r),this,t,a,c,u)}},I=t.initialize?s(t.selector,t.context):{};return function(e,t){!e.controls.initPartials&&t.template&&(e.controls.initPartials=function(e,t){for(var n in e)e[n]=t.partials[n];return!0}(e.options.partials,t.template.blick))}(T,j),t.initialize&&delete a[t.selector],j.initialised?null:t.initialize?{component:j,instance:j.init(I),element:I}:j}},extend$:{value:function(e,t){var n=t.subscribe$,r="",o="",i=0;for(r in n)for(e[o=t.childNames[r]?r+":"+t.childNames[r]:r]||(e[o]=[]),i=n[r].length;i--;)-1===e[o].indexOf(n[r][i])&&e[o].push(n[r][i]);return e}}});function g(e){return e=e.split(":"),l[e[0]][e[1]]}function m(e,t,n){var r=l[n||e.id][t];return r&&{element:r.element,instance:r.instance,name:r.name}}function y(e,t){if(t.instance.onLoad&&t.instance.onLoad(e,t.crInst))for(var n,r=t.children.length,o=[];r--;)o=t.children[r].split(":"),y((n=l[o[0]][o[1]]).element,n)}function b(e,t){var n,r={};if(e){t.children.splice(t.children.indexOf(e),1),n=e.split(":"),r=l[n[0]][n[1]],delete l[n[0]][n[1]];for(var o=r.destroyers.length;o--;)r.destroyers[o]();for(var i in r.instance.onDestroy&&r.instance.onDestroy(),r.template.blick.destroyInstance(r.models),r.models)r.models[i].model.destroy();r.controller.destroy();for(o=r.children.length;o--;)b(r.children[o],r)}}function x(e,t,n,r){var o,i,l=e.template,s=l.childQuery||[],u=l.childComponents,p=!1,d="",f=[],h="",v=0,g=0,m=null===l.blick.partials["@content"];if(n||u.length&&t.firstElementChild){if("string"!=typeof s){for(v=u.length;v--;)s.push(u[v]);l.childQuery=s.join(",")}if(f=[].slice.call(c((n||l.childQuery)+", [cr-lazy]",t)),m)for(v=f.length;v--;)for(f[v]["cr-id"]&&f.splice(v,1),g=v;g--;)f[g].contains(f[v])&&f.splice(v,1);for(v=0,i=f.length;v<i;v++)e.instance.onBeforeChildInit&&e.instance.onBeforeChildInit(f[v]),h=f[v].tagName.toLowerCase(),p=f[v].hasAttribute("cr-lazy"),d=p&&f[v].getAttribute("cr-lazy")||h,!e.crInst.options.debug&&p&&f[v].removeAttribute("cr-lazy"),!p||a[h]?(o=a[h].init(f[v],null,e.instance,r),e.instance.onChildInit&&e.instance.onChildInit(o.element,o.instance,h)):function(e,t,n){require([require.lazyPackages[d]||d],function(o){var i=o.init(t,null,e.instance,r);return e.instance.onChildInit&&e.instance.onChildInit(i.element,i.instance,n),o})}(e,f[v],h)}}function _(e,t){e="VArray Error: "+e;if(!t)throw e;console.error(e)}function N(e,t,n){t.parent?k(n,e.parentNode):n.inst[n.name]=n.inst[n.name]}function k(e,t,n){for(var r=e.childNodes,o=e.collector.updaters[t["cr-id"]][r]||[],i=o.length;i--;)o[i](t[r],n,t)}function C(e,t,n,r){r||(e["cr-id"]=t["cr-id"],n&&e.setAttribute("cr-id",t["cr-id"]))}function A(e,t,n,r,o,i){var a=r.renderArgs?E(r.renderArgs).parent:r,s=(a["__cr-id"]||a._onChange._options.instId).split(":"),u=l[s[0]][s[1]],p=u.models,f=n&&n["cr-id"],h=p[f&&f.split(":")[0]||d(p)[0]].model,v=h._onChange._options.children,g=t.children,m=0;if(!0===i)return function(e,t){for(var n=e.childNodes,r=c(t.template.childQuery,e),o=n.length;o--;)e.removeChild(n[o]);for(var o=r.length;o--;)b(r[o]["cr-id"],t)}(t,u),function(e){return u.controller.removeItem(e["cr-id"]),e[v]||[]};if(g.length){if(f)for(m=g.length;m--;)C(g[m],n,e.options.debugMode,g[m]["cr-id"]);if(x(u,t),O(u,h,t),o)for(m=g.length;m--;)g[m].__loopItem?delete g[m].__loopItem:delete g[m]["cr-id"]}}function P(e,t,n){var r=e.renderArgs?E(e.renderArgs):e,o=r.parent,i=function(e){return e.parent["__cr-id"]||e._onChange&&e._onChange._options.instId||e.loop&&e.loop["@root"]["__cr-id"]||e.value&&e.value._onChange&&e.value._onChange._options.instId||e.parent["@root"]&&e.parent["@root"]["__cr-id"]||""}(r),a=(r.parent["cr-id"]||r.parent.this["cr-id"]).split(":")[0],s=i.split(":"),c=(l[s[0]][s[1]].models[a]||{}).model,u=o&&(Object.getOwnPropertyDescriptor(o,t)||{}).set?1:0;return c?(!u&&n&&o&&hasOwnProperty.call(o,t)&&(c.addSubscriber(t,o),u=2),u):null}function E(e){for(var t=0,n=e.length;t<n;t++){if(e[t].renderArgs)return E(e[t].renderArgs);if(e[t].parent["__cr-id"])return e[t]}}function O(t,n,r){if(!t.template.enableEvents)return null;r&&O(t,n),w(r||t.element,"cr-event",function(r,o,i){var a=e.findParent(i,"cr-id",t.element),l=a?a["cr-id"]:"",s=l.substring(0,l.indexOf(":")),c=n&&l&&n.getElementById(l,!0)||t.instance,u=t.models[s]&&t.models[s].model,p=u&&u._onChange&&u._onChange._options.children,d=o.split(/\s*,\s*/);t.controller.installEvent(r,{idTag:"cr-id",getElementById:n&&n.getElementById,model:c,children:p,element:i,callbacks:d},d,t.instance),!t.crInst.options.debug&&i.removeAttribute("cr-event")})}function S(n,r,o){var i={},l=d(a).join("|"),s="<(?:"+(l?"("+l+")[^/]?|":"")+"([^ >]+)[^>]*cr-lazy)[^/]*?>";d(r.partials||{});return n.replace(new RegExp(s,"g"),function(e,t,n,r){var o=t||n||r;o&&(i[o]=!0)}),{blick:o?null:new t(e.trim(n),r),childComponents:d(i),enableEvents:!0}}function w(e,t,n,r){for(var o=e.hasAttribute&&e.hasAttribute(t)?[e]:[],i=e.childNodes.length?c("["+t+"]",e):[],a=i.length?(o.push.apply(o,i),o):o,l={},s=a.length,u="",p=[];s--;){p=(u=a[s].getAttribute(t))?u.split(/\s*;+\s*/):[],l[u]=a[s];for(var d=p.length,f=[],h="",v="";d--;)h=(f=p[d].split(/\s*:+\s*/))[0],v=f[1]||f[0],n&&n(h,v,a[s]),r&&(v?(r[h]=r[h]||{},r[h][v]=r[h][v]||[],r[h][v].push(a[s])):(r[h]=r[h]||[],r[h].push(a[s])))}return r||l}},"circular");
//# sourceMappingURL=circular.min.js.map