<commit_before>/*
Mag.JS v0.27.9
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
(function(b,c){'use strict';function g(Q,R){return'function'==typeof R?''+R:R}function h(Q,R){if(w[Q]&&!R)return w[Q];var S=mag.doc.getElementById(Q);return S&&(w[Q]=S),w[Q]}var j='KEY',l=0,n=['#'+j,'.'+j,j],q=function(Q,R){var S;for(var T in n){var U=n[T].replace(j,R);if(S=Q.querySelector(U),S)break}return S},r=function(Q){var R=mag.utils.items.getItemVal(Q),S=mag.getNode(R);return S},t=function(Q){if('string'==typeof Q){var R=r(~mag.mod.runningViewInstance||mag.utils.runningEventInstance),S=q(R||mag.doc,Q);if(S)return S}return Q},u=function(Q,R,S){var T=[],U=Q.cloneNode(1),W=[],X=[],Y=function(Z){var $=Q;Z=Z||{};var _;Z.key&&(_=Z.key+'-'+Y.id);var aa=Z.key?Z.key+'-'+Y.id:Y.id;X[aa]||(X[aa]=mag.utils.copy(S)),'object'==typeof Z&&(Z=mag.utils.extend(X[aa],Z)),_&&!T[_]?$=T[_]=U.cloneNode(1):_&&T[_]&&($=T[_]),$[mag.MAGNUM]=$[mag.MAGNUM]||{},$[mag.MAGNUM].scid=aa,mag._cprops[aa]&&'object'==typeof Z&&(Z.children=mag._cprops[aa]);var ba;return W[aa]!=JSON.stringify(Z,g)&&(ba=R(Z),W[aa]=JSON.stringify(Z,g),mag.fill.run($,ba)),$};return Y.id=++l,Y};b.mag=function(Q,R,S){if(Q=t(Q),R=t(R),S=S||{},mag.utils.isHTMLEle(R)&&mag.utils.isHTMLEle(Q))R[mag.MAGNUM]||mag.fill.run(R,Q);else{if('function'==typeof R&&mag.utils.isHTMLEle(Q)){try{u(Q.cloneNode(1),R,S)()}catch(T){}return u(Q,R,S)}return I(-1,h(mag._isNode(Q)),R,S)}},mag.MAGNUM='__magnum__',mag.rafBounceIds=[],mag._cprops=[],mag.doc=c;var v={values:[],attributes:[],elementMatcher:[]},w=[],l=0;mag._isNode=function(Q){return mag.utils.isHTMLEle(Q)&&(!Q.id&&(Q.id=++l),w[Q.id]=Q,Q=Q.id),Q};var x=function(Q,R){var S,T=R?Q+'-'+R:Q;return S=mag.utils.items.isItem(T)?mag.utils.items.getItem(T):mag.utils.getItemInstanceId(T),S};mag.module=function(Q,R,S){S=S||{},Q=mag._isNode(Q);var T=x(Q,S.key),U=y(S,T,R,Q);return U?I(T,U,R,mag.utils.copy(S)):void 0};var y=function(Q,R,S,T){Q.retain||mag.mod.clear(R);var U=h(T);if(mag.mod.submodule(T,R,S,Q),J(R,T),!O(R,U))return mag.redraw(U,R,1).then(function(){P(R,U)}),U},z=function(Q,R){return 0>R||R!=mag.utils.items.getItem(Q)?Q==mag.mod.getId(R):!0},A=[];mag.begin=function(Q){'undefined'==typeof A[Q]?A[Q]=1:A[Q]++},mag.end=function(Q){if(1<A[Q])A[Q]--;else{A[Q]=0;var R=mag.utils.items.getItemVal(Q);mag.redraw(h(R),Q)}},mag.redraw=function(Q,R,S){if(!A[R]){if(!Q||'undefined'==typeof R)throw Error('Mag.JS - Id or node invalid: '+mag.utils.items.getItemVal(R));if(!z(Q.id,R))return{then:T=>T()};if(S&&mag.fill.configs.splice(0,mag.fill.configs.length),S&&mag.mod.clear(R),mag.mod.runningViewInstance==R)throw Error('Mag.JS - recursive call: '+R);return mag.utils.scheduleFlush(R,K(Q,R,S))}},mag.hookin=function(Q,R,S){v[Q].push({context:{},handler:S,key:R})},mag.hook=function(Q,R,S){for(var T=0,U=v[Q].length;T<U;T++)mag.utils.callHook(v,R,Q,T,S)};var B={},C=[],D=[],E=function(Q,R,S){var T=mag.getNode(mag.mod.getId(Q)),U=function(){mag.utils.callLCEvent('onunload',mag.mod.getState(Q),T,Q)||(mag.clear(Q),N(Q,T),R[Q]&&(R[Q].length=0),S&&(mag.fill.removeNode(T),mag.mod.remove(Q)))};mag.mod.getState(Q).onbeforeunload?mag.utils.callLCEvent('onbeforeunload',mag.mod.getState(Q),T,Q,0,function(){U()}):U()},F=function(Q,R){D[Q]=D[Q]||[];var S=D[Q].push(R);return mag.utils.onLCEvent('didupdate',Q,function(T,U){var V=mag.utils.merge(mag.utils.copy(U),mag.utils.copy(T));if(JSON.stringify(V)!==JSON.stringify(C[Q])){for(var W of D[Q])W(T,U,h(mag.mod.getId(Q)),C[Q]);C[Q]=V}}),function(){return D[Q].splice(S-1,1)}},G=[],H=function(Q,R,S,T,U){var V=mag.utils.items.getItem(R);(R=mag._isNode(Q),P(V,Q),!(mag.mod.exists(V)&&mag.utils.callLCEvent('willgetprops',mag.mod.getState(V),Q,V,0,S)))&&(mag.mod.submodule(Q.id,V,T,S),J(V,Q.id),O(V,Q)||mag.redraw(Q,V,U).then(function(){P(V,Q)}))},I=function(Q,R,S,T){G[Q]=G[Q]||[];var U=function(V,W,X,Y,Z){'object'==typeof Z&&(Y=mag.utils.merge(mag.utils.copy(Y),Z),Z=0);var $=W.id+(Y.key?'.'+Y.key:'')+'.'+(Z||0);!B[$]||Y.key||~U._id||($+=++l);var _=B[$]=B[$]||W.cloneNode(1);if(_.id=$,mag.utils.items.isItem($))return H(_,$,Y,X,1),_;var aa=mag.utils.getItemInstanceId(_.id);return 0>V?V=U._id=aa:G[V].push({instanceId:aa,subscribe:F.bind({},aa)}),H(_,$,Y,X,1),_}.bind({},Q,R,S,T);return U._id=Q,U.clones=function(){return G[U._id]},U.destroy=function(V){E(U._id,U.clones,V)},U.getId=function(){return U._id},U.rafBounce=function(V){return V?mag.rafBounceIds[U._id]=1:!1===V&&(mag.rafBounceIds[U._id]=0),!!mag.rafBounceIds[U._id]},U.draw=function(V){return mag.redraw(R,U._id,V)},U.getState=function(){return mag.mod.getState(U._id)},U.getProps=function(){return mag.mod.getProps(U._id)},U.subscribe=function(V){return F(U._id,V)},U},J=function(Q,R){var S=function(T,U){h(U)?mag.redraw(h(U),T):mag.utils.items.isItem(U)&&mag.clear(T)}.bind({},Q,R);mag.mod.setFrameId(Q,S)};mag.clear=function(Q){mag.utils.items.removeItem(Q),mag.mod.clear(Q),mag.fill.clearCache(mag.mod.getId(Q))};var K=function(Q,R,S){return function(T,U,V){if(h(T.id,1),z(T.id,U)&&T){var W=mag.mod.getState(U);return mag.utils.callLCEvent('isupdate',W,T,U)?void 0:mag.mod.iscached(U)&&!V?0:void(mag.utils.callLCEvent('willupdate',W,T,U)||(mag.mod.callView(T,U),mag.fill.setId(T.id),mag.fill.run(T,W),mag.fill.setId(0),L(T.id,mag.fill.configs),mag.utils.callLCEvent('didupdate',W,T,U),!V&&mag.mod.iscached(U)))}}.bind({},Q,R,S)},L=function(Q,R){for(var S in R)S.startsWith('id("'+Q+'")/')&&R[S]()},M=function(Q){var S=[];for(var T in mag.fill.cached)-1<T.indexOf('id("'+Q+'")/')&&-1<T.indexOf('-config')&&mag.fill.cached[T].configContext&&S.push({path:T.split('-config')[0],controller:mag.fill.cached[T].configContext,handler:mag.fill.cached[T].configContext.onunload});return S},N=function(Q,R){for(var U,S=M(R.id,Q),T=0,V=S;U=V&&V[T];T++)U.controller.onunload&&(U.handler.call(U.controller,R,U.path),U.controller.onunload=0)},O=function(Q,R){return mag.utils.callLCEvent('willload',mag.mod.getState(Q),R,Q,1)},P=function(Q,R){var S=mag.utils.items.getItemVal(Q);if(h(S)&&mag.mod.exists(Q))return mag.utils.callLCEvent('didload',mag.mod.getState(Q),R,Q,1)};mag.getNode=h})(window||global||this,document),function(b){'use strict';function c(u,v){var w=u.name;if('undefined'==typeof u.object[u.name]&&'_'!==w[0]){var x=b.fill.find(v,w),y='$'===w[0],z=[];return x.length?(x.forEach(function(E){var F;if(!(E&&E.type&&!~['submit','button'].indexOf(E.type)))'undefined'==typeof u.oldValue&&'undefined'==typeof u.object[u.name]&&E&&!~['submit','button'].indexOf(E.type)&&1==E.childNodes.length&&E.childNodes[0].textContent.trim()&&(F={_text:E.childNodes[0].textContent.trim()});else if(E.value&&0<E.value.length)if('checkbox'!=E.type&&'radio'!=E.type)F={_value:E.value};else if(E.checked&&(F={},F._checked=!0),!y){var G=v.querySelectorAll('[name='+E.name+']');if(G.length)for(var H of G)H.checked&&(F?F._value=H.value:F={_value:H.value})}else F?F._value=E.value:F={_value:E.value};F?z.push(F):E&&!E.hasChildNodes()&&z.push(h)}),0===z.length?void 0:y?z:z[0]&&'undefined'!=typeof z[0]._value?z[0]._value:z[0]&&z[0]._text?z[0]._text:z[0]):h}if('_'==w[0]){var A=w.substr(1);if(v.length){var z=[];for(var B in v){var C=v[B],D=C[A];'undefined'==typeof D&&(D=C.getAttribute(A)),z.push(D)}return z}var D=v[A];return'undefined'==typeof D&&(D=v.getAttribute(A)),D}}function f(u,v){l.setProps(v,b.proxy(l.getProps(v),t.bind({},'props',v),'prop'));var x=new u(b.proxy({},t.bind({},'state',v)));return x}var g=[],h=b.MAGNUM,l={runningViewInstance:-1,innerMods:[],cache:[]};l.getState=function(u){return g[u][1]},l.setState=function(u,v){g[u][1]=v},l.getView=function(u){return g[u][0]},l.getProps=function(u){return g[u][2]},l.setProps=function(u,v){return g[u][2]=v},l.remove=function(u){g.splice(u,1)},l.getId=function(u){return g[u]&&g[u][3]},l.exists=function(u){return'undefined'!=typeof g[u]},l.setFrameId=function(u,v){g[u][4]=v},l.getFrameId=function(u){return g[u][4]},l.getMod=function(u){return g[u][5]};var n=(u,v)=>{for(var w in v=v||u,u){var x=u[w];'function'!=typeof x||~['controller','view'].indexOf(w)||(u[w]=x.bind(v))}return u};l.submodule=function(u,v,w,x){if(g[v])return x.key&&x.key==l.getProps(v).key?l.setProps(v,b.utils.copy(b.utils.merge(l.getProps(v),x))):l.setProps(v,x),g[v];w=b.utils.copy(w),n(w,w),g[v]=[0,0,0,0,0,0],l.setProps(v,x);var z=function(B,C,D){w.element=D,w.state=C,w.props=l.getProps(B),w.view&&w.view.call(w,C,w.props,D)}.bind({},v),A={controller:function(B){return w.props=l.getProps(v),w.state=B,w.element=b.getNode(u),(w.controller||function(){}).call(B,w.props)||B},view:z};return g[v][0]=A.view,g[v][3]=u,g[v][1]=f(A.controller,v,u),g[v][5]=w,g[v]};var q=[],r=function(u,v){var w=u,x=v.split('/');for(var y of x)if(y){var z=b.fill.find(w,y);z.length&&(w=z)}return w},t=function(u,v,w){if('get'==w.type&&'props'!=u&&!~b.fill.ignorekeys.indexOf(w.name.toString())&&'undefined'==typeof w.oldValue){var x=b.getNode(l.getId(v));if(w.path&&'/'==w.path[0])var y=r(x,w.path);y&&'$'!=w.path.split('/').pop()[0]&&(y=y[0]);var z=c(w,y?y:x);if(null!=z&&'undefined'!=typeof z&&'object'==typeof z&&w.object&&b.utils.merge(z,w.object[w.name]),'undefined'!=typeof z)return l.cached[v]=0,z}else'set'==w.type&&'props'!=u&&w.object[w.name]&&w.object[w.name].draw&&'function'==typeof w.object[w.name].draw&&(l.innerMods[l.getId(v)]=[w.name,w.object[w.name]]);var A=l.getFrameId(v);'function'==typeof A&&'set'==w.type&&(cancelAnimationFrame(q[v]),q[v]=requestAnimationFrame(A))};l.iscached=function(u){var v=JSON.stringify(b.utils.merge(b.utils.copy(l.getProps(u)),l.getState(u)));return u in l.cache&&l.cache[u]==v||void(l.cache[u]=v)},l.remove=function(u){g[u]&&(g[u]=0)},l.clear=function(u){~u&&l.cache[u]&&l.cache.splice(u,1)},l.cached=[],l.callView=function(u,v){l.runningViewInstance=v,l.cached[v]||(b.props.attachToArgs(v,l.getState(v),u),l.cached[v]=1);try{l.getView(v)(l.getState(v),u)}finally{l.runningViewInstance=-1}},b.mod=l}(mag),function(b){'use strict';function f(v,w,x,y){var z=[];for(var A in v){var B=v[A];h(B)&&(z.push(B),g(B,w,x,y))}return!!z.length&&(1==z.length?z[0]:z)}function g(v,w,x,y){if(v[n]=v[n]||{},!v[n].eventOnFocus){var z=function(A,B,C){var E=~['radio','checkbox'].indexOf(v.type);this[n].dirty||(this[n].dirty=1),E?'_checked'in B||'_value'in B?B._checked=this.checked:this.checked&&(B[C]=this.value):void 0===B._value?void 0!==B._text&&(B._text=this.value):B._value=this.value,b.redraw(A,b.utils.items.getItem(A.id))}.bind(v,y,w,x);v.addEventListener('click',z,!1),v.addEventListener('input',z,!1),v.addEventListener('focus',z,!1),v[n].eventOnFocus=1}}function h(v){return v&&~['INPUT','SELECT','TEXTAREA'].indexOf(v.tagName)}function j(v){for(var w in v)if(h(v[w]))return v[w];return!1}var l={},n=b.MAGNUM,q=function(v,w){for(var x=1;x<v.length;x++){var y=v[x],z=v[x+1],A=b.fill.find(Array.isArray(w)?w[0]:w,y);if(z&&!isNaN(+z))w=A[z];else if(A&&A.length&&z&&x+2<v.length)w=b.fill.find(A[0],z);else if(A&&A.length&&(w=A,x+2==v.length))break}return Array.isArray(w)?w[0]:w},r=function(v,w,x,y){var A,z=x.toString().split('.');if(3<=z.length)y=q(z,y),A=b.fill.find(y,w);else{var B=parseInt(z.pop()),C=isNaN(B)?0:B;A=b.fill.find(y[C]?y[C]:y,w)}return f(A,v,w,y)},t=function(v,w,x,y){var z=x[w];~['_value','_checked','_text'].indexOf(w)&&isNaN(v)&&(w=v.split('.').pop());var A=b.fill.find(y,w),B=j(A);if('function'!=typeof z&&B){var C=r.bind({},x,w,v,y);C(),Object.defineProperty(x,w,{configurable:!0,get:function(){var D=C();return D&&'undefined'!==D.value&&D[n]&&D[n].dirty&&D.value!==z?(z=D.value,b.redraw(y,v,1),D.value):z},set:function(D){var E=C();E&&'undefined'!==E.value&&E.value!==D&&D!==z&&(E.value=D,z=D)}})}},u=function(v,w,x){for(var y in w)if(w.hasOwnProperty(y)){var z=w[y];'object'!=typeof z||b.utils.isHTMLEle(z)?t.bind({},v,y,w,x)():(b.utils.isObject(z)&&b.utils.isEmpty(z)&&(z._value=''),u(v+'.'+y,z,x))}};l.attachToArgs=u,b.props=l}(mag),function(b){'use strict';var c={isObject:function(l){return'Object]'==Object.prototype.toString.call(l).substr(-7)},isEmpty:function(l){for(var n in l)if(l.hasOwnProperty(n))return 0;return 1},isHTMLEle:function(l){return l&&1===l.nodeType},callHook:function(l,n,q,r,t,u){l[q][r].key==n&&(u={v:t.value,k:t.key},t.change=!1,l[q][r].handler.call(l[q][r].context,t),{v:t.value,k:t.key}!==u&&(t.change=!0))}},f=[],g=[];c.scheduleFlush=function(l,n){return new Promise(function(q){b.rafBounce||b.rafBounceIds[l]?(cancelAnimationFrame(g[l]),g[l]=requestAnimationFrame(function(){n(),q(),g[l]=0})):(f.push(n),g[l]?q():g[l]=requestAnimationFrame(function(){g[l]=0;for(var r;r=f.shift();)r();q()}))})};var h=[];c.onLCEvent=function(l,n,q){var r=l+'-'+n;h[r]=h[r]||[];var t=h[r].push(q);return function(){return h[r].splice(t-1,1)}},c.callLCEvent=function(l,n,q,r,t,u){var v;c.runningEventInstance=r;var w=b.mod.getProps(r);n&&n[l]&&(v=n[l].call(b.mod.getMod(r),q,w,r,u),t&&(n[l]=0));var x=l+'-'+r;if(h[x]){for(var y of h[x])y(n,w);t&&(h[x]=0)}return(c.runningEventInstance=-1,!1===v)||void 0},c.copy=function(l){return Object.assign({},l)},c.merge=function(){return Object.assign.apply({},arguments)},c.extend=function(l,n,q){for(var r in n)if(n[r]===void 0)delete n[r];else if(q&&c.isObject(n[r]))return c.extend(l[r],n[r]);return c.merge(l,n)};var j={i:[],isItem:function(l){return~j.i.indexOf(l)},setItem:function(l){j.i[j.i.length]=l},getItem:function(l){return j.i.indexOf(l)},getItemVal:function(l){return j.i[l]},removeItem:function(l){j.i.splice(j.i.indexOf(l),1)}};c.items=j,c.getItemInstanceIdAll=function(){return j.i},c.getItemInstanceId=function(l){return j.isItem(l)?j.getItem(l):(j.setItem(l),j.getItem(l))},b.utils=c}(mag),function(b,c,f){'use strict';function g(aa){return Array.isArray(aa)}function h(aa,ba){return aa[R]=aa[R]||{},(!aa[R].uid||ba)&&(aa[R].uid=++Y),aa[R].uid}function j(aa,ba){var ca=h(aa,ba);return V[ca]?V[ca]:V[ca]=q(aa)}function l(aa,ba,ca){var da=h(aa,ca);return W[P.id]=W[P.id]||[],W[P.id][da]&&W[P.id][da]==ba?1:void(W[P.id][da]=ba)}function n(aa){return aa.id?aa:aa.parentNode?n(aa.parentNode):void 0}function q(aa){var ba='',ca=n(aa),da=aa.parentNode&&[].indexOf.call(aa.parentNode.children,aa);return ca&&(ba+='id("'+ca.id+'")'),ba+='/'+aa.tagName+'['+(da+1)+']',ba}function r(aa){if(aa.id&&P.id===aa.id)return'id("'+aa.id+'")';if(aa===b.doc.body)return aa.tagName;var ba=0;if(aa.parentNode)for(var ea,ca=aa.parentNode.childNodes,da=0;da<ca.length;da++){if(ea=ca[da],ea===aa)return r(aa.parentNode)+(aa.tagName?'/'+aa.tagName+'['+(ba+1)+']':'');1===ea.nodeType&&ea.tagName===aa.tagName&&ba++}}function t(aa){var ba=r(aa);aa&&Q[ba+'-config']&&Q[ba+'-config'].configContext&&typeof Q[ba+'-config'].configContext.onunload==='function'&&(Q[ba+'-config'].configContext.onunload(Q[ba+'-config'].configContext,aa,ba),delete Q[ba+'-config'],delete P.configs[ba]),aa.parentNode&&aa.parentNode.removeChild(aa),b.mod.cached[b.utils.items.getItem(P.id)]=0}function u(aa){var ba=aa&&parseInt(aa.split('[').pop().slice(0,-1));return ba?parseInt(ba)-1:0}function v(aa){return aa&&~aa.indexOf('id(')&&aa.split('id("')[1].split('")')[0]}function w(aa){if(aa&&aa[R]&&aa[R].isChildOfArray)return aa;return aa.parentNode?w(aa.parentNode):void 0}function x(aa,ba,ca){if(!l(aa,ba.outerHTML,ca)&&(!ba.id&&!aa.childNodes[0]||ba.id&&!b.doc.getElementById(ba.id)||aa.firstChild&&!aa.firstChild.isEqualNode(ba))){var da=b.utils.items.getItem(ba.id);if(~da&&aa.hasChildNodes()){var ea=b.utils.items.getItem(P.id),fa=aa.cloneNode(1);fa[R]={childof:ea},b.mod.getProps(da).children=fa}else ba[R]&&ba[R].scid&&(fa=aa.cloneNode(1),fa[R]={childof:ba[R].scid},b._cprops[ba[R].scid]=fa);for(;aa.lastChild;)aa.removeChild(aa.lastChild);if(ba[R]&&ba[R].childof!==f){aa.innerHTML=ba.innerHTML;var ga=b.utils.items.getItem(P.id),ha=ba[R].childof;~ga&&!L(ga,ha)&&(b.utils.onLCEvent('willupdate',ba[R].childof,function(){b.utils.merge(b.mod.getState(ga),b.mod.getState(ha))}),Z.push(ga+','+ha),Z.push(ha+','+ga))}else aa.appendChild(ba)}}function y(aa,ba){var ca;for(var da in ba){var ea=ba[da];ea===f?ea='':null===ea&&-1===['onunload'].indexOf(da)?(aa[R].detached=aa[R].detached||[],aa[R].detached[da]=1,C(aa,da)):aa[R].detached&&aa[R].detached[da]&&(B(aa,da),aa[R].detached[da]=0),'_'===da[0]&&'_'!==da[1]&&(ca=ca||{},ca[da.substr(1)]=ea)}return ca}function z(aa,ba,ca){var da;for(var ea in ba){var fa=ba[ea];if(!~P.ignorekeys.indexOf(ea)&&'_'!==ea[0]){da=K(aa,ea);var ga={key:ea,value:fa,node:aa};b.hook('values','*',ga),ga.change&&(fa=ga.value),g(fa)&&(da=K(aa,'$'+ea)),P.run(da,fa,ca+'/'+ea)}}}function A(aa,ba,ca,da){var ea,ia=u(ca);return ba&&b.utils.isHTMLEle(ba)?void x(aa,ba):'function'==typeof ba?$(ba,aa,ia,ca):'object'==typeof ba?void(b.mod.innerMods[P.id]&&ba[b.mod.innerMods[P.id][0]]&&!ba[b.mod.innerMods[P.id][0]].draw&&b.mod.innerMods[P.id][1].destroy(),ea=y(aa,ba),ea&&H(aa,ea,ca,da),z(aa,ba,ca)):A(aa,{_text:ba},ca)}function B(aa,ba){var ca=K(aa,ba);ca.forEach(function(da){var ea=h(da);if(ea in _){for(var fa in _[ea])da.appendChild(_[ea][fa]);delete _[ea]}})}function C(aa,ba){var ca=0,da=1,ea=function(ha){if(++ca==da)for(;ha.lastChild;)t(ha.lastChild)},fa=function(ha,ia){var ja;ha.id&&b.utils.items.isItem(ha.id)&&(ja=b.utils.items.getItem(ha.id)),ja&&b.mod.getState(ja).onbeforeunload?(da++,b.utils.callLCEvent('onbeforeunload',b.mod.getState(ja),ha,ja,0,function(){ja&&b.utils.callLCEvent('onunload',b.mod.getState(ja),ha,ja),ia()})):(ja&&b.utils.callLCEvent('onunload',b.mod.getState(ja),ha,ja),ia())},ga=K(aa,ba);ga.forEach(function(ha){var ia=h(ha);ha.children.length&&(_[ia]=D(ha.children));for(var ka in _[ia]){var la=_[ia][ka];fa(la,function(){ea(ha)})}ea(ha)})}function D(aa){var ba;if(null==aa.length&&(aa=[aa]),!g(aa)){ba=[];for(var ca=0;ca<aa.length;ca+=1)aa[ca]&&ba.push(aa[ca]);aa=ba}return aa}function E(aa,ba){var ca=function(da,ea,fa){var ga=w(ea),ha=ga&&r(ga),ia=u(ha),ja=q(ea),ka=u(ja),ma=v(ja),na=b.doc.getElementById(ma),oa=b.utils.items.getItem(ma),pa=da.call(~oa?b.mod.getMod(oa):na,fa,ka,ea,{path:ha,node:ga,index:ia});if(ma&&na){var qa=function(){b.redraw(na,oa,1)};pa&&pa.then?pa.then(function(ra){return qa(),ra}):qa()}return pa}.bind({},ba,aa);return ca}function F(aa,ba,ca){aa.removeEventListener(ba,ca),aa.addEventListener(ba,ca)}function G(aa,ba,ca,da){var ea=ba.substr(2).toLowerCase(),fa=ca[R].events=ca[R].events||[],ga=ea+(da?da.split(')').pop():'')+ca[R].uid;(!fa[ga]||fa[ga]&&''+fa[ga]!=''+aa)&&(fa[ga]=aa,F(ca,ea,E(ca,aa)))}function H(aa,ba,ca,da){var ea=u(ca);for(var fa in Q[h(aa)]=Q[h(aa)]||[],ba)if('text'!==fa&&'html'!==fa)if(0==fa.indexOf('on'))G(ba[fa],fa,aa,da);else{if('config'==fa){var ca=r(aa),ea=u(ca),ga=!0;Q[ca+'-config']?ga=!1:Q[ca+'-config']={};var ha=Q[ca+'-config'].configContext=Q[ca+'-config'].configContext||{},ia=function(ma,na){return function(){return ma.apply(ma,na)}};c[ca]=ia(ba[fa],[aa,ga,ha,ea]);continue}var ja={key:fa,value:ba[fa],node:aa};if(b.hook('attributes',fa,ja),ja.change&&(fa=ja.key,ba[fa]=ja.value),Q[h(aa)]&&Q[h(aa)][fa]==ba[fa])continue;null===ba[fa]?aa.removeAttribute(fa):fa in aa?'style'==fa?aa[fa].cssText=ba[fa]:aa[fa]=ba[fa]:aa.setAttribute(fa,ba[fa]+''),Q[h(aa)][fa]=ba[fa]}I(aa,ba.text),J(aa,ba.html)}function I(aa,ba){if(aa&&null!=ba&&!l(aa,ba)){var ca=ba+'';if('INPUT'!==aa.nodeName)'SELECT'!==aa.nodeName&&(aa.firstChild?aa.firstChild.textContent=ca:aa.appendChild(aa.ownerDocument.createTextNode(ca)));else if(!~['radio','checkbox'].indexOf(aa.type))ca!=aa.value&&(aa.value=ca);else if(aa.name){var da=b.getNode(P.id).querySelectorAll('[name='+aa.name+']');if(1<da.length)for(var ea of da)if(ea.value==ca){ea.checked=!0;break}}'SELECT'===aa.nodeName&&ca&&(aa.value=ca)}}function J(aa,ba){!aa||null==ba||l(aa,ba)||(aa.innerHTML=b.utils.isHTMLEle(ba)?ba.innerHTML:ba)}function K(aa,ba,ca){var da=N(aa),ea=[],fa=ba,ga='$'===ba[0];'$'===fa[0]&&(fa=fa.substr(1));for(var ha=0;ha<da.length;ha+=1)O(da[ha],fa)&&ea.push(da[ha]);if(!ea.length||ga)for(var ha=0;ha<da.length&&(ea=ea.concat(K(da[ha],ba,!0)),!ea.length||ga);ha++);if(!ca&&!ea.length){var ia={key:ba,value:ea,node:aa};b.hook('elementMatcher',ba,ia),ia.change&&(ea=ia.value)}return ea}function L(aa,ba){return~Z.indexOf(aa+','+ba)}function M(aa){return P.id&&aa.id&&aa.id!=P.id&&b.utils.items.isItem(aa.id)&&!L(b.utils.items.getItem(P.id),b.utils.items.getItem(aa.id))?0:1}function N(aa){var ba=[];if(aa){var ca=aa.childNodes;if(ca)for(var da=0;da<ca.length;da+=1)1===ca[da].nodeType&&M(ca[da])&&ba.push(ca[da])}return ba}function O(aa,ba){var ca=' '+aa.className+' ';return aa.id===ba||~ca.indexOf(' '+ba+' ')||aa.name===ba||aa.nodeName.toLowerCase()===ba.toLowerCase()||aa.getAttribute('data-bind')===ba}var P={cached:[],ignorekeys:['toString','draw','then','hasOwnProperty','willgetprops','onbeforeunload','Symbol(Symbol.toStringTag)','nodeType','toJSON','onunload','willupdate','didupdate','didload','willload','isupdate']},Q=P.cached,R=b.MAGNUM,T='undefined',U='_key',V=[],W=[],X={},Y=0;P.run=function(aa,ba,ca){var da,ea;if(aa){null==ba&&(ba={_text:''});var fa=D(aa);if(ea=g(ba),ea){if(X[ca]&&0===fa.length&&(X[ca].parent.insertAdjacentHTML('beforeend',X[ca].node),fa=D(X[ca].parent.children)),!fa.length)return;var ga=fa[0].parentNode;for(X[ca]||(X[ca]={node:fa[0].cloneNode(1).outerHTML,parent:ga});fa.length<ba.length;)X[ca]?(ga.insertAdjacentHTML('beforeend',X[ca].node),da=ga.lastChild):da=fa[0].cloneNode(1),fa.push(da),ga&&ga.appendChild(da);var ha=ba.map(function(ma){return ma&&ma[U]});if((fa.length==ba.length||-1!==ha.indexOf(f))&&(ba=ba.map(function(ma,na){if('object'==typeof ma){if(fa[na][R]=fa[na][R]||{},fa[na][R].__key&&typeof ma[U]==T)return ma[U]=fa[na][R].__key,ma;typeof ma[U]==T&&(ma[U]=R+na),fa[na][R].__key=ma[U]}return ma})),fa.length>ba.length)if(0===ba.length||'object'!=typeof ba[0])for(;fa.length>ba.length;)da=fa.pop(),ga=da.parentNode,ga&&t(da);else{var ia=[],ja=ba.map(function(ma){return ma[U]});fa=fa.filter(function(ma){var oa;return(typeof ma[R]==T?oa=1:(!~ja.indexOf(ma[R].__key)||~ia.indexOf(ma[R].__key))&&(ia.push(ma[R].__key),oa=1),oa)?(t(ma),!1):(ia.push(ma[R].__key),!0)})}}for(var ka=0;ka<fa.length;ka++)if(ea)fa[ka]&&P.run(fa[ka],ba[ka]);else{var la=j(fa[ka]);fa[ka][R].xpath=la,A(fa[ka],ba,la,ca)}}};var Z=[],$=function(aa,ba,ca,da){var ea=w(ba.parentNode),fa=ea&&ea.getAttribute('key');ea&&fa&&(ca=+fa.split(R)[1]);var ga=aa(ca,da);ga&&b.utils.isHTMLEle(ga)&&(x(ba,ga),aa.draw&&aa.draw())},_=[];P.removeNode=t,P.configs=c,P.find=K,P.setId=aa=>{P.id=aa},P.clearCache=aa=>{W[aa]&&delete W[aa]},b.fill=P}(mag,[]),function(b){function f(h,j,l,n){function q(t){return r.has(t)}var r=new WeakSet;return new Proxy(h,{get:function(t,u,v){var w=t[u];if('symbol'==typeof u)return w;if('object'!=typeof w||'symbol'==typeof w||null===w||'function'==typeof w||Array.isArray(w)||!b.utils.isObject(w)||w.then||w.draw)u in t||~b.fill.ignorekeys.indexOf(u.toString())||l||'_'==u[0]||(w=b.proxy({},j,l,n+g+u));else if(!q(w))return r.add(w),b.proxy(w,j,l,n+g+u);var x=j({type:'get',object:t,name:u,path:n,oldValue:Reflect.get(t,u,v)});return'undefined'!=typeof x&&(w=x==b.MAGNUM?void 0:x),w},deleteProperty:function(t,u){return j({type:'delete',name:u,object:t,oldValue:Reflect.get(t,u)}),Reflect.deleteProperty(t,u)},set:function(t,u,v,w){var x=Reflect.get(t,u,w);return x===v&&'length'!==u||(j({type:'set',name:u,object:t,oldValue:x}),Reflect.set(t,u,v,w))}})}var g='/';b.proxy=function(h,j,l,n){for(var q in h){var r=typeof h[q];Array.isArray(h[q])&&101>h[q].length?h[q]=f(h[q],j):'object'==r&&null!==h[q]&&'symbol'!=typeof q&&'symbol'!=r&&'function'!=r&&b.utils.isObject(h[q])&&(h[q]=b.proxy(h[q],j,l,n+g+q))}return f(h,j,l,n||g)}}(mag,window||global||this);<commit_msg>Update mag.0.27.9.min.js<commit_after>/*
Mag.JS v0.27.9
http://github.com/magnumjs/mag.js
(c) <NAME>
License: MIT
*/
(function(b,c){'use strict';function g(Q,R){return'function'==typeof R?''+R:R}function h(Q,R){if(w[Q]&&!R)return w[Q];var S=mag.doc.getElementById(Q);return S&&(w[Q]=S),w[Q]}var j='KEY',l=0,n=['#'+j,'.'+j,j],q=function(Q,R){var S;for(var T in n){var U=n[T].replace(j,R);if(S=Q.querySelector(U),S)break}return S},r=function(Q){var R=mag.utils.items.getItemVal(Q),S=mag.getNode(R);return S},t=function(Q){if('string'==typeof Q){var R=r(~mag.mod.runningViewInstance||mag.utils.runningEventInstance),S=q(R||mag.doc,Q);if(S)return S}return Q},u=function(Q,R,S){var T=[],U=Q.cloneNode(1),W=[],X=[],Y=function(Z){var $=Q;Z=Z||{};var _;Z.key&&(_=Z.key+'-'+Y.id);var aa=Z.key?Z.key+'-'+Y.id:Y.id;X[aa]||(X[aa]=mag.utils.copy(S)),'object'==typeof Z&&(Z=mag.utils.extend(X[aa],Z)),_&&!T[_]?$=T[_]=U.cloneNode(1):_&&T[_]&&($=T[_]),$[mag.MAGNUM]=$[mag.MAGNUM]||{},$[mag.MAGNUM].scid=aa,mag._cprops[aa]&&'object'==typeof Z&&(Z.children=mag._cprops[aa]);var ba;return W[aa]!=JSON.stringify(Z,g)&&(ba=R(Z),W[aa]=JSON.stringify(Z,g),mag.fill.run($,ba)),$};return Y.id=++l,Y};b.mag=function(Q,R,S){if(Q=t(Q),R=t(R),S=S||{},mag.utils.isHTMLEle(R)&&mag.utils.isHTMLEle(Q))R[mag.MAGNUM]||mag.fill.run(R,Q);else{if('function'==typeof R&&mag.utils.isHTMLEle(Q)){try{u(Q.cloneNode(1),R,S)()}catch(T){}return u(Q,R,S)}return I(-1,h(mag._isNode(Q)),R,S)}},mag.MAGNUM='__magnum__',mag.rafBounceIds=[],mag._cprops=[],mag.doc=c;var v={values:[],attributes:[],elementMatcher:[]},w=[],l=0;mag._isNode=function(Q){return mag.utils.isHTMLEle(Q)&&(!Q.id&&(Q.id=++l),w[Q.id]=Q,Q=Q.id),Q};var x=function(Q,R){var S,T=R?Q+'-'+R:Q;return S=mag.utils.items.isItem(T)?mag.utils.items.getItem(T):mag.utils.getItemInstanceId(T),S};mag.module=function(Q,R,S){S=S||{},Q=mag._isNode(Q);var T=x(Q,S.key),U=y(S,T,R,Q);return U?I(T,U,R,mag.utils.copy(S)):void 0};var y=function(Q,R,S,T){Q.retain||mag.mod.clear(R);var U=h(T);if(mag.mod.submodule(T,R,S,Q),J(R,T),!O(R,U))return mag.redraw(U,R,1).then(function(){P(R,U)}),U},z=function(Q,R){return 0>R||R!=mag.utils.items.getItem(Q)?Q==mag.mod.getId(R):!0},A=[];mag.begin=function(Q){'undefined'==typeof A[Q]?A[Q]=1:A[Q]++},mag.end=function(Q){if(1<A[Q])A[Q]--;else{A[Q]=0;var R=mag.utils.items.getItemVal(Q);mag.redraw(h(R),Q)}},mag.redraw=function(Q,R,S){if(!A[R]){if(!Q||'undefined'==typeof R)throw Error('Mag.JS - Id or node invalid: '+mag.utils.items.getItemVal(R));if(!z(Q.id,R))return{then:T=>T()};if(S&&mag.fill.configs.splice(0,mag.fill.configs.length),S&&mag.mod.clear(R),mag.mod.runningViewInstance==R)throw Error('Mag.JS - recursive call: '+R);return mag.utils.scheduleFlush(R,K(Q,R,S))}},mag.hookin=function(Q,R,S){v[Q].push({context:{},handler:S,key:R})},mag.hook=function(Q,R,S){for(var T=0,U=v[Q].length;T<U;T++)mag.utils.callHook(v,R,Q,T,S)};var B={},C=[],D=[],E=function(Q,R,S){var T=mag.getNode(mag.mod.getId(Q)),U=function(){mag.utils.callLCEvent('onunload',mag.mod.getState(Q),T,Q)||(mag.clear(Q),N(Q,T),R[Q]&&(R[Q].length=0),S&&(mag.fill.removeNode(T),mag.mod.remove(Q)))};mag.mod.getState(Q).onbeforeunload?mag.utils.callLCEvent('onbeforeunload',mag.mod.getState(Q),T,Q,0,function(){U()}):U()},F=function(Q,R){D[Q]=D[Q]||[];var S=D[Q].push(R);return mag.utils.onLCEvent('didupdate',Q,function(T,U){var V=mag.utils.merge(mag.utils.copy(U),mag.utils.copy(T));if(JSON.stringify(V)!==JSON.stringify(C[Q])){for(var W of D[Q])W(T,U,h(mag.mod.getId(Q)),C[Q]);C[Q]=V}}),function(){return D[Q].splice(S-1,1)}},G=[],H=function(Q,R,S,T,U){var V=mag.utils.items.getItem(R);(R=mag._isNode(Q),P(V,Q),!(mag.mod.exists(V)&&mag.utils.callLCEvent('willgetprops',mag.mod.getState(V),Q,V,0,S)))&&(mag.mod.submodule(Q.id,V,T,S),J(V,Q.id),O(V,Q)||mag.redraw(Q,V,U).then(function(){P(V,Q)}))},I=function(Q,R,S,T){G[Q]=G[Q]||[];var U=function(V,W,X,Y,Z){'object'==typeof Z&&(Y=mag.utils.merge(mag.utils.copy(Y),Z),Z=0);var $=W.id+(Y.key?'.'+Y.key:'')+'.'+(Z||0);!B[$]||Y.key||~U._id||($+=++l);var _=B[$]=B[$]||W.cloneNode(1);if(_.id=$,mag.utils.items.isItem($))return H(_,$,Y,X,1),_;var aa=mag.utils.getItemInstanceId(_.id);return 0>V?V=U._id=aa:G[V].push({instanceId:aa,subscribe:F.bind({},aa)}),H(_,$,Y,X,1),_}.bind({},Q,R,S,T);return U._id=Q,U.clones=function(){return G[U._id]},U.destroy=function(V){E(U._id,U.clones,V)},U.getId=function(){return U._id},U.rafBounce=function(V){return V?mag.rafBounceIds[U._id]=1:!1===V&&(mag.rafBounceIds[U._id]=0),!!mag.rafBounceIds[U._id]},U.draw=function(V){return mag.redraw(R,U._id,V)},U.getState=function(){return mag.mod.getState(U._id)},U.getProps=function(){return mag.mod.getProps(U._id)},U.subscribe=function(V){return F(U._id,V)},U},J=function(Q,R){var S=function(T,U){h(U)?mag.redraw(h(U),T):mag.utils.items.isItem(U)&&mag.clear(T)}.bind({},Q,R);mag.mod.setFrameId(Q,S)};mag.clear=function(Q){mag.utils.items.removeItem(Q),mag.mod.clear(Q),mag.fill.clearCache(mag.mod.getId(Q))};var K=function(Q,R,S){return function(T,U,V){if(h(T.id,1),z(T.id,U)&&T){var W=mag.mod.getState(U);return mag.utils.callLCEvent('isupdate',W,T,U)?void 0:mag.mod.iscached(U)&&!V?0:void(mag.utils.callLCEvent('willupdate',W,T,U)||(mag.mod.callView(T,U),mag.fill.setId(T.id),mag.fill.run(T,W),mag.fill.setId(0),L(T.id,mag.fill.configs),mag.utils.callLCEvent('didupdate',W,T,U),!V&&mag.mod.iscached(U)))}}.bind({},Q,R,S)},L=function(Q,R){for(var S in R)S.startsWith('id("'+Q+'")/')&&R[S]()},M=function(Q){var S=[];for(var T in mag.fill.cached)-1<T.indexOf('id("'+Q+'")/')&&-1<T.indexOf('-config')&&mag.fill.cached[T].configContext&&S.push({path:T.split('-config')[0],controller:mag.fill.cached[T].configContext,handler:mag.fill.cached[T].configContext.onunload});return S},N=function(Q,R){for(var U,S=M(R.id,Q),T=0,V=S;U=V&&V[T];T++)U.controller.onunload&&(U.handler.call(U.controller,R,U.path),U.controller.onunload=0)},O=function(Q,R){return mag.utils.callLCEvent('willload',mag.mod.getState(Q),R,Q,1)},P=function(Q,R){var S=mag.utils.items.getItemVal(Q);if(h(S)&&mag.mod.exists(Q))return mag.utils.callLCEvent('didload',mag.mod.getState(Q),R,Q,1)};mag.getNode=h})(window||global||this,document),function(b){'use strict';function c(u,v){var w=u.name;if('undefined'==typeof u.object[u.name]&&'_'!==w[0]){var x=b.fill.find(v,w),y='$'===w[0],z=[];return x.length?(x.forEach(function(E){var F;if(!(E&&E.type&&!~['submit','button'].indexOf(E.type)))'undefined'==typeof u.oldValue&&'undefined'==typeof u.object[u.name]&&E&&!~['submit','button'].indexOf(E.type)&&1==E.childNodes.length&&E.childNodes[0].textContent.trim()&&(F={_text:E.childNodes[0].textContent.trim()});else if(E.value&&0<E.value.length)if('checkbox'!=E.type&&'radio'!=E.type)F={_value:E.value};else if(E.checked&&(F={},F._checked=!0),!y){var G=v.querySelectorAll('[name='+E.name+']');if(G.length)for(var H of G)H.checked&&(F?F._value=H.value:F={_value:H.value})}else F?F._value=E.value:F={_value:E.value};F?z.push(F):E&&!E.hasChildNodes()&&z.push(h)}),0===z.length?void 0:y?z:z[0]&&'undefined'!=typeof z[0]._value?z[0]._value:z[0]&&z[0]._text?z[0]._text:z[0]):h}if('_'==w[0]){var A=w.substr(1);if(v.length){var z=[];for(var B in v){var C=v[B],D=C[A];'undefined'==typeof D&&(D=C.getAttribute(A)),z.push(D)}return z}var D=v[A];return'undefined'==typeof D&&(D=v.getAttribute(A)),D}}function f(u,v){l.setProps(v,b.proxy(l.getProps(v),t.bind({},'props',v),'prop'));var x=new u(b.proxy({},t.bind({},'state',v)));return x}var g=[],h=b.MAGNUM,l={runningViewInstance:-1,innerMods:[],cache:[]};l.getState=function(u){return g[u][1]},l.setState=function(u,v){g[u][1]=v},l.getView=function(u){return g[u][0]},l.getProps=function(u){return g[u][2]},l.setProps=function(u,v){return g[u][2]=v},l.remove=function(u){g.splice(u,1)},l.getId=function(u){return g[u]&&g[u][3]},l.exists=function(u){return'undefined'!=typeof g[u]},l.setFrameId=function(u,v){g[u][4]=v},l.getFrameId=function(u){return g[u][4]},l.getMod=function(u){return g[u][5]};var n=(u,v)=>{for(var w in v=v||u,u){var x=u[w];'function'!=typeof x||~['controller','view'].indexOf(w)||(u[w]=x.bind(v))}return u};l.submodule=function(u,v,w,x){if(g[v])return x.key&&x.key==l.getProps(v).key?l.setProps(v,b.utils.copy(b.utils.merge(l.getProps(v),x))):l.setProps(v,x),g[v];w=b.utils.copy(w),n(w,w),g[v]=[0,0,0,0,0,0],l.setProps(v,x);var z=function(B,C,D){w.element=D,w.state=C,w.props=l.getProps(B),w.view&&w.view.call(w,C,w.props,D)}.bind({},v),A={controller:function(B){return w.props=l.getProps(v),w.state=B,w.element=b.getNode(u),(w.controller||function(){}).call(B,w.props)||B},view:z};return g[v][0]=A.view,g[v][3]=u,g[v][1]=f(A.controller,v,u),g[v][5]=w,g[v]};var q=[],r=function(u,v){var w=u,x=v.split('/');for(var y of x)if(y){var z=b.fill.find(w,y);z.length&&(w=z)}return w},t=function(u,v,w){if('get'==w.type&&'props'!=u&&!~b.fill.ignorekeys.indexOf(w.name.toString())&&'undefined'==typeof w.oldValue){var x=b.getNode(l.getId(v));if(w.path&&'/'==w.path[0])var y=r(x,w.path);y&&'$'!=w.path.split('/').pop()[0]&&(y=y[0]);var z=c(w,y?y:x);if(null!=z&&'undefined'!=typeof z&&'object'==typeof z&&w.object&&b.utils.merge(z,w.object[w.name]),'undefined'!=typeof z)return l.cached[v]=0,z}else'set'==w.type&&'props'!=u&&w.object[w.name]&&w.object[w.name].draw&&'function'==typeof w.object[w.name].draw&&(l.innerMods[l.getId(v)]=[w.name,w.object[w.name]]);var A=l.getFrameId(v);'function'==typeof A&&'set'==w.type&&(cancelAnimationFrame(q[v]),q[v]=requestAnimationFrame(A))};l.iscached=function(u){var v=JSON.stringify(b.utils.merge(b.utils.copy(l.getProps(u)),l.getState(u)));return u in l.cache&&l.cache[u]==v||void(l.cache[u]=v)},l.remove=function(u){g[u]&&(g[u]=0)},l.clear=function(u){~u&&l.cache[u]&&l.cache.splice(u,1)},l.cached=[],l.callView=function(u,v){l.runningViewInstance=v,l.cached[v]||(b.props.attachToArgs(v,l.getState(v),u),l.cached[v]=1);try{l.getView(v)(l.getState(v),u)}finally{l.runningViewInstance=-1}},b.mod=l}(mag),function(b){'use strict';function f(v,w,x,y){var z=[];for(var A in v){var B=v[A];h(B)&&(z.push(B),g(B,w,x,y))}return!!z.length&&(1==z.length?z[0]:z)}function g(v,w,x,y){if(v[n]=v[n]||{},!v[n].eventOnFocus){var z=function(A,B,C){var E=~['radio','checkbox'].indexOf(v.type);this[n].dirty||(this[n].dirty=1),E?'_checked'in B||'_value'in B?B._checked=this.checked:this.checked&&(B[C]=this.value):void 0===B._value?void 0!==B._text&&(B._text=this.value):B._value=this.value,b.redraw(A,b.utils.items.getItem(A.id))}.bind(v,y,w,x);v.addEventListener('click',z,!1),v.addEventListener('input',z,!1),v.addEventListener('focus',z,!1),v[n].eventOnFocus=1}}function h(v){return v&&~['INPUT','SELECT','TEXTAREA'].indexOf(v.tagName)}function j(v){for(var w in v)if(h(v[w]))return v[w];return!1}var l={},n=b.MAGNUM,q=function(v,w){for(var x=1;x<v.length;x++){var y=v[x],z=v[x+1],A=b.fill.find(Array.isArray(w)?w[0]:w,y);if(z&&!isNaN(+z))w=A[z];else if(A&&A.length&&z&&x+2<v.length)w=b.fill.find(A[0],z);else if(A&&A.length&&(w=A,x+2==v.length))break}return Array.isArray(w)?w[0]:w},r=function(v,w,x,y){var A,z=x.toString().split('.');if(3<=z.length)y=q(z,y),A=b.fill.find(y,w);else{var B=parseInt(z.pop()),C=isNaN(B)?0:B;A=b.fill.find(y[C]?y[C]:y,w)}return f(A,v,w,y)},t=function(v,w,x,y){var z=x[w];~['_value','_checked','_text'].indexOf(w)&&isNaN(v)&&(w=v.split('.').pop());var A=b.fill.find(y,w),B=j(A);if('function'!=typeof z&&B){var C=r.bind({},x,w,v,y);C(),Object.defineProperty(x,w,{configurable:!0,get:function(){var D=C();return D&&'undefined'!==D.value&&D[n]&&D[n].dirty&&D.value!==z?(z=D.value,b.redraw(y,v,1),D.value):z},set:function(D){var E=C();E&&'undefined'!==E.value&&E.value!==D&&D!==z&&(E.value=D,z=D)}})}},u=function(v,w,x){for(var y in w)if(w.hasOwnProperty(y)){var z=w[y];'object'!=typeof z||b.utils.isHTMLEle(z)?t.bind({},v,y,w,x)():(b.utils.isObject(z)&&b.utils.isEmpty(z)&&(z._value=''),u(v+'.'+y,z,x))}};l.attachToArgs=u,b.props=l}(mag),function(b){'use strict';var c={isObject:function(l){return'Object]'==Object.prototype.toString.call(l).substr(-7)},isEmpty:function(l){for(var n in l)if(l.hasOwnProperty(n))return 0;return 1},isHTMLEle:function(l){return l&&1===l.nodeType},callHook:function(l,n,q,r,t,u){l[q][r].key==n&&(u={v:t.value,k:t.key},t.change=!1,l[q][r].handler.call(l[q][r].context,t),{v:t.value,k:t.key}!==u&&(t.change=!0))}},f=[],g=[];c.scheduleFlush=function(l,n){return new Promise(function(q){b.rafBounce||b.rafBounceIds[l]?(cancelAnimationFrame(g[l]),g[l]=requestAnimationFrame(function(){n(),q(),g[l]=0})):(f.push(n),g[l]?q():g[l]=requestAnimationFrame(function(){g[l]=0;for(var r;r=f.shift();)r();q()}))})};var h=[];c.onLCEvent=function(l,n,q){var r=l+'-'+n;h[r]=h[r]||[];var t=h[r].push(q);return function(){return h[r].splice(t-1,1)}},c.callLCEvent=function(l,n,q,r,t,u){var v;c.runningEventInstance=r;var w=b.mod.getProps(r);n&&n[l]&&(v=n[l].call(b.mod.getMod(r),q,w,r,u),t&&(n[l]=0));var x=l+'-'+r;if(h[x]){for(var y of h[x])y(n,w);t&&(h[x]=0)}return(c.runningEventInstance=-1,!1===v)||void 0},c.copy=function(l){return Object.assign({},l)},c.merge=function(){return Object.assign.apply({},arguments)},c.extend=function(l,n,q){for(var r in n)if(n[r]===void 0)delete n[r];else if(q&&c.isObject(n[r]))return c.extend(l[r],n[r]);return c.merge(l,n)};var j={i:[],isItem:function(l){return~j.i.indexOf(l)},setItem:function(l){j.i[j.i.length]=l},getItem:function(l){return j.i.indexOf(l)},getItemVal:function(l){return j.i[l]},removeItem:function(l){j.i.splice(j.i.indexOf(l),1)}};c.items=j,c.getItemInstanceIdAll=function(){return j.i},c.getItemInstanceId=function(l){return j.isItem(l)?j.getItem(l):(j.setItem(l),j.getItem(l))},b.utils=c}(mag),function(b,c,f){'use strict';function g(aa){return Array.isArray(aa)}function h(aa,ba){return aa[R]=aa[R]||{},(!aa[R].uid||ba)&&(aa[R].uid=++Y),aa[R].uid}function j(aa,ba){var ca=h(aa,ba);return V[ca]?V[ca]:V[ca]=q(aa)}function l(aa,ba,ca){var da=h(aa,ca);return W[P.id]=W[P.id]||[],W[P.id][da]&&W[P.id][da]==ba?1:void(W[P.id][da]=ba)}function n(aa){return aa.id?aa:aa.parentNode?n(aa.parentNode):void 0}function q(aa){var ba='',ca=n(aa),da=aa.parentNode&&[].indexOf.call(aa.parentNode.children,aa);return ca&&(ba+='id("'+ca.id+'")'),ba+='/'+aa.tagName+'['+(da+1)+']',ba}function r(aa){if(aa.id&&P.id===aa.id)return'id("'+aa.id+'")';if(aa===b.doc.body)return aa.tagName;var ba=0;if(aa.parentNode)for(var ea,ca=aa.parentNode.childNodes,da=0;da<ca.length;da++){if(ea=ca[da],ea===aa)return r(aa.parentNode)+(aa.tagName?'/'+aa.tagName+'['+(ba+1)+']':'');1===ea.nodeType&&ea.tagName===aa.tagName&&ba++}}function t(aa){var ba=r(aa);aa&&Q[ba+'-config']&&Q[ba+'-config'].configContext&&typeof Q[ba+'-config'].configContext.onunload==='function'&&(Q[ba+'-config'].configContext.onunload(Q[ba+'-config'].configContext,aa,ba),delete Q[ba+'-config'],delete P.configs[ba]),aa.parentNode&&aa.parentNode.removeChild(aa),b.mod.cached[b.utils.items.getItem(P.id)]=0}function u(aa){var ba=aa&&parseInt(aa.split('[').pop().slice(0,-1));return ba?parseInt(ba)-1:0}function v(aa){return aa&&~aa.indexOf('id(')&&aa.split('id("')[1].split('")')[0]}function w(aa){if(aa&&aa[R]&&aa[R].isChildOfArray)return aa;return aa.parentNode?w(aa.parentNode):void 0}function x(aa,ba,ca){if(!l(aa,ba.outerHTML,ca)&&(!ba.id&&!aa.childNodes[0]||ba.id&&!b.doc.getElementById(ba.id)||aa.firstChild&&!aa.firstChild.isEqualNode(ba))){var da=b.utils.items.getItem(ba.id);if(~da&&aa.hasChildNodes()){var ea=b.utils.items.getItem(P.id),fa=aa.cloneNode(1);fa[R]={childof:ea},b.mod.getProps(da).children=fa}else ba[R]&&ba[R].scid&&(fa=aa.cloneNode(1),fa[R]={childof:ba[R].scid},b._cprops[ba[R].scid]=fa);for(;aa.lastChild;)aa.removeChild(aa.lastChild);if(ba[R]&&ba[R].childof!==f){aa.innerHTML=ba.innerHTML;var ga=b.utils.items.getItem(P.id),ha=ba[R].childof;~ga&&!L(ga,ha)&&(b.utils.onLCEvent('willupdate',ba[R].childof,function(){b.utils.merge(b.mod.getState(ga),b.mod.getState(ha))}),Z.push(ga+','+ha),Z.push(ha+','+ga))}else aa.appendChild(ba)}}function y(aa,ba){var ca;for(var da in ba){var ea=ba[da];ea===f?ea='':null===ea&&-1===['onunload'].indexOf(da)?(aa[R].detached=aa[R].detached||[],aa[R].detached[da]=1,C(aa,da)):aa[R].detached&&aa[R].detached[da]&&(B(aa,da),aa[R].detached[da]=0),'_'===da[0]&&'_'!==da[1]&&(ca=ca||{},ca[da.substr(1)]=ea)}return ca}function z(aa,ba,ca){var da;for(var ea in ba){var fa=ba[ea];if(!~P.ignorekeys.indexOf(ea)&&'_'!==ea[0]){da=K(aa,ea);var ga={key:ea,value:fa,node:aa};b.hook('values','*',ga),ga.change&&(fa=ga.value),g(fa)&&(da=K(aa,'$'+ea)),P.run(da,fa,ca+'/'+ea)}}}function A(aa,ba,ca,da){var ea,ia=u(ca);return ba&&b.utils.isHTMLEle(ba)?void x(aa,ba):'function'==typeof ba?$(ba,aa,ia,ca):'object'==typeof ba?void(b.mod.innerMods[P.id]&&ba[b.mod.innerMods[P.id][0]]&&!ba[b.mod.innerMods[P.id][0]].draw&&b.mod.innerMods[P.id][1].destroy(),ea=y(aa,ba),ea&&H(aa,ea,ca,da),z(aa,ba,ca)):A(aa,{_text:ba},ca)}function B(aa,ba){var ca=K(aa,ba);ca.forEach(function(da){var ea=h(da);if(ea in _){for(var fa in _[ea])da.appendChild(_[ea][fa]);delete _[ea]}})}function C(aa,ba){var ca=0,da=1,ea=function(ha){if(++ca==da)for(;ha.lastChild;)t(ha.lastChild)},fa=function(ha,ia){var ja;ha.id&&b.utils.items.isItem(ha.id)&&(ja=b.utils.items.getItem(ha.id)),ja&&b.mod.getState(ja).onbeforeunload?(da++,b.utils.callLCEvent('onbeforeunload',b.mod.getState(ja),ha,ja,0,function(){ja&&b.utils.callLCEvent('onunload',b.mod.getState(ja),ha,ja),ia()})):(ja&&b.utils.callLCEvent('onunload',b.mod.getState(ja),ha,ja),ia())},ga=K(aa,ba);ga.forEach(function(ha){var ia=h(ha);ha.children.length&&(_[ia]=D(ha.children));for(var ka in _[ia]){var la=_[ia][ka];fa(la,function(){ea(ha)})}ea(ha)})}function D(aa){var ba;if(null==aa.length&&(aa=[aa]),!g(aa)){ba=[];for(var ca=0;ca<aa.length;ca+=1)aa[ca]&&ba.push(aa[ca]);aa=ba}return aa}function E(aa,ba){var ca=function(da,ea,fa){var ga=w(ea),ha=ga&&r(ga),ia=u(ha),ja=j(ea),ka=u(ja),ma=v(ja),na=b.doc.getElementById(ma),oa=b.utils.items.getItem(ma),pa=da.call(~oa?b.mod.getMod(oa):na,fa,ka,ea,{path:ha,node:ga,index:ia});if(ma&&na){var qa=function(){b.redraw(na,oa,1)};pa&&pa.then?pa.then(function(ra){return qa(),ra}):qa()}return pa}.bind({},ba,aa);return ca}function F(aa,ba){function ca(da){var ea=aa[R].eventHandlers[ba];for(var fa in ea){var ga=ea[fa],ha=E(aa,ga);ha(da)}}aa.removeEventListener(ba,ca),aa.addEventListener(ba,ca)}function G(aa,ba,ca,da){var ea=ba.substr(2).toLowerCase(),fa=(da?da.split(')').pop():'')+'-'+ca[R].uid,ga=ca[R].events=ca[R].events||[],ha=ca[R].eventHandlers=ca[R].eventHandlers||[];ha[ea]=ha[ea]||[],ha[ea][fa]=aa,ga[ea]||(ga[ea]=1,F(ca,ea))}function H(aa,ba,ca,da){var ea=u(ca);for(var fa in Q[h(aa)]=Q[h(aa)]||[],ba)if('text'!==fa&&'html'!==fa)if(0==fa.indexOf('on'))G(ba[fa],fa,aa,da);else{if('config'==fa){var ca=r(aa),ea=u(ca),ga=!0;Q[ca+'-config']?ga=!1:Q[ca+'-config']={};var ha=Q[ca+'-config'].configContext=Q[ca+'-config'].configContext||{},ia=function(ma,na){return function(){return ma.apply(ma,na)}};c[ca]=ia(ba[fa],[aa,ga,ha,ea]);continue}var ja={key:fa,value:ba[fa],node:aa};if(b.hook('attributes',fa,ja),ja.change&&(fa=ja.key,ba[fa]=ja.value),Q[h(aa)]&&Q[h(aa)][fa]==ba[fa])continue;null===ba[fa]?aa.removeAttribute(fa):fa in aa?'style'==fa?aa[fa].cssText=ba[fa]:aa[fa]=ba[fa]:aa.setAttribute(fa,ba[fa]+''),Q[h(aa)][fa]=ba[fa]}I(aa,ba.text),J(aa,ba.html)}function I(aa,ba){if(aa&&null!=ba&&!l(aa,ba)){var ca=ba+'';if('INPUT'!==aa.nodeName)'SELECT'!==aa.nodeName&&(aa.firstChild?aa.firstChild.textContent=ca:aa.appendChild(aa.ownerDocument.createTextNode(ca)));else if(!~['radio','checkbox'].indexOf(aa.type))ca!=aa.value&&(aa.value=ca);else if(aa.name){var da=b.getNode(P.id).querySelectorAll('[name='+aa.name+']');if(1<da.length)for(var ea of da)if(ea.value==ca){ea.checked=!0;break}}'SELECT'===aa.nodeName&&ca&&(aa.value=ca)}}function J(aa,ba){!aa||null==ba||l(aa,ba)||(aa.innerHTML=b.utils.isHTMLEle(ba)?ba.innerHTML:ba)}function K(aa,ba,ca){var da=N(aa),ea=[],fa=ba,ga='$'===ba[0];'$'===fa[0]&&(fa=fa.substr(1));for(var ha=0;ha<da.length;ha+=1)O(da[ha],fa)&&ea.push(da[ha]);if(!ea.length||ga)for(var ha=0;ha<da.length&&(ea=ea.concat(K(da[ha],ba,!0)),!ea.length||ga);ha++);if(!ca&&!ea.length){var ia={key:ba,value:ea,node:aa};b.hook('elementMatcher',ba,ia),ia.change&&(ea=ia.value)}return ea}function L(aa,ba){return~Z.indexOf(aa+','+ba)}function M(aa){return P.id&&aa.id&&aa.id!=P.id&&b.utils.items.isItem(aa.id)&&!L(b.utils.items.getItem(P.id),b.utils.items.getItem(aa.id))?0:1}function N(aa){var ba=[];if(aa){var ca=aa.childNodes;if(ca)for(var da=0;da<ca.length;da+=1)1===ca[da].nodeType&&M(ca[da])&&ba.push(ca[da])}return ba}function O(aa,ba){var ca=' '+aa.className+' ';return aa.id===ba||~ca.indexOf(' '+ba+' ')||aa.name===ba||aa.nodeName.toLowerCase()===ba.toLowerCase()||aa.getAttribute('data-bind')===ba}var P={cached:[],ignorekeys:['toString','draw','then','hasOwnProperty','willgetprops','onbeforeunload','Symbol(Symbol.toStringTag)','nodeType','toJSON','onunload','willupdate','didupdate','didload','willload','isupdate']},Q=P.cached,R=b.MAGNUM,T='undefined',U='_key',V=[],W=[],X={},Y=0;P.run=function(aa,ba,ca){var da,ea;if(aa){null==ba&&(ba={_text:''});var fa=D(aa);if(ea=g(ba),ea){if(X[ca]&&0===fa.length&&(X[ca].parent.insertAdjacentHTML('beforeend',X[ca].node),fa=D(X[ca].parent.children)),!fa.length)return;var ga=fa[0].parentNode;for(X[ca]||(X[ca]={node:fa[0].cloneNode(1).outerHTML,parent:ga});fa.length<ba.length;)X[ca]?(ga.insertAdjacentHTML('beforeend',X[ca].node),da=ga.lastChild):da=fa[0].cloneNode(1),fa.push(da),ga&&ga.appendChild(da);var ha=ba.map(function(ma){return ma&&ma[U]});if((fa.length==ba.length||-1!==ha.indexOf(f))&&(ba=ba.map(function(ma,na){if('object'==typeof ma){if(fa[na][R]=fa[na][R]||{},fa[na][R].__key&&typeof ma[U]==T)return ma[U]=fa[na][R].__key,ma;typeof ma[U]==T&&(ma[U]=R+na),fa[na][R].__key=ma[U]}return ma})),fa.length>ba.length)if(0===ba.length||'object'!=typeof ba[0])for(;fa.length>ba.length;)da=fa.pop(),ga=da.parentNode,ga&&t(da);else{var ia=[],ja=ba.map(function(ma){return ma[U]});fa=fa.filter(function(ma){var oa;return(typeof ma[R]==T?oa=1:(!~ja.indexOf(ma[R].__key)||~ia.indexOf(ma[R].__key))&&(ia.push(ma[R].__key),oa=1),oa)?(t(ma),!1):(ia.push(ma[R].__key),!0)})}}for(var ka=0;ka<fa.length;ka++)if(ea)fa[ka]&&P.run(fa[ka],ba[ka]);else{var la=j(fa[ka]);fa[ka][R].xpath=la,A(fa[ka],ba,la,ca)}}};var Z=[],$=function(aa,ba,ca,da){var ea=w(ba.parentNode),fa=ea&&ea.getAttribute('key');ea&&fa&&(ca=+fa.split(R)[1]);var ga=aa(ca,da);if(ga&&b.utils.isHTMLEle(ga))x(ba,ga),aa.draw&&aa.draw();else{var ha=/<[a-z][\s\S]*>/i.test(ga)?'_html':'_text',ia={};return ia[ha]=ga,A(ba,ia,da)}},_=[];P.removeNode=t,P.configs=c,P.find=K,P.setId=aa=>{P.id=aa},P.clearCache=aa=>{W[aa]&&delete W[aa]},b.fill=P}(mag,[]),function(b){function f(h,j,l,n){function q(t){return r.has(t)}var r=new WeakSet;return new Proxy(h,{get:function(t,u,v){var w=t[u];if('symbol'==typeof u)return w;if('object'!=typeof w||'symbol'==typeof w||null===w||'function'==typeof w||Array.isArray(w)||!b.utils.isObject(w)||w.then||w.draw)u in t||~b.fill.ignorekeys.indexOf(u.toString())||l||'_'==u[0]||(w=b.proxy({},j,l,n+g+u));else if(!q(w))return r.add(w),b.proxy(w,j,l,n+g+u);var x=j({type:'get',object:t,name:u,path:n,oldValue:Reflect.get(t,u,v)});return'undefined'!=typeof x&&(w=x==b.MAGNUM?void 0:x),w},deleteProperty:function(t,u){return j({type:'delete',name:u,object:t,oldValue:Reflect.get(t,u)}),Reflect.deleteProperty(t,u)},set:function(t,u,v,w){var x=Reflect.get(t,u,w);return x===v&&'length'!==u||(j({type:'set',name:u,object:t,oldValue:x}),Reflect.set(t,u,v,w))}})}var g='/';b.proxy=function(h,j,l,n){for(var q in h){var r=typeof h[q];Array.isArray(h[q])&&101>h[q].length?h[q]=f(h[q],j):'object'==r&&null!==h[q]&&'symbol'!=typeof q&&'symbol'!=r&&'function'!=r&&b.utils.isObject(h[q])&&(h[q]=b.proxy(h[q],j,l,n+g+q))}return f(h,j,l,n||g)}}(mag,window||global||this);
{'fraction_non_alphanumeric': 0.3227262134276816, 'fraction_numerical': 0.008665070655282728, 'mean_word_length': 14.60396694214876, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 24, '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': '7520054', 'n_tokens_mistral': 21994, 'n_tokens_neox': 22130, 'n_words': 914}