").data("index",b).append($("").text(c.connector)).append($(" ").html(UI.format.status(c))).append($(" ").html(a(c))).append($(" ").css("text-align",
+var i=function(){function a(b){var c=mist.data.capabilities.connectors[b.connector];if(!c)return"";var d=[],f=["required","optional"],D;for(D in f)for(var g in c[f[D]])b[g]&&b[g]!=""?d.push(g+": "+b[g]):c[f[D]][g]["default"]&&d.push(g+": "+c[f[D]][g]["default"]);return $("").addClass("description").text(d.join(", "))}g.html("");for(var b in mist.data.config.protocols){var c=mist.data.config.protocols[b];g.append($("").data("index",b).append($("").text(c.connector)).append($(" ").html(UI.format.status(c))).append($(" ").html(a(c))).append($(" ").css("text-align",
"right").html($("").text("Edit").click(function(){UI.navto("Edit Protocol",$(this).closest("tr").data("index"))})).append($("").text("Delete").click(function(){var a=$(this).closest("tr").data("index");if(confirm('Are you sure you want to delete the protocol "'+mist.data.config.protocols[a].connector+'"?')){mist.data.config.protocols.splice(a,1);mist.send(function(){UI.navto("Protocols")},{config:mist.data.config})}}))))}};i();UI.interval.set(function(){mist.send(function(){i()})},
-3E4);break;case "Edit Protocol":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,b)},{capabilities:!0});c.append("Loading..");break}var j=!1;""!=b&&0<=b&&(j=!0);var k={};for(f in mist.data.config.protocols)k[mist.data.config.protocols[f].connector]=1;var aa=function(a){var c=mist.data.capabilities.connectors[a],d=mist.convertBuildOptions(c,m);d.push({type:"hidden",pointer:{main:m,index:"connector"},value:a});d.push({type:"buttons",buttons:[{type:"save",label:"Save","function":function(){if(j)mist.data.config.protocols[b]=
+3E4);break;case "Edit Protocol":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,b)},{capabilities:!0});c.append("Loading..");break}var j=!1;""!=b&&0<=b&&(j=!0);var k={};for(f in mist.data.config.protocols)k[mist.data.config.protocols[f].connector]=1;var ca=function(a){var c=mist.data.capabilities.connectors[a],d=mist.convertBuildOptions(c,m);d.push({type:"hidden",pointer:{main:m,index:"connector"},value:a});d.push({type:"buttons",buttons:[{type:"save",label:"Save","function":function(){if(j)mist.data.config.protocols[b]=
m;else{if(!mist.data.config.protocols)mist.data.config.protocols=[];mist.data.config.protocols.push(m)}mist.send(function(){UI.navto("Protocols")},{config:mist.data.config})}},{type:"cancel",label:"Cancel","function":function(){UI.navto("Protocols")}}]});if("deps"in c&&c.deps!=""){$t=$("").text("Dependencies:");$ul=$("");$t.append($ul);if(typeof c.deps=="string")c.deps=c.deps.split(", ");for(var f in c.deps){a=$("").text(c.deps[f]+" ");$ul.append(a);typeof k[c.deps[f]]!="undefined"||
-typeof k[c.deps[f]+".exe"]!="undefined"?a.append($("").addClass("green").text("(Configured)")):a.append($("").addClass("red").text("(Not yet configured)"))}d.unshift({type:"text",text:$t[0].innerHTML})}return UI.buildUI(d)},k={};for(f in mist.data.config.protocols)k[mist.data.config.protocols[f].connector]=1;if(j)m=d=mist.data.config.protocols[b],c.find("h2").append(' "'+d.connector+'"'),c.append(aa(d.connector));else{c.html($("").text("New Protocol"));var m={},t=[];for(f in mist.data.capabilities.connectors)t.push([f,
-f]);var F=$("");c.append(UI.buildUI([{label:"Protocol",type:"select",select:t,"function":function(){F.html(aa($(this).getval()))}}])).append(F)}break;case "Streams":if(!("capabilities"in mist.data)){c.html("Loading..");mist.send(function(){UI.navto(a)},{capabilities:!0});break}var f=$(""),C=$("").text("Loading..");c.append(UI.buildUI([{type:"help",help:"Here you can create, edit or delete new and existing streams. Go to stream preview or embed a video player on your website."},
-$("").css({width:"45.25em",display:"flex","justify-content":"flex-end"}).append(f).append($("
").text("Create a new stream").click(function(){UI.navto("Edit")}))])).append(C);if(""==b){var s=mist.stored.get();"viewmode"in s&&(b=s.viewmode)}f.text("Switch to "+("thumbnails"==b?"list":"thumbnail")+" view").click(function(){mist.stored.set("viewmode",b=="thumbnails"?"list":"thumbnails");UI.navto("Streams",b=="thumbnails"?"list":"thumbnails")});var y=$.extend(!0,{},mist.data.streams),P=function(a,
-b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c},Q=function(b,d,f){C.remove();switch(b){case "thumbnails":var e=$("").addClass("preview_icons"),g;g=f||[];d.sort();d.unshift("");C.remove();c.append($("
").text(a)).append(UI.buildUI([{label:"Filter the streams",type:"datalist",datalist:d,pointer:{main:{},index:"stream"},help:"If you type something here, the box below will only show streams with names that contain your text.","function":function(){var a=
-$(this).val();e.children().each(function(){$(this).hide();$(this).attr("data-stream").indexOf(a)>-1&&$(this).show()})}}]));d.shift();c.append($("").addClass("description").text("Choose a stream below.")).append(e);for(var h in d){var b=d[h],i="",j=$("").text("Delete").click(function(){var a=$(this).closest("div").attr("data-stream");if(confirm('Are you sure you want to delete the stream "'+a+'"?')){delete mist.data.streams[a];var b={};mist.data.LTS?b.deletestream=[a]:b.streams=mist.data.streams;
+typeof k[c.deps[f]+".exe"]!="undefined"?a.append($("").addClass("green").text("(Configured)")):a.append($("").addClass("red").text("(Not yet configured)"))}d.unshift({type:"text",text:$t[0].innerHTML})}return UI.buildUI(d)},k={};for(f in mist.data.config.protocols)k[mist.data.config.protocols[f].connector]=1;if(j)m=d=mist.data.config.protocols[b],c.find("h2").append(' "'+d.connector+'"'),c.append(ca(d.connector));else{c.html($("").text("New Protocol"));var m={},t=[];for(f in mist.data.capabilities.connectors)t.push([f,
+f]);var G=$("");c.append(UI.buildUI([{label:"Protocol",type:"select",select:t,"function":function(){G.html(ca($(this).getval()))}}])).append(G)}break;case "Streams":if(!("capabilities"in mist.data)){c.html("Loading..");mist.send(function(){UI.navto(a)},{capabilities:!0});break}var f=$(""),C=$("").text("Loading..");c.append(UI.buildUI([{type:"help",help:"Here you can create, edit or delete new and existing streams. Go to stream preview or embed a video player on your website."},
+$("").css({width:"45.25em",display:"flex","justify-content":"flex-end"}).append(f).append($("
").text("Create a new stream").click(function(){UI.navto("Edit")}))])).append(C);if(""==b){var s=mist.stored.get();"viewmode"in s&&(b=s.viewmode)}f.text("Switch to "+("thumbnails"==b?"list":"thumbnail")+" view").click(function(){mist.stored.set("viewmode",b=="thumbnails"?"list":"thumbnails");UI.navto("Streams",b=="thumbnails"?"list":"thumbnails")});var y=$.extend(!0,{},mist.data.streams),R=function(a,
+b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c},S=function(b,d,f){C.remove();switch(b){case "thumbnails":var g=$("").addClass("preview_icons"),e;e=f||[];d.sort();d.unshift("");C.remove();c.append($("
").text(a)).append(UI.buildUI([{label:"Filter the streams",type:"datalist",datalist:d,pointer:{main:{},index:"stream"},help:"If you type something here, the box below will only show streams with names that contain your text.","function":function(){var a=
+$(this).val();g.children().each(function(){$(this).hide();$(this).attr("data-stream").indexOf(a)>-1&&$(this).show()})}}]));d.shift();c.append($("").addClass("description").text("Choose a stream below.")).append(g);for(var h in d){var b=d[h],i="",j=$("").text("Delete").click(function(){var a=$(this).closest("div").attr("data-stream");if(confirm('Are you sure you want to delete the stream "'+a+'"?')){delete mist.data.streams[a];var b={};mist.data.LTS?b.deletestream=[a]:b.streams=mist.data.streams;
mist.send(function(){UI.navto("Streams")},b)}}),l=$("").text("Settings").click(function(){UI.navto("Edit",$(this).closest("div").attr("data-stream"))}),f=$("").text("Preview").click(function(){UI.navto("Preview",$(this).closest("div").attr("data-stream"))}),k=$("").text("Embed").click(function(){UI.navto("Embed",$(this).closest("div").attr("data-stream"))}),n=$("").addClass("image");if(b.indexOf("+")>-1){i=b.split("+");i=mist.data.streams[i[0]].source+i[1];l=j="";n.addClass("wildcard")}else{i=
-mist.data.streams[b].source;if(g.indexOf(b)>-1){k=f="";n.addClass("folder")}}e.append($("").append($("
").addClass("streamname").text(b)).append(n).append($("").addClass("description").text(i)).append($("").addClass("button_container").append(l).append(j).append(f).append(k)).attr("title",b).attr("data-stream",b))}break;default:var m=$("").append($("").append("").attr("colspan",6).text("Loading.."));h=$("").html($("").html($("").html($("").text("Stream name").attr("data-sort-type",
+mist.data.streams[b].source;if(e.indexOf(b)>-1){k=f="";n.addClass("folder")}}g.append($("").append($("
").addClass("streamname").text(b)).append(n).append($("").addClass("description").text(i)).append($("").addClass("button_container").append(l).append(j).append(f).append(k)).attr("title",b).attr("data-stream",b))}break;default:var m=$("").append($("").append("").attr("colspan",6).text("Loading.."));h=$("").html($("").html($("").html($("").text("Stream name").attr("data-sort-type",
"string").addClass("sorting-asc")).append($(" ").text("Source").attr("data-sort-type","string")).append($(" ").text("Status").attr("data-sort-type","int")).append($(" ").css("text-align","right").text("Connections").attr("data-sort-type","int")).append($(" ")).append($(" ")))).append(m);c.append(h);h.stupidtable();var o=function(){var a=[],b;for(b in mist.data.active_streams)a.push({streams:[mist.data.active_streams[b]],fields:["clients"],start:-2});mist.send(function(){$.extend(true,
y,mist.data.streams);var a=0;m.html("");d.sort();for(var b in d){var c=d[b],f;f=c in mist.data.streams?mist.data.streams[c]:y[c];var g=$(" ").css("text-align","right").html($("").addClass("description").text("Loading..")),e=0;if(typeof mist.data.totals!="undefined"&&typeof mist.data.totals[c]!="undefined"){var h=mist.data.totals[c].all_protocols.clients,e=0;if(h.length){for(a in h)e=e+h[a][1];e=Math.round(e/h.length)}}g.html(UI.format.number(e));if(e==0&&f.online==1)f.online=2;e=$(" ").css("text-align",
"right").css("white-space","nowrap");(!("ischild"in f)||!f.ischild)&&e.html($("").text("Settings").click(function(){UI.navto("Edit",$(this).closest("tr").data("index"))})).append($("").text("Delete").click(function(){var a=$(this).closest("tr").data("index");if(confirm('Are you sure you want to delete the stream "'+a+'"?')){delete mist.data.streams[a];var b={};mist.data.LTS?b.deletestream=[a]:b.streams=mist.data.streams;mist.send(function(){UI.navto("Streams")},b)}}));h=$("").text(c);
-f.ischild&&h.css("padding-left","1em");var da=UI.format.status(f),i=$("").text("Preview").click(function(){UI.navto("Preview",$(this).closest("tr").data("index"))}),j=$("").text("Embed").click(function(){UI.navto("Embed",$(this).closest("tr").data("index"))});if("filesfound"in y[c]){da.html("");i="";g.html("");j=""}m.append($("").data("index",c).html($("").html(h).attr("title",c).addClass("overflow_ellipsis")).append($(" ").text(f.source).attr("title",f.source).addClass("description").addClass("overflow_ellipsis").css("max-width",
-"20em")).append($(" ").data("sort-value",f.online).html(da)).append(g).append($(" ").css("white-space","nowrap").html(i).append(j)).append(e));a++}},{totals:a,active_streams:true})};if(mist.data.LTS){var p=0,q=0;for(g in mist.data.streams){h=mist.data.capabilities.inputs.Folder||mist.data.capabilities.inputs["Folder.exe"];if(!h)break;if(mist.inputMatch(h.source_match,mist.data.streams[g].source)){y[g].source=y[g].source+"*";y[g].filesfound=null;mist.send(function(a,b){var c=b.stream,d;for(d in a.browse.files)for(var f in mist.data.capabilities.inputs)if(!(f.indexOf("Buffer")>=
-0||f.indexOf("Folder")>=0)&&mist.inputMatch(mist.data.capabilities.inputs[f].source_match,"/"+a.browse.files[d])){var e=c+"+"+a.browse.files[d];y[e]=P(e,mist.data.streams[c]);y[e].source=mist.data.streams[c].source+a.browse.files[d]}"files"in a.browse&&a.browse.files.length?y[c].filesfound=true:mist.data.streams[c].filesfound=false;q++;if(p==q){mist.send(function(){o()},{active_streams:true});UI.interval.set(function(){o()},5E3)}},{browse:mist.data.streams[g].source},{stream:g});p++}}if(p==0){mist.send(function(){o()},
-{active_streams:true});UI.interval.set(function(){o()},5E3)}}else{mist.send(function(){o()},{active_streams:true});UI.interval.set(function(){o()},5E3)}}};if(mist.data.LTS){var R=0,ba=0,t={},ca=[];for(s in mist.data.streams)if(mist.inputMatch((mist.data.capabilities.inputs.Folder||mist.data.capabilities.inputs["Folder.exe"]).source_match,mist.data.streams[s].source))ca.push(s),mist.send(function(a,c){var d=c.stream,f;for(f in a.browse.files)for(var e in mist.data.capabilities.inputs)e.indexOf("Buffer")>=
-0||e.indexOf("Folder")>=0||mist.inputMatch(mist.data.capabilities.inputs[e].source_match,"/"+a.browse.files[f])&&(t[d+"+"+a.browse.files[f]]=true);ba++;R==ba&&mist.send(function(){for(var a in mist.data.active_streams){var c=mist.data.active_streams[a].split("+");if(c.length>1&&c[0]in mist.data.streams){t[mist.data.active_streams[a]]=true;y[mist.data.active_streams[a]]=P(mist.data.active_streams[a],mist.data.streams[c[0]])}}t=Object.keys(t);t=t.concat(Object.keys(mist.data.streams));t.sort();Q(b,
-t,ca)},{active_streams:true})},{browse:mist.data.streams[s].source},{stream:s}),R++;0==R&&mist.send(function(){for(var a in mist.data.active_streams){var c=mist.data.active_streams[a].split("+");if(c.length>1&&c[0]in mist.data.streams){t[mist.data.active_streams[a]]=true;y[mist.data.active_streams[a]]=P(mist.data.active_streams[a],mist.data.streams[c[0]])}}t=Object.keys(t);mist.data.streams&&(t=t.concat(Object.keys(mist.data.streams)));t.sort();Q(b,t)},{active_streams:!0})}else Q(b,Object.keys(mist.data.streams));
-break;case "Edit":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,b)},{capabilities:!0});c.append("Loading..");break}j=!1;""!=b&&(j=!0);if(j){var r=b,m=mist.data.streams[r];c.find("h2").append(' "'+r+'"')}else c.html($("").text("New Stream")),m={};r=[];for(f in mist.data.capabilities.inputs)r.push(mist.data.capabilities.inputs[f].source_match);var K=$(" "),ea=function(a){if(!mist.data.streams)mist.data.streams={};mist.data.streams[m.name]=m;b!=m.name&&delete mist.data.streams[b];
-var c={};if(mist.data.LTS){c.addstream={};c.addstream[m.name]=m;if(b!=m.name)c.deletestream=[b]}else c.streams=mist.data.streams;if(m.stop_sessions&&b!=""){c.stop_sessions=b;delete m.stop_sessions}mist.send(function(){delete mist.data.streams[m.name].online;delete mist.data.streams[m.name].error;UI.navto(a,a=="Preview"?m.name:"")},c)},fa=$("