").data("index",b).append($("").text(d&&
+d.friendly?d.friendly: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.send(function(){UI.navto("Protocols")},
+{deleteprotocol:mist.data.config.protocols[a]});mist.data.config.protocols.splice(a,1)}}))))}};ga();UI.interval.set(function(){mist.send(function(){ga()})},1E4);break;case "Edit Protocol":if("undefined"==typeof mist.data.capabilities){mist.send(function(){UI.navto(a,c)},{capabilities:!0});d.append("Loading..");return}var E=!1;""!=c&&0<=c&&(E=!0);var L={};for(m in mist.data.config.protocols)L[mist.data.config.protocols[m].connector]=1;var ha=function(a){var b=mist.data.capabilities.connectors[a],c=
+mist.convertBuildOptions(b,p);if(E)var d=$.extend({},p);c.push({type:"hidden",pointer:{main:p,index:"connector"},value:a});c.push({type:"buttons",buttons:[{type:"save",label:"Save","function":function(){var a={};E?a.updateprotocol=[d,p]:a.addprotocol=p;mist.send(function(){UI.navto("Protocols")},a)}},{type:"cancel",label:"Cancel","function":function(){UI.navto("Protocols")}}]});if("deps"in b&&b.deps!=""){z=$("").text("Dependencies:");$ul=$("");z.append($ul);if(typeof b.deps=="string")b.deps=
+b.deps.split(", ");for(var g in b.deps){a=$("").text(b.deps[g]+" ");$ul.append(a);typeof L[b.deps[g]]!="undefined"||typeof L[b.deps[g]+".exe"]!="undefined"?a.append($("").addClass("green").text("(Configured)")):a.append($("").addClass("red").text("(Not yet configured)"))}c.unshift({type:"text",text:z[0].innerHTML})}return UI.buildUI(c)},L={};for(m in mist.data.config.protocols)L[mist.data.config.protocols[m].connector]=1;if(E){var s=mist.data.config.protocols[c],p=s;d.find("h2").append(' "'+
+s.connector+'"');d.append(ha(s.connector))}else{d.html($("").text("New Protocol"));var p={},t=[["",""]];for(m in mist.data.capabilities.connectors)t.push([m,mist.data.capabilities.connectors[m].friendly?mist.data.capabilities.connectors[m].friendly:m]);var I=$("");d.append(UI.buildUI([{label:"Protocol",type:"select",select:t,"function":function(){$(this).getval()!=""&&I.html(ha($(this).getval()))}}])).append(I)}break;case "Streams":if(!("capabilities"in mist.data)){d.html("Loading..");mist.send(function(){UI.navto(a)},
+{capabilities:!0});return}m=$("");var F=$("").text("Loading..");d.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(m).append($("
").text("Create a new stream").click(function(){UI.navto("Edit")}))])).append(F);""==c&&(g=mist.stored.get(),"viewmode"in g&&(c=g.viewmode));m.text("Switch to "+
+("thumbnails"==c?"list":"thumbnail")+" view").click(function(){mist.stored.set("viewmode",c=="thumbnails"?"list":"thumbnails");UI.navto("Streams",c=="thumbnails"?"list":"thumbnails")});var y=$.extend(!0,{},mist.data.streams),T=function(a,b){var c=$.extend({},b);delete c.meta;delete c.error;c.online=2;c.name=a;c.ischild=true;return c},U=function(b,c,g){F.remove();switch(b){case "thumbnails":var f=$("").addClass("preview_icons"),e;e=g||[];c.sort();c.unshift("");F.remove();d.append($("
").text(a)).append(UI.buildUI([{label:"Filter the streams",
+type:"datalist",datalist:c,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();f.children().each(function(){$(this).hide();$(this).attr("data-stream").indexOf(a)>-1&&$(this).show()})}}]));c.shift();d.append($("").addClass("description").text("Choose a stream below.")).append(f);for(var h in c){var b=c[h],j="",k=$("").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={};b.deletestream=[a];mist.send(function(){UI.navto("Streams")},b)}}),i=$("").text("Settings").click(function(){UI.navto("Edit",$(this).closest("div").attr("data-stream"))}),g=$("").text("Preview").click(function(){UI.navto("Preview",$(this).closest("div").attr("data-stream"))}),l=$("").text("Embed").click(function(){UI.navto("Embed",
+$(this).closest("div").attr("data-stream"))}),o=$("").addClass("image");if(b.indexOf("+")>-1){j=b.split("+");j=mist.data.streams[j[0]].source+j[1];i=k="";o.addClass("wildcard")}else{j=mist.data.streams[b].source;if(e.indexOf(b)>-1){l=g="";o.addClass("folder")}}f.append($("").append($("
").addClass("streamname").text(b)).append(o).append($("").addClass("description").text(j)).append($("").addClass("button_container").append(i).append(k).append(g).append(l)).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);
d.append(h);h.stupidtable();var n=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("");c.sort();for(var b in c){var d=c[b],g;g=d in mist.data.streams?mist.data.streams[d]:y[d];var e=$(" ").css("text-align","right").html($("").addClass("description").text("Loading..")),f=0;if(typeof mist.data.totals!="undefined"&&typeof mist.data.totals[d]!=
"undefined"){var h=mist.data.totals[d].all_protocols.clients,f=0;if(h.length){for(a in h)f=f+h[a][1];f=Math.round(f/h.length)}}e.html(UI.format.number(f));if(f==0&&g.online==1)g.online=2;f=$(" ").css("text-align","right").css("white-space","nowrap");(!("ischild"in g)||!g.ischild)&&f.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 "'+
@@ -161,29 +162,29 @@ $(this).getval()==1;switch($(this).getval()){case 0:q.controls=false;break;case
$(this).getval();$(".embed_code").setval(w(q))},help:"If the video should restart when the end is reached."},{label:"Start muted",type:"checkbox",pointer:{main:q,index:"muted"},"function":function(){q.muted=$(this).getval();$(".embed_code").setval(w(q))},help:"If the video should restart when the end is reached."},{label:"Fill available space",type:"checkbox",pointer:{main:q,index:"fillSpace"},"function":function(){q.fillSpace=$(this).getval();$(".embed_code").setval(w(q))},help:"The video will fit the available space in its container, even if the video stream has a smaller resolution."},
{label:"Poster",type:"str",pointer:{main:q,index:"poster"},"function":function(){q.poster=$(this).getval();$(".embed_code").setval(w(q))},help:"URL to an image that is displayed when the video is not playing."},{label:"Video URL addition",type:"str",pointer:{main:q,index:"urlappend"},help:"The embed script will append this string to the video url, useful for sending through params.",classes:["embed_code_forceprotocol"],"function":function(){q.urlappend=$(this).getval();$(".embed_code").setval(w(q))}},
{label:"Preselect tracks",type:"DOMfield",DOMfield:K,help:"Pre-select these tracks."},{label:"Monitoring action",type:"select",select:[["","Ask the viewer what to do"],["nextCombo","Try the next source / player combination"]],pointer:{main:q,index:"monitor_action"},"function":function(){q.monitor_action=$(this).getval();$(".embed_code").setval(w(q))},help:"What the player should do when playback is poor."},$("").text("Protocol stream urls"),aa]));$.ajax({type:"GET",url:H+"json_"+C+".js",success:function(a){var b=
-[],c=N.find(".field.forceType"),d=N.find(".field.prioritize_type"),g;for(g in a.source){var e=a.source[g],f=UI.humanMime(e.type);b.push({label:f?f+" ("+e.type+") ":UI.format.capital(e.type),type:"str",value:e.url,readonly:true,qrcode:true,clipboard:true});f=UI.humanMime(e.type);if(c.children('option[value="'+e.type+'"]').length==0){c.append($("").text(f?f+" ("+e.type+")":UI.format.capital(e.type)).val(e.type));d.append($(" ").text(f?f+" ("+e.type+")":UI.format.capital(e.type)).val(e.type))}}c.val(q.forceType);
-d.val(q.prioritize_type);aa.html(UI.buildUI(b));K.html("");b={};for(g in a.meta.tracks){c=a.meta.tracks[g];if(c.codec=="subtitle")c.type="subtitle";if(!(c.type!="audio"&&c.type!="video"&&c.type!="subtitle")){c.type in b||(b[c.type]=c.type=="subtitle"?[]:[["","Autoselect "+c.type]]);b[c.type].push([c.trackid,UI.format.capital(c.type)+" track "+(b[c.type].length+(c.type=="subtitle"?1:0))])}}if(Object.keys(b).length){K.closest("label").show();var a=["audio","video","subtitle"],h;for(h in a){g=a[h];if(b[g]&&
-b[g].length){c=$("").attr("data-type",g).css("flex-grow","1").change(function(){$(this).val()==""?delete q.setTracks[$(this).attr("data-type")]:q.setTracks[$(this).attr("data-type")]=$(this).val();$(".embed_code").setval(w(q))});K.append(c);g=="subtitle"?b[g].unshift(["","No "+g]):b[g].push([-1,"No "+g]);for(var i in b[g])c.append($("").val(b[g][i][0]).text(b[g][i][1]));if(g in q.setTracks){c.val(q.setTracks[g]);if(c.val()==null){c.val("");delete q.setTracks[g];$(".embed_code").setval(w(q))}}}}}else K.closest("label").hide();
+[],c=N.find(".field.forceType"),d=N.find(".field.prioritize_type"),e;for(e in a.source){var g=a.source[e],f=UI.humanMime(g.type);b.push({label:f?f+" ("+g.type+") ":UI.format.capital(g.type),type:"str",value:g.url,readonly:true,qrcode:true,clipboard:true});f=UI.humanMime(g.type);if(c.children('option[value="'+g.type+'"]').length==0){c.append($(" ").text(f?f+" ("+g.type+")":UI.format.capital(g.type)).val(g.type));d.append($(" ").text(f?f+" ("+g.type+")":UI.format.capital(g.type)).val(g.type))}}c.val(q.forceType);
+d.val(q.prioritize_type);aa.html(UI.buildUI(b));K.html("");b={};for(e in a.meta.tracks){c=a.meta.tracks[e];if(c.codec=="subtitle")c.type="subtitle";if(!(c.type!="audio"&&c.type!="video"&&c.type!="subtitle")){c.type in b||(b[c.type]=c.type=="subtitle"?[]:[["","Autoselect "+c.type]]);b[c.type].push([c.trackid,UI.format.capital(c.type)+" track "+(b[c.type].length+(c.type=="subtitle"?1:0))])}}if(Object.keys(b).length){K.closest("label").show();var a=["audio","video","subtitle"],h;for(h in a){e=a[h];if(b[e]&&
+b[e].length){c=$("").attr("data-type",e).css("flex-grow","1").change(function(){$(this).val()==""?delete q.setTracks[$(this).attr("data-type")]:q.setTracks[$(this).attr("data-type")]=$(this).val();$(".embed_code").setval(w(q))});K.append(c);e=="subtitle"?b[e].unshift(["","No "+e]):b[e].push([-1,"No "+e]);for(var i in b[e])c.append($("").val(b[e][i][0]).text(b[e][i][1]));if(e in q.setTracks){c.val(q.setTracks[e]);if(c.val()==null){c.val("");delete q.setTracks[e];$(".embed_code").setval(w(q))}}}}}else K.closest("label").hide();
O=true},error:function(){aa.html("Error while retrieving stream info.");K.closest("label").hide();q.setTracks={}}});m=document.createElement("script");m.src=J+"player.js";document.head.appendChild(m);m.onload=function(){var a=N.find(".field.forcePlayer"),b;for(b in mistplayers)a.append($(" ").text(mistplayers[b].name).val(b));document.head.removeChild(this)};m.onerror=function(){document.head.removeChild(this)};break;case "Push":var D=$("").text("Loading..");d.append(D);mist.send(function(a){function b(a){setTimeout(function(){mist.send(function(c){var d=
-false;if("push_list"in c&&c.push_list&&c.push_list.length){var d=true,e;for(e in c.push_list)if(a.indexOf(c.push_list[e][0])>-1){d=false;break}}else d=true;if(d)for(e in a)g.find("tr[data-pushid="+a[e]+"]").remove();else b()},{push_list:1})},1E3)}function c(e,f){var h=$("
");if(f=="Automatic"&&e.length>=4){h.append($("").text(e[2]));e[3]&&h.append($("").text(", schedule on "+(new Date(e[3]*1E3)).toLocaleString()));e.length>=5&&e[4]&&h.append($("").text(", complete on "+(new Date(e[4]*
-1E3)).toLocaleString()))}else e.length>=4&&e[2]!=e[3]?h.append($("").text(e[2])).append($("").html("»").addClass("unit").css("margin","0 0.5em")).append($("").text(e[3])):h.append($("").text(e[2]));var i=$(" ").append($("").text(f=="Automatic"?"Remove":"Stop").click(function(){if(confirm("Are you sure you want to "+$(this).text().toLowerCase()+" this push?\n"+e[1]+" to "+e[2])){var a=$(this).closest("tr");a.html($("").html($("").addClass("red").text(f==
-"Automatic"?"Removing..":"Stopping..")));if(f=="Automatic"){var c=e.slice(1);mist.send(function(){a.remove()},{push_auto_remove:[c]})}else mist.send(function(){b([e[0]])},{push_stop:[e[0]]})}}));if(f=="Automatic"){i.prepend($("").text("Edit").click(function(){UI.navto("Start Push","auto_"+($(this).closest("tr").index()-1))}));i.append($("").text("Stop pushes").click(function(){if(confirm('Are you sure you want to stop all pushes matching \n"'+e[1]+" to "+e[2]+'"?'+(d.wait!=0?"\n\nRetrying is enabled. You'll probably want to set that to 0.":
-""))){var c=$(this);c.text("Stopping pushes..");var f=[],h;for(h in a.push_list)if(e[1]==a.push_list[h][1]&&e[2]==a.push_list[h][2]){f.push(a.push_list[h][0]);g.find("tr[data-pushid="+a.push_list[h][0]+"]").html($("").html($("").addClass("red").text("Stopping..")))}mist.send(function(){c.text("Stop pushes");b(f)},{push_stop:f,push_settings:{wait:0}})}}))}return $("").attr("data-pushid",e[0]).append($("").text(e[1])).append($(" ").append(h.children())).append(i)}D.html(UI.buildUI([{type:"help",
-help:"You can push streams to files or other servers, allowing them to broadcast your stream as well."}]));var d=a.push_settings;d||(d={});var g=$("").append($("").append($("").text("Stream")).append($(" ").text("Target")).append($(" "))),e=g.clone();if("push_list"in a)for(var f in a.push_list)g.append(c(a.push_list[f],"Manual"));if("push_auto_list"in a)for(f in a.push_auto_list){var h=a.push_auto_list[f].slice();h.unshift(-1);e.append(c(h,"Automatic"))}D.append($("").text("Automatic pushes")).append(UI.buildUI([{label:"Delay before retry",
+false;if("push_list"in c&&c.push_list&&c.push_list.length){var d=true,g;for(g in c.push_list)if(a.indexOf(c.push_list[g][0])>-1){d=false;break}}else d=true;if(d)for(g in a)e.find("tr[data-pushid="+a[g]+"]").remove();else b()},{push_list:1})},1E3)}function c(g,f){var h=$("");if(f=="Automatic"&&g.length>=4){h.append($("").text(g[2]));g[3]&&h.append($("").text(", schedule on "+(new Date(g[3]*1E3)).toLocaleString()));g.length>=5&&g[4]&&h.append($("").text(", complete on "+(new Date(g[4]*
+1E3)).toLocaleString()))}else g.length>=4&&g[2]!=g[3]?h.append($("").text(g[2])).append($("").html("»").addClass("unit").css("margin","0 0.5em")).append($("").text(g[3])):h.append($("").text(g[2]));var i=$(" ").append($("").text(f=="Automatic"?"Remove":"Stop").click(function(){if(confirm("Are you sure you want to "+$(this).text().toLowerCase()+" this push?\n"+g[1]+" to "+g[2])){var a=$(this).closest("tr");a.html($("").html($("").addClass("red").text(f==
+"Automatic"?"Removing..":"Stopping..")));if(f=="Automatic"){var c=g.slice(1);mist.send(function(){a.remove()},{push_auto_remove:[c]})}else mist.send(function(){b([g[0]])},{push_stop:[g[0]]})}}));if(f=="Automatic"){i.prepend($("").text("Edit").click(function(){UI.navto("Start Push","auto_"+($(this).closest("tr").index()-1))}));i.append($("").text("Stop pushes").click(function(){if(confirm('Are you sure you want to stop all pushes matching \n"'+g[1]+" to "+g[2]+'"?'+(d.wait!=0?"\n\nRetrying is enabled. You'll probably want to set that to 0.":
+""))){var c=$(this);c.text("Stopping pushes..");var f=[],h;for(h in a.push_list)if(g[1]==a.push_list[h][1]&&g[2]==a.push_list[h][2]){f.push(a.push_list[h][0]);e.find("tr[data-pushid="+a.push_list[h][0]+"]").html($("").html($("").addClass("red").text("Stopping..")))}mist.send(function(){c.text("Stop pushes");b(f)},{push_stop:f,push_settings:{wait:0}})}}))}return $("").attr("data-pushid",g[0]).append($("").text(g[1])).append($(" ").append(h.children())).append(i)}D.html(UI.buildUI([{type:"help",
+help:"You can push streams to files or other servers, allowing them to broadcast your stream as well."}]));var d=a.push_settings;d||(d={});var e=$("").append($("").append($("").text("Stream")).append($(" ").text("Target")).append($(" "))),g=e.clone();if("push_list"in a)for(var f in a.push_list)e.append(c(a.push_list[f],"Manual"));if("push_auto_list"in a)for(f in a.push_auto_list){var h=a.push_auto_list[f].slice();h.unshift(-1);g.append(c(h,"Automatic"))}D.append($("").text("Automatic pushes")).append(UI.buildUI([{label:"Delay before retry",
unit:"s",type:"int",min:0,help:"How long the delay should be before MistServer retries an automatic push. If set to 0, it does not retry.","default":0,pointer:{main:d,index:"wait"},LTSonly:1},{label:"Maximum retries",unit:"/s",type:"int",min:0,help:"The maximum amount of retries per second (for all automatic pushes). If set to 0, there is no limit.","default":0,pointer:{main:d,index:"maxspeed"},LTSonly:1},{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){mist.send(function(){UI.navto("Push")},
-{push_settings:d})}}]}])).append($("").text("Add an automatic push").click(function(){UI.navto("Start Push","auto")}));e.find("tr").length==1?D.append($("").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):D.append(e);D.append($("
").text("Pushes")).append($("").text("Start a push").click(function(){UI.navto("Start Push")}));if(g.find("tr").length==1)D.append($("").text("No pushes are active.").addClass("text").css("margin-top",
-"0.5em"));else{var e=[],h=[],i=$("
").css("margin-left","0.5em").append($("").text("Any stream").val("")),j=$("").css("margin-left","0.5em").append($("").text("Any target").val(""));for(f in a.push_list){e.indexOf(a.push_list[f][1])==-1&&e.push(a.push_list[f][1]);h.indexOf(a.push_list[f][2])==-1&&h.push(a.push_list[f][2])}e.sort();h.sort();for(f in e)i.append($(" ").text(e[f]));for(f in h)j.append($(" ").text(h[f]));D.append($("").text("Stop all pushes").click(function(){var c=
-[],d;for(d in a.push_list)c.push(a.push_list[d][0]);if(c.length!=0&&confirm("Are you sure you want to stop all pushes?")){mist.send(function(){b(c)},{push_stop:c});g.find("tr:not(:first-child)").html($("").append($("").addClass("red").text("Stopping..")));$(this).remove()}})).append($("").css("margin-left","1em").append($("").text("Stop all pushes that match: ").css("font-size","0.9em")).append(i).append($("").css("margin-left","0.5em").text("and").css("font-size",
-"0.9em")).append(j).append($("").css("margin-left","0.5em").text("Apply").click(function(){var c=i.val(),d=j.val();if(c==""&&d=="")return alert("Looks like you want to stop all pushes. Maybe you should use that button?");var e={},f;for(f in a.push_list)if((c==""||a.push_list[f][1]==c)&&(d==""||a.push_list[f][2]==d))e[a.push_list[f][0]]=a.push_list[f];if(Object.keys(e).length==0)return alert("No matching pushes.");c="Are you sure you want to stop these pushes?\n\n";for(f in e)c=c+(e[f][1]+
-" to "+e[f][2]+"\n");if(confirm(c)){e=Object.keys(e);mist.send(function(){b(e)},{push_stop:e});for(f in e)g.find("tr[data-pushid="+e[f]+"]").html($("").html($("").addClass("red").text("Stopping..")))}}))).append(g)}},{push_settings:1,push_list:1,push_auto_list:1});break;case "Start Push":if(!("capabilities"in mist.data)){d.append("Loading Mist capabilities..");mist.send(function(){UI.navto("Start Push",c)},{capabilities:1});return}var v,S=function(a){var b=false,e=c.split("_");
-c=e[0];e.length==2&&(b=e[1]);if(b!==false&&typeof a=="undefined")mist.send(function(a){S(a.push_auto_list[b])},{push_auto_list:1});else{var g=[],f;for(f in mist.data.capabilities.connectors){e=mist.data.capabilities.connectors[f];"push_urls"in e&&(g=g.concat(e.push_urls))}c=="auto"&&d.find("h2").text("Add automatic push");var h={};if(c=="auto"&&typeof a!="undefined"){h={stream:a[0],target:a[1]};if(a.length>=3)h.scheduletime=a[2];if(a.length>=4)h.completetime=a[3];if(h.target.indexOf("recstartunix=")>
+{push_settings:d})}}]}])).append($("").text("Add an automatic push").click(function(){UI.navto("Start Push","auto")}));g.find("tr").length==1?D.append($("").text("No automatic pushes have been configured.").addClass("text").css("margin-top","0.5em")):D.append(g);D.append($("
").text("Pushes")).append($("").text("Start a push").click(function(){UI.navto("Start Push")}));if(e.find("tr").length==1)D.append($("").text("No pushes are active.").addClass("text").css("margin-top",
+"0.5em"));else{var g=[],h=[],i=$("
").css("margin-left","0.5em").append($("").text("Any stream").val("")),j=$("").css("margin-left","0.5em").append($("").text("Any target").val(""));for(f in a.push_list){g.indexOf(a.push_list[f][1])==-1&&g.push(a.push_list[f][1]);h.indexOf(a.push_list[f][2])==-1&&h.push(a.push_list[f][2])}g.sort();h.sort();for(f in g)i.append($(" ").text(g[f]));for(f in h)j.append($(" ").text(h[f]));D.append($("").text("Stop all pushes").click(function(){var c=
+[],d;for(d in a.push_list)c.push(a.push_list[d][0]);if(c.length!=0&&confirm("Are you sure you want to stop all pushes?")){mist.send(function(){b(c)},{push_stop:c});e.find("tr:not(:first-child)").html($("").append($("").addClass("red").text("Stopping..")));$(this).remove()}})).append($("").css("margin-left","1em").append($("").text("Stop all pushes that match: ").css("font-size","0.9em")).append(i).append($("").css("margin-left","0.5em").text("and").css("font-size",
+"0.9em")).append(j).append($("").css("margin-left","0.5em").text("Apply").click(function(){var c=i.val(),d=j.val();if(c==""&&d=="")return alert("Looks like you want to stop all pushes. Maybe you should use that button?");var g={},f;for(f in a.push_list)if((c==""||a.push_list[f][1]==c)&&(d==""||a.push_list[f][2]==d))g[a.push_list[f][0]]=a.push_list[f];if(Object.keys(g).length==0)return alert("No matching pushes.");c="Are you sure you want to stop these pushes?\n\n";for(f in g)c=c+(g[f][1]+
+" to "+g[f][2]+"\n");if(confirm(c)){g=Object.keys(g);mist.send(function(){b(g)},{push_stop:g});for(f in g)e.find("tr[data-pushid="+g[f]+"]").html($("").html($("").addClass("red").text("Stopping..")))}}))).append(e)}},{push_settings:1,push_list:1,push_auto_list:1});break;case "Start Push":if(!("capabilities"in mist.data)){d.append("Loading Mist capabilities..");mist.send(function(){UI.navto("Start Push",c)},{capabilities:1});return}var v,S=function(a){var b=false,g=c.split("_");
+c=g[0];g.length==2&&(b=g[1]);if(b!==false&&typeof a=="undefined")mist.send(function(a){S(a.push_auto_list[b])},{push_auto_list:1});else{var e=[],f;for(f in mist.data.capabilities.connectors){g=mist.data.capabilities.connectors[f];"push_urls"in g&&(e=e.concat(g.push_urls))}c=="auto"&&d.find("h2").text("Add automatic push");var h={};if(c=="auto"&&typeof a!="undefined"){h={stream:a[0],target:a[1]};if(a.length>=3)h.scheduletime=a[2];if(a.length>=4)h.completetime=a[3];if(h.target.indexOf("recstartunix=")>
-1){f=h.target.split("recstartunix=")[1];h.recstartunix=f.split("&")[0];h.target=h.target.replace("recstartunix="+h.recstartunix,"").replace("?&","?").replace("&&","&");if(h.target[h.target.length-1]=="?")h.target=h.target.slice(0,-1)}}f=[{label:"Stream name",type:"str",help:"This may either be a full stream name, a partial wildcard stream name, or a full wildcard stream name. For example, given the stream a you can use: a : the stream configured as a a+ : all streams configured as a with a wildcard behind it, but not a itself a+b : only the version of stream a that has wildcard b ",
-pointer:{main:h,index:"stream"},validate:["required",function(a){a=a.split("+");a=a[0];return a in mist.data.streams?false:{msg:"'"+a+"' is not a stream name.",classes:["orange"],"break":false}}],datalist:v,LTSonly:1},{label:"Target",type:"str",help:"Where the stream will be pushed to. Valid formats: Valid text replacements: $stream - inserts the stream name used to push to MistServer $day - inserts the current day number $month - inserts the current month number $year - inserts the current year number $hour - inserts the hour timestamp when stream was received $minute - inserts the minute timestamp the stream was received $seconds - inserts the seconds timestamp when the stream was received $datetime - inserts $year.$month.$day.$hour.$minute.$seconds timestamp when the stream was received Valid URL parameters: recstart=123 - media timestamp in milisseconds where the push should start recstop=456 - media timestamp in miliseconds where the push should stop recstartunix=150000000 - unix time in seconds where the push should start. This will override the recstart parameter. recstopunix=150000000 - unix time in seconds where the push should stop. This will override the recstop parameter. ",
-pointer:{main:h,index:"target"},validate:["required",function(a){for(var b in g)if(mist.inputMatch(g[b],a))return false;return{msg:"Does not match a valid target. Valid formats:",classes:["red"]}}],LTSonly:1}];c=="auto"&&f.push($("").text("Optional parameters"),{type:"unix",label:"Schedule time",min:0,help:"The time where the push will become active. The default is to start immediately.",pointer:{main:h,index:"scheduletime"}},{type:"unix",label:"Recording start time",
+pointer:{main:h,index:"stream"},validate:["required",function(a){a=a.split("+");a=a[0];return a in mist.data.streams?false:{msg:"'"+a+"' is not a stream name.",classes:["orange"],"break":false}}],datalist:v,LTSonly:1},{label:"Target",type:"str",help:"Where the stream will be pushed to. Valid formats: Valid text replacements: $stream - inserts the stream name used to push to MistServer $day - inserts the current day number $month - inserts the current month number $year - inserts the current year number $hour - inserts the hour timestamp when stream was received $minute - inserts the minute timestamp the stream was received $seconds - inserts the seconds timestamp when the stream was received $datetime - inserts $year.$month.$day.$hour.$minute.$seconds timestamp when the stream was received Valid URL parameters: recstart=123 - media timestamp in milisseconds where the push should start recstop=456 - media timestamp in miliseconds where the push should stop recstartunix=150000000 - unix time in seconds where the push should start. This will override the recstart parameter. recstopunix=150000000 - unix time in seconds where the push should stop. This will override the recstop parameter. ",
+pointer:{main:h,index:"target"},validate:["required",function(a){for(var b in e)if(mist.inputMatch(e[b],a))return false;return{msg:"Does not match a valid target. Valid formats:",classes:["red"]}}],LTSonly:1}];c=="auto"&&f.push($("").text("Optional parameters"),{type:"unix",label:"Schedule time",min:0,help:"The time where the push will become active. The default is to start immediately.",pointer:{main:h,index:"scheduletime"}},{type:"unix",label:"Recording start time",
min:0,help:"Where in the media buffer the recording will start. Defaults to the most recently received keyframe. Only makes sense for live streams.",pointer:{main:h,index:"recstartunix"}},{type:"unix",label:"Complete time",min:0,help:"The time where the push will stop. Defaults to never stop automatically. Only makes sense for live streams.",pointer:{main:h,index:"completetime"}});f.push({type:"buttons",buttons:[{type:"cancel",label:"Cancel","function":function(){UI.navto("Push")}},{type:"save",
-label:"Save","function":function(){var b={};h.recstartunix?b.recstartunix="recstartunix="+h.recstartunix:h.scheduletime&&(b.recstartunix="recstartunix="+h.scheduletime);delete h.recstartunix;if(Object.keys(b).length){var d="?",e=h.target.split("?");if(e.length>1){var d="&",e=e[e.length-1],e=e.split("&"),g;for(g in e){var f=e[g].split("=")[0];f in b&&delete b[f]}}if(Object.keys(b).length){d=d+Object.values(b).join("&");h.target=h.target+d}}b={};b[c=="auto"?"push_auto_add":"push_start"]=h;if(typeof a!=
-"undefined"&&(a[0]!=h.stream||a[1]!=h.target))b.push_auto_remove=[a];mist.send(function(){UI.navto("Push")},b)}}]});d.append(UI.buildUI(f))}};mist.data.LTS?mist.send(function(a){(v=a.active_streams)||(v=[]);var a=[],b;for(b in v)v[b].indexOf("+")!=-1&&a.push(v[b].replace(/\+.*/,"")+"+");v=v.concat(a);var c=0,d=0;for(b in mist.data.streams){v.push(b);if(mist.inputMatch(UI.findInput("Folder").source_match,mist.data.streams[b].source)){v.push(b+"+");mist.send(function(a,b){var e=b.stream,g;for(g in a.browse.files)for(var f in mist.data.capabilities.inputs)f.indexOf("Buffer")>=
-0||(f.indexOf("Folder")>=0||f.indexOf("Buffer.exe")>=0||f.indexOf("Folder.exe")>=0)||mist.inputMatch(mist.data.capabilities.inputs[f].source_match,"/"+a.browse.files[g])&&v.push(e+"+"+a.browse.files[g]);d++;if(c==d){v=v.filter(function(a,b,c){return c.lastIndexOf(a)===b}).sort();S()}},{browse:mist.data.streams[b].source},{stream:b});c++}}if(c==d){v=v.filter(function(a,b,c){return c.lastIndexOf(a)===b}).sort();S()}},{active_streams:1}):(v=Object.keys(mist.data.streams),S());break;case "Triggers":if(!("triggers"in
+label:"Save","function":function(){var b={};h.recstartunix?b.recstartunix="recstartunix="+h.recstartunix:h.scheduletime&&(b.recstartunix="recstartunix="+h.scheduletime);delete h.recstartunix;if(Object.keys(b).length){var d="?",g=h.target.split("?");if(g.length>1){var d="&",g=g[g.length-1],g=g.split("&"),e;for(e in g){var f=g[e].split("=")[0];f in b&&delete b[f]}}if(Object.keys(b).length){d=d+Object.values(b).join("&");h.target=h.target+d}}b={};b[c=="auto"?"push_auto_add":"push_start"]=h;if(typeof a!=
+"undefined"&&(a[0]!=h.stream||a[1]!=h.target))b.push_auto_remove=[a];mist.send(function(){UI.navto("Push")},b)}}]});d.append(UI.buildUI(f))}};mist.data.LTS?mist.send(function(a){(v=a.active_streams)||(v=[]);var a=[],b;for(b in v)v[b].indexOf("+")!=-1&&a.push(v[b].replace(/\+.*/,"")+"+");v=v.concat(a);var c=0,d=0;for(b in mist.data.streams){v.push(b);if(mist.inputMatch(UI.findInput("Folder").source_match,mist.data.streams[b].source)){v.push(b+"+");mist.send(function(a,b){var g=b.stream,e;for(e in a.browse.files)for(var f in mist.data.capabilities.inputs)f.indexOf("Buffer")>=
+0||(f.indexOf("Folder")>=0||f.indexOf("Buffer.exe")>=0||f.indexOf("Folder.exe")>=0)||mist.inputMatch(mist.data.capabilities.inputs[f].source_match,"/"+a.browse.files[e])&&v.push(g+"+"+a.browse.files[e]);d++;if(c==d){v=v.filter(function(a,b,c){return c.lastIndexOf(a)===b}).sort();S()}},{browse:mist.data.streams[b].source},{stream:b});c++}}if(c==d){v=v.filter(function(a,b,c){return c.lastIndexOf(a)===b}).sort();S()}},{active_streams:1}):(v=Object.keys(mist.data.streams),S());break;case "Triggers":if(!("triggers"in
mist.data.config)||!mist.data.config.triggers)mist.data.config.triggers={};A=$("");b=$("