",{value:n.Id,text:n.Name}))})},!1,!0,!1,!1,!0);$.ajax("/api/sharedconnection/list",{type:"GET"}).done(function(n){var t=GetOctoApiResponse(n);t.Status==200&&(t.Result.SharedConnections.forEach(n=>{u(n,!1,!1)}),t.Result.SharedConnections.length==0?$("#sharedConnectionsHolder").attr("style","display: inline !important"):$("#noSharedConnectionsHolder").attr("style","display: none !important"))}).fail(function(t){var i=GetOctoApiResponse(t);n(i.Error)}).always(function(){$("#mainUi").slideDown();t()})}function e(n){var i=Math.floor((n-new Date)/1e3),t=Math.floor(i/31536e3);return t>=1?t==1?t+" year":t+" years":(t=Math.floor(i/2592e3),t>=1)?t==1?t+" month":t+" months":(t=Math.floor(i/86400),t>=1)?t==1?t+" day":t+" days":(t=Math.floor(i/3600),t>=1)?t==1?t+" hour":t+" hours":(t=Math.floor(i/60),t>=1)?t==1?t+" minute":t+" minutes":(t=Math.floor(i),t==1)?t+" second":t+" seconds"}function o(n){return n.AppId!==undefined&&n.AppId!==null&&n.AppId.length>0}var r=0;function u(t,u,f){var a=t.Id,s=r;r++;var c=`Printer: ${t.PrinterName}`;if(t.Expiration!=null){var l=Date.parse(t.Expiration);c+=Math.floor((l-new Date)/1e3)<0?" - Expired<\/span>":" - Expires in "+e(l)}var v=t.Url,y=f?"display:none !important":"",p=u?"":"display:none",h=o(t),w=h?"display:none !important":"",b=h?"sharedConnectionRevokeEndButton":"",k=h?`${MapAppIdToUiTextName(t.AppId)}'s App Connection`:t.Name;$("#sharedConnectionsHolder").append(`
`);$(`#sharedConnectionShowUrlButton${s}`).click(function(){$(`#sharedConnectionUrl${s}`).slideToggle()});$(`#sharedConnectionUrl${s}`).click(function(){SelectText(`sharedConnectionUrl${s}`)});$(`#sharedConnectionRevokButton${s}`).click(function(){var t=confirm("Are you sure you revoke this shared connection?");if(t==!0){i();var r={Id:a};$.ajax("/api/sharedconnection/revoke",{data:JSON.stringify(r),contentType:"application/json",type:"POST"}).done(function(n){var t=GetOctoApiResponse(n);t.Status!=200&&location.reload();$(`#sharedConnection${s}`).slideUp(400,function(){$(`#sharedConnection${s}`).remove()})}).fail(function(t){var i=GetOctoApiResponse(t);n("Failed to revoke: "+i.Error)})}});f&&$(`#sharedConnection${s}`).slideDown()}})