Welcome to the mailbox.org user forum!
 

unresponsive script when removing a batch of e-mails

1734531 shared this problem 2 years ago
Published

I wanted to remove a lot of e-mails by searching for words they have in common in the subject line. This went well and a selection of 202 e-mails showed up. I tick the 'select all' box and click on the tiny trashcan symbol. It takes a while and then a browser pop-up tells me of an unresponsive script: https://office.mailbox.org/app…-19.20160823.033118/precore.js:21

When selecting 'continue' the pop-up disappears but none of the e-mails are removed.

Here's what the Firefox debugger tells me:

//@ sourceURL=io.ox/mail/compose/bundle.js

define("io.ox/mail/compose/bundle",[],function(){"use strict";var a=define.amd;delete define.amd,define("io.ox/mail/compose/actions/send",["io.ox/core/extensions","io.ox/mail/api","settings!io.ox/mail","io.ox/core/notifications","gettext!io.ox/mail","io.ox/mail/actions/attachmentEmpty","io.ox/mail/actions/attachmentQuota"],function(a,b,c,d,e,f,g){a.point("io.ox/mail/compose/actions/send").extend({id:"metrics",index:100,perform:function(){require(["io.ox/metrics/main"],function(a){a.trackEvent({app:"mail",target:"compose/toolbar",type:"click",action:"send"})})}},{id:"fix-content-type",index:200,perform:function(a){"text/plain"===a.mail.attachments[0].content_type&&"html"===a.model.get("editorMode")&&(a.mail.attachments[0].content_type="text/html")}},{id:"check:no-recipients",index:300,perform:function(a){var b=_.isEmpty(a.mail.to)&&_.isEmpty(a.mail.cc)&&_.isEmpty(a.mail.bcc);return b?(d.yell("error",e("Mail has no recipient.")),a.view.$el.find(".tokenfield:first .token-input").focus(),a.stopPropagation(),$.Deferred().reject()):void 0}},{id:"check:no-subject",index:400,perform:function(a){if(""===$.trim(a.mail.subject)){var b=$.Deferred();return require(["io.ox/core/tk/dialogs"],function(c){new c.ModalDialog({focus:!1}).text(e("Mail has empty subject. Send it anyway?")).addPrimaryButton("send",e("Yes, send without subject"),"send",{tabIndex:1}).addButton("subject",e("Add subject"),"subject",{tabIndex:1}).show(function(){b.notify("empty subject")}).done(function(c){"send"!==c?(this.remove(),a.view.$el.find('input[name="subject"]').focus(),a.stopPropagation(),b.reject()):b.resolve()})}),b}}},{id:"check:attachment-empty",index:500,perform:function(a){return f.emptinessCheck(a.mail.files).then(_.identity,function(){a.stopPropagation()})}},{id:"check:attachment-publishmailattachments",index:550,perform:function(a){return g.publishMailAttachmentsNotification(a.mail.files)}},{id:"busy:start",index:600,perform:function(a){a.view.blockReuse(a.mail.sendtype);var b=a.app.getWindow();b&&(b.busy(),b.preQuit())}},{id:"fix-draft-sendtype",index:700,perform:function(a){a.mail.sendtype===b.SENDTYPE.EDIT_DRAFT&&(a.mail.sendtype=b.SENDTYPE.DRAFT)}},{id:"wait-for-pending-images",index:800,perform:function(a){if(!window.tinymce||!window.tinymce.activeEditor||!window.tinymce.activeEditor.plugins.oximage)return $.when();var b=$('img[data-pending="true"]',window.tinymce.activeEditor.getElement()).map(function(){return $(this).attr("id")}),c=window.tinymce.activeEditor.plugins.oximage.getPendingDeferreds(b);return $.when(c).then(function(){a.mail.attachments[0].content=a.model.getMail().attachments[0].content})}},{id:"send",index:1e3,perform:function(a){return b.send(a.mail,a.mail.files)}},{id:"errors",index:2e3,perform:function(a){if(a.error&&!a.warning){var b=a.app.getWindow();return b&&b.idle().show(),a.app.launch(),void d.yell("error",a.error)}}},{id:"warnings",index:2e3,perform:function(a){if(!a.errors&&a.warning){var b=a.warning.error||a.warning;d.yell("warning",b),a.model.dirty(!1),a.app.quit()}}},{id:"success",index:2e3,perform:function(a){a.error||a.warning||(c.get("features/notifyOnSent",!1)&&d.yell("success",e("The email has been sent")),a.model.dirty(!1),a.app.quit())}},{id:"update-caches",index:3e3,perform:function(a){var c,d,e,f,g,h=a.mail.sendtype===b.SENDTYPE.REPLY,i=a.mail.sendtype===b.SENDTYPE.FORWARD,j=b.separator;(h||i)&&(f=a.mail.msgref?[a.mail.msgref]:_.chain(a.mail.attachments).filter(function(a){return"message/rfc822"===a.content_type}).map(function(a){return a.msgref}).value(),g=_.map(f,function(a){return c=_(a.split(j)),d=c.initial().join(j),e=c.last(),{folder_id:d,id:e}}),b.getList(g).then(function(a){for(var c=a.length,d=0;c>d;d++)h&&(a[d].flags|=1),i&&(a[d].flags|=256);$.when(b.caches.list.merge(a),b.caches.get.merge(a)).done(function(){b.trigger("refresh.list")})}))}},{id:"busy:end",index:1e4,perform:function(a){a.view.unblockReuse(a.mail.sendtype)}})}),define("io.ox/mail/compose/extensions",["io.ox/contacts/api","io.ox/mail/sender","io.ox/backbone/mini-views/common","io.ox/backbone/mini-views/dropdown","io.ox/core/extensions","io.ox/core/extPatterns/actions","io.ox/core/tk/tokenfield","io.ox/core/dropzone","io.ox/core/capabilities","io.ox/mail/actions/attachmentQuota","io.ox/core/util","settings!io.ox/mail","gettext!io.ox/mail","static/3rd.party/jquery-ui.min.js"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n="io.ox/mail/compose",o={to:m("To"),cc:m("CC"),bcc:m("BCC"),reply_to:m.pgettext("compose","Reply to")},p={header:function(a){if(a.view.app.getWindow()){var b=$('<div data-extension-id="header">');e.point(n+"/header").invoke("draw",b,a),a.view.app.getWindow().setHeader(b)}},title:function(){this.append($('<h1 class="sr-only">').text(m("Compose new mail")))},buttons:{discard:function(a){this.append($('<button type="button" class="btn btn-default" data-action="discard" tabindex="1">').on("click",function(){a.view.app.quit()}).text(m("Discard")))},save:function(a){this.append($('<button type="button" class="btn btn-default" data-action="save" tabindex="1">').on("click",function(){return a.view.isSaving===!0?!1:(a.view.isSaving=!0,void a.view.saveDraft().always(function(){a.view.isSaving=!1}))}).text(m("Save")))},send:function(a){this.append($('<button type="button" class="btn btn-primary" data-action="send" tabindex="1">').on("click",function(){a.view.send()}).on("keyup",function(b){27===(b.keyCode||b.which)&&a.view.focusEditor()}).text(m("Send")))}},sender:function(a){function c(){require(["io.ox/mail/compose/names"],function(a){a.open()})}var e=$('<div class="row sender" data-extension-id="sender">'),f=function(){function f(a){if(a){var b=a[0],c=a[1];return[$('<span class="name">').text(b?b+" ":""),$('<span class="address">').text(b?"<"+c+">":c)]}}var g=_(a.model.get("from")).first(),h=new d({model:a.model,label:f(g),aria:m("From"),caret:!0});b.drawDropdown().done(function(b){function d(){var b=!!l.get("sendDisplayName",!0);return l.set("sendDisplayName",!b).save(),a.model.set("sendDisplayName",!b),ox.trigger("change:customDisplayNames"),!1}function g(){var b=_(a.model.get("from")).first();h.$("ul").empty(),j(),h.$(".dropdown-label").empty().append(f(b)),h.$ul.find('[data-name="toggle-display"]').focus()}function i(a){var b=a[0],c=a[1];return l.get("sendDisplayName",!0)?l.get(["customDisplayNames",c,"overwrite"])&&(b=l.get(["customDisplayNames",c,"name"],"")):b=null,[b,c]}function j(){if(b.sortedAddresses.length){var a=_(b.sortedAddresses).pluck("option");if(_(a).each(function(a){a=i(a),h.option("from",[a],function(){return f(a)})}),!_.device("smartphone")){var e=!!l.get("sendDisplayName",!0);h.divider().link("toggle-display",m(e?"Hide names":"Show names"),d).link("edit-real-names",m("Edit names"),c)}}}j(),e.append($('<label class="maillabel col-xs-1">').text(m("From")),$('<div class="col-xs-11">').append(h.render().$el.attr({"data-dropdown":"from"}))),ox.on("change:customDisplayNames",function(){var b=a.model.get("from");b&&a.model.set("from",[i(b[0])]),g()}),a.view.listenTo(a.model,"change:from",g)})};a.model.get("from")?f():a.model.once("change:from",function(){f()}),this.append(e)},tokenPicture:function(b){$(this).prepend(a.pictureHalo($('<div class="contact-image">'),b.toJSON(),{width:16,height:16,scaleType:"contain"}))},recipientActionLink:function(a){return function(){var b=$('<a href="#" tabindex="1" data-action="add" role="checkbox" aria-checked="false">');"cc"===a?b.attr({"data-type":"cc","aria-label":m("Show carbon copy input field")}).text(m("CC")):b.attr({"data-type":"bcc","aria-label":m("Show blind carbon copy input field")}).text(m("BCC")),this.append(b)}},recipientActionLinkMobile:function(){var a=$('<a href="#" tabindex="1" data-action="add" role="checkbox" aria-checked="false">').append($('<span class="fa fa-angle-right">'));this.append(a)},recipientActions:function(){var a=$('<div class="recipient-actions">');_.device("!smartphone")?e.point(n+"/recipientActionLink").invoke("draw",a):e.point(n+"/recipientActionLinkMobile").invoke("draw",a),this.append(a)},tokenfield:function(a){return"reply_to"!==a||l.get("showReplyTo/configurable",!1)!==!1?function(b){var c,d=_.uniqueId("form-control-label-"),f=b.model.get(a)||[],h="row"+(/cc$/.test(a)&&!f.length?" hidden":""),i=!1,j=new g({id:d,className:a,extPoint:n,apiOptions:{contacts:!0,distributionlists:!0,msisdn:!0,emailAutoComplete:!0},maxResults:20,placeholder:o[a]}),l=$('<div class="col-xs-11">').append(j.$el);"to"===a&&e.point(n+"/recipientActions").invoke("draw",l),this.append(c=$('<div data-extension-id="'+a+'">').addClass(h).append($('<label class="maillabel col-xs-1">').text(o[a]).attr({"for":d}),l)),j.render().$el.on("tokenfield:createdtoken",function(a){e.point(n+"/createtoken").invoke("action",this,_.extend(b,{event:a}))}).on("tokenfield:next",function(){c.nextAll().find('input.tt-input,input[name="subject"]').filter(":visible").first().focus()}),j.listenTo(b.model,"change:"+a,function(a,b){if(!i){var c=_(b).map(function(a){var b=k.removeQuotes(a[0]),c=a[1];return{type:5,display_name:b,email1:c,token:{label:b,value:c}}});this.collection.reset(c)}}),b.model.trigger("change:"+a,b.model,b.model.get(a)),j.collection.on("change reset add remove sort",function(){var c=this.map(function(a){var b=a.get("token"),c=k.removeQuotes(b.label),d=b.value;return[c,d]});i=!0,b.model.set(a,c),i=!1})}:void 0},subject:function(a){var b=_.uniqueId("form-control-label-");this.append($('<div data-extension-id="subject" class="row subject">').append($('<label class="maillabel hidden-xs col-sm-1">').text(m("Subject")).attr({"for":b}),$('<div class="col-xs-12 col-sm-11">').append(new c.InputView({model:a.model,id:b,name:"subject"}).render().$el.attr({placeholder:m("Subject")}))))},signature:function(a){if(!_.device("smartphone")){var b=this;a.view.signaturesLoading=$.Deferred(),require(["io.ox/core/api/snippets"],function(c){c.getAll("signature").always(function(c){var d=a.model.get("signatures")||[],e=_.uniq(c.concat(d),!1,function(a){return a.id});a.model.set("signatures",e);var f=_.map(c,function(a){return{id:a.id,displayName:a.displayname}});f.length>=1&&_.each(f,function(a){b.data("view").option("defaultSignatureId",a.id,a.displayName)}),a.view.signaturesLoading.resolve(e)})})}},signaturemenu:function(a){function b(){var b=new d({model:a.model,label:m("Signatures"),caret:!0,el:f}).option("defaultSignatureId","",m("No signature"));e.point(n+"/signatures").invoke("draw",b.$el,a),b.$ul.addClass("pull-right"),a.view.signaturesLoading.done(function(){b.divider(),b.link("settings",m("Manage signatures"),function(){var a={id:"io.ox/mail/settings/signatures"};ox.launch("io.ox/settings/main",a).done(function(){this.setSettingsPane(a)})}),b.$ul.addClass("pull-right"),b.render()}),f.empty().append(b.$el)}if(!_.device("smartphone")){var c=this,f=$('<div class="dropdown signatures text-left">');require(["io.ox/core/api/snippets"],function(c){a.view.listenTo(c,"refresh.all",b),b()}),c.append(f)}},optionsmenu:function(a){var b=new d({model:a.model,label:m("Options"),caret:!0});e.point(n+"/menuoptions").invoke("draw",b.$el,a),b.$ul.addClass("pull-right"),this.append(b.render().$el.addClass("text-left"))},attachmentPreviewList:function(a){var b=this,c=$.Deferred();return require(["io.ox/core/attachments/view"],function(d){var g=new d.List({collection:a.model.get("attachments"),editable:!0,mode:l.get("attachments/layout/compose/"+_.display(),"preview")}),i=new h.Inplace({caption:m("Drop attachments here")});i.on({show:function(){b.css("minHeight","100px"),$(window).trigger("resize")},hide:function(){b.css("minHeight",0),$(window).trigger("resize")},drop:function(b){a.model.attachFiles(_(b).map(function(a){return _.extend(a,{group:"localFile"})})),$(window).trigger("resize")}}),g.listenTo(a.model,"change:attachments",function(){g.$list.empty(),g.$preview.empty(),g.renderList(),g.updateScrollControls()}),g.listenToOnce(g.collection,"add remove reset",_.debounce(function(){this.getValidModels().length>0&&(this.$el.addClass("open"),this.isListRendered||(this.renderList(),g.updateScrollControls()),$(window).trigger("resize"))})),g.render(),g.getValidModels().length>0&&(g.renderList(),g.$el.addClass("open")),b.append(i.render().$el.addClass("abs"),g.$el),g.$el.on("click","li.item",function(a){var b,c,d,h,i=$(a.currentTarget);i.attr("data-original")&&(b=i.attr("data-id"),c=g.collection.get(b).toJSON(),h=g.collection.filter(function(a){return"attachment"===a.get("disp")}).map(function(a){return a.toJSON()}),d=e.Baton({startItem:c,data:h}),f.invoke("io.ox/mail/actions/view-attachment",null,d))}),g.updateScrollControls(),g.on("change:layout",function(a){l.set("attachments/layout/compose/"+_.display(),a).save()}),c.resolve(g)},c.reject),c},attachment:function(){function a(a,b){var c=this,d=a.get("attachments"),e=d.filter(function(a){var b=a.get("size");return"undefined"!=typeof b}).map(function(a){return a.get("size")}).reduce(function(a,b){return a+b},0);j.checkQuota(b.target.files,e)&&(c.trigger("aria-live-update",m("Added %s to attachments.",_(b.target.files).map(function(a){return a.name}).join(", "))),a.attachFiles(_(b.target.files).map(function(a){return _.extend(a,{group:"localFile"})})))}function b(a){var b=this;require(["io.ox/files/filepicker"],function(c){new c({primaryButtonText:m("Add"),cancelButtonText:m("Cancel"),header:m("Add attachments"),multiselect:!0}).done(function(c){b.trigger("aria-live-update",m("Added %s to attachments.",_(c).map(function(a){return a.filename}).join(", "))),a.attachFiles(_(c).map(function(a){return _.extend(a,{group:"file"})}))})})}return function(c){var e=$('<input type="file" name="file" capture="camera">').css("display","none").on("change",a.bind(this,c.model)).prop("multiple",_.device("!smartphone"));if(i.has("infostore")){var f=new d({label:m("Attachments"),caret:!0});this.append(e,f.append($('<a href="#">').append($.txt(m("Add local file"))).on("click",function(){e[0].value="",e.trigger("click")})).link("add-file",m("Add from Drive"),b.bind(this,c.model)).render().$el)}else this.append(e,$('<button type="button" class="btn btn-link">').text(m("Attachments")).on("click",function(){e[0].value="",e.trigger("click")}))}}(),body:function(){var a=this,b=_.uniqueId("tmce-"),c=_.uniqueId("tmcetoolbar-");a.append($('<div class="row">').append($('<div class="col-sm-12">').append($('<div class="editable-toolbar">').attr("id",c),$('<div class="editable">').attr("id",b).css("min-height","400px"))))},mailto:function(){if(l.get("features/registerProtocolHandler",!0)&&navigator.registerProtocolHandler){var a=location,b=a.href.indexOf("#"),c=a.href.substr(0,b);navigator.registerProtocolHandler("mailto",c+"#app="+ox.registry.get("mail-compose")+":compose&mailto=%s",ox.serverConfig.productNameMail)}}};return p}),define("io.ox/mail/compose/inline-images",["io.ox/core/extensions","io.ox/core/tk/dialogs","io.ox/core/tk/attachments","io.ox/core/notifications","io.ox/core/http","gettext!io.ox/mail"],function(a,b,c,d,e,f){var g={inlineImage:function(a){if("FormData"in window){var b=new FormData;return b.append("file",a.file),e.UPLOAD({module:"file",params:{action:"new",module:"mail",type:"image"},data:b,fixPost:!0})}return e.FORM({module:"file",form:a.form,params:{module:"mail",type:"image"}})},getInsertedImageUrl:function(a){var b=ox.apiRoot+"/file",c=$.param({action:"get",id:a.data[0],session:ox.session});return b+"?"+c}},h="io.ox/mail/compose/inline-images/";return a.point(h+"title").extend({id:"default",draw:function(){this.append($("<h4>").text(f("Insert inline image")))}}),a.point(h+"file_upload").extend({id:"default",draw:function(a){a.$.file_upload=c.fileUploadWidget({tabindex:0}),this.append(a.$.file_upload)}}),a.point(h+"buttons").extend({id:"default",draw:function(){this.addPrimaryButton("insert",f("Insert"),"insert",{tabIndex:"1"}).addButton("cancel",f("Cancel"),"cancel",{tabIndex:"1"})}}),{api:g,show:function(){var c,e=_.browser.IE&&_.browser.IE<10,i=new b.ModalDialog({async:!0,noBusy:e}),j=new a.Baton({$:{}}),k=$.Deferred();return i.build(function(){c=$("<form>",{"accept-charset":"UTF-8",enctype:"multipart/form-data",method:"POST"}),this.getContentNode().append(c),a.point(h+"title").invoke("draw",this.getHeader(),j),a.point(h+"file_upload").invoke("draw",c,j),a.point(h+"buttons").invoke("draw",this,j),this.getPopup().addClass("inline-images").parent().css("z-index",999999)}),i.on("insert",function(){var a=j.$.file_upload.find("input[type=file]"),b=this,h=function(a){a&&a.error&&d.yell("error",a.error),b.idle()};return e||b.busy(),/\.(gif|bmp|tiff|jpe?g|gmp|png)$/i.test(a.val())?g.inlineImage({file:a[0].files?a[0].files[0]:[],form:c}).then(function(a){b.close(),k.resolve(g.getInsertedImageUrl(a))}).fail(h):(d.yell("error",f("Please select a valid image File to insert")),b.idle(),k.reject(),void 0)}).show(),k}}}),define("io.ox/mail/compose/main",["io.ox/mail/api","gettext!io.ox/mail"],function(a,b){function c(){function a(a){return function(e){var f=$.Deferred();return _.url.hash("app","io.ox/mail/compose:"+a),e=_.extend({mode:a},e),d.cid="io.ox/mail:"+a+"."+_.cid(e),c.nodes.header.addClass("sr-only"),c.nodes.body.addClass("sr-only"),c.busy().show(function(){require(["io.ox/mail/compose/bundle"],function(){require(["io.ox/mail/compose/view","io.ox/mail/compose/model"],function(g,h){var i=/(compose|edit)/.test(e.mode)||e.restored,j=i?e:_.pick(e,"id","folder_id","mode","csid","content_type");d.model=new h(j),d.view=new g({app:d,model:d.model}),c.nodes.main.addClass("scrollable").append(d.view.render().$el),d.view.fetchMail(j).done(function(){d.view.setMail().done(function(){c.nodes.header.removeClass("sr-only"),c.nodes.body.removeClass("sr-only").find(".scrollable").scrollTop(0),c.idle(),c.setTitle(b("Compose")),f.resolve({app:d}),ox.trigger("mail:"+a+":ready",e,d)})}).fail(function(a){require(["io.ox/core/notifications"],function(b){b.yell(a),d.quit(),f.reject()})})})})}),f}}var c,d=ox.ui.createApp({name:"io.ox/mail/compose",title:b("Compose"),userContent:!0,closable:!0});return d.setLauncher(function(){d.setWindow(c=ox.ui.createWindow({name:"io.ox/mail/compose",chromeless:!0})),c.nodes.body.removeAttr("role"),c.nodes.outer.attr("role","main")}),d.failSave=function(){return d.view?_.extend({module:"io.ox/mail/compose"},d.model.getFailSave()):void 0},d.failRestore=function(b){return b.initial=!1,/(reply|replyall|forward)/.test(b.mode)&&(b.restored=!0),a(b.mode)(b)},d.getContextualHelp=function(){return"ox.appsuite.user.sect.email.gui.html#ox.appsuite.user.reference.email.gui.create"},d.setQuit(function(){return d.view?d.view.discard():void 0}),d.compose=a("compose"),d.forward=a("forward"),d.reply=a("reply"),d.replyall=a("replyall"),d.edit=a("edit"),window.compose=d,d}var d={};return{getApp:c,reuse:function(b,c){var e=function(a){return void 0===d[a]||d[a]<=0};if("reply"===b&&e(a.SENDTYPE.REPLY))return ox.ui.App.reuse("io.ox/mail:reply."+_.cid(c));if("replyall"===b&&e(a.SENDTYPE.REPLY))return ox.ui.App.reuse("io.ox/mail:replyall."+_.cid(c));if("forward"===b&&e(a.SENDTYPE.FORWARD)){var f;return f=_.isArray(c)?_(c).map(function(a){return _.cid(a)}).join():_.cid(c),ox.ui.App.reuse("io.ox/mail:forward."+f)}return"edit"===b&&e(a.SENDTYPE.DRAFT)?ox.ui.App.reuse("io.ox/mail:edit."+_.cid(c)):void 0}}}),define.async("io.ox/mail/compose/model",["io.ox/mail/api","io.ox/mail/util","io.ox/core/capabilities","io.ox/core/api/account","io.ox/core/attachments/backbone","settings!io.ox/mail","gettext!io.ox/mail"],function(a,b,c,d,e,f,g){var h={};h.converterFor=function(){return _.identity},h.sendEncoding=function(){return"unified"};var i=Backbone.Model.extend({defaults:function(){return{autosavedAsDraft:!1,autoDismiss:!1,preferredEditorMode:f.get("messageFormat","html"),editorMode:f.get("messageFormat","html"),attachments:new e.Collection,folder_id:"default0/INBOX",initial:!0,priority:3,sendDisplayName:!!f.get("sendDisplayName",!0),sendtype:a.SENDTYPE.NORMAL,defaultSignatureId:f.get("defaultSignature"),csid:a.csid(),vcard:f.get("appendVcard",!1)?1:0,infostore_ids_saved:[]}},initialize:function(){var a=this,b=this.get("attachments");if(_.isObject(b)&&!_.isEmpty(b)){var c="text"===this.get("editorMode")?"text":"html";c in b&&(b=[{content:b[c][0].content,content_type:this.getContentType(),disp:"inline"}])}if(_.isArray(b)){var g=new e.Collection;g.add(b),this.set("attachments",g),b=g}var h=b.at(0);h&&"inline"===h.get("disp")&&_.isString(h.get("content"))||b.add({content:"",content_type:this.getContentType(),disp:"inline"},{at:0,silent:!0}),_.mapObject({contacts_ids:"contact",infostore_ids:"file",nested_msgs:"nested"},function(c,d){a.get(d)&&b.add(a.get(d).map(function(a){return a.group=c,a}),{silent:!0})}),"alternative"===this.get("preferredEditorMode")&&(this.set("editorMode","html",{silent:!0}),"text/plain"===this.get("content_type")&&this.set("editorMode","text",{silent:!0})),this.get("from")&&0!==this.get("from").length||d.getPrimaryAddressFromFolder(this.get("folder_id")).then(function(a){f.get(["customDisplayNames",a[1],"overwrite"])&&(a[0]=f.get(["customDisplayNames",a[1],"name"],"")),this.set("from",[a])}.bind(this)),"compose"!==this.get("mode")&&this.set("defaultSignatureId",f.get("defaultReplyForwardSignature")),this.set("autoDismiss","edit"===this.get("mode")),this.get("signatures")||this.set("signatures",this.getSignatures()),this.updateShadow()},getCopy:function(){var a=_.clone(this.toJSON());return a.attachments=_.clone(this.attributes.attachments.toJSON()),a},updateShadow:function(){this._shadowAttributes=this.getCopy()},dirty:function(a){return this.trigger("needsync"),a===!0?this._shadowAttributes={}:a===!1&&this.updateShadow(),!_.isEqual(this._shadowAttributes,this.getCopy())},getContentType:function(){return"text"===this.get("editorMode")?"text/plain":"html"===this.get("editorMode")?"text/html":"alternative"},setInitialMailContentType:function(){if("alternative"===this.get("editorMode")){var a=this.get("attachments").at(0).get("content_type"),b="html";"text/plain"===a&&(b="text"),this.set("editorMode",b,{silent:!0})}},setMailContentType:function(a){this.get("attachments").at(0).set("content_type",a,{silent:!0})},setContent:function(a){var b=this.get("attachments").at(0);b.set("content",a)},getContent:function(){var a=this.get("attachments").at(0).get("content")||"",b=this.get("editorMode");return"text"===b&&(a=_.unescapeHTML(a.replace(/<br\s*\/?>/g,"\n"))),"html"===b&&(a=a.replace(/(<img[^>]+src=")\/ajax/g,"$1"+ox.apiRoot),a=a.replace(/^<div\sid="ox-\S+">/,"").replace(/<\/div>$/,"")),a=this.convertAllToUnified(a)},getSignatures:function(){if("edit"===this.get("mode")&&this.set("defaultSignatureId","",{silent:!0}),_.device("!smartphone")||"edit"===this.get("mode"))return[];"custom"===f.get("mobileSignatureType")?this.set("defaultSignatureId","0",{silent:!0}):this.set("defaultSignatureId","1",{silent:!0});var a=f.get("mobileSignature");return void 0===a&&(a=g("Sent from %s via mobile",ox.serverConfig.productName)),[{id:"0",content:a,misc:{insertion:"below"}}]},parse:function(a){return _(b.parseRecipients([].concat(a).join(", "))).map(function(a){var c="email"===b.getChannel(a[1])?"":b.getChannelSuffixes().msisdn;return['"'+a[0]+'"',a[1],c]})},getFailSave:function(){this.trigger("needsync");var a=this.toJSON();return delete a.files,a.attachments=a.attachments.filter(function(a){return"localFile"!==a.get("group")}),_(a.attachments).each(function(a){a.get("content")&&a.set("content",a.get("content").replace(/<img[^>]*src=\\?"data:[^>]*>/gi,""))}),a.attachments=this.attributes.attachments.toJSON(),{description:g("Mail")+": "+(a.subject||g("No subject")),point:a}},getMail:function(){this.trigger("needsync");var a,c=this.get("attachments"),d=h.converterFor({to:h.sendEncoding()}),e=c.at(0).get("content");return d&&"unified"!==h.sendEncoding()&&(this.set("subject",d(this.get("subject")),{silent:!0}),e=d(e,this.get("editorMode"))),e=b.fixInlineImages(e),c.at(0).set("content",e,{silent:!0}),a=this.pick("from","to","cc","bcc","headers","reply_to","subject","priority","vcard","nested_msgs","sendtype","csid","initial","msgref","disp_notification_to"),a=_.extend(a,{attachments:_(c.mailAttachments()).reject(function(a){return"drive"===a.source}),contacts_ids:c.contactsIds(),infostore_ids:c.driveFiles(),files:c.localFiles()}),a=_.omit(a,function(a,b){return"subject"===b||_.isNumber(a)||_.isBoolean(a)?!1:_.isEmpty(a)}),this.get("sendDisplayName")===!1&&(a.from[0][0]=null),a},getMailForDraft:function(){var b=this.getMail();return _(b.flags).isUndefined()?b.flags=a.FLAGS.DRAFT:0===(4&b.data.flags)&&(b.flags+=a.FLAGS.DRAFT),b},getMailForAutosave:function(){var a=this.getMailForDraft();if(a.infostore_ids){var b=this.get("infostore_ids_saved");a.infostore_ids=_(a.infostore_ids).reject(function(a){return _(b).indexOf(a)>-1})}return a},discard:function(){this.get("autoDismiss")||this.get("autosavedAsDraft")&&this.get("msgref")&&a.remove([b.parseMsgref(a.separator,this.get("msgref"))])},convertAllToUnified:h.converterFor({from:"all",to:"unified"}),attachFiles:function(a){this.get("attachments").add(a)}}),j=$.Deferred();return c.has("emoji")?require(["io.ox/emoji/bundle"]).then(function(a){h=a,j.resolve(i)}):j.resolve(i),j}),define("io.ox/mail/compose/names",["io.ox/mail/sender","io.ox/core/tk/dialogs","io.ox/backbone/mini-views/common","settings!io.ox/mail","gettext!io.ox/mail"],function(a,b,c,d,e){var f={},g=Backbone.View.extend({className:"form-group",initialize:function(){this.listenTo(this.model,"change:overwrite",function(){var a=this.model.get("overwrite"),b=a?"":this.model.get("defaultName"),c=this.$('input[name="name"]');c.attr("placeholder",b).prop("disabled",!a),a?c.val(this.model.get("name")).focus():c.val("")})},render:function(){return this.$el.append($("<h5>").text(this.model.id),$('<div class="input-group">').append($('<span class="input-group-addon">').append(this.renderCheckbox()),this.renderField())),this},renderCheckbox:function(){return new c.CheckboxView({name:"overwrite",model:this.model}).render().$el.attr("title",e("Use custom name")).prop("checked",this.model.get("overwrite"))},renderField:function(){var a=this.model.get("overwrite"),b=a?"":this.model.get("defaultName");return new c.InputView({name:"name",model:this.model}).render().$el.attr("title",e("Custom name")).attr("placeholder",b).prop("disabled",!a).val(a?this.model.get("name"):"")}}),h=Backbone.View.extend({render:function(){return this.$el.append($('<div class="help-block">').css("margin","0 0 1em 0").text(e("Select a checkbox to define a custom name for that address; otherwise the mail account's default name will be used. If you want to use an address anonymously, select the checkbox and leave the field empty.")),this.collection.map(function(a){return new g({model:a}).render().$el})),this},save:function(){var a={};this.collection.each(function(b){a[b.id]=b.pick("name","overwrite","defaultName")}),d.set("customDisplayNames",a).save(),ox.trigger("change:customDisplayNames",a)}}),i=Backbone.Model.extend({constructor:function(a){Backbone.Model.call(this,{id:a,defaultName:f[a],overwrite:d.get(["customDisplayNames",a,"overwrite"],!1),name:d.get(["customDisplayNames",a,"name"],"")})}}),j=Backbone.Collection.extend({model:i});return{EditRealNamesView:h,NameView:g,open:function(){a.getAddresses().done(function(a,c,d){var g=_([].concat([d],a,c)).chain().map(function(a){return f[a[1]]=a[0],a[1]}).uniq().value();(new b.ModalDialog).build(function(){this.getHeader().append($("<h4>").text(e("Edit real names"))),this.view=new h({collection:new j(g),el:this.getContentNode().get(0)}),this.view.render()}).addPrimaryButton("save",e("Save"),"save",{tabindex:1}).addButton("cancel",e("Cancel"),"cancel",{tabindex:1}).on("save",function(){this.view.save(),this.view=null}).show(function(){this.find("input:enabled").focus()})})}}}),define("io.ox/mail/compose/view",["io.ox/mail/compose/extensions","io.ox/backbone/mini-views/dropdown","io.ox/core/extensions","io.ox/mail/api","io.ox/mail/util","io.ox/core/tk/textproc","settings!io.ox/mail","settings!io.ox/core","io.ox/core/notifications","io.ox/core/api/snippets","io.ox/core/api/account","gettext!io.ox/mail","io.ox/mail/actions/attachmentEmpty","io.ox/mail/actions/attachmentQuota","io.ox/core/tk/dialogs","less!io.ox/mail/style","less!io.ox/mail/compose/style","io.ox/mail/compose/actions/send"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p=0,q="io.ox/mail/compose";c.point(q+"/buttons").extend({index:100,id:"send",draw:a.buttons.send},{index:200,id:"save",draw:a.buttons.save},{index:300,id:"discard",draw:a.buttons.discard}),c.point(q+"/mailto").extend({id:"mailto",index:100,setup:a.mailto}),c.point(q+"/header").extend({index:100,id:"title",draw:a.title},{index:200,id:"buttons",draw:function(a){c.point(q+"/buttons").invoke("draw",this,a)}}),c.point(q+"/fields").extend({id:"header",index:p+=100,draw:a.header},{id:"sender",index:p+=100,draw:a.sender},{id:"to",index:p+=100,draw:a.tokenfield("to")},{id:"cc",index:p+=100,draw:a.tokenfield("cc")},{id:"bcc",index:p+=100,draw:a.tokenfield("bcc")},{id:"replyto",index:p+=100,draw:a.tokenfield("reply_to")},{id:"subject",index:p+=100,draw:a.subject},{id:"composetoolbar",index:p+=100,draw:function(a){var b=$('<div data-extension-id="composetoolbar" class="row composetoolbar">');c.point(q+"/composetoolbar").invoke("draw",b,a),this.append(b)},redraw:function(a){var b=this.find(".row.composetoolbar");c.point(q+"/composetoolbar").invoke("redraw",b,a)}},{id:"attachments",index:p+=100,draw:function(a){var b=$('<div data-extension-id="attachments" class="row attachments">');c.point(q+"/attachments").invoke("draw",b,a),this.append(b)}},{id:"arialive",index:p+=100,draw:function(){var a=$('<div data-extension-id="arialive" class="sr-only" role="alert" aria-live="assertive">');this.append(a)}}),c.point(q+"/recipientActionLink").extend({id:"cc",index:100,draw:a.recipientActionLink("cc")},{id:"bcc",index:200,draw:a.recipientActionLink("bcc")}),c.point(q+"/recipientActionLinkMobile").extend({id:"mobile",index:100,draw:a.recipientActionLinkMobile}),c.point(q+"/recipientActions").extend({id:"recipientActions",index:100,draw:a.recipientActions}),c.point(q+"/menu").extend({id:"signatures",index:100,draw:a.signaturemenu},{id:"options",index:200,draw:a.optionsmenu}),c.point(q+"/signatures").extend({id:"signature",index:100,draw:a.signature}),c.point(q+"/editors").extend({id:"plain-text",label:l("Plain Text"),mode:"text"},{id:"tinymce",label:l("HTML"),mode:"html"}),c.point(q+"/menuoptions").extend({id:"editor",index:100,draw:function(){if(!_.device("smartphone")){var a=this.data("view").header(l("Editor"));c.point(q+"/editors").each(function(b){(b.mode||b.label)&&a.option("editorMode",b.mode,b.label,l("Editor"))})}}},{id:"priority",index:200,draw:function(){this.data("view").header(l("Priority")).option("priority",0,l("High"),l("Priority")).option("priority",3,l("Normal"),l("Priority")).option("priority",5,l("Low"),l("Priority"))}},{id:"options",index:300,draw:function(){this.data("view").header(l("Options")).option("vcard",1,l("Attach Vcard"),l("Options"),0).option("disp_notification_to",!0,l("Request read receipt"),l("Options"))}}),c.point(q+"/composetoolbar").extend({id:"add_attachments",index:100,draw:function(b){var c=$('<div data-extension-id="add_attachments" class="col-xs-4 col-md-5 col-md-offset-1">');a.attachment.call(c,b),this.append(c)}},{id:"menus",index:200,draw:function(a){var b=$('<div class="pull-right text-right">');c.point(q+"/menu").invoke("draw",b,a),this.append($('<div data-extension-id="composetoolbar-menu" class="col-xs-8 col-md-6">').append(b))}}),c.point(q+"/attachments").extend({id:"attachmentPreview",index:100,draw:function(b){var c=$('<div data-extension-id="attachmentPreview" class="col-xs-12">');a.attachmentPreviewList.call(c,b),c.appendTo(this)}}),c.point(q+"/attachments").disable("attachmentList");var r=Backbone.View.extend({className:"io-ox-mail-compose container",events:{'click [data-action="add"]':"toggleTokenfield",'keydown [data-extension-id="subject"] input':"setSubject",keydown:"focusSendButton",

"aria-live-update":"ariaLiveUpdate"},initialize:function(a){this.app=a.app,this.editorHash={},this.autosave={},this.blocked=[],this.messageFormat=a.messageFormat||g.get("messageFormat","html"),"edit"===this.model.get("mode")&&"text/html"===this.model.get("content_type")&&"text"===g.get("messageFormat","html")&&(this.messageFormat="html"),this.editor=null,this.composeMode="compose",this.editorId=_.uniqueId("editor-"),this.editorContainer=$('<div class="editor">').attr({"data-editor-id":this.editorId}),this.baton=c.Baton({model:this.model,view:this}),this.$el.on("dispose",function(a){this.dispose(a)}.bind(this)),this.listenTo(this.model,"keyup:subject change:subject",this.setTitle),this.listenTo(this.model,"change:editorMode",this.toggleEditorMode),this.listenTo(this.model,"change:defaultSignatureId",this.setSelectedSignature),this.listenTo(this.model,"change:signatures",this.updateSelectedSignature),this.listenTo(this.model,"needsync",this.syncMail);var b,d;if(b=_.url.hash("mailto")){var e=function(a){return a.split(",").map(function(a){var b=_.compact(a.replace(/^("([^"]*)"|([^<>]*))?\s*(<(\s*(.*?)\s*)>)?/,"$2//$3//$5").split("//")).map(function(a){return a.trim()});return 1===b.length?[b[0],b[0]]:b})},f=b.replace(/^mailto:/,"").split(/\?/,2),h=decodeURIComponent(f[0]);d=_.deserialize(f[1]);for(var i in d)d[i.toLowerCase()]=d[i];h&&this.model.set("to",e(h),{silent:!0}),d.cc&&this.model.set("cc",e(d.cc),{silent:!0}),d.bcc&&this.model.set("bcc",e(d.bcc),{silent:!0}),this.setSubject(d.subject||""),this.model.setContent(d.body||""),_.url.hash("mailto",null)}c.point(q+"/mailto").invoke("setup")},ariaLiveUpdate:function(a,b){this.$('[data-extension-id="arialive"]').text(b)},fetchMail:function(a){if("compose"===a.mode)return $.when();if(a.restored)return $.when();var b=this,c=a.mode,e=_(a).pick("id","folder_id");return delete a.mode,a.initial===!1?(a.attachments=new Backbone.Collection(_.clone(a.attachments)),this.model.set(a),a=null,$.when()):(a="forward"!==c||a.id?_.pick(a,"id","folder_id","csid","content_type"):_(a).map(function(a){return _.pick(a,"id","folder_id","csid")}),a.embedded=!0,a.max_size=g.get("maxSize/compose",524288),d[c](a,this.messageFormat).then(k.getValidAddress).then(function(h){h.sendtype="edit"!==c?"forward"===c?d.SENDTYPE.FORWARD:d.SENDTYPE.REPLY:d.SENDTYPE.EDIT_DRAFT,h.mode=c;var i=_.clone(h.attachments);("forward"===c||"edit"===c)&&i.forEach(function(a){_.extend(a,{group:"mail",mail:e})}),delete h.attachments,("forward"===c||"edit"===c)&&(_(h.nested_msgs).each(function(a){i.push({id:a.id,filename:a.subject,content_type:"message/rfc822",msgref:a.msgref})}),delete h.nested_msgs);var j=_.first(h.from);_.isArray(j)&&g.get(["customDisplayNames",j[1],"overwrite"])&&(j[0]=g.get(["customDisplayNames",j[1],"name"],j[0])),b.model.set(h);var k=b.model.get("attachments");k.reset(i);var l=k.at(0).get("content"),m=k.at(0).get("content_type");"edit"===c&&"alternative"===b.model.get("editorMode")&&"text/plain"===m&&b.model.set("editorMode","text",{silent:!0}),"text/plain"===m&&(l=f.htmltotext(l));var n=$.Deferred();return"text/plain"===m&&"html"===b.model.get("editorMode")?f.texttohtml(l).then(function(a){k.at(0).set("content_type","text/html"),l=a,n.resolve()}):n.resolve(),$.when(n).then(function(){k.at(0).set("content",l),b.model.unset("attachments"),b.model.set("attachments",k),a=h=k=null})}).fail(function(){b.clean()}))},setSubject:function(a){var b=a.target?$(a.target).val():a;a.which&&13===a.which&&this.editor.focus(),this.model.set("subject",b,{silent:!0}).trigger("keyup:subject",b)},setTitle:function(){this.app.setTitle(this.model.get("subject")||l("Compose"))},parseMsgref:function(a){var b=_(a.toString().split(d.separator)),c=b.last(),e=b.without(c).join(d.separator);return{folder_id:e,id:c}},saveDraft:function(){this.model.set("autoDismiss",!0);var a=this.app.getWindow();a.busy();var b=this,e=this.model,f=this.model.getMailForDraft(),g=new $.Deferred;return delete f.vcard,m.emptinessCheck(f.files).then(function(){var a=$.Deferred();return c.point("io.ox/mail/compose/actions/send").get("wait-for-pending-images",function(b){b.perform(new c.Baton({mail:f,model:e})).then(a.resolve,a.reject)}),a}).then(function(){return n.publishMailAttachmentsNotification(f.files)}).then(function(){return d.send(f,f.files)}).then(function(a){var c=b.parseMsgref(a.data);return"text/plain"===f.attachments[0].content_type&&(c.view="raw"),$.when(a,d.get(c))},function(a){return a.error?(i.yell(a),g.reject(a)):void 0}).then(function(a,c){return"html"===e.get("editorMode")&&$(c.attachments[0].content).find("img:not(.emoji)").each(function(a,c){$("img:not(.emoji):eq("+a+")",b.editorContainer.find(".editable")).attr("src",$(c).attr("src"))}),c.attachments.forEach(function(a,b){var c=e.get("attachments").at(b);"undefined"==typeof c?e.get("attachments").add(a):c.id!==a.id&&(c.clear({silent:!0}),c.set(a))}),e.set("msgref",a.data),e.set("sendtype",d.SENDTYPE.EDIT_DRAFT),e.dirty(!1),i.yell("success",l("Mail saved as draft")),a}).always(function(){a.idle()})},autoSaveDraft:function(){var a=new $.Deferred,b=this.model,c=this.model.getMailForAutosave();return d.autosave(c).always(function(e){e.error?(i.yell(e),a.reject(e)):(b.set({autosavedAsDraft:!0,msgref:e,sendtype:d.SENDTYPE.EDIT_DRAFT,infostore_ids_saved:[].concat(b.get("infostore_ids_saved"),c.infostore_ids||[])}),b.updateShadow(),i.yell("success",l("Mail saved as draft")),a.resolve(e))}),this.initAutoSaveAsDraft(),a},stopAutoSave:function(){this.autosave&&window.clearTimeout(this.autosave.timer)},initAutoSaveAsDraft:function(){var a,b,c,d=g.get("autoSaveDraftsAfter",!1),e={minute:6e4,minutes:6e4},f=this;d&&(d=d.split("_"),a=e[d[1]],d=d[0],d&&a&&(this.stopAutoSave(),b=function(){f.autosave.timer=_.delay(c,d*a)},c=function(){f.model.dirty()?f.autoSaveDraft():b()},this.autosave={},b()))},clean:function(){this.model.dirty(!1);for(var a in this.editorHash)this.editorHash[a].destroy();this.stopAutoSave()},dispose:function(){this.stopListening(),this.model=null},discard:function(){var a=this,b=$.when();return(this.model.dirty()||this.model.get("autosavedAsDraft")&&!this.model.get("autoDismiss"))&&(b=new o.ModalDialog({width:550,container:_.device("smartphone")?a.$el.closest(".window-container-center"):$("#io-ox-core")}).text(l("Do you really want to discard your message?")).addPrimaryButton("delete",l.pgettext("dialog","Discard message"),"delete",{tabIndex:1}).addAlternativeButton("savedraft",l("Save as draft"),"savedraft",{tabIndex:1}).addButton("cancel",l("Cancel"),"cancel",{tabIndex:1}).show().then(function(b){return"delete"!==b?"savedraft"===b?a.saveDraft():$.Deferred().reject():void a.model.discard()})),b.then(function(){a.clean()})},send:function(){this.model.set("autoDismiss",!0);var a=this.model.getMail(),b=this,d=new c.Baton({mail:a,model:this.model,app:this.app,view:b}),e=c.point("io.ox/mail/compose/actions/send");return e.reduce(function(a,b){return a&&a.then||(a=$.when(a)),a.then(_.identity,function(a){return a&&a.error&&(d.error=a.error),a&&a.warnings&&(d.warning=a.warnings),$.when()}).then(function(){return d.isPropagationStopped()||d.isDisabled(e.id,b.id)?void 0:b.perform.apply(void 0,[d])})},$.when()).fail(function(){d.model.set("autoDismiss",!1)})},toggleTokenfield:function(a){var b,c="string"==typeof a,d=c?a:$(a.target).attr("data-type");if(_.device("smartphone"))return c||a.preventDefault(),b=this.$el.find('[data-extension-id="cc"], [data-extension-id="bcc"]'),b.hasClass("hidden")?(b.removeClass("hidden"),this.$el.find('[data-action="add"] span').removeClass("fa-angle-right").addClass("fa-angle-down")):_.isEmpty(this.model.attributes.cc)&&_.isEmpty(this.model.attributes.bcc)&&(this.model.set("cc",[]),this.model.set("bcc",[]),b.addClass("hidden"),this.$el.find('[data-action="add"] span').removeClass("fa-angle-down").addClass("fa-angle-right")),b;var e=this.$el.find('[data-type="'+d+'"]');return b=this.$el.find('[data-extension-id="'+d+'"]'),c||a.preventDefault(),b.hasClass("hidden")||c?(b.removeClass("hidden"),e.addClass("active").attr("aria-checked",!0)):(!this.model.has(d)||_.isEmpty(this.model.get(d)))&&(this.model.set(d,[]),b.addClass("hidden"),$(window).trigger("resize.tinymce"),e.removeClass("active").attr("aria-checked",!1)),b},loadEditor:function(a){if(this.editorHash[this.model.get("editorMode")])return this.reuseEditor(a);var b=this,c=$.Deferred(),d={};return d.useFixedWithFont=g.get("useFixedWithFont"),d.app=this.app,d.view=this,d.model=this.model,d.oxContext={view:this},ox.manifests.loadPluginsFor("io.ox/mail/compose/editor/"+this.model.get("editorMode")).then(function(a){new a(b.editorContainer,d).done(function(a){c.resolve(a)})}),c.then(function(c){return b.editorHash[b.model.get("editorMode")]=c,b.reuseEditor(a)})},reuseEditor:function(a){var b=this;return this.editor=this.editorHash[this.model.get("editorMode")],$.when(this.editor.setPlainText(a)).then(function(){return b.editor.show(),b.setSelectedSignature(),b.editor})},getEditor:function(){var a=$.Deferred();return this.editor?(a.resolve(this.editor),a):this.loadEditor()},toggleEditorMode:function(){var a;return this.editor&&(this.removeSignature(),a=this.editor.getPlainText(),this.editor.hide()),this.editorContainer.busy(),this.loadEditor(a).then(function(){this.editorContainer.idle(),this.model.setMailContentType(this.editor.content_type),_.isFunction(this.editor.tinymce)&&this.editor.tinymce().undoManager.clear()}.bind(this))},syncMail:function(){this.editor&&this.model.setContent(this.editor.getContent())},setBody:function(a){this.model.get("initial")&&(a=String(a||"").replace(/^[\s\xA0]*\n([\s\xA0]*\S)/,"$1"),a=a.replace(/[\s\uFEFF\xA0]+$/,"")),"compose"!==this.model.get("mode")&&(a=a.replace(/\n<br>&nbsp;$/,"\n")),this.setSimpleMail(a),this.editor.setContent(a),this.model.get("initial")&&(this.setSelectedSignature(),this.prependNewLine())},updateSelectedSignature:function(){var a=this.model.get("signature");if(a){var b=_(this.model.get("signatures")).find({id:String(a.id)});if(a.content!==b.content){var c=!!this.editor.find;if(c)this.editor.find(".io-ox-signature").each(function(){var a=$(this),c=a.text(),d=$("<div>").html(b.content).text().replace(/\s+/g,"")!==c.replace(/\s+/g,"");d&&a.empty().append($(b.content))});else{var d=e.signatures.cleanAdd(a.content,!1),f=e.signatures.cleanAdd(b.content,!1);this.editor.replaceParagraph(d,f)}this.model.set("signature",b)}}},setSelectedSignature:function(a,b){a||(a=this.model.get("defaultSignatureId")),_.isString(a)&&(b=a);var c=this.model.get("signatures");this.model.set("signature",_(c).where({id:String(b)})[0]);var d=_(c).where({id:_.isObject(a)?a.previous("defaultSignatureId"):""})[0];if(d&&this.removeSignature(d),this.model.get("signature")){var e=this.model.get("signature");e.misc=_.isString(e.misc)?JSON.parse(e.misc):e.misc,this.setSignature(e)}},removeSignature:function(a){if(!a){if(!this.model.get("signature"))return;a=this.model.get("signature")}var b=this,c=!!this.editor.find,d=e.signatures.cleanAdd(a.content,c);c?this.editor.find(".io-ox-signature").each(function(){var a=$(this),c=a.text(),d=_(b.model.get("signatures")).find(function(a){return $("<div>").html(a.content).text().replace(/\s+/g,"")===c.replace(/\s+/g,"")});d?a.remove():a.removeClass("io-ox-signature")}):d&&this.editor.replaceParagraph(d,"")},isSignature:function(a){var b=!!this.editor.find;return e.signatures.is(a,this.model.get("signatures"),b)},setSignature:function(a){var b,c=!!this.editor.find;if(this.model.get("signatures").length>0)if(b=e.signatures.cleanAdd(a.content,c),c&&(b=this.getParagraph(b)),_.isString(a.misc)&&(a.misc=JSON.parse(a.misc)),a.misc&&"below"===a.misc.insertion)this.editor.appendContent(b),this.editor.scrollTop("bottom");else{var d=_.bind(this.editor.insertPrevCite||this.editor.prependContent,this.editor);d(b),this.editor.scrollTop("top")}},getParagraph:function(a){var b=$(/(<([^>]+)>)/gi.test(a)?"<div>":"<p>");return b.addClass("io-ox-signature").append(this.editor.ln2br(a)),$("<div>").append(b).html()},prependNewLine:function(){var a=this.editor.getContent().replace(/^\n+/,"").replace(/^(<p><br><\/p>)+/,""),b="html"===this.model.get("editorMode")?"<p><br></p>":"\n";"edit"!==this.model.get("mode")&&this.editor.setContent(b+a)},setMail:function(){var a=this;return this.model.setInitialMailContentType(),this.toggleEditorMode().then(function(){return a.signaturesLoading}).done(function(){var b=a.model.get("mode");/(compose|forward)/.test(b)?_.device("!ios")&&_.defer(function(){a.$el.find(".tokenfield:first .token-input").focus()}):a.editor.focus(),("replyall"===b||"edit"===b)&&(_.isEmpty(a.model.get("cc"))||a.toggleTokenfield("cc"),_.isEmpty(a.model.get("bcc"))||a.toggleTokenfield("bcc")),a.setBody(a.model.getContent()),a.model.dirty(!1)})},setSimpleMail:function(a){"text"!==this.model.get("editorMode")&&(/<table/.test(a)||this.editorContainer.find(".editable.mce-content-body").addClass("simple-mail"))},blockReuse:function(a){this.blocked[a]=(this.blocked[a]||0)+1},unblockReuse:function(a){this.blocked[a]=(this.blocked[a]||0)-1,this.blocked[a]<=0&&delete this.blocked[a]},focusEditor:function(){this.editor.focus()},focusSendButton:function(a){(a.metaKey||a.ctrlKey)&&13===(a.keyCode||a.which)&&(a.preventDefault(),this.$el.parents().find('button[data-action="send"]').focus())},render:function(){var a=this,b=$('<div class="mail-compose-fields">');return c.point(q+"/fields").invoke("draw",b,this.baton),this.$el.append(b),this.setTitle(),this.$el.find("input.tokenfield").each(function(){var b=$(this).data("bs.tokenfield").$input;b.on({compositionstart:function(){$(this).attr("data-ime","active")},compositionend:function(){$(this).attr("data-ime","inactive")},keydown:function(a){13===a.which&&"active"!==$(this).attr("data-ime")&&$(this).val("")},keyup:function(b){if(13!==b.which&&!_.device("smartphone")){var c=$(this).val();/^to:?\s/i.test(c)?$(this).typeahead("val",""):/^cc:?\s/i.test(c)?($(this).typeahead("val",""),a.toggleTokenfield("cc").find(".token-input").focus()):/^bcc:?\s/i.test(c)&&($(this).typeahead("val",""),a.toggleTokenfield("bcc").find(".token-input").focus())}}})}),this.$el.append(this.editorContainer),this.initAutoSaveAsDraft(),this}});return r}),define("io.ox/mail/sender",["io.ox/mail/util","io.ox/core/api/account","io.ox/core/api/user","io.ox/contacts/api","io.ox/core/capabilities","settings!io.ox/mail"],function(a,b,c,d,e,f){function g(a,b){return a=a.value,b=b.value,b>a?-1:1}function h(a,b,c,d){return $("<option>",{value:a}).text(_.noI18n(b||a)).attr({"data-display-name":c||"","data-address":d||a})}function i(b){var c={display_name:b[0],address:"email"===a.getChannel(b[1])?b[1]:a.cleanupPhone(b[1])+a.getChannelSuffixes().msisdn};return c.text=a.formatSender(c.display_name,b[1],!1),c.value=a.formatSender(c.display_name,c.address),c}var j={getsender:function(a){return i(a)},get:function(a){var b=a.children("option:selected"),c=b.attr("data-display-name"),d=b.attr("data-address");return b.length?[c,d]:["",a.attr("data-default-send-address")]},set:function(a,c){if(a&&_.isArray(c)){var d,e=b.trimAddress(c[1]),f=a.find('[data-address="'+e+'"]'),g=a.children();if(0===g.length)return void a.attr("data-default",e);d=g.index(f),-1===d&&(f=a.find("[default]"),d=a.children().index(f)),a.prop("selectedIndex",d)}},getUser:function(){return c.get({id:ox.user_id})},getMapping:function(){return e.has("msisdn")?d.getMapping("msisdn","names"):[]},getDefaultSendAddress:function(){return $.trim(f.get("defaultSendAddress",""))},getDefaultSendAddressWithDisplayname:function(){return j.getAddresses().then(function(a,b,c){return[c]})},getPrimaryAddress:function(){return b.getPrimaryAddress()},getAccounts:function(){return b.getAllSenderAddresses()},getDisplayName:function(){return b.getDefaultDisplayName()},getNumbers:function(){return $.when(j.getUser(),j.getDisplayName()).then(function(a,b){return b=b||a.display_name||"",_(j.getMapping()).chain().map(function(c){var d=$.trim(a[c]);return d?[b,d]:void 0}).compact().value()})},getAddresses:function(){return $.when(j.getAccounts(),j.getNumbers(),j.getPrimaryAddress())},drawOptions:function(a){if(a){var b=this.getDefaultSendAddress();return a.empty().attr("data-default-send-address",b).append(h(b)),j.getAddresses().then(function(b,c,d){var e,f=a.attr("data-default")||d[1],j=[].concat(b,c);j=_(j).map(function(a){var b=i(a),c=h(b.value,b.text,b.display_name,b.address);return(a[1]===f||b.address===f)&&(c.attr("default","default"),e=b.value),{value:b.value,option:c}}),a.empty().append(_(j.sort(g)).pluck("option")),a.attr("data-default",f),e&&a.val(e)})}},drawDropdown:function(){var a=this.getDefaultSendAddress();return j.getAddresses().then(function(b,c,d){var e=a||d[1],f=[].concat(b,c);return f=_(f).map(function(a){var b=i(a);return{value:b.value,option:a}}),{sortedAddresses:f.sort(g),defaultAddress:e}})}};return j}),define("io.ox/backbone/mini-views/common",["io.ox/backbone/mini-views/abstract"],function(a){var b=a.extend({el:'<input type="text" class="form-control">',events:_.device("firefox")?{change:"onChange",drop:"onDrop"}:{change:"onChange"},onChange:function(){this.model.set(this.name,this.$el.val(),{validate:!0})},onDrop:function(a){if(a.originalEvent.dataTransfer.getData("text")){var b=this;this.$el.one("input",function(){b.$el.trigger("change")})}},setup:function(){this.listenTo(this.model,"change:"+this.name,this.update)},update:function(){this.$el.val($.trim(this.model.get(this.name)))},render:function(){return this.$el.attr({name:this.name,tabindex:this.options.tabindex||1}),this.id&&this.$el.attr("id",this.id),this.options.maxlength&&this.$el.attr("maxlength",this.options.maxlength),this.update(),this}}),c=a.extend({el:'<input type="password" class="form-control">',events:{change:"onChange"},onChange:function(){var a=this.$el.val();/^\*$/.test(a)&&(a=null),this.model.set(this.name,a,{validate:!0})},setup:function(){this.listenTo(this.model,"change:"+this.name,this.update)},update:function(){var a=this.model.get(this.name);this.$el.val(null!==a?$.trim(a):"********")},render:function(){return this.$el.attr({autocomplete:"off",autocorrect:"off",name:this.name,tabindex:this.options.tabindex||1}),this.id&&this.$el.attr("id",this.id),this.options.maxlength&&this.$el.attr("maxlength",this.options.maxlength),this.update(),this}}),d=a.extend({el:'<textarea class="form-control">',events:_.device("firefox")?{change:"onChange",drop:"onDrop"}:{change:"onChange"},onChange:function(){this.model.set(this.name,this.$el.val(),{validate:!0})},onDrop:function(a){if(a.originalEvent.dataTransfer.getData("text")){var b=this;this.$el.one("input",function(){b.$el.trigger("change")})}},setup:function(a){this.rows=a.rows,this.listenTo(this.model,"change:"+this.name,this.update)},update:function(){this.$el.val(this.model.get(this.name))},render:function(){return this.$el.attr({name:this.name,tabindex:this.options.tabindex||1}),this.rows&&this.$el.attr("rows",this.rows),this.options.maxlength&&this.$el.attr("maxlength",this.options.maxlength),this.update(),this}}),e=a.extend({el:'<input type="checkbox">',events:{change:"onChange"},onChange:function(){this.model.set(this.name,this.$el.prop("checked"))},setup:function(){this.listenTo(this.model,"change:"+this.name,this.update)},update:function(){this.$el.prop("checked",!!this.model.get(this.name))},render:function(){return this.$el.attr({name:this.name,tabindex:this.options.tabindex||1}),this.update(),this}}),f=a.extend({tagName:"div",className:"controls",events:{change:"onChange"},onChange:function(){this.model.set(this.name,this.$el.find('[name="'+this.name+'"]:checked').val())},setup:function(){this.listenTo(this.model,"change:"+this.name,this.update)},update:function(){var a=this;_.each(a.$el.find('[name="'+a.name+'"]'),function(b){a.model.get(a.name)===b.value&&$(b).prop("checked",!0)})},render:function(){var a=this;return this.$el.append(_.map(this.options.list,function(b){return $("<div>").addClass("radio").append($("<label>").text(b.label).prepend($('<input type="radio" name="'+a.name+'">').val(b.value).attr({tabindex:a.options.tabindex||1})))})),this.update(),this}}),g=a.extend({tagName:"select",className:"input-xlarge form-control",events:{change:"onChange"},onChange:function(){this.model.set(this.name,this.$el.val())},setup:function(){this.listenTo(this.model,"change:"+this.name,this.update)},update:function(){this.$el.val(this.model.get(this.name))},render:function(){return this.$el.attr({name:this.name,tabindex:this.options.tabindex||1}),this.id&&this.$el.attr({id:this.id}),this.$el.append(_.map(this.options.list,function(a){return $("<option>").attr({value:a.value}).text(a.label)})),this.update(),this}}),h=a.extend({tagName:"span",className:"help-block",getContainer:function(){return this.options.selector?_.isString(this.options.selector)?this.$el.closest(this.options.selector):_.isObject(this.options.selector)?this.options.selector:void 0:this.$el.closest('.form-group, [class*="col-"]')},render:function(){var a=this;return _.defer(function(){var b=a.getContainer(),c=_.uniqueId("error-help_");b.on({invalid:function(d,e){$(this).hasClass("has-error")||($(this).addClass("has-error"),a.$el.attr({id:c}),a.$el.text(e).show().end(),$(this).find("input").attr({"aria-invalid":!0,"aria-describedby":c}),_.defer(function(){$(b).find("input").focus()}))},valid:function(){$(this).removeClass("has-error"),a.$el.removeAttr("id role"),a.$el.text("").hide().end(),$(this).find("input").removeAttr("aria-invalid aria-describedby")}})}),this.$el.attr({"aria-live":"assertive"}).hide(),this}}),i=a.extend({tagName:"form",setup:function(){this.listenTo(this.model,"change")},render:function(){return this.id&&this.$el.attr({id:this.id}),this}}),j=a.extend({tagName:"div",className:"dropdownlink",events:{'click [data-action="change-value"]':"onClick"},onClick:function(a){a.preventDefault(),this.model.set(this.name,$(a.target).attr("data-value"))},setup:function(){this.listenTo(this.model,"change:"+this.name,this.update)},update:function(){this.$el.find(".dropdown-toggle").text(this.options.values[this.model.get(this.name)])},render:function(){return this.$el.append($('<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="menuitem" aria-haspopup="true" tabindex="1">').text(this.options.values[this.model.get(this.name)]),$('<ul class="dropdown-menu" role="menu">').append(_(this.options.values).map(function(a,b){return $("<li>").append($("<a>",{href:"#","data-action":"change-value","data-value":b,tabindex:"1"}).append($.txt(a)))}))),this.update(),this}});return{AbstractView:a,InputView:b,PasswordView:c,TextView:d,CheckboxView:e,RadioView:f,SelectView:g,ErrorView:h,FormView:i,DropdownLinkView:j}}),define("io.ox/core/tk/tokenfield",["io.ox/core/extensions","io.ox/core/tk/typeahead","io.ox/participants/model","io.ox/participants/views","io.ox/contacts/api","io.ox/core/util","gettext!io.ox/core","static/3rd.party/bootstrap-tokenfield/js/bootstrap-tokenfield.js","css!3rd.party/bootstrap-tokenfield/css/bootstrap-tokenfield.css","less!io.ox/core/tk/tokenfield","static/3rd.party/jquery-ui.min.js"],function(a,b,c,d,e,f,g){$.fn.tokenfield.Constructor.prototype.getTokensList=function(a,b,c){a=a||this._firstDelimiter,b="undefined"!=typeof b&&null!==b?b:this.options.beautify;var d=a+(b&&" "!==a?" ":"");return $.map(this.getTokens(c),function(a){if(a.model){var b=a.model.getDisplayName(),c=a.model.getEmail?a.model.getEmail():void 0;return b===c?c:'"'+f.removeQuotes(b)+'" <'+c+">"}return a.value}).join(d)},$.fn.tokenfield.Constructor.prototype.setTokens=function(a,b,c){if(a){b||this.$wrapper.find(".token").remove(),"undefined"==typeof c&&(c=!0),"string"==typeof a&&(a=this._delimiters.length?a.match(/('[^']*'|"[^"]*"|[^"',;]+)+/g):[a]);var d=this;return $.each(a,function(a,b){d.createToken(b,c)}),this.$element.get(0)}};var h=b.extend({className:"test",events:{dispose:"dispose"},initialize:function(f){var g=this;f=_.extend({},{harmonize:function(a){return _(a).map(function(a){var b=new c.Participant(a);return{value:b.getTarget({fallback:!0}),label:b.getDisplayName().trim()||b.getEmail(),model:b}})},delayedautoselect:!1,allowEditing:!0,createTokensOnBlur:!0,dnd:!0,html:!1,init:!1,customDefaultModel:!1,extPoint:"io.ox/core/tk/tokenfield",leftAligned:!1},f),a.point(f.extPoint+"/token").extend({id:"token",index:100,draw:function(a){$(this).prepend(e.pictureHalo($('<div class="contact-image">'),a.toJSON(),{width:16,height:16,scaleType:"contain"}))}}),a.point(f.extPoint+"/autoCompleteItem").extend({id:"view",index:100,draw:function(a){var b=new d.ParticipantEntryView({model:a.model,closeButton:!1,halo:!1});this.append(b.render().$el)}}),b.prototype.initialize.call(this,f);var h=Backbone.Collection.extend({model:c.Participant});this.collection=f.collection||new h,this.collection.comparator=function(a){return a.index||null},this.redrawLock=!1,this.listenTo(this.collection,"reset",function(){g.redrawTokens()})},dispose:function(){this.$el.tokenfield("destroy"),this.stopListening(),this.collection=null},register:function(){var b=this;this.$el.tokenfield().parent().delegate(".token","click mousedown",function(a){var c=$.extend(!0,{},a,{type:"tokenfield:clickedtoken",attrs:$(a.currentTarget).data().attrs,originalEvent:a});b.$el.tokenfield().trigger(c)}),this.options.delayedautoselect&&(b.autoselect={},b.model.on("change:query",function(a,c){b.autoselect[c]&&(b.input.trigger($.Event("keydown",{keyCode:13,which:13})),delete b.autoselect[c])})),this.$el.tokenfield().on({"tokenfield:createtoken":function(a){if(!b.redrawLock){if(b.options.customDefaultModel&&!a.attrs.model)return a.preventDefault(),!1;var d,e=b.getInput().data();if(e.edit===!0)return d=/^"(.*?)"\s*(<\s*(.*?)\s*>)?$/.exec(a.attrs.value),_.isArray(d)?a.attrs.label=f.removeQuotes(d[1]):d=["",a.attrs.value,"",a.attrs.value],a.attrs.model=e.editModel.set("token",{label:d[1],value:d[3]}),a.attrs.value=a.attrs.model.cid,void(e.edit=!1);if(a.attrs.model||(d=/^"(.*?)"\s*(<\s*(.*?)\s*>)?$/.exec(a.attrs.value),_.isArray(d)?(a.attrs.label=f.removeQuotes(d[1]),a.attrs.value=d[3]):d=["",a.attrs.value,"",a.attrs.value],a.attrs.model=new c.Participant({type:5,display_name:d[1],email1:d[3]})),a.attrs.model.has("distribution_list")){var h=_.chain(a.attrs.model.get("distribution_list")).filter(function(a){return!!a.mail}).map(function(a){a.type=5;var b=new c.Participant({type:5,display_name:a.display_name,email1:a.mail});return b.set("token",{label:a.display_name,value:a.mail},{silent:!0})}).value(),i=a.attrs.model.get("display_name"),j=_(h).map(function(a){return[a.get("token").label+", "+a.get("token").value]});return b.$el.trigger("aria-live-update",1===j.length?g("Added distribution list %s with %s member. The only member of the distribution list is %s.",i,j.length,j.join(", ")):g("Added distribution list %s with %s members. Members of the distribution list are %s.",i,j.length,j.join(", "))),b.collection.add(h),b.redrawTokens(),b.input.data("ttTypeahead").input.$input.val(""),!1}a.attrs.model.set("token",{label:a.attrs.label,value:a.attrs.value},{silent:!0}),a.attrs.value=a.attrs.model.cid,b.$el.trigger("aria-live-update",g("Added %1$s, %2$s.",a.attrs.model.get("display_name"),a.attrs.model.value)),b.collection.add(a.attrs.model)}},"tokenfield:createdtoken":function(c){if(c.attrs){var d=c.attrs.model||b.getModelByCID(c.attrs.value),e=$(c.relatedTarget),f=e.find(".token-label");"0px"===f.css("max-width")&&f.css("max-width","none"),e.attr("title",function(){var a=d.get("token"),b=a.label;return a.label!==a.value&&(b=a.label?a.label+" <"+a.value+">":a.value),b}),a.point(b.options.extPoint+"/token").invoke("draw",c.relatedTarget,d,c)}},"tokenfield:edittoken":function(a){if(a.attrs&&a.attrs.model){var c=a.attrs.model.get("token");b.getInput().data("editModel",a.attrs.model),a.attrs.value=c.label,c.value!==c.label&&(a.attrs.value=c.label?'"'+f.removeQuotes(c.label)+'" <'+c.value+">":c.value),b.getInput().one("blur",function(){for(var a=b.$el.parent().find(".token"),c=b.getInput().data().editModel.cid,d=!1,e=0;e<a.length;e++)if($(a[e]).data("attrs").value===c)return void(d=!0);d||b.collection.remove(b.getModelByCID(c))})}},"tokenfield:removetoken":function(a){_([].concat(a.attrs)).each(function(a){var c=b.getModelByCID(a.value);b.$el.trigger("aria-live-update",g("Removed %1$s, %2$s.",c.get("display_name"),c.value)),b.collection.remove(c)})}})},render:function(){var a=this.options,c=this;return this.$el.addClass("tokenfield").tokenfield({createTokensOnBlur:a.createTokensOnBlur,minLength:a.minLength,allowEditing:a.allowEditing,typeahead:c.typeaheadOptions,html:this.options.html||!1,inputType:this.options.inputtype||"email"}),this.register(),this.input=$(this.$el).data("bs.tokenfield").$input,b.prototype.render.call({$el:this.input,model:this.model,options:this.options}),this.hiddenapi=this.input.data("ttTypeahead"),(_.device("smartphone")||a.leftAligned)&&(this.hiddenapi.dropdown._show=function(){var b="auto",d=0;_.device("smartphone")?(d=-1*c.input.offset().left,b=window.innerWidth):a.leftAligned&&(d=c.input.position().left,d=-1*Math.round(d)+17),this.$menu.css({left:d,width:b}).show()}),this.options.delayedautoselect&&this.input.on("keydown",function(b){var d=13===b.which,e=!!c.input.val()&&c.input.val().length>=a.minLength,f=c.model.get("query")!==c.input.val();f&&!d&&(c.hiddenapi.dropdown.empty(),c.hiddenapi.dropdown.close()),d&&e&&f&&(c.autoselect[c.input.val()]=!0)}),this.$el.parent().addClass(this.options.className),this.options.dnd&&this.$el.closest("div.tokenfield").sortable({items:"> .token",connectWith:"div.tokenfield",cancel:"a.close",placeholder:"token placeholder",revert:0,forcePlaceholderSize:!0,stop:function(){c.resort()},receive:function(a,b){var d=b.item.data();c.collection.add(d.attrs.model),c.resort()},remove:function(a,b){var d=b.item.data();c.collection.remove(d.attrs.model),c.resort()}}).droppable({hoverClass:"drophover"}),this.$el.closest("div.tokenfield").on("keydown",function(a){(a.ctrlKey||a.metaKey)&&88===a.keyCode&&($(this).find(".token.active").each(function(){c.collection.remove($(this).data().attrs.model)}),c.redrawTokens())}),this},getModelByCID:function(a){return this.collection.get({cid:a})},redrawTokens:function(){var a=[];this.redrawLock=!0,this.collection.each(function(b){a.push({label:b.getDisplayName(),value:b.cid,model:b})}),this.$el.tokenfield("setTokens",a,!1),this.redrawLock=!1},resort:function(){var a=this.collection;_(this.$el.tokenfield("getTokens")).each(function(b,c){a.get({cid:b.value}).index=c}),a.sort(),this.redrawTokens()},getInput:function(){return this.input},setFocus:function(){var a=this.$el.parent();a.find(".token-input").focus()}});return h}),define("io.ox/core/tk/typeahead",["io.ox/core/extensions","io.ox/core/api/autocomplete","settings!io.ox/contacts","static/3rd.party/typeahead.js/dist/typeahead.jquery.js","css!3rd.party/bootstrap-tokenfield/css/tokenfield-typeahead.css"],function(a,b,c){function d(a,b){return this.model.set({source:a}),b}var e=Backbone.View.extend({el:'<input type="text" class="form-control">',options:{apiOptions:{contacts:!1,users:!1,groups:!1,resources:!1,distributionlists:!1},source:function(a){return this.api.search(a)},click:$.noop,tabindex:1,maxResults:25,autoselect:!0,hint:!0,reduce:_.identity,harmonize:_.identity,init:!0,extPoint:"io.ox/core/tk/typeahead"},initialize:function(e){var f=this;this.model=new Backbone.Model({source:"idle",query:void 0,dropdown:"closed"}),e=this.options=$.extend({},this.options,e||{}),a.point(e.extPoint+"/autoCompleteItem").extend({id:"view",index:100,draw:function(a){this.text(a)}}),this.api=new b(e.apiOptions),this.typeaheadOptions=[{autoselect:e.autoselect,minLength:Math.max(1,c.get("search/minimumQueryLength",2)),highlight:!0,hint:e.hint},{source:function(a,b){if(d.call(f,"requesting"),e.source.call(f,a).then(d.bind(f,"processing")).then(e.reduce).then(function(a){return e.maxResults&&(a=a.slice(0,e.maxResults)),"top"===e.placement?a.reverse():a}).then(e.harmonize).then(d.bind(f,"finished")).then(d.bind(f,"idle")).then(b),!f.registered){

var c=this;c.onSync("rendered",function(){var a=c.$el.closest(".twitter-typeahead").find(".tt-dropdown-menu"),b=a.find(".tt-dataset-0").is(":empty"),d=a.find("span.info").attr("data-query");b||f.model.set("query",d),a.is(":visible")&&f.model.set("dropdown","opened"),f.trigger("typeahead-custom:dropdown-rendered")}),f.registered=!0}},templates:{suggestion:e.suggestion||function(b){var c=$('<div class="autocomplete-item">');return a.point(e.extPoint+"/autoCompleteItem").invoke("draw",c,b),c},header:function(a){return $('<span class="info hidden">').attr("data-query",a.query)}}}]},render:function(){var a=this.options,b=this;return this.$el.attr({tabindex:this.options.tabindex,placeholder:this.options.placeholder}).on({"typeahead:closed":function(){var a=b.$el.closest(".twitter-typeahead").find(".tt-dropdown-menu");a.is(":visible")||b.model.set("dropdown","closed")},"typeahead:selected typeahead:autocompleted":function(c,d){a.click.call(this,c,d),b.$el.trigger("select",d),b.$el.typeahead("val","")},"typeahead:cursorchanged":function(){}}),this.options.init&&this.$el.typeahead.apply(this.$el,this.typeaheadOptions),this}});return e}),define("io.ox/participants/model",["io.ox/core/api/user","io.ox/core/api/group","io.ox/core/api/resource","io.ox/contacts/api","io.ox/contacts/model","io.ox/contacts/util","io.ox/core/util","gettext!io.ox/core"],function(a,b,c,d,e,f,g,h){var i=Backbone.Model.extend({idAttribute:"pid",TYPE_UNKNOWN:0,TYPE_USER:1,TYPE_USER_GROUP:2,TYPE_RESOURCE:3,TYPE_RESOURCE_GROUP:4,TYPE_EXTERNAL_USER:5,TYPE_DISTLIST:6,TYPE_LABEL:"unknown internal usergroup resource resourcegroup external distlist".split(" "),TYPE_STRINGS:{0:h("Unknown"),1:"",2:h("Group"),3:h("Resource"),4:h("Resource group"),5:h("External contact"),6:h("Distribution list")},defaults:{display_name:"",email1:"",field:"email1",type:5},loading:null,initialize:function(){var a=this;if(_.isString(this.get("type"))){var b=this.TYPE_UNKNOWN;switch(this.get("type")){case"user":b=this.TYPE_USER;break;case"group":b=this.TYPE_USER_GROUP;break;case"resource":b=this.TYPE_RESOURCE;break;case"contact":b=this.get("mark_as_distributionlist")?this.TYPE_DISTLIST:this.TYPE_EXTERNAL_USER}this.set("type",b)}this.get("mail_field")&&this.set("field","email"+this.get("mail_field")),this.loading=this.fetch().then(function(){a.magic()})},magic:function(){this.has("field")&&("email1"===this.get("field")&&this.get("type")===this.TYPE_EXTERNAL_USER&&this.get("internal_userid")?this.set({type:this.TYPE_USER,contact_id:this.get("id"),id:this.get("internal_userid")}):"email1"!==this.get("field")&&this.get("type")===this.TYPE_USER&&this.get("contact_id")&&this.set({type:this.TYPE_EXTERNAL_USER,internal_userid:this.get("id"),id:this.get("contact_id")})),this.get("type")!==this.TYPE_EXTERNAL_USER||this.has("id")||this.set("id",this.getEmail(),{silent:!0}),this.set("pid",[this.TYPE_LABEL[this.get("type")],this.get("id"),this.get("field")].join("_"),{silent:!0}),this.value=this.getTarget()||this.getDisplayName()},getContactID:function(){return this.get(this.get("type")===this.TYPE_USER&&this.get("contact_id")?"contact_id":"id")},getDisplayName:function(){var a=f.getMailFullName(this.toJSON());return a||(""!==this.getEmail()?this.getEmail():"")},getEmail:function(){return f.getMail(this.toJSON())},getTarget:function(a){return a=_.extend({fallback:!1},a),a.fallback&&this.get("type")===this.TYPE_DISTLIST?"distribution_list":this.get(this.get("field"))||this.getEmail()},getFieldString:function(){return this.has("field")?e.fields[this.get("field")]:""},getTypeString:function(){return this.TYPE_STRINGS[this.get("type")]||""},getFieldNumber:function(){return _.isNumber(this.get("mail_field"))?this.get("mail_field"):this.get("field")?parseInt(this.get("field").slice(-1),10):0},getAPIData:function(){var a={type:this.get("type")};if(this.get("field")&&(a.field=this.get("field")),5===this.get("type")){a.mail=this.getTarget();var b=this.getDisplayName(this.toJSON());_.isEmpty(b)||(a.display_name=b)}else this.has("id")&&(a.id=this.get("id"));return a},fetch:function(){var e=this,f=function(a){e.set(a)},g=function(a){e.get("display_name")&&(a=_(a).omit("first_name","last_name","display_name")),e.set(a)};switch(this.get("type")){case this.TYPE_USER:if(this.get("display_name")&&"image1_url"in this.attributes)break;return a.get({id:this.get("id")}).then(f);case this.TYPE_USER_GROUP:if(this.get("display_name")&&this.get("members"))break;return b.get({id:this.get("id")}).then(f);case this.TYPE_RESOURCE:if(this.get("display_name"))break;return c.get({id:this.get("id")}).then(f);case this.TYPE_RESOURCE_GROUP:this.set("display_name","resource group");break;case this.TYPE_EXTERNAL_USER:if(this.get("display_name")&&"image1_url"in this.attributes)break;return this.get("id")&&this.get("folder_id")?d.get(this.pick("id","folder_id")).then(f):d.getByEmailaddress(this.getEmail()).then(g);case this.TYPE_DISTLIST:if(this.get("display_name")&&"distribution_list"in this.attributes)break;return d.get(this.pick("id","folder_id")).then(f)}return $.when()}}),j=Backbone.Collection.extend({model:i,getAPIData:function(){return this.map(function(a){return a.getAPIData()})},initialize:function(){var a=this;this.on("change",function(){var b={},c=[];a.each(function(a){a.id&&(b[a.id]?c.push(a):b[a.id]=!0)}),a.remove(c)}),this.oldAdd=this.add,this.add=this.addUniquely},addUniquely:function(a,b){var c=this;_([].concat(a)).each(function(a){var d;a instanceof c.model&&a.get("mark_as_distributionlist")?d=a.get("distribution_list"):a.mark_as_distributionlist&&(d=a.distribution_list),_([].concat(d||a)).each(function(a){var d=a instanceof c.model?a:new c.model(a);d.loading.then(function(){c.oldAdd(d,b)})})})}});return{Participant:i,Participants:j}}),define("io.ox/participants/views",["io.ox/contacts/api","io.ox/core/util","io.ox/core/folder/api","gettext!io.ox/core","less!io.ox/participants/style"],function(a,b,c,d){var e=Backbone.View.extend({tagName:"div",className:"participant-wrapper",IMG_CSS:"default-image contact-image group-image resource-image resource-image external-user-image group-image".split(" "),events:{"click .remove":"onRemove",keydown:"fnKey"},options:{halo:!1,closeButton:!1,field:!1,customize:$.noop},nodes:{},initialize:function(a){this.options=$.extend({},this.options,a||{}),this.listenTo(this.model,"change",function(a){a&&a.changed&&(this.$el.empty(),this.render())}),this.listenTo(this.model,"remove",function(){this.remove()})},render:function(){return this.$el.append(this.nodes.$img=$("<div>"),this.nodes.$text=$('<div class="participant-name">'),$('<div class="participant-email">').append(this.nodes.$mail=$(this.options.halo?"<a>":"<span>")),$('<div class="extra-decorator">').append(this.nodes.$extra=$("<span>")),$('<a href="#" class="remove" role="button" tabindex="1">').append($('<div class="icon">').append($('<i class="fa fa-trash-o" aria-hidden="true">'),$('<span class="sr-only">').text(d("Remove contact")+" "+this.model.getDisplayName())))).attr({"data-cid":this.model.cid}).toggleClass("removable",this.options.closeButton),this.setCustomImage(),this.setDisplayName(),this.setTypeStyle(),this.options.customize.call(this),this},setDisplayName:function(){b.renderPersonalName({$el:this.nodes.$text,name:this.model.getDisplayName()},this.model.toJSON())},setCustomImage:function(){var b=this.model.toJSON();5===b.type&&delete b.id,a.pictureHalo(this.nodes.$img,b,{width:54,height:54}),this.nodes.$img.addClass("participant-image "+(this.IMG_CSS[parseInt(this.model.get("type"),10)]||""))},setRows:function(a,b){b=b||this.model.getTypeString()||"",this.nodes.$mail.text(d.noI18n(a)),this.nodes.$extra.text(d.noI18n(b)),a&&b&&this.$el.addClass("three-rows")},isOrganizer:function(){if(!this.options.baton)return!1;var a=this.options.baton.model.toJSON();return a.organizerId?this.model.get("id")===a.organizerId:!1},isRemovable:function(){if(!this.options.baton)return!1;var a=this.options.baton.model.toJSON();return this.model.get("id")!==a.organizerId?!0:c.pool.getModel(a.folder_id).is("public")},setTypeStyle:function(){var a=this.model.getTarget(),b=null;switch(a&&this.options.field&&this.model.getFieldString()&&(a+=" ("+this.model.getFieldString()+")"),this.model.get("type")){case 1:case 5:this.isOrganizer()&&(b=d("Organizer"),this.isRemovable()||this.$el.removeClass("removable")),a&&this.options.halo&&this.nodes.$mail.attr({href:"#",tabindex:"1"}).data({email1:a}).addClass("halo-link");break;case 3:if(this.options.halo){var c=this.model.toJSON();c.callbacks={},this.options.baton&&this.options.baton.callbacks&&(c.callbacks=this.options.baton.callbacks);var e=$("<a>").attr({href:"#",tabindex:"1"}).data(c).addClass("halo-resource-link");this.nodes.$extra.replaceWith(e),this.nodes.$extra=e}}this.setRows(a,b)},fnKey:function(a){(46===a.which||8===a.which)&&this.onRemove(a)},onRemove:function(a){a.preventDefault(),this.model.collection.remove(this.model)}}),f=Backbone.View.extend({tagName:"div",className:"participantsrow col-xs-12",initialize:function(a){this.options=a,this.listenTo(this.collection,"add",function(a){this.renderEmptyLabel(),this.renderParticipant(a)}),this.listenTo(this.collection,"remove",function(){this.renderEmptyLabel()}),this.listenTo(this.collection,"reset",function(){this.$ul.empty(),this.renderAll()}),this.$empty=$("<li>").text(d("This list has no contacts yet"))},render:function(){return this.$el.append($("<fieldset>").append($("<legend>").text(this.options.label||d("Participants")),this.$ul=$('<ul class="list-unstyled">'))),this.renderAll()},renderParticipant:function(a){var b=this,c=new e({tagName:"li",model:a,baton:b.options.baton,halo:!0,closeButton:!0}).render().$el.addClass("col-xs-12 col-sm-6");a.get("id")===b.options.baton.model.get("organizerId")?b.$ul.prepend(c):b.$ul.append(c)},renderAll:function(){var a=this;return this.renderEmptyLabel(),this.collection.each(function(b){a.renderParticipant(b)}),this},renderEmptyLabel:function(){return 0===this.collection.length?this.$ul.append(this.$empty):this.$empty.remove(),this.$ul.toggleClass("empty",0===this.collection.length)}});return{ParticipantEntryView:e,UserContainer:f}}),define("io.ox/core/api/autocomplete",["io.ox/core/http","io.ox/core/capabilities","io.ox/contacts/api","io.ox/core/api/resource","io.ox/core/api/group","io.ox/core/extensions","settings!io.ox/contacts"],function(a,b,c,d,e,f,g){function h(a){var g=this;this.options=$.extend({users:!1,contacts:!1,distributionlists:!1,resources:!1,groups:!1,msisdn:!1,split:!0,limit:0},a),this.cache={},this.apis=[],a.users&&this.apis.push({type:"user",api:c}),a.contacts&&this.apis.push({type:"contact",api:c}),a.resources&&this.apis.push({type:"resource",api:d}),a.groups&&this.apis.push({type:"group",api:e}),this.fields=this.options.split?["email1","email2","email3"]:["email1"],this.options.msisdn&&b.has("msisdn")&&(this.fields=this.fields.concat(c.getMapping("msisdn","names"))),f.point("io.ox/core/api/autocomplete/customize").invoke("customize",this),c.on("maybyNewContact",function(){g.cache={}})}return h.prototype={search:function(b){b="string"!=typeof b?"":$.trim(b).toLowerCase();var c=this,d={admin:g.get("showAdmin",!1),emailAutoComplete:!1,limit:this.options.limit};if(b in this.cache)return $.Deferred().resolve(this.cache[b]);try{return a.pause(),$.when.apply($,_(c.apis).map(function(a){return(a.api.autocomplete||a.api.search)(b,d)})).then(function(){var a=[],d=_(arguments).toArray();return _(c.apis).each(function(e,f){var g=_(d[f]).map(function(a){return a.type=e.type,a});a=a.concat(g),/contact|custom|user/.test(e.type)&&(a=c.processContactResults(a,b))}),c.cache[b]=a})}finally{a.resume()}},processContactResults:function(a,b){function c(a){return e[a]?!1:e[a]=!0}var d=[],e={},f=this;return _(a).each(function(a){a.mark_as_distributionlist?f.options.distributionlists&&d.push(a):_.each(f.fields,function(c){if(a[c]){if(6!==a.folder_id&&"user"===a.type)return;if(f.options.users&&6===a.folder_id&&"contact"===a.type)return;"user"===a.type&&a.internal_userid&&(a.contact_id=a.id,a.id=a.internal_userid,delete a.internal_userid);var e=_.extend({},a);e.field=c,a[c]===b?d.unshift(e):d.push(e)}})}),d=_(d).filter(function(a){return c(a.mark_as_distributionlist?_.cid(a):a[a.field])}),e=null,d}},h}),define("io.ox/contacts/model",["io.ox/backbone/modelFactory","io.ox/backbone/validation","io.ox/core/extensions","io.ox/contacts/api","io.ox/core/capabilities","io.ox/settings/util","gettext!io.ox/contacts"],function(a,b,c,d,e,f,g){function h(d,h){var i="io.ox/core/user/model"===d,j=new a({api:h,ref:d,update:function(a){var b=a.changedSinceLoading(),c=b.pictureFile,d=i?f.yellOnReject:_.identity;return c?(delete b.pictureFile,d(h.editNewImage({id:a.id,folder_id:a.get("folder_id")},b,c))):d(h.update({id:a.id,folder:a.get("folder_id"),last_modified:a.get("last_modified"),data:b}))},updateEvents:["edit"],create:function(a){var b,c;return a.attributes.pictureFile?(c=a.get("pictureFile"),b=a.toJSON(),delete b.pictureFile):b=a.toJSON(),h.create(b,c)},destroy:function(a){return h.remove({id:a.id,folder_id:a.get("folder_id")})}});return b.validationFor(d,{display_name:{format:"string"},first_name:{format:"string"},last_name:{format:"string"},second_name:{format:"string"},suffix:{format:"string"},title:{format:"string"},street_home:{format:"string"},postal_code_home:{format:"string"},city_home:{format:"string"},state_home:{format:"string"},country_home:{format:"string"},birthday:{format:"date"},marital_status:{format:"string"},number_of_children:{format:"string"},profession:{format:"string"},nickname:{format:"string"},spouse_name:{format:"string"},anniversary:{format:"date"},note:{format:"text"},department:{format:"string"},position:{format:"string"},employee_type:{format:"string"},room_number:{format:"string"},street_business:{format:"string"},postal_code_business:{format:"string"},city_business:{format:"string"},state_business:{format:"string"},country_business:{format:"string"},number_of_employees:{format:"string"},sales_volume:{format:"string"},tax_id:{format:"string"},commercial_register:{format:"string"},branches:{format:"string"},business_category:{format:"string"},info:{format:"string"},manager_name:{format:"string"},assistant_name:{format:"string"},street_other:{format:"string"},city_other:{format:"string"},postal_code_other:{format:"string"},country_other:{format:"string"},telephone_business1:{format:"phone"},telephone_business2:{format:"phone"},fax_business:{format:"phone"},telephone_callback:{format:"phone"},telephone_car:{format:"phone"},telephone_company:{format:"phone"},telephone_home1:{format:"phone"},telephone_home2:{format:"phone"},fax_home:{format:"phone"},cellular_telephone1:{format:"phone"},cellular_telephone2:{format:"phone"},telephone_other:{format:"phone"},fax_other:{format:"phone"},email1:{format:e.has("msisdn")?"email/phone":"email"},email2:{format:"email"},email3:{format:"email"},url:{format:"url"},telephone_isdn:{format:"phone"},telephone_pager:{format:"phone"},telephone_primary:{format:"phone"},telephone_radio:{format:"phone"},telephone_telex:{format:"phone"},telephone_ttytdd:{format:"phone"},instant_messenger1:{format:"string"},instant_messenger2:{format:"string"},telephone_ip:{format:"phone"},telephone_assistant:{format:"phone"},company:{format:"string"},image1:{format:"string"},userfield01:{format:"string"},userfield02:{format:"string"},userfield03:{format:"string"},userfield04:{format:"string"},userfield05:{format:"string"},userfield06:{format:"string"},userfield07:{format:"string"},userfield08:{format:"string"},userfield09:{format:"string"},userfield10:{format:"string"},userfield11:{format:"string"},userfield12:{format:"string"},userfield13:{format:"string"},userfield14:{format:"string"},userfield15:{format:"string"},userfield16:{format:"string"},userfield17:{format:"string"},userfield18:{format:"string"},userfield19:{format:"string"},userfield20:{format:"string"},links:{format:"array"},distribution_list:{format:"array"},number_of_links:{format:"number"},number_of_images:{format:"number"},image_last_modified:{format:"number"},state_other:{format:"string"},file_as:{format:"string"},image1_content_type:{format:"string"},mark_as_distributionlist:{format:"boolean"},default_address:{format:"number"},image1_url:{format:"url"},internal_userid:{format:"number"},useCount:{format:"number"},yomiFirstName:{format:"string"},yomiLastName:{format:"string"},yomiCompany:{format:"string"},addressHome:{format:"string"},addressBusiness:{format:"string"},addressOther:{format:"string"},private_flag:{format:"boolean"}}),c.point(d+"/validation").extend({id:"upload_quota",validate:function(a){a.quotaExceeded&&this.add("attachments_list",g("Files can not be uploaded, because quota exceeded."))}}),c.point(d+"/validation").extend({id:"birthday",validate:function(a){"birthday"in a&&!_.isNumber(a.birthday)&&this.add("birthday",g("Please set day and month properly"))}}),j}var i={display_name:g("Display name"),first_name:g("First name"),last_name:g("Last name"),second_name:g("Middle name"),suffix:g("Suffix"),title:g.pgettext("salutation","Title"),street_home:g("Street"),postal_code_home:g("Postcode"),city_home:g("Town"),state_home:g("State"),country_home:g("Country"),birthday:g("Date of birth"),marital_status:g("Marital status"),number_of_children:g("Children"),profession:g("Profession"),nickname:g("Nickname"),spouse_name:g("Spouse's name"),anniversary:g("Anniversary"),note:g("Comment"),department:g("Department"),position:g("Position"),employee_type:g("Employee type"),room_number:g("Room number"),street_business:g("Street"),postal_code_business:g("Postcode"),city_business:g("Town"),state_business:g("State"),country_business:g("Country"),number_of_employees:g("Employee ID"),sales_volume:g("Sales Volume"),tax_id:g("TAX ID"),commercial_register:g("Commercial Register"),branches:g("Branches"),business_category:g("Business category"),info:g("Info"),manager_name:g("Manager"),assistant_name:g("Assistant"),street_other:g("Street"),city_other:g("Town"),postal_code_other:g("Postcode"),country_other:g("Country"),telephone_business1:g("Phone (business)"),telephone_business2:g("Phone (business alt)"),fax_business:g("Fax"),telephone_callback:g("Telephone callback"),telephone_car:g("Phone (car)"),telephone_company:g("Phone (company)"),telephone_home1:g("Phone (home)"),telephone_home2:g("Phone (home alt)"),fax_home:g("Fax (Home)"),cellular_telephone1:g("Cell phone"),cellular_telephone2:g("Cell phone (alt)"),telephone_other:g("Phone (other)"),fax_other:g("Fax (alt)"),email1:g(e.has("msisdn")?"Email 1 / Phone number":"Email 1"),email2:g("Email 2"),email3:g("Email 3"),url:g("URL"),telephone_isdn:g("Telephone (ISDN)"),telephone_pager:g("Pager"),telephone_primary:g("Telephone primary"),telephone_radio:g("Telephone radio"),telephone_telex:g("Telex"),telephone_ttytdd:g("TTY/TDD"),instant_messenger1:g("Instant Messenger 1"),instant_messenger2:g("Instant Messenger 2"),telephone_ip:g("IP phone"),telephone_assistant:g("Phone (assistant)"),company:g("Company"),image1:g("Image 1"),userfield01:g("Optional 01"),userfield02:g("Optional 02"),userfield03:g("Optional 03"),userfield04:g("Optional 04"),userfield05:g("Optional 05"),userfield06:g("Optional 06"),userfield07:g("Optional 07"),userfield08:g("Optional 08"),userfield09:g("Optional 09"),userfield10:g("Optional 10"),userfield11:g("Optional 11"),userfield12:g("Optional 12"),userfield13:g("Optional 13"),userfield14:g("Optional 14"),userfield15:g("Optional 15"),userfield16:g("Optional 16"),userfield17:g("Optional 17"),userfield18:g("Optional 18"),userfield19:g("Optional 19"),userfield20:g("Optional 20"),links:g("Links"),distribution_list:g("Distribution list"),state_other:g("State"),mark_as_distributionlist:g("Mark as distributionlist"),default_address:g("Default address"),addressHome:g("Address Home"),addressBusiness:g("Address Business"),addressOther:g("Address Other"),private_flag:g("This contact is private and cannot be shared"),number_of_links:"Number of links",number_of_images:"Number of images",image_last_modified:"Image last modified",file_as:"File as",image1_content_type:"Image1 content type",image1_url:"Image1 url",internal_userid:"Internal userid",useCount:"use Count",yomiFirstName:"yomi First Name",yomiLastName:"yomi Last Name",yomiCompany:"yomi Company"},j=h("io.ox/contacts/model",d);return{Contact:j.model,Contacts:j.collection,factory:j,api:d,fields:i,protectedMethods:{buildFactory:h}}}),define("io.ox/backbone/modelFactory",["io.ox/backbone/basicModel","io.ox/core/extensions"],function(a,b){function c(a,b){var c={},d={},e=this,f=0;this.internal={cachedServerAttributes:function(a){return d[a]||{}}},this.create=function(a){var e=new b.model(a),f=b.internal.toUniqueIdFromObject(a);return c[f]=e,d[f]=JSON.parse(JSON.stringify(e.toJSON())),e},this.get=function(){var a=$.makeArray(arguments),f=b.internal.toUniqueIdFromGet.apply(b,a),g=$.Deferred();return c[f]?$.Deferred().resolve(c[f]):(b.internal.load.apply(b.internal,a).done(function(a){a._realm=e;var f=new b.model(a);c[f.id]=f,d[f.id]=JSON.parse(JSON.stringify(f.toJSON())),g.resolve(f)}).fail(g.reject),g)},this.getAll=function(){var a=$.Deferred();return b.internal.loadAll.apply(b.internal,$.makeArray(arguments)).done(function(){e.getList.apply(e,$.makeArray(arguments)).done(a.resolve).fail(a.reject)}).fail(a.reject),a},this.getList=function(){function a(){var a=_(g).map(function(a){return c[a.uid]});f.resolve(a)}var f=$.Deferred(),g=b.internal.componentizeList.apply(b.internal,$.makeArray(arguments)),h=[];return _(g).each(function(a){c[a.uid]||h.push(a.id)}),_.isEmpty(h)?(a(),f):(b.internal.loadBulk(h).done(function(f){_(f).each(function(a){a._realm=e;var f=b.create(a);c[f.id]=f,d[f.id]=JSON.parse(JSON.stringify(f.toJSON()))}),a()}).fail(f.reject),f)},this.refresh=function(a,b){if(c[a]){var e=c[a];_(e.attributes).each(function(a,b){/^_/.test(b)||e.unset(b,{silent:!0})}),e.set(b),d[a]=JSON.parse(JSON.stringify(e.toJSON()))}},this.markDestroyed=function(a){if(c[a]){var b=c[a];delete c[a],b.trigger("destroy",b)}},this.destroy=function(){_(c).each(function(a){a.off()}),c={}},this.retain=function(){return f++,this},this.release=function(){f--,0>=f&&(f=0,this.destroy())},b.point("realm").invoke("extend",this)}function d(a){function d(a){var b=f.internal.toUniqueIdFromObject(a);return a._uid=b,a}this.internal={};var f=this,g={};this.realm=function(a){return a?g[a]||(g[a]=new c(a,this)):this.realm("default")},this.model=e.extend(_.extend({factory:this},a.model||{})),this.collection=Backbone.Collection.extend({model:this.model,sync:function(){return f.point("collection/sync").invoke("sync",this,$.makeArray(arguments))}}),this.api=a.api,this.ref=a.ref,this.internal.load=a.load||function(){var a=$.makeArray(arguments);return f.api.get.apply(f.api,a).then(d)},this.internal.loadAll=a.loadAll||function(){return f.api.getAll.apply(f.api,$.makeArray(arguments))},this.internal.loadBulk=a.loadBulk||function(a){return f.api.getList(a).then(function(a){return _(a).each(d),a})},this.internal.create=a.create||function(a){return f.api.create(a.toJSON())},this.internal.read=a.read||function(a){return f.api.get({id:a.get("id"),folder:a.get("folder")||a.get("folder_id")}).done(function(b){a.realm.refresh(f.internal.toUniqueIdFromObject(b),b)})},this.internal.update=a.update||function(b){var c=null;return a.getUpdatedAttributes?c=a.getUpdatedAttributes(b):(c=b.changedSinceLoading(),c.id=b.id,c.last_modified=b.get("last_modified"),c.folder||(c.folder=b.get("folder")||b.get("folder_id"))),f.api.update(c)},this.internal.destroy=a.destroy||function(a){return f.api.remove({id:a.id,folder:a.get("folder_id")||a.get("folder")})},this.internal.toUniqueId=a.toUniqueId||function(a){return a.id},this.internal.toUniqueIdFromGet=a.toUniqueIdFromGet||this.internal.toUniqueId,this.internal.toUniqueIdFromObject=a.toUniqueIdFromObject||this.internal.toUniqueId,this.internal.eventToGetArguments=a.eventToGetArguments||function(a,b){return[{id:b.id,folder:b.folder||b.folder_id}]},this.internal.componentizeList=a.componentizeList||function(a){return _(a).map(function(a){return{uid:f.internal.toUniqueIdFromObject(a),id:a}})},/\/$/.test(this.ref)||(this.ref=this.ref+"/"),this.point=this.point||function(a){return/^\//.test(a)&&(a=a.substring(1)),b.point(this.ref+a)},this.get=this.get||function(){var a=this.realm("default");return a.get.apply(a,$.makeArray(arguments))},this.getAll=this.getAll||function(){var a=this.realm("default");return a.getAll.apply(a,$.makeArray(arguments))},this.getList=this.getList||function(){var a=this.realm("default");return a.getList.apply(a,$.makeArray(arguments))},this.create=this.create||function(a){if(a=a||{},a.id){var b=this.realm("default");return b.create(a)}return new this.model(a)},this.createCollection=this.createCollection||function(a){return new this.collection(a)},this.internal.updateEvents=a.updateEvents||["update"],this.internal.destroyEvents=a.destroyEvents||["delete"],_(this.internal.updateEvents).each(function(a){f.api.on(a,function(){var a=f.internal.eventToGetArguments.apply(f,$.makeArray(arguments)),b=f.internal.toUniqueIdFromGet.apply(f,a);f.api.get.apply(f.api,a).done(function(a){_(g).each(function(c){c.refresh(b,a)})})})}),_(this.internal.destroyEvents).each(function(a){f.api.on(a,function(){var a=f.internal.eventToGetArguments.apply(f,$.makeArray(arguments)),b=f.internal.toUniqueIdFromGet.apply(f,a);_(g).each(function(a){a.markDestroyed(b)})})}),this.point("validation").extend({id:"generic",validate:function(a,b){_(a).each(function(c,d){var e=f.point("validation/"+d).invoke("validate",b,c,b,a,d).value();_(e).each(function(a){a&&(_.isArray(a)?_(a).each(function(a){b.add(d,a)}):b.add(d,a))})})}}),this.wrap=function(a){return arguments.length>1?this.createCollection(_(arguments).map(function(a){return f.wrap(a)})):a.attributes&&a.factory===this?a:this.create(a)},_($.makeArray(arguments).splice(1)).each(function(a){_.extend(f,a)})}var e=a.extend({idAttribute:"_uid",initialize:function(){a.prototype.initialize.apply(this,$.makeArray(arguments)),this.realm=this.get("_realm")||this.factory.realm("default"),delete this.attributes._realm,this.syncer=this.factory.internal;var b=this;this.on("sync",function(){b.touchedAttributes={}})},point:function(a){return this.factory.point(a)},touch:function(){var a=this;this.touchedAttributes=this.touchedAttributes||{},_(arguments).each(function(b){a.touchedAttributes[b]=!0})},changedSinceLoading:function(){var a=this,b=this.realm.internal.cachedServerAttributes(this.id)||{},c=this.attributes,d={},e={};return _(b).chain().keys().each(function(a){d[a]=1}),_(c).chain().keys().each(function(a){d[a]=1}),_(d).chain().keys().each(function(d){var f=b[d],g=c[d],h=!1;a.touchedAttributes&&a.touchedAttributes[d]?e[d]=g:f!==g&&(_.isArray(f)&&_.isArray(g)?(0!==_(f).difference(g).length||0!==_(g).difference(f).length)&&(f.length!==g.length?h=!0:_.each(g,function(a,b){_.each(g[b],function(a,c){void 0===f[b]?h=!0:a!==f[b][c]&&(h=!0)})}),h===!0&&(e[d]=g)):e[d]=g)}),e},isDirty:function(){return!_.isEmpty(this.changedSinceLoading())},getCompositeId:function(){return(this.get("folder")||this.get("folder_id"))+"."+(this.get("id")||"new-object")}});return d}),define("io.ox/backbone/validation",["io.ox/core/extensions","io.ox/core/util","settings!io.ox/core","gettext!io.ox/core"],function(a,b,c,d){var e=function(a){return _.isUndefined(a)||null===a||""===a},f={string:function(){return!0},text:function(){return!0},anyFloat:function(a){a=String(a).replace(/,/g,".").replace(/\.0*$/,"");var b=e(a)||!isNaN(parseFloat(a,10))&&parseFloat(a,10).toString().length===a.toString().length;return b||d("Please enter a valid number")},number:function(a){var b=e(a)||!isNaN(parseFloat(a,10))&&parseFloat(a,10).toString().length===a.toString().length;return b||d("Please enter a valid number")},array:function(a){return _.isArray(a)||"Please enter a valid array"},"boolean":function(a){return _.isBoolean(a)||"Please enter a bool"},date:function(a){return null!==a&&!_.isNumber(a)||a>0xe677ccf98008?d("Please enter a valid date"):!0},pastDate:function(a){return _.isString(a)&&""!==a?d("Please enter a valid date"):_.now()>a||d("Please enter a date in the past")},email:function(a){return c.get("features/validateMailAddresses",!0)===!1||b.isValidMailAddress(a)||d("Please enter a valid email address")},phone:function(a){return c.get("features/validatePhoneNumbers",!1)===!1||b.isValidPhoneNumber(a)||d("Please enter a valid phone number. Allowed characters are: %1$s","0-9 , . - ( ) # + ; /")},"email/phone":function(a){return c.get("features/validateMailAddresses",!0)===!1||b.isValidMailAddress(a)||c.get("features/validatePhoneNumbers",!1)===!1||b.isValidPhoneNumber(a)||d("Please enter a valid email address or phone number")},url:function(){return!0},object:function(a){return _.isObject(a)||d("Please enter a valid object")}};return a.point("io.ox/backbone/validation/formats").invoke("customize",f,f),a.point("io.ox/backbone/validation/formats").on("extended",function(a){a.invoke("customize",f,f)}),{validationFor:function(b,c){var g=b+(/\/$/.test(b)?"validation":"/validation");_(c).each(function(b,c){a.point(g+"/"+c).extend({id:b.id||c,validate:function(a,d,e){var g=[];if(b.format&&f[b.format]){var h=f[b.format].call(d,a);h!==!0&&g.push(h)}if(b.fn){var i=b.fn.apply(d,a,d,e,c);i&&(_.isArray(i)?_(i).each(function(a){g.push(a)}):g.push(i))}return g}}),b.mandatory&&a.point(g+"/save").extend({id:c+"-is-mandatory",validate:function(a,b){var f=a[c];e(f)&&b.add(c,d("Please enter a value"))}})})},formats:f}}),define("io.ox/backbone/basicModel",["io.ox/core/extensions","gettext!io.ox/core"],function(a,b){function c(){this.errors={},this.add=function(a,b){return(this.errors[a]||(this.errors[a]=[])).push(b),this},this.hasErrors=function(){return!_.isEmpty(this.errors)},this.errorsFor=function(a){return this.errors[a]},this.each=function(){var a=_(this.errors);return a.each.apply(a,$.makeArray(arguments))}}var d=Backbone.Model.extend({initialize:function(a){var b=this;this._valid=!0,this.attributeValidity={},this.id=a.id,this.on("change:id",function(){b.id=b.get("id")}),this.init&&this.init(),this.url=this.url||"invalidURL"},point:function(b){return/^\//.test(b)&&(b=b.substring(1)),a.point(this.ref+b)},validate:function(a,b,d){d=d||{};var e=this,f=new c;if(a=a||this.toJSON(),this.point("validation").invoke("validate",f,a,f,this),d.isSave&&this.point("validation/save").invoke("validate",f,a,f,this),f.hasErrors()){var g={};_(a).chain().keys().each(function(a){g[a]=!0}),f.each(function(a,b){g[b]=!1,e.trigger("invalid:"+b,a,f,e)}),_(e.attributeValidity).each(function(a,b){!a&&g[b]&&e.trigger("valid:"+b,e)}),e.attributeValidity=g,e.trigger("invalid",f,e),e.errors=f,e._valid=!1}else e._valid||(_(e.attributeValidity).each(function(a,b){a||e.trigger("valid:"+b,e)}),_(a).chain().keys().each(function(a){e.attributeValidity[a]=!0}),e._valid=!0,this.trigger("valid"))},parse:function(){return{}},sync:function(a,c,d){var e=this;if("delete"===a&&(a="destroy"),("update"===a||"create"===a)&&!this.isValid({isSave:!0})){var f=b("The dialog contains invalid data"),g=this.errors.errors;return 1===_(g).size()&&_.isString(g[_(g).keys()[0]][0])&&(f=g[_(g).keys()[0]]),$.Deferred().reject({error:f,model:this})}if(this.syncer)return this.trigger(a+":start"),this.trigger("sync:start"),this.syncer[a](c).done(function(b){d.success(c,b),e.trigger(a,b),e.trigger("sync",b)}).fail(function(f,g){!g||404!==g.status&&0!==g.status||(f.error=b("Server unreachable")),d.error(c,f),e.trigger("backendError",f,g),e.trigger(a+":fail",f),e.trigger("sync:fail",f)}).always(function(){e.trigger(a+":always"),e.trigger("sync:always")});throw new Error("No Syncer specified!")},isSet:function(){var a=this;return _(arguments).all(function(b){return a.has(b)&&""!==a.get(b)})},isAnySet:function(){var a=this;return _(arguments).any(function(b){return a.has(b)&&""!==a.get(b)})},isValid:function(a){return this.validate(this.toJSON(),null,a),this._valid},hasValidAttributes:function(){var a=this;return _(arguments).all(function(b){

return a.attributeValidity[b]})},invalidAttributes:function(){var a=this;return _(this.attributeValidity).chain().keys().filter(function(b){return!a.attributeValidity[b]}).values()._wrapped}});return d}),define("io.ox/settings/util",["io.ox/core/notifications","gettext!io.ox/core"],function(a,b){return{destroy:function(){a.yell("destroy")},yellOnReject:function(c,d){if(!(c&&c.promise&&c.done))return $.when();var e=$.extend({debug:!1},d||{});return e.debug&&c.always(function(){var a=_.isArray(this)?this:[this];_.each(a,function(a){a.state?console.warn("NOTIFIY: "+a.state()):c.state&&console.warn("NOTIFIY: "+c.state())})}),c.fail(function(c){var d=$.extend({type:"error",error:"unknown",error_params:[]},c||{});"MAIL_FILTER-0015"===d.code?d.message=b("Unable to load mail filter settings."):d.error&&(d.message=d.error),a.yell(d)})}}}),define("io.ox/core/api/snippets",["io.ox/core/http","io.ox/core/event"],function(a,b){var c={},d=null;return b.extend(c),c.getAll=function(){return d?$.Deferred().resolve(d):a.GET({module:"snippet",params:{action:"all"}}).then(function(a){return d=_(a).map(function(a){return a.misc=$.extend({insertion:"below"},a.misc||{}),a})},function(){return d=null,[]})},c.create=function(b){return a.PUT({module:"snippet",params:{action:"new"},data:b}).done(function(){d=null,c.trigger("refresh.all")})},c.update=function(b){return a.PUT({module:"snippet",params:{action:"update",id:b.id},data:b}).done(function(){d=null,c.trigger("refresh.all")})},c.get=function(b){return a.GET({module:"snippet",params:{action:"get",id:b}})},c.list=function(b){return a.PUT({module:"snippet",params:{action:"list"},data:b})},c.destroy=function(b){return a.GET({module:"snippet",params:{action:"delete",id:b}}).done(function(){d=null,c.trigger("refresh.all")})},c}),define.async("io.ox/core/tk/contenteditable-editor",["io.ox/core/emoji/util","io.ox/core/capabilities","io.ox/core/extensions","io.ox/core/tk/textproc","io.ox/mail/api","settings!io.ox/core","settings!io.ox/mail","gettext!io.ox/core","less!io.ox/core/tk/contenteditable-editor"],function(a,b,c,d,e,f,g,h){function i(a){var b=a.selection.getRng();b.collapsed||(a.execCommand("Delete",!1,null),b=a.selection.getRng());var c,d=b.commonAncestorContainer,e=null;for(c=function(a){var b;if(a)if(a.hasChildNodes())for(b=0;b<a.childNodes.length;b++){if(1===a.childNodes[b].nodeType)return void c(a.childNodes[b]);3===a.childNodes[b].nodeType&&(a.childNodes[b].nodeValue=a.childNodes[b].nodeValue.replace("​",""))}else"BR"===a.nodeName&&(e=a)};d&&!/mce-content-body/.test(d.className);){b.setEndAfter(d);var f=d.parentNode,g=b.extractContents();c(g.firstChild),$(g).text().length>0&&f.insertBefore(g,d.nextSibling);try{var h,i,j=$(f).children("ol + ol");j.length>0&&(h=j.prev(),i=h.children("li").length+1,j.attr("start",i))}catch(k){ox.debug&&console.error(k)}d=f}if(e)try{e.parentNode.removeChild(e)}catch(k){ox.debug&&console.error(k)}var l=a.getDoc().createElement("span");l.innerHTML="&nbsp;";var m=a.getDoc().createElement("p");m.appendChild(l),b.insertNode(m),a.selection.select(l),a.execCommand("Delete",!1,null)}function j(a){var b=a.commonAncestorContainer||a.parentElement(),c=$(b).parents("blockquote").last(),d=c.length>0;return d}function k(a,b){var c=a.selection.getRng();j(c)&&c.startContainer&&(_.device("IE")||(i(a),a.dom.events.cancel(b)))}function l(){var a=ox.language,b=["ar","ar_SA","az","be","bg_BG","bn_BD","bs","ca","cs","cy","da","de","de_AT","dv","el","en_CA","en_GB","es","et","eu","fa","fi","fo","fr_FR","gd","gl","he_IL","hr","hu_HU","hy","id","is_IS","it","ja","ka_GE","kk","km_KH","ko_KR","lb","lt","lv","ml","ml_IN","mn_MN","nb_NO","nl","pl","pt_BR","pt_PT","ro","ru","si_LK","sk","sl_SI","sr","sv_SE","ta","ta_IN","tg","th_TH","tr_TR","tt","ug","uk","uk_UA","vi","vi_VN","zh_CN","zh_TW"],c=_.indexOf(b,a,!0);return"fr_CA"===a?"fr_FR":c>-1?b[c]:(c=_.indexOf(b,a.substr(0,2),!0),c>-1?b[c]:"en")}function m(i,j){function k(a){return String(a||"").replace(/[\s\xA0]+$/g,"")}function m(a){var b=Math.round(.9*f.get("maxUploadIdleTimeout",2e5));D.push(setInterval(j.keepalive||e.keepalive,b,a))}function o(){_(D).each(clearInterval)}var p,q,r,s=$.Deferred(),t=$.Deferred(),u=i.data("editorId");i.append(i=$('<div class="contenteditable-editor">').attr({"data-editor-id":u}).append(q=$('<div class="editable-toolbar">').attr("data-editor-id",u),r=$('<div class="editable" tabindex="1" role="textbox" aria-multiline="true">').attr({"aria-label":h("Rich Text Area. Press ALT-F10 for toolbar")}).css("margin-bottom","32px"))),j=_.extend({toolbar1:"undo redo | bold italic | emoji | bullist numlist outdent indent",advanced:"styleselect fontselect fontsizeselect | forecolor backcolor | link image",toolbar2:"",toolbar3:"",plugins:"autolink oximage oxpaste oxdrop link paste textcolor emoji lists",theme:"unobtanium",skin:"lightgray"},j),r.addClass(j["class"]),j.toolbar1+=" | "+j.advanced,j.toolbar1=f.get("tinyMCE/theme_advanced_buttons1",j.toolbar1),j.toolbar2=f.get("tinyMCE/theme_advanced_buttons2",j.toolbar2),j.toolbar3=f.get("tinyMCE/theme_advanced_buttons3",j.toolbar3),b.has("emoji")||(j.toolbar1=j.toolbar1.replace(/( \| )?emoji( \| )?/g," | "),j.toolbar2=j.toolbar2.replace(/( \| )?emoji( \| )?/g," | "),j.toolbar3=j.toolbar3.replace(/( \| )?emoji( \| )?/g," | "),j.plugins=j.plugins.replace(/emoji/g,"").trim());var v='.editable-toolbar[data-editor-id="'+u+'"]';window.cordova&&(j.toolbar="false",j.toolbar1="false",j.toolbar2="false",j.toolbar3="false",j.plugins="autolink paste");var w={script_url:(window.cordova?ox.localFileRoot:ox.base)+"/apps/3rd.party/tinymce/tinymce.jquery.min.js",extended_valid_elements:"blockquote[type]",inline:!0,fixed_toolbar_container:v,menubar:!1,statusbar:!1,skin:j.skin,toolbar1:j.toolbar1,toolbar2:j.toolbar2,toolbar3:j.toolbar3,relative_urls:!1,remove_script_host:!1,entity_encoding:"raw",forced_root_block:(g.get("simpleLineBreaks",!0),"p"),browser_spellcheck:!0,plugins:j.plugins,link_title:!1,target_list:!1,link_assume_external_targets:!0,language:l(),hidden_input:!1,theme:j.theme,init_instance_callback:function(a){p=a,t.resolve()},execcommand_callback:function(a,b,c){"createlink"===c&&_.defer(function(){$(tinyMCE.get(a).getBody()).find("a").attr({target:"_blank",rel:"noopener"})})},paste_preprocess:d.paste_preprocess,paste_postprocess:d.paste_postprocess,setup:function(a){j.oxContext&&(a.oxContext=j.oxContext),c.point(n+"/setup").invoke("draw",this,a),a.on("BeforeRenderUI",function(){s.resolve()})}};c.point(n+"/options").invoke("config",w,j.oxContext),r.tinymce(w);var x=function(a){return a.replace(/<[a-z][^>]*\sdata-mce.*?>/gi,function(a){return a.replace(/\sdata-mce-\S+=("[^"]*"|'[^']*')/g,"")})},y=_.debounce(function(){if(null!==i){var a=i.parent().find(".mail-compose-fields").height();if(_.device("smartphone")&&$(".io-ox-mobile-mail-compose-window").length>0){var b=i.parent().parent().height();return void r.css("min-height",b-a-32)}if(_.device("smartphone")){a=i.parent().find(".mail-compose-fields").height();var c=$("#io-ox-topbar").height(),d=i.parents().find(".window-header").height(),e=30;return void r.css("min-height",window.innerHeight-(a+c+d+e))}var f=$(window).height(),g=r.offset().top;r.css("min-height",f-g-40+"px"),j.css&&r.css(j.css);var h=$(v+" > div").height(),k=$(v).next().outerWidth();h&&$(v).css("height",h+1),k&&$(v).css("width",k)}},30),z=function(b){var c=a.processEmoji(b,function(a,b){b.loaded&&p.setContent(a)});p.setContent(c),/position:(\s+)?absolute/i.test(b)&&$(p.getBody()).find("[style*=absolute]").css("position","static"),/white-space:(\s+)?nowrap/i.test(b)&&$(p.getBody()).find("[style*=nowrap]").css("white-space","normal")},A=function(){z("")},B=function(a){return String(a||"").replace(/\r/g,"").replace(new RegExp("\\n","g"),"<br>")},C=function(){$(p.getBody()).find(".mce-resizehandle").remove();var b=p.getContent({format:"raw"});return b=a.imageTagsToUnified(b),b=x(b),b=b.replace(/<(\w+)[ ]?\/>/g,"<$1>").replace(/(<p>(<br>)?<\/p>)+$/,""),b=b.replace(/(\s|&nbsp;|\0x20|<br\/?>|<p( class="io-ox-signature")>(&nbsp;|\s|<br\/?>)*<\/p>)*$/g,""),k(b)};this.content_type=j.model&&"alternative"===j.model.get("preferredEditorMode")?"ALTERNATIVE":"text/html",this.done=function(a){var b=this;return $.when(t,s).then(function(){return a(b),b})},this.focus=function(){_.device("ios")||_.defer(function(){p.focus(),p.execCommand("mceFocus",!1,u)})},this.ln2br=B,this.clear=A,this.getContent=C,this.getPlainText=function(){return d.htmltotext($(p.getBody()).html())},this.setContent=z,this.setPlainText=function(a){return(a=k(a))?d.texttohtml(a).then(function(a){/^<blockquote\>/.test(a)&&(a="<p><br></p>"+a),z(a),p.undoManager.clear()}):void 0},this.paste=function(a){p.execCommand("mceInsertClipboardContent",!1,{content:a})},this.scrollTop=function(a){var b=$(p.getDoc());return void 0===a?b.scrollTop():void("top"===a?b.scrollTop(0):"bottom"===a&&b.scrollTop(b.get(0).body.scrollHeight))},this.setCaretPosition=function(){$(p.getDoc()).scrollTop(0)},this.appendContent=function(a){var b=this.getContent();a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",b=b.replace(/^(<p><br><\/p>){2,}/,"").replace(/(<p><br><\/p>)+$/,"")+"<p><br></p>"+a,/^<blockquote/.test(b)&&(b="<p><br></p>"+b),this.setContent(b)},this.prependContent=function(a){var b=this.getContent();a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",b=a+"<p><br></p>"+b.replace(/^(<p><br><\/p>)+/,"").replace(/(<p><br><\/p>){2,}$/,""),b="<p><br></p>"+b,this.setContent(b)},this.setContentParts=function(a,b){var c="";a=_.isString(a)?{content:a}:a,a.content&&(c+=a.content),"above"===b&&a.cite&&(c+="\n\n"+a.cite),a.quote&&(c+="\n\n"+a.quote||""),"below"===b&&a.cite&&(c+="\n\n"+a.cite),this.setContent(c)},this.getContentParts=function(){var a=this.getContent(),b=a.indexOf('<blockquote type="cite">');return"<blockquote><p>"===a.substring(0,15)&&(b=0),"<p><br></p><blockquote>"===a.substring(0,23)&&(b=0),0>b?{content:a}:{content:a.substring(0,b).replace(/\s+$/g,""),quote:a.substring(b),cite:void 0}},this.insertPrevCite=function(a){var b=this.getContentParts();a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",b.cite=a,this.setContentParts(b,"above")},this.replaceParagraph=function(a,b){var c,d,e=this.getContent();return a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",(c=e.indexOf(a))>-1?(d=this.scrollTop(),this.setContent(e.substr(0,c)+(b||"")+e.substr(c+a.length)),this.scrollTop(d),!0):!1},this.removeContent=function(a){this.replaceContent(a,"")},this.find=function(a){return $(p.getDoc()).find(a)},this.replaceContent=function(a,b){function c(){p.selection.setContent(b||"")}var d,e=p.getWin(),f=!1;if(p.selection.select(p.getBody(),!0),p.selection.collapse(!0),_.browser.IE)for(p.focus(),d=p.getDoc().selection.createRange();d.findText(a,1,0);)d.scrollIntoView(),d.select(),c(),f=!0;else for(;e.find(a,0,0,!1,!1,!1,!1);)c(),f=!0;return f},this.getMode=function(){return"html"},this.tinymce=function(){return r.tinymce?r.tinymce():{}},this.show=function(){i.show(),$(v).css("display",""),y(),$(window).on("resize.tinymce",y),$(window).on("orientationchange.tinymce",function(){_.delay(y,50)})},this.hide=function(){i.hide(),$(window).off("resize.tinymce orientationchange.tinymce")},function(){if(!_.device("smartphone")){var a=j.scrollpane||j.app&&j.app.getWindowNode(),b=!1,c=14;a.on("scroll",function(){a.scrollTop()-a.find(".mail-compose-fields").height()>c?(b||(b=!0,q.addClass("fixed").css("top",j.view.$el.parent().offset().top),$(window).trigger("resize.tinymce")),r.css("margin-top",q.height())):b&&(b=!1,q.removeClass("fixed").css("top",0),r.css("margin-top",0))})}}(),this.destroy=function(){this.hide(),o(),r.tinymce()&&(r.empty(),r.tinymce().remove()),i=r=r.tinymce=t=s=p=null};var D=[];r.on("addInlineImage",function(a,b){m(b)})}var n="io.ox/core/tk/contenteditable-editor",o=0;return c.point(n+"/setup").extend({id:"default",index:o+=100,draw:function(a){a.on("keydown",function(b){13===(b.keyCode||b.which)&&k(a,b)}),c.point("3rd.party/emoji/editor_css").each(function(b){var c=a.convertURL(require.toUrl(b.css));a.contentCSS.push(c)})}}),c.point(n+"/setup").extend({id:"emoji",index:o+=100,draw:function(a){c.point("3rd.party/emoji/editor_css").each(function(b){var c=a.convertURL(require.toUrl(b.css));a.contentCSS.push(c)})}}),c.point(n+"/setup").extend({id:"list-style-position",index:o+=100,draw:function(a){a.on("NodeChange",function(a){"LI"===a.element.nodeName&&"left"!==a.element.style.textAlign&&""!==a.element.style.textAlign&&$(a.element).css("list-style-position","inside")})}}),window.tinyMCE?$.Deferred().resolve(m):require(["3rd.party/tinymce/jquery.tinymce.min"]).then(function(){return m})}),define("io.ox/core/tk/textproc",["io.ox/core/emoji/util"],function(a){return{paste_preprocess:function(b,c){c.content=c.content.replace(/<!--(.*?)-->/g,"").replace(/<img[^>]* data-emoji-unicode=\"([^\"]*)\"[^>]*>/gi,"$1"),c.content=a.processEmoji(c.content)},paste_postprocess:function(a,b){function c(a,b){var c,d=$(b),e=b.tagName,f=d.children(),g=!0;if("DIV"===e&&d.attr("id")&&-1!==d.attr("id").indexOf("ox-text-p")&&(g=!1),d.removeAttr("id title alt rel"),/^(BR|HR|IMG)$/.test(e))return a;if(d.attr("align")&&d.css("textAlign",d.attr("align")).removeAttr("align"),d.contents().each(function(){3===b.nodeType&&(b.nodeValue=b.nodeValue.replace(/:$/,": "))}),0===f.length)if(c=d.text().match(/^[ \t]$/)?d.text:$.trim(d.text()),""===c){if("TD"!==e)return d.remove(),!1;d.text(" ")}else{if(/^(SPAN|SMALL|PRE)$/.test(e)&&!d.attr("class")&&!d.attr("style"))return d.replaceWith($.txt(d.text())),!1;/^".+"$/.test(c)&&d.text(c.replace(/^"/,"“").replace(/"$/,"”"))}else if("DIV"===e&&!d.attr("class")&&!d.attr("style")&&g)return f.eq(0).unwrap(),!1;return a}function d(){var a=$(this),b=a.contents();1===b.length&&"BR"===b.get(0).tagName&&a.remove()}function e(){$(this).children().first().unwrap()}function f(){var a=$(this),b=a.attr("style"),c=$("<p>");b&&c.attr("style",b),a.replaceWith(c.append(a.contents()))}function g(){var a=$(this);a.replaceWith($("<em>").text(a.text()))}function h(){var a,b=$(this);b.attr("href")?(b.removeAttr("title target"),/^\[\d+\]$/.test(b.text())&&/^#/.test(b.attr("href"))&&(a=String(b.text()).match(/^\[(\d+)\]$/),b.replaceWith($("<sup>").text(a[1]).add($.txt(" "))))):b.replaceWith(b.contents())}function i(){var a=$(this);a.removeAttr("width").attr({border:"0",cellSpacing:"0",cellPadding:"0"}).css({lineHeight:"1em",margin:"0.5em auto 0.5em auto"}),a.find("th").css({fontWeight:"bold",textAlign:"center",borderBottom:"1px solid #555",padding:"0.4em 1em 0.4em 1em"}),a.find("td").css({borderBottom:"1px solid #aaa",padding:"0.4em 1em 0.4em 1em"}),a.find("tr").first().find("td, th").css({borderTop:"1px solid #555"}),a.find("tr").last().find("td, th").css({borderBottom:"1px solid #555"})}var j,k=$(b.node);k.find("iframe, object, applet, input, textarea, button, select, canvas, script, noscript, audio, video, img").filter(':not(img.emoji,img[src*="'+ox.abs+ox.root+'/api/file"],img[data-pending="true"])').remove(),k.find("sup").css("lineHeight","0"),k.find("article, header, footer, section, form").each(e),k.find("a").each(h),k.find("code").each(g);do j=_(k.find("*")).inject(c,!0);while(!j);k.find("table").each(i),k.eq(0).children("div").each(f),k.find("p").each(d)},htmltotext:function(a){function b(a,b){var c,d="void"===b.type?"<"+b.tag+"\\b([^>]*)\\/?>":"<"+b.tag+"\\b([^>]*)>([\\s\\S]*?)<\\/"+b.tag+">",e=new RegExp(d,"gi");return c="string"==typeof b.replacement?a.replace(e,b.replacement):a.replace(e,function(a,c,d,e){return b.replacement.call(this,a,c,d,e)})}function c(a){return new RegExp(a+"\\s*=\\s*[\"']?([^\"']*)[\"']?","i")}function d(a){return a=a.replace(/<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi,function(a,b,c){function d(a,b){return b=b.replace(/^\s+/,"").replace(/\n\n/g,"\n\n ").replace(/\n([ ]*)+(\*|\d+\.) /g,"\n$1 $2 ")}var e=c.split("</li>");e.splice(e.length-1,1);for(var f=0,g=e.length;g>f;f++){if(e[f]){var h="ol"===b?f+1+". ":"* ";e[f]=h+e[f].replace(/\s*<li[^>]*>([\s\S]*)/i,d)}e[f]=e[f].replace(/(.) +$/m,"$1")}return e.join("\n")}),"\n\n"+a.replace(/[ \t]+\n|\s+$/g,"")}function e(a){return a.replace(/<blockquote\b[^>]*>([\s\S]*?)<\/blockquote>/gi,function(a,b){return b=b.replace(/^\s+|\s+$/g,""),b=f(b),b=b.replace(/^/gm,"> ").replace(/^(>([ \t]{2,}>)+)/gm,"> >")})}function f(a){return a.replace(/<!--(.*?)-->/g,"").replace(/<img[^>]* data-emoji-unicode=\"([^\"]*)\"[^>]*>/gi,"$1").replace(/(<\/?\w+(\s[^<>]*)?\/?>)/g,"").replace(/^[\t\r\n]+|[\t\r\n]+$/g,"").replace(/\n\s+\n/g,"\n\n").replace(/\n{3,}/g,"\n\n").replace(/&nbsp;/g," ").replace(/>/g,">").replace(/</g,"<").replace(/&amp;/g,"&")}for(var g=[{patterns:"p",replacement:function(a,b,c){return c?"\n\n"+c+"\n":""}},{patterns:["br"],type:"void",replacement:"\n"},{patterns:"h([1-6])",replacement:function(a,b,c,d){return"\n\n"+d+"\n"}},{patterns:"hr",type:"void",replacement:"\n\n---\n"},{patterns:"a",replacement:function(a,b,d){var e=b.match(c("href"));return e&&0===e[1].indexOf("mailto:")?e[1].substr(7):e&&d===e[1]?d:"["+(d||"")+"]("+(e&&e[1]||"")+")"}}],h=0,i=g.length;i>h;h++)if("string"==typeof g[h].patterns)a=b(a,{tag:g[h].patterns,replacement:g[h].replacement,type:g[h].type});else for(var j=0,k=g[h].patterns.length;k>j;j++)a=b(a,{tag:g[h].patterns[j],replacement:g[h].replacement,type:g[h].type});a=a.replace(/<pre\b[^>]*>`([\s\S]*?)`<\/pre>/gi,function(a,b){var c=b;return c=c.replace(/^\t+/g," "),c=c.replace(/\n/g,"\n "),"\n\n "+c+"\n"}),a=a.replace(/^(\s{0,3}\d+)\. /g,"$1\\. ");for(var l=/<(ul|ol)\b[^>]*>(?:(?!<ul|<ol)[\s\S])*?<\/\1>/gi;a.match(l);)a=a.replace(l,d);for(var m=/<blockquote\b[^>]*>((?:(?!<blockquote)[\s\S])*?)<\/blockquote>/gi;a.match(m);)a=a.replace(m,e);return a=f(a),a=a.replace(/^\s+\n\n/,"\n"),/^\n\>\s/.test(a)||(a=a.replace(/^\n/,"")),a},texttohtml:function(a){var b={exec:$.noop},c=$.Deferred();return require(["static/3rd.party/marked/lib/marked.js"]).then(function(d){d.prototype.constructor.Parser.prototype.parse=function(a){this.inline=new d.InlineLexer(a.links,this.options,this.renderer),_.extend(this.inline.rules,{em:b,strong:b,escape:b,del:b,image:b,codespan:b,autolink:b}),this.tokens=a.reverse();for(var c="";this.next();)c+=this.tok();return c},d.setOptions({renderer:new d.Renderer,gfm:!0,tables:!1,breaks:!0,pedantic:!1,sanitize:!0,smartLists:!0,smartypants:!1});var e=new d.Lexer;_.extend(e.rules,{heading:b,code:b,hr:b,lheading:b}),c.resolve(d.parser(e.lex(a)))}),c}}}),!function(a){function b(){function b(a){"remove"===a&&this.each(function(a,b){var c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var d;(d=tinymce.get(c.id))&&d.setContent(a)});else if(d.length>0&&(c=tinymce.get(d[0].id)))return c.getContent()}function e(a){var b=null;return a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var h={};a.each(["text","html","val"],function(b,g){var i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return f(b)?a!==c?("string"==typeof a&&b.filter(":tinymce").each(function(b,c){var d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void 0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var e=h[d]=a.fn[d];a.fn[d]=function(){return b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var i=this,j=arguments;if(!b||"value"!==b||!f(i))return g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var i,j,k,l=this,m="";if(!l.length)return l;if(!c)return window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return l},a.extend(a.expr[":"],{tinymce:function(a){var b;return!!(a.id&&"tinymce"in window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce))}})}(jQuery),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function b(b,d){var e,f,g,h=b.nodeName.toLowerCase();return"area"===h?(e=b.parentNode,f=e.name,b.href&&f&&"map"===e.nodeName.toLowerCase()?(g=a("img[usemap='#"+f+"']")[0],!!g&&c(g)):!1):(/^(input|select|textarea|button|object)$/.test(h)?!b.disabled:"a"===h?b.href||d:d)&&c(b)}function c(b){return a.expr.filters.visible(b)&&!a(b).parents().addBack().filter(function(){return"hidden"===a.css(this,"visibility")}).length}a.ui=a.ui||{},a.extend(a.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),a.fn.extend({scrollParent:function(b){var c=this.css("position"),d="absolute"===c,e=b?/(auto|scroll|hidden)/:/(auto|scroll)/,f=this.parents().filter(function(){var b=a(this);return d&&"static"===b.css("position")?!1:e.test(b.css("overflow")+b.css("overflow-y")+b.css("overflow-x"))}).eq(0);return"fixed"!==c&&f.length?f:a(this[0].ownerDocument||document)},uniqueId:function(){var a=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&a(this).removeAttr("id")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(c){return b(c,!isNaN(a.attr(c,"tabindex")))},tabbable:function(c){var d=a.attr(c,"tabindex"),e=isNaN(d);return(e||d>=0)&&b(c,!e)}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(b,c){function d(b,c,d,f){return a.each(e,function(){c-=parseFloat(a.css(b,"padding"+this))||0,d&&(c-=parseFloat(a.css(b,"border"+this+"Width"))||0),f&&(c-=parseFloat(a.css(b,"margin"+this))||0)}),c}var e="Width"===c?["Left","Right"]:["Top","Bottom"],f=c.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+c]=function(b){return void 0===b?g["inner"+c].call(this):this.each(function(){a(this).css(f,d(this,b)+"px")})},a.fn["outer"+c]=function(b,e){return"number"!=typeof b?g["outer"+c].call(this,b):this.each(function(){a(this).css(f,d(this,b,!0,e)+"px")})}}),a.fn.addBack||(a.fn.addBack=function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}),a("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(a.fn.removeData=function(b){return function(c){return arguments.length?b.call(this,a.camelCase(c)):b.call(this)}}(a.fn.removeData)),a.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),a.fn.extend({focus:function(b){return function(c,d){return"number"==typeof c?this.each(function(){var b=this;setTimeout(function(){a(b).focus(),d&&d.call(b)},c)}):b.apply(this,arguments)}}(a.fn.focus),disableSelection:function(){var a="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(a+".ui-disableSelection",function(a){a.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(b){if(void 0!==b)return this.css("zIndex",b);if(this.length)for(var c,d,e=a(this[0]);e.length&&e[0]!==document;){if(c=e.css("position"),("absolute"===c||"relative"===c||"fixed"===c)&&(d=parseInt(e.css("zIndex"),10),!isNaN(d)&&0!==d))return d;e=e.parent()}return 0}}),a.ui.plugin={add:function(b,c,d){var e,f=a.ui[b].prototype;for(e in d)f.plugins[e]=f.plugins[e]||[],f.plugins[e].push([c,d[e]])},call:function(a,b,c,d){var e,f=a.plugins[b];if(f&&(d||a.element[0].parentNode&&11!==a.element[0].parentNode.nodeType))for(e=0;f.length>e;e++)a.options[f[e][0]]&&f[e][1].apply(a.element,c)}};var d=0,e=Array.prototype.slice;a.cleanData=function(b){return function(c){var d,e,f;for(f=0;null!=(e=c[f]);f++)try{d=a._data(e,"events"),d&&d.remove&&a(e).triggerHandler("remove")}catch(g){}b(c)}}(a.cleanData),a.widget=function(b,c,d){var e,f,g,h,i={},j=b.split(".")[0];return b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){return this._createWidget?void(arguments.length&&this._createWidget(a,b)):new g(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){return a.isFunction(d)?void(i[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},e=function(a){return c.prototype[b].apply(this,a)};return function(){var b,c=this._super,f=this._superApply;return this._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}()):void(i[b]=d)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix||b:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g),g},a.widget.extend=function(b){for(var c,d,f=e.call(arguments,1),g=0,h=f.length;h>g;g++)for(c in f[g])d=f[g][c],f[g].hasOwnProperty(c)&&void 0!==d&&(b[c]=a.isPlainObject(d)?a.isPlainObject(b[c])?a.widget.extend({},b[c],d):a.widget.extend({},d):d);return b},a.widget.bridge=function(b,c){var d=c.prototype.widgetFullName||b;a.fn[b]=function(f){var g="string"==typeof f,h=e.call(arguments,1),i=this;return g?this.each(function(){var c,e=a.data(this,d);return"instance"===f?(i=e,!1):e?a.isFunction(e[f])&&"_"!==f.charAt(0)?(c=e[f].apply(e,h),c!==e&&void 0!==c?(i=c&&c.jquery?i.pushStack(c.get()):c,!1):void 0):a.error("no such method '"+f+"' for "+b+" widget instance"):a.error("cannot call methods on "+b+" prior to initialization; attempted to call method '"+f+"'")}):(h.length&&(f=a.widget.extend.apply(null,[f].concat(h))),this.each(function(){var b=a.data(this,d);b?(b.option(f||{}),b._init&&b._init()):a.data(this,d,new c(f,this))})),i}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(b,c){c=a(c||this.defaultElement||this)[0],this.element=a(c),this.uuid=d++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=a(),this.hoverable=a(),this.focusable=a(),c!==this&&(a.data(c,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===c&&this.destroy()}}),this.document=a(c.style?c.ownerDocument:c.document||c),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(b,c){var d,e,f,g=b;if(0===arguments.length)return a.widget.extend({},this.options);if("string"==typeof b)if(g={},d=b.split("."),b=d.shift(),d.length){for(e=g[b]=a.widget.extend({},this.options[b]),f=0;d.length-1>f;f++)e[d[f]]=e[d[f]]||{},e=e[d[f]];if(b=d.pop(),1===arguments.length)return void 0===e[b]?null:e[b];e[b]=c}else{if(1===arguments.length)return void 0===this.options[b]?null:this.options[b];g[b]=c}return this._setOptions(g),this},_setOptions:function(a){var b;for(b in a)this._setOption(b,a[b]);return this},_setOption:function(a,b){return this.options[a]=b,"disabled"===a&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!b),b&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(b,c,d){var e,f=this;"boolean"!=typeof b&&(d=c,c=b,b=!1),d?(c=e=a(c),this.bindings=this.bindings.add(c)):(d=c,c=this.element,e=this.widget()),a.each(d,function(d,g){function h(){return b||f.options.disabled!==!0&&!a(this).hasClass("ui-state-disabled")?("string"==typeof g?f[g]:g).apply(f,arguments):void 0}"string"!=typeof g&&(h.guid=g.guid=g.guid||h.guid||a.guid++);var i=d.match(/^([\w:-]*)\s*(.*)$/),j=i[1]+f.eventNamespace,k=i[2];k?e.delegate(k,j,h):c.bind(j,h)})},_off:function(b,c){c=(c||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,b.unbind(c).undelegate(c),this.bindings=a(this.bindings.not(b).get()),this.focusable=a(this.focusable.not(b).get()),this.hoverable=a(this.hoverable.not(b).get())},_delay:function(a,b){function c(){return("string"==typeof a?d[a]:a).apply(d,arguments)}var d=this;return setTimeout(c,b||0)},_hoverable:function(b){this.hoverable=this.hoverable.add(b),this._on(b,{mouseenter:function(b){a(b.currentTarget).addClass("ui-state-hover")},mouseleave:function(b){a(b.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(b){this.focusable=this.focusable.add(b),this._on(b,{focusin:function(b){a(b.currentTarget).addClass("ui-state-focus")},focusout:function(b){a(b.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(b,c,d){var e,f,g=this.options[b];if(d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent)for(e in f)e in c||(c[e]=f[e]);return this.element.trigger(c,d),!(a.isFunction(g)&&g.apply(this.element[0],[c].concat(d))===!1||c.isDefaultPrevented())}},a.each({show:"fadeIn",hide:"fadeOut"},function(b,c){a.Widget.prototype["_"+b]=function(d,e,f){"string"==typeof e&&(e={effect:e});var g,h=e?e===!0||"number"==typeof e?c:e.effect||c:b;

e=e||{},"number"==typeof e&&(e={duration:e}),g=!a.isEmptyObject(e),e.complete=f,e.delay&&d.delay(e.delay),g&&a.effects&&a.effects.effect[h]?d[b](e):h!==b&&d[h]?d[h](e.duration,e.easing,f):d.queue(function(c){a(this)[b](),f&&f.call(d[0]),c()})}}),a.widget;var f=!1;a(document).mouseup(function(){f=!1}),a.widget("ui.mouse",{version:"1.11.4",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(a){return b._mouseDown(a)}).bind("click."+this.widgetName,function(c){return!0===a.data(c.target,b.widgetName+".preventClickEvent")?(a.removeData(c.target,b.widgetName+".preventClickEvent"),c.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(b){if(!f){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(b),this._mouseDownEvent=b;var c=this,d=1===b.which,e="string"==typeof this.options.cancel&&b.target.nodeName?a(b.target).closest(this.options.cancel).length:!1;return d&&!e&&this._mouseCapture(b)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(b)!==!1,!this._mouseStarted)?(b.preventDefault(),!0):(!0===a.data(b.target,this.widgetName+".preventClickEvent")&&a.removeData(b.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(a){return c._mouseMove(a)},this._mouseUpDelegate=function(a){return c._mouseUp(a)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),b.preventDefault(),f=!0,!0)):!0}},_mouseMove:function(b){if(this._mouseMoved){if(a.ui.ie&&(!document.documentMode||9>document.documentMode)&&!b.button)return this._mouseUp(b);if(!b.which)return this._mouseUp(b)}return(b.which||b.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(b),b.preventDefault()):(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,b)!==!1,this._mouseStarted?this._mouseDrag(b):this._mouseUp(b)),!this._mouseStarted)},_mouseUp:function(b){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,b.target===this._mouseDownEvent.target&&a.data(b.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(b)),f=!1,!1},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),a.widget("ui.draggable",a.ui.mouse,{version:"1.11.4",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(a,b){this._super(a,b),"handle"===a&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?void(this.destroyOnClear=!0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),void this._mouseDestroy())},_mouseCapture:function(b){var c=this.options;return this._blurActiveElement(b),this.helper||c.disabled||a(b.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(b),this.handle?(this._blockFrames(c.iframeFix===!0?"iframe":c.iframeFix),!0):!1)},_blockFrames:function(b){this.iframeBlocks=this.document.find(b).map(function(){var b=a(this);return a("<div>").css("position","absolute").appendTo(b.parent()).outerWidth(b.outerWidth()).outerHeight(b.outerHeight()).offset(b.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(b){var c=this.document[0];if(this.handleElement.is(b.target))try{c.activeElement&&"body"!==c.activeElement.nodeName.toLowerCase()&&a(c.activeElement).blur()}catch(d){}},_mouseStart:function(b){var c=this.options;return this.helper=this._createHelper(b),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),a.ui.ddmanager&&(a.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===a(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(b),this.originalPosition=this.position=this._generatePosition(b,!1),this.originalPageX=b.pageX,this.originalPageY=b.pageY,c.cursorAt&&this._adjustOffsetFromHelper(c.cursorAt),this._setContainment(),this._trigger("start",b)===!1?(this._clear(),!1):(this._cacheHelperProportions(),a.ui.ddmanager&&!c.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this._normalizeRightBottom(),this._mouseDrag(b,!0),a.ui.ddmanager&&a.ui.ddmanager.dragStart(this,b),!0)},_refreshOffsets:function(a){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:a.pageX-this.offset.left,top:a.pageY-this.offset.top}},_mouseDrag:function(b,c){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(b,!0),this.positionAbs=this._convertPositionTo("absolute"),!c){var d=this._uiHash();if(this._trigger("drag",b,d)===!1)return this._mouseUp({}),!1;this.position=d.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),!1},_mouseStop:function(b){var c=this,d=!1;return a.ui.ddmanager&&!this.options.dropBehaviour&&(d=a.ui.ddmanager.drop(this,b)),this.dropped&&(d=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!d||"valid"===this.options.revert&&d||this.options.revert===!0||a.isFunction(this.options.revert)&&this.options.revert.call(this.element,d)?a(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",b)!==!1&&c._clear()}):this._trigger("stop",b)!==!1&&this._clear(),!1},_mouseUp:function(b){return this._unblockFrames(),a.ui.ddmanager&&a.ui.ddmanager.dragStop(this,b),this.handleElement.is(b.target)&&this.element.focus(),a.ui.mouse.prototype._mouseUp.call(this,b)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(b){return this.options.handle?!!a(b.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper),e=d?a(c.helper.apply(this.element[0],[b])):"clone"===c.helper?this.element.clone().removeAttr("id"):this.element;return e.parents("body").length||e.appendTo("parent"===c.appendTo?this.element[0].parentNode:c.appendTo),d&&e[0]===this.element[0]&&this._setPositionRelative(),e[0]===this.element[0]||/(fixed|absolute)/.test(e.css("position"))||e.css("position","absolute"),e},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_isRootNode:function(a){return/(html|body)/i.test(a.tagName)||a===this.document[0]},_getParentOffset:function(){var b=this.offsetParent.offset(),c=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==c&&a.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(b={top:0,left:0}),{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var a=this.element.position(),b=this._isRootNode(this.scrollParent[0]);return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+(b?0:this.scrollParent.scrollTop()),left:a.left-(parseInt(this.helper.css("left"),10)||0)+(b?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b,c,d,e=this.options,f=this.document[0];return this.relativeContainer=null,e.containment?"window"===e.containment?void(this.containment=[a(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,a(window).scrollLeft()+a(window).width()-this.helperProportions.width-this.margins.left,a(window).scrollTop()+(a(window).height()||f.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):"document"===e.containment?void(this.containment=[0,0,a(f).width()-this.helperProportions.width-this.margins.left,(a(f).height()||f.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]):e.containment.constructor===Array?void(this.containment=e.containment):("parent"===e.containment&&(e.containment=this.helper[0].parentNode),c=a(e.containment),d=c[0],void(d&&(b=/(scroll|auto)/.test(c.css("overflow")),this.containment=[(parseInt(c.css("borderLeftWidth"),10)||0)+(parseInt(c.css("paddingLeft"),10)||0),(parseInt(c.css("borderTopWidth"),10)||0)+(parseInt(c.css("paddingTop"),10)||0),(b?Math.max(d.scrollWidth,d.offsetWidth):d.offsetWidth)-(parseInt(c.css("borderRightWidth"),10)||0)-(parseInt(c.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(b?Math.max(d.scrollHeight,d.offsetHeight):d.offsetHeight)-(parseInt(c.css("borderBottomWidth"),10)||0)-(parseInt(c.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=c))):void(this.containment=null)},_convertPositionTo:function(a,b){b||(b=this.position);var c="absolute"===a?1:-1,d=this._isRootNode(this.scrollParent[0]);return{top:b.top+this.offset.relative.top*c+this.offset.parent.top*c-("fixed"===this.cssPosition?-this.offset.scroll.top:d?0:this.offset.scroll.top)*c,left:b.left+this.offset.relative.left*c+this.offset.parent.left*c-("fixed"===this.cssPosition?-this.offset.scroll.left:d?0:this.offset.scroll.left)*c}},_generatePosition:function(a,b){var c,d,e,f,g=this.options,h=this._isRootNode(this.scrollParent[0]),i=a.pageX,j=a.pageY;return h&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),b&&(this.containment&&(this.relativeContainer?(d=this.relativeContainer.offset(),c=[this.containment[0]+d.left,this.containment[1]+d.top,this.containment[2]+d.left,this.containment[3]+d.top]):c=this.containment,a.pageX-this.offset.click.left<c[0]&&(i=c[0]+this.offset.click.left),a.pageY-this.offset.click.top<c[1]&&(j=c[1]+this.offset.click.top),a.pageX-this.offset.click.left>c[2]&&(i=c[2]+this.offset.click.left),a.pageY-this.offset.click.top>c[3]&&(j=c[3]+this.offset.click.top)),g.grid&&(e=g.grid[1]?this.originalPageY+Math.round((j-this.originalPageY)/g.grid[1])*g.grid[1]:this.originalPageY,j=c?e-this.offset.click.top>=c[1]||e-this.offset.click.top>c[3]?e:e-this.offset.click.top>=c[1]?e-g.grid[1]:e+g.grid[1]:e,f=g.grid[0]?this.originalPageX+Math.round((i-this.originalPageX)/g.grid[0])*g.grid[0]:this.originalPageX,i=c?f-this.offset.click.left>=c[0]||f-this.offset.click.left>c[2]?f:f-this.offset.click.left>=c[0]?f-g.grid[0]:f+g.grid[0]:f),"y"===g.axis&&(i=this.originalPageX),"x"===g.axis&&(j=this.originalPageY)),{top:j-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:h?0:this.offset.scroll.top),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:h?0:this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_normalizeRightBottom:function(){"y"!==this.options.axis&&"auto"!==this.helper.css("right")&&(this.helper.width(this.helper.width()),this.helper.css("right","auto")),"x"!==this.options.axis&&"auto"!==this.helper.css("bottom")&&(this.helper.height(this.helper.height()),this.helper.css("bottom","auto"))},_trigger:function(b,c,d){return d=d||this._uiHash(),a.ui.plugin.call(this,b,[c,d,this],!0),/^(drag|start|stop)/.test(b)&&(this.positionAbs=this._convertPositionTo("absolute"),d.offset=this.positionAbs),a.Widget.prototype._trigger.call(this,b,c,d)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),a.ui.plugin.add("draggable","connectToSortable",{start:function(b,c,d){var e=a.extend({},c,{item:d.element});d.sortables=[],a(d.options.connectToSortable).each(function(){var c=a(this).sortable("instance");c&&!c.options.disabled&&(d.sortables.push(c),c.refreshPositions(),c._trigger("activate",b,e))})},stop:function(b,c,d){var e=a.extend({},c,{item:d.element});d.cancelHelperRemoval=!1,a.each(d.sortables,function(){var a=this;a.isOver?(a.isOver=0,d.cancelHelperRemoval=!0,a.cancelHelperRemoval=!1,a._storedCSS={position:a.placeholder.css("position"),top:a.placeholder.css("top"),left:a.placeholder.css("left")},a._mouseStop(b),a.options.helper=a.options._helper):(a.cancelHelperRemoval=!0,a._trigger("deactivate",b,e))})},drag:function(b,c,d){a.each(d.sortables,function(){var e=!1,f=this;f.positionAbs=d.positionAbs,f.helperProportions=d.helperProportions,f.offset.click=d.offset.click,f._intersectsWith(f.containerCache)&&(e=!0,a.each(d.sortables,function(){return this.positionAbs=d.positionAbs,this.helperProportions=d.helperProportions,this.offset.click=d.offset.click,this!==f&&this._intersectsWith(this.containerCache)&&a.contains(f.element[0],this.element[0])&&(e=!1),e})),e?(f.isOver||(f.isOver=1,d._parent=c.helper.parent(),f.currentItem=c.helper.appendTo(f.element).data("ui-sortable-item",!0),f.options._helper=f.options.helper,f.options.helper=function(){return c.helper[0]},b.target=f.currentItem[0],f._mouseCapture(b,!0),f._mouseStart(b,!0,!0),f.offset.click.top=d.offset.click.top,f.offset.click.left=d.offset.click.left,f.offset.parent.left-=d.offset.parent.left-f.offset.parent.left,f.offset.parent.top-=d.offset.parent.top-f.offset.parent.top,d._trigger("toSortable",b),d.dropped=f.element,a.each(d.sortables,function(){this.refreshPositions()}),d.currentItem=d.element,f.fromOutside=d),f.currentItem&&(f._mouseDrag(b),c.position=f.position)):f.isOver&&(f.isOver=0,f.cancelHelperRemoval=!0,f.options._revert=f.options.revert,f.options.revert=!1,f._trigger("out",b,f._uiHash(f)),f._mouseStop(b,!0),f.options.revert=f.options._revert,f.options.helper=f.options._helper,f.placeholder&&f.placeholder.remove(),c.helper.appendTo(d._parent),d._refreshOffsets(b),c.position=d._generatePosition(b,!0),d._trigger("fromSortable",b),d.dropped=!1,a.each(d.sortables,function(){this.refreshPositions()}))})}}),a.ui.plugin.add("draggable","cursor",{start:function(b,c,d){var e=a("body"),f=d.options;e.css("cursor")&&(f._cursor=e.css("cursor")),e.css("cursor",f.cursor)},stop:function(b,c,d){var e=d.options;e._cursor&&a("body").css("cursor",e._cursor)}}),a.ui.plugin.add("draggable","opacity",{start:function(b,c,d){var e=a(c.helper),f=d.options;e.css("opacity")&&(f._opacity=e.css("opacity")),e.css("opacity",f.opacity)},stop:function(b,c,d){var e=d.options;e._opacity&&a(c.helper).css("opacity",e._opacity)}}),a.ui.plugin.add("draggable","scroll",{start:function(a,b,c){c.scrollParentNotHidden||(c.scrollParentNotHidden=c.helper.scrollParent(!1)),c.scrollParentNotHidden[0]!==c.document[0]&&"HTML"!==c.scrollParentNotHidden[0].tagName&&(c.overflowOffset=c.scrollParentNotHidden.offset())},drag:function(b,c,d){var e=d.options,f=!1,g=d.scrollParentNotHidden[0],h=d.document[0];g!==h&&"HTML"!==g.tagName?(e.axis&&"x"===e.axis||(d.overflowOffset.top+g.offsetHeight-b.pageY<e.scrollSensitivity?g.scrollTop=f=g.scrollTop+e.scrollSpeed:b.pageY-d.overflowOffset.top<e.scrollSensitivity&&(g.scrollTop=f=g.scrollTop-e.scrollSpeed)),e.axis&&"y"===e.axis||(d.overflowOffset.left+g.offsetWidth-b.pageX<e.scrollSensitivity?g.scrollLeft=f=g.scrollLeft+e.scrollSpeed:b.pageX-d.overflowOffset.left<e.scrollSensitivity&&(g.scrollLeft=f=g.scrollLeft-e.scrollSpeed))):(e.axis&&"x"===e.axis||(b.pageY-a(h).scrollTop()<e.scrollSensitivity?f=a(h).scrollTop(a(h).scrollTop()-e.scrollSpeed):a(window).height()-(b.pageY-a(h).scrollTop())<e.scrollSensitivity&&(f=a(h).scrollTop(a(h).scrollTop()+e.scrollSpeed))),e.axis&&"y"===e.axis||(b.pageX-a(h).scrollLeft()<e.scrollSensitivity?f=a(h).scrollLeft(a(h).scrollLeft()-e.scrollSpeed):a(window).width()-(b.pageX-a(h).scrollLeft())<e.scrollSensitivity&&(f=a(h).scrollLeft(a(h).scrollLeft()+e.scrollSpeed)))),f!==!1&&a.ui.ddmanager&&!e.dropBehaviour&&a.ui.ddmanager.prepareOffsets(d,b)}}),a.ui.plugin.add("draggable","snap",{start:function(b,c,d){var e=d.options;d.snapElements=[],a(e.snap.constructor!==String?e.snap.items||":data(ui-draggable)":e.snap).each(function(){var b=a(this),c=b.offset();this!==d.element[0]&&d.snapElements.push({item:this,width:b.outerWidth(),height:b.outerHeight(),top:c.top,left:c.left})})},drag:function(b,c,d){var e,f,g,h,i,j,k,l,m,n,o=d.options,p=o.snapTolerance,q=c.offset.left,r=q+d.helperProportions.width,s=c.offset.top,t=s+d.helperProportions.height;for(m=d.snapElements.length-1;m>=0;m--)i=d.snapElements[m].left-d.margins.left,j=i+d.snapElements[m].width,k=d.snapElements[m].top-d.margins.top,l=k+d.snapElements[m].height,i-p>r||q>j+p||k-p>t||s>l+p||!a.contains(d.snapElements[m].item.ownerDocument,d.snapElements[m].item)?(d.snapElements[m].snapping&&d.options.snap.release&&d.options.snap.release.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[m].item})),d.snapElements[m].snapping=!1):("inner"!==o.snapMode&&(e=p>=Math.abs(k-t),f=p>=Math.abs(l-s),g=p>=Math.abs(i-r),h=p>=Math.abs(j-q),e&&(c.position.top=d._convertPositionTo("relative",{top:k-d.helperProportions.height,left:0}).top),f&&(c.position.top=d._convertPositionTo("relative",{top:l,left:0}).top),g&&(c.position.left=d._convertPositionTo("relative",{top:0,left:i-d.helperProportions.width}).left),h&&(c.position.left=d._convertPositionTo("relative",{top:0,left:j}).left)),n=e||f||g||h,"outer"!==o.snapMode&&(e=p>=Math.abs(k-s),f=p>=Math.abs(l-t),g=p>=Math.abs(i-q),h=p>=Math.abs(j-r),e&&(c.position.top=d._convertPositionTo("relative",{top:k,left:0}).top),f&&(c.position.top=d._convertPositionTo("relative",{top:l-d.helperProportions.height,left:0}).top),g&&(c.position.left=d._convertPositionTo("relative",{top:0,left:i}).left),h&&(c.position.left=d._convertPositionTo("relative",{top:0,left:j-d.helperProportions.width}).left)),!d.snapElements[m].snapping&&(e||f||g||h||n)&&d.options.snap.snap&&d.options.snap.snap.call(d.element,b,a.extend(d._uiHash(),{snapItem:d.snapElements[m].item})),d.snapElements[m].snapping=e||f||g||h||n)}}),a.ui.plugin.add("draggable","stack",{start:function(b,c,d){var e,f=d.options,g=a.makeArray(a(f.stack)).sort(function(b,c){return(parseInt(a(b).css("zIndex"),10)||0)-(parseInt(a(c).css("zIndex"),10)||0)});g.length&&(e=parseInt(a(g[0]).css("zIndex"),10)||0,a(g).each(function(b){a(this).css("zIndex",e+b)}),this.css("zIndex",e+g.length))}}),a.ui.plugin.add("draggable","zIndex",{start:function(b,c,d){var e=a(c.helper),f=d.options;e.css("zIndex")&&(f._zIndex=e.css("zIndex")),e.css("zIndex",f.zIndex)},stop:function(b,c,d){var e=d.options;e._zIndex&&a(c.helper).css("zIndex",e._zIndex)}}),a.ui.draggable,a.widget("ui.droppable",{version:"1.11.4",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var b,c=this.options,d=c.accept;this.isover=!1,this.isout=!0,this.accept=a.isFunction(d)?d:function(a){return a.is(d)},this.proportions=function(){return arguments.length?void(b=arguments[0]):b?b:b={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(c.scope),c.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(b){a.ui.ddmanager.droppables[b]=a.ui.ddmanager.droppables[b]||[],a.ui.ddmanager.droppables[b].push(this)},_splice:function(a){for(var b=0;a.length>b;b++)a[b]===this&&a.splice(b,1)},_destroy:function(){var b=a.ui.ddmanager.droppables[this.options.scope];this._splice(b),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(b,c){if("accept"===b)this.accept=a.isFunction(c)?c:function(a){return a.is(c)};else if("scope"===b){var d=a.ui.ddmanager.droppables[this.options.scope];this._splice(d),this._addToManager(c)}this._super(b,c)},_activate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),c&&this._trigger("activate",b,this.ui(c))},_deactivate:function(b){var c=a.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),c&&this._trigger("deactivate",b,this.ui(c))},_over:function(b){var c=a.ui.ddmanager.current;c&&(c.currentItem||c.element)[0]!==this.element[0]&&this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",b,this.ui(c)))},_out:function(b){var c=a.ui.ddmanager.current;c&&(c.currentItem||c.element)[0]!==this.element[0]&&this.accept.call(this.element[0],c.currentItem||c.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",b,this.ui(c)))},_drop:function(b,c){var d=c||a.ui.ddmanager.current,e=!1;return d&&(d.currentItem||d.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var c=a(this).droppable("instance");return c.options.greedy&&!c.options.disabled&&c.options.scope===d.options.scope&&c.accept.call(c.element[0],d.currentItem||d.element)&&a.ui.intersect(d,a.extend(c,{offset:c.element.offset()}),c.options.tolerance,b)?(e=!0,!1):void 0}),e?!1:this.accept.call(this.element[0],d.currentItem||d.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",b,this.ui(d)),this.element):!1):!1},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}}),a.ui.intersect=function(){function a(a,b,c){return a>=b&&b+c>a}return function(b,c,d,e){if(!c.offset)return!1;var f=(b.positionAbs||b.position.absolute).left+b.margins.left,g=(b.positionAbs||b.position.absolute).top+b.margins.top,h=f+b.helperProportions.width,i=g+b.helperProportions.height,j=c.offset.left,k=c.offset.top,l=j+c.proportions().width,m=k+c.proportions().height;switch(d){case"fit":return f>=j&&l>=h&&g>=k&&m>=i;case"intersect":return f+b.helperProportions.width/2>j&&l>h-b.helperProportions.width/2&&g+b.helperProportions.height/2>k&&m>i-b.helperProportions.height/2;case"pointer":return a(e.pageY,k,c.proportions().height)&&a(e.pageX,j,c.proportions().width);case"touch":return(g>=k&&m>=g||i>=k&&m>=i||k>g&&i>m)&&(f>=j&&l>=f||h>=j&&l>=h||j>f&&h>l);default:return!1}}}(),a.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(b,c){var d,e,f=a.ui.ddmanager.droppables[b.options.scope]||[],g=c?c.type:null,h=(b.currentItem||b.element).find(":data(ui-droppable)").addBack();a:for(d=0;f.length>d;d++)if(!(f[d].options.disabled||b&&!f[d].accept.call(f[d].element[0],b.currentItem||b.element))){for(e=0;h.length>e;e++)if(h[e]===f[d].element[0]){f[d].proportions().height=0;continue a}f[d].visible="none"!==f[d].element.css("display"),f[d].visible&&("mousedown"===g&&f[d]._activate.call(f[d],c),f[d].offset=f[d].element.offset(),f[d].proportions({width:f[d].element[0].offsetWidth,height:f[d].element[0].offsetHeight}))}},drop:function(b,c){var d=!1;return a.each((a.ui.ddmanager.droppables[b.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&a.ui.intersect(b,this,this.options.tolerance,c)&&(d=this._drop.call(this,c)||d),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],b.currentItem||b.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,c)))}),d},dragStart:function(b,c){b.element.parentsUntil("body").bind("scroll.droppable",function(){b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)})},drag:function(b,c){b.options.refreshPositions&&a.ui.ddmanager.prepareOffsets(b,c),a.each(a.ui.ddmanager.droppables[b.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var d,e,f,g=a.ui.intersect(b,this,this.options.tolerance,c),h=!g&&this.isover?"isout":g&&!this.isover?"isover":null;h&&(this.options.greedy&&(e=this.options.scope,f=this.element.parents(":data(ui-droppable)").filter(function(){return a(this).droppable("instance").options.scope===e}),f.length&&(d=a(f[0]).droppable("instance"),d.greedyChild="isover"===h)),d&&"isover"===h&&(d.isover=!1,d.isout=!0,d._out.call(d,c)),this[h]=!0,this["isout"===h?"isover":"isout"]=!1,this["isover"===h?"_over":"_out"].call(this,c),d&&"isout"===h&&(d.isout=!1,d.isover=!0,d._over.call(d,c)))}})},dragStop:function(b,c){b.element.parentsUntil("body").unbind("scroll.droppable"),b.options.refreshPositions||a.ui.ddmanager.prepareOffsets(b,c)}},a.ui.droppable,a.widget("ui.resizable",a.ui.mouse,{version:"1.11.4",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(a){return parseInt(a,10)||0},_isNumber:function(a){return!isNaN(parseInt(a,10))},_hasScroll:function(b,c){if("hidden"===a(b).css("overflow"))return!1;var d=c&&"left"===c?"scrollLeft":"scrollTop",e=!1;return b[d]>0?!0:(b[d]=1,e=b[d]>0,b[d]=0,e)},_create:function(){var b,c,d,e,f,g=this,h=this.options;if(this.element.addClass("ui-resizable"),a.extend(this,{_aspectRatio:!!h.aspectRatio,aspectRatio:h.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:h.helper||h.ghost||h.animate?h.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(a("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=h.handles||(a(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=a(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),b=this.handles.split(","),this.handles={},c=0;b.length>c;c++)d=a.trim(b[c]),f="ui-resizable-"+d,e=a("<div class='ui-resizable-handle "+f+"'></div>"),e.css({zIndex:h.zIndex}),"se"===d&&e.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[d]=".ui-resizable-"+d,this.element.append(e);this._renderAxis=function(b){var c,d,e,f;b=b||this.element;for(c in this.handles)this.handles[c].constructor===String?this.handles[c]=this.element.children(this.handles[c]).first().show():(this.handles[c].jquery||this.handles[c].nodeType)&&(this.handles[c]=a(this.handles[c]),this._on(this.handles[c],{mousedown:g._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(d=a(this.handles[c],this.element),f=/sw|ne|nw|se|n|s/.test(c)?d.outerHeight():d.outerWidth(),e=["padding",/ne|nw|n/.test(c)?"Top":/se|sw|s/.test(c)?"Bottom":/^e$/.test(c)?"Right":"Left"].join(""),b.css(e,f),this._proportionallyResize()),this._handles=this._handles.add(this.handles[c])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.mouseover(function(){g.resizing||(this.className&&(e=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),g.axis=e&&e[1]?e[1]:"se")}),h.autoHide&&(this._handles.hide(),a(this.element).addClass("ui-resizable-autohide").mouseenter(function(){h.disabled||(a(this).removeClass("ui-resizable-autohide"),g._handles.show())}).mouseleave(function(){h.disabled||g.resizing||(a(this).addClass("ui-resizable-autohide"),g._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var b,c=function(b){a(b).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(c(this.element),b=this.element,this.originalElement.css({position:b.css("position"),width:b.outerWidth(),height:b.outerHeight(),top:b.css("top"),left:b.css("left")}).insertAfter(b),b.remove()),this.originalElement.css("resize",this.originalResizeStyle),

c(this.originalElement),this},_mouseCapture:function(b){var c,d,e=!1;for(c in this.handles)d=a(this.handles[c])[0],(d===b.target||a.contains(d,b.target))&&(e=!0);return!this.options.disabled&&e},_mouseStart:function(b){var c,d,e,f=this.options,g=this.element;return this.resizing=!0,this._renderProxy(),c=this._num(this.helper.css("left")),d=this._num(this.helper.css("top")),f.containment&&(c+=a(f.containment).scrollLeft()||0,d+=a(f.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:c,top:d},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:g.width(),height:g.height()},this.originalSize=this._helper?{width:g.outerWidth(),height:g.outerHeight()}:{width:g.width(),height:g.height()},this.sizeDiff={width:g.outerWidth()-g.width(),height:g.outerHeight()-g.height()},this.originalPosition={left:c,top:d},this.originalMousePosition={left:b.pageX,top:b.pageY},this.aspectRatio="number"==typeof f.aspectRatio?f.aspectRatio:this.originalSize.width/this.originalSize.height||1,e=a(".ui-resizable-"+this.axis).css("cursor"),a("body").css("cursor","auto"===e?this.axis+"-resize":e),g.addClass("ui-resizable-resizing"),this._propagate("start",b),!0},_mouseDrag:function(b){var c,d,e=this.originalMousePosition,f=this.axis,g=b.pageX-e.left||0,h=b.pageY-e.top||0,i=this._change[f];return this._updatePrevProperties(),i?(c=i.apply(this,[b,g,h]),this._updateVirtualBoundaries(b.shiftKey),(this._aspectRatio||b.shiftKey)&&(c=this._updateRatio(c,b)),c=this._respectSize(c,b),this._updateCache(c),this._propagate("resize",b),d=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),a.isEmptyObject(d)||(this._updatePrevProperties(),this._trigger("resize",b,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(b){this.resizing=!1;var c,d,e,f,g,h,i,j=this.options,k=this;return this._helper&&(c=this._proportionallyResizeElements,d=c.length&&/textarea/i.test(c[0].nodeName),e=d&&this._hasScroll(c[0],"left")?0:k.sizeDiff.height,f=d?0:k.sizeDiff.width,g={width:k.helper.width()-f,height:k.helper.height()-e},h=parseInt(k.element.css("left"),10)+(k.position.left-k.originalPosition.left)||null,i=parseInt(k.element.css("top"),10)+(k.position.top-k.originalPosition.top)||null,j.animate||this.element.css(a.extend(g,{top:i,left:h})),k.helper.height(k.size.height),k.helper.width(k.size.width),this._helper&&!j.animate&&this._proportionallyResize()),a("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",b),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var a={};return this.position.top!==this.prevPosition.top&&(a.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(a.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(a.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(a.height=this.size.height+"px"),this.helper.css(a),a},_updateVirtualBoundaries:function(a){var b,c,d,e,f,g=this.options;f={minWidth:this._isNumber(g.minWidth)?g.minWidth:0,maxWidth:this._isNumber(g.maxWidth)?g.maxWidth:1/0,minHeight:this._isNumber(g.minHeight)?g.minHeight:0,maxHeight:this._isNumber(g.maxHeight)?g.maxHeight:1/0},(this._aspectRatio||a)&&(b=f.minHeight*this.aspectRatio,d=f.minWidth/this.aspectRatio,c=f.maxHeight*this.aspectRatio,e=f.maxWidth/this.aspectRatio,b>f.minWidth&&(f.minWidth=b),d>f.minHeight&&(f.minHeight=d),f.maxWidth>c&&(f.maxWidth=c),f.maxHeight>e&&(f.maxHeight=e)),this._vBoundaries=f},_updateCache:function(a){this.offset=this.helper.offset(),this._isNumber(a.left)&&(this.position.left=a.left),this._isNumber(a.top)&&(this.position.top=a.top),this._isNumber(a.height)&&(this.size.height=a.height),this._isNumber(a.width)&&(this.size.width=a.width)},_updateRatio:function(a){var b=this.position,c=this.size,d=this.axis;return this._isNumber(a.height)?a.width=a.height*this.aspectRatio:this._isNumber(a.width)&&(a.height=a.width/this.aspectRatio),"sw"===d&&(a.left=b.left+(c.width-a.width),a.top=null),"nw"===d&&(a.top=b.top+(c.height-a.height),a.left=b.left+(c.width-a.width)),a},_respectSize:function(a){var b=this._vBoundaries,c=this.axis,d=this._isNumber(a.width)&&b.maxWidth&&b.maxWidth<a.width,e=this._isNumber(a.height)&&b.maxHeight&&b.maxHeight<a.height,f=this._isNumber(a.width)&&b.minWidth&&b.minWidth>a.width,g=this._isNumber(a.height)&&b.minHeight&&b.minHeight>a.height,h=this.originalPosition.left+this.originalSize.width,i=this.position.top+this.size.height,j=/sw|nw|w/.test(c),k=/nw|ne|n/.test(c);return f&&(a.width=b.minWidth),g&&(a.height=b.minHeight),d&&(a.width=b.maxWidth),e&&(a.height=b.maxHeight),f&&j&&(a.left=h-b.minWidth),d&&j&&(a.left=h-b.maxWidth),g&&k&&(a.top=i-b.minHeight),e&&k&&(a.top=i-b.maxHeight),a.width||a.height||a.left||!a.top?a.width||a.height||a.top||!a.left||(a.left=null):a.top=null,a},_getPaddingPlusBorderDimensions:function(a){for(var b=0,c=[],d=[a.css("borderTopWidth"),a.css("borderRightWidth"),a.css("borderBottomWidth"),a.css("borderLeftWidth")],e=[a.css("paddingTop"),a.css("paddingRight"),a.css("paddingBottom"),a.css("paddingLeft")];4>b;b++)c[b]=parseInt(d[b],10)||0,c[b]+=parseInt(e[b],10)||0;return{height:c[0]+c[2],width:c[1]+c[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var a,b=0,c=this.helper||this.element;this._proportionallyResizeElements.length>b;b++)a=this._proportionallyResizeElements[b],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(a)),a.css({height:c.height()-this.outerDimensions.height||0,width:c.width()-this.outerDimensions.width||0})},_renderProxy:function(){var b=this.element,c=this.options;this.elementOffset=b.offset(),this._helper?(this.helper=this.helper||a("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++c.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(a,b){return{width:this.originalSize.width+b}},w:function(a,b){var c=this.originalSize,d=this.originalPosition;return{left:d.left+b,width:c.width-b}},n:function(a,b,c){var d=this.originalSize,e=this.originalPosition;return{top:e.top+c,height:d.height-c}},s:function(a,b,c){return{height:this.originalSize.height+c}},se:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},sw:function(b,c,d){return a.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,c,d]))},ne:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,c,d]))},nw:function(b,c,d){return a.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,c,d]))}},_propagate:function(b,c){a.ui.plugin.call(this,b,[c,this.ui()]),"resize"!==b&&this._trigger(b,c,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),a.ui.plugin.add("resizable","animate",{stop:function(b){var c=a(this).resizable("instance"),d=c.options,e=c._proportionallyResizeElements,f=e.length&&/textarea/i.test(e[0].nodeName),g=f&&c._hasScroll(e[0],"left")?0:c.sizeDiff.height,h=f?0:c.sizeDiff.width,i={width:c.size.width-h,height:c.size.height-g},j=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null,k=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;c.element.animate(a.extend(i,k&&j?{top:k,left:j}:{}),{duration:d.animateDuration,easing:d.animateEasing,step:function(){var d={width:parseInt(c.element.css("width"),10),height:parseInt(c.element.css("height"),10),top:parseInt(c.element.css("top"),10),left:parseInt(c.element.css("left"),10)};e&&e.length&&a(e[0]).css({width:d.width,height:d.height}),c._updateCache(d),c._propagate("resize",b)}})}}),a.ui.plugin.add("resizable","containment",{start:function(){var b,c,d,e,f,g,h,i=a(this).resizable("instance"),j=i.options,k=i.element,l=j.containment,m=l instanceof a?l.get(0):/parent/.test(l)?k.parent().get(0):l;m&&(i.containerElement=a(m),/document/.test(l)||l===document?(i.containerOffset={left:0,top:0},i.containerPosition={left:0,top:0},i.parentData={element:a(document),left:0,top:0,width:a(document).width(),height:a(document).height()||document.body.parentNode.scrollHeight}):(b=a(m),c=[],a(["Top","Right","Left","Bottom"]).each(function(a,d){c[a]=i._num(b.css("padding"+d))}),i.containerOffset=b.offset(),i.containerPosition=b.position(),i.containerSize={height:b.innerHeight()-c[3],width:b.innerWidth()-c[1]},d=i.containerOffset,e=i.containerSize.height,f=i.containerSize.width,g=i._hasScroll(m,"left")?m.scrollWidth:f,h=i._hasScroll(m)?m.scrollHeight:e,i.parentData={element:m,left:d.left,top:d.top,width:g,height:h}))},resize:function(b){var c,d,e,f,g=a(this).resizable("instance"),h=g.options,i=g.containerOffset,j=g.position,k=g._aspectRatio||b.shiftKey,l={top:0,left:0},m=g.containerElement,n=!0;m[0]!==document&&/static/.test(m.css("position"))&&(l=i),j.left<(g._helper?i.left:0)&&(g.size.width=g.size.width+(g._helper?g.position.left-i.left:g.position.left-l.left),k&&(g.size.height=g.size.width/g.aspectRatio,n=!1),g.position.left=h.helper?i.left:0),j.top<(g._helper?i.top:0)&&(g.size.height=g.size.height+(g._helper?g.position.top-i.top:g.position.top),k&&(g.size.width=g.size.height*g.aspectRatio,n=!1),g.position.top=g._helper?i.top:0),e=g.containerElement.get(0)===g.element.parent().get(0),f=/relative|absolute/.test(g.containerElement.css("position")),e&&f?(g.offset.left=g.parentData.left+g.position.left,g.offset.top=g.parentData.top+g.position.top):(g.offset.left=g.element.offset().left,g.offset.top=g.element.offset().top),c=Math.abs(g.sizeDiff.width+(g._helper?g.offset.left-l.left:g.offset.left-i.left)),d=Math.abs(g.sizeDiff.height+(g._helper?g.offset.top-l.top:g.offset.top-i.top)),c+g.size.width>=g.parentData.width&&(g.size.width=g.parentData.width-c,k&&(g.size.height=g.size.width/g.aspectRatio,n=!1)),d+g.size.height>=g.parentData.height&&(g.size.height=g.parentData.height-d,k&&(g.size.width=g.size.height*g.aspectRatio,n=!1)),n||(g.position.left=g.prevPosition.left,g.position.top=g.prevPosition.top,g.size.width=g.prevSize.width,g.size.height=g.prevSize.height)},stop:function(){var b=a(this).resizable("instance"),c=b.options,d=b.containerOffset,e=b.containerPosition,f=b.containerElement,g=a(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width,j=g.outerHeight()-b.sizeDiff.height;b._helper&&!c.animate&&/relative/.test(f.css("position"))&&a(this).css({left:h.left-e.left-d.left,width:i,height:j}),b._helper&&!c.animate&&/static/.test(f.css("position"))&&a(this).css({left:h.left-e.left-d.left,width:i,height:j})}}),a.ui.plugin.add("resizable","alsoResize",{start:function(){var b=a(this).resizable("instance"),c=b.options;a(c.alsoResize).each(function(){var b=a(this);b.data("ui-resizable-alsoresize",{width:parseInt(b.width(),10),height:parseInt(b.height(),10),left:parseInt(b.css("left"),10),top:parseInt(b.css("top"),10)})})},resize:function(b,c){var d=a(this).resizable("instance"),e=d.options,f=d.originalSize,g=d.originalPosition,h={height:d.size.height-f.height||0,width:d.size.width-f.width||0,top:d.position.top-g.top||0,left:d.position.left-g.left||0};a(e.alsoResize).each(function(){var b=a(this),d=a(this).data("ui-resizable-alsoresize"),e={},f=b.parents(c.originalElement[0]).length?["width","height"]:["width","height","top","left"];a.each(f,function(a,b){var c=(d[b]||0)+(h[b]||0);c&&c>=0&&(e[b]=c||null)}),b.css(e)})},stop:function(){a(this).removeData("resizable-alsoresize")}}),a.ui.plugin.add("resizable","ghost",{start:function(){var b=a(this).resizable("instance"),c=b.options,d=b.size;b.ghost=b.originalElement.clone(),b.ghost.css({opacity:.25,display:"block",position:"relative",height:d.height,width:d.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof c.ghost?c.ghost:""),b.ghost.appendTo(b.helper)},resize:function(){var b=a(this).resizable("instance");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=a(this).resizable("instance");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}}),a.ui.plugin.add("resizable","grid",{resize:function(){var b,c=a(this).resizable("instance"),d=c.options,e=c.size,f=c.originalSize,g=c.originalPosition,h=c.axis,i="number"==typeof d.grid?[d.grid,d.grid]:d.grid,j=i[0]||1,k=i[1]||1,l=Math.round((e.width-f.width)/j)*j,m=Math.round((e.height-f.height)/k)*k,n=f.width+l,o=f.height+m,p=d.maxWidth&&n>d.maxWidth,q=d.maxHeight&&o>d.maxHeight,r=d.minWidth&&d.minWidth>n,s=d.minHeight&&d.minHeight>o;d.grid=i,r&&(n+=j),s&&(o+=k),p&&(n-=j),q&&(o-=k),/^(se|s|e)$/.test(h)?(c.size.width=n,c.size.height=o):/^(ne)$/.test(h)?(c.size.width=n,c.size.height=o,c.position.top=g.top-m):/^(sw)$/.test(h)?(c.size.width=n,c.size.height=o,c.position.left=g.left-l):((0>=o-k||0>=n-j)&&(b=c._getPaddingPlusBorderDimensions(this)),o-k>0?(c.size.height=o,c.position.top=g.top-m):(o=k-b.height,c.size.height=o,c.position.top=g.top+f.height-o),n-j>0?(c.size.width=n,c.position.left=g.left-l):(n=j-b.width,c.size.width=n,c.position.left=g.left+f.width-n))}}),a.ui.resizable,a.widget("ui.sortable",a.ui.mouse,{version:"1.11.4",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(a,b,c){return a>=b&&b+c>a},_isFloating:function(a){return/left|right/.test(a.css("float"))||/inline|table-cell/.test(a.css("display"))},_create:function(){this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(a,b){this._super(a,b),"handle"===a&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),a.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(b,c){var d=null,e=!1,f=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(b),a(b.target).parents().each(function(){return a.data(this,f.widgetName+"-item")===f?(d=a(this),!1):void 0}),a.data(b.target,f.widgetName+"-item")===f&&(d=a(b.target)),d&&(!this.options.handle||c||(a(this.options.handle,d).find("*").addBack().each(function(){this===b.target&&(e=!0)}),e))?(this.currentItem=d,this._removeCurrentsFromItems(),!0):!1)},_mouseStart:function(b,c,d){var e,f,g=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(b),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},a.extend(this.offset,{click:{left:b.pageX-this.offset.left,top:b.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(b),this.originalPageX=b.pageX,this.originalPageY=b.pageY,g.cursorAt&&this._adjustOffsetFromHelper(g.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),g.containment&&this._setContainment(),g.cursor&&"auto"!==g.cursor&&(f=this.document.find("body"),this.storedCursor=f.css("cursor"),f.css("cursor",g.cursor),this.storedStylesheet=a("<style>*{ cursor: "+g.cursor+" !important; }</style>").appendTo(f)),g.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",g.opacity)),g.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",g.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",b,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!d)for(e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("activate",b,this._uiHash(this));return a.ui.ddmanager&&(a.ui.ddmanager.current=this),a.ui.ddmanager&&!g.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(b),!0},_mouseDrag:function(b){var c,d,e,f,g=this.options,h=!1;for(this.position=this._generatePosition(b),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-b.pageY<g.scrollSensitivity?this.scrollParent[0].scrollTop=h=this.scrollParent[0].scrollTop+g.scrollSpeed:b.pageY-this.overflowOffset.top<g.scrollSensitivity&&(this.scrollParent[0].scrollTop=h=this.scrollParent[0].scrollTop-g.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-b.pageX<g.scrollSensitivity?this.scrollParent[0].scrollLeft=h=this.scrollParent[0].scrollLeft+g.scrollSpeed:b.pageX-this.overflowOffset.left<g.scrollSensitivity&&(this.scrollParent[0].scrollLeft=h=this.scrollParent[0].scrollLeft-g.scrollSpeed)):(b.pageY-this.document.scrollTop()<g.scrollSensitivity?h=this.document.scrollTop(this.document.scrollTop()-g.scrollSpeed):this.window.height()-(b.pageY-this.document.scrollTop())<g.scrollSensitivity&&(h=this.document.scrollTop(this.document.scrollTop()+g.scrollSpeed)),b.pageX-this.document.scrollLeft()<g.scrollSensitivity?h=this.document.scrollLeft(this.document.scrollLeft()-g.scrollSpeed):this.window.width()-(b.pageX-this.document.scrollLeft())<g.scrollSensitivity&&(h=this.document.scrollLeft(this.document.scrollLeft()+g.scrollSpeed))),h!==!1&&a.ui.ddmanager&&!g.dropBehaviour&&a.ui.ddmanager.prepareOffsets(this,b)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),c=this.items.length-1;c>=0;c--)if(d=this.items[c],e=d.item[0],f=this._intersectsWithPointer(d),f&&d.instance===this.currentContainer&&e!==this.currentItem[0]&&this.placeholder[1===f?"next":"prev"]()[0]!==e&&!a.contains(this.placeholder[0],e)&&("semi-dynamic"===this.options.type?!a.contains(this.element[0],e):!0)){if(this.direction=1===f?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(d))break;this._rearrange(b,d),this._trigger("change",b,this._uiHash());break}return this._contactContainers(b),a.ui.ddmanager&&a.ui.ddmanager.drag(this,b),this._trigger("sort",b,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(b,c){if(b){if(a.ui.ddmanager&&!this.options.dropBehaviour&&a.ui.ddmanager.drop(this,b),this.options.revert){var d=this,e=this.placeholder.offset(),f=this.options.axis,g={};f&&"x"!==f||(g.left=e.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),f&&"y"!==f||(g.top=e.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,a(this.helper).animate(g,parseInt(this.options.revert,10)||500,function(){d._clear(b)})}else this._clear(b,c);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--)this.containers[b]._trigger("deactivate",null,this._uiHash(this)),this.containers[b].containerCache.over&&(this.containers[b]._trigger("out",null,this._uiHash(this)),this.containers[b].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),a.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?a(this.domPosition.prev).after(this.currentItem):a(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},a(c).each(function(){var c=(a(b.item||this).attr(b.attribute||"id")||"").match(b.expression||/(.+)[\-=_](.+)/);c&&d.push((b.key||c[1]+"[]")+"="+(b.key&&b.expression?c[1]:c[2]))}),!d.length&&b.key&&d.push(b.key+"="),d.join("&")},toArray:function(b){var c=this._getItemsAsjQuery(b&&b.connected),d=[];return b=b||{},c.each(function(){d.push(a(b.item||this).attr(b.attribute||"id")||"")}),d},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,d=this.positionAbs.top,e=d+this.helperProportions.height,f=a.left,g=f+a.width,h=a.top,i=h+a.height,j=this.offset.click.top,k=this.offset.click.left,l="x"===this.options.axis||d+j>h&&i>d+j,m="y"===this.options.axis||b+k>f&&g>b+k,n=l&&m;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?n:b+this.helperProportions.width/2>f&&g>c-this.helperProportions.width/2&&d+this.helperProportions.height/2>h&&i>e-this.helperProportions.height/2},_intersectsWithPointer:function(a){var b="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height),c="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width),d=b&&c,e=this._getDragVerticalDirection(),f=this._getDragHorizontalDirection();return d?this.floating?f&&"right"===f||"down"===e?2:1:e&&("down"===e?2:1):!1},_intersectsWithSides:function(a){var b=this._isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height),c=this._isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width),d=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?"right"===e&&c||"left"===e&&!c:d&&("down"===d&&b||"up"===d&&!b)},_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return 0!==a&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return 0!==a&&(a>0?"right":"left")},refresh:function(a){return this._refreshItems(a),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var a=this.options;return a.connectWith.constructor===String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(b){function c(){h.push(this)}var d,e,f,g,h=[],i=[],j=this._connectWith();if(j&&b)for(d=j.length-1;d>=0;d--)for(f=a(j[d],this.document[0]),e=f.length-1;e>=0;e--)g=a.data(f[e],this.widgetFullName),g&&g!==this&&!g.options.disabled&&i.push([a.isFunction(g.options.items)?g.options.items.call(g.element):a(g.options.items,g.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),g]);for(i.push([a.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):a(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),d=i.length-1;d>=0;d--)i[d][0].each(c);return a(h)},_removeCurrentsFromItems:function(){var b=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=a.grep(this.items,function(a){for(var c=0;b.length>c;c++)if(b[c]===a.item[0])return!1;return!0})},_refreshItems:function(b){this.items=[],this.containers=[this];var c,d,e,f,g,h,i,j,k=this.items,l=[[a.isFunction(this.options.items)?this.options.items.call(this.element[0],b,{item:this.currentItem}):a(this.options.items,this.element),this]],m=this._connectWith();if(m&&this.ready)for(c=m.length-1;c>=0;c--)for(e=a(m[c],this.document[0]),d=e.length-1;d>=0;d--)f=a.data(e[d],this.widgetFullName),f&&f!==this&&!f.options.disabled&&(l.push([a.isFunction(f.options.items)?f.options.items.call(f.element[0],b,{item:this.currentItem}):a(f.options.items,f.element),f]),this.containers.push(f));for(c=l.length-1;c>=0;c--)for(g=l[c][1],h=l[c][0],d=0,j=h.length;j>d;d++)i=a(h[d]),i.data(this.widgetName+"-item",g),k.push({item:i,instance:g,width:0,height:0,left:0,top:0})},refreshPositions:function(b){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var c,d,e,f;for(c=this.items.length-1;c>=0;c--)d=this.items[c],d.instance!==this.currentContainer&&this.currentContainer&&d.item[0]!==this.currentItem[0]||(e=this.options.toleranceElement?a(this.options.toleranceElement,d.item):d.item,b||(d.width=e.outerWidth(),d.height=e.outerHeight()),f=e.offset(),d.left=f.left,d.top=f.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(c=this.containers.length-1;c>=0;c--)f=this.containers[c].element.offset(),this.containers[c].containerCache.left=f.left,this.containers[c].containerCache.top=f.top,this.containers[c].containerCache.width=this.containers[c].element.outerWidth(),this.containers[c].containerCache.height=this.containers[c].element.outerHeight();return this},_createPlaceholder:function(b){b=b||this;var c,d=b.options;d.placeholder&&d.placeholder.constructor!==String||(c=d.placeholder,d.placeholder={element:function(){var d=b.currentItem[0].nodeName.toLowerCase(),e=a("<"+d+">",b.document[0]).addClass(c||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tbody"===d?b._createTrPlaceholder(b.currentItem.find("tr").eq(0),a("<tr>",b.document[0]).appendTo(e)):"tr"===d?b._createTrPlaceholder(b.currentItem,e):"img"===d&&e.attr("src",b.currentItem.attr("src")),c||e.css("visibility","hidden"),e},update:function(a,e){(!c||d.forcePlaceholderSize)&&(e.height()||e.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10)))}}),b.placeholder=a(d.placeholder.element.call(b.element,b.currentItem)),b.currentItem.after(b.placeholder),d.placeholder.update(b,b.placeholder)},_createTrPlaceholder:function(b,c){var d=this;b.children().each(function(){a("<td>&#160;</td>",d.document[0]).attr("colspan",a(this).attr("colspan")||1).appendTo(c)})},_contactContainers:function(b){var c,d,e,f,g,h,i,j,k,l,m=null,n=null;for(c=this.containers.length-1;c>=0;c--)if(!a.contains(this.currentItem[0],this.containers[c].element[0]))if(this._intersectsWith(this.containers[c].containerCache)){if(m&&a.contains(this.containers[c].element[0],m.element[0]))continue;m=this.containers[c],n=c}else this.containers[c].containerCache.over&&(this.containers[c]._trigger("out",b,this._uiHash(this)),this.containers[c].containerCache.over=0);if(m)if(1===this.containers.length)this.containers[n].containerCache.over||(this.containers[n]._trigger("over",b,this._uiHash(this)),this.containers[n].containerCache.over=1);else{for(e=1e4,f=null,k=m.floating||this._isFloating(this.currentItem),g=k?"left":"top",h=k?"width":"height",l=k?"clientX":"clientY",d=this.items.length-1;d>=0;d--)a.contains(this.containers[n].element[0],this.items[d].item[0])&&this.items[d].item[0]!==this.currentItem[0]&&(i=this.items[d].item.offset()[g],j=!1,b[l]-i>this.items[d][h]/2&&(j=!0),e>Math.abs(b[l]-i)&&(e=Math.abs(b[l]-i),f=this.items[d],this.direction=j?"up":"down"));if(!f&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[n])return void(this.currentContainer.containerCache.over||(this.containers[n]._trigger("over",b,this._uiHash()),this.currentContainer.containerCache.over=1));f?this._rearrange(b,f,null,!0):this._rearrange(b,null,this.containers[n].element,!0),this._trigger("change",b,this._uiHash()),this.containers[n]._trigger("change",b,this._uiHash(this)),this.currentContainer=this.containers[n],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[n]._trigger("over",b,this._uiHash(this)),this.containers[n].containerCache.over=1}},_createHelper:function(b){var c=this.options,d=a.isFunction(c.helper)?a(c.helper.apply(this.element[0],[b,this.currentItem])):"clone"===c.helper?this.currentItem.clone():this.currentItem;return d.parents("body").length||a("parent"!==c.appendTo?c.appendTo:this.currentItem[0].parentNode)[0].appendChild(d[0]),d[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!d[0].style.width||c.forceHelperSize)&&d.width(this.currentItem.width()),(!d[0].style.height||c.forceHelperSize)&&d.height(this.currentItem.height()),d},_adjustOffsetFromHelper:function(b){"string"==typeof b&&(b=b.split(" ")),a.isArray(b)&&(b={left:+b[0],top:+b[1]||0}),"left"in b&&(this.offset.click.left=b.left+this.margins.left),"right"in b&&(this.offset.click.left=this.helperProportions.width-b.right+this.margins.left),"top"in b&&(this.offset.click.top=b.top+this.margins.top),"bottom"in b&&(this.offset.click.top=this.helperProportions.height-b.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var b=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&a.contains(this.scrollParent[0],this.offsetParent[0])&&(b.left+=this.scrollParent.scrollLeft(),b.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&a.ui.ie)&&(b={top:0,left:0}),{top:b.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:b.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var b,c,d,e=this.options;"parent"===e.containment&&(e.containment=this.helper[0].parentNode),("document"===e.containment||"window"===e.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===e.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===e.containment?this.document.width():this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),

/^(document|window|parent)$/.test(e.containment)||(b=a(e.containment)[0],c=a(e.containment).offset(),d="hidden"!==a(b).css("overflow"),this.containment=[c.left+(parseInt(a(b).css("borderLeftWidth"),10)||0)+(parseInt(a(b).css("paddingLeft"),10)||0)-this.margins.left,c.top+(parseInt(a(b).css("borderTopWidth"),10)||0)+(parseInt(a(b).css("paddingTop"),10)||0)-this.margins.top,c.left+(d?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(a(b).css("borderLeftWidth"),10)||0)-(parseInt(a(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,c.top+(d?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(a(b).css("borderTopWidth"),10)||0)-(parseInt(a(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(b,c){c||(c=this.position);var d="absolute"===b?1:-1,e="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&a.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,f=/(html|body)/i.test(e[0].tagName);return{top:c.top+this.offset.relative.top*d+this.offset.parent.top*d-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():f?0:e.scrollTop())*d,left:c.left+this.offset.relative.left*d+this.offset.parent.left*d-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():f?0:e.scrollLeft())*d}},_generatePosition:function(b){var c,d,e=this.options,f=b.pageX,g=b.pageY,h="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&a.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,i=/(html|body)/i.test(h[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(b.pageX-this.offset.click.left<this.containment[0]&&(f=this.containment[0]+this.offset.click.left),b.pageY-this.offset.click.top<this.containment[1]&&(g=this.containment[1]+this.offset.click.top),b.pageX-this.offset.click.left>this.containment[2]&&(f=this.containment[2]+this.offset.click.left),b.pageY-this.offset.click.top>this.containment[3]&&(g=this.containment[3]+this.offset.click.top)),e.grid&&(c=this.originalPageY+Math.round((g-this.originalPageY)/e.grid[1])*e.grid[1],g=this.containment?c-this.offset.click.top>=this.containment[1]&&c-this.offset.click.top<=this.containment[3]?c:c-this.offset.click.top>=this.containment[1]?c-e.grid[1]:c+e.grid[1]:c,d=this.originalPageX+Math.round((f-this.originalPageX)/e.grid[0])*e.grid[0],f=this.containment?d-this.offset.click.left>=this.containment[0]&&d-this.offset.click.left<=this.containment[2]?d:d-this.offset.click.left>=this.containment[0]?d-e.grid[0]:d+e.grid[0]:d)),{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():i?0:h.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():i?0:h.scrollLeft())}},_rearrange:function(a,b,c,d){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?b.item[0]:b.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var e=this.counter;this._delay(function(){e===this.counter&&this.refreshPositions(!d)})},_clear:function(a,b){function c(a,b,c){return function(d){c._trigger(a,d,b._uiHash(b))}}this.reverting=!1;var d,e=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(d in this._storedCSS)("auto"===this._storedCSS[d]||"static"===this._storedCSS[d])&&(this._storedCSS[d]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!b&&e.push(function(a){this._trigger("receive",a,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||b||e.push(function(a){this._trigger("update",a,this._uiHash())}),this!==this.currentContainer&&(b||(e.push(function(a){this._trigger("remove",a,this._uiHash())}),e.push(function(a){return function(b){a._trigger("receive",b,this._uiHash(this))}}.call(this,this.currentContainer)),e.push(function(a){return function(b){a._trigger("update",b,this._uiHash(this))}}.call(this,this.currentContainer)))),d=this.containers.length-1;d>=0;d--)b||e.push(c("deactivate",this,this.containers[d])),this.containers[d].containerCache.over&&(e.push(c("out",this,this.containers[d])),this.containers[d].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,b||this._trigger("beforeStop",a,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!b){for(d=0;e.length>d;d++)e[d].call(this,a);this._trigger("stop",a,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){a.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(b){var c=b||this;return{helper:c.helper,placeholder:c.placeholder||a([]),position:c.position,originalPosition:c.originalPosition,offset:c.positionAbs,item:c.currentItem,sender:b?b.element:null}}})}),function(a){var b=function(){return{isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},isBlankString:function(a){return!a||/^\s*$/.test(a)},escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isString:function(a){return"string"==typeof a},isNumber:function(a){return"number"==typeof a},isArray:a.isArray,isFunction:a.isFunction,isObject:a.isPlainObject,isUndefined:function(a){return"undefined"==typeof a},toStr:function(a){return b.isUndefined(a)||null===a?"":a+""},bind:a.proxy,each:function(b,c){function d(a,b){return c(b,a)}a.each(b,d)},map:a.map,filter:a.grep,every:function(b,c){var d=!0;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?void 0:!1}),!!d):d},some:function(b,c){var d=!1;return b?(a.each(b,function(a,e){return(d=c.call(null,e,a,b))?!1:void 0}),!!d):d},mixin:a.extend,getUniqueId:function(){var a=0;return function(){return a++}}(),templatify:function(b){function c(){return String(b)}return a.isFunction(b)?b:c},defer:function(a){setTimeout(a,0)},debounce:function(a,b,c){var d,e;return function(){var f,g,h=this,i=arguments;return f=function(){d=null,c||(e=a.apply(h,i))},g=c&&!d,clearTimeout(d),d=setTimeout(f,b),g&&(e=a.apply(h,i)),e}},throttle:function(a,b){var c,d,e,f,g,h;return g=0,h=function(){g=new Date,e=null,f=a.apply(c,d)},function(){var i=new Date,j=b-(i-g);return c=this,d=arguments,0>=j?(clearTimeout(e),e=null,g=i,f=a.apply(c,d)):e||(e=setTimeout(h,j)),f}},noop:function(){}}}(),c=function(){return{wrapper:'<span class="twitter-typeahead"></span>',dropdown:'<span class="tt-dropdown-menu"></span>',dataset:'<div class="tt-dataset-%CLASS%"></div>',suggestions:'<span class="tt-suggestions"></span>',suggestion:'<div class="tt-suggestion"></div>'}}(),d=function(){var a={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:" 0"}};return b.isMsie()&&b.mixin(a.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),b.isMsie()&&b.isMsie()<=7&&b.mixin(a.input,{marginTop:"-1px"}),a}(),e=function(){function c(b){b&&b.el||a.error("EventBus initialized without el"),this.$el=a(b.el)}var d="typeahead:";return b.mixin(c.prototype,{trigger:function(a){var b=[].slice.call(arguments,1);this.$el.trigger(d+a,b)}}),c}(),f=function(){function a(a,b,c,d){var e;if(!c)return this;for(b=b.split(i),c=d?h(c,d):c,this._callbacks=this._callbacks||{};e=b.shift();)this._callbacks[e]=this._callbacks[e]||{sync:[],async:[]},this._callbacks[e][a].push(c);return this}function b(b,c,d){return a.call(this,"async",b,c,d)}function c(b,c,d){return a.call(this,"sync",b,c,d)}function d(a){var b;if(!this._callbacks)return this;for(a=a.split(i);b=a.shift();)delete this._callbacks[b];return this}function e(a){var b,c,d,e,g;if(!this._callbacks)return this;for(a=a.split(i),d=[].slice.call(arguments,1);(b=a.shift())&&(c=this._callbacks[b]);)e=f(c.sync,this,[b].concat(d)),g=f(c.async,this,[b].concat(d)),e()&&j(g);return this}function f(a,b,c){function d(){for(var d,e=0,f=a.length;!d&&f>e;e+=1)d=a[e].apply(b,c)===!1;return!d}return d}function g(){var a;return a=window.setImmediate?function(a){setImmediate(function(){a()})}:function(a){setTimeout(function(){a()},0)}}function h(a,b){return a.bind?a.bind(b):function(){a.apply(b,[].slice.call(arguments,0))}}var i=/\s+/,j=g();return{onSync:c,onAsync:b,off:d,trigger:e}}(),g=function(a){function c(a,c,d){for(var e,f=[],g=0,h=a.length;h>g;g++)f.push(b.escapeRegExChars(a[g]));return e=d?"\\b("+f.join("|")+")\\b":"("+f.join("|")+")",c?new RegExp(e):new RegExp(e,"i")}var d={node:null,pattern:null,tagName:"strong",className:null,wordsOnly:!1,caseSensitive:!1};return function(e){function f(b){var c,d,f;return(c=h.exec(b.data))&&(f=a.createElement(e.tagName),e.className&&(f.className=e.className),d=b.splitText(c.index),d.splitText(c[0].length),f.appendChild(d.cloneNode(!0)),b.parentNode.replaceChild(f,d)),!!c}function g(a,b){for(var c,d=3,e=0;e<a.childNodes.length;e++)c=a.childNodes[e],c.nodeType===d?e+=b(c)?1:0:g(c,b)}var h;e=b.mixin({},d,e),e.node&&e.pattern&&(e.pattern=b.isArray(e.pattern)?e.pattern:[e.pattern],h=c(e.pattern,e.caseSensitive,e.wordsOnly),g(e.node,f))}}(window.document),h=function(){function c(c){var e,f,g,i,j=this;c=c||{},c.input||a.error("input is missing"),e=b.bind(this._onBlur,this),f=b.bind(this._onFocus,this),g=b.bind(this._onKeydown,this),i=b.bind(this._onInput,this),this.$hint=a(c.hint),this.$input=a(c.input).on("blur.tt",e).on("focus.tt",f).on("keydown.tt",g),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=b.noop),b.isMsie()?this.$input.on("keydown.tt keypress.tt cut.tt paste.tt",function(a){h[a.which||a.keyCode]||b.defer(b.bind(j._onInput,j,a))}):this.$input.on("input.tt",i),this.query=this.$input.val(),this.$overflowHelper=d(this.$input)}function d(b){return a('<pre aria-hidden="true"></pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:b.css("font-family"),fontSize:b.css("font-size"),fontStyle:b.css("font-style"),fontVariant:b.css("font-variant"),fontWeight:b.css("font-weight"),wordSpacing:b.css("word-spacing"),letterSpacing:b.css("letter-spacing"),textIndent:b.css("text-indent"),textRendering:b.css("text-rendering"),textTransform:b.css("text-transform")}).insertAfter(b)}function e(a,b){return c.normalizeQuery(a)===c.normalizeQuery(b)}function g(a){return a.altKey||a.ctrlKey||a.metaKey||a.shiftKey}var h;return h={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"},c.normalizeQuery=function(a){return(a||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},b.mixin(c.prototype,f,{_onBlur:function(){this.resetInputValue(),this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(a){var b=h[a.which||a.keyCode];this._managePreventDefault(b,a),b&&this._shouldTrigger(b,a)&&this.trigger(b+"Keyed",a)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(a,b){var c,d,e;switch(a){case"tab":d=this.getHint(),e=this.getInputValue(),c=d&&d!==e&&!g(b);break;case"up":case"down":c=!g(b);break;default:c=!1}c&&b.preventDefault()},_shouldTrigger:function(a,b){var c;switch(a){case"tab":c=!g(b);break;default:c=!0}return c},_checkInputValue:function(){var a,b,c;a=this.getInputValue(),b=e(a,this.query),c=b?this.query.length!==a.length:!1,this.query=a,b?c&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(a){this.query=a},getInputValue:function(){return this.$input.val()},setInputValue:function(a,b){this.$input.val(a),b?this.clearHint():this._checkInputValue()},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(a){this.$hint.val(a)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var a,b,c,d;a=this.getInputValue(),b=this.getHint(),c=a!==b&&0===b.indexOf(a),d=""!==a&&c&&!this.hasOverflow(),!d&&this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var a=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=a},isCursorAtEnd:function(){var a,c,d;return a=this.$input.val().length,c=this.$input[0].selectionStart,b.isNumber(c)?c===a:document.selection?(d=document.selection.createRange(),d.moveStart("character",-a),a===d.text.length):!0},destroy:function(){this.$hint.off(".tt"),this.$input.off(".tt"),this.$hint=this.$input=this.$overflowHelper=null}}),c}(),i=function(){function e(d){d=d||{},d.templates=d.templates||{},d.source||a.error("missing source"),d.name&&!j(d.name)&&a.error("invalid dataset name: "+d.name),this.query=null,this.highlight=!!d.highlight,this.name=d.name||b.getUniqueId(),this.source=d.source,this.displayFn=h(d.display||d.displayKey),this.templates=i(d.templates,this.displayFn),this.$el=a(c.dataset.replace("%CLASS%",this.name))}function h(a){function c(b){return b[a]}return a=a||"value",b.isFunction(a)?a:c}function i(a,c){function d(a){return"<p>"+c(a)+"</p>"}return{empty:a.empty&&b.templatify(a.empty),header:a.header&&b.templatify(a.header),footer:a.footer&&b.templatify(a.footer),suggestion:a.suggestion||d}}function j(a){return/^[_a-zA-Z0-9-]+$/.test(a)}var k="ttDataset",l="ttValue",m="ttDatum";return e.extractDatasetName=function(b){return a(b).data(k)},e.extractValue=function(b){return a(b).data(l)},e.extractDatum=function(b){return a(b).data(m)},b.mixin(e.prototype,f,{_render:function(e,f){function h(){return p.templates.empty({query:e,isEmpty:!0})}function i(){function h(b){var e;return e=a(c.suggestion).append(p.templates.suggestion(b)).data(k,p.name).data(l,p.displayFn(b)).data(m,b),e.children().each(function(){a(this).css(d.suggestionChild)}),e}var i,j;return i=a(c.suggestions).css(d.suggestions),j=b.map(f,h),i.append.apply(i,j),p.highlight&&g({className:"tt-highlight",node:i[0],pattern:e}),i}function j(){return p.templates.header({query:e,isEmpty:!o})}function n(){return p.templates.footer({query:e,isEmpty:!o})}if(this.$el){var o,p=this;this.$el.empty(),o=f&&f.length,!o&&this.templates.empty?this.$el.html(h()).prepend(p.templates.header?j():null).append(p.templates.footer?n():null):o&&this.$el.html(i()).prepend(p.templates.header?j():null).append(p.templates.footer?n():null),this.trigger("rendered")}},getRoot:function(){return this.$el},update:function(a){function b(b){c.canceled||a!==c.query||c._render(a,b)}var c=this;this.query=a,this.canceled=!1,this.source(a,b)},cancel:function(){this.canceled=!0},clear:function(){this.cancel(),this.$el.empty(),this.trigger("rendered")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=null}}),e}(),j=function(){function c(c){var d,f,g,h=this;c=c||{},c.menu||a.error("menu is required"),this.isOpen=!1,this.isEmpty=!0,this.datasets=b.map(c.datasets,e),d=b.bind(this._onSuggestionClick,this),f=b.bind(this._onSuggestionMouseEnter,this),g=b.bind(this._onSuggestionMouseLeave,this),this.$menu=a(c.menu).on("click.tt",".tt-suggestion",d).on("mouseenter.tt",".tt-suggestion",f).on("mouseleave.tt",".tt-suggestion",g),b.each(this.datasets,function(a){h.$menu.append(a.getRoot()),a.onSync("rendered",h._onRendered,h)})}function e(a){return new i(a)}return b.mixin(c.prototype,f,{_onSuggestionClick:function(b){this.trigger("suggestionClicked",a(b.currentTarget))},_onSuggestionMouseEnter:function(b){this._removeCursor(),this._setCursor(a(b.currentTarget),!0)},_onSuggestionMouseLeave:function(){this._removeCursor()},_onRendered:function(){function a(a){return a.isEmpty()}this.isEmpty=b.every(this.datasets,a),this.isEmpty?this._hide():this.isOpen&&this._show(),this.trigger("datasetRendered")},_hide:function(){this.$menu.hide()},_show:function(){this.$menu.css("display","block")},_getSuggestions:function(){return this.$menu.find(".tt-suggestion")},_getCursor:function(){return this.$menu.find(".tt-cursor").first()},_setCursor:function(a,b){a.first().addClass("tt-cursor"),!b&&this.trigger("cursorMoved")},_removeCursor:function(){this._getCursor().removeClass("tt-cursor")},_moveCursor:function(a){var b,c,d,e;if(this.isOpen){if(c=this._getCursor(),b=this._getSuggestions(),this._removeCursor(),d=b.index(c)+a,d=(d+1)%(b.length+1)-1,-1===d)return void this.trigger("cursorRemoved");-1>d&&(d=b.length-1),this._setCursor(e=b.eq(d)),this._ensureVisible(e)}},_ensureVisible:function(a){var b,c,d,e;b=a.position().top,c=b+a.outerHeight(!0),d=this.$menu.scrollTop(),e=this.$menu.height()+parseInt(this.$menu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10),0>b?this.$menu.scrollTop(d+b):c>e&&this.$menu.scrollTop(d+(c-e))},close:function(){this.isOpen&&(this.isOpen=!1,this._removeCursor(),this._hide(),this.trigger("closed"))},open:function(){this.isOpen||(this.isOpen=!0,!this.isEmpty&&this._show(),this.trigger("opened"))},setLanguageDirection:function(a){this.$menu.css("ltr"===a?d.ltr:d.rtl)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getDatumForSuggestion:function(a){var b=null;return a.length&&(b={raw:i.extractDatum(a),value:i.extractValue(a),datasetName:i.extractDatasetName(a)}),b},getDatumForCursor:function(){return this.getDatumForSuggestion(this._getCursor().first())},getDatumForTopSuggestion:function(){return this.getDatumForSuggestion(this._getSuggestions().first())},update:function(a){function c(b){b.update(a)}b.each(this.datasets,c)},empty:function(){function a(a){a.clear()}b.each(this.datasets,a),this.isEmpty=!0},isVisible:function(){return this.isOpen&&!this.isEmpty},destroy:function(){function a(a){a.destroy()}this.$menu.off(".tt"),this.$menu=null,b.each(this.datasets,a)}}),c}(),k=function(){function f(c){var d,f,i;c=c||{},c.input||a.error("missing input"),this.isActivated=!1,this.autoselect=!!c.autoselect,this.minLength=b.isNumber(c.minLength)?c.minLength:1,this.$node=g(c.input,c.withHint),d=this.$node.find(".tt-dropdown-menu"),f=this.$node.find(".tt-input"),i=this.$node.find(".tt-hint"),f.on("blur.tt",function(a){var c,e,g;c=document.activeElement,e=d.is(c),g=d.has(c).length>0,b.isMsie()&&(e||g)&&(a.preventDefault(),a.stopImmediatePropagation(),b.defer(function(){f.focus()}))}),d.on("mousedown.tt",function(a){a.preventDefault()}),this.eventBus=c.eventBus||new e({el:f}),this.dropdown=new j({menu:d,datasets:c.datasets}).onSync("suggestionClicked",this._onSuggestionClicked,this).onSync("cursorMoved",this._onCursorMoved,this).onSync("cursorRemoved",this._onCursorRemoved,this).onSync("opened",this._onOpened,this).onSync("closed",this._onClosed,this).onAsync("datasetRendered",this._onDatasetRendered,this),this.input=new h({input:f,hint:i}).onSync("focused",this._onFocused,this).onSync("blurred",this._onBlurred,this).onSync("enterKeyed",this._onEnterKeyed,this).onSync("tabKeyed",this._onTabKeyed,this).onSync("escKeyed",this._onEscKeyed,this).onSync("upKeyed",this._onUpKeyed,this).onSync("downKeyed",this._onDownKeyed,this).onSync("leftKeyed",this._onLeftKeyed,this).onSync("rightKeyed",this._onRightKeyed,this).onSync("queryChanged",this._onQueryChanged,this).onSync("whitespaceChanged",this._onWhitespaceChanged,this),this._setLanguageDirection()}function g(b,e){var f,g,h,j;f=a(b),g=a(c.wrapper).css(d.wrapper),h=a(c.dropdown).css(d.dropdown),j=f.clone().css(d.hint).css(i(f)),j.val("").removeData().addClass("tt-hint").removeAttr("id name placeholder required").prop("readonly",!0).attr({autocomplete:"off",spellcheck:"false",tabindex:-1}),f.data(l,{dir:f.attr("dir"),autocomplete:f.attr("autocomplete"),spellcheck:f.attr("spellcheck"),style:f.attr("style")}),f.addClass("tt-input").attr({autocomplete:"off",spellcheck:!1}).css(e?d.input:d.inputWithNoHint);try{!f.attr("dir")&&f.attr("dir","auto")}catch(k){}return f.wrap(g).parent().prepend(e?j:null).append(h)}function i(a){return{backgroundAttachment:a.css("background-attachment"),backgroundClip:a.css("background-clip"),backgroundColor:a.css("background-color"),backgroundImage:a.css("background-image"),backgroundOrigin:a.css("background-origin"),backgroundPosition:a.css("background-position"),backgroundRepeat:a.css("background-repeat"),backgroundSize:a.css("background-size")}}function k(a){var c=a.find(".tt-input");b.each(c.data(l),function(a,d){b.isUndefined(a)?c.removeAttr(d):c.attr(d,a)}),c.detach().removeData(l).removeClass("tt-input").insertAfter(a),a.remove()}var l="ttAttrs";return b.mixin(f.prototype,{_onSuggestionClicked:function(a,b){var c;(c=this.dropdown.getDatumForSuggestion(b))&&this._select(c)},_onCursorMoved:function(){var a=this.dropdown.getDatumForCursor();this.input.setInputValue(a.value,!0),this.eventBus.trigger("cursorchanged",a.raw,a.datasetName)},_onCursorRemoved:function(){this.input.resetInputValue(),this._updateHint()},_onDatasetRendered:function(){this._updateHint()},_onOpened:function(){this._updateHint(),this.eventBus.trigger("opened")},_onClosed:function(){this.input.clearHint(),this.eventBus.trigger("closed")},_onFocused:function(){this.isActivated=!0,this.dropdown.open()},_onBlurred:function(){this.isActivated=!1,this.dropdown.empty(),this.dropdown.close()},_onEnterKeyed:function(a,b){var c,d;c=this.dropdown.getDatumForCursor(),d=this.dropdown.getDatumForTopSuggestion(),c?(this._select(c),b.preventDefault()):this.autoselect&&d&&(this._select(d),b.preventDefault())},_onTabKeyed:function(a,b){var c;(c=this.dropdown.getDatumForCursor())?(this._select(c),b.preventDefault()):this._autocomplete(!0)},_onEscKeyed:function(){this.dropdown.close(),this.input.resetInputValue()},_onUpKeyed:function(){var a=this.input.getQuery();this.dropdown.isEmpty&&a.length>=this.minLength?this.dropdown.update(a):this.dropdown.moveCursorUp(),this.dropdown.open()},_onDownKeyed:function(){var a=this.input.getQuery();this.dropdown.isEmpty&&a.length>=this.minLength?this.dropdown.update(a):this.dropdown.moveCursorDown(),this.dropdown.open()},_onLeftKeyed:function(){"rtl"===this.dir&&this._autocomplete()},_onRightKeyed:function(){"ltr"===this.dir&&this._autocomplete()},_onQueryChanged:function(a,b){this.input.clearHintIfInvalid(),b.length>=this.minLength?this.dropdown.update(b):this.dropdown.empty(),this.dropdown.open(),this._setLanguageDirection()},_onWhitespaceChanged:function(){this._updateHint(),this.dropdown.open()},_setLanguageDirection:function(){var a;this.dir!==(a=this.input.getLanguageDirection())&&(this.dir=a,this.$node.css("direction",a),this.dropdown.setLanguageDirection(a))},_updateHint:function(){var a,c,d,e,f,g;a=this.dropdown.getDatumForTopSuggestion(),a&&this.dropdown.isVisible()&&!this.input.hasOverflow()?(c=this.input.getInputValue(),d=h.normalizeQuery(c),e=b.escapeRegExChars(d),f=new RegExp("^(?:"+e+")(.+$)","i"),g=f.exec(a.value),g?this.input.setHint(c+g[1]):this.input.clearHint()):this.input.clearHint()},_autocomplete:function(a){var b,c,d,e;b=this.input.getHint(),c=this.input.getQuery(),d=a||this.input.isCursorAtEnd(),b&&c!==b&&d&&(e=this.dropdown.getDatumForTopSuggestion(),e&&this.input.setInputValue(e.value),this.eventBus.trigger("autocompleted",e.raw,e.datasetName))},_select:function(a){this.input.setQuery(a.value),this.input.setInputValue(a.value,!0),this._setLanguageDirection(),this.eventBus.trigger("selected",a.raw,a.datasetName),this.dropdown.close(),b.defer(b.bind(this.dropdown.empty,this.dropdown))},open:function(){this.dropdown.open()},close:function(){this.dropdown.close()},setVal:function(a){a=b.toStr(a),this.isActivated?this.input.setInputValue(a):(this.input.setQuery(a),this.input.setInputValue(a,!0)),this._setLanguageDirection()},getVal:function(){return this.input.getQuery()},destroy:function(){this.input.destroy(),this.dropdown.destroy(),k(this.$node),this.$node=null}}),f}();!function(){var c,d,f;c=a.fn.typeahead,d="ttTypeahead",f={initialize:function(c,f){function g(){var g,h,i=a(this);b.each(f,function(a){a.highlight=!!c.highlight}),h=new k({input:i,eventBus:g=new e({el:i}),withHint:b.isUndefined(c.hint)?!0:!!c.hint,minLength:c.minLength,autoselect:c.autoselect,datasets:f}),i.data(d,h)}return f=b.isArray(f)?f:[].slice.call(arguments,1),c=c||{},this.each(g)},open:function(){function b(){var b,c=a(this);(b=c.data(d))&&b.open()}return this.each(b)},close:function(){function b(){var b,c=a(this);(b=c.data(d))&&b.close()}return this.each(b)},val:function(b){function c(){var c,e=a(this);(c=e.data(d))&&c.setVal(b)}function e(a){var b,c;return(b=a.data(d))&&(c=b.getVal()),c}return arguments.length?this.each(c):e(this.first())},destroy:function(){function b(){var b,c=a(this);(b=c.data(d))&&(b.destroy(),c.removeData(d))}return this.each(b)}},a.fn.typeahead=function(b){var c;return f[b]&&"initialize"!==b?(c=this.filter(function(){return!!a(this).data(d)}),f[b].apply(c,[].slice.call(arguments,1))):f.initialize.apply(this,arguments)},a.fn.typeahead.noConflict=function(){return a.fn.typeahead=c,this}}()}(window.jQuery),function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=global.window&&global.window.$?a(global.window.$):function(b){if(!b.$&&!b.fn)throw new Error("Tokenfield requires a window object with jQuery or a jQuery instance");return a(b.$||b)}:a(jQuery,window)}(function(a,b){var c=function(b,c){var d=this;this.$element=a(b),this.textDirection=this.$element.css("direction"),this.options=a.extend(!0,{},a.fn.tokenfield.defaults,{tokens:this.$element.val()},this.$element.data(),c),this._delimiters="string"==typeof this.options.delimiter?[this.options.delimiter]:this.options.delimiter,this._triggerKeys=a.map(this._delimiters,function(a){return a.charCodeAt(0)}),this._firstDelimiter=this._delimiters[0];var e=a.inArray(" ",this._delimiters),f=a.inArray("-",this._delimiters);e>=0&&(this._delimiters[e]="\\s"),f>=0&&(delete this._delimiters[f],this._delimiters.unshift("-"));var g=["\\","$","[","{","^",".","|","?","*","+","(",")"];a.each(this._delimiters,function(b,c){var e=a.inArray(c,g);e>=0&&(d._delimiters[b]="\\"+c)});var h=b.style.width,i=this.$element.width(),j="rtl"===a("body").css("direction")?"right":"left",k={position:this.$element.css("position")};k[j]=this.$element.css(j),this.$element.data("original-styles",k).data("original-tabindex",this.$element.prop("tabindex")).css("position","absolute").css(j,"-10000px").prop("tabindex",-1),this.$wrapper=a('<div class="tokenfield form-control" />'),this.$element.hasClass("input-lg")&&this.$wrapper.addClass("input-lg"),this.$element.hasClass("input-sm")&&this.$wrapper.addClass("input-sm"),"rtl"===this.textDirection&&this.$wrapper.addClass("rtl");var l=this.$element.prop("id")||(new Date).getTime()+""+Math.floor(100*(1+Math.random()));this.$input=a('<input type="'+this.options.inputType+'" class="token-input" autocomplete="off" />').appendTo(this.$wrapper).prop("placeholder",this.$element.prop("placeholder")).prop("id",l+"-tokenfield").prop("tabindex",this.$element.data("original-tabindex"));var m=a('label[for="'+this.$element.prop("id")+'"]');if(m.length&&m.prop("for",this.$input.prop("id")),this.$copyHelper=a('<input type="text" />').css("position","absolute").css(j,"-10000px").prop("tabindex",-1).prependTo(this.$wrapper),h?this.$wrapper.css("width",h):this.$element.parents(".form-inline").length&&this.$wrapper.width(i),(this.$element.prop("disabled")||this.$element.parents("fieldset[disabled]").length)&&this.disable(),this.$element.prop("readonly")&&this.readonly(),this.$mirror=a('<span style="position:absolute;top:-9999px;left:-9999px;white-space:pre;"/>'),this.$input.css("min-width",this.options.minWidth+"px"),this.$wrapper.insertBefore(this.$element),this.$element.prependTo(this.$wrapper),this.$mirror.appendTo(this.$wrapper),this.update(),this.setTokens(this.options.tokens,!1,!this.$element.val()&&this.options.tokens),this.listen(),!a.isEmptyObject(this.options.autocomplete)){var n="rtl"===this.textDirection?"right":"left",o=a.extend({minLength:this.options.showAutocompleteOnFocus?0:null,position:{my:n+" top",at:n+" bottom",of:this.$wrapper}},this.options.autocomplete);this.$input.autocomplete(o)}if(!a.isEmptyObject(this.options.typeahead)){var p=this.options.typeahead,q={minLength:this.options.showAutocompleteOnFocus?0:null},r=a.isArray(p)?p:[p,p];r[0]=a.extend({},q,r[0]),this.$input.typeahead.apply(this.$input,r),this.typeahead=!0}};c.prototype={constructor:c,createToken:function(b,c){var d=this;if(b="string"==typeof b?{value:b,label:b}:a.extend({},b),"undefined"==typeof c&&(c=!0),b.value=a.trim(b.value.toString()),b.label=b.label&&b.label.length?a.trim(b.label):b.value,!(!b.value.length||!b.label.length||b.label.length<this.options.minLength||this.options.limit&&this.getTokens().length>=this.options.limit)){var e=a.Event("tokenfield:createtoken",{attrs:b});if(this.$element.trigger(e),e.attrs&&!e.isDefaultPrevented()){var f=a('<div class="token" />').append('<span class="token-label" />').append('<a href="#" class="close" tabindex="-1" aria-label="Remove">&times;</a>').data("attrs",b);this.$input.hasClass("tt-input")?this.$input.parent().before(f):this.$input.before(f),this.$input.css("width",this.options.minWidth+"px");var g=f.find(".token-label"),h=f.find(".close");return this.options.html?g.html(b.label):g.text(b.label),f.on("mousedown",function(){return d._disabled||d._readonly?!1:void(d.preventDeactivation=!0)}).on("click",function(a){return d._disabled||d._readonly?!1:(d.preventDeactivation=!1,a.ctrlKey||a.metaKey?(a.preventDefault(),d.toggle(f)):void d.activate(f,a.shiftKey,a.shiftKey))}).on("dblclick",function(){return d._disabled||d._readonly||!d.options.allowEditing?!1:void d.edit(f)}),h.on("click",a.proxy(this.remove,this)),this.$element.trigger(a.Event("tokenfield:createdtoken",{attrs:b,relatedTarget:f.get(0)})),c&&this.$element.val(this.getTokensList()).trigger(a.Event("change",{initiator:"tokenfield"})),setTimeout(function(){d.maxTokenWidth||(d.maxTokenWidth=d.$wrapper.width()-h.width()-10),g.css("max-width",d.maxTokenWidth),d.update()},0),this.$element.get(0)}}},setTokens:function(b,c,d){if(c||this.$wrapper.find(".token").remove(),b){"undefined"==typeof d&&(d=!0),"string"==typeof b&&(b=this._delimiters.length?b.split(new RegExp("["+this._delimiters.join("")+"]")):[b]);var e=this;return a.each(b,function(a,b){e.createToken(b,d)}),this.$element.get(0)}},getTokenData:function(b){var c=b.map(function(){var b=a(this);return b.data("attrs")}).get();return 1===c.length&&(c=c[0]),c},getTokens:function(b){var c=this,d=[],e=b?".active":"";return this.$wrapper.find(".token"+e).each(function(){d.push(c.getTokenData(a(this)))}),d},getTokensList:function(b,c,d){b=b||this._firstDelimiter,c="undefined"!=typeof c&&null!==c?c:this.options.beautify;var e=b+(c&&" "!==b?" ":"");return a.map(this.getTokens(d),function(a){return a.value;

}).join(e)},getInput:function(){return this.$input.val()},setInput:function(a){this.$input.hasClass("tt-input")?this.$input.typeahead("val",a):this.$input.val(a)},listen:function(){var c=this;this.$element.on("change.tokenfield",a.proxy(this.change,this)),this.$wrapper.on("mousedown",a.proxy(this.focusInput,this)),this.$input.on("focus",a.proxy(this.focus,this)).on("blur",a.proxy(this.blur,this)).on("paste",a.proxy(this.paste,this)).on("keydown",a.proxy(this.keydown,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),this.$copyHelper.on("focus",a.proxy(this.focus,this)).on("blur",a.proxy(this.blur,this)).on("keydown",a.proxy(this.keydown,this)).on("keyup",a.proxy(this.keyup,this)),this.$input.on("keypress",a.proxy(this.update,this)).on("keyup",a.proxy(this.update,this)),this.$input.on("autocompletecreate",function(){var b=a(this).data("ui-autocomplete").menu.element,d=c.$wrapper.outerWidth()-parseInt(b.css("border-left-width"),10)-parseInt(b.css("border-right-width"),10);b.css("min-width",d+"px")}).on("autocompleteselect",function(a,b){return c.createToken(b.item)&&(c.$input.val(""),c.$input.data("edit")&&c.unedit(!0)),!1}).on("typeahead:selected typeahead:autocompleted",function(a,b){c.createToken(b)&&(c.$input.typeahead("val",""),c.$input.data("edit")&&c.unedit(!0))}),a(b).on("resize",a.proxy(this.update,this))},keydown:function(b){function c(a){if(e.$input.is(document.activeElement)){if(e.$input.val().length>0)return;a+="All";var c=e.$input.hasClass("tt-input")?e.$input.parent()[a](".token:first"):e.$input[a](".token:first");if(!c.length)return;e.preventInputFocus=!0,e.preventDeactivation=!0,e.activate(c),b.preventDefault()}else e[a](b.shiftKey),b.preventDefault()}function d(c){if(b.shiftKey){if(e.$input.is(document.activeElement)){if(e.$input.val().length>0)return;var d=e.$input.hasClass("tt-input")?e.$input.parent()[c+"All"](".token:first"):e.$input[c+"All"](".token:first");if(!d.length)return;e.activate(d)}var f="prev"===c?"next":"prev",g="prev"===c?"first":"last";e.$firstActiveToken[f+"All"](".token").each(function(){e.deactivate(a(this))}),e.activate(e.$wrapper.find(".token:"+g),!0,!0),b.preventDefault()}}if(this.focused){var e=this;switch(b.keyCode){case 8:if(!this.$input.is(document.activeElement))break;this.lastInputValue=this.$input.val();break;case 37:c("rtl"===this.textDirection?"next":"prev");break;case 38:d("prev");break;case 39:c("rtl"===this.textDirection?"prev":"next");break;case 40:d("next");break;case 65:if(this.$input.val().length>0||!b.ctrlKey&&!b.metaKey)break;this.activateAll(),b.preventDefault();break;case 9:case 13:if(this.$input.data("ui-autocomplete")&&this.$input.data("ui-autocomplete").menu.element.find("li:has(a.ui-state-focus), li.ui-state-focus").length)break;if(this.$input.hasClass("tt-input")&&this.$wrapper.find(".tt-cursor").length)break;if(this.$input.hasClass("tt-input")&&this.$wrapper.find(".tt-hint").val()&&this.$wrapper.find(".tt-hint").val().length)break;if(this.$input.is(document.activeElement)&&this.$input.val().length||this.$input.data("edit"))return this.createTokensFromInput(b,this.$input.data("edit"));if(this.$input.is(document.activeElement)&&13===b.keyCode&&(b.preventDefault(),this.$element.trigger("tokenfield:next")),13===b.keyCode){if(!this.$copyHelper.is(document.activeElement)||1!==this.$wrapper.find(".token.active").length)break;if(!e.options.allowEditing)break;this.edit(this.$wrapper.find(".token.active"))}}this.lastKeyDown=b.keyCode}},keypress:function(b){if(-1!==a.inArray(b.which,this._triggerKeys)&&this.$input.is(document.activeElement)){var c=this.$input.val(),d=/^"[^"]*$/.test(c);if(d)return;return c&&this.createTokensFromInput(b),!1}},keyup:function(a){if(this.preventInputFocus=!1,this.focused){switch(a.keyCode){case 8:if(this.$input.is(document.activeElement)){if(this.$input.val().length||this.lastInputValue.length&&8===this.lastKeyDown)break;this.preventDeactivation=!0;var b=this.$input.hasClass("tt-input")?this.$input.parent().prevAll(".token:first"):this.$input.prevAll(".token:first");if(!b.length)break;this.activate(b)}else this.remove(a);break;case 46:this.remove(a,"next")}this.lastKeyUp=a.keyCode}},focus:function(){this.focused=!0,this.$wrapper.addClass("focus"),this.$input.is(document.activeElement)&&(this.$wrapper.find(".active").removeClass("active"),this.$firstActiveToken=null,this.options.showAutocompleteOnFocus&&this.search())},blur:function(a){this.focused=!1,this.$wrapper.removeClass("focus"),this.preventDeactivation||this.$element.is(document.activeElement)||(this.$wrapper.find(".active").removeClass("active"),this.$firstActiveToken=null),!this.preventCreateTokens&&(this.$input.data("edit")&&!this.$input.is(document.activeElement)||this.options.createTokensOnBlur)&&this.createTokensFromInput(a),this.preventDeactivation=!1,this.preventCreateTokens=!1},paste:function(a){var b=this;b.options.allowPasting&&setTimeout(function(){b.createTokensFromInput(a)},1)},change:function(a){"tokenfield"!==a.initiator&&this.setTokens(this.$element.val())},createTokensFromInput:function(a,b){if(!(this.$input.val().length<this.options.minLength)){var c=this.getTokensList();return this.setTokens(this.$input.val(),!0),c===this.getTokensList()&&this.$input.val().length?!1:(this.setInput(""),this.$input.data("edit")&&this.unedit(b),!1)}},next:function(a){if(a){var b=this.$wrapper.find(".active:first"),c=b&&this.$firstActiveToken?b.index()<this.$firstActiveToken.index():!1;if(c)return this.deactivate(b)}var d=this.$wrapper.find(".active:last"),e=d.nextAll(".token:first");return e.length?void this.activate(e,a):void this.$input.focus()},prev:function(a){if(a){var b=this.$wrapper.find(".active:last"),c=b&&this.$firstActiveToken?b.index()>this.$firstActiveToken.index():!1;if(c)return this.deactivate(b)}var d=this.$wrapper.find(".active:first"),e=d.prevAll(".token:first");return e.length||(e=this.$wrapper.find(".token:first")),e.length||a?void this.activate(e,a):void this.$input.focus()},activate:function(b,c,d,e){if(b){if("undefined"==typeof e&&(e=!0),d&&(c=!0),this.$copyHelper.focus(),c||(this.$wrapper.find(".active").removeClass("active"),e?this.$firstActiveToken=b:delete this.$firstActiveToken),d&&this.$firstActiveToken){var f=this.$firstActiveToken.index()-2,g=b.index()-2,h=this;this.$wrapper.find(".token").slice(Math.min(f,g)+1,Math.max(f,g)).each(function(){h.activate(a(this),!0)})}b.addClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select()}},activateAll:function(){var b=this;this.$wrapper.find(".token").each(function(c){b.activate(a(this),0!==c,!1,!1)})},deactivate:function(a){a&&(a.removeClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select())},toggle:function(a){a&&(a.toggleClass("active"),this.$copyHelper.val(this.getTokensList(null,null,!0)).select())},edit:function(b){if(b){var c=b.data("attrs"),d={attrs:c,relatedTarget:b.get(0)},e=a.Event("tokenfield:edittoken",d);if(this.$element.trigger(e),!e.isDefaultPrevented()){b.find(".token-label").text(c.value);var f=b.outerWidth(),g=this.$input.hasClass("tt-input")?this.$input.parent():this.$input;b.replaceWith(g),this.preventCreateTokens=!0,this.$input.val(c.value).select().data("edit",!0).width(f),this.update(),this.$element.trigger(a.Event("tokenfield:editedtoken",d))}}},unedit:function(a){var b=this.$input.hasClass("tt-input")?this.$input.parent():this.$input;if(b.appendTo(this.$wrapper),this.$input.data("edit",!1),this.$mirror.text(""),this.update(),a){var c=this;setTimeout(function(){c.$input.focus()},1)}},remove:function(b,c){if(!(this.$input.is(document.activeElement)||this._disabled||this._readonly)){var d,e="click"===b.type?a(b.target).closest(".token"):this.$wrapper.find(".token.active");"click"!==b.type&&(c||(c="prev"),this[c](),"prev"===c&&(d=0===e.first().prevAll(".token:first").length));var f={attrs:this.getTokenData(e),relatedTarget:e.get(0)},g=a.Event("tokenfield:removetoken",f);if(this.$element.trigger(g),!g.isDefaultPrevented()){var h=a.Event("tokenfield:removedtoken",f),i=a.Event("change",{initiator:"tokenfield"});e.remove(),this.$element.val(this.getTokensList()).trigger(h).trigger(i),(!this.$wrapper.find(".token").length||"click"===b.type||d)&&this.$input.focus(),this.$input.css("width",this.options.minWidth+"px"),this.update(),b.preventDefault(),b.stopPropagation()}}},update:function(){var a=this.$input.val(),b=parseInt(this.$input.css("padding-left"),10),c=parseInt(this.$input.css("padding-right"),10),d=b+c;if(this.$input.data("edit")){if(a||(a=this.$input.prop("placeholder")),a===this.$mirror.text())return;this.$mirror.text(a);var e=this.$mirror.width()+10;if(e>this.$wrapper.width())return this.$input.width(this.$wrapper.width());this.$input.width(e)}else{this.$input.width(this.options.minWidth);var f="rtl"===this.textDirection?this.$input.offset().left+this.$input.outerWidth()-this.$wrapper.offset().left-parseInt(this.$wrapper.css("padding-left"),10)-d-1:this.$wrapper.offset().left+this.$wrapper.width()+parseInt(this.$wrapper.css("padding-left"),10)-this.$input.offset().left-d;this.$input.width(isNaN(f)?"100%":f)}},focusInput:function(b){if(!(a(b.target).closest(".token").length||a(b.target).closest(".token-input").length||a(b.target).closest(".tt-dropdown-menu").length)){var c=this;setTimeout(function(){c.$input.focus()},0)}},search:function(){this.$input.data("ui-autocomplete")&&this.$input.autocomplete("search")},disable:function(){this.setProperty("disabled",!0)},enable:function(){this.setProperty("disabled",!1)},readonly:function(){this.setProperty("readonly",!0)},writeable:function(){this.setProperty("readonly",!1)},setProperty:function(a,b){this["_"+a]=b,this.$input.prop(a,b),this.$element.prop(a,b),this.$wrapper[b?"addClass":"removeClass"](a)},destroy:function(){this.$element.val(this.getTokensList()),this.$element.css(this.$element.data("original-styles")),this.$element.prop("tabindex",this.$element.data("original-tabindex"));var b=a('label[for="'+this.$input.prop("id")+'"]');b.length&&b.prop("for",this.$element.prop("id")),this.$element.insertBefore(this.$wrapper),this.$element.off(".tokenfield"),this.$element.removeData("original-styles").removeData("original-tabindex").removeData("bs.tokenfield"),this.$wrapper.remove(),this.$mirror.remove();var c=this.$element;return c}};var d=a.fn.tokenfield;return a.fn.tokenfield=function(b,d){var e,f=[];Array.prototype.push.apply(f,arguments);var g=this.each(function(){var g=a(this),h=g.data("bs.tokenfield"),i="object"==typeof b&&b;"string"==typeof b&&h&&h[b]?(f.shift(),e=h[b].apply(h,f)):h||"string"==typeof b||d||(g.data("bs.tokenfield",h=new c(this,i)),g.trigger("tokenfield:initialize"))});return"undefined"!=typeof e?e:g},a.fn.tokenfield.defaults={minWidth:60,minLength:0,html:!0,allowEditing:!0,allowPasting:!0,limit:0,autocomplete:{},typeahead:{},showAutocompleteOnFocus:!1,createTokensOnBlur:!1,delimiter:",",beautify:!0,inputType:"text"},a.fn.tokenfield.Constructor=c,a.fn.tokenfield.noConflict=function(){return a.fn.tokenfield=d,this},c}),define.amd=a}),define("static/3rd.party/typeahead.js/dist/typeahead.jquery.js",_.noop),define("static/3rd.party/jquery-ui.min.js",_.noop),define("static/3rd.party/bootstrap-tokenfield/js/bootstrap-tokenfield.js",_.noop);

/* :oxoptions: null :/oxoptions: */

FROM THE ABOVE, THE PART THAT'S HIGHLIGHTED IN THE DEBUGGER IS THIS:

return a.attributeValidity[b]})},invalidAttributes:function(){var

a=this;return

_(this.attributeValidity).chain().keys().filter(function(b){return!a.attributeValidity[b]}).values()._wrapped}});return

d}),define("io.ox/settings/util",["io.ox/core/notifications","gettext!io.ox/core"],function(a,b){return{destroy:function(){a.yell("destroy")},yellOnReject:function(c,d){if(!(c&&c.promise&&c.done))return

$.when();var e=$.extend({debug:!1},d||{});return

e.debug&&c.always(function(){var

a=_.isArray(this)?this:[this];_.each(a,function(a){a.state?console.warn("NOTIFIY:

"+a.state()):c.state&&console.warn("NOTIFIY:

"+c.state())})}),c.fail(function(c){var

d=$.extend({type:"error",error:"unknown",error_params:[]},c||{});"MAIL_FILTER-0015"===d.code?d.message=b("Unable

to load mail filter

settings."):d.error&&(d.message=d.error),a.yell(d)})}}}),define("io.ox/core/api/snippets",["io.ox/core/http","io.ox/core/event"],function(a,b){var

c={},d=null;return b.extend(c),c.getAll=function(){return

d?$.Deferred().resolve(d):a.GET({module:"snippet",params:{action:"all"}}).then(function(a){return

d=_(a).map(function(a){return

a.misc=$.extend({insertion:"below"},a.misc||{}),a})},function(){return

d=null,[]})},c.create=function(b){return

a.PUT({module:"snippet",params:{action:"new"},data:b}).done(function(){d=null,c.trigger("refresh.all")})},c.update=function(b){return

a.PUT({module:"snippet",params:{action:"update",id:b.id},data:b}).done(function(){d=null,c.trigger("refresh.all")})},c.get=function(b){return

a.GET({module:"snippet",params:{action:"get",id:b}})},c.list=function(b){return

a.PUT({module:"snippet",params:{action:"list"},data:b})},c.destroy=function(b){return

a.GET({module:"snippet",params:{action:"delete",id:b}}).done(function(){d=null,c.trigger("refresh.all")})},c}),define.async("io.ox/core/tk/contenteditable-editor",["io.ox/core/emoji/util","io.ox/core/capabilities","io.ox/core/extensions","io.ox/core/tk/textproc","io.ox/mail/api","settings!io.ox/core","settings!io.ox/mail","gettext!io.ox/core","less!io.ox/core/tk/contenteditable-editor"],function(a,b,c,d,e,f,g,h){function

i(a){var

b=a.selection.getRng();b.collapsed||(a.execCommand("Delete",!1,null),b=a.selection.getRng());var

c,d=b.commonAncestorContainer,e=null;for(c=function(a){var

b;if(a)if(a.hasChildNodes())for(b=0;b<a.childNodes.length;b++){if(1===a.childNodes[b].nodeType)return

void

c(a.childNodes[b]);3===a.childNodes[b].nodeType&&(a.childNodes[b].nodeValue=a.childNodes[b].nodeValue.replace("

",""))}else"BR"===a.nodeName&&(e=a)};d&&!/mce-content-body/.test(d.className);){b.setEndAfter(d);var

f=d.parentNode,g=b.extractContents();c(g.firstChild),$(g).text().length>0&&f.insertBefore(g,d.nextSibling);try{var

h,i,j=$(f).children("ol +

ol");j.length>0&&(h=j.prev(),i=h.children("li").length+1,j.attr("start",i))}catch(k){ox.debug&&console.error(k)}d=f}if(e)try{e.parentNode.removeChild(e)}catch(k){ox.debug&&console.error(k)}var

l=a.getDoc().createElement("span");l.innerHTML="&nbsp;";var

m=a.getDoc().createElement("p");m.appendChild(l),b.insertNode(m),a.selection.select(l),a.execCommand("Delete",!1,null)}function

j(a){var

b=a.commonAncestorContainer||a.parentElement(),c=$(b).parents("blockquote").last(),d=c.length>0;return

d}function k(a,b){var

c=a.selection.getRng();j(c)&&c.startContainer&&(_.device("IE")||(i(a),a.dom.events.cancel(b)))}function

l(){var

a=ox.language,b=["ar","ar_SA","az","be","bg_BG","bn_BD","bs","ca","cs","cy","da","de","de_AT","dv","el","en_CA","en_GB","es","et","eu","fa","fi","fo","fr_FR","gd","gl","he_IL","hr","hu_HU","hy","id","is_IS","it","ja","ka_GE","kk","km_KH","ko_KR","lb","lt","lv","ml","ml_IN","mn_MN","nb_NO","nl","pl","pt_BR","pt_PT","ro","ru","si_LK","sk","sl_SI","sr","sv_SE","ta","ta_IN","tg","th_TH","tr_TR","tt","ug","uk","uk_UA","vi","vi_VN","zh_CN","zh_TW"],c=_.indexOf(b,a,!0);return"fr_CA"===a?"fr_FR":c>-1?b[c]:(c=_.indexOf(b,a.substr(0,2),!0),c>-1?b[c]:"en")}function

m(i,j){function k(a){return

String(a||"").replace(/[\s\xA0]+$/g,"")}function m(a){var

b=Math.round(.9*f.get("maxUploadIdleTimeout",2e5));D.push(setInterval(j.keepalive||e.keepalive,b,a))}function

o(){_(D).each(clearInterval)}var

p,q,r,s=$.Deferred(),t=$.Deferred(),u=i.data("editorId");i.append(i=$('<div

class="contenteditable-editor">').attr({"data-editor-id":u}).append(q=$('<div

class="editable-toolbar">').attr("data-editor-id",u),r=$('<div

class="editable" tabindex="1" role="textbox"

aria-multiline="true">').attr({"aria-label":h("Rich Text Area. Press

ALT-F10 for

toolbar")}).css("margin-bottom","32px"))),j=_.extend({toolbar1:"undo

redo | bold italic | emoji | bullist numlist outdent

indent",advanced:"styleselect fontselect fontsizeselect | forecolor

backcolor | link image",toolbar2:"",toolbar3:"",plugins:"autolink

oximage oxpaste oxdrop link paste textcolor emoji

lists",theme:"unobtanium",skin:"lightgray"},j),r.addClass(j["class"]),j.toolbar1+="

|

"+j.advanced,j.toolbar1=f.get("tinyMCE/theme_advanced_buttons1",j.toolbar1),j.toolbar2=f.get("tinyMCE/theme_advanced_buttons2",j.toolbar2),j.toolbar3=f.get("tinyMCE/theme_advanced_buttons3",j.toolbar3),b.has("emoji")||(j.toolbar1=j.toolbar1.replace(/(

\| )?emoji( \| )?/g," | "),j.toolbar2=j.toolbar2.replace(/( \| )?emoji(

\| )?/g," | "),j.toolbar3=j.toolbar3.replace(/( \| )?emoji( \| )?/g," |

"),j.plugins=j.plugins.replace(/emoji/g,"").trim());var

v='.editable-toolbar[data-editor-id="'+u+'"]';window.cordova&&(j.toolbar="false",j.toolbar1="false",j.toolbar2="false",j.toolbar3="false",j.plugins="autolink

paste");var

w={script_url:(window.cordova?ox.localFileRoot:ox.base)+"/apps/3rd.party/tinymce/tinymce.jquery.min.js",extended_valid_elements:"blockquote[type]",inline:!0,fixed_toolbar_container:v,menubar:!1,statusbar:!1,skin:j.skin,toolbar1:j.toolbar1,toolbar2:j.toolbar2,toolbar3:j.toolbar3,relative_urls:!1,remove_script_host:!1,entity_encoding:"raw",forced_root_block:(g.get("simpleLineBreaks",!0),"p"),browser_spellcheck:!0,plugins:j.plugins,link_title:!1,target_list:!1,link_assume_external_targets:!0,language:l(),hidden_input:!1,theme:j.theme,init_instance_callback:function(a){p=a,t.resolve()},execcommand_callback:function(a,b,c){"createlink"===c&&_.defer(function(){$(tinyMCE.get(a).getBody()).find("a").attr({target:"_blank",rel:"noopener"})})},paste_preprocess:d.paste_preprocess,paste_postprocess:d.paste_postprocess,setup:function(a){j.oxContext&&(a.oxContext=j.oxContext),c.point(n+"/setup").invoke("draw",this,a),a.on("BeforeRenderUI",function(){s.resolve()})}};c.point(n+"/options").invoke("config",w,j.oxContext),r.tinymce(w);var

x=function(a){return

a.replace(/<[a-z][^>]*\sdata-mce.*?>/gi,function(a){return

a.replace(/\sdata-mce-\S+=("[^"]*"|'[^']*')/g,"")})},y=_.debounce(function(){if(null!==i){var

a=i.parent().find(".mail-compose-fields").height();if(_.device("smartphone")&&$(".io-ox-mobile-mail-compose-window").length>0){var

b=i.parent().parent().height();return void

r.css("min-height",b-a-32)}if(_.device("smartphone")){a=i.parent().find(".mail-compose-fields").height();var

c=$("#io-ox-topbar").height(),d=i.parents().find(".window-header").height(),e=30;return

void r.css("min-height",window.innerHeight-(a+c+d+e))}var

f=$(window).height(),g=r.offset().top;r.css("min-height",f-g-40+"px"),j.css&&r.css(j.css);var

h=$(v+" >

div").height(),k=$(v).next().outerWidth();h&&$(v).css("height",h+1),k&&$(v).css("width",k)}},30),z=function(b){var

c=a.processEmoji(b,function(a,b){b.loaded&&p.setContent(a)});p.setContent(c),/position:(\s+)?absolute/i.test(b)&&$(p.getBody()).find("[style*=absolute]").css("position","static"),/white-space:(\s+)?nowrap/i.test(b)&&$(p.getBody()).find("[style*=nowrap]").css("white-space","normal")},A=function(){z("")},B=function(a){return

String(a||"").replace(/\r/g,"").replace(new

RegExp("\\n","g"),"<br>")},C=function(){$(p.getBody()).find(".mce-resizehandle").remove();var

b=p.getContent({format:"raw"});return

b=a.imageTagsToUnified(b),b=x(b),b=b.replace(/<(\w+)[

]?\/>/g,"<$1>").replace(/(<p>(<br>)?<\/p>)+$/,""),b=b.replace(/(\s|&nbsp;|\0x20|<br\/?>|<p(

class="io-ox-signature")>(&nbsp;|\s|<br\/?>)*<\/p>)*$/g,""),k(b)};this.content_type=j.model&&"alternative"===j.model.get("preferredEditorMode")?"ALTERNATIVE":"text/html",this.done=function(a){var

b=this;return $.when(t,s).then(function(){return

a(b),b})},this.focus=function(){_.device("ios")||_.defer(function(){p.focus(),p.execCommand("mceFocus",!1,u)})},this.ln2br=B,this.clear=A,this.getContent=C,this.getPlainText=function(){return

d.htmltotext($(p.getBody()).html())},this.setContent=z,this.setPlainText=function(a){return(a=k(a))?d.texttohtml(a).then(function(a){/^<blockquote\>/.test(a)&&(a="<p><br></p>"+a),z(a),p.undoManager.clear()}):void

0},this.paste=function(a){p.execCommand("mceInsertClipboardContent",!1,{content:a})},this.scrollTop=function(a){var

b=$(p.getDoc());return void

0===a?b.scrollTop():void("top"===a?b.scrollTop(0):"bottom"===a&&b.scrollTop(b.get(0).body.scrollHeight))},this.setCaretPosition=function(){$(p.getDoc()).scrollTop(0)},this.appendContent=function(a){var

b=this.getContent();a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",b=b.replace(/^(<p><br><\/p>){2,}/,"").replace(/(<p><br><\/p>)+$/,"")+"<p><br></p>"+a,/^<blockquote/.test(b)&&(b="<p><br></p>"+b),this.setContent(b)},this.prependContent=function(a){var

b=this.getContent();a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",b=a+"<p><br></p>"+b.replace(/^(<p><br><\/p>)+/,"").replace(/(<p><br><\/p>){2,}$/,""),b="<p><br></p>"+b,this.setContent(b)},this.setContentParts=function(a,b){var

c="";a=_.isString(a)?{content:a}:a,a.content&&(c+=a.content),"above"===b&&a.cite&&(c+="\n\n"+a.cite),a.quote&&(c+="\n\n"+a.quote||""),"below"===b&&a.cite&&(c+="\n\n"+a.cite),this.setContent(c)},this.getContentParts=function(){var

a=this.getContent(),b=a.indexOf('<blockquote

type="cite">');return"<blockquote><p>"===a.substring(0,15)&&(b=0),"<p><br></p><blockquote>"===a.substring(0,23)&&(b=0),0>b?{content:a}:{content:a.substring(0,b).replace(/\s+$/g,""),quote:a.substring(b),cite:void

0}},this.insertPrevCite=function(a){var

b=this.getContentParts();a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",b.cite=a,this.setContentParts(b,"above")},this.replaceParagraph=function(a,b){var

c,d,e=this.getContent();return

a=/^<p/i.test(a)?a:"<p>"+B(a)+"</p>",(c=e.indexOf(a))>-1?(d=this.scrollTop(),this.setContent(e.substr(0,c)+(b||"")+e.substr(c+a.length)),this.scrollTop(d),!0):!1},this.removeContent=function(a){this.replaceContent(a,"")},this.find=function(a){return

$(p.getDoc()).find(a)},this.replaceContent=function(a,b){function

c(){p.selection.setContent(b||"")}var

d,e=p.getWin(),f=!1;if(p.selection.select(p.getBody(),!0),p.selection.collapse(!0),_.browser.IE)for(p.focus(),d=p.getDoc().selection.createRange();d.findText(a,1,0);)d.scrollIntoView(),d.select(),c(),f=!0;else

for(;e.find(a,0,0,!1,!1,!1,!1);)c(),f=!0;return

f},this.getMode=function(){return"html"},this.tinymce=function(){return

r.tinymce?r.tinymce():{}},this.show=function(){i.show(),$(v).css("display",""),y(),$(window).on("resize.tinymce",y),$(window).on("orientationchange.tinymce",function(){_.delay(y,50)})},this.hide=function(){i.hide(),$(window).off("resize.tinymce

orientationchange.tinymce")},function(){if(!_.device("smartphone")){var

a=j.scrollpane||j.app&&j.app.getWindowNode(),b=!1,c=14;a.on("scroll",function(){a.scrollTop()-a.find(".mail-compose-fields").height()>c?(b||(b=!0,q.addClass("fixed").css("top",j.view.$el.parent().offset().top),$(window).trigger("resize.tinymce")),r.css("margin-top",q.height())):b&&(b=!1,q.removeClass("fixed").css("top",0),r.css("margin-top",0))})}}(),this.destroy=function(){this.hide(),o(),r.tinymce()&&(r.empty(),r.tinymce().remove()),i=r=r.tinymce=t=s=p=null};var

D=[];r.on("addInlineImage",function(a,b){m(b)})}var

n="io.ox/core/tk/contenteditable-editor",o=0;return

c.point(n+"/setup").extend({id:"default",index:o+=100,draw:function(a){a.on("keydown",function(b){13===(b.keyCode||b.which)&&k(a,b)}),c.point("3rd.party/emoji/editor_css").each(function(b){var

c=a.convertURL(require.toUrl(b.css));a.contentCSS.push(c)})}}),c.point(n+"/setup").extend({id:"emoji",index:o+=100,draw:function(a){c.point("3rd.party/emoji/editor_css").each(function(b){var

c=a.convertURL(require.toUrl(b.css));a.contentCSS.push(c)})}}),c.point(n+"/setup").extend({id:"list-style-position",index:o+=100,draw:function(a){a.on("NodeChange",function(a){"LI"===a.element.nodeName&&"left"!==a.element.style.textAlign&&""!==a.element.style.textAlign&&$(a.element).css("list-style-position","inside")})}}),window.tinyMCE?$.Deferred().resolve(m):require(["3rd.party/tinymce/jquery.tinymce.min"]).then(function(){return

m})}),define("io.ox/core/tk/textproc",["io.ox/core/emoji/util"],function(a){return{paste_preprocess:function(b,c){c.content=c.content.replace(/<!--(.*?)-->/g,"").replace(/<img[^>]*

data-emoji-unicode=\"([^\"]*)\"[^>]*>/gi,"$1"),c.content=a.processEmoji(c.content)},paste_postprocess:function(a,b){function

c(a,b){var

c,d=$(b),e=b.tagName,f=d.children(),g=!0;if("DIV"===e&&d.attr("id")&&-1!==d.attr("id").indexOf("ox-text-p")&&(g=!1),d.removeAttr("id

title alt rel"),/^(BR|HR|IMG)$/.test(e))return

a;if(d.attr("align")&&d.css("textAlign",d.attr("align")).removeAttr("align"),d.contents().each(function(){3===b.nodeType&&(b.nodeValue=b.nodeValue.replace(/:$/,":

"))}),0===f.length)if(c=d.text().match(/^[

\t]$/)?d.text:$.trim(d.text()),""===c){if("TD"!==e)return

d.remove(),!1;d.text("

")}else{if(/^(SPAN|SMALL|PRE)$/.test(e)&&!d.attr("class")&&!d.attr("style"))return

d.replaceWith($.txt(d.text())),!1;/^".+"$/.test(c)&&d.text(c.replace(/^"/,"“").replace(/"$/,"”"))}else

if("DIV"===e&&!d.attr("class")&&!d.attr("style")&&g)return

f.eq(0).unwrap(),!1;return a}function d(){var

a=$(this),b=a.contents();1===b.length&&"BR"===b.get(0).tagName&&a.remove()}function

e(){$(this).children().first().unwrap()}function f(){var

a=$(this),b=a.attr("style"),c=$("<p>");b&&c.attr("style",b),a.replaceWith(c.append(a.contents()))}function

g(){var

a=$(this);a.replaceWith($("<em>").text(a.text()))}function h(){var

a,b=$(this);b.attr("href")?(b.removeAttr("title

target"),/^\[\d+\]$/.test(b.text())&&/^#/.test(b.attr("href"))&&(a=String(b.text()).match(/^\[(\d+)\]$/),b.replaceWith($("<sup>").text(a[1]).add($.txt("

"))))):b.replaceWith(b.contents())}function i(){var

a=$(this);a.removeAttr("width").attr({border:"0",cellSpacing:"0",cellPadding:"0"}).css({lineHeight:"1em",margin:"0.5em

auto 0.5em

auto"}),a.find("th").css({fontWeight:"bold",textAlign:"center",borderBottom:"1px

solid #555",padding:"0.4em 1em 0.4em

1em"}),a.find("td").css({borderBottom:"1px solid #aaa",padding:"0.4em

1em 0.4em 1em"}),a.find("tr").first().find("td, th").css({borderTop:"1px

solid #555"}),a.find("tr").last().find("td, th").css({borderBottom:"1px

solid #555"})}var j,k=$(b.node);k.find("iframe, object, applet, input,

textarea, button, select, canvas, script, noscript, audio, video,

img").filter(':not(img.emoji,img[src*="'+ox.abs+ox.root+'/api/file"],img[data-pending="true"])').remove(),k.find("sup").css("lineHeight","0"),k.find("article,

header, footer, section,

form").each(e),k.find("a").each(h),k.find("code").each(g);do

j=_(k.find("*")).inject(c,!0);while(!j);k.find("table").each(i),k.eq(0).children("div").each(f),k.find("p").each(d)},htmltotext:function(a){function

b(a,b){var

c,d="void"===b.type?"<"+b.tag+"\\b([^>]*)\\/?>":"<"+b.tag+"\\b([^>]*)>([\\s\\S]*?)<\\/"+b.tag+">",e=new

RegExp(d,"gi");return c="string"==typeof

b.replacement?a.replace(e,b.replacement):a.replace(e,function(a,c,d,e){return

b.replacement.call(this,a,c,d,e)})}function c(a){return new

RegExp(a+"\\s*=\\s*[\"']?([^\"']*)[\"']?","i")}function d(a){return

a=a.replace(/<(ul|ol)\b[^>]*>([\s\S]*?)<\/\1>/gi,function(a,b,c){function

d(a,b){return b=b.replace(/^\s+/,"").replace(/\n\n/g,"\n\n

").replace(/\n([ ]*)+(\*|\d+\.) /g,"\n$1 $2 ")}var

e=c.split("</li>");e.splice(e.length-1,1);for(var

f=0,g=e.length;g>f;f++){if(e[f]){var h="ol"===b?f+1+". ":"*

";e[f]=h+e[f].replace(/\s*<li[^>]*>([\s\S]*)/i,d)}e[f]=e[f].replace(/(.)

+$/m,"$1")}return e.join("\n")}),"\n\n"+a.replace(/[

\t]+\n|\s+$/g,"")}function e(a){return

a.replace(/<blockquote\b[^>]*>([\s\S]*?)<\/blockquote>/gi,function(a,b){return

b=b.replace(/^\s+|\s+$/g,""),b=f(b),b=b.replace(/^/gm,">

").replace(/^(>([ \t]{2,}>)+)/gm,"> >")})}function

f(a){return a.replace(/<!--(.*?)-->/g,"").replace(/<img[^>]*

data-emoji-unicode=\"([^\"]*)\"[^>]*>/gi,"$1").replace(/(<\/?\w+(\s[^<>]*)?\/?>)/g,"").replace(/^[\t\r\n]+|[\t\r\n]+$/g,"").replace(/\n\s+\n/g,"\n\n").replace(/\n{3,}/g,"\n\n").replace(/&nbsp;/g,"

").replace(/>/g,">").replace(/</g,"<").replace(/&amp;/g,"&")}for(var

g=[{patterns:"p",replacement:function(a,b,c){return

c?"\n\n"+c+"\n":""}},{patterns:["br"],type:"void",replacement:"\n"},{patterns:"h([1-6])",replacement:function(a,b,c,d){return"\n\n"+d+"\n"}},{patterns:"hr",type:"void",replacement:"\n\n---\n"},{patterns:"a",replacement:function(a,b,d){var

e=b.match(c("href"));return

e&&0===e[1].indexOf("mailto:")?e[1].substr(7):e&&d===e[1]?d:"["+(d||"")+"]("+(e&&e[1]||"")+")"}}],h=0,i=g.length;i>h;h++)if("string"==typeof

g[h].patterns)a=b(a,{tag:g[h].patterns,replacement:g[h].replacement,type:g[h].type});else

for(var

j=0,k=g[h].patterns.length;k>j;j++)a=b(a,{tag:g[h].patterns[j],replacement:g[h].replacement,type:g[h].type});a=a.replace(/<pre\b[^>]*>`([\s\S]*?)`<\/pre>/gi,function(a,b){var

c=b;return c=c.replace(/^\t+/g," "),c=c.replace(/\n/g,"\n "),"\n\n

"+c+"\n"}),a=a.replace(/^(\s{0,3}\d+)\. /g,"$1\\. ");for(var

l=/<(ul|ol)\b[^>]*>(?:(?!<ul|<ol)[\s\S])*?<\/\1>/gi;a.match(l);)a=a.replace(l,d);for(var

m=/<blockquote\b[^>]*>((?:(?!<blockquote)[\s\S])*?)<\/blockquote>/gi;a.match(m);)a=a.replace(m,e);return

a=f(a),a=a.replace(/^\s+\n\n/,"\n"),/^\n\>\s/.test(a)||(a=a.replace(/^\n/,"")),a},texttohtml:function(a){var

b={exec:$.noop},c=$.Deferred();return

require(["static/3rd.party/marked/lib/marked.js"]).then(function(d){d.prototype.constructor.Parser.prototype.parse=function(a){this.inline=new

d.InlineLexer(a.links,this.options,this.renderer),_.extend(this.inline.rules,{em:b,strong:b,escape:b,del:b,image:b,codespan:b,autolink:b}),this.tokens=a.reverse();for(var

c="";this.next();)c+=this.tok();return c},d.setOptions({renderer:new

d.Renderer,gfm:!0,tables:!1,breaks:!0,pedantic:!1,sanitize:!0,smartLists:!0,smartypants:!1});var

e=new

d.Lexer;_.extend(e.rules,{heading:b,code:b,hr:b,lheading:b}),c.resolve(d.parser(e.lex(a)))}),c}}}),!function(a){function

b(){function b(a){"remove"===a&&this.each(function(a,b){var

c=e(b);c&&c.remove()}),this.find("span.mceEditor,div.mceEditor").each(function(a,b){var

c=tinymce.get(b.id.replace(/_parent$/,""));c&&c.remove()})}function

d(a){var c,d=this;if(null!=a)b.call(d),d.each(function(b,c){var

d;(d=tinymce.get(c.id))&&d.setContent(a)});else

if(d.length>0&&(c=tinymce.get(d[0].id)))return

c.getContent()}function e(a){var b=null;return

a&&a.id&&g.tinymce&&(b=tinymce.get(a.id)),b}function

f(a){return!!(a&&a.length&&g.tinymce&&a.is(":tinymce"))}var

h={};a.each(["text","html","val"],function(b,g){var

i=h[g]=a.fn[g],j="text"===g;a.fn[g]=function(b){var

g=this;if(!f(g))return i.apply(g,arguments);if(b!==c)return

d.call(g.filter(":tinymce"),b),i.apply(g.not(":tinymce"),arguments),g;var

h="",k=arguments;return(j?g:g.eq(0)).each(function(b,c){var

d=e(c);h+=d?j?d.getContent().replace(/<(?:"[^"]*"|'[^']*'|[^'">])*>/g,""):d.getContent({save:!0}):i.apply(a(c),k)}),h}}),a.each(["append","prepend"],function(b,d){var

g=h[d]=a.fn[d],i="prepend"===d;a.fn[d]=function(a){var b=this;return

f(b)?a!==c?("string"==typeof

a&&b.filter(":tinymce").each(function(b,c){var

d=e(c);d&&d.setContent(i?a+d.getContent():d.getContent()+a)}),g.apply(b.not(":tinymce"),arguments),b):void

0:g.apply(b,arguments)}}),a.each(["remove","replaceWith","replaceAll","empty"],function(c,d){var

e=h[d]=a.fn[d];a.fn[d]=function(){return

b.call(this,d),e.apply(this,arguments)}}),h.attr=a.fn.attr,a.fn.attr=function(b,g){var

i=this,j=arguments;if(!b||"value"!==b||!f(i))return

g!==c?h.attr.apply(i,j):h.attr.apply(i,j);if(g!==c)return

d.call(i.filter(":tinymce"),g),h.attr.apply(i.not(":tinymce"),j),i;var

k=i[0],l=e(k);return l?l.getContent({save:!0}):h.attr.apply(a(k),j)}}var

c,d,e,f=[],g=window;a.fn.tinymce=function(c){function h(){var

d=[],f=0;e||(b(),e=!0),l.each(function(a,b){var

e,g=b.id,h=c.oninit;g||(b.id=g=tinymce.DOM.uniqueId()),tinymce.get(g)||(e=new

tinymce.Editor(g,c,tinymce.EditorManager),d.push(e),e.on("init",function(){var

a,b=h;l.css("visibility",""),h&&++f==d.length&&("string"==typeof

b&&(a=-1===b.indexOf(".")?null:tinymce.resolve(b.replace(/\.\w+$/,"")),b=tinymce.resolve(b)),b.apply(a||tinymce,d))}))}),a.each(d,function(a,b){b.render()})}var

i,j,k,l=this,m="";if(!l.length)return l;if(!c)return

window.tinymce?tinymce.get(l[0].id):null;if(l.css("visibility","hidden"),g.tinymce||d||!(i=c.script_url))1===d?f.push(h):h();else{d=1,j=i.substring(0,i.lastIndexOf("/")),-1!=i.indexOf(".min")&&(m=".min"),g.tinymce=g.tinyMCEPreInit||{base:j,suffix:m},-1!=i.indexOf("gzip")&&(k=c.language||"en",i=i+(/\?/.test(i)?"&":"?")+"js=true&core=true&suffix="+escape(m)+"&themes="+escape(c.theme||"modern")+"&plugins="+escape(c.plugins||"")+"&languages="+(k||""),g.tinyMCE_GZ||(g.tinyMCE_GZ={start:function(){function

b(a){tinymce.ScriptLoader.markDone(tinymce.baseURI.toAbsolute(a))}b("langs/"+k+".js"),b("themes/"+c.theme+"/theme"+m+".js"),b("themes/"+c.theme+"/langs/"+k+".js"),a.each(c.plugins.split(","),function(a,c){c&&(b("plugins/"+c+"/plugin"+m+".js"),b("plugins/"+c+"/langs/"+k+".js"))})},end:function(){}}));var

n=document.createElement("script");n.type="text/javascript",n.onload=n.onreadystatechange=function(b){b=b||window.event,2===d||"load"!=b.type&&!/complete|loaded/.test(n.readyState)||(tinymce.dom.Event.domLoaded=1,d=2,c.script_loaded&&c.script_loaded(),h(),a.each(f,function(a,b){b()}))},n.src=i,document.body.appendChild(n)}return

l},a.extend(a.expr[":"],{tinymce:function(a){var

b;return!!(a.id&&"tinymce"in

window&&(b=tinymce.get(a.id),b&&b.editorManager===tinymce))}})}(jQuery),function(a){"function"==typeof

define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){function

b(b,d){var

e,f,g,h=b.nodeName.toLowerCase();return"area"===h?(e=b.parentNode,f=e.name,b.href&&f&&"map"===e.nodeName.toLowerCase()?(g=a("img[usemap='#"+f+"']")[0],!!g&&c(g)):!1):(/^(input|select|textarea|button|object)$/.test(h)?!b.disabled:"a"===h?b.href||d:d)&&c(b)}function

c(b){return

a.expr.filters.visible(b)&&!a(b).parents().addBack().filter(function(){return"hidden"===a.css(this,"visibility")}).length}a.ui=a.ui||{},a.extend(a.ui,{version:"1.11.4",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),a.fn.extend({scrollParent:function(b){var

c=this.css("position"),d="absolute"===c,e=b?/(auto|scroll|hidden)/:/(auto|scroll)/,f=this.parents().filter(function(){var

b=a(this);return

d&&"static"===b.css("position")?!1:e.test(b.css("overflow")+b.css("overflow-y")+b.css("overflow-x"))}).eq(0);return"fixed"!==c&&f.length?f:a(this[0].ownerDocument||document)},uniqueId:function(){var

a=0;return function(){return

this.each(function(){this.id||(this.id="ui-id-"+

++a)})}}(),removeUniqueId:function(){return

this.each(function(){/^ui-id-\d+$/.test(this.id)&&a(this).removeAttr("id")})}}),a.extend(a.expr[":"],{data:a.expr.createPseudo?a.expr.createPseudo(function(b){return

function(c){return!!a.data(c,b)}}):function(b,c,d){return!!a.data(b,d[3])},focusable:function(c){return

b(c,!isNaN(a.attr(c,"tabindex")))},tabbable:function(c){var

d=a.attr(c,"tabindex"),e=isNaN(d);return(e||d>=0)&&b(c,!e)}}),a("<a>").outerWidth(1).jquery||a.each(["Width","Height"],function(b,c){function

d(b,c,d,f){return

a.each(e,function(){c-=parseFloat(a.css(b,"padding"+this))||0,d&&(c-=parseFloat(a.css(b,"border"+this+"Width"))||0),f&&(c-=parseFloat(a.css(b,"margin"+this))||0)}),c}var

e="Width"===c?["Left","Right"]:["Top","Bottom"],f=c.toLowerCase(),g={innerWidth:a.fn.innerWidth,innerHeight:a.fn.innerHeight,outerWidth:a.fn.outerWidth,outerHeight:a.fn.outerHeight};a.fn["inner"+c]=function(b){return

void

0===b?g["inner"+c].call(this):this.each(function(){a(this).css(f,d(this,b)+"px")})},a.fn["outer"+c]=function(b,e){return"number"!=typeof

b?g["outer"+c].call(this,b):this.each(function(){a(this).css(f,d(this,b,!0,e)+"px")})}}),a.fn.addBack||(a.fn.addBack=function(a){return

this.add(null==a?this.prevObject:this.prevObject.filter(a))}),a("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(a.fn.removeData=function(b){return

function(c){return

arguments.length?b.call(this,a.camelCase(c)):b.call(this)}}(a.fn.removeData)),a.ui.ie=!!/msie

[\w.]+/.exec(navigator.userAgent.toLowerCase()),a.fn.extend({focus:function(b){return

function(c,d){return"number"==typeof c?this.each(function(){var

b=this;setTimeout(function(){a(b).focus(),d&&d.call(b)},c)}):b.apply(this,arguments)}}(a.fn.focus),disableSelection:function(){var

a="onselectstart"in

document.createElement("div")?"selectstart":"mousedown";return

function(){return

this.bind(a+".ui-disableSelection",function(a){a.preventDefault()})}}(),enableSelection:function(){return

this.unbind(".ui-disableSelection")},zIndex:function(b){if(void

0!==b)return this.css("zIndex",b);if(this.length)for(var

c,d,e=a(this[0]);e.length&&e[0]!==document;){if(c=e.css("position"),("absolute"===c||"relative"===c||"fixed"===c)&&(d=parseInt(e.css("zIndex"),10),!isNaN(d)&&0!==d))return

d;e=e.parent()}return 0}}),a.ui.plugin={add:function(b,c,d){var

e,f=a.ui[b].prototype;for(e in

d)f.plugins[e]=f.plugins[e]||[],f.plugins[e].push([c,d[e]])},call:function(a,b,c,d){var

e,f=a.plugins[b];if(f&&(d||a.element[0].parentNode&&11!==a.element[0].parentNode.nodeType))for(e=0;f.length>e;e++)a.options[f[e][0]]&&f[e][1].apply(a.element,c)}};var

d=0,e=Array.prototype.slice;a.cleanData=function(b){return

function(c){var

d,e,f;for(f=0;null!=(e=c[f]);f++)try{d=a._data(e,"events"),d&&d.remove&&a(e).triggerHandler("remove")}catch(g){}b(c)}}(a.cleanData),a.widget=function(b,c,d){var

e,f,g,h,i={},j=b.split(".")[0];return

b=b.split(".")[1],e=j+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e.toLowerCase()]=function(b){return!!a.data(b,e)},a[j]=a[j]||{},f=a[j][b],g=a[j][b]=function(a,b){return

this._createWidget?void(arguments.length&&this._createWidget(a,b)):new

g(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new

c,h.options=a.widget.extend({},h.options),a.each(d,function(b,d){return

a.isFunction(d)?void(i[b]=function(){var a=function(){return

c.prototype[b].apply(this,arguments)},e=function(a){return

c.prototype[b].apply(this,a)};return function(){var

b,c=this._super,f=this._superApply;return

this._super=a,this._superApply=e,b=d.apply(this,arguments),this._super=c,this._superApply=f,b}}()):void(i[b]=d)}),g.prototype=a.widget.extend(h,{widgetEventPrefix:f?h.widgetEventPrefix||b:b},i,{constructor:g,namespace:j,widgetName:b,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var

d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete

f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g),g},a.widget.extend=function(b){for(var

c,d,f=e.call(arguments,1),g=0,h=f.length;h>g;g++)for(c in

f[g])d=f[g][c],f[g].hasOwnProperty(c)&&void

0!==d&&(b[c]=a.isPlainObject(d)?a.isPlainObject(b[c])?a.widget.extend({},b[c],d):a.widget.extend({},d):d);return

b},a.widget.bridge=function(b,c){var

d=c.prototype.widgetFullName||b;a.fn[b]=function(f){var

g="string"==typeof f,h=e.call(arguments,1),i=this;return

g?this.each(function(){var

c,e=a.data(this,d);return"instance"===f?(i=e,!1):e?a.isFunction(e[f])&&"_"!==f.charAt(0)?(c=e[f].apply(e,h),c!==e&&void

0!==c?(i=c&&c.jquery?i.pushStack(c.get()):c,!1):void

0):a.error("no such method '"+f+"' for "+b+" widget

instance"):a.error("cannot call methods on "+b+" prior to

initialization; attempted to call method

'"+f+"'")}):(h.length&&(f=a.widget.extend.apply(null,[f].concat(h))),this.each(function(){var

b=a.data(this,d);b?(b.option(f||{}),b._init&&b._init()):a.data(this,d,new

c(f,this))})),i}},a.Widget=function(){},a.Widget._childConstructors=[],a.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(b,c){c=a(c||this.defaultElement||this)[0],this.element=a(c),this.uuid=d++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=a(),this.hoverable=a(),this.focusable=a(),c!==this&&(a.data(c,this.widgetFullName,this),this._on(!0,this.element,{remove:function(a){a.target===c&&this.destroy()}}),this.document=a(c.style?c.ownerDocument:c.document||c),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled

ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return

this.element},option:function(b,c){var

d,e,f,g=b;if(0===arguments.length)return

a.widget.extend({},this.options);if("string"==typeof

b)if(g={},d=b.split("."),b=d.shift(),d.length){for(e=g[b]=a.widget.extend({},this.options[b]),f=0;d.length-1>f;f++)e[d[f]]=e[d[f]]||{},e=e[d[f]];if(b=d.pop(),1===arguments.length)return

void 0===e[b]?null:e[b];e[b]=c}else{if(1===arguments.length)return void

0===this.options[b]?null:this.options[b];g[b]=c}return

this._setOptions(g),this},_setOptions:function(a){var b;for(b in

a)this._setOption(b,a[b]);return this},_setOption:function(a,b){return

this.options[a]=b,"disabled"===a&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!b),b&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return

this._setOptions({disabled:!1})},disable:function(){return

this._setOptions({disabled:!0})},_on:function(b,c,d){var

e,f=this;"boolean"!=typeof

b&&(d=c,c=b,b=!1),d?(c=e=a(c),this.bindings=this.bindings.add(c)):(d=c,c=this.element,e=this.widget()),a.each(d,function(d,g){function

h(){return

b||f.options.disabled!==!0&&!a(this).hasClass("ui-state-disabled")?("string"==typeof

g?f[g]:g).apply(f,arguments):void 0}"string"!=typeof

g&&(h.guid=g.guid=g.guid||h.guid||a.guid++);var

i=d.match(/^([\w:-]*)\s*(.*)$/),j=i[1]+f.eventNamespace,k=i[2];k?e.delegate(k,j,h):c.bind(j,h)})},_off:function(b,c){c=(c||"").split("

").join(this.eventNamespace+"

")+this.eventNamespace,b.unbind(c).undelegate(c),this.bindings=a(this.bindings.not(b).get()),this.focusable=a(this.focusable.not(b).get()),this.hoverable=a(this.hoverable.not(b).get())},_delay:function(a,b){function

c(){return("string"==typeof a?d[a]:a).apply(d,arguments)}var

d=this;return

setTimeout(c,b||0)},_hoverable:function(b){this.hoverable=this.hoverable.add(b),this._on(b,{mouseenter:function(b){a(b.currentTarget).addClass("ui-state-hover")},mouseleave:function(b){a(b.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(b){this.focusable=this.focusable.add(b),this._on(b,{focusin:function(b){a(b.currentTarget).addClass("ui-state-focus")},focusout:function(b){a(b.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(b,c,d){var

e,f,g=this.options[b];if(d=d||{},c=a.Event(c),c.type=(b===this.widgetEventPrefix?b:this.widgetEventPrefix+b).toLowerCase(),c.target=this.element[0],f=c.originalEvent)for(e

in f)e in c||(c[e]=f[e]);return

this.element.trigger(c,d),!(a.isFunction(g)&&g.apply(this.element[0],[c].concat(d))===!1||c.isDefaultPrevented())}},a.each({show:"fadeIn",hide:"fadeOut"},function(b,c){a.Widget.prototype["_"+b]=function(d,e,f){"string"==typeof

e&&(e={effect:e});var g,h=e?e===!0||"number"==typeof

e?c:e.effect||c:b;