1function merge(t,e){for(attrname in e)t[attrname]=e[attrname];return t}function ReadspeakerSkipper(){this.cont_obj1=".full-description",this.cont_obj2=".truncated-description"}function fetchApiToken(t,e){return $.ajax({url:"/api/v2/tokens",type:"POST",dataType:"json",data:{data:{attributes:{password:e,login:t}}},success:function(t){localStorage.setItem("UNEXPECTED-THUNDER",t.data.attributes.token)}})}function removeApiToken(){localStorage.removeItem("UNEXPECTED-THUNDER")}var Utility;(function(){window.EHQ||(window.EHQ={}),window.EHQ.surveys={};var t=$("#env-data");t.length&&(window.ENV=window.ENV||{},window.ENV.isProduction=t.data("is-production"),window.ENV.isDevelopment=t.data("is-development")),window.EHQ.setup_survey_questions=function(){return window.EHQ.surveys.setupRegionQuestion(),window.EHQ.initialize_datepicker()},window.EHQ.initialize_datepicker=function(){if(!0===$(".js-show-year-only").data("datepicker-upgrade"))$("input.date_picker").each(function(){var t=$(this).closest(".field_container")[0],e=$(t).find(".js-show-year-only")[0];if("true"===$(e).val()){$(this).datepicker({changeYear:!0,yearRange:"-100:+50",showOn:"button",buttonText:"<i class='fa fa-calendar'></i>",dateFormat:"yy",showButtonPanel:!0,onChangeMonthYear:function(t){$(this).datepicker("setDate",new Date(t,0,1))}});var i=$(t).find(".fa-calendar")[0];$(i).addClass("year-only");var n=$(t).find(".ui-datepicker-trigger")[0];$(n).addClass("year-only");var o=$(t).find(".date_picker")[0];$(o).addClass("year-input"),triggerYearPicker()}else{$(this).datepicker({yearRange:"-100:+50",showOn:"button",buttonText:"<i class='fa fa-calendar'></i>",showButtonPanel:!0,dateFormat:window.dateTime||"dd/mm/yy",closeText:"Close",onSelect:function(){$(this).data("datepicker").inline=!0;var t=$(this);setTimeout(function(){$(".ui-datepicker-buttonpane").append('<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" data-handler="hide" data-event="click">Close</button>'),$(t).data("datepicker").inline=!1,$("#ui-datepicker-div").on("click",".ui-datepicker-close",function(){$("#ui-datepicker-div").hide()})},0)},onClose:function(){$(this).focus()}});o=$(t).find(".date_picker")[0];$(o).addClass("date-input"),triggerDatePicker()}});else if($("input.date_picker").length>0)return $("input.date_picker").datepicker({dateFormat:window.dateTime,changeYear:!0,yearRange:"-100:+50"})},window.EHQ.surveys.setupRegionQuestion=function(){function t(t){$(t).select2({minimumInputLength:2,width:"element",id:function(t){return t.id},ajax:{url:"/suburbs.json",type:"GET",dataType:"json",quietMillis:1e3,data:function(t){return{q:t.replace(/^([A-Za-z]\d[A-Za-z])[ ](\d[A-Za-z]\d)$/g,"$1$2")}},results:function(t){console.log(t.suburb);var e=$.map(t.suburbs,function(e){return e.zipcode?{id:e.name+", "+e.state+" "+e.zipcode}:e.postal_code?{id:e.name+", "+e.state+", "+e.postal_code,results:t}:{id:e.state?e.name+", "+e.state:e.name}});return console.log(e),{results:e}}},formatSelection:function(t){return t.id},formatResult:function(t){if(t.results)for(var e=0;e<t.results.suburbs.length;e++)if(t.results.suburbs[e].postal_code)return"".concat(t.id.split(",")[0],", ",t.id.split(",")[1],", ","".concat(t.id.split(",")[2].substr(0,4)," ",t.id.split(",")[2].substr(4,3)));return t.id},initSelection:function(t,e){return e($(t).val())},dropdownCssClass:"bigdrop",formatInputTooShort:!1,formatNoMatches:function(){return $(t).data("translations").not_found},formatSearching:function(){return $(t).data("translations").search}})}return $(".region-select2").each(function(){$("input.region-select2").val()?(t(this),$(".region-select2 span").html($("input.region-select2").val())):t(this)})},$(function(){return"undefined"!=typeof $.datepicker&&($.datepicker.regional["en-AU"]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["January","February","March","April","May","June","July","August","September","October","November","December"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Frid
1ay","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:window.dateTime,firstDay:1,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},$.datepicker.setDefaults($.datepicker.regional["en-AU"])),$(".select2").length>0&&$(".select2").select2({minimumInputLength:1,width:"element",matcher:function(t,e){return 0===e.toUpperCase().indexOf(t.toUpperCase())}}),window.EHQ.surveys.setupRegionQuestion(),$('[data-toggle="tooltip"]').length>0&&$('[data-toggle="tooltip"]').tooltip(),$("html").is(".ie9, .ie8")||$(".info-icon").length>0&&$(".info-icon").tooltip(),$("abbr.timeago").length>0?$("abbr.timeago").timeago():null}),$(document).ready(function(){function t(t){if(!/<[^>]*>?/gm.test(t))return!0}return!!navigator.platform&&/iPhone/.test(navigator.platform)&&window.matchMedia("(max-width: 960px)").matches&&window.matchMedia("(min-width: 320px)").matches&&$("#js-set-this-location-button").on("click",function(){$(".places-upgrade-sidebar .c-map-sidebar-detail .add-marker-content .simple_form").addClass("iphone-fix")}),$(".search-box-large form").add(".search-box form").submit(function(e){var i=$(this).find("#search-query"),n=$(this).find("#search-query").val(),o=$(this).find("#search-query").data("error-message");$(".search-large-error").remove(),i.removeAttr("aria-invalid"),i.removeAttr("aria-errormessage"),t(n)&&n.trim()||(i.attr("aria-invalid","true"),i.attr("aria-errormessage","search-query-error"),$(this).parent().append("<span class='search-large-error' id='search-query-error' style='color:red'>"+o+"</span>"),e.preventDefault())}),$(".recent-photos-widget li").each(function(){var t=$(this);t.hasClass("img_1")&&(t.css("min-height","initial"),t.find("img").css("height","initial").css("object-fit","initial"))}),$("#static-page-content").length>0&&(navigator.appVersion&&navigator.appVersion.includes("Win")?$("#static-page-content").css("padding-bottom","55px"):window.matchMedia("(max-width: 992px)").matches&&window.matchMedia("(min-width: 768px)").matches&&$("#static-page-content").css("padding-bottom","65px")),window.EHQ.initialize_datepicker()}),$(".js-product-selection").on("change",function(t){"custom"===t.target.value.toLowerCase()&&0===$("#form_max_number_of_admins").val().length&&0===$("#form_audit_trail_duration").val().length&&($("#form_max_number_of_admins").val(1),$("#form_audit_trail_duration").val(4))})}).call(this),jQuery(document).ready(function(){$(".js_dependent_link").css("visibility","visible")}),placeholderSettings={inputWrapper:'<span style="position: relative; display: block; color:#bababa;"></span>',placeholderCSS:{top:"20%",left:"8px","font-weight":"bold","font-size":"0.85em",position:"absolute",display:"block"}},applyPlaceholders=function(){"placeholder"in document.createElement("input")||$("input[placeholder], textarea[placeholder]").placeholder(placeholderSettings)},$(function(){applyPlaceholders()}),function(t){var e={_createCurrentTime:function(t){var e=null,i=null;return{second:i=(i=t-60*(e=Math.floor(t/60)))<10?["0",i].join(""):i,minute:e=e<10?["0",e].join(""):e}}};t.fn.countdown=function(i){var n={story:"li",guestbook:".comment_container",forum:".comment-wrapper",map:".leaflet-popup-content-wrapper"};return i||(i={mode:"story"}),this.each(function(){var o=null,r=null,a=null;return currentTime=null,o=t(this).closest(n[i.mode]),r=t(o).find(".edit-timer"),a=r.html(),currentTime=null,currentTime=e._createCurrentTime(a),r.html([currentTime.minute,":",currentTime.second].join("")),r.show(),counter=setInterval(function(){return currentTime=e._createCurrentTime(a),r.html([currentTime.minute,":",currentTime.second].join("")),0===a&&(clearInterval(counter),r.closest(".edit-timer").hide()),a--},1e3)})}}(jQuery),Utility=(EHQ=EHQ||{}).Utility={disableCheck:function(){var t,e,i;$("form.disbled-tool-form").each(function(){return(t=$(this)).attr("action","").find("input, textarea, select").prop("disabled","disabled"),$(this).attr("action","").find("label, legend, tr").addClass("label-disabled"),e=$("<a/>",{href:"javascript:;",text:(i=t.find("input[type=submit]")).val(),"class":"btn submit-disabled",role:"button",disabled:"disabled",type:"submit"}),i.replaceWith(e)})},getIndex:function(t,e){for(var i=-1,n=0;n<t.length;n++)i=t[n]===e?n:i;return i},disableEnterInFormInputBoxes:function(){var t=13;$("form").on("keypress","input.string",function(e){if(e.which===t)return!1})}},(EHQ=EHQ||{}).LifeCycleWidget={selectors:{wrapper:".widget_life_cycle",toggleButton:".widget-header",list:".widget-content"},init:function(){this.loadEventBindings(),$(this.selectors.wrapper).find(".widget-header").removeAttr("data-toggle")},loadEventBindings:function(){$(this.selectors.wrapper).find(this.selectors.toggleButton).on("click",{context:this},this._toggleStages)},_toggleStages:function(t){that=t.data.context;var e=$(".life-cycle-status-not-current"),i=$(".life-cycle-status-current"),n=$(this).find(".widget-header-arrow");"open"===n.data("status")?(i.addClass("closed-state"),e.addClass("closed-state"),that._toggleOneByOne(e,!1),n.data("status","close"),n.attr("title",$(n).data("close-message")),n.parent().addClass("collapsed")):(i.removeClass("closed-state"),e.removeClass("closed-state"),that._toggleOneByOne(e,!0),n.data("status","open"),n.attr("title",$(n).data("open-message")),n.parent().removeClass("collapsed"))},_toggleOneByOne:function(t,e){0!=t.length&&(that=this,e?$(t[0]).show("fast"):$(t[0]).hide("fast"),setTimeout(function(){that._toggleOneByOne(t.slice(1),e)},50))}},$("document").ready(function(){EHQ.LifeCycleWidget.init()}),function(){$(function(){return $(document).on("click",".description-read-more-link, .read-more-collapse",function(t){t.preventDefault(),$(this).closest(".read-more-collapse").is('[aria-expanded="false"]')?$($(this).closest(".read-more-collapse")).attr("aria-expanded","true"):$($(this).closest(".read-more-collapse")).attr("aria-expanded","fal
1se"),$(this).closest(".parent-description").find(".full-description").removeClass("hide"),$(this).closest(".parent-description").find(".full-description").show(),$(this).closest(".parent-description").find(".truncated-description").remove()})})}.call(this);var unverifiedParticipation=function(t,e,i){return this.$form=$(t),!!this.$form.length&&(this.unverifiedParticipationEnabled=e,this.email=this.$form.find(".user-email"),this.screenName=this.$form.find(".user-screen-name"),this.password=this.$form.find(".user-password"),this.tosInput=this.$form.find(".tos-input"),this.error={ajaxConnectionError:this.$form.find(".unverified-participation-block").data("error-ajax-connection"),logInError:this.$form.find(".unverified-participation-block").data("error-login"),screenNameTakenError:this.screenName.data("error-screenname-taken"),screenNameEmptyError:this.screenName.data("error-empty"),passwordEmptyError:this.password.data("error-empty"),emailDoesntExistError:this.email.data("error-invalid"),emailEmptyError:this.email.data("error-empty"),tosError:this.tosInput.data("error-invalid")},this.selectors={submitButton:".submit-button",emailConfirmationLink:".devise-email-confirmation-link",userEmail:".user-email",userPassword:".user-password",passwordContainer:".unverified-password",screenNameContainer:".unverified-participation-login-field",unverifiedParticipationEnabled:".unverified-participation-enabled",ajaxLoader:".ajax-loader",floatingError:".floating-error",providePasswordMessage:".provide-password-message",container:i||".container",registrationBlock:".registration-block",responsiveProvidePasswordMessage:"responsive-provide-password-message"},this)};unverifiedParticipation.prototype={init:function(){this.unverifiedParticipationEnabled?this.showScreenNameOrPassword("screenName",!0):this.showScreenNameOrPassword("password",!0),this.setupRegistrationLinks(),this.eventBindings()},setupRegistrationLinks:function(){this.$form.addClass("clearfix");var t=this.$form.find(this.selectors.registrationBlock).detach(),e=this.$form.find(this.selectors.providePasswordMessage).detach();t.insertAfter(this.$form),e.insertAfter(this.$form)},isEmailPresent:function(t,e){$.get("/user_verifications/check_email",{email:this.email.val()}).done(function(e){"function"==typeof t&&t("true"===e)}).fail(function(){e&&"function"==typeof e&&e(this.ajaxConnectionError)})},isScreenNamePresent:function(t,e){$.get("/user_verifications/check_login",{login:this.screenName.val()}).done(function(e){"function"==typeof t&&t("true"===e)}).fail(function(){"function"==typeof e&&e(this.ajaxConnectionError)})}
1,signIn:function(t,e,i){var n=this;$.post("/user_verifications/sign_in_user",{email_or_login:this.email.val(),password:this.password.val()}).done(function(i){switch(i){case"LOGIN_SUCCESS":fetchApiToken(n.email.val(),n.password.val()).then(function(){"function"==typeof t&&t()});break;case"LOGIN_ERROR":"function"==typeof e&&e(n.error.logInError);break;case"USER_NOT_CONFIRMED":$(n).$form.find(n.emailConfirmationLink).show()}}).fail(function(){i&&"function"==typeof i&&i(this.ajaxConnectionError)})},isEmailValid:function(t){return/^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(t)},showFloatingError:function(t){var e=$(this.selectors.floatingError);if(e.length)e.text(t).show().delay(5e3).fadeOut();else{var i=$(this.selectors.container).first();$("<div/>",{"class":this.selectors.floatingError.substr(1)+" icon-warning-sign",text:t,id:"floating-error-message"}).prependTo(i).delay(5e3).fadeOut()}},showScreenNameOrPassword:function(t){var e=this.password.closest(this.selectors.passwordContainer),i=this.screenName.closest(this.selectors.screenNameContainer);e.find("input").val(""),i.find("input").val(""),this.unverifiedParticipationEnabled?"password"===t?(this.toggleScreenNameOrPassword(e,!0),this.toggleScreenNameOrPassword(i,!1),e.closest(".form-container").find(this.selectors.registrationBlock).hide(),e.closest(".form-container").find(this.selectors.providePasswordMessage).slideDown()):(this.toggleScreenNameOrPassword(i,!0),this.toggleScreenNameOrPassword(e,!1),e.closest(".form-container").find(this.selectors.providePasswordMessage).hide(),e.closest(".form-container").find(this.selectors.registrationBlock).slideDown()):(this.toggleScreenNameOrPassword(e,!0),this.toggleScreenNameOrPassword(i,!1))},toggleScreenNameOrPassword:function(t,e){e?t.show():t.hide(),t.find("input").attr("required",e)},eventBindings:function(){var t=$(document),e=this,i=null;t.on("change",e.email.selector,function(){i=!0}),t.on("blur",e.email.selector,function(){i&&(i=null,e.isEmailValid($(this).val())&&($(e.selectors.ajaxLoader).show(),e.isEmailPresent(function(t){t?($(e.selectors.ajaxLoader).hide(),$(e.showScreenNameOrPassword("password")),$(".tos-checkbox").hide()):($(e.selectors.ajaxLoader).hide(),$(".tos-checkbox").show(),$(e.showScreenNameOrPassword("screenName")))},function(t){e.selectors.showAjaxError(t)})))})},formSubmit:function(t){var e=this;t&&"function"==typeof t?t():e.$form.submit()},submit:function(t){var e=this;t&&"function"==typeof t?e.formValidCheck(t):e.$form.find(e.selectors.submitButton).on("click",function(t){t.preventDefault(),e.formValidCheck()})},addAccessibilityAttributes:function(t){$(".simple_form input").removeClass("error-field").removeAttr("aria-invalid"),$(t).attr({"aria-describedby":"floating-error-message","aria-invalid":!0}).addClass("error-field").focus()},formValidCheck:function(t){var e=this;e.email.is(":visible")?e.email.val()?e.isEmailValid(e.email.val())?e.screenName.val()?e.isScreenNamePresent(function(i){i?e.showFloatingError(e.error.screenNameTakenError):$(".tos-input:valid").length>0?e.formSubmit(t):(e.addAccessibilityAttributes(e.tosInput),e.showFloatingError(e.error.tosError))}):e.screenName.is(":visible")?(e.addAccessibilityAttributes(this.screenName),e.showFloatingError(e.error.screenNameEmptyError)):e.password.val()?e.signIn(function(){e.formSubmit(t)},function(t){e.showFloatingError(t),e.password.focus().val("")}
1):(e.addAccessibilityAttributes(this.password),e.showFloatingError(e.error.passwordEmptyError)):(e.showFloatingError(e.error.emailDoesntExistError),this.email.focus().val("")):(e.addAccessibilityAttributes(this.email),e.showFloatingError(e.error.emailEmptyError)):e.formSubmit(t)}},$(function(){var t=(t=window.location.hash).substring(0,t.indexOf("?"));$id=$(t),$id.length&&$("html, body").scrollTo($id,300)}),this.EHQ=this.EHQ||{},EHQ.ForumComment=function(){function t(t,e,i){this.commentForm=t,this.addNewCommentLink=e,this.commentsContainer=i}var e;return t.prototype.hide_link=function(){return this.addNewCommentLink.hide("fast")},t.prototype.show_link=function(){return this.addNewCommentLink.show()},t.prototype.show_form=function(){return this.commentForm.slideDown("fast"),this.commentForm.find(".user-input-email").length>0?this.commentForm.find(".user-input-email").focus():this.commentForm.find("form .comment_input").focus()},t.prototype.hide_form=function(){return this.commentForm.hide("fast"),this.commentForm.find("form").resetForm()},t.prototype.increment_comment_count=function(){var t;if($(".comments_count").length)return t=parseInt($(".comments_count").html())+1,$(".comments_count").html(t)},t.prototype.show_comment_expand_links=function(){return parseInt($(".comments_count").html())>1?$(".comment-display-style").show():$(".comment-display-style").hide()},e=function(t){var e,i,n;for(t=t.split("+").join(" "),e={},n=void 0,i=/[?&]?([^=]+)=([^&]*)/g;n=i.exec(t);)e[decodeURIComponent(n[1])]=decodeURIComponent(n[2]);return e},t.prototype.post=function(){var t,i,n,o;return n=this,i=(t=this.commentForm.find("form"))[0].action+".ajax",t.find(".submit-button").val("Submitting..").prop("disabled",!0),$.ajax({url:i,type:"POST",dataType:"json",data:t.serialize(),success:(o=this,function(i){return"true"===i.quarantined&&(document.location="/logout"),e(document.location.search).posted_first?($(i.html).appendTo(o.commentsContainer).show("blind",500),window.scrollTo(0,document.body.scrollHeight)):$(i.html).prependTo(o.commentsContainer).show("blind",500),o.increment_comment_count(),o.show_comment_expand_links(),t.resetForm(),o.show_link(),n.show_link(),"undefined"!=typeof StoriesTool&&StoriesTool.collapseCommentForm(t),t.find(".submit-button").val("Submit").prop("disabled",!1)}),error:function(e){return function(){return e.commentForm.find(".pull-left").hide(),e.commentForm.find("textarea").focus(),t.find(".submit-button").val("Submit").prop("disabled",!1)}}(this)})},t.prototype.startCountdown=function(t){return $(".edit-timer",t).countdown({mode:"forum"})},t.prototype.show_edit_form=function(t){return $.ajax(t.href+".ajax",{type:"GET",dataType:"json",success:function(e){var i;return $(t).closest(".edit-area").find(".ajax-loader").hide(),(i=$(t).closest(".comment-wrapper").find(".edit_comment_form").first()).html(e.html),i.find("textarea").focus(),i.find(".unverified-participation-email-contianer").hide(),i.find(".unverified-participation-login-field").hide()}})},t.prototype.post_edit_form=function(t){return $(t).find(".js-icon-loading").show(),$(t).find(".submit-button").hide(),$(t).find(".submitting-button").css("display","inline-block"),$.ajax(t.action+".ajax",{type:"POST",dataType:"json",data:$(t).serialize(),success:function(e){var i,n,o;return n=(o=$(t).closest(".comment-wrapper")).find(".author").text(),o.attr("id"),(i=$(e.html)).find(".author").text(n),o.replaceWith(i),$(t).find(".submit-button").show(),$(t).find(".submitting-button").hide()}})},t.prototype.hide_edit_form=function(t){return $(t).closest(".edit_comment_form").html("")},t.prototype.hide_edit_link=function(t){return $(t).closest(".comment-wrapper").find(".edit_comment_link").hide()},t.prototype.show_edit_link=function(t){return $(t).closest(".comment-wrapper").find(".edit_comment_link").show()},t.prototype.hide_comment=function(t){return $(t).closest(".comment-wrapper").find(".comment").hide()},t.prototype.show_comment=function(t){return $(t).closest(".comment-wrapper").find(".comment").show()},t}(),function(){this.EHQ=this.EHQ||{},EHQ.ForumReply=function(){function t(){}return t.prototype.show_form=function(t,e){return $(".reply_form").html(""),$.ajax(t.href+".ajax",{type:"GET",dataType:"json",success:function(i){var n;return(n=$(t).closest(".comment").find(".reply_form").first()).html(i.html),n.slideDown("fast"),$(t).closest(".comment").find(".comment_spinner").hide(),n.find(".user-input-email").length>0?n.find(".user-input-email").focus():n.find("textarea").focus(),e()}})},t.prototype.show_comment_expand_links=function(){return parseInt($(".comments_count").html())>1?$(".comment-display-style").show():$(".comment-display-style").hide()}
1,t.prototype.increment_comment_count=function(){var t;return t=parseInt($(".comments_count").html())+1,$(".comments_count").html(t)},t.prototype.post=function(t){var e,i;return(e=$(t)).find(".pull-left").show(),e.find(".submit-button").hide(),e.find(".submitting-button").css("display","inline-block"),$.ajax(t.action+".ajax",{type:"POST",dataType:"json",data:e.serialize(),success:(i=this,function(t){var n,o,r,a,s,l;return"true"===t.quarantined&&(document.location="/logout"),(l=e.closest(".comment-wrapper").find(".replies")).length?l.append(t.html):((l=$("<div class='offset-comment replies'></div>")).append(t.html),l.appendTo(e.closest(".comment-wrapper"))),(a=e.closest(".comment-wrapper")).find("span.edit-area").first().hide(),(o=e.parents(".replies").last().prev(".comment-wrapper")).length||(o=e.parents(".comment-wrapper")),r=o.find(".hide_text")[0],o.find(".show_replies span").html(r),o.find(".show_replies").addClass("hide_replies"),o.find(".show_replies").removeClass("show_replies"),o.next().removeClass("collapse"),i.increment_comment_count(),i.show_comment_expand_links(),n=l.find(".comment").last(),s=e.find(".sign-in-form").is(":visible"),e.closest(".reply_form").html(""),$.scrollTo(n,1e3),$(n.parent()).effect("highlight",{},5e3),$(a).find(".reply").removeClass("disabled"),s&&location.reload(),e.find(".submit-button").show(),e.find(".submitting-button").hide()}),error:function(t,i,n){return window.alert(n),e.find(".pull-left").hide(),e.find("textarea").focus(),e.find(".submit-button").show(),e.find(".submitting-button").hide()}})},t.prototype.cancel=function(t){return $(t).closest(".comment").find(".reply").removeClass("disabled"),$(t).closest(".reply_form").html("")},t.prototype.agree=function(t){return t.setAttribute("aria-disabled",!0),$(t).addClass("disabled"),$(t).parents(".comment").find(".disagree").first().addClass("disabled").attr("aria-disabled",!0),$.ajax($(t).data("path")+".ajax",{type:"POST",dataType:"json",success:function(e){return $(t).closest(".comment").find(".agree-score span.score").first().html(e.count)}})},t.prototype.disagree=function(t){return t.setAttribute("aria-disabled",!0),$(t).addClass("disabled"),$(t).parents(".comment").find(".agree").first().addClass("disabled").attr("aria-disabled",!0),$.ajax($(t).data("path")+".ajax",{type:"POST",dataType:"json",success:function(e){return $(t).closest(".comment").find(".disagree-score span.score").first().html(e.count)}})},t.prototype.report_comment=function(t){return $.ajax(t.href+".ajax",{type:"PUT",dataType:"json",success:function(){return alert($(t).data("message")),$(t).hide()}})},t}()}.call(this),function(){$(document).ready(function(){return $(document).on("click",".cancel_link",function(){return $("#forum_topic_form, #story_telling_tool_form").hide(),$("#new_forum_topic_link, #new_story_telling_tool_link").show(),$("#single_story").show(),$("story_telling_tool_form").html(""),!1})})}.call(this);var rwindow,rdocument,projectTeam={selectors:{btn_read_bio:".js-read-bio",info:".js-member-info"}};if($(document).ready(function(){$(document).on("click",projectTeam.selectors.btn_read_bio,function(){$(this).closest(".project-members__item").find(".js-member-info").slideToggle(),$(this).toggleClass("open")})}),void 0===RELANG)var RELANG={};var EHQ,RLANG={html:"HTML",video:"Insert Embed Code",image:"Insert Image",edit_image:"Edit Image",table:"Table",link:"Link",link_insert:"Insert link",unlink:"Unlink",formatting:"Formatting",paragraph:"Paragraph",quote:"Quote",code:"Code",header1:"Header 1",header2:"Header 2",header3:"Header 3",header4:"Header 4",bold:"Bold",italic:"Italic",fontcolor:"Font Color",backcolor:"Back Color",unorderedlist:"Unordered List",orderedlist:"Ordered List",outdent:"Outdent",indent:"Indent",cancel:"Cancel",insert:"Insert",save:"Save",_delete:"Delete",insert_table:"Insert Table",insert_row_above:"Add Row Above",insert_row_below:"Add Row Below",insert_column_left:"Add Column Left",insert_column_right:"Add Column Right",delete_column:"Delete Column",delete_row:"Delete Row",delete_table:"Delete Table",rows:"Rows",columns:"Columns",add_head:"Add Head",delete_head:"Delete Head",title:"Title",image_position:"Position",none:"None",left:"Left",right:"Right",full:"Full",image_web_link:"Image Web Link",text:"Text",mailto:"Email",web:"URL",video_html_code:"Embed Code",file:"Insert File",upload:"Upload",download:"Download",choose:"Choose",or_choose:"Or choose",drop_file_here:"Drop file here",align_left:"Align text to the left",align_center:"Center text",align_right:"Align text to the right",align_justify:"Justify text",horizontalrule:"Insert Horizontal Rule",deleted:"Deleted",anchor:"Anchor",link_new_tab:"Open link in new tab",underline:"Underline",alignment:"Alignment"};!function(t){jQuery.fn.redactor=function(i){return this.each(function(){var n=t(this),o=n.data("redactor");o||n.data("redactor",o=new e(this,i))})};var e=function(e,i){this.$el=t(e),void 0!==i&&"undefined"!=typeof i.lang&&"en"!==i.lang&&"undefined"!=typeof RELANG[i.lang]&&(RLANG=RELANG[i.lang]),this.opts=t.extend({iframe:!1,css:!1,lang:"en",direction:"ltr",callback:!1,keyupCallback:!1,keydownCallback:!1,execCommandCallback:!1,plugins:!1,cleanup:!0,focus:!1,tabindex:!1,autoresize:!0,minHeight:!1,fixed:!1,fixedTop:0,fixedBox:!1,source:!0,shortcuts:!0,mobile:!0,air:!1,wym
1:!1,convertLinks:!0,convertDivs:!0,protocol:"http://",autosave:!1,autosaveCallback:!1,interval:60,imageGetJson:!1,imageUpload:!1,imageUploadCallback:!1,imageUploadErrorCallback:!1,fileUpload:!1,fileUploadCallback:!1,fileUploadErrorCallback:!1,uploadCrossDomain:!1,uploadFields:!1,observeImages:!0,overlay:!0,allowedTags:["form","input","button","select","option","datalist","output","textarea","fieldset","legend","section","header","hgroup","aside","footer","article","details","nav","progress","time","canvas","code","span","div","label","a","br","p","b","i","del","strike","u","img","video","source","track","audio","iframe","object","embed","param","blockquote","mark","cite","small","ul","ol","li","hr","dl","dt","dd","sup","sub","big","pre","code","figure","figcaption","strong","em","table","tr","td","th","tbody","thead","tfoot","h1","h2","h3","h4","h5","h6"],toolbarExternal:!1,buttonsCustom:{},buttonsAdd:[],buttons:["html","|","formatting","|","bold","italic","deleted","|","unorderedlist","orderedlist","outdent","indent","|","image","video","file","table","link","|","fontcolor","backcolor","|","alignment","|","horizontalrule"],airButtons:["formatting","|","bold","italic","deleted","|","unorderedlist","orderedlist","outdent","indent","|","fontcolor","backcolor"],formattingTags:["p","blockquote","pre","h1","h2","h3","h4"],activeButtons:["deleted","italic","bold","underline","unorderedlist","orderedlist"],activeButtonsStates:{b:"bold",strong:"bold",i:"italic",em:"italic",del:"deleted",strike:"deleted",ul:"unorderedlist",ol:"orderedlist",u:"underline"},colors:["#ffffff","#000000","#eeece1","#1f497d","#4f81bd","#c0504d","#9bbb59","#8064a2","#4bacc6","#f79646","#ffff00","#f2f2f2","#7f7f7f","#ddd9c3","#c6d9f0","#dbe5f1","#f2dcdb","#ebf1dd","#e5e0ec","#dbeef3","#fdeada","#fff2ca","#d8d8d8","#595959","#c4bd97","#8db3e2","#b8cce4","#e5b9b7","#d7e3bc","#ccc1d9","#b7dde8","#fbd5b5","#ffe694","#bfbfbf","#3f3f3f","#938953","#548dd4","#95b3d7","#d99694","#c3d69b","#b2a2c7","#b7dde8","#fac08f","#f2c314","#a5a5a5","#262626","#494429","#17365d","#366092","#953734","#76923c","#5f497a","#92cddc","#e36c09","#c09100","#7f7f7f","#0c0c0c","#1d1b10","#0f243e","#244061","#632423","#4f6128","#3f3151","#31859b","#974806","#7f6000"],emptyHtml:"<p><br /></p>",buffer:!1,visual:!0,modal_file:String()+'<div id="redactor_modal_content"><form id="redactorUploadFileForm" method="post" action="" enctype="multipart/form-data"><label>Name (optional)</label><input type="text" id="redactor_filename" class="redactor_input" /><div style="margin-top: 7px;"><input type="file" id="redactor_file" name="file" /></div></form><br></div>',modal_image_edit:String()+'<div id="redactor_modal_content"><label>'+RLANG.title+'</label><input id="redactor_file_alt" class="redactor_input" /><label>'+RLANG.link+'</label><input id="redactor_file_link" class="redactor_input" /><label>'+RLANG.image_position+'</label><select id="redactor_form_image_align"><option value="left">'+RLANG.left+'</option><option value="right">'+RLANG.right+'</option><option value="none">'+RLANG.full+'</option></select></div><div id="redactor_modal_footer"><a href="javascript:void(null);" id="redactor_image_delete_btn" class="redactor_modal_btn">'+RLANG._delete+'</a> <a href="javascript:void(null);" class="redactor_modal_btn redactor_btn_modal_close">'+RLANG.cancel+'</a><input type="button" name="save" class="redactor_modal_btn" id="redactorSaveBtn" value="'+RLANG.save+'" /></div>',modal_image:String()+'<div id="redactor_modal_content"><div id="redactor_tabs"><a href="javascript:void(null);" class="redactor_tabs_act">'+RLANG.upload+'</a><a href="javascript:void(null);">'+RLANG.choose+'</a><a href="javascript:void(null);">'+RLANG.link+'</a></div><form id="redactorInsertImageForm" method="post" action="" enctype="multipart/form-data"><div id="redactor_tab1" class="redactor_tab"><input type="file" id="redactor_file" name="file" /></div><div id="redactor_tab2" class="redactor_tab" style="display: none;"><div id="redactor_image_box"></div></div></form><div id="redactor_tab3" class="redactor_tab" style="display: none;"><label>'+RLANG.image_web_link+'</label><input type="text" name="redactor_file_link" id="redactor_file_link" class="redactor_input" /></div></div><div id="redactor_modal_footer"><a href="javascript:void(null);" class="redactor_modal_btn redactor_btn_modal_close">
1'+RLANG.cancel+'</a><input type="button" name="upload" class="redactor_modal_btn" id="redactor_upload_btn" value="'+RLANG.insert+'" /></div>',modal_link:String()+'<div id="redactor_modal_content"><form id="redactorInsertLinkForm" method="post" action=""><div id="redactor_tabs"><a href="javascript:void(null);" class="redactor_tabs_act">URL</a><a href="javascript:void(null);">Email</a><a href="javascript:void(null);">'+RLANG.anchor+'</a></div><input type="hidden" id="redactor_tab_selected" value="1" /><div class="redactor_tab" id="redactor_tab1"><label>URL</label><input type="text" id="redactor_link_url" class="redactor_input" /><label>'+RLANG.text+'</label><input type="text" class="redactor_input redactor_link_text" id="redactor_link_url_text" /><label><input type="checkbox" id="redactor_link_blank"> '+RLANG.link_new_tab+'</label></div><div class="redactor_tab" id="redactor_tab2" style="display: none;"><label>Email</label><input type="text" id="redactor_link_mailto" class="redactor_input" /><label>'+RLANG.text+'</label><input type="text" class="redactor_input redactor_link_text" id="redactor_link_mailto_text" /></div><div class="redactor_tab" id="redactor_tab3" style="display: none;"><label>'+RLANG.anchor+'</label><input type="text" class="redactor_input" id="redactor_link_anchor" /><label>'+RLANG.text+'</label><input type="text" class="redactor_input redactor_link_text" id="redactor_link_anchor_text" /></div></form></div><div id="redactor_modal_footer"><a href="javascript:void(null);" class="redactor_modal_btn redactor_btn_modal_close">'+RLANG.cancel+'</a><input type="button" class="redactor_modal_btn" id="redactor_insert_link_btn" value="'+RLANG.insert+'" /></div>',modal_table:String()+'<div id="redactor_modal_content"><label>'+RLANG.rows+'</label><input type="text" size="5" value="2" id="redactor_table_rows" /><label>'+RLANG.columns+'</label><input type="text" size="5" value="3" id="redactor_table_columns" /></div><div id="redactor_modal_footer"><a href="javascript:void(null);" class="redactor_modal_btn redactor_btn_modal_close">'+RLANG.cancel+'</a><input type="button" name="upload" class="redactor_modal_btn" id="redactor_insert_table_btn" value="'+RLANG.insert+'" /></div>', 2modal_video:String()+'<div id="redactor_modal_content"><form id="redactorInsertVideoForm"><label>'+RLANG.video_html_code+'</label><textarea id="redactor_insert_video_area" style="width: 99%; height: 160px;"></textarea></form></div><div id="redactor_modal_footer"><a href="javascript:void(null);" class="redactor_modal_btn redactor_btn_modal_close">'+RLANG.cancel+'</a><input type="button" class="redactor_modal_btn" id="redactor_insert_video_btn" value="'+RLANG.insert+'" /></div>',toolbar:{html:{title:RLANG.html,func:"toggle"},formatting:{title:RLANG.formatting,func:"show",dropdown:{p:{title:RLANG.paragraph,exec:"formatblock"},blockquote:{title:RLANG.quote,exec:"formatblock",className:"redactor_format_blockquote"},pre:{title:RLANG.code,exec:"formatblock",className:"redactor_format_pre"},h1:{title:RLANG.header1,exec:"formatblock",className:"redactor_format_h1"},h2:{title:RLANG.header2,exec:"formatblock",className:"redactor_format_h2"},h3:{title:RLANG.header3,exec:"formatblock",className:"redactor_format_h3"},h4:{title:RLANG.header4,exec:"formatblock",className:"redactor_format_h4"}}},bold:{title:RLANG.bold,exec:"bold"},italic:{title:RLANG.italic,exec:"italic"},deleted:{title:RLANG.deleted,exec:"strikethrough"},underline:{title:RLANG.underline,exec:"underline"},unorderedlist:{title:"• "+RLANG.unorderedlist,exec:"insertunorderedlist"},orderedlist:{title:"1. "+RLANG.orderedlist,exec:"insertorderedlist"},outdent:{title:"< "+RLANG.outdent,exec:"outdent"},indent:{title:"> "+RLANG.indent,exec:"indent"},image:{title:RLANG.image,func:"showImage"},video:{title:RLANG.video,func:"showVideo"},file:{title:RLANG.file,func:"showFile"},table:{title:RLANG.table,func:"show",dropdown:{insert_table:{title:RLANG.insert_table,func:"showTable"},separator_drop1:{name:"separator"},insert_row_above:{title:RLANG.insert_row_above,func:"insertRowAbove"},insert_row_below:{title:RLANG.insert_row_below,func:"insertRowBelow"},insert_column_left:{title:RLANG.insert_column_left,func:"insertColumnLeft"},insert_column_right:{title:RLANG.insert_column_right,func:"insertColumnRight"},separator_drop2:{name:"separator"},add_head:{title:RLANG.add_head,func:"addHead"},delete_head:{title:RLANG.delete_head,func:"deleteHead"},separator_drop3:{name:"separator"},delete_column:{title:RLANG.delete_column,func:"deleteColumn"},delete_row:{title:RLANG.delete_row,func:"deleteRow"},delete_table:{title:RLANG.delete_table,func:"deleteTable"}}},link:{title:RLANG.link,func:"show",dropdown:{link:{title:RLANG.link_insert,func:"showLink"},unlink:{title:RLANG.unlink,exec:"unlink"}}},fontcolor:{title:RLANG.fontcolor,func:"show"},backcolor:{title:RLANG.backcolor,func:"show"},alignment:{title:RLANG.alignment,func:"show",dropdown:{alignleft:{title:RLANG.align_left,exec:"JustifyLeft"},aligncenter:{title:RLANG.align_center,exec:"JustifyCenter"},alignright:{title:RLANG.align_right,exec:"JustifyRight"},justify:{title:RLANG.align_justify,exec:"JustifyFull"}}},alignleft:{exec:"JustifyLeft",title:RLANG.align_left},aligncenter:{exec:"JustifyCenter",title:RLANG.align_center},alignright:{exec:"JustifyRight",title:RLANG.align_right},justify:{exec:"JustifyFull",title:RLANG.align_justify},horizontalrule:{exec:"inserthorizontalrule",title:RLANG.horizontalrule}}},i,this.$el.data()),this.dropdowns=[],this.init()};e.prototype={init:function(){function e(){if(this.enableAir(),this.buildToolbar(),"object"==typeof this.opts.plugins&&t.each(this.opts.plugins,t.proxy(function(e,i){"undefined"!=typeof RedactorPlugins[i]&&(t.extend(this,RedactorPlugins[i]),"undefined"!=typeof RedactorPlugins[i].init&&this.init())},this)),!1!==this.opts.activeButtons&&!1!==this.opts.toolbar){var e=t.proxy(function(){this.observeFormatting()},this);this.$editor.click(e).keyup(e)}var i=!1;this.browser("webkit")&&-1===navigator.userAgent.indexOf("Chrome")&&(this.browser("version").split(".")[0]<536&&(i=!0));if(!1===this.isMobile(!0)&&!1===i&&!1===this.browser("opera")&&this.$editor.bind("paste",t.proxy(function(){if(!1===this.opts.cleanup)return!0;this.pasteRunning=!0,this.setBuffer(),!0===this.opts.autoresize?this.saveScroll=this.document.body.scrollTop:this.saveScroll=this.$editor.scrollTop();var e=this.extractContent();setTimeout(t.proxy(function(){var t=this.extractContent();this.$editor.append(e),this.restoreSelection();var i=this.getFragmentHtml(t);this.pasteCleanUp(i),this.pasteRunning=!1},this),1)},this)),this.keyup(),this.keydown(),!1!==this.opts.autosave&&this.autoSave(),setTimeout(t.proxy(function(){this.observeImages(),this.observeTables()},this),1),this.browser("mozilla")){this.$editor.click(t.proxy(function(){this.saveSelection()},this));try{this.document.execCommand("enableObjectResizing",!1,!1),this.document.execCommand("enableInlineTableEditing",!1,!1)}catch(n){}}this.opts.focus&&setTimeout(t.proxy(function(){this.$editor.focus()},this),1),this.opts.fixed&&(this.observeScroll(),t(document).scroll(t.proxy(this.observeScroll,this))),"function"==typeof this.opts.callback&&this.opts.callback(this),!1!==this.opts.toolbar&&this.$toolbar.find("a").attr("tabindex","-1")}if(this.height=this.$el.css("height"),this.width=this.$el.css("width"),rdocument=this.document=document,rwindow=this.window=window,!1===this.opts.mobile&&this.isMobile())return this.build(!0),!1;if(this.opts.iframe&&(this.opts.autoresize=!1),this.opts.air)t.extend(this.opts.toolbar,this.opts.buttonsCustom),this.opts.buttons=this.opts.airButtons;else if(!1!==this.opts.toolbar){if(!1===this.opts.source){var i=this.opts.buttons.indexOf("html"),n=this.opts.buttons[i+1];this.opts.buttons.splice(i,1),void 0!==n&&"|"===n&&this.opts.buttons.splice(i,1)}t.extend(this.opts.toolbar,this.opts.buttonsCustom),t.each(this.opts.buttonsAdd,t.proxy(function(t,e){this.opts.buttons.push(e)},this))}!1!==this.opts.toolbar&&t.each(this.opts.toolbar.formatting.dropdown,t.proxy(function(e){"-1"==t.inArray(e,this.opts.formattingTags)&&delete this.opts.toolbar.formatting.dropdown[e]},this)),this.build(!1,e)},shortcuts:function(t,e){t.preventDefault(),this.execCommand(e,!1)},keyup:function(){this.$editor.keyup(t.proxy(function(t){var e=t.keyCode||t.which;if(this.browser("mozilla")&&!this.pasteRunning&&this.saveSelection(),"function"==typeof this.opts.keyupCallback&&this.opts.keyupCallback(this,t),8===e||46===e)return this.observeImages(),this.formatEmpty(t);13!==e||t.shiftKey||t.ctrlKey||t.metaKey||(this.browser("webkit")&&this.formatNewLine(t),this.opts.convertLinks&&this.$editor.linkify()),this.syncCode()},this))},keydown:function(){this.$editor.keydown(t.proxy(function(e){var i=e.keyCode||e.which,n=this.getParentNode(),o=this.getCurrentNode(),r=!1,a=e.ctrlKey||e.metaKey;if(!n&&!o||"PRE"!==t(n).get(0).tagName&&"PRE"!==t(o).get(0).tagName||(r=!0),"function"==typeof this.opts.keydownCallback&&this.opts.keydownCallback(this,e),a&&this.opts.shortcuts&&(90===i?!1!==this.opts.buffer?(e.preventDefault(),this.getBuffer()):e.shiftKey?this.shortcuts(e,"redo"):this.shortcuts(e,"undo"):77===i?this.shortcuts(e,"removeFormat"):66===i?this.shortcuts(e,"bold"):73===i?this.shortcuts(e,"italic"):74===i?this.shortcuts(e,"insertunorderedlist"):75===i?this.shortcuts(e,"insertorderedlist"):76===i?this.shortcuts(e,"superscript"):72===i&&this.shortcuts(e,"subscript")),a||90===i||(this.opts.buffer=!1),!0===r&&13===i){e.preventDefault();var s=t(o).parent().text();return this.insertNodeAtCaret(this.document.createTextNode("\r\n")),-1==s.search(/\s$/)&&this.insertNodeAtCaret(this.document.createTextNode("\r\n")),this.syncCode(),!1}return!(!this.opts.shortcuts||e.shiftKey||9!==i)||(this.opts.shortcuts&&e.shiftKey&&9===i&&this.shortcuts(e,"outdent"),this.browser("webkit")&&-1===navigator.userAgent.indexOf("Chrome")?this.safariShiftKeyEnter(e,i):void 0)},this))},build:function(e,i){if(!0!==e){function n(){this.$editor=this.$content.contents().find("body").attr("contenteditable",!0).attr("dir",this.opts.direction),rdocument=this.document=this.$editor[0].ownerDocument,rwindow=this.window=this.document.defaultView||window,!1!==this.opts.css&&this.$content.contents().find("head").append('<link rel="stylesheet" href="'+this.opts.css+'" />'),this.$editor.html(a),i&&(i.call(this),i=null)}if(this.$box=t('<div class="redactor_box"></div>'),this.opts.air&&(this.air=t('<div class="redactor_air" style="display: none;"></div>')),this.$content=null,this.textareamode=!0,"TEXTAREA"===this.$el.get(0).tagName){if(this.opts.iframe){var o=this;this.$content=t('<iframe style="width: 100%;" frameborder="0" title="'+t("#t-redactor-title").val()+'"></iframe>').load(function(){n.call(o)})}else this.$content=this.$editor=t("<div></div>");var r=this.$el.get(0).className.split(/\s+/);t.each(r,t.proxy(function(t,e){this.$content.addClass("redactor_"+e)},this))}else this.textareamode=!1,this.$content=this.$editor=this.$el,this.$el=t('<textarea name="'+this.$editor.attr("id")+'"></textarea>').css("height",this.height);this.$editor&&this.$editor.addClass("redactor_editor").attr("contenteditable",!0).attr("dir",this.opts.direction),!1!==this.opts.tabindex&&this.$content.attr("tabindex",this.opts.tabindex),!1!==this.opts.minHeight&&this.$content.css("min-height",this.opts.minHeight+"px"),!0===this.opts.wym&&this.$content.addClass("redactor_editor_wym"),!1===this.opts.autoresize&&this.$content.css("height",this.height),this.$el.hide();var a="";this.textareamode?(a=this.$el.val(),a=this.savePreCode(a),this.$box.insertAfter(this.$el).append(this.$content).append(this.$el)):(a=this.$editor.html(),a=this.savePreCode(a),this.$box.insertAfter(this.$content).append(this.$el).append(this.$editor)),a=this.paragraphy(a),this.$editor&&this.$editor.html(a),!1===this.textareamode&&this.syncCode()}else if("TEXTAREA"!==this.$el.get(0).tagName){a=this.$el.val();var s=t('<textarea name="'+this.$editor.attr("id")+'"></textarea>').css("height",this.height).val(a);this.$el.hide(),this.$el.after(s)}i&&this.$editor&&i.call(this)},enableAir:function(){if(!1===this.opts.air)return!1;this.air.hide(),this.$editor.bind("textselect",t.proxy(function(t){this.showAir(t)},this)),this.$editor.bind("textunselect",t.proxy(function(){this.air.hide()},this))},showAir:function(e){t(".redactor_air").hide();var i=this.air.innerWidth(),n=e.clientX;t(this.document).width()<n+i&&(n-=i);var o=e.clientY+t(document).scrollTop()+14;!0===this.opts.iframe&&(o+=this.$box.position().top,n+=this.$box.position().left),this.air.css({left:n+"px",top:o+"px"}).show()},syncCode:function(){this.$el.val(this.$editor.html())},setCode:function(t){t=this.stripTags(t),this.$editor.html(t).focus(),this.syncCode()},getCode:function(){var t="";return t=this.opts.visual?this.$editor.html():this.$el.val(),this.stripTags(t)},insertHtml:function(t){this.$editor.focus(),this.pasteHtmlAtCaret(t),this.observeImages(),this.syncCode()},pasteHtmlAtCaret:function(t){var e,i;if(this.document.getSelection){if((e=this.window.getSelection()).getRangeAt&&e.rangeCount){(i=e.getRangeAt(0)).deleteContents();var n=this.document.createElement("div");n.innerHTML=t;for(var o,r,a=this.document.createDocumentFragment();o=n.firstChild;)r=a.appendChild(o);i.insertNode(a),r&&((i=i.cloneRange()).setStartAfter(r),i.collapse(!0),e.removeAllRanges(),e.addRange(i))}}else this.document.selection&&"Control"!=this.document.selection.type&&this.document.selection.createRange().pasteHTML(t)},destroy:function(){var e=this.getCode();this.textareamode?(this.$box.after(this.$el),this.$box.remove(),this.$el.height(this.height).val(e).show()):(this.$box.after(this.$editor),this.$box.remove(),this.$editor.removeClass("redactor_editor").removeClass("redactor_editor_wym").attr("contenteditable",!1).html(e).show()),this.opts.toolbarExternal&&t(this.opts.toolbarExternal).empty(),t(".redactor_air").remove();for(var i=0;i<this.dropdowns.length;i++)this.dropdowns[i].remove(),delete this.dropdowns[i];!1!==this.opts.autosave&&clearInterval(this.autosaveInterval)},observeFormatting:function(){var e=this.getCurrentNode();this.inactiveAllButtons(),t.each(this.opts.activeButtonsStates,t.proxy(function(i,n){0!=t(e).closest(i,this.$editor.get()[0]).length&&this.setBtnActive(n)},this));var i=t(e).closest(["p","div","h1","h2","h3","h4","h5","h6","blockquote","td"]);if("undefined"!=typeof i[0]&&"undefined"!=typeof i[0].elem&&0!=t(i[0].elem).size())switch(t(i[0].elem).css("text-align")){case"right":this.setBtnActive("alignright");break;case"center":this.setBtnActive("aligncenter");break;case"justify":this.setBtnActive("justify");break;default:this.setBtnActive("alignleft")}},observeImages:function(){if(!1===this.opts.observeImages)return!1;this.$editor.find("img").each(t.proxy(function(e,i){this.browser("msie")&&t(i).attr("unselectable","on"),this.resizeImage(i)},this))},observeTables:function(){this.$editor.find("table").click(t.proxy(this.tableObserver,this))},observeScroll:function(){var e=0;if(t(this.document).scrollTop()>this.$box.offset().top){var i="100%";this.opts.fixedBox&&(e=this.$box.offset().left,i=this.$box.innerWidth()),this.fixed=!0,this.$toolbar.css({position:"fixed",width:i,zIndex:1005,top:this.opts.fixedTop+"px",left:e})}else this.fixed=!1,this.$toolbar.css({position:"relative",width:"auto",zIndex:1,top:0,left:e})},setBuffer:function(){this.saveSelection(),this.opts.buffer=this.$editor.html()},getBuffer:function(){if(!1===this.opts.buffer)return!1;this.$editor.html(this.opts.buffer),this.browser("msie")||this.restoreSelection(),this.opts.buffer=!1},execCommand:function(e,i){if(0==this.opts.visual)return this.$el.focus(),!1;try{var n;if("inserthtml"===e)this.browser("msie")?(this.$editor.focus(),this.document.selection.createRange().pasteHTML(i)):this.pasteHtmlAtCaret(i),this.observeImages();else if("unlink"===e)n=this.getParentNode(),"A"===t(n).get(0).tagName?t(n).replaceWith(t(n).text()):this.execRun(e,i);else if("JustifyLeft"===e||"JustifyCenter"===e||"JustifyRight"===e||"JustifyFull"===e){n=this.getCurrentNode();var o=t(n).get(0).tagName;if(!1===this.opts.iframe&&0==t(n).parents(".redactor_editor").size())return!1;var r=["P","DIV","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","TD"];if(-1!=t.inArray(o,r)){var a=!1;
2"JustifyCenter"===e?a="center":"JustifyRight"===e?a="right":"JustifyFull"===e&&(a="justify"),!1===a?t(n).css("text-align",""):t(n).css("text-align",a)}else this.execRun(e,i)}else if("formatblock"===e&&"blockquote"===i)if(n=this.getCurrentNode(),"BLOCKQUOTE"===t(n).get(0).tagName)if(this.browser("msie")){var s=t("<p>"+t(n).html()+"</p>");t(n).replaceWith(s)}else this.execRun(e,"p");else if("P"===t(n).get(0).tagName){var l=t(n).parent();if("BLOCKQUOTE"===t(l).get(0).tagName){s=t("<p>"+t(n).html()+"</p>");t(l).replaceWith(s),this.setSelection(s[0],0,s[0],0)}else if(this.browser("msie")){s=t("<blockquote>"+t(n).html()+"</blockquote>");t(n).replaceWith(s)}else this.execRun(e,i)}else this.execRun(e,i);else"formatblock"!==e||"pre"!==i&&"p"!==i?("inserthorizontalrule"===e&&this.browser("msie")&&this.$editor.focus(),"formatblock"===e&&this.browser("mozilla")&&this.$editor.focus(),this.execRun(e,i)):(n=this.getParentNode(),"PRE"===t(n).get(0).tagName?t(n).replaceWith("<p>"+this.encodeEntities(t(n).text())+"</p>"):this.execRun(e,i));"inserthorizontalrule"===e&&this.$editor.find("hr").removeAttr("id"),this.syncCode(),this.oldIE()&&this.$editor.focus(),"function"==typeof this.opts.execCommandCallback&&this.opts.execCommandCallback(this,e),this.opts.air&&this.air.hide()}catch(c){}},execRun:function(t,e){"formatblock"===t&&this.browser("msie")&&(e="<"+e+">"),this.document.execCommand(t,!1,e)},formatNewLine:function(){var e=this.getParentNode();if("DIV"===e.nodeName&&"redactor_editor"===e.className){var i=t(this.getCurrentNode());if("DIV"===i.get(0).tagName&&(""===i.html()||"<br>"===i.html())){var n=t("<p>").append(i.clone().get(0).childNodes);i.replaceWith(n),n.html("<br />"),this.setSelection(n[0],0,n[0],0)}}},safariShiftKeyEnter:function(e,i){return!e.shiftKey||13!==i||(e.preventDefault(),this.insertNodeAtCaret(t("<span><br /></span>").get(0)),this.syncCode(),!1)},formatEmpty:function(e){var i=t.trim(this.$editor.html()),n=(i=i.replace(/<br\s?\/?>/i,"")).replace(/<p>\s?<\/p>/gi,"");if(""===i||""===n){e.preventDefault();var o=t(this.opts.emptyHtml).get(0);return this.$editor.html(o),this.setSelection(o,0,o,0),this.syncCode(),!1}this.syncCode()},paragraphy:function(e){if(""===(e=t.trim(e))||"<p></p>"===e)return this.opts.emptyHtml;this.opts.convertDivs&&(e=e.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi,"<p>$2</p>"));var i=function(t,e,i){return t.replace(new RegExp(e,"g"),i)},n=function(t,n){return i(e,t,n)},o="(table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|style|script|object|input|param|p|h[1-6])";return e+="\n",n("<br />\\s*<br />","\n\n"),n("(<"+o+"[^>]*>)","\n$1"),n("(</"+o+">)","$1\n\n"),n("\r\n|\r","\n"),n("\n\n+","\n\n"),n("\n?((.|\n)+?)$","<p>$1</p>\n"),n("<p>\\s*?</p>",""),n("<p>(<div[^>]*>\\s*)","$1<p>"),n("<p>([^<]+)\\s*?(</(div|address|form)[^>]*>)","<p>$1</p>$2"),n("<p>\\s*(</?"+o+"[^>]*>)\\s*</p>","$1"),n("<p>(<li.+?)</p>","$1"),n("<p>\\s*(</?"+o+"[^>]*>)","$1"),n("(</?"+o+"[^>]*>)\\s*</p>","$1"),n("(</?"+o+"[^>]*>)\\s*<br />","$1"),n("<br />(\\s*</?(p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)","$1"),-1!=e.indexOf("<pre")&&n("(<pre(.|\n)*?>)((.|\n)*?)</pre>",function(t,e,n,o){return i(e,"\\\\(['\"\\\\])","$1")+i(i(i(o,"<p>","\n"),"</p>|<br />",""),"\\\\(['\"\\\\])","$1")+"</pre>"}),n("\n</p>$","</p>")},stripTags:function(e){var i=this.opts.allowedTags,n=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;return e.replace(n,function(e,n){return t.inArray(n.toLowerCase(),i)>"-1"?e:""})},savePreCode:function(e){var i=e.match(/<pre(.*?)>([\w\W]*?)<\/pre>/gi);return null!==i&&t.each(i,t.proxy(function(t,i){var n=i.match(/<pre(.*?)>([\w\W]*?)<\/pre>/i);n[2]=this.encodeEntities(n[2]),e=e.replace(i,"<pre"+n[1]+">"+n[2]+"</pre>")},this)),e},encodeEntities:function(t){return t=String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"'),String(t).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")},cleanupPre:function(t){t=(t=(t=t.replace(/<br>/gi,"\n")).replace(/<\/p>/gi,"\n")).replace(/<\/div>/gi,"\n");var e=this.document.createElement("div");return e.innerHTML=t,e.textContent||e.innerText},pasteCleanUp:function(e){var i=this.getParentNode();if("PRE"===t(i).get(0).tagName)return e=this.cleanupPre(e),this.pasteCleanUpInsert(e),!0;e=(e=(e=e.replace(/<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi,"")).replace(/( ){2,}/gi," ")).replace(/<b\sid="internal-source-marker(.*?)">([\w\W]*?)<\/b>
2/gi,"$2"),e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=this.stripTags(e)).replace(/<td><\/td>/gi,"[td]")).replace(/<td> <\/td>/gi,"[td]")).replace(/<td><br><\/td>/gi,"[td]")).replace(/<a(.*?)href="(.*?)"(.*?)>([\w\W]*?)<\/a>/gi,'[a href="$2"]$4[/a]')).replace(/<iframe(.*?)>([\w\W]*?)<\/iframe>/gi,"[iframe$1]$2[/iframe]")).replace(/<video(.*?)>([\w\W]*?)<\/video>/gi,"[video$1]$2[/video]")).replace(/<audio(.*?)>([\w\W]*?)<\/audio>/gi,"[audio$1]$2[/audio]")).replace(/<embed(.*?)>([\w\W]*?)<\/embed>/gi,"[embed$1]$2[/embed]")).replace(/<object(.*?)>([\w\W]*?)<\/object>/gi,"[object$1]$2[/object]")).replace(/<param(.*?)>/gi,"[param$1]")).replace(/<img(.*?)style="(.*?)"(.*?)>/gi,"[img$1$3]")).replace(/<(\w+)([\w\W]*?)>/gi,"<$1>")).replace(/<[^\/>][^>]*>(\s*|\t*|\n*| |<br>)<\/[^>]+>/gi,"")).replace(/<[^\/>][^>]*>(\s*|\t*|\n*| |<br>)<\/[^>]+>/gi,"")).replace(/\[td\]/gi,"<td> </td>")).replace(/\[a href="(.*?)"\]([\w\W]*?)\[\/a\]/gi,'<a href="$1">$2</a>')).replace(/\[iframe(.*?)\]([\w\W]*?)\[\/iframe\]/gi,"<iframe$1>$2</iframe>")).replace(/\[video(.*?)\]([\w\W]*?)\[\/video\]/gi,"<video$1>$2</video>")).replace(/\[audio(.*?)\]([\w\W]*?)\[\/audio\]/gi,"<audio$1>$2</audio>")).replace(/\[embed(.*?)\]([\w\W]*?)\[\/embed\]/gi,"<embed$1>$2</embed>")).replace(/\[object(.*?)\]([\w\W]*?)\[\/object\]/gi,"<object$1>$2</object>")).replace(/\[param(.*?)\]/gi,"<param$1>")).replace(/\[img(.*?)\]/gi,"<img$1>"),this.opts.convertDivs&&(e=e.replace(/<div(.*?)>([\w\W]*?)<\/div>/gi,"<p>$2</p>")),e=(e=(e=(e=e.replace(/<span>([\w\W]*?)<\/span>/gi,"$1")).replace(/\n{3,}/gi,"\n")).replace(/<p><p>/gi,"<p>")).replace(/<\/p><\/p>/gi,"</p>"),this.browser("mozilla")&&(e=e.replace(/<br>$/gi,"")),this.pasteCleanUpInsert(e)},pasteCleanUpInsert:function(e){this.execCommand("inserthtml",e),!0===this.opts.autoresize?t(this.document.body).scrollTop(this.saveScroll):this.$editor.scrollTop(this.saveScroll)},formattingRemove:function(e){var i=[],n=e.match(/<pre(.*?)>([\w\W]*?)<\/pre>/gi);return null!==n&&t.each(n,function(t,n){e=e.replace(n,"prebuffer_"+t),i.push(n)}),e=(e=(e=(e=(e=(e=(e=e.replace(/\s{2,}/g," ")).replace(/\n/g," ")).replace(/[\t]*/g,"")).replace(/\n\s*\n/g,"\n")).replace(/^[\s\n]*/g,"")).replace(/[\s\n]*$/g,"")).replace(/>\s+</g,"><"),i&&(t.each(i,function(t,i){e=e.replace("prebuffer_"+t,i)}),i=[]),e},formattingIndenting:function(t){return t=(t=(t=(t=t.replace(/<li/g,"\t<li")).replace(/<tr/g,"\t<tr")).replace(/<td/g,"\t\t<td")).replace(/<\/tr>/g,"\t</tr>")},formattingEmptyTags:function(t){for(var e=["<pre></pre>","<blockquote>\\s*</blockquote>","<em>\\s*</em>","<ul></ul>","<ol></ol>","<li></li>","<table></table>","<tr></tr>","<span>\\s*<span>","<span> <span>","<b>\\s*</b>","<b> </b>","<p>\\s*</p>","<p> </p>","<p>\\s*<br>\\s*</p>","<div>\\s*</div>","<div>\\s*<br>\\s*</div>"],i=0;i<e.length;++i){var n=e[i];t=t.replace(new RegExp(n,"gi"),"")}return t},formattingAddBefore:function(t){for(var e="\r\n",i=["<p","<form","</ul>","</ol>","<fieldset","<legend","<object","<embed","<select","<option","<input","<textarea","<pre","<blockquote","<ul","<ol","<li","<dl","<dt","<dd","<table","<thead","<tbody","<caption","</caption>","<th","<tr","<td","<figure"],n=0;n<i.length;++n){var o=i[n];t=t.replace(new RegExp(o,"gi"),e+o)}return t},formattingAddAfter:function(t){for(var e="\r\n",i=["</p>","</div>","</h1>","</h2>","</h3>","</h4>","</h5>","</h6>","<br>","<br />","</dl>","</dt>","</dd>","</form>","</blockquote>","</pre>","</legend>","</fieldset>","</object>","</embed>","</textarea>","</select>","</option>","</table>","</thead>","</tbody>","</tr>","</td>","</th>","</figure>"],n=0;n<i.length;++n){var o=i[n];t=t.replace(new RegExp(o,"gi"),o+e)}return t},formatting:function(t){return t=this.formattingRemove(t),t=this.formattingEmptyTags(t),t=this.formattingAddBefore(t),t=this.formattingAddAfter(t),t=this.formattingIndenting(t)},toggle:function(){if(this.opts.visual){var t=this.$editor.innerHeight();this.$editor.hide(),this.$content.hide(),e=this.$editor.html(),this.$el.height(t).val(e).show().focus(),this.setBtnActive("html"),this.opts.visual
2=!1}else{this.$el.hide();var e=this.$el.val();this.$editor.html(e).show(),this.$content.show(),""===this.$editor.html()&&this.setCode(this.opts.emptyHtml),this.$editor.focus(),this.setBtnInactive("html"),this.opts.visual=!0,this.observeImages(),this.observeTables()}},autoSave:function(){this.autosaveInterval=setInterval(t.proxy(function(){t.ajax({url:this.opts.autosave,type:"post",data:this.$el.attr("name")+"="+escape(encodeURIComponent(this.getCode())),success:t.proxy(function(t){"function"==typeof this.opts.autosaveCallback&&this.opts.autosaveCallback(t,this)},this)})},this),1e3*this.opts.interval)},buildToolbar:function(){if(!1===this.opts.toolbar)return!1;this.$toolbar=t("<ul>").addClass("redactor_toolbar"),this.opts.air?(t(this.air).append(this.$toolbar),t("body").append(this.air)):!1===this.opts.toolbarExternal?this.$box.prepend(this.$toolbar):t(this.opts.toolbarExternal).html(this.$toolbar),t.each(this.opts.buttons,t.proxy(function(e,i){if("|"!==i&&"undefined"!=typeof this.opts.toolbar[i]){var n=this.opts.toolbar[i];if(!1===this.opts.fileUpload&&"file"===i)return!0;this.$toolbar.append(t("<li>").append(this.buildButton(i,n)))}"|"===i&&this.$toolbar.append(t('<li class="redactor_separator"></li>'))},this))},buildButton:function(e,i){var n=t('<a href="javascript:void(null);" title="'+i.title+'" class="redactor_btn_'+e+'"></a>');if("undefined"==typeof i.func?n.click(t.proxy(function(n){n&&n.preventDefault(),-1!=t.inArray(e,this.opts.activeButtons)&&(this.inactiveAllButtons(),this.setBtnActive(e)),this.browser("mozilla")&&this.$editor.focus(),this.execCommand(i.exec,e)},this)):"show"!==i.func&&n.click(t.proxy(function(t){this[i.func](t)},this)),"undefined"!=typeof i.callback&&!1!==i.callback&&n.click(t.proxy(function(t){i.callback(this,t,e)},this)),"backcolor"===e||"fontcolor"===e||"undefined"!=typeof i.dropdown){var o=t('<div class="redactor_dropdown" style="display: none;">');o="backcolor"===e||"fontcolor"===e?this.buildColorPicker(o,e):this.buildDropdown(o,i.dropdown),this.dropdowns.push(o.appendTo(t(document.body))),this.hdlShowDropDown=t.proxy(function(t){this.showDropDown(t,o,e)},this),n.click(this.hdlShowDropDown)}return n},buildDropdown:function(e,i){return t.each(i,t.proxy(function(i,n){var o;"undefined"==typeof n.className&&(n.className=""),"undefined"!=typeof n.name&&"separator"===n.name?o=t('<a class="redactor_separator_drop">'):(o=t('<a href="javascript:void(null);" class="'+n.className+'">'+n.title+"</a>"),"function"==typeof n.callback?t(o).click(t.proxy(function(t){n.callback(this,t,i)},this)):"undefined"==typeof n.func?t(o).click(t.proxy(function(){this.execCommand(n.exec,i)},this)):t(o).click(t.proxy(function(t){this[n.func](t)},this))),t(e).append(o)},this)),e},buildColorPicker:function(e,i){var n;n="backcolor"===i?this.browser("msie")?"BackColor":"hilitecolor":"forecolor",t(e).width(210);for(var o=this.opts.colors.length,r=0;r<o;++r){var a=this.opts.colors[r],s=t('<a rel="'+a+'" href="javascript:void(null);" class="redactor_color_link"></a>').css({backgroundColor:a});t(e).append(s);var l=this;t(s).click(function(){l.execCommand(n,t(this).attr("rel")),"forecolor"===n&&l.$editor.find("font").replaceWith(function(){return t('<span style="color: '+t(this).attr("color")+';">'+t(this).html()+"</span>")}),l.browser("msie")&&"BackColor"===n&&l.$editor.find("font").replaceWith(function(){return t('<span style="'+t(this).attr("style")+'">'+t(this).html()+"</span>")})})}var c=t('<a href="javascript:void(null);" class="redactor_color_none"></a>').html(RLANG.none);return"backcolor"===i?c.click(t.proxy(this.setBackgroundNone,this)):c.click(t.proxy(this.setColorNone,this)),t(e).append(c),e},setBackgroundNone:function(){t(this.getParentNode()).css("background-color","transparent"),this.syncCode()},setColorNone:function(){t(this.getParentNode()).attr("color","").css("color",""),this.syncCode()},showDropDown:function(e,i,n){if(this.getBtn(n).hasClass("dropact"))this.hideAllDropDown();else{this.hideAllDropDown(),this.setBtnActive(n),this.getBtn(n).addClass("dropact");var o=this.getBtn(n).offset().left;if(this.opts.air){var r=this.air.offset().top;t(i).css({position:"absolute",left:o+"px",top:r+30+"px"}).show()}else if(this.opts.fixed&&this.fixed)t(i).css({position:"fixed",left:o+"px",top:"30px"}).show();else{var a=this.$toolbar.offset().top+30;t(i).css({position:"absolute",left:o+"px",top:a+"px"}).show()}}var s=t.proxy(function(t){this.hideDropDown(t,i,n)},this);
2t(document).one("click",s),this.$editor.one("click",s),this.$content.one("click",s),e.stopPropagation()},hideAllDropDown:function(){this.$toolbar.find("a.dropact").removeClass("redactor_act").removeClass("dropact"),t(".redactor_dropdown").hide()},hideDropDown:function(e,i){t(e.target).hasClass("dropact")||(t(i).removeClass("dropact"),this.showedDropDown=!1,this.hideAllDropDown())},getBtn:function(e){return!1!==this.opts.toolbar&&t(this.$toolbar.find("a.redactor_btn_"+e))},setBtnActive:function(t){this.getBtn(t).addClass("redactor_act")},setBtnInactive:function(t){this.getBtn(t).removeClass("redactor_act")},inactiveAllButtons:function(){t.each(this.opts.activeButtons,t.proxy(function(t,e){this.setBtnInactive(e)},this))},changeBtnIcon:function(t,e){this.getBtn(t).addClass("redactor_btn_"+e)},removeBtnIcon:function(t,e){this.getBtn(t).removeClass("redactor_btn_"+e)},addBtnSeparator:function(){this.$toolbar.append(t('<li class="redactor_separator"></li>'))},addBtnSeparatorAfter:function(e){this.getBtn(e).parent().after(t('<li class="redactor_separator"></li>'))},addBtnSeparatorBefore:function(e){this.getBtn(e).parent().before(t('<li class="redactor_separator"></li>'))},removeBtnSeparatorAfter:function(t){this.getBtn(t).parent().next().remove()},removeBtnSeparatorBefore:function(t){this.getBtn(t).parent().prev().remove()},setBtnRight:function(t){if(!1===this.opts.toolbar)return!1;this.getBtn(t).parent().addClass("redactor_btn_right")},setBtnLeft:function(t){if(!1===this.opts.toolbar)return!1;this.getBtn(t).parent().removeClass("redactor_btn_right")},addBtn:function(e,i,n,o){if(!1===this.opts.toolbar)return!1;var r=this.buildButton(e,{title:i,callback:n,dropdown:o});this.$toolbar.append(t("<li>").append(r))},addBtnFirst:function(e,i,n,o){if(!1===this.opts.toolbar)return!1;var r=this.buildButton(e,{title:i,callback:n,dropdown:o});this.$toolbar.prepend(t("<li>").append(r))},addBtnAfter:function(e,i,n,o,r){if(!1===this.opts.toolbar)return!1;var a=this.buildButton(i,{title:n,callback:o,dropdown:r});this.getBtn(e).parent().after(t("<li>").append(a))},addBtnBefore:function(e,i,n,o,r){if(!1===this.opts.toolbar)return!1;var a=this.buildButton(i,{title:n,callback:o,dropdown:r});this.getBtn(e).parent().before(t("<li>").append(a))},removeBtn:function(t,e){var i=this.getBtn(t);!0===e&&i.parent().next().remove(),i.parent().removeClass("redactor_btn_right"),i.remove()},getFragmentHtml:function(t){var e=t.cloneNode(!0),i=this.document.createElement("div");return i.appendChild(e),i.innerHTML},extractContent:function(){for(var t,e=this.$editor.get(0),i=this.document.createDocumentFragment();t=e.firstChild;)i.appendChild(t);return i},saveSelection:function(){this.$editor.focus(),this.savedSel=this.getOrigin(),this.savedSelObj=this.getFocus()},restoreSelection:function(){"undefined"!=typeof this.savedSel&&null!==this.savedSel&&null!==this.savedSelObj&&"BODY"!==this.savedSel[0].tagName?!1===this.opts.iframe&&0==t(this.savedSel[0]).closest(".redactor_editor").size()?this.$editor.focus():(this.browser("opera")&&this.$editor.focus(),this.setSelection(this.savedSel[0],this.savedSel[1],this.savedSelObj[0],this.savedSelObj[1]),this.browser("mozilla")&&this.$editor.focus()):this.$editor.focus()},getSelection:function(){var t=this.document;return this.window.getSelection?this.window.getSelection():t.getSelection?t.getSelection():t.selection.createRange()},hasSelection:function(){if(this.oldIE()){var t,e=this.$editor.get(0);return e.focus(),e.document.selection?(t=e.document.selection.createRange())&&t.parentElement().document===e.document:!1}var i;return(i=this.getSelection())&&null!=i.focusNode&&null!=i.anchorNode},getOrigin:function(){if(this.oldIE()){var t,e=this.$editor.get(0);return e.focus(),this.hasSelection()?(t=e.document.selection.createRange(),this._getBoundary(e.document,t,!0)):null}var i;return(i=this.getSelection())&&null!=i.anchorNode?[i.anchorNode,i.anchorOffset]:null},getFocus:function(){if(this.oldIE()){var t,e=this.$editor.get(0);return e.focus(),this.hasSelection()?(t=e.document.selection.createRange(),this._getBoundary(e.document,t,!1)):null}var i;return(i=this.getSelection())&&null!=i.focusNode?[i.focusNode,i.focusOffset]:null}
2,setSelection:function(t,e,i,n){if(null==i&&(i=t),null==n&&(n=e),this.oldIE()){var o=this.$editor.get(0),a=o.document.body.createTextRange();return this._moveBoundary(o.document,a,!1,i,n),this._moveBoundary(o.document,a,!0,t,e),a.select()}var s=this.getSelection();if(s)if(s.collapse&&s.extend)s.collapse(t,e),s.extend(i,n);else{r=this.document.createRange(),r.setStart(t,e),r.setEnd(i,n);try{s.removeAllRanges()}catch(l){}s.addRange(r)}},getCurrentNode:function(){return"undefined"!=typeof this.window.getSelection?this.getSelectedNode().parentNode:"undefined"!=typeof this.document.selection?this.getSelection().parentElement():void 0},getParentNode:function(){return t(this.getCurrentNode()).parent()[0]},getSelectedNode:function(){return this.oldIE()?this.getSelection().parentElement():"undefined"!=typeof this.window.getSelection?this.window.getSelection().rangeCount>0&&this.getSelection().getRangeAt(0).commonAncestorContainer:"undefined"!=typeof this.document.selection?this.getSelection():void 0},_getBoundary:function(t,e,i){var n,o,r,a,s;for(o=t.createElement("a"),(n=e.duplicate()).collapse(i),s=n.parentElement();;){try{s.insertBefore(o,o.previousSibling),n.moveToElementText(o)}catch(l){}if(!(n.compareEndPoints(i?"StartToStart":"StartToEnd",e)>0&&null!=o.previousSibling))break}return-1===n.compareEndPoints(i?"StartToStart":"StartToEnd",e)&&o.nextSibling?(n.setEndPoint(i?"EndToStart":"EndToEnd",e),r=o.nextSibling,a=n.text.length):(r=o.parentNode, 3a=this._getChildIndex(o)),o.parentNode.removeChild(o),[r,a]},_moveBoundary:function(t,e,i,n,o){var r,a,s,l,c;return c=0,r=this._isText(n)?n:n.childNodes[o],a=this._isText(n)?n.parentNode:n,this._isText(n)&&(c=o),l=t.createElement("a"),a.insertBefore(l,r||null),(s=t.body.createTextRange()).moveToElementText(l),l.parentNode.removeChild(l),e.setEndPoint(i?"StartToStart":"EndToEnd",s),e[i?"moveStart":"moveEnd"]("character",c)},_isText:function(t){return null!=t&&3==t.nodeType},_getChildIndex:function(t){for(var e=0;t=t.previousSibling;)e++;return e},insertNodeAfterCaret:function(t){this.saveSelection(),this.insertNodeAtCaret(t),this.restoreSelection()},insertNodeAtCaret:function(t){if(this.window.getSelection){var e=this.getSelection();if(e.rangeCount){var i=e.getRangeAt(0);i.collapse(!1),i.insertNode(t),(i=i.cloneRange()).selectNodeContents(t),i.collapse(!1),e.removeAllRanges(),e.addRange(i)}}else if(this.document.selection){var n=1===t.nodeType?t.outerHTML:t.data,o="marker_"+(""+Math.random()).slice(2);n+='<span id="'+o+'"></span>';var r=this.getSelection();r.collapse(!1),r.pasteHTML(n);var a=this.document.getElementById(o);r.moveToElementText(a),r.select(),a.parentNode.removeChild(a)}},getSelectedHtml:function(){var t="";if(this.window.getSelection){var e=this.window.getSelection();if(e.rangeCount){for(var i=this.document.createElement("div"),n=0,o=e.rangeCount;n<o;++n)i.appendChild(e.getRangeAt(n).cloneContents());t=i.innerHTML}}else this.document.selection&&"Text"===this.document.selection.type&&(t=this.document.selection.createRange().htmlText);return t},resizeImage:function(e){var i,n=!1,o=!1,r=t(e).width()/t(e).height(),a=10,s=10;t(e).off("hover mousedown mouseup click mousemove"),t(e).hover(function(){t(e).css("cursor","nwse-resize")},function(){t(e).css("cursor",""),n=!1}),t(e).mousedown(function(a){a.preventDefault(),r=t(e).width()/t(e).height(),n=!0,o=!0,Math.round(a.pageX-t(e).eq(0).offset().left),i=Math.round(a.pageY-t(e).eq(0).offset().top)}),t(e).mouseup(t.proxy(function(){n=!1,t(e).css("cursor",""),this.syncCode()},this)),t(e).click(t.proxy(function(t){o&&this.imageEdit(t)},this)),t(e).mousemove(function(l){if(n){o=!1;Math.round(l.pageX-t(this).eq(0).offset().left);var c=Math.round(l.pageY-t(this).eq(0).offset().top)-i,d=t(e).height(),u=parseInt(d,10)+c,h=parseInt(u*r);h>a&&t(e).width(h),u>s&&t(e).height(u),t(e).attr("width",h).attr("height",u),Math.round(l.pageX-t(this).eq(0).offset().left),i=Math.round(l.pageY-t(this).eq(0).offset().top)}})},showTable:function(){this.saveSelection(),this.modalInit(RLANG.table,this.opts.modal_table,300,t.proxy(function(){t("#redactor_insert_table_btn").click(t.proxy(this.insertTable,this)),setTimeout(function(){t("#redactor_table_rows").focus()},200)},this))}
3,insertTable:function(){for(var e=t("#redactor_table_rows").val(),i=t("#redactor_table_columns").val(),n=t("<div></div>"),o=Math.floor(99999*Math.random()),r=t('<table id="table'+o+'"><tbody></tbody></table>'),a=0;a<e;a++){for(var s=t("<tr></tr>"),l=0;l<i;l++){var c=t("<td><br></td>");t(s).append(c)}t(r).append(s)}t(n).append(r);var d=t(n).html()+"<p></p>";this.restoreSelection(),this.execCommand("inserthtml",d),this.modalClose(),this.observeTables()},tableObserver:function(e){this.$table=t(e.target).closest("table"),this.$table_tr=this.$table.find("tr"),this.$table_td=this.$table.find("td"),this.$tbody=t(e.target).closest("tbody"),this.$thead=t(this.$table).find("thead"),this.$current_td=t(e.target),this.$current_tr=t(e.target).closest("tr")},deleteTable:function(){t(this.$table).remove(),this.$table=!1,this.syncCode()},deleteRow:function(){t(this.$current_tr).remove(),this.syncCode()},deleteColumn:function(){var e=t(this.$current_td).get(0).cellIndex;t(this.$table).find("tr").each(function(){t(this).find("td").eq(e).remove()}),this.syncCode()},addHead:function(){if(0!==t(this.$table).find("thead").size())this.deleteHead();else{var e=t(this.$table).find("tr").first().clone();e.find("td").html(" "),this.$thead=t("<thead></thead>"),this.$thead.append(e),t(this.$table).prepend(this.$thead),this.syncCode()}},deleteHead:function(){t(this.$thead).remove(),this.$thead=!1,this.syncCode()},insertRowAbove:function(){this.insertRow("before")},insertRowBelow:function(){this.insertRow("after")},insertColumnLeft:function(){this.insertColumn("before")},insertColumnRight:function(){this.insertColumn("after")},insertRow:function(e){var i=t(this.$current_tr).clone();i.find("td").html(" "),"after"===e?t(this.$current_tr).after(i):t(this.$current_tr).before(i),this.syncCode()},insertColumn:function(e){var i=0;this.$current_tr.find("td").each(t.proxy(function(e,n){t(n)[0]===this.$current_td[0]&&(i=e)},this)),this.$table_tr.each(function(n,o){var r=t(o).find("td").eq(i),a=r.clone();a.html(" "),"after"===e?t(r).after(a):t(r).before(a)}),this.syncCode()},showVideo:function(){this.saveSelection(),this.modalInit(RLANG.video,this.opts.modal_video,600,t.proxy(function(){t("#redactor_insert_video_btn").click(t.proxy(this.insertVideo,this)),setTimeout(function(){t("#redactor_insert_video_area").focus()},200)},this))},insertVideo:function(){var e=t("#redactor_insert_video_area").val();e=this.stripTags(e);var i=t("<div/>",{"class":"embed-container"});e=e.replace(/(?:width|height)\s*=\s*["']([0-9]+)["']\s*(?:width|height)\s*=\s*["']([0-9]+)["']/gi,""),e=i.append(e).prop("outerHTML"),this.restoreSelection(),this.execCommand("inserthtml",e),this.modalClose()},imageEdit:function(e){var i=t(e.target),n=i.parent(),o=t.proxy(function(){t("#redactor_file_alt").val(i.attr("alt")),t("#redactor_image_edit_src").attr("href",i.attr("src")),t("#redactor_form_image_align").val(i.css("float")),"A"===t(n).get(0).tagName&&t("#redactor_file_link").val(t(n).attr("href")),t("#redactor_image_delete_btn").click(t.proxy(function(){this.imageDelete(i)},this)),t("#redactorSaveBtn").click(t.proxy(function(){this.imageSave(i)},this))},this);this.modalInit(RLANG.edit_image,this.opts.modal_image_edit,380,o)},imageDelete:function(e){var i=t(e).parent();0!=i.size()&&"A"==i[0].tagName?i.remove():t(e).remove(),this.modalClose(),this.syncCode()},imageSave:function(e){var i=t(e).parent();t(e).attr("alt",t("#redactor_file_alt").val());var n=t("#redactor_form_image_align").val();"left"===n?t(e).css({float:"left",margin:"0 10px 10px 0"}):"right"===n?t(e).css({float:"right",margin:"0 0 10px 10px"}):"full"===n?t(e).css({float:"none",margin:"0 0 10px 10px"}):t(e).css({float:"none",margin:"0"});var o=t.trim(t("#redactor_file_link").val());""!==o?"A"!==t(i).get(0).tagName?t(e).replaceWith('<a href="'+o+'">'+this.outerHTML(e)+"</a>"):t(i).attr("href",o):"A"===t(i).get(0).tagName&&t(i).replaceWith(this.outerHTML(e)),this.modalClose(),this.observeImages(),this.syncCode()},showImage:function(){this.saveSelection();var e=t.proxy(function(){if(!1!==this.opts.imageGetJson?t.getJSON(this.opts.imageGetJson,t.proxy(function(e){var i={},n=0;t.each(e,t.proxy(function(t,e){"undefined"!=typeof e.folder&&(n++,i[e.folder]=n)},this));var o=!1;if(t.each(e,t.proxy(function(e,n){var r="";"undefined"!=typeof n.title&&(r=n.title);var a=0;t.isEmptyObject(i)||"undefined"==typeof n.folder||(a=i[n.folder],!1===o&&(o=".redactorfolder"+a));var s=t('<img src="'+n.thumb+'" class="redactorfolder redactorfolder'+a+'" rel="'+n.image+'" title="'+r+'" />');t("#redactor_image_box").append(s),t(s).click(t.proxy(this.imageSetThumb,this))},this)),!t.isEmptyObject(i)){t(".redactorfolder").hide(),t(o).show();var r=function(e){t(".redactorfolder").hide(),t(".redactorfolder"+t(e.target).val()).show()},a=t('<select id="redactor_image_box_select">');t.each(i,function(e,i){a.append(t('<option value="'+i+'">'+e+"</option>"))}),t("#redactor_image_box").before(a),a.change(r)}},this)):t("#redactor_tabs a").eq(1).remove(),!1!==this.opts.imageUpload)!1===this.opts.uploadCrossDomain&&!1===this.isMobile()&&0!==t("#redactor_file").size()&&t("#redactor_file").dragupload({url:this.opts.imageUpload,uploadFields:this.opts.uploadFields,success:t.proxy(this.imageUploadCallback,this),error:t.proxy(this.opts.imageUploadErrorCallback,this)}),this.uploadInit("redactor_file",{auto:!0,url:this.opts.imageUpload,success:t.proxy(this.imageUploadCallback,this),error:t.proxy(this.opts.imageUploadErrorCallback,this)});else if(t(".redactor_tab").hide(),!1===this.opts.imageGetJson)t("#redactor_tabs").remove(),t("#redactor_tab3").show();else{var e=t("#redactor_tabs a");e.eq(0).remove(),e.eq(1).addClass("redactor_tabs_act"),t("#redactor_tab2").show()}t("#redactor_upload_btn").click(t.proxy(this.imageUploadCallbackLink,this)),!1===this.opts.imageUpload&&!1===this.opts.imageGetJson&&setTimeout(function(){t("#redactor_file_link").focus()},200)},this);this.modalInit(RLANG.image,this.opts.modal_image,610,e)},imageSetThumb:function(e){this._imageSet('<img src="'+t(e.target).attr("rel")+'" alt="'+t(e.target).attr("title")+'" />',!0)},imageUploadCallbackLink:function(){if(""!==t("#redactor_file_link").val()){var e='<img src="'+t("#redactor_file_link").val()+'" alt="" />';this._imageSet(e,!0)}else this.modalClose()},imageUploadCallback:function(t){this._imageSet(t)},_imageSet:function(t,e){if(this.restoreSelection(),!1!==t){var i="";i=!0!==e?'<p><img src="'+t.filelink+'" alt="" /></p>
3':t,this.execCommand("inserthtml",i),!0!==e&&"function"==typeof this.opts.imageUploadCallback&&this.opts.imageUploadCallback(this,t)}this.modalClose(),this.observeImages()},showLink:function(){this.saveSelection();var e=t.proxy(function(){this.insert_link_node=!1;var e=this.getSelection(),i="",n="",o="";if(this.browser("msie")){var r=this.getParentNode();"A"===r.nodeName?(this.insert_link_node=t(r),n=this.insert_link_node.text(),i=this.insert_link_node.attr("href"),o=this.insert_link_node.attr("target")):n=this.oldIE()?e.text:e.toString()}else e&&e.anchorNode&&"A"===e.anchorNode.parentNode.tagName?(i=e.anchorNode.parentNode.href,n=e.anchorNode.parentNode.text,o=e.anchorNode.parentNode.target,""===e.toString()&&(this.insert_link_node=e.anchorNode.parentNode)):n=e.toString();t(".redactor_link_text").val(n);var a=self.location.href.replace(/\/$/i,""),s=i.replace(a,"");0===i.search("mailto:")?(this.setModalTab(2),t("#redactor_tab_selected").val(2),t("#redactor_link_mailto").val(i.replace("mailto:",""))):0===s.search(/^#/gi)?(this.setModalTab(3),t("#redactor_tab_selected").val(3),t("#redactor_link_anchor").val(s.replace(/^#/gi,""))):t("#redactor_link_url").val(s),"_blank"===o&&t("#redactor_link_blank").attr("checked",!0),t("#redactor_insert_link_btn").click(t.proxy(this.insertLink,this)),setTimeout(function(){t("#redactor_link_url").focus()},200)},this);this.modalInit(RLANG.link,this.opts.modal_link,460,e)},insertLink:function(){var e=t("#redactor_tab_selected").val(),i="",n="",o="",r="";if("1"===e){i=t("#redactor_link_url").val(),n=t("#redactor_link_url_text").val(),t("#redactor_link_blank").prop("checked")&&(o=' target="_blank"',r="_blank");var a="/(w+:{0,1}w*@)?(S+)(:[0-9]+)?(/|/([w#!:.?+=&%@!-/]))?/",s=new RegExp("^(http|ftp|https)://"+a,"i"),l=new RegExp("^"+a,"i");-1==i.search(s)&&0==i.search(l)&&!1!==this.opts.protocol&&(i=this.opts.protocol+i)}else"2"===e?(i="mailto:"+t("#redactor_link_mailto").val(),n=t("#redactor_link_mailto_text").val()):"3"===e&&(i="#"+t("#redactor_link_anchor").val(),n=t("#redactor_link_anchor_text").val());this._insertLink('<a href="'+i+'"'+o+">"+n+"</a>",t.trim(n),i,r)},_insertLink:function(e,i,n,o){this.$editor.focus(),this.restoreSelection(),""!==i&&(this.insert_link_node?(t(this.insert_link_node).text(i),t(this.insert_link_node).attr("href",n),""!==o?t(this.insert_link_node).attr("target",o):t(this.insert_link_node).removeAttr("target"),this.syncCode()):this.execCommand("inserthtml",e)),this.modalClose()},showFile:function(){this.saveSelection();var e=t.proxy(function(){var e=this.getSelection(),i="";i=this.oldIE()?e.text:e.toString(),t("#redactor_filename").val(i),!1===this.opts.uploadCrossDomain&&!1===this.isMobile()&&t("#redactor_file").dragupload({url:this.opts.fileUpload,uploadFields:this.opts.uploadFields,success:t.proxy(this.fileUploadCallback,this),error:t.proxy(this.opts.fileUploadErrorCallback,this)}),this.uploadInit("redactor_file",{auto:!0,url:this.opts.fileUpload,success:t.proxy(this.fileUploadCallback,this),error:t.proxy(this.opts.fileUploadErrorCallback,this)})},this);this.modalInit(RLANG.file,this.opts.modal_file,500,e)},fileUploadCallback:function(e){if(this.restoreSelection(),!1!==e){var i=t("#redactor_filename").val();""===i&&(i=e.filename);var n='<a href="'+e.filelink+'">'+i+"</a>";this.browser("webkit")&&this.window.chrome&&(n+=" "),this.execCommand("inserthtml",n),"function"==typeof this.opts.fileUploadCallback&&this.opts.fileUploadCallback(this,e)}this.modalClose()},modalInit:function(e,i,n,o){if(0===t("#redactor_modal_overlay").size()&&(this.overlay=t('<div id="redactor_modal_overlay" style="display: none;"></div>'),t("body").prepend(this.overlay)),this.opts.overlay&&(t("#redactor_modal_overlay").show(),t("#redactor_modal_overlay").click(t.proxy(this.modalClose,this))),0===t("#redactor_modal").size()&&(this.modal=t('<div id="redactor_modal" style="display: none;"><div id="redactor_modal_close">×</div><div id="redactor_modal_header"></div><div id="redactor_modal_inner"></div></div>'),t("body").append(this.modal)),t("#redactor_modal_close").click(t.proxy(this.modalClose,this)),this.hdlModalClose=t.proxy(function(t){if(27===t.keyCode)return this.modalClose(),!1},this),t(document).keyup(this.hdlModalClose),this.$editor.keyup(this.hdlModalClose),0==i.indexOf("#")?t("#redactor_modal_inner").empty().append(t(i).html()):t("#redactor_modal_inner").empty().append(i),t("#redactor_modal_header").html(e),"undefined"!=typeof t.fn.draggable&&(t("#redactor_modal").draggable({handle:"#redactor_modal_header"}),t("#redactor_modal_header").css("cursor","move")),0!==t("#redactor_tabs").size()){var r=this;t("#redactor_tabs a").each(function(e,i){e++,t(i).click(function(){if(t("#redactor_tabs a").removeClass("redactor_tabs_act"),t(this).addClass("redactor_tabs_act"),t(".redactor_tab").hide(),t("#redactor_tab"+e).show(),t("#redactor_tab_selected").val(e),!1===r.isMobile()){var i=t("#redactor_modal").outerHeight();t("#redactor_modal").css("margin-top","-"+(i+10)/2+"px")}})})}t("#redactor_modal .redactor_btn_modal_close").click(t.proxy(this.modalClose,this)),!1===this.isMobile()?(t("#redactor_modal").css({position:"fixed",top:"-2000px",left:"50%",width:n+"px",marginLeft:"-"+(n+60)/2+"px"}).show(),this.modalSaveBodyOveflow=t(document.body).css("overflow"),t(document.body).css("overflow","hidden")):t("#redactor_modal").css({position:"fixed",width:"100%",height:"100%",top:"0",left:"0",margin:"0",minHeight:"300px"}).show(),"function"==typeof o&&o(),!1===this.isMobile()&&setTimeout(function(){var e=t("#redactor_modal").outerHeight();t("#redactor_modal").css({top:"50%",height:"auto",minHeight:"auto",marginTop:"-"+(e+10)/2+"px"})},20)},modalClose:function(){return t("#redactor_modal_close").unbind("click",this.modalClose),t("#redactor_modal").fadeOut("fast",t.proxy(function(){t("#redactor_modal_inner").html(""),this.opts.overlay&&(t("#redactor_modal_overlay").hide(),t("#redactor_modal_overlay").unbind("click",this.modalClose)),t(document).unbind("
3keyup",this.hdlModalClose),this.$editor.unbind("keyup",this.hdlModalClose)},this)),!1===this.isMobile()&&t(document.body).css("overflow",this.modalSaveBodyOveflow?this.modalSaveBodyOveflow:"visible"),!1},setModalTab:function(e){t(".redactor_tab").hide();var i=t("#redactor_tabs a");i.removeClass("redactor_tabs_act"),i.eq(e-1).addClass("redactor_tabs_act"),t("#redactor_tab"+e).show()},uploadInit:function(e,i){this.uploadOptions={url:!1,success:!1,error:!1,start:!1,trigger:!1,auto:!1,input:!1},t.extend(this.uploadOptions,i),0!==t("#"+e).size()&&"INPUT"===t("#"+e).get(0).tagName?(this.uploadOptions.input=t("#"+e),this.element=t(t("#"+e).get(0).form)):this.element=t("#"+e),this.element_action=this.element.attr("action"),this.uploadOptions.auto?t(this.uploadOptions.input).change(t.proxy(function(){this.element.submit(function(){return!1}),this.uploadSubmit()},this)):this.uploadOptions.trigger&&t("#"+this.uploadOptions.trigger).click(t.proxy(this.uploadSubmit,this))},uploadSubmit:function(){this.uploadForm(this.element,this.uploadFrame())},uploadFrame:function(){this.id="f"+Math.floor(99999*Math.random());var e=this.document.createElement("div"),i='<iframe style="display:none" id="'+this.id+'" name="'+this.id+'"></iframe>';return e.innerHTML=i,t(e).appendTo("body"),this.uploadOptions.start&&this.uploadOptions.start(),t("#"+this.id).load(t.proxy(this.uploadLoaded,this)),this.id},uploadForm:function(e,i){if(this.uploadOptions.input){var n="redactorUploadForm"+this.id,o="redactorUploadFile"+this.id;this.form=t('<form action="'+this.uploadOptions.url+'" method="POST" target="'+i+'" name="'+n+'" id="'+n+'" enctype="multipart/form-data"></form>'),!1!==this.opts.uploadFields&&"object"==typeof this.opts.uploadFields&&t.each(this.opts.uploadFields,t.proxy(function(e,i){0===i.toString().indexOf("#")&&(i=t(i).val());var n=t("<input/>",{type:"hidden",name:e,value:i});t(this.form).append(n)},this));var r=this.uploadOptions.input,a=t(r).clone();t(r).attr("id",o),t(r).before(a),t(r).appendTo(this.form),t(this.form).css("position","absolute"),t(this.form).css("top","-2000px"),t(this.form).css("left","-2000px"),t(this.form).appendTo("body"),this.form.submit()}else e.attr("target",i),e.attr("method","POST"),e.attr("enctype","multipart/form-data"),e.attr("action",this.uploadOptions.url),this.element.submit()},uploadLoaded:function(){var e,i=t("#"+this.id)[0];if(e=i.contentDocument?i.contentDocument:i.contentWindow?i.contentWindow.document:window.frames[this.id].document,this.uploadOptions.success)if(void 0!==e){var n=e.body.innerHTML.match(/\{(.|\n)*\}/)[0],o=t.parseJSON(n);"undefined"==typeof o.error?this.uploadOptions.success(o):(this.uploadOptions.error(this,o),this.modalClose())}else alert("Upload failed!"),this.modalClose();this.element.attr("action",this.element_action),this.element.attr("target","")},browser:function(t){var e=navigator.userAgent.toLowerCase(),i=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return"version"==t?i[2]:"webkit"==t?"chrome"==i[1]||"webkit"==i[1]:i[1]==t},oldIE:function(){return!!(this.browser("msie")&&parseInt(this.browser("version"),10)<9)},outerHTML:function(e){return t("<p>").append(t(e).eq(0).clone()).html()},normalize:function(t){return parseInt(t.replace("px",""),10)},isMobile:function(t){return!(!0!==t||!/(iPhone|iPod|iPad|BlackBerry|Android)/.test(navigator.userAgent))||!!/(iPhone|iPod|BlackBerry|Android)/.test(navigator.userAgent)}},t.fn.getObject=function(){return this.data("redactor")},t.fn.getEditor=function(){return this.data("redactor").$editor},t.fn.getCode=function(){return t.trim(this.data("redactor").getCode())},t.fn.getText=function(){return this.data("redactor").$editor.text()},t.fn.getSelected=function(){return this.data("redactor").getSelectedHtml()},t.fn.setCode=function(t){this.data("redactor").setCode(t)},t.fn.insertHtml=function(t){this.data("redactor").insertHtml(t)},t.fn.destroyEditor=function(){this.each(function(){void 0!==t(this).data("redactor")&&(t(this).data("redactor").destroy(),t(this).removeData("redactor"))})},t.fn.setFocus=function(){this.data("redactor").$editor.focus()},t.fn.execCommand=function(t,e){this.data("redactor").execCommand(t,e)}}(jQuery),function(t){"use strict";function e(e,i){this.opts=t.extend({url:!1,success:!1,error:!1,preview:!1,uploadFields:!1,text:RLANG.drop_file_here,atext:RLANG.or_choose},i),this.$el=t(e)}t.fn.dragupload=function(t){return this.each(function(){new e(this,t).init()})}
3,e.prototype={init:function(){if(-1===navigator.userAgent.search("MSIE")){this.droparea=t('<div class="redactor_droparea"></div>'),this.dropareabox=t('<div class="redactor_dropareabox">'+this.opts.text+"</div>"),this.dropalternative=t('<div class="redactor_dropalternative">'+this.opts.atext+"</div>"),this.droparea.append(this.dropareabox),this.$el.before(this.droparea),this.$el.before(this.dropalternative),this.dropareabox.bind("dragover",t.proxy(function(){return this.ondrag()},this)),this.dropareabox.bind("dragleave",t.proxy(function(){return this.ondragleave()},this));var e=t.proxy(function(t){var e=parseInt(t.loaded/t.total*100,10);this.dropareabox.text("Loading "+e+"%")},this),i=jQuery.ajaxSettings.xhr();i.upload&&i.upload.addEventListener("progress",e,!1);var n=function(){return i};this.dropareabox.get(0).ondrop=t.proxy(function(e){e.preventDefault(),this.dropareabox.removeClass("hover").addClass("drop");var i=e.dataTransfer.files[0],o=new FormData;!1!==this.opts.uploadFields&&"object"==typeof this.opts.uploadFields&&t.each(this.opts.uploadFields,t.proxy(function(e,i){0===i.toString().indexOf("#")&&(i=t(i).val()),o.append(e,i)},this)),o.append("file",i),t.ajax({url:this.opts.url,dataType:"html",data:o,xhr:n,cache:!1,contentType:!1,processData:!1,type:"POST",success:t.proxy(function(e){var i=t.parseJSON(e);"undefined"==typeof i.error?this.opts.success(i):(this.opts.error(this,i),this.opts.success(!1))},this)})},this)}},ondrag:function(){return this.dropareabox.addClass("hover"),!1},ondragleave:function(){return this.dropareabox.removeClass("hover"),!1}}}(jQuery),function(t){"use strict";var e="http://",i=/(^|<|\s)(www\..+?\..+?)(\s|>|$)/g,n=/(^|<|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|>|$)/g,o=function(){for(var r=this.childNodes,a=r.length;a--;){var s=r[a];if(3===s.nodeType){var l=s.nodeValue;l&&(l=l.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(i,'$1<a href="'+e+'$2">$2</a>$3').replace(n,'$1<a href="$2">$2</a>$5'),t(s).after(l).remove())}else 1!==s.nodeType||/^(a|button|textarea)$/i.test(s.tagName)||o.call(s)}};t.fn.linkify=function(){this.each(o)}}(jQuery),function(t){t.event.special.textselect={setup:function(e){t(this).data("textselected",!1),t(this).data("ttt",e),t(this).on("mouseup",t.event.special.textselect.handler)},teardown:function(){t(this).off("mouseup",t.event.special.textselect.handler)},handler:function(e){var i=t(this).data("ttt"),n=t.event.special.textselect.getSelectedText(i).toString();""!=n&&(t(this).data("textselected",!0),e.type="textselect",e.text=n,t.event.dispatch.apply(this,arguments))},getSelectedText:function(){var t="";return rwindow.getSelection?t=rwindow.getSelection():rdocument.getSelection?t=rdocument.getSelection():rdocument.selection&&(t=rdocument.selection.createRange().text),t}},t.event.special.textunselect={setup:function(e){t(this).data("rttt",e),t(this).data("textselected",!1),t(this).on("mouseup",t.event.special.textunselect.handler),t(this).on("keyup",t.event.special.textunselect.handlerKey)},teardown:function(){t(this).unbind("mouseup",t.event.special.textunselect.handler)},handler:function(e){if(t(this).data("textselected")){var i=t(this).data("rttt");""==t.event.special.textselect.getSelectedText(i).toString()&&(t(this).data("textselected",!1),e.type="textunselect",t.event.dispatch.apply(this,arguments))}},handlerKey:function(e){if(t(this).data("textselected")){var i=t(this).data("rttt"),n=t.event.special.textselect.getSelectedText(i).toString();(e.keyCode=27)&&""==n&&(t(this).data("textselected",!1),e.type="textunselect",t.event.dispatch.apply(this,arguments))}}}}(jQuery),EHQ=EHQ||{},$(function(){var t;t=function(){var t,e,i,n,o;return EHQ.environment=EHQ.environment||$("body").data("environment"),i=$("meta[name=csrf-token]").attr("content"),e=$("meta[name=csrf-param]").attr("content"),t=function(t){return $(t).data("prohibit-choose-image")?"":"<a href='javascript:void(null);'> "+RLANG.choose+" </a>"},e&&i&&(n=e+"="+encodeURIComponent(i)),0===$(".redactor_box").siblings(".redactor-help").length&&$('<div class="redactor-help" style="font-weight:normal;
3 color:#aaa; line-height: 1; padding: 0 0 4px 0"></div>').insertBefore(".redactor_box"),$("#redactor_upload_btn").click(function(){return $(".redactor-help").html("You can resize the image by dragging")}),o=function(e){return{imageUpload:"/redactor_assets?"+n+"&"+EHQ.environment,imageGetJson:"/redactor_assets?"+EHQ.environment,imageUploadCallback:function(){return $(".redactor-help").html("You can resize the image by dragging")},buttons:["formatting","bold","italic","deleted","underline","|","alignment","|","unorderedlist","orderedlist","|","image","video","file","link","|","html","fontcolor"],iframe:!0,css:"/assets/redcator_iframe.css",convertDivs:!1,minHeight:140,modal_image:'<div id="redactor_modal_content">\n <div id="redactor_tabs">\n <a href="javascript:void(null);" class="redactor_tabs_act"> '+RLANG.upload+" </a>\n "+t(e)+'\n <a href="javascript:void(null);"> '+RLANG.link+' </a>\n </div>\n <form id="redactorInsertImageForm" method="post" action="" enctype="multipart/form-data">\n <div id="redactor_tab1" class="redactor_tab">\n <input type="file" id="redactor_file" name="file" />\n </div>\n <div id="redactor_tab2" class="redactor_tab" style="display: none;">\n <div id="redactor_image_box"></div>\n </div>\n </form>\n <div id="redactor_tab3" class="redactor_tab" style="display: none;">\n <label> '+RLANG.image_web_link+' </label>\n <input type="text" name="redactor_file_link" id="redactor_file_link" class="redactor_input" />\n </div>\n </div>\n <div id="redactor_modal_footer">\n <a href="javascript:void(null);" class="redactor_modal_btn redactor_btn_modal_close"> '+RLANG.cancel+' </a>\n <input type="button" name="upload" class="redactor_modal_btn" id="redactor_upload_btn" value=\' '+RLANG.insert+" ' />\n</div>"}},$("textarea.redactor").each(function(){return $(this).redactor(o(this))})},$("body").ajaxSuccess(t),t()});var escapeHTML=function(t){function e(t){return"string"==typeof t?t:null==t?"":t+""}function i(t){return a[t]}function n(t){return(t=e(t))&&r.test(t)?t.replace(o,i):t}var o=/[&<>"'`]/g,r=RegExp(o.source),a={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};return n(t)};!function(){function t(e,i){var n;if(e.nodeType===Node.TEXT_NODE)i.push(e.data);else if(e.nodeType===Node.ELEMENT_NODE)for(n=e.firstChild;n;)t(n,i),n=n.nextSibling}function e(e){var i="",n=[];return t(e,n),n.length&&(i=n.join(" ")),i}function i(){var t,i,n,o,r,a,s=[];for(t=$("h1, h2, h3").not(".hide h1, .hide h2, .hide h3"),i=0;i<t.length;i+=1)r=e(n=t[i]).trim(),a=n.tagName.toLowerCase(),o=n.getAttribute("id")||r.toLowerCase().replace(/[^a-zA-Z0-9]/g,"-")+"-"+i,"A"===n.parentElement.tagName?n.parentElement.setAttribute("id",o):n.setAttribute("id",o),s.push({title:r,tag:a,href:o});return s}function n(){a.toggleClass("visible")}function o(t,e){(e.clientX||"click"!==e.type)&&($(t).focus(),n())}function r(){var t,e,r=i();for($(".access-menu-container .loading").hide(),t=0;t<r.length;t++)e=r[t],s.append(' <li class="heading--'+e.tag+'" role="presentation"> <a class="heading--item" role="menuitem" tabIndex="0" href="#'+e.href+'"> '+escapeHTML(e.title)+" </a> </li>");a.on("click",function(){$(this).toggleClass("visible")}),$(".heading--item").on("click",function(t){o(this.href,t)}),$(".heading--item").on("keydown ",function(t){9===t.which&&t.target.hash==="#"+r[r.length-1].href&&n(),13===t.which&&o(t.target.hash,t)})}var a=$(".access-menu-visibility"),s=$("#page-outlines");$(document).ready(function(){r()})}();var Role={list:"list",listitem:"listitem",link:"link",presentation:"presentation",navigation:"navigation",stringify:function(t){return t.join(" ")}},aria_properties={photo_widget_li:{labelled_by:{child_suffix:"video_details_"},described_by:{child_suffix:"vid_desc_"}},vplayer_cont:{tabindex:2},vplayer_cont_video_tag:{tabindex:4},photo_widget_offscreen:{"aria-hidden":!1},photo_widget_span_caption:{"aria-hidden":!0},photo_list:{},photo_group:{},photo_caption:{"aria-hidden":!0},project_video_ul:{labelled_by:{child_suffix:"video_page_header"}},project_video_li:{labelled_by:{child_suffix:"vid_details_"},described_by:{child_suffix:"vid_desc_"}},project_video_li_h6:{"aria-hidden":!0},project_video_li_desc:{"aria-hidden":!0},navbar_left:{role:Role.navigation},navbar_ul_left:{role:Role.list},navbar_li_left_item:{role:[Role.listitem,Role.link]}},Aria={role:function(t){return"string"==typeof t&&(t=[t]),Role.stringify(t)},labelled_by:function(t,e){var i=t.child_suffix,n=jQuery(e).attr("data-childId");return void 0===n?i:i+n},described_by:function(t,e){var i=t.child_suffix,n=jQuery(e).attr("data-childId");return void 0===n?i:i+n}},AttrMap={labelled_by:"aria-labelledby",described_by:"aria-describedby"};jQuery(document).ready(function(){hostname=new RegExp(location.host.replace("www.","").replace("archive.","")),linkRegex=/[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi,$("#yield a").each(function(){var t=$(this),e=t.attr("href");hostname.test(e)?t.addClass("local"):e&&"/"==e.slice(0,1)?t.addClass("local"):e&&"#"==e.slice(0,1)?t.addClass("anchor"):e&&e.match(linkRegex)?t.addClass("external").append($('<span class="sr-only"></span>').html(EHQ.i8n.a11y.external_link)):t.addClass("script")});var t=document.getElementsByTagName("iframe");
3if(t.length>0){for(var e=0;e<t.length;e++){var i=t[e].getAttribute("src");if(i){var n=i.match(/maps\.google\.com|api\.mapbox\.com|google\.com\/maps/g);n&&n.length&&t[e].setAttribute("src",i+"&wmode=transparent")}}t[e-1].frameBorder="0",t[e-1].setAttribute("frameBorder","0")}}),$(".dropdown-menu li a").focus(function(){$(this).closest(".dropdown-menu").addClass("active")}).focusout(function(){$(this).closest(".dropdown-menu").removeClass("active")}),function(){var t;(t=(t=void 0)||{}).Utility={removeImageHeight:function(){return $(".col-lg-7").find("img").each(function(){if($(this).attr("width")>=500)return $(this).attr("height","auto").css("height","auto")})}},t.Utility.removeImageHeight()}.call(this),QuickPollPublic={changedVoteClickd:!1,selectors:{unverifiedParticipationEnabled:".unverified-participation-enabled",submitButton:".submit-button",form:".js_quick_poll_container form",fetchQuickPoll:".quick-poll-nav, .change_vote, .vote",quickPollContainer:".js_quick_poll_container",unverifiedParticipationEmailContianer:".unverified-participation-email-contianer",unverifiedParticipationLoginField:".unverified-participation-login-field",quickPollToolId:"#quickpolltoolid"},unverifiedParticipationObject:null,init:function(){var t=this,e=$(t.selectors.form);
3e.length&&e.each(function(){var e=$(this),i=e.hasClass(t.selectors.unverifiedParticipationEnabled.slice(1));t.bindUnverifiedParticipation(e,i),e.find(t.selectors.submitButton).removeClass("btn btn-primary")}),this.eventBindings(),this.stopVideoPlayerTrigger()},bindUnverifiedParticipation:function(t,e){this.unverifiedParticipationObject=new unverifiedParticipation(t,e),this.unverifiedParticipationObject.init(),this.unverifiedParticipationObject.submit()},eventBindings:function(){var t="true"===localStorage.getItem("showShareModal"),e=sessionStorage.getItem("showShareModal");null===e?e=!0:"hidden"===e&&(e=!1),t&&e&&setTimeout(function(){$("#social-share-modal").appendTo("body").modal("show")},2e3),localStorage.setItem("showShareModal",!1);var i=this;$("body").on("click",this.selectors.fetchQuickPoll,function(t){i.changedVoteClickd=!0,t.preventDefault();var e=this;$.ajax({url:$(e).attr("data-url"),type:"GET",dataType:"html"}).done(function(t){$(e).closest(i.selectors.quickPollContainer).replaceWith(t),"change_vote"===$(e).attr("class")&&($(i.selectors.quickPollContainer).find(i.selectors.unverifiedParticipationEmailContianer).hide(),$(i.selectors.quickPollContainer).find(i.selectors.unverifiedParticipationLoginField).hide());var n=$(i.selectors.form),o=n.hasClass(i.selectors.unverifiedParticipationEnabled.slice(1));n.length&&!i.unverifiedParticipationObject&&i.bindUnverifiedParticipation(n,o),$(".submit-button").addClass("disabled"),$(i.selectors.submitButton).removeClass("btn btn-primary"),$(document).on("submit",i.selectors.form,function(){$(this).find(".submit-button").prop("disabled","true")}),SocialSharing.register(document.body)})}),$("body").on("click",".quick-poll-container .view_results a",function(){setTimeout(function(){SocialSharing.register(document.body)},1e3)}),$(document).on("submit",this.selectors.form,function(){localStorage.setItem("showShareModal",!0),$(this).find(".submit-button").addClass("disabled")}),this.toggleSubmitButton();var n=$(this.selectors.form).find("input:radio");$(document).on("click",n.selector,this.toggleSubmitButton)},toggleSubmitButton:function(){$(".js_quick_poll_container form").each(function(t,e){var i=$(e).find(".submit-button") 4;$(e).find("input:radio").is(":checked")?i.removeClass("disabled"):i.addClass("disabled")})},stopVideoPlayerTrigger:function(){$("#global-container").on("keydown",".comment-input, textarea",function(t){32===t.keyCode&&t.stopPropagation()})}},QuickPollPublic.init(),$(document).ready(function(){$("h5.nav-header.nomargin").click(function(){$(this).next("ul.nav-list.nopadding").is(":hidden")?$(this).prev("img").attr("src","/assets/folder_close.gif"):$(this).prev("img").attr("src","/assets/folder.gif"),$(this).next("ul.nav-list.nopadding").toggle("slow")}),setTimeout(function(){$(".twitter-timeline").contents().find(".timeline").css("border-radius","0")},1e3),$("#logout-link").length&&$("#custom-banner").length&&$("#custom-banner").closest(".widget_advanced").addClass("hide")}),ReadspeakerSkipper.prototype.isNotVisible=function(t){return $(t).is(":hidden")},ReadspeakerSkipper.prototype.getHiddenElement=function(t,e){return this.isNotVisible(t)?t:e},ReadspeakerSkipper.prototype.setClass=function(){this.hidden_element=this.getHiddenElement(this.cont_obj1,this.cont_obj2),$(this.hidden_element).addClass("rs_skip")},(new ReadspeakerSkipper).setClass(),"function"!=typeof Object.assign&&(Object.assign=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");t=Object(t);for(var e=1;e<arguments.length;e++){var i=arguments[e];if(null!=i)for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t}),function(){var t=$("#shared-env");t.length&&(window.EHQ=window.EHQ||{},window.environment=EHQ.environment=t.data("environment"),window.EHQ.i8n=EHQ.i8n||{},window.EHQ.i8n.a11y={external_link:t.data("external-link")})}.call(this),function(){var t=$("#ehq-analytics");if(t.length>0){var e=t.data("reporting-params"),i=t.data("src");window.ehqa=window.ehqa||function(){(ehqa.q=ehqa.q||[]).push(arguments)},window.reporting_params=e,function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=i;var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)}(),ehqa("track",e)}}.call(this);var addPaddingToBody=function(){$(".sticky-footer").length>0&&$(".body-footer-padding").css("padding-bottom",$(".sticky-footer").height()+"px")};$(document).ready(addPaddingToBody()),function(){function t(t){return/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/.test(t)}$("#user_email").on("keyup",function(){$("#user_email").val()?$("#password-submit").removeAttr("disabled"):$("#password-submit").attr("disabled","true")}),$("#password-submit").on("click",function(e){var i=$("#user_email").val();i&&t(i)||(e.preventDefault(),e.stopPropagation(),$("#user_email").focus(),$("#user_email").addClass("has-error"),$(".error-message").removeClass("hide"),$("#user_email").focus(),$("#user_email").attr("aria-describedby","reset-password-error"))})}(),$(document).ready(function(){$("#logout-link").click(function(){removeApiToken()})}),function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).VanillaSharing={})}(this,function(t){"use strict";function e(t){return Object.keys(t).filter(function(e){return"undefined"!=typeof t[e]&&""!==t[e]}).map(function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(t[e]))}).join("&")}function i(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.fbAppId,n=t.url,o=t.redirectUri;if(!i)throw new Error("fbAppId is not defined");var r=e({app_id:i,display:"popup",redirect_uri:o,link:n});return"https://www.facebook.com/dialog/feed?".concat(r)}function n(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(i(t),"_blank",R)}function o(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.fbAppId,n=t.url,o=t.hashtag,r=t.redirectUri;if(!i)throw new Error("fbAppId is not defined");var a=e({app_id:i,display:"popup",redirect_uri:r,href:n,hashtag:o});return"https://www.facebook.com/dialog/share?".concat(a)}function r(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(o(t),"_blank",R)}function a(){var t=(arguments.length>0&&arguments[0]!==undefined?arguments[0]:{}).url;if(!t)throw new Error("url is not defined");var i=e({kid_directed_site:"0",sdk:"joey",u:t,display:"popup",ref:"plugin",src:"share_button"});return"https://www.facebook.com/sharer/sharer.php?".concat(i)}function s(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(a(t),"_blank",R)}function l(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{}
4,i=e({share_url:t.url,title:t.title,description:t.description,imageurl:t.image});return window.open("http://connect.mail.ru/share?".concat(i),"_blank",R)}function c(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.toolType?t.message+" "+t.toolType+" "+t.site:"",n=t.to,o=t.url,r=t.title,a=i,s=e({subject:t.tool?t.tool:"",body:"".concat(r||"","\r\n").concat(a||"","\r\n").concat(o||"")});return"mailto:".concat(n||"","?").concat(s)}function d(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.location.assign(c(t))}function u(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=e({url:t.url,title:t.title,imageUrl:t.image});return"https://connect.ok.ru/offer?".concat(i)}function h(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(u(t),"_blank",R)}function p(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=e({url:t.url,text:t.title});return"https://t.me/share/url?".concat(i)}function f(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(p(t),"_blank",R)}function m(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{}
4,i=t.title,n=t.url,o=t.hashtags,r=e({text:i,url:n,hashtags:(void 0===o?[]:o).join(",")});return"https://twitter.com/intent/tweet?".concat(r)}function g(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(m(t),"_blank",R)}function v(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=e({url:t.url,title:t.title});return window.open("https://www.reddit.com/submit?".concat(i),"_blank",R)}function b(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.description,n=e({url:t.url,description:i,media:t.media});return window.open("https://pinterest.com/pin/create/button/?".concat(n),"_blank",R)}function _(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.url,n=t.title,o=t.caption,r=t.tags,a=void 0===r?[]:r,s=t.posttype,l=void 0===s?"link":s,c=e({canonicalUrl:i,title:n,caption:o,tags:a.join(","),posttype:l});return window.open("https://www.tumblr.com/widgets/share/tool?".concat(c),"_blank",R)}function y(){return!!window.navigator.userAgent.match(/Version\/[\d.]+.*Safari/)}function w(t){return y()?window.open(t):window.location.assign(t)}function x(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.url,n=t.title;if(!i&&!n)throw new Error("url and title not specified");var o=e({text:[n,i].filter(function(t){return t}).join(" ")});return"viber://forward?".concat(o)}function $(){return w(x(arguments.length>0&&arguments[0]!==undefined?arguments[0]:{}))}function k(){var t,i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},n=i.url,o=i.image,r=i.isVkParse,a=i.description,s=i.title;return a&&a.length>L&&(a="".concat(a.substr(0,L),"...")),s&&s.length>L&&(s="".concat(s.substr(0,L),"...")),t=e(r?{url:n}:{url:n,title:s,description:a,image:o,noparse:!0}),"https://vk.com/share.php?".concat(t)}function C(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(k(t),"_blank",R)}function T(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.phone,n=e({text:[t.title,t.url].filter(function(t){return t}).join(" "),phone:i});return"https://api.whatsapp.com/send?".concat(n)}function S(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return window.open(T(t),"_blank",R)}function E(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{}
4,i=t.title,n=t.url,o=e({title:i,summary:t.description,url:n});return window.open("https://www.linkedin.com/shareArticle?mini=true&".concat(o),"_blank",R)}function A(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},i=t.fbAppId,n=t.url;if(!i)throw new Error("fbAppId is not defined");var o=e({app_id:i,link:n});return window.location.assign("fb-messenger://share?".concat(o))}function N(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},e=t.title,i=t.url;if(!i)throw new Error("url is not defined");var n=encodeURIComponent("".concat(i));return e&&(n="".concat(encodeURIComponent("".concat(e," "))).concat(n)),window.open("https://line.me/R/msg/text/?".concat(n),"_blank",R)}var R="scrollbars=1, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0",L=80;t.email=d,t.fbButton=s,t.fbFeed=n,t.fbShare=r,t.getEmailUrl=c,t.getFbButtonUrl=a,t.getFbFeedUrl=i,t.getFbShareUrl=o,t.getOkUrl=u,t.getTelegramUrl=p,t.getTwUrl=m,t.getViberUrl=x,t.getVkUrl=k,t.getWhatsappUrl=T,t.line=N,t.linkedin=E,t.mail=l,t.messenger=A,t.ok=h,t.pinterest=b,t.reddit=v,t.telegram=f,t.tumblr=_,t.tw=g,t.viber=$,t.vk=C,t.whatsapp=S,Object.defineProperty(t,"__esModule",{value:!0})});var SocialSharing=function(){function t(t){for(var e=t.getElementsByClassName("SocialSharing"),i=0;i<e.length;i++)e[i].removeEventListener("click",n),e[i].addEventListener("click",n)}function e(t){for(var e=t.getElementsByClassName("SocialSharing"),i=0;i<e.length;i++)e[i].removeEventListener("click",n)}function i(t){return["url","title","description","image","site","tool","toolType"].reduce(function(e,i){var n=t.parentNode.getAttribute("data-"+i);return n&&(e[i]=n),e},{})}function n(t){var e=t.target;switch(e.getAttribute("data-type")){case"facebook":return VanillaSharing.fbButton(i(e));case"twitter":return VanillaSharing.tw(i(e));case"linkedin":return VanillaSharing.linkedin(i(e));case"email":var n=e.getAttribute("data-text"),o=i(e);return o.message=n,VanillaSharing.email(o);case"whatsapp":return VanillaSharing.whatsapp(i(e));default:return!1}}return t(document.body),{register:t,unregister:e}}();!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Tribute=t()}}(function(){return function(){function t(e,i,n){function o(a,s){if(!i[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(r)return r(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var d=i[a]={exports:{}};e[a][0].call(d.exports,function(t){return o(e[a][1][t]||t)},d,d.exports,t,e,i,n)}return i[a].exports}for(var r="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}return t}()({1:[function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var r=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),a=(n(t("./utils")),n(t("./TributeEvents"))),s=n(t("./TributeMenuEvents")),l=n(t("./TributeRange")),c=n(t("./TributeSearch")),d=function(){function t(e){var i=this,n=e.values,r=n===undefined?null:n,d=e.iframe,u=d===undefined?null:d,h=e.selectClass,p=h===undefined?"highlight":h,f=e.trigger,m=f===undefined?"@":f,g=e.autocompleteMode,v=g!==undefined&&g,b=e.selectTemplate,_=b===undefined?null:b,y=e.menuItemTemplate,w=y===undefined?null:y,x=e.lookup,$=x===undefined?"key":x,k=e.fillAttr,C=k===undefined?"value":k,T=e.collection,S=T===undefined?null:T,E=e.menuContainer,A=E===undefined?null:E,N=e.noMatchTemplate,R=N===undefined?null:N,L=e.requireLeadingSpace,j=L===undefined||L,I=e.allowSpaces,P=I!==undefined&&I,M=e.replaceTextSuffix,O=M===undefined?null:M,B=e.positionMenu,D=B===undefined||B,H=e.spaceSelectsMat
4ch,G=H!==undefined&&H,U=e.searchOpts,F=U===undefined?{}:U;if(o(this,t),this.autocompleteMode=v,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=A,this.allowSpaces=P,this.replaceTextSuffix=O,this.positionMenu=D,this.hasTrailingSpace=!1,this.spaceSelectsMatch=G,this.autocompleteMode&&(m="",P=!1),r)this.collection=[{trigger:m,iframe:u,selectClass:p,selectTemplate:(_||t.defaultSelectTemplate).bind(this),menuItemTemplate:(w||t.defaultMenuItemTemplate).bind(this),noMatchTemplate:"function"==typeof R?R.bind(i):R||function(){return""}.bind(i),lookup:$,fillAttr:C,values:r,requireLeadingSpace:j,searchOpts:F}];else{if(!S)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=S.map(function(e){return{trigger:e.trigger||m,iframe:e.iframe||u,selectClass:e.selectClass||p,selectTemplate:(e.selectTemplate||t.defaultSelectTemplate).bind(i),menuItemTemplate:(e.menuItemTemplate||t.defaultMenuItemTemplate).bind(i),noMatchTemplate:"function"==typeof R?R.bind(i):null,lookup:e.lookup||$,fillAttr:e.fillAttr||C,values:e.values,requireLeadingSpace:e.requireLeadingSpace,searchOpts:e.searchOpts||F}})}new l["default"](this),new a["default"](this),new s["default"](this),new c["default"](this)}return r(t,[{key:"triggers",value:function(){return this.collection.map(function(t){return t.trigger})}},{key:"attach",value:function(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var e=t.length,i=0;i<e;++i)this._attach(t[i]);else this._attach(t)}},{key:"_attach",value:function(t){t.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+t.nodeName),this.ensureEditable(t),this.events.bind(t),t.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function(e){if(-1===t.inputTypes().indexOf(e.nodeName)){if(!e.contentEditable)throw new Error("[Tribute] Cannot bind to "+e.nodeName);e.contentEditable=!0}}},{key:"createMenu",value:function(){var t=this.range.getDocument().createElement("div"),e=this.range.getDocument().createElement("ul");return t.className="tribute-container",t.appendChild(e),this.menuContainer?this.menuContainer.appendChild(t):this.range.getDocument().body.appendChild(t)}},{key:"showMenuFor",value:function(t,e){var i=this;if(!this.isActive||this.current.element!==t||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(),t.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var n=function(t){if(i.isActive){var n=i.search.filter(i.current.mentionText,t,{pre:i.current.collection.searchOpts.pre||"<span>",post:i.current.collection.searchOpts.post||"</span>",extract:function(t){if("string"==typeof i.current.collection.lookup)return t[i.current.collection.lookup];if("function"==typeof i.current.collection.lookup)return i.current.collection.lookup(t,i.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});i.current.filteredItems=n;var o=i.menu.querySelector("ul");if(i.range.positionMenuAtCaret(e),!n.length){var r=new CustomEvent("tribute-no-match",{detail:i.menu});return i.current.element.dispatchEvent(r),void(i.current.collection.noMatchTemplate?o.innerHTML=i.current.collection.noMatchTemplate():i.hideMenu())}o.innerHTML="",n.forEach(function(t,e){var n=i.range.getDocument().createElement("li");n.setAttribute("data-index",e),n.addEventListener("mouseenter",function(t){var e=t.target.getAttribute("data-index");0!==t.movementX&&0!==t.movementY&&i.events.setActiveLi(e)}),i.menuSelected===e&&(n.className=i.current.collection.selectClass),n.innerHTML=i.current.collection.menuItemTemplate(t),o.appendChild(n)})}};"function"==typeof this.current.collection.values?this.current.collection.values(this.current.mentionText,n):n(this.current.collection.values)}}},{key:"showMenuForCollection",value:function(t,e){t!==document.activeElement&&this.placeCaretAtEnd(t),this.current.collection=this.collection[e||0],this.current.externalTrigger=!0,this.current.element=t,t.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(t,this.current.collection.trigger),this.showMenuFor(t)}},{key:"placeCaretAtEnd",value:function(t){if(t.focus(),"undefined"!=typeof window.getSelection&&"undefined"!=typeof document.createRange){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(e)}else if("undefined"!=typeof document.body.createTextRange){var n=document.body.createTextRange();n.moveToElementText(t),n.collapse(!1),n.select()}}},{key:"insertTextAtCursor",value:function(t){var e,i;(i=(e=window.getSelection()).getRangeAt(0)).deleteContents();var n=document.createTextNode(t);i.insertNode(n),i.selectNodeContents(n),i.collapse(!1),e.removeAllRanges(),e.addRange(i)}},{key:"insertAtCaret",value:function(t,e){var i=t.scrollTop,n=t.selectionStart,o=t.value.substring(0,n),r=t.value.substring(t.selectionEnd,t.value.length);t.value=o+e+r,n+=e.length,t.selectionStart=n,t.selectionEnd=n,t.focu
4s(),t.scrollTop=i}},{key:"hideMenu",value:function(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function(t,e){if("number"==typeof(t=parseInt(t))&&!isNaN(t)){var i=this.current.filteredItems[t],n=this.current.collection.selectTemplate(i);null!==n&&this.replaceText(n,e,i)}}},{key:"replaceText",value:function(t,e,i){this.range.replaceTriggerText(t,!0,!0,e,i)}},{key:"_append",value:function(t,e,i){if("function"==typeof t.values)throw new Error("Unable to append to values, as it is a function.");t.values=i?e:t.values.concat(e)}},{key:"append",value:function(t,e,i){var n=parseInt(t);if("number"!=typeof n)throw new Error("please provide an index for the collection to update.");var o=this.collection[n];this._append(o,e,i)}},{key:"appendCurrent",value:function(t,e){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,t,e)}},{key:"detach",value:function(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var e=t.length,i=0;i<e;++i)this._detach(t[i]);else this._detach(t)}},{key:"_detach",value:function(t){var e=this;this.events.unbind(t),t.tributeMenu&&this.menuEvents.unbind(t.tributeMenu),setTimeout(function(){t.removeAttribute("data-tribute"),e.isActive=!1,t.tributeMenu&&t.tributeMenu.remove()})}}],[{key:"defaultSelectTemplate",value:function(t){return void 0===t?null:this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+t.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+t.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function(t){return t.string}},{key:"inputTypes",value:function(){return["TEXTAREA","INPUT"]}}]),t}();i["default"]=d,e.exports=i["default"]},{"./TributeEvents":2,"./TributeMenuEvents":3,"./TributeRange":4,"./TributeSearch":5,"./utils":7}],2:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(e){n(this,t),this.tribute=e,this.tribute.events=this}return o(t,[{key:"bind",value:function(t){t.boundKeydown=this.keydown.bind(t,this),t.boundKeyup=this.keyup.bind(t,this),t.boundInput=this.input.bind(t,this),t.addEventListener("keydown",t.boundKeydown,!1),t.addEventListener("keyup",t.boundKeyup,!1),t.addEventListener("input",t.boundInput,!1)}},{key:"unbind",value:function(t){t.removeEventListener("keydown",t.boundKeydown,!1),t.removeEventListener("keyup",t.boundKeyup,!1),t.removeEventListener("input",t.boundInput,!1),delete t.boundKeydown,delete t.boundKeyup,delete t.boundInput}},{key:"keydown",value:function(e,i){e.shouldDeactivate(i)&&(e.tribute.isActive=!1,e.tribute.hideMenu());var n=this;e.commandEvent=!1,t.keys().forEach(function(t){t.key===i.keyCode&&(e.commandEvent=!0,e.callbacks()[t.value.toLowerCase()](i,n))})}},{key:"input",value:function(t,e){t.inputEvent=!0,t.keyup.call(this,t,e)}},{key:"click",value:function(t,e){var i=t.tribute;if(i.menu&&i.menu.contains(e.target)){var n=e.target;for(e.preventDefault(),e.stopPropagation();"li"!==n.nodeName.toLowerCase();)if(!(n=n.parentNode)||n===i.menu)throw new Error("cannot find the <li> container for the click");i.selectItemAtIndex(n.getAttribute("data-index"),e),i.hideMenu()}else i.current.element&&!i.current.externalTrigger&&(i.current.externalTrigger=!1,setTimeout(function(){return i.hideMenu()}))}},{key:"keyup",value:function(t,e){if(t.inputEvent&&(t.inputEvent=!1),t.updateSelection(this),27!==e.keyCode){if(!t.tribute.allowSpaces&&t.tribute.hasTrailingSpace)return t.tribute.hasTrailingSpace=!1,t.commandEvent=!0,void t.callbacks().space(e,this);if(!t.tribute.isActive)if(t.tribute.autocompleteMode)t.callbacks().triggerChar(e,this,"");else{var i=t.getKeyCode(t,this,e);
4if(isNaN(i)||!i)return;var n=t.tribute.triggers().find(function(t){return t.charCodeAt(0)===i});void 0!==n&&t.callbacks().triggerChar(e,this,n)}((t.tribute.current.trigger||t.tribute.autocompleteMode)&&!1===t.commandEvent||t.tribute.isActive&&8===e.keyCode)&&t.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function(e){if(!this.tribute.isActive)return!1;if(0===this.tribute.current.mentionText.length){var i=!1;return t.keys().forEach(function(t){e.keyCode===t.key&&(i=!0)}),!i}return!1}},{key:"getKeyCode",value:function(t){var e=t.tribute,i=e.range.getTriggerInfo(!1,e.hasTrailingSpace,!0,e.allowSpaces,e.autocompleteMode);return!!i&&i.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function(t){this.tribute.current.element=t;var e=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);e&&(this.tribute.current.selectedPath=e.mentionSelectedPath,this.tribute.current.mentionText=e.mentionText,this.tribute.current.selectedOffset=e.mentionSelectedOffset)}},{key:"callbacks",value:function(){var t=this;return{triggerChar:function(e,i,n){var o=t.tribute;o.current.trigger=n;var r=o.collection.find(function(t){return t.trigger===n});o.current.collection=r,o.inputEvent&&o.showMenuFor(i,!0)},enter:function(e){t.tribute.isActive&&(e.preventDefault(),e.stopPropagation(),setTimeout(function(){t.tribute.selectItemAtIndex(t.tribute.menuSelected,e),t.tribute.hideMenu()},0))},escape:function(e){t.tribute.isActive&&(e.preventDefault(),e.stopPropagation(),t.tribute.isActive=!1,t.tribute.hideMenu())},tab:function(e,i){t.callbacks().enter(e,i)},space:function(e,i){t.tribute.isActive&&(t.tribute.spaceSelectsMatch?t.callbacks().enter(e,i):t.tribute.allowSpaces||(e.stopPropagation(),setTimeout(function(){t.tribute.hideMenu(),t.tribute.isActive=!1},0)))},up:function(e){if(t.tribute.isActive){e.preventDefault(),e.stopPropagation();var i=t.tribute.current.filteredItems.length,n=t.tribute.menuSelected;i>n&&n>0?(t.tribute.menuSelected--,t.setActiveLi()):0===n&&(t.tribute.menuSelected=i-1,t.setActiveLi(),t.tribute.menu.scrollTop=t.tribute.menu.scrollHeight)}},down:function(e){if(t.tribute.isActive){e.preventDefault(),e.stopPropagation();var i=t.tribute.current.filteredItems.length-1,n=t.tribute.menuSelected;i>n?(t.tribute.menuSelected++,t.setActiveLi()):i===n&&(t.tribute.menuSelected=0,t.setActiveLi(),t.tribute.menu.scrollTop=0)}},"delete":function(e,i){t.tribute.isActive&&t.tribute.current.mentionText.length<1?t.tribute.hideMenu():t.tribute.isActive&&t.tribute.showMenuFor(i)}}}},{key:"setActiveLi",value:function(t){var e=this.tribute.menu.querySelectorAll("li"),i=e.length>>>0;t&&(this.tribute.menuSelected=parseInt(t));for(var n=0;n<i;n++){var o=e[n];if(n===this.tribute.menuSelected){o.classList.add(this.tribute.current.collection.selectClass);var r=o.getBoundingClientRect(),a=this.tribute.menu.getBoundingClientRect();if(r.bottom>a.bottom){var s=r.bottom-a.bottom;this.tribute.menu.scrollTop+=s}else if(r.top<a.top){var l=a.top-r.top;this.tribute.menu.scrollTop-=l}}else o.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function(t,e){var i=t.getBoundingClientRect().height;if(e){var n=t.currentStyle||window.getComputedStyle(t);return i+parseFloat(n.marginTop)+parseFloat(n.marginBottom)}return i}}],[{key:"keys",value:function(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),t}();i["default"]=r,e.exports=i["default"]},{}],3:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(e){n(this,t),this.tribute=e,this.tribute.menuEvents=this,this.menu=this.tribute.menu}return o(t,[{key:"bind",value:function(){var t=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce(function(){t.tribute.isActive&&t.tribute.showMenuFor(t.tribute.current.element,!1)},300,!1),this.windowResizeEvent=this.debounce(function(){t.tribute.isActive&&t.tribute.range.positionMenuAtCaret(!0)},300,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function(){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}}
4,{key:"debounce",value:function(t,e,i){var n,o=this,r=arguments;return function(){var a=o,s=r,l=function(){n=null,i||t.apply(a,s)},c=i&&!n;clearTimeout(n),n=setTimeout(l,e),c&&t.apply(a,s)}}}]),t}();i["default"]=r,e.exports=i["default"]},{}],4:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(e){n(this,t),this.tribute=e,this.tribute.range=this}return o(t,[{key:"getDocument",value:function(){var t=void 0;return this.tribute.current.collection&&(t=this.tribute.current.collection.iframe),t?t.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function(t){var e=this,i=this.tribute.current,n=void 0,o=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==o){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");n=this.isContentEditable(i.element)?this.getContentEditableCaretPosition(o.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,o.mentionPosition),this.tribute.menu.style.cssText="top: "+n.top+"px;\n left: "+n.left+"px;\n right: "+n.right+"px;\n bottom: "+n.bottom+"px;\n position: absolute;\n zIndex: 10000;\n display: block;","auto"===n.left&&(this.tribute.menu.style.left="auto"),"auto"===n.top&&(this.tribute.menu.style.top="auto"),t&&this.scrollIntoView(),window.setTimeout(function(){var i={width:e.tribute.menu.offsetWidth,height:e.tribute.menu.offsetHeight},o=e.isMenuOffScreen(n,i),r=window.innerWidth>i.width&&(o.left||o.right),a=window.innerHeight>i.height&&(o.top||o.bottom);(r||a)&&(e.tribute.menu.style.cssText="display: none",e.positionMenuAtCaret(t))},0)}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function(t,e,i){var n=void 0,o=t;if(e)for(var r=0;r<e.length;r++){if((o=o.childNodes[e[r]])===undefined)return;for(;o.length<i;)i-=o.length,o=o.nextSibling;0!==o.childNodes.length||o.length||(o=o.previousSibling)}var a=this.getWindowSelection();(n=this.getDocument().createRange()).setStart(o,i),n.setEnd(o,i),n.collapse(!0);try{a.removeAllRanges()}catch(s){}a.addRange(n),t.focus()}},{key:"replaceTriggerText",value:function(t,e,i,n,o){var r=this.tribute.current,a=this.getTriggerInfo(!0,i,e,this.tribute.allowSpaces,this.tribute.autocompleteMode),s=new CustomEvent("tribute-replaced",{detail:{item:o,event:n}});if(a!==undefined){if(this.isContentEditable(r.element)){t+="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:"\xa0",this.pasteHtml(t,a.mentionPosition,a.mentionPosition+a.mentionText.length+!this.tribute.autocompleteMode)}else{var l=this.tribute.current.element,c="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";t+=c;var d=a.mentionPosition,u=a.mentionPosition+a.mentionText.length+c.length;l.value=l.value.substring(0,d)+t+l.value.substring(u,l.value.length),l.selectionStart=d+t.length,l.selectionEnd=d+t.length}r.element.dispatchEvent(s)}}},{key:"pasteHtml",value:function(t,e,i){var n=void 0,o=void 0;o=this.getWindowSelection(),(n=this.getDocument().createRange()).setStart(o.anchorNode,e),n.setEnd(o.anchorNode,i),n.deleteContents();var r=this.getDocument().createElement("div");r.innerHTML=t;for(var a=this.getDocument().createDocumentFragment(),s=void 0,l=void 0;s=r.firstChild;)l=a.appendChild(s);n.insertNode(a),l&&((n=n.cloneRange()).setStartAfter(l),n.collapse(!0),o.removeAllRanges(),o.addRange(n))}},{key:"getWindowSelection",value:function(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function(t){if(null===t.parentNode)return 0;for(var e=0;e<t.parentNode.childNodes.length;e++){if(t.parentNode.childNodes[e]===t)return e}}},{key:"getContentEditableSelectedPath",value:function(){var t=this.getWindowSelection(),e=t.anchorNode,i=[];if(null!=e){for(var n=void 0,o=e.contentEditable;null!==e&&"true"!==o;)n=this.getNodePositionInParent(e),i.push(n),null!==(e=e.parentNode)&&(o=e.contentEditable);return i.reverse(),{selected:e,path:i,offset:t.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function(){var t=this.tribute.current,e="";if(this.isContentEditable(t.element)){var i=this.getWindowSelection().anchorNode;if(null!=i){var n=i.textContent,o=this.getWindowSelection().getRangeAt(0).startOffset;n&&o>=0&&(e=n.substring(0,o))}}else{var r=this.tribute.current.element;if(r){var a=r.selectionStart;r.value&&a>=0&&(e=r.value.substring(0,a))}}return e}},{key:"getLastWordInText",value:function(t){var e=(t=t.replace(/\u00A0/g," ")).split(" ");return e[e.length-1].trim()}}
4,{key:"getTriggerInfo",value:function(t,e,i,n,o){ 5var r=this,a=this.tribute.current,s=void 0,l=void 0,c=void 0;if(this.isContentEditable(a.element)){var d=this.getContentEditableSelectedPath(a);d&&(s=d.selected,l=d.path,c=d.offset)}else s=this.tribute.current.element;var u=this.getTextPrecedingCurrentSelection(),h=this.getLastWordInText(u);if(o)return{mentionPosition:u.length-h.length,mentionText:h,mentionSelectedElement:s,mentionSelectedPath:l,mentionSelectedOffset:c};if(u!==undefined&&null!==u){var p=-1,f=void 0;if(this.tribute.collection.forEach(function(t){var e=t.trigger,n=t.requireLeadingSpace?r.lastIndexWithLeadingSpace(u,e):u.lastIndexOf(e);n>p&&(p=n,f=e,i=t.requireLeadingSpace)}),p>=0&&(0===p||!i||/[\xA0\s]/g.test(u.substring(p-1,p)))){var m=u.substring(p+1,u.length);f=u.substring(p,p+1);var g=m.substring(0,1),v=m.length>0&&(" "===g||"\xa0"===g);e&&(m=m.trim());var b=n?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=b.test(m),!v&&(t||!b.test(m)))return{mentionPosition:p,mentionText:m,mentionSelectedElement:s,mentionSelectedPath:l,mentionSelectedOffset:c,mentionTriggerChar:f}}}}},{key:"lastIndexWithLeadingSpace",value:function(t,e){for(var i=t.split("").reverse().join(""),n=-1,o=0,r=t.length;o<r;o++){var a=o===t.length-1,s=/\s/.test(i[o+1]);if(e===i[o]&&(a||s)){n=t.length-1-o;break}}return n}},{key:"isContentEditable",value:function(t){return"INPUT"!==t.nodeName&&"TEXTAREA"!==t.nodeName}},{key:"isMenuOffScreen",value:function(t,e){var i=window.innerWidth,n=window.innerHeight,o=document.documentElement,r=(window.pageXOffset||o.scrollLeft)-(o.clientLeft||0),a=(window.pageYOffset||o.scrollTop)-(o.clientTop||0),s="number"==typeof t.top?t.top:a+n-t.bottom-e.height,l="number"==typeof t.right?t.right:t.left+e.width,c="number"==typeof t.bottom?t.bottom:t.top+e.height,d="number"==typeof t.left?t.left:r+i-t.right-e.width;return{top:s<Math.floor(a),right:l>Math.ceil(r+i),bottom:c>Math.ceil(a+n),left:d<Math.floor(r)}}},{key:"getMenuDimensions",value:function(){var t={width:null,height:null};return this.tribute.menu.style.cssText="top: 0px;\n left: 0px;\n position: fixed;\n zIndex: 10000;\n display: block;\n visibility; hidden;",t.width=this.tribute.menu.offsetWidth,t.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",t}},{key:"getTextAreaOrInputUnderlinePosition",value:function(t,e){var i=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"],n=null!==window.mozInnerScreenX,o=this.getDocument().createElement("div");o.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(o);var r=o.style,a=window.getComputedStyle?getComputedStyle(t):t.currentStyle;r.whiteSpace="pre-wrap","INPUT"!==t.nodeName&&(r.wordWrap="break-word"),r.position="absolute",r.visibility="hidden",i.forEach(function(t){r[t]=a[t]}),n?(r.width=parseInt(a.width)-2+"px",t.scrollHeight>parseInt(a.height)&&(r.overflowY="scroll")):r.overflow="hidden",o.textContent=t.value.substring(0,e),"INPUT"===t.nodeName&&(o.textContent=o.textContent.replace(/\s/g," "));var s=this.getDocument().createElement("span");s.textContent=t.value.substring(e)||".",o.appendChild(s);var l=t.getBoundingClientRect(),c=document.documentElement,d=(window.pageXOffset||c.scrollLeft)-(c.clientLeft||0),u=(window.pageYOffset||c.scrollTop)-(c.clientTop||0),h={top:l.top+u+s.offsetTop+parseInt(a.borderTopWidth)+parseInt(a.fontSize)-t.scrollTop,left:l.left+d+s.offsetLeft+parseInt(a.borderLeftWidth)},p=window.innerWidth,f=window.innerHeight,m=this.getMenuDimensions(),g=this.isMenuOffScreen(h,m);g.right&&(h.right=p-h.left,h.left="auto");var v=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(g.bottom){var b=v-(f-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);h.bottom=b+(f-l.top-s.offsetTop),h.top="auto"}return(g=this.isMenuOffScreen(h,m)).left&&(h.left=p>m.width?d+p-m.width:d,delete h.right),g.top&&(h.top=f>m.height?u+f-m.height:u,delete h.bottom),this.getDocument().body.removeChild(o),h}},{key:"getContentEditableCaretPosition",value:function(t){var e="\ufeff",i=void 0,n="sel_"+(new Date).getTime()+"_"+Math.random().toString().substr(2),o=void 0,r=this.getWindowSelection(),a=r.getRangeAt(0);(o=this.getDocument().createRange()).setStart(r.anchorNode,t),o.setEnd(r.anchorNode,t),o.collapse(!1),(i=this.getDocument().createElement("span")).id=n,i.appendChild(this.getDocument().createTextNode(e)),o.insertNode(i),r.removeAllRanges(),r.addRange(a);var s=i.getBoundingClientRect(),l=document.documentElement,c=(window.pageXOffset||l.scrollLeft)-(l.clientLeft||0),d=(window.pageYOffset||l.scrollTop)-(l.clientTop||0),u={left:s.left+c,top:s.top+i.offsetHeight+d},h=window.innerWidth,p=window.innerHeight,f=this.getMenuDimensions(),m=this.isMenuOffScreen(u,f);m.right&&(u.left="auto",u.right=h-s.left-c);var g=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(m.bottom){var v=g-(p-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);u.top="auto",u.bottom=v+(p-s.top)}return(m=this.isMenuOffScreen(u,f)).left&&(u.left=h>
5f.width?c+h-f.width:c,delete u.right),m.top&&(u.top=p>f.height?d+p-f.height:d,delete u.bottom),i.parentNode.removeChild(i),u}},{key:"scrollIntoView",value:function(){var t=20,e=void 0,i=100,n=this.menu;if(void 0!==n){for(;e===undefined||0===e.height;)if(0===(e=n.getBoundingClientRect()).height&&((n=n.childNodes[0])===undefined||!n.getBoundingClientRect))return;var o=e.top,r=o+e.height;if(o<0)window.scrollTo(0,window.pageYOffset+e.top-t);else if(r>window.innerHeight){var a=window.pageYOffset+e.top-t;a-window.pageYOffset>i&&(a=window.pageYOffset+i);var s=window.pageYOffset-(window.innerHeight-r);s>a&&(s=a),window.scrollTo(0,s)}}}}]),t}();i["default"]=r,e.exports=i["default"]},{}],5:[function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),r=function(){function t(e){n(this,t),this.tribute=e,this.tribute.search=this}return o(t,[{key:"simpleFilter",value:function(t,e){var i=this;return e.filter(function(e){return i.test(t,e)})}},{key:"test",value:function(t,e){return null!==this.match(t,e)}},{key:"match",value:function(t,e,i){i=i||{};e.length;var n=i.pre||"",o=i.post||"",r=i.caseSensitive&&e||e.toLowerCase();t=i.caseSensitive&&t||t.toLowerCase();var a=this.traverse(r,t,0,0,[]);return a?{rendered:this.render(e,a.cache,n,o),score:a.score}:null}},{key:"traverse",value:function(t,e,i,n,o){if(e.length===n)return{score:this.calculateScore(o),cache:o.slice()};if(t.length===i||e.length-n>t.length-i)return undefined;for(var r=e[n],a=t.indexOf(r,i),s=void 0,l=void 0;a>-1;){if(o.push(a),l=this.traverse(t,e,a+1,n+1,o),o.pop(),!l)return s;(!s||s.score<l.score)&&(s=l),a=t.indexOf(r,a+1)}return s}},{key:"calculateScore",value:function(t){var e=0,i=1;return t.forEach(function(n,o){o>0&&(t[o-1]+1===n?i+=i+1:i=1),e+=i}),e}},{key:"render",value:function(t,e,i,n){var o=t.substring(0,e[0]);return e.forEach(function(r,a){o+=i+t[r]+n+t.substring(r+1,e[a+1]?e[a+1]:t.length)}),o}},{key:"filter",value:function(t,e,i){var n=this;return i=i||{},e.reduce(function(e,o,r){var a=o;i.extract&&((a=i.extract(o))||(a=""));var s=n.match(t,a,i);return null!=s&&(e[e.length]={string:s.rendered,score:s.score,index:r,original:o}),e},[]).sort(function(t,e){var i=e.score-t.score;return i||t.index-e.index})}}]),t}();i["default"]=r,e.exports=i["default"]},{}],6:[function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(i,"__esModule",{value:!0});var o=n(t("./Tribute"));i["default"]=o["default"],e.exports=i["default"]},{"./Tribute":1}],7:[function(){"use strict";if(Array.prototype.find||(Array.prototype.find=function(t){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var e,i=Object(this),n=i.length>>>0,o=arguments[1],r=0;r<n;r++)if(e=i[r],t.call(o,e,r,i))return e;return undefined}),window&&"function"!=typeof window.CustomEvent){var t=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:undefined};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};"undefined"!=typeof window.Event&&(t.prototype=window.Event.prototype),window.CustomEvent=t}},{}]},{},[6])(6)});var Mentions=function(){function t(t,e){var i=function(){$.ajax({url:t,dataType:"json",headers:{"x-api-token":"Bearer "+r},success:function(t){t.data.forEach(function(t){a[t.attributes.type+t.id]=t.attributes["last-seen-at"]}),e(t.data.map(function(t){return{key:t.attributes.login,value:t.id,type:t.attributes.type,createdAt:t.attributes["created-at"]}}))},error:function(){e([])}})};r?i():$.ajax({url:"/token",dataType:"json",success:function(t){r=t.data.attributes.token,i()},error:function(){e([])}})}function e(){var t=$(this),e=t.data(),i=e.userType+e.userId,n=a[i],o=n||"N/A",r=e.mentionTooltip+o;t.tooltip({html:!0,container:"body",title:r}),t.tooltip("show")}function i(t){$(t).on("paste",function(e){var i=(e.originalEvent.clipboardData||window.clipboardData).getData("text").replace(/(<([^>]+)>)/gi,""),n=window.getSelection();if(!n.rangeCount)return!1;n.deleteFromDocument(),n.getRangeAt(0).insertNode(document.createTextNode(i)),e.preventDefault(),$(t).trigger("change")})}function n(e,n){t(n,function(t){new Tribute({trigger:"@",values:t,selectTemplate:function(t){var i=document.createElement("span"),n=$(e).data(),o=t.original.key+"<br>"+n.joined+": "+new Date(t.original.createdAt).getFullYear()+"<br>"+n.lastActive+": ";return i.setAttribute("class","mention"),i.setAttribute("data-mentioned-name",t.original.key),i.setAttribute("data-user-id",t.original.value),i.setAttribute("data-user-type",t.original.type),i.setAttribute("data-mention-tooltip",o),$(i).append("@"+t.original.key),i.outerHTML}}).attach(e),i(e)})}function o(t){var e=[];return $(t).find(".mention").each(function(t,i){$(i).html()==="@"+$(i).data("mentioned-name")?e.push({mentioned_name:$(i).data("mentioned-name"),user_id:$(i).data("user-id"),user_type:$(i).data("user-type")}):$(i).removeAttr("data-mentioned-name").removeAttr("data-user-id").removeAttr("data-user-type").removeAttr("data-mention-tooltip").removeClass("mention")}),e}var r,a={};return{attach:n,extract:o,showTooltip:e}}();$(function(){function t(t){if($(t)[0].scrollHeight>$(t).height()){$(t).addClass("content-border");
5var e=$(".shared-content-block").css("background-color");return $("head").append("<style>.content-border:after{position:absolute;bottom:0;right:0;width:100%;content:'';height:20px;background-image: linear-gradient(to bottom, rgba(255,255,255, 0),"+e+"100%);}</style>"),!0}}function e(t){var e=$(t).data("continueText"),i=$(t).data("title");$(t).after($("<a></a>").attr("class","continue-btn").attr("href","#").attr("role","button").attr("aria-label",e+" "+i).text(e)),$(t).next().on("click",function(){return $(t).addClass("content-expand"),$(t).removeClass("content-border"),$(this).hide(),!1})}$.each($(".tool-content"),function(i,n){$(n).hasClass("tool-content")&&"truncated"!==$(n).data("truncated")?$(n).addClass("content-expand"):t(n)&&e(n),$(n).find(".sup-image").length&&$(n).find(".fr-fic").hide()})}),function(){var t,e,i;$('[data-toggle="tooltip"]').tooltip(),$(".widget-header").click(function(){var t,e,i;if($("i",this).toggleClass("icon-chevron-right, icon-chevron-down"),i=(t=$(this)).attr("data-target"))return e=$(i),setTimeout(function(){var i;return i=e.hasClass("in"),t.attr("aria-expanded",i?"true":"false")},400)}),$(document).on("keydown",".widget-header",function(t){if(13===t.which||32===t.which)return t.preventDefault(),$(this).trigger("click")}),$(".ranking-source .controls label").each(function(){return $(this).prepend('<span class="reorder-handle" />')}),$('.ranking-source input[type="checkbox"], .ranking-destination input[type="checkbox"]').live("change",function(t){return t.preventDefault()}),$(".ranking-source label.checkbox, .ranking-destination label.checkbox").live("hover",function(){return $(this).toggleClass("active")}),i=function(){},e=function(){return $('input[type="checkbox"]',this).attr("disabled","disabled")},t=function(){return $('input[type="checkbox"]',this).removeAttr("disabled")},$(".ranking-source .controls").sortable({connectWith:".ranking-destination .controls",create:e,receive:e,start:i,stop:e}),$(".ranking-destination .controls").sortable({connectWith:".ranking-source .controls",cancel:".help-inline",receive:t,start:i,stop:t}),$(function(){var t,e;return"undefined"!=typeof respond&&null!==respond&&respond.update(),EHQ.Utility.disableCheck(),EHQ.Utility.disableEnterInFormInputBoxes(),$(".user-input-screen-name").length>0&&$(".user-input-screen-name").each(function(){if(EHQ.Utility.getIndex(["new_survey_response","new_quick_poll_response"],$(this).closest("form").attr("id"))>=0)return $(this).closest(".unverified-participation-login-field").hide()}),$("body").on("focus",".user-input-email, .user-input-screen-name",function(){var t,e;if((e=$(this).closest("form").find("p.unverified_user_note")).length>0&&!e.closest("form").data("formtypeappended")&&(t=e.closest("form").data("formtype")))return e.text(e.text()+" "+t+"."),e.closest("form").data("formtypeappended",1)}),$("body").on("touchstart.dropdown",".dropdown-menu",function(t){return t.stopPropagation()}),$(".crumb li:last-child").addClass("lastChild"),(t=$('div[role="article"]')).length>0&&(t.hide(),t.get(0).offsetHeight,t.show()),$("li.gallery-item").hover(function(){return $(this).find(".gallery-item-caption").removeClass("hide-caption")},function(){return $(this).find(".gallery-item-caption").addClass("hide-caption")}),$(".document-library-widget-link").each(function(t,e){return $(e).attr("href",$(e).data("url"))}),e=function(t,e){var i;return $(".project-tile").hide(),0!==e.length||t?(i=$(".project-tile"),t&&(i=i.filter("[data-state="+t+"]")),e.length>0&&(i=i.filter(function(){return $(this).attr("data-name").indexOf(e.toLowerCase())>-1})),0===i.length?$(".no-projects").show():($(".no-projects").hide(),i.show())):($(".project-tile").show(),$(".no-projects").hide())},$(".filters-container").on("click",".filter",function(t){var i;return t.preventDefault(),(i=$(this)).closest(".filters-container").find(".active").removeClass("active"),i.parent().addClass("active"),e(i.data("state"),$("#consultations-filter").val())}),$(".search-wrapper").on("keyup","#consultations-filter",function(){return e($(".active").data("state"),$(this).val())}),$(document).ready(function(){$("#main-nav").length&&$("#main-nav").smartmenus()}),window.rsConf={general:{usePost:!0}}})}.call(this);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.