text: var Conversation=function(){function d(){try{if(void 0!=c&&"jid"in c&&"slides"in c){var a=0,b=_.map($(".slideId"),function(b){var e=parseInt($(b).text());b=_.find(c.slides,function(b){return b.id==e?!0:!1});"groupSets"in b||(b.groupSets=[]);b.index=a;a+=1;return b});reorderSlidesOfCurrentConversation(c.jid.toString(),b);g=!1;f()}}catch(v){console.log("exception while reordering slides",v)}}var p=!0,c={},h=[],q="",r={},l={},t={},m={},u={},g=!1,n=function(){g?r.show():r.hide();_.forEach($(".slideContainer"),
  function(a){var b=$(a),c=$(b).next(".slideContainer"),e=$(b).prev(".slideContainer");a=b.find(".moveSlideBack");var d=b.find(".moveSlideForward");a.unbind("click");d.unbind("click");0==c.length?d.hide():(d.show(),d.on("click",function(){g=!0;b.detach();c.after(b);n()}));0==e.length?a.hide():(a.show(),a.on("click",function(){g=!0;b.detach();e.before(b);n()}))})},f=function(){p?($(".backToConversations").show(),$(".joinConversation").show()):($(".backToConversations").hide(),$(".joinConversation").hide());
  m.html(_.map(_.sortBy(c.slides,"index"),function(b){var a=u.clone();a.find(".slideId").text(b.id);a.find(".slideIndex").text(b.index);var d=sprintf("exposeSlide_%s",b.id);a.find(".slideExposedCheckbox").attr("id",d).on("click",function(a){a=$(this).prop("checked");b.exposed=a;_.some(c.slides,function(a){return a.exposed})?changeExposureOfSlide(c.jid.toString(),b.id,a):($.jAlert({type:"error",title:"Last slide hidden",content:"At least one slide must be visible.  Re-exposing this slide."}),b.exposed=
  !0,f())}).prop("checked",b.exposed);a.find(".slideExposedCheckboxLabel").attr("for",d).text(b.exposed?"Visible":"Hidden");if(p)a.find(".slideAnchor").attr("href",sprintf("board?conversationJid=%s&slideId=%s&unique=true",c.jid.toString(),b.id.toString())).find(".slideThumbnail").attr("src",sprintf("/thumbnail/%s",b.id));else{var d=a.find(".slideAnchorContainer"),g=d.find(".slideThumbnail").clone().attr("src",sprintf("/thumbnail/%s",b.id));d.empty();d.append(g)}a.find(".addSlideBeforeButton").on("click",
  function(){addSlideToConversationAtIndex(c.jid.toString(),b.index);f()});a.find(".duplicateSlideButton").on("click",function(){duplicateSlideById(c.jid.toString(),b.id);f()});a.find(".addSlideAfterButton").on("click",function(){addSlideToConversationAtIndex(c.jid.toString(),b.index+1);f()});return a}));$("#sortableRoot").sortable({handle:".slideDragHandle",stop:function(a,c){g=!0;n()}}).disableSelection();"deleted"==c.subject?($("#unarchiveChallenge").show(),$("#archiveChallenge").hide(),$("#sharingContainer").hide()):
  ($("#unarchiveChallenge").hide(),$("#archiveChallenge").show(),$("#sharingContainer").show());$(".conversationJid").text(c.jid);$(".conversationAuthor").text(c.author);$(".conversationCreated").text((new Date(c.creation)).toString());$(".conversationLastModified").text((new Date(c.lastAccessed)).toString());$("#conversationTitleInput").val(c.title);$(".joinConversation").attr("href",sprintf("/board?conversationJid=%s&unique=true",c.jid));console.log("usergroups",h);var a={ouType:"special",name:c.subject};
  "foreignRelationship"in c&&(a.foreignRelationship=c.foreignRelationship);l.html(_.map(_.groupBy(_.uniqBy(_.concat(h,[a]),function(a){return"foreignRelationship"in a&&"key"in a.foreignRelationship?sprintf("%s (%s)",a.name,a.foreignRelationship.key):a.name}),function(a){return a.ouType}),function(a){var d=t.clone();d.find(".conversationSharingChoiceContainer").clone();var e=d.find(".conversationSharingChoiceContainer");d.find(".conversationSharingCategory").text(a[0].ouType);var g=e.find(".conversationSharingChoice").clone();
  e.html(_.map(a,function(a){var b=_.uniqueId(),d=g.clone();d.find(".conversationSharingChoiceInputElement").attr("id",b).attr("type","radio").on("click",function(){"foreignRelationship"in a?changeSubjectOfConversation(c.jid.toString(),a.name,a.foreignRelationship.system,a.foreignRelationship.key):changeSubjectOfConversation(c.jid.toString(),a.name,void 0,void 0);f()}).prop("checked","foreignRelationship"in a&&"foreignRelationship"in c?c.foreignRelationship.key==a.foreignRelationship.key:c.subject==
  a.name);var e=a.name;"foreignRelationship"in a&&"displayName"in a.foreignRelationship?e=sprintf("%s (%s)",a.name,a.foreignRelationship.displayName):"foreignRelationship"in a&&"key"in a.foreignRelationship&&(e=sprintf("%s (%s)",a.name,a.foreignRelationship.key));d.find(".conversationSharingChoiceLabel").attr("for",b).text(e);return d}));var h=!1,k=d.find(".conversationSharingCollapser").addClass(a[0].ouType);k.on("click",function(){e.toggle();(h=!h)?(k.addClass("fa-toggle-right"),k.removeClass("fa-toggle-down")):
  (k.addClass("fa-toggle-down"),k.removeClass("fa-toggle-right"))});_.some(a,function(a){return a.name==c.subject})?(h=!0,e.show(),k.addClass("fa-toggle-right"),k.removeClass("fa-toggle-down")):(h=!1,e.hide(),k.addClass("fa-toggle-down"),k.removeClass("fa-toggle-right"));return d}));n()};$(function(){r=$("#reorderInProgress");l=$(".conversationSharing");t=l.find(".conversationSharingCategoryContainer").clone();l.empty();m=$("#sortableRoot");u=m.find(".slideContainer").clone();m.empty();$("#reorderSlides").on("click",
  function(){d()});$("#cancelReorderSlides").on("click",function(){g=!1;f()});$(".backToConversations").attr("href","/conversationSearch");$("#conversationTitleInput").on("blur",function(){var a=$(this).val();renameConversation(c.jid.toString(),a)}).keyup(function(a){13==a.which&&(a.preventDefault(),a=$(this).val(),renameConversation(c.jid.toString(),a))});$("#archiveChallenge").on("click",function(){$.jAlert({type:"confirm",confirmQuestion:"Are you sure you want to archive this conversation?  It will not be available in the application.  Participants' content will become unavailable.",
  confirmBtnText:"Archive",onConfirm:function(a,b){a.preventDefault();deleteConversation(c.jid.toString());window.location.href="/conversationSearch"},denyBtnText:"Cancel",onDeny:function(a,b){a.preventDefault()}})});$("#unarchiveChallenge").on("click",function(){$.jAlert({type:"confirm",confirmQuestion:"Are you sure you want to unarchive this conversation?  It will be unarchived, but set to share only with you.  If you wish to share this conversation with other participants, remember to change the sharing to an appropriate level.",
  confirmBtnText:"Unarchive",onConfirm:function(a,b){a.preventDefault();changeSubjectOfConversation(c.jid.toString(),q)},denyBtnText:"Cancel",onDeny:function(a,b){a.preventDefault()}})});$("#duplicateChallenge").on("click",function(){$.jAlert({type:"confirm",confirmQuestion:"Are you sure you want to duplicate this conversation?  Only your content will be duplicated.  Content from other participants will not be duplicated.",confirmBtnText:"Duplicate",onConfirm:function(a,b){a.preventDefault();duplicateConversation(c.jid.toString())},
  denyBtnText:"Cancel",onDeny:function(a,b){a.preventDefault()}})});f()});return{receiveUserGroups:function(a){h=a;f()},receiveUsername:function(a){q=a},receiveConversationDetails:function(a){c=a;f()},getConversationDetails:function(){return c},getUsername:function(){return q},getUserGroups:function(){return h},setLinkVisibility:function(a){p=a;f()}}}();function augmentArguments(d){d[_.size(d)]=(new Date).getTime();return d}function serverResponse(d){}
  function receiveUsername(d){Conversation.receiveUsername(d)}function receiveUserGroups(d){Conversation.receiveUserGroups(d)}function receiveConversationDetails(d){Conversation.receiveConversationDetails(d)}function receiveNewConversationDetails(d){console.log("new conversation received")}function receiveShowLinks(d){console.log("receivedShowLinks:",d);Conversation.setLinkVisibility(d)};
  