<commit_before>!function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;a=function(a){"use strict";var b={merge:function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]?"object"!=typeof a[c]||"object"!=typeof b[c]||this.isFunction(a[c])||this.isFunction(b[c])||this.merge(a[c],b[c]):a[c]=b[c])},isFunction:function(a){return!!(a&&a.constructor&&a.call&&a.apply)},isEqual:function(a,b){return JSON.stringify(a)===JSON.stringify(b)},arrayInsertAt:function(a,b,c){var d=a.slice(0,c);return d.push(b),d.concat(a.slice(c,a.length))},clone:function(a){if(!(a instanceof Object)||this.isFunction(a))return a;var b=new a.constructor;for(var c in a)b[c]=this.clone(a[c]);return b},safeCall:function(a,b,c){if(c||(c=[]),app.debug)return a[b](c[0],c[1],c[2],c[3]);try{return a[b](c[0],c[1],c[2],c[3])}catch(d){console.error(d)}}};return a=window.snew?snew.Obj(b):b}({}),b=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b),e={_meta:{contentSpace:!1},init:function(){},destroy:function(){},get:function(a,b){return this._handleData("get",a,null,b)},set:function(a,b,c){if(arguments.length<2)throw"The given arguments are not enough";return this._handleData("set",a,b,c)},unset:function(a,b){if(arguments.length<1)throw"The given arguments are not enough";return this._handleData("set",a,null,b)},addJob:function(a){a.uid=this._meta.uid,snew.runloopHelper._addJob(a)},setAll:function(a,b){var c=this._meta.contentSpace;return b||(b={}),void 0!==b.contentSpace&&(c=b.contentSpace),b.contentSpace=!1,this._handleData("set",c,a,b)},push:function(a,b,c){if(arguments.length<2)throw"The given arguments are not enough";return this._handleData("push",a,b,c)},pushOnce:function(a,b,c){if(arguments.length<2)throw"The given arguments are not enough";return this._handleData("pushOnce",a,b,c)},pop:function(a,b){return this._handleData("pop",a,null,b)},shift:function(a,b){return this._handleData("shift",a,null,b)},remove:function(a,b){return this._handleData("remove",a,null,b)},trigger:function(a){for(var b=arguments.length,c=Array(b>1?b-1:0),d=1;b>d;d++)c[d-1]=arguments[d];return snew.eventsystem.trigger(a,"*",c)},_handleData:function(a,b,c,d){return d||(d={}),b=this._generateRealpath(b,d),this._handleRealData(a,b,c,d)},_handleRealData:function(a,b,c,d,e,f){f||(f=0);for(var g=snew.objHelper.hasQuery(b)?[]:void 0,h=f;h<b.length;h++){var i=b[h],j=b[b.length-1];if(snew.objHelper.isQuery(i)){var k=this._getReference(b)[j];for(var l in k)k.hasOwnProperty(l)&&snew.objHelper.isTrue(k[l],i,d.query)&&g.push(this._handleRealData(a,b,c,d));return g}if(h+1==b.length)return this._handleTypes(a,b,c,d)}return g},_handleTypes:function(a,b,c,d){var e=b[b.length-1],f=d.forceRender||!1,g=!1,d={},h=void 0;switch(a){case"get":g=this._getReference(b)[e];break;case"set":h=this._getReference(b)[e],h!=c&&(this._getReference(b)[e]=c,g=!0,f=!0);break;case"push":case"pushOnce":h=this._getReference(b,"arr",d)[e],("pushOnce"!=a||-1===h.indexOf(c))&&(h.push(c),g=!0,f=!0,"pushOnce"===a&&(a="push"));break;case"remove":if(h=this._getReference(b,"arr",d),!(h instanceof Array))throw"Removing does only work for arrays currently";h.splice(e,1),g=!0,f=!0;break;default:throw"type "+a+" is not defined"}if(f&&this.view){var i=!1,j=null,k=this._meta.contentSpace.length;if(this._meta.contentSpace){var l=b.slice(0,k);j=b.slice(k,b.length),snew.utilHelper.isEqual(l,this._meta.contentSpace)&&(i=!0)}else j=b,i=!0;i&&(snew.viewHelper.dirtyHandling!==!1?this.view._addDirty(d.createdParent?d.createdParent.slice(k,d.createdParent.length):j,d.createdParent?"set":a,c):this.view._render())}return g},_getReference:function(a,b,c){var d=null,e=null;1===a.length?(d=this,e=0):(d=this[a[0]],e=1);for(var f=e;f<a.length;f++){var g=a[f];if(d[g]||("arr"==b&&f<a.length?(c&&!c.createdParent&&(c.createdParent=a.slice(0,f+1)),d[g]=[],console.info(a.slice(0,f+1).join(".")+" did not exist, so I created it for you")):("obj"==b||f+1<a.length)&&(d[g]={},c&&!c.createdParent&&(c.createdParent=a.slice(0,f+1)),console.info(a.slice(0,f+1).join(".")+" did not exist, so I created it for you"))),f==a.length-1)return 1===a.length?this:d;d=d[g]}throw"Something went totally wrong at getting the references"},_generateRealpath:function(a,b){"string"==typeof a&&(a=a.split("."));var c=c=b.contentSpace?this._meta.contentSpace:this._meta.contentSpace;if(c){a=snew.utilHelper.clone(a);for(var d=c.length;d>0;d--)a.unshift(c[d-1])}return a}},f=function(){var a=arguments[arguments.length-1],b=d["default"].clone(e);return d["default"].merge(a,b),arguments.length>1&&(a._meta.type=arguments[0]),arguments.length>2&&(a._meta.path=arguments[1]),a};return a=f}({},a),c=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({logicOperators:[{delimiter:"&&",defaultValue:!0},{delimiter:"||",defaultValue:!1},{delimiter:"@each",defaultValue:!0,skip:!0}],types:["==","!=",">=","<=",">","<"],isTrue:function(a,b,c){var d=this.getType(b),e=d.defaultValue;if(d.skip)return e;for(var f=b.split(d.delimiter),g=0;g<f.length;g++){var h=this.getLogicParts(f[g]);if(this.objCheck(a,h,c)!=d.defaultValue){e=!e;break}}return e},getVariableName:function(a){return"{"==a[0]&&"}"==a[a.length-1]?a.slice(1,a.length-1):void 0},objCheck:function(a,b,c){var d=null,e=this.getVariableName(b.value),f=[b.value];e&&(this.variableValidation(e,c),f=c[e]);for(var g=0;g<f.length;g++){var h=f[g];if(d=this.valueCompare(a[b.key],h,b.type))break}return d},valueCompare:function(a,b,c){var d=null;switch(c){case"==":d=a===b?!0:!1;break;case"!=":d=a!==b?!0:!1;break;case">=":d=a>=b?!0:!1;break;case"<=":d=b>=a?!0:!1;break;case">":d=a>b?!0:!1;break;case"<":d=b>a?!0:!1;break;default:throw"Type "+c+" is not implemented, please contact https://github.com/plusgut/snew/issues"}return d},getLogicParts:function(a){for(var b=0;b<this.types.length;b++){var c=this.types[b];if(-1!=a.indexOf(c)){var d=a.split(c);if(2!=d.length)throw"Your logic operator was there mutliple times "+a;return{key:d[0],type:c,value:d[1]}}}throw"Your logic operator was not available "+a},getType:function(a){for(var b=null,c=this.logicOperators.length;c>0;c--){var d=this.logicOperators[c-1];if(-1!=a.indexOf(d.delimiter)||1===c&&!b){if(b)throw"You can not use multiple types";b=d}}return b},hasQuery:function(a){for(var b=0;b<a.length;b++)if(this.isQuery(a[b]))return!0},isQuery:function(a){return"object"==typeof a?!0:void 0},variableValidation:function(a,b){if(!b||void 0===b[a])throw a+" was not set in opt: {query: {}}";if(this.utilHelper.isArray(b[a])instanceof Array)throw a+" query has to be an array"},isKeyChild:function(a,b){return!0}})}({},b),d=function(a){"use strict";function b(a,b){snew.controllerHelper.list[a]?console.warn("The Controller for "+a+" already exists"):(snew.controllerHelper.list[a]=snew.Obj("controller",a,b),snew.controllerHelper.list[a]._meta.path=a,snew.utilHelper.merge(snew.controllerHelper.list[a],c))}var c={_meta:{registry:!0,contentSpace:["content"],type:"controller",requests:{}},content:{},construct:function(){},notify:function(){},preprocess:function(a){return a},send:function(a){var b=snew.helperAdapter.send(a);return this._meta.requests[b]=a,b},fetch:function(){this._meta.modelFinished=!1,this._meta.modelLoading=!1,this._loadModel()},_loadModel:function(){if(this.model&&!this._meta.modelFinished){if(!this._meta.modelLoading){this._meta.modelLoading=!0;var a=this.model;this.send({model:a,success:"_modelSuccess",error:"_modelError"})}return!0}return!1},_checkRequest:function(a,b){for(var c in this._meta.requests)if(c==a){var d=this._meta.requests[c],e=d.success;b.error&&(e=d.error),this[e](b),delete this._meta.requests[c]}},subscribe:function(a){return snew.utilAdapter.subscribe(a)},_modelSuccess:function(a){this._meta.modelFinished=!0,a=this.preprocess(a.result),a instanceof Array&&(this.meta.key="values",console.info(this._meta.path+" had an model which returned an array. Put it instead of content, to content.values")),this.model.key?this.set(this.model.key,a,this.model.opt):this.setAll(a,this.model.opt),snew.controllerHelper.callInits()},_modelError:function(a){this._meta.modelFinished=!0,this.set("error",!0),this.set("message",a.result),snew.controllerHelper.callInits(),console.warn(this._meta.path+" got an error ",a)}};return a=b}({}),e=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({id:0,list:{},anons:{},inits:[],garbageCollection:!0,systemLoaded:!1,_registers:{},init:function(){this.garbageCollection!==!1&&this.addJob({callback:this.garbage}),this.addJob({callback:this._callInits})},create:function(a,b,c){var d=++this.id;this.inits.push(d),this.anons[d]=this.getEntity(a),this.anons[d]._meta.uid=d,b&&snew.utilHelper.merge(this.anons[d].content,b),this.anons[d].view=snew.viewHelper.create(a,c),this.anons[d].view.controller=this.anons[d],this._handleRegisters(this.anons[d],c),snew.utilHelper.safeCall(this.anons[d],"construct"),snew.utilHelper.safeCall(this.anons[d].view,"construct");var e=this.anons[d].view._compileComplete();return{uid:d,html:e}},_callInits:function(a){for(var b=[],c=!1,d=0;d<snew.controllerHelper.inits.length;d++){var e=snew.controllerHelper.inits[d];c=!0,snew.controllerHelper.controllerExists(e)&&(snew.controllerHelper.anons[e]._loadModel(e)?b.push(e):(snew.utilHelper.safeCall(snew.controllerHelper.anons[e],"init"),snew.utilHelper.safeCall(snew.controllerHelper.anons[e].view,"init")))}c&&0===b.length&&!snew.controllerHelper.systemLoaded&&(snew.controllerHelper.systemLoaded=!0,snew.helperHelper.callInits()),snew.controllerHelper.inits=b},controllerExists:function(a){return snew.controllerHelper.anons[a]?!0:void console.error("Controller does not exist",a)},getEntity:function(a){return this.list[a]||(console.log("Controller "+a+" did not exist, I created it for you"),snew.Controller(a,{_meta:{pseudo:!0,path:a}})),snew.utilHelper.clone(this.list[a])},search:function(a){return this._iterate(a)},call:function(a,b,c){return this._iterate(a,b,c)},_iterate:function(a,b,c){var d=window.parseInt(a,10);if(isNaN(d)||!this.anons[d]){var e=[];for(var f in this.anons)if(this.anons.hasOwnProperty(f)&&(this.anons[f]._meta.path==a||"@each"==a||"*"==a||this.anons[f]._meta.uid==a))if(b){var g=snew.utilHelper.safeCall(this.anons[f],b,c);e.push(g)}else e.push(this.anons[f]);return e}return b?[snew.utilHelper.safeCall(this.anons[d],b,c)]:[this.anons[d]]},_addRegister:function(a,b){this._registers[a]?console.warn(a+" has already an registration"):this._registers[a]=b},_handleRegisters:function(a){for(var b in this._registers){var c=this._registers[b];snew[b][c](a,"controller")}},garbage:function(){}})}({},b),f=function(a){"use strict";function b(a,b){app.helper||(app.helper={}),app.helper[a]?console.warn("The helper for "+a+" already exists"):app.helper[a]=snew.Obj("helper",a,b)}return a=b}({}),g=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({search:function(){var a=[];for(var b in app.helper)a.push(app.helper[b]);return a},callInits:function(){var a=[];for(var b in app.helper)snew.utilHelper.safeCall(app.helper[b],"init");return a}})}({},b),h=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}function d(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}var e=c(b);return a=(0,e["default"])({_list:{},_eventParts:["action","type"],init:function(){snew.controllerHelper._addRegister("eventsystem","_addEvents")},trigger:function(a,b,c){var e=[];if(this._list[a])for(var f in this._list[a])for(var g in this._list[a][f])for(var h=this._list[a][f][g],i=snew[f+"Helper"].search(g),j=0;j<i.length;j++)for(var k=i[j],l=0;l<h.length;l++){var m=h[l];k[m.action]?e.push(k[m.action].apply(k,[a].concat(d(c)))):console.error("The "+f+" does not have the function "+m.action,g)}return e.length||console.warn("There was no eventdefinition found "+a),e},_addEvents:function(a,b){if(a.events)for(var c=0;c<a.events.length;c++)this.addEvent(a.events[c],a._meta.uid,b)},addEvent:function(a,b,c){this._list[a.type]||(this._list[a.type]={}),this._list[a.type][c]||(this._list[a.type][c]={}),this._list[a.type][c][b]||(this._list[a.type][c][b]=[]),this._list[a.type][c][b].push(a)},validateEvent:function(a,b){var c=!0,d=0;for(var e in a)a.hasOwnProperty(e)&&(-1===this._eventParts.indexOf(e)?console.warn(b._meta.namespace+" | 	The event has some unknown options ("+e+")",a,b):(d++,"action"!==e||b[a[e]]||(c=!1,console.error(b._meta.namespace+" | 	The given action ("+a[e]+") does not exist in the class"))));return c&&d===this._eventParts.length?!0:!1}})}({},b),i=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({events:[{action:"change",type:"hashchange"},{action:"changeUrl",type:"route"}],delimiter:"/",init:function(){this.changed||this.change(location.hash)},getState:function(){for(var a=location.hash.substring(1,location.hash.length),b=a.split(this.delimiter);b.length>0&&""===b[b.length-1];)b.pop();return b},changeUrl:function(a){var b=a.join(this.delimiter);return location.hash!="#"+b?(location.hash=b,!0):void 0},writeUrl:function(){location.hash=this.getUrl()},getUrl:function(a){return a.join(this.delimiter)},change:function(a){this.triggerUrl(this.getState())},triggerUrl:function(a){this.changed=!0;var b=null,c=this.getUrl(a);b=c.length?this.trigger("/"+c):this.trigger("/"),0===b.length&&this.trigger("/404")}})}({},b),j=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({jobs:[],ticks:10,init:function(){this.loop()},loop:function(){for(var a=0;a<this.jobs.length;a++)this.jobs[a].callback();snew.viewHelper.dirtyChecking(),this.stopped||setTimeout(this.loop.bind(this),this.ticks)},_addJob:function(a){return this.jobs.push(a)},stop:function(){this.stopped=!0},start:function(){this.stopped=!1,this.loop()}})}({},b),k=function(a){"use strict";function b(a,b){snew.viewHelper.list[a]?console.warn("The View for "+a+" already exists"):(snew.viewHelper.list[a]=snew.Obj("view",a,b),snew.utilHelper.merge(snew.viewHelper.list[a],c))}var c={_meta:{type:"view",contentSpace:["controller","content"],currentValues:{},dirty:[]},events:[],construct:function(){},notify:function(){},_triggerEvent:function(a,b,c,d){},_updateCurrent:function(a,b,c){var d=snew.templateHelper.syncModel(this._meta.path,a,b,c,this._meta.currentValues);d&&this.controller.set(d,c)},_render:function(){this._compile(this._meta.dirty),this._meta.dirty=[],snew.utilHelper.safeCall(this.controller,"notify"),snew.utilHelper.safeCall(this,"notify")},_compile:function(a){return snew.templateHelper.compile(this.controller._meta.path,this.controller._meta.uid,this.controller.content,this._meta.currentValues,a,this.controller._meta.uid)},_compileComplete:function(){var a=this.controller._meta.uid;return snew.viewHelper.scriptStart(a,this._meta.path)+this._compile("*")+snew.viewHelper.scriptEnd(a)},_addDirty:function(a,b,c){this._meta.dirty.push({type:b,value:c,key:a}),snew.viewHelper.pushOnce("dirties",this.controller._meta.uid)},_handleDirties:function(){this._compile(this._batchDirties(this._meta.dirty)),this._meta.dirty=[]},_batchDirties:function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];if("set"==d.type)this._compress(d,b,!1,d.value);else if("push"===d.type)this._compress(d,b,this.get(d.key).length-1,d.value);else if("shift"===d.type)this._compress(d,b,0,d.value);else{if("remove"!==d.type)throw"Unknown dataoperation, could not compile template";this._compress(d,b,!1,d.value)}}return b},_compress:function(a,b,c,d){for(var e=snew.viewHelper.getCompressType(a.type),f=!1,g=0;g<b.length;g++){for(var h=!0,i=0;i<b[g].key.length;i++)if(b[g].key[i]!==a.key[g]){h=!1;break}if(h)if("create"===e)b[g].length!==a.key.length?f=!0:b[g].to>=c&&c<=b[g].to+b[g].values.length&&(b[g].values=snew.utilHelper.arrayInsertAt(b[g].values,d,c),f=!0);else if("set"!==e)throw"Unknown dirtyType "+e}f||b.push({type:e,key:a.key,values:[a.value],to:c})}};return a=b}({}),l=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({templatePrefix:"templates/",entrance:"#app",startPath:"main/app",uidDomNode:"SCRIPT",uidAttrStart:"data-begin",uidAttrEnd:"data-end",list:{},dirties:[],eventSpaces:["controllerHelper","helperHelper"],eventListeners:["keydown"],eventMap:{keydown:{keyCode:{13:"view.enterkey",27:"view.escapekey"}}},_meta:{contentSpace:!1},init:function(){tempartCompiler.partial=this.partialHandling,this.dirtyHandling!==!1&&this.addJob({callback:this.dirtyChecking}),this.checkValidity(),this.insertApp(),this.addEvents()},partialHandling:function(a,b,c,d,e){return c[a.id]={path:e,uid:1+snew.controllerHelper.id},snew.controllerHelper.create(e,b).html},create:function(a,b){return this.getEntity(a)},insertApp:function(){var a=document.querySelector(this.entrance);if(a){var b=snew.controllerHelper.create(this.startPath,null,{});a.outerHTML=b.html}else console.error("snew.viewHelper.entrance was not represented in dom properly",a)},getEntity:function(a){return this.list[a]||(console.log("View "+a+" does not exist"),snew.View(a,{_meta:{pseudo:!0}})),snew.utilHelper.clone(this.list[a])},getCompressType:function(a){return("shift"===a||"push"===a)&&(a="create"),a},scriptStart:function(a,b){return"<"+this.uidDomNode+" "+this.uidAttrStart+'="'+a+'" data-template="'+b+'"></'+this.uidDomNode+">"},scriptEnd:function(a){return"<"+this.uidDomNode+" "+this.uidAttrEnd+'="'+a+'"></'+this.uidDomNode+">"},checkValidity:function(){if(!this.entrance)throw"App entrance is not defined"},dirtyChecking:function(){if(snew.viewHelper.dirties){for(var a=0;a<snew.viewHelper.dirties.length;a++)for(var b=snew.viewHelper.dirties[a],c=snew.controllerHelper.search(b),d=0;d<c.length;d++){var e=c[d];e.view._handleDirties()}snew.viewHelper.dirties=[]}},getUids:function(a){var b=[],c=[];do{var d=this.isUidEndObj(a),e=this.isUidObj(a);d?c.push(d):e&&-1===c.indexOf(e)&&b.push(e),a=a.previousSibling?a.previousSibling:a.parentNode}while(a);return b},isUidObj:function(a){return this._getAttributeValue(a,this.uidDomNode,this.uidAttrStart)},isUidEndObj:function(a){return this._getAttributeValue(a,this.uidDomNode,this.uidAttrEnd)},_getAttributeValue:function(a,b,c){if(a.nodeName===b)for(var d=0;d<a.attributes.length;d++)if(a.attributes[d].nodeName===c)return a.attributes[d].nodeValue},addEvents:function(){for(var a=this,b=0;b<this.eventListeners.length;b++)document.body.addEventListener(this.eventListeners[b],function(a){return snew.viewHelper.handleEvent(a)});window.addEventListener("hashchange",function(){a.trigger("hashchange",location.hash)})},handleEvent:function(a){this.getUids(a.target);this.triggerExtra(a),this.updateData(a)},updateData:function(a){"keydown"==a.type&&setTimeout(function(){var b=a.target.getAttribute("tempartstart");if(b&&13!==a.keyCode){var c=b.indexOf("-"),d=b.slice(0,c),e=b.slice(c+1,b.length),f=snew.search(d);if(1!==f.length)throw"Getting the correct controller failed somehow";var g=f[0];g.view._updateCurrent(e,"value",a.target.value)}},0)},triggerExtra:function(a){if(this.eventMap[a.type])for(var b in this.eventMap[a.type]){var c=a[b];if(c){var d=this.eventMap[a.type][b][c];d&&this.trigger(d,a)}}},getAttributes:function(a,b){if(b||(b={}),a){var c=a.attributes;void 0===b.id&&a.attr("id")&&void 0===c["data-id"]&&(b.id=a.attr("id"));var d=["ember-extension"];for(var e in c)if(c.hasOwnProperty(e)){var f=c[e].name,g=c[e].value;if(f&&0===f.search("data-")){var h=f.replace(/data-/,"");void 0===b[h]&&-1==d.indexOf(h)&&(b[h]=g||null)}}a.parentNode&&(b=this.getAttributes(a.parentNode,b))}return b}})}({},b),m=function(a){"use strict";function b(a,b){snew.templateHelper.list[a]?console.warn("The Template for "+a+" already exists"):snew.templateHelper.list[a]=b}return a=b}({}),n=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({list:{},init:function(){tempartCompiler.trigger=this.triggerEvent.bind(this)},triggerEvent:function(a,b,c){for(var d=snew.search(a),e=0;e<d.length;e++){var f=d[e],g=!1;if(f[b]&&(g=!0,f[b].apply(f,c)),f.view[b]&&(g=!0,f.view[b].apply(f.view,c)),!g)throw"Could not matching event("+b+") to controller("+f._meta.path+")"}snew.viewHelper.dirtyChecking()},compile:function(a,b,c,d,e,f){if(this.list[a])return tempartCompiler.compile({blocks:this.list[a],content:c,currentValues:d,dirties:e,path:a,prefix:f});throw"Template "+a+" does not exist"},syncModel:function(a,b,c,d,e){if(!this.list[a])throw"No such template found";return tempartCompiler.syncModel(this.list[a],b,c,d,e)}})}({},b),o=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";function p(a){return a&&a.__esModule?a:{"default":a}}var q=p(b),r=p(c),s=p(d),t=p(e),u=p(f),v=p(g),w=p(h),x=p(i),y=p(j),z=p(k),A=p(l),B=p(m),C=p(n),D=p(o),E=(0,q["default"])({Obj:q["default"],didInit:!1,init:function(a){this.didInit=!0,window.app||(window.app={}),console.log("Can I haz some snews?"),this.utilHelper.merge(E,a),this.executeInit()},search:function(a){return this.controllerHelper.search(a)},executeInit:function(){var a=["eventsystem","viewHelper"];for(var b in a)a.hasOwnProperty(b)&&E[a[b]].init();for(var c in this)"object"==typeof this[c]&&"function"==typeof this[c].init&&-1===a.indexOf(c)&&this[c].init()}});return E.objHelper=r["default"],E.Controller=s["default"],E.controllerHelper=t["default"],E.Helper=u["default"],E.helperHelper=v["default"],E.eventsystem=w["default"],E.routerHelper=x["default"],E.utilHelper=y["default"],E.runloopHelper=z["default"],E.View=A["default"],E.viewHelper=B["default"],E.Template=C["default"],E.templateHelper=D["default"],setTimeout(function(){E.didInit||console.log("To setup a snew application you should call snew.init({})")},10),window.snew=E,a=E}({},b,c,d,e,f,g,h,i,a,j,k,l,m,n)}();<commit_msg>[dist] new version<commit_after>!function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o;a=function(a){"use strict";var b={merge:function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]?"object"!=typeof a[c]||"object"!=typeof b[c]||this.isFunction(a[c])||this.isFunction(b[c])||this.merge(a[c],b[c]):a[c]=b[c])},isFunction:function(a){return!!(a&&a.constructor&&a.call&&a.apply)},isEqual:function(a,b){return JSON.stringify(a)===JSON.stringify(b)},arrayInsertAt:function(a,b,c){var d=a.slice(0,c);return d.push(b),d.concat(a.slice(c,a.length))},clone:function(a){if(!(a instanceof Object)||this.isFunction(a))return a;var b=new a.constructor;for(var c in a)b[c]=this.clone(a[c]);return b},safeCall:function(a,b,c){if(c||(c=[]),app.debug)return a[b](c[0],c[1],c[2],c[3]);try{return a[b](c[0],c[1],c[2],c[3])}catch(d){console.error(d)}}};return a=window.snew?snew.Obj(b):b}({}),b=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b),e={_meta:{contentSpace:!1},init:function(){},destroy:function(){},get:function(a,b){return this._handleData("get",a,null,b)},set:function(a,b,c){if(arguments.length<2)throw"The given arguments are not enough";return this._handleData("set",a,b,c)},unset:function(a,b){if(arguments.length<1)throw"The given arguments are not enough";return this._handleData("set",a,null,b)},addJob:function(a){a.uid=this._meta.uid,snew.runloopHelper._addJob(a)},setAll:function(a,b){var c=this._meta.contentSpace;return b||(b={}),void 0!==b.contentSpace&&(c=b.contentSpace),b.contentSpace=!1,this._handleData("set",c,a,b)},push:function(a,b,c){if(arguments.length<2)throw"The given arguments are not enough";return this._handleData("push",a,b,c)},pushOnce:function(a,b,c){if(arguments.length<2)throw"The given arguments are not enough";return this._handleData("pushOnce",a,b,c)},pop:function(a,b){return this._handleData("pop",a,null,b)},shift:function(a,b){return this._handleData("shift",a,null,b)},remove:function(a,b){return this._handleData("remove",a,null,b)},trigger:function(a){for(var b=arguments.length,c=Array(b>1?b-1:0),d=1;b>d;d++)c[d-1]=arguments[d];return snew.eventsystem.trigger(a,"*",c)},_handleData:function(a,b,c,d){return d||(d={}),b=this._generateRealpath(b,d),this._handleRealData(a,b,c,d)},_handleRealData:function(a,b,c,d,e,f){f||(f=0);for(var g=snew.objHelper.hasQuery(b)?[]:void 0,h=f;h<b.length;h++){var i=b[h],j=b[b.length-1];if(snew.objHelper.isQuery(i)){var k=this._getReference(b)[j];for(var l in k)k.hasOwnProperty(l)&&snew.objHelper.isTrue(k[l],i,d.query)&&g.push(this._handleRealData(a,b,c,d));return g}if(h+1==b.length)return this._handleTypes(a,b,c,d)}return g},_handleTypes:function(a,b,c,d){var e=b[b.length-1],f=d.forceRender||!1,g=!1,d={},h=void 0;switch(a){case"get":g=this._getReference(b)[e];break;case"set":h=this._getReference(b)[e],h!=c&&(this._getReference(b)[e]=c,g=!0,f=!0);break;case"push":case"pushOnce":h=this._getReference(b,"arr",d)[e],("pushOnce"!=a||-1===h.indexOf(c))&&(h.push(c),g=!0,f=!0,"pushOnce"===a&&(a="push"));break;case"remove":if(h=this._getReference(b,"arr",d),!(h instanceof Array))throw"Removing does only work for arrays currently";h.splice(e,1),g=!0,f=!0;break;default:throw"type "+a+" is not defined"}if(f&&this.view){var i=!1,j=null,k=this._meta.contentSpace.length;if(this._meta.contentSpace){var l=b.slice(0,k);j=b.slice(k,b.length),snew.utilHelper.isEqual(l,this._meta.contentSpace)&&(i=!0)}else j=b,i=!0;i&&(snew.viewHelper.dirtyHandling!==!1?this.view._addDirty(d.createdParent?d.createdParent.slice(k,d.createdParent.length):j,d.createdParent?"set":a,c):this.view._render())}return g},_getReference:function(a,b,c){var d=null,e=null;1===a.length?(d=this,e=0):(d=this[a[0]],e=1);for(var f=e;f<a.length;f++){var g=a[f];if(d[g]||("arr"==b&&f<a.length?(c&&!c.createdParent&&(c.createdParent=a.slice(0,f+1)),d[g]=[],console.info(a.slice(0,f+1).join(".")+" did not exist, so I created it for you")):("obj"==b||f+1<a.length)&&(d[g]={},c&&!c.createdParent&&(c.createdParent=a.slice(0,f+1)),console.info(a.slice(0,f+1).join(".")+" did not exist, so I created it for you"))),f==a.length-1)return 1===a.length?this:d;d=d[g]}throw"Something went totally wrong at getting the references"},_generateRealpath:function(a,b){"string"==typeof a&&(a=a.split("."));var c=c=b.contentSpace?this._meta.contentSpace:this._meta.contentSpace;if(c){a=snew.utilHelper.clone(a);for(var d=c.length;d>0;d--)a.unshift(c[d-1])}return a}},f=function(){var a=arguments[arguments.length-1],b=d["default"].clone(e);return d["default"].merge(a,b),arguments.length>1&&(a._meta.type=arguments[0]),arguments.length>2&&(a._meta.path=arguments[1]),a};return a=f}({},a),c=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({logicOperators:[{delimiter:"&&",defaultValue:!0},{delimiter:"||",defaultValue:!1},{delimiter:"@each",defaultValue:!0,skip:!0}],types:["==","!=",">=","<=",">","<"],isTrue:function(a,b,c){var d=this.getType(b),e=d.defaultValue;if(d.skip)return e;for(var f=b.split(d.delimiter),g=0;g<f.length;g++){var h=this.getLogicParts(f[g]);if(this.objCheck(a,h,c)!=d.defaultValue){e=!e;break}}return e},getVariableName:function(a){return"{"==a[0]&&"}"==a[a.length-1]?a.slice(1,a.length-1):void 0},objCheck:function(a,b,c){var d=null,e=this.getVariableName(b.value),f=[b.value];e&&(this.variableValidation(e,c),f=c[e]);for(var g=0;g<f.length;g++){var h=f[g];if(d=this.valueCompare(a[b.key],h,b.type))break}return d},valueCompare:function(a,b,c){var d=null;switch(c){case"==":d=a===b?!0:!1;break;case"!=":d=a!==b?!0:!1;break;case">=":d=a>=b?!0:!1;break;case"<=":d=b>=a?!0:!1;break;case">":d=a>b?!0:!1;break;case"<":d=b>a?!0:!1;break;default:throw"Type "+c+" is not implemented, please contact https://github.com/plusgut/snew/issues"}return d},getLogicParts:function(a){for(var b=0;b<this.types.length;b++){var c=this.types[b];if(-1!=a.indexOf(c)){var d=a.split(c);if(2!=d.length)throw"Your logic operator was there mutliple times "+a;return{key:d[0],type:c,value:d[1]}}}throw"Your logic operator was not available "+a},getType:function(a){for(var b=null,c=this.logicOperators.length;c>0;c--){var d=this.logicOperators[c-1];if(-1!=a.indexOf(d.delimiter)||1===c&&!b){if(b)throw"You can not use multiple types";b=d}}return b},hasQuery:function(a){for(var b=0;b<a.length;b++)if(this.isQuery(a[b]))return!0},isQuery:function(a){return"object"==typeof a?!0:void 0},variableValidation:function(a,b){if(!b||void 0===b[a])throw a+" was not set in opt: {query: {}}";if(this.utilHelper.isArray(b[a])instanceof Array)throw a+" query has to be an array"},isKeyChild:function(a,b){return!0}})}({},b),d=function(a){"use strict";function b(a,b){snew.controllerHelper.list[a]?console.warn("The Controller for "+a+" already exists"):(snew.controllerHelper.list[a]=snew.Obj("controller",a,b),snew.controllerHelper.list[a]._meta.path=a,snew.utilHelper.merge(snew.controllerHelper.list[a],c))}var c={_meta:{registry:!0,contentSpace:["content"],type:"controller",requests:{}},content:{},construct:function(){},notify:function(){},preprocess:function(a){return a},send:function(a){var b=snew.helperAdapter.send(a);return this._meta.requests[b]=a,b},fetch:function(){this._meta.modelFinished=!1,this._meta.modelLoading=!1,this._loadModel()},_loadModel:function(){if(this.model&&!this._meta.modelFinished){if(!this._meta.modelLoading){this._meta.modelLoading=!0;var a=this.model;this.send({model:a,success:"_modelSuccess",error:"_modelError"})}return!0}return!1},_checkRequest:function(a,b){for(var c in this._meta.requests)if(c==a){var d=this._meta.requests[c],e=d.success;b.error&&(e=d.error),this[e](b),delete this._meta.requests[c]}},subscribe:function(a){return snew.utilAdapter.subscribe(a)},_modelSuccess:function(a){this._meta.modelFinished=!0,a=this.preprocess(a.result),a instanceof Array&&(this.meta.key="values",console.info(this._meta.path+" had an model which returned an array. Put it instead of content, to content.values")),this.model.key?this.set(this.model.key,a,this.model.opt):this.setAll(a,this.model.opt),snew.controllerHelper.callInits()},_modelError:function(a){this._meta.modelFinished=!0,this.set("error",!0),this.set("message",a.result),snew.controllerHelper.callInits(),console.warn(this._meta.path+" got an error ",a)}};return a=b}({}),e=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({id:0,list:{},anons:{},inits:[],garbageCollection:!0,systemLoaded:!1,_registers:{},init:function(){this.garbageCollection!==!1&&this.addJob({callback:this.garbage}),this.addJob({callback:this._callInits})},create:function(a,b,c){var d=++this.id;this.inits.push(d),this.anons[d]=this.getEntity(a),this.anons[d]._meta.uid=d,b&&snew.utilHelper.merge(this.anons[d].content,b),this.anons[d].view=snew.viewHelper.create(a,c),this.anons[d].view.controller=this.anons[d],this._handleRegisters(this.anons[d],c),snew.utilHelper.safeCall(this.anons[d],"construct"),snew.utilHelper.safeCall(this.anons[d].view,"construct");var e=this.anons[d].view._compileComplete();return{uid:d,html:e}},_callInits:function(a){for(var b=[],c=!1,d=0;d<snew.controllerHelper.inits.length;d++){var e=snew.controllerHelper.inits[d];c=!0,snew.controllerHelper.controllerExists(e)&&(snew.controllerHelper.anons[e]._loadModel(e)?b.push(e):(snew.utilHelper.safeCall(snew.controllerHelper.anons[e],"init"),snew.utilHelper.safeCall(snew.controllerHelper.anons[e].view,"init")))}c&&0===b.length&&!snew.controllerHelper.systemLoaded&&(snew.controllerHelper.systemLoaded=!0,snew.helperHelper.callInits()),snew.controllerHelper.inits=b},controllerExists:function(a){return snew.controllerHelper.anons[a]?!0:void console.error("Controller does not exist",a)},getEntity:function(a){return this.list[a]||(console.log("Controller "+a+" did not exist, I created it for you"),snew.Controller(a,{_meta:{pseudo:!0,path:a}})),snew.utilHelper.clone(this.list[a])},search:function(a){return this._iterate(a)},call:function(a,b,c){return this._iterate(a,b,c)},_iterate:function(a,b,c){var d=window.parseInt(a,10);if(isNaN(d)||!this.anons[d]){var e=[];for(var f in this.anons)if(this.anons.hasOwnProperty(f)&&(this.anons[f]._meta.path==a||"@each"==a||"*"==a||this.anons[f]._meta.uid==a))if(b){var g=snew.utilHelper.safeCall(this.anons[f],b,c);e.push(g)}else e.push(this.anons[f]);return e}return b?[snew.utilHelper.safeCall(this.anons[d],b,c)]:[this.anons[d]]},_addRegister:function(a,b){this._registers[a]?console.warn(a+" has already an registration"):this._registers[a]=b},_handleRegisters:function(a){for(var b in this._registers){var c=this._registers[b];snew[b][c](a,"controller")}},garbage:function(){}})}({},b),f=function(a){"use strict";function b(a,b){app.helper||(app.helper={}),app.helper[a]?console.warn("The helper for "+a+" already exists"):app.helper[a]=snew.Obj("helper",a,b)}return a=b}({}),g=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({search:function(){var a=[];for(var b in app.helper)a.push(app.helper[b]);return a},callInits:function(){var a=[];for(var b in app.helper)snew.utilHelper.safeCall(app.helper[b],"init");return a}})}({},b),h=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}function d(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}var e=c(b);return a=(0,e["default"])({_list:{},_eventParts:["action","type"],init:function(){snew.controllerHelper._addRegister("eventsystem","_addEvents")},trigger:function(a,b,c){var e=[];if(this._list[a])for(var f in this._list[a])for(var g in this._list[a][f])for(var h=this._list[a][f][g],i=snew[f+"Helper"].search(g),j=0;j<i.length;j++)for(var k=i[j],l=0;l<h.length;l++){var m=h[l];k[m.action]?e.push(k[m.action].apply(k,[a].concat(d(c)))):console.error("The "+f+" does not have the function "+m.action,g)}return e.length||console.warn("There was no eventdefinition found "+a),e},_addEvents:function(a,b){if(a.events)for(var c=0;c<a.events.length;c++)this.addEvent(a.events[c],a._meta.uid,b)},addEvent:function(a,b,c){this._list[a.type]||(this._list[a.type]={}),this._list[a.type][c]||(this._list[a.type][c]={}),this._list[a.type][c][b]||(this._list[a.type][c][b]=[]),this._list[a.type][c][b].push(a)},validateEvent:function(a,b){var c=!0,d=0;for(var e in a)a.hasOwnProperty(e)&&(-1===this._eventParts.indexOf(e)?console.warn(b._meta.namespace+" | 	The event has some unknown options ("+e+")",a,b):(d++,"action"!==e||b[a[e]]||(c=!1,console.error(b._meta.namespace+" | 	The given action ("+a[e]+") does not exist in the class"))));return c&&d===this._eventParts.length?!0:!1}})}({},b),i=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({events:[{action:"change",type:"hashchange"},{action:"changeUrl",type:"route"}],delimiter:"/",init:function(){this.changed||this.change(location.hash)},getState:function(){for(var a=location.hash.substring(1,location.hash.length),b=a.split(this.delimiter);b.length>0&&""===b[b.length-1];)b.pop();return b},changeUrl:function(a){var b=a.join(this.delimiter);return location.hash!="#"+b?(location.hash=b,!0):void 0},writeUrl:function(){location.hash=this.getUrl()},getUrl:function(a){return a.join(this.delimiter)},change:function(a){this.triggerUrl(this.getState())},triggerUrl:function(a){this.changed=!0;var b=null,c=this.getUrl(a);b=c.length?this.trigger("/"+c):this.trigger("/"),0===b.length&&this.trigger("/404")}})}({},b),j=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({jobs:[],ticks:10,init:function(){this.loop()},loop:function(){for(var a=0;a<this.jobs.length;a++)this.jobs[a].callback();snew.viewHelper.dirtyChecking(),this.stopped||setTimeout(this.loop.bind(this),this.ticks)},_addJob:function(a){return this.jobs.push(a)},stop:function(){this.stopped=!0},start:function(){this.stopped=!1,this.loop()}})}({},b),k=function(a){"use strict";function b(a,b){snew.viewHelper.list[a]?console.warn("The View for "+a+" already exists"):(snew.viewHelper.list[a]=snew.Obj("view",a,b),snew.utilHelper.merge(snew.viewHelper.list[a],c))}var c={_meta:{type:"view",contentSpace:["controller","content"],currentValues:{},dirty:[]},events:[],construct:function(){},notify:function(){},_triggerEvent:function(a,b,c,d){},_updateCurrent:function(a,b,c){var d=snew.templateHelper.syncModel(this._meta.path,a,b,c,this._meta.currentValues);d&&this.controller.set(d,c)},_render:function(){this._compile(this._meta.dirty),this._meta.dirty=[],snew.utilHelper.safeCall(this.controller,"notify"),snew.utilHelper.safeCall(this,"notify")},_compile:function(a){return snew.templateHelper.compile(this.controller._meta.path,this.controller._meta.uid,this.controller.content,this._meta.currentValues,a,this.controller._meta.uid,this.controller)},_compileComplete:function(){var a=this.controller._meta.uid;return snew.viewHelper.scriptStart(a,this._meta.path)+this._compile("*")+snew.viewHelper.scriptEnd(a)},_addDirty:function(a,b,c){this._meta.dirty.push({type:b,value:c,key:a}),snew.viewHelper.pushOnce("dirties",this.controller._meta.uid)},_handleDirties:function(){this._compile(this._batchDirties(this._meta.dirty)),this._meta.dirty=[]},_batchDirties:function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];if("set"==d.type)this._compress(d,b,!1,d.value);else if("push"===d.type)this._compress(d,b,this.get(d.key).length-1,d.value);else if("shift"===d.type)this._compress(d,b,0,d.value);else{if("remove"!==d.type)throw"Unknown dataoperation, could not compile template";this._compress(d,b,!1,d.value)}}return b},_compress:function(a,b,c,d){for(var e=snew.viewHelper.getCompressType(a.type),f=!1,g=0;g<b.length;g++){for(var h=!0,i=0;i<b[g].key.length;i++)if(b[g].key[i]!==a.key[g]){h=!1;break}if(h)if("create"===e)b[g].length!==a.key.length?f=!0:b[g].to>=c&&c<=b[g].to+b[g].values.length&&(b[g].values=snew.utilHelper.arrayInsertAt(b[g].values,d,c),f=!0);else if("set"!==e)throw"Unknown dirtyType "+e}f||b.push({type:e,key:a.key,values:[a.value],to:c})}};return a=b}({}),l=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({templatePrefix:"templates/",entrance:"#app",startPath:"main/app",uidDomNode:"SCRIPT",uidAttrStart:"data-begin",uidAttrEnd:"data-end",list:{},dirties:[],eventSpaces:["controllerHelper","helperHelper"],eventListeners:["keydown"],eventMap:{keydown:{keyCode:{13:"view.enterkey",27:"view.escapekey"}}},_meta:{contentSpace:!1},init:function(){tempartCompiler.partial=this.partialHandling,this.dirtyHandling!==!1&&this.addJob({callback:this.dirtyChecking}),this.checkValidity(),this.insertApp(),this.addEvents()},partialHandling:function(a,b,c,d,e){return c[a.id]={path:e,uid:1+snew.controllerHelper.id},snew.controllerHelper.create(e,b).html},create:function(a,b){return this.getEntity(a)},insertApp:function(){var a=document.querySelector(this.entrance);if(a){var b=snew.controllerHelper.create(this.startPath,null,{});a.outerHTML=b.html}else console.error("snew.viewHelper.entrance was not represented in dom properly",a)},getEntity:function(a){return this.list[a]||(console.log("View "+a+" does not exist"),snew.View(a,{_meta:{pseudo:!0}})),snew.utilHelper.clone(this.list[a])},getCompressType:function(a){return("shift"===a||"push"===a)&&(a="create"),a},scriptStart:function(a,b){return"<"+this.uidDomNode+" "+this.uidAttrStart+'="'+a+'" data-template="'+b+'"></'+this.uidDomNode+">"},scriptEnd:function(a){return"<"+this.uidDomNode+" "+this.uidAttrEnd+'="'+a+'"></'+this.uidDomNode+">"},checkValidity:function(){if(!this.entrance)throw"App entrance is not defined"},dirtyChecking:function(){if(snew.viewHelper.dirties){for(var a=0;a<snew.viewHelper.dirties.length;a++)for(var b=snew.viewHelper.dirties[a],c=snew.controllerHelper.search(b),d=0;d<c.length;d++){var e=c[d];e.view._handleDirties()}snew.viewHelper.dirties=[]}},getUids:function(a){var b=[],c=[];do{var d=this.isUidEndObj(a),e=this.isUidObj(a);d?c.push(d):e&&-1===c.indexOf(e)&&b.push(e),a=a.previousSibling?a.previousSibling:a.parentNode}while(a);return b},isUidObj:function(a){return this._getAttributeValue(a,this.uidDomNode,this.uidAttrStart)},isUidEndObj:function(a){return this._getAttributeValue(a,this.uidDomNode,this.uidAttrEnd)},_getAttributeValue:function(a,b,c){if(a.nodeName===b)for(var d=0;d<a.attributes.length;d++)if(a.attributes[d].nodeName===c)return a.attributes[d].nodeValue},addEvents:function(){for(var a=this,b=0;b<this.eventListeners.length;b++)document.body.addEventListener(this.eventListeners[b],function(a){return snew.viewHelper.handleEvent(a)});window.addEventListener("hashchange",function(){a.trigger("hashchange",location.hash)})},handleEvent:function(a){this.getUids(a.target);this.triggerExtra(a),this.updateData(a)},updateData:function(a){"keydown"==a.type&&setTimeout(function(){var b=a.target.getAttribute("tempartstart");if(b&&13!==a.keyCode){var c=b.indexOf("-"),d=b.slice(0,c),e=b.slice(c+1,b.length),f=snew.search(d);if(1!==f.length)throw"Getting the correct controller failed somehow";var g=f[0];g.view._updateCurrent(e,"value",a.target.value)}},0)},triggerExtra:function(a){if(this.eventMap[a.type])for(var b in this.eventMap[a.type]){var c=a[b];if(c){var d=this.eventMap[a.type][b][c];d&&this.trigger(d,a)}}},getAttributes:function(a,b){if(b||(b={}),a){var c=a.attributes;void 0===b.id&&a.attr("id")&&void 0===c["data-id"]&&(b.id=a.attr("id"));var d=["ember-extension"];for(var e in c)if(c.hasOwnProperty(e)){var f=c[e].name,g=c[e].value;if(f&&0===f.search("data-")){var h=f.replace(/data-/,"");void 0===b[h]&&-1==d.indexOf(h)&&(b[h]=g||null)}}a.parentNode&&(b=this.getAttributes(a.parentNode,b))}return b}})}({},b),m=function(a){"use strict";function b(a,b){snew.templateHelper.list[a]?console.warn("The Template for "+a+" already exists"):snew.templateHelper.list[a]=b}return a=b}({}),n=function(a,b){"use strict";function c(a){return a&&a.__esModule?a:{"default":a}}var d=c(b);return a=(0,d["default"])({list:{},init:function(){tempartCompiler.trigger=this.triggerEvent.bind(this)},triggerEvent:function(a,b,c){for(var d=snew.search(a),e=0;e<d.length;e++){var f=d[e],g=!1;if(f[b]&&(g=!0,f[b].apply(f,c)),f.view[b]&&(g=!0,f.view[b].apply(f.view,c)),!g)throw"Could not matching event("+b+") to controller("+f._meta.path+")"}snew.viewHelper.dirtyChecking()},compile:function(a,b,c,d,e,f,g){if(this.list[a])return tempartCompiler.compile({controller:g,blocks:this.list[a],content:c,currentValues:d,dirties:e,path:a,prefix:f});throw"Template "+a+" does not exist"},syncModel:function(a,b,c,d,e){if(!this.list[a])throw"No such template found";return tempartCompiler.syncModel(this.list[a],b,c,d,e)}})}({},b),o=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){"use strict";function p(a){return a&&a.__esModule?a:{"default":a}}var q=p(b),r=p(c),s=p(d),t=p(e),u=p(f),v=p(g),w=p(h),x=p(i),y=p(j),z=p(k),A=p(l),B=p(m),C=p(n),D=p(o),E=(0,q["default"])({Obj:q["default"],didInit:!1,init:function(a){this.didInit=!0,window.app||(window.app={}),console.log("Can I haz some snews?"),this.utilHelper.merge(E,a),this.executeInit()},search:function(a){return this.controllerHelper.search(a)},executeInit:function(){var a=["eventsystem","viewHelper"];for(var b in a)a.hasOwnProperty(b)&&E[a[b]].init();for(var c in this)"object"==typeof this[c]&&"function"==typeof this[c].init&&-1===a.indexOf(c)&&this[c].init()}});return E.objHelper=r["default"],E.Controller=s["default"],E.controllerHelper=t["default"],E.Helper=u["default"],E.helperHelper=v["default"],E.eventsystem=w["default"],E.routerHelper=x["default"],E.utilHelper=y["default"],E.runloopHelper=z["default"],E.View=A["default"],E.viewHelper=B["default"],E.Template=C["default"],E.templateHelper=D["default"],setTimeout(function(){E.didInit||console.log("To setup a snew application you should call snew.init({})")},10),window.snew=E,a=E}({},b,c,d,e,f,g,h,i,a,j,k,l,m,n)}();
{'fraction_non_alphanumeric': 0.26234328698427173, 'fraction_numerical': 0.009300205151584227, 'mean_word_length': 15.443403298350825, 'pattern_counts': {'":': 44, '<': 73, '<?xml version=': 0, '>': 43, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3574844', 'n_tokens_mistral': 17437, 'n_tokens_neox': 17433, 'n_words': 1043}