forked from roundcube/elastic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.min.js
executable file
·131 lines (131 loc) · 58.9 KB
/
ui.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/**
* Roundcube webmail functions for the Elastic skin
*
* Copyright (c) The Roundcube Dev Team
*
* The contents are subject to the Creative Commons Attribution-ShareAlike
* License. It is allowed to copy, distribute, transmit and to adapt the work
* by keeping credits to the original autors in the README file.
* See http://creativecommons.org/licenses/by-sa/3.0/ for details.
*
* @license magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
*/
/*
magnet:?xt=urn:btih:90dc5c0be029de84e523b9b3922520e79e0e6f08&dn=cc0.txt CC0-1.0
*/
function rcube_elastic_ui(){function l(a,b,c){(a=w(a))&&rcmail.register_button(a.command,b,a.data.type,c,a.data.sel)}function t(a,b,c,d){var e=!0,g=$("<a>"),k=a.attr("id")||(new Date).getTime(),m=k+"-clone";c=a[0].className+(c?" "+c:"");if(!b)c=$.trim(c.replace("btn-primary","primary").replace(/(btn[a-z-]*|button|disabled)/g,"")),c+=" button"+(d?"":" disabled");else if(d=a.data("popup"))g.data({popup:d,"toggle-button":a.data("toggle-button")}),D(g[0]),e=!1,rcmail.register_menu_button(g[0],d);g.attr({id:m,
href:"#","class":c}).append($('<span class="inner">').text(a.text()));if(e)g.on("click",function(b){a.click()});n&&!b?(g.data("target",a),T.push($.extend({button_id:m},w(a[0].id)))):l(k,m,c.replace(" disabled",""));return g}function w(a){var b,c;for(c in rcmail.buttons)for(b=0;b<rcmail.buttons[c].length;b++){var d=rcmail.buttons[c][b];if(d.id==a)return{command:c,index:b,data:d}}}function A(){$("[data-list]").filter("ul,table").each(function(){var a,b=$(this),d=b.data("list");if(rcmail[d]&&rcmail[d].multiselect){var c=
b.parents("layout-sidebar,#layout-list,#layout-content").last();var e=c.find(".header");var h=e.find("ul");if(!h.length)h=e;else if(a=h.find("a.select").data("toggle-button"))a=$("#"+a);rcmail[d].enable_checkbox_selection();a||(a=$("<a>").attr({"class":"button selection disabled",role:"button",title:rcmail.gettext("select")}).on("click",function(){$(this).is(".active")&&b.toggleClass("withselection")}).append($('<span class="inner">').text(rcmail.gettext("select"))),h.is(".menu")?(a.prependTo(h).wrap('<li role="menuitem">'),
f.content&&(c=t(a,!0,"hidden-big hidden-large"),$('<li role="menuitem">').append(c).appendTo("#toolbar-menu"),a=a.add(c))):(e=b.data("list-select-replace"))?$(e).replaceWith(a):(a.appendTo(h).addClass("icon"),c.is("#layout-sidebar")||a.addClass("toolbar-button")));rcmail.addEventListener("listupdate",function(b){b.list&&b.list==rcmail[d]&&(b.rowcount?a.addClass("active").removeClass("disabled").attr("tabindex",0):a.removeClass("active").addClass("disabled").attr("tabindex",-1))})}J&&rcmail[d]&&("function"==
typeof rcmail[d].draggable?rcmail[d].draggable("destroy"):"boolean"==typeof rcmail[d].draggable&&(rcmail[d].draggable=!1))});window.MutationObserver&&$("[data-label-msg]").filter("ul,table").each(function(){var a=$('<div class="listing-info hidden">').insertAfter(this),b=$(this);var d=function(){var d=b.data("label-msg");var c=b.is("ul")?b:b.children("tbody");if(rcmail.env.search_request||rcmail.env.qsearch||!d||c.children(":visible").length)a.addClass("hidden");else{c=b.data("label-ext");var g=b.data("create-command");
!c||g&&!rcmail.commands[g]||(d+=" "+c);a.text(d).removeClass("hidden")}};var c=function(){if(rcmail.busy||!b.is(":visible"))return setTimeout(c,250);clearTimeout(h.list_timer);h.list_timer=setTimeout(d,50)};(new MutationObserver(c)).observe(b[0],{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});c()});"print"!=rcmail.env.action&&$("#attachment-list > li").each(function(){U(this)});var a=function(a){"phone"==r&&rcmail.display_message(rcmail.gettext(a),"confirmation")};rcmail.addEventListener("fileappended",
function(b){b.attachment.complete&&(U(b.item),"text/vcard"==b.attachment.mimetype&&rcmail.commands["attach-vcard"]&&a("vcard_attachments.vcardattached"))}).addEventListener("managesieve.insertrow",function(a){p(a.obj)}).addEventListener("add-recipient",function(){a("recipientsadded")});rcmail.init_pagejumper(".pagenav > input");if("mail"==rcmail.task){if("compose"==rcmail.env.action&&(rcmail.addEventListener("compose-encrypted",function(a){$("a.mode-html, button.attach").prop("disabled",a.active);
$("a.attach, a.responses:not(.edit)")[a.active?"addClass":"removeClass"]("disabled")}),$("#layout-sidebar > .footer:not(.pagenav) > a.button").click(function(){$(this).is(".disabled")&&rcmail.display_message(rcmail.gettext("nocontactselected"),"warning")}),window.MutationObserver)){var b=$("#attachment-list"),c=function(){V("attach",0<b.children().length)};(new MutationObserver(c)).observe(b[0],{childList:!0});c()}rcmail.env.extwin||"compose"!=rcmail.env.action&&"show"!=rcmail.env.action||$("a.mail",
f.menu).attr({"aria-disabled":!1,onclick:"return rcmail.command('list','',this,event);"});"preview"!=rcmail.env.action&&"show"!=rcmail.env.action||$("a").filter('[href^="mailto:"]').each(function(){ia(this)})}else"settings"==rcmail.task&&(rcmail.addEventListener("identity-encryption-show",function(a){p(a.container)}),rcmail.addEventListener("identity-encryption-update",function(a){p(a.container)}));rcmail.set_env({thread_padding:"1.5rem",popup_width_small:1025,popup_width:1200});rcmail.env.devel_mode&&
window.less?less.pageLoadFinished.then(function(){E();rcmail.env.compose_focus_elem&&$(rcmail.env.compose_focus_elem).focus()}):E();var d=rcmail.env.date_format_localized;if(d){var e=function(a){$(a).filter(".datepicker").attr("placeholder",d);$(a).parent().find("select").each(function(){K(this)})};$("input.datepicker").each(function(){e(this)});rcmail.addEventListener("insert-edit-field",e)}}function p(a){a||(a=document);$("input.button,button",a).not(".btn").addClass("btn").not(".btn-primary,.primary,.mainaction").addClass("btn-secondary");
$("input.button.mainaction,button.primary,button.mainaction",a).addClass("btn-primary");$("button.btn.delete,button.btn.discard",a).addClass("btn-danger");$.each(["warning","error","information","confirmation"],function(){var b=this;$(".box"+b+":not(.ui.alert)",a).each(function(){L(this,b,!0)})});if(a!=document&&1==$(".popup",a).children().length){var b=$(".popup",a).children().first();if(b.is("img"))$(".popup",a).addClass("justified");else if(b.is("label")){var c=b.find("input").detach();b=b.detach();
var d=c.attr("id");d||c.attr("id",d="dialog-input-elastic");$(".popup",a).addClass("formcontent").append($('<div class="form-group row">').append(b.attr("for",d).addClass("col-sm-2 col-form-label")).append($('<div class="col-sm-10">').append(c)));c.focus()}}$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",$(".propform",a)).addClass("form-control");$("[type=checkbox]",$(".propform",a)).addClass("form-check-input");$("select",a).addClass("form-control custom-select");
a!=document&&$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",a).addClass("form-control");$("table.propform",a).each(function(){var a=0,b=0,d=["sm",4,8];$(this).attr("class").match(/cols-([a-z]+)-(\d)-(\d)/)&&(d=[RegExp.$1,RegExp.$2,RegExp.$3]);$(this).find("> tbody > tr, > tr").each(function(){var c=$(this),e=["form-group","row"];var g=c.children("td");if(2==g.length){var k=g.first();g=g.last();$("label",k).addClass("col-form-label");k.addClass("col-"+d[0]+"-"+d[1]);
g.addClass("col-"+d[0]+"-"+d[2]);1!=g.find("[type=checkbox]").length||g.find(".proplist").length?g.find("input:not([type=hidden]),textarea,radio,select").length?b++:(g.addClass("form-control-plaintext"),a++):(e.push("form-check"),g.find("a").length&&e.push("with-link"),b++);g.children(".datepicker")&&2==g.children("input").length&&g.addClass("datetime")}else 1==g.length&&g.css("width","100%");c.addClass(e.join(" "))});a>b&&$(this).addClass("text-only")});$("td.input-group",a).each(function(){$(this).children().slice(1).addClass("input-group-append")});
$("fieldset.propform:not(.groupped) div.row",a).each(function(){var a=0<$("input:not([type=hidden]),select,textarea",this).length;a&&$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",this).addClass("form-control");$(this).children().last().addClass("col-sm-8"+(a?"":" form-control-plaintext"));$(this).children().first().addClass("col-sm-4 col-form-label");$(this).addClass("form-group")});$("fieldset.propform.groupped fieldset",a).each(function(){$(".row",this).each(function(){var a=
0<$("input,select,textarea",this).length,b=$(this).children();a&&$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",this).addClass("form-control");if(!(2>b.length)){var d=b.first();d.is("select")?d.addClass("input-group-prepend"):d.wrap('<span class="input-group-prepend">').addClass("input-group-text");a||b.last().addClass("form-control-plaintext");$(".content",this).addClass("input-group-prepend input-group-append input-group-text");$("a.deletebutton",this).addClass("input-group-text icon delete").wrap('<span class="input-group-append">');
$(this).addClass("input-group")}})});$("fieldset.advanced",a).each(function(){var a=$(this).children(".propform").first();a.wrap($("<div>").addClass("collapse"));$(this).children("legend").first().addClass("closed").on("click",function(){a.parent().collapse("toggle");$(this).toggleClass("closed")})});$(".propform > .prop.block:not(.row)",a).each(function(){$(this).addClass("form-group row").each(function(){$("label",this).addClass("col-form-label").wrap($('<div class="col-sm-4">'));$("input,select,textarea",
this).wrap($('<div class="col-sm-8">'));$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",this).addClass("form-control")})});$("td.rowbuttons > a",a).addClass("btn");$("form.tabbed,div.tabbed",a).each(function(a,b){var d=[],c=$("<ul>").attr({"class":"nav nav-tabs",role:"tablist"});$(this).addClass("tab-content").children("fieldset").each(function(b,c){b=c.id||"tab"+a+"-"+b;var g=$(c).data("navlink-class");$(c).addClass("tab-pane").attr({id:b,role:"tabpanel"});b=$("<li>").addClass("nav-item").append($("<a>").addClass("nav-link"+
(g?" "+g:"")).attr({role:"tab",href:"#"+b}).text($("legend",c).first().text()).click(function(a){$(this).tab("show");x(a);return!1}));$("legend",c).first().hide();d.push(b)});c.append(d).insertBefore(b);$("a.nav-link",c).first().click()});$("input[type=file]:not(.custom-file-input)",a).each(function(){var a=rcmail.gettext("choosefile"+(this.multiple?"s":"")),b=$("<label>").attr({"class":"custom-file-label","data-browse":rcmail.gettext("browse")}).text(a);$(this).addClass("custom-file-input").wrap('<div class="custom-file">');
$(this).on("change",function(){var b=a;this.files.length&&(b=this.files[0].name,1<this.files.length&&(b+=", ..."));$(this).next().text(b)}).parent().append(b)});$("table:not(.table,.compact-table,.propform,.listing,.ui-datepicker-calendar)",a).filter(function(){return!$(this).parent().is(".propform")&&!$(this).parents(".message-htmlpart,.message-partheaders,.boxinformation,.raw-tables").length}).each(function(){var a=$(this).addClass("table");a.parent().addClass("table-responsive-sm");a.find("thead").addClass("thead-default")});
$("input.pretty-checkbox, .propform input[type=checkbox], .form-check input, .popupmenu.form input[type=checkbox], .menu input[type=checkbox]",a).each(function(){F(this)});$(a).is(".actionrow")&&$("input[type=checkbox]",a).each(function(){F(this)});$(".input-group-combo > select",a).first().on("change",function(){var a=$(this),b=function(){a[a.next().is(":visible")?"removeClass":"addClass"]("alone")};setTimeout(b,50);setTimeout(b,2E3)}).trigger("change");$("#message-objects",a).children(":not(.ui.alert)").add(".part-notice").each(function(){var a=
String($(this).removeClass("notice part-notice").attr("class")).split(/\s/)[0]||"warning";L(this,a);$(this).addClass("box"+a);$("a",this).addClass("btn btn-primary btn-sm")});$(".error",a).addClass("is-invalid");"login"==rcmail.env.task&&a==document&&($("#rcmloginsubmit").addClass("btn-lg text-uppercase w-100"),$("#login-form table tr").each(function(){var a=$("input,select",this),b=$("label",this),d=a.data("icon"),c=$("<i>").attr("class","input-group-text icon "+a.attr("name").replace("_",""));d&&
c.addClass(d);$(this).addClass("form-group row");b.parent().css("display","none");a.addClass(a.is("select")?"custom-select":"form-control").attr("placeholder",b.text()).before($('<span class="input-group-prepend">').append(c)).parent().addClass("input-group input-group-lg")}));$("select:not([multiple])",a).each(function(){K(this)})}function ja(a){if($(a).is(".mce-window")){var b=$(a).find(".mce-window-body"),c=$(a).find(".mce-foot > .mce-container-body");b.length&&p(b[0]);b.find("button").filter(function(){return 0<
$(this).parent(".mce-btn").length}).removeClass("btn btn-secondary");5===c.children(".mce-widget").length&&c.addClass("mce-search-foot");$(a).find(".mce-charmap").parent().parent().addClass("mce-charmap-dialog");$(a).find(".mce-combobox").each(function(){$(this).children(".mce-btn").length||$(this).addClass("mce-combobox-fake")});$(a).find(".mce-form > .mce-container-body").each(function(){4<$(this).children(".mce-formitem").length&&$(this).addClass("mce-form-split")});$(a).find(".mce-form").next(":not(.mce-formitem)").addClass("mce-form");
if(!u()){var d=0;c=b.height();$(a).find(".mce-form").each(function(){d=Math.max(d,$(this).height())});c<d&&(d+=(b.find(".mce-tabs").height()||0)+25,b.height(d),$(a).height($(a).height()+(d-c)),$(a).css("top",($(window).height()-$(a).height())/2+"px"))}}else $(a).is(".mce-menu")&&($(a).prepend($('<h3 class="popover-header">').append($('<a class="button icon "cancel">').text(rcmail.gettext("close")).on("click",function(){$(document.body).click()}))),window.MutationObserver&&(new MutationObserver(function(){"phone"==
r&&($(".mce-menu:visible").length?$("div.mce-overlay").length||$("<div>").attr("class","popover-overlay mce-overlay").appendTo("body").click(function(){$(this).remove()}):$("div.mce-overlay").click())})).observe(a,{attributes:!0}))}function ka(a,b){if(a.match(/_action=(create|add)/)||a.match(/_nav=hide/))$(h.frame_nav).addClass("hide-nav-buttons");else{var c,d,e;if((a=$("[data-list]",f.list).data("list"))&&(e=rcmail[a])){$(h.frame_nav).removeClass("hide-nav-buttons hidden");if(d=e.get_single_selection())e.rows&&
e.rows[d]&&!e.rows[d].expanded?e.expand_row(b,d):e.get_node&&(c=e.get_node(d))&&c.collapsed&&e.expand(d);var g,k,m=$("#"+rcmail.env.contentframe);b=$("a.button.next",h.frame_nav).off("click").addClass("disabled");c=$("a.button.prev",h.frame_nav).off("click").addClass("disabled");if((k=e.get_next())||rcmail.env.current_page<rcmail.env.pagecount)b.removeClass("disabled").on("click",function(){h.content_lock=!0;G(m);k?e.select(k):(rcmail.env.list_uid="FIRST",rcmail.command("nextpage"))});if((g=e.get_prev())&&
("*"!=g||"subscription_list"!=a)||1<rcmail.env.current_page)c.removeClass("disabled").on("click",function(){h.content_lock=!0;G(m);g?e.select(g):(rcmail.env.list_uid="LAST",rcmail.command("previouspage"))})}else $(h.frame_nav).is(".hide-nav-buttons")&&!$(".buttons",h.frame_nav).children().length&&$(h.frame_nav).addClass("hidden")}}function la(a){var b=[],c=$("#"+a.id).parent().is(".html-editor");a.config.plugins+=" autoresize";H().touch&&(a.config.toolbar_items_size=null,a.config.toolbar="undo redo | insert | styleselect",
a.config.plugins.match(/emoticons/)&&(a.config.toolbar+=" emoticons"));if("mail"==rcmail.task&&"compose"==rcmail.env.action){var d=$("#compose-content > form"),e=function(a){"Tab"==a.key&&a.shiftKey&&$("#compose-content > form").scrollTop(0)};b.push(function(a){a.on("keypress",e)});$("#composebody").on("keypress",e);d.on("scroll",function(){var a=$(".mce-container-body",d),b=$(".mce-top-part",a),c=a.offset(),e=d.offset().top;c&&0>c.top-e?b.css({position:"fixed",top:e+"px",width:a.width()+"px"}):b.css({position:"relative",
top:0,width:"auto"})});$(window).resize(function(){d.trigger("scroll")})}c&&(a.config.toolbar="plaintext | "+a.config.toolbar,a.config.setup_callback=function(a){a.addButton("plaintext",{tooltip:rcmail.gettext("plaintoggle"),icon:"plaintext",onclick:function(b){rcmail.command("toggle-editor",{id:a.id,html:!1},"",b.originalEvent)&&$("#"+a.id).parent().removeClass("ishtml")}})});rcmail.addEventListener("editor-load",function(a){$.each(b,function(){this(a.ref.editor)})})}function W(a){$("ul",a.obj).addClass("menu listing iconized");
$(a.obj).addClass("popupmenu popover");p(a.obj);$("input",a.obj).addClass("form-control");if(u()&&$(a.obj).is(".googie_window")){var b=rcmail.gettext("close");b=$("<a>").attr("class","button icon cancel").text(b).click(function(b){b.stopPropagation();$(".popover-overlay").remove();$(a.obj).hide()});$('<h3 class="popover-header">').append(b).prependTo(a.obj);$(".popover-overlay").length||$("<div>").attr("class","popover-overlay").appendTo("body").click(function(){$(this).remove()});$("ul,button",a.obj).click(function(a){$(a.target).is("input")||
$(".popover-overlay").remove()})}}function ma(a){n&&$.each(T,function(b,d){if(a.command==d.command)parent.$("#"+d.button_id)[a.status?"removeClass":"addClass"]("disabled")});if("mail"==rcmail.task)switch(a.command){case "reply-list":if(1==rcmail.env.reply_all_mode){var b=rcmail.gettext(a.status?"replylist":"replyall");$(".toolbar a.reply-all").attr("title",b).find(".inner").text(b)}break;case "compose-encrypted":$(".toolbar a.encrypt").parent().show();break;case "compose-encrypted-signed":$("#encryption-menu-button").show()}}
function X(){var a=$(window).width();J=1024>=a;r=480>=a?"phone":1200<a?"large":768<a?"normal":"small"}function E(){var a;X();M();na();(a=u())?(rcmail.set_env(h.small_screen_config),rcmail.enable_command("extwin",!1)):(rcmail.set_env(h.config),rcmail.enable_command("extwin",!0));$.each(N,function(){$(this)[a?"hide":"show"]()})}function M(){if(!n||f.sidebar.length||f.list.length){switch(r){case "phone":Y();y(!1);break;case "small":Y();y(!0);break;case "normal":oa();break;case "large":pa()}"phone"==
r&&$("#logo").data("src-small")?$("#logo").attr("src",$("#logo").data("src-small")):$("#logo").attr("src",$("#logo").data("src-default"));B();bw.webkit&&bw.ipad&&bw.agent.match(/OS 9/)&&$(".iframe-wrapper").each(function(){var a=$(this).height();a&&$(this).children("iframe").height(a)})}else B()}function na(){var a=H(),b=$(document.documentElement);b[0].className.match(/layout-([a-z]+)/)?RegExp.$1!=a.mode&&b.removeClass("layout-"+RegExp.$1).addClass("layout-"+a.mode):b.addClass("layout-"+a.mode);
a.touch&&!b.is(".touch")?b.addClass("touch"):!a.touch&&b.is(".touch")&&b.removeClass("touch")}function B(){$("#layout > div > .header").each(function(){var a,b=0,c=0,d={left:0,right:0};$(this).children(":visible:not(.position-absolute)").each(function(){!a&&$(this).is(".header-title")?a=$(this):d[a?"right":"left"]+=this.offsetWidth});0+d.right>=d.left?(b=0,c=d.right+0-d.left):(c=0,b=d.left-(0+d.right));$(a).css({"margin-right":b+"px","margin-left":c+"px","padding-right":"0px"})})}function oa(){if(f.list.length){var a=
f.list.is(h.last_selected)||!f.sidebar.is(h.last_selected)&&!f.sidebar.is(".layout-sticky");f.list[a?"removeClass":"addClass"]("hidden")}f.sidebar.length&&(a=!f.list.length||f.sidebar.is(h.last_selected)||f.sidebar.is(".layout-sticky"),f.sidebar[a?"removeClass":"addClass"]("hidden"));f.content.removeClass("hidden");y(!0);Z();f.list.length&&$(".header > ul.menu",f.list).addClass("popupmenu")}function pa(){$.each(f,function(a,b){b.removeClass("hidden")});Z();f.list&&$(".header > ul.menu.popupmenu",
f.list).removeClass("popupmenu")}function Y(){var a=!1;if(f.content.length){var b=a=f.content.is(h.last_selected);f.content[b?"removeClass":"addClass"]("hidden");$(".header > ul.menu",f.content).addClass("popupmenu")}f.list.length&&(b=!a&&f.list.is(h.last_selected),f.list[b?"removeClass":"addClass"]("hidden"),$(".header > ul.menu",f.list).addClass("popupmenu"));f.sidebar.length&&(b=!a&&(f.sidebar.is(h.last_selected)||!f.list.length),f.sidebar[b?"removeClass":"addClass"]("hidden"));a&&z.back_list.show()}
function Z(){z.back_list.filter(function(){return 0==$(this).parents("#layout-sidebar").length}).hide();$("ul.menu.popupmenu").removeClass("popupmenu")}function O(a){f.list.addClass("hidden");f.sidebar.removeClass("hidden");a&&f.sidebar.addClass("layout-sticky");"small"!=r&&"phone"!=r||f.content.addClass("hidden");B();h.last_selected=f.sidebar[0]}function P(a){f.list.length||f.sidebar.length?(f.sidebar.addClass("hidden").removeClass("layout-sticky"),f.list.removeClass("hidden"),"small"!=r&&"phone"!=
r||qa(),a&&f.list.children(".scroller").scrollTop(0),h.last_selected=f.list[0]):history.back();B()}function qa(){h.last_selected=f.list[0]||f.sidebar[0];M();rcmail.show_contentframe(!1);$("[data-list]",f.list).each(function(){var a=$(this).data("list");rcmail[a]&&(rcmail[a].clear_selection?rcmail[a].clear_selection():rcmail[a].select&&rcmail[a].select())})}function y(a){a?("phone"==r&&($('<div id="menu-overlay" class="popover-overlay">').on("click",function(){y(!1)}).appendTo("body"),h.menu_initialized||
(h.menu_initialized=!0,$("a",f.menu).on("click",function(a){"phone"==r&&y()})),f.menu.addClass("popover")),f.menu.removeClass("hidden")):($("#menu-overlay").remove(),f.menu.addClass("hidden").removeClass("popover"))}function ra(a){"loading"==a.type&&$(".iframe-loader:visible").length?rcmail.hide_message(a.object):(L(a.object,a.type,!0),$(a.object).attr("role","alert"))}function L(a,b,c){var d="ui alert",e=!$(a).is(".noicon");c&&e&&!$(a).is(".aligned-buttons")&&$(a).html($("<span>").html($(a).html()));
b=b.split(" ")[0];if(b={information:"alert-info",notice:"alert-info",confirmation:"alert-success",warning:"alert-warning",error:"alert-danger",loading:"alert-info loading",uploading:"alert-info loading",vcardattachment:"alert-info"}[b])d+=" "+b,e&&$("<i>").attr("class","icon").prependTo(a);$(a).addClass(d)}function aa(a){var b=$(),c=$("a.button.options",a),d=$("input:not([type=hidden])",a),e=d.attr("placeholder");$("form",a);var g=function(){if(d.val()||"mail"==rcmail.task&&$("#s_interval").val()||
rcmail.gui_objects.search_filter&&"ALL"!=$(rcmail.gui_objects.search_filter).val()||rcmail.gui_objects.foldersfilter&&"---"!=$(rcmail.gui_objects.foldersfilter).val())return!0},k=function(){$(a).is(".open")&&c.click()},m=function(){$(a)[g()?"addClass":"removeClass"]("active");b[rcmail.gui_objects.search_filter&&"UNSEEN"==$(rcmail.gui_objects.search_filter).val()?"addClass":"removeClass"]("selected")};d.is("#mailsearchform")&&(b=$("<a>").attr({"class":"button unread",href:"#",role:"button",title:rcmail.gettext("showunread")}).on("click",
function(a){$(rcmail.gui_objects.search_filter).val($(a.target).is(".selected")?"ALL":"UNSEEN");rcmail.command("search")}).insertBefore(c));c.on("click",function(b){var d=$(this).data("target"),g=$("#"+d),e=$(a).is(".open");if(g.length){if(!e)if(C[d])C[d](g.get(0),this,b);else if("function"==typeof window[d])window[d](g.get(0),this,b);g.next()[e?"show":"hide"]();g.toggleClass("hidden");$(".floating-action-buttons").toggleClass("hidden");$(a).toggleClass("open");$("button.search",g).off("click.search").on("click.search",
function(){c.click();m()})}});d.on("input change",m).on("focus blur",function(a){d.attr("placeholder","blur"==a.type?e:"")});$("a.reset",a).on("click",function(b){d.val("").change().trigger("keyup.treelist",{keyCode:27});$(a).is(".open")&&c.click();rcmail.gui_objects.search_filter&&$(rcmail.gui_objects.search_filter).val("ALL");rcmail.gui_objects.foldersfilter&&($(rcmail.gui_objects.foldersfilter).val("---").change(),rcmail.folder_filter("---"));m()});rcmail.addEventListener("init",m).addEventListener("responsebeforesearch",
m).addEventListener("beforelist",k).addEventListener("afterlist",m).addEventListener("beforesearch",k)}function D(a,b){if(n&&u())return parent.UI.popup_init(a,b||window);b||(b=window);var c,d=$(a).data("popup"),e=$(b.$("#"+d).get(0)),g=e,k=$(a).attr("title");$(a).attr({"aria-haspopup":"true","aria-expanded":"false","aria-owns":d}).popover({content:function(){b!=window&&(e=g.clone(!0,!0),e.attr("id",d+"-clone").appendTo(document.body).find("li > a").attr("onclick","").off("click").on("click",function(d){$(this).is(".disabled")||
($(a).popover("hide"),b.$("#"+$(this).attr("id")).click());return!1}));return e.get(0)},trigger:$(a).data("popup-trigger")||"click",placement:$(a).data("popup-pos")||"bottom",animation:!0,boundary:"window",html:!0}).on("show.bs.popover",function(g){var k=e.data("popup-init");d&&q[d]&&(q[d].transitioning=!0);if(k&&C[k])C[k](e.get(0),a,g);else if(k&&b[k])b[k](e.get(0),a,g);c=$("div.popover:visible").length+1;e.removeClass("hidden").attr("aria-hidden",!1).find('[aria-haspopup="true"]').data("level",
c+1).off("click.popup").on("click.popup",function(a){a.stopPropagation()});u()||e.css("max-height",Math.min(539,$(window).height()-30))}).on("shown.bs.popover",function(b){b=u();var g=$("#"+$(a).attr("aria-describedby"));c=$(a).data("level")||1;if(b){var e=1<c?"back":"close",k=rcmail.gettext(e);e="button icon "+("back"==e?"back":"cancel");$(".popover-header",g).empty().append($("<a>").attr("class",e).text(k).on("click",function(b){$(a).popover("hide");1<c&&b.stopPropagation()}).on("mousedown",function(a){a.stopPropagation()}))}$.each(q,
function(a,b){$(b.target).data("level")==c&&a!=d&&I(a)});"key"==$(a).data("event")&&(g.off("keydown.popup").on("keydown.popup","a.active",function(b){var d,c="next";switch(b.which){case 27:case 9:return $(a).popover("toggle").focus(),!1;case 38:case 63232:c="previous";case 40:case 63233:for(b=b.target.parentNode;b=b[c+"Sibling"];)if(d=$(b).children(".active")[0]){d.focus();break}return!1}}),g.find("a.active").first().focus());d&&q[d]&&(q[d].transitioning=!1);b&&!$(".popover-overlay").length&&$("<div>").attr("class",
"popover-overlay").appendTo("body").click(function(){$(this).remove()});$(".popover-body",g).addClass("webkit-scroller")}).on("hide.bs.popover",function(){1==c&&$(".popover-overlay").remove();d&&q[d]&&e.is(":visible")&&(q[d].transitioning=!0)}).on("hidden.bs.popover",function(){/-clone$/.test(e.attr("id"))?e.remove():e.attr("aria-hidden",!0).addClass("hidden").appendTo(e.data("popup-parent")||document.body);$(".popover-body:empty").each(function(){$(this).parent().remove()});d&&q[d]&&delete q[d]}).on("click",
function(){$(this).data("event","mouse")}).on("keydown",function(a){if(a.originalEvent)switch(a.originalEvent.which){case 13:case 32:a.preventDefault();$(this).data("event","key").popover("toggle");break;case 27:$(this).popover("hide")}});k&&$(a).attr("title",k);e.attr("aria-hidden","true").data("button",a);if(e.data("editable"))e.on("click mousedown",function(a){a.stopPropagation()})}function x(a){Q&&Q>(new Date).getTime()-250||$(".popover.show").each(function(){var b=$(".popover-body",this).children().first().data("button");
b&&a.target!=b&&!$(b).find(a.target).length&&"string"!==typeof b&&$(b).popover("hide");b||$(this).remove()})}function R(a){if(a&&a.name&&(!a.props||!1!==a.props.skinable)){if(n&&u())return a.win||(a.win=window),parent.UI.menu_toggle(a);if("messagelistmenu"==a.name)sa(a);else if("menu-open"==a.event){var b=$("ul",a.obj).first(),c=a.props&&a.props.link?a.props.link:a.originalEvent.target;$(c).is("span")&&(c=$(c).parents("a,li")[0]);if(a.name.match(/^drag/)){var d=rcube_event.get_mouse_pos(a.originalEvent);
c=$("<a>").css({position:"absolute",left:d.x,top:d.y,height:"1px",width:"1px",visibility:"hidden"}).appendTo(document.body).get(0)}d=$(c).data("popup-pos")||"right";"folder-selector"==a.name?b.addClass("listing folderlist"):"addressbook-selector"==a.name||"contactgroup-selector"==a.name?b.addClass("listing contactlist"):b.hasClass("menu")&&b.addClass("listing");"pagejump-selector"==a.name&&(b.addClass("simplelist"),a.obj.addClass("simplelist"),d="top");q[a.name]&&I(a.name,a.originalEvent);var e=function(){if(q[a.name]&&
q[a.name].transitioning)return setTimeout(e,50);$(c).data("popup")||($(c).data({event:rcube_event.is_keyboard(a.originalEvent)?"key":"mouse",popup:a.name,"popup-pos":d,"popup-trigger":"manual"}),D(c,a.win));q[a.name]={target:c};$(c).popover("show")};e()}else I(a.name,a.originalEvent);a.originalEvent.stopPropagation()}}function I(a,b){var c=a;if(q[c])var d=q[c].target;else d=$("#"+c).data("button"),d||(c.match(/(?!-)menu$/)&&(c=c.substr(0,c.length-4)),d=$("#"+c+"-menu").data("button"));c=d;a.match(/^drag/)?
$(c).popover("dispose").remove():($(c).popover("hide"),"forwardmenu"==a&&x(b))}function sa(a){a=$("#listoptions-menu");a.width();var b=a.clone(!0);$('select[name="sort_col"]',b).val(rcmail.env.sort_col||"");$('select[name="sort_ord"]',b).val(rcmail.env.sort_order||"ASC");$('select[name="mode"]',b).val(rcmail.env.threading?"threads":"list");$("select",b).each(function(){this.id+="-clone"});$("label",b).each(function(){$(this).attr("for",$(this).attr("for")+"-clone")});b=rcmail.simple_dialog(b,rcmail.gettext("listoptionstitle"),
function(a){rcube_event.is_keyboard(a.originalEvent)&&$("#listmenulink").focus();a=$('select[name="sort_col"]',b).val();var d=$('select[name="sort_ord"]',b).val(),c=$('select[name="mode"]',b).val();rcmail.set_list_options([],a,d,"threads"==c?1:0);return!0},{closeOnEscape:!0,minWidth:400})}function ba(a,b){var c=rcmail.env.task;var d=rcmail.env.search_mods,e=rcmail.env.mailbox,g=$("#s_scope",a).val(),k=$("#s_interval",a).val();"all"==g&&(e="*");d||(d={});if("mail"==c){d[e]||(d[e]=rcube_clone_object(d["*"]));
var f=d[e];c="text";rcmail.env.search_scope=g;rcmail.env.search_interval=k}else f=d,c="*";b&&(b.checked?f[b.value]=1:delete f[b.value],b.value==c&&$('input[name="s_mods[]"]',a).map(function(){this!=b&&(this.checked=!0,b.checked?(this.disabled=!0,delete f[this.value]):(this.disabled=!1,f[this.value]=1))}),rcmail.set_searchmods(f))}function V(a,b){var c=$("#composestatusbar"),d=c.find("a.button.icon."+a);b?d.length||$("<a>").attr("class","button icon "+a).on("click",function(){O()}).appendTo(c):d.remove()}
function ca(a,b,c){var d=$(b).parent().attr("id").replace(/^attach/,"");$.each(["open","download","rename"],function(){var b=this;$("#attachmenu"+b,a).off("click").attr("onclick","").click(function(a){return rcmail.command(b+"-attachment",d,this,a.originalEvent)})});return rcmail.command("menu-open",{menu:"attachmentmenu",id:d},a,c)}function U(a){a=$(a);if(!a.is(".no-menu")&&!a.children(".dropdown").length){var b=rcmail.gettext("options"),c=a.find("a.filename"),d=$("<a>").attr({href:"#",tabindex:c.attr("tabindex")||
0,title:b,"class":"button icon dropdown skip-content"}).on("click",function(a){return ca($("#attachmentmenu"),d,a)}).append($("<span>").attr("class","inner").text(b));c.length?d.insertAfter(c):d.appendTo(a)}}function da(a,b,c,d){var e=$(b).attr("href").replace(/^mailto:/,"");if(0>e.indexOf("@"))return!0;a.find("a").off("click").removeClass("active");if(rcmail.env.has_writeable_addressbook)$(".addressbook",a).addClass("active").on("click",function(a){var d=e,c=$(b).filter(".rcmContactAddress").text();
d=d.split("?")[0].split(",")[0].replace(/(^<|>$)/g,"");c&&(c=c.replace("<"+d+">",""),d='"'+$.trim(c)+'" <'+d+">");return rcmail.command("add-contact",d,this,a.originalEvent)});$(".compose",a).addClass("active").on("click",function(a){d?(b.onclick=d,$(b).trigger("click",[!0]),b.onclick=null):rcmail.command("compose",e,this,a.originalEvent);return!1});return rcmail.command("menu-open",{menu:"mailto-menu",link:b},b,c.originalEvent)}function ia(a){var b=a.onclick;a.onclick=null;$(a).on("click",function(c,
d){return d||da($("#mailto-menu"),a,c,b)})}function ta(a){var b=$("#quotadisplay"),c=b.find(".bar"),d=a.total?a.percent:0;c.length||(c=$('<span class="bar"><span class="value"></span></span>').appendTo(b));0<d&&10>d&&(d=10);c.find(".value").css("width",d+"%")[90<=d?"addClass":"removeClass"]("warning");b.attr({"data-original-title":"",title:b.find(".count").attr("title")});if(a.table)b.css("cursor","pointer").data("popup-pos","top").off("click").on("click",function(b){rcmail.simple_dialog(a.table,
"quota",null,{cancel_button:"close"})});else b.tooltip("dispose").tooltip({trigger:u()?"click":"hover"})}function ua(a){var b="",c=function(){k.css("width",Math.max(5,15*k.val().length+10))},d=function(){$(a).val(f.text()+k.val())},e=function(a,b,c){var g=$('<li class="recipient">'),f=$('<span class="name">').html(va(a||b)).on("dblclick",function(a){wa(a,e)}),m=$('<span class="email">'),h=$("<a>").attr({"class":"button icon remove"}).click(function(){g.remove();d();k.focus();return!1});a&&(b=" <"+
b+">");m.text((a?b:"")+",");g.attr("title",a?a+b:null).append([f,m,h]);c?c.replaceWith(g):g.insertBefore(k.parent());d()},g=function(a){a=(a||k.val()).replace(/[,;\s]+$/,"");a=ea(a);$.each(a.recipients,function(){e(this.name,this.email)});k.val(a.text);d();c();return 0<a.recipients.length};var k=$("<input>").attr({type:"text",tabindex:$(a).attr("tabindex")}).on("paste change",function(a,b){var d=this.value;"paste"==a.type?(b=(a.originalEvent.clipboardData||window.clipboardData).getData("text")||"",
d=d.substring(0,this.selectionStart)+b+d.substring(this.selectionEnd),a.preventDefault()):b&&(a=f.find("li.recipient").last(),a.length&&-1<this.value.indexOf(a.text().replace(/[ ,]+$/,""))&&a.remove());g(d)}).on("input",c).on("keydown",function(a){if(8==a.keyCode&&!k.val().length)return f.children("li.recipient").last().remove(),d(),!1;if((","==a.key||";"==a.key||"Enter"==a.key&&!rcmail.ksearch_visible())&&g())return!1;c()}).on("blur",function(){f.removeClass("focus")}).on("focus mousedown",function(){f.addClass("focus")});
var f=$("<ul>").addClass("form-control recipient-input ac-input rounded-left").append($("<li>").append(k)).on("mouseup",function(){b=window.getSelection().toString()}).on("click",function(){b.length||k.focus()});$(a).css({position:"absolute",opacity:0,left:"-5000px",width:"10px"}).attr("tabindex",-1).after(f).on("focus",function(a){k.focus();a.preventDefault()}).on("change",function(){$("li.recipient",f).remove();k.val(this.value).change()}).change();rcmail.init_address_input_events(k)}function ea(a){a=
$.trim(a.replace(/[,;\s]*[\r\n]+/g,","));var b=[],c=/(<(\S+|("[^"]+"))@\S+>)/,d=/((\S+|("[^"]+"))@\S+)/,e=a.match(/(?=\S)[^",;]*(?:"[^\\"]*(?:\\[,;\S][^\\"]*)*"[^",;]*)*/g);$.each(e||[],function(){if(this.length&&(c.test(this)||d.test(this))){var g=RegExp.$1,e=$.trim(this.replace(g,""));b.push({name:e,email:g.replace(/(^<|>$)/g,""),text:this});a=a.replace(this,"")}});a=a.replace(/[,;]+/,",").replace(/^[,;\s]+/,"");return{recipients:b,text:a}}function va(a){var b,c="",d=a.length;'"'!=a.charAt(0)&&
-1<a.indexOf('"')&&(a='"'+a.replace("\\","\\\\").replace('"','\\"')+'"');for(b=0;b<d;b++){var e=a.charAt(b);switch(e){case '"':if(0<b&&b<d-1){c+='"';break}c+='<span class="quotes">'+e+"</span>";break;case "\\":c+='<span class="quotes">'+e+"</span>";"\\"==a.charAt(b+1)&&(c+=e,b++);break;case "<":c+="<";break;case ">":c+=">";break;default:c+=e}}return c}function wa(a,b){var c=$(a.target).parents(".recipient"),d=c.text().replace(/,+$/,""),e=$("<input>").attr({type:"text",size:50}).val(d);a=$("<label>").text(rcmail.gettext("recipient")).append(e);
rcmail.simple_dialog(a,"recipientedit",function(){var a;if(a=e.val()){if(a!=d){a=ea(a);if(1!=a.recipients.length)return!1;b(a.recipients[0].name,a.recipients[0].email,c)}return!0}})}function xa(a){var b=$("<a>").attr({"class":"icon button delete",href:"#"}).click(function(a){rcmail.command("delete-photo","",this,a);return!1}),c=$(a).find("img")[0],d=function(){var b=-1!=(c.currentSrc||c.src).indexOf(rcmail.env.photo_placeholder);$(a)[b?"removeClass":"addClass"]("changed")};$(a).append(b).click(function(){rcmail.upload_input("upload-form")});
d();$(c).on("load",d)}function G(a){a=$(a);if(a.length){var b=$('<div class="iframe-loader">').append($('<div class="spinner spinner-border" role="status">').append($('<span class="sr-only">').text(rcmail.gettext("loading"))));a.on("load error loaded",function(){setTimeout(function(){b.remove()},500)}).parent().append(b);fa&&a.parent().addClass("ios-scroll")}}function F(a){var b;a=$(a);if(!a.is(".custom-control-input")){(b=a.attr("id"))||(b="icochk"+ ++h.checkboxes,a.attr("id",b));if(a.parent().is("label")){var c=
a.parent();a=a.detach();c.before(a)}else c=$("<label>");c.attr({"for":b,"class":"custom-control-label",title:a.attr("title")||""}).on("click",function(a){a.stopPropagation()});a.addClass("form-check-input custom-control-input").wrap('<div class="custom-control custom-switch">').parent().append(c)}}function ya(a){var b=$(a.row).find("input[id^=icochk]");b.length&&(a="icochk"+ ++h.checkboxes,b.attr("id",a).next("label").attr("for",a))}function K(a){if(!bw.iphone&&!bw.ipad&&(a=$(a),!a.is(".pretty-select"))){var b=
"select"+a.attr("id")+a.attr("name"),c=function(){if(a[0].ownerDocument.defaultView.$(".select-menu .listing").data("ident")==b)return!0},d=function(){var b=c();a.popover("dispose").focus();return!b},e=function(c){var g,e=-1,f=[],h=[],l=a.closest(".ui-dialog")[0],n=(document.documentElement.clientHeight||$(document.body).height())-75,q=$(document.body).width()-20,r=Math.min(a.outerWidth(),q),t=a.val();u()||(n*=.5);x(c);$("option",a).each(function(){var a=$(this).text(),b=$('<a href="#">').data("value",
this.value).addClass(this.disabled?"disabled":"active"+(this.value==t?" selected":""));a.length?(b.text(a),h.push(this.disabled?"":a.charAt(0).toLowerCase())):(b.html(" "),h.push(""));f.push($("<li>").append(b))});var p=$('<ul class="listing selectable iconized">').attr("data-ident",b).data("button",a[0]).append(f).on("click","a.active",function(){var b=$(this).data("value"),c=d();a.val(b).change();return c}).on("keydown","a.active",function(a){var b;var c="next";switch(a.which){case 27:case 9:return d();
case 13:case 32:return $(this).click(),!1;case 38:case 63232:c="previous";case 40:case 63233:for(a=a.target.parentNode;a=a[c+"Sibling"];)if(b=$(a).children(".active")[0]){b.focus();break}return!1;default:(c=a.originalEvent.key)&&1==c.length&&(c=c.toLowerCase(),g!=c&&(e=-1),a=h.indexOf(c,e+1),(-1<a||-1<(a=h.indexOf(c)))&&p.find("a").eq(a).focus(),g=c,e=a)}});a.popover("dispose").popover({container:l||document.body,content:p[0],placement:"bottom",trigger:"manual",boundary:"viewport",html:!0,offset:"0,2",
sanitize:!1,template:'<div class="popover select-menu" style="min-width: '+r+"px; max-width: "+q+'px"><div class="popover-header"></div><div class="popover-body" style="max-height: '+n+'px"></div></div>'}).on("shown.bs.popover",function(){a.focus();p.parent().prev().empty().append($('<a class="button icon cancel">').text(rcmail.gettext("close")).on("click",function(a){a.stopPropagation();return d()}));var b=p.find("a.selected").first();if(b.focus().length){var f=p.parent();e=p.find("a").index(b[0]);
g=h[e];5<e&&f.scrollTop(f.scrollTop()+f.height()/2)}else rcube_event.is_keyboard(c)&&p.find("a.active").first().focus();p.on("mousedown",function(a){a.stopPropagation()})}).popover("show")};a.addClass("pretty-select custom-select form-control").on("mousedown keydown",function(b){a=$(b.target);if(!a.prop("disabled")){if(9==b.which)return d(),!0;if(27==b.which||"mousedown"==b.type&&c())return d();a.focus();a.prop("disabled",!0);setTimeout(function(){a.prop("disabled",!1)},0);b.stopPropagation();if("mousedown"==
b.type||13==b.which||32==b.which||40==b.which||63233==b.which)return e(b),Q=(new Date).getTime(),!1}})}}function za(a){var b=!1,c=$(a),d=c.parent(),e=$('<a class="mce-i-html" href="#" tabindex="-1"></a>').attr("title",rcmail.gettext("htmltoggle")).on("click",function(a){rcmail.command("toggle-editor",{id:c.attr("id"),html:!0},"",a.originalEvent)&&d.addClass("ishtml")}).on("keydown",function(a){if(9==a.which)return c.focus(),!1}),g=$('<div class="editor-toolbar">').append(e);d.is("td")?(a=$('input[type="checkbox"]',
d.parent().next()),b=!0):a=c.next("select.hidden");Aa(c);1==a.length&&(d.addClass("html-editor"),c.after(g).data("control",a).on("keydown",function(a){a.altKey&&121==a.which&&e.focus()}),b&&(a.parents("tr").first().hide(),d.prev().hide(),d.addClass("col-sm-12")))}function Aa(a){var b=parseInt($(a).css("padding-top"))+parseInt($(a).css("padding-bottom"))+2,c=21*($(a)[0].rows||5);$(a).on("input",function(a){if(!(this.scrollHeight-b<=c)){var d,g=0;$(a.target).parents().each(function(){if(0<this.scrollTop)return d=
this,g=this.scrollTop,!1});a=$(this).outerHeight();$(this).outerHeight(0);var f=Math.max(c,this.scrollHeight);$(this).outerHeight(a);f!==a&&$(this).height(f);g&&(d.scrollTop=g)}}).trigger("input")}function S(a,b,c,d,e,g){d=$('<div class="input-group"><input type="text" class="form-control"><span class="input-group-append"><a class="icon reset input-group-text" href="#"></a></span></div>');b={value:b,name:c+"[]"};e&&(b.size=e);$("input",d).attr(b).keydown(function(b){var d=$(this);if(13==b.which){b=
d.attr("name").replace(/\[\]$/,"");var c=(new Date).getTime();d=S(a,"",b,c,e,d.parent());$("input",d).focus()}else if((8==b.which||46==b.which)&&""==d.val()&&(d=d.parent(),1<a.children().length))return d.prev().length?d.prev().children("input").focus():d.next().children("input").focus(),d.remove(),!1});$("a.reset",d).click(function(){var b=$(this.parentNode.parentNode);1<a.children().length?($("input",b.next().length?b.next():b.prev()).focus(),b.remove()):$("input",b).val("").focus()});$(d).find("input,a").on("focus",
function(){a.addClass("focused")}).on("blur",function(){a.removeClass("focused")});g?g.after(d):d.appendTo(a);return d}function ha(a){var b=a.find(".scroller .listing").first().attr("id"),c=rcmail.env.task+"."+(b||rcmail.env.action+"."+a.attr("id"));b=Ba(c);var d=a.is(".sidebar-right"),e=function(b){a.css({width:Math.max(100,b),flex:"none"})};a[d?"prev":"next"]().length&&($('<div class="column-resizer">').appendTo(a).on("mousedown",function(b){var g,f=$(this),h=a.position().left;f.width(1E4).css(d?
"left":"right",-5E3);document.body.style.userSelect="none";$(document).on("mousemove.resizer",function(b){clearTimeout(g);g=setTimeout(function(){d&&(h=a.position().left);var c=rcube_event.get_mouse_pos(b).x;c=d?a.width()+(h-c):c-h;e(c)},5)}).on("mouseup.resizer",function(){$(document).off(".resizer");$("iframe").off(".resizer");document.body.style.userSelect="auto";f.width(6).css(d?"left":"right",-3);var b=a.width();v[c]=b;if(!rcmail.local_storage_set_item("prefs.elastic",v)){var e=new Date;e.setYear(e.getFullYear()+
1);rcmail.set_cookie(c,b,e)}})}),b&&e(b))}function Ca(a){if(!u()||!0===arguments[3])return h.open_window.apply(rcmail,arguments);a=rcmail.add_url(a,"_framed",1);a=rcmail.add_url(a,"_extwin",1);var b,c="",d={cancel_button:"close",width:768,height:768},e=$("<iframe>").attr({id:"windowframe",src:a});/_action=([a-z_]+)/.test(a)&&(b=rcmail.labels[RegExp.$1])&&(c=b);/_frame=1/.test(a)&&(d.dialogClass="no-titlebar");rcmail.simple_dialog(e,c,null,d);return!0}function H(){if(n){var a=$(parent.document.documentElement);
return{mode:a[0].className.match(/layout-([a-z]+)/)?RegExp.$1:r,touch:a.is(".touch")}}return{mode:r,touch:J}}function u(){var a=H();return"phone"==a.mode||"small"==a.mode}function Ba(a){v||(v=rcmail.local_storage_get_item("prefs.elastic",{}));if(null==v[a]){var b=rcmail.get_cookie(a);null!=b&&(v[a]=b,rcmail.local_storage_set_item("prefs.elastic",v)&&rcmail.set_cookie(a,b,new Date))}return v[a]}var v,C=this,r="normal",J=!1,fa=!1,Q,n=rcmail.is_framed(),h={config:{standard_windows:rcmail.env.standard_windows,
message_extwin:rcmail.env.message_extwin,compose_extwin:rcmail.env.compose_extwin,help_open_extwin:rcmail.env.help_open_extwin},checkboxes:0,small_screen_config:{standard_windows:!0,message_extwin:!1,compose_extwin:!1,help_open_extwin:!1}},q={},N=[],T=[],f={menu:$("#layout-menu"),sidebar:$("#layout-sidebar"),list:$("#layout-list"),content:$("#layout-content")},z={menu:$("a.task-menu-button"),back_sidebar:$("a.back-sidebar-button"),back_list:$("a.back-list-button"),back_content:$("a.back-content-button")};
this.register_content_buttons=function(a){if(h.frame_nav&&a&&a.length){var b=h.frame_nav.children(".buttons");N=[];$.each(a,function(){this.data("target")&&N.push(this.data("target"))});b.html("").append(a)}};this.menu_hide=I;this.menu_toggle=R;this.menu_destroy=function(a){$("[aria-owns="+a+"]").popover("dispose").data("popup",null)};this.popup_init=D;this.about_dialog=function(a){var b,c=!1,d=$("<iframe>").attr({id:"aboutframe",src:rcmail.url("settings/about",{_framed:1})}),e=$("#supportlink");
if(e.length&&(b=e.attr("href"))){c=e.text();var g=function(a){0>b.indexOf("mailto:")?window.open(b):location.href=b}}rcmail.simple_dialog(d,$(a).text(),g,{button:c,button_class:"help",cancel_button:"close",height:400})};this.headers_dialog=function(){var a={_uid:rcmail.env.uid,_mbox:rcmail.env.mailbox,_framed:1};a=$("<iframe>").attr({id:"headersframe",src:rcmail.url("headers",a)});rcmail.simple_dialog(a,rcmail.gettext("arialabelmessageheaders"),null,{cancel_button:"close",height:400})};this.import_dialog=
function(){if(rcmail.commands["import-messages"]){var a=$("#uploadform").clone(!0);rcmail.simple_dialog(a,rcmail.gettext("importmessages"),function(b){return rcmail.command("import-messages",$(a.find("form")[0]))},{button:"import",closeOnEscape:!0,minWidth:400})}};this.headers_show=function(a){a=$(a).parent().prev();a[a.is(".hidden")?"removeClass":"addClass"]("hidden")};this.spellmenu=function(a){var b,c=[],d=rcmail.spellcheck_lang(),e=$("ul",a);if(!e.length){e=$('<ul class="selectable listing iconized" role="menu">');
for(b in rcmail.env.spell_langs){var g=$('<li role="menuitem">');var f=$('<a href="#'+b+'" tabindex="0"></a>').text(rcmail.env.spell_langs[b]).addClass("active").data("lang",b).on("click keypress",function(a){if("keypress"!=a.type||13==rcube_event.get_keycode(a))return rcmail.spellcheck_lang_set($(this).data("lang")),rcmail.hide_menu("spell-menu",a),!1});f.appendTo(g);c.push(g)}e.append(c).appendTo(a)}$("li",e).each(function(){var a=$("a",this);a.data("lang")==d?a.addClass("selected").attr("aria-selected",
"true"):a.hasClass("selected")&&a.removeClass("selected").removeAttr("aria-selected")})};this.searchmenu=function(a){var b,c=$('input[name="s_mods[]"]',a),d=$("#s_scope",a),e=rcmail.env.mailbox,g=rcmail.env.search_mods,f=rcmail.env.search_scope||"base";$(a).data("initialized")||($(a).data("initialized",!0),c.length&&(c.on("change",function(){ba(a,this)}),rcmail.addEventListener("beforesearch",function(){ba(a)})));if(rcmail.env.search_mods){if("mail"==rcmail.env.task){"all"==f&&(e="*");g=g[e]?g[e]:
g["*"];var h="text";d.val(f)}else h="*";if(g[h])c.map(function(){this.checked=!0;this.disabled=this.value!=h});else for(b in c.prop("disabled",!1).prop("checked",!1),g)c.filter('[value="'+b+'"]').prop("checked",!0)}};this.headersmenu=function(a,b,c){$("li > a",a).each(function(){var a=$(this),b="#compose_"+a.data("target");a[$(b).is(":visible")?"removeClass":"addClass"]("active").off().on("click",function(){$(b).removeClass("hidden").find(".recipient-input input").focus();a.removeClass("active");
rcmail.set_menu_buttons()})})};this.header_reset=function(a){$("#"+a).val("").change().closest(".form-group").nextAll(":not(.hidden)").first().find("input").focus();$("a[data-target="+a.replace(/^_/,"")+"]").addClass("active");rcmail.set_menu_buttons()};this.compose_status=V;this.attachmentmenu=ca;this.mailtomenu=da;this.recipient_selector=function(a,b){b||(b={});var c=rcmail.gettext(b.title||"insertcontact"),d=$("#recipient-dialog"),e=d.parent(),g=function(){d.is(":visible")&&rcmail.env.recipient_dialog.dialog("close")};
rcmail.env.recipient_selector_initialized||(rcmail.addEventListener("add-recipient",g),rcmail.env.recipient_selector_initialized=!0);a&&(rcmail.env.focused_field="#_"+a);rcmail.contact_list.clear_selection();rcmail.contact_list.multiselect="multiselect"in b?b.multiselect:!0;rcmail.env.recipient_dialog=rcmail.simple_dialog(d,c,function(){b.action?(b.action(),g()):rcmail.command("add-recipient")},{button:rcmail.gettext(b.button||"insert"),button_class:b.button_class||"insert recipient",height:600,classes:{"ui-dialog-content":"p-0"},
open:function(){$("#directorylist a").first().focus()},close:function(){d.appendTo(e);$(this).remove();$(b.focus||rcmail.env.focused_field).focus()}})};this.show_list=P;this.show_sidebar=O;this.smart_field_init=function(a){var b=a.id+"_list",c=$('<div class="multi-input"><div class="content"></div><div class="invalid-feedback"></div></div>'),d=a.value?a.value.split("\n"):[""];$("#"+b).length||($.each(d,function(b,d){S($(".content",c),d,a.name,b,$(a).data("size"))}),c.attr("id",b),a=$(a),a.attr("disabled")?
c.hide():a.prop("disabled",!0),a.data("hidden")&&c.hide(),a.after(c),a.hasClass("is-invalid")&&(c.addClass("is-invalid"),$(".invalid-feedback",c).text(a.data("error-msg"))))};this.smart_field_reset=function(a,b){b=b.length?b:[""];var c=$("#"+(a.id+"_list")).children(".content");c.empty();$.each(b,function(b,e){S(c,e,a.name,b,$(a).data("size"))})};this.form_errors=function(a){$.each(a,function(){var a=$("#"+this[0]).addClass("is-invalid");"list"==a.data("type")?(a.data("error-msg",this[2]),$("#"+this[0]+
"_list > .invalid-feedback").text(this[2])):a.after($('<span class="invalid-feedback">').text(this[2]))})};this.switch_nav_list=function(a){var b=$("a",a),c=$(a).next();if(c.height())c.animate({height:"0"},250),b.addClass("expand").removeClass("collapse"),$(a).removeClass("expanded");else{var d=$("tr,li",c).filter(function(){return"none"!=this.style.display});var e=$(d[0]).height()||50;c.animate({height:Math.min(5,d.length)*e+1+"px"},250);b.addClass("collapse").removeClass("expand");$(a).addClass("expanded")}};
this.searchbar_init=aa;this.pretty_checkbox=F;this.pretty_select=K;this.datepicker_init=function(a){window.MutationObserver&&$(a).not("[data-observed]").each(function(){var a,c=!0,d=n?parent:window;$(this).attr("data-observed","1");n&&($(this).detach().appendTo(parent.document.body),$('<div id="ui-datepicker-div" class="hidden">').appendTo(document.body));(new MutationObserver(function(b){$.each(b,function(b,e){"attributes"==e.type?(b="true"==$(e.target).attr("aria-hidden"),b!=c&&(b?a&&a.remove():
a=$("<div>").attr("class","ui-widget-overlay datepicker").appendTo(d.document.body).click(function(a){$(this).remove();n&&$.datepicker._hideDatepicker()}),c=b)):e.addedNodes.length&&(d.UI.bootstrap_style(e.target),n&&(d.$("select.ui-datepicker-month",e.target).on("change",function(){$.datepicker._selectMonthYear($.datepicker._lastInput,this,"M")}),d.$("select.ui-datepicker-year",e.target).on("change",function(){$.datepicker._selectMonthYear($.datepicker._lastInput,this,"Y")})))})})).observe(this,
{childList:!0,subtree:!1,attributes:!0,attributeFilter:["aria-hidden"]})})};this.bootstrap_style=p;X();(function(){h.last_selected=$("#layout > div.selected")[0];!h.last_selected&&f.content.length&&$.each(["sidebar","list","content"],function(){if(f[this].length)return h.last_selected=f[this][0],f[this].addClass("selected"),!1});$(window).on("resize",function(){clearTimeout(h.resize_timeout);h.resize_timeout=setTimeout(function(){E()},25)});h.open_window=rcmail.open_window;rcmail.open_window=Ca;rcmail.addEventListener("message",
ra).addEventListener("menu-open",R).addEventListener("menu-close",R).addEventListener("editor-init",la).addEventListener("autocomplete_create",W).addEventListener("googiespell_create",W).addEventListener("setquota",ta).addEventListener("enable-command",ma).addEventListener("clonerow",ya).addEventListener("init",A);window.MutationObserver&&window.tinymce&&(new MutationObserver(function(a){$.each(a,function(){$.each(this.addedNodes,function(){ja(this)})})})).observe(document.body,{childList:!0});if((f.list.length||
f.content.length)&&u()){var a=[];$("[data-fab]").each(function(){var b=$(this),c=b.data("fab-task")||"*",d=b.data("fab-action")||"*";"*"!=c&&c!=rcmail.env.task||"*"!=d&&d!=rcmail.env.action&&("none"!=d||rcmail.env.action)||a.push(t(b,!1,!1,!0))});a.length&&$('<div class="floating-action-buttons">').append(a).appendTo(f.list.length?f.list:f.content)}f.sidebar.length&&ha(f.sidebar);f.list.length&&ha(f.list)})();p();(function(){if(!h.got_smart_toolbar){h.got_smart_toolbar=!0;var a,b=[],c=[],d=H(),e=
function(a,b,d){var c=$('<li role="menuitem">');a=d?t($(a),!0,"hidden-big hidden-large"):$(a).detach();a.contents().filter(function(){3!=this.nodeType||$.trim(this.nodeValue).length||$(this).remove()});a.is(".spacer")?c.addClass("spacer"):c.append(a);b.push(c)};f.content.find(".header > .menu").each(function(){var a=$(this);a.children().each(function(){e(this,b)});a.remove()});f.list.find(".header > .menu").each(function(){var g=$(this);a=g.next();g.children().each(function(){"large"!=d.mode&&$(this).data("popup-pos",
"right");e(this,b,!0);e(this,c)});g.remove()});$('ul[data-menu="toolbar-small"] > li > a').each(function(){var a=$(this).clone();a.attr("id",this.id+"_clone");b.push($('<li role="menuitem">').addClass("hidden-big").append(a))});if(c.length){var g=f.list.children(".header"),k={"class":"menu toolbar popupmenu listing iconized",id:"toolbar-list-menu"},m=$('<a class="button icon toolbar-list-button" href="#list-menu">').attr({"data-popup":"toolbar-list-menu"});k=$("<ul>").attr(k).data("popup-parent",
g).append(c);a.length?k.insertBefore(a):g.append(k);g.append(m)}b.length&&(g=f.content.children(".header"),k={"class":"menu toolbar popupmenu listing iconized",id:"toolbar-menu"},m=$('<a class="button icon toolbar-menu-button" href="#menu">').attr({"data-popup":"toolbar-menu"}),g.append($("<ul>").attr(k).data("popup-parent",g).append(b)).append(m),f.list.find("a.toolbar-menu-button").click(function(a){a.stopPropagation();m.click()}))}})();(function(){if(f.list.length){var a=h.last_selected,b=function(a){"string"===
typeof a&&a.length||(a=$("h1.voice").text()||$("title").text()||"");f.content.find(".header > .header-title").text(a)},c=function(d,c,e,l){u()&&h.frame_nav&&ka(c,d);e&&!f.content.is(":visible")?h.last_selected=f.content[0]:e||h.last_selected==a||h.content_lock||(h.last_selected=a);M();b(l&&e?l:null);h.content_lock=!1},d=function(a){"large"!=r&&!h.content_lock&&a.force&&P();h.content_lock=!1;a.title&&$(".header > .header-title",f.list).text(a.title)},e=function(a){var b={};if("addressbook"==rcmail.env.task||
"mail"==rcmail.env.task)b.force=!0;"mail"!=rcmail.env.task||rcmail.env.action||(a="string"==$.type(a)?a:rcmail.env.mailbox,a=rcmail.env.mailboxes[a],b.title=a?a.name:"");d(b)};f.content.find("iframe").on("load",function(a){var d="",e=!0;$(this).parent(".iframe-wrapper").scrollTop(0);try{d=a.target.contentWindow.location.href,e=!d.endsWith(rcmail.env.blankpage),$(a.target.contentWindow).on("unload",b)}catch(Da){}c(a,d,e)});rcmail.addEventListener("afterlist",e).addEventListener("afterlistgroup",e).addEventListener("afterlistsearch",
e).addEventListener("show-list",function(a){a.force=!0;d(a)}).addEventListener("show-content",function(a){a.obj&&!$(a.obj).is("iframe")&&($(a.scrollElement||a.obj).scrollTop(0),u()&&G(a.obj));c(a.event||new Event,"_action="+(a.mode||"edit"),!0,a.title)})}})();(function(){$("[data-popup]").each(function(){D(this)});$(document).on("click",x);rcube_webmail.set_iframe_events({mousedown:x,touchstart:x})})();(function(){var a,b,c=[];$.ui&&$.widget("ui.dialog",$.ui.dialog,{open:function(){$(this.element).is(".iframe")&&
(this.options.width=Math.max(576,this.options.width));this._super();var a=$(this.uiDialog),b=a.width(),c=a.height(),f=$(window).width(),h=$(window).height();480>=f?a.css({width:"100%",height:"100%"}):(c>h&&a.css("height","100%"),b>f&&a.css("width","100%"));$(document).click();G($("div.popup > iframe",a));p(this.uiDialog);return this},close:function(){this._super();$(".select-menu:visible").remove();return this}});z.menu.on("click",function(){y(!0);return!1});z.back_sidebar.on("click",function(){O();
return!1});z.back_list.on("click",function(){P();return!1});z.back_content.on("click",function(){f.list.addClass("hidden");f.sidebar.addClass("hidden");f.content.removeClass("hidden");f.sidebar.removeClass("layout-sticky");B();h.last_selected=f.content[0];return!1});$(".searchbar").each(function(){aa(this)});!n||rcmail.env.extwin||parent.$(".ui-dialog:visible").length?n||((a=f.content.find(".boxtitle").first().detach().text())||(a=$("h1.voice").first().text()),a&&f.content.find(".header > .header-title").text(a)):
(a=$("h1.voice").first().text())&&parent.$("#layout-content > .header > .header-title:not(.constant)").text(a);n||!f.content.length||f.content.is(".no-navbar")||f.content.children(".frame-content").length||(h.frame_nav=$('<div class="footer menu toolbar content-frame-navigation hide-nav-buttons">').append($('<a class="button prev">').append($('<span class="inner"></span>').text(rcmail.gettext("previous")))).append($('<span class="buttons">')).append($('<a class="button next">').append($('<span class="inner"></span>').text(rcmail.gettext("next")))).appendTo(f.content));
$("a[data-content-button]").each(function(){c.push(t($(this)))});$(".formbuttons").filter(function(){return!$(this).parent(".searchoptions").length}).children().each(function(){var a=$(this);if(n||a.parents("#layout-content").length)a.is(".cancel")?a.addClass("hidden"):c.push(t(a))});(n?parent.UI:C).register_content_buttons(c);if(b=rcmail.gui_objects.messageform)b=$('form[name="'+b+'"]'),$("#_cc, #_bcc, #_replyto, #_followupto",$(".compose-headers")).each(function(){$(this).on("change",function(){$("#compose"+
$(this).attr("id"))[this.value?"removeClass":"addClass"]("hidden")})}),$("#compose-options").find("textarea,input,select").each(function(){var a=$("<input>").attr({type:"hidden",name:$(this).attr("name")}).appendTo(b);$(this).attr("tabindex",2).on("change",function(){a.val("checkbox"!=this.type||this.checked?$(this).val():"")}).change()});$("[data-recipient-input]").each(function(){ua(this)});$(".image-upload").each(function(){xa(this)});$("textarea[data-html-editor]").each(function(){za(this)});
$("#dragmessage-menu,#dragcontact-menu").each(function(){rcmail.gui_object("dragmenu",this.id)});$("#taskmenu > a").each(function(){if(/button-([a-z]+)/.test(this.className)){var a,b=RegExp.$1,c=w(this.id);c&&(a=c.data)&&(a.sel&&(a.sel=a.sel.replace("button-selected","selected")+" "+b),a.act&&(a.act+=" "+b),rcmail.buttons[c.command][c.index]=a,rcmail.init_button(c.command,a));$(this).addClass(b);$(".button-inner",this).addClass("inner")}$(this).on("mouseover",function(){rcube_webmail.long_subject_title(this,
0,$("span.inner",this))})});$(".listbutton").each(function(){var a=w(this.id);$(this).addClass("button").removeClass("listbutton");a.data.sel&&(a.data.sel=a.data.sel.replace("listbutton","button"));a.data.act&&(a.data.act=a.data.act.replace("listbutton","button"));rcmail.buttons[a.command][a.index]=a.data;rcmail.init_button(a.command,a.data)});$("[data-hidden]").each(function(){for(var a,b=$(this).data("hidden"),c=$(this).parent("li"),f=/(large|big|small|phone|lbs)/g;a=f.exec(b);)$(c.length?c:this).addClass("hidden-"+
a[1])});$("[data-list]").each(function(){$("input[type=checkbox]",this).each(function(){F(this)})});n&&$(".formcontent").each(function(){$(this).next(".formbuttons").length&&$(this).parent().addClass("formcontainer")});$("#attachment-list + a.zipdownload").appendTo(".header-links");(fa=$("html").is(".ipad,.iphone"))&&$(".iframe-wrapper, .scroller").addClass("ios-scroll");$("html").filter(".ipad,.iphone,.webkit.mobile,.webkit.tablet").addClass("webkit-scroller").length&&$(f.menu).addClass("webkit-scroller");
$(".treelist").each(function(){var a=this,b=function(){$(a)[0<$(".treetoggle",a).length?"removeClass":"addClass"]("notree")};window.MutationObserver&&(new MutationObserver(b)).observe(a,{childList:!0,subtree:!0});b();$("li.mailbox > a").on("mouseover",function(){rcube_webmail.long_subject_title_ex(this)})});$("#logo").data("src-default")||$("#logo").data("src-default",$("#logo").attr("src"))})();E()}
if(window.rcmail)rcmail.show_menu=function(l,t,w){var A="object"==typeof l?l.menu:l,p=$("#"+A);"string"==typeof l&&(l={menu:A});return rcmail.triggerEvent(!1===t?"menu-close":"menu-open",{name:A,obj:p,props:l,originalEvent:w})},rcmail.hide_menu=function(l,t){return rcmail.triggerEvent("menu-close",{name:l,props:{menu:l},originalEvent:t})};else var rcmail=parent.rcmail,rcube_webmail=parent.rcube_webmail,bw={};var UI=new rcube_elastic_ui;
if($&&$.datepicker){var __newInst=$.datepicker._newInst;$.extend($.datepicker,{_newInst:function(l,t){l=__newInst.call(this,l,t);l.inline||UI.datepicker_init(l.dpDiv);return l}})};