forked from roundcube/elastic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.min.js
131 lines (131 loc) · 58.8 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 r(a,b,d){(a=n(a))&&rcmail.register_button(a.command,b,a.data.type,d,a.data.sel)}function s(a,b,d,c){var f=!0,h=$("<a>"),m=a.attr("id")||(new Date).getTime(),k=m+"-clone";d=a[0].className+(d?" "+d:"");if(!b)d=$.trim(d.replace("btn-primary","primary").replace(/(btn[a-z-]*|button|disabled)/g,"")),d+=" button"+(c?"":" disabled");else if(c=a.data("popup"))h.data({popup:c,"toggle-button":a.data("toggle-button")}),E(h[0]),f=!1,rcmail.register_menu_button(h[0],c);h.attr({id:k,
href:"#","class":d}).append($('<span class="inner">').text(a.text()));if(f)h.on("click",function(c){a.click()});l&&!b?(h.data("target",a),U.push($.extend({button_id:k},n(a[0].id)))):r(m,k,d.replace(" disabled",""));return h}function n(a){var b,d,c;for(c in rcmail.buttons)for(b=0;b<rcmail.buttons[c].length;b++)if(d=rcmail.buttons[c][b],d.id==a)return{command:c,index:b,data:d}}function B(){$("[data-list]").filter("ul,table").each(function(){var a,c=$(this),b=c.data("list");if(rcmail[b]&&rcmail[b].multiselect){var d,
f=c.parents("layout-sidebar,#layout-list,#layout-content").last();d=f.find(".header");var u=d.find("ul");if(!u.length)u=d;else if(a=u.find("a.select").data("toggle-button"))a=$("#"+a);rcmail[b].enable_checkbox_selection();a||(a=$("<a>").attr({"class":"button selection disabled",role:"button",title:rcmail.gettext("select")}).on("click",function(){$(this).is(".active")&&c.toggleClass("withselection")}).append($('<span class="inner">').text(rcmail.gettext("select"))),u.is(".menu")?(a.prependTo(u).wrap('<li role="menuitem">'),
e.content&&(f=s(a,!0,"hidden-big hidden-large"),$('<li role="menuitem">').append(f).appendTo("#toolbar-menu"),a=a.add(f))):(d=c.data("list-select-replace"))?$(d).replaceWith(a):(a.appendTo(u).addClass("icon"),f.is("#layout-sidebar")||a.addClass("toolbar-button")));rcmail.addEventListener("listupdate",function(c){c.list&&c.list==rcmail[b]&&(c.rowcount?a.addClass("active").removeClass("disabled").attr("tabindex",0):a.removeClass("active").addClass("disabled").attr("tabindex",-1))})}K&&rcmail[b]&&("function"==
typeof rcmail[b].draggable?rcmail[b].draggable("destroy"):"boolean"==typeof rcmail[b].draggable&&(rcmail[b].draggable=!1))});window.MutationObserver&&$("[data-label-msg]").filter("ul,table").each(function(){var a,c,b=$('<div class="listing-info hidden">').insertAfter(this),d=$(this);a=function(){var a,c,f=d.data("label-msg");a=d.is("ul")?d:d.children("tbody");rcmail.env.search_request||rcmail.env.qsearch||!f||a.children(":visible").length?b.addClass("hidden"):(a=d.data("label-ext"),c=d.data("create-command"),
!a||c&&!rcmail.commands[c]||(f+=" "+a),b.text(f).removeClass("hidden"))};c=function(){if(rcmail.busy||!d.is(":visible"))return setTimeout(c,250);clearTimeout(g.list_timer);g.list_timer=setTimeout(a,50)};(new MutationObserver(c)).observe(d[0],{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]});c()});"print"!=rcmail.env.action&&$("#attachment-list > li").each(function(){V(this)});var a=function(a){"phone"==q&&rcmail.display_message(rcmail.gettext(a),"confirmation")};rcmail.addEventListener("fileappended",
function(c){c.attachment.complete&&(V(c.item),"text/vcard"==c.attachment.mimetype&&rcmail.commands["attach-vcard"]&&a("vcard_attachments.vcardattached"))}).addEventListener("managesieve.insertrow",function(a){v(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"),d=function(){W("attach",0<b.children().length)};(new MutationObserver(d)).observe(b[0],{childList:!0});d()}rcmail.env.extwin||"compose"!=rcmail.env.action&&"show"!=rcmail.env.action||$("a.mail",
e.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){v(a.container)}),rcmail.addEventListener("identity-encryption-update",function(a){v(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(){F();rcmail.env.compose_focus_elem&&$(rcmail.env.compose_focus_elem).focus()}):F();var c,f=rcmail.env.date_format_localized;f&&(c=function(a){$(a).filter(".datepicker").attr("placeholder",f);$(a).parent().find("select").each(function(){L(this)})},$("input.datepicker").each(function(){c(this)}),rcmail.addEventListener("insert-edit-field",c))}function v(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 c=this;$(".box"+c+":not(.ui.alert)",a).each(function(){M(this,c,!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 d=b.find("input").detach(),b=b.detach(),
c=d.attr("id");c||d.attr("id",c="dialog-input-elastic");$(".popup",a).addClass("formcontent").append($('<div class="form-group row">').append(b.attr("for",c).addClass("col-sm-2 col-form-label")).append($('<div class="col-sm-10">').append(d)));d.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,c=0,b=["sm",4,8];$(this).attr("class").match(/cols-([a-z]+)-(\d)-(\d)/)&&(b=[RegExp.$1,RegExp.$2,RegExp.$3]);$(this).find("> tbody > tr, > tr").each(function(){var d,e,g=$(this),u=["form-group","row"];e=g.children("td");2==e.length?(d=e.first(),e=e.last(),$("label",d).addClass("col-form-label"),d.addClass("col-"+b[0]+"-"+b[1]),e.addClass("col-"+
b[0]+"-"+b[2]),1!=e.find("[type=checkbox]").length||e.find(".proplist").length?e.find("input:not([type=hidden]),textarea,radio,select").length?c++:(e.addClass("form-control-plaintext"),a++):(u.push("form-check"),e.find("a").length&&u.push("with-link"),c++),e.children(".datepicker")&&2==e.children("input").length&&e.addClass("datetime")):1==e.length&&e.css("width","100%");g.addClass(u.join(" "))});a>c&&$(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,
c=0<$("input,select,textarea",this).length,b=$(this).children();c&&$("input:not(.button,.no-bs,[type=button],[type=radio],[type=checkbox]),textarea",this).addClass("form-control");2>b.length||(a=b.first(),a.is("select")?a.addClass("input-group-prepend"):a.wrap('<span class="input-group-prepend">').addClass("input-group-text"),c||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,c){var b=[],d=$("<ul>").attr({"class":"nav nav-tabs",role:"tablist"});$(this).addClass("tab-content").children("fieldset").each(function(c,d){var h;h=d.id||"tab"+a+"-"+c;var k=$(d).data("navlink-class");$(d).addClass("tab-pane").attr({id:h,role:"tabpanel"});
h=$("<li>").addClass("nav-item").append($("<a>").addClass("nav-link"+(k?" "+k:"")).attr({role:"tab",href:"#"+h}).text($("legend",d).first().text()).click(function(a){$(this).tab("show");y(a);return!1}));$("legend",d).first().hide();b.push(h)});d.append(b).insertBefore(c);$("a.nav-link",d).first().click()});$("input[type=file]:not(.custom-file-input)",a).each(function(){var a=rcmail.gettext("choosefile"+(this.multiple?"s":"")),c=$("<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 c=a;this.files.length&&(c=this.files[0].name,1<this.files.length&&(c+=", ..."));$(this).next().text(c)}).parent().append(c)});$("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(){G(this)});$(a).is(".actionrow")&&$("input[type=checkbox]",a).each(function(){G(this)});$(".input-group-combo > select",a).first().on("change",function(){var a=$(this),c=function(){a[a.next().is(":visible")?"removeClass":"addClass"]("alone")};setTimeout(c,
50);setTimeout(c,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";M(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),c=$("label",this),b=a.data("icon"),d=$("<i>").attr("class","input-group-text icon "+a.attr("name").replace("_",""));b&&d.addClass(b);$(this).addClass("form-group row");c.parent().css("display","none");a.addClass(a.is("select")?"custom-select":"form-control").attr("placeholder",c.text()).before($('<span class="input-group-prepend">').append(d)).parent().addClass("input-group input-group-lg")}));$("select:not([multiple])",a).each(function(){L(this)})}function ja(a){if($(a).is(".mce-window")){var b=
$(a).find(".mce-window-body"),d=$(a).find(".mce-foot > .mce-container-body");b.length&&v(b[0]);b.find("button").filter(function(){return 0<$(this).parent(".mce-btn").length}).removeClass("btn btn-secondary");5===d.children(".mce-widget").length&&d.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(!t()){var c=0,d=b.height();$(a).find(".mce-form").each(function(){c=Math.max(c,$(this).height())});d<c&&(c+=(b.find(".mce-tabs").height()||0)+25,b.height(c),$(a).height($(a).height()+(c-d)),$(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"==q&&($(".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/))$(g.frame_nav).addClass("hide-nav-buttons");else{var d,c,f,h=$("[data-list]",e.list).data("list");
if(h&&(f=rcmail[h])){$(g.frame_nav).removeClass("hide-nav-buttons hidden");if(c=f.get_single_selection())f.rows&&f.rows[c]&&!f.rows[c].expanded?f.expand_row(b,c):f.get_node&&(d=f.get_node(c))&&d.collapsed&&f.expand(c);var m,k,x=$("#"+rcmail.env.contentframe);d=$("a.button.next",g.frame_nav).off("click").addClass("disabled");c=$("a.button.prev",g.frame_nav).off("click").addClass("disabled");if((k=f.get_next())||rcmail.env.current_page<rcmail.env.pagecount)d.removeClass("disabled").on("click",function(){g.content_lock=
!0;H(x);k?f.select(k):(rcmail.env.list_uid="FIRST",rcmail.command("nextpage"))});if((m=f.get_prev())&&("*"!=m||"subscription_list"!=h)||1<rcmail.env.current_page)c.removeClass("disabled").on("click",function(){g.content_lock=!0;H(x);m?f.select(m):(rcmail.env.list_uid="LAST",rcmail.command("previouspage"))})}else $(g.frame_nav).is(".hide-nav-buttons")&&!$(".buttons",g.frame_nav).children().length&&$(g.frame_nav).addClass("hidden")}}function la(a){var b=[],d=$("#"+a.id).parent().is(".html-editor");
a.config.plugins+=" autoresize";I().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 c=$("#compose-content > form"),f=function(a){"Tab"==a.key&&a.shiftKey&&$("#compose-content > form").scrollTop(0)};b.push(function(a){a.on("keypress",f)});$("#composebody").on("keypress",f);c.on("scroll",function(){var a=$(".mce-container-body",
c),b=$(".mce-top-part",a),d=a.offset(),f=c.offset().top;d&&0>d.top-f?b.css({position:"fixed",top:f+"px",width:a.width()+"px"}):b.css({position:"relative",top:0,width:"auto"})});$(window).resize(function(){c.trigger("scroll")})}d&&(a.config.toolbar="plaintext | "+a.config.toolbar,a.config.setup_callback=function(a){a.addButton("plaintext",{tooltip:rcmail.gettext("plaintoggle"),icon:"plaintext",onclick:function(c){rcmail.command("toggle-editor",{id:a.id,html:!1},"",c.originalEvent)&&$("#"+a.id).parent().removeClass("ishtml")}})});
rcmail.addEventListener("editor-load",function(a){$.each(b,function(){this(a.ref.editor)})})}function X(a){$("ul",a.obj).addClass("menu listing iconized");$(a.obj).addClass("popupmenu popover");v(a.obj);$("input",a.obj).addClass("form-control");if(t()&&$(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){l&&$.each(U,function(b,c){if(a.command==c.command)parent.$("#"+c.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 Y(){var a=$(window).width();K=1024>=a;q=480>=a?"phone":1200<a?"large":768<a?"normal":"small"}function F(){var a;Y();N();na();(a=t())?(rcmail.set_env(g.small_screen_config),rcmail.enable_command("extwin",!1)):(rcmail.set_env(g.config),rcmail.enable_command("extwin",!0));$.each(O,function(){$(this)[a?
"hide":"show"]()})}function N(){if(!l||e.sidebar.length||e.list.length){switch(q){case "phone":Z();z(!1);break;case "small":Z();z(!0);break;case "normal":oa();break;case "large":pa()}"phone"==q&&$("#logo").data("src-small")?$("#logo").attr("src",$("#logo").data("src-small")):$("#logo").attr("src",$("#logo").data("src-default"));C();bw.webkit&&bw.ipad&&bw.agent.match(/OS 9/)&&$(".iframe-wrapper").each(function(){var a=$(this).height();a&&$(this).children("iframe").height(a)})}else C()}function na(){var a=
I(),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 C(){$("#layout > div > .header").each(function(){var a,b=0,d=0,c={left:0,right:0};$(this).children(":visible:not(.position-absolute)").each(function(){!a&&$(this).is(".header-title")?a=$(this):c[a?"right":"left"]+=
this.offsetWidth});0+c.right>=c.left?(b=0,d=c.right+0-c.left):(d=0,b=c.left-(0+c.right));$(a).css({"margin-right":b+"px","margin-left":d+"px","padding-right":"0px"})})}function oa(){var a;e.list.length&&(a=e.list.is(g.last_selected)||!e.sidebar.is(g.last_selected)&&!e.sidebar.is(".layout-sticky"),e.list[a?"removeClass":"addClass"]("hidden"));e.sidebar.length&&(a=!e.list.length||e.sidebar.is(g.last_selected)||e.sidebar.is(".layout-sticky"),e.sidebar[a?"removeClass":"addClass"]("hidden"));e.content.removeClass("hidden");
z(!0);aa();e.list.length&&$(".header > ul.menu",e.list).addClass("popupmenu")}function pa(){$.each(e,function(a,b){b.removeClass("hidden")});aa();e.list&&$(".header > ul.menu.popupmenu",e.list).removeClass("popupmenu")}function Z(){var a,b=!1;e.content.length&&(a=b=e.content.is(g.last_selected),e.content[a?"removeClass":"addClass"]("hidden"),$(".header > ul.menu",e.content).addClass("popupmenu"));e.list.length&&(a=!b&&e.list.is(g.last_selected),e.list[a?"removeClass":"addClass"]("hidden"),$(".header > ul.menu",
e.list).addClass("popupmenu"));e.sidebar.length&&(a=!b&&(e.sidebar.is(g.last_selected)||!e.list.length),e.sidebar[a?"removeClass":"addClass"]("hidden"));b&&A.back_list.show()}function aa(){A.back_list.filter(function(){return 0==$(this).parents("#layout-sidebar").length}).hide();$("ul.menu.popupmenu").removeClass("popupmenu")}function P(a){e.list.addClass("hidden");e.sidebar.removeClass("hidden");a&&e.sidebar.addClass("layout-sticky");"small"!=q&&"phone"!=q||e.content.addClass("hidden");C();g.last_selected=
e.sidebar[0]}function Q(a){e.list.length||e.sidebar.length?(e.sidebar.addClass("hidden").removeClass("layout-sticky"),e.list.removeClass("hidden"),"small"!=q&&"phone"!=q||qa(),a&&e.list.children(".scroller").scrollTop(0),g.last_selected=e.list[0]):history.back();C()}function qa(){g.last_selected=e.list[0]||e.sidebar[0];N();rcmail.show_contentframe(!1);$("[data-list]",e.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 z(a){a?("phone"==q&&($('<div id="menu-overlay" class="popover-overlay">').on("click",function(){z(!1)}).appendTo("body"),g.menu_initialized||(g.menu_initialized=!0,$("a",e.menu).on("click",function(a){"phone"==q&&z()})),e.menu.addClass("popover")),e.menu.removeClass("hidden")):($("#menu-overlay").remove(),e.menu.addClass("hidden").removeClass("popover"))}function ra(a){"loading"==a.type&&$(".iframe-loader:visible").length?rcmail.hide_message(a.object):(M(a.object,a.type,
!0),$(a.object).attr("role","alert"))}function M(a,b,d){var c="ui alert",f=!$(a).is(".noicon");d&&f&&!$(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])c+=" "+b,f&&$("<i>").attr("class","icon").prependTo(a);$(a).addClass(c)}function ba(a){var b=
$(),d=$("a.button.options",a),c=$("input:not([type=hidden])",a),f=c.attr("placeholder");$("form",a);var h=function(){if(c.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},e=function(){$(a).is(".open")&&d.click()},k=function(){$(a)[h()?"addClass":"removeClass"]("active");b[rcmail.gui_objects.search_filter&&"UNSEEN"==$(rcmail.gui_objects.search_filter).val()?
"addClass":"removeClass"]("selected")};c.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(d));d.on("click",function(c){var b=$(this).data("target"),f=$("#"+b),h=$(a).is(".open");if(f.length){if(!h)if(D[b])D[b](f.get(0),this,c);else if("function"==typeof window[b])window[b](f.get(0),
this,c);f.next()[h?"show":"hide"]();f.toggleClass("hidden");$(".floating-action-buttons").toggleClass("hidden");$(a).toggleClass("open");$("button.search",f).off("click.search").on("click.search",function(){d.click();k()})}});c.on("input change",k).on("focus blur",function(a){c.attr("placeholder","blur"==a.type?f:"")});$("a.reset",a).on("click",function(b){c.val("").change().trigger("keyup.treelist",{keyCode:27});$(a).is(".open")&&d.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("---"));k()});rcmail.addEventListener("init",k).addEventListener("responsebeforesearch",k).addEventListener("beforelist",e).addEventListener("afterlist",k).addEventListener("beforesearch",e)}function E(a,b){if(l&&t())return parent.UI.popup_init(a,b||window);b||(b=window);var d,c=$(a).data("popup"),f=$(b.$("#"+c).get(0)),h=f,e=$(a).attr("title");$(a).attr({"aria-haspopup":"true","aria-expanded":"false",
"aria-owns":c}).popover({content:function(){b!=window&&(f=h.clone(!0,!0),f.attr("id",c+"-clone").appendTo(document.body).find("li > a").attr("onclick","").off("click").on("click",function(c){$(this).is(".disabled")||($(a).popover("hide"),b.$("#"+$(this).attr("id")).click());return!1}));return f.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(h){var e=f.data("popup-init");c&&p[c]&&
(p[c].transitioning=!0);if(e&&D[e])D[e](f.get(0),a,h);else if(e&&b[e])b[e](f.get(0),a,h);d=$("div.popover:visible").length+1;f.removeClass("hidden").attr("aria-hidden",!1).find('[aria-haspopup="true"]').data("level",d+1).off("click.popup").on("click.popup",function(a){a.stopPropagation()});t()||f.css("max-height",Math.min(539,$(window).height()-30))}).on("shown.bs.popover",function(b){b=t();var f=$("#"+$(a).attr("aria-describedby"));d=$(a).data("level")||1;if(b){var h=1<d?"back":"close",e=rcmail.gettext(h),
h="button icon "+("back"==h?"back":"cancel");$(".popover-header",f).empty().append($("<a>").attr("class",h).text(e).on("click",function(c){$(a).popover("hide");1<d&&c.stopPropagation()}).on("mousedown",function(a){a.stopPropagation()}))}$.each(p,function(a,b){$(b.target).data("level")==d&&a!=c&&J(a)});"key"==$(a).data("event")&&(f.off("keydown.popup").on("keydown.popup","a.active",function(c){var b,d="next";switch(c.which){case 27:case 9:return $(a).popover("toggle").focus(),!1;case 38:case 63232:d=
"previous";case 40:case 63233:for(c=c.target.parentNode;c=c[d+"Sibling"];)if(b=$(c).children(".active")[0]){b.focus();break}return!1}}),f.find("a.active").first().focus());c&&p[c]&&(p[c].transitioning=!1);b&&!$(".popover-overlay").length&&$("<div>").attr("class","popover-overlay").appendTo("body").click(function(){$(this).remove()});$(".popover-body",f).addClass("webkit-scroller")}).on("hide.bs.popover",function(){1==d&&$(".popover-overlay").remove();c&&p[c]&&f.is(":visible")&&(p[c].transitioning=
!0)}).on("hidden.bs.popover",function(){/-clone$/.test(f.attr("id"))?f.remove():f.attr("aria-hidden",!0).addClass("hidden").appendTo(f.data("popup-parent")||document.body);$(".popover-body:empty").each(function(){$(this).parent().remove()});c&&p[c]&&delete p[c]}).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")}});
e&&$(a).attr("title",e);f.attr("aria-hidden","true").data("button",a);if(f.data("editable"))f.on("click mousedown",function(a){a.stopPropagation()})}function y(a){R&&R>(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 S(a){if(a&&a.name&&(!a.props||!1!==a.props.skinable)){if(l&&t())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,d,c=$("ul",a.obj).first(),f=a.props&&a.props.link?a.props.link:a.originalEvent.target;$(f).is("span")&&(f=$(f).parents("a,li")[0]);a.name.match(/^drag/)&&(d=rcube_event.get_mouse_pos(a.originalEvent),f=$("<a>").css({position:"absolute",left:d.x,top:d.y,height:"1px",width:"1px",visibility:"hidden"}).appendTo(document.body).get(0));d=$(f).data("popup-pos")||"right";"folder-selector"==a.name?c.addClass("listing folderlist"):
"addressbook-selector"==a.name||"contactgroup-selector"==a.name?c.addClass("listing contactlist"):c.hasClass("menu")&&c.addClass("listing");"pagejump-selector"==a.name&&(c.addClass("simplelist"),a.obj.addClass("simplelist"),d="top");p[a.name]&&J(a.name,a.originalEvent);b=function(){if(p[a.name]&&p[a.name].transitioning)return setTimeout(b,50);$(f).data("popup")||($(f).data({event:rcube_event.is_keyboard(a.originalEvent)?"key":"mouse",popup:a.name,"popup-pos":d,"popup-trigger":"manual"}),E(f,a.win));
p[a.name]={target:f};$(f).popover("show")};b()}else J(a.name,a.originalEvent);a.originalEvent.stopPropagation()}}function J(a,b){var d;d=a;var c;p[d]?c=p[d].target:(c=$("#"+d).data("button"),c||(d.match(/(?!-)menu$/)&&(d=d.substr(0,d.length-4)),c=$("#"+d+"-menu").data("button")));d=c;a.match(/^drag/)?$(d).popover("dispose").remove():($(d).popover("hide"),"forwardmenu"==a&&y(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 c=$('select[name="sort_ord"]',b).val(),f=$('select[name="mode"]',
b).val();rcmail.set_list_options([],a,c,"threads"==f?1:0);return!0},{closeOnEscape:!0,minWidth:400})}function ca(a,b){var d,c;d=rcmail.env.task;var f=rcmail.env.search_mods,h=rcmail.env.mailbox,e=$("#s_scope",a).val(),k=$("#s_interval",a).val();"all"==e&&(h="*");f||(f={});"mail"==d?(f[h]||(f[h]=rcube_clone_object(f["*"])),c=f[h],d="text",rcmail.env.search_scope=e,rcmail.env.search_interval=k):(c=f,d="*");b&&(b.checked?c[b.value]=1:delete c[b.value],b.value==d&&$('input[name="s_mods[]"]',a).map(function(){this!=
b&&(this.checked=!0,b.checked?(this.disabled=!0,delete c[this.value]):(this.disabled=!1,c[this.value]=1))}),rcmail.set_searchmods(c))}function W(a,b){var d=$("#composestatusbar"),c=d.find("a.button.icon."+a);b?c.length||$("<a>").attr("class","button icon "+a).on("click",function(){P()}).appendTo(d):c.remove()}function da(a,b,d){var c=$(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",c,this,a.originalEvent)})});return rcmail.command("menu-open",{menu:"attachmentmenu",id:c},a,d)}function V(a){a=$(a);if(!a.is(".no-menu")&&!a.children(".dropdown").length){var b=rcmail.gettext("options"),d=a.find("a.filename"),c=$("<a>").attr({href:"#",tabindex:d.attr("tabindex")||0,title:b,"class":"button icon dropdown skip-content"}).on("click",function(a){return da($("#attachmentmenu"),c,a)}).append($("<span>").attr("class","inner").text(b));d.length?c.insertAfter(d):c.appendTo(a)}}
function ea(a,b,d,c){var f=$(b).attr("href").replace(/^mailto:/,"");if(0>f.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 c=f,d=$(b).filter(".rcmContactAddress").text(),c=c.split("?")[0].split(",")[0].replace(/(^<|>$)/g,"");d&&(d=d.replace("<"+c+">",""),c='"'+$.trim(d)+'" <'+c+">");return rcmail.command("add-contact",c,this,a.originalEvent)});$(".compose",a).addClass("active").on("click",
function(a){c?(b.onclick=c,$(b).trigger("click",[!0]),b.onclick=null):rcmail.command("compose",f,this,a.originalEvent);return!1});return rcmail.command("menu-open",{menu:"mailto-menu",link:b},b,d.originalEvent)}function ia(a){var b=a.onclick;a.onclick=null;$(a).on("click",function(d,c){return c||ea($("#mailto-menu"),a,d,b)})}function ta(a){var b=$("#quotadisplay"),d=b.find(".bar"),c=a.total?a.percent:0;d.length||(d=$('<span class="bar"><span class="value"></span></span>').appendTo(b));0<c&&10>c&&
(c=10);d.find(".value").css("width",c+"%")[90<=c?"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(c){rcmail.simple_dialog(a.table,"quota",null,{cancel_button:"close"})});else b.tooltip("dispose").tooltip({trigger:t()?"click":"hover"})}function ua(a){var b,d,c="",f=function(){$(a).val(b.text()+d.val())},h=function(a,c,b){var e=$('<li class="recipient">'),
m=$('<span class="name">').html(va(a||c)).on("dblclick",function(a){wa(a,h)}),g=$('<span class="email">'),l=$("<a>").attr({"class":"button icon remove"}).click(function(){e.remove();f();d.focus();return!1});a&&(c=" <"+c+">");g.text((a?c:"")+",");e.attr("title",a?a+c:null).append([m,g,l]);b?b.replaceWith(e):e.insertBefore(d.parent());f()},e=function(a){a=(a||d.val()).replace(/[,;\s]+$/,"");a=fa(a);$.each(a.recipients,function(){h(this.name,this.email)});d.val(a.text);f();return 0<a.recipients.length};
d=$("<input>").attr({type:"text",tabindex:$(a).attr("tabindex")}).on("paste change",function(a,c){var d,f=this.value;"paste"==a.type?(d=(a.originalEvent.clipboardData||window.clipboardData).getData("text")||"",f=f.substring(0,this.selectionStart)+d+f.substring(this.selectionEnd),a.preventDefault()):c&&(d=b.find("li.recipient").last(),d.length&&-1<this.value.indexOf(d.text().replace(/[ ,]+$/,""))&&d.remove());e(f)}).on("keydown",function(a){if(8==a.keyCode&&!d.val().length)return b.children("li.recipient").last().remove(),
f(),!1;if((","==a.key||";"==a.key||"Enter"==a.key&&!rcmail.ksearch_visible())&&e())return!1}).on("blur",function(){b.removeClass("focus")}).on("focus mousedown",function(){b.addClass("focus")});b=$("<ul>").addClass("form-control recipient-input ac-input rounded-left").append($('<li class="input">').append(d)).on("mouseup",function(){c=window.getSelection().toString()}).on("click",function(){c.length||d.focus()});$(a).css({position:"absolute",opacity:0,left:"-5000px",width:"10px"}).attr("tabindex",
-1).after(b).on("focus",function(a){d.focus();a.preventDefault()}).on("change",function(){$("li.recipient",b).remove();d.val(this.value).change()}).change();rcmail.init_address_input_events(d)}function fa(a){a=$.trim(a.replace(/[,;\s]*[\r\n]+/g,","));var b=[],d=/(<(\S+|("[^"]+"))@\S+>)/,c=/((\S+|("[^"]+"))@\S+)/,f=a.match(/(?=\S)[^",;]*(?:"[^\\"]*(?:\\[,;\S][^\\"]*)*"[^",;]*)*/g);$.each(f||[],function(){if(this.length&&(d.test(this)||c.test(this))){var f=RegExp.$1,e=$.trim(this.replace(f,""));b.push({name:e,
email:f.replace(/(^<|>$)/g,""),text:this});a=a.replace(this,"")}});a=a.replace(/[,;]+/,",").replace(/^[,;\s]+/,"");return{recipients:b,text:a}}function va(a){var b,d,c="",f=a.length;'"'!=a.charAt(0)&&-1<a.indexOf('"')&&(a='"'+a.replace("\\","\\\\").replace('"','\\"')+'"');for(b=0;b<f;b++)switch(d=a.charAt(b),d){case '"':if(0<b&&b<f-1){c+='"';break}c+='<span class="quotes">'+d+"</span>";break;case "\\":c+='<span class="quotes">'+d+"</span>";"\\"==a.charAt(b+1)&&(c+=d,b++);break;case "<":c+="<";
break;case ">":c+=">";break;default:c+=d}return c}function wa(a,b){var d=$(a.target).parents(".recipient"),c=d.text().replace(/,+$/,""),f=$("<input>").attr({type:"text",size:50}).val(c),h=$("<label>").text(rcmail.gettext("recipient")).append(f);rcmail.simple_dialog(h,"recipientedit",function(){var a;if(a=f.val()){if(a!=c){a=fa(a);if(1!=a.recipients.length)return!1;b(a.recipients[0].name,a.recipients[0].email,d)}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}),d=$(a).find("img")[0],c=function(){var c=-1!=(d.currentSrc||d.src).indexOf(rcmail.env.photo_placeholder);$(a)[c?"removeClass":"addClass"]("changed")};$(a).append(b).click(function(){rcmail.upload_input("upload-form")});c();$(d).on("load",c)}function H(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);ga&&a.parent().addClass("ios-scroll")}}function G(a){var b,d;a=$(a);a.is(".custom-control-input")||((d=a.attr("id"))||(d="icochk"+ ++g.checkboxes,a.attr("id",d)),a.parent().is("label")?(b=a.parent(),a=a.detach(),b.before(a)):b=$("<label>"),b.attr({"for":d,"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(b))}
function ya(a){var b=$(a.row).find("input[id^=icochk]");b.length&&(a="icochk"+ ++g.checkboxes,b.attr("id",a).next("label").attr("for",a))}function L(a){if(!bw.iphone&&!bw.ipad&&(a=$(a),!a.is(".pretty-select"))){var b="select"+a.attr("id")+a.attr("name"),d=function(){if(a[0].ownerDocument.defaultView.$(".select-menu .listing").data("ident")==b)return!0},c=function(){var c=d();a.popover("dispose").focus();return!c},f=function(d){var f,e=-1,g=[],l=[],u=a.closest(".ui-dialog")[0],p=(document.documentElement.clientHeight||
$(document.body).height())-75,q=$(document.body).width()-20,r=Math.min(a.outerWidth(),q),s=a.val();t()||(p*=0.5);y(d);$("option",a).each(function(){var a=$(this).text(),c=$('<a href="#">').data("value",this.value).addClass(this.disabled?"disabled":"active"+(this.value==s?" selected":""));a.length?(c.text(a),l.push(this.disabled?"":a.charAt(0).toLowerCase())):(c.html(" "),l.push(""));g.push($("<li>").append(c))});var n=$('<ul class="listing selectable iconized">').attr("data-ident",b).data("button",
a[0]).append(g).on("click","a.active",function(){var b=$(this).data("value"),d=c();a.val(b).change();return d}).on("keydown","a.active",function(a){var b,d;b="next";switch(a.which){case 27:case 9:return c();case 13:case 32:return $(this).click(),!1;case 38:case 63232:b="previous";case 40:case 63233:for(a=a.target.parentNode;a=a[b+"Sibling"];)if(d=$(a).children(".active")[0]){d.focus();break}return!1;default:(b=a.originalEvent.key)&&1==b.length&&(b=b.toLowerCase(),f!=b&&(e=-1),a=l.indexOf(b,e+1),(-1<
a||-1<(a=l.indexOf(b)))&&n.find("a").eq(a).focus(),f=b,e=a)}});a.popover("dispose").popover({container:u||document.body,content:n[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: '+p+'px"></div></div>'}).on("shown.bs.popover",function(){a.focus();n.parent().prev().empty().append($('<a class="button icon cancel">').text(rcmail.gettext("close")).on("click",
function(a){a.stopPropagation();return c()}));var b=n.find("a.selected").first();if(b.focus().length){var g=n.parent();e=n.find("a").index(b[0]);f=l[e];5<e&&g.scrollTop(g.scrollTop()+g.height()/2)}else rcube_event.is_keyboard(d)&&n.find("a.active").first().focus();n.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 c(),!0;if(27==b.which||
"mousedown"==b.type&&d())return c();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 f(b),R=(new Date).getTime(),!1}})}}function za(a){var b,d=!1,c=$(a),f=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)&&
f.addClass("ishtml")}).on("keydown",function(a){if(9==a.which)return c.focus(),!1}),m=$('<div class="editor-toolbar">').append(e);f.is("td")?(b=$('input[type="checkbox"]',f.parent().next()),d=!0):b=c.next("select.hidden");Aa(a);1==b.length&&(f.addClass("html-editor"),c.after(m).data("control",b).on("keydown",function(a){a.altKey&&121==a.which&&e.focus()}),d&&(b.parents("tr").first().hide(),f.prev().hide(),f.addClass("col-sm-12")))}function Aa(a){var b,d,c=function(){if(!a.scrollHeight)return setTimeout(c,
250);b||(b=parseInt($(a).css("padding-top"))+parseInt($(a).css("padding-bottom"))+2,d=$(a).height());if(!(a.scrollHeight-b<=d)){var f,e=0;$(a).parents().each(function(){if(0<this.scrollTop)return f=this,e=this.scrollTop,!1});var m=$(a).outerHeight();$(a).outerHeight(0);var k=Math.max(d,a.scrollHeight);$(a).outerHeight(m);k!==m&&$(a).height(k);e&&(f.scrollTop=e)}};$(a).on("input",c).trigger("input")}function T(a,b,d,c,f,e){c=$('<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:d+"[]"};f&&(b.size=f);$("input",c).attr(b).keydown(function(c){var b=$(this);if(13==c.which){c=b.attr("name").replace(/\[\]$/,"");var d=(new Date).getTime(),b=T(a,"",c,d,f,b.parent());$("input",b).focus()}else if((8==c.which||46==c.which)&&""==b.val()&&(b=b.parent(),1<a.children().length))return b.prev().length?b.prev().children("input").focus():b.next().children("input").focus(),b.remove(),!1});$("a.reset",c).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()});$(c).find("input,a").on("focus",function(){a.addClass("focused")}).on("blur",function(){a.removeClass("focused")});e?e.after(c):c.appendTo(a);return c}function ha(a){var b=a.find(".scroller .listing").first().attr("id"),d=rcmail.env.task+"."+(b||rcmail.env.action+"."+a.attr("id")),b=Ba(d),c=a.is(".sidebar-right"),f=function(b){a.css({width:Math.max(100,b),flex:"none"})};a[c?"prev":"next"]().length&&($('<div class="column-resizer">').appendTo(a).on("mousedown",
function(b){var e,g=$(this),x=a.position().left;g.width(1E4).css(c?"left":"right",-5E3);document.body.style.userSelect="none";$(document).on("mousemove.resizer",function(b){clearTimeout(e);e=setTimeout(function(){c&&(x=a.position().left);var d=rcube_event.get_mouse_pos(b).x,d=c?a.width()+(x-d):d-x;f(d)},5)}).on("mouseup.resizer",function(){$(document).off(".resizer");$("iframe").off(".resizer");document.body.style.userSelect="auto";g.width(6).css(c?"left":"right",-3);var b=a.width();w[d]=b;if(!rcmail.local_storage_set_item("prefs.elastic",
w)){var f=new Date;f.setYear(f.getFullYear()+1);rcmail.set_cookie(d,b,f)}})}),b&&f(b))}function Ca(a){if(!t()||!0===arguments[3])return g.open_window.apply(rcmail,arguments);a=rcmail.add_url(a,"_framed",1);a=rcmail.add_url(a,"_extwin",1);var b,d="",c={cancel_button:"close",width:768,height:768},f=$("<iframe>").attr({id:"windowframe",src:a});/_action=([a-z_]+)/.test(a)&&(b=rcmail.labels[RegExp.$1])&&(d=b);/_frame=1/.test(a)&&(c.dialogClass="no-titlebar");rcmail.simple_dialog(f,d,null,c);return!0}function I(){if(l){var a=
$(parent.document.documentElement);return{mode:a[0].className.match(/layout-([a-z]+)/)?RegExp.$1:q,touch:a.is(".touch")}}return{mode:q,touch:K}}function t(){var a=I();return"phone"==a.mode||"small"==a.mode}function Ba(a){w||(w=rcmail.local_storage_get_item("prefs.elastic",{}));if(null==w[a]){var b=rcmail.get_cookie(a);null!=b&&(w[a]=b,rcmail.local_storage_set_item("prefs.elastic",w)&&rcmail.set_cookie(a,b,new Date))}return w[a]}var w,D=this,q="normal",K=!1,ga=!1,R,l=rcmail.is_framed(),g={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}},p={},O=[],U=[],e={menu:$("#layout-menu"),sidebar:$("#layout-sidebar"),list:$("#layout-list"),content:$("#layout-content")},A={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(g.frame_nav&&a&&a.length){var b=g.frame_nav.children(".buttons");O=[];$.each(a,function(){this.data("target")&&O.push(this.data("target"))});b.html("").append(a)}};this.menu_hide=J;this.menu_toggle=S;this.menu_destroy=function(a){$("[aria-owns="+a+"]").popover("dispose").data("popup",null)};this.popup_init=E;this.about_dialog=function(a){var b,d,c=!1,f=$("<iframe>").attr({id:"aboutframe",src:rcmail.url("settings/about",{_framed:1})}),e=$("#supportlink");
e.length&&(b=e.attr("href"))&&(c=e.text(),d=function(a){0>b.indexOf("mailto:")?window.open(b):location.href=b});rcmail.simple_dialog(f,$(a).text(),d,{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,d,c,f=[],e=rcmail.spellcheck_lang(),g=$("ul",a);if(!g.length){g=$('<ul class="selectable listing iconized" role="menu">');
for(b in rcmail.env.spell_langs)c=$('<li role="menuitem">'),d=$('<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}),d.appendTo(c),f.push(c);g.append(f).appendTo(a)}$("li",g).each(function(){var a=$("a",this);a.data("lang")==e?a.addClass("selected").attr("aria-selected",
"true"):a.hasClass("selected")&&a.removeClass("selected").removeAttr("aria-selected")})};this.searchmenu=function(a){var b,d,c=$('input[name="s_mods[]"]',a),f=$("#s_scope",a),e=rcmail.env.mailbox,g=rcmail.env.search_mods,k=rcmail.env.search_scope||"base";$(a).data("initialized")||($(a).data("initialized",!0),c.length&&(c.on("change",function(){ca(a,this)}),rcmail.addEventListener("beforesearch",function(){ca(a)})));if(rcmail.env.search_mods)if("mail"==rcmail.env.task?("all"==k&&(e="*"),g=g[e]?g[e]:
g["*"],d="text",f.val(k)):d="*",g[d])c.map(function(){this.checked=!0;this.disabled=this.value!=d});else for(b in c.prop("disabled",!1).prop("checked",!1),g)c.filter('[value="'+b+'"]').prop("checked",!0)};this.headersmenu=function(a,b,d){$("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=W;this.attachmentmenu=da;this.mailtomenu=ea;this.recipient_selector=function(a,b){b||(b={});var d=rcmail.gettext(b.title||"insertcontact"),c=$("#recipient-dialog"),f=c.parent(),e=function(){c.is(":visible")&&rcmail.env.recipient_dialog.dialog("close")};rcmail.env.recipient_selector_initialized||
(rcmail.addEventListener("add-recipient",e),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(c,d,function(){b.action?(b.action(),e()):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(){c.appendTo(f);$(this).remove();$(b.focus||rcmail.env.focused_field).focus()}})};this.show_list=Q;this.show_sidebar=P;this.smart_field_init=function(a){var b=a.id+"_list",d=$('<div class="multi-input"><div class="content"></div><div class="invalid-feedback"></div></div>'),c=a.value?a.value.split("\n"):[""];$("#"+b).length||($.each(c,function(b,c){T($(".content",d),c,a.name,b,$(a).data("size"))}),d.attr("id",b),a=$(a),a.attr("disabled")?d.hide():a.prop("disabled",!0),a.data("hidden")&&
d.hide(),a.after(d),a.hasClass("is-invalid")&&(d.addClass("is-invalid"),$(".invalid-feedback",d).text(a.data("error-msg"))))};this.smart_field_reset=function(a,b){var d=b.length?b:[""],c=$("#"+(a.id+"_list")).children(".content");c.empty();$.each(d,function(b,d){T(c,d,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,d,c=$("a",a),f=$(a).next();f.height()?(f.animate({height:"0"},250),c.addClass("expand").removeClass("collapse"),$(a).removeClass("expanded")):(b=$("tr,li",f).filter(function(){return"none"!=this.style.display}),d=$(b[0]).height()||50,f.animate({height:Math.min(5,b.length)*d+1+"px"},250),c.addClass("collapse").removeClass("expand"),$(a).addClass("expanded"))};this.searchbar_init=ba;this.pretty_checkbox=
G;this.pretty_select=L;this.datepicker_init=function(a){window.MutationObserver&&$(a).not("[data-observed]").each(function(){var a,d=!0,c=l?parent:window;$(this).attr("data-observed","1");l&&($(this).detach().appendTo(parent.document.body),$('<div id="ui-datepicker-div" class="hidden">').appendTo(document.body));(new MutationObserver(function(f){$.each(f,function(f,e){if("attributes"==e.type){var g="true"==$(e.target).attr("aria-hidden");g!=d&&(g?a&&a.remove():a=$("<div>").attr("class","ui-widget-overlay datepicker").appendTo(c.document.body).click(function(a){$(this).remove();
l&&$.datepicker._hideDatepicker()}),d=g)}else e.addedNodes.length&&(c.UI.bootstrap_style(e.target),l&&(c.$("select.ui-datepicker-month",e.target).on("change",function(){$.datepicker._selectMonthYear($.datepicker._lastInput,this,"M")}),c.$("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=v;Y();(function(){g.last_selected=
$("#layout > div.selected")[0];!g.last_selected&&e.content.length&&$.each(["sidebar","list","content"],function(){if(e[this].length)return g.last_selected=e[this][0],e[this].addClass("selected"),!1});$(window).on("resize",function(){clearTimeout(g.resize_timeout);g.resize_timeout=setTimeout(function(){F()},25)});g.open_window=rcmail.open_window;rcmail.open_window=Ca;rcmail.addEventListener("message",ra).addEventListener("menu-open",S).addEventListener("menu-close",S).addEventListener("editor-init",
la).addEventListener("autocomplete_create",X).addEventListener("googiespell_create",X).addEventListener("setquota",ta).addEventListener("enable-command",ma).addEventListener("clonerow",ya).addEventListener("init",B);window.MutationObserver&&window.tinymce&&(new MutationObserver(function(a){$.each(a,function(){$.each(this.addedNodes,function(){ja(this)})})})).observe(document.body,{childList:!0});if((e.list.length||e.content.length)&&t()){var a=[];$("[data-fab]").each(function(){var b=$(this),d=b.data("fab-task")||
"*",c=b.data("fab-action")||"*";"*"!=d&&d!=rcmail.env.task||"*"!=c&&c!=rcmail.env.action&&("none"!=c||rcmail.env.action)||a.push(s(b,!1,!1,!0))});a.length&&$('<div class="floating-action-buttons">').append(a).appendTo(e.list.length?e.list:e.content)}e.sidebar.length&&ha(e.sidebar);e.list.length&&ha(e.list)})();v();(function(){if(!g.got_smart_toolbar){g.got_smart_toolbar=!0;var a,b=[],d=[],c=I(),f=function(a,b,c){var d=$('<li role="menuitem">');a=c?s($(a),!0,"hidden-big hidden-large"):$(a).detach();
a.contents().filter(function(){3!=this.nodeType||$.trim(this.nodeValue).length||$(this).remove()});a.is(".spacer")?d.addClass("spacer"):d.append(a);b.push(d)};e.content.find(".header > .menu").each(function(){var a=$(this);a.children().each(function(){f(this,b)});a.remove()});e.list.find(".header > .menu").each(function(){var e=$(this);a=e.next();e.children().each(function(){"large"!=c.mode&&$(this).data("popup-pos","right");f(this,b,!0);f(this,d)});e.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(d.length){var h=e.list.children(".header"),m={"class":"menu toolbar popupmenu listing iconized",id:"toolbar-list-menu"},k=$('<a class="button icon toolbar-list-button" href="#list-menu">').attr({"data-popup":"toolbar-list-menu"}),m=$("<ul>").attr(m).data("popup-parent",h).append(d);a.length?m.insertBefore(a):h.append(m);h.append(k)}b.length&&(h=e.content.children(".header"),m={"class":"menu toolbar popupmenu listing iconized",
id:"toolbar-menu"},k=$('<a class="button icon toolbar-menu-button" href="#menu">').attr({"data-popup":"toolbar-menu"}),h.append($("<ul>").attr(m).data("popup-parent",h).append(b)).append(k),e.list.find("a.toolbar-menu-button").click(function(a){a.stopPropagation();k.click()}))}})();(function(){if(e.list.length){var a=g.last_selected,b=function(a){"string"===typeof a&&a.length||(a=$("h1.voice").text()||$("title").text()||"");e.content.find(".header > .header-title").text(a)},d=function(c,d,f,l){t()&&
g.frame_nav&&ka(d,c);f&&!e.content.is(":visible")?g.last_selected=e.content[0]:f||g.last_selected==a||g.content_lock||(g.last_selected=a);N();b(l&&f?l:null);g.content_lock=!1},c=function(a){"large"!=q&&!g.content_lock&&a.force&&Q();g.content_lock=!1;a.title&&$(".header > .header-title",e.list).text(a.title)},f=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:"");c(b)};e.content.find("iframe").on("load",function(a){var c="",f=!0;$(this).parent(".iframe-wrapper").scrollTop(0);try{c=a.target.contentWindow.location.href,f=!c.endsWith(rcmail.env.blankpage),$(a.target.contentWindow).on("unload",b)}catch(e){}d(a,c,f)});rcmail.addEventListener("afterlist",f).addEventListener("afterlistgroup",f).addEventListener("afterlistsearch",f).addEventListener("show-list",function(a){a.force=!0;c(a)}).addEventListener("show-content",function(a){a.obj&&!$(a.obj).is("iframe")&&
($(a.scrollElement||a.obj).scrollTop(0),t()&&H(a.obj));d(a.event||new Event,"_action="+(a.mode||"edit"),!0,a.title)})}})();(function(){$("[data-popup]").each(function(){E(this)});$(document).on("click",y);rcube_webmail.set_iframe_events({mousedown:y,touchstart:y})})();(function(){var a,b,d=[];$.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(),d=a.height(),e=$(window).width(),
g=$(window).height();480>=e?a.css({width:"100%",height:"100%"}):(d>g&&a.css("height","100%"),b>e&&a.css("width","100%"));$(document).click();H($("div.popup > iframe",a));v(this.uiDialog);return this},close:function(){this._super();$(".select-menu:visible").remove();return this}});A.menu.on("click",function(){z(!0);return!1});A.back_sidebar.on("click",function(){P();return!1});A.back_list.on("click",function(){Q();return!1});A.back_content.on("click",function(){e.list.addClass("hidden");e.sidebar.addClass("hidden");
e.content.removeClass("hidden");e.sidebar.removeClass("layout-sticky");C();g.last_selected=e.content[0];return!1});$(".searchbar").each(function(){ba(this)});!l||rcmail.env.extwin||parent.$(".ui-dialog:visible").length?l||((a=e.content.find(".boxtitle").first().detach().text())||(a=$("h1.voice").first().text()),a&&e.content.find(".header > .header-title").text(a)):(a=$("h1.voice").first().text())&&parent.$("#layout-content > .header > .header-title:not(.constant)").text(a);l||!e.content.length||e.content.is(".no-navbar")||
e.content.children(".frame-content").length||(g.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(e.content));$("a[data-content-button]").each(function(){d.push(s($(this)))});$(".formbuttons").filter(function(){return!$(this).parent(".searchoptions").length}).children().each(function(){var a=
$(this);if(l||a.parents("#layout-content").length)a.is(".cancel")?a.addClass("hidden"):d.push(s(a))});(l?parent.UI:D).register_content_buttons(d);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,d=n(this.id);d&&(a=d.data)&&(a.sel&&(a.sel=a.sel.replace("button-selected","selected")+" "+b),a.act&&(a.act+=" "+b),rcmail.buttons[d.command][d.index]=a,rcmail.init_button(d.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=n(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"),d=$(this).parent("li"),e=/(large|big|small|phone|lbs)/g;a=e.exec(b);)$(d.length?d:this).addClass("hidden-"+a[1])});$("[data-list]").each(function(){$("input[type=checkbox]",this).each(function(){G(this)})});l&&$(".formcontent").each(function(){$(this).next(".formbuttons").length&&
$(this).parent().addClass("formcontainer")});$("#attachment-list + a.zipdownload").appendTo(".header-links");(ga=$("html").is(".ipad,.iphone"))&&$(".iframe-wrapper, .scroller").addClass("ios-scroll");$("html").filter(".ipad,.iphone,.webkit.mobile,.webkit.tablet").addClass("webkit-scroller").length&&$(e.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"))})();F()}
if(window.rcmail)rcmail.show_menu=function(r,s,n){var B="object"==typeof r?r.menu:r,v=$("#"+B);"string"==typeof r&&(r={menu:B});return rcmail.triggerEvent(!1===s?"menu-close":"menu-open",{name:B,obj:v,props:r,originalEvent:n})},rcmail.hide_menu=function(r,s){return rcmail.triggerEvent("menu-close",{name:r,props:{menu:r},originalEvent:s})};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(r,s){var n=__newInst.call(this,r,s);n.inline||UI.datepicker_init(n.dpDiv);return n}})};