!function(){"use strict";var e,t,n,r;r={_whatToTrace:[function(e,t){return`groupBy=substr(${e},1)`},function(e,t){return`${e}=${t}*`}]},n={_whatToTrace:function(e,t,n,r){return console.debug("overSchema => level",n,"over",r),1===n&&t.length>r?`${e}=${t}*&groupBy=substr(${e},${n+r+1})`:null}},e={dateTitle:["_utime","_startTime","_updateTime"],sfaTitle:["_2fDevices"]},t={home:[]},angular.module("llngSessionsExplorer",["ui.tree","ui.bootstrap","llApp"]).controller("SessionsExplorerCtrl",["$scope","$translator","$location","$q","$http",function(a,i,o,u,s){var l,c,p,f;return a.links=links,a.menulinks=menulinks,a.staticPrefix=staticPrefix,a.scriptname=scriptname,a.formPrefix=formPrefix,a.availableLanguages=availableLanguages,a.waiting=!0,a.showM=!1,a.showT=!0,a.data=[],a.currentScope=null,a.currentSession=null,a.menu=t,a.searchString="",a.sfatypes={},a.translateP=i.translateP,a.translate=i.translate,a.translateTitle=function(e){return i.translateField(e,"title")},f="persistent",a.menuClick=function(e){if(e.popup)window.open(e.popup);else switch(e.action||(e.action=e.title),typeof e.action){case"function":e.action(a.currentNode,a),a[e.action]();break;case"string":a[e.action]();break;default:console.warn("Unknown action type",typeof e.action)}return a.showM=!1},a.search2FA=function(e){return e&&(a.searchString=""),a.currentSession=null,a.data=[],a.updateTree2("",a.data,0,0)},a.delete2FA=function(e,t){var n,r,i;for(n=0,i=(r=document.querySelectorAll(`.data-${t}`)).length;n<i;n++)r[n].remove();return a.waiting=!0,s.delete(`${scriptname}sfa/${f}/${a.currentSession.id}?type=${e}&epoch=${t}`).then(function(e){return a.waiting=!1},function(e){return a.waiting=!1}),a.showT=!1},a.stoggle=function(e){var t;return 0===(t=e.$modelValue).nodes.length&&a.updateTree(t.value,t.nodes,t.level,t.over,t.query,t.count),e.toggle()},a.displaySession=function(t){var n,r;return r=function(t){var n,r,i,o,u,s,l,c,p,f,d,h,g,m,$,y,w,v,_,T;for(f in n=function(e){return e},v=t._utime,t)(T=t[f])?("string"==typeof t&&T.match(/; /)&&(t[f]=T.split("; ")),"object"!=typeof t[f]&&("_password".match(new RegExp("\b"+f+"\b"))?t[f]="********":f.match(/^(_utime|_lastAuthnUTime|_lastSeen|notification)$/)?t[f]=a.localeDate(T):f.match(/^(_startTime|_updateTime)$/)&&(m=/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/,i=(T=n(T)).match(m),t[f]=`${i[3]}/${i[2]}/${i[1]} à ${i[4]}:${i[5]}:${i[6]}`))):delete t[f];for(s in $=[],e){for(w=[],c=0,d=(u=e[s]).length;c<d;c++)if(t[o=u[c]])if("_2fDevices"===o&&t[o]){if((r=JSON.parse(t[o])).length>0)for(w.push({title:"2fid",value:"name",type:"type",epoch:"date"}),p=0,h=r.length;p<h;p++){for(f in y=r[p])T=y[f],"type"===f&&(_=T),"name"===f&&(g=T),"epoch"===f&&(l=T);w.push({title:"["+_+"]"+l,type:_,value:g,epoch:l,sfrow:!0})}delete t[o]}else t[o].toString().match(/\w+/)?(w.push({title:o,value:t[o]}),delete t[o]):delete t[o];else delete t[o];w.length>0&&$.push({title:`__${s}__`,nodes:w})}return{_utime:v,nodes:$}},a.currentScope=t,n=t.$modelValue.session,s.get(`${scriptname}sfa/${f}/${n}`).then(function(e){return a.currentSession=r(e.data),a.currentSession.id=n}),a.showT=!1},a.localeDate=function(e){return new Date(1e3*e).toLocaleString()},a.getLanguage=function(e){return a.lang=e,a.form="white",a.init(),a.showM=!1},p=function(e,t,n){var r;return(null===(r=t.match(/#!?\/(\w+)/))||r[1].match(/^(persistent)$/))&&(a.type="_session_uid"),a.init()},a.$on("$locationChangeSuccess",p),l=0,a.updateTree=function(e,t,i,o,u,c){var p,d,h;return a.waiting=!0,d=r[a.type]?r[a.type]:r._whatToTrace,p=d[i](a.type,e,u),c>25&&n[a.type]&&(h=n[a.type](a.type,e,i,o,u))?(o++,p=h,i-=1):o=0,s.get(`${scriptname}sfa/${f}?${p}`+Object.entries(a.sfatypes).map(function(e){return e[1]?"&type="+e[0]:""}).join("")).then(function(n){var r,u,s,c,f;if((r=n.data).result){for(u=0,s=(f=r.values).length;u<s;u++)c=f[u],l++,c.id=`node${l}`,i<d.length-1&&(c.nodes=[],c.level=i+1,c.query=p,c.over=o),t.push(c);""===e&&(a.total=r.total)}return a.waiting=!1},function(e){return a.waiting=!1})},a.updateTree2=function(e,t,i,o,u,c){var p,d,h;return a.waiting=!0,d=r[a.type]?r[a.type]:"_updateTime"===a.type?r._startTime:r._whatToTrace,p=d[i](a.type,e,u),c>25&&n[a.type]&&(h=n[a.type](a.type,e,i,o,u))?(o++,p=h,i-=1):o=0,s.get(`${scriptname}sfa/${f}?_session_uid=${a.searchString}*&groupBy=substr(_session_uid,${a.searchString.length})`+Object.entries(a.sfatypes).map(function(e){return e[1]?"&type="+e[0]:""}).join("")).then(function(n){var r,u,s,c,f;if((r=n.data).result){for(u=0,s=(f=r.values).length;u<s;u++)c=f[u],l++,c.id=`node${l}`,i<d.length-1&&(c.nodes=[],c.level=i+1,c.query=p,c.over=o),t.push(c);""===e&&(a.total=r.total)}return a.waiting=!1},function(e){return a.waiting=!1})},a.init=function(){return a.waiting=!0,a.data=[],u.all([i.init(a.lang),a.updateTree("",a.data,0,0)]).then(function(){return a.waiting=!1},function(e){return a.waiting=!1}),a.activeModule="2ndFA",a.myStyle={color:"#ffb84d"}},c=o.path().match(/^\/(\w+)/),a.type=c?c[1]:"_whatToTrace"}])}();