text: /*! Known 2018-12-02 */
  "use strict";function addMessage(a,b){Template.addMessage(a)}function addErrorMessage(a){Template.addErrorMessage(a)}function bindControls(){Template.bindControls()}function contentCreateForm(a,b){Template.initContentCreateForm(a,b)}function hideContentCreateForm(){Template.hideContentCreateForm()}function autoSave(a,b,c){return Template.autoSave(a,b,c)}function annotateContent(){$(".h-entry").fitVids(),$("time.dt-published").timeago()}var Template=Template||{};Template.addMessage=function(a,b){void 0===b&&(b="alert-info"),void 0!==a&&$("div#page-messages").append('<div class="alert '+b+' col-md-10 col-md-offset-1"><button type="button" class="close" data-dismiss="alert">&times;</button>'+a+"</div>")},Template.addErrorMessage=function(a){Template.addMessage(a,"alert-danger")},Template.activateStarToggle=function(){$(".interactions .annotate-icon a.stars-toggle").each(function(){var a=$(this).attr("data-form-id"),b=$(this).find("i.fa"),c=b.closest("span.annotate-icon").find("a.stars");$("#"+a).submit(function(a){a.preventDefault(),$.ajax({type:"POST",url:$(this).attr("action"),data:$(this).serialize(),success:function(a){b.hasClass("fa-star")&&b.hasClass("far")?b.removeClass("far").addClass("fas"):b.removeClass("fas").addClass("far"),c.text(a.text)}})})})},Template.enableFormCandy=function(){$(".ctrl-enter-submit").keypress(function(a){var b=a.which?a.which:a.keyCode;10!=b&&13!=b||!a.ctrlKey||$(this).closest("form").submit()})},Template.enablePagination=function(){$(".pager-xhr a").click(function(a){a.preventDefault();var b=$(this).closest(".pager-xhr"),c=parseInt(b.attr("data-offset")),d=parseInt(b.attr("data-limit")),e=parseInt(b.attr("data-count")),f=$("#"+b.attr("data-control-id")),g=b.attr("data-source-url"),h=$(this).attr("rel"),i=$(this).closest(".pager-xhr").find("li.newer"),j=$(this).closest(".pager-xhr").find("li.older");g=g.split("?")[0];var k;"next"==h?(k=c-d)<0&&(k=0):(k=c+d)>e-1&&(k=e-1),g=g+"?offset="+k.toString()+"&limit="+d.toString(),f.load(g,function(a,c,g){"error"!=c&&(b.attr("data-offset",k.toString()),i.removeClass("pagination-disabled"),j.removeClass("pagination-disabled"),0==k&&i.addClass("pagination-disabled"),k>e-d&&j.addClass("pagination-disabled"),f.scrollTop(0))})})},Template.enableRichTextRequired=function(){$("textarea.validation-required").each(function(){var a=$(this).closest("form"),b=$(this),c=$(this).closest("div.richtext-container").find("div.alert");a.submit(function(a){c.hide(),0==b.val().length&&(a.preventDefault(),console.error("Required richtext field "+b.attr("name")+" is blank, preventing form submission"),c.show().focus())})})},Template.enableImageFallback=function(){$("img").on("error",function(){console.error("Loading fallback image "+known.config.displayUrl+"gfx/users/default.png"),$(this).attr("src",known.config.displayUrl+"gfx/users/default.png")})},Template.activateImagePreview=function(a){var b=$(a).closest("div.image-file-input").find("div.photo-preview"),c=$(a).closest("div.image-file-input").find("span.photo-filename"),d=$(a).closest("div.image-file-input").find(".preview");if(a.files&&a.files[0]){var e=new FileReader;e.onload=function(a){c.html(c.attr("data-nexttext"));try{var e=EXIF.readFromBinaryFile(base64ToArrayBuffer(this.result));ImageTools.exifRotateImg("#"+d.attr("id"),e.Orientation,"#"+b.attr("id"))}catch(a){console.error(a)}d.attr("src",a.target.result),d.show()},e.readAsDataURL(a.files[0])}},Template.autoSave=function(a,b,c){var d={};setInterval(function(){for(var e={},f=0;f<b.length;f++){var g=b[f],h="#"+g;c&&g in c&&(h=c[g]);var i=!1;$(h).val()!=d[g]&&(i=$(h).val()),!1!==i&&(e[g]=i,d[g]=i)}Object.keys(e).length>0&&$.post(wwwroot()+"autosave/",{context:a,elements:e,names:b},function(){})},1e4)},Template.isCreateFormVisible=!1,Template.bindControls=function(){$(".acl-ctrl-option").click(function(){$("#access-control-id").val($(this).attr("data-acl")),$("#acl-text").html($(this).html())}),$(".syndication-toggle input[type=checkbox]").bootstrapToggle(),$(".ignore-this").hide(),Security.activateACLControls(),Template.enableFormCandy(),Template.enableRichTextRequired(),$("#contentCreate .form-control").first().focus()},Template.initContentCreateForm=function(a,b){Template.isCreateFormVisible||(Template.isCreateFormVisible=!0,$.ajax(b,{dataType:"html",success:function(b){$("#contentCreate").html(b).slideDown(400),$("#contentTypeButtonBar").slideUp(400),window.contentCreateType=a,window.contentPage=!0,bindControls()},error:function(a){$("#contentTypeButtonBar").slideDown(400),Template.isCreateFormVisible=!1}}))},Template.hideContentCreateForm=function(){Template.isCreateFormVisible=!1,1==window.contentPage?($("#contentTypeButtonBar").slideDown(200),$("#contentCreate").slideUp(200)):window.history.length>1&&window.history.back()},function(a,b,c){if(c in b&&b[c]){var d,e=a.location,f=/^(a|html)$/i;a.addEventListener("click",function(a){for(d=a.target;!f.test(d.nodeName);)d=d.parentNode;"href"in d&&(d.href.indexOf("http")||~d.href.indexOf(e.host))&&!d.classList.contains("contentTypeButton")&&(a.preventDefault(),e.href=d.href)},!1)}}(document,window.navigator,"standalone"),$(document).ready(function(){$("body").on("click",function(a,b){var c=a.target;c.href&&-1===c.href.indexOf(window.location.origin)&&(c.target="_blank")})}),$(document).ready(function(){$.timeago.settings.cutoff=2592e6,annotateContent(),Template.enableFormCandy(),Template.enablePagination(),Template.enableRichTextRequired(),Template.enableImageFallback(),Template.activateStarToggle()});