"use strict";var container=function(){var e=[],t={context:"",of:""},r=function(t,r,n,o){if("string"!=typeof t)throw new Error("var name must be of type string");if("function"!=typeof r&&"object"!=typeof r)throw new Error('var object "'+t+'" must be of type function or object');if("boolean"!=typeof n)throw new Error('var singelton "'+t+'" must be of type boolean');return o&&window.localStorage.setItem(t,JSON.stringify(r)),e[t]={name:t,object:r,singleton:n,instance:null},this},n={},o=function(t){var r=void 0!==e[t]?e[t]:null;if(null===r){if(n[t])return n[t];var o=window.localStorage.getItem(t);return o?(o=JSON.parse(o),n[t]=o,o):null}if(null===r.instance){var a="function"==typeof r.object?this.resolve(r.object):r.object;return r.singleton&&(r.instance=a),a}return r.instance},a=function(e){var t=this,r=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,n=e.toString(),o=n.match(r)[1].split(",");return e.apply(e,o.map(function(e){return t.get(e.trim())}))},i=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e,r){e=e.replace(t.of,t.context).split(".");for(var n=this.get(e.shift());e.length>1;){if(void 0==n)return null;n=n[e.shift()]}if(void 0!==r)return n[e.shift()]=r;if(void 0==n)return null;var o=e.shift();return void 0==o?n:n[o]}),s=function(){return t},l=function(e,r){return t={context:e,of:r},this},c={set:r,get:o,resolve:a,path:i,setScope:l,getScope:s};return r("container",c,!0),c}();container.set("http",function(e){var t=[],r=[],n=function(t,r,n){var o,a=e.createElement("a"),i=/(?:\?|&|&)+([^=]+)(?:=([^&]*))*/g,s=[];for(a.href=t,r=encodeURIComponent(r);o=i.exec(a.search);)r!=o[1]&&s.push(o[1]+(o[2]?"="+o[2]:""));return s.push(r+(n?"="+encodeURIComponent(n):"")),a.search=s.join("&"),a.href},o=function(o,a,i,s,l){var c;if(-1==["GET","POST","PUT","DELETE","TRACE","HEAD","OPTIONS","CONNECT","PATCH"].indexOf(o))throw new Error("var method must contain a valid HTTP method name");if("string"!=typeof a)throw new Error("var url must be of type string");if("object"!=typeof i)throw new Error("var headers must be of type object");if("string"!=typeof a)throw new Error("var url must be of type string");for(c=0;c1;){if(void 0==e)return null;e=e[t.shift()]}return void 0!==r?e[t.shift()]=r:void 0==e?null:e[t.shift()]},Array.prototype.includes||(Array.prototype.includes=function(e){if(null==this)throw new TypeError("Array.prototype.includes called on null or undefined");var t=Object(this),r=parseInt(t.length,10)||0;if(0===r)return!1;var n,o=parseInt(arguments[1],10)||0;o>=0?n=o:(n=r+o,0>n&&(n=0));for(var a;r>n;){if(a=t[n],e===a||e!==e&&a!==a)return!0;n++}return!1}),container.set("view",function(e,t){var r={},n=function(e,t,r,n,o){(!t.$lsStop||o)&&(r.set("element",t,!0),r.setScope(n.context,n.of),r.resolve(e.controller),r.setScope("",""),!0!==e.repeat&&t.removeAttribute(e.selector),o&&(t.$lsStop=!0))};return{stock:r,add:function(e){if("object"!=typeof e)throw new Error("var object must be of type object");var t={selector:"",controller:function(){},template:"",repeat:!1,"protected":!1};for(var n in t)t.hasOwnProperty(n)&&(n in e||(e[n]=t[n]));if(!e.selector)throw new Error("View component is missing a selector attribute");return r[e.selector]=e,this},render:function(o,a,i){var s=this,l=o?o.childNodes:[];a=a||{context:"",of:""};for(var c=0;c-1?e.substr(0,t):e,o=t>-1?decodeURIComponent(e.substr(t+1)):"",a=r.indexOf("[");if(-1==a)n[decodeURIComponent(r)]=o;else{var i=r.indexOf("]"),s=decodeURIComponent(r.substring(a+1,i));r=decodeURIComponent(r.substring(0,a)),n[r]||(n[r]=[]),s?n[r][s]=o:n[r].push(o)}}}),n},m={setParam:l,getParam:i,getParams:s,reset:c,change:f,reload:v,getURL:u,add:p,match:d,getCurrent:o,getPrevious:a,params:{}};return m},!0),container.set("expression",function(e){var t=/(\{{.*?\}})/gi;return{parse:function(r){return r.replace(t,function(t){var r=t.substring(2,t.length-2).replace("['",".").replace("']","").trim(),n=e.path(r);return n=null==n||void 0==n?"":n,n="object"==typeof n?JSON.stringify(n):n})}}},!0),container.set("window",window,!0).set("document",window.document,!0).set("element",window.document,!0);var app=function(e){return{run:function(t){try{container.get("http").addGlobalParam("version",e),this.view.render(t.document)}catch(r){var n=container.resolve(this.error);n(r)}},error:function(){return function(e){console.error("error",e.message,e.stack,e.toString())}},container:container,view:this.container.get("view")}};container.get("view").add({selector:"data-ls-init",template:!1,repeat:!0,controller:function(e,t,r,n,o){var a={selector:"data-ls-scope",template:!1,repeat:!0,controller:function(){},state:!0},i=function(i){if(t.scrollTo(0,0),o.reset(),a["protected"]=void 0!==i.view["protected"]?i.view["protected"]:!1,a["protected"]&&null==o.getPrevious())throw new Error("CSRF protection");a.template=void 0!==i.view.template?i.view.template:null,a.controller=void 0!==i.view.controller?i.view.controller:function(){},a.state=void 0!==i.view.state?i.view.state:!0,r.dispatchEvent(new CustomEvent("state-change")),null==o.getPrevious()?a.template="":(a.nested=!1,n.render(e)),r.dispatchEvent(new CustomEvent("state-changed"))},s=function(e,t){if((t.nodeName||t.tagName).toLowerCase()===e.toLowerCase())return t;for(;t=t.parentNode;)if((t.nodeName||t.tagName).toLowerCase()===e.toLowerCase())return t;return null};n.add(a),r.addEventListener("click",function(e){var r=s("a",e.target);if(!r)return!1;if(!r.href)return!1;if(e.metaKey)return!1;if(r.hasAttribute("target")&&"_blank"==r.getAttribute("target"))return!1;if(r.hostname!=t.location.hostname)return!1;var n=o.match(r.pathname);return null===n?!1:(e.preventDefault(),t.location==r.href?!1:(n.view.state=void 0===n.view.state?!0:n.view.state,!0===n.view.state&&t.history.pushState({},"Unknown",r.href),i(n),!0))}),t.addEventListener("popstate",function(){i(o.match(t.location.pathname))}),i(o.match(t.location.pathname))}}),container.get("view").add({selector:"data-ls-print",template:!1,repeat:!0,controller:function(e,t){var r=t.parse("{{"+e.dataset.lsPrint+"}}"),n=e.getAttribute("data-default")||"";if(r=r||n,"INPUT"==e.tagName||"SELECT"==e.tagName||"BUTTON"==e.tagName||"TEXTAREA"==e.tagName){var o=e.getAttribute("type");"radio"==o||"checkbox"==o?r.toString()==e.value||r.indexOf(e.value)>-1?e.setAttribute("checked","checked"):e.removeAttribute("checked"):(e.value!=r&&(e.value=r),e.dispatchEvent(new window.Event("change")))}else e.innerText!=r&&(e.innerText=r)}}),container.get("view").add({selector:"data-ls-rerender",template:!1,repeat:!0,controller:function(e,t,r,n,o){var a=e.dataset.lsRerender||"";a=a.trim().split(",");for(var i=0;i')}r.get(a).then(function(e){return function(t){s(t,e)}}(e),function(){throw new Error("Failed loading template")})}}),container.get("view").add({selector:"data-ls-href",template:!1,repeat:!0,controller:function(e,t){e.href=t.parse(e.dataset.lsHref)}}),container.get("view").add({selector:"data-ls-if",template:!1,repeat:!0,controller:function controller(element,expression){var result=!!eval(expression.parse(element.dataset.lsIf));element.$lsSkip=!result,result?(element.style.removeProperty("display"),element.style.removeProperty("visibility")):(element.style.visibility="hidden",element.style.display="none")}}),container.get("view").add({selector:"data-ls-hide",template:!1,repeat:!0,controller:function controller(element,expression){element.style.display=eval(expression.parse(element.dataset.lsHide))?"inherit":"none"}}),container.get("view").add({selector:"data-ls-class",template:!1,repeat:!0,controller:function(e,t){e.className=t.parse(e.dataset.lsClass)}}),container.get("view").add({selector:"data-ls-src",template:!1,repeat:!0,controller:function(e,t){e.addEventListener("error",function(){e.style.opacity=0}),e.addEventListener("load",function(){e.style.opacity=1});var r=t.parse(e.dataset.lsSrc);r!=e.src&&""!=r&&(e.src=r)}});