var supportCenter=supportCenter||{},codeSources=[];supportCenter.common=function(){moment.locale(supportCenter.resources.cultureInfo);var n=function(){var n=0;return function(t,i){clearTimeout(n);n=setTimeout(t,i)}}(),t=function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n=n.replace(new RegExp("{"+i+"}","g"),t[i]));return n},i=function(n){$("html, body").animate({scrollTop:n.offset().top},"600")},r=function(n){return $("<div/>").text(n).html()},u=function(n,t){var i=[];n.find("li").remove();$.each(t,function(n,t){i.push($("<li>"+t+"<\/li>")[0])});n.append(i)},f=function(n,t){n.fadeIn();setTimeout(function(){n.fadeOut()},t)},e=function(){function n(n,t,i){var r,u;i?(r=new Date,r.setTime(r.getTime()+i*864e5),u="; expires="+r.toUTCString()):u="";document.cookie=n+"="+encodeURIComponent(JSON.stringify(t))+u+";domain=."+document.domain+";path=/"}function t(t){n(t,"",-1)}return{setCookie:n,expireCookie:t}}(),o=function(n){for(var f="\n",i=n.split(f),u,r,t=i.length-1;t>=0;t--)if(i[t].trim().length>0)break;else i.splice(t,1);for(u=0,t=0;t<i.length;t++)if(i[t].trim().length>0)break;else u++;return(i.splice(0,u),r=Number.MAX_SAFE_INTEGER,i.forEach(function(n){var t=n.length-n.replace(/^\s+/g,"").length;n.trim().length>0&&t<r&&(r=t)}),r===Number.MAX_SAFE_INTEGER)?n:i.map(function(n){return n.slice(r)}).join(f)},s=function(n){var t=$("<div/>").append(n);return t.find("ol[start]").each(function(){var n="section "+($(this).attr("start")-1);$(this).css("counter-reset",n)}),t.html()},h=function(n,t){var i=115,u=n.offset().top,r;supportCenter.extensions&&supportCenter.extensions.scrollAdjustment&&(i=supportCenter.extensions.scrollAdjustment);r=u-i;$("html, body").animate({scrollTop:r},600,function(){t&&t()})};return{delay:n,template:t,scrollToElement:i,scrollToContentElement:h,appendToList:u,showForTime:f,encodeHtml:r,helpers:function(){return{arraysIdentical:function(n,t){var i=n.length;if(i!==t.length)return!1;while(i--)if(n[i]!==t[i])return!1;return!0},generateGuid:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){var t=Math.random()*16|0,i=n=="x"?t:t&3|8;return i.toString(16)})},queryString:function(){for(var t={},f=window.location.search.substring(1),r=f.split("&"),n,u,i=0;i<r.length;i++)n=r[i].split("="),typeof t[n[0]]=="undefined"?t[n[0]]=n[1]:typeof t[n[0]]=="string"?(u=[t[n[0]],n[1]],t[n[0]]=u):t[n[0]].push(n[1]);return t}(),cleanEmptyAttaches:function(n){var t=[];$.each(n(),function(n,i){i.fileName()==""&&t.push(i)});$.each(t,function(t,i){n.remove(i)})},groupArrayBy:function(n,t){return $.map(n.reduce(function(n,i){return(n[i[t]]=n[i[t]]||[]).push(i),n},{}),function(n,t){return{group:t,items:n}})},containsTerm:function(n,t){var r,i,u,f;if(!n||n.length===0)return!0;for(r=n.split(" ").filter(function(n){return n&&n.length>0}),i=0;i<r.length;i++)if(u=new RegExp(r[i].replace(/([\(\)\[\]\\\.\^\$\|\?\+])/ig,"\\$1"),"i"),f=t.match(u),!f)return!1;return!0},trimString:function(n){var t=100;return n&&n.length>t?n.substring(0,t):n},copyToClipboard:function(n){if(n){if(window.clipboardData&&window.clipboardData.setData)return clipboardData.setData("Text",n);var t=document.createElement("textarea");t.style.width="2em";t.style.height="2em";t.value=n;document.body.appendChild(t);t.select();try{return document.execCommand("copy")}catch(i){return!1}finally{document.body.removeChild(t)}}},getTicketUrl:function(n,t,i,r){return i.details+"/"+n.toLowerCase()+"/"+r.getTicketSubject(t)}}}(),viewModels:function(){return{searchViewModel:function(n,t,i){var r={};return r.searchFocused=ko.observable(!1),r.searchActive=ko.observable(n()&&n()!==""),r.searchString=n,n.subscribe(function(n){r.searchActive(n&&n.length)}),r.toggleFocus=function(){r.searchFocused(!r.searchFocused())},r.applySearch=function(){return t()},r.clearSearch=function(){return i()},r.typed=function(){return r.searchString()&&r.searchString().length>0},r},attachViewModel:function(){var n={};return n.fileName=ko.observable(""),n.displayedFileName=ko.computed(function(){return n.fileName().split("\\").reverse()[0]}),n.visible=ko.computed(function(){return n.fileName()!=""&&n.fileName()!=undefined}),n.upload=ko.observable(1.1),n.opacity=ko.observable(0),n.error=ko.observable(null),n.itemOid=ko.observable(null),n.size=ko.observable(""),n.uploadFinish=ko.observable(!1),n}}}(),localStorage:function(){function n(){try{return"localStorage"in window&&window.localStorage!==null}catch(n){return!1}}return{tryGetValue:function(t){if(!n())return null;var i=window.localStorage.getItem(t);return i?JSON.parse(i):null},trySetValue:function(t,i){n()&&window.localStorage.setItem(t,JSON.stringify(i))}}}(),cookie:e,codeCopy:function(){function n(n){return codeSources.push(n),codeSources.length-1}function t(t){var i=codeSources.indexOf(t),r=i!==-1?i:n(t);return'<div class="icon icon-copy-alt-light copy-code" title="Copy code" data-code-id="'+r+'" onclick="supportCenter.common.codeCopy.copyToClipboard(this);"><\/div>'}function i(n){var i=null,t=$(n),r=codeSources[t.data("code-id")];r&&(supportCenter.common.helpers.copyToClipboard(r),t.toggleClass("copied",!0),clearTimeout(i),i=setTimeout(function(){t.toggleClass("copied",!1)},2500))}return{getHtml:t,copyToClipboard:i}}(),makeHtml:function(n,t,i){var r,u;return n?(r=window.markdownit({html:!1,linkify:!0,typographer:!0,breaks:!0,langPrefix:"language-",highlight:function(n,t){n=o(n.replace(/\t/g,"    "));var i=null;try{i=t&&hljs.getLanguage(t)?hljs.highlight(t,n,!0).value:hljs.highlightAuto(n).value}catch(u){}return i||r.utils.escapeHtml(n)}}),r.use(markdownItDXPlugins.tabbedContentPlugin),r.use(markdownItDXPlugins.spoilerPlugin),r.use(markdownItDXPlugins.autoAnchorsForHeadersPlugin),r.use(markdownItDXPlugins.highlightLinesPlugin),r.disable("code"),r.disable("smartquotes"),r.linkify.set({fuzzyLink:!1}),setTimeout(function(){var n=$("pre > code").parent("pre").filter(function(n,t){return!t.className.includes("code-sample")});n.each(function(n,t){var i=$(supportCenter.common.codeCopy.getHtml(t.textContent))[0];$(t).append(i)});markdownItDXPlugins.bindEvents({displayAnchors:!1})},0),i&&markdownitLinkAttributes&&(u=new RegExp("^((?!"+i+").)*$","ig"),r.use(markdownitLinkAttributes,{pattern:u,attrs:{rel:"nofollow"}})),s(t===!0?r.renderInline(n):r.render(n))):""},getUrlWithFilters:function(n,t,i,r,u,f){var s=n,e={},o;return t.length>0&&(e.filters=JSON.stringify(t)),i&&i.length&&(e.preset=i),r&&r.length&&(e.searchString=this.helpers.trimString(r)),u&&u.length&&(e.sorting=u),f&&f>1&&(s+="/"+f),o=$.map(e,function(n,t){return t+"="+encodeURIComponent(n)}).join("&"),s+(o.length===0?"":"?"+o)}}}();$(function(){(function(){$.each($(".tab-control"),function(n,t){var i=$(t);i.find(".tab-action").click(function(){var n=$(this);i.find(".tab-action.active").removeClass("active");i.find(".tab-content.active").removeClass("active");n.addClass("active");i.find(n.data("target")).addClass("active")});i.find(".tab-action.active").length===0&&i.find(".tab-action:first").click()})})(),function(){var t=$(window).height()<400?0:$(window).height()/10,i=function(n,i){var r=n.offset().top-$(window).height()/2;if(!(Math.abs(r)<t))return i?$("html, body").animate({scrollTop:r},"600"):$("html, body").scrollTop(r)},n=function(n,t){var r=n.find("textarea");i(n,t);r&&r.focus()};$.each($("[data-scroll]"),function(t,i){var r=$(i);r.click(function(){var t=$($(i).data("scroll")),u=$($(i).data("focus-delay")),r=$(i).data("scroll-noanimate")==="true";u?setTimeout(function(){n(t,!r)},300):n(t,!r)})})}(),function(){function n(){$.each($(document).find(".dropdown-toggle.active"),function(n,t){var i=$(t),r=i.next(".dropdown-popup");i.removeClass("active");r.hide()})}function t(t,i){t.is(":visible")?(i.removeClass("active"),t.hide()):(n(),i.addClass("active"),t.show())}$.each($(".dropdown"),function(n,i){var f=$(i),u=f.find(".dropdown-toggle"),r=f.find(".dropdown-popup"),e=r.find(".popup-dismiss"),o=f.find(".dropdown-main");o.length>0&&r.css("left",o.outerWidth()+"px");u.click(function(n){n.stopPropagation();t(r,u)});$(document).click(function(){u.removeClass("active");r.hasClass("adaptive")||r.hide()});e&&e.click(function(){u.removeClass("active");r.hide()})})}(),function(){function t(n){var t=n.find(".modal-dialog"),u=t.outerWidth(),i=t.outerHeight(),f=(u<window.innerWidth?u:window.innerWidth)/2,e=(i<window.innerHeight?i:window.innerHeight)/2;t.css("margin","-"+e+"px 0 0 -"+f+"px");r(n,i)}function r(n,t){var r=n.find(".modal-dialog"),i=n.find(".modal-backdrop");if(!(r.length<1)&&!(i.length<1)){var e=Math.max(t,r.outerHeight(),r[0].scrollHeight),o=u(r[0]),f=e+o;f>window.innerHeight?i.height(f>i.height()?n[0].scrollHeight:f):f<=i.height()&&i.height(window.innerHeight)}}function u(n){var t=0;do t+=n.offsetTop||0,n=n.offsetParent;while(n);return t}var i="modal-open",n=$("body");$.each($(".modal"),function(u,f){var e=$(f),o=function(){t(e)},s=function(){return r(e),!1};e.on("show.bs.modal",function(){$(this).fadeIn("fast",function(){$(this).addClass("in");n.hasClass(i)||n.addClass(i);t(e,!0);$(window).bind("resize",o);$(".modal-dialog").bind("elementResize",s)})});e.on("hide.bs.modal",function(t){t.preventDefault();$(this).fadeOut("fast",function(){$(this).removeClass("in");n.hasClass("tutorial-mode")?(n.attr("style","").attr("class",""),n.addClass("tutorial-mode")):n.attr("style","").attr("class","");$(window).unbind("resize",o);$(".modal-dialog").unbind("elementResize",s)})})});$.each($(".always-display-modal"),function(n,i){var r=$(i);t(r,!0);$(window).bind("resize",function(){t(r)})})}()});supportCenter=supportCenter||{};supportCenter.dataService=function(n){function h(n,t,i){n.ajaxSubmit({type:"POST",dataType:"json",success:function(n){t(n)},error:function(n){i(n)}})}function t(n,t,i,u,f,h){var c,a,l;return f=$.extend({},s,f),h?(contentType=o,c=$.extend({},{__RequestVerificationToken:h},t)):(contentType=e,c=f.requestType==r?JSON.stringify(t):t),a=f.requestType||r,l=$.ajax({dataType:u,contentType:contentType,type:a,url:n,data:c,success:i,async:f.async,error:f.onError}),{cancelRequest:function(){l&&l.abort()}}}function c(r,f,e){return t(n.loadRecentTickets,r,f,i,{onError:e,requestType:u})}function l(r,f){return t(n.ticketExists,{friendlyId:r},f,i,{requestType:u,async:!1})}function a(r,f,e){return t(n.getTriggerChanges,r,f,i,{onError:e,requestType:u})}function v(u,f,e,o){return t(n.listData,u,f,i,{onError:e,requestType:r},o)}function y(u,f,e,o){return t(n.savePreset,u,f,i,{onError:e,requestType:r},o)}function p(i,u,e,o){return t(n.getNewTicketModel,i,u,f,{onError:e,requestType:r},o)}var i="json",f="html",e="application/json; charset=utf-8",o="application/x-www-form-urlencoded; charset=utf-8",r="post",u="get",s={async:!0};return{ajaxSubmitForm:h,loadRecentTickets:c,ticketExists:l,getTriggerChanges:a,getListData:v,getNewTicketModel:p,savePreset:y}}(supportCenter.urlConfiguration);supportCenter=supportCenter||{};$(function(){var t=$("#recent-tickets-dialog"),n;window.location.hash==="#_=_"&&(window.history&&history.replaceState?window.history.replaceState("",document.title,window.location.pathname):window.location.hash=""),function(i,r,u){var f=$("#recent-tickets-btn");supportCenter.recentTicketsViewModel=function(){var t={},f=8,e=50,i=$("#recent-tickets-dialog .items");return t.pageNumber=0,t.searchFocused=ko.observable(!1),t.searchTerm=ko.observable(""),t.searchString=ko.observable(""),t.items=ko.observableArray(),t.canShowNext=ko.observable(!1),t.ticketsLoading=ko.observable(!1),t.recentTicketListIsEmpty=ko.observable(!1),t.submiting=ko.observable(!0),t.requestError=ko.observable(!1),t.clearRecentTicketResult=function(){t.pageNumber=0;i.scrollTop(0);t.items.removeAll()},t.applySearch=function(){t.clearRecentTicketResult();t.submiting(!0);t.requestError(!1);setTimeout(function(){t.searchString(t.searchTerm());t.load()},0)},ko.computed(t.searchTerm).extend({rateLimit:{method:"notifyWhenChangesStop",timeout:1500}}).subscribe(function(n){n!=""&&setTimeout(function(){t.applySearch()},0)}),t.clearSearch=function(){t.searchTerm("");t.searchString("");t.applySearch();t.searchFocused(!0)},t.load=function(){n&&n.cancelRequest&&n.cancelRequest();t.pageNumber>0&&(t.ticketsLoading(!0),i.scrollTop(i.scrollTop()+e));n=supportCenter.dataService.loadRecentTickets({pageNumber:t.pageNumber,searchTerm:t.searchString(),pageSize:f},function(n){var i=$.map(n.Data.Page,function(n){var t={};return t.friendlyId=n.FriendlyId,t.id=n.Id,t.subject=n.Subject,t.viewed=n.Viewed,t});t.pageNumber===0?(t.recentTicketListIsEmpty(t.searchString()===""&&n.Data.TotalCount===0),t.items(i)):i.forEach(function(n){t.items.push(n)});t.canShowNext(n.Data.Count+n.Data.Offset<n.Data.TotalCount);t.pageNumber++;t.ticketsLoading(!1);t.submiting(!1)},function(){t.submiting(!1);t.ticketsLoading(!1);t.requestError(!0)})},t.getTicketDetailsUrl=function(n,t){return r.details+"/"+n.toLowerCase()+"/"+u.getTicketSubject(t)},i.scroll(function(){t.canShowNext()&&!t.ticketsLoading()&&i.scrollTop()+i.height()===i.find(".items-container").height()&&t.load()}),t}();ko.applyBindings(supportCenter.recentTicketsViewModel,t[0]);f.click(function(){t.modal();setTimeout(function(){supportCenter.recentTicketsViewModel.clearSearch()},100)})}(supportCenter.common,supportCenter.urlConfiguration,supportCenter.seoLinksHelper),function(){function v(){n.not(":visible").length>0?s.css({display:"inline-block"}):s.css({display:"none"})}function c(){if(u=$(window).width(),r)return u>=h&&(n.show(),r=!1,v(),y()),!1;u<h?n.hide():n.show();v()}function w(n){n.show();n.css({width:"100%"});$.each(n.find("ul"),function(n,t){$(t).addClass("dropdown-menu-plain")})}function b(n){n.css({width:""});$.each(n.find("ul"),function(n,t){$(t).removeClass("dropdown-menu-plain")})}function k(){i.addClass("adaptive");n.css({width:"100%"});n.removeClass("pull-right");n.addClass("adaptive");n.show();w(f);$.each(l,function(n,t){$(t).hide()});o.length||t(e,"margin-top",!0);t(i,"height",!0);t(a,"top",!0);t(o,"top",!0)}function t(n,t,i){n.css(t,i?parseFloat(n.css(t))+f.height()+1:parseFloat(n.css(t))-f.height()-1)}function y(){o.length||t(e,"margin-top",!1);t(i,"height",!1);t(a,"top",!1);t(o,"top",!1);i.removeClass("adaptive");n.css({width:""});n.addClass("pull-right");n.removeClass("adaptive");n.hide();b(f);$.each(l,function(n,t){$(t).show()})}var i=$("#header"),n=i.find("#profile-dropdown"),s=$("#show-hidden-menu-items"),f=n.children(".dropdown-popup"),l=n.children().not(".dropdown-popup"),e=$("#content"),o=e.find("#action-bar"),a=e.find("#content"),r=!1,h=$(".logo.ticket-list").outerWidth(!0)+380,u=0,p=0;$(window).resize(function(){c()});s.click(function(){r=!r;r?k():(y(),c())});$(function(){u=$(window).width();p=u;$.each(n,function(n,t){h+=$(t).outerWidth()});c()}())}(),function(){t.on("hide.bs.modal",function(){supportCenter.recentTicketsViewModel.clearRecentTicketResult()})}(),function(){$.fn.modal.Constructor.prototype.enforceFocus=function(){}}(),function(n,t){var i=$("#sign-out-form"),r=$("#sign-out-btn");r.click(function(){t.ajaxSubmitForm(i,function(){window.location.reload()},function(){window.location.reload()})})}(supportCenter.client,supportCenter.dataService),function(){window.addEventListener("dragover",function(n){n=n||event;n.preventDefault()},!1);window.addEventListener("drop",function(n){n=n||event;n.preventDefault()},!1)}()});supportCenter=supportCenter||{};supportCenter.seoLinksHelper=function(){function f(t){return t=t.replace(r,n),t.replace(u,n)}function e(n){for(var t in i)n=n.replace(new RegExp(t,"g"),i[t]);return n}function o(i){var r,u,e,f;if(i.length>t){r="";u=i.split(n);for(e in u)if(f=u[e],r.length+f.length+1<t)r+=f+n;else break;i=r.replace(/-$/,"")}return i}var n="-",t=90,r=/[^a-zа-я0-9-]/g,u=/-+/g,i={"а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ё":"yo","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sch","ъ":"j","ы":"i","ь":"j","э":"e","ю":"yu","я":"ya"};return{getTicketSubject:function(n){return n&&(n=f(n.toLowerCase()),n=e(n),n=o(n)),n}}}();supportCenter=supportCenter||{};supportCenter.avatarHelper=function(n,t){function r(t,i){return n.getAvatar+"/"+t+"?type="+i}function u(n){var i="",t=f(n).split(/[\s,\._\-]/).filter(function(n){return n!=""});return t.length&&(i+=t[0][0]),t.length===2&&t[1]&&(i+=t[1][0]),i.toUpperCase()}function f(n){return n?n.trim().replace(/[\/#!$%\^&\*;:{}=`~()\[\]\'\"<>?@+\|№\\]|\s*\([^)]*\)*|\d*/g,""):""}function e(n){return"scheme-"+n.match(/\d/)[0]}function o(n){return"type-"+n.toLowerCase()}function i(n){return["avatar-image",o(n)]}function s(n,t){return i(n).concat(e(t))}function h(n){return i(n).concat("scheme-0")}function c(n){return{"class":ko.observable(h(n).join(" ")),text:ko.observable("?"),background:ko.observable("")}}function l(u,f,e){return{"class":ko.observable(i(e).join(" ")),text:ko.observable(""),background:ko.observable("url("+r(f,e)+")"),badgeUrl:u?"url("+n.client+"favicon.ico/"+t.faviconId+")":""}}function a(i,r,f,e){return{"class":ko.observable(s(r,f).join(" ")),text:ko.observable(u(e)),background:ko.observable(""),badgeUrl:i?"url("+n.client+"favicon.ico/"+t.faviconId+")":""}}return{getAvatar:function(n,t,i,r,u){return t?l(n,t,u):a(n,u,r,i)},getEmptyAvatar:c}}(supportCenter.urlConfiguration,supportCenter.company)