<commit_before>/*
Mag.JS v0.24.1
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
!function(e,t,n){function i(e,t){if(o[e]&&!t)return o[e];var n=mag.doc.getElementById(e);return n&&(o[e]=n),o[e]}e.mag={},mag.doc=t;var r={values:[],attributes:[],elementMatcher:[]},o=[];mag.create=function(e,t,n){return function(i,r){return"string"!=typeof i&&(r=i,i=0),mag.module(i||e,t,mag.utils.merge(n||{},r||{}))}},mag.module=function(e,t,n){n=n||{},e instanceof HTMLElement&&(e.id||(e.id=performance.now()),o[e.id]=e,e=e.id);var r;if(!(r=!mag.utils.items.isItem(e))){r=mag.utils.items.getItem(e);var a=i(e);r=!mag.utils.callLCEvent("onreload",mag.mod.getState(r),a,r)}return r&&(r=n.key&&mag.utils.items.isItem(e+"."+n.key)?mag.utils.items.getItem(e+"."+n.key):mag.utils.getItemInstanceId(n.key?e+"."+n.key:e),n.retain||mag.mod.clear(r),mag.mod.submodule(e,r,t,n),a=i(e),v(r,e),!mag.utils.callLCEvent("willload",mag.mod.getState(r),a,r,1))?(mag.redraw(a,r,1),mag.utils.callLCEvent("didload",mag.mod.getState(r),a,r,1),s(r,a,t,mag.utils.copy(n))):void 0};var a=function(e,t){return 0>t||t!=mag.utils.items.getItem(e)?e==mag.mod.getId(t)?!0:!1:!0},u=[];mag.begin=function(e){n===u[e]?u[e]=1:u[e]++},mag.end=function(e){if(1<u[e])u[e]--;else{u[e]=0;var t=mag.utils.items.getItemVal(e);mag.redraw(i(t),e)}};var l=[];mag.redraw=function(e,t,i){if(!u[t]){if(!e||n===t)throw Error("Mag.JS - Id or node invalid: "+mag.utils.items.getItemVal(t));a(e.id,t)&&(i&&mag.fill.configs.splice(0,mag.fill.configs.length),i&&mag.mod.clear(t),e=p(e,t,i),cancelAnimationFrame(l[t]),l[t]=requestAnimationFrame(e))}},mag.hookin=function(e,t,n){r[e].push({context:{},handler:n,key:t})},mag.hook=function(e,t,n){for(var i=0,o=r[e].length;o>i;i++)mag.utils.callHook(r,t,e,i,n)};var d={},c=[],f=function(e,t){mag.utils.onLCEvent("didupdate",e,function(n,r){var o=mag.utils.merge(mag.utils.copy(r),mag.utils.copy(n));JSON.stringify(o)!==JSON.stringify(c[e])&&(t(n,r,i(mag.mod.getId(e)),c[e]),c[e]=o)})},g=[],m=function(e,t,n,i,r){t=mag.utils.items.getItem(t),mag.mod.submodule(e.id,t,i,n),mag.utils.callLCEvent("willgetprops",mag.mod.getState(t),e,t,0,n)||(v(t,e.id),mag.redraw(e,t,r))},s=function(e,t,n,i){g[e]=g[e]||[];var r=function(e,t,n,i,r){if("object"==typeof r&&(i=mag.utils.merge(mag.utils.copy(i)||{},r),r=0),r=t.id+(i.key?"."+i.key:"")+"."+(r||0),t=d[r]=d[r]||t.cloneNode(1),t.id=r,mag.utils.items.isItem(r))return m(t,r,i,n,1),t;var o=mag.utils.getItemInstanceId(t.id);return g[e].push({instanceId:o,subscribe:f.bind({},o)}),m(t,r,i,n,1),t}.bind({},e,t,n,i);return r.clones=function(e){return g[e]}.bind({},e),r.destroy=function(e,t){var n=mag.getNode(mag.mod.getId(e)),i=function(){if(!mag.utils.callLCEvent("onunload",mag.mod.getState(e),n,e)){mag.clear(e);var i,o=0;i=n.id;var a,u=[];for(a in mag.fill.cached)-1<a.indexOf('id("'+i+'")/')&&-1<a.indexOf("-config")&&mag.fill.cached[a].configContext&&u.push({path:a.split("-config")[0],controller:mag.fill.cached[a].configContext,handler:mag.fill.cached[a].configContext.onunload});for(;i=u&&u[o];o++)i.controller.onunload&&(i.handler.call(i.controller,n,i.path),i.controller.onunload=0);r.clones(e).length=0,t&&mag.fill.removeNode(n)}};mag.mod.getState(e).onbeforeunload?mag.utils.callLCEvent("onbeforeunload",mag.mod.getState(e),n,e,0,function(){i()}):i()}.bind({},e),r.getId=function(e){return e}.bind({},e),r.draw=function(e,t,n){mag.redraw(e,t,n)}.bind({},t,e),r.getState=function(e,t){return mag.mod.getState(t||e)}.bind({},e),r.getProps=function(e,t){return mag.mod.getProps(t||e)}.bind({},e),r.subscribe=f.bind({},e),r},v=function(e,t){var n=function(e,t){i(t)?mag.redraw(i(t),e):mag.utils.items.isItem(t)&&mag.clear(e)}.bind({},e,t);mag.mod.setFrameId(e,n)};mag.clear=function(e){cancelAnimationFrame(l[e]),mag.utils.items.removeItem(e),mag.mod.clear(e),mag.fill.clearCache(mag.mod.getId(e))};var p=function(e,t,r){return function(e,t,r){if(i(e.id,1),a(e.id,t)&&e){var o=mag.mod.getState(t);if(!mag.utils.callLCEvent("isupdate",o,e,t)){if(mag.mod.iscached(t)&&!r)e=0;else{if(!mag.utils.callLCEvent("willupdate",o,e,t)){mag.mod.callView(e,t),mag.fill.setId(e.id),mag.fill.run(e,o);var u,l=e.id,d=mag.fill.configs;for(u in d)u.startsWith('id("'+l+'")/')&&d[u]();mag.utils.callLCEvent("didupdate",o,e,t),r||mag.mod.iscached(t)}e=n}return e}}}.bind({},e,t,r)};mag.getNode=i}(window||global||this,document),function(e){function t(t,n){var i=t.name;if(void 0===t.object[t.name]){var r,o=e.fill.find(n,i),i="$"===i[0],a=[];return o.reverse().forEach(function(e){e&&(e.value&&0<e.value.length?(r=e.value,!e.type||"checkbox"!=e.type&&"radio"!=e.type||(r={_value:r},e.checked&&(r._checked=!0),a.push(r))):e.innerText&&0<e.innerText.length?r=e.innerText:e.innerHTML&&0<e.innerHTML.length?r=e.innerHTML:e.value||"INPUT"!=e.tagName||(r=""))}),0<a.length&&i?a:r}}function n(t,n){var i;return"undefined"!=typeof Proxy?(r.setProps(n,e.proxy(r.getProps(n),u.bind({},"props",n))),i=new t(e.proxy({},u.bind({},"state",n)))):i=new t({}),i}var i=[],r={innerMods:[],cache:[],getState:function(e){return i[e][1]},setState:function(e,t){i[e][1]=t},getView:function(e){return i[e][0]},getProps:function(e){return i[e][2]},setProps:function(e,t){return i[e][2]=t},remove:function(e){i.splice(e,1)},getId:function(e){return i[e]&&i[e][3]},exists:function(e){return void 0!==i[e]?!0:!1},setFrameId:function(e,t){i[e][4]=t},getFrameId:function(e){return i[e][4]},submodule:function(t,o,a,u){return i[o]?(u.key&&u.key===r.getProps(o).key?r.setProps(o,e.utils.copy(e.utils.merge(r.getProps(o),u))):r.setProps(o,u),i[o]):(i[o]=[0,0,0,0,0],r.setProps(o,u),u=function(e,t,n){a.view&&a.view.call(a,t,r.getProps(e),n)}.bind({},o),i[o][0]=u,i[o][3]=t,i[o][1]=n(function(e){return(a.controller||function(){}).call(e,r.getProps(o))||e},o,t),i[o])}},o=[],a=[],u=function(n,i,u){var d=JSON.stringify(u.object),c=String(u.name);if(d!==a[i+c]){if(a[i+c]=d,"get"!=u.type||"props"==n||~e.fill.ignorekeys.indexOf(String(u.name))||void 0!==u.oldValue||0!==Object.keys(u.object).length)"set"==u.type&&"props"!=n&&u.object[u.name]&&u.object[u.name].draw&&"function"==typeof u.object[u.name].draw&&(r.innerMods[r.getId(i)]=[u.name,u.object[u.name]]);else if(n=t(u,e.doc.getElementById(r.getId(i))),void 0!==n)return l[i]=0,n;n=r.getFrameId(i),"function"==typeof n&&"set"==u.type&&(cancelAnimationFrame(o[i]),o[i]=requestAnimationFrame(n))}};r.iscached=function(t){var n=e.utils.merge(e.utils.copy(r.getProps(t)),r.getState(t));return r.cache[t]&&r.cache[t]===JSON.stringify(n)?!0:void(r.cache[t]=JSON.stringify(n))},r.clear=function(e){e>-1&&r.cache[e]&&r.cache.splice(e,1)};var l=[];r.callView=function(t,n){var i=r.getView(n);l[n]||(e.props.attachToArgs(n,r.getState(n),t),l[n]=1),i(r.getState(n),t)},e.mod=r}(mag),function(e){function t(e){for(var t in e)if(e[t]&&-1!==["INPUT","SELECT","TEXTAREA"].indexOf(e[t].tagName))return e[t];return!1}var n={},i=function(t,n){for(var i=1;i<t.length;i+=2){var r=t[i+1];n=e.fill.find(n,t[i]),n=n[r]}return n},r=function(n,r,o,a){return o=(""+o).split("."),3>o.length?(o=parseInt(o.pop()),o=isNaN(o)?0:o,r=e.fill.find(a[o]?a[o]:a,r)):(a=i(o,a),r=e.fill.find(a,r)),(r=t(r))&&!r.eventOnFocus&&(o=-1<["radio","checkbox"].indexOf(r.type),a=function(t,i){this.__magnum__=this.__magnum__||{},this.__magnum__.dirty||(this.__magnum__.dirty=1),i&&(n._checked=this.checked,e.redraw(t,e.utils.items.getItem(t.id),1))}.bind(r,a,o),o?r.addEventListener("click",a,!1):r.addEventListener("focus",a,!1),r.eventOnFocus=1),r},o=function(n,i,o,a){var u=o[i];"_value"===i&&(i=n.split(".").pop());var l=e.fill.find(a,i),l=t(l);if("function"!=typeof u&&l){var d=r.bind({},o,i,n,a);d(),Object.defineProperty(o,i,{configurable:!0,get:function(){var t=d();return t&&"undefined"!==t.value&&t.__magnum__&&t.__magnum__.dirty&&t.value!==u?(u=t.value,e.redraw(a,n,1),t.value):u},set:function(e){var t=d();t&&"undefined"!==t.value&&t.value!==e&&e!==u&&(t.value=e,u=e)}})}},a=function(e,t,n){for(var i in t){var r=t[i];"object"==typeof r?a(e+"."+i,r,n):o.bind({},e,i,t,n)()}};n.attachToArgs=a,e.props=n}(mag),function(e){var t={callHook:function(e,t,n,i,r,o){e[n][i].key==t&&(o={v:r.value,k:r.key},r.change=!1,e[n][i].handler.call(e[n][i].context,r),o!=={v:r.value,k:r.key}&&(r.change=!0))}},n=[];t.onLCEvent=function(e,t,i){n[e+"-"+t]=i},t.callLCEvent=function(t,i,r,o,a,u){var l=!1,d={preventDefault:function(){l=!0}};return i&&i[t]&&(i[t].call(i,d,r,e.mod.getProps(o),o,u),a&&(i[t]=0)),n[t+"-"+o]&&n[t+"-"+o](e.mod.getState(o),e.mod.getProps(o)),l},t.copy=function(e){return Object.assign({},e)},t.merge=function(){return Object.assign.apply({},arguments)};var i={i:[],isItem:function(e){return-1<i.i.indexOf(e)},setItem:function(e){i.i[i.i.length]=e},getItem:function(e){return i.i.indexOf(e)},getItemVal:function(e){return i.i[e]},removeItem:function(e){i.i.splice(i.i.indexOf(e),1)}};t.items=i,t.getItemInstanceIdAll=function(){return i.i},t.getItemInstanceId=function(e){return i.isItem(e)?i.getItem(e):(i.setItem(e),i.getItem(e))},e.utils=t}(mag),function(e,t,n){function i(e){return Array.isArray&&Array.isArray(e)||"[object Array]"==={}.toString.call(e)}function r(e,t){return e[N]=e[N]||{},(!e[N].uid||t)&&(e[N].uid=performance.now()),e[N].uid}function o(e,t){var n=r(e,t);if(O[n])n=O[n];else{var i,o=O,a="";i=u(e);var l=e.parentNode&&[].indexOf.call(e.parentNode.children,e);i&&(a+='id("'+i.id+'")'),i=a+("/"+e.tagName+"["+(l+1)+"]"),n=o[n]=i}return n}function a(e,t,i){return e=r(e,i),S[x.id]=S[x.id]||[],S[x.id][e]&&S[x.id][e]==t?1:(S[x.id][e]=t,n)}function u(e){return e.id?e:e.parentNode?u(e.parentNode):n}function l(t){if(t.id)return'id("'+t.id+'")';if(t===e.doc.body)return t.tagName;var n=0;if(t.parentNode)for(var i=t.parentNode.childNodes,r=0;r<i.length;r++){var o=i[r];if(o===t)return l(t.parentNode)+(t.tagName?"/"+t.tagName+"["+(n+1)+"]":"");1===o.nodeType&&o.tagName===t.tagName&&n++}}function d(t){var n=l(t);t.parentNode.removeChild(t),t&&C[n+"-config"]&&C[n+"-config"].configContext&&typeof C[n+"-config"].configContext.onunload===w&&(C[n+"-config"].configContext.onunload(C[n+"-config"].configContext,t,n),delete C[n+"-config"],delete e.fill.configs[n])}function c(e){return(e=e&&parseInt(e.split("[").pop().slice(0,-1)))?parseInt(e)-1:0}function f(e){return e&&e[N]&&e[N].isChildOfArray?e:e.parentNode?f(e.parentNode):n}function g(t,n,i){if(!a(t,n.outerHTML,i)&&!e.doc.getElementById(n.id)){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(n)}}function m(t,r,o){var a,u=c(o);if(r&&r.nodeType==_)return g(t,r),n;if("function"==typeof r){var l=(a=f(t.parentNode))&&a.getAttribute("key");return a&&l&&(u=+l.split(N)[1]),(l=r(u))&&l.nodeType&&l.nodeType==_?(g(t,l),t[N]=t[N]||{},t[N].isChildOfArray=!0,t[N].dataPass={index:u},r.draw(),n):(r=/<[a-z][\s\S]*>/i.test(l)?"_html":"_text",u={},u[r]=l,m(t,u,o))}if("object"!=typeof r)return m(t,{_text:r},o);e.mod.innerMods[x.id]&&r[e.mod.innerMods[x.id][0]]&&!r[e.mod.innerMods[x.id][0]].draw&&e.mod.innerMods[x.id][1].destroy();for(l in r)u=r[l],u===n?u="":null===u&&-1===["onunload"].indexOf(l)?(t[N].detached=t[N].detached||[],t[N].detached[l]=1,v(t,l)):t[N].detached&&t[N].detached[l]&&(s(t,l),t[N].detached[l]=0),"_"===l[0]&&(a=a||{},a[l.substr(1)]=u);a&&y(t,a,o);for(l in r)if(u=r[l],!~x.ignorekeys.indexOf(l)&&"_"!==l[0]){a=k(t,l);var d={key:l,value:u,node:t};e.hook("values","*",d),d.change&&(u=d.value),i(u)&&(a=k(t,"$"+l)),x.run(a,u,o+"/"+l)}}function s(e,t){k(e,t).forEach(function(e){var t=r(e);if(L[t]){for(var n in L[t])e.appendChild(L[t][n]);delete L[t]}})}function v(t,n){var i=0,o=1,a=function(e){if(++i===o)for(;e.lastChild;)d(e.lastChild)},u=function(t,n){var i;t.id&&e.utils.items.isItem(t.id)&&(i=e.utils.items.getItem(t.id)),i&&e.mod.getState(i).onbeforeunload?(o++,e.utils.callLCEvent("onbeforeunload",e.mod.getState(i),t,i,0,function(){i&&e.utils.callLCEvent("onunload",e.mod.getState(i),t,i),n()})):(i&&e.utils.callLCEvent("onunload",e.mod.getState(i),t,i),n())};k(t,n).forEach(function(e){var t=r(e);e.children.length&&(L[t]=p(e.children));for(var n in L[t])u(L[t][n],function(){a(e)});a(e)})}function p(e){var t;if(null==e.length&&(e=[e]),!i(e)){t=[];for(var n=0;n<e.length;n+=1)e[n]&&t.push(e[n]);e=t}return e}function h(t,n,i){return function(t,n,i){var r=f(n),a=r&&l(r),u=c(a),d=o(n),g=c(d),r={path:a,data:((r||{})[N]||[]).dataPass,node:r,index:u},d=d&&-1<d.indexOf("id(")&&d.split('id("')[1].split('")')[0],a=e.doc.getElementById(d);return t=t.call(n,i,g,n,r),e.redraw(a,e.utils.items.getItem(d)),t}.bind({},n[i],t)}function y(n,i,o){var a=c(o);C[r(n)]=C[r(n)]||[];for(var u in i)if("text"!==u&&"html"!==u)if(0==u.indexOf("on"))n[u.toLowerCase()]=h(n,i,u);else if("config"==u){o=l(n);var a=c(o),d=!0;C[o+"-config"]?d=!1:C[o+"-config"]={};var f=C[o+"-config"].configContext=C[o+"-config"].configContext||{};t[o]=function(e,t){return function(){return e.apply(e,t)}}(i[u],[n,d,f,a])}else o={key:u,value:i[u],node:n},e.hook("attributes",u,o),o.change&&(u=o.key,i[u]=o.value),C[r(n)]&&C[r(n)][u]==i[u]||(null===i[u]?n.removeAttribute(u):u in n?n[u]=i[u]:n.setAttribute(u,""+i[u]),C[r(n)][u]=i[u]);b(n,i.text),I(n,i.html)}function b(e,t){e&&null!=t&&!a(e,t)&&("INPUT"===e.nodeName?e.value=""+t:e.firstChild?e.firstChild.textContent=""+t:e.appendChild(e.ownerDocument.createTextNode(""+t)),"SELECT"===e.nodeName&&(e.value=""+t))}function I(e,t){e&&null!=t&&!a(e,t)&&(e.innerHTML=t)}function k(t,n,i){var r=[];if(t){var o=t.childNodes;if(o)for(var a=0;a<o.length;a+=1)o[a].nodeType===_&&r.push(o[a])}var o=[],a=n,u="$"===n[0];"$"===a[0]&&(a=a.substr(1));for(var l=0;l<r.length;l+=1){var d=r[l],c=a,f=" "+d.className+" ";(d.id===c||-1<f.indexOf(" "+c+" ")||d.name===c||d.nodeName.toLowerCase()===c.toLowerCase()||d.getAttribute("data-bind")===c)&&o.push(r[l])}if(!o.length||u)for(l=0;l<r.length&&(o=o.concat(k(r[l],n,!0)),!o.length||u);l++);return i||o.length||(t={key:n,value:o,node:t},e.hook("elementMatcher",n,t),t.change&&(o=t.value)),o}var x={cached:[],ignorekeys:"willgetprops onbeforeunload Symbol(Symbol.toStringTag) nodeType toJSON onunload onreload willupdate didupdate didload willload isupdate".split(" ")},_=1,C=x.cached,N="__magnum__",w="function",O=[],S=[],E={};x.run=function(e,t,r){var a,u,l;if(e){null==t&&(t={_text:""});var c=p(e);if(l=i(t)){if(E[r]&&0===c.length&&(E[r].parent.insertAdjacentHTML("beforeend",E[r].node),c=p(E[r].parent.children)),0===c.length)return;for(u=c[0].parentNode,E[r]||(E[r]={node:c[0].cloneNode(1).outerHTML,parent:u});c.length<t.length;)E[r]?(u.insertAdjacentHTML("beforeend",E[r].node),a=u.lastChild):a=c[0].cloneNode(1),c.push(a),u&&u.appendChild(a);if(c.map(function(e){return e.__key}),r=t.map(function(e){return e&&e._key}),(c.length==t.length||-1!==r.indexOf(n))&&(t=t.map(function(e,t){if("object"==typeof e){if(c[t].__key&&void 0===e._key)return e._key=c[t].__key,e;void 0===e._key&&(e._key=N+t),c[t].__key=e._key}return e})),c.length>t.length)if(0===t.length||"object"!=typeof t[0])for(;c.length>t.length;)a=c.pop(),(u=a.parentNode)&&d(a);else var f=[],g=t.map(function(e){return e._key}),c=(c.map(function(e){return e.__key}),c.filter(function(e){return-1===g.indexOf(e.__key)||-1!==f.indexOf(e.__key)?(f.push(e.__key),d(e),!1):(f.push(e.__key),!0)}))}for(r=0;r<c.length;r++)l?c[r]&&x.run(c[r],t[r]):(t&&"object"==typeof t&&-1!==Object.keys(t).indexOf("_key")&&(c[r][N]=c[r][N]||{},c[r][N].isChildOfArray=!0,c[r][N].dataPass=t),a=o(c[r]),m(c[r],t,a));return e}};var L=[];x.removeNode=d,x.configs=t,x.find=k,x.setId=function(e){x.id=e},x.clearCache=function(e){S[e]&&delete S[e]},e.fill=x}(mag,[]),function(e,t){function n(t,n){var i=[];return new Proxy(t,{get:function(t,r){var o=t[r],a=n({type:"get",object:e.utils.copy(t[r]),name:r,oldValue:i[r]});return void 0!==a&&(o=t[r]=a),o},deleteProperty:function(e,t){return n({type:"delete",name:t,object:e,oldValue:i[t]}),delete e[t]},set:function(t,r,o){return i[r]===o?!0:(JSON.stringify(o)!==JSON.stringify(t[r])&&(i[r]=e.utils.copy(t[r])),n({type:"set",name:r,object:t,oldValue:i[r]}),t[r]=o,!0)}})}function i(e,t){for(var i in e)Array.isArray(e[i])&&101>e[i].length&&(e[i]=n(e[i],t));return n(e,t)}e.proxy=function(n,r){return n&&t.Proxy?i(n,function(t){return"object"==typeof t.object[t.name]&&(t.object[t.name]=e.proxy(t.object[t.name],r)),r(t)}):void 0}}(mag,window||global||this);<commit_msg>Update mag.0.24.1.min.js<commit_after>/*
Mag.JS v0.24.1
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
!function(e,t,n){function i(e,t){if(o[e]&&!t)return o[e];var n=mag.doc.getElementById(e);return n&&(o[e]=n),o[e]}e.mag={},mag.doc=t;var r={values:[],attributes:[],elementMatcher:[]},o=[];mag.create=function(e,t,n){return function(i,r){return"string"!=typeof i&&(r=i,i=0),mag.module(i||e,t,mag.utils.merge(n||{},r||{}))}},mag.module=function(e,t,n){n=n||{},e instanceof HTMLElement&&(e.id||(e.id=performance.now()),o[e.id]=e,e=e.id);var r;if(!(r=!mag.utils.items.isItem(e))){r=mag.utils.items.getItem(e);var a=i(e);r=!mag.utils.callLCEvent("onreload",mag.mod.getState(r),a,r)}return r&&(r=n.key&&mag.utils.items.isItem(e+"."+n.key)?mag.utils.items.getItem(e+"."+n.key):mag.utils.getItemInstanceId(n.key?e+"."+n.key:e),n.retain||mag.mod.clear(r),mag.mod.submodule(e,r,t,n),a=i(e),v(r,e),!mag.utils.callLCEvent("willload",mag.mod.getState(r),a,r,1))?(mag.redraw(a,r,1),mag.utils.callLCEvent("didload",mag.mod.getState(r),a,r,1),s(r,a,t,mag.utils.copy(n))):void 0};var a=function(e,t){return 0>t||t!=mag.utils.items.getItem(e)?e==mag.mod.getId(t)?!0:!1:!0},u=[];mag.begin=function(e){n===u[e]?u[e]=1:u[e]++},mag.end=function(e){if(1<u[e])u[e]--;else{u[e]=0;var t=mag.utils.items.getItemVal(e);mag.redraw(i(t),e)}};var d=[];mag.redraw=function(e,t,i){if(!u[t]){if(!e||n===t)throw Error("Mag.JS - Id or node invalid: "+mag.utils.items.getItemVal(t));a(e.id,t)&&(i&&mag.fill.configs.splice(0,mag.fill.configs.length),i&&mag.mod.clear(t),e=p(e,t,i),cancelAnimationFrame(d[t]),d[t]=requestAnimationFrame(e))}},mag.hookin=function(e,t,n){r[e].push({context:{},handler:n,key:t})},mag.hook=function(e,t,n){for(var i=0,o=r[e].length;o>i;i++)mag.utils.callHook(r,t,e,i,n)};var l={},c=[],f=function(e,t){mag.utils.onLCEvent("didupdate",e,function(n,r){var o=mag.utils.merge(mag.utils.copy(r),mag.utils.copy(n));JSON.stringify(o)!==JSON.stringify(c[e])&&(t(n,r,i(mag.mod.getId(e)),c[e]),c[e]=o)})},g=[],m=function(e,t,n,i,r){t=mag.utils.items.getItem(t),mag.mod.submodule(e.id,t,i,n),mag.utils.callLCEvent("willgetprops",mag.mod.getState(t),e,t,0,n)||(v(t,e.id),mag.redraw(e,t,r))},s=function(e,t,n,i){g[e]=g[e]||[];var r=function(e,t,n,i,r){if("object"==typeof r&&(i=mag.utils.merge(mag.utils.copy(i)||{},r),r=0),r=t.id+(i.key?"."+i.key:"")+"."+(r||0),t=l[r]=l[r]||t.cloneNode(1),t.id=r,mag.utils.items.isItem(r))return m(t,r,i,n,1),t;var o=mag.utils.getItemInstanceId(t.id);return g[e].push({instanceId:o,subscribe:f.bind({},o)}),m(t,r,i,n,1),t}.bind({},e,t,n,i);return r.clones=function(e){return g[e]}.bind({},e),r.destroy=function(e,t){var n=mag.getNode(mag.mod.getId(e)),i=function(){if(!mag.utils.callLCEvent("onunload",mag.mod.getState(e),n,e)){mag.clear(e);var i,o=0;i=n.id;var a,u=[];for(a in mag.fill.cached)-1<a.indexOf('id("'+i+'")/')&&-1<a.indexOf("-config")&&mag.fill.cached[a].configContext&&u.push({path:a.split("-config")[0],controller:mag.fill.cached[a].configContext,handler:mag.fill.cached[a].configContext.onunload});for(;i=u&&u[o];o++)i.controller.onunload&&(i.handler.call(i.controller,n,i.path),i.controller.onunload=0);r.clones(e).length=0,t&&mag.fill.removeNode(n)}};mag.mod.getState(e).onbeforeunload?mag.utils.callLCEvent("onbeforeunload",mag.mod.getState(e),n,e,0,function(){i()}):i()}.bind({},e),r.getId=function(e){return e}.bind({},e),r.draw=function(e,t,n){mag.redraw(e,t,n)}.bind({},t,e),r.getState=function(e,t){return mag.mod.getState(t||e)}.bind({},e),r.getProps=function(e,t){return mag.mod.getProps(t||e)}.bind({},e),r.subscribe=f.bind({},e),r},v=function(e,t){var n=function(e,t){i(t)?mag.redraw(i(t),e):mag.utils.items.isItem(t)&&mag.clear(e)}.bind({},e,t);mag.mod.setFrameId(e,n)};mag.clear=function(e){cancelAnimationFrame(d[e]),mag.utils.items.removeItem(e),mag.mod.clear(e),mag.fill.clearCache(mag.mod.getId(e))};var p=function(e,t,r){return function(e,t,r){if(i(e.id,1),a(e.id,t)&&e){var o=mag.mod.getState(t);if(!mag.utils.callLCEvent("isupdate",o,e,t)){if(mag.mod.iscached(t)&&!r)e=0;else{if(!mag.utils.callLCEvent("willupdate",o,e,t)){mag.mod.callView(e,t),mag.fill.setId(e.id),mag.fill.run(e,o);var u,d=e.id,l=mag.fill.configs;for(u in l)u.startsWith('id("'+d+'")/')&&l[u]();mag.utils.callLCEvent("didupdate",o,e,t),r||mag.mod.iscached(t)}e=n}return e}}}.bind({},e,t,r)};mag.getNode=i}(window||global||this,document),function(e){function t(t,n){var i=t.name;if(void 0===t.object[t.name]){var r,o=e.fill.find(n,i),i="$"===i[0],a=[];return o.reverse().forEach(function(e){e&&(e.value&&0<e.value.length?(r=e.value,!e.type||"checkbox"!=e.type&&"radio"!=e.type||(r={_value:r},e.checked&&(r._checked=!0),a.push(r))):e.innerText&&0<e.innerText.length?r=e.innerText:e.innerHTML&&0<e.innerHTML.length?r=e.innerHTML:e.value||"INPUT"!=e.tagName||(r=""))}),0<a.length&&i?a:r}}function n(t,n){var i;return"undefined"!=typeof Proxy?(r.setProps(n,e.proxy(r.getProps(n),u.bind({},"props",n))),i=new t(e.proxy({},u.bind({},"state",n)))):i=new t({}),i}var i=[],r={innerMods:[],cache:[],getState:function(e){return i[e][1]},setState:function(e,t){i[e][1]=t},getView:function(e){return i[e][0]},getProps:function(e){return i[e][2]},setProps:function(e,t){return i[e][2]=t},remove:function(e){i.splice(e,1)},getId:function(e){return i[e]&&i[e][3]},exists:function(e){return void 0!==i[e]?!0:!1},setFrameId:function(e,t){i[e][4]=t},getFrameId:function(e){return i[e][4]},submodule:function(t,o,a,u){return i[o]?(u.key&&u.key===r.getProps(o).key?r.setProps(o,e.utils.copy(e.utils.merge(r.getProps(o),u))):r.setProps(o,u),i[o]):(i[o]=[0,0,0,0,0],r.setProps(o,u),u=function(e,t,n){a.view&&a.view.call(a,t,r.getProps(e),n)}.bind({},o),i[o][0]=u,i[o][3]=t,i[o][1]=n(function(e){return(a.controller||function(){}).call(e,r.getProps(o))||e},o,t),i[o])}},o=[],a=[],u=function(n,i,u){var l=JSON.stringify(u.object),c=u.name+"";if(l!==a[i+c]){if(a[i+c]=l,"get"!=u.type||"props"==n||~e.fill.ignorekeys.indexOf(""+u.name)||void 0!==u.oldValue||0!==Object.keys(u.object).length)"set"==u.type&&"props"!=n&&u.object[u.name]&&u.object[u.name].draw&&"function"==typeof u.object[u.name].draw&&(r.innerMods[r.getId(i)]=[u.name,u.object[u.name]]);else if(n=t(u,e.doc.getElementById(r.getId(i))),void 0!==n)return d[i]=0,n;n=r.getFrameId(i),"function"==typeof n&&"set"==u.type&&(cancelAnimationFrame(o[i]),o[i]=requestAnimationFrame(n))}};r.iscached=function(t){var n=e.utils.merge(e.utils.copy(r.getProps(t)),r.getState(t));return r.cache[t]&&r.cache[t]===JSON.stringify(n)?!0:void(r.cache[t]=JSON.stringify(n))},r.clear=function(e){e>-1&&r.cache[e]&&r.cache.splice(e,1)};var d=[];r.callView=function(t,n){var i=r.getView(n);d[n]||(e.props.attachToArgs(n,r.getState(n),t),d[n]=1),i(r.getState(n),t)},e.mod=r}(mag),function(e){function t(e){for(var t in e)if(e[t]&&-1!==["INPUT","SELECT","TEXTAREA"].indexOf(e[t].tagName))return e[t];return!1}var n={},i=function(t,n){for(var i=1;i<t.length;i+=2){var r=t[i+1];n=e.fill.find(n,t[i]),n=n[r]}return n},r=function(n,r,o,a){return o=(""+o).split("."),3>o.length?(o=parseInt(o.pop()),o=isNaN(o)?0:o,r=e.fill.find(a[o]?a[o]:a,r)):(a=i(o,a),r=e.fill.find(a,r)),(r=t(r))&&!r.eventOnFocus&&(o=-1<["radio","checkbox"].indexOf(r.type),a=function(t,i){this.__magnum__=this.__magnum__||{},this.__magnum__.dirty||(this.__magnum__.dirty=1),i&&(n._checked=this.checked,e.redraw(t,e.utils.items.getItem(t.id),1))}.bind(r,a,o),o?r.addEventListener("click",a,!1):r.addEventListener("focus",a,!1),r.eventOnFocus=1),r},o=function(n,i,o,a){var u=o[i];"_value"===i&&(i=n.split(".").pop());var d=e.fill.find(a,i),d=t(d);if("function"!=typeof u&&d){var l=r.bind({},o,i,n,a);l(),Object.defineProperty(o,i,{configurable:!0,get:function(){var t=l();return t&&"undefined"!==t.value&&t.__magnum__&&t.__magnum__.dirty&&t.value!==u?(u=t.value,e.redraw(a,n,1),t.value):u},set:function(e){var t=l();t&&"undefined"!==t.value&&t.value!==e&&e!==u&&(t.value=e,u=e)}})}},a=function(e,t,n){for(var i in t){var r=t[i];"object"==typeof r?a(e+"."+i,r,n):o.bind({},e,i,t,n)()}};n.attachToArgs=a,e.props=n}(mag),function(e){var t={callHook:function(e,t,n,i,r,o){e[n][i].key==t&&(o={v:r.value,k:r.key},r.change=!1,e[n][i].handler.call(e[n][i].context,r),o!=={v:r.value,k:r.key}&&(r.change=!0))}},n=[];t.onLCEvent=function(e,t,i){n[e+"-"+t]=i},t.callLCEvent=function(t,i,r,o,a,u){var d=!1,l={preventDefault:function(){d=!0}};return i&&i[t]&&(i[t].call(i,l,r,e.mod.getProps(o),o,u),a&&(i[t]=0)),n[t+"-"+o]&&n[t+"-"+o](e.mod.getState(o),e.mod.getProps(o)),d},t.copy=function(e){return Object.assign({},e)},t.merge=function(){return Object.assign.apply({},arguments)};var i={i:[],isItem:function(e){return-1<i.i.indexOf(e)},setItem:function(e){i.i[i.i.length]=e},getItem:function(e){return i.i.indexOf(e)},getItemVal:function(e){return i.i[e]},removeItem:function(e){i.i.splice(i.i.indexOf(e),1)}};t.items=i,t.getItemInstanceIdAll=function(){return i.i},t.getItemInstanceId=function(e){return i.isItem(e)?i.getItem(e):(i.setItem(e),i.getItem(e))},e.utils=t}(mag),function(e,t,n){function i(e){return Array.isArray&&Array.isArray(e)||"[object Array]"==={}.toString.call(e)}function r(e,t){return e[N]=e[N]||{},(!e[N].uid||t)&&(e[N].uid=performance.now()),e[N].uid}function o(e,t){var n=r(e,t);if(S[n])n=S[n];else{var i,o=S,a="";i=u(e);var d=e.parentNode&&[].indexOf.call(e.parentNode.children,e);i&&(a+='id("'+i.id+'")'),i=a+("/"+e.tagName+"["+(d+1)+"]"),n=o[n]=i}return n}function a(e,t,i){return e=r(e,i),O[x.id]=O[x.id]||[],O[x.id][e]&&O[x.id][e]==t?1:(O[x.id][e]=t,n)}function u(e){return e.id?e:e.parentNode?u(e.parentNode):n}function d(t){if(t.id)return'id("'+t.id+'")';if(t===e.doc.body)return t.tagName;var n=0;if(t.parentNode)for(var i=t.parentNode.childNodes,r=0;r<i.length;r++){var o=i[r];if(o===t)return d(t.parentNode)+(t.tagName?"/"+t.tagName+"["+(n+1)+"]":"");1===o.nodeType&&o.tagName===t.tagName&&n++}}function l(t){var n=d(t);t.parentNode.removeChild(t),t&&C[n+"-config"]&&C[n+"-config"].configContext&&typeof C[n+"-config"].configContext.onunload===w&&(C[n+"-config"].configContext.onunload(C[n+"-config"].configContext,t,n),delete C[n+"-config"],delete e.fill.configs[n])}function c(e){return(e=e&&parseInt(e.split("[").pop().slice(0,-1)))?parseInt(e)-1:0}function f(e){return e&&e[N]&&e[N].isChildOfArray?e:e.parentNode?f(e.parentNode):n}function g(t,n,i){if(!a(t,n.outerHTML,i)&&!e.doc.getElementById(n.id)){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(n)}}function m(t,r,o){var a,u=c(o);if(r&&r.nodeType==_)return g(t,r),n;if("function"==typeof r){var d=(a=f(t.parentNode))&&a.getAttribute("key");return a&&d&&(u=+d.split(N)[1]),(d=r(u))&&d.nodeType&&d.nodeType==_?(g(t,d),t[N]=t[N]||{},t[N].isChildOfArray=!0,t[N].dataPass={index:u},r.draw(),n):(r=/<[a-z][\s\S]*>/i.test(d)?"_html":"_text",u={},u[r]=d,m(t,u,o))}if("object"!=typeof r)return m(t,{_text:r},o);e.mod.innerMods[x.id]&&r[e.mod.innerMods[x.id][0]]&&!r[e.mod.innerMods[x.id][0]].draw&&e.mod.innerMods[x.id][1].destroy();for(d in r)u=r[d],u===n?u="":null===u&&-1===["onunload"].indexOf(d)?(t[N].detached=t[N].detached||[],t[N].detached[d]=1,v(t,d)):t[N].detached&&t[N].detached[d]&&(s(t,d),t[N].detached[d]=0),"_"===d[0]&&(a=a||{},a[d.substr(1)]=u);a&&y(t,a,o);for(d in r)if(u=r[d],!~x.ignorekeys.indexOf(d)&&"_"!==d[0]){a=k(t,d);var l={key:d,value:u,node:t};e.hook("values","*",l),l.change&&(u=l.value),i(u)&&(a=k(t,"$"+d)),x.run(a,u,o+"/"+d)}}function s(e,t){k(e,t).forEach(function(e){var t=r(e);if(L[t]){for(var n in L[t])e.appendChild(L[t][n]);delete L[t]}})}function v(t,n){var i=0,o=1,a=function(e){if(++i===o)for(;e.lastChild;)l(e.lastChild)},u=function(t,n){var i;t.id&&e.utils.items.isItem(t.id)&&(i=e.utils.items.getItem(t.id)),i&&e.mod.getState(i).onbeforeunload?(o++,e.utils.callLCEvent("onbeforeunload",e.mod.getState(i),t,i,0,function(){i&&e.utils.callLCEvent("onunload",e.mod.getState(i),t,i),n()})):(i&&e.utils.callLCEvent("onunload",e.mod.getState(i),t,i),n())};k(t,n).forEach(function(e){var t=r(e);e.children.length&&(L[t]=p(e.children));for(var n in L[t])u(L[t][n],function(){a(e)});a(e)})}function p(e){var t;if(null==e.length&&(e=[e]),!i(e)){t=[];for(var n=0;n<e.length;n+=1)e[n]&&t.push(e[n]);e=t}return e}function h(t,n,i){return function(t,n,i){var r=f(n),a=r&&d(r),u=c(a),l=o(n),g=c(l),r={path:a,data:((r||{})[N]||[]).dataPass,node:r,index:u},l=l&&-1<l.indexOf("id(")&&l.split('id("')[1].split('")')[0],a=e.doc.getElementById(l);return t=t.call(n,i,g,n,r),e.redraw(a,e.utils.items.getItem(l)),t}.bind({},n[i],t)}function y(n,i,o){var a=c(o);C[r(n)]=C[r(n)]||[];for(var u in i)if("text"!==u&&"html"!==u)if(0==u.indexOf("on"))n[u.toLowerCase()]=h(n,i,u);else if("config"==u){o=d(n);var a=c(o),l=!0;C[o+"-config"]?l=!1:C[o+"-config"]={};var f=C[o+"-config"].configContext=C[o+"-config"].configContext||{};t[o]=function(e,t){return function(){return e.apply(e,t)}}(i[u],[n,l,f,a])}else o={key:u,value:i[u],node:n},e.hook("attributes",u,o),o.change&&(u=o.key,i[u]=o.value),C[r(n)]&&C[r(n)][u]==i[u]||(null===i[u]?n.removeAttribute(u):u in n?n[u]=i[u]:n.setAttribute(u,""+i[u]),C[r(n)][u]=i[u]);b(n,i.text),I(n,i.html)}function b(e,t){e&&null!=t&&!a(e,t)&&("INPUT"===e.nodeName?e.value=""+t:"SELECT"!==e.nodeName&&(e.firstChild?e.firstChild.textContent=""+t:e.appendChild(e.ownerDocument.createTextNode(""+t))),"SELECT"===e.nodeName&&(e.value=""+t))}function I(e,t){e&&null!=t&&!a(e,t)&&(e.innerHTML=t)}function k(t,n,i){var r=[];if(t){var o=t.childNodes;if(o)for(var a=0;a<o.length;a+=1)o[a].nodeType===_&&r.push(o[a])}var o=[],a=n,u="$"===n[0];"$"===a[0]&&(a=a.substr(1));for(var d=0;d<r.length;d+=1){var l=r[d],c=a,f=" "+l.className+" ";(l.id===c||-1<f.indexOf(" "+c+" ")||l.name===c||l.nodeName.toLowerCase()===c.toLowerCase()||l.getAttribute("data-bind")===c)&&o.push(r[d])}if(!o.length||u)for(d=0;d<r.length&&(o=o.concat(k(r[d],n,!0)),!o.length||u);d++);return i||o.length||(t={key:n,value:o,node:t},e.hook("elementMatcher",n,t),t.change&&(o=t.value)),o}var x={cached:[],ignorekeys:"willgetprops onbeforeunload Symbol(Symbol.toStringTag) nodeType toJSON onunload onreload willupdate didupdate didload willload isupdate".split(" ")},_=1,C=x.cached,N="__magnum__",w="function",S=[],O=[],E={};x.run=function(e,t,r){var a,u,d;if(e){null==t&&(t={_text:""});var c=p(e);if(d=i(t)){if(E[r]&&0===c.length&&(E[r].parent.insertAdjacentHTML("beforeend",E[r].node),c=p(E[r].parent.children)),0===c.length)return;for(u=c[0].parentNode,E[r]||(E[r]={node:c[0].cloneNode(1).outerHTML,parent:u});c.length<t.length;)E[r]?(u.insertAdjacentHTML("beforeend",E[r].node),a=u.lastChild):a=c[0].cloneNode(1),c.push(a),u&&u.appendChild(a);if(c.map(function(e){return e.__key}),r=t.map(function(e){return e&&e._key}),(c.length==t.length||-1!==r.indexOf(n))&&(t=t.map(function(e,t){if("object"==typeof e){if(c[t].__key&&void 0===e._key)return e._key=c[t].__key,e;void 0===e._key&&(e._key=N+t),c[t].__key=e._key}return e})),c.length>t.length)if(0===t.length||"object"!=typeof t[0])for(;c.length>t.length;)a=c.pop(),(u=a.parentNode)&&l(a);else var f=[],g=t.map(function(e){return e._key}),c=(c.map(function(e){return e.__key}),c.filter(function(e){return-1===g.indexOf(e.__key)||-1!==f.indexOf(e.__key)?(f.push(e.__key),l(e),!1):(f.push(e.__key),!0)}))}for(r=0;r<c.length;r++)d?c[r]&&x.run(c[r],t[r]):(t&&"object"==typeof t&&-1!==Object.keys(t).indexOf("_key")&&(c[r][N]=c[r][N]||{},c[r][N].isChildOfArray=!0,c[r][N].dataPass=t),a=o(c[r]),m(c[r],t,a));return e}};var L=[];x.removeNode=l,x.configs=t,x.find=k,x.setId=function(e){x.id=e},x.clearCache=function(e){O[e]&&delete O[e]},e.fill=x}(mag,[]),function(e,t){function n(t,n){var i=[];return new Proxy(t,{get:function(t,r){var o=t[r],a=n({type:"get",object:e.utils.copy(t[r]),name:r,oldValue:i[r]});return void 0!==a&&(o=t[r]=a),o},deleteProperty:function(e,t){return n({type:"delete",name:t,object:e,oldValue:i[t]}),delete e[t]},set:function(t,r,o){return i[r]===o?!0:(JSON.stringify(o)!==JSON.stringify(t[r])&&(i[r]=e.utils.copy(t[r])),n({type:"set",name:r,object:t,oldValue:i[r]}),t[r]=o,!0)}})}function i(e,t){for(var i in e)Array.isArray(e[i])&&101>e[i].length&&(e[i]=n(e[i],t));return n(e,t)}e.proxy=function(n,r){return n&&t.Proxy?i(n,function(t){return"object"==typeof t.object[t.name]&&(t.object[t.name]=e.proxy(t.object[t.name],r)),r(t)}):void 0}}(mag,window||global||this);
{'fraction_non_alphanumeric': 0.3417062195648154, 'fraction_numerical': 0.009924181717314923, 'mean_word_length': 14.450952380952382, 'pattern_counts': {'":': 6, '<': 45, '<?xml version=': 0, '>': 21, 'https://': 0, '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': '4474395', 'n_tokens_mistral': 15712, 'n_tokens_neox': 15816, 'n_words': 520}