/*! For license information please see newsletter_editor.js.LICENSE.txt */
(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[198],{85532(e,t,o){"use strict";o(67711),o(79416);var n=o(42176),r=o(92794),i=o(69139),s=o(79124),a=o(74733),l=o(1672),c=o(95338),d=o(14762),u=o(84025),h=o(54558),m=o(86106);n.Hooks.addAction("mailpoet_newsletters_editor_initialize","mailpoet",e=>{const t=document.getElementById("mailpoet_editor"),o=e=>(document.location.search.split(`${e}=`)[1]||"").split("&")[0];t&&window.EditorApplication&&(r.U.Modal.loading(!0),r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"get",data:{id:o("id")}}).always(()=>r.U.Modal.loading(!1)).always(()=>(0,h.d)()).done(t=>{const n=t.data;if("sending"===n.status&&n.queue&&null===n.queue.status){let e="yes"===o("pauseConfirmed");if(e||(e=window.confirm((0,i.__)("Sending is in progress. Do you want to pause sending and edit the newsletter?","mailpoet"))),!e)return void(window.location=`admin.php?page=mailpoet-newsletters#/${n.type}`);r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"sending_queue",action:"pause",data:{newsletter_id:n.id}}).done(()=>r.U.Notice.system((0,i.__)("Email sending has been paused.","mailpoet"))).fail(e=>{e.errors.length>0&&r.U.Notice.error(e.errors.map(e=>e.message),{scroll:!0,static:!0})})}else if(l.df.includes(n.type)&&"active"===n.status){let e="yes"===o("deactivationConfirmed");if(e||(e=window.confirm((0,i.__)("To edit this email, it needs to be deactivated. You can activate it again after you make the changes.","mailpoet"))),!e)return void(window.location=`admin.php?page=mailpoet-newsletters#/${n.type}`);(0,u.M4)(Number(n.id),"draft").then(e=>{"draft"===e.data.status&&r.U.Notice.system((0,i.__)("This email was deactivated.","mailpoet"))}).catch(e=>{r.U.Notice.error([e.message],{scroll:!0,static:!0})})}Promise.resolve(((e,t)=>{if("automatic"!==t.type)return e;const o=e;return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"automatic_emails",action:"get_event_shortcodes",data:{email_slug:t.options.group,event_slug:t.options.event}}).then(e=>c.default.isObject(e)&&e.data?(o.shortcodes={...o.shortcodes,...e.data},o):o).fail(e=>{e.errors.length>0&&r.U.Notice.error(e.errors.map(e=>e.message),{scroll:!0,static:!0})})})(e,n)).then(e=>{const t={...e.blockDefaults,container:{}};window.EditorApplication.start({newsletter:n,config:{...e,blockDefaults:t}})}).catch(()=>{window.EditorApplication.start({newsletter:n,config:e})}),((e,t)=>{if(!["wc_transactional","confirmation_email"].includes(e)){const o=document.getElementById("mailpoet_editor_steps_heading"),n=l.Ls.includes(e)?2:3;let c=null,u=()=>{window.location=`admin.php?page=${r.U.mainPageSlug}`};if(t.automationId){const e=`admin.php?page=mailpoet-automation-editor&id=${t.automationId}`;u=()=>{window.location=e};const o=()=>document.querySelector(".mailpoet_show_preview").click(),n=()=>document.querySelector(".mailpoet_save_go_to_automation").click();c=(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("input",{type:"button",name:"preview",className:"button link-button",onClick:o,value:"Preview"})," ",(0,m.jsx)("input",{type:"button",className:"button button-primary",onClick:n,value:(0,i.__)("Return back to the Automation","mailpoet")})]})}const h=(0,m.jsx)(d.ErrorBoundary,{children:(0,m.jsx)(a.Y,{emailType:e,step:n,buttons:c,onLogoClick:u})});(0,s.H)(o).render(h)}})("automatic"===n.type?n.options?.group:n.type,n.options)}).fail(e=>{e.errors.length>0&&r.U.Notice.error(e.errors.map(e=>e.message),{scroll:!0,static:!0})}))});var p,g,f=o(53306),v=o.n(f),b=o(21559),y=o.n(b),w=o(41669),x=o.n(w);p=y(),g=v().View.extend({el:"#mailpoet_editor",regions:{stylesRegion:"#mailpoet_editor_styles",contentRegion:"#mailpoet_editor_content",sidebarRegion:"#mailpoet_editor_sidebar",bottomRegion:"#mailpoet_editor_bottom",headingRegion:"#mailpoet_editor_heading",historyRegion:"#mailpoet_editor_history",topRegion:"#mailpoet_editor_top"},events:{click:"onClickOutsideContentHideSettings"},onClickOutsideContentHideSettings:function(e){x()(e.target).parents("#mailpoet_editor_content").length||window.EditorApplication.getChannel().trigger("hideSettings")}});const C=new(v().Application.extend({region:"#mailpoet_editor",onStart:function(){this._appView=new g,this.showView(this._appView),this.listenTo(this.getChannel(),"settingsDisplayed",this.setDisplayedSettingsId)},getChannel:function(e){return void 0===e?p.channel("global"):p.channel(e)},getDisplayedSettingsId:function(){return this.displayedSettingsId},setDisplayedSettingsId:function(e){this.displayedSettingsId=e}}));window.EditorApplication=C,Backbone.SuperModel=function(e,t){var o=function(t){for(var o=t.length-1;o>=0;o--){var n=t.slice(0,o),r=t.slice(o);if(1!=r.length){var i=this;(n=n.join(".")).length>0&&(i=this.get(n));for(var s=e.first(r),a=e.rest(r),l=[s],c=0;c<a.length;c++)s=[s,a[c]].join("."),l.push(s);for(var d=0;d<l.length;d++){var u=l[d],h=i.trigger;h&&e.isFunction(h)&&h.call(i,"change:"+u,i,i.get(u))}}}},n=function(t){return e.isString(t)&&(t=t.split(".")),t},r=function(e,t,o){for(var r=(t=n(t)).length-1,i=0;i<r;++i){var s=t[i];s in e||(e[s]={}),e=e[s]}o(e,t[r])},i=function(o,r,s){r=n(r);var a=e.first(r),l=o.get(a);l instanceof t.Model&&i(l,e.rest(r),s),s(o,r)},s=function(t,o,n){var r;return o&&(r=e.result(t,"relations")[o]),n&&!r&&(r=l),null==r&&(r=l),r},a=function(t,o,n){var r=e.result(t,"name");return r&&!o[r]&&(o[r]=t),o},l=t.Model.extend({relations:{},unsafeAttributes:[],name:null,_valueForCollection:function(t){return!!e.isArray(t)&&(!(t.length>=1)||e.isObject(t[0]))},_nestedSet:function(n,r,i){for(var d=(n=n.split(".")).length-1,u=this,h=0;h<d;++h){var m=n[h];if(!u.attributes[m]){var p=new(s(u,m,r));u.attributes[m]=a(u,p)}u=u.attributes[m]}var g=n[d];if(!e.isArray(r)&&e.isObject(r)&&function(e){return e.constructor===Object}(r))if(0===e.size(r))u.attributes[g]=new l;else for(var f in r){var v=g+"."+f;u._nestedSet(v,r[f],i)}else if(this._valueForCollection(r)){var b=s(u,g,r);b.prototype instanceof t.Model&&(b=c);var y=new b(r);y=a(u,y),u.attributes[g]=y}else 1==n.length?u.attributes[g]=r:u.set(g,r,e.extend({skipNested:!0,forceChange:!0},i));i.silent||o.call(this,n)},_setChanging:function(){this._previousAttributes=this.toJSON(),this.changed={}},_triggerChanges:function(e,t,o){e.length&&(this._pending=!0);for(var n=0,r=e.length;n<r;n++)o||(o=this.get(e[n])),1==e[n].split(".").length&&this.trigger("change:"+e[n],this,o,t)},_setChange:function(t,o,n){var i,s,a=this.get(t);return t=t.split("."),!e.isEqual(a,o)||n.forceChange?(i=this.changed,s=o,r(i,t,function(e,t){e[t]=s}),!0):(function(e,t){r(e,t,function(e,t){delete e[t]})}(this.changed,t),!1)},set:function(e,t,o){var n,r,s,a,l,c,d;if(null==e)return this;if("object"==typeof e?(r=e,o=t):(r={})[e]=t,o=o||{},!this._validate(r,o))return!1;s=o.unset,l=o.silent,a=[],c=this._changing,d=o.skipNested,this._changing=!0,c||this._setChanging(),this.idAttribute in r&&(this.id=r[this.idAttribute]);var u=function(e,t){delete e.attributes[t]};for(n in r)t=r[n],this._setChange(n,t,o)&&a.push(n),s?i(this,n,u):d?this.attributes[n]=t:this._nestedSet(n,t,o);if(l||this._triggerChanges(a,o),c)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,o);return this._pending=!1,this._changing=!1,this},get:function(t){var o=t?t.split("."):[];if(o.length>1){var n=this.attributes[e.first(o)];if(!n)return;var r=e.rest(o).join(".");return e.isFunction(n.get)?n.get(r):n[r]}return this.attributes[t]},toJSON:function(t){t=t||{};var o=e.result(this,"unsafeAttributes");t.except&&(o=e.union(o,t.except));var n=e.clone(this.attributes);return e.each(o,function(e){delete n[e]}),e.each(n,function(t,o){t&&e.isFunction(t.toJSON)&&(n[o]=t.toJSON())}),n},hasChanged:function(t){return null==t?!e.isEmpty(this.changed):(o=this.changed,n=!1,r(o,t,function(t,o){n=e.has(t,o)}),n);var o,n},previous:function(e){return null!=e&&this._previousAttributes?function(e,t,o){for(var r=(t=n(t)).length,i=0;i<r;i++){if(!e||"object"!=typeof e)return o;e=e[t[i]]}return void 0===e?o:e}(this._previousAttributes,e):null},clear:function(e){for(var o in this.id=void 0,this.attributes){var n=this.attributes[o];n instanceof t.Model?n.clear():n instanceof t.Collection?n.reset():this.unset(o)}return this}}),c=t.Collection.extend({model:l});return l}(_,Backbone);const k=Backbone.SuperModel,S={};S.ConfigModel=k.extend({defaults:{availableStyles:{},socialIcons:{},blockDefaults:{},sidepanelWidth:"331px",validation:{},urls:{},availableDiscountTypes:{}}}),S.config={},S.getConfig=function(){return S.config},S.setConfig=function(e){return S.config=new S.ConfigModel(e,{parse:!0}),S.config},C.on("before:start",(e,t)=>{const o=e,n=c.default.clone(t.config);o.getConfig=S.getConfig,o.setConfig=S.setConfig,n.blockDefaults=c.default.extend(n.blockDefaults,t.newsletter.body?.blockDefaults||{}),o.setConfig(n)});var T={};T.StylesModel=k.extend({defaults:{text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"16px",lineHeight:"1.6"},h1:{fontColor:"#111111",fontFamily:"Arial",fontSize:"40px",lineHeight:"1.6"},h2:{fontColor:"#222222",fontFamily:"Tahoma",fontSize:"32px",lineHeight:"1.6"},h3:{fontColor:"#333333",fontFamily:"Verdana",fontSize:"24px",lineHeight:"1.6"},link:{fontColor:"#21759B",textDecoration:"underline"},wrapper:{backgroundColor:"#ffffff"},body:{backgroundColor:"#cccccc"},woocommerce:{headingFontFamily:"Arial"}},initialize:function(e){this.set(x().extend(!0,{},this.defaults,e)),this.on("change",function(){C.getChannel().trigger("autoSave")}),C.getChannel().on("historyUpdate",this.onHistoryUpdate,this)},onHistoryUpdate:function(e){this.set(e.globalStyles)}}),T.StylesView=v().View.extend({getTemplate:function(){return window.templates.styles},templateContext:function(){return{isWoocommerceTransactional:this.isWoocommerceTransactional}},modelEvents:{change:"render"},serializeData:function(){return this.model.toJSON()},initialize:function(e){this.isWoocommerceTransactional=e.isWoocommerceTransactional}}),T._globalStyles=new k,T.getGlobalStyles=function(){return T._globalStyles},T.setGlobalStyles=function(e){return T._globalStyles=new T.StylesModel(e),T._globalStyles},T.getAvailableStyles=function(){return C.getConfig().get("availableStyles")},C.on("before:start",function(e,t){var o,n,r,i=e;i.getGlobalStyles=T.getGlobalStyles,i.setGlobalStyles=T.setGlobalStyles,i.getAvailableStyles=T.getAvailableStyles,o=t.newsletter.body,n=c.default.has(o,"globalStyles")?o.globalStyles:{},r=c.default.has(t.config,"overrideGlobalStyles")?t.config.overrideGlobalStyles:{},this.setGlobalStyles(x().extend(!0,{},n,r))}),C.on("start",function(e){var t=new T.StylesView({model:e.getGlobalStyles(),isWoocommerceTransactional:C.getNewsletter().isWoocommerceTransactional()});e._appView.showChildView("stylesRegion",t)});var E=o(9689),O=o.n(E),A=o(7378);const M="brand",B="theme",R={selectedStyle:"brand",brand:{fontFamily:"SF Pro Text",fontWeight:"normal",background:"#ffffff",foreground:"#dfa8bb"},theme:{fontFamily:"SF Pro Text",fontWeight:"800",background:"#ffffff",foreground:"#ad86e9"}};function N(){const{brand:e,theme:t,selectedStyle:o}=R,[n,r]=(0,A.useState)(o),s=e=>()=>r(e);return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("h4",{children:[(0,i.__)("Choose a style","mailpoet")," ",(0,m.jsx)("i",{className:"mailpoet_info"})]}),(0,m.jsxs)("div",{id:"mailpoet_style_types",children:[(0,m.jsxs)("div",{className:"mailpoet_form_field mailpoet_form_style_type_brand",children:[(0,m.jsx)("input",{type:"radio",name:"style_type",id:"style_type_brand",value:M,checked:n===M,onChange:s(M)}),(0,m.jsxs)("label",{htmlFor:"style_type_brand",children:[(0,m.jsx)("h1",{className:"style_type_typography",style:{fontFamily:e.fontFamily,fontWeight:e.fontWeight},children:"Aa"}),(0,m.jsxs)("span",{className:"style_type_colors",children:[(0,m.jsx)("span",{style:{background:e.foreground}}),(0,m.jsx)("span",{style:{background:e.background}})]}),(0,m.jsx)("i",{className:"mailpoet_checkmark radio_checkmark"})]})]}),(0,m.jsxs)("div",{className:"mailpoet_form_field mailpoet_form_style_type_theme",children:[(0,m.jsx)("input",{type:"radio",name:"style_type",id:"style_type_theme",value:B,checked:n===B,onChange:s(B)}),(0,m.jsxs)("label",{htmlFor:"style_type_theme",children:[(0,m.jsx)("h1",{className:"style_type_typography",style:{fontFamily:t.fontFamily,fontWeight:t.fontWeight},children:"Aa"}),(0,m.jsxs)("span",{className:"style_type_colors",children:[(0,m.jsx)("span",{style:{background:t.foreground}}),(0,m.jsx)("span",{style:{background:t.background}})]}),(0,m.jsx)("i",{className:"mailpoet_checkmark radio_checkmark"})]})]})]})]})}const V=(e,t)=>{const o=t.offset(),n=t.height(),r=t.width();return!(e.pageX<o.left||e.pageX>o.left+r||e.pageY<o.top||e.pageY>o.top+n)},D={};D._contentWidgets=new(O().Collection.extend({model:k.extend({defaults:{name:"",priority:100,widgetView:void 0}}),comparator:"priority"})),D.registerWidget=e=>{const t=C.getConfig().get("hiddenWidgets");return(!t||!t.includes(e.name))&&D._contentWidgets.add(e)},D.getWidgets=function(){return D._contentWidgets},D._layoutWidgets=new(O().Collection.extend({model:k.extend({defaults:{name:"",priority:100,widgetView:void 0}}),comparator:"priority"})),D.registerLayoutWidget=function(e){return D._layoutWidgets.add(e)},D.getLayoutWidgets=function(){return D._layoutWidgets};const P=v().View.extend({getTemplate:()=>window.templates.sidebar,regions:{contentRegion:".mailpoet_content_region",layoutRegion:".mailpoet_layout_region",stylesRegion:".mailpoet_styles_region",previewRegion:".mailpoet_preview_region"},events:{"click .mailpoet_sidebar_region h3, .mailpoet_sidebar_region .handlediv":function(e){const t=this.$el.find(".mailpoet_sidebar_region:not(.closed)"),o=this.$el.find(e.target).closest(".mailpoet_sidebar_region");t.find(".mailpoet_region_content").velocity("slideUp",{duration:250,easing:"easeOut",complete:()=>{t.addClass("closed")}}),t.get(0)!==o.get(0)&&o.find(".mailpoet_region_content").velocity("slideDown",{duration:250,easing:"easeIn",complete:()=>{o.removeClass("closed")}})}},templateContext(){return{isWoocommerceTransactional:this.model.isWoocommerceTransactional()}},initialize(){x()(window).on("resize",this.updateHorizontalScroll.bind(this)).on("scroll",this.updateHorizontalScroll.bind(this))},onRender(){this.showChildView("contentRegion",new D.SidebarWidgetsView(C.getWidgets())),this.showChildView("layoutRegion",new D.SidebarLayoutWidgetsView(C.getLayoutWidgets())),this.showChildView("stylesRegion",new D.SidebarStylesView({model:C.getGlobalStyles(),availableStyles:C.getAvailableStyles(),isWoocommerceTransactional:this.model.isWoocommerceTransactional()}))},updateHorizontalScroll(){this.$el.parent().each(function(){const e=x()(this);if("fixed"===e.css("position")){const t=e.parent().offset().left-x()(window).scrollLeft();e.css("left",`${t}px`)}else e.css("left","")})},onDomRefresh(){this.$el.parent().stick_in_parent({offset_top:32}),this.$el.parent().on("sticky_kit:stick",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:unstick",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:bottom",this.updateHorizontalScroll.bind(this)),this.$el.parent().on("sticky_kit:unbottom",this.updateHorizontalScroll.bind(this))}});D.SidebarWidgetsCollectionView=v().CollectionView.extend({childView:e=>e.get("widgetView")}),D.SidebarWidgetsView=v().View.extend({getTemplate:()=>window.templates.sidebarContent,regions:{widgets:".mailpoet_region_content"},initialize(e){this.widgets=e},onRender(){this.showChildView("widgets",new D.SidebarWidgetsCollectionView({collection:this.widgets}))}}),D.SidebarLayoutWidgetsView=D.SidebarWidgetsView.extend({getTemplate:()=>window.templates.sidebarLayout}),D.SidebarStylesView=v().View.extend({brandStylesRoot:null,getTemplate:()=>window.templates.sidebarStyles,behaviors:{ColorPickerBehavior:{},WooCommerceStylesBehavior:{}},events(){return{"change #mailpoet_text_font_color":c.default.partial(this.changeColorField,"text.fontColor"),"change #mailpoet_text_font_family":function(e){this.model.set("text.fontFamily",e.target.value)},"change #mailpoet_text_font_size":function(e){this.model.set("text.fontSize",e.target.value)},"change #mailpoet_h1_font_color":c.default.partial(this.changeColorField,"h1.fontColor"),"change #mailpoet_h1_font_family":function(e){this.model.set("h1.fontFamily",e.target.value)},"change #mailpoet_h1_font_size":function(e){this.model.set("h1.fontSize",e.target.value)},"change #mailpoet_h2_font_color":c.default.partial(this.changeColorField,"h2.fontColor"),"change #mailpoet_h2_font_family":function(e){this.model.set("h2.fontFamily",e.target.value)},"change #mailpoet_h2_font_size":function(e){this.model.set("h2.fontSize",e.target.value)},"change #mailpoet_h3_font_color":c.default.partial(this.changeColorField,"h3.fontColor"),"change #mailpoet_h3_font_family":function(e){this.model.set("h3.fontFamily",e.target.value)},"change #mailpoet_h3_font_size":function(e){this.model.set("h3.fontSize",e.target.value)},"change #mailpoet_a_font_color":c.default.partial(this.changeColorField,"link.fontColor"),"change #mailpoet_a_font_underline":function(e){this.model.set("link.textDecoration",e.target.checked?e.target.value:"none")},"change #mailpoet_text_line_height":function(e){this.model.set("text.lineHeight",e.target.value)},"change #mailpoet_heading_line_height":function(e){this.model.set("h1.lineHeight",e.target.value),this.model.set("h2.lineHeight",e.target.value),this.model.set("h3.lineHeight",e.target.value)},"change #mailpoet_newsletter_background_color":c.default.partial(this.changeColorField,"wrapper.backgroundColor"),"change #mailpoet_background_color":c.default.partial(this.changeColorField,"body.backgroundColor")}},templateContext(){return{model:this.model.toJSON(),availableStyles:this.availableStyles.toJSON(),isWoocommerceTransactional:this.isWoocommerceTransactional}},initialize(e){this.availableStyles=e.availableStyles,this.isWoocommerceTransactional=e.isWoocommerceTransactional,C.getChannel().on("historyUpdate",this.render)},changeField(e,t){this.model.set(e,x()(t.target).val())},changeColorField(e,t){const o=x()(t.target).val()||"transparent";this.model.set(e,o)},onRender(){const e=this.$el.find("#mailpoet_brand_styles")[0],t=r.U.FeaturesController.isSupported(r.U.FeaturesController.FEATURE_BRAND_TEMPLATES);e&&t&&(window.mailpoet_brand_styles||{}).available&&(this.brandStylesRoot=(0,s.H)(e),this.brandStylesRoot.render((0,m.jsx)(N,{})))},onDestroy(){this.brandStylesRoot&&this.brandStylesRoot.unmount()}}),C.on("before:start",e=>{const t=e;t.registerWidget=D.registerWidget,t.getWidgets=D.getWidgets,t.registerLayoutWidget=D.registerLayoutWidget,t.getLayoutWidgets=D.getLayoutWidgets}),C.on("start",e=>{const t=new P({model:e.getNewsletter()});e._appView.showChildView("sidebarRegion",t)});var I=o(94667),L={};L.NewsletterModel=k.extend({whitelisted:["id","subject","preheader","type"],initialize:function(){this.on("change",function(){C.getChannel().trigger("autoSave")})},toJSON:function(){return c.default.pick(k.prototype.toJSON.call(this),this.whitelisted)},isWoocommerceTransactional:function(){return"wc_transactional"===this.get("type")},isAutomationEmail:function(){return l.Ls.includes(this.get("type"))},isConfirmationEmailTemplate:function(){return"confirmation_email"===this.get("type")},isStandardEmail:function(){return this.get("type")===I.Gn.Standard},isWelcomeEmail:function(){return this.get("type")===I.Gn.Welcome}}),L._blockTypes={},L.registerBlockType=function(e,t){L._blockTypes[e]=t},L.getBlockTypeModel=function(e){return e in L._blockTypes?L._blockTypes[e].blockModel:L._blockTypes.unknownBlockFallback.blockModel},L.getBlockTypeView=function(e){return e in L._blockTypes?L._blockTypes[e].blockView:L._blockTypes.unknownBlockFallback.blockView},L.getBody=function(){return{content:C._contentContainer.toJSON(),globalStyles:C.getGlobalStyles().toJSON(),blockDefaults:c.default.omit(C.getConfig().toJSON().blockDefaults,"text","image")}},L.toJSON=function(){return c.default.extend({body:L.getBody()},C.getNewsletter().toJSON())},L.getNewsletter=function(){return L.newsletter},L.findModels=function(e){var t=C._contentContainer.getChildren();return c.default.filter(t,e)},L.renderContent=function(e){C._contentContainer&&C._contentContainer.destroy(),C._contentContainerView&&C._contentContainerView.destroy(),C._contentContainer=new(C.getBlockTypeModel("container"))(e,{parse:!0}),C._contentContainerView=new(C.getBlockTypeView("container"))({model:C._contentContainer,renderOptions:{depth:0}}),C._appView.showChildView("contentRegion",C._contentContainerView)},C.on("before:start",function(e,t){var o=e;o.registerBlockType=L.registerBlockType,o.getBlockTypeModel=L.getBlockTypeModel,o.getBlockTypeView=L.getBlockTypeView,o.toJSON=L.toJSON,o.getBody=L.getBody,o.getNewsletter=L.getNewsletter,o.findModels=L.findModels,L.newsletter=new L.NewsletterModel(c.default.omit(c.default.clone(t.newsletter),["body"]))}),C.on("start",function(e,t){var o=e,n=t.newsletter.body,s=c.default.has(n,"content")?n.content:{};c.default.has(t.newsletter,"body")&&c.default.isObject(t.newsletter.body)||r.U.Notice.error((0,i.__)("Contents of this newsletter are corrupted and may be lost, you may need to add new content to this newsletter, or create a new one. If possible, please contact us and report this issue.","mailpoet"),{static:!0}),L.renderContent(s),o.getChannel().on("historyUpdate",function(e){L.renderContent(e.content)},this)});var F={};F.HeadingView=v().View.extend({getTemplate:function(){return window.templates.heading},initialize:function(){C.getChannel().on("historyUpdate",this.onHistoryUpdate,this)},templateContext:function(){return{model:this.model.toJSON(),isWoocommerceTransactional:this.model.isWoocommerceTransactional(),isAutomationEmail:this.model.isAutomationEmail(),isConfirmationEmailTemplate:this.model.isConfirmationEmailTemplate()}},events:function(){return{"change .mailpoet_input_title":c.default.partial(this.changeField,"subject"),"change .mailpoet_input_preheader":c.default.partial(this.changeField,"preheader"),"change #mailpoet_heading_email_type":e=>{C.getChannel().trigger("changeWCEmailType",e.target.value)}}},changeField:function(e,t){this.model.set(e,x()(t.target).val())},onHistoryUpdate:function(){const e=x()("#mailpoet_heading_email_type").val()||"completed_order";C.getChannel().trigger("changeWCEmailType",e)}}),C.on("start",function(e){var t=e.getNewsletter();e._appView.showChildView("headingRegion",new F.HeadingView({model:t}));const o=document.getElementById("tooltip-designer-subject-line"),n=document.getElementById("tooltip-designer-preheader");t.isWoocommerceTransactional()||t.isAutomationEmail()||(o&&r.U.helpTooltip.show(o,{tooltipId:"tooltip-designer-subject-line-ti",tooltip:(0,i.__)("You can add MailPoet shortcodes here. For example, you can add your subscribers' first names by using this shortcode: [subscriber:firstname | default:reader]. Simply copy and paste the shortcode into the field.","mailpoet"),place:"right"}),n&&r.U.helpTooltip.show(n,{tooltipId:"tooltip-designer-preheader-ti",tooltip:(0,i.__)("This optional text will appear in your subscribers' inboxes, beside the subject line. Write something enticing!","mailpoet")+" "+(0,i.__)("Max length is 250 characters, however, we recommend 80 characters.","mailpoet")}))});var z=o(62439),H=o.n(z),U=o(35558),Z={};Z.HistoryView=v().View.extend({MAX_HISTORY_STATES:25,elements:{redo:null,undo:null,resetTemplate:null},events:{"click #mailpoet-history-arrow-undo":"undo","click #mailpoet-history-arrow-redo":"redo","click #mailpoet-history-reset-template":"resetTemplate"},model:{statesStack:[],currentStateIndex:0},getTemplate:function(){return window.templates.history},getOriginalTemplate:function(){return(0,U.cloneDeep)(window.mailpoet_original_template_body)},initialize:function(){var e=this;C.getChannel().on("afterEditorSave",this.addState,this),H().bind(["ctrl+z","command+z"],function(){e.undo()}),H().bind(["shift+ctrl+z","shift+command+z"],function(){e.redo()})},onAttach:function(){this.elements.redo=document.getElementById("mailpoet-history-arrow-redo"),this.elements.undo=document.getElementById("mailpoet-history-arrow-undo"),this.elements.resetTemplate=document.getElementById("mailpoet-history-reset-template"),this.getOriginalTemplate()&&this.elements.resetTemplate.classList.remove("mailpoet_hidden"),this.addState(C.toJSON())},addState:function(e){var t;e&&e.body&&(t=JSON.stringify(e.body),this.model.statesStack[this.model.currentStateIndex]!==t&&(this.model.currentStateIndex>0&&this.model.statesStack.splice(0,this.model.currentStateIndex),this.model.statesStack.unshift(t),this.model.currentStateIndex=0,this.model.statesStack.length=Math.min(this.model.statesStack.length,this.MAX_HISTORY_STATES),this.updateArrowsUI()))},canUndo:function(){return this.model.currentStateIndex<this.model.statesStack.length-1},canRedo:function(){return this.model.currentStateIndex>0},undo:function(){this.canUndo()&&(this.model.currentStateIndex=Math.min(this.model.statesStack.length-1,this.model.currentStateIndex+1),this.updateArrowsUI(),this.applyState(this.model.currentStateIndex))},redo:function(){this.canRedo()&&(this.model.currentStateIndex=Math.max(0,this.model.currentStateIndex-1),this.updateArrowsUI(),this.applyState(this.model.currentStateIndex))},resetTemplate:function(){const e=this.getOriginalTemplate();window.confirm((0,i.__)("Reset template will restore the original template as distributed with the plugin. You will loose all your edits."))&&(C.getChannel().trigger("historyUpdate",e),C.getChannel().request("save"))},updateArrowsUI:function(){this.elements.undo.classList.toggle("mailpoet_history_arrow_inactive",!this.canUndo()),this.elements.redo.classList.toggle("mailpoet_history_arrow_inactive",!this.canRedo()),this.elements.undo.setAttribute("title",this.canUndo()?(0,i._x)("Undo","A button title when user can undo the change in editor","mailpoet"):(0,i._x)("No actions available to undo.","A button title when user can't undo the change in editor","mailpoet")),this.elements.redo.setAttribute("title",this.canRedo()?(0,i._x)("Redo","A button title when user can redo the change in editor","mailpoet"):(0,i._x)("No actions available to redo.","A button title when user can't redo the change in editor","mailpoet"))},applyState:function(e){const t=JSON.parse(this.model.statesStack[e]);C.getChannel().trigger("historyUpdate",t)}}),C.on("start",function(e){e._appView.showChildView("historyRegion",new Z.HistoryView)}),o(79534);var $={_query:function(e){return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"automatedLatestContent",action:e.action,data:e.options||{}})}};$._cachedQuery=c.default.memoize($._query,JSON.stringify),$._dynamicProductsQuery=function(e){return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"dynamicProducts",action:e.action,data:e.options||{}})},$._cachedDynamicProductsQuery=c.default.memoize($._dynamicProductsQuery,JSON.stringify),$.getNewsletter=function(e){return $._query({action:"get",options:e})},$.getPostTypes=function(){return $._cachedQuery({action:"getPostTypes",options:{}}).then(function(e){return c.default.values(e.data)})},$.getTaxonomies=function(e){return $._cachedQuery({action:"getTaxonomies",options:{postType:e}}).then(function(e){return e.data})},$.getProductTaxonomies=function(e){return $._cachedDynamicProductsQuery({action:"getTaxonomies",options:{postType:e}}).then(function(e){return e.data})},$.getTerms=function(e){return $._cachedQuery({action:"getTerms",options:e}).then(function(e){return e.data})},$.getProductTerms=function(e){return $._cachedDynamicProductsQuery({action:"getTerms",options:e}).then(function(e){return e.data})},$.getPosts=function(e){return $._cachedQuery({action:"getPosts",options:e}).then(function(e){return e.data})},$.getTransformedPosts=function(e){return $._cachedQuery({action:"getTransformedPosts",options:e}).then(function(e){return e.data})},$.getBulkTransformedPosts=function(e){return $._query({action:"getBulkTransformedPosts",options:e}).then(function(e){return e.data})},$.getBulkTransformedProducts=function(e){return $._dynamicProductsQuery({action:"getBulkTransformedProducts",options:e}).then(function(e){return e.data})},$.saveNewsletter=function(e){return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"save",data:e||{}})},$.previewNewsletter=function(e){return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"sendPreview",data:e||{}})},C.on("start",function(){$.getPostTypes()}),function(e){if(e.URL=e.URL||e.webkitURL,e.Blob&&e.URL)try{return void new Blob}catch(e){}var t=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder||function(e){var t=function(e){return Object.prototype.toString.call(e).match(/^\[object\s(.*)\]$/)[1]},o=function(){this.data=[]},n=function(e,t,o){this.data=e,this.size=e.length,this.type=t,this.encoding=o},r=o.prototype,i=n.prototype,s=e.FileReaderSync,a=function(e){this.code=this[this.name=e]},l="NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR".split(" "),c=l.length,d=e.URL||e.webkitURL||e,u=d.createObjectURL,h=d.revokeObjectURL,m=d,p=e.btoa,g=e.atob,f=e.ArrayBuffer,v=e.Uint8Array,b=/^[\w-]+:\/*\[?[\w\.:-]+\]?(?::[0-9]+)?/;for(n.fake=i.fake=!0;c--;)a.prototype[l[c]]=c+1;return d.createObjectURL||(m=e.URL=function(e){var t,o=document.createElementNS("http://www.w3.org/1999/xhtml","a");return o.href=e,"origin"in o||("data:"===o.protocol.toLowerCase()?o.origin=null:(t=e.match(b),o.origin=t&&t[1])),o}),m.createObjectURL=function(e){var t,o=e.type;return null===o&&(o="application/octet-stream"),e instanceof n?(t="data:"+o,"base64"===e.encoding?t+";base64,"+e.data:"URI"===e.encoding?t+","+decodeURIComponent(e.data):p?t+";base64,"+p(e.data):t+","+encodeURIComponent(e.data)):u?u.call(d,e):void 0},m.revokeObjectURL=function(e){"data:"!==e.substring(0,5)&&h&&h.call(d,e)},r.append=function(e){var o=this.data;if(v&&(e instanceof f||e instanceof v)){for(var r="",i=new v(e),l=0,c=i.length;l<c;l++)r+=String.fromCharCode(i[l]);o.push(r)}else if("Blob"===t(e)||"File"===t(e)){if(!s)throw new a("NOT_READABLE_ERR");var d=new s;o.push(d.readAsBinaryString(e))}else e instanceof n?"base64"===e.encoding&&g?o.push(g(e.data)):"URI"===e.encoding?o.push(decodeURIComponent(e.data)):"raw"===e.encoding&&o.push(e.data):("string"!=typeof e&&(e+=""),o.push(unescape(encodeURIComponent(e))))},r.getBlob=function(e){return arguments.length||(e=null),new n(this.data.join(""),e,"raw")},r.toString=function(){return"[object BlobBuilder]"},i.slice=function(e,t,o){var r=arguments.length;return r<3&&(o=null),new n(this.data.slice(e,r>1?t:this.data.length),o,this.encoding)},i.toString=function(){return"[object Blob]"},i.close=function(){this.size=0,delete this.data},o}(e);e.Blob=function(e,o){var n=o&&o.type||"",r=new t;if(e)for(var i=0,s=e.length;i<s;i++)Uint8Array&&e[i]instanceof Uint8Array?r.append(e[i].buffer):r.append(e[i]);var a=r.getBlob(n);return!a.slice&&a.webkitSlice&&(a.slice=a.webkitSlice),a};var o=Object.getPrototypeOf||function(e){return e.__proto__};e.Blob.prototype=o(new e.Blob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||(void 0).content||void 0);const j=window.Blob;var W,q,G=o(78672),Y=o.n(G),X={isConfirmationEmailValid:function(){var e=C.toJSON(),t=e&&e.body&&e.body.content?JSON.stringify(e.body.content):"";return!(C.getConfig().get("validation.validateActivationLinkIsPresent")&&t.indexOf("[activation_link]")<0&&(x()(".mailpoet_save_error").html((0,i.__)("Don't forget to include the [activation_link] shortcode in the email","mailpoet")).removeClass("mailpoet_hidden"),x()(".mailpoet_save_button").attr("disabled","disabled").addClass("button-disabled"),x()(".mailpoet_editor_last_saved .mailpoet_autosaved_message").addClass("mailpoet_hidden"),1))},save:function(){var e=C.toJSON(),t=x()("#mailpoet_editor_top"),o=x().Deferred();return c.default.isUndefined(e.body)||(e.body.blockDefaults&&(delete e.body.blockDefaults.woocommerceHeading,delete e.body.blockDefaults.woocommerceContent,e.body.blockDefaults&&e.body.blockDefaults.coupon&&(delete e.body.blockDefaults.coupon.couponId,delete e.body.blockDefaults.coupon.code)),e.body=JSON.stringify(e.body)),X.isConfirmationEmailValid()?(C.getChannel().trigger("beforeEditorSave",e),$.saveNewsletter(e).done(function(o){void 0!==o.success&&!0===o.success||void 0!==o.error&&(0===o.error.length?r.U.Notice.error((0,i.__)("Template has not been saved, please try again","mailpoet"),{positionAfter:t,scroll:!0}):x()(o.error).each(function(e,o){r.U.Notice.error(o,{positionAfter:t,scroll:!0})})),c.default.isUndefined(e.body)||(e.body=JSON.parse(e.body)),C.getChannel().trigger("afterEditorSave",e,o)}).fail(function(e){C.getChannel().trigger("editorSaveFailed",{},e)})):o.resolve()},saveTemplate:function(e){return(0,d.fromNewsletter)(C.toJSON()).then(function(t){var o=c.default.extend(e||{},{thumbnail_data:t,body:JSON.stringify(C.getBody()),categories:JSON.stringify(["saved",C.getNewsletter().get("type")])});return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletterTemplates",action:"save",data:o})})},exportTemplate:function(e){return(0,d.fromNewsletter)(C.toJSON()).then(function(t){var o=c.default.extend(e||{},{thumbnail_data:t,body:C.getBody(),categories:JSON.stringify(["saved",C.getNewsletter().get("type")])}),n=new j([JSON.stringify(o)],{type:"application/json;charset=utf-8"});Y().saveAs(n,"template.json"),r.U.trackEvent("Editor > Template exported")})}};X.SaveView=v().View.extend({getTemplate:function(){return window.templates.save},templateContext:function(){return{wrapperClass:this.wrapperClass,isWoocommerceTransactional:this.model.isWoocommerceTransactional(),isAutomationEmail:this.model.isAutomationEmail(),woocommerceCustomizerEnabled:C.getConfig().get("woocommerceCustomizerEnabled"),isConfirmationEmailTemplate:this.model.isConfirmationEmailTemplate(),confirmationEmailCustomizerEnabled:C.getConfig().get("confirmationEmailCustomizerEnabled")}},events:{"click .mailpoet_save_button":"save","click .mailpoet_save_show_options":"toggleSaveOptions","click .mailpoet_save_next":"next","click .mailpoet_save_template":"showSaveAsTemplate","click .mailpoet_save_as_template":"saveAsTemplate","click .mailpoet_save_export":"showExportTemplate","click .mailpoet_export_template":"exportTemplate","click .mailpoet_save_activate_wc_customizer_button":"activateWooCommerceCustomizer","click .mailpoet_save_activate_confirmation_email_customizer_button":"activateConfirmationEmailCustomizer","click .mailpoet_save_go_to_automation":"saveAndGoToAutomation","click .mailpoet_show_preview":"showPreview"},initialize:function(){this.setDropdownDirectionDown(),C.getChannel().on("beforeEditorSave",this.beforeSave,this),C.getChannel().on("afterEditorSave",this.afterSave,this),C.getChannel().on("editorSaveFailed",this.handleSavingErrors,this)},setDropdownDirectionDown:function(){this.wrapperClass="mailpoet_save_dropdown_down"},setDropdownDirectionUp:function(){this.wrapperClass="mailpoet_save_dropdown_up"},onRender:function(){this.validateNewsletter(C.toJSON())},save:function(){this.model.isConfirmationEmailTemplate()&&this.$(".mailpoet_save_button").hasClass("button-disabled")||(this.hideSaveOptions(),C.getChannel().request("save"))},beforeSave:function(){this.$(".mailpoet_autosaved_at").text((0,i.__)("Saving...","mailpoet"))},afterSave:function(e){this.validateNewsletter(e),this.$(".mailpoet_editor_last_saved .mailpoet_autosaved_message").removeClass("mailpoet_hidden"),this.$(".mailpoet_autosaved_at").text("")},handleSavingErrors:function(){this.showError((0,i.__)("The email could not be saved. Please, clear browser cache and reload the page. If the problem persists, duplicate the email and try again.","mailpoet"))},showSaveOptions:function(){this.$(".mailpoet_save_show_options").addClass("mailpoet_save_show_options_active"),this.$(".mailpoet_save_options").removeClass("mailpoet_hidden"),this.hideSaveAsTemplate(),this.hideExportTemplate()},hideSaveOptions:function(){this.$(".mailpoet_save_show_options").removeClass("mailpoet_save_show_options_active"),this.$(".mailpoet_save_options").addClass("mailpoet_hidden"),this.hideSaveAsTemplate(),this.hideExportTemplate()},toggleSaveOptions:function(){this.$(".mailpoet_save_show_options").hasClass("mailpoet_save_show_options_active")?this.hideSaveOptions():this.showSaveOptions()},showSaveAsTemplate:function(){this.$(".mailpoet_save_as_template_container").removeClass("mailpoet_hidden")},hideSaveAsTemplate:function(){this.$(".mailpoet_save_as_template_container").addClass("mailpoet_hidden")},saveAsTemplate:function(){var e=this.$(".mailpoet_save_as_template_name").val(),t=x()("#mailpoet_editor_top");""===e?r.U.Notice.error((0,i.__)("Please add a template name","mailpoet"),{positionAfter:t,scroll:!0}):(X.saveTemplate({name:e}).then(function(){r.U.Notice.success((0,i.__)("Template has been saved.","mailpoet"),{positionAfter:t,scroll:!0}),r.U.trackEvent("Editor > Template saved")}).catch(function(){r.U.Notice.error((0,i.__)("Template has not been saved, please try again","mailpoet"),{positionAfter:t,scroll:!0})}),this.hideSaveOptions())},showExportTemplate:function(){this.$(".mailpoet_export_template_container").removeClass("mailpoet_hidden")},hideExportTemplate:function(){this.$(".mailpoet_export_template_container").addClass("mailpoet_hidden")},exportTemplate:function(){var e=this.$(".mailpoet_export_template_name").val(),t=x()("#mailpoet_editor_top");""===e?r.U.Notice.error((0,i.__)("Please add a template name","mailpoet"),{positionAfter:t,scroll:!0}):(X.exportTemplate({name:e}),this.hideExportTemplate())},showPreview:function(){var e=C.toJSON();c.default.isUndefined(e.body)||(e.body=JSON.stringify(e.body)),r.U.Modal.loading(!0),r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"newsletters",action:"showPreview",data:e}).always(function(){r.U.Modal.loading(!1)}).done(function(e){this.previewView=new X.NewsletterPreviewView({model:new X.NewsletterPreviewModel,previewType:window.localStorage.getItem(C.getConfig().get("newsletterPreview.previewTypeLocalStorageKey")),previewUrl:e.meta.preview_url}),this.previewView.render(),r.U.Modal.popup({template:"",element:this.previewView.$el,minWidth:"95%",height:"100%",title:(0,i.__)("Newsletter Preview","mailpoet"),onCancel:function(){this.previewView.destroy(),this.previewView=null}.bind(this)}),r.U.trackEvent("Editor > Browser Preview")}.bind(this)).fail(function(e){e.errors.length>0&&r.U.Notice.error(e.errors.map(function(e){return e.message}),{scroll:!0})})},next:function(){this.hideSaveOptions(),this.$(".mailpoet_save_next").hasClass("button-disabled")||(X._cancelAutosave(),X.save().done(function(){window.location.href=C.getConfig().get("urls.send")}))},saveAndGoToAutomation:function(){this.hideSaveOptions(),X._cancelAutosave(),X.save().done(function(){const e=`admin.php?page=mailpoet-automation-editor&id=${C.getNewsletter().get("options").get("automationId")}`;window.location.href=e})},validateNewsletter:function(e){var t,o="",n=C.getNewsletter();C._contentContainer.isValid()?e&&e.body&&e.body.content?(t=e.body.content,o=JSON.stringify(e.body.content),t.blocks&&Array.isArray(t.blocks)&&0!==t.blocks.length?C.getConfig().get("validation.validateUnsubscribeLinkPresent")&&o.indexOf("[link:subscription_unsubscribe_url]")<0&&o.indexOf("[link:subscription_unsubscribe]")<0&&"sent"!==n.get("status")?this.showValidationError((0,i.__)('All emails must include an "Unsubscribe" link. Add a footer widget to your email to continue.',"mailpoet")):C.getConfig().get("validation.validateActivationLinkIsPresent")&&o.indexOf("[activation_link]")<0?this.showValidationError((0,i.__)("Don't forget to include the [activation_link] shortcode in the email","mailpoet")):"re_engagement"===n.get("type")&&o.indexOf("[link:subscription_re_engage_url]")<0?this.showValidationError((0,i.__)("A re-engagement email must include a link with [link:subscription_re_engage_url] shortcode.","mailpoet")):"notification"===n.get("type")&&o.indexOf('"type":"automatedLatestContent"')<0&&o.indexOf('"type":"automatedLatestContentLayout"')<0?this.showValidationError((0,i._x)("Please add an “Automatic Latest Content” widget to the email from the right sidebar.","(Please reuse the current translation used for the string “Automatic Latest Content”) This Error message is displayed when a user tries to send a “Post Notification” email without any “Automatic Latest Content” widget inside","mailpoet")):"standard"!==n.get("type")||"sent"!==n.get("status")?this.hideValidationError():this.showValidationError((0,i.__)("This email has already been sent. It can be edited, but not sent again. Duplicate this email if you want to send it again.","mailpoet")):this.showValidationError((0,i.__)("Poet, please add prose to your masterpiece before you send it to your followers.","mailpoet"))):this.handleSavingErrors():this.showValidationError(C._contentContainer.validationError)},showError:function(e){var t=this.$(".mailpoet_save_error");t.html(e.replace(/\. /g,".<br>")),t.removeClass("mailpoet_hidden")},hideError:function(){this.$(".mailpoet_save_error").addClass("mailpoet_hidden")},showValidationError:function(e){this.showError(e),this.$(".mailpoet_save_next").addClass("button-disabled"),this.model.isConfirmationEmailTemplate()&&this.$(".mailpoet_save_button").attr("disabled","disabled").addClass("button-disabled")},hideValidationError:function(){this.hideError(),this.$(".mailpoet_save_next").removeClass("button-disabled"),this.model.isConfirmationEmailTemplate()&&this.$(".mailpoet_save_button").removeAttr("disabled").removeClass("button-disabled")},activateWooCommerceCustomizer:function(){var e=x()(".mailpoet_save_woocommerce_customizer_disabled");return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{"woocommerce.use_mailpoet_editor":1}}).done(function(){e.addClass("mailpoet_hidden"),r.U.trackEvent("Editor > WooCommerce email customizer enabled")}).fail(function(e){r.U.Notice.showApiErrorNotice(e,{scroll:!0})})},activateConfirmationEmailCustomizer:function(){var e=x()(".mailpoet_save_confirmation_email_disabled");return r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"settings",action:"set",data:{"signup_confirmation.use_mailpoet_editor":1}}).done(function(){e.addClass("mailpoet_hidden"),r.U.trackEvent("Editor > Confirmation email customizer enabled")}).fail(function(e){r.U.Notice.showApiErrorNotice(e,{scroll:!0})})}}),X.autoSave=function(){X._cancelAutosave(),W=setTimeout(function(){if(q)return q=!1,void X._cancelAutosave();X.isConfirmationEmailValid()?C.getChannel().request("save").always(function(){X._cancelAutosave()}):X._cancelAutosave()},1e3)},X._cancelAutosave=function(){W&&(clearTimeout(W),W=void 0)},X.onHistoryUpdate=function(){q=!0},X.beforeExitWithUnsavedChanges=function(e){var t,o;if(W)return t=(0,i.__)("There are unsaved changes which will be lost if you leave this page.","mailpoet"),(o=e||window.event)&&(o.returnValue=t),t},X.NewsletterPreviewModel=k.extend({defaults:{previewSendingError:!1,previewSendingSuccess:!1,sendingPreview:!1,mssPendingApproval:window.mailpoet_mss_key_pending_approval,mssKeyPendingApprovalRefreshMessage:!0,awaitingKeyCheck:!1}}),X.NewsletterPreviewView=v().View.extend({className:"mailpoet_browser_preview_wrapper",getTemplate:function(){return window.templates.newsletterPreview},modelEvents:{change:"render"},events:function(){return{"change .mailpoet_browser_preview_type":"changeBrowserPreviewType","click #mailpoet_send_preview":"sendPreview","click #refresh-mss-key-status":"refreshMssKeyStatus"}},initialize:function(e){this.previewType=e.previewType||"mobile",this.previewUrl=e.previewUrl,this.width="100%",this.height="100%"},templateContext:function(){return{previewType:this.previewType,previewUrl:this.previewUrl,width:this.width,height:this.height,email:this.$("#mailpoet_preview_to_email").val()||window.currentUserEmail,previewSendingError:this.model.get("previewSendingError"),sendingPreview:this.model.get("sendingPreview"),mssKeyPendingApproval:this.model.get("mssPendingApproval"),mssKeyPendingApprovalRefreshMessage:this.model.get("mssKeyPendingApprovalRefreshMessage"),awaitingKeyCheck:this.model.get("awaitingKeyCheck")}},changeBrowserPreviewType:function(e){var t=x()(e.target).val();"mobile"===t?(this.$(".mailpoet_browser_preview_container").addClass("mailpoet_browser_preview_container_mobile"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_desktop"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_send_to_email")):"desktop"===t?(this.$(".mailpoet_browser_preview_container").addClass("mailpoet_browser_preview_container_desktop"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_mobile"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_send_to_email")):(this.$(".mailpoet_browser_preview_container").addClass("mailpoet_browser_preview_container_send_to_email"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_desktop"),this.$(".mailpoet_browser_preview_container").removeClass("mailpoet_browser_preview_container_mobile")),window.localStorage.setItem(C.getConfig().get("newsletterPreview.previewTypeLocalStorageKey"),t),this.previewType=t},sendPreview:function(){var e=this,t=this.$("#mailpoet_preview_to_email"),o={subscriber:t.val(),id:C.getNewsletter().get("id")};if(o.subscriber.length<=0)return r.U.Notice.error((0,i.__)("Enter an email address to send the preview newsletter to.","mailpoet"),{positionAfter:t,scroll:!0}),!1;this.model.set("previewSendingError",!1),this.model.set("previewSendingSuccess",!1),this.model.set("sendingPreview",!0),C.getChannel().request("save").always(function(){$.previewNewsletter(o).done(function(){e.model.set("sendingPreview",!1),e.model.set("previewSendingSuccess",!0),r.U.trackEvent("Editor > Preview sent",{"Domain name":o.subscriber.substring(o.subscriber.indexOf("@")+1)})}).fail(function(t){e.model.set("sendingPreview",!1),e.model.set("previewSendingError",!0);let o=`<p>${(0,i.__)("Sorry, there was an error, please try again later.","mailpoet")}</p>`;t.errors.length>0&&(o=t.errors.map(function(e){let t=`\n              <p>\n                ${(0,i.__)("The email could not be sent due to a technical issue with %1$s","mailpoet").replace("%1$s",window.config.mtaMethod)}:\n                <i>${e.message}</i>\n              </p>\n            `;return"PHPMail"===window.config.mtaMethod?t+=`\n                <p>${(0,i.__)("Please check your sending method configuration, you may need to consult with your hosting company.","mailpoet")}</p>\n                <br />\n                <p>${(0,i.__)("The easy alternative is to <b>send emails with MailPoet Sending Service</b> instead, like thousands of other users do.","mailpoet")}</p>\n                <p>\n                  <a\n                    href='${r.U.MailPoetComUrlFactory.getFreePlanUrl({utm_campaign:"sending-error"})}'\n                    target='_blank'\n                    rel='noopener noreferrer'\n                  >\n                    ${(0,i.__)("Sign up for free in minutes","mailpoet")}\n                  </a>\n                </p>\n              `:t+=`<p>${(0,i.__)("Check your [link]sending method settings[/link].","mailpoet").replace(/\[link\](.*?)\[\/link\]/g,'<a href="?page=mailpoet-settings#mta" key="check-sending">$1</a>')}</p>`,t}).join("")),document.getElementById("mailpoet_preview_sending_error").innerHTML=o})})},refreshMssKeyStatus:function(){return this.model.set("awaitingKeyCheck",!0),r.U.Ajax.post({api_version:window.mailpoet_api_version,endpoint:"services",action:"refreshMSSKeyStatus"}).done(e=>{this.model.set("awaitingKeyCheck",!1),e.data&&200===e.data.result.code&&(this.model.set("mssPendingApproval",!(0,d.isTruthy)(e.data.result.data.is_approved)),this.model.set("mssKeyPendingApprovalRefreshMessage",!1))}).fail(e=>{if(this.model.set("awaitingKeyCheck",!1),e.errors&&Array.isArray(e.errors)){const t=e.errors.map(e=>e.message);document.querySelector(".pendindig_approval_error").innerHTML=t.join("\n")}})}}),C.on("before:start",function(e){var t=e;t.save=X.save,t.getChannel().on("autoSave",X.autoSave),t.getChannel().on("historyUpdate",X.onHistoryUpdate),window.onbeforeunload=X.beforeExitWithUnsavedChanges,t.getChannel().reply("save",t.save)}),C.on("start",function(e){var t=e.getNewsletter(),o=new X.SaveView({model:t}),n=new X.SaveView({model:t});n.setDropdownDirectionUp(),e._appView.showChildView("topRegion",o),e._appView.showChildView("bottomRegion",n)});var K=v(),J={};K.Behaviors.behaviorsLookup=function(){return J},window.BehaviorsLookup=J,o(61938),J.ColorPickerBehavior=v().Behavior.extend({onRender:function(){var e=this,t="hex6";this.view.$(".mailpoet_color").each(function(){var o=e.view.$(this),n=function(e){e&&e.getAlpha()>0?o.val(e.toString(t)):o.val(""),o.trigger("change")};o.spectrum({clickoutFiresChange:!0,showInput:!0,showInitial:!0,showPalette:!0,showSelectionPalette:!0,palette:[],localStorageKey:"newsletter_editor.spectrum.palette",preferredFormat:t,allowEmpty:!0,chooseText:(0,i._x)("Select","select color","mailpoet"),cancelText:(0,i._x)("Cancel","cancel color selection","mailpoet"),change:n,move:n,hide:n})})}});var Q=o(20436),ee=o.n(Q);J.ContainerDropZoneBehavior=v().Behavior.extend({defaults:{columnLimit:3},onRender:function(){c.default.isObject(this.view.options.renderOptions)&&!0===this.view.options.renderOptions.disableDragAndDrop||this.addDropZone()},addDropZone:function(){var e,t=this,o=this.view,n=t.$el.get(0);if(0===this.view.renderOptions.depth)e=".mailpoet_droppable_block.mailpoet_droppable_layout_block";else{if(2!==this.view.renderOptions.depth)return;e=".mailpoet_droppable_block:not(.mailpoet_droppable_layout_block)"}ee()(n).dropzone({accept:e,overlap:"pointer",ondragenter:function(){o.$el.addClass("mailpoet_drop_active")},ondragleave:function(){t.cleanup()},ondropmove:function(e){var n,r,i,s,a,l,c,d=t.getDropPosition(e.dragmove.pageX,e.dragmove.pageY,o.$el,o.model.get("orientation"),o.model.get("blocks").length),u=o.$el,h="",m="",p=u.offset(),g=t.getCollection();void 0!==d&&(u.find(".mailpoet_drop_marker").remove(),g.isEmpty()||(0===g.length?(s=(i=u.find(o.childViewContainer)).offset().top-u.offset().top,a=i.offset().left-u.offset().left,h=i.width(),m=i.height()):(r=t.getCollection().length===d.index?g.at(d.index-1):g.at(d.index),s=(i=t.getChildren().findByModel(r).$el).offset().top-p.top,a=i.offset().left-p.left,"normal"===d.insertionType?("after"===d.position&&("vertical"===o.model.get("orientation")?s+=i.outerHeight(!0):a+=i.outerWidth()),"vertical"===o.model.get("orientation")?h=i.outerWidth():m=i.outerHeight()):("after"===d.position&&("vertical"===o.model.get("orientation")?a+=i.outerWidth():s+=i.outerHeight()),"vertical"===o.model.get("orientation")?m=i.outerHeight(!0):h=i.outerWidth(!0))),n=x()('<div class="mailpoet_drop_marker"></div>'),0===d.index&&n.addClass("mailpoet_drop_marker_first"),g.length-1===d.index&&n.addClass("mailpoet_drop_marker_last"),d.index>0&&g.length-1>d.index&&n.addClass("mailpoet_drop_marker_middle"),n.addClass("mailpoet_drop_marker_"+d.position),c=(l="before"===d.position?t.getChildren().findByModel(g.at(d.index-1)).$el:t.getChildren().findByModel(g.at(d.index)).$el).outerHeight(!0)-l.outerHeight(),n.css("top",s-c/2),n.css("left",a),n.css("width",h),n.css("height",m),u.append(n)))},ondrop:function(e){var n,r,i,s,a,l=t.getDropPosition(e.dragEvent.pageX,e.dragEvent.pageY,o.$el,o.model.get("orientation"),o.model.get("blocks").length),c=e.draggable.getDropModel(),d=t.getCollection();void 0!==l&&("normal"===l.insertionType?(r="after"===l.position?l.index+1:l.index,"horizontal"===o.model.get("orientation")&&"container"!==c.get("type")?((i=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),d.add(i,{at:r})):d.add(c,{at:r}),n=t.getChildren().findByModel(c)):(a=d.at(l.index),i=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"===o.model.get("orientation")?"horizontal":"vertical"}),d.remove(a),"horizontal"===i.get("orientation")?("before"===l.position&&((s=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),i.get("blocks").add(s)),(s=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(a),i.get("blocks").add(s),"after"===l.position&&((s=new(window.EditorApplication.getBlockTypeModel("container"))({orientation:"vertical"})).get("blocks").add(c),i.get("blocks").add(s))):("before"===l.position&&i.get("blocks").add(c),i.get("blocks").add(a),"after"===l.position&&i.get("blocks").add(c)),d.add(i,{at:l.index}),n=t.getChildren().findByModel(i).children.findByModel(c)),e.draggable.onDrop({dropBehavior:t,droppedModel:c,droppedView:n}),t.cleanup())}})},cleanup:function(){this.view.$el.removeClass("mailpoet_drop_active"),this.view.$(".mailpoet_drop_marker").remove()},getDropPosition:function(e,t,o){var n,r,i,s,a,l,c=0,d=this.view.$el,u=this.view.model.get("orientation"),h=d.offset(),m=h.left,p=h.top,g=d.outerWidth(!0),f=d.outerHeight(!0),v=e-m,b=t-p,y=this._canAcceptNormalInsertion(),w=this._canAcceptSpecialInsertion(),_=!!o;return 0===this.getCollection().length?{insertionType:"normal",index:0,position:"inside"}:("vertical"===u?(n=v,r=g):(n=b,r=f),w&&!y&&(c=.5),n<=r*c&&(_||w)?(i="special",a="before",s=this._computeSpecialIndex(e,t)):n>r*(1-c)&&(_||w)?(i="special",a="after",s=this._computeSpecialIndex(e,t)):(i="normal",a=(l=this._computeNormalIndex(e,t)).position,s=l.index),_||"vertical"!==u||"special"!==i||"horizontal"!==this.getCollection().at(s).get("orientation")||(i="normal",a=(l=this._computeNormalIndex(e,t)).position,s=l.index),"horizontal"!==u||"special"!==i?{insertionType:i,index:s,position:a}:void 0)},_computeNormalIndex:function(e,t){var o,n,r,i=this._computeCellIndex(e,t),s=this.getChildren().findByModel(this.getCollection().at(i)),a=this.view.model.get("orientation"),l=s.$el;return"vertical"===a?(o=t,n=l.offset().top,r=l.outerHeight(!0)):(o=e,n=l.offset().left,r=l.outerWidth(!0)),o<=n+r/2?{index:i,position:"before"}:{index:i,position:"after"}},_computeSpecialIndex:function(e,t){return this._computeCellIndex(e,t)},_computeCellIndex:function(e,t){var o=this.view.model.get("orientation"),n="vertical"===o?t:e,r=this.getChildren().find(function(e){var t,r,i=e.$el;return"vertical"===o?(t=i.offset().top,r=i.outerHeight(!0)):(t=i.offset().left,r=i.outerWidth(!0)),r+=t,t<=n&&n<=r});return"object"==typeof r?r._index:0},_canAcceptNormalInsertion:function(){var e=this.view.model.get("orientation"),t=this.view.renderOptions.depth,o=this.getChildren().length;return"vertical"===e||"horizontal"===e&&1===t&&o<this.options.columnLimit},_canAcceptSpecialInsertion:function(){var e=this.view.model.get("orientation"),t=this.view.renderOptions.depth,o=this.getChildren().length;return 0===t||1===t&&"horizontal"===e&&o<=this.options.columnLimit},getCollectionView:function(){return this.view.getChildView("blocks")},getChildren:function(){return this.getCollectionView().children},getCollection:function(){return this.getCollectionView().collection}}),J.DraggableBehavior=v().Behavior.extend({defaults:{cloneOriginal:!1,hideOriginal:!1,ignoreSelector:".mailpoet_ignore_drag, .mailpoet_ignore_drag *",onDragSubstituteBy:void 0,getDropModel:function(){throw new Error("Missing 'drop' function for DraggableBehavior")},onDrop:function(){},testAttachToInstance:function(){return!0}},onRender:function(){var e,t=this;this.options.testAttachToInstance(this.view.model,this.view)&&(e=ee()(this.$el.get(0),{ignoreFrom:this.options.ignoreSelector}).draggable({max:1/0,autoScroll:!0,onstart:function(e){var o,n,r,i,s,a=e;!0===t.options.cloneOriginal&&(c.default.isFunction(t.options.onDragSubstituteBy)&&(r=t.options.onDragSubstituteBy(t)),i=r||a.target.cloneNode(!0),x()(a.target),(s=x()(i)).addClass("mailpoet_droppable_active"),s.css("position","absolute"),s.css("top",0),s.css("left",0),document.body.appendChild(i),o=s.width()/2,n=s.height()/2,s.css("top",a.pageY-n),s.css("left",a.pageX-o),a.interaction.element=i,!0===t.options.hideOriginal&&t.view.$el.addClass("mailpoet_hidden"),C.getChannel().trigger("dragStart"),document.activeElement.blur())},onmove:function(e){var t=e.target,o=(parseFloat(t.getAttribute("data-x"))||0)+e.dx,n=(parseFloat(t.getAttribute("data-y"))||0)+e.dy;t.style.transform="translate("+o+"px, "+n+"px)",t.style.webkitTransform=t.style.transform,t.setAttribute("data-x",o),t.setAttribute("data-y",n)},onend:function(e){var o=e.target;o.style.transform="",o.style.webkitTransform=o.style.transform,o.removeAttribute("data-x"),o.removeAttribute("data-y"),x()(e.interaction.element).addClass("mailpoet_droppable_active"),!0===t.options.cloneOriginal&&(x()(o).remove(),!0===t.options.hideOriginal&&t.view.$el.removeClass("mailpoet_hidden"))}}).preventDefault("auto").styleCursor(!1).actionChecker(function(e,t,o){return 0!==t.button?null:o}),void 0!==this.options.drop?e.getDropModel=this.options.drop:e.getDropModel=this.view.getDropFunc(),e.onDrop=function(e){var o=e;c.default.isObject(o)&&(o.dragBehavior=t),t.options.onDrop.apply(t,[o])})}}),J.HighlightEditingBehavior=v().Behavior.extend({modelEvents:{startEditing:"onStartEditing",stopEditing:"onStopEditing",startResizing:"onStartResizing",stopResizing:"onStopResizing"},events:{mouseenter:"onMouseEnter",mouseleave:"onMouseLeave"},onMouseEnter:function(e){this.isFocusedByPointer=!0,e&&e.buttons>0||C.getDisplayedSettingsId()||this.view.addHighlight()},onMouseLeave:function(){this.isFocusedByPointer=!1,this.isBeingEdited||this.view.removeHighlight()},onStartEditing:function(){this.isBeingEdited=!0,this.view.addHighlight()},onStopEditing:function(){this.isBeingEdited=!1,this.isFocusedByPointer||this.view.removeHighlight()},onStartResizing:function(){this.onStartEditing(),this.view.triggerMethod("resizeStart")},onStopResizing:function(e){this.isFocusedByPointer=V(e,this.view.$el),C.getDisplayedSettingsId()||this.onStopEditing(),this.view.triggerMethod("resizeStop",e)},onDomRefresh:function(){this.isBeingEdited&&this.view.addHighlight()},onChildviewResizeStart:function(){this.onStartEditing(),this.view.triggerMethod("resizeStart")},onChildviewResizeStop:function(e){this.isFocusedByPointer=V(e,this.view.$el),this.onStopEditing(),this.view.triggerMethod("resizeStop",e)}}),J.MediaManagerBehavior=v().Behavior.extend({ui:{"select-image":".mailpoet_field_image_select_image","address-input":".mailpoet_field_image_address"},events:{"click @ui.select-image":"showMediaManager","input @ui.address-input":"changeAddress"},initialize:function(){this.view.options.showImageManager&&this.showMediaManager()},changeAddress:c.default.debounce(function(e){var t=x()(e.target).val(),o=new Image;t||!this.options.onSelect?(o.onload=function(){this.options.onSelect&&this.view[this.options.onSelect]({src:t,width:o.naturalWidth+"px",height:o.naturalHeight+"px"})}.bind(this),o.src=t):this.view[this.options.onSelect]({src:null,width:null,height:null})},500),showMediaManager:function(){var e,t,o=this;if(this._mediaManager)return this._mediaManager.resetSelections(),void this._mediaManager.open();e=window.wp.media.view.MediaFrame.Select.extend({initialize:function(){window.wp.media.view.MediaFrame.prototype.initialize.apply(this,arguments),c.default.defaults(this.options,{multiple:!0,editing:!1,state:"insert"}),this.createSelection(),this.createStates(),this.bindHandlers(),this.createIframeStates(),this.$el.addClass("hide-title")},resetSelections:function(){this.state().get("selection").reset()},createQuery:function(e){return window.wp.media.query(e)},createStates:function(){var e=this.options;this.states.add([new window.wp.media.controller.Library({id:"insert",title:"Add images",priority:20,toolbar:"main-insert",filterable:"image",library:this.createQuery(e.library),multiple:!!e.multiple&&"reset",editable:!1,allowLocalEdits:!1,displaySettings:!1,displayUserSettings:!1})]),window.wp.media.view.settings.post.featuredImageId&&this.states.add(new window.wp.media.controller.FeaturedImage)},bindHandlers:function(){var e;this.on("router:create:browse",this.createRouter,this),this.on("router:render:browse",this.browseRouter,this),this.on("content:create:browse",this.browseContent,this),this.on("content:render:upload",this.uploadContent,this),this.on("toolbar:create:select",this.createSelectToolbar,this),this.on("menu:create:gallery",this.createMenu,this),this.on("toolbar:create:main-insert",this.createToolbar,this),this.on("toolbar:create:main-gallery",this.createToolbar,this),this.on("toolbar:create:main-embed",this.mainEmbedToolbar,this),this.on("updateExcluded",this.browseContent,this),e={content:{embed:"embedContent","edit-selection":"editSelectionContent"},toolbar:{"main-insert":"mainInsertToolbar"}},c.default.each(e,function(e,t){c.default.each(e,function(e,o){this.on(t+":render:"+o,this[e],this)},this)},this)},uploadContent:function(){window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this,arguments),this.$el.addClass("hide-toolbar")},embedContent:function(){var e=new window.wp.media.view.Embed({controller:this,model:this.state()}).render();this.content.set(e),e.url.focus()},editSelectionContent:function(){var e,t=this.state(),o=t.get("selection");(e=new window.wp.media.view.AttachmentsBrowser({controller:this,collection:o,selection:o,model:t,sortable:!0,search:!1,dragInfo:!0,AttachmentView:window.wp.media.view.Attachment.EditSelection}).render()).toolbar.set("backToLibrary",{text:"Return to library",priority:-100,click:function(){this.controller.content.mode("browse")}}),this.content.set(e)},selectionStatusToolbar:function(e){var t=this.state().get("editable");e.set("selection",new window.wp.media.view.Selection({controller:this,collection:this.state().get("selection"),priority:-40,editable:t&&function(){this.controller.content.mode("edit-selection")}}).render())},mainInsertToolbar:function(e){var t=this;this.selectionStatusToolbar(e),e.set("insert",{style:"primary",priority:80,text:"Select Image",requires:{selection:!0},click:function(){var e=t.state(),o=e.get("selection");t.close(),e.trigger("insert",o).reset()}})},mainEmbedToolbar:function(e){e.view=new window.wp.media.view.Toolbar.Embed({controller:this,text:"Add images"})}}),t=new e({id:"mailpoet-media-manager",frame:"select",title:"Select image",editing:!1,multiple:!1,library:{type:"image"},displaySettings:!1,button:{text:"Select"}}),this._mediaManager=t,this._mediaManager.on("insert",function(){t.state().get("selection").each(function(e){var t=e.get("sizes"),n=c.default.sortBy(c.default.keys(t),function(e){return Math.abs(1320-t[e].width)}),r=t[c.default.first(n)].width,i=c.default.filter(c.default.values(t),function(e){return e.width===r}),s=c.default.max(i,function(e){return e.height});o.options.onSelect&&o.view[o.options.onSelect]({height:s.height+"px",width:s.width+"px",src:s.url,alt:void 0!==e.get("alt")?e.get("alt"):""})})}),this._mediaManager.open()},onBeforeDestroy:function(){"object"==typeof this._mediaManager&&this._mediaManager.remove()}}),J.ResizableBehavior=v().Behavior.extend({defaults:{elementSelector:null,resizeHandleSelector:!0,transformationFunction:function(e){return e},minLength:0,maxLength:1/0,modelField:"styles.block.height",onResize:function(e){var t=parseFloat(this.view.model.get(this.options.modelField))+this.options.transformationFunction(e.dy);t=Math.min(this.options.maxLength,Math.max(this.options.minLength,t)),this.view.model.set(this.options.modelField,t+"px")}},onRender:function(){this.attachResize(),this.view.$el.addClass("mailpoet_resizable_block")},attachResize:function(){var e,t=this;e=null===this.options.elementSelector?this.view.$el.get(0):this.view.$(this.options.elementSelector).get(0),ee()(e).resizable({edges:{top:!1,left:!1,right:!1,bottom:"string"==typeof this.options.resizeHandleSelector?this.view.$(this.options.resizeHandleSelector).get(0):this.options.resizeHandleSelector}}).on("resizestart",function(){t.view.model.trigger("startResizing"),document.activeElement.blur()}).on("resizemove",function(e){return t.options.onResize.bind(t)(e)}).on("resizeend",function(e){t.view.model.trigger("stopResizing",e),t.$el.removeClass("mailpoet_resize_active")})}}),J.SortableBehavior=v().Behavior.extend({onRender:function(){var e=this.view.collection;c.default.isFunction(this.$el.sortable)&&this.$el.sortable({cursor:"move",start:function(e,t){t.item.data("previousIndex",t.item.index())},end:function(e,t){t.item.removeData("previousIndex")},update:function(t,o){var n=o.item.data("previousIndex"),r=o.item.index(),i=e.at(n);e.remove(i),e.add(i,{at:r})},items:this.options.items})}}),J.ShowSettingsBehavior=v().Behavior.extend({defaults:{ignoreFrom:""},events:{"click .mailpoet_content":"showSettings"},showSettings:function(e){this.isIgnoredElement(e.target)||this.view.triggerMethod("showSettings")},isIgnoredElement:function(e){return this.options.ignoreFrom&&this.options.ignoreFrom.length>0&&x()(e).is(this.options.ignoreFrom)}});var te=o(78774),oe=o.n(te);function ne(e){e.options.register("mailpoet_shortcodes",{processor:"object",default:{}}),e.options.register("mailpoet_shortcodes_window_title",{processor:"string",default:""}),e.ui.registry.addIcon("mailpoet",'<svg viewBox="0 0 152.02 156.4" width="20" height="20"><path d="M37.71,89.1c3.5,0,5.9-.8,7.2-2.3a8,8,0,0,0,2-5.4V35.7l17,45.1a12.68,12.68,0,0,0,3.7,5.4c1.6,1.3,4,2,7.2,2a12.54,12.54,0,0,0,5.9-1.4,8.41,8.41,0,0,0,3.9-5l18.1-50V81a8.53,8.53,0,0,0,2.1,6.1c1.4,1.4,3.7,2.2,6.9,2.2,3.5,0,5.9-.8,7.2-2.3a8,8,0,0,0,2-5.4V8.7a7.48,7.48,0,0,0-3.3-6.6c-2.1-1.4-5-2.1-8.6-2.1a19.3,19.3,0,0,0-9.4,2,11.63,11.63,0,0,0-5.1,6.8L74.91,67.1,54.41,8.4a12.4,12.4,0,0,0-4.5-6.2c-2.1-1.5-5-2.2-8.8-2.2a16.51,16.51,0,0,0-8.9,2.1c-2.3,1.5-3.5,3.9-3.5,7.2V80.8c0,2.8.7,4.8,2,6.2C32.21,88.4,34.41,89.1,37.71,89.1Z"/><path d="M149,116.6l-2.4-1.9a7.4,7.4,0,0,0-9.4.3,19.65,19.65,0,0,1-12.5,4.6h-21.4A37.08,37.08,0,0,0,77,130.5l-1.1,1.2-1.1-1.1a37.25,37.25,0,0,0-26.3-10.9H27a19.59,19.59,0,0,1-12.4-4.6,7.28,7.28,0,0,0-9.4-.3l-2.4,1.9A7.43,7.43,0,0,0,0,122.2a7.14,7.14,0,0,0,2.4,5.7A37.28,37.28,0,0,0,27,137.4h21.6a19.59,19.59,0,0,1,18.9,14.4v.2c.1.7,1.2,4.4,8.5,4.4s8.4-3.7,8.5-4.4v-.2a19.59,19.59,0,0,1,18.9-14.4H125a37.28,37.28,0,0,0,24.6-9.5,7.42,7.42,0,0,0,2.4-5.7A7.86,7.86,0,0,0,149,116.6Z"/></svg>'),e.ui.registry.addButton("mailpoet_shortcodes",{icon:"mailpoet",onAction:function(){var t,o=[],n=e.options.get("mailpoet_shortcodes");Object.keys(n).forEach(function(e){var r;if(Object.prototype.hasOwnProperty.call(n,e)){for(r={name:e,title:e,items:[]},t=0;t<n[e].length;t+=1)r.items.push({type:"button",text:n[e][t].text,name:n[e][t].shortcode});o.push(r)}}),e.windowManager.open({title:e.options.get("mailpoet_shortcodes_window_title"),body:{type:"tabpanel",tabs:o},buttons:[{type:"cancel",text:(0,i.__)("Close","mailpoet"),primary:!0}],onAction:function(t,o){e.insertContent(o.name),e.windowManager.close()}})}})}o(45710),o(66136),o(79589),o(53646),o(37905),oe().IconManager.add("default",{icons:{"accessibility-check":'<svg width="24" height="24"><path d="M12 2a2 2 0 0 1 2 2 2 2 0 0 1-2 2 2 2 0 0 1-2-2c0-1.1.9-2 2-2Zm8 7h-5v12c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-5c0-.6-.4-1-1-1a1 1 0 0 0-1 1v5c0 .6-.4 1-1 1a1 1 0 0 1-1-1V9H4a1 1 0 1 1 0-2h16c.6 0 1 .4 1 1s-.4 1-1 1Z" fill-rule="nonzero"/></svg>',"accordion-toggle":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M12 15c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1h-6a1 1 0 0 1-1-1Z"/><path opacity=".2" fill-rule="evenodd" clip-rule="evenodd" d="M4 15c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1-1-1Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12 19c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1h-6a1 1 0 0 1-1-1Z"/><path opacity=".2" fill-rule="evenodd" clip-rule="evenodd" d="M4 19c0-.6.4-1 1-1h6c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1-1-1Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12.3 7.3a1 1 0 0 1 1.4 0L16 9.6l2.3-2.3a1 1 0 1 1 1.4 1.4L16 12.4l-3.7-3.7a1 1 0 0 1 0-1.4ZM4.3 11.7a1 1 0 0 1 0-1.4L6.6 8 4.3 5.7a1 1 0 0 1 1.4-1.4L9.4 8l-3.7 3.7a1 1 0 0 1-1.4 0Z"/></svg>',accordion:'<svg width="24" height="24"><rect x="12" y="7" width="10" height="2" rx="1"/><rect x="12" y="11" width="10" height="2" rx="1"/><rect x="12" y="15" width="6" height="2" rx="1"/><path fill-rule="evenodd" clip-rule="evenodd" d="M2.3 7.3a1 1 0 0 1 1.4 0L6 9.6l2.3-2.3a1 1 0 0 1 1.4 1.4L6 12.4 2.3 8.7a1 1 0 0 1 0-1.4Z"/></svg>',"action-next":'<svg width="24" height="24"><path fill-rule="nonzero" d="M5.7 7.3a1 1 0 0 0-1.4 1.4l7.7 7.7 7.7-7.7a1 1 0 1 0-1.4-1.4L12 13.6 5.7 7.3Z"/></svg>',"action-prev":'<svg width="24" height="24"><path fill-rule="nonzero" d="M18.3 15.7a1 1 0 0 0 1.4-1.4L12 6.6l-7.7 7.7a1 1 0 0 0 1.4 1.4L12 9.4l6.3 6.3Z"/></svg>',addtag:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M15 5a2 2 0 0 1 1.6.8L21 12l-4.4 6.2a2 2 0 0 1-1.6.8h-3v-2h3l3.5-5L15 7H5v3H3V7c0-1.1.9-2 2-2h10Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M6 12a1 1 0 0 0-1 1v2H3a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2H7v-2c0-.6-.4-1-1-1Z"/></svg>',"ai-prompt":'<svg width="24" height="24"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M15 6.7a1 1 0 0 0-1.4 0l-9.9 10a1 1 0 0 0 0 1.3l2.1 2.1c.4.4 1 .4 1.4 0l10-9.9c.3-.3.3-1 0-1.4l-2.2-2Zm1.4 2.8-2-2-3 2.7 2.2 2.2 2.8-2.9Z"/><path d="m18.5 7.3-.7-1.5-1.5-.8 1.5-.7.7-1.5.7 1.5 1.5.7-1.5.8-.7 1.5ZM18.5 16.5l-.7-1.6-1.5-.7 1.5-.7.7-1.6.7 1.6 1.5.7-1.5.7-.7 1.6ZM9.7 7.3 9 5.8 7.5 5 9 4.3l.7-1.5.7 1.5L12 5l-1.5.8-.7 1.5Z"/></g><defs><clipPath id="a"><path d="M0 0h24v24H0z"/></clipPath></defs></svg>',ai:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M5 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3h14a3 3 0 0 0 3-3V6a3 3 0 0 0-3-3H5Zm6.8 11.5.5 1.2a68.3 68.3 0 0 0 .7 1.1l.4.1c.3 0 .5 0 .7-.3.2-.1.3-.3.3-.6l-.3-1-2.6-6.2a20.4 20.4 0 0 0-.5-1.3l-.5-.4-.7-.2c-.2 0-.5 0-.6.2-.2 0-.4.2-.5.4l-.3.6-.3.7L5.7 15l-.2.6-.1.4c0 .3 0 .5.3.7l.6.2c.3 0 .5 0 .7-.2l.4-1 .5-1.2h3.9ZM9.8 9l1.5 4h-3l1.5-4Zm5.6-.9v7.6c0 .4 0 .7.2 1l.7.2c.3 0 .6 0 .8-.3l.2-.9V8.1c0-.4 0-.7-.2-.9a1 1 0 0 0-.8-.3c-.2 0-.5.1-.7.3l-.2 1Z"/></svg>',"align-center":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm3 4h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 1 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Zm-3-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"align-justify":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Zm0 4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"align-left":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 4h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Zm0-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"align-none":'<svg width="24" height="24"><path d="M14.2 5 13 7H5a1 1 0 1 1 0-2h9.2Zm4 0h.8a1 1 0 0 1 0 2h-2l1.2-2Zm-6.4 4-1.2 2H5a1 1 0 0 1 0-2h6.8Zm4 0H19a1 1 0 0 1 0 2h-4.4l1.2-2Zm-6.4 4-1.2 2H5a1 1 0 0 1 0-2h4.4Zm4 0H19a1 1 0 0 1 0 2h-6.8l1.2-2ZM7 17l-1.2 2H5a1 1 0 0 1 0-2h2Zm4 0h8a1 1 0 0 1 0 2H9.8l1.2-2Zm5.2-13.5 1.3.7-9.7 16.3-1.3-.7 9.7-16.3Z" fill-rule="evenodd"/></svg>',"align-right":'<svg width="24" height="24"><path d="M5 5h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2Zm6 4h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 8h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm-6-4h14c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',"arrow-left":'<svg width="24" height="24"><path d="m5.6 13 12 6a1 1 0 0 0 1.4-1V6a1 1 0 0 0-1.4-.9l-12 6a1 1 0 0 0 0 1.8Z" fill-rule="evenodd"/></svg>',"arrow-right":'<svg width="24" height="24"><path d="m18.5 13-12 6A1 1 0 0 1 5 18V6a1 1 0 0 1 1.4-.9l12 6a1 1 0 0 1 0 1.8Z" fill-rule="evenodd"/></svg>',bold:'<svg width="24" height="24"><path d="M7.8 19c-.3 0-.5 0-.6-.2l-.2-.5V5.7c0-.2 0-.4.2-.5l.6-.2h5c1.5 0 2.7.3 3.5 1 .7.6 1.1 1.4 1.1 2.5a3 3 0 0 1-.6 1.9c-.4.6-1 1-1.6 1.2.4.1.9.3 1.3.6s.8.7 1 1.2c.4.4.5 1 .5 1.6 0 1.3-.4 2.3-1.3 3-.8.7-2.1 1-3.8 1H7.8Zm5-8.3c.6 0 1.2-.1 1.6-.5.4-.3.6-.7.6-1.3 0-1.1-.8-1.7-2.3-1.7H9.3v3.5h3.4Zm.5 6c.7 0 1.3-.1 1.7-.4.4-.4.6-.9.6-1.5s-.2-1-.7-1.4c-.4-.3-1-.4-2-.4H9.4v3.8h4Z" fill-rule="evenodd"/></svg>',bookmark:'<svg width="24" height="24"><path d="M6 4v17l6-4 6 4V4c0-.6-.4-1-1-1H7a1 1 0 0 0-1 1Z" fill-rule="nonzero"/></svg>',"border-style":'<svg width="24" height="24"><g fill-rule="evenodd"><rect width="18" height="2" x="3" y="6" rx="1"/><rect width="2.8" height="2" x="3" y="16" rx="1"/><rect width="2.8" height="2" x="6.8" y="16" rx="1"/><rect width="2.8" height="2" x="10.6" y="16" rx="1"/><rect width="2.8" height="2" x="14.4" y="16" rx="1"/><rect width="2.8" height="2" x="18.2" y="16" rx="1"/><rect width="8" height="2" x="3" y="11" rx="1"/><rect width="8" height="2" x="13" y="11" rx="1"/></g></svg>',"border-width":'<svg width="24" height="24"><g fill-rule="evenodd"><rect width="18" height="5" x="3" y="5" rx="1"/><rect width="18" height="3.5" x="3" y="11.5" rx="1"/><rect width="18" height="2" x="3" y="17" rx="1"/></g></svg>',brightness:'<svg width="24" height="24"><path d="M12.7 18.3a1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7v1a1 1 0 0 0 .3.7 1 1 0 0 0 .7.3 1 1 0 0 0 .7-.3 1 1 0 0 0 .3-.7v-1a1 1 0 0 0-.3-.7ZM11.3 5.7a1 1 0 0 0 .7.3 1 1 0 0 0 .7-.3A1 1 0 0 0 13 5V4a1 1 0 0 0-.3-.7A1 1 0 0 0 12 3a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7v1a1 1 0 0 0 .3.7Zm9.4 5.6a1 1 0 0 0-.7-.3h-1a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7 1 1 0 0 0 .3.7 1 1 0 0 0 .7.3h1a1 1 0 0 0 .7-.3 1 1 0 0 0 .3-.7 1 1 0 0 0-.3-.7Zm-15 1.4A1 1 0 0 0 6 12a1 1 0 0 0-.3-.7A1 1 0 0 0 5 11H4a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7 1 1 0 0 0 .3.7 1 1 0 0 0 .7.3h1a1 1 0 0 0 .7-.3Zm13 4.6-.7-.8a1 1 0 0 0-.8-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7 1 1 0 0 0 .3.8l.7.7a1 1 0 0 0 .7.3 1 1 0 0 0 .8-.3 1 1 0 0 0 .3-.8 1 1 0 0 0-.3-.7ZM5.3 6.7l.7.8a1 1 0 0 0 .8.3 1 1 0 0 0 .7-.3 1 1 0 0 0 .3-.7 1 1 0 0 0-.3-.8l-.7-.7A1 1 0 0 0 6 5a1 1 0 0 0-.8.3 1 1 0 0 0-.3.8 1 1 0 0 0 .3.6Zm12 1a1 1 0 0 0 .7-.2l.7-.7A1 1 0 0 0 19 6a1 1 0 0 0-.3-.8 1 1 0 0 0-.8-.3 1 1 0 0 0-.7.3l-.7.7a1 1 0 0 0-.3.8 1 1 0 0 0 .3.7 1 1 0 0 0 .7.2ZM6.7 16.4a1 1 0 0 0-.8.2l-.7.7a1 1 0 0 0-.3.7 1 1 0 0 0 .3.8 1 1 0 0 0 .8.3 1 1 0 0 0 .7-.3l.7-.7a1 1 0 0 0 .3-.8 1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3Z"/><path fill-rule="evenodd" d="M13.6 8.3A4 4 0 0 0 12 8a4 4 0 0 0-1.6.3A4 4 0 0 0 9 9.5a4 4 0 0 0-.6 1A4 4 0 0 0 8 12c0 .6.1 1 .3 1.6a4 4 0 0 0 2.1 2 4 4 0 0 0 1.6.4 4 4 0 0 0 1.6-.3 4 4 0 0 0 2-2.1A4 4 0 0 0 16 12a4 4 0 0 0-.3-1.6 4 4 0 0 0-2.1-2ZM14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0Z"/></svg>',browse:'<svg width="24" height="24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-4v-2h4V8H5v10h4v2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 9.4-2.3 2.3a1 1 0 1 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 0 1-1.4 1.4L13 13.4V20a1 1 0 0 1-2 0v-6.6Z" fill-rule="nonzero"/></svg>',cancel:'<svg width="24" height="24"><path d="M12 4.6a7.4 7.4 0 1 1 0 14.8 7.4 7.4 0 0 1 0-14.8ZM12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18Zm0 8L14.8 8l1 1.1-2.7 2.8 2.7 2.7-1.1 1.1-2.7-2.7-2.7 2.7-1-1.1 2.6-2.7-2.7-2.7 1-1.1 2.8 2.7Z" fill-rule="nonzero"/></svg>',"cell-background-color":'<svg width="24" height="24"><path d="m15.7 2 1.6 1.6-2.7 2.6 5.9 5.8c.7.7.7 1.7 0 2.4l-6.3 6.1a1.7 1.7 0 0 1-2.4 0l-6.3-6.1c-.7-.7-.7-1.7 0-2.4L15.7 2ZM18 12l-4.5-4L9 12h9ZM4 16s2 2.4 2 3.8C6 21 5.1 22 4 22s-2-1-2-2.2C2 18.4 4 16 4 16Z"/></svg>',"cell-border-color":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M5 13v5h2v2H5a2 2 0 0 1-2-2v-5h2zm8-7V4h6a2 2 0 0 1 2 2h-8z" opacity=".2"/><path fill-rule="nonzero" d="M13 4v2H5v7H3V6c0-1.1.9-2 2-2h8zm-2.6 14.1.1-.1.1.1.2.3.2.2.2.2c.4.6.8 1.2.8 1.7 0 .8-.7 1.5-1.5 1.5S9 21.3 9 20.5c0-.5.4-1.1.8-1.7l.2-.2.2-.2.2-.3z"/><path d="m13 11-2 2H5v-2h6V6h2z"/><path fill-rule="nonzero" d="m18.4 8 1 1-1.8 1.9 4 4c.5.4.5 1.1 0 1.6l-4.3 4.2a1.2 1.2 0 0 1-1.6 0l-4.4-4.2c-.4-.5-.4-1.2 0-1.7l7-6.8Zm1.6 7-3-3-3 3h6Z"/></g></svg>',"change-case":'<svg width="24" height="24"><path d="M18.4 18.2v-.6c-.5.8-1.3 1.2-2.4 1.2-2.2 0-3.3-1.6-3.3-4.8 0-3.1 1-4.7 3.3-4.7 1.1 0 1.8.3 2.4 1.1v-.6c0-.5.4-.8.8-.8s.8.3.8.8v8.4c0 .5-.4.8-.8.8a.8.8 0 0 1-.8-.8zm-2-7.4c-1.3 0-1.8.9-1.8 3.2 0 2.4.5 3.3 1.7 3.3 1.3 0 1.8-.9 1.8-3.2 0-2.4-.5-3.3-1.7-3.3zM10 15.7H5.5l-.8 2.6a1 1 0 0 1-1 .7h-.2a.7.7 0 0 1-.7-1l4-12a1 1 0 0 1 2 0l4 12a.7.7 0 0 1-.8 1h-.2a1 1 0 0 1-1-.7l-.8-2.6zm-.3-1.5-2-6.5-1.9 6.5h3.9z" fill-rule="evenodd"/></svg>',"character-count":'<svg width="24" height="24"><path d="M4 11.5h16v1H4v-1Zm4.8-6.8V10H7.7V5.8h-1v-1h2ZM11 8.3V9h2v1h-3V7.7l2-1v-.9h-2v-1h3v2.4l-2 1Zm6.3-3.4V10h-3.1V9h2.1V8h-2.1V6.8h2.1v-1h-2.1v-1h3.1ZM5.8 16.4c0-.5.2-.8.5-1 .2-.2.6-.3 1.2-.3l.8.1c.2 0 .4.2.5.3l.4.4v2.8l.2.3H8.2V18.7l-.6.3H7c-.4 0-.7 0-1-.2a1 1 0 0 1-.3-.9c0-.3 0-.6.3-.8.3-.2.7-.4 1.2-.4l.6-.2h.3v-.2l-.1-.2a.8.8 0 0 0-.5-.1 1 1 0 0 0-.4 0l-.3.4h-1Zm2.3.8h-.2l-.2.1-.4.1a1 1 0 0 0-.4.2l-.2.2.1.3.5.1h.4l.4-.4v-.6Zm2-3.4h1.2v1.7l.5-.3h.5c.5 0 .9.1 1.2.5.3.4.5.8.5 1.4 0 .6-.2 1.1-.5 1.5-.3.4-.7.6-1.3.6l-.6-.1-.4-.4v.4h-1.1v-5.4Zm1.1 3.3c0 .3 0 .6.2.8a.7.7 0 0 0 1.2 0l.2-.8c0-.4 0-.6-.2-.8a.7.7 0 0 0-.6-.3l-.6.3-.2.8Zm6.1-.5c0-.2 0-.3-.2-.4a.8.8 0 0 0-.5-.2c-.3 0-.5.1-.6.3l-.2.9c0 .3 0 .6.2.8.1.2.3.3.6.3.2 0 .4 0 .5-.2l.2-.4h1.1c0 .5-.3.8-.6 1.1a2 2 0 0 1-1.3.4c-.5 0-1-.2-1.3-.6a2 2 0 0 1-.5-1.4c0-.6.1-1.1.5-1.5.3-.4.8-.5 1.4-.5.5 0 1 0 1.2.3.4.3.5.7.5 1.2h-1v-.1Z" fill-rule="evenodd"/></svg>',"checklist-rtl":'<svg width="24" height="24"><path d="M5 17h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2zm14.2 11c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L18 8c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8z" fill-rule="evenodd"/></svg>',checklist:'<svg width="24" height="24"><path d="M11 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2h-8a1 1 0 0 1 0-2ZM7.2 16c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 20c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8Zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 14c-.2.3-.7.4-1 0l-1.3-1.3a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8Zm0-6c.2-.4.6-.5.9-.3.3.2.4.6.2 1L6 8c-.2.3-.7.4-1 0L3.8 6.9a.7.7 0 0 1 0-1c.3-.2.7-.2 1 0l.7.9 1.7-2.8Z" fill-rule="evenodd"/></svg>',checkmark:'<svg width="24" height="24"><path d="M18.2 5.4a1 1 0 0 1 1.6 1.2l-8 12a1 1 0 0 1-1.5.1l-5-5a1 1 0 1 1 1.4-1.4l4.1 4.1 7.4-11Z" fill-rule="nonzero"/></svg>',"chevron-down":'<svg width="10" height="10"><path d="M8.7 2.2c.3-.3.8-.3 1 0 .4.4.4.9 0 1.2L5.7 7.8c-.3.3-.9.3-1.2 0L.2 3.4a.8.8 0 0 1 0-1.2c.3-.3.8-.3 1.1 0L5 6l3.7-3.8Z" fill-rule="nonzero"/></svg>',"chevron-left":'<svg width="10" height="10"><path d="M7.8 1.3 4 5l3.8 3.7c.3.3.3.8 0 1-.4.4-.9.4-1.2 0L2.2 5.7a.8.8 0 0 1 0-1.2L6.6.2C7 0 7.4 0 7.8.2c.3.3.3.8 0 1.1Z" fill-rule="nonzero"/></svg>',"chevron-right":'<svg width="10" height="10"><path d="M2.2 1.3a.8.8 0 0 1 0-1c.4-.4.9-.4 1.2 0l4.4 4.1c.3.4.3.9 0 1.2L3.4 9.8c-.3.3-.8.3-1.2 0a.8.8 0 0 1 0-1.1L6 5 2.2 1.3Z" fill-rule="nonzero"/></svg>',"chevron-up":'<svg width="10" height="10"><path d="M8.7 7.8 5 4 1.3 7.8c-.3.3-.8.3-1 0a.8.8 0 0 1 0-1.2l4.1-4.4c.3-.3.9-.3 1.2 0l4.2 4.4c.3.3.3.9 0 1.2-.3.3-.8.3-1.1 0Z" fill-rule="nonzero"/></svg>',close:'<svg width="24" height="24"><path d="M17.3 8.2 13.4 12l3.9 3.8a1 1 0 0 1-1.5 1.5L12 13.4l-3.8 3.9a1 1 0 0 1-1.5-1.5l3.9-3.8-3.9-3.8a1 1 0 0 1 1.5-1.5l3.8 3.9 3.8-3.9a1 1 0 0 1 1.5 1.5Z" fill-rule="evenodd"/></svg>',"code-sample":'<svg width="24" height="26"><path d="M7.1 11a2.8 2.8 0 0 1-.8 2 2.8 2.8 0 0 1 .8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11Zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 0 1-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 0 1 .8-2 2.8 2.8 0 0 1-.8-2Zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2ZM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 0 1-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 0 1-.5-.5V17a3 3 0 0 0 1-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5Z" fill-rule="evenodd"/></svg>',"color-levels":'<svg width="24" height="24"><path d="M17.5 11.4A9 9 0 0 1 18 14c0 .5 0 1-.2 1.4 0 .4-.3.9-.5 1.3a6.2 6.2 0 0 1-3.7 3 5.7 5.7 0 0 1-3.2 0A5.9 5.9 0 0 1 7.6 18a6.2 6.2 0 0 1-1.4-2.6 6.7 6.7 0 0 1 0-2.8c0-.4.1-.9.3-1.3a13.6 13.6 0 0 1 2.3-4A20 20 0 0 1 12 4a26.4 26.4 0 0 1 3.2 3.4 18.2 18.2 0 0 1 2.3 4Zm-2 4.5c.4-.7.5-1.4.5-2a7.3 7.3 0 0 0-1-3.2c.2.6.2 1.2.2 1.9a4.5 4.5 0 0 1-1.3 3 5.3 5.3 0 0 1-2.3 1.5 4.9 4.9 0 0 1-2 .1 4.3 4.3 0 0 0 2.4.8 4 4 0 0 0 2-.6 4 4 0 0 0 1.5-1.5Z" fill-rule="evenodd"/></svg>',"color-picker":'<svg width="24" height="24"><path d="M12 3a9 9 0 0 0 0 18 1.5 1.5 0 0 0 1.1-2.5c-.2-.3-.4-.6-.4-1 0-.8.7-1.5 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Zm-5.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Zm3-4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Zm5 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Zm3 4a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3Z" fill-rule="nonzero"/></svg>',"color-swatch-remove-color":'<svg width="24" height="24" class="color-swatch-remove-color"><path stroke="#000" stroke-width="2" d="M21 3 3 21" fill-rule="evenodd"/></svg>',"color-swatch":'<svg width="24" height="24"><rect x="3" y="3" width="18" height="18" rx="1" fill-rule="evenodd"/></svg>',"comment-add":'<svg width="24" height="24"><g fill-rule="nonzero"><path d="m9 19 3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 0 0-1 1v10c0 .6.4 1 1 1h4v2Zm-2 4v-4H5a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-6.4L7 23Z"/><path d="M13 10h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 0v-2H9a1 1 0 0 1 0-2h2V8a1 1 0 0 1 2 0v2Z"/></g></svg>',comment:'<svg width="24" height="24"><path fill-rule="nonzero" d="m9 19 3-2h7c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H5a1 1 0 0 0-1 1v10c0 .6.4 1 1 1h4v2Zm-2 4v-4H5a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-6.4L7 23Z"/></svg>',contrast:'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 4a7.8 7.8 0 0 1 5.7 2.3A8 8 0 0 1 19.4 9c.4 1 .6 2 .6 3.1s-.2 2.1-.6 3.1a8 8 0 0 1-1.7 2.6 8 8 0 0 1-2.6 1.7 7.8 7.8 0 0 1-3.1.6 7.8 7.8 0 0 1-3.1-.6 8 8 0 0 1-2.6-1.7A8 8 0 0 1 4.6 15 7.8 7.8 0 0 1 4 12c0-1.1.2-2.1.6-3.1a8 8 0 0 1 1.7-2.6A8 8 0 0 1 9 4.6 7.8 7.8 0 0 1 12 4Zm-6 8a6 6 0 0 0 1.8 4.2 6 6 0 0 0 1.9 1.3 5.8 5.8 0 0 0 2.3.5V6c-.8 0-1.6.2-2.3.5a6 6 0 0 0-2 1.3 6 6 0 0 0-1.2 1.9A5.8 5.8 0 0 0 6 12Z"/></svg>',copy:'<svg width="24" height="24"><path d="M16 3H6a2 2 0 0 0-2 2v11h2V5h10V3Zm1 4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V9c0-1.2.9-2 2-2h7Zm0 12V9h-7v10h7Z" fill-rule="nonzero"/></svg>',crop:'<svg width="24" height="24"><path d="M17 8v7h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v2c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-2H7V9H5a1 1 0 1 1 0-2h2V5c0-.6.4-1 1-1s1 .4 1 1v2h7l3-3 1 1-3 3ZM9 9v5l5-5H9Zm1 6h5v-5l-5 5Z" fill-rule="evenodd"/></svg>',"cut-column":'<svg width="24" height="24"><path fill-rule="evenodd" d="M7.2 4.5c.9 0 1.6.4 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7Zm12.3 5h-3v10h3v-10ZM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8Zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4ZM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8A2.5 2.5 0 0 0 7.7 6l-.4-.1H7Z"/></svg>',"cut-row":'<svg width="24" height="24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14ZM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18V18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5Zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3ZM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4Zm8.5-7.1h-11v2h11v-2Z"/></svg>',cut:'<svg width="24" height="24"><path d="M18 15c.6.7 1 1.4 1 2.3 0 .8-.2 1.5-.7 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2 0-.9.4-1.6 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l6 6 6-6 .5 1a3.3 3.3 0 0 1 0 2c0 .4-.3.7-.5 1l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8Zm-8.5 2.2.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2 1.6 1.6 0 0 0-.8 0 2.6 2.6 0 0 0-.8.3 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3 2.8 2.8 0 0 0 1-1Zm2.5-2.8c.4 0 .7-.1 1-.4.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4s-.7.1-1 .4c-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4Zm5.4 4 .2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3 1.5 1.5 0 0 0-.8 0 1 1 0 0 0-.4.2 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4l.3.4.3.4a2.8 2.8 0 0 0 .8.5l.4.1h.7l.5-.2Z" fill-rule="evenodd"/></svg>',"document-properties":'<svg width="24" height="24"><path d="M14.4 3H7a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h10a2 2 0 0 0 2-2V7.6L14.4 3ZM17 19H7V5h6v4h4v10Z" fill-rule="nonzero"/></svg>',drag:'<svg width="24" height="24"><path d="M13 5h2v2h-2V5Zm0 4h2v2h-2V9ZM9 9h2v2H9V9Zm4 4h2v2h-2v-2Zm-4 0h2v2H9v-2Zm0 4h2v2H9v-2Zm4 0h2v2h-2v-2ZM9 5h2v2H9V5Z" fill-rule="evenodd"/></svg>',"duplicate-column":'<svg width="24" height="24"><path d="M17 6v16h-7V6h7Zm-2 2h-3v12h3V8Zm-2-6v2H8v15H6V2h7Z"/></svg>',"duplicate-row":'<svg width="24" height="24"><path d="M22 11v7H6v-7h16Zm-2 2H8v3h12v-3Zm-1-6v2H4v5H2V7h17Z"/></svg>',duplicate:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M16 3v2H6v11H4V5c0-1.1.9-2 2-2h10Zm3 8h-2V9h-7v10h9a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2V9c0-1.2.9-2 2-2h7a2 2 0 0 1 2 2v2Z"/><path d="M17 14h1a1 1 0 0 1 0 2h-1v1a1 1 0 0 1-2 0v-1h-1a1 1 0 0 1 0-2h1v-1a1 1 0 0 1 2 0v1Z"/></g></svg>',"edit-block":'<svg width="24" height="24"><path fill-rule="nonzero" d="m19.8 8.8-9.4 9.4c-.2.2-.5.4-.9.4l-5.4 1.2 1.2-5.4.5-.8 9.4-9.4c.7-.7 1.8-.7 2.5 0l2.1 2.1c.7.7.7 1.8 0 2.5Zm-2-.2 1-.9v-.3l-2.2-2.2a.3.3 0 0 0-.3 0l-1 1L18 8.5Zm-1 1-2.5-2.4-6 6 2.5 2.5 6-6Zm-7 7.1-2.6-2.4-.3.3-.1.2-.7 3 3.1-.6h.1l.4-.5Z"/></svg>',"edit-image":'<svg width="24" height="24"><path d="M18 16h2V7a2 2 0 0 0-2-2H7v2h11v9ZM6 17h15a1 1 0 0 1 0 2h-1v1a1 1 0 0 1-2 0v-1H6a2 2 0 0 1-2-2V7H3a1 1 0 1 1 0-2h1V4a1 1 0 1 1 2 0v13Zm3-5.3 1.3 2 3-4.7 3.7 6H7l2-3.3Z" fill-rule="nonzero"/></svg>',"embed-page":'<svg width="24" height="24"><path d="M19 6V5H5v14h2A13 13 0 0 1 19 6Zm0 1.4c-.8.8-1.6 2.4-2.2 4.6H19V7.4Zm0 5.6h-2.4c-.4 1.8-.6 3.8-.6 6h3v-6Zm-4 6c0-2.2.2-4.2.6-6H13c-.7 1.8-1.1 3.8-1.1 6h3Zm-4 0c0-2.2.4-4.2 1-6H9.6A12 12 0 0 0 8 19h3ZM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm11.8 9c.4-1.9 1-3.4 1.8-4.5a9.2 9.2 0 0 0-4 4.5h2.2Zm-3.4 0a12 12 0 0 1 2.8-4 12 12 0 0 0-5 4h2.2Z" fill-rule="nonzero"/></svg>',embed:'<svg width="24" height="24"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm4.8 2.6 5.6 4a.5.5 0 0 1 0 .8l-5.6 4A.5.5 0 0 1 9 16V8a.5.5 0 0 1 .8-.4Z" fill-rule="nonzero"/></svg>',emoji:'<svg width="24" height="24"><path d="M9 11c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 0 0-1 1c0 .6.4 1 1 1Zm6 0c.6 0 1-.4 1-1s-.4-1-1-1a1 1 0 0 0-1 1c0 .6.4 1 1 1Zm-3 5.5c2.1 0 4-1.5 4.4-3.5H7.6c.5 2 2.3 3.5 4.4 3.5ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm0 14.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13Z" fill-rule="nonzero"/></svg>',export:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M14.4 3 18 7v1h-5V5H7v14h9a1 1 0 0 1 2 0c0 1-.8 2-1.9 2H7c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h7.5Z"/><path d="M18.1 12c.5 0 .9.4.9 1 0 .5-.3 1-.8 1h-7.3c-.5 0-.9-.4-.9-1 0-.5.3-1 .8-1h7.3Z"/><path d="M16.4 9.2a1 1 0 0 1 1.4.2l2.4 3.6-2.4 3.6a1 1 0 0 1-1.7-1v-.2l1.7-2.4-1.6-2.4a1 1 0 0 1 .2-1.4Z"/></g></svg>',fill:'<svg width="24" height="26"><path d="m16.6 12-9-9-1.4 1.4 2.4 2.4-5.2 5.1c-.5.6-.5 1.6 0 2.2L9 19.6a1.5 1.5 0 0 0 2.2 0l5.5-5.5c.5-.6.5-1.6 0-2.2ZM5.2 13 10 8.2l4.8 4.8H5.2ZM19 14.5s-2 2.2-2 3.5c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.3-2-3.5-2-3.5Z" fill-rule="nonzero"/></svg>',"flip-horizontally":'<svg width="24" height="24"><path d="M14 19h2v-2h-2v2Zm4-8h2V9h-2v2ZM4 7v10c0 1.1.9 2 2 2h3v-2H6V7h3V5H6a2 2 0 0 0-2 2Zm14-2v2h2a2 2 0 0 0-2-2Zm-7 16h2V3h-2v18Zm7-6h2v-2h-2v2Zm-4-8h2V5h-2v2Zm4 12a2 2 0 0 0 2-2h-2v2Z" fill-rule="nonzero"/></svg>',"flip-vertically":'<svg width="24" height="24"><path d="M5 14v2h2v-2H5Zm8 4v2h2v-2h-2Zm4-14H7a2 2 0 0 0-2 2v3h2V6h10v3h2V6a2 2 0 0 0-2-2Zm2 14h-2v2a2 2 0 0 0 2-2ZM3 11v2h18v-2H3Zm6 7v2h2v-2H9Zm8-4v2h2v-2h-2ZM5 18c0 1.1.9 2 2 2v-2H5Z" fill-rule="nonzero"/></svg>',footnote:'<svg width="24" height="24"><path d="M19 13c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2h14Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19 4v6h-1V5h-1.5V4h2.6Z"/><path d="M12 18c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 1 1 0-2h7ZM14 8c.6 0 1 .4 1 1s-.4 1-1 1H5a1 1 0 0 1 0-2h9Z"/></svg>',"format-code":'<svg width="24" height="24"><path d="m10 22 2-7H6l9-13h2l-2 8h7L12 22h-2ZM6 2h7l-1.4 2H6V2Zm4.2 4H4v2h4.8l1.4-2Zm-2.7 4H2v2h4l1.5-2Z"/></svg>',"format-painter":'<svg width="24" height="24"><path d="M18 5V4c0-.5-.4-1-1-1H5a1 1 0 0 0-1 1v4c0 .6.5 1 1 1h12c.6 0 1-.4 1-1V7h1v4H9v9c0 .6.4 1 1 1h2c.6 0 1-.4 1-1v-7h8V5h-3Z" fill-rule="nonzero"/></svg>',format:'<svg width="24" height="24"><path fill-rule="evenodd" d="M17 5a1 1 0 0 1 0 2h-4v11a1 1 0 0 1-2 0V7H7a1 1 0 1 1 0-2h10Z"/></svg>',fullscreen:'<svg width="24" height="24"><path d="m15.3 10-1.2-1.3 2.9-3h-2.3a.9.9 0 1 1 0-1.7H19c.5 0 .9.4.9.9v4.4a.9.9 0 1 1-1.8 0V7l-2.9 3Zm0 4 3 3v-2.3a.9.9 0 1 1 1.7 0V19c0 .5-.4.9-.9.9h-4.4a.9.9 0 1 1 0-1.8H17l-3-2.9 1.3-1.2ZM10 15.4l-2.9 3h2.3a.9.9 0 1 1 0 1.7H5a.9.9 0 0 1-.9-.9v-4.4a.9.9 0 1 1 1.8 0V17l2.9-3 1.2 1.3ZM8.7 10 5.7 7v2.3a.9.9 0 0 1-1.7 0V5c0-.5.4-.9.9-.9h4.4a.9.9 0 0 1 0 1.8H7l3 2.9-1.3 1.2Z" fill-rule="nonzero"/></svg>',gallery:'<svg width="24" height="24"><path fill-rule="nonzero" d="m5 15.7 2.3-2.2c.3-.3.7-.3 1 0L11 16l5.1-5c.3-.4.8-.4 1 0l2 1.9V8H5v7.7ZM5 18V19h3l1.8-1.9-2-2L5 17.9Zm14-3-2.5-2.4-6.4 6.5H19v-4ZM4 6h16c.6 0 1 .4 1 1v13c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V7c0-.6.4-1 1-1Zm6 7a2 2 0 1 1 0-4 2 2 0 0 1 0 4ZM4.5 4h15a.5.5 0 1 1 0 1h-15a.5.5 0 0 1 0-1Zm2-2h11a.5.5 0 1 1 0 1h-11a.5.5 0 0 1 0-1Z"/></svg>',gamma:'<svg height="24" width="24"><path d="M11.5 16.3a.7.7 0 1 0 1.4 0V14l2.7-6a.7.7 0 1 0-1.2-.6l-2.2 5-2.3-4.9C9.6 7 8.7 7 8 7.2v1.1c.8-.2.9 0 1.2 1l2.3 4.7z"/><path d="M4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm1 2h14v14H5z" fill-rule="evenodd"/></svg>',help:'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M12 5.5a6.5 6.5 0 0 0-6 9 6.3 6.3 0 0 0 1.4 2l1 1a6.3 6.3 0 0 0 3.6 1 6.5 6.5 0 0 0 6-9 6.3 6.3 0 0 0-1.4-2l-1-1a6.3 6.3 0 0 0-3.6-1ZM12 4a7.8 7.8 0 0 1 5.7 2.3A8 8 0 1 1 12 4Z"/><path d="M9.6 9.7a.7.7 0 0 1-.7-.8c0-1.1 1.5-1.8 3.2-1.8 1.8 0 3.2.8 3.2 2.4 0 1.4-.4 2.1-1.5 2.8-.2 0-.3.1-.3.2a2 2 0 0 0-.8.8.8.8 0 0 1-1.4-.6c.3-.7.8-1 1.3-1.5l.4-.2c.7-.4.8-.6.8-1.5 0-.5-.6-.9-1.7-.9-.5 0-1 .1-1.4.3-.2 0-.3.1-.3.2v-.2c0 .4-.4.8-.8.8Z" fill-rule="nonzero"/><circle cx="12" cy="16" r="1"/></g></svg>',"highlight-bg-color":'<svg width="24" height="24"><g fill-rule="evenodd"><path class="tox-icon-highlight-bg-color__color" d="M3 18h18v3H3z"/><path fill-rule="nonzero" d="M7.7 16.7H3l3.3-3.3-.7-.8L10.2 8l4 4.1-4 4.2c-.2.2-.6.2-.8 0l-.6-.7-1.1 1.1zm5-7.5L11 7.4l3-2.9a2 2 0 0 1 2.6 0L18 6c.7.7.7 2 0 2.7l-2.9 2.9-1.8-1.8-.5-.6"/></g></svg>',home:'<svg width="24" height="24"><path fill-rule="nonzero" d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/></svg>',"horizontal-rule":'<svg width="24" height="24"><path d="M4 11h16v2H4z" fill-rule="evenodd"/></svg>',"image-options":'<svg width="24" height="24"><path d="M6 10a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm12 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm-6 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Z" fill-rule="nonzero"/></svg>',image:'<svg width="24" height="24"><path d="m5 15.7 3.3-3.2c.3-.3.7-.3 1 0L12 15l4.1-4c.3-.4.8-.4 1 0l2 1.9V5H5v10.7ZM5 18V19h3l2.8-2.9-2-2L5 17.9Zm14-3-2.5-2.4-6.4 6.5H19v-4ZM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm6 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" fill-rule="nonzero"/></svg>',indent:'<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 1 1 0-2Zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm-5 4h12a1 1 0 0 1 0 2H7a1 1 0 0 1 0-2Zm-2.6-3.8L6.2 12l-1.8-1.2a1 1 0 0 1 1.2-1.6l3 2a1 1 0 0 1 0 1.6l-3 2a1 1 0 1 1-1.2-1.6Z" fill-rule="evenodd"/></svg>',info:'<svg width="24" height="24"><path d="M12 4a7.8 7.8 0 0 1 5.7 2.3A8 8 0 1 1 12 4Zm-1 3v2h2V7h-2Zm3 10v-1h-1v-5h-3v1h1v4h-1v1h4Z" fill-rule="evenodd"/></svg>',"insert-character":'<svg width="24" height="24"><path d="M15 18h4l1-2v4h-6v-3.3l1.4-1a6 6 0 0 0 1.8-2.9 6.3 6.3 0 0 0-.1-4.1 5.8 5.8 0 0 0-3-3.2c-.6-.3-1.3-.5-2.1-.5a5.1 5.1 0 0 0-3.9 1.8 6.3 6.3 0 0 0-1.3 6 6.2 6.2 0 0 0 1.8 3l1.4.9V20H4v-4l1 2h4v-.5l-2-1L5.4 15A6.5 6.5 0 0 1 4 11c0-1 .2-1.9.6-2.7A7 7 0 0 1 6.3 6C7.1 5.4 8 5 9 4.5c1-.3 2-.5 3.1-.5a8.8 8.8 0 0 1 5.7 2 7 7 0 0 1 1.7 2.3 6 6 0 0 1 .2 4.8c-.2.7-.6 1.3-1 1.9a7.6 7.6 0 0 1-3.6 2.5v.5Z" fill-rule="evenodd"/></svg>',"insert-time":'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M12 19a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm0 2a9 9 0 1 1 0-18 9 9 0 0 1 0 18Z"/><path d="M16 12h-3V7c0-.6-.4-1-1-1a1 1 0 0 0-1 1v7h5c.6 0 1-.4 1-1s-.4-1-1-1Z"/></g></svg>',invert:'<svg height="24" width="24"><path d="M5 4 3.6 5.4l3.9 4C6.6 10.7 6 12.3 6 14a6 6 0 0 0 10.3 4.2l1.9 1.8 1.4-1.4z" fill-rule="evenodd"/><path d="M13.4 8.4c.9 1 1.6 2.1 2 3.2l2.6 2.6V14c0-5-6-10-6-10s-1 .8-2.1 2l1.4 1.5.7-.7 1.4 1.6z"/></svg>',italic:'<svg width="24" height="24"><path d="m16.7 4.7-.1.9h-.3c-.6 0-1 0-1.4.3-.3.3-.4.6-.5 1.1l-2.1 9.8v.6c0 .5.4.8 1.4.8h.2l-.2.8H8l.2-.8h.2c1.1 0 1.8-.5 2-1.5l2-9.8.1-.5c0-.6-.4-.8-1.4-.8h-.3l.2-.9h5.8Z" fill-rule="evenodd"/></svg>',language:'<svg width="24" height="24"><path d="M12 3a9 9 0 1 1 0 18 9 9 0 0 1 0-18Zm4.3 13.3c-.5 1-1.2 2-2 2.9a7.5 7.5 0 0 0 3.2-2.1l-.2-.2a6 6 0 0 0-1-.6Zm-8.6 0c-.5.2-.9.5-1.2.8.9 1 2 1.7 3.2 2a10 10 0 0 1-2-2.8Zm3.6-.8c-.8 0-1.6.1-2.2.3.5 1 1.2 1.9 2.1 2.7Zm1.5 0v3c.9-.8 1.6-1.7 2.1-2.7-.6-.2-1.4-.3-2.1-.3Zm-6-2.7H4.5c.2 1 .5 2.1 1 3h.3l1.3-1a10 10 0 0 1-.3-2Zm12.7 0h-2.3c0 .7-.1 1.4-.3 2l1.6 1.1c.5-1 .9-2 1-3.1Zm-3.8 0h-3V14c1 0 2 .1 2.7.4.2-.5.3-1 .3-1.6Zm-4.4 0h-3l.3 1.6c.8-.3 1.7-.4 2.7-.4v-1.3Zm-5.5-5c-.7 1-1.1 2.2-1.3 3.5h2.3c0-1 .2-1.8.5-2.6l-1.5-1Zm2.9 1.4v.1c-.2.6-.4 1.3-.4 2h3V9.4c-1 0-1.8-.1-2.6-.3Zm6.6 0h-.1l-2.4.3v1.8h3l-.5-2.1Zm3-1.4-.3.1-1.3.8c.3.8.5 1.6.5 2.6h2.3a7.5 7.5 0 0 0-1.3-3.5Zm-9 0 2 .2V5.5a9 9 0 0 0-2 2.2Zm3.5-2.3V8c.6 0 1.3 0 1.9-.2a9 9 0 0 0-2-2.3Zm-3-.7h-.1c-1.1.4-2.1 1-3 1.8l1.2.7a10 10 0 0 1 1.9-2.5Zm4.4 0 .1.1a10 10 0 0 1 1.8 2.4l1.1-.7a7.5 7.5 0 0 0-3-1.8Z"/></svg>',"line-height":'<svg width="24" height="24"><path d="M21 5a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zm0 4a1 1 0 0 1 .1 2H13a1 1 0 0 1-.1-2H21zM7 3.6l3.7 3.7a1 1 0 0 1-1.3 1.5h-.1L8 7.3v9.2l1.3-1.3a1 1 0 0 1 1.3 0h.1c.4.4.4 1 0 1.3v.1L7 20.4l-3.7-3.7a1 1 0 0 1 1.3-1.5h.1L6 16.7V7.4L4.7 8.7a1 1 0 0 1-1.3 0h-.1a1 1 0 0 1 0-1.3v-.1L7 3.6z"/></svg>',line:'<svg width="24" height="24"><path d="m15 9-8 8H4v-3l8-8 3 3Zm1-1-3-3 1-1h1c-.2 0 0 0 0 0l2 2s0 .2 0 0v1l-1 1ZM4 18h16v2H4v-2Z" fill-rule="evenodd"/></svg>',link:'<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2-2a2 2 0 1 0-2.6-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2Z" fill-rule="nonzero"/></svg>',"list-bull-circle":'<svg height="48" width="48"><path d="M8 14a3 3 0 1 0 6 0 3 3 0 0 0-6 0zm5 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 24a3 3 0 1 0 6 0 3 3 0 0 0-6 0zm5 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0zM8 34a3 3 0 1 0 6 0 3 3 0 0 0-6 0zm5 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z" fill-rule="evenodd"/><path d="M18 12h22v4H18zm0 10h22v4H18zm0 10h22v4H18z" opacity=".2"/></svg>',"list-bull-default":'<svg height="48" width="48"><path d="M14 14a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/><path d="M12 24a3 3 0 1 0 6 0 3 3 0 0 0-6 0zm5 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0z" fill-rule="evenodd"/><path d="M16 31h6v6h-6z"/><path d="M16 31h6v6h-6z"/><path d="M18 12h22v4H18zm4 10h18v4H22zm4 10h14v4H26z" opacity=".2"/></svg>',"list-bull-disc":'<svg height="48" width="48"><path d="M14 14a3 3 0 1 1-6 0 3 3 0 0 1 6 0zm0 10a3 3 0 1 1-6 0 3 3 0 0 1 6 0zm0 10a3 3 0 1 1-6 0 3 3 0 0 1 6 0z"/><path d="M18 12h22v4H18zm0 10h22v4H18zm0 10h22v4H18z" opacity=".2"/></svg>',"list-bull-square":'<svg height="48" width="48"><path d="M8 21h6v6H8zm0 10h6v6H8zm0-20h6v6H8z"/><path d="M18 12h22v4H18zm0 10h22v4H18zm0 10h22v4H18z" opacity=".2"/></svg>',"list-num-default-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M37.4 17v-4.8h-.1l-1.5 1v-1.1l1.6-1.1h1.2v6zM33.3 17.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm1.7 5.7c0-1.2 1-2 2.2-2 1.3 0 2.1.8 2.1 1.8 0 .7-.3 1.2-1.3 2.2l-1.2 1v.2h2.6v1h-4.3v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H35zm-1.7 4.3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7zm3.2 7.3v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H35c0-1.1 1-1.8 2.2-1.8 1.2 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.7.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .6 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7zm-3.3 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7z"/></g></svg>',"list-num-default":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10 17v-4.8l-1.5 1v-1.1l1.6-1h1.2V17h-1.2Zm3.6.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7Zm-5 5.7c0-1.2.8-2 2.1-2s2.1.8 2.1 1.8c0 .7-.3 1.2-1.4 2.2l-1.1 1v.2h2.6v1H8.6v-.9l2-1.9c.8-.8 1-1.1 1-1.5 0-.5-.4-.8-1-.8-.5 0-.9.3-.9.9H8.5Zm6.3 4.3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7ZM10 34.4v-1h.7c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7s-1 .3-1 .8H8.6c0-1.1 1-1.8 2.2-1.8 1.3 0 2.1.6 2.1 1.6 0 .7-.4 1.2-1 1.3v.1c.8.1 1.3.7 1.3 1.4 0 1-1 1.9-2.4 1.9-1.3 0-2.2-.8-2.3-2h1.2c0 .6.5 1 1.1 1 .7 0 1-.4 1-1 0-.5-.3-.8-1-.8h-.7Zm4.7 2.7c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7Z"/></g></svg>',"list-num-lower-alpha-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M36.5 16c-.9 0-1.5-.5-1.5-1.3s.6-1.3 1.8-1.4h1v-.4c0-.4-.2-.6-.7-.6-.4 0-.7.1-.8.4h-1.1c0-.8.8-1.4 2-1.4S39 12 39 13V16h-1.2v-.6c-.3.4-.8.7-1.4.7Zm.4-.8c.6 0 1-.4 1-.9V14h-1c-.5.1-.7.3-.7.6 0 .4.3.6.7.6ZM33.1 16.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7ZM37.7 26c-.7 0-1.2-.2-1.5-.7v.7H35v-6.3h1.2v2.5c.3-.5.8-.9 1.5-.9 1.1 0 1.8 1 1.8 2.4 0 1.5-.7 2.4-1.8 2.4Zm-.5-3.6c-.6 0-1 .5-1 1.3s.4 1.4 1 1.4c.7 0 1-.6 1-1.4 0-.8-.3-1.3-1-1.3ZM33.2 26.1c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7zm6 7h-1c-.1-.5-.4-.8-1-.8s-1 .5-1 1.4c0 1 .4 1.4 1 1.4.5 0 .9-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7zm-6.1 3c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7z"/></g></svg>',"list-num-lower-alpha":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10.3 15.2c.5 0 1-.4 1-.9V14h-1c-.5.1-.8.3-.8.6 0 .4.3.6.8.6Zm-.4.9c-1 0-1.5-.6-1.5-1.4 0-.8.6-1.3 1.7-1.4h1.1v-.4c0-.4-.2-.6-.7-.6-.5 0-.8.1-.9.4h-1c0-.8.8-1.4 2-1.4 1.1 0 1.8.6 1.8 1.6V16h-1.1v-.6h-.1c-.2.4-.7.7-1.3.7Zm4.6 0c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm-3.2 10c-.6 0-1.2-.3-1.4-.8v.7H8.5v-6.3H10v2.5c.3-.5.8-.9 1.4-.9 1.2 0 1.9 1 1.9 2.4 0 1.5-.7 2.4-1.9 2.4Zm-.4-3.7c-.7 0-1 .5-1 1.3s.3 1.4 1 1.4c.6 0 1-.6 1-1.4 0-.8-.4-1.3-1-1.3Zm4 3.7c-.5 0-.7-.3-.7-.7 0-.4.2-.7.7-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm-2.2 7h-1.2c0-.5-.4-.8-.9-.8-.6 0-1 .5-1 1.4 0 1 .4 1.4 1 1.4.5 0 .8-.2 1-.7h1c0 1-.8 1.7-2 1.7-1.4 0-2.2-.9-2.2-2.4s.8-2.4 2.2-2.4c1.2 0 2 .7 2 1.7Zm1.8 3c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-lower-greek-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M37.4 16c-1.2 0-2-.8-2-2.3 0-1.5.8-2.4 2-2.4.6 0 1 .4 1.3 1v-.9H40v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1-.7h-.2c-.2.4-.7.8-1.3.8Zm.3-1c.6 0 1-.5 1-1.3s-.4-1.3-1-1.3-1 .5-1 1.3.4 1.4 1 1.4ZM33.3 16.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7ZM36 21.9c0-1.5.8-2.3 2.1-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.9 1.3.9.3 1.3.8 1.3 1.7 0 1.2-.7 1.9-1.8 1.9-.6 0-1.1-.3-1.4-.8v2.2H36V22Zm1.8 1.2v-1h.3c.5 0 .9-.2.9-.7 0-.5-.3-.8-.9-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1 1.3s1-.4 1-1-.4-1-1.2-1h-.3ZM33.3 26.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7ZM37.1 34.6 34.8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.2.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2Zm.7 1a2 2 0 0 0-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1ZM33.3 36.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-lower-greek":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M10.5 15c.7 0 1-.5 1-1.3s-.3-1.3-1-1.3c-.5 0-.9.5-.9 1.3s.4 1.4 1 1.4Zm-.3 1c-1.1 0-1.8-.8-1.8-2.3 0-1.5.7-2.4 1.8-2.4.7 0 1.1.4 1.3 1h.1v-.9h1.2v3.2c0 .4.1.5.4.5h.2v.9h-.6c-.6 0-1-.2-1.1-.7h-.1c-.2.4-.7.8-1.4.8Zm5 .1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.7-.7.5 0 .8.3.8.7 0 .4-.3.7-.8.7Zm-4.9 7v-1h.3c.6 0 1-.2 1-.7 0-.5-.4-.8-1-.8-.5 0-.8.3-.8 1v2.2c0 .8.4 1.3 1.1 1.3.6 0 1-.4 1-1s-.5-1-1.3-1h-.3ZM8.6 22c0-1.5.7-2.3 2-2.3 1.2 0 2 .6 2 1.6 0 .6-.3 1-.8 1.3.8.3 1.3.8 1.3 1.7 0 1.2-.8 1.9-1.9 1.9-.6 0-1.1-.3-1.3-.8v2.2H8.5V22Zm6.2 4.2c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7Zm-4.5 8.5L8 30h1.4l1.7 3.5 1.7-3.5h1.1l-2.2 4.6v.1c.5.8.7 1.4.7 1.8 0 .4-.1.8-.4 1-.2.2-.6.3-1 .3-.9 0-1.3-.4-1.3-1.2 0-.5.2-1 .5-1.7l.1-.2Zm.7 1a2 2 0 0 0-.4.9c0 .3.1.4.4.4.3 0 .4-.1.4-.4 0-.2-.1-.6-.4-1Zm4.5.5c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-lower-roman-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M32.9 16v-1.2h-1.3V16H33Zm0 10v-1.2h-1.3V26H33Zm0 10v-1.2h-1.3V36H33Z"/><path fill-rule="nonzero" d="M36 21h-1.5v5H36zM36 31h-1.5v5H36zM39 21h-1.5v5H39zM39 31h-1.5v5H39zM42 31h-1.5v5H42zM36 11h-1.5v5H36zM36 19h-1.5v1H36zM36 29h-1.5v1H36zM39 19h-1.5v1H39zM39 29h-1.5v1H39zM42 29h-1.5v1H42zM36 9h-1.5v1H36z"/></g></svg>',"list-num-lower-roman":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M15.1 16v-1.2h1.3V16H15Zm0 10v-1.2h1.3V26H15Zm0 10v-1.2h1.3V36H15Z"/><path fill-rule="nonzero" d="M12 21h1.5v5H12zM12 31h1.5v5H12zM9 21h1.5v5H9zM9 31h1.5v5H9zM6 31h1.5v5H6zM12 11h1.5v5H12zM12 19h1.5v1H12zM12 29h1.5v1H12zM9 19h1.5v1H9zM9 29h1.5v1H9zM6 29h1.5v1H6zM12 9h1.5v1H12z"/></g></svg>',"list-num-upper-alpha-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="m39.3 17-.5-1.4h-2l-.5 1.4H35l2-6h1.6l2 6h-1.3Zm-1.6-4.7-.7 2.3h1.6l-.8-2.3ZM33.4 17c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7Zm4.7 9.9h-2.7v-6H38c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7Zm-1.4-5v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1Zm0 4h1.1c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9h-1.1V26ZM33 27.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm4.9 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2Zm-4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-upper-alpha":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="m12.6 17-.5-1.4h-2L9.5 17H8.3l2-6H12l2 6h-1.3ZM11 12.3l-.7 2.3h1.6l-.8-2.3Zm4.7 4.8c-.4 0-.7-.3-.7-.7 0-.4.3-.7.7-.7.5 0 .7.3.7.7 0 .4-.2.7-.7.7ZM11.4 27H8.7v-6h2.6c1.2 0 1.9.6 1.9 1.5 0 .6-.5 1.2-1 1.3.7.1 1.3.7 1.3 1.5 0 1-.8 1.7-2 1.7ZM10 22v1.5h1c.6 0 1-.3 1-.8 0-.4-.4-.7-1-.7h-1Zm0 4H11c.7 0 1.1-.3 1.1-.8 0-.6-.4-.9-1.1-.9H10V26Zm5.4 1.1c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Zm-4.1 10c-1.8 0-2.8-1.1-2.8-3.1s1-3.1 2.8-3.1c1.4 0 2.5.9 2.6 2.2h-1.3c0-.7-.6-1.1-1.3-1.1-1 0-1.6.7-1.6 2s.6 2 1.6 2c.7 0 1.2-.4 1.4-1h1.2c-.1 1.3-1.2 2.2-2.6 2.2Zm4.5 0c-.5 0-.8-.3-.8-.7 0-.4.3-.7.8-.7.4 0 .7.3.7.7 0 .4-.3.7-.7.7Z"/></g></svg>',"list-num-upper-roman-rtl":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M8 12h22v4H8zM8 22h22v4H8zM8 32h22v4H8z"/><path d="M31.6 17v-1.2H33V17h-1.3Zm0 10v-1.2H33V27h-1.3Zm0 10v-1.2H33V37h-1.3Z"/><path fill-rule="nonzero" d="M34.5 20H36v7h-1.5zM34.5 30H36v7h-1.5zM37.5 20H39v7h-1.5zM37.5 30H39v7h-1.5zM40.5 30H42v7h-1.5zM34.5 10H36v7h-1.5z"/></g></svg>',"list-num-upper-roman":'<svg width="48" height="48"><g fill-rule="evenodd"><path opacity=".2" d="M18 12h22v4H18zM18 22h22v4H18zM18 32h22v4H18z"/><path d="M15.1 17v-1.2h1.3V17H15Zm0 10v-1.2h1.3V27H15Zm0 10v-1.2h1.3V37H15Z"/><path fill-rule="nonzero" d="M12 20h1.5v7H12zM12 30h1.5v7H12zM9 20h1.5v7H9zM9 30h1.5v7H9zM6 30h1.5v7H6zM12 10h1.5v7H12z"/></g></svg>',lock:'<svg width="24" height="24"><path d="M16.3 11c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H8V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h.3ZM10 8v3h4V8a1 1 0 0 0-.3-.7A1 1 0 0 0 13 7h-2a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7Z" fill-rule="evenodd"/></svg>',ltr:'<svg width="24" height="24"><path d="M11 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 7.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L11 5ZM4.4 16.2 6.2 15l-1.8-1.2a1 1 0 0 1 1.2-1.6l3 2a1 1 0 0 1 0 1.6l-3 2a1 1 0 1 1-1.2-1.6Z" fill-rule="evenodd"/></svg>',"math-equation":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 4.8c.1-.5.5-.8 1-.8h10a1 1 0 1 1 0 2h-9.2L8.3 19.2a1 1 0 0 1-1.7.4l-3.4-4.2a1 1 0 0 1 1.6-1.2l2 2.5L9 4.8Zm9.7 5.5c.4.4.4 1 0 1.4L17 13.5l1.8 1.8a1 1 0 1 1-1.4 1.4L15.5 15l-1.8 1.8a1 1 0 0 1-1.4-1.4l1.8-1.8-1.8-1.8a1 1 0 0 1 1.4-1.4l1.8 1.8 1.8-1.8a1 1 0 0 1 1.4 0Z"/></svg>',mentions:'<svg height="24" width="24"><path d="M12 21a8.8 8.8 0 0 1-3.5-.7 9 9 0 0 1-2.9-2 9 9 0 0 1-1.9-2.8A8.8 8.8 0 0 1 3 12c0-1.3.2-2.4.7-3.5a9 9 0 0 1 4.8-4.8A8.8 8.8 0 0 1 12 3c1.3 0 2.4.2 3.5.7a9.1 9.1 0 0 1 4.8 4.8A8.7 8.7 0 0 1 21 12v1.4a3 3 0 0 1-.9 2.2 3 3 0 0 1-2.2.9c-.5 0-1-.1-1.5-.4a3.8 3.8 0 0 1-1.1-1 4.8 4.8 0 0 1-1.5 1 4.3 4.3 0 0 1-1.8.4c-1.2 0-2.3-.4-3.2-1.3-.9-.9-1.3-2-1.3-3.2s.4-2.3 1.3-3.2c.9-.9 2-1.3 3.2-1.3s2.3.4 3.2 1.3c.9.9 1.3 2 1.3 3.2v1.4c0 .4.1.7.4 1 .3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1V12c0-2-.7-3.8-2.1-5.2S14 4.7 12 4.7s-3.8.7-5.2 2.1S4.7 10 4.7 12s.7 3.8 2.1 5.2 3.2 2.1 5.2 2.1h4.5V21zm0-6.2c.8 0 1.4-.3 2-.8a2.7 2.7 0 0 0 .8-2c0-.8-.3-1.4-.8-2a2.7 2.7 0 0 0-2-.8c-.8 0-1.4.3-2 .8a2.7 2.7 0 0 0-.8 2c0 .8.3 1.4.8 2a2.7 2.7 0 0 0 2 .8z"/></svg>',minus:'<svg width="24" height="24"><path d="M19 11a1 1 0 0 1 .1 2H5a1 1 0 0 1-.1-2H19Z"/></svg>',"more-drawer":'<svg width="24" height="24"><path d="M6 10a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm12 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Zm-6 0a2 2 0 0 0-2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2 2 2 0 0 0-2-2Z" fill-rule="nonzero"/></svg>',"new-document":'<svg width="24" height="24"><path d="M14.4 3H7a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h10a2 2 0 0 0 2-2V7.6L14.4 3ZM17 19H7V5h6v4h4v10Z" fill-rule="nonzero"/></svg>',"new-tab":'<svg width="24" height="24"><path d="m15 13 2-2v8H5V7h8l-2 2H7v8h8v-4Zm4-8v5.5l-2-2-5.6 5.5H10v-1.4L15.5 7l-2-2H19Z" fill-rule="evenodd"/></svg>',"non-breaking":'<svg width="24" height="24"><path d="M11 11H8a1 1 0 1 1 0-2h3V6c0-.6.4-1 1-1s1 .4 1 1v3h3c.6 0 1 .4 1 1s-.4 1-1 1h-3v3c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-3Zm10 4v5H3v-5c0-.6.4-1 1-1s1 .4 1 1v3h14v-3c0-.6.4-1 1-1s1 .4 1 1Z" fill-rule="evenodd"/></svg>',notice:'<svg width="24" height="24"><path d="M15.5 4 20 8.5v7L15.5 20h-7L4 15.5v-7L8.5 4h7ZM13 17v-2h-2v2h2Zm0-4V7h-2v6h2Z" fill-rule="evenodd" clip-rule="evenodd"/></svg>',"ordered-list-rtl":'<svg width="24" height="24"><path d="M6 17h8a1 1 0 0 1 0 2H6a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2H6a1 1 0 0 1 0-2Zm0-6h8a1 1 0 0 1 0 2H6a1 1 0 1 1 0-2Zm13-1v3.5a.5.5 0 1 1-1 0V5h-.5a.5.5 0 1 1 0-1H19Zm-1 8.8.2.2h1.3a.5.5 0 1 1 0 1h-1.6a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0-.2-.2h-1.3a.5.5 0 0 1-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3Zm2 4.2v2c0 .6-.4 1-1 1h-1.5a.5.5 0 0 1 0-1h1.2a.3.3 0 1 0 0-.6h-1.3a.4.4 0 1 1 0-.8h1.3a.3.3 0 0 0 0-.6h-1.2a.5.5 0 1 1 0-1H19c.6 0 1 .4 1 1Z" fill-rule="evenodd"/></svg>',"ordered-list":'<svg width="24" height="24"><path d="M10 17h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0-6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 1 1 0-2ZM6 4v3.5c0 .3-.2.5-.5.5a.5.5 0 0 1-.5-.5V5h-.5a.5.5 0 0 1 0-1H6Zm-1 8.8.2.2h1.3c.3 0 .5.2.5.5s-.2.5-.5.5H4.9a1 1 0 0 1-.9-1V13c0-.4.3-.8.6-1l1.2-.4.2-.3a.2.2 0 0 0-.2-.2H4.5a.5.5 0 0 1-.5-.5c0-.3.2-.5.5-.5h1.6c.5 0 .9.4.9 1v.1c0 .4-.3.8-.6 1l-1.2.4-.2.3ZM7 17v2c0 .6-.4 1-1 1H4.5a.5.5 0 0 1 0-1h1.2c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.4a.4.4 0 1 1 0-.8h1.3c.2 0 .3-.1.3-.3 0-.2-.1-.3-.3-.3H4.5a.5.5 0 1 1 0-1H6c.6 0 1 .4 1 1Z" fill-rule="evenodd"/></svg>',orientation:'<svg width="24" height="24"><path d="M7.3 6.4 1 13l6.4 6.5 6.5-6.5-6.5-6.5ZM3.7 13l3.6-3.7L11 13l-3.7 3.7-3.6-3.7ZM12 6l2.8 2.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0L9.2 5.7a.8.8 0 0 1 0-1.2L13.6.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L12 4h1a9 9 0 1 1-4.3 16.9l1.5-1.5A7 7 0 1 0 13 6h-1Z" fill-rule="nonzero"/></svg>',outdent:'<svg width="24" height="24"><path d="M7 5h12c.6 0 1 .4 1 1s-.4 1-1 1H7a1 1 0 1 1 0-2Zm5 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm0 4h7c.6 0 1 .4 1 1s-.4 1-1 1h-7a1 1 0 0 1 0-2Zm-5 4h12a1 1 0 0 1 0 2H7a1 1 0 0 1 0-2Zm1.6-3.8a1 1 0 0 1-1.2 1.6l-3-2a1 1 0 0 1 0-1.6l3-2a1 1 0 0 1 1.2 1.6L6.8 12l1.8 1.2Z" fill-rule="evenodd"/></svg>',"export-pdf":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z"/><path d="M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"/></svg>',"export-word":'<svg width="24" height="24"><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"/></svg>',"import-word":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z"/><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z"/></svg>',"page-break":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M5 11c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h1c.6 0 1 .4 1 1s-.4 1-1 1h-1a1 1 0 0 1 0-2Zm4 0c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2ZM7 3v5h10V3c0-.6.4-1 1-1s1 .4 1 1v7H5V3c0-.6.4-1 1-1s1 .4 1 1ZM6 22a1 1 0 0 1-1-1v-7h14v7c0 .6-.4 1-1 1a1 1 0 0 1-1-1v-5H7v5c0 .6-.4 1-1 1Z"/></g></svg>',paragraph:'<svg width="24" height="24"><path fill-rule="evenodd" d="M10 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 6.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L10 5Z"/></svg>',"paste-column-after":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm8 7v12h-6V8h6Zm-1.5 1.5h-3v9h3v-9ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-column-before":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm-2 7v12H4V8h6ZM8.5 9.5h-3v9h3v-9ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-row-after":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm10 11v5H8v-5h14Zm-1.5 1.5h-11v2h11v-2ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-row-before":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2H9.2A3 3 0 0 1 12 1Zm10 7v5H8V8h14Zm-1.5 1.5h-11v2h11v-2ZM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z"/></svg>',"paste-text":'<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h3V9h9ZM9 20H6a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0 1 12 1a3 3 0 0 1 2.8 2H18a2 2 0 0 1 2 2v4h1v12H9v-1Zm1.5-9.5v9h9v-9h-9ZM12 3a1 1 0 0 0-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1Zm0 9h6v2h-.5l-.5-1h-1v4h.8v1h-3.6v-1h.8v-4h-1l-.5 1H12v-2Z" fill-rule="nonzero"/></svg>',paste:'<svg width="24" height="24"><path d="M18 9V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h3V9h9ZM9 20H6a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.2A3 3 0 0 1 12 1a3 3 0 0 1 2.8 2H18a2 2 0 0 1 2 2v4h1v12H9v-1Zm1.5-9.5v9h9v-9h-9ZM12 3a1 1 0 0 0-1 1c0 .5.4 1 1 1s1-.5 1-1-.4-1-1-1Z" fill-rule="nonzero"/></svg>',"permanent-pen":'<svg width="24" height="24"><path d="M10.5 17.5 8 20H3v-3l3.5-3.5a2 2 0 0 1 0-3L14 3l1 1-7.3 7.3a1 1 0 0 0 0 1.4l3.6 3.6c.4.4 1 .4 1.4 0L20 9l1 1-7.6 7.6a2 2 0 0 1-2.8 0l-.1-.1Z" fill-rule="nonzero"/></svg>',plus:'<svg width="24" height="24"><path d="M12 4c.5 0 1 .4 1 .9V11h6a1 1 0 0 1 .1 2H13v6a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H11V5c0-.6.4-1 1-1Z"/></svg>',preferences:'<svg width="24" height="24"><path d="m20.1 13.5-1.9.2a5.8 5.8 0 0 1-.6 1.5l1.2 1.5c.4.4.3 1 0 1.4l-.7.7a1 1 0 0 1-1.4 0l-1.5-1.2a6.2 6.2 0 0 1-1.5.6l-.2 1.9c0 .5-.5.9-1 .9h-1a1 1 0 0 1-1-.9l-.2-1.9a5.8 5.8 0 0 1-1.5-.6l-1.5 1.2a1 1 0 0 1-1.4 0l-.7-.7a1 1 0 0 1 0-1.4l1.2-1.5a6.2 6.2 0 0 1-.6-1.5l-1.9-.2a1 1 0 0 1-.9-1v-1c0-.5.4-1 .9-1l1.9-.2a5.8 5.8 0 0 1 .6-1.5L5.2 7.3a1 1 0 0 1 0-1.4l.7-.7a1 1 0 0 1 1.4 0l1.5 1.2a6.2 6.2 0 0 1 1.5-.6l.2-1.9c0-.5.5-.9 1-.9h1c.5 0 1 .4 1 .9l.2 1.9a5.8 5.8 0 0 1 1.5.6l1.5-1.2a1 1 0 0 1 1.4 0l.7.7c.3.4.4 1 0 1.4l-1.2 1.5a6.2 6.2 0 0 1 .6 1.5l1.9.2c.5 0 .9.5.9 1v1c0 .5-.4 1-.9 1ZM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z" fill-rule="evenodd"/></svg>',preview:'<svg width="24" height="24"><path d="M3.5 12.5c.5.8 1.1 1.6 1.8 2.3 2 2 4.2 3.2 6.7 3.2s4.7-1.2 6.7-3.2a16.2 16.2 0 0 0 2.1-2.8 15.7 15.7 0 0 0-2.1-2.8c-2-2-4.2-3.2-6.7-3.2a9.3 9.3 0 0 0-6.7 3.2A16.2 16.2 0 0 0 3.2 12c0 .2.2.3.3.5Zm-2.4-1 .7-1.2L4 7.8C6.2 5.4 8.9 4 12 4c3 0 5.8 1.4 8.1 3.8a18.2 18.2 0 0 1 2.8 3.7v1l-.7 1.2-2.1 2.5c-2.3 2.4-5 3.8-8.1 3.8-3 0-5.8-1.4-8.1-3.8a18.2 18.2 0 0 1-2.8-3.7 1 1 0 0 1 0-1Zm12-3.3a2 2 0 1 0 2.7 2.6 4 4 0 1 1-2.6-2.6Z" fill-rule="nonzero"/></svg>',print:'<svg width="24" height="24"><path d="M18 8H6a3 3 0 0 0-3 3v6h2v3h14v-3h2v-6a3 3 0 0 0-3-3Zm-1 10H7v-4h10v4Zm.5-5c-.8 0-1.5-.7-1.5-1.5s.7-1.5 1.5-1.5 1.5.7 1.5 1.5-.7 1.5-1.5 1.5Zm.5-8H6v2h12V5Z" fill-rule="nonzero"/></svg>',quote:'<svg width="24" height="24"><path d="M7.5 17h.9c.4 0 .7-.2.9-.6L11 13V8c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 0 0 .8 1.3Zm8 0h.9c.4 0 .7-.2.9-.6L19 13V8c0-.6-.4-1-1-1h-4a1 1 0 0 0-1 1v4c0 .6.4 1 1 1h2l-1.3 2.7a1 1 0 0 0 .8 1.3Z" fill-rule="nonzero"/></svg>',redo:'<svg width="24" height="24"><path d="M17.6 10H12c-2.8 0-4.4 1.4-4.9 3.5-.4 2 .3 4 1.4 4.6a1 1 0 1 1-1 1.8c-2-1.2-2.9-4.1-2.3-6.8.6-3 3-5.1 6.8-5.1h5.6l-3.3-3.3a1 1 0 1 1 1.4-1.4l5 5a1 1 0 0 1 0 1.4l-5 5a1 1 0 0 1-1.4-1.4l3.3-3.3Z" fill-rule="nonzero"/></svg>',reload:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="m5 22.1-1.2-4.7v-.2a1 1 0 0 1 1-1l5 .4a1 1 0 1 1-.2 2l-2.2-.2a7.8 7.8 0 0 0 8.4.2 7.5 7.5 0 0 0 3.5-6.4 1 1 0 1 1 2 0 9.5 9.5 0 0 1-4.5 8 9.9 9.9 0 0 1-10.2 0l.4 1.4a1 1 0 1 1-2 .5ZM13.6 7.4c0-.5.5-1 1-.9l2.8.2a8 8 0 0 0-9.5-1 7.5 7.5 0 0 0-3.6 7 1 1 0 0 1-2 0 9.5 9.5 0 0 1 4.5-8.6 10 10 0 0 1 10.9.3l-.3-1a1 1 0 0 1 2-.5l1.1 4.8a1 1 0 0 1-1 1.2l-5-.4a1 1 0 0 1-.9-1Z"/></g></svg>',"remove-formatting":'<svg width="24" height="24"><path d="M13.2 6a1 1 0 0 1 0 .2l-2.6 10a1 1 0 0 1-1 .8h-.2a.8.8 0 0 1-.8-1l2.6-10H8a1 1 0 1 1 0-2h9a1 1 0 0 1 0 2h-3.8ZM5 18h7a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Zm13 1.5L16.5 18 15 19.5a.7.7 0 0 1-1-1l1.5-1.5-1.5-1.5a.7.7 0 0 1 1-1l1.5 1.5 1.5-1.5a.7.7 0 0 1 1 1L17.5 17l1.5 1.5a.7.7 0 0 1-1 1Z" fill-rule="evenodd"/></svg>',remove:'<svg width="24" height="24"><path d="M16 7h3a1 1 0 0 1 0 2h-1v9a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3V9H5a1 1 0 1 1 0-2h3V6a3 3 0 0 1 3-3h2a3 3 0 0 1 3 3v1Zm-2 0V6c0-.6-.4-1-1-1h-2a1 1 0 0 0-1 1v1h4Zm2 2H8v9c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V9Zm-7 3a1 1 0 0 1 2 0v4a1 1 0 0 1-2 0v-4Zm4 0a1 1 0 0 1 2 0v4a1 1 0 0 1-2 0v-4Z" fill-rule="nonzero"/></svg>',"resize-handle":'<svg width="10" height="10"><g fill-rule="nonzero"><path d="M8.1 1.1A.5.5 0 1 1 9 2l-7 7A.5.5 0 1 1 1 8l7-7ZM8.1 5.1A.5.5 0 1 1 9 6l-3 3A.5.5 0 1 1 5 8l3-3Z"/></g></svg>',resize:'<svg width="24" height="24"><path d="M4 5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h6c.3 0 .5.1.7.3.2.2.3.4.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3H7.4L18 16.6V13c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3.3 0 .5.1.7.3.2.2.3.4.3.7v6c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3h-6a1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3.6L6 7.4V11c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3A1 1 0 0 1 4 11V5Z" fill-rule="evenodd"/></svg>',"restore-draft":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M17 13c0 .6-.4 1-1 1h-4V8c0-.6.4-1 1-1s1 .4 1 1v4h2c.6 0 1 .4 1 1Z"/><path d="M4.7 10H9a1 1 0 0 1 0 2H3a1 1 0 0 1-1-1V5a1 1 0 1 1 2 0v3l2.5-2.4a9.2 9.2 0 0 1 10.8-1.5A9 9 0 0 1 13.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 1 1 1.3-1.5 7.2 7.2 0 0 0 11.6-3.7 7 7 0 0 0-3.5-7.7A7.2 7.2 0 0 0 8 7L4.7 10Z" fill-rule="nonzero"/></g></svg>',"revision-history":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M17 13c0 .6-.4 1-1 1h-4V8c0-.6.4-1 1-1s1 .4 1 1v4h2c.6 0 1 .4 1 1Z"/><path d="M4.7 10H9a1 1 0 0 1 0 2H3a1 1 0 0 1-1-1V5a1 1 0 1 1 2 0v3l2.5-2.4a9.2 9.2 0 0 1 10.8-1.5A9 9 0 0 1 13.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 1 1 1.3-1.5 7.2 7.2 0 0 0 11.6-3.7 7 7 0 0 0-3.5-7.7A7.2 7.2 0 0 0 8 7L4.7 10Z" fill-rule="nonzero"/></g></svg>',"rotate-left":'<svg width="24" height="24"><path d="M4.7 10H9a1 1 0 0 1 0 2H3a1 1 0 0 1-1-1V5a1 1 0 1 1 2 0v3l2.5-2.4a9.2 9.2 0 0 1 10.8-1.5A9 9 0 0 1 13.4 21c-2.4.1-4.7-.7-6.5-2.2a1 1 0 1 1 1.3-1.5 7.2 7.2 0 0 0 11.6-3.7 7 7 0 0 0-3.5-7.7A7.2 7.2 0 0 0 8 7L4.7 10Z" fill-rule="nonzero"/></svg>',"rotate-right":'<svg width="24" height="24"><path d="M20 8V5a1 1 0 0 1 2 0v6c0 .6-.4 1-1 1h-6a1 1 0 0 1 0-2h4.3L16 7A7.2 7.2 0 0 0 7.7 6a7 7 0 0 0 3 13.1c1.9.1 3.7-.5 5-1.7a1 1 0 0 1 1.4 1.5A9.2 9.2 0 0 1 2.2 14c-.9-3.9 1-8 4.5-9.9 3.5-1.9 8-1.3 10.8 1.5L20 8Z" fill-rule="nonzero"/></svg>',rtl:'<svg width="24" height="24"><path d="M8 5h8v2h-2v12h-2V7h-2v12H8v-7c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 4.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L8 5Zm12 11.2a1 1 0 1 1-1 1.6l-3-2a1 1 0 0 1 0-1.6l3-2a1 1 0 1 1 1 1.6L18.4 15l1.8 1.2Z" fill-rule="evenodd"/></svg>',save:'<svg width="24" height="24"><path d="M5 16h14a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2Zm0 2v2h14v-2H5Zm10 0h2v2h-2v-2Zm-4-6.4L8.7 9.3a1 1 0 1 0-1.4 1.4l4 4c.4.4 1 .4 1.4 0l4-4a1 1 0 1 0-1.4-1.4L13 11.6V4a1 1 0 0 0-2 0v7.6Z" fill-rule="nonzero"/></svg>',search:'<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3Zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12Z" fill-rule="nonzero"/></svg>',"select-all":'<svg width="24" height="24"><path d="M3 5h2V3a2 2 0 0 0-2 2Zm0 8h2v-2H3v2Zm4 8h2v-2H7v2ZM3 9h2V7H3v2Zm10-6h-2v2h2V3Zm6 0v2h2a2 2 0 0 0-2-2ZM5 21v-2H3c0 1.1.9 2 2 2Zm-2-4h2v-2H3v2ZM9 3H7v2h2V3Zm2 18h2v-2h-2v2Zm8-8h2v-2h-2v2Zm0 8a2 2 0 0 0 2-2h-2v2Zm0-12h2V7h-2v2Zm0 8h2v-2h-2v2Zm-4 4h2v-2h-2v2Zm0-16h2V3h-2v2ZM7 17h10V7H7v10Zm2-8h6v6H9V9Z" fill-rule="nonzero"/></svg>',selected:'<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2Zm3.6 10.9L7 12.3a.7.7 0 0 0-1 1L9.6 17 18 8.6a.7.7 0 0 0 0-1 .7.7 0 0 0-1 0l-7.4 7.3Z"/></svg>',send:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="m13.3 22 7-18.3-18.3 7L9 15l4.3 7ZM18 6.8l-.7-.7L9.4 14l.7.7L18 6.8Z"/></svg>',settings:'<svg width="24" height="24"><path d="M11 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6V8H5a1 1 0 1 1 0-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.5V6ZM8 8h2V6H8v2Zm9 2.8v.2h2c.6 0 1 .4 1 1s-.4 1-1 1h-2v.3c0 .2 0 .3-.2.5l-.6.2h-2.4c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6V13H5a1 1 0 0 1 0-2h8v-.3c0-.2 0-.3.2-.5l.6-.2h2.4c.3 0 .4 0 .6.2l.2.6ZM14 13h2v-2h-2v2Zm-3 2.8v.2h8c.6 0 1 .4 1 1s-.4 1-1 1h-8v.3c0 .2 0 .3-.2.5l-.6.2H7.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6V18H5a1 1 0 0 1 0-2h2v-.3c0-.2 0-.3.2-.5l.5-.2h2.5c.3 0 .4 0 .6.2l.2.6ZM8 18h2v-2H8v2Z" fill-rule="evenodd"/></svg>',sharpen:'<svg width="24" height="24"><path fill-rule="evenodd" d="m16 6 4 4-8 9-8-9 4-4h8Zm-4 10.2 5.5-6.2-.1-.1H12v-.3h5.1l-.2-.2H12V9h4.6l-.2-.2H12v-.3h4.1l-.2-.2H12V8h3.6l-.2-.2H8.7L6.5 10l.1.1H12v.3H6.9l.2.2H12v.3H7.3l.2.2H12v.3H7.7l.3.2h4v.3H8.2l.2.2H12v.3H8.6l.3.2H12v.3H9l.3.2H12v.3H9.5l.2.2H12v.3h-2l.2.2H12v.3h-1.6l.2.2H12v.3h-1.1l.2.2h.9v.3h-.7l.2.2h.5v.3h-.3l.3.2Z"/></svg>',sourcecode:'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M9.8 15.7c.3.3.3.8 0 1-.3.4-.9.4-1.2 0l-4.4-4.1a.8.8 0 0 1 0-1.2l4.4-4.2c.3-.3.9-.3 1.2 0 .3.3.3.8 0 1.1L6 12l3.8 3.7ZM14.2 15.7c-.3.3-.3.8 0 1 .4.4.9.4 1.2 0l4.4-4.1c.3-.3.3-.9 0-1.2l-4.4-4.2a.8.8 0 0 0-1.2 0c-.3.3-.3.8 0 1.1L18 12l-3.8 3.7Z"/></g></svg>',"spell-check":'<svg width="24" height="24"><path d="M6 8v3H5V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h2c.3 0 .5.1.7.3.2.2.3.4.3.7v6H8V8H6Zm0-3v2h2V5H6Zm13 0h-3v5h3v1h-3a1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7V5c0-.3.1-.5.3-.7.2-.2.4-.3.7-.3h3v1Zm-5 1.5-.1.7c-.1.2-.3.3-.6.3.3 0 .5.1.6.3l.1.7V10c0 .3-.1.5-.3.7a1 1 0 0 1-.7.3h-3V4h3c.3 0 .5.1.7.3.2.2.3.4.3.7v1.5ZM13 10V8h-2v2h2Zm0-3V5h-2v2h2Zm3 5 1 1-6.5 7L7 15.5l1.3-1 2.2 2.2L16 12Z" fill-rule="evenodd"/></svg>',"strike-through":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M15.6 8.5c-.5-.7-1-1.1-1.3-1.3-.6-.4-1.3-.6-2-.6-2.7 0-2.8 1.7-2.8 2.1 0 1.6 1.8 2 3.2 2.3 4.4.9 4.6 2.8 4.6 3.9 0 1.4-.7 4.1-5 4.1A6.2 6.2 0 0 1 7 16.4l1.5-1.1c.4.6 1.6 2 3.7 2 1.6 0 2.5-.4 3-1.2.4-.8.3-2-.8-2.6-.7-.4-1.6-.7-2.9-1-1-.2-3.9-.8-3.9-3.6C7.6 6 10.3 5 12.4 5c2.9 0 4.2 1.6 4.7 2.4l-1.5 1.1Z"/><path d="M5 11h14a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z" fill-rule="nonzero"/></g></svg>',subscript:'<svg width="24" height="24"><path d="m10.4 10 4.6 4.6-1.4 1.4L9 11.4 4.4 16 3 14.6 7.6 10 3 5.4 4.4 4 9 8.6 13.6 4 15 5.4 10.4 10ZM21 19h-5v-1l1-.8 1.7-1.6c.3-.4.5-.8.5-1.2 0-.3 0-.6-.2-.7-.2-.2-.5-.3-.9-.3a2 2 0 0 0-.8.2l-.7.3-.4-1.1 1-.6 1.2-.2c.8 0 1.4.3 1.8.7.4.4.6.9.6 1.5s-.2 1.1-.5 1.6a8 8 0 0 1-1.3 1.3l-.6.6h2.6V19Z" fill-rule="nonzero"/></svg>',superscript:'<svg width="24" height="24"><path d="M15 9.4 10.4 14l4.6 4.6-1.4 1.4L9 15.4 4.4 20 3 18.6 7.6 14 3 9.4 4.4 8 9 12.6 13.6 8 15 9.4Zm5.9 1.6h-5v-1l1-.8 1.7-1.6c.3-.5.5-.9.5-1.3 0-.3 0-.5-.2-.7-.2-.2-.5-.3-.9-.3l-.8.2-.7.4-.4-1.2c.2-.2.5-.4 1-.5.3-.2.8-.2 1.2-.2.8 0 1.4.2 1.8.6.4.4.6 1 .6 1.6 0 .5-.2 1-.5 1.5l-1.3 1.4-.6.5h2.6V11Z" fill-rule="nonzero"/></svg>',"table-caption":'<svg width="24" height="24"><g fill-rule="nonzero"><rect width="12" height="2" x="3" y="4" rx="1"/><path d="M19 8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-8c0-1.1.9-2 2-2h14ZM5 15v3h6v-3H5Zm14 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></g></svg>',"table-cell-classes":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M13 4v9H3V6c0-1.1.9-2 2-2h8Zm-2 2H5v5h6V6Z"/><path fill-rule="nonzero" d="M13 4h6a2 2 0 0 1 2 2v7h-8v-2h6V6h-6V4Z" opacity=".2"/><path d="m18 20-2.6 1.6.7-3-2.4-2 3.1-.2 1.2-2.9 1.2 2.9 3.1.2-2.4 2 .7 3z"/><path fill-rule="nonzero" d="M3 13v5c0 1.1.9 2 2 2h8v-7h-2v5H5v-5H3Z" opacity=".2"/></g></svg>',"table-cell-properties":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 9H5v5h6v-5Zm8 0h-6v5h6v-5Zm-8-7H5v5h6V6Z"/></svg>',"table-cell-select-all":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 2H5v12h14V6Z"/><path d="M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2Z" opacity=".2"/></g></svg>',"table-cell-select-inner":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 2H5v12h14V6Z" opacity=".2"/><path d="M13 6v5h6v2h-6v5h-2v-5H5v-2h6V6h2Z"/></g></svg>',"table-classes":'<svg width="24" height="24"><g fill-rule="evenodd"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v7h-8v7H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 9H5v5h6v-5Zm8-7h-6v5h6V6Zm-8 0H5v5h6V6Z"/><path d="m18 20-2.6 1.6.7-3-2.4-2 3.1-.2 1.2-2.9 1.2 2.9 3.1.2-2.4 2 .7 3z"/></g></svg>',"table-delete-column":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2Zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5Z"/></svg>',"table-delete-row":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6Zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3Z"/></svg>',"table-delete-table":'<svg width="24" height="24"><g fill-rule="nonzero"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 6v12h14V6H5Z"/><path d="m14.4 8.6 1.1 1-2.4 2.4 2.4 2.4-1.1 1.1-2.4-2.4-2.4 2.4-1-1.1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></g></svg>',"table-insert-column-after":'<svg width="24" height="24"><path fill-rule="nonzero" d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15ZM9 13H5v5h4v-5Zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1ZM9 6H5v5h4V6Z"/></svg>',"table-insert-column-before":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15Zm0 9h-4v5h4v-5ZM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1Zm11-2h-4v5h4V6Z"/></svg>',"table-insert-row-above":'<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2Zm5 10H5v4h6v-4Zm8 0h-6v4h6v-4ZM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1Z"/></svg>',"table-insert-row-after":'<svg width="24" height="24"><path fill-rule="nonzero" d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1Zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18ZM11 6H5v4h6V6Zm8 0h-6v4h6V6Z"/></svg>',"table-left-header":'<svg width="24" height="24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',"table-merge-cells":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 15.5V18h3v-2.5H5Zm14-5h-9V18h9v-7.5ZM19 6h-4v2.5h4V6ZM8 6H5v2.5h3V6Zm5 0h-3v2.5h3V6Zm-8 7.5h3v-3H5v3Z"/></svg>',"table-row-numbering-rtl":'<svg width="24" height="24"><path d="M6 4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H6Zm0 12h8v3H6v-3Zm11 0c.6 0 1 .4 1 1v1a1 1 0 0 1-2 0v-1c0-.6.4-1 1-1ZM6 11h8v3H6v-3Zm11 0c.6 0 1 .4 1 1v1a1 1 0 0 1-2 0v-1c0-.6.4-1 1-1ZM6 6h8v3H6V6Zm11 0c.6 0 1 .4 1 1v1a1 1 0 1 1-2 0V7c0-.6.4-1 1-1Z"/></svg>',"table-row-numbering":'<svg width="24" height="24"><path d="M18 4a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h12Zm0 12h-8v3h8v-3ZM7 16a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-1c0-.6-.4-1-1-1Zm11-5h-8v3h8v-3ZM7 11a1 1 0 0 0-1 1v1a1 1 0 0 0 2 0v-1c0-.6-.4-1-1-1Zm11-5h-8v3h8V6ZM7 6a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0V7c0-.6-.4-1-1-1Z"/></svg>',"table-row-properties":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 15v3h6v-3H5Zm14 0h-6v3h6v-3Zm0-9h-6v3h6V6ZM5 9h6V6H5v3Z"/></svg>',"table-split-cells":'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM8 15.5H5V18h3v-2.5Zm11-5h-9V18h9v-7.5Zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2Zm-8.5-1H5v3h3v-3ZM19 6h-4v2.5h4V6ZM8 6H5v2.5h3V6Zm5 0h-3v2.5h3V6Z"/></svg>',"table-top-header":'<svg width="24" height="24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',table:'<svg width="24" height="24"><path fill-rule="nonzero" d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14ZM5 14v4h6v-4H5Zm14 0h-6v4h6v-4Zm0-6h-6v4h6V8ZM5 12h6V8H5v4Z"/></svg>',"template-add":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 12v4H5a2 2 0 0 0-2 2v3h9.3a6 6 0 0 1-.3-2H5v-1h7a6 6 0 0 1 .8-2H11v-5l-.8-.6a3 3 0 1 1 3.6 0l-.8.6v4.7a6 6 0 0 1 2-1.9V12a5 5 0 1 0-6 0Z"/><path d="M18 15c.5 0 1 .4 1 .9V18h2a1 1 0 0 1 .1 2H19v2a1 1 0 0 1-2 .1V20h-2a1 1 0 0 1-.1-2H17v-2c0-.6.4-1 1-1Z"/></svg>',template:'<svg width="24" height="24"><path d="M19 19v-1H5v1h14ZM9 16v-4a5 5 0 1 1 6 0v4h4a2 2 0 0 1 2 2v3H3v-3c0-1.1.9-2 2-2h4Zm4 0v-5l.8-.6a3 3 0 1 0-3.6 0l.8.6v5h2Z" fill-rule="nonzero"/></svg>',"temporary-placeholder":'<svg width="24" height="24"><g fill-rule="evenodd"><path d="M9 7.6V6h2.5V4.5a.5.5 0 1 1 1 0V6H15v1.6a8 8 0 1 1-6 0Zm-2.6 5.3a.5.5 0 0 0 .3.6c.3 0 .6 0 .6-.3l.1-.2a5 5 0 0 1 3.3-2.8c.3-.1.4-.4.4-.6-.1-.3-.4-.5-.6-.4a6 6 0 0 0-4.1 3.7Z"/><circle cx="14" cy="4" r="1"/><circle cx="12" cy="2" r="1"/><circle cx="10" cy="4" r="1"/></g></svg>',"text-color":'<svg width="24" height="24"><g fill-rule="evenodd"><path class="tox-icon-text-color__color" d="M3 18h18v3H3z"/><path d="M8.7 16h-.8a.5.5 0 0 1-.5-.6l2.7-9c.1-.3.3-.4.5-.4h2.8c.2 0 .4.1.5.4l2.7 9a.5.5 0 0 1-.5.6h-.8a.5.5 0 0 1-.4-.4l-.7-2.2c0-.3-.3-.4-.5-.4h-3.4c-.2 0-.4.1-.5.4l-.7 2.2c0 .3-.2.4-.4.4Zm2.6-7.6-.6 2a.5.5 0 0 0 .5.6h1.6a.5.5 0 0 0 .5-.6l-.6-2c0-.3-.3-.4-.5-.4h-.4c-.2 0-.4.1-.5.4Z"/></g></svg>',"text-size-decrease":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H4a1 1 0 0 1 0-2h10ZM14 12a1 1 0 1 0 0 2h6a1 1 0 1 0 0-2h-6Z"/></svg>',"text-size-increase":'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M14 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H4a1 1 0 0 1 0-2h10ZM17 9a1 1 0 0 0-1 1v2h-2a1 1 0 1 0 0 2h2v2a1 1 0 1 0 2 0v-2h2a1 1 0 1 0 0-2h-2v-2c0-.6-.4-1-1-1Z"/></svg>',toc:'<svg width="24" height="24"><path d="M5 5c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 1 1 0-2Zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 1 1 0-2Zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h11c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Zm0-4c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 1 1 0-2Zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm-3 8c.6 0 1 .4 1 1s-.4 1-1 1a1 1 0 0 1 0-2Zm3 0h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',translate:'<svg width="24" height="24"><path d="m12.7 14.3-.3.7-.4.7-2.2-2.2-3.1 3c-.3.4-.8.4-1 0a.7.7 0 0 1 0-1l3.1-3A12.4 12.4 0 0 1 6.7 9H8a10.1 10.1 0 0 0 1.7 2.4c.5-.5 1-1.1 1.4-1.8l.9-2H4.7a.7.7 0 1 1 0-1.5h4.4v-.7c0-.4.3-.8.7-.8.4 0 .7.4.7.8v.7H15c.4 0 .8.3.8.7 0 .4-.4.8-.8.8h-1.4a12.3 12.3 0 0 1-1 2.4 13.5 13.5 0 0 1-1.7 2.3l1.9 1.8Zm4.3-3 2.7 7.3a.5.5 0 0 1-.4.7 1 1 0 0 1-1-.7l-.6-1.5h-3.4l-.6 1.5a1 1 0 0 1-1 .7.5.5 0 0 1-.4-.7l2.7-7.4a1 1 0 0 1 2 0Zm-2.2 4.4h2.4L16 12.5l-1.2 3.2Z" fill-rule="evenodd"/></svg>',typography:'<svg width="24" height="24"><path fill-rule="evenodd" clip-rule="evenodd" d="M17 5a1 1 0 1 1 0 2h-4v11a1 1 0 1 1-2 0V7H7a1 1 0 0 1 0-2h10Z"/><path d="m17.5 14 .8-1.7 1.7-.8-1.7-.8-.8-1.7-.8 1.7-1.7.8 1.7.8.8 1.7ZM7 14l1 2 2 1-2 1-1 2-1-2-2-1 2-1 1-2Z"/></svg>',underline:'<svg width="24" height="24"><path d="M16 5c.6 0 1 .4 1 1v5.5a4 4 0 0 1-.4 1.8l-1 1.4a5.3 5.3 0 0 1-5.5 1 5 5 0 0 1-1.6-1c-.5-.4-.8-.9-1.1-1.4a4 4 0 0 1-.4-1.8V6c0-.6.4-1 1-1s1 .4 1 1v5.5c0 .3 0 .6.2 1l.6.7a3.3 3.3 0 0 0 2.2.8 3.4 3.4 0 0 0 2.2-.8c.3-.2.4-.5.6-.8l.2-.9V6c0-.6.4-1 1-1ZM8 17h8c.6 0 1 .4 1 1s-.4 1-1 1H8a1 1 0 0 1 0-2Z" fill-rule="evenodd"/></svg>',undo:'<svg width="24" height="24"><path d="M6.4 8H12c3.7 0 6.2 2 6.8 5.1.6 2.7-.4 5.6-2.3 6.8a1 1 0 0 1-1-1.8c1.1-.6 1.8-2.7 1.4-4.6-.5-2.1-2.1-3.5-4.9-3.5H6.4l3.3 3.3a1 1 0 1 1-1.4 1.4l-5-5a1 1 0 0 1 0-1.4l5-5a1 1 0 0 1 1.4 1.4L6.4 8Z" fill-rule="nonzero"/></svg>',unlink:'<svg width="24" height="24"><path d="M6.2 12.3a1 1 0 0 1 1.4 1.4l-2 2a2 2 0 1 0 2.6 2.8l4.8-4.8a1 1 0 0 0 0-1.4 1 1 0 1 1 1.4-1.3 2.9 2.9 0 0 1 0 4L9.6 20a3.9 3.9 0 0 1-5.5-5.5l2-2Zm11.6-.6a1 1 0 0 1-1.4-1.4l2.1-2a2 2 0 1 0-2.7-2.8L11 10.3a1 1 0 0 0 0 1.4A1 1 0 1 1 9.6 13a2.9 2.9 0 0 1 0-4L14.4 4a3.9 3.9 0 0 1 5.5 5.5l-2 2ZM7.6 6.3a.8.8 0 0 1-1 1.1L3.3 4.2a.7.7 0 1 1 1-1l3.2 3.1ZM5.1 8.6a.8.8 0 0 1 0 1.5H3a.8.8 0 0 1 0-1.5H5Zm5-3.5a.8.8 0 0 1-1.5 0V3a.8.8 0 0 1 1.5 0V5Zm6 11.8a.8.8 0 0 1 1-1l3.2 3.2a.8.8 0 0 1-1 1L16 17Zm-2.2 2a.8.8 0 0 1 1.5 0V21a.8.8 0 0 1-1.5 0V19Zm5-3.5a.7.7 0 1 1 0-1.5H21a.8.8 0 0 1 0 1.5H19Z" fill-rule="nonzero"/></svg>',unlock:'<svg width="24" height="24"><path d="M16 5c.8 0 1.5.3 2.1.9.6.6.9 1.3.9 2.1v3h-2V8a1 1 0 0 0-.3-.7A1 1 0 0 0 16 7h-2a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7v3h.3c.2 0 .3 0 .5.2l.2.6v7.4c0 .3 0 .4-.2.6l-.6.2H4.8c-.3 0-.4 0-.6-.2a.7.7 0 0 1-.2-.6v-7.4c0-.3 0-.4.2-.6l.5-.2H11V8c0-.8.3-1.5.9-2.1.6-.6 1.3-.9 2.1-.9h2Z" fill-rule="evenodd"/></svg>',"unordered-list":'<svg width="24" height="24"><path d="M11 5h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2Zm0 6h8c.6 0 1 .4 1 1s-.4 1-1 1h-8a1 1 0 0 1 0-2ZM4.5 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1Zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1Zm0 6c0-.4.1-.8.4-1 .3-.4.7-.5 1.1-.5.4 0 .8.1 1 .4.4.3.5.7.5 1.1 0 .4-.1.8-.4 1-.3.4-.7.5-1.1.5-.4 0-.8-.1-1-.4-.4-.3-.5-.7-.5-1.1Z" fill-rule="evenodd"/></svg>',unselected:'<svg width="24" height="24"><path fill-rule="nonzero" d="M6 4h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2Zm0 1a1 1 0 0 0-1 1v12c0 .6.4 1 1 1h12c.6 0 1-.4 1-1V6c0-.6-.4-1-1-1H6Z"/></svg>',upload:'<svg width="24" height="24"><path d="M18 19v-2a1 1 0 0 1 2 0v3c0 .6-.4 1-1 1H5a1 1 0 0 1-1-1v-3a1 1 0 0 1 2 0v2h12ZM11 6.4 8.7 8.7a1 1 0 0 1-1.4-1.4l4-4a1 1 0 0 1 1.4 0l4 4a1 1 0 1 1-1.4 1.4L13 6.4V16a1 1 0 0 1-2 0V6.4Z" fill-rule="nonzero"/></svg>',"add-file":'<svg height="24" width="24"><path d="M2 7h2V4h3V2H4a2 2 0 0 0-2 2zm20 0h-2V4h-3V2h3a2 2 0 0 1 2 2zm0 2h-2v6h2zm0 8h-2v3h-3v2h3a2 2 0 0 0 2-2zM2 9h2v6H2zm0 8h2v3h3v2H4a2 2 0 0 1-2-2zm7 5v-2h6v2zm6-20v2H9V2zM6 17h12l-4-5-3 3.8-2-2.6z"/><path d="M2 7h2V4h3V2H4a2 2 0 0 0-2 2zm20 0h-2V4h-3V2h3a2 2 0 0 1 2 2zm0 2h-2v6h2zm0 8h-2v3h-3v2h3a2 2 0 0 0 2-2zM2 9h2v6H2zm0 8h2v3h3v2H4a2 2 0 0 1-2-2zm7 5v-2h6v2zm6-20v2H9V2zM6 17h12l-4-5-3 3.8-2-2.6z"/><path d="M6 17h12l-4-5-3 3.8-2-2.6z"/><path d="M6 17h12l-4-5-3 3.8-2-2.6z"/><path d="M6 17h12l-4-5-3 3.8-2-2.6z"/><path d="M6 17h12l-4-5-3 3.8-2-2.6z"/></svg>',adjustments:'<svg width="24" height="24"><path d="M16 11a3 3 0 1 1 2.8-4H21v2h-2.2a3 3 0 0 1-2.8 2Zm0-2a1 1 0 1 1 0-2 1 1 0 0 1 0 2ZM3 9h8V7H3v2Zm5 10a3 3 0 1 0-2.8-4H3v2h2.2A3 3 0 0 0 8 19Zm0-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm13 0h-8v-2h8v2Z"/></svg>',"alt-text":'<svg width="24" height="24"><path d="M3 20a2 2 0 0 1-1.4-.6A2 2 0 0 1 1 18V6c0-.6.2-1 .6-1.4A2 2 0 0 1 3 4h18c.6 0 1 .2 1.4.6.4.4.6.9.6 1.4v12c0 .6-.2 1-.6 1.4a2 2 0 0 1-1.4.6H3Zm0-2h18V6H3v12Zm1.5-3H6v-1.5h1.5V15H9v-5a1 1 0 0 0-.3-.7A1 1 0 0 0 8 9H5.5a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7v5ZM6 12v-1.5h1.5V12H6Z"/><path d="M11 15V9h1.3v4.5h2V15H11Zm5.8-4.5V15h1.4v-4.5h1.3V9h-4v1.5h1.3Z"/></svg>',"auto-image-enhancement":'<svg width="24" height="24"><path d="M7.7 10.6a5.8 5.8 0 0 0 5.7 5.7A5.8 5.8 0 0 0 7.7 22 5.8 5.8 0 0 0 2 16.3a5.8 5.8 0 0 0 5.7-5.7ZM15.5 2c.3 3 3.3 6 6.5 6.4-3.2.5-6.2 3.4-6.5 6.5-.3-3.4-3-6-6.4-6.5 3.3-.5 6.1-3 6.4-6.4Z"/></svg>',blur:'<svg width="24" height="24"><path d="M19.3 9.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3s.5-.1.7-.3a1 1 0 0 0 .3-.7 1 1 0 0 0-.3-.7A1 1 0 0 0 20 9a1 1 0 0 0-.7.3Zm-16 0a1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3s.5-.1.7-.3A1 1 0 0 0 5 10a1 1 0 0 0-.3-.7A1 1 0 0 0 4 9a1 1 0 0 0-.7.3Zm16 6a1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3s.5-.1.7-.3a1 1 0 0 0 .3-.7 1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3Zm-16 0a1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3s.5-.1.7-.3A1 1 0 0 0 5 16a1 1 0 0 0-.3-.7A1 1 0 0 0 4 15a1 1 0 0 0-.7.3Zm5-11A1 1 0 0 0 8 5a1 1 0 0 0 1 1c.3 0 .5-.1.7-.3A1 1 0 0 0 10 5a1 1 0 0 0-.3-.7A1 1 0 0 0 9 4a1 1 0 0 0-.7.3Zm6 0a1 1 0 0 0-.3.7 1 1 0 0 0 1 1c.3 0 .5-.1.7-.3A1 1 0 0 0 16 5a1 1 0 0 0-.3-.7A1 1 0 0 0 15 4a1 1 0 0 0-.7.3Zm-6 16a1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3s.5-.1.7-.3a1 1 0 0 0 .3-.7 1 1 0 0 0-.3-.7A1 1 0 0 0 9 20a1 1 0 0 0-.7.3Zm6 0a1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3s.5-.1.7-.3a1 1 0 0 0 .3-.7 1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3ZM7.6 8.6A2 2 0 0 0 7 10c0 .6.2 1 .6 1.4.4.4.8.6 1.4.6s1-.2 1.4-.6c.4-.4.6-.8.6-1.4s-.2-1-.6-1.4A2 2 0 0 0 9 8a2 2 0 0 0-1.4.6Zm0 6A2 2 0 0 0 7 16c0 .6.2 1 .6 1.4.4.4.8.6 1.4.6s1-.2 1.4-.6c.4-.4.6-.8.6-1.4s-.2-1-.6-1.4A2 2 0 0 0 9 14a2 2 0 0 0-1.4.6Zm6-6A2 2 0 0 0 13 10c0 .6.2 1 .6 1.4.4.4.8.6 1.4.6s1-.2 1.4-.6c.4-.4.6-.8.6-1.4s-.2-1-.6-1.4A2 2 0 0 0 15 8a2 2 0 0 0-1.4.6Zm0 6A2 2 0 0 0 13 16c0 .6.2 1 .6 1.4.4.4.8.6 1.4.6s1-.2 1.4-.6c.4-.4.6-.8.6-1.4s-.2-1-.6-1.4A2 2 0 0 0 15 14a2 2 0 0 0-1.4.6Z"/></svg>',box:'<svg width="24" height="24"><path d="M3.8 7a1 1 0 0 0-.7.6l-.1 3V13.8a3.5 3.5 0 0 0 4 2.7c.8-.2 1.4-.5 2-1l.3-.3.3.2c.7.7 1.4 1 2.4 1.1 1.2 0 2.4-.6 3-1.6.9-1.2.8-2.8 0-4a3.7 3.7 0 0 0-2-1.2c-.4-.1-1.2-.1-1.6 0a3.4 3.4 0 0 0-1.7 1l-.3.2-.2-.1c-.4-.5-1.2-1-2-1.1-.6-.2-1.5 0-2 .2H5V9c0-1.3 0-1.3-.3-1.6a1 1 0 0 0-1-.3Zm12 2.6c-.3.2-.5.4-.6.8v.6l.9 1 .7 1v.1l-.8 1-.7 1a1 1 0 0 0 0 .7 1 1 0 0 0 1.3.6c.2 0 .3-.2 1-1l.5-.7.6.8.7.8c.4.3 1 .3 1.3 0l.2-.3a1 1 0 0 0 0-.8l-.8-1.2-.7-1a26 26 0 0 0 1.5-2 .8.8 0 0 0 .1-.4c0-.4-.1-.7-.5-.9H20c-.4 0-.5 0-1.2.8l-.7.8-.6-.7-.7-.9a1 1 0 0 0-1 0Zm-9 2 .4.1c.3.1.6.5.7.8l.1.6v.6c-.6 1-2 1.2-2.7.3-.3-.3-.3-.5-.3-1v-.5c.3-.5.7-.8 1.1-1a1.5 1.5 0 0 1 .7 0Zm5.7 0c.4 0 .8.4 1 .8l.2.6-.1.7c-.5.9-1.6 1.1-2.4.6a1.4 1.4 0 0 1-.6-1.1 1.4 1.4 0 0 1 .5-1.2 1.5 1.5 0 0 1 1.4-.4Z"/></svg>',camera:'<svg height="24" width="24"><g clip-rule="evenodd" fill-rule="evenodd"><path d="M10 5.4a1 1 0 0 1 .8-.4h4.4a1 1 0 0 1 .8.4l1.2 1.8h2.3A2.5 2.5 0 0 1 22 9.6v8a2.5 2.5 0 0 1-2.5 2.5h-13A2.5 2.5 0 0 1 4 17.6v-8a2.5 2.5 0 0 1 2.5-2.4h2.3zM11.4 7l-1.2 1.7a1 1 0 0 1-.8.5h-3a.5.5 0 0 0-.4.4v8a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-8a.5.5 0 0 0-.5-.4h-2.9a1 1 0 0 1-.8-.5L14.6 7z"/><path d="M13 11.4a2 2 0 1 0 0 3.8 2 2 0 0 0 0-3.8zm-4 1.9a4 4 0 1 1 8 0 4 4 0 0 1-8 0z"/></g></svg>',caption:'<svg height="24" width="24"><path d="M6 16h8v-2H6zm10 0h2v-2h-2zM4 20a2 2 0 0 1-1.5-.6A2 2 0 0 1 2 18V6c0-.6.2-1 .6-1.4A2 2 0 0 1 4 4h16c.6 0 1 .2 1.4.6.4.4.6.9.6 1.4v12c0 .6-.2 1-.6 1.4a2 2 0 0 1-1.4.6zm0-2h16V6H4z"/></svg>',dropbox:'<svg height="24" width="24"><path clip-rule="evenodd" d="m6.4 9.3-3-2a1 1 0 0 1 0-1.6l4-2.5a1 1 0 0 1 1 0L12 5.5l3.6-2.3a1 1 0 0 1 1 0l4 2.5a1 1 0 0 1 0 1.7l-3 1.9 3 1.9a1 1 0 0 1 0 1.6l-2.9 1.9V16c0 .3-.1.6-.4.8l-4.5 3a1 1 0 0 1-1.2 0l-4.4-3a1 1 0 0 1-.5-.9v-1l-3.2-2.2a1 1 0 0 1 0-1.6zm3 0L12 7.5l2.6 1.8L12 11zM8.9 15v.4l3.3 2.3 3.4-2.3v-.2L12 13l-3.1 2zm-1-10-2 1.4 2 1.3 2-1.3zm8.2 0-2 1.4 2 1.3 2-1.3zm-2 6.9 2-1.3 2 1.3-2 1.3-2-1.3zm-8.3 0 2-1.3L10 12l-2 1.3-2-1.3z" fill-rule="evenodd"/></svg>',evernote:'<svg width="24" height="24"><path fill-rule="evenodd" d="m9.5 3-.3.1-2.6 2.6C3.8 8.5 4 8.2 4 8.7c0 1.3.3 3 .6 4.3.5 2 1.1 3.2 2 3.7l1.2.3c1 .2 1.5.2 2.2.2 1.3 0 1.7 0 2.2-.4.3-.2.3-.4.4-1a38.4 38.4 0 0 1 .3-.4l.3.1 1.8.1h1.6v-1.8H14l-.1-.2a6.8 6.8 0 0 1-.5-1c-.2-.4-.3-.6-.5-.7a.8.8 0 0 0-.5-.1.9.9 0 0 0-.8.5l-.4 1.6-.3 1.5H9.4l-2-.3a1 1 0 0 1-.1-.2A10.1 10.1 0 0 1 6 9.7v-.2h4l.5-.5V5H12c.4.2.7.7.8 1.1a1 1 0 0 0 .2.6c.2.2.3.2 1 .3 1.2 0 2 .2 2.5.6.4.2.8.7 1 1.2.3 1.2.5 4 .3 6.4 0 1.8-.4 3.4-.8 4h-.7a8 8 0 0 1-.8 0c-.2 0-.3-.3-.2-.5a.5.5 0 0 1 .4-.3h.9v-1.8H16c-.7 0-.9 0-1.2.2-.9.4-1.4 1.2-1.4 2.1l.1.4.1.2a1 1 0 0 1 .1.2c.3.7.8 1.2 1.4 1.3l1.2.1h1.2a2 2 0 0 0 1-.8 9 9 0 0 0 1.1-4.3c.2-3 0-6.3-.4-7.7A4.3 4.3 0 0 0 16 5.3a7 7 0 0 0-1.3-.2 7.2 7.2 0 0 1-.4 0 5.5 5.5 0 0 1 0-.3c-.2-.5-.6-1-1.2-1.4a3 3 0 0 0-.5-.2c-.4-.2-.5-.2-1.8-.2a26.5 26.5 0 0 0-1.3 0Zm-.8 4v.7H7.2l.7-.8.8-.7v.7Zm7 3.5c-.4 0-.7.5-.9 1v.7h.3c.7 0 1.1.2 1.5.6l.3.2.3-.6V11a1 1 0 0 0-.6-.4 2 2 0 0 0-.8 0Z" clip-rule="evenodd"/></svg>',exposure:'<svg width="24" height="24"><path d="M5 21a2 2 0 0 1-1.4-.6A2 2 0 0 1 3 19V5c0-.6.2-1 .6-1.4A2 2 0 0 1 5 3h14c.6 0 1 .2 1.4.6.4.4.6.8.6 1.4v14c0 .6-.2 1-.6 1.4a2 2 0 0 1-1.4.6H5Zm0-2h14V5L5 19Zm9.5-1v-2h-2v-1.5h2v-2H16v2h2V16h-2v2h-1.5ZM6 8.5h5V7H6v1.5Z"/></svg>',fb:'<svg width="24" height="24"><path fill-rule="evenodd" d="M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-11 6.7V14H8.1v-2.5h2v-1C10 8.2 11.5 7 12.8 7H16v2.5h-2.4c-.8 0-1 .7-1 1.3v.7h3.2l-1 2.5h-2v5a7 7 0 1 0-2.8-.2Z" clip-rule="evenodd"/></svg>',flickr:'<svg width="24" height="24"><path d="M8.2 15.3c1.7 0 3.1-1.4 3.1-3.1A3.2 3.2 0 0 0 8.1 9 3.2 3.2 0 0 0 5 12.2c0 1.7 1.4 3 3.2 3Zm7.6 0c1.7 0 3.2-1.4 3.2-3.1a3.2 3.2 0 0 0-6.3 0c0 1.7 1.4 3 3.1 3Z"/></svg>',folder:'<svg width="24" height="24"><path fill-rule="evenodd" d="M5.6 6a.6.6 0 0 0-.6.6v11.2a.6.6 0 0 0 .6.6h12.8a.6.6 0 0 0 .6-.6V9a.6.6 0 0 0-.6-.6h-7.2a1 1 0 0 1-.8-.4L9 6H5.6ZM3.8 4.8A2.6 2.6 0 0 1 5.6 4h4a1 1 0 0 1 .8.4l1.3 2h6.7A2.6 2.6 0 0 1 21 9v8.8a2.6 2.6 0 0 1-2.6 2.6H5.6A2.6 2.6 0 0 1 3 17.8V6.6c0-.7.3-1.4.8-1.8Z" clip-rule="evenodd"/></svg>',"google-drive":'<svg height="24" width="24"><path clip-rule="evenodd" d="M8.7 4.5a1 1 0 0 1 .9-.5h4.8a1 1 0 0 1 .9.5l5.6 9.7a1 1 0 0 1 0 1l-2.4 4.2a1 1 0 0 1-.9.5H6.4a1 1 0 0 1-.9-.5l-2.4-4.2a1 1 0 0 1 0-1zM10.2 6l-4.5 7.7h2.5L12.7 6h-2.5zm4.2 1 4.4 7.7-1.2 2.2-4.4-7.7zM12 11.2l-1.5 2.5h3zm2.6 4.5H5.7L7 17.9h8.9l-1.3-2.2z" fill-rule="evenodd"/></svg>',"google-photos":'<svg width="24" height="24"><path fill-rule="evenodd" d="M12.4 3c-.8 0-1.4.7-1.4 1.4v3.2a5 5 0 0 0-8 4c0 .8.6 1.4 1.4 1.4h3.2a5 5 0 0 0-1 3 5 5 0 0 0 5 5c.8 0 1.4-.6 1.4-1.4v-3.2a5 5 0 0 0 8-4c0-.8-.7-1.4-1.4-1.4h-3.2a5 5 0 0 0-4-8Zm.6 8V5a3 3 0 0 1 2.4 3 3 3 0 0 1-2.4 3Zm-2 0H5a3 3 0 0 1 3-2.4 3 3 0 0 1 3 2.4Zm2 2a3 3 0 0 0 3 2.4 3 3 0 0 0 3-2.4h-6Zm-4.4 3a3 3 0 0 1 2.4-3v6a3 3 0 0 1-2.4-3Z" clip-rule="evenodd"/></svg>',grayscale:'<svg height="24" width="24"><path d="M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zm12.4 0H19v3.6zm-2.8 0h-2.2l8.6 8.6v-2.2zm-5 0H5l14 14v-2.6z" fill-rule="evenodd"/></svg>',huddle:'<svg height="24" width="24"><path d="M10.3 5.6V8h.8v-2l3.5 2 4.3-2.5L14.6 3l-4.3 2.6zM14.6 8v5.2l4.3-2.6V5.6L14.6 8zM6 13.3v2.5h.9v-2l3.4 2 4.3-2.5-4.3-2.6zm4.3 2.6V21l4.3-2.6v-5.1l-4.3 2.6z"/></svg>',"image-decorative":'<svg width="24" height="24"><path d="M12 10c.3 0 .5-.1.7-.3A1 1 0 0 0 13 9a1 1 0 0 0-.3-.7A1 1 0 0 0 12 8a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7 1 1 0 0 0 1 1Zm0 6a3 3 0 0 1-1.8-.5A3 3 0 0 1 9.1 14a2 2 0 0 0-.2 0 3 3 0 0 1-2.5-1 3 3 0 0 1-.9-2.2A3 3 0 0 1 6.2 9a3.4 3.4 0 0 1-.5-1 3 3 0 0 1-.2-1 3 3 0 0 1 1-2.2A3 3 0 0 1 8.8 4H9a3 3 0 0 1 1.1-1.4A3 3 0 0 1 12 2a3 3 0 0 1 1.8.5c.5.4.9.9 1.1 1.5h.2a3 3 0 0 1 2.5.8 3 3 0 0 1 .9 2.3c0 .3 0 .7-.2 1a2.8 2.8 0 0 1-.5.9l.5 1 .2 1a3 3 0 0 1-1 2.2 3 3 0 0 1-2.4.9 1.8 1.8 0 0 0-.2 0 3 3 0 0 1-1.1 1.4 3 3 0 0 1-1.8.5Zm0 7a8.7 8.7 0 0 1 .7-3.5 9.2 9.2 0 0 1 2-2.8 9.2 9.2 0 0 1 2.8-2A8.6 8.6 0 0 1 21 14a8.6 8.6 0 0 1-.7 3.5 9.2 9.2 0 0 1-2 2.8 9.2 9.2 0 0 1-2.8 2 8.6 8.6 0 0 1-3.5.7Zm2.5-2.5a6.8 6.8 0 0 0 2.4-1.5 6.8 6.8 0 0 0 1.7-2.6c-1 .4-1.8 1-2.6 1.7a6.8 6.8 0 0 0-1.5 2.4ZM12 23a8.6 8.6 0 0 0-.7-3.5 9.2 9.2 0 0 0-2-2.9 9.2 9.2 0 0 0-2.8-1.9A8.6 8.6 0 0 0 3 14a8.7 8.7 0 0 0 .7 3.5 9.2 9.2 0 0 0 2 2.9 9.2 9.2 0 0 0 2.8 1.9 8.6 8.6 0 0 0 3.5.7Zm-2.5-2.5A6.8 6.8 0 0 1 7.2 19a6.8 6.8 0 0 1-1.6-2.6c.9.4 1.7 1 2.5 1.7a6.8 6.8 0 0 1 1.6 2.4Zm5.9-8.4c.3 0 .5-.1.8-.4.2-.2.3-.5.3-.8 0-.2 0-.4-.2-.6a1.3 1.3 0 0 0-.5-.4l-.8-.4a3 3 0 0 1-.2.5 3.8 3.8 0 0 1-.2.5 2.5 2.5 0 0 1-.3.4 4 4 0 0 1-.4.4l.8.6a.8.8 0 0 0 .3.1h.4ZM15 8.5l.8-.4.5-.4.2-.6a1.1 1.1 0 0 0-.3-.8 1 1 0 0 0-.8-.4 1.1 1.1 0 0 0-.7.2l-.8.6.4.4.3.4a3.9 3.9 0 0 1 .4 1Zm-4-2.3a2.7 2.7 0 0 1 1-.2 2.7 2.7 0 0 1 1 .2l.2-1.1c0-.3-.1-.6-.4-.8A1.2 1.2 0 0 0 12 4c-.3 0-.6.1-.8.3-.3.2-.4.5-.3.8v1.1Zm1 7.8c.3 0 .6-.1.8-.3.3-.2.4-.5.3-.8v-1.1a2.7 2.7 0 0 1-1.1.2 2.7 2.7 0 0 1-1-.2l-.2 1.1c0 .3.1.6.4.8.2.2.5.3.8.3ZM9 8.5a3 3 0 0 1 .4-1l.3-.4.4-.4-.8-.6A.9.9 0 0 0 9 6a1.2 1.2 0 0 0-.3 0c-.4 0-.6 0-.9.3a1.1 1.1 0 0 0-.3.8c0 .2 0 .4.2.6l.5.4.9.4Zm-.3 3.6H9l.3-.2.8-.6a5.5 5.5 0 0 1-.4-.4 2.1 2.1 0 0 1-.3-.4 3.8 3.8 0 0 1-.2-.5 3 3 0 0 1-.1-.5l-1 .4-.4.4a1.1 1.1 0 0 0-.2.6c0 .3.2.6.4.8.2.2.4.4.7.4Z"/></svg>',"image-enhancements":'<svg height="24" width="24"><path d="M5.3 21a2 2 0 0 1-1.5-.6 2 2 0 0 1-.6-1.4V5c0-.6.2-1 .6-1.4A2 2 0 0 1 5.2 3H13v2H5.2v14h14v-8h2v8c0 .6-.1 1-.5 1.4a2 2 0 0 1-1.4.6z"/><path d="M11 9a4 4 0 0 0 4 4 4 4 0 0 0-4 4 4 4 0 0 0-4-4 4 4 0 0 0 4-4zm5.5-6c.2 2.1 2.2 4.1 4.5 4.5-2.3.4-4.3 2.4-4.5 4.5A5.2 5.2 0 0 0 12 7.5 5.2 5.2 0 0 0 16.5 3z"/></svg>',instagram:'<svg height="24" width="24"><path clip-rule="evenodd" d="M10.1 9a4 4 0 1 1 4.4 6.6A4 4 0 0 1 10.1 9zm2.2 1.3a2 2 0 1 0 0 4 2 2 0 0 0 0-4z" fill-rule="evenodd"/><path d="M16 9.3a1.3 1.3 0 1 0 0-2.6 1.3 1.3 0 0 0 0 2.6z"/><path clip-rule="evenodd" d="M3 6a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v12a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3zm3-1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1z" fill-rule="evenodd"/></svg>',onedrive:'<svg height="24" width="24"><path d="M4 13.7h1zm16 .7h-1zm-11.7-4A4.4 4.4 0 0 1 12.1 8V6a6.4 6.4 0 0 0-5.6 3.4l1.8 1zM12.1 8c2 0 3.6 1.4 4 2.8l2-.5A6.3 6.3 0 0 0 12 6v2zm8.1 6.8-9.8-5.5-1 1.8 9.8 5.5 1-1.8zm-9.8-5.5A5 5 0 0 0 3 13.7h2A3 3 0 0 1 9.5 11l1-1.8zM3 13.7a5 5 0 0 0 1 2.8l1.5-1.1a3 3 0 0 1-.5-1.7zm15.8 1.6a2.3 2.3 0 0 1-2 1.4v2a4.3 4.3 0 0 0 3.9-2.6zm-2 1.4H8v2h8.7zm-8.8 0a3 3 0 0 1-2.5-1.3L4 16.5a5 5 0 0 0 4 2.2v-2zm12.7-.6c.2-.6.3-1.1.3-1.7h-2c0 .3 0 .6-.2.9zm.3-1.7c0-3-3.1-5.1-6-4l.8 1.9a2.3 2.3 0 0 1 3.2 2h2zm-6-4L4.4 15l.8 1.9 10.7-4.6-.7-1.8z"/></svg>',"photo-filter":'<svg height="24" width="24"><path d="M4.4 21c-.3 0-.6-.2-.9-.5-.3-.3-.4-.6-.5-.9L19.6 3c.3 0 .6.3.9.5l.5.9zM3 14.7v-2.8L11.9 3h2.8zM3 7V5c0-.6.2-1 .6-1.4A2 2 0 0 1 5 3h2zm14 14 4-4v2c0 .6-.2 1-.6 1.4a2 2 0 0 1-1.4.6zm-7.7 0L21 9.3v2.8L12 21z"/></svg>',"revert-changes":'<svg height="24" width="24"><path d="m8.9 18.8.4 3.2H13v-2h-2v-2.6a4.6 4.6 0 0 1-1.6-.6 5.9 5.9 0 0 1-1.3-1l-2.5 1-1-1.7 2.2-1.6a4 4 0 0 1-.2-.7 5.9 5.9 0 0 1 0-.8v-.8l.2-.8-2.2-1.6 1-1.7 2.5 1a6 6 0 0 1 1.2-.9l1.4-.6.4-2.6h2l.3 2.6A5.6 5.6 0 0 1 16 8.2l2.5-1 1 1.6-2.2 1.7.2.7v.8a5 5 0 0 1 0 1h2a2.6 2.6 0 0 0 0-.5V11.3l2.6-2-2.8-4.7-3 1.3a8.2 8.2 0 0 0-.5-.4 3.8 3.8 0 0 0-.6-.3L14.8 2H9.3l-.4 3.2a5 5 0 0 0-1.2.7l-3-1.3L2 9.4l2.6 2V12.6l-2.6 2 2.7 4.7 3-1.3a8 8 0 0 0 1.2.7z"/><path d="m14.5 20.3 2.1-2-2.1-2.2 1.4-1.4 2.1 2.1 2.1-2 1.4 1.3-2 2.1 2 2.1-1.4 1.4-2.1-2-2.1 2zM12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></svg>',saturation:'<svg width="24" height="24"><path fill-rule="evenodd" d="M12 20.5a6 6 0 1 1-5.9-10.2 6 6 0 1 1 11.8 0A6 6 0 1 1 12 20.5Zm-1.1-7.7a6 6 0 0 0-.2.3 4.3 4.3 0 0 1-2-1.3c.9.1 1.6.5 2.2 1Zm2.4.3a6 6 0 0 0-.2-.3 4.3 4.3 0 0 1 2.2-1 4.3 4.3 0 0 1-2 1.3ZM12.2 15a6.3 6.3 0 0 1-.4 0 4.3 4.3 0 0 0 .2 2.5 4.3 4.3 0 0 0 .2-2.5Zm.9 4.2a6 6 0 0 0 .8-4.5 6 6 0 0 0 3.4-2.8 4.3 4.3 0 0 1-1.3 8.4 4.3 4.3 0 0 1-2.9-1.1Zm-2.2 0a4.3 4.3 0 1 1-4.2-7.3 6 6 0 0 0 3.4 2.8 6 6 0 0 0 .8 4.5Zm-3-9.2a4.3 4.3 0 1 1 8.3 0 6 6 0 0 0-4.2 1.5A6 6 0 0 0 7.8 10Z"/></svg>',"transform-image":'<svg height="24" width="24"><path d="M3 21v-6h2V9H3V3h6v2h6V3h6v6h-2v6h2v6h-6v-2H9v2zm6-4h6v-2h2V9h-2V7H9v2H7v6h2zM5 7h2V5H5zm12 0h2V5h-2zm0 12h2v-2h-2zM5 19h2v-2H5z"/></svg>',vibrance:'<svg height="24" width="24"><path d="M12 20 22 4H2zm2.6-8 1.3-2H8l1.3 2h5.2zm-1.2 2h-2.8l1.4 2.2zm5-8L17 8H7L5.6 6h12.8z" fill-rule="evenodd"/></svg>',vk:'<svg width="24" height="24"><path fill-rule="evenodd" d="M14.8 17.4a2 2 0 0 1-1.3.7 8 8 0 0 1-7.7-3.6c-1.4-2-2.2-4.4-2.6-5.7L3 8.6A2 2 0 0 1 5 6h2.5c.4 0 .8.1 1.2.4A2 2 0 0 1 9.8 6h3.5a2 2 0 0 1 1.4.6 2 2 0 0 1 1.5-.6h2.4a2 2 0 0 1 2 2.5c-.5 1.5-1.2 2.6-1.8 3.6a12.5 12.5 0 0 1 2 3.2A2 2 0 0 1 19 18h-2.6a2 2 0 0 1-1.3-.5 6.9 6.9 0 0 1-.3-.2Zm.5-2.5-1.2-1a3 3 0 0 0-.8-.2v2.4h-1.7a5.6 5.6 0 0 1-.3 0c-3-.7-4.7-3.7-5.6-6.1A38.1 38.1 0 0 1 5 8.1V8h2.5a80.5 80.5 0 0 1 1.2 2.5c.6 1.2 1.2 2 2 2.1V9l-.9-1h3.5v4.1a5 5 0 0 0 .4-.3c.7-.7 1.2-1.4 1.6-2.2l.2-.3.7-1.3h2.4a8.5 8.5 0 0 1-.8 2l-1.3 2-.3.3a10.5 10.5 0 0 1 2.8 3.8h-2.6l-.8-.9a20.6 20.6 0 0 0-.3-.3Z" clip-rule="evenodd"/></svg>',warmth:'<svg height="24" width="24"><path d="M12 21.1c-1.4 0-2.6-.5-3.6-1.5s-1.5-2.1-1.5-3.5c0-.8.2-1.6.6-2.2A5 5 0 0 1 8.9 12v-6c0-.8.3-1.5 1-2.1a2.9 2.9 0 0 1 2-.9c.9 0 1.6.3 2.2.9.5.6.8 1.3.8 2.1v6a5 5 0 0 1 1.5 1.8A4.9 4.9 0 0 1 17 16c0 1.4-.5 2.6-1.4 3.5s-2.2 1.5-3.6 1.5zm-3-5h6c0-.5-.2-1-.4-1.4a3 3 0 0 0-.9-1l-.8-.6v-7a1 1 0 0 0-.3-.7A1 1 0 0 0 12 5a1 1 0 0 0-.7.3 1 1 0 0 0-.3.7v7l-.8.6a2.9 2.9 0 0 0-.9 1 3 3 0 0 0-.3 1.4z"/></svg>',user:'<svg width="24" height="24"><path d="M12 24a12 12 0 1 1 0-24 12 12 0 0 1 0 24Zm-8.7-5.3a11 11 0 0 0 17.4 0C19.4 16.3 14.6 15 12 15c-2.6 0-7.4 1.3-8.7 3.7ZM12 13c2.2 0 4-2 4-4.5S14.2 4 12 4 8 6 8 8.5 9.8 13 12 13Z" fill-rule="nonzero"/></svg>',"vertical-align":'<svg width="24" height="24"><g fill-rule="nonzero"><rect width="18" height="2" x="3" y="11" rx="1"/><path d="M12 2c.6 0 1 .4 1 1v4l2-1.3a1 1 0 0 1 1.2 1.5l-.1.1-4.1 3-4-3a1 1 0 0 1 1-1.7l2 1.5V3c0-.6.4-1 1-1zm0 11.8 4 2.9a1 1 0 0 1-1 1.7l-2-1.5V21c0 .5-.4 1-.9 1H12a1 1 0 0 1-1-1v-4l-2 1.3a1 1 0 0 1-1.2-.1l-.1-.1a1 1 0 0 1 .1-1.3l.1-.1 4.1-3z"/></g></svg>',visualblocks:'<svg width="24" height="24"><path d="M9 19v2H7v-2h2Zm-4 0v2a2 2 0 0 1-2-2h2Zm8 0v2h-2v-2h2Zm8 0a2 2 0 0 1-2 2v-2h2Zm-4 0v2h-2v-2h2ZM15 7a1 1 0 0 1 0 2v7a1 1 0 0 1-2 0V9h-1v7a1 1 0 0 1-2 0v-4a2.5 2.5 0 0 1-.2-5H15ZM5 15v2H3v-2h2Zm16 0v2h-2v-2h2ZM5 11v2H3v-2h2Zm16 0v2h-2v-2h2ZM5 7v2H3V7h2Zm16 0v2h-2V7h2ZM5 3v2H3c0-1.1.9-2 2-2Zm8 0v2h-2V3h2Zm6 0a2 2 0 0 1 2 2h-2V3ZM9 3v2H7V3h2Zm8 0v2h-2V3h2Z" fill-rule="evenodd"/></svg>',visualchars:'<svg width="24" height="24"><path d="M10 5h7a1 1 0 0 1 0 2h-1v11a1 1 0 0 1-2 0V7h-2v11a1 1 0 0 1-2 0v-6c-.5 0-1 0-1.4-.3A3.4 3.4 0 0 1 6.8 10a3.3 3.3 0 0 1 0-2.8 3.4 3.4 0 0 1 1.8-1.8L10 5Z" fill-rule="evenodd"/></svg>',warning:'<svg width="24" height="24"><path d="M19.8 18.3c.2.5.3.9 0 1.2-.1.3-.5.5-1 .5H5.2c-.5 0-.9-.2-1-.5-.3-.3-.2-.7 0-1.2L11 4.7l.5-.5.5-.2c.2 0 .3 0 .5.2.2 0 .3.3.5.5l6.8 13.6ZM12 18c.3 0 .5-.1.7-.3.2-.2.3-.4.3-.7a1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7c0 .3.1.5.3.7.2.2.4.3.7.3Zm.7-3 .3-4a1 1 0 0 0-.3-.7 1 1 0 0 0-.7-.3 1 1 0 0 0-.7.3 1 1 0 0 0-.3.7l.3 4h1.4Z" fill-rule="evenodd"/></svg>',"zoom-in":'<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3Zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12Zm-1-9a1 1 0 0 1 2 0v6a1 1 0 0 1-2 0V8Zm-2 4a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2H8Z" fill-rule="nonzero"/></svg>',"zoom-out":'<svg width="24" height="24"><path d="M16 17.3a8 8 0 1 1 1.4-1.4l4.3 4.4a1 1 0 0 1-1.4 1.4l-4.4-4.3Zm-5-.3a6 6 0 1 0 0-12 6 6 0 0 0 0 12Zm-3-5a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2H8Z" fill-rule="nonzero"/></svg>'}}),J.TextEditorBehavior=v().Behavior.extend({defaults:{selector:".mailpoet_content",toolbar1:"bold italic link unlink forecolor mailpoet_shortcodes",toolbar2:"",validElements:"p[class|style],span[class|style],a[href|class|title|target|style],strong[class|style],em[class|style],strike,br,del",invalidElements:"script",blockFormats:"Paragraph=p",plugins:"link mailpoet_shortcodes",configurationFilter:e=>e},initialize:function(){this.listenTo(C.getChannel(),"dragStart",this.hideEditor)},hideEditor:function(){this.tinymceEditor&&this.tinymceEditor.fire("blur")},onDomRefresh:async function(){!0!==this.view.disableTextEditor&&(oe().PluginManager.add("mailpoet_shortcodes",ne),await oe().init(this.options.configurationFilter({target:this.el.querySelector(this.options.selector),inline:!0,contextmenu:!1,license_key:"gpl",menubar:!1,toolbar1:this.options.toolbar1,toolbar2:this.options.toolbar2,browser_spellcheck:!0,valid_elements:this.options.validElements,invalid_elements:this.options.invalidElements,block_formats:this.options.blockFormats,relative_urls:!1,remove_script_host:!1,convert_urls:!0,urlconverter_callback:function(e){return e.match(/\[.+\]/g)?e:this.documentBaseURI.toAbsolute(e,this.options.get("remove_script_host")).replace("&amp;","&")},plugins:this.options.plugins,setup:e=>{this.tinymceEditor=e,e.on("change",()=>{this.view.triggerMethod("text:editor:change",e.getContent())}),e.on("click",t=>{C.getDisplayedSettingsId()&&C.getChannel().trigger("hideSettings"),document.activeElement!==e.targetElm&&e.selection.placeCaretAt(t.clientX,t.clientY)}),e.on("focus",()=>{this.view.triggerMethod("text:editor:focus")}),e.on("blur",()=>{this.view.triggerMethod("text:editor:blur")})}})))}}),J.WooCommerceStylesBehavior=v().Behavior.extend({events:function(){return{"change #mailpoet_wc_branding_color":function(e){let t;const o=e.target.value,n=this.wcHexIsLight(o)?"#202020":"#ffffff";t=this.wcHexIsLight(this.view.model.get("wrapper.backgroundColor"))?this.wcHexIsLight(o)?n:o:this.wcHexIsLight(o)?o:n,this.view.model.set("woocommerce.brandingColor",o),this.view.model.set("woocommerce.headingFontColor",n),this.view.model.set("link.fontColor",t)},"change #mailpoet_wc_heading_font_family":function(e){this.view.model.set("woocommerce.headingFontFamily",e.target.value)},"change #mailpoet_wc_content_heading_font_color":function(e){this.view.model.set("woocommerce.contentHeadingFontColor",e.target.value)}}},wcHexIsLight:function(e){const t=e.replace("#","");return(299*parseInt(t.substr(0,2),16)+587*parseInt(t.substr(2,2),16)+114*parseInt(t.substr(4,2),16))/1e3>155}});var re=o(68665),ie=(o(12137),{}),se=v().View.extend({});ie.BlockModel=k.extend({stale:[],initialize:function(){this.on("change",function(){this._updateDefaults(),C.getChannel().trigger("autoSave")})},_getDefaults:function(e,t){var o;return o=c.default.isObject(t)&&c.default.isFunction(t.toJSON)?t.toJSON():t,JSON.parse(JSON.stringify(x().extend(e,o||{})))},_updateDefaults:function(){var e=this.get("context")||this.get("type");C.getConfig().set("blockDefaults."+e,this.toJSON())},toJSON:function(){return c.default.omit(k.prototype.toJSON.call(this),this.stale)},getChildren:function(){return[]}}),ie.BlockView=se.extend({regions:{toolsRegion:"> .mailpoet_tools"},modelEvents:{change:"render",delete:"deleteBlock",duplicate:"duplicateBlock"},behaviors:{DraggableBehavior:{cloneOriginal:!0,hideOriginal:!0,onDrop:function(e){C.getChannel().trigger("hideSettings"),e.dragBehavior.view.model.destroy()},onDragSubstituteBy:function(e){var t,o;if(c.default.isFunction(e.view.onDragSubstituteBy))return(t=new(e.view.onDragSubstituteBy())).render(),o=t.$el.get(0).cloneNode(!0),t.destroy(),o}},HighlightEditingBehavior:{}},templateContext:function(){return{model:this.model.toJSON(),viewCid:this.cid}},constructor:function(){se.apply(this,arguments),this.$el.addClass("mailpoet_editor_view_"+this.cid)},initialize:function(){this.on("showSettings",this.showSettings,this)},addHighlight:function(){this.$el.addClass("mailpoet_highlight"),this.showingToolsDisabled||(this.$("> .mailpoet_tools").addClass("mailpoet_display_tools"),this.toolsView.triggerMethod("showTools"))},removeHighlight:function(){this.$el.removeClass("mailpoet_highlight"),this.hideTools()},hideTools:function(){this.$("> .mailpoet_tools").removeClass("mailpoet_display_tools"),this.toolsView.triggerMethod("hideTools")},enableShowingTools:function(){this.showingToolsDisabled=!1},disableShowingTools:function(){this.showingToolsDisabled=!0,this.hideTools()},showSettings:function(e){this.toolsView.triggerMethod("showSettings",e)},getDropFunc:function(){return function(){return this.model.clone()}.bind(this)},disableDragging:function(){this.$el.addClass("mailpoet_ignore_drag")},enableDragging:function(){this.$el.removeClass("mailpoet_ignore_drag")},deleteBlock:function(){this.transitionOut().then(function(){this.model.destroy()}.bind(this))},duplicateBlock:function(){this.model.collection.add(this.model.toJSON(),{at:this.model.collection.findIndex(this.model)})},transitionOut:function(){return this._transition("slideUp","fadeOut","easeIn")},_transition:function(e,t,o){var n=x().Deferred();return this.$el.velocity(e,{duration:250,easing:o,complete:function(){n.resolve()}}).velocity(t,{duration:250,easing:o,queue:!1}),n}}),ie.BlockToolsView=se.extend({getTemplate:function(){return window.templates.genericBlockTools},events:{"click .mailpoet_edit_block":"toggleSettings","click .mailpoet_delete_block_activate":"showDeletionConfirmation","click .mailpoet_delete_block_cancel":"hideDeletionConfirmation","click .mailpoet_delete_block_confirm":"deleteBlock","click .mailpoet_duplicate_block":"duplicateBlock"},tools:{settings:!0,delete:!0,duplicate:!0,move:!0},getSettingsView:function(){return ie.BlockSettingsView},initialize:function(e){var t=e||{};c.default.isUndefined(t.tools)||(this.tools=x().extend({},this.tools,t.tools||{})),this.on("hideTools",this.hideDeletionConfirmation,this),this.on("showSettings",this.changeSettings)},templateContext:function(){return{model:this.model.toJSON(),viewCid:this.cid,tools:this.tools}},toggleSettings:function(){C.getDisplayedSettingsId()!==this.model.cid?this.changeSettings():C.getChannel().trigger("hideSettings")},changeSettings:function(e){var t=this.getSettingsView(),o=C.getDisplayedSettingsId();if(o){if(o===this.model.cid)return;C.getChannel().trigger("hideSettings")}else document.activeElement.blur(),C.getChannel().trigger("settingsDisplayed",this.model.cid),new t(c.default.extend({model:this.model},e||{})).render()},showDeletionConfirmation:function(){this.$(".mailpoet_delete_block").closest(".mailpoet_block").find("> .mailpoet_block_highlight").css({background:"#E64047",opacity:.5}),this.$(".mailpoet_delete_block").addClass("mailpoet_delete_block_activated")},hideDeletionConfirmation:function(){this.$(".mailpoet_delete_block").closest(".mailpoet_block").find("> .mailpoet_block_highlight").css({background:"transparent",opacity:1}),this.$(".mailpoet_delete_block").removeClass("mailpoet_delete_block_activated")},deleteBlock:function(e){return e.preventDefault(),this.model.trigger("delete"),C.getChannel().trigger("hideSettings"),!1},duplicateBlock:function(e){return e.preventDefault(),this.model.trigger("duplicate"),C.getChannel().trigger("hideSettings"),!1}}),ie.BlockSettingsView=v().View.extend({className:"mailpoet_editor_settings",behaviors:{ColorPickerBehavior:{}},initialize:function(e){var t;this.model.trigger("startEditing"),t={element:this.$el,template:"",position:"right",overlayRender:!1,width:C.getConfig().get("sidepanelWidth"),onCancel:function(){this.destroy()}.bind(this)},this.renderOptions=e.renderOptions||{},"subpanel"===this.renderOptions.displayFormat?r.U.Modal.subpanel(t):r.U.Modal.panel(t),this.listenTo(C.getChannel(),"hideSettings",this.close)},templateContext:function(){return{model:this.model.toJSON()}},close:function(){this.destroy()},changeField:function(e,t){this.model.set(e,x()(t.target).val())},changeUrlField:function(e,t){const o=x()(t.target).val().trim(),n=o.startsWith("[")?o:(0,re.i)(o);x()(t.target).val(n),this.model.set(e,n)},changePixelField:function(e,t){this.changeFieldWithSuffix(e,t,"px")},changeFieldWithSuffix:function(e,t,o){this.model.set(e,x()(t.target).val()+o)},changeBoolField:function(e,t){this.model.set(e,"true"===x()(t.target).val())},changeBoolCheckboxField:function(e,t){this.model.set(e,!!x()(t.target).prop("checked"))},changeColorField:function(e,t){var o=x()(t.target).val();""===o&&(o="transparent"),this.model.set(e,o)},onBeforeDestroy:function(){r.U.Modal.close(),this.model.trigger("stopEditing"),C.getChannel().trigger("settingsDisplayed",null)}}),ie.WidgetView=v().View.extend({className:"mailpoet_widget mailpoet_droppable_block mailpoet_droppable_widget",behaviors:{DraggableBehavior:{drop:function(){throw new Error("Unsupported operation")}}}});var ae,le={},ce=ie;ae=O().Collection.extend({model:ce.BlockModel,initialize:function(){this.on("add change remove",function(){C.getChannel().trigger("autoSave")})},parse:function(e){return c.default.map(e,function(e){return new(C.getBlockTypeModel(e.type))(e,{parse:!0})})}}),le.ContainerBlockModel=ce.BlockModel.extend({relations:{blocks:ae},defaults:function(){return this._getDefaults({type:"container",columnLayout:!1,orientation:"vertical",image:{src:null,display:"scale"},styles:{block:{backgroundColor:"transparent"}},blocks:new ae},C.getConfig().get("blockDefaults.container"))},_updateDefaults:function(){},validate:function(){var e=this.get("blocks").find(function(e){return!e.isValid()});if(e)return e.validationError},parse:function(e){return"container"===e.type&&c.default.has(e,"blocks")&&e.blocks.constructor===Array&&(e.blocks=new ae(e.blocks,{parse:!0})),e},getChildren:function(){var e=this.get("blocks").map(function(e){return[e,e.getChildren()]});return c.default.flatten(e)}}),le.ContainerBlocksView=v().CollectionView.extend({className:"mailpoet_container",events:{click:"removeFocusFromAnyActiveElement"},childView:function(e){return C.getBlockTypeView(e.get("type"))},childViewOptions:function(){var e=c.default.clone(this.renderOptions);return void 0!==e.depth&&(e.depth+=1),{renderOptions:e}},emptyView:function(){return le.ContainerBlockEmptyView},emptyViewOptions:function(){return{renderOptions:this.renderOptions}},initialize:function(e){this.renderOptions=e.renderOptions},onChildviewResizeStart:function(){this.triggerMethod("resizeStart")},onChildviewResizeStop:function(e){this.triggerMethod("resizeStop",e)},removeFocusFromAnyActiveElement:function(e){var t;e&&e.target&&(t=e.target.getAttribute("class"))&&-1!==t.indexOf("mailpoet_container_horizontal")&&document.activeElement.blur()}}),le.ContainerBlockView=ce.BlockView.extend({regions:c.default.extend({},ce.BlockView.prototype.regions,{blocks:{el:"> .mailpoet_container",replaceElement:!0}}),className:"mailpoet_block mailpoet_container_block mailpoet_droppable_block mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.containerBlock},events:c.default.extend({},ce.BlockView.prototype.events,{"click .mailpoet_newsletter_layer_selector":"toggleEditingLayer"}),ui:{tools:"> .mailpoet_tools"},behaviors:c.default.extend({},ce.BlockView.prototype.behaviors,{ContainerDropZoneBehavior:{},DraggableBehavior:{cloneOriginal:!0,hideOriginal:!0,onDrop:function(e){e.dragBehavior.view.model.destroy()},onDragSubstituteBy:function(e){var t,o;if(c.default.isFunction(e.view.onDragSubstituteBy))return(t=new(e.view.onDragSubstituteBy())).render(),o=t.$el.get(0).cloneNode(!0),t.destroy(),o},testAttachToInstance:function(e,t){return 1===t.renderOptions.depth}},HighlightEditingBehavior:{}}),onDragSubstituteBy:function(){if(1===this.renderOptions.depth){if(3===this.model.get("blocks").length)return le.ThreeColumnContainerWidgetView;if(2===this.model.get("blocks").length)return le.TwoColumnContainerWidgetView}return le.OneColumnContainerWidgetView},initialize:function(e){ce.BlockView.prototype.initialize.apply(this,arguments),this.renderOptions=c.default.defaults(e.renderOptions||{},{})},onRender:function(){var e,t="";this.toolsView=new le.ContainerBlockToolsView({model:this.model,tools:{settings:1===this.renderOptions.depth,delete:1===this.renderOptions.depth,duplicate:!0,move:1===this.renderOptions.depth,layerSelector:!1}}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("blocks",new le.ContainerBlocksView({collection:this.model.get("blocks"),renderOptions:this.renderOptions})),"string"==typeof(e=this.model.get("columnLayout"))&&(t="mailpoet_irregular_width_contents_container column_layout_"+e),this.$("> .mailpoet_container").attr("class","mailpoet_container mailpoet_container_"+this.model.get("orientation")+" "+t)},addHighlight:function(){1!==this.renderOptions.depth||this.$el.hasClass("mailpoet_container_layer_active")||(this.$(this.ui.tools).addClass("mailpoet_display_tools"),this.$el.addClass("mailpoet_highlight"),this.toolsView.triggerMethod("showTools"))},removeHighlight:function(){1!==this.renderOptions.depth||this.$el.hasClass("mailpoet_container_layer_active")||(this.$(this.ui.tools).removeClass("mailpoet_display_tools"),this.$el.removeClass("mailpoet_highlight"),this.toolsView.triggerMethod("hideTools"))},toggleEditingLayer:function(e){var t=this,o=this.$("> .mailpoet_tools .mailpoet_newsletter_layer_selector"),n=x()(".mailpoet_layer_overlay"),r=this.$("> .mailpoet_container"),i=function(){t.$el.removeClass("mailpoet_container_layer_active"),o.removeClass("mailpoet_container_layer_active"),r.removeClass("mailpoet_layer_highlight"),n.hide(),n.off("click")};o.hasClass("mailpoet_container_layer_active")?i():(t.$el.addClass("mailpoet_container_layer_active"),o.addClass("mailpoet_container_layer_active"),r.addClass("mailpoet_layer_highlight"),n.on("click",i),n.show()),e.stopPropagation()}}),le.ContainerBlockEmptyView=v().View.extend({getTemplate:function(){return window.templates.containerEmpty},initialize:function(e){this.renderOptions=c.default.defaults(e.renderOptions||{},{})},templateContext:function(){return{isRoot:0===this.renderOptions.depth,emptyContainerMessage:this.renderOptions.emptyContainerMessage||""}}}),le.ContainerBlockToolsView=ce.BlockToolsView.extend({getSettingsView:function(){return le.ContainerBlockSettingsView}}),le.ContainerBlockSettingsView=ce.BlockSettingsView.extend({behaviors:c.default.extend({},ce.BlockSettingsView.prototype.behaviors,{MediaManagerBehavior:{onSelect:"onImageSelect"}}),getTemplate:function(){return window.templates.containerBlockSettings},events:function(){return{"change .mailpoet_field_container_background_color":c.default.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_done_editing":"close","change .mailpoet_field_display_type":"changeDisplayType"}},initialize:function(){ce.BlockSettingsView.prototype.initialize.apply(this,arguments),this.model.trigger("startEditing"),this._columnsSettingsView=new le.ContainerBlockColumnsSettingsView({collection:this.model.get("blocks")})},changeDisplayType:function(e){this.model.get("image").set("display",e.target.value),this.model.trigger("change")},onImageSelect:function(e){this.model.set("image.src",e.src),this.model.trigger("change"),this.render()}}),le.ContainerBlockColumnsSettingsView=v().CollectionView.extend({childView:function(){return le.ContainerBlockColumnSettingsView},childViewOptions:function(e,t){return{columnIndex:t}}}),le.ContainerBlockColumnSettingsView=v().View.extend({getTemplate:function(){return window.templates.containerBlockColumnSettings},initialize:function(e){this.columnNumber=(e.columnIndex||0)+1},templateContext:function(){return{model:this.model.toJSON(),columnNumber:this.columnNumber}}}),le.OneColumnContainerWidgetView=ce.WidgetView.extend({className:ce.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.oneColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new le.ContainerBlockModel({orientation:"horizontal",blocks:[new le.ContainerBlockModel]})}}}}),le.TwoColumnContainerWidgetView=ce.WidgetView.extend({className:ce.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new le.ContainerBlockModel({orientation:"horizontal",blocks:[new le.ContainerBlockModel,new le.ContainerBlockModel]})}}}}),le.ThreeColumnContainerWidgetView=ce.WidgetView.extend({className:ce.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.threeColumnLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new le.ContainerBlockModel({orientation:"horizontal",blocks:[new le.ContainerBlockModel,new le.ContainerBlockModel,new le.ContainerBlockModel]})}}}}),le.TwoColumn12ContainerWidgetView=ce.WidgetView.extend({className:ce.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumn12LayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){var e=new le.ContainerBlockModel({orientation:"horizontal",blocks:[new le.ContainerBlockModel,new le.ContainerBlockModel]});return e.set("columnLayout","1_2"),e}}}}),le.TwoColumn21ContainerWidgetView=ce.WidgetView.extend({className:ce.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.twoColumn21LayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){var e=new le.ContainerBlockModel({orientation:"horizontal",blocks:[new le.ContainerBlockModel,new le.ContainerBlockModel]});return e.set("columnLayout","2_1"),e}}}}),C.on("before:start",function(e){e.registerBlockType("container",{blockModel:le.ContainerBlockModel,blockView:le.ContainerBlockView}),e.registerLayoutWidget({name:"oneColumnLayout",priority:100,widgetView:le.OneColumnContainerWidgetView}),e.registerLayoutWidget({name:"twoColumnLayout",priority:100,widgetView:le.TwoColumnContainerWidgetView}),e.registerLayoutWidget({name:"threeColumnLayout",priority:100,widgetView:le.ThreeColumnContainerWidgetView}),e.registerLayoutWidget({name:"twoColumn12Layout",priority:100,widgetView:le.TwoColumn12ContainerWidgetView}),e.registerLayoutWidget({name:"twoColumn21Layout",priority:100,widgetView:le.TwoColumn21ContainerWidgetView})});var de={},ue=ie;de.ButtonBlockModel=ue.BlockModel.extend({defaults:function(){return this._getDefaults({type:"button",text:"Button",url:"",styles:{block:{backgroundColor:"#ff0000",borderColor:"#cccccc",borderWidth:"1px",borderRadius:"4px",borderStyle:"solid",width:"200px",lineHeight:"40px",fontColor:"#000000",fontFamily:"Arial",fontSize:"16px",fontWeight:"normal",textAlign:"center"}}},C.getConfig().get("blockDefaults.button"))}}),de.ButtonBlockView=ue.BlockView.extend({className:"mailpoet_block mailpoet_button_block mailpoet_droppable_block",getTemplate:function(){return window.templates.buttonBlock},onDragSubstituteBy:function(){return de.ButtonWidgetView},behaviors:c.default.extend({},ue.BlockView.prototype.behaviors,{ShowSettingsBehavior:{}}),initialize:function(){ue.BlockView.prototype.initialize.apply(this,arguments),this._replaceButtonStylesHandler=function(e){this.model.set(e)}.bind(this),C.getChannel().on("replaceAllButtonStyles",this._replaceButtonStylesHandler)},onRender:function(){this.toolsView=new de.ButtonBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)}}),de.ButtonBlockToolsView=ue.BlockToolsView.extend({getSettingsView:function(){return de.ButtonBlockSettingsView}}),de.ButtonBlockSettingsView=ue.BlockSettingsView.extend({getTemplate:function(){return window.templates.buttonBlockSettings},events:function(){return{"input .mailpoet_field_button_text":c.default.partial(this.changeField,"text"),"change .mailpoet_field_button_url":c.default.partial(this.changeUrlField,"url"),"change .mailpoet_field_button_alignment":c.default.partial(this.changeField,"styles.block.textAlign"),"change .mailpoet_field_button_font_color":c.default.partial(this.changeColorField,"styles.block.fontColor"),"change .mailpoet_field_button_font_family":c.default.partial(this.changeField,"styles.block.fontFamily"),"change .mailpoet_field_button_font_size":c.default.partial(this.changeField,"styles.block.fontSize"),"change .mailpoet_field_button_background_color":c.default.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_button_border_color":c.default.partial(this.changeColorField,"styles.block.borderColor"),"change .mailpoet_field_button_font_weight":"changeFontWeight","input .mailpoet_field_button_border_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_border_width_input",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_button_border_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_border_width_input",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_button_border_width_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_border_width",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_button_border_radius":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius_input",c.default.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"change .mailpoet_field_button_border_radius":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius_input",c.default.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_button_border_radius_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_border_radius",c.default.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_button_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_width_input",c.default.partial(this.changePixelField,"styles.block.width").bind(this)),"change .mailpoet_field_button_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_width_input",c.default.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_button_width_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_width",c.default.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_button_line_height":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_line_height_input",c.default.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"change .mailpoet_field_button_line_height":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_line_height_input",c.default.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"input .mailpoet_field_button_line_height_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_button_line_height",c.default.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"click .mailpoet_field_button_replace_all_styles":"applyToAll","click .mailpoet_done_editing":"close"}},templateContext:function(){return c.default.extend({},ue.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON(),renderOptions:this.renderOptions})},applyToAll:function(){C.getChannel().trigger("replaceAllButtonStyles",c.default.pick(this.model.toJSON(),"styles","type"))},updateValueAndCall:function(e,t,o){this.$(e).val(x()(o.target).val()),t(o)},changeFontWeight:function(e){var t=!!x()(e.target).prop("checked");this.model.set("styles.block.fontWeight",t?x()(e.target).val():"normal")}}),de.ButtonWidgetView=ue.WidgetView.extend({id:"automation_editor_block_button",getTemplate:function(){return window.templates.buttonInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new de.ButtonBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("button",{blockModel:de.ButtonBlockModel,blockView:de.ButtonBlockView}),e.registerWidget({name:"button",widgetView:de.ButtonWidgetView,priority:92})});var he,me={},pe=ie;me.ImageBlockModel=pe.BlockModel.extend({defaults:function(){return this._getDefaults({type:"image",link:"",src:"",alt:"An image of...",fullWidth:!0,width:"64px",height:"64px",styles:{block:{textAlign:"center"}}},C.getConfig().get("blockDefaults.image"))},_updateDefaults:function(){}}),me.ImageBlockView=pe.BlockView.extend({className:"mailpoet_block mailpoet_image_block mailpoet_droppable_block",getTemplate:function(){return window.templates.imageBlock},onDragSubstituteBy:function(){return me.ImageWidgetView},templateContext:function(){return c.default.extend({imageMissingSrc:C.getConfig().get("urls.imageMissing")},pe.BlockView.prototype.templateContext.apply(this))},behaviors:c.default.extend({},pe.BlockView.prototype.behaviors,{ResizableBehavior:{elementSelector:".mailpoet_image",resizeHandleSelector:".mailpoet_image_resize_handle",onResize:function(e){var t=this.view.model.get("styles.block.textAlign"),o=this.$(".mailpoet_image").offset(),n=this.$(".mailpoet_image").width(),r=e.pageX-o.left;"right"===t&&(r=n+o.left-e.pageX),this.view.model.set("width",r+"px")}},ShowSettingsBehavior:{ignoreFrom:".mailpoet_image_resize_handle"}}),onRender:function(){var e=this;this.toolsView=new me.ImageBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.model.get("fullWidth")?this.$el.addClass("mailpoet_full_image"):this.$el.removeClass("mailpoet_full_image"),this.model.get("width")&&"auto"!==this.model.get("width")||this.$el.find("img").on("load",function(){e.model.set("width",this.width),e.model.set("height",this.height)}),this.$(".mailpoet_content").css("width",this.model.get("width"))}}),me.ImageBlockToolsView=pe.BlockToolsView.extend({getSettingsView:function(){return me.ImageBlockSettingsView}}),me.ImageBlockSettingsView=pe.BlockSettingsView.extend({behaviors:c.default.extend({},pe.BlockSettingsView.prototype.behaviors,{MediaManagerBehavior:{onSelect:"onImageSelect"}}),onRender:function(){r.U.helpTooltip.show(document.getElementById("tooltip-designer-full-width"),{tooltipId:"tooltip-editor-full-width",tooltip:(0,i.__)("This option eliminates padding around the image.","mailpoet"),place:"top"}),r.U.helpTooltip.show(document.getElementById("tooltip-designer-ideal-width"),{tooltipId:"tooltip-editor-ideal-width",tooltip:(0,i.__)("Use images with widths of at least 1,000 pixels to ensure sharp display on high density screens, like mobile devices.","mailpoet"),place:"bottom"})},getTemplate:function(){return window.templates.imageBlockSettings},events:function(){return{"change .mailpoet_field_image_link":c.default.partial(this.changeUrlField,"link"),"input .mailpoet_field_image_alt_text":c.default.partial(this.changeField,"alt"),"change .mailpoet_field_image_full_width":c.default.partial(this.changeBoolCheckboxField,"fullWidth"),"change .mailpoet_field_image_alignment":c.default.partial(this.changeField,"styles.block.textAlign"),"click .mailpoet_done_editing":"close","input .mailpoet_field_image_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_image_width_input",c.default.partial(this.changePixelField,"width").bind(this)),"change .mailpoet_field_image_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_image_width_input",c.default.partial(this.changePixelField,"width").bind(this)),"input .mailpoet_field_image_width_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_image_width",c.default.partial(this.changePixelField,"width").bind(this))}},modelEvents:function(){return{"change:maxWidth":"updateMaxWidth","change:width":"updateWidth"}},updateValueAndCall:function(e,t,o){this.$(e).val(x()(o.target).val()),t(o)},updateMaxWidth:function(){var e=parseInt(this.model.get("maxWidth"),10);this.$(".mailpoet_field_image_width").attr("max",e),this.$(".mailpoet_field_image_width_input").attr("max",e)},updateWidth:function(){var e=parseInt(this.model.get("width"),10);this.$(".mailpoet_field_image_width").val(e),this.$(".mailpoet_field_image_width_input").val(e)},onImageSelect:function(e){null===e.src?this.model.set({src:""}):this.model.set(e),this.render()}}),he=pe.WidgetView.extend({id:"automation_editor_block_image",getTemplate:function(){return window.templates.imageInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new me.ImageBlockModel},onDrop:function(e){e.droppedView.triggerMethod("showSettings",{showImageManager:!0})}}}}),me.ImageWidgetView=he,C.on("before:start",function(e){e.registerBlockType("image",{blockModel:me.ImageBlockModel,blockView:me.ImageBlockView}),e.registerWidget({name:"image",widgetView:me.ImageWidgetView,priority:91})});var ge={},fe=ie;ge.DividerBlockModel=fe.BlockModel.extend({defaults:function(){return this._getDefaults({type:"divider",styles:{block:{backgroundColor:"transparent",padding:"12px",borderStyle:"solid",borderWidth:"1px",borderColor:"#000000"}}},C.getConfig().get("blockDefaults.divider"))}}),ge.DividerBlockView=fe.BlockView.extend({className:"mailpoet_block mailpoet_divider_block mailpoet_droppable_block",getTemplate:function(){return window.templates.dividerBlock},modelEvents:c.default.omit(fe.BlockView.prototype.modelEvents,"change"),behaviors:c.default.defaults({ResizableBehavior:{elementSelector:".mailpoet_content",resizeHandleSelector:".mailpoet_resize_handle",transformationFunction:function(e){return e/2},minLength:0,modelField:"styles.block.padding"},ShowSettingsBehavior:{ignoreFrom:".mailpoet_resize_handle"}},fe.BlockView.prototype.behaviors),onDragSubstituteBy:function(){return ge.DividerWidgetView},initialize:function(){var e=this;fe.BlockView.prototype.initialize.apply(this,arguments),this._replaceDividerHandler=function(t){e.model.set(t),e.model.trigger("applyToAll")},C.getChannel().on("replaceAllDividers",this._replaceDividerHandler),this.listenTo(this.model,"change:src change:styles.block.backgroundColor change:styles.block.borderStyle change:styles.block.borderWidth change:styles.block.borderColor applyToAll",this.render),this.listenTo(this.model,"change:styles.block.padding",this.changePadding)},templateContext:function(){return c.default.extend({totalHeight:2*parseInt(this.model.get("styles.block.padding"),10)+parseInt(this.model.get("styles.block.borderWidth"),10)+"px"},fe.BlockView.prototype.templateContext.apply(this))},onRender:function(){this.toolsView=new ge.DividerBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onBeforeDestroy:function(){C.getChannel().off("replaceAllDividers",this._replaceDividerHandler),this.stopListening(this.model)},changePadding:function(){this.$(".mailpoet_content").css("padding-top",this.model.get("styles.block.padding")),this.$(".mailpoet_content").css("padding-bottom",this.model.get("styles.block.padding")),this.$(".mailpoet_resize_handle_text").text(2*parseInt(this.model.get("styles.block.padding"),10)+parseInt(this.model.get("styles.block.borderWidth"),10)+"px")}}),ge.DividerBlockToolsView=fe.BlockToolsView.extend({getSettingsView:function(){return ge.DividerBlockSettingsView}}),ge.DividerBlockSettingsView=fe.BlockSettingsView.extend({getTemplate:function(){return window.templates.dividerBlockSettings},events:function(){return{"click .mailpoet_field_divider_style":"changeStyle","input .mailpoet_field_divider_border_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width_input",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_divider_border_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width_input",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_divider_border_width_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_divider_border_width",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_divider_border_color":c.default.partial(this.changeColorField,"styles.block.borderColor"),"change .mailpoet_field_divider_background_color":c.default.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_button_divider_apply_to_all":"applyToAll","click .mailpoet_done_editing":"close"}},modelEvents:function(){return{"change:styles.block.borderColor":"repaintDividerStyleOptions"}},templateContext:function(){return c.default.extend({},fe.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON(),renderOptions:this.renderOptions})},changeStyle:function(e){var t=x()(e.currentTarget).data("style");this.model.set("styles.block.borderStyle",t),this.$(".mailpoet_field_divider_style").removeClass("mailpoet_active_divider_style"),this.$('.mailpoet_field_divider_style[data-style="'+t+'"]').addClass("mailpoet_active_divider_style")},repaintDividerStyleOptions:function(){this.$(".mailpoet_field_divider_style > div").css("border-top-color",this.model.get("styles.block.borderColor"))},applyToAll:function(){C.getChannel().trigger("replaceAllDividers",this.model.toJSON())},updateValueAndCall:function(e,t,o){this.$(e).val(x()(o.target).val()),t(o)}}),ge.DividerWidgetView=fe.WidgetView.extend({id:"automation_editor_block_divider",getTemplate:function(){return window.templates.dividerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ge.DividerBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("divider",{blockModel:ge.DividerBlockModel,blockView:ge.DividerBlockView}),e.registerWidget({name:"divider",widgetView:ge.DividerWidgetView,priority:93})});var ve={},be=ie;ve.TextBlockModel=be.BlockModel.extend({defaults:function(){return this._getDefaults({type:"text",text:"Edit this to insert text"},C.getConfig().get("blockDefaults.text"))},_updateDefaults:function(){}}),ve.TextBlockView=be.BlockView.extend({className:"mailpoet_block mailpoet_text_block mailpoet_droppable_block",getTemplate:function(){return window.templates.textBlock},modelEvents:c.default.omit(be.BlockView.prototype.modelEvents,"change"),behaviors:c.default.extend({},be.BlockView.prototype.behaviors,{TextEditorBehavior:{toolbar1:"blocks bold italic forecolor | link unlink",toolbar2:"alignleft aligncenter alignright alignjustify | bullist numlist blockquote | code mailpoet_shortcodes",validElements:"p[class|style],span[class|style],a[href|class|title|target|style],h1[class|style],h2[class|style],h3[class|style],ol[class|style],ul[class|style],li[class|style],strong[class|style],em[class|style],strike,br,blockquote[class|style],table[class|style],tr[class|style],th[class|style],td[class|style],del",invalidElements:"script",blockFormats:"Heading 1=h1;Heading 2=h2;Heading 3=h3;Paragraph=p",plugins:"link lists code mailpoet_shortcodes",configurationFilter:function(e){return c.default.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:(0,i.__)("Select a shortcode","mailpoet")})}}}),initialize:function(e){be.BlockView.prototype.initialize.apply(this,arguments),this.renderOptions=c.default.defaults(e.renderOptions||{},{disableTextEditor:!1}),this.disableTextEditor=this.renderOptions.disableTextEditor},onDragSubstituteBy:function(){return ve.TextWidgetView},onRender:function(){this.toolsView=new ve.TextBlockToolsView({model:this.model,tools:{settings:!1}}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),ve.TextBlockToolsView=be.BlockToolsView.extend({getSettingsView:function(){return ve.TextBlockSettingsView}}),ve.TextBlockSettingsView=be.BlockSettingsView.extend({getTemplate:function(){return window.templates.textBlockSettings}}),ve.TextWidgetView=be.WidgetView.extend({id:"automation_editor_block_text",getTemplate:function(){return window.templates.textInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ve.TextBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("text",{blockModel:ve.TextBlockModel,blockView:ve.TextBlockView}),e.registerWidget({name:"text",widgetView:ve.TextWidgetView,priority:90})});var ye={},we=ie;ye.SpacerBlockModel=we.BlockModel.extend({defaults:function(){return this._getDefaults({type:"spacer",styles:{block:{backgroundColor:"rgba(0, 0, 0, 0)",height:"40px"}}},C.getConfig().get("blockDefaults.spacer"))}}),ye.SpacerBlockView=we.BlockView.extend({className:"mailpoet_block mailpoet_spacer_block mailpoet_droppable_block",getTemplate:function(){return window.templates.spacerBlock},behaviors:c.default.defaults({ResizableBehavior:{elementSelector:".mailpoet_spacer",resizeHandleSelector:".mailpoet_resize_handle",minLength:20,modelField:"styles.block.height"},ShowSettingsBehavior:{ignoreFrom:".mailpoet_resize_handle"}},we.BlockView.prototype.behaviors),modelEvents:c.default.omit(we.BlockView.prototype.modelEvents,"change"),onDragSubstituteBy:function(){return ye.SpacerWidgetView},initialize:function(){we.BlockView.prototype.initialize.apply(this,arguments),this.listenTo(this.model,"change:styles.block.backgroundColor",this.render),this.listenTo(this.model,"change:styles.block.height",this.changeHeight)},onRender:function(){this.toolsView=new ye.SpacerBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},changeHeight:function(){this.$(".mailpoet_spacer").css("height",this.model.get("styles.block.height")),this.$(".mailpoet_resize_handle_text").text(this.model.get("styles.block.height")),this.render()},onBeforeDestroy:function(){this.stopListening(this.model)}}),ye.SpacerBlockToolsView=we.BlockToolsView.extend({getSettingsView:function(){return ye.SpacerBlockSettingsView}}),ye.SpacerBlockSettingsView=we.BlockSettingsView.extend({getTemplate:function(){return window.templates.spacerBlockSettings},events:function(){return{"change .mailpoet_field_spacer_background_color":c.default.partial(this.changeColorField,"styles.block.backgroundColor"),"click .mailpoet_done_editing":"close"}}}),ye.SpacerWidgetView=we.WidgetView.extend({id:"automation_editor_block_spacer",getTemplate:function(){return window.templates.spacerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ye.SpacerBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("spacer",{blockModel:ye.SpacerBlockModel,blockView:ye.SpacerBlockView}),e.registerWidget({name:"spacer",widgetView:ye.SpacerWidgetView,priority:94})});var _e={},xe=ie;_e.FooterBlockModel=xe.BlockModel.extend({defaults:function(){return this._getDefaults({type:"footer",text:'<a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br /><b>Add your postal address here!</b>',styles:{block:{backgroundColor:"transparent"},text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"12px",textAlign:"center"},link:{fontColor:"#0000ff",textDecoration:"none"}}},C.getConfig().get("blockDefaults.footer"))},_updateDefaults:function(){C.getConfig().set("blockDefaults.footer",c.default.omit(this.toJSON(),"text"))}}),_e.FooterBlockView=xe.BlockView.extend({className:"mailpoet_block mailpoet_footer_block mailpoet_droppable_block",getTemplate:function(){return window.templates.footerBlock},modelEvents:c.default.extend({"change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration":"render"},c.default.omit(xe.BlockView.prototype.modelEvents,"change")),behaviors:c.default.extend({},xe.BlockView.prototype.behaviors,{TextEditorBehavior:{configurationFilter:function(e){return c.default.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:(0,i.__)("Select a shortcode","mailpoet")})}}}),onDragSubstituteBy:function(){return _e.FooterWidgetView},onRender:function(){this.toolsView=new _e.FooterBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),_e.FooterBlockToolsView=xe.BlockToolsView.extend({getSettingsView:function(){return _e.FooterBlockSettingsView}}),_e.FooterBlockSettingsView=xe.BlockSettingsView.extend({getTemplate:function(){return window.templates.footerBlockSettings},events:function(){return{"change .mailpoet_field_footer_text_color":c.default.partial(this.changeColorField,"styles.text.fontColor"),"change .mailpoet_field_footer_text_font_family":c.default.partial(this.changeField,"styles.text.fontFamily"),"change .mailpoet_field_footer_text_size":c.default.partial(this.changeField,"styles.text.fontSize"),"change #mailpoet_field_footer_link_color":c.default.partial(this.changeColorField,"styles.link.fontColor"),"change #mailpoet_field_footer_link_underline":function(e){this.model.set("styles.link.textDecoration",e.target.checked?e.target.value:"none")},"change .mailpoet_field_footer_background_color":c.default.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_footer_alignment":c.default.partial(this.changeField,"styles.text.textAlign"),"click .mailpoet_done_editing":"close"}},templateContext:function(){return c.default.extend({},xe.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON()})}}),_e.FooterWidgetView=xe.WidgetView.extend({id:"automation_editor_block_footer",getTemplate:function(){return window.templates.footerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new _e.FooterBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("footer",{blockModel:_e.FooterBlockModel,blockView:_e.FooterBlockView}),e.registerWidget({name:"footer",widgetView:_e.FooterWidgetView,priority:102})});var Ce={},ke=ie;Ce.HeaderBlockModel=ke.BlockModel.extend({defaults:function(){return this._getDefaults({type:"header",text:'<a href="[link:newsletter_view_in_browser_url]">View this in your browser</a>',styles:{block:{backgroundColor:"transparent"},text:{fontColor:"#000000",fontFamily:"Arial",fontSize:"12px",textAlign:"center"},link:{fontColor:"#0000ff",textDecoration:"underline"}}},C.getConfig().get("blockDefaults.header"))},_updateDefaults:function(){C.getConfig().set("blockDefaults.header",c.default.omit(this.toJSON(),"text"))}}),Ce.HeaderBlockView=ke.BlockView.extend({className:"mailpoet_block mailpoet_header_block mailpoet_droppable_block",getTemplate:function(){return window.templates.headerBlock},modelEvents:c.default.extend({"change:styles.block.backgroundColor change:styles.text.fontColor change:styles.text.fontFamily change:styles.text.fontSize change:styles.text.textAlign change:styles.link.fontColor change:styles.link.textDecoration":"render"},c.default.omit(ke.BlockView.prototype.modelEvents,"change")),behaviors:c.default.extend({},ke.BlockView.prototype.behaviors,{TextEditorBehavior:{configurationFilter:function(e){return c.default.extend({},e,{mailpoet_shortcodes:C.getConfig().get("shortcodes").toJSON(),mailpoet_shortcodes_window_title:(0,i.__)("Select a shortcode","mailpoet")})}}}),onDragSubstituteBy:function(){return Ce.HeaderWidgetView},onRender:function(){this.toolsView=new Ce.HeaderBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},onTextEditorChange:function(e){this.model.set("text",e)},onTextEditorFocus:function(){this.disableDragging(),this.disableShowingTools()},onTextEditorBlur:function(){this.enableDragging(),this.enableShowingTools()}}),Ce.HeaderBlockToolsView=ke.BlockToolsView.extend({getSettingsView:function(){return Ce.HeaderBlockSettingsView}}),Ce.HeaderBlockSettingsView=ke.BlockSettingsView.extend({getTemplate:function(){return window.templates.headerBlockSettings},events:function(){return{"change .mailpoet_field_header_text_color":c.default.partial(this.changeColorField,"styles.text.fontColor"),"change .mailpoet_field_header_text_font_family":c.default.partial(this.changeField,"styles.text.fontFamily"),"change .mailpoet_field_header_text_size":c.default.partial(this.changeField,"styles.text.fontSize"),"change #mailpoet_field_header_link_color":c.default.partial(this.changeColorField,"styles.link.fontColor"),"change #mailpoet_field_header_link_underline":function(e){this.model.set("styles.link.textDecoration",e.target.checked?e.target.value:"none")},"change .mailpoet_field_header_background_color":c.default.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_header_alignment":c.default.partial(this.changeField,"styles.text.textAlign"),"click .mailpoet_done_editing":"close"}},templateContext:function(){return c.default.extend({},ke.BlockView.prototype.templateContext.apply(this,arguments),{availableStyles:C.getAvailableStyles().toJSON()})}}),Ce.HeaderWidgetView=ke.WidgetView.extend({id:"automation_editor_block_header",getTemplate:function(){return window.templates.headerInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Ce.HeaderBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("header",{blockModel:Ce.HeaderBlockModel,blockView:Ce.HeaderBlockView}),e.registerWidget({name:"header",widgetView:Ce.HeaderWidgetView,priority:101})});var Se={},Te=ie;Se.ALCSupervisor=k.extend({initialize:function(){this.listenTo(C.getChannel(),"automatedLatestContentRefresh",c.default.debounce(this.refresh,500))},refresh:function(){var e,t=C.findModels(function(e){return"automatedLatestContent"===e.get("type")})||[];0!==t.length&&(e=c.default.map(t,function(e){return e.toJSON()}),$.getBulkTransformedPosts({blocks:e}).then(c.default.partial(this.refreshBlocks,t)))},refreshBlocks:function(e,t){c.default.each(c.default.zip(e,t),function(e){var t=e[0],o=e[1];t.trigger("refreshPosts",o)})}}),Se.AutomatedLatestContentBlockModel=Te.BlockModel.extend({stale:["_container"],defaults:function(){return this._getDefaults({type:"automatedLatestContent",withLayout:!1,amount:"5",contentType:"post",terms:[],inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,featuredImagePosition:"belowTitle",showAuthor:"no",authorPrecededBy:"Author:",showCategories:"no",categoriesPrecededBy:"Categories:",readMoreType:"button",readMoreText:"Read more",readMoreButton:{text:"Read more",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_container:new(C.getBlockTypeModel("container"))},C.getConfig().get("blockDefaults.automatedLatestContent"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_container:C.getBlockTypeModel("container")}},initialize:function(){Te.BlockView.prototype.initialize.apply(this,arguments),this.on("change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:sortBy change:showDivider",this._handleChanges,this),this.listenTo(this.get("readMoreButton"),"change",this._handleChanges),this.listenTo(this.get("divider"),"change",this._handleChanges),this.on("add remove update reset",this._handleChanges),this.on("refreshPosts",this.updatePosts,this)},updatePosts:function(e){this.get("_container.blocks").reset(e,{parse:!0})},_handleChanges:function(){this._updateDefaults(),C.getChannel().trigger("automatedLatestContentRefresh")}}),Se.AutomatedLatestContentBlockView=Te.BlockView.extend({className:"mailpoet_block mailpoet_automated_latest_content_block mailpoet_droppable_block",initialize:function(){C.getChannel().on("replaceAllButtonStyles",function(e){this.model.set({readMoreButton:e})}.bind(this))},getTemplate:function(){return window.templates.automatedLatestContentBlock},regions:{toolsRegion:".mailpoet_tools",postsRegion:".mailpoet_automated_latest_content_block_posts"},modelEvents:c.default.extend(c.default.omit(Te.BlockView.prototype.modelEvents,"change"),{postsChanged:"render"}),events:{"click .mailpoet_automated_latest_content_block_overlay":"showSettings"},onDragSubstituteBy:function(){return Se.AutomatedLatestContentWidgetView},onRender:function(){var e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:(0,i.__)("There is no content to display.","mailpoet")};this.toolsView=new Se.AutomatedLatestContentBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("postsRegion",new e({model:this.model.get("_container"),renderOptions:t}))}}),Se.AutomatedLatestContentBlockToolsView=Te.BlockToolsView.extend({getSettingsView:function(){return Se.AutomatedLatestContentBlockSettingsView}}),Se.AutomatedLatestContentBlockSettingsView=Te.BlockSettingsView.extend({getTemplate:function(){return window.templates.automatedLatestContentBlockSettings},events:function(){return{"click .mailpoet_automated_latest_content_hide_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_show_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_select_button":"showButtonSettings","click .mailpoet_automated_latest_content_select_divider":"showDividerSettings","change .mailpoet_automated_latest_content_read_more_type":"changeReadMoreType","change .mailpoet_automated_latest_content_display_type":"changeDisplayType","change .mailpoet_automated_latest_content_title_format":"changeTitleFormat","change .mailpoet_automated_latest_content_title_as_links":c.default.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_automated_latest_content_show_divider":c.default.partial(this.changeBoolField,"showDivider"),"input .mailpoet_automated_latest_content_show_amount":c.default.partial(this.changeField,"amount"),"change .mailpoet_automated_latest_content_content_type":c.default.partial(this.changeField,"contentType"),"change .mailpoet_automated_latest_content_include_or_exclude":c.default.partial(this.changeField,"inclusionType"),"change .mailpoet_automated_latest_content_title_alignment":c.default.partial(this.changeField,"titleAlignment"),"change .mailpoet_automated_latest_content_image_full_width":c.default.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_automated_latest_content_featured_image_position":c.default.partial(this.changeField,"featuredImagePosition"),"change .mailpoet_automated_latest_content_show_author":c.default.partial(this.changeField,"showAuthor"),"input .mailpoet_automated_latest_content_author_preceded_by":c.default.partial(this.changeField,"authorPrecededBy"),"change .mailpoet_automated_latest_content_show_categories":c.default.partial(this.changeField,"showCategories"),"input .mailpoet_automated_latest_content_categories":c.default.partial(this.changeField,"categoriesPrecededBy"),"input .mailpoet_automated_latest_content_read_more_text":c.default.partial(this.changeField,"readMoreText"),"change .mailpoet_automated_latest_content_sort_by":c.default.partial(this.changeField,"sortBy"),"click .mailpoet_done_editing":"close"}},onRender:function(){var e=this;$.getPostTypes().done(c.default.bind(this._updateContentTypes,this)),this.$(".mailpoet_automated_latest_content_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:(0,i.__)("Categories & tags","mailpoet"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,o,n){var r,i=$.getTaxonomies(e.model.get("contentType")).then(function(e){return r=e,$.getTerms({search:t.data.term,page:t.data.page,taxonomies:c.default.keys(r)}).then(function(e){return{taxonomies:r,terms:e}})});return i.then(o),i.fail(n),i},processResults:function(e){return{results:c.default.map(e.terms,function(t){return c.default.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var o=e.model.get("terms");o.add(t.params.data),e.model.set("terms",o.toJSON())},"select2:unselect":function(t){var o=e.model.get("terms");o.remove(t.params.data),e.model.set("terms",o.toJSON())}}).trigger("change")},toggleDisplayOptions:function(){var e=this.$(".mailpoet_automated_latest_content_display_options"),t=this.$(".mailpoet_automated_latest_content_show_display_options");e.hasClass("mailpoet_closed")?(e.removeClass("mailpoet_closed"),t.addClass("mailpoet_hidden")):(e.addClass("mailpoet_closed"),t.removeClass("mailpoet_hidden"))},showButtonSettings:function(){new de.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new ge.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=x()(e.target).val();"link"===t?(this.$(".mailpoet_automated_latest_content_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_automated_latest_content_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){var t=x()(e.target).val();"titleOnly"===t?(this.$(".mailpoet_automated_latest_content_title_as_list").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_full_width_option").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_separator").addClass("mailpoet_hidden")):(this.$(".mailpoet_automated_latest_content_title_as_list").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_full_width_option").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_image_separator").removeClass("mailpoet_hidden"),"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_automated_latest_content_title_format").val(["h1"]),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden"))),"excerpt"===t?this.$(".mailpoet_automated_latest_content_featured_image_position_container").removeClass("mailpoet_hidden"):this.$(".mailpoet_automated_latest_content_featured_image_position_container").addClass("mailpoet_hidden"),this.changeField("displayType",e)},changeTitleFormat:function(e){"ul"===x()(e.target).val()?(this.$(".mailpoet_automated_latest_content_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_automated_latest_content_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_links").val(["true"])):(this.$(".mailpoet_automated_latest_content_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)},_updateContentTypes:function(e){var t=this.$(".mailpoet_automated_latest_content_content_type"),o=this.model.get("contentType");t.find("option").remove(),c.default.each(e,function(e){t.append(x()("<option>",{value:e.name,text:e.label}))}),t.val(o)}}),Se.AutomatedLatestContentWidgetView=Te.WidgetView.extend({getTemplate:function(){return window.templates.automatedLatestContentInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Se.AutomatedLatestContentBlockModel({},{parse:!0})},onDrop:function(e){e.droppedView.triggerMethod("showSettings")}}}}),C.on("before:start",function(e){e.registerBlockType("automatedLatestContent",{blockModel:Se.AutomatedLatestContentBlockModel,blockView:Se.AutomatedLatestContentBlockView})}),C.on("start",function(e){var t=e;t._ALCSupervisor=new Se.ALCSupervisor,t._ALCSupervisor.refresh()});var Ee={},Oe=ie;Ee.ALCLayoutSupervisor=k.extend({initialize:function(){this.listenTo(C.getChannel(),"automatedLatestContentLayoutRefresh",c.default.debounce(this.refresh,500))},refresh:function(){var e,t=C.findModels(function(e){return"automatedLatestContentLayout"===e.get("type")})||[];0!==t.length&&(e=c.default.map(t,function(e){return e.toJSON()}),$.getBulkTransformedPosts({blocks:e}).then(c.default.partial(this.refreshBlocks,t)))},refreshBlocks:function(e,t){c.default.each(c.default.zip(e,t),function(e){var t=e[0],o=e[1];t.trigger("refreshPosts",o)})}}),Ee.AutomatedLatestContentLayoutBlockModel=Oe.BlockModel.extend({stale:["_container","_displayOptionsHidden","_featuredImagePosition"],defaults:function(){return this._getDefaults({type:"automatedLatestContentLayout",withLayout:!0,amount:"5",contentType:"post",terms:[],inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"centered",fullPostFeaturedImagePosition:"none",showAuthor:"no",authorPrecededBy:"Author:",showCategories:"no",categoriesPrecededBy:"Categories:",readMoreType:"button",readMoreText:"Read more",readMoreButton:{text:"Read more",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_container:new(C.getBlockTypeModel("container")),_displayOptionsHidden:!0,_featuredImagePosition:"none"},C.getConfig().get("blockDefaults.automatedLatestContentLayout"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_container:C.getBlockTypeModel("container")}},initialize:function(e){c.default.isEmpty(e)&&this.set("fullPostFeaturedImagePosition","left"),e&&"full"===e.displayType&&"product"===e.contentType&&!this.get("fullPostFeaturedImagePosition")&&this.set("fullPostFeaturedImagePosition",this.get("featuredImagePosition")),Oe.BlockView.prototype.initialize.apply(this,arguments),this.on("change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:featuredImagePosition change:fullPostFeaturedImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:sortBy change:showDivider change:titlePosition",this._handleChanges,this),this.listenTo(this.get("readMoreButton"),"change",this._handleChanges),this.listenTo(this.get("divider"),"change",this._handleChanges),this.on("add remove update reset",this._handleChanges),this.on("refreshPosts",this.updatePosts,this);const t="full"===this.get("displayType")?"fullPostFeaturedImagePosition":"featuredImagePosition";this.set("_featuredImagePosition",this.get(t))},updatePosts:function(e){this.get("_container.blocks").reset(e,{parse:!0})},_handleChanges:function(){this._updateDefaults(),C.getChannel().trigger("automatedLatestContentLayoutRefresh")}}),Ee.AutomatedLatestContentLayoutBlockView=Oe.BlockView.extend({className:"mailpoet_block mailpoet_automated_latest_content_block mailpoet_droppable_block",initialize:function(){C.getChannel().on("replaceAllButtonStyles",function(e){this.model.set({readMoreButton:e})}.bind(this))},getTemplate:function(){return window.templates.automatedLatestContentLayoutBlock},regions:{toolsRegion:".mailpoet_tools",postsRegion:".mailpoet_automated_latest_content_block_posts"},modelEvents:c.default.extend(c.default.omit(Oe.BlockView.prototype.modelEvents,"change"),{postsChanged:"render"}),events:{"click .mailpoet_automated_latest_content_block_overlay":"showSettings"},onDragSubstituteBy:function(){return Ee.AutomatedLatestContentLayoutWidgetView},onRender:function(){var e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:(0,i.__)("There is no content to display.","mailpoet")};this.toolsView=new Ee.AutomatedLatestContentLayoutBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("postsRegion",new e({model:this.model.get("_container"),renderOptions:t}))},duplicateBlock:function(){var e=this.model.toJSON(),t=new Ee.AutomatedLatestContentLayoutBlockModel(e);this.model.collection.add(t,{at:this.model.collection.findIndex(this.model)})}}),Ee.AutomatedLatestContentLayoutBlockToolsView=Oe.BlockToolsView.extend({getSettingsView:function(){return Ee.AutomatedLatestContentLayoutBlockSettingsView}}),Ee.AutomatedLatestContentLayoutBlockSettingsView=Oe.BlockSettingsView.extend({getTemplate:function(){return window.templates.automatedLatestContentLayoutBlockSettings},events:function(){return{"click .mailpoet_automated_latest_content_hide_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_show_display_options":"toggleDisplayOptions","click .mailpoet_automated_latest_content_select_button":"showButtonSettings","click .mailpoet_automated_latest_content_select_divider":"showDividerSettings","change .mailpoet_automated_latest_content_read_more_type":"changeReadMoreType","change .mailpoet_automated_latest_content_display_type":"changeDisplayType","change .mailpoet_automated_latest_content_title_format":"changeTitleFormat","change .mailpoet_automated_latest_content_title_as_links":c.default.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_automated_latest_content_show_divider":c.default.partial(this.changeBoolField,"showDivider"),"input .mailpoet_automated_latest_content_show_amount":c.default.partial(this.changeField,"amount"),"change .mailpoet_automated_latest_content_content_type":c.default.partial(this.changeField,"contentType"),"change .mailpoet_automated_latest_content_include_or_exclude":c.default.partial(this.changeField,"inclusionType"),"change .mailpoet_automated_latest_content_title_alignment":c.default.partial(this.changeField,"titleAlignment"),"change .mailpoet_automated_latest_content_image_full_width":c.default.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_automated_latest_content_featured_image_position":"changeFeaturedImagePosition","change .mailpoet_automated_latest_content_show_author":c.default.partial(this.changeField,"showAuthor"),"input .mailpoet_automated_latest_content_author_preceded_by":c.default.partial(this.changeField,"authorPrecededBy"),"change .mailpoet_automated_latest_content_show_categories":c.default.partial(this.changeField,"showCategories"),"input .mailpoet_automated_latest_content_categories":c.default.partial(this.changeField,"categoriesPrecededBy"),"input .mailpoet_automated_latest_content_read_more_text":c.default.partial(this.changeField,"readMoreText"),"change .mailpoet_automated_latest_content_sort_by":c.default.partial(this.changeField,"sortBy"),"change .mailpoet_automated_latest_content_title_position":c.default.partial(this.changeField,"titlePosition"),"click .mailpoet_done_editing":"close"}},onRender:function(){var e=this;$.getPostTypes().done(c.default.bind(this._updateContentTypes,this)),this.$(".mailpoet_automated_latest_content_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:(0,i.__)("Categories & tags","mailpoet"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,o,n){var r,i=$.getTaxonomies(e.model.get("contentType")).then(function(e){return r=e,$.getTerms({search:t.data.term,page:t.data.page,taxonomies:c.default.keys(r)}).then(function(e){return{taxonomies:r,terms:e}})});return i.then(o),i.fail(n),i},processResults:function(e){return{results:c.default.map(e.terms,function(t){return c.default.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var o=e.model.get("terms");o.add(t.params.data),e.model.set("terms",o.toJSON())},"select2:unselect":function(t){var o=e.model.get("terms");o.remove(t.params.data),e.model.set("terms",o.toJSON())}}).trigger("change")},toggleDisplayOptions:function(){this.model.set("_displayOptionsHidden",!this.model.get("_displayOptionsHidden")),this.render()},showButtonSettings:function(){new de.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new ge.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=x()(e.target).val();"link"===t?(this.$(".mailpoet_automated_latest_content_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_automated_latest_content_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){"titleOnly"!==x()(e.target).val()&&"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_automated_latest_content_title_format").val(["h1"]),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden")),this.changeField("displayType",e);const t="full"===this.model.get("displayType")?"fullPostFeaturedImagePosition":"featuredImagePosition";this.model.set("_featuredImagePosition",this.model.get(t)),this.render()},changeTitleFormat:function(e){"ul"===x()(e.target).val()?(this.$(".mailpoet_automated_latest_content_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_automated_latest_content_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_links").val(["true"])):(this.$(".mailpoet_automated_latest_content_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_automated_latest_content_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)},changeFeaturedImagePosition:function(e){const t="full"===this.model.get("displayType")?"fullPostFeaturedImagePosition":"featuredImagePosition";this.changeField(t,e),this.changeField("_featuredImagePosition",e)},_updateContentTypes:function(e){var t=this.$(".mailpoet_automated_latest_content_content_type"),o=this.model.get("contentType");t.find("option").remove(),c.default.each(e,function(e){t.append(x()("<option>",{value:e.name,text:e.label}))}),t.val(o)}}),Ee.AutomatedLatestContentLayoutWidgetView=Oe.WidgetView.extend({className:Oe.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.automatedLatestContentLayoutInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Ee.AutomatedLatestContentLayoutBlockModel({},{parse:!0})},onDrop:function(e){e.droppedView.triggerMethod("showSettings")}}}}),C.on("before:start",function(e){e.registerBlockType("automatedLatestContentLayout",{blockModel:Ee.AutomatedLatestContentLayoutBlockModel,blockView:Ee.AutomatedLatestContentLayoutBlockView}),e.registerWidget({name:"automatedLatestContentLayout",widgetView:Ee.AutomatedLatestContentLayoutWidgetView,priority:97})}),C.on("start",function(e){var t=e;t._ALCLayoutSupervisor=new Ee.ALCLayoutSupervisor,t._ALCLayoutSupervisor.refresh()});const Ae={},Me=ie;Ae.DynamicProductsSupervisor=k.extend({initialize(){this.listenTo(C.getChannel(),"dynamicProductsRefresh",c.default.debounce(this.refresh,500))},refresh(){const e=C.findModels(e=>"dynamicProducts"===e.get("type"))||[];if(0===e.length)return;const t=c.default.map(e,e=>e.toJSON());$.getBulkTransformedProducts({blocks:t}).then(c.default.partial(this.refreshBlocks,e))},refreshBlocks(e,t){c.default.each(c.default.zip(e,t),e=>{const t=e[0],o=e[1];t.trigger("refreshPosts",o)})}}),Ae.DynamicProductsBlockModel=Me.BlockModel.extend({stale:["_container","_displayOptionsHidden","_featuredImagePosition"],defaults(){return this._getDefaults({type:"dynamicProducts",withLayout:!0,amount:"10",contentType:"product",terms:[],inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"left",pricePosition:"below",readMoreType:"link",readMoreText:"Buy now",readMoreButton:{text:"Buy now",url:"[postLink]"},sortBy:"newest",showDivider:!0,dynamicProductsType:"selected",divider:{},_container:new(C.getBlockTypeModel("container")),_displayOptionsHidden:!0,_featuredImagePosition:"none"},C.getConfig().get("blockDefaults.dynamicProducts"))},relations:()=>({readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_container:C.getBlockTypeModel("container")}),initialize(...e){Me.BlockView.prototype.initialize.apply(this,e),this.on("change:amount change:contentType change:terms change:inclusionType change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:pricePosition change:readMoreType change:readMoreText change:sortBy change:showDivider change:dynamicProductsType change:titlePosition change:excludeOutOfStock",this._handleChanges,this),this.listenTo(this.get("readMoreButton"),"change",this._handleChanges),this.listenTo(this.get("divider"),"change",this._handleChanges),this.on("add remove update reset",this._handleChanges),this.on("refreshPosts",this.updatePosts,this),this.set("_featuredImagePosition",this.get("featuredImagePosition"))},updatePosts(e){this.get("_container.blocks").reset(e,{parse:!0})},_handleChanges(){this._updateDefaults(),C.getChannel().trigger("dynamicProductsRefresh")}}),Ae.DynamicProductsBlockView=Me.BlockView.extend({className:"mailpoet_block mailpoet_dynamic_products_block mailpoet_droppable_block",initialize(){C.getChannel().on("replaceAllButtonStyles",function(e){this.model.set({readMoreButton:e})}.bind(this))},getTemplate:()=>window.templates.dynamicProductsBlock,regions:{toolsRegion:".mailpoet_tools",postsRegion:".mailpoet_dynamic_products_block_posts"},modelEvents:c.default.extend(c.default.omit(Me.BlockView.prototype.modelEvents,"change"),{postsChanged:"render"}),events:{"click .mailpoet_dynamic_products_block_overlay":"showSettings"},onDragSubstituteBy:()=>Ae.DynamicProductsWidgetView,onRender(){const e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:(0,i.__)("There is no content to display.","mailpoet")};this.toolsView=new Ae.DynamicProductsBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("postsRegion",new e({model:this.model.get("_container"),renderOptions:t}))},duplicateBlock(){const e=this.model.toJSON(),t=new Ae.DynamicProductsBlockModel(e);this.model.collection.add(t,{at:this.model.collection.findIndex(this.model)})}}),Ae.DynamicProductsBlockToolsView=Me.BlockToolsView.extend({getSettingsView:()=>Ae.DynamicProductsBlockSettingsView}),Ae.DynamicProductsBlockSettingsView=Me.BlockSettingsView.extend({getTemplate:()=>window.templates.dynamicProductsBlockSettings,events(){return{"click .mailpoet_dynamic_products_hide_display_options":"toggleDisplayOptions","click .mailpoet_dynamic_products_show_display_options":"toggleDisplayOptions","click .mailpoet_dynamic_products_select_button":"showButtonSettings","click .mailpoet_dynamic_products_select_divider":"showDividerSettings","change .mailpoet_dynamic_products_read_more_type":"changeReadMoreType","change .mailpoet_dynamic_products_display_type":"changeDisplayType","change .mailpoet_dynamic_products_title_format":"changeTitleFormat","change .mailpoet_dynamic_products_dynamic_products_type":"changeDynamicProductsType","change .mailpoet_dynamic_products_title_as_links":c.default.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_dynamic_products_show_divider":c.default.partial(this.changeBoolField,"showDivider"),"input .mailpoet_dynamic_products_show_amount":c.default.partial(this.changeField,"amount"),"change .mailpoet_dynamic_products_content_type":c.default.partial(this.changeField,"contentType"),"change .mailpoet_dynamic_products_include_or_exclude":c.default.partial(this.changeField,"inclusionType"),"change .mailpoet_dynamic_products_exclude_out_of_stock":c.default.partial(this.changeBoolCheckboxField,"excludeOutOfStock"),"change .mailpoet_dynamic_products_title_alignment":c.default.partial(this.changeField,"titleAlignment"),"change .mailpoet_dynamic_products_image_full_width":c.default.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_dynamic_products_price_position":c.default.partial(this.changeField,"pricePosition"),"change .mailpoet_dynamic_products_featured_image_position":"changeFeaturedImagePosition","input .mailpoet_dynamic_products_read_more_text":c.default.partial(this.changeField,"readMoreText"),"change .mailpoet_dynamic_products_sort_by":c.default.partial(this.changeField,"sortBy"),"change .mailpoet_dynamic_products_title_position":c.default.partial(this.changeField,"titlePosition"),"click .mailpoet_done_editing":"close"}},onRender(){const e=this;this.$(".mailpoet_dynamic_products_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:(0,i.__)("Categories & tags","mailpoet"),ajax:{data:e=>({term:e.term,page:e.page||1}),transport(t,o,n){let r,i;const s=$.getProductTaxonomies(e.model.get("contentType")).then(e=>(r=e,i=$.getProductTerms({search:t.data.term,page:t.data.page,taxonomies:c.default.keys(r)}).then(e=>({taxonomies:r,terms:e})),i));return s.then(o),s.fail(n),s},processResults:e=>({results:c.default.map(e.terms,t=>c.default.defaults({text:`${e.taxonomies[t.taxonomy].labels.singular_name}: ${t.name}`,id:t.term_id},t)),pagination:{more:100===e.terms.length}})}}).on({"select2:select":t=>{const o=e.model.get("terms");o.add(t.params.data),e.model.set("terms",o.toJSON())},"select2:unselect":t=>{const o=e.model.get("terms");o.remove(t.params.data),e.model.set("terms",o.toJSON())}}).trigger("change")},toggleDisplayOptions(){this.model.set("_displayOptionsHidden",!this.model.get("_displayOptionsHidden")),this.render()},showButtonSettings(){new de.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings(){new ge.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType(e){const t=x()(e.target).val();"link"===t?(this.$(".mailpoet_dynamic_products_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_dynamic_products_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_dynamic_products_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_dynamic_products_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType(e){"titleOnly"!==x()(e.target).val()&&"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_dynamic_products_title_format").val(["h1"]),this.$(".mailpoet_dynamic_products_title_as_link").removeClass("mailpoet_hidden")),this.changeField("displayType",e),this.model.set("_featuredImagePosition",this.model.get("featuredImagePosition")),this.render()},changeTitleFormat(e){"ul"===x()(e.target).val()?(this.$(".mailpoet_dynamic_products_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_dynamic_products_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_dynamic_products_title_as_links").val(["true"])):(this.$(".mailpoet_dynamic_products_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_dynamic_products_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)},changeFeaturedImagePosition(e){this.changeField("featuredImagePosition",e),this.changeField("_featuredImagePosition",e)},changeDynamicProductsType(e){"selected"===x()(e.target).val()?this.$(".mailpoet_dynamic_products_selected_products").removeClass("mailpoet_hidden"):this.$(".mailpoet_dynamic_products_selected_products").addClass("mailpoet_hidden"),this.changeField("dynamicProductsType",e)}}),Ae.DynamicProductsWidgetView=Me.WidgetView.extend({className:`${Me.WidgetView.prototype.className} mailpoet_droppable_layout_block`,getTemplate:()=>window.templates.dynamicProductsInsertion,behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:()=>new Ae.DynamicProductsBlockModel({},{parse:!0}),onDrop(e){e.droppedView.triggerMethod("showSettings")}}}}),C.on("before:start",e=>{if(!window.mailpoet_woocommerce_active)return!1;e.registerBlockType("dynamicProducts",{blockModel:Ae.DynamicProductsBlockModel,blockView:Ae.DynamicProductsBlockView}),e.registerWidget({name:"dynamicProducts",widgetView:Ae.DynamicProductsWidgetView,priority:99})}),C.on("start",e=>{if(!window.mailpoet_woocommerce_active)return!1;const t=e;t._DynamicProductsSupervisor=new Ae.DynamicProductsSupervisor,t._DynamicProductsSupervisor.refresh()}),o(79537);var Be,Re,Ne,Ve,De,Pe={},Ie=ie;Pe.PostsBlockModel=Ie.BlockModel.extend({stale:["_selectedPosts","_availablePosts","_transformedPosts","_featuredImagePosition"],defaults:function(){return this._getDefaults({type:"posts",withLayout:!0,amount:"10",offset:0,contentType:"post",postStatus:"publish",terms:[],search:"",inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"centered",fullPostFeaturedImagePosition:"none",showAuthor:"no",authorPrecededBy:"Author:",showCategories:"no",categoriesPrecededBy:"Categories:",readMoreType:"link",readMoreText:"Read more",readMoreButton:{text:"Read more",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_selectedPosts:[],_availablePosts:[],_transformedPosts:new(C.getBlockTypeModel("container")),_featuredImagePosition:"none"},C.getConfig().get("blockDefaults.posts"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_selectedPosts:O().Collection,_availablePosts:O().Collection,_transformedPosts:C.getBlockTypeModel("container")}},initialize:function(e){var t=c.default.debounce(this.fetchAvailablePosts.bind(this),500),o=c.default.debounce(this._refreshTransformedPosts.bind(this),500);c.default.isEmpty(e)&&this.set("fullPostFeaturedImagePosition","left"),e&&"full"===e.displayType&&"product"===e.contentType&&!this.get("fullPostFeaturedImagePosition")&&this.set("fullPostFeaturedImagePosition",this.get("featuredImagePosition")),c.default.extend(this,y().Requests),this.fetchAvailablePosts(),this.on("change",this._updateDefaults,this),this.on("change:contentType change:terms change:postStatus change:search",t),this.on("loadMorePosts",this._loadMorePosts,this),this.listenTo(this.get("_selectedPosts"),"add remove reset",o),this.on("change:displayType change:titleFormat change:featuredImagePosition change:fullPostFeaturedImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:showAuthor change:authorPrecededBy change:showCategories change:categoriesPrecededBy change:readMoreType change:readMoreText change:showDivider change:titlePosition",o),this.listenTo(this.get("readMoreButton"),"change",o),this.listenTo(this.get("divider"),"change",o),this.listenTo(C.getChannel(),"hideSettings",this.destroy),this.on("insertSelectedPosts",this._insertSelectedPosts,this);const n="full"===this.get("displayType")?"fullPostFeaturedImagePosition":"featuredImagePosition";this.set("_featuredImagePosition",this.get(n))},fetchAvailablePosts:function(){var e=this;this.set("offset",0),$.getPosts(this.toJSON()).done(function(t){e.get("_availablePosts").reset(t),e.get("_selectedPosts").reset(),e.trigger("change:_availablePosts")}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch available posts","mailpoet"))})},_loadMorePosts:function(){var e=this,t=this.get("_availablePosts").length,o=this.get("offset")+Number(this.get("amount"));return!(0===t||t<o||(this.set("offset",o),this.trigger("loadingMorePosts"),$.getPosts(this.toJSON()).done(function(t){e.get("_availablePosts").add(t),e.trigger("change:_availablePosts")}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch available posts","mailpoet"))}).always(function(){e.trigger("morePostsLoaded")}),0))},_refreshTransformedPosts:function(){var e=this,t=this.toJSON();t.posts=this.get("_selectedPosts").pluck("ID"),0!==t.posts.length?$.getTransformedPosts(t).done(function(t){e.get("_transformedPosts").get("blocks").reset(t,{parse:!0})}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch rendered posts","mailpoet"))}):this.get("_transformedPosts").get("blocks").reset()},_insertSelectedPosts:function(){var e=this.toJSON(),t=this.collection.indexOf(this),o=this.collection;e.posts=this.get("_selectedPosts").pluck("ID"),0!==e.posts.length&&$.getTransformedPosts(e).done(function(e){o.add(JSON.parse(JSON.stringify(e)),{at:t})}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch rendered posts","mailpoet"))})}}),Pe.PostsBlockView=Ie.BlockView.extend({className:"mailpoet_block mailpoet_posts_block mailpoet_droppable_block",getTemplate:function(){return window.templates.postsBlock},modelEvents:{},regions:c.default.extend({postsRegion:".mailpoet_posts_container"},Ie.BlockView.prototype.regions),onDragSubstituteBy:function(){return Pe.PostsWidgetView},initialize:function(){Ie.BlockView.prototype.initialize.apply(this,arguments),this.toolsView=new Pe.PostsBlockToolsView({model:this.model}),this.model.reply("blockView",this.notifyAboutSelf,this)},onRender:function(){var e,t;this.getRegion("toolsRegion").hasView()||this.showChildView("toolsRegion",this.toolsView),this.trigger("showSettings"),e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:(0,i.__)("There is no content to display.","mailpoet")},this.showChildView("postsRegion",new e({model:this.model.get("_transformedPosts"),renderOptions:t}))},notifyAboutSelf:function(){return this},onBeforeDestroy:function(){this.model.stopReplying("blockView",this.notifyAboutSelf,this)}}),Pe.PostsBlockToolsView=Ie.BlockToolsView.extend({getSettingsView:function(){return Pe.PostsBlockSettingsView}}),Pe.PostsBlockSettingsView=Ie.BlockSettingsView.extend({getTemplate:function(){return window.templates.postsBlockSettings},regions:{selectionRegion:".mailpoet_settings_posts_selection",displayOptionsRegion:".mailpoet_settings_posts_display_options"},events:{"click .mailpoet_settings_posts_show_display_options":"switchToDisplayOptions","click .mailpoet_settings_posts_show_post_selection":"switchToPostSelection","click .mailpoet_settings_posts_insert_selected":"insertPosts"},templateContext:function(){return{model:this.model.toJSON()}},initialize:function(){this.model.trigger("startEditing"),this.selectionView=new Ve({model:this.model}),this.displayOptionsView=new Be({model:this.model})},onRender:function(){var e=this;this.model.request("blockView"),this.showChildView("selectionRegion",this.selectionView),this.showChildView("displayOptionsRegion",this.displayOptionsView),r.U.Modal.panel({element:this.$el,template:"",position:"right",overlayRender:!1,width:C.getConfig().get("sidepanelWidth"),onCancel:function(){e.model.destroy()}}),this.selectionView.triggerMethod("attach"),this.displayOptionsView.triggerMethod("attach")},switchToDisplayOptions:function(){this.$(".mailpoet_settings_posts_selection").addClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_display_options").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_show_display_options").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_posts_show_post_selection").removeClass("mailpoet_hidden")},switchToPostSelection:function(){this.$(".mailpoet_settings_posts_display_options").addClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_selection").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_posts_show_post_selection").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_posts_show_display_options").removeClass("mailpoet_hidden")},insertPosts:function(){this.model.trigger("insertSelectedPosts"),this.model.destroy(),this.close()}}),De=v().CollectionView.extend({className:"mailpoet_post_scroll_container",childView:function(){return Re},emptyView:function(){return Ne},childViewOptions:function(){return{blockModel:this.blockModel}},initialize:function(e){this.blockModel=e.blockModel},events:{scroll:"onPostsScroll"},onPostsScroll:function(e){var t=x()(e.target);t.scrollTop()+t.innerHeight()>=t[0].scrollHeight-1&&this.blockModel.trigger("loadMorePosts")}}),Ve=v().View.extend({getTemplate:function(){return window.templates.postSelectionPostsBlockSettings},regions:{posts:".mailpoet_post_selection_container"},events:function(){return{"change .mailpoet_settings_posts_content_type":c.default.partial(this.changeField,"contentType"),"change .mailpoet_posts_post_status":c.default.partial(this.changeField,"postStatus"),"input .mailpoet_posts_search_term":c.default.partial(this.changeField,"search")}},modelEvents:{"change:offset":function(e,t){0===t&&this.$(".mailpoet_post_scroll_container").scrollTop(0)},loadingMorePosts:function(){this.$(".mailpoet_post_selection_loading").css("visibility","visible")},morePostsLoaded:function(){this.$(".mailpoet_post_selection_loading").css("visibility","hidden")}},templateContext:function(){return{model:this.model.toJSON()}},onRender:function(){var e;$.getPostTypes().done(c.default.bind(this._updateContentTypes,this)),e=new De({collection:this.model.get("_availablePosts"),blockModel:this.model}),this.showChildView("posts",e)},onAttach:function(){var e=this;this.$(".mailpoet_posts_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:(0,i.__)("Categories & tags","mailpoet"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,o,n){var r,i=$.getTaxonomies(e.model.get("contentType")).then(function(e){return r=e,$.getTerms({search:t.data.term,page:t.data.page,taxonomies:c.default.keys(r)}).then(function(e){return{taxonomies:r,terms:e}})});return i.then(o),i.fail(n),i},processResults:function(e){return{results:c.default.map(e.terms,function(t){return c.default.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var o=e.model.get("terms");o.add(t.params.data),e.model.set("terms",o.toJSON())},"select2:unselect":function(t){var o=e.model.get("terms");o.remove(t.params.data),e.model.set("terms",o.toJSON())}}).trigger("change")},changeField:function(e,t){this.model.set(e,x()(t.target).val())},_updateContentTypes:function(e){var t=this.$(".mailpoet_settings_posts_content_type"),o=this.model.get("contentType");t.find("option").remove(),c.default.each(e,function(e){t.append(x()("<option>",{value:e.name,text:e.label}))}),t.val(o)}}),Ne=v().View.extend({getTemplate:function(){return window.templates.emptyPostPostsBlockSettings}}),Re=v().View.extend({getTemplate:function(){return window.templates.singlePostPostsBlockSettings},events:function(){return{"change .mailpoet_select_post_checkbox":"postSelectionChange"}},templateContext:function(){return{model:this.model.toJSON(),index:this._index}},initialize:function(e){this.blockModel=e.blockModel},postSelectionChange:function(e){var t=x()(e.target),o=this.blockModel.get("_selectedPosts");t.prop("checked")?o.add(this.model):o.remove(this.model)}}),Be=Ie.BlockSettingsView.extend({getTemplate:function(){return window.templates.displayOptionsPostsBlockSettings},events:function(){return{"click .mailpoet_posts_select_button":"showButtonSettings","click .mailpoet_posts_select_divider":"showDividerSettings","change .mailpoet_posts_read_more_type":"changeReadMoreType","change .mailpoet_posts_display_type":"changeDisplayType","change .mailpoet_posts_title_format":"changeTitleFormat","change .mailpoet_posts_title_as_links":c.default.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_posts_show_divider":c.default.partial(this.changeBoolField,"showDivider"),"change .mailpoet_posts_content_type":c.default.partial(this.changeField,"contentType"),"change .mailpoet_posts_title_alignment":c.default.partial(this.changeField,"titleAlignment"),"change .mailpoet_posts_image_full_width":c.default.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_posts_featured_image_position":"changeFeaturedImagePosition","change .mailpoet_posts_show_author":c.default.partial(this.changeField,"showAuthor"),"input .mailpoet_posts_author_preceded_by":c.default.partial(this.changeField,"authorPrecededBy"),"change .mailpoet_posts_show_categories":c.default.partial(this.changeField,"showCategories"),"input .mailpoet_posts_categories":c.default.partial(this.changeField,"categoriesPrecededBy"),"input .mailpoet_posts_read_more_text":c.default.partial(this.changeField,"readMoreText"),"change .mailpoet_automated_latest_content_title_position":c.default.partial(this.changeField,"titlePosition")}},templateContext:function(){return{model:this.model.toJSON()}},showButtonSettings:function(){new de.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new ge.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=x()(e.target).val();"link"===t?(this.$(".mailpoet_posts_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_posts_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){"titleOnly"!==x()(e.target).val()&&"ul"===this.model.get("titleFormat")&&(this.model.set("titleFormat","h1"),this.$(".mailpoet_posts_title_format").val(["h1"]),this.$(".mailpoet_posts_title_as_link").removeClass("mailpoet_hidden")),this.changeField("displayType",e);const t="full"===this.model.get("displayType")?"fullPostFeaturedImagePosition":"featuredImagePosition";this.model.set("_featuredImagePosition",this.model.get(t)),this.render()},changeTitleFormat:function(e){"ul"===x()(e.target).val()?(this.$(".mailpoet_posts_non_title_list_options").addClass("mailpoet_hidden"),this.model.set("titleIsLink",!0),this.$(".mailpoet_posts_title_as_link").addClass("mailpoet_hidden"),this.$(".mailpoet_posts_title_as_links").val(["true"])):(this.$(".mailpoet_posts_non_title_list_options").removeClass("mailpoet_hidden"),this.$(".mailpoet_posts_title_as_link").removeClass("mailpoet_hidden")),this.changeField("titleFormat",e)},changeFeaturedImagePosition:function(e){const t="full"===this.model.get("displayType")?"fullPostFeaturedImagePosition":"featuredImagePosition";this.changeField(t,e),this.changeField("_featuredImagePosition",e)}}),Pe.PostsWidgetView=Ie.WidgetView.extend({className:Ie.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:function(){return window.templates.postsInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Pe.PostsBlockModel({},{parse:!0})}}}}),C.on("before:start",function(e){e.registerBlockType("posts",{blockModel:Pe.PostsBlockModel,blockView:Pe.PostsBlockView}),e.registerWidget({name:"posts",widgetView:Pe.PostsWidgetView,priority:96})});var Le,Fe,ze,He,Ue,Ze={},$e=ie;Ze.ProductsBlockModel=$e.BlockModel.extend({stale:["_selectedProducts","_availableProducts","_transformedProducts"],defaults:function(){return this._getDefaults({type:"products",withLayout:!0,amount:"10",offset:0,contentType:"product",postStatus:"publish",terms:[],search:"",inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"alternate",pricePosition:"below",readMoreType:"link",readMoreText:"Buy now",readMoreButton:{text:"Buy now",url:"[postLink]"},sortBy:"newest",showDivider:!0,divider:{},_selectedProducts:[],_availableProducts:[],_transformedProducts:new(C.getBlockTypeModel("container"))},C.getConfig().get("blockDefaults.products"))},relations:function(){return{readMoreButton:C.getBlockTypeModel("button"),divider:C.getBlockTypeModel("divider"),_selectedProducts:O().Collection,_availableProducts:O().Collection,_transformedProducts:C.getBlockTypeModel("container")}},initialize:function(){var e=c.default.debounce(this.fetchAvailableProducts.bind(this),500),t=c.default.debounce(this._refreshTransformedProducts.bind(this),500);c.default.extend(this,y().Requests),this.fetchAvailableProducts(),this.on("change",this._updateDefaults,this),this.on("change:terms change:postStatus change:search",e),this.on("loadMoreProducts",this._loadMoreProducts,this),this.listenTo(this.get("_selectedProducts"),"add remove reset",t),this.on("change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:pricePosition change:readMoreType change:readMoreText change:showDivider change:titlePosition",t),this.listenTo(this.get("readMoreButton"),"change",t),this.listenTo(this.get("divider"),"change",t),this.listenTo(C.getChannel(),"hideSettings",this.destroy),this.on("insertSelectedProducts",this._insertSelectedProducts,this)},fetchAvailableProducts:function(){var e=this;this.set("offset",0),$.getPosts(this.toJSON()).done(function(t){e.get("_availableProducts").reset(t),e.get("_selectedProducts").reset(),e.trigger("change:_availableProducts")}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch available posts","mailpoet"))})},_loadMoreProducts:function(){var e=this,t=this.get("_availableProducts").length,o=this.get("offset")+Number(this.get("amount"));return!(0===t||t<o||(this.set("offset",o),this.trigger("loadingMoreProducts"),$.getPosts(this.toJSON()).done(function(t){e.get("_availableProducts").add(t),e.trigger("change:_availableProducts")}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch available posts","mailpoet"))}).always(function(){e.trigger("moreProductsLoaded")}),0))},_refreshTransformedProducts:function(){var e=this,t=this.toJSON();t.posts=this.get("_selectedProducts").pluck("ID"),0!==t.posts.length?$.getTransformedPosts(t).done(function(t){e.get("_transformedProducts").get("blocks").reset(t,{parse:!0})}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch rendered posts","mailpoet"))}):this.get("_transformedProducts").get("blocks").reset()},_insertSelectedProducts:function(){var e=this.toJSON(),t=this.collection.indexOf(this),o=this.collection;e.posts=this.get("_selectedProducts").pluck("ID"),0!==e.posts.length&&$.getTransformedPosts(e).done(function(e){o.add(JSON.parse(JSON.stringify(e)),{at:t})}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch rendered posts","mailpoet"))})}}),Ze.ProductsBlockView=$e.BlockView.extend({className:"mailpoet_block mailpoet_products_block mailpoet_droppable_block",getTemplate:function(){return window.templates.productsBlock},modelEvents:{},regions:c.default.extend({productsRegion:".mailpoet_products_container"},$e.BlockView.prototype.regions),onDragSubstituteBy:function(){return Ze.ProductsWidgetView},initialize:function(){$e.BlockView.prototype.initialize.apply(this,arguments),this.toolsView=new Ze.ProductsBlockToolsView({model:this.model}),this.model.reply("blockView",this.notifyAboutSelf,this)},onRender:function(){var e,t;this.getRegion("toolsRegion").hasView()||this.showChildView("toolsRegion",this.toolsView),this.trigger("showSettings"),e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:(0,i.__)("There is no content to display.","mailpoet")},this.showChildView("productsRegion",new e({model:this.model.get("_transformedProducts"),renderOptions:t}))},notifyAboutSelf:function(){return this},onBeforeDestroy:function(){this.model.stopReplying("blockView",this.notifyAboutSelf,this)}}),Ze.ProductsBlockToolsView=$e.BlockToolsView.extend({getSettingsView:function(){return Ze.ProductsBlockSettingsView}}),Ze.ProductsBlockSettingsView=$e.BlockSettingsView.extend({getTemplate:function(){return window.templates.productsBlockSettings},regions:{selectionRegion:".mailpoet_settings_products_selection",displayOptionsRegion:".mailpoet_settings_products_display_options"},events:{"click .mailpoet_settings_products_show_display_options":"switchToDisplayOptions","click .mailpoet_settings_products_show_product_selection":"switchToProductSelection","click .mailpoet_settings_products_insert_selected":"insertProducts"},templateContext:function(){return{model:this.model.toJSON()}},initialize:function(){this.model.trigger("startEditing"),this.selectionView=new He({model:this.model}),this.displayOptionsView=new Le({model:this.model})},onRender:function(){var e=this;this.model.request("blockView"),this.showChildView("selectionRegion",this.selectionView),this.showChildView("displayOptionsRegion",this.displayOptionsView),r.U.Modal.panel({element:this.$el,template:"",position:"right",overlayRender:!1,width:C.getConfig().get("sidepanelWidth"),onCancel:function(){e.model.destroy()}}),this.selectionView.triggerMethod("attach"),this.displayOptionsView.triggerMethod("attach")},switchToDisplayOptions:function(){this.$(".mailpoet_settings_products_selection").addClass("mailpoet_closed"),this.$(".mailpoet_settings_products_display_options").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_products_show_display_options").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_products_show_product_selection").removeClass("mailpoet_hidden")},switchToProductSelection:function(){this.$(".mailpoet_settings_products_display_options").addClass("mailpoet_closed"),this.$(".mailpoet_settings_products_selection").removeClass("mailpoet_closed"),this.$(".mailpoet_settings_products_show_product_selection").addClass("mailpoet_hidden"),this.$(".mailpoet_settings_products_show_display_options").removeClass("mailpoet_hidden")},insertProducts:function(){this.model.trigger("insertSelectedProducts"),this.model.destroy(),this.close()}}),Ue=v().CollectionView.extend({className:"mailpoet_products_scroll_container",childView:function(){return Fe},emptyView:function(){return ze},childViewOptions:function(){return{blockModel:this.blockModel}},initialize:function(e){this.blockModel=e.blockModel},events:{scroll:"onProductsScroll"},onProductsScroll:function(e){var t=x()(e.target);t.scrollTop()+t.innerHeight()>=t[0].scrollHeight&&this.blockModel.trigger("loadMoreProducts")}}),He=v().View.extend({getTemplate:function(){return window.templates.postSelectionProductsBlockSettings},regions:{posts:".mailpoet_product_selection_container"},events:function(){return{"change .mailpoet_products_post_status":c.default.partial(this.changeField,"postStatus"),"input .mailpoet_products_search_term":c.default.partial(this.changeField,"search")}},modelEvents:{"change:offset":function(e,t){0===t&&this.$(".mailpoet_products_scroll_container").scrollTop(0)},loadingMoreProducts:function(){this.$(".mailpoet_product_selection_loading").css("visibility","visible")},moreProductsLoaded:function(){this.$(".mailpoet_product_selection_loading").css("visibility","hidden")}},templateContext:function(){return{model:this.model.toJSON()}},onRender:function(){var e;e=new Ue({collection:this.model.get("_availableProducts"),blockModel:this.model}),this.showChildView("posts",e)},onAttach:function(){var e=this;this.$(".mailpoet_products_categories_and_tags").select2({multiple:!0,allowClear:!0,placeholder:(0,i.__)("Categories & tags","mailpoet"),ajax:{data:function(e){return{term:e.term,page:e.page||1}},transport:function(t,o,n){var r,i=$.getTaxonomies(e.model.get("contentType")).then(function(e){return r=e,$.getTerms({search:t.data.term,page:t.data.page,taxonomies:c.default.keys(r)}).then(function(e){return{taxonomies:r,terms:e}})});return i.then(o),i.fail(n),i},processResults:function(e){return{results:c.default.map(e.terms,function(t){return c.default.defaults({text:e.taxonomies[t.taxonomy].labels.singular_name+": "+t.name,id:t.term_id},t)}),pagination:{more:100===e.terms.length}}}}}).on({"select2:select":function(t){var o=e.model.get("terms");o.add(t.params.data),e.model.set("terms",o.toJSON())},"select2:unselect":function(t){var o=e.model.get("terms");o.remove(t.params.data),e.model.set("terms",o.toJSON())}}).trigger("change")},changeField:function(e,t){this.model.set(e,x()(t.target).val())}}),ze=v().View.extend({getTemplate:function(){return window.templates.emptyPostProductsBlockSettings}}),Fe=v().View.extend({getTemplate:function(){return window.templates.singlePostProductsBlockSettings},events:function(){return{"change .mailpoet_select_product_checkbox":"productSelectionChange"}},templateContext:function(){return{model:this.model.toJSON(),index:this._index}},initialize:function(e){this.blockModel=e.blockModel},productSelectionChange:function(e){var t=x()(e.target),o=this.blockModel.get("_selectedProducts");t.prop("checked")?o.add(this.model):o.remove(this.model)}}),Le=$e.BlockSettingsView.extend({getTemplate:function(){return window.templates.displayOptionsProductsBlockSettings},events:function(){return{"click .mailpoet_products_select_button":"showButtonSettings","click .mailpoet_products_select_divider":"showDividerSettings","change .mailpoet_products_read_more_type":"changeReadMoreType","change .mailpoet_products_display_type":"changeDisplayType","change .mailpoet_products_title_format":"changeTitleFormat","change .mailpoet_products_title_as_links":c.default.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_products_show_divider":c.default.partial(this.changeBoolField,"showDivider"),"change .mailpoet_products_title_alignment":c.default.partial(this.changeField,"titleAlignment"),"change .mailpoet_products_image_full_width":c.default.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_products_featured_image_position":c.default.partial(this.changeField,"featuredImagePosition"),"change .mailpoet_products_price_position":c.default.partial(this.changeField,"pricePosition"),"input .mailpoet_products_read_more_text":c.default.partial(this.changeField,"readMoreText"),"change .mailpoet_products_title_position":c.default.partial(this.changeField,"titlePosition")}},templateContext:function(){return{model:this.model.toJSON()}},showButtonSettings:function(){new de.ButtonBlockSettingsView({model:this.model.get("readMoreButton"),renderOptions:{displayFormat:"subpanel",hideLink:!0,hideApplyToAll:!0}}).render()},showDividerSettings:function(){new ge.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeReadMoreType:function(e){var t=x()(e.target).val();"link"===t?(this.$(".mailpoet_products_read_more_text").removeClass("mailpoet_hidden"),this.$(".mailpoet_products_select_button").addClass("mailpoet_hidden")):"button"===t&&(this.$(".mailpoet_products_read_more_text").addClass("mailpoet_hidden"),this.$(".mailpoet_products_select_button").removeClass("mailpoet_hidden")),this.changeField("readMoreType",e)},changeDisplayType:function(e){"titleOnly"!==x()(e.target).val()?(this.$(".mailpoet_products_title_position").removeClass("mailpoet_hidden"),this.$(".mailpoet_products_title_position_separator").removeClass("mailpoet_hidden")):(this.$(".mailpoet_products_title_position").addClass("mailpoet_hidden"),this.$(".mailpoet_products_title_position_separator").addClass("mailpoet_hidden")),this.changeField("displayType",e)},changeTitleFormat:function(e){this.changeField("titleFormat",e)}}),Ze.ProductsWidgetView=$e.WidgetView.extend({className:$e.WidgetView.prototype.className+" mailpoet_droppable_layout_block",id:"automation_editor_block_products",getTemplate:function(){return window.templates.productsInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new Ze.ProductsBlockModel({},{parse:!0})}}}}),C.on("before:start",function(e){window.mailpoet_woocommerce_active&&(e.registerBlockType("products",{blockModel:Ze.ProductsBlockModel,blockView:Ze.ProductsBlockView}),e.registerWidget({name:"products",widgetView:Ze.ProductsWidgetView,priority:98}))});var je,We={},qe=ie,Ge=!0;We.AbandonedCartContentBlockModel=qe.BlockModel.extend({stale:["_selectedProducts","_availableProducts","_transformedProducts"],defaults:function(){return this._getDefaults({type:"abandonedCartContent",withLayout:!0,amount:"2",contentType:"product",postStatus:"publish",inclusionType:"include",displayType:"excerpt",titleFormat:"h1",titleAlignment:"left",titleIsLink:!1,imageFullWidth:!1,titlePosition:"abovePost",featuredImagePosition:"alternate",pricePosition:"below",readMoreType:"none",readMoreText:"",readMoreButton:{},sortBy:"newest",showDivider:!0,divider:{},_selectedProducts:[],_availableProducts:[],_transformedProducts:new(C.getBlockTypeModel("container"))},C.getConfig().get("blockDefaults.abandonedCartContent"))},relations:function(){return{divider:C.getBlockTypeModel("divider"),_selectedProducts:O().Collection,_availableProducts:O().Collection,_transformedProducts:C.getBlockTypeModel("container")}},initialize:function(){var e=c.default.debounce(this._refreshTransformedProducts.bind(this),500);c.default.extend(this,y().Requests),this._refreshTransformedProducts(),this.on("change",this._updateDefaults,this),this.listenTo(this.get("_selectedProducts"),"add remove reset",e),this.on("change:displayType change:titleFormat change:featuredImagePosition change:titleAlignment change:titleIsLink change:imageFullWidth change:pricePosition change:showDivider change:titlePosition",e),this.listenTo(this.get("divider"),"change",e)},_refreshTransformedProducts:function(){var e=this,t=this.toJSON();$.getTransformedPosts(t).done(function(t){e.get("_transformedProducts").get("blocks").reset(t,{parse:!0})}).fail(function(){r.U.Notice.error((0,i.__)("Failed to fetch rendered posts","mailpoet"))})}}),We.AbandonedCartContentBlockView=qe.BlockView.extend({className:"mailpoet_block mailpoet_abandoned_cart_content_block mailpoet_droppable_block",getTemplate:function(){return window.templates.abandonedCartContentBlock},modelEvents:c.default.omit(qe.BlockView.prototype.modelEvents,"change"),regions:c.default.extend({productsRegion:".mailpoet_abandoned_cart_content_container"},qe.BlockView.prototype.regions),onDragSubstituteBy:function(){return We.AbandonedCartContentBlockWidgetView},initialize:function(){qe.BlockView.prototype.initialize.apply(this,arguments),this.toolsView=new We.AbandonedCartContentBlockToolsView({model:this.model})},events:{"click .mailpoet_abandoned_cart_content_block_overlay":"showSettings"},onRender:function(){var e,t;Ge&&(this.getRegion("toolsRegion").hasView()||this.showChildView("toolsRegion",this.toolsView),e=C.getBlockTypeView("container"),t={disableTextEditor:!0,disableDragAndDrop:!0,emptyContainerMessage:(0,i.__)("There is no content to display.","mailpoet")},this.showChildView("productsRegion",new e({model:this.model.get("_transformedProducts"),renderOptions:t})))}}),We.AbandonedCartContentBlockToolsView=qe.BlockToolsView.extend({getSettingsView:function(){return We.AbandonedCartContentBlockSettingsView}}),We.AbandonedCartContentBlockSettingsView=qe.BlockSettingsView.extend({getTemplate:function(){return window.templates.abandonedCartContentBlockSettings},regions:{displayOptionsRegion:".mailpoet_settings_abandoned_cart_content_display_options"},events:{"click .mailpoet_done_editing":"close"},templateContext:function(){return{model:this.model.toJSON()}},initialize:function(){this.model.trigger("startEditing"),this.displayOptionsView=new je({model:this.model})},onRender:function(){this.model.request("blockView"),this.showChildView("displayOptionsRegion",this.displayOptionsView),r.U.Modal.panel({element:this.$el,template:"",position:"right",overlayRender:!1,width:C.getConfig().get("sidepanelWidth")}),this.displayOptionsView.triggerMethod("attach")}}),je=qe.BlockSettingsView.extend({getTemplate:function(){return window.templates.displayOptionsAbandonedCartContentBlockSettings},events:function(){return{"click .mailpoet_products_select_divider":"showDividerSettings","change .mailpoet_products_display_type":"changeDisplayType","change .mailpoet_products_title_format":"changeTitleFormat","change .mailpoet_products_title_as_links":c.default.partial(this.changeBoolField,"titleIsLink"),"change .mailpoet_products_show_divider":c.default.partial(this.changeBoolField,"showDivider"),"change .mailpoet_products_title_alignment":c.default.partial(this.changeField,"titleAlignment"),"change .mailpoet_products_image_full_width":c.default.partial(this.changeBoolField,"imageFullWidth"),"change .mailpoet_products_featured_image_position":c.default.partial(this.changeField,"featuredImagePosition"),"change .mailpoet_products_price_position":c.default.partial(this.changeField,"pricePosition"),"change .mailpoet_products_title_position":c.default.partial(this.changeField,"titlePosition")}},templateContext:function(){return{model:this.model.toJSON()}},showDividerSettings:function(){new ge.DividerBlockSettingsView({model:this.model.get("divider"),renderOptions:{displayFormat:"subpanel",hideApplyToAll:!0}}).render()},changeDisplayType:function(e){"titleOnly"!==x()(e.target).val()?(this.$(".mailpoet_products_title_position").removeClass("mailpoet_hidden"),this.$(".mailpoet_products_title_position_separator").removeClass("mailpoet_hidden")):(this.$(".mailpoet_products_title_position").addClass("mailpoet_hidden"),this.$(".mailpoet_products_title_position_separator").addClass("mailpoet_hidden")),this.changeField("displayType",e)},changeTitleFormat:function(e){this.changeField("titleFormat",e)}}),We.AbandonedCartContentBlockWidgetView=qe.WidgetView.extend({className:qe.WidgetView.prototype.className+" mailpoet_droppable_layout_block",id:"automation_editor_block_abandoned_cart_content",getTemplate:function(){return window.templates.abandonedCartContentInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new We.AbandonedCartContentBlockModel({},{parse:!0})}}}}),C.on("before:start",function(e,t){window.mailpoet_woocommerce_active&&(e.registerBlockType("abandonedCartContent",{blockModel:We.AbandonedCartContentBlockModel,blockView:We.AbandonedCartContentBlockView}),"woocommerce"===t.newsletter.options.group&&"woocommerce_abandoned_shopping_cart"===t.newsletter.options.event?e.registerWidget({name:"abandonedCartContent",widgetView:We.AbandonedCartContentBlockWidgetView,priority:100}):Ge=!1)});var Ye,Xe,Ke,Je,Qe,et={},tt=ie;et.SocialIconModel=k.extend({defaults:function(){var e=C.getConfig().get("socialIcons.custom");return{type:"socialIcon",iconType:"custom",link:e.get("defaultLink"),image:C.getAvailableStyles().get("socialIconSets.default.custom"),height:"32px",width:"32px",text:e.get("title")}},initialize:function(){var e=this;this.on("change:iconType",function(){var t=C.getConfig().get("socialIcons").get(e.get("iconType")),o=e.collection.iconBlockModel.getIconSet();this.set({link:t.get("defaultLink"),image:o.get(e.get("iconType")),text:t.get("title")})},this),this.on("change",function(){C.getChannel().trigger("autoSave")})}}),et.SocialIconCollectionModel=O().Collection.extend({model:et.SocialIconModel}),et.SocialBlockModel=tt.BlockModel.extend({name:"iconBlockModel",defaults:function(){return this._getDefaults({type:"social",iconSet:"default",styles:{block:{textAlign:"center"}},icons:new et.SocialIconCollectionModel},C.getConfig().get("blockDefaults.social"))},relations:{icons:et.SocialIconCollectionModel},initialize:function(){this.get("icons").on("add remove change",this._iconsChanged,this),this.on("change:iconSet",this.changeIconSet,this),this.on("change",this._updateDefaults,this)},getIconSet:function(){return C.getAvailableStyles().get("socialIconSets").get(this.get("iconSet"))},changeIconSet:function(){var e=this.getIconSet();c.default.each(this.get("icons").models,function(t){t.set("image",e.get(t.get("iconType")))})},_iconsChanged:function(){this._updateDefaults(),C.getChannel().trigger("autoSave")}}),Qe=v().View.extend({tagName:"span",getTemplate:function(){return window.templates.socialIconBlock},modelEvents:{change:"render"},templateContext:function(){var e=C.getAvailableStyles().get("socialIconSets");return{model:this.model.toJSON(),allIconSets:e.toJSON(),imageMissingSrc:C.getConfig().get("urls.imageMissing")}}}),et.SocialIconCollectionView=v().CollectionView.extend({childView:Qe}),et.SocialBlockView=tt.BlockView.extend({className:"mailpoet_block mailpoet_social_block mailpoet_droppable_block",getTemplate:function(){return window.templates.socialBlock},regions:c.default.extend({},tt.BlockView.prototype.regions,{icons:".mailpoet_social"}),ui:{tools:"> .mailpoet_tools"},behaviors:c.default.extend({},tt.BlockView.prototype.behaviors,{ShowSettingsBehavior:{}}),onDragSubstituteBy:function(){return et.SocialWidgetView},onRender:function(){this.toolsView=new et.SocialBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView),this.showChildView("icons",new et.SocialIconCollectionView({collection:this.model.get("icons")}))}}),et.SocialBlockToolsView=tt.BlockToolsView.extend({getSettingsView:function(){return et.SocialBlockSettingsView}}),et.SocialBlockSettingsView=tt.BlockSettingsView.extend({getTemplate:function(){return window.templates.socialBlockSettings},regions:{iconRegion:"#mailpoet_social_icons_selection",stylesRegion:"#mailpoet_social_icons_styles"},events:function(){return{"click .mailpoet_done_editing":"close","change .mailpoet_social_block_alignment":c.default.partial(this.changeField,"styles.block.textAlign")}},initialize:function(){tt.BlockSettingsView.prototype.initialize.apply(this,arguments),this._iconSelectorView=new Ye({model:this.model}),this._stylesView=new Je({model:this.model})},onRender:function(){this.showChildView("iconRegion",this._iconSelectorView),this.showChildView("stylesRegion",this._stylesView)}}),Xe=v().View.extend({getTemplate:function(){return window.templates.socialSettingsIcon},events:function(){return{"click .mailpoet_delete_block":"deleteIcon","change .mailpoet_social_icon_field_type":c.default.partial(this.changeField,"iconType"),"input .mailpoet_social_icon_field_image":c.default.partial(this.changeUrlField,"image"),"change .mailpoet_social_icon_field_link":this.changeLink,"input .mailpoet_social_icon_field_text":c.default.partial(this.changeField,"text")}},modelEvents:{"change:iconType":"render","change:image":function(){this.$(".mailpoet_social_icon_image").attr("src",this.model.get("image"))},"change:text":function(){this.$(".mailpoet_social_icon_image").attr("alt",this.model.get("text"))}},templateContext:function(){var e=C.getConfig().get("socialIcons"),t=c.default.map(c.default.keys(e.attributes),function(t){return{iconType:t,title:e.get(t).get("title")}}),o=C.getAvailableStyles().get("socialIconSets");return c.default.extend({},tt.BlockView.prototype.templateContext.apply(this,arguments),{iconTypes:t,currentType:e.get(this.model.get("iconType")).toJSON(),allIconSets:o.toJSON()})},deleteIcon:function(){this.model.destroy()},changeLink:function(e){if("email"!==this.model.get("iconType"))return this.changeUrlField("link",e);this.model.set("link","mailto:"+x()(e.target).val())},changeField:tt.BlockSettingsView.prototype.changeField,changeUrlField:tt.BlockSettingsView.prototype.changeUrlField}),Ke=v().CollectionView.extend({behaviors:{SortableBehavior:{items:"> div"}},childViewContainer:"#mailpoet_social_icon_selector_contents",childView:Xe}),Ye=v().View.extend({getTemplate:function(){return window.templates.socialSettingsIconSelector},regions:{icons:"#mailpoet_social_icon_selector_contents"},events:{"click .mailpoet_add_social_icon":"addSocialIcon"},modelEvents:{"change:iconSet":"render"},addSocialIcon:function(){this.model.get("icons").add({})},onRender:function(){this.showChildView("icons",new Ke({collection:this.model.get("icons")}))}}),Je=v().View.extend({getTemplate:function(){return window.templates.socialSettingsStyles},modelEvents:{change:"render"},events:{"click .mailpoet_social_icon_set":"changeSocialIconSet"},initialize:function(){this.listenTo(this.model.get("icons"),"add remove change",this.render)},templateContext:function(){var e=C.getAvailableStyles().get("socialIconSets");return{activeSet:this.model.get("iconSet"),socialIconSets:e.toJSON(),availableSets:c.default.keys(e.toJSON()),availableSocialIcons:this.model.get("icons").pluck("iconType"),imageMissingSrc:C.getConfig().get("urls.imageMissing")}},changeSocialIconSet:function(e){this.model.set("iconSet",x()(e.currentTarget).data("setname"))},onBeforeDestroy:function(){this.model.get("icons").off("add remove",this.render,this)}}),et.SocialWidgetView=tt.WidgetView.extend({id:"automation_editor_block_social",getTemplate:function(){return window.templates.socialInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new et.SocialBlockModel}}}}),C.on("before:start",function(e){e.registerBlockType("social",{blockModel:et.SocialBlockModel,blockView:et.SocialBlockView}),e.registerWidget({name:"social",widgetView:et.SocialWidgetView,priority:95})});const ot=ie.BlockModel.extend({stale:["selected"],defaults(){return this._getDefaults({type:"woocommerceContent",selected:"completed_order"},C.getConfig().get("blockDefaults.woocommerceContent"))}}),nt=ie.BlockToolsView.extend({tools:{move:!0}}),rt=ie.WidgetView.extend({className:ie.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:()=>window.templates.woocommerceContentInsertion,behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:()=>new ot({},{parse:!0})}}}),it=ie.BlockView.extend({className:"mailpoet_block mailpoet_woocommerce_content_block mailpoet_droppable_block",initialize:function(){ie.BlockView.prototype.initialize.apply(this,arguments),this.listenTo(C.getChannel(),"changeWCEmailType",e=>{this.model.set("selected",e),this.render()})},getTemplate(){return window.mailpoet_woocommerce_email_improvements_enabled?"new_account"===this.model.get("selected")?window.templates.woocommerceNewAccountImproved:"processing_order"===this.model.get("selected")?window.templates.woocommerceProcessingOrderImproved:"completed_order"===this.model.get("selected")?window.templates.woocommerceCompletedOrderImproved:window.templates.woocommerceCustomerNoteImproved:"new_account"===this.model.get("selected")?window.templates.woocommerceNewAccount:"processing_order"===this.model.get("selected")?window.templates.woocommerceProcessingOrder:"completed_order"===this.model.get("selected")?window.templates.woocommerceCompletedOrder:window.templates.woocommerceCustomerNote},regions:{toolsRegion:".mailpoet_tools"},onDragSubstituteBy:()=>rt,onRender(){this.toolsView=new nt({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},templateContext(){return{viewCid:this.cid,model:this.model.toJSON(),selected:this.model.get("selected"),siteName:window.mailpoet_site_name,siteAddress:window.mailpoet_site_address}}});C.on("before:start",e=>{e.registerBlockType("woocommerceContent",{blockModel:ot,blockView:it})});const st=ie.BlockModel.extend({stale:["contents","selected"],defaults(){return this._getDefaults({type:"woocommerceHeading",selected:"completed_order"},C.getConfig().get("blockDefaults.woocommerceHeading"))}}),at=ie.BlockToolsView.extend({tools:{move:!0}}),lt=ie.WidgetView.extend({className:ie.WidgetView.prototype.className+" mailpoet_droppable_layout_block",getTemplate:()=>window.templates.woocommerceHeadingInsertion,behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:()=>new st({},{parse:!0})}}}),ct=ie.BlockView.extend({className:"mailpoet_container mailpoet_woocommerce_heading_block mailpoet_droppable_block",initialize:function(){ie.BlockView.prototype.initialize.apply(this,arguments),this.listenTo(C.getChannel(),"changeWCEmailType",e=>{this.model.set("selected",e),this.render()})},modelEvents:c.default.omit(ie.BlockView.prototype.modelEvents,"change"),getTemplate:()=>window.templates.woocommerceHeadingBlock,regions:{toolsRegion:".mailpoet_tools"},onDragSubstituteBy:()=>lt,onRender(){this.toolsView=new at({model:this.model}),this.showChildView("toolsRegion",this.toolsView)},templateContext(){const e=this.model.get("contents").toJSON(),t=this.model.get("selected");return{viewCid:this.cid,model:this.model.toJSON(),content:e[t]}}});C.on("before:start",e=>{e.registerBlockType("woocommerceHeading",{blockModel:st,blockView:ct})});var dt=o(70390),ut=o.n(dt);const ht={},mt=ie;ht.BlockModel=mt.BlockModel.extend({}),ht.BlockView=mt.BlockView.extend({className:"mailpoet_block mailpoet_fallback_block mailpoet_droppable_block",getTemplate:function(){return window.templates.unknownBlockFallbackBlock},onRender:function(){this.toolsView=new ht.BlockToolsView({model:this.model,tools:{settings:!1,duplicate:!1}}),ut()(()=>{this.showChildView("toolsRegion",this.toolsView)})},templateContext(){return{blockType:this.model.get("type")}}}),ht.WidgetView=mt.WidgetView.extend({id:"automation_editor_block_fallback",getTemplate:function(){return window.templates.unknownBlockFallbackInsertion},behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:function(){return new ht.BlockModel}}}}),ht.BlockToolsView=mt.BlockToolsView.extend({}),C.on("before:start",function(e){e.registerBlockType("unknownBlockFallback",{blockModel:ht.BlockModel,blockView:ht.BlockView})});var pt=o(13722),gt=o(50744),ft=o(22979),vt=o(24071),bt=o(19253),yt=o(87691),wt=o(58319),_t=o(58270),xt=o(69611);class Ct extends A.Component{availableDiscountTypes;getValueCallback;setValueCallback;loadCouponsDebounced=(0,U.debounce)(()=>{this.loadCoupons()},300);constructor(e){super(e),this.getValueCallback=e.getValueCallback,this.setValueCallback=e.setValueCallback,this.availableDiscountTypes=[{label:(0,i.__)("All types","mailpoet"),value:""},...e.availableDiscountTypes??[]],this.state={couponSearch:"",couponFilterDiscountType:"",couponId:this.getValueCallback("couponId"),availableCoupons:[],loadingInitial:!1,loadingMore:!1,pageNumber:1,moreCouponsAvailable:!0}}componentDidMount(){this.loadCoupons()}handleSearchInputChange=e=>{this.setState({couponSearch:e},()=>this.loadCouponsDebounced())};fetchCoupons(e){const t=e?"loadingInitial":"loadingMore";r.U.Ajax.post({api_version:r.U.apiVersion,endpoint:"coupons",action:"getCoupons",data:{page_size:1e3,page_number:this.state.pageNumber,discount_type:this.state.couponFilterDiscountType,search:this.state.couponSearch,include_coupon_ids:[this.state.couponId]}}).then(o=>{const n=o.data||[];let r=[];if(e)r=n;else{const{availableCoupons:e}=this.state;r=(0,U.uniqBy)([...e,...n],"id")}this.setState(e=>({...e,availableCoupons:r,moreCouponsAvailable:n.length>0,[t]:!1}))}).catch(()=>{r.U.Notice.error((0,i.__)("Loading coupons was not successful","mailpoet"),{scroll:!0}),this.setState(e=>({...e,[t]:!1}))})}loadCoupons(){this.setState({pageNumber:1,loadingInitial:!0},()=>this.fetchCoupons(!0))}loadMoreCoupons(){const{pageNumber:e}=this.state,t=e+1;this.setState({pageNumber:t,loadingMore:!0},()=>this.fetchCoupons(!1))}render(){const{loadingInitial:e,loadingMore:t,moreCouponsAvailable:o,availableCoupons:n}=this.state;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(ft.A,{children:(0,m.jsxs)(vt.Ay,{children:[(0,m.jsx)(bt.A,{children:(0,m.jsx)(yt.A,{value:this.state.couponSearch,onChange:this.handleSearchInputChange})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(wt.A,{label:(0,i.__)("Discount type","mailpoet"),onChange:e=>{this.setState({couponFilterDiscountType:e},()=>this.loadCoupons())},options:this.availableDiscountTypes,value:this.state.couponFilterDiscountType})})]})}),(0,m.jsx)(ft.A,{children:(0,m.jsx)(vt.Ay,{className:"mailpoet-coupon-block-existing-coupons",children:(0,m.jsxs)(bt.A,{children:[e?(0,m.jsx)("div",{className:"mailpoet_coupon_block_coupon",children:(0,m.jsx)(_t.Ay,{})}):null,!e&&n.length>0?n.map(e=>{const t=this.availableDiscountTypes.find(t=>t.value===e.discountType);return(0,m.jsxs)("div",{className:"mailpoet_coupon_block_coupon",children:[(0,m.jsx)("input",{id:`coupon-${e.id}`,className:"components-radio-control__input",name:"coupon",type:"radio",value:e.id,checked:e.id===this.state.couponId,onChange:t=>{const o=Number(t.target.value);this.setState({couponId:o}),this.setValueCallback("couponId",o),this.setValueCallback("code",e.text)}}),(0,m.jsx)("label",{htmlFor:`coupon-${e.id}`,children:e.text}),(0,m.jsx)("div",{className:"discount_type",children:t.label}),e.excerpt?(0,m.jsx)("div",{children:e.excerpt}):null]},`coupon-${e.id}`)}):null,e||0!==n.length?null:(0,m.jsx)("div",{className:"mailpoet_coupon_block_coupon",children:(0,i.__)("No coupons found","mailpoet")}),!t&&o?(0,m.jsx)(xt.Ay,{variant:"secondary",onClick:()=>this.loadMoreCoupons(),children:(0,i.__)("Load more","mailpoet")}):null,t?(0,m.jsx)(_t.Ay,{}):null]})})})]})}}var kt=o(19718),St=o(46683);class Tt extends A.Component{availableDiscountTypes;getValueCallback;setValueCallback;constructor(e){super(e),this.availableDiscountTypes=e.availableDiscountTypes,this.getValueCallback=e.getValueCallback,this.setValueCallback=e.setValueCallback,this.state={amount:this.getValueCallback("amount"),amountMax:this.getValueCallback("amountMax"),discountType:this.getValueCallback("discountType"),expiryDay:this.getValueCallback("expiryDay"),freeShipping:this.getValueCallback("freeShipping")},this.discountTypeChange=this.discountTypeChange.bind(this)}discountTypeChange=e=>{const t=x()(".mailpoet_field_coupon_amount input");t.parsley().destroy();let o="";o=e.includes("percent")?"100":"1000000",t.prop("max",o),t.parsley().validate(),this.setState({amountMax:o,discountType:e}),this.setValueCallback("amountMax",o),this.setValueCallback("discountType",e)};render(){return(0,m.jsx)(ft.A,{children:(0,m.jsxs)(vt.Ay,{title:(0,i.__)("General settings","mailpoet"),children:[(0,m.jsx)(bt.A,{children:(0,m.jsx)(wt.A,{label:(0,i.__)("Discount type","mailpoet"),onChange:this.discountTypeChange,options:this.availableDiscountTypes,value:this.state.discountType})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(kt.A,{className:"mailpoet_field_coupon_amount",label:(0,i.__)("Coupon amount","mailpoet"),onChange:e=>{this.setState({amount:e}),x()(".mailpoet_field_coupon_amount input").parsley().isValid()&&this.setValueCallback("amount",e)},type:"number",min:"0",max:this.state.amountMax,value:this.state.amount,"data-parsley-validate":!0,"data-parsley-required":!0,"data-parsley-validation-threshold":"0","data-parsley-trigger":"input"})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(kt.A,{className:"mailpoet_field_coupon_expiry_day",label:(0,i.__)("Expires in","mailpoet"),onChange:e=>{this.setState({expiryDay:e}),x()(".mailpoet_field_coupon_expiry_day input").parsley().isValid()&&this.setValueCallback("expiryDay",e)},min:"0",type:"number",value:this.state.expiryDay,"data-parsley-required":!0,"data-parsley-validation-threshold":"0","data-parsley-trigger":"input"})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(St.A,{checked:this.state.freeShipping,label:(0,i.__)("Free shipping","mailpoet"),onChange:e=>{this.setValueCallback("freeShipping",e),this.setState({freeShipping:e})}})})]})})}}var Et=o(16037);class Ot extends A.Component{getValueCallback;setValueCallback;priceDecimalSeparator;constructor(e){super(e),this.getValueCallback=e.getValueCallback,this.setValueCallback=e.setValueCallback,this.priceDecimalSeparator=e.priceDecimalSeparator,this.state={minimumAmount:this.getValueCallback("minimumAmount"),maximumAmount:this.getValueCallback("maximumAmount"),individualUse:this.getValueCallback("individualUse"),excludeSaleItems:this.getValueCallback("excludeSaleItems"),productIds:this.getValueCallback("productIds").toJSON(),excludedProductIds:this.getValueCallback("excludedProductIds").toJSON(),productCategoryIds:this.getValueCallback("productCategoryIds").toJSON(),excludedProductCategoryIds:this.getValueCallback("excludedProductCategoryIds").toJSON(),emailRestrictions:this.getValueCallback("emailRestrictions"),restrictToSubscriber:this.getValueCallback("restrictToSubscriber")||!1}}handleSelection=e=>{const t=this.getValueCallback(e.target.name);t.reset(e.target.value.map(e=>({id:e}))),this.setValueCallback(e.target.name,t);const o={};o[e.target.name]=e.target.value,this.setState(o)};render(){const e={forceSelect2:!0,endpoint:"products",resetSelect2OnUpdate:!0,multiple:!0,placeholder:(0,i.__)("Search for a product…","mailpoet")},t={forceSelect2:!0,endpoint:"product_categories",resetSelect2OnUpdate:!0,multiple:!0};return(0,m.jsx)(ft.A,{children:(0,m.jsxs)(vt.Ay,{title:(0,i.__)("Usage restriction","mailpoet"),className:"mailpoet-coupon-block-usage-restriction",initialOpen:!1,children:[(0,m.jsx)(bt.A,{children:(0,m.jsx)(kt.A,{className:"mailpoet_field_coupon_minimum_amount",label:(0,i.__)("Minimum spend","mailpoet"),value:this.state.minimumAmount,placeholder:(0,i.__)("No minimum","mailpoet"),onChange:e=>{this.setState({minimumAmount:e}),x()(".mailpoet_field_coupon_minimum_amount input").parsley().isValid()&&this.setValueCallback("minimumAmount",e)},pattern:`[0-9]+([${this.priceDecimalSeparator}][0-9]+)?`,"data-parsley-validate":!0,"data-parsley-trigger":"input","data-parsley-validation-threshold":"1","data-parsley-error-message":(0,i.__)("Please enter a value with one monetary decimal point (%s) without thousand separators and currency symbols.","mailpoet").replace("%s",this.priceDecimalSeparator)})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(kt.A,{className:"mailpoet_field_coupon_maximum_amount",label:(0,i.__)("Maximum spend","mailpoet"),value:this.state.maximumAmount,placeholder:(0,i.__)("No maximum","mailpoet"),onChange:e=>{this.setState({maximumAmount:e}),x()(".mailpoet_field_coupon_maximum_amount input").parsley().isValid()&&this.setValueCallback("maximumAmount",e)},pattern:`[0-9]+([${this.priceDecimalSeparator}][0-9]+)?`,"data-parsley-validate":!0,"data-parsley-trigger":"input","data-parsley-validation-threshold":"1","data-parsley-error-message":(0,i.__)("Please enter a value with one monetary decimal point (%s) without thousand separators and currency symbols.","mailpoet").replace("%s",this.priceDecimalSeparator)})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(St.A,{checked:this.state.individualUse,label:(0,i.__)("Individual use only","mailpoet"),onChange:e=>{this.setValueCallback("individualUse",e),this.setState({individualUse:e})},help:(0,i.__)("Coupon cannot be used in conjunction with other coupons.","mailpoet")})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(St.A,{checked:this.state.excludeSaleItems,label:(0,i.__)("Exclude sale items","mailpoet"),onChange:e=>{this.setValueCallback("excludeSaleItems",e),this.setState({excludeSaleItems:e})},help:(0,i.__)("Coupon does not apply to items on sale.","mailpoet")})}),(0,m.jsxs)(bt.A,{children:[(0,m.jsx)("label",{htmlFor:"productIds",children:(0,i.__)("Products","mailpoet")}),(0,m.jsx)(Et.L,{field:{...e,name:"productIds",selected:()=>this.state.productIds.map(e=>e.id)},onValueChange:this.handleSelection})]}),(0,m.jsxs)(bt.A,{children:[(0,m.jsx)("label",{htmlFor:"excludedProductIds",children:(0,i.__)("Excluded products","mailpoet")}),(0,m.jsx)(Et.L,{field:{...e,name:"excludedProductIds",selected:()=>this.state.excludedProductIds.map(e=>e.id)},onValueChange:this.handleSelection})]}),(0,m.jsxs)(bt.A,{children:[(0,m.jsx)("label",{htmlFor:"productCategoriesIds",children:(0,i.__)("Product categories","mailpoet")}),(0,m.jsx)(Et.L,{field:{...t,name:"productCategoryIds",placeholder:(0,i.__)("Any category","mailpoet"),selected:()=>this.state.productCategoryIds.map(e=>e.id)},onValueChange:this.handleSelection})]}),(0,m.jsxs)(bt.A,{children:[(0,m.jsx)("label",{htmlFor:"excludedProductCategoryIds",children:(0,i.__)("Exclude product categories","mailpoet")}),(0,m.jsx)(Et.L,{field:{...t,name:"excludedProductCategoryIds",placeholder:(0,i.__)("No categories","mailpoet"),selected:()=>this.state.excludedProductCategoryIds.map(e=>e.id)},onValueChange:this.handleSelection})]}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(kt.A,{className:"mailpoet_field_coupon_email_restrictions",label:(0,i.__)("Allowed emails","mailpoet"),value:this.state.emailRestrictions,placeholder:(0,i.__)("No restrictions","mailpoet"),onChange:e=>{this.setState({emailRestrictions:e}),x()(".mailpoet_field_coupon_email_restrictions input").parsley().isValid()&&this.setValueCallback("emailRestrictions",e)},type:"text",pattern:"/^([\\w\\d._\\-#\\*])+@([\\w\\d._\\-#\\*]+[.][\\w\\d._\\-#\\*]+)+(,([\\w\\d._\\-#\\*])+@([\\w\\d._\\-#\\*]+[.][\\w\\d._\\-#\\*]+))*$/","data-parsley-validate":!0,"data-parsley-validation-threshold":"1","data-parsley-trigger":"input","data-parsley-error-message":(0,i.__)('Separate email addresses with commas. You can also use an asterisk (*) to match parts of an email. For example "*@gmail.com" would match all gmail addresses.',"mailpoet")})}),this.getValueCallback("showRestrictToSubscriber")&&(0,m.jsx)(bt.A,{children:(0,m.jsx)(St.A,{checked:this.state.restrictToSubscriber,label:(0,i.__)("Restrict to subscriber email","mailpoet"),onChange:e=>{this.setValueCallback("restrictToSubscriber",e),this.setState({restrictToSubscriber:e})},help:(0,i.__)("Restrict coupon usage to the subscriber receiving this email.","mailpoet")})})]})})}}class At extends A.Component{getValueCallback;setValueCallback;constructor(e){super(e),this.getValueCallback=e.getValueCallback,this.setValueCallback=e.setValueCallback,this.state={usageLimit:this.getValueCallback("usageLimit"),usageLimitPerUser:this.getValueCallback("usageLimitPerUser")}}render(){return(0,m.jsx)(ft.A,{children:(0,m.jsxs)(vt.Ay,{title:(0,i.__)("Usage limits","mailpoet"),className:"mailpoet-coupon-block-usage-limits",initialOpen:!1,children:[(0,m.jsx)(bt.A,{children:(0,m.jsx)(kt.A,{label:(0,i.__)("Usage limit per coupon","mailpoet"),value:this.state.usageLimit,placeholder:(0,i.__)("Unlimited usage","mailpoet"),type:"number",onChange:e=>{this.setValueCallback("usageLimit",e),this.setState({usageLimit:e})}})}),(0,m.jsx)(bt.A,{children:(0,m.jsx)(kt.A,{label:(0,i.__)("Usage limit per user","mailpoet"),value:this.state.usageLimitPerUser,placeholder:(0,i.__)("Unlimited usage","mailpoet"),type:"number",onChange:e=>{this.setValueCallback("usageLimitPerUser",e),this.setState({usageLimitPerUser:e})}})})]})})}}var Mt=o(57470);const{lock:Bt,unlock:Rt}=(0,Mt.yf)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/edit-post"),{Tabs:Nt}=Rt(gt.j);var Vt=function(e){return e.allCoupons="allCoupons",e.createNew="createNew",e}(Vt||{});function Dt({availableDiscountTypes:e,getValueCallback:t,setValueCallback:o,priceDecimalSeparator:n,codePlaceholder:r}){const[s,a]=(0,A.useState)(t("source")),l=(0,A.useCallback)(e=>{o("source",e),a(e),e===Vt.createNew?(o("code",r),o("couponId",""),jQuery(".mailpoet_editor_coupon_overlay").css("visibility","visible")):e===Vt.allCoupons&&jQuery(".mailpoet_editor_coupon_overlay").css("visibility","hidden")},[r,o]);return(0,m.jsx)(d.ErrorBoundary,{children:(0,m.jsx)(pt.F.Provider,{value:(0,pt.f)(window),children:(0,m.jsxs)(Nt,{selectedTabId:s,onSelect:l,children:[(0,m.jsx)("div",{className:"components-panel__header interface-complementary-area-header edit-post-sidebar__panel-tabs",children:(0,m.jsxs)(Nt.TabList,{children:[(0,m.jsx)(Nt.Tab,{tabId:Vt.allCoupons,children:(0,i.__)("All coupons","mailpoet")}),(0,m.jsx)(Nt.Tab,{tabId:Vt.createNew,children:(0,i.__)("Create new","mailpoet")})]})}),(0,m.jsx)(Nt.TabPanel,{tabId:Vt.allCoupons,children:(0,m.jsx)(Ct,{availableDiscountTypes:e,getValueCallback:t,setValueCallback:o})}),(0,m.jsx)(Nt.TabPanel,{tabId:Vt.createNew,children:(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Tt,{availableDiscountTypes:e,getValueCallback:t,setValueCallback:o}),(0,m.jsx)(Ot,{getValueCallback:t,setValueCallback:o,priceDecimalSeparator:n}),(0,m.jsx)(At,{getValueCallback:t,setValueCallback:o})]})})]})})})}const Pt={},It=ie;Pt.CouponBlockModel=It.BlockModel.extend({defaults(){return this._getDefaults({isStandardEmail:C.getNewsletter().isStandardEmail(),isAutomationEmail:C.getNewsletter().isAutomationEmail(),productIds:[],excludedProductIds:[],productCategoryIds:[],excludedProductCategoryIds:[],type:"coupon",amount:10,amountMax:100,discountType:"percent",expiryDay:10,usageLimit:"",usageLimitPerUser:"",minimumAmount:"",maximumAmount:"",emailRestrictions:"",restrictToSubscriber:!1,showRestrictToSubscriber:C.getNewsletter().isAutomationEmail()||C.getNewsletter().isWelcomeEmail(),styles:{block:{backgroundColor:"#ffffff",borderColor:"#000000",borderRadius:"5px",borderStyle:"solid",borderWidth:"1px",fontColor:"#000000",fontFamily:"Verdan",fontSize:"18px",fontWeight:"normal",lineHeight:"40px",textAlign:"center",width:"200px"}},source:"createNew",code:C.getConfig().get("coupon.code_placeholder")},C.getConfig().get("blockDefaults.coupon"))}}),Pt.CouponBlockView=It.BlockView.extend({className:"mailpoet_block mailpoet_coupon_block mailpoet_droppable_block",getTemplate:()=>window.templates.couponBlock,onDragSubstituteBy:()=>Pt.CouponWidgetView,behaviors:c.default.extend({},It.BlockView.prototype.behaviors,{ShowSettingsBehavior:{}}),initialize(...e){It.BlockView.prototype.initialize.apply(this,e),this.replaceCouponStylesHandler=e=>{this.model.set(e)},C.getChannel().on("replaceAllCouponStyles",this.replaceCouponStylesHandler)},onRender(){this.toolsView=new Pt.CouponBlockToolsView({model:this.model}),this.showChildView("toolsRegion",this.toolsView)}}),Pt.CouponBlockToolsView=It.BlockToolsView.extend({getSettingsView:()=>Pt.CouponBlockSettingsView}),Pt.CouponBlockSettingsView=It.BlockSettingsView.extend({getTemplate:()=>window.templates.couponBlockSettings,events(){return{"change .mailpoet_field_coupon_alignment":c.default.partial(this.changeField,"styles.block.textAlign"),"change .mailpoet_field_coupon_font_color":c.default.partial(this.changeColorField,"styles.block.fontColor"),"change .mailpoet_field_coupon_font_family":c.default.partial(this.changeField,"styles.block.fontFamily"),"change .mailpoet_field_coupon_font_size":c.default.partial(this.changeField,"styles.block.fontSize"),"change .mailpoet_field_coupon_background_color":c.default.partial(this.changeColorField,"styles.block.backgroundColor"),"change .mailpoet_field_coupon_border_color":c.default.partial(this.changeColorField,"styles.block.borderColor"),"change .mailpoet_field_coupon_font_weight":"changeFontWeight","input .mailpoet_field_coupon_border_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_border_width_input",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"change .mailpoet_field_coupon_border_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_border_width_input",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_coupon_border_width_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_border_width",c.default.partial(this.changePixelField,"styles.block.borderWidth").bind(this)),"input .mailpoet_field_coupon_border_radius":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_border_radius_input",c.default.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"change .mailpoet_field_coupon_border_radius":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_border_radius_input",c.default.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_coupon_border_radius_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_border_radius",c.default.partial(this.changePixelField,"styles.block.borderRadius").bind(this)),"input .mailpoet_field_coupon_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_width_input",c.default.partial(this.changePixelField,"styles.block.width").bind(this)),"change .mailpoet_field_coupon_width":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_width_input",c.default.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_coupon_width_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_width",c.default.partial(this.changePixelField,"styles.block.width").bind(this)),"input .mailpoet_field_coupon_line_height":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_line_height_input",c.default.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"change .mailpoet_field_coupon_line_height":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_line_height_input",c.default.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"input .mailpoet_field_coupon_line_height_input":c.default.partial(this.updateValueAndCall,".mailpoet_field_coupon_line_height",c.default.partial(this.changePixelField,"styles.block.lineHeight").bind(this)),"click .mailpoet_field_coupon_replace_all_styles":"applyToAll","click .mailpoet_done_editing":"close","click .mailpoet_settings_coupon_show_coupon_configuration":"switchToCouponConfiguration","click .mailpoet_settings_coupon_show_display_options":"switchToDisplayOptions"}},templateContext(...e){return c.default.extend({},It.BlockView.prototype.templateContext.apply(this,e),{availableStyles:C.getAvailableStyles().toJSON(),renderOptions:this.renderOptions})},applyToAll(){C.getChannel().trigger("replaceAllCouponStyles",c.default.pick(this.model.toJSON(),"styles","type"))},updateValueAndCall(e,t,o){this.$(e).val(x()(o.target).val()),t(o)},changeFontWeight(e){const t=!!x()(e.target).prop("checked");this.model.set("styles.block.fontWeight",t?x()(e.target).val():"normal")},switchToDisplayOptions(){x()(".mailpoet_coupon_block_settings").addClass("mailpoet_closed"),x()(".mailpoet_coupon_block_display_options").removeClass("mailpoet_closed"),x()(".mailpoet_settings_coupon_show_display_options").addClass("mailpoet_hidden"),x()(".mailpoet_settings_coupon_show_coupon_configuration").removeClass("mailpoet_hidden")},switchToCouponConfiguration(){x()(".mailpoet_coupon_block_display_options").addClass("mailpoet_closed"),x()(".mailpoet_coupon_block_settings").removeClass("mailpoet_closed"),x()(".mailpoet_settings_coupon_show_coupon_configuration").addClass("mailpoet_hidden"),x()(".mailpoet_settings_coupon_show_display_options").removeClass("mailpoet_hidden")},onRender(){const e=document.getElementById("mailpoet_coupon_block_settings");(0,s.H)(e).render((0,m.jsx)(Dt,{availableDiscountTypes:C.getConfig().get("coupon.discount_types").toJSON(),codePlaceholder:C.getConfig().get("coupon.code_placeholder"),priceDecimalSeparator:C.getConfig().get("coupon.price_decimal_separator"),setValueCallback:(e,t)=>this.model.set(e,t),getValueCallback:e=>this.model.get(e)}))}}),Pt.CouponWidgetView=It.WidgetView.extend({id:"automation_editor_block_coupon",getTemplate:()=>window.templates.couponInsertion,behaviors:{DraggableBehavior:{cloneOriginal:!0,drop:()=>new Pt.CouponBlockModel}}}),C.on("before:start",e=>{window.MailPoet.isWoocommerceActive&&(e.registerBlockType("coupon",{blockModel:Pt.CouponBlockModel,blockView:Pt.CouponBlockView}),e.registerWidget({name:"coupon",widgetView:Pt.CouponWidgetView,priority:92}))}),(0,d.registerTranslations)(),window.Backbone&&window.Backbone.noConflict()},53306(e,t,o){e.exports=function(e,t,o){"use strict";e="default"in e?e.default:e,t="default"in t?t.default:t,o="default"in o?o.default:o;var n="3.2.0",r=function(e){return function(t){for(var o=arguments.length,n=Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return e.apply(t,n)}},i=e.Model.extend,s=function e(o,n){t.isObject(o)&&(o=o.prev+" is going to be removed in the future. Please use "+o.next+" instead."+(o.url?" See: "+o.url:"")),Ee.DEV_MODE&&(void 0!==n&&n||e._cache[o]||(e._warn("Deprecation warning: "+o),e._cache[o]=!0))};s._console="undefined"!=typeof console?console:{},s._warn=function(){return(s._console.warn||s._console.log||t.noop).apply(s._console,arguments)},s._cache={};var a=function(e){return document.documentElement.contains(e&&e.parentNode)},l=function(e,o){var n=this;e&&t.each(o,function(t){var o=e[t];void 0!==o&&(n[t]=o)})},c=function(e){if(e)return this.options&&void 0!==this.options[e]?this.options[e]:this[e]},d=function(e){var o=this;return t.reduce(e,function(e,n,r){return t.isFunction(n)||(n=o[n]),n&&(e[r]=n),e},{})},u=/(^|:)(\w)/gi;function h(e,t,o){return o.toUpperCase()}var m=t.memoize(function(e){return"on"+e.replace(u,h)});function p(e){for(var o=arguments.length,n=Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];var i=m(e),s=c.call(this,i),a=void 0;return t.isFunction(s)&&(a=s.apply(this,n)),this.trigger.apply(this,arguments),a}function g(e){for(var o=arguments.length,n=Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return t.isFunction(e.triggerMethod)?e.triggerMethod.apply(e,n):p.apply(e,n)}function f(e,o,n){e._getImmediateChildren&&t.each(e._getImmediateChildren(),function(e){n(e)&&g(e,o,e)})}function v(e){return!e._isAttached}function b(e){return!!v(e)&&(e._isAttached=!0,!0)}function y(e){return e._isAttached}function w(e){return!!y(e)&&(e._isAttached=!1,!0)}function _(e){e._isAttached&&e._isRendered&&g(e,"dom:refresh",e)}function x(){f(this,"before:attach",v)}function C(){f(this,"attach",b),_(this)}function k(){f(this,"before:detach",y)}function S(){f(this,"detach",w)}function T(){_(this)}function E(e){e._areViewEventsMonitored||(e._areViewEventsMonitored=!0,e.on({"before:attach":x,attach:C,"before:detach":k,detach:S,render:T}))}var O=["description","fileName","lineNumber","name","message","number"],A=i.call(Error,{urlRoot:"http://marionettejs.com/docs/v3.2.0/",constructor:function(e,o){t.isObject(e)?e=(o=e).message:o||(o={});var n=Error.call(this,e);t.extend(this,t.pick(n,O),t.pick(o,O)),this.captureStackTrace(),o.url&&(this.url=this.urlRoot+o.url)},captureStackTrace:function(){Error.captureStackTrace&&Error.captureStackTrace(this,A)},toString:function(){return this.name+": "+this.message+(this.url?" See: "+this.url:"")}});function M(e,o,n,r){if(o&&n){if(!t.isObject(n))throw new A({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindevents"});t.each(n,function(n,i){t.isString(n)?function(e,o,n,r,i){var s=r.split(/\s+/);t.each(s,function(t){var r=e[t];if(!r)throw new A('Method "'+t+'" was configured as an event handler, but does not exist.');e[i](o,n,r)})}(e,o,i,n,r):e[r](o,i,n)})}}function B(e,t){return M(this,e,t,"listenTo"),this}function R(e,t){return M(this,e,t,"stopListening"),this}function N(e,o,n,r){if(o&&n){if(!t.isObject(n))throw new A({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindrequests"});var i=d.call(e,n);o[r](i,e)}}function V(e,t){return N(this,e,t,"reply"),this}function D(e,t){return N(this,e,t,"stopReplying"),this}A.extend=i;var P={normalizeMethods:d,_setOptions:function(){for(var e=arguments.length,o=Array(e),n=0;n<e;n++)o[n]=arguments[n];this.options=t.extend.apply(t,[{},t.result(this,"options")].concat(o))},mergeOptions:l,getOption:c,bindEvents:B,unbindEvents:R},I={_initRadio:function(){var e=t.result(this,"channelName");if(e){if(!o)throw new A({name:"BackboneRadioMissing",message:'The dependency "backbone.radio" is missing.'});var n=this._channel=o.channel(e),r=t.result(this,"radioEvents");this.bindEvents(n,r);var i=t.result(this,"radioRequests");this.bindRequests(n,i),this.on("destroy",this._destroyRadio)}},_destroyRadio:function(){this._channel.stopReplying(null,null,this)},getChannel:function(){return this._channel},bindEvents:B,unbindEvents:R,bindRequests:V,unbindRequests:D},L=["channelName","radioEvents","radioRequests"],F=function(e){this._setOptions(e),this.mergeOptions(e,L),this.cid=t.uniqueId(this.cidPrefix),this._initRadio(),this.initialize.apply(this,arguments)};F.extend=i,t.extend(F.prototype,e.Events,P,I,{cidPrefix:"mno",_isDestroyed:!1,isDestroyed:function(){return this._isDestroyed},initialize:function(){},destroy:function(){if(this._isDestroyed)return this;for(var e=arguments.length,t=Array(e),o=0;o<e;o++)t[o]=arguments[o];return this.triggerMethod.apply(this,["before:destroy",this].concat(t)),this._isDestroyed=!0,this.triggerMethod.apply(this,["destroy",this].concat(t)),this.stopListening(),this},triggerMethod:p});var z={createBuffer:function(){return document.createDocumentFragment()},appendChildren:function(t,o){e.$(t).append(o)},beforeEl:function(t,o){e.$(t).before(o)},replaceEl:function(e,t){if(e!==t){var o=t.parentNode;o&&o.replaceChild(e,t)}},detachContents:function(t){e.$(t).contents().detach()},setInnerContent:function(t,o){e.$(t).html(o)},removeEl:function(t){e.$(t).remove()},findEls:function(t,o){return e.$(t,o)}},H=function(e){this.templateId=e};t.extend(H,{templateCaches:{},get:function(e,t){var o=this.templateCaches[e];return o||(o=new H(e),this.templateCaches[e]=o),o.load(t)},clear:function(){for(var e=void 0,t=arguments.length,o=Array(t),n=0;n<t;n++)o[n]=arguments[n];var r=o.length;if(r>0)for(e=0;e<r;e++)delete this.templateCaches[o[e]];else this.templateCaches={}}}),t.extend(H.prototype,z,{load:function(e){if(this.compiledTemplate)return this.compiledTemplate;var t=this.loadTemplate(this.templateId,e);return this.compiledTemplate=this.compileTemplate(t,e),this.compiledTemplate},loadTemplate:function(e,t){var o=this.findEls(e);if(!o.length)throw new A({name:"NoTemplateError",message:'Could not find template: "'+e+'"'});return o.html()},compileTemplate:function(e,o){return t.template(e,o)}});var U=t.invokeMap||t.invoke;function Z(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return Array.from(e)}function $(e,o){return t.chain(o).map(function(o,n){var r=function(e,o){return e.behaviorClass?e.behaviorClass:t.isFunction(e)?e:t.isFunction(Ee.Behaviors.behaviorsLookup)?Ee.Behaviors.behaviorsLookup(e,o)[o]:Ee.Behaviors.behaviorsLookup[o]}(o,n),i=new r(o===r?{}:o,e),s=$(e,t.result(i,"behaviors"));return[i].concat(s)}).flatten().value()}var j={_initBehaviors:function(){this._behaviors=this._getBehaviors()},_getBehaviors:function(){var e=t.result(this,"behaviors");return t.isObject(e)?$(this,e):{}},_getBehaviorTriggers:function(){var e=U(this._behaviors,"getTriggers");return t.extend.apply(t,[{}].concat(Z(e)))},_getBehaviorEvents:function(){var e=U(this._behaviors,"getEvents");return t.extend.apply(t,[{}].concat(Z(e)))},_proxyBehaviorViewProperties:function(){U(this._behaviors,"proxyViewProperties")},_delegateBehaviorEntityEvents:function(){U(this._behaviors,"delegateEntityEvents")},_undelegateBehaviorEntityEvents:function(){U(this._behaviors,"undelegateEntityEvents")},_destroyBehaviors:function(e){U.apply(void 0,[this._behaviors,"destroy"].concat(Z(e)))},_bindBehaviorUIElements:function(){U(this._behaviors,"bindUIElements")},_unbindBehaviorUIElements:function(){U(this._behaviors,"unbindUIElements")},_triggerEventOnBehaviors:function(){for(var e=this._behaviors,t=0,o=e&&e.length;t<o;t++)p.apply(e[t],arguments)}},W={_delegateEntityEvents:function(e,o){this._undelegateEntityEvents(e,o);var n=t.result(this,"modelEvents");B.call(this,e,n);var r=t.result(this,"collectionEvents");B.call(this,o,r)},_undelegateEntityEvents:function(e,o){var n=t.result(this,"modelEvents");R.call(this,e,n);var r=t.result(this,"collectionEvents");R.call(this,o,r)}},q=/^(\S+)\s*(.*)$/;var G=function(e){var o=e.match(q);return function(e,o){return[e+t.uniqueId(".evt"),o].join(" ")}(o[1],o[2])},Y={triggersStopPropagation:!0,triggersPreventDefault:!0};function X(e){return!!Y[e]}var K={_getViewTriggers:function(e,o){return t.reduce(o,function(o,n,r){return o[r=G(r)]=function(e,o){t.isString(o)&&(o={event:o});var n=o.event,r=!!o.preventDefault;X("triggersPreventDefault")&&(r=!1!==o.preventDefault);var i=!!o.stopPropagation;return X("triggersStopPropagation")&&(i=!1!==o.stopPropagation),function(t){r&&t.preventDefault(),i&&t.stopPropagation(),e.triggerMethod(n,e,t)}}(e,n),o},{})}},J=function(e,t){return e.replace(/@ui\.[a-zA-Z-_$0-9]*/g,function(e){return t[e.slice(4)]})},Q=function e(o,n,r){return t.each(o,function(i,s){t.isString(i)?o[s]=J(i,n):t.isObject(i)&&t.isArray(r)&&(t.extend(i,e(t.pick(i,r),n)),t.each(r,function(e){var o=i[e];t.isString(o)&&(i[e]=J(o,n))}))}),o},ee={normalizeUIKeys:function(e){return function(e,o){return t.reduce(e,function(e,t,n){return e[J(n,o)]=t,e},{})}(e,this._getUIBindings())},normalizeUIString:function(e){var t=this._getUIBindings();return J(e,t)},normalizeUIValues:function(e,t){var o=this._getUIBindings();return Q(e,o,t)},_getUIBindings:function(){var e=t.result(this,"_uiBindings"),o=t.result(this,"ui");return e||o},_bindUIElements:function(){var e=this;if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var o=t.result(this,"_uiBindings");this._ui={},t.each(o,function(t,o){e._ui[o]=e.$(t)}),this.ui=this._ui}},_unbindUIElements:function(){var e=this;this.ui&&this._uiBindings&&(t.each(this.ui,function(t,o){delete e.ui[o]}),this.ui=this._uiBindings,delete this._uiBindings,delete this._ui)},_getUI:function(e){return this._ui[e]}},te={supportsRenderLifecycle:!0,supportsDestroyLifecycle:!0,_isDestroyed:!1,isDestroyed:function(){return!!this._isDestroyed},_isRendered:!1,isRendered:function(){return!!this._isRendered},_isAttached:!1,isAttached:function(){return!!this._isAttached},delegateEvents:function(o){this._proxyBehaviorViewProperties(),this._buildEventProxies();var n=this._getEvents(o);void 0===o&&(this.events=n);var r=t.extend({},this._getBehaviorEvents(),n,this._getBehaviorTriggers(),this.getTriggers());return e.View.prototype.delegateEvents.call(this,r),this},_getEvents:function(e){var o=e||this.events;return t.isFunction(o)?this.normalizeUIKeys(o.call(this)):this.normalizeUIKeys(o)},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this,e)}},delegateEntityEvents:function(){return this._delegateEntityEvents(this.model,this.collection),this._delegateBehaviorEntityEvents(),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.model,this.collection),this._undelegateBehaviorEntityEvents(),this},destroy:function(){if(this._isDestroyed)return this;for(var e=!!this._isAttached,t=arguments.length,o=Array(t),n=0;n<t;n++)o[n]=arguments[n];return this.triggerMethod.apply(this,["before:destroy",this].concat(o)),e&&this.triggerMethod("before:detach",this),this.unbindUIElements(),this.removeEl(this.el),e&&(this._isAttached=!1,this.triggerMethod("detach",this)),this._removeChildren(),this._destroyBehaviors(o),this._isDestroyed=!0,this._isRendered=!1,this.triggerMethod.apply(this,["destroy",this].concat(o)),this.stopListening(),this},bindUIElements:function(){return this._bindUIElements(),this._bindBehaviorUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this._unbindBehaviorUIElements(),this},getUI:function(e){return this._getUI(e)},childViewEventPrefix:"childview",triggerMethod:function(){var e=p.apply(this,arguments);return this._triggerEventOnBehaviors.apply(this,arguments),e},_buildEventProxies:function(){this._childViewEvents=t.result(this,"childViewEvents"),this._childViewTriggers=t.result(this,"childViewTriggers")},_proxyChildViewEvents:function(e){this.listenTo(e,"all",this._childViewEventHandler)},_childViewEventHandler:function(e){for(var o=this.normalizeMethods(this._childViewEvents),n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];void 0!==o&&t.isFunction(o[e])&&o[e].apply(this,r);var s=this._childViewTriggers;s&&t.isString(s[e])&&this.triggerMethod.apply(this,[s[e]].concat(r));var a=t.result(this,"childViewEventPrefix");if(!1!==a){var l=a+":"+e;this.triggerMethod.apply(this,[l].concat(r))}}};function oe(e){e.supportsDestroyLifecycle||g(e,"before:destroy",e);var t=!!e._isAttached;t&&g(e,"before:detach",e),e.remove(),t&&(e._isAttached=!1,g(e,"detach",e)),e._isDestroyed=!0,e.supportsDestroyLifecycle||g(e,"destroy",e)}t.extend(te,z,j,P,W,K,ee);var ne=["allowMissingEl","parentEl","replaceElement"],re=F.extend({cidPrefix:"mnr",replaceElement:!1,_isReplaced:!1,constructor:function(t){if(this._setOptions(t),this.mergeOptions(t,ne),this._initEl=this.el=this.getOption("el"),this.el=this.el instanceof e.$?this.el[0]:this.el,!this.el)throw new A({name:"NoElError",message:'An "el" must be specified for a region.'});this.$el=this.getEl(this.el),F.call(this,t)},show:function(e,t){if(this._ensureElement(t))return(e=this._getView(e,t))===this.currentView||(this.triggerMethod("before:show",this,e,t),e._isAttached||this.empty(t),this._setupChildView(e),this._renderView(e),this._attachView(e,t),this.currentView=e,this.triggerMethod("show",this,e,t)),this},_setupChildView:function(e){E(e),this._proxyChildViewEvents(e),e.on("destroy",this._empty,this)},_proxyChildViewEvents:function(e){var t=this._parentView;t&&t._proxyChildViewEvents(e)},_renderView:function(e){e._isRendered||(e.supportsRenderLifecycle||g(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,g(e,"render",e)))},_attachView:function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!e._isAttached&&a(this.el),r=void 0===o.replaceElement?!!t.result(this,"replaceElement"):!!o.replaceElement;n&&g(e,"before:attach",e),r?this._replaceEl(e):this.attachHtml(e),n&&(e._isAttached=!0,g(e,"attach",e))},_ensureElement:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t.isObject(this.el)||(this.$el=this.getEl(this.el),this.el=this.$el[0]),!this.$el||0===this.$el.length){if(void 0===e.allowMissingEl?t.result(this,"allowMissingEl"):e.allowMissingEl)return!1;throw new A('An "el" must exist in DOM for this region '+this.cid)}return!0},_getView:function(t){if(!t)throw new A({name:"ViewNotValid",message:"The view passed is undefined and therefore invalid. You must pass a view instance to show."});if(t._isDestroyed)throw new A({name:"ViewDestroyedError",message:'View (cid: "'+t.cid+'") has already been destroyed and cannot be used.'});if(t instanceof e.View)return t;var o=this._getViewOptions(t);return new de(o)},_getViewOptions:function(e){return t.isFunction(e)?{template:e}:t.isObject(e)?e:{template:function(){return e}}},getEl:function(e){return this.findEls(e,t.result(this,"parentEl"))},_replaceEl:function(e){this._restoreEl(),e.on("before:destroy",this._restoreEl,this),this.replaceEl(e.el,this.el),this._isReplaced=!0},_restoreEl:function(){if(this._isReplaced){var e=this.currentView;e&&(this.replaceEl(this.el,e.el),this._isReplaced=!1)}},isReplaced:function(){return!!this._isReplaced},attachHtml:function(e){this.appendChildren(this.el,e.el)},empty:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{allowMissingEl:!0},t=this.currentView;if(!t)return this._ensureElement(e)&&this.detachHtml(),this;var o=!e.preventDestroy;return o||s("The preventDestroy option is deprecated. Use Region#detachView"),this._empty(t,o),this},_empty:function(e,t){e.off("destroy",this._empty,this),this.triggerMethod("before:empty",this,e),this._restoreEl(),delete this.currentView,e._isDestroyed||(this._removeView(e,t),this._stopChildViewEvents(e)),this.triggerMethod("empty",this,e)},_stopChildViewEvents:function(e){this._parentView&&this._parentView.stopListening(e)},_removeView:function(e,t){t?e.destroy?e.destroy():oe(e):this._detachView(e)},detachView:function(){var e=this.currentView;if(e)return this._empty(e),e},_detachView:function(e){var t=!!e._isAttached;t&&g(e,"before:detach",e),this.detachHtml(),t&&(e._isAttached=!1,g(e,"detach",e))},detachHtml:function(){this.detachContents(this.el)},hasView:function(){return!!this.currentView},reset:function(e){return this.empty(e),this.$el&&(this.el=this._initEl),delete this.$el,this},destroy:function(e){return this.reset(e),F.prototype.destroy.apply(this,arguments)}});t.extend(re.prototype,z);var ie=function(e,o){return e instanceof re?e:function(e,o){var n=t.extend({},o);if(t.isString(e))return t.extend(n,{el:e}),se(n);if(t.isFunction(e))return t.extend(n,{regionClass:e}),se(n);if(t.isObject(e))return e.selector&&s("The selector option on a Region definition object is deprecated. Use el to pass a selector string"),t.extend(n,{el:e.selector},e),se(n);throw new A({message:"Improper region configuration type.",url:"marionette.region.html#region-configuration-types"})}(e,o)};function se(e){return new(0,e.regionClass)(t.omit(e,"regionClass"))}var ae={regionClass:re,_initRegions:function(){this.regions=this.regions||{},this._regions={},this.addRegions(t.result(this,"regions"))},_reInitRegions:function(){U(this._regions,"reset")},addRegion:function(e,t){var o={};return o[e]=t,this.addRegions(o)[e]},addRegions:function(e){if(!t.isEmpty(e))return e=this.normalizeUIValues(e,["selector","el"]),this.regions=t.extend({},this.regions,e),this._addRegions(e)},_addRegions:function(e){var o=this,n={regionClass:this.regionClass,parentEl:t.partial(t.result,this,"el")};return t.reduce(e,function(e,t,r){return e[r]=ie(t,n),o._addRegion(e[r],r),e},{})},_addRegion:function(e,t){this.triggerMethod("before:add:region",this,t,e),e._parentView=this,this._regions[t]=e,this.triggerMethod("add:region",this,t,e)},removeRegion:function(e){var t=this._regions[e];return this._removeRegion(t,e),t},removeRegions:function(){var e=this.getRegions();return t.each(this._regions,t.bind(this._removeRegion,this)),e},_removeRegion:function(e,t){this.triggerMethod("before:remove:region",this,t,e),e.destroy(),delete this.regions[t],delete this._regions[t],this.triggerMethod("remove:region",this,t,e)},emptyRegions:function(){var e=this.getRegions();return U(e,"empty"),e},hasRegion:function(e){return!!this.getRegion(e)},getRegion:function(e){return this._regions[e]},getRegions:function(){return t.clone(this._regions)},showChildView:function(e,t){for(var o=this.getRegion(e),n=arguments.length,r=Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return o.show.apply(o,[t].concat(r))},detachChildView:function(e){return this.getRegion(e).detachView()},getChildView:function(e){return this.getRegion(e).currentView}},le={render:function(e,o){if(!e)throw new A({name:"TemplateNotFoundError",message:"Cannot render the template since its false, null or undefined."});return(t.isFunction(e)?e:H.get(e))(o)}},ce=["behaviors","childViewEventPrefix","childViewEvents","childViewTriggers","collectionEvents","events","modelEvents","regionClass","regions","template","templateContext","triggers","ui"],de=e.View.extend({constructor:function(o){this.render=t.bind(this.render,this),this._setOptions(o),this.mergeOptions(o,ce),E(this),this._initBehaviors(),this._initRegions();var n=Array.prototype.slice.call(arguments);n[0]=this.options,e.View.prototype.constructor.apply(this,n),this.delegateEntityEvents()},serializeData:function(){return this.model||this.collection?this.model?this.serializeModel():{items:this.serializeCollection()}:{}},serializeModel:function(){return this.model?t.clone(this.model.attributes):{}},serializeCollection:function(){return this.collection?this.collection.map(function(e){return t.clone(e.attributes)}):{}},setElement:function(){var t=!!this.el;return e.View.prototype.setElement.apply(this,arguments),t&&(this._isRendered=!!this.$el.length,this._isAttached=a(this.el)),this._isRendered&&this.bindUIElements(),this},render:function(){return this._isDestroyed||(this.triggerMethod("before:render",this),this._isRendered&&this._reInitRegions(),this._renderTemplate(),this.bindUIElements(),this._isRendered=!0,this.triggerMethod("render",this)),this},_renderTemplate:function(){var e=this.getTemplate();if(!1!==e){var t=this.mixinTemplateContext(this.serializeData()),o=le.render(e,t,this);this.attachElContent(o)}},getTemplate:function(){return this.template},mixinTemplateContext:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=t.result(this,"templateContext");return t.extend(e,o)},attachElContent:function(e){return this.setInnerContent(this.el,e),this},_removeChildren:function(){this.removeRegions()},_getImmediateChildren:function(){return t.chain(this.getRegions()).map("currentView").compact().value()}});t.extend(de.prototype,te,ae);var ue,he,me=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce"],pe=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,t.bind(this.add,this))};ue=pe.prototype,he="_views",t.each(me,function(e){ue[e]=function(){var o=[t.values(t.result(this,he))].concat(t.toArray(arguments));return t[e].apply(t,o)}}),t.extend(pe.prototype,{add:function(e,t){return this._add(e,t)._updateLength()},_add:function(e,t){var o=e.cid;return this._views[o]=e,e.model&&(this._indexByModel[e.model.cid]=o),t&&(this._indexByCustom[t]=o),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){return this._remove(e)._updateLength()},_remove:function(e){var o=e.cid;return e.model&&delete this._indexByModel[e.model.cid],t.some(this._indexByCustom,t.bind(function(e,t){if(e===o)return delete this._indexByCustom[t],!0},this)),delete this._views[o],this},_updateLength:function(){return this.length=t.size(this._views),this}});var ge=["behaviors","childView","childViewEventPrefix","childViewEvents","childViewOptions","childViewTriggers","collectionEvents","events","filter","emptyView","emptyViewOptions","modelEvents","reorderOnSort","sort","triggers","ui","viewComparator"],fe=e.View.extend({sort:!0,constructor:function(o){this.render=t.bind(this.render,this),this._setOptions(o),this.mergeOptions(o,ge),E(this),this._initBehaviors(),this.once("render",this._initialEvents),this._initChildViewStorage(),this._bufferedChildren=[];var n=Array.prototype.slice.call(arguments);n[0]=this.options,e.View.prototype.constructor.apply(this,n),this.delegateEntityEvents()},_startBuffering:function(){this._isBuffering=!0},_endBuffering:function(){var e=this._isAttached?this._getImmediateChildren():[];this._isBuffering=!1,t.each(e,function(e){g(e,"before:attach",e)}),this.attachBuffer(this,this._createBuffer()),t.each(e,function(e){e._isAttached=!0,g(e,"attach",e)}),this._bufferedChildren=[]},_getImmediateChildren:function(){return t.values(this.children._views)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"update",this._onCollectionUpdate),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(e,o,n){var r=void 0!==n.at&&(n.index||o.indexOf(e));(this.filter||!1===r)&&(r=t.indexOf(this._filteredSortedModels(r),e)),this._shouldAddChild(e,r)&&(this._destroyEmptyView(),this._addChild(e,r))},_onCollectionUpdate:function(e,t){var o=t.changes;this._removeChildModels(o.removed)},_removeChildModels:function(e){var t=this._getRemovedViews(e);t.length&&(this.children._updateLength(),this._updateIndices(t,!1),this.isEmpty()&&this._showEmptyView())},_getRemovedViews:function(e){var o=this;return t.reduce(e,function(e,t){var n=t&&o.children.findByModel(t);return!n||n._isDestroyed||(o._removeChildView(n),e.push(n)),e},[])},_removeChildView:function(e){this.triggerMethod("before:remove:child",this,e),this.children._remove(e),e.destroy?e.destroy():oe(e),this.stopListening(e),this.triggerMethod("remove:child",this,e)},setElement:function(){var t=!!this.el;return e.View.prototype.setElement.apply(this,arguments),t&&(this._isAttached=a(this.el)),this},render:function(){return this._isDestroyed||(this.triggerMethod("before:render",this),this._renderChildren(),this._isRendered=!0,this.triggerMethod("render",this)),this},setFilter:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).preventRender,o=this._isRendered&&!this._isDestroyed,n=this.filter!==e;if(o&&n&&!t){var r=this._filteredSortedModels();this.filter=e;var i=this._filteredSortedModels();this._applyModelDeltas(i,r)}else this.filter=e;return this},removeFilter:function(e){return this.setFilter(null,e)},_applyModelDeltas:function(e,o){var n=this,r={};t.each(e,function(e,t){!n.children.findByModel(e)&&n._onCollectionAdd(e,n.collection,{at:t}),r[e.cid]=!0});var i=t.filter(o,function(e){return!r[e.cid]&&n.children.findByModel(e)});this._removeChildModels(i)},reorder:function(){var e,o,n=this,r=this.children,i=this._filteredSortedModels();return!i.length&&this._showingEmptyView||(t.some(i,function(e){return!r.findByModel(e)})?this.render():(e=[],o=r.reduce(function(o,n){var r=t.indexOf(i,n.model);return-1===r?(e.push(n.model),o):(n._index=r,o[r]=n.el,o)},new Array(i.length)),n.triggerMethod("before:reorder",n),n._appendReorderedChildren(o),n._removeChildModels(e),n.triggerMethod("reorder",n))),this},resortView:function(){return this.reorderOnSort?this.reorder():this._renderChildren(),this},_sortViews:function(){var e=this,o=this._filteredSortedModels();t.find(o,function(t,o){var n=e.children.findByModel(t);return!n||n._index!==o})&&this.resortView()},_emptyViewIndex:-1,_appendReorderedChildren:function(e){this.appendChildren(this.el,e)},_renderChildren:function(){this._isRendered&&(this._destroyEmptyView(),this._destroyChildren());var e=this._filteredSortedModels();this.isEmpty({processedModels:e})?this._showEmptyView():(this.triggerMethod("before:render:children",this),this._startBuffering(),this._showCollection(e),this._endBuffering(),this.triggerMethod("render:children",this))},_createView:function(e,t){var o=this._getChildView(e),n=this._getChildViewOptions(e,t);return this.buildChildView(e,o,n)},_setupChildView:function(e,t){E(e),this._proxyChildViewEvents(e),this.sort&&(e._index=t)},_showCollection:function(e){t.each(e,t.bind(this._addChild,this)),this.children._updateLength()},_filteredSortedModels:function(e){if(!this.collection||!this.collection.length)return[];var t=this.getViewComparator(),o=this.collection.models;if(e=Math.min(Math.max(e,0),o.length-1),t){var n=void 0;e&&(n=o[e],o=o.slice(0,e).concat(o.slice(e+1))),o=this._sortModelsBy(o,t),n&&o.splice(e,0,n)}return this._filterModels(o)},getViewComparator:function(){return this.viewComparator},_filterModels:function(e){var o=this;return this.filter&&(e=t.filter(e,function(e,t){return o._shouldAddChild(e,t)})),e},_sortModelsBy:function(e,o){return"string"==typeof o?t.sortBy(e,function(e){return e.get(o)}):1===o.length?t.sortBy(e,t.bind(o,this)):t.clone(e).sort(t.bind(o,this))},_showEmptyView:function(){var o=this._getEmptyView();if(o&&!this._showingEmptyView){this._showingEmptyView=!0;var n=new e.Model,r=this.emptyViewOptions||this.childViewOptions;t.isFunction(r)&&(r=r.call(this,n,this._emptyViewIndex));var i=this.buildChildView(n,o,r);this.triggerMethod("before:render:empty",this,i),this.addChildView(i,0),this.triggerMethod("render:empty",this,i)}},_destroyEmptyView:function(){this._showingEmptyView&&(this.triggerMethod("before:remove:empty",this),this._destroyChildren(),delete this._showingEmptyView,this.triggerMethod("remove:empty",this))},_getEmptyView:function(){var e=this.emptyView;if(e)return this._getView(e)},_getChildView:function(e){var t=this.childView;if(!t)throw new A({name:"NoChildViewError",message:'A "childView" must be specified'});if(!(t=this._getView(t,e)))throw new A({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},_getView:function(o,n){return o.prototype instanceof e.View||o===e.View?o:t.isFunction(o)?o.call(this,n):void 0},_addChild:function(e,t){var o=this._createView(e,t);return this.addChildView(o,t),o},_getChildViewOptions:function(e,o){return t.isFunction(this.childViewOptions)?this.childViewOptions(e,o):this.childViewOptions},addChildView:function(e,t){return this.triggerMethod("before:add:child",this,e),this._setupChildView(e,t),this._isBuffering?this.children._add(e):(this._updateIndices(e,!0),this.children.add(e)),this._renderView(e),this._attachView(e,t),this.triggerMethod("add:child",this,e),e},_updateIndices:function(e,o){if(this.sort)if(o){var n=t.isArray(e)?t.max(e,"_index"):e;t.isObject(n)&&this.children.each(function(e){e._index>=n._index&&(e._index+=1)})}else t.each(t.sortBy(this.children._views,"_index"),function(e,t){e._index=t})},_renderView:function(e){e._isRendered||(e.supportsRenderLifecycle||g(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,g(e,"render",e)))},_attachView:function(e,t){var o=!e._isAttached&&!this._isBuffering&&this._isAttached;o&&g(e,"before:attach",e),this.attachHtml(this,e,t),o&&(e._isAttached=!0,g(e,"attach",e))},buildChildView:function(e,o,n){return new o(t.extend({model:e},n))},removeChildView:function(e){return!e||e._isDestroyed||(this._removeChildView(e),this.children._updateLength(),this._updateIndices(e,!1)),e},isEmpty:function(e){var o=void 0;return t.result(e,"processedModels")?o=e.processedModels:(o=this.collection?this.collection.models:[],o=this._filterModels(o)),0===o.length},attachBuffer:function(e,t){this.appendChildren(e.el,t)},_createBuffer:function(){var e=this,o=this.createBuffer();return t.each(this._bufferedChildren,function(t){e.appendChildren(o,t.el)}),o},attachHtml:function(e,t,o){e._isBuffering?e._bufferedChildren.splice(o,0,t):e._insertBefore(t,o)||e._insertAfter(t)},_insertBefore:function(e,t){var o=void 0;return this.sort&&t<this.children.length-1&&(o=this.children.find(function(e){return e._index===t+1})),!!o&&(this.beforeEl(o.el,e.el),!0)},_insertAfter:function(e){this.appendChildren(this.el,e.el)},_initChildViewStorage:function(){this.children=new pe},_removeChildren:function(){this._destroyChildren()},_destroyChildren:function(e){this.children.length&&(this.triggerMethod("before:destroy:children",this),this.children.each(t.bind(this._removeChildView,this)),this.children._updateLength(),this.triggerMethod("destroy:children",this))},_shouldAddChild:function(e,o){var n=this.filter;return!t.isFunction(n)||n.call(this,e,o,this.collection)}});t.extend(fe.prototype,te);var ve=["childViewContainer","template","templateContext"],be=fe.extend({constructor:function(e){s("CompositeView is deprecated. Convert to View at your earliest convenience"),this.mergeOptions(e,ve),fe.prototype.constructor.apply(this,arguments)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"update",this._onCollectionUpdate),this.listenTo(this.collection,"reset",this.renderChildren),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_getChildView:function(e){var t=this.childView;if(!t)return this.constructor;if(!(t=this._getView(t,e)))throw new A({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},serializeData:function(){return this.serializeModel()},render:function(){return this._isDestroyed||(this._isRendering=!0,this.resetChildViewContainer(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.renderChildren(),this._isRendering=!1,this._isRendered=!0,this.triggerMethod("render",this)),this},renderChildren:function(){(this._isRendered||this._isRendering)&&fe.prototype._renderChildren.call(this)},attachBuffer:function(e,t){var o=this.getChildViewContainer(e);this.appendChildren(o,t)},_insertAfter:function(e){var t=this.getChildViewContainer(this,e);this.appendChildren(t,e.el)},_appendReorderedChildren:function(e){var t=this.getChildViewContainer(this);this.appendChildren(t,e)},getChildViewContainer:function(e,o){if(e.$childViewContainer)return e.$childViewContainer;var n=void 0;if(e.childViewContainer){var r=t.result(e,"childViewContainer");if((n="@"===r.charAt(0)&&e.ui?e.ui[r.substr(4)]:this.findEls(r,e.$el)).length<=0)throw new A({name:"ChildViewContainerMissingError",message:'The specified "childViewContainer" was not found: '+e.childViewContainer})}else n=e.$el;return e.$childViewContainer=n,n},resetChildViewContainer:function(){this.$childViewContainer&&(this.$childViewContainer=void 0)}}),ye=t.pick(de.prototype,"serializeModel","getTemplate","_renderTemplate","mixinTemplateContext","attachElContent");t.extend(be.prototype,ye);var we=["collectionEvents","events","modelEvents","triggers","ui"],_e=F.extend({cidPrefix:"mnb",constructor:function(e,o){this.view=o,this.defaults=t.clone(t.result(this,"defaults",{})),this._setOptions(this.defaults,e),this.mergeOptions(this.options,we),this.ui=t.extend({},t.result(this,"ui"),t.result(o,"ui")),F.apply(this,arguments)},$:function(){return this.view.$.apply(this.view,arguments)},destroy:function(){return this.stopListening(),this},proxyViewProperties:function(){return this.$el=this.view.$el,this.el=this.view.el,this},bindUIElements:function(){return this._bindUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this},getUI:function(e){return this._getUI(e)},delegateEntityEvents:function(){return this._delegateEntityEvents(this.view.model,this.view.collection),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.view.model,this.view.collection),this},getEvents:function(){var e=this,o=this.normalizeUIKeys(t.result(this,"events"));return t.reduce(o,function(o,n,r){if(t.isFunction(n)||(n=e[n]),n)return o[r=G(r)]=t.bind(n,e),o},{})},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this.view,e)}}});t.extend(_e.prototype,W,K,ee);var xe=["region","regionClass"],Ce=F.extend({cidPrefix:"mna",constructor:function(e){this._setOptions(e),this.mergeOptions(e,xe),this._initRegion(),F.prototype.constructor.apply(this,arguments)},regionClass:re,_initRegion:function(){var e=this.region;if(e){var t={regionClass:this.regionClass};this._region=ie(e,t)}},getRegion:function(){return this._region},showView:function(e){for(var t=this.getRegion(),o=arguments.length,n=Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return t.show.apply(t,[e].concat(n))},getView:function(){return this.getRegion().currentView},start:function(e){return this.triggerMethod("before:start",this,e),this.triggerMethod("start",this,e),this}}),ke=["appRoutes","controller"],Se=e.Router.extend({constructor:function(t){this._setOptions(t),this.mergeOptions(t,ke),e.Router.apply(this,arguments);var o=this.appRoutes,n=this._getController();this.processAppRoutes(n,o),this.on("route",this._processOnRoute,this)},appRoute:function(e,t){var o=this._getController();return this._addAppRoute(o,e,t),this},_processOnRoute:function(e,o){if(t.isFunction(this.onRoute)){var n=t.invert(this.appRoutes)[e];this.onRoute(e,n,o)}},processAppRoutes:function(e,o){var n=this;if(!o)return this;var r=t.keys(o).reverse();return t.each(r,function(t){n._addAppRoute(e,t,o[t])}),this},_getController:function(){return this.controller},_addAppRoute:function(e,o,n){var r=e[n];if(!r)throw new A('Method "'+n+'" was not found on the controller');this.route(o,n,t.bind(r,e))},triggerMethod:p});t.extend(Se.prototype,P);var Te=e.Marionette,Ee=e.Marionette={};return Ee.noConflict=function(){return e.Marionette=Te,this},Ee.bindEvents=r(B),Ee.unbindEvents=r(R),Ee.bindRequests=r(V),Ee.unbindRequests=r(D),Ee.mergeOptions=r(l),Ee.getOption=r(c),Ee.normalizeMethods=r(d),Ee.extend=i,Ee.isNodeAttached=a,Ee.deprecate=s,Ee.triggerMethod=r(p),Ee.triggerMethodOn=g,Ee.isEnabled=X,Ee.setEnabled=function(e,t){return Y[e]=t},Ee.monitorViewEvents=E,Ee.Behaviors={},Ee.Behaviors.behaviorsLookup=function(){throw new A({message:"You must define where your behaviors are stored.",url:"marionette.behaviors.md#behaviorslookup"})},Ee.Application=Ce,Ee.AppRouter=Se,Ee.Renderer=le,Ee.TemplateCache=H,Ee.View=de,Ee.CollectionView=fe,Ee.CompositeView=be,Ee.Behavior=_e,Ee.Region=re,Ee.Error=A,Ee.Object=F,Ee.DEV_MODE=!1,Ee.FEATURES=Y,Ee.VERSION=n,Ee}(o(9689),o(95338),o(21559))},21559(e,t,o){e.exports=function(e,t){"use strict";e="default"in e?e.default:e,t="default"in t?t.default:t;var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},n=t.Radio,r=t.Radio={};r.VERSION="2.0.0",r.noConflict=function(){return t.Radio=n,this},r.DEBUG=!1,r._debugText=function(e,t,o){return e+(o?" on the "+o+" channel":"")+': "'+t+'"'},r.debugLog=function(e,t,o){r.DEBUG&&console&&console.warn&&console.warn(r._debugText(e,t,o))};var i=/\s+/;function s(e,t,o,n){var r=e[t];if(!(o&&o!==r.callback&&o!==r.callback._callback||n&&n!==r.context))return delete e[t],!0}r._eventsApi=function(t,n,r,s){if(!r)return!1;var a={};if("object"===(void 0===r?"undefined":o(r))){for(var l in r){var c=t[n].apply(t,[l,r[l]].concat(s));i.test(l)?e.extend(a,c):a[l]=c}return a}if(i.test(r)){for(var d=r.split(i),u=0,h=d.length;u<h;u++)a[d[u]]=t[n].apply(t,[d[u]].concat(s));return a}return!1},r._callHandler=function(e,t,o){var n=o[0],r=o[1],i=o[2];switch(o.length){case 0:return e.call(t);case 1:return e.call(t,n);case 2:return e.call(t,n,r);case 3:return e.call(t,n,r,i);default:return e.apply(t,o)}};var a,l,c={};function d(t){return c[t]||(c[t]=e.bind(r.log,r,t))}function u(t){return e.isFunction(t)?t:function(){return t}}e.extend(r,{log:function(t,o){if("undefined"!=typeof console){var n=e.toArray(arguments).slice(2);console.log("["+t+'] "'+o+'"',n)}},tuneIn:function(e){var t=r.channel(e);return t._tunedIn=!0,t.on("all",d(e)),this},tuneOut:function(e){var t=r.channel(e);return t._tunedIn=!1,t.off("all",d(e)),delete c[e],this}}),r.Requests={request:function(t){var o=e.toArray(arguments).slice(1),n=r._eventsApi(this,"request",t,o);if(n)return n;var i=this.channelName,s=this._requests;if(i&&this._tunedIn&&r.log.apply(this,[i,t].concat(o)),s&&(s[t]||s.default)){var a=s[t]||s.default;return o=s[t]?o:arguments,r._callHandler(a.callback,a.context,o)}r.debugLog("An unhandled request was fired",t,i)},reply:function(e,t,o){return r._eventsApi(this,"reply",e,[t,o])||(this._requests||(this._requests={}),this._requests[e]&&r.debugLog("A request was overwritten",e,this.channelName),this._requests[e]={callback:u(t),context:o||this}),this},replyOnce:function(t,o,n){if(r._eventsApi(this,"replyOnce",t,[o,n]))return this;var i=this,s=e.once(function(){return i.stopReplying(t),u(o).apply(this,arguments)});return this.reply(t,s,n)},stopReplying:function(t,o,n){return r._eventsApi(this,"stopReplying",t)||(t||o||n?function(t,o,n,r){t||(t={});for(var i=o?[o]:e.keys(t),a=!1,l=0,c=i.length;l<c;l++)t[o=i[l]]&&s(t,o,n,r)&&(a=!0);return a}(this._requests,t,o,n)||r.debugLog("Attempted to remove the unregistered request",t,this.channelName):delete this._requests),this}},r._channels={},r.channel=function(e){if(!e)throw new Error("You must provide a name for the channel.");return r._channels[e]?r._channels[e]:r._channels[e]=new r.Channel(e)},r.Channel=function(e){this.channelName=e},e.extend(r.Channel.prototype,t.Events,r.Requests,{reset:function(){return this.off(),this.stopListening(),this.stopReplying(),this}});var h=[t.Events,r.Requests];return e.each(h,function(t){e.each(t,function(t,o){r[o]=function(t){return l=e.toArray(arguments).slice(1),(a=this.channel(t))[o].apply(a,l)}})}),r.reset=function(t){var o=t?[this._channels[t]]:this._channels;e.each(o,function(e){e.reset()})},r}(o(95338),o(9689))},9689(e,t,o){var n,r,i;i="object"==typeof self&&self.self===self&&self||"object"==typeof globalThis&&globalThis.global===globalThis&&globalThis,n=[o(95338),o(41669),t],r=function(e,t,o){i.Backbone=function(e,t,o,n){var r=e.Backbone,i=Array.prototype.slice;t.VERSION="1.3.3",t.$=n,t.noConflict=function(){return e.Backbone=r,this},t.emulateHTTP=!1,t.emulateJSON=!1;var s=function(e,t,n){o.each(t,function(t,r){o[r]&&(e.prototype[r]=function(e,t,n){switch(e){case 1:return function(){return o[t](this[n])};case 2:return function(e){return o[t](this[n],e)};case 3:return function(e,r){return o[t](this[n],a(e,this),r)};case 4:return function(e,r,i){return o[t](this[n],a(e,this),r,i)};default:return function(){var e=i.call(arguments);return e.unshift(this[n]),o[t].apply(o,e)}}}(t,r,n))})},a=function(e,t){return o.isFunction(e)?e:o.isObject(e)&&!t._isModel(e)?l(e):o.isString(e)?function(t){return t.get(e)}:e},l=function(e){var t=o.matches(e);return function(e){return t(e.attributes)}},c=t.Events={},d=/\s+/,u=function(e,t,n,r,i){var s,a=0;if(n&&"object"==typeof n){void 0!==r&&"context"in i&&void 0===i.context&&(i.context=r);for(s=o.keys(n);a<s.length;a++)t=u(e,t,s[a],n[s[a]],i)}else if(n&&d.test(n))for(s=n.split(d);a<s.length;a++)t=e(t,s[a],r,i);else t=e(t,n,r,i);return t};c.on=function(e,t,o){return h(this,e,t,o)};var h=function(e,t,o,n,r){return e._events=u(m,e._events||{},t,o,{context:n,ctx:e,listening:r}),r&&((e._listeners||(e._listeners={}))[r.id]=r),e};c.listenTo=function(e,t,n){if(!e)return this;var r=e._listenId||(e._listenId=o.uniqueId("l")),i=this._listeningTo||(this._listeningTo={}),s=i[r];if(!s){var a=this._listenId||(this._listenId=o.uniqueId("l"));s=i[r]={obj:e,objId:r,id:a,listeningTo:i,count:0}}return h(e,t,n,this,s),this};var m=function(e,t,o,n){if(o){var r=e[t]||(e[t]=[]),i=n.context,s=n.ctx,a=n.listening;a&&a.count++,r.push({callback:o,context:i,ctx:i||s,listening:a})}return e};c.off=function(e,t,o){return this._events?(this._events=u(p,this._events,e,t,{context:o,listeners:this._listeners}),this):this},c.stopListening=function(e,t,n){var r=this._listeningTo;if(!r)return this;for(var i=e?[e._listenId]:o.keys(r),s=0;s<i.length;s++){var a=r[i[s]];if(!a)break;a.obj.off(t,n,this)}return this};var p=function(e,t,n,r){if(e){var i,s=0,a=r.context,l=r.listeners;if(t||n||a){for(var c=t?[t]:o.keys(e);s<c.length;s++){var d=e[t=c[s]];if(!d)break;for(var u=[],h=0;h<d.length;h++){var m=d[h];n&&n!==m.callback&&n!==m.callback._callback||a&&a!==m.context?u.push(m):(i=m.listening)&&0===--i.count&&(delete l[i.id],delete i.listeningTo[i.objId])}u.length?e[t]=u:delete e[t]}return e}for(var p=o.keys(l);s<p.length;s++)delete l[(i=l[p[s]]).id],delete i.listeningTo[i.objId]}};c.once=function(e,t,n){var r=u(g,{},e,t,o.bind(this.off,this));return"string"==typeof e&&null==n&&(t=void 0),this.on(r,t,n)},c.listenToOnce=function(e,t,n){var r=u(g,{},t,n,o.bind(this.stopListening,this,e));return this.listenTo(e,r)};var g=function(e,t,n,r){if(n){var i=e[t]=o.once(function(){r(t,i),n.apply(this,arguments)});i._callback=n}return e};c.trigger=function(e){if(!this._events)return this;for(var t=Math.max(0,arguments.length-1),o=Array(t),n=0;n<t;n++)o[n]=arguments[n+1];return u(f,this._events,e,void 0,o),this};var f=function(e,t,o,n){if(e){var r=e[t],i=e.all;r&&i&&(i=i.slice()),r&&v(r,n),i&&v(i,[t].concat(n))}return e},v=function(e,t){var o,n=-1,r=e.length,i=t[0],s=t[1],a=t[2];switch(t.length){case 0:for(;++n<r;)(o=e[n]).callback.call(o.ctx);return;case 1:for(;++n<r;)(o=e[n]).callback.call(o.ctx,i);return;case 2:for(;++n<r;)(o=e[n]).callback.call(o.ctx,i,s);return;case 3:for(;++n<r;)(o=e[n]).callback.call(o.ctx,i,s,a);return;default:for(;++n<r;)(o=e[n]).callback.apply(o.ctx,t);return}};c.bind=c.on,c.unbind=c.off,o.extend(t,c);var b=t.Model=function(e,t){var n=e||{};t||(t={}),this.cid=o.uniqueId(this.cidPrefix),this.attributes={},t.collection&&(this.collection=t.collection),t.parse&&(n=this.parse(n,t)||{});var r=o.result(this,"defaults");n=o.defaults(o.extend({},r,n),r),this.set(n,t),this.changed={},this.initialize.apply(this,arguments)};o.extend(b.prototype,c,{changed:null,validationError:null,idAttribute:"id",cidPrefix:"c",initialize:function(){},toJSON:function(e){return o.clone(this.attributes)},sync:function(){return t.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return o.escape(this.get(e))},has:function(e){return null!=this.get(e)},matches:function(e){return!!o.iteratee(e,this)(this.attributes)},set:function(e,t,n){if(null==e)return this;var r;if("object"==typeof e?(r=e,n=t):(r={})[e]=t,n||(n={}),!this._validate(r,n))return!1;var i=n.unset,s=n.silent,a=[],l=this._changing;this._changing=!0,l||(this._previousAttributes=o.clone(this.attributes),this.changed={});var c=this.attributes,d=this.changed,u=this._previousAttributes;for(var h in r)t=r[h],o.isEqual(c[h],t)||a.push(h),o.isEqual(u[h],t)?delete d[h]:d[h]=t,i?delete c[h]:c[h]=t;if(this.idAttribute in r&&(this.id=this.get(this.idAttribute)),!s){a.length&&(this._pending=n);for(var m=0;m<a.length;m++)this.trigger("change:"+a[m],this,c[a[m]],n)}if(l)return this;if(!s)for(;this._pending;)n=this._pending,this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,o.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,o.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!o.isEmpty(this.changed):o.has(this.changed,e)},changedAttributes:function(e){if(!e)return!!this.hasChanged()&&o.clone(this.changed);var t=this._changing?this._previousAttributes:this.attributes,n={};for(var r in e){var i=e[r];o.isEqual(t[r],i)||(n[r]=i)}return!!o.size(n)&&n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return o.clone(this._previousAttributes)},fetch:function(e){e=o.extend({parse:!0},e);var t=this,n=e.success;return e.success=function(o){var r=e.parse?t.parse(o,e):o;if(!t.set(r,e))return!1;n&&n.call(e.context,t,o,e),t.trigger("sync",t,o,e)},I(this,e),this.sync("read",this,e)},save:function(e,t,n){var r;null==e||"object"==typeof e?(r=e,n=t):(r={})[e]=t;var i=(n=o.extend({validate:!0,parse:!0},n)).wait;if(r&&!i){if(!this.set(r,n))return!1}else if(!this._validate(r,n))return!1;var s=this,a=n.success,l=this.attributes;n.success=function(e){s.attributes=l;var t=n.parse?s.parse(e,n):e;if(i&&(t=o.extend({},r,t)),t&&!s.set(t,n))return!1;a&&a.call(n.context,s,e,n),s.trigger("sync",s,e,n)},I(this,n),r&&i&&(this.attributes=o.extend({},l,r));var c=this.isNew()?"create":n.patch?"patch":"update";"patch"!==c||n.attrs||(n.attrs=r);var d=this.sync(c,this,n);return this.attributes=l,d},destroy:function(e){e=e?o.clone(e):{};var t=this,n=e.success,r=e.wait,i=function(){t.stopListening(),t.trigger("destroy",t,t.collection,e)};e.success=function(o){r&&i(),n&&n.call(e.context,t,o,e),t.isNew()||t.trigger("sync",t,o,e)};var s=!1;return this.isNew()?o.defer(e.success):(I(this,e),s=this.sync("delete",this,e)),r||i(),s},url:function(){var e=o.result(this,"urlRoot")||o.result(this.collection,"url")||P();if(this.isNew())return e;var t=this.get(this.idAttribute);return e.replace(/[^\/]$/,"$&/")+encodeURIComponent(t)},parse:function(e,t){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return!this.has(this.idAttribute)},isValid:function(e){return this._validate({},o.extend({},e,{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=o.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return!n||(this.trigger("invalid",this,n,o.extend(t,{validationError:n})),!1)}}),s(b,{keys:1,values:1,pairs:1,invert:1,pick:0,omit:0,chain:1,isEmpty:1},"attributes");var y=t.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,o.extend({silent:!0},t))},w={add:!0,remove:!0,merge:!0},_={add:!0,remove:!1},x=function(e,t,o){o=Math.min(Math.max(o,0),e.length);var n,r=Array(e.length-o),i=t.length;for(n=0;n<r.length;n++)r[n]=e[n+o];for(n=0;n<i;n++)e[n+o]=t[n];for(n=0;n<r.length;n++)e[n+i+o]=r[n]};o.extend(y.prototype,c,{model:b,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return t.sync.apply(this,arguments)},add:function(e,t){return this.set(e,o.extend({merge:!1},t,_))},remove:function(e,t){t=o.extend({},t);var n=!o.isArray(e);e=n?[e]:e.slice();var r=this._removeModels(e,t);return!t.silent&&r.length&&(t.changes={added:[],merged:[],removed:r},this.trigger("update",this,t)),n?r[0]:r},set:function(e,t){if(null!=e){(t=o.extend({},w,t)).parse&&!this._isModel(e)&&(e=this.parse(e,t)||[]);var n=!o.isArray(e);e=n?[e]:e.slice();var r=t.at;null!=r&&(r=+r),r>this.length&&(r=this.length),r<0&&(r+=this.length+1);var i,s,a=[],l=[],c=[],d=[],u={},h=t.add,m=t.merge,p=t.remove,g=!1,f=this.comparator&&null==r&&!1!==t.sort,v=o.isString(this.comparator)?this.comparator:null;for(s=0;s<e.length;s++){i=e[s];var b=this.get(i);if(b){if(m&&i!==b){var y=this._isModel(i)?i.attributes:i;t.parse&&(y=b.parse(y,t)),b.set(y,t),c.push(b),f&&!g&&(g=b.hasChanged(v))}u[b.cid]||(u[b.cid]=!0,a.push(b)),e[s]=b}else h&&(i=e[s]=this._prepareModel(i,t))&&(l.push(i),this._addReference(i,t),u[i.cid]=!0,a.push(i))}if(p){for(s=0;s<this.length;s++)u[(i=this.models[s]).cid]||d.push(i);d.length&&this._removeModels(d,t)}var _=!1,C=!f&&h&&p;if(a.length&&C?(_=this.length!==a.length||o.some(this.models,function(e,t){return e!==a[t]}),this.models.length=0,x(this.models,a,0),this.length=this.models.length):l.length&&(f&&(g=!0),x(this.models,l,null==r?this.length:r),this.length=this.models.length),g&&this.sort({silent:!0}),!t.silent){for(s=0;s<l.length;s++)null!=r&&(t.index=r+s),(i=l[s]).trigger("add",i,this,t);(g||_)&&this.trigger("sort",this,t),(l.length||d.length||c.length)&&(t.changes={added:l,removed:d,merged:c},this.trigger("update",this,t))}return n?e[0]:e}},reset:function(e,t){t=t?o.clone(t):{};for(var n=0;n<this.models.length;n++)this._removeReference(this.models[n],t);return t.previousModels=this.models,this._reset(),e=this.add(e,o.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),e},push:function(e,t){return this.add(e,o.extend({at:this.length},t))},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e)},unshift:function(e,t){return this.add(e,o.extend({at:0},t))},shift:function(e){var t=this.at(0);return this.remove(t,e)},slice:function(){return i.apply(this.models,arguments)},get:function(e){if(null!=e)return this._byId[e]||this._byId[this.modelId(e.attributes||e)]||e.cid&&this._byId[e.cid]},has:function(e){return null!=this.get(e)},at:function(e){return e<0&&(e+=this.length),this.models[e]},where:function(e,t){return this[t?"find":"filter"](e)},findWhere:function(e){return this.where(e,!0)},sort:function(e){var t=this.comparator;if(!t)throw new Error("Cannot sort a set without a comparator");e||(e={});var n=t.length;return o.isFunction(t)&&(t=o.bind(t,this)),1===n||o.isString(t)?this.models=this.sortBy(t):this.models.sort(t),e.silent||this.trigger("sort",this,e),this},pluck:function(e){return this.map(e+"")},fetch:function(e){var t=(e=o.extend({parse:!0},e)).success,n=this;return e.success=function(o){var r=e.reset?"reset":"set";n[r](o,e),t&&t.call(e.context,n,o,e),n.trigger("sync",n,o,e)},I(this,e),this.sync("read",this,e)},create:function(e,t){var n=(t=t?o.clone(t):{}).wait;if(!(e=this._prepareModel(e,t)))return!1;n||this.add(e,t);var r=this,i=t.success;return t.success=function(e,t,o){n&&r.add(e,o),i&&i.call(o.context,e,t,o)},e.save(null,t),e},parse:function(e,t){return e},clone:function(){return new this.constructor(this.models,{model:this.model,comparator:this.comparator})},modelId:function(e){return e[this.model.prototype.idAttribute||"id"]},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(this._isModel(e))return e.collection||(e.collection=this),e;(t=t?o.clone(t):{}).collection=this;var n=new this.model(e,t);return n.validationError?(this.trigger("invalid",this,n.validationError,t),!1):n},_removeModels:function(e,t){for(var o=[],n=0;n<e.length;n++){var r=this.get(e[n]);if(r){var i=this.indexOf(r);this.models.splice(i,1),this.length--,delete this._byId[r.cid];var s=this.modelId(r.attributes);null!=s&&delete this._byId[s],t.silent||(t.index=i,r.trigger("remove",r,this,t)),o.push(r),this._removeReference(r,t)}}return o},_isModel:function(e){return e instanceof b},_addReference:function(e,t){this._byId[e.cid]=e;var o=this.modelId(e.attributes);null!=o&&(this._byId[o]=e),e.on("all",this._onModelEvent,this)},_removeReference:function(e,t){delete this._byId[e.cid];var o=this.modelId(e.attributes);null!=o&&delete this._byId[o],this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,o,n){if(t){if(("add"===e||"remove"===e)&&o!==this)return;if("destroy"===e&&this.remove(t,n),"change"===e){var r=this.modelId(t.previousAttributes()),i=this.modelId(t.attributes);r!==i&&(null!=r&&delete this._byId[r],null!=i&&(this._byId[i]=t))}}this.trigger.apply(this,arguments)}}),s(y,{forEach:3,each:3,map:3,collect:3,reduce:0,foldl:0,inject:0,reduceRight:0,foldr:0,find:3,detect:3,filter:3,select:3,reject:3,every:3,all:3,some:3,any:3,include:3,includes:3,contains:3,invoke:0,max:3,min:3,toArray:1,size:1,first:3,head:3,take:3,initial:3,rest:3,tail:3,drop:3,last:3,without:0,difference:0,indexOf:3,shuffle:1,lastIndexOf:3,isEmpty:1,chain:1,sample:3,partition:3,groupBy:3,countBy:3,sortBy:3,indexBy:3,findIndex:3,findLastIndex:3},"models");var C=t.View=function(e){this.cid=o.uniqueId("view"),o.extend(this,o.pick(e,S)),this._ensureElement(),this.initialize.apply(this,arguments)},k=/^(\S+)\s*(.*)$/,S=["model","collection","el","id","attributes","className","tagName","events"];o.extend(C.prototype,c,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this._removeElement(),this.stopListening(),this},_removeElement:function(){this.$el.remove()},setElement:function(e){return this.undelegateEvents(),this._setElement(e),this.delegateEvents(),this},_setElement:function(e){this.$el=e instanceof t.$?e:t.$(e),this.el=this.$el[0]},delegateEvents:function(e){if(e||(e=o.result(this,"events")),!e)return this;for(var t in this.undelegateEvents(),e){var n=e[t];if(o.isFunction(n)||(n=this[n]),n){var r=t.match(k);this.delegate(r[1],r[2],o.bind(n,this))}}return this},delegate:function(e,t,o){return this.$el.on(e+".delegateEvents"+this.cid,t,o),this},undelegateEvents:function(){return this.$el&&this.$el.off(".delegateEvents"+this.cid),this},undelegate:function(e,t,o){return this.$el.off(e+".delegateEvents"+this.cid,t,o),this},_createElement:function(e){return document.createElement(e)},_ensureElement:function(){if(this.el)this.setElement(o.result(this,"el"));else{var e=o.extend({},o.result(this,"attributes"));this.id&&(e.id=o.result(this,"id")),this.className&&(e.class=o.result(this,"className")),this.setElement(this._createElement(o.result(this,"tagName"))),this._setAttributes(e)}},_setAttributes:function(e){this.$el.attr(e)}}),t.sync=function(e,n,r){var i=T[e];o.defaults(r||(r={}),{emulateHTTP:t.emulateHTTP,emulateJSON:t.emulateJSON});var s={type:i,dataType:"json"};if(r.url||(s.url=o.result(n,"url")||P()),null!=r.data||!n||"create"!==e&&"update"!==e&&"patch"!==e||(s.contentType="application/json",s.data=JSON.stringify(r.attrs||n.toJSON(r))),r.emulateJSON&&(s.contentType="application/x-www-form-urlencoded",s.data=s.data?{model:s.data}:{}),r.emulateHTTP&&("PUT"===i||"DELETE"===i||"PATCH"===i)){s.type="POST",r.emulateJSON&&(s.data._method=i);var a=r.beforeSend;r.beforeSend=function(e){if(e.setRequestHeader("X-HTTP-Method-Override",i),a)return a.apply(this,arguments)}}"GET"===s.type||r.emulateJSON||(s.processData=!1);var l=r.error;r.error=function(e,t,o){r.textStatus=t,r.errorThrown=o,l&&l.call(r.context,e,t,o)};var c=r.xhr=t.ajax(o.extend(s,r));return n.trigger("request",n,c,r),c};var T={create:"POST",update:"PUT",patch:"PATCH",delete:"DELETE",read:"GET"};t.ajax=function(){return t.$.ajax.apply(t.$,arguments)};var E=t.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},O=/\((.*?)\)/g,A=/(\(\?)?:\w+/g,M=/\*\w+/g,B=/[\-{}\[\]+?.,\\\^$|#\s]/g;o.extend(E.prototype,c,{initialize:function(){},route:function(e,n,r){o.isRegExp(e)||(e=this._routeToRegExp(e)),o.isFunction(n)&&(r=n,n=""),r||(r=this[n]);var i=this;return t.history.route(e,function(o){var s=i._extractParameters(e,o);!1!==i.execute(r,s,n)&&(i.trigger.apply(i,["route:"+n].concat(s)),i.trigger("route",n,s),t.history.trigger("route",i,n,s))}),this},execute:function(e,t,o){e&&e.apply(this,t)},navigate:function(e,o){return t.history.navigate(e,o),this},_bindRoutes:function(){if(this.routes){this.routes=o.result(this,"routes");for(var e,t=o.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(B,"\\$&").replace(O,"(?:$1)?").replace(A,function(e,t){return t?e:"([^/?]+)"}).replace(M,"([^?]*?)"),new RegExp("^"+e+"(?:\\?([\\s\\S]*))?$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return o.map(n,function(e,t){return t===n.length-1?e||null:e?decodeURIComponent(e):null})}});var R=t.History=function(){this.handlers=[],this.checkUrl=o.bind(this.checkUrl,this),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},N=/^[#\/]|\s+$/g,V=/^\/+|\/+$/g,D=/#.*$/;R.started=!1,o.extend(R.prototype,c,{interval:50,atRoot:function(){return this.location.pathname.replace(/[^\/]$/,"$&/")===this.root&&!this.getSearch()},matchRoot:function(){return this.decodeFragment(this.location.pathname).slice(0,this.root.length-1)+"/"===this.root},decodeFragment:function(e){return decodeURI(e.replace(/%25/g,"%2525"))},getSearch:function(){var e=this.location.href.replace(/#.*/,"").match(/\?.+/);return e?e[0]:""},getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getPath:function(){var e=this.decodeFragment(this.location.pathname+this.getSearch()).slice(this.root.length-1);return"/"===e.charAt(0)?e.slice(1):e},getFragment:function(e){return null==e&&(e=this._usePushState||!this._wantsHashChange?this.getPath():this.getHash()),e.replace(N,"")},start:function(e){if(R.started)throw new Error("Backbone.history has already been started");if(R.started=!0,this.options=o.extend({root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=!1!==this.options.hashChange,this._hasHashChange="onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7),this._useHashChange=this._wantsHashChange&&this._hasHashChange,this._wantsPushState=!!this.options.pushState,this._hasPushState=!(!this.history||!this.history.pushState),this._usePushState=this._wantsPushState&&this._hasPushState,this.fragment=this.getFragment(),this.root=("/"+this.root+"/").replace(V,"/"),this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var t=this.root.slice(0,-1)||"/";return this.location.replace(t+"#"+this.getPath()),!0}this._hasPushState&&this.atRoot()&&this.navigate(this.getHash(),{replace:!0})}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe"),this.iframe.src="javascript:0",this.iframe.style.display="none",this.iframe.tabIndex=-1;var n=document.body,r=n.insertBefore(this.iframe,n.firstChild).contentWindow;r.document.open(),r.document.close(),r.location.hash="#"+this.fragment}var i=window.addEventListener||function(e,t){return attachEvent("on"+e,t)};if(this._usePushState?i("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe?i("hashchange",this.checkUrl,!1):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),!this.options.silent)return this.loadUrl()},stop:function(){var e=window.removeEventListener||function(e,t){return detachEvent("on"+e,t)};this._usePushState?e("popstate",this.checkUrl,!1):this._useHashChange&&!this.iframe&&e("hashchange",this.checkUrl,!1),this.iframe&&(document.body.removeChild(this.iframe),this.iframe=null),this._checkUrlInterval&&clearInterval(this._checkUrlInterval),R.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();if(t===this.fragment&&this.iframe&&(t=this.getHash(this.iframe.contentWindow)),t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()},loadUrl:function(e){return!!this.matchRoot()&&(e=this.fragment=this.getFragment(e),o.some(this.handlers,function(t){if(t.route.test(e))return t.callback(e),!0}))},navigate:function(e,t){if(!R.started)return!1;t&&!0!==t||(t={trigger:!!t}),e=this.getFragment(e||"");var o=this.root;""!==e&&"?"!==e.charAt(0)||(o=o.slice(0,-1)||"/");var n=o+e;if(e=this.decodeFragment(e.replace(D,"")),this.fragment!==e){if(this.fragment=e,this._usePushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);if(this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getHash(this.iframe.contentWindow)){var r=this.iframe.contentWindow;t.replace||(r.document.open(),r.document.close()),this._updateHash(r.location,e,t.replace)}}return t.trigger?this.loadUrl(e):void 0}},_updateHash:function(e,t,o){if(o){var n=e.href.replace(/(javascript:|#).*$/,"");e.replace(n+"#"+t)}else e.hash="#"+t}}),t.history=new R;b.extend=y.extend=E.extend=C.extend=R.extend=function(e,t){var n,r=this;return n=e&&o.has(e,"constructor")?e.constructor:function(){return r.apply(this,arguments)},o.extend(n,r,t),n.prototype=o.create(r.prototype,e),n.prototype.constructor=n,n.__super__=r.prototype,n};var P=function(){throw new Error('A "url" property or function must be specified')},I=function(e,t){var o=t.error;t.error=function(n){o&&o.call(t.context,e,n,t),e.trigger("error",e,n,t)}};return t}(i,o,e,t)}.apply(t,n),void 0===r||(e.exports=r)},78672(e,t){var o,n;void 0===(n="function"==typeof(o=function(){"use strict";function t(e,t,o){var n=new XMLHttpRequest;n.open("GET",e),n.responseType="blob",n.onload=function(){s(n.response,t,o)},n.onerror=function(){console.error("could not download file")},n.send()}function o(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function n(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(o){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var r="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof globalThis&&globalThis.global===globalThis?globalThis:void 0,i=r.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=r.saveAs||("object"!=typeof window||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!i?function(e,i,s){var a=r.URL||r.webkitURL,l=document.createElement("a");i=i||e.name||"download",l.download=i,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?n(l):o(l.href)?t(e,i,s):n(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout(function(){a.revokeObjectURL(l.href)},4e4),setTimeout(function(){n(l)},0))}:"msSaveOrOpenBlob"in navigator?function(e,r,i){if(r=r||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}(e,i),r);else if(o(e))t(e,r,i);else{var s=document.createElement("a");s.href=e,s.target="_blank",setTimeout(function(){n(s)})}}:function(e,o,n,s){if((s=s||open("","_blank"))&&(s.document.title=s.document.body.innerText="downloading..."),"string"==typeof e)return t(e,o,n);var a="application/octet-stream"===e.type,l=/constructor/i.test(r.HTMLElement)||r.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&l||i)&&"undefined"!=typeof FileReader){var d=new FileReader;d.onloadend=function(){var e=d.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),s?s.location.href=e:location=e,s=null},d.readAsDataURL(e)}else{var u=r.URL||r.webkitURL,h=u.createObjectURL(e);s?s.location=h:location.href=h,s=null,setTimeout(function(){u.revokeObjectURL(h)},4e4)}});r.saveAs=s.saveAs=s,e.exports=s})?o.apply(t,[]):o)||(e.exports=n)},79416(e,t,o){"use strict";var n,r=o(41669),i=o.n(r);e=o.hmd(e),function(e){if(!e.jQuery){var t=function(e,o){return new t.fn.init(e,o)};t.isWindow=function(e){return e&&e===e.window},t.type=function(e){return e?"object"==typeof e||"function"==typeof e?n[i.call(e)]||"object":typeof e:e+""},t.isArray=Array.isArray||function(e){return"array"===t.type(e)},t.isPlainObject=function(e){var o;if(!e||"object"!==t.type(e)||e.nodeType||t.isWindow(e))return!1;try{if(e.constructor&&!r.call(e,"constructor")&&!r.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(e){return!1}for(o in e);return void 0===o||r.call(e,o)},t.each=function(e,t,o){var n=0,r=e.length,i=l(e);if(o){if(i)for(;n<r&&!1!==t.apply(e[n],o);n++);else for(n in e)if(e.hasOwnProperty(n)&&!1===t.apply(e[n],o))break}else if(i)for(;n<r&&!1!==t.call(e[n],n,e[n]);n++);else for(n in e)if(e.hasOwnProperty(n)&&!1===t.call(e[n],n,e[n]))break;return e},t.data=function(e,n,r){if(void 0===r){var i=e[t.expando],s=i&&o[i];if(void 0===n)return s;if(s&&n in s)return s[n]}else if(void 0!==n){var a=e[t.expando]||(e[t.expando]=++t.uuid);return o[a]=o[a]||{},o[a][n]=r,r}},t.removeData=function(e,n){var r=e[t.expando],i=r&&o[r];i&&(n?t.each(n,function(e,t){delete i[t]}):delete o[r])},t.extend=function(){var e,o,n,r,i,s,a=arguments[0]||{},l=1,c=arguments.length,d=!1;for("boolean"==typeof a&&(d=a,a=arguments[l]||{},l++),"object"!=typeof a&&"function"!==t.type(a)&&(a={}),l===c&&(a=this,l--);l<c;l++)if(i=arguments[l])for(r in i)i.hasOwnProperty(r)&&(e=a[r],a!==(n=i[r])&&(d&&n&&(t.isPlainObject(n)||(o=t.isArray(n)))?(o?(o=!1,s=e&&t.isArray(e)?e:[]):s=e&&t.isPlainObject(e)?e:{},a[r]=t.extend(d,s,n)):void 0!==n&&(a[r]=n)));return a},t.queue=function(e,o,n){if(e){o=(o||"fx")+"queue";var r,i,s=t.data(e,o);return n?(!s||t.isArray(n)?s=t.data(e,o,(i=[],(r=n)&&(l(Object(r))?function(e,t){for(var o=+t.length,n=0,r=e.length;n<o;)e[r++]=t[n++];if(o!=o)for(;void 0!==t[n];)e[r++]=t[n++];e.length=r}(i,"string"==typeof r?[r]:r):[].push.call(i,r)),i)):s.push(n),s):s||[]}},t.dequeue=function(e,o){t.each(e.nodeType?[e]:e,function(e,n){o=o||"fx";var r=t.queue(n,o),i=r.shift();"inprogress"===i&&(i=r.shift()),i&&("fx"===o&&r.unshift("inprogress"),i.call(n,function(){t.dequeue(n,o)}))})},t.fn=t.prototype={init:function(e){if(e.nodeType)return this[0]=e,this;throw new Error("Not a DOM node.")},offset:function(){var t=this[0].getBoundingClientRect?this[0].getBoundingClientRect():{top:0,left:0};return{top:t.top+(e.pageYOffset||document.scrollTop||0)-(document.clientTop||0),left:t.left+(e.pageXOffset||document.scrollLeft||0)-(document.clientLeft||0)}},position:function(){var e=this[0],o=function(e){for(var t=e.offsetParent;t&&"html"!==t.nodeName.toLowerCase()&&t.style&&"static"===t.style.position.toLowerCase();)t=t.offsetParent;return t||document}(e),n=this.offset(),r=/^(?:body|html)$/i.test(o.nodeName)?{top:0,left:0}:t(o).offset();return n.top-=parseFloat(e.style.marginTop)||0,n.left-=parseFloat(e.style.marginLeft)||0,o.style&&(r.top+=parseFloat(o.style.borderTopWidth)||0,r.left+=parseFloat(o.style.borderLeftWidth)||0),{top:n.top-r.top,left:n.left-r.left}}};var o={};t.expando="velocity"+(new Date).getTime(),t.uuid=0;for(var n={},r=n.hasOwnProperty,i=n.toString,s="Boolean Number String Function Array Date RegExp Object Error".split(" "),a=0;a<s.length;a++)n["[object "+s[a]+"]"]=s[a].toLowerCase();t.fn.init.prototype=t.fn,e.Velocity={Utilities:t}}function l(e){var o=e.length,n=t.type(e);return"function"!==n&&!t.isWindow(e)&&(!(1!==e.nodeType||!o)||"array"===n||0===o||"number"==typeof o&&o>0&&o-1 in e)}}(window),n=function(){return function(e,t,o,n){var r,s=function(){if(o.documentMode)return o.documentMode;for(var e=7;e>4;e--){var t=o.createElement("div");if(t.innerHTML="\x3c!--[if IE "+e+"]><span></span><![endif]--\x3e",t.getElementsByTagName("span").length)return t=null,e}return n}(),a=(r=0,t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||function(e){var t,o=(new Date).getTime();return t=Math.max(0,16-(o-r)),r=o+t,setTimeout(function(){e(o+t)},t)}),l=function(){var e=t.performance||{};if("function"!=typeof e.now){var o=e.timing&&e.timing.navigationStart?e.timing.navigationStart:(new Date).getTime();e.now=function(){return(new Date).getTime()-o}}return e}(),c=function(){var e=Array.prototype.slice;try{return e.call(o.documentElement),e}catch(t){return function(t,o){var n=this.length;if("number"!=typeof t&&(t=0),"number"!=typeof o&&(o=n),this.slice)return e.call(this,t,o);var r,i=[],s=t>=0?t:Math.max(0,n+t),a=(o<0?n+o:Math.min(o,n))-s;if(a>0)if(i=new Array(a),this.charAt)for(r=0;r<a;r++)i[r]=this.charAt(s+r);else for(r=0;r<a;r++)i[r]=this[s+r];return i}}}(),d=function(){return Array.prototype.includes?function(e,t){return e.includes(t)}:Array.prototype.indexOf?function(e,t){return e.indexOf(t)>=0}:function(e,t){for(var o=0;o<e.length;o++)if(e[o]===t)return!0;return!1}};function u(e){return m.isWrapped(e)?e=c.call(e):m.isNode(e)&&(e=[e]),e}var h,m={isNumber:function(e){return"number"==typeof e},isString:function(e){return"string"==typeof e},isArray:Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},isFunction:function(e){return"[object Function]"===Object.prototype.toString.call(e)},isNode:function(e){return e&&e.nodeType},isWrapped:function(e){return e&&e!==t&&m.isNumber(e.length)&&!m.isString(e)&&!m.isFunction(e)&&!m.isNode(e)&&(0===e.length||m.isNode(e[0]))},isSVG:function(e){return t.SVGElement&&e instanceof t.SVGElement},isEmptyObject:function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}},p=!1;if(e.fn&&e.fn.jquery?(h=e,p=!0):h=t.Velocity.Utilities,s<=8&&!p)throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity.");if(!(s<=7)){var g="swing",f={State:{isMobile:/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(t.navigator.userAgent),isAndroid:/Android/i.test(t.navigator.userAgent),isGingerbread:/Android 2\.3\.[3-7]/i.test(t.navigator.userAgent),isChrome:t.chrome,isFirefox:/Firefox/i.test(t.navigator.userAgent),prefixElement:o.createElement("div"),prefixMatches:{},scrollAnchor:null,scrollPropertyLeft:null,scrollPropertyTop:null,isTicking:!1,calls:[],delayedElements:{count:0}},CSS:{},Utilities:h,Redirects:{},Easings:{},Promise:t.Promise,defaults:{queue:"",duration:400,easing:g,begin:n,complete:n,progress:n,display:n,visibility:n,loop:!1,delay:!1,mobileHA:!0,_cacheValues:!0,promiseRejectEmpty:!0},init:function(e){h.data(e,"velocity",{isSVG:m.isSVG(e),isAnimating:!1,computedStyle:null,tweensContainer:null,rootPropertyValueCache:{},transformCache:{}})},hook:null,mock:!1,version:{major:1,minor:5,patch:2},debug:!1,timestamp:!0,pauseAll:function(e){var t=(new Date).getTime();h.each(f.State.calls,function(t,o){if(o){if(e!==n&&(o[2].queue!==e||!1===o[2].queue))return!0;o[5]={resume:!1}}}),h.each(f.State.delayedElements,function(e,o){o&&C(o,t)})},resumeAll:function(e){(new Date).getTime(),h.each(f.State.calls,function(t,o){if(o){if(e!==n&&(o[2].queue!==e||!1===o[2].queue))return!0;o[5]&&(o[5].resume=!0)}}),h.each(f.State.delayedElements,function(e,t){t&&k(t)})}};t.pageYOffset!==n?(f.State.scrollAnchor=t,f.State.scrollPropertyLeft="pageXOffset",f.State.scrollPropertyTop="pageYOffset"):(f.State.scrollAnchor=o.documentElement||o.body.parentNode||o.body,f.State.scrollPropertyLeft="scrollLeft",f.State.scrollPropertyTop="scrollTop");var v=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,o,n){var r={x:t.x+n.dx*o,v:t.v+n.dv*o,tension:t.tension,friction:t.friction};return{dx:r.v,dv:e(r)}}function o(o,n){var r={dx:o.v,dv:e(o)},i=t(o,.5*n,r),s=t(o,.5*n,i),a=t(o,n,s),l=1/6*(r.dx+2*(i.dx+s.dx)+a.dx),c=1/6*(r.dv+2*(i.dv+s.dv)+a.dv);return o.x=o.x+l*n,o.v=o.v+c*n,o}return function e(t,n,r){var i,s,a,l={x:-1,v:0,tension:null,friction:null},c=[0],d=0,u=1e-4;for(t=parseFloat(t)||500,n=parseFloat(n)||20,r=r||null,l.tension=t,l.friction=n,s=(i=null!==r)?(d=e(t,n))/r*.016:.016;a=o(a||l,s),c.push(1+a.x),d+=16,Math.abs(a.x)>u&&Math.abs(a.v)>u;);return i?function(e){return c[e*(c.length-1)|0]}:d}}();f.Easings={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},spring:function(e){return 1-Math.cos(4.5*e*Math.PI)*Math.exp(6*-e)}},h.each([["ease",[.25,.1,.25,1]],["ease-in",[.42,0,1,1]],["ease-out",[0,0,.58,1]],["ease-in-out",[.42,0,.58,1]],["easeInSine",[.47,0,.745,.715]],["easeOutSine",[.39,.575,.565,1]],["easeInOutSine",[.445,.05,.55,.95]],["easeInQuad",[.55,.085,.68,.53]],["easeOutQuad",[.25,.46,.45,.94]],["easeInOutQuad",[.455,.03,.515,.955]],["easeInCubic",[.55,.055,.675,.19]],["easeOutCubic",[.215,.61,.355,1]],["easeInOutCubic",[.645,.045,.355,1]],["easeInQuart",[.895,.03,.685,.22]],["easeOutQuart",[.165,.84,.44,1]],["easeInOutQuart",[.77,0,.175,1]],["easeInQuint",[.755,.05,.855,.06]],["easeOutQuint",[.23,1,.32,1]],["easeInOutQuint",[.86,0,.07,1]],["easeInExpo",[.95,.05,.795,.035]],["easeOutExpo",[.19,1,.22,1]],["easeInOutExpo",[1,0,0,1]],["easeInCirc",[.6,.04,.98,.335]],["easeOutCirc",[.075,.82,.165,1]],["easeInOutCirc",[.785,.135,.15,.86]]],function(e,t){f.Easings[t[0]]=T.apply(null,t[1])});var b=f.CSS={RegEx:{isHex:/^#([A-f\d]{3}){1,2}$/i,valueUnwrap:/^[A-z]+\((.*)\)$/i,wrappedValueAlreadyExtracted:/[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/,valueSplit:/([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi},Lists:{colors:["fill","stroke","stopColor","color","backgroundColor","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","outlineColor"],transformsBase:["translateX","translateY","scale","scaleX","scaleY","skewX","skewY","rotateZ"],transforms3D:["transformPerspective","translateZ","scaleZ","rotateX","rotateY"],units:["%","em","ex","ch","rem","vw","vh","vmin","vmax","cm","mm","Q","in","pc","pt","px","deg","grad","rad","turn","s","ms"],colorNames:{aliceblue:"240,248,255",antiquewhite:"250,235,215",aquamarine:"127,255,212",aqua:"0,255,255",azure:"240,255,255",beige:"245,245,220",bisque:"255,228,196",black:"0,0,0",blanchedalmond:"255,235,205",blueviolet:"138,43,226",blue:"0,0,255",brown:"165,42,42",burlywood:"222,184,135",cadetblue:"95,158,160",chartreuse:"127,255,0",chocolate:"210,105,30",coral:"255,127,80",cornflowerblue:"100,149,237",cornsilk:"255,248,220",crimson:"220,20,60",cyan:"0,255,255",darkblue:"0,0,139",darkcyan:"0,139,139",darkgoldenrod:"184,134,11",darkgray:"169,169,169",darkgrey:"169,169,169",darkgreen:"0,100,0",darkkhaki:"189,183,107",darkmagenta:"139,0,139",darkolivegreen:"85,107,47",darkorange:"255,140,0",darkorchid:"153,50,204",darkred:"139,0,0",darksalmon:"233,150,122",darkseagreen:"143,188,143",darkslateblue:"72,61,139",darkslategray:"47,79,79",darkturquoise:"0,206,209",darkviolet:"148,0,211",deeppink:"255,20,147",deepskyblue:"0,191,255",dimgray:"105,105,105",dimgrey:"105,105,105",dodgerblue:"30,144,255",firebrick:"178,34,34",floralwhite:"255,250,240",forestgreen:"34,139,34",fuchsia:"255,0,255",gainsboro:"220,220,220",ghostwhite:"248,248,255",gold:"255,215,0",goldenrod:"218,165,32",gray:"128,128,128",grey:"128,128,128",greenyellow:"173,255,47",green:"0,128,0",honeydew:"240,255,240",hotpink:"255,105,180",indianred:"205,92,92",indigo:"75,0,130",ivory:"255,255,240",khaki:"240,230,140",lavenderblush:"255,240,245",lavender:"230,230,250",lawngreen:"124,252,0",lemonchiffon:"255,250,205",lightblue:"173,216,230",lightcoral:"240,128,128",lightcyan:"224,255,255",lightgoldenrodyellow:"250,250,210",lightgray:"211,211,211",lightgrey:"211,211,211",lightgreen:"144,238,144",lightpink:"255,182,193",lightsalmon:"255,160,122",lightseagreen:"32,178,170",lightskyblue:"135,206,250",lightslategray:"119,136,153",lightsteelblue:"176,196,222",lightyellow:"255,255,224",limegreen:"50,205,50",lime:"0,255,0",linen:"250,240,230",magenta:"255,0,255",maroon:"128,0,0",mediumaquamarine:"102,205,170",mediumblue:"0,0,205",mediumorchid:"186,85,211",mediumpurple:"147,112,219",mediumseagreen:"60,179,113",mediumslateblue:"123,104,238",mediumspringgreen:"0,250,154",mediumturquoise:"72,209,204",mediumvioletred:"199,21,133",midnightblue:"25,25,112",mintcream:"245,255,250",mistyrose:"255,228,225",moccasin:"255,228,181",navajowhite:"255,222,173",navy:"0,0,128",oldlace:"253,245,230",olivedrab:"107,142,35",olive:"128,128,0",orangered:"255,69,0",orange:"255,165,0",orchid:"218,112,214",palegoldenrod:"238,232,170",palegreen:"152,251,152",paleturquoise:"175,238,238",palevioletred:"219,112,147",papayawhip:"255,239,213",peachpuff:"255,218,185",peru:"205,133,63",pink:"255,192,203",plum:"221,160,221",powderblue:"176,224,230",purple:"128,0,128",red:"255,0,0",rosybrown:"188,143,143",royalblue:"65,105,225",saddlebrown:"139,69,19",salmon:"250,128,114",sandybrown:"244,164,96",seagreen:"46,139,87",seashell:"255,245,238",sienna:"160,82,45",silver:"192,192,192",skyblue:"135,206,235",slateblue:"106,90,205",slategray:"112,128,144",snow:"255,250,250",springgreen:"0,255,127",steelblue:"70,130,180",tan:"210,180,140",teal:"0,128,128",thistle:"216,191,216",tomato:"255,99,71",turquoise:"64,224,208",violet:"238,130,238",wheat:"245,222,179",whitesmoke:"245,245,245",white:"255,255,255",yellowgreen:"154,205,50",yellow:"255,255,0"}},Hooks:{templates:{textShadow:["Color X Y Blur","black 0px 0px 0px"],boxShadow:["Color X Y Blur Spread","black 0px 0px 0px 0px"],clip:["Top Right Bottom Left","0px 0px 0px 0px"],backgroundPosition:["X Y","0% 0%"],transformOrigin:["X Y Z","50% 50% 0px"],perspectiveOrigin:["X Y","50% 50%"]},registered:{},register:function(){for(var e=0;e<b.Lists.colors.length;e++){var t="color"===b.Lists.colors[e]?"0 0 0 1":"255 255 255 1";b.Hooks.templates[b.Lists.colors[e]]=["Red Green Blue Alpha",t]}var o,n,r;if(s)for(o in b.Hooks.templates)if(b.Hooks.templates.hasOwnProperty(o)){r=(n=b.Hooks.templates[o])[0].split(" ");var i=n[1].match(b.RegEx.valueSplit);"Color"===r[0]&&(r.push(r.shift()),i.push(i.shift()),b.Hooks.templates[o]=[r.join(" "),i.join(" ")])}for(o in b.Hooks.templates)if(b.Hooks.templates.hasOwnProperty(o))for(var a in r=(n=b.Hooks.templates[o])[0].split(" "))if(r.hasOwnProperty(a)){var l=o+r[a],c=a;b.Hooks.registered[l]=[o,c]}},getRoot:function(e){var t=b.Hooks.registered[e];return t?t[0]:e},getUnit:function(e,t){var o=(e.substr(t||0,5).match(/^[a-z%]+/)||[])[0]||"";return o&&d(b.Lists.units)?o:""},fixColors:function(e){return e.replace(/(rgba?\(\s*)?(\b[a-z]+\b)/g,function(e,t,o){return b.Lists.colorNames.hasOwnProperty(o)?(t||"rgba(")+b.Lists.colorNames[o]+(t?"":",1)"):t+o})},cleanRootPropertyValue:function(e,t){return b.RegEx.valueUnwrap.test(t)&&(t=t.match(b.RegEx.valueUnwrap)[1]),b.Values.isCSSNullValue(t)&&(t=b.Hooks.templates[e][1]),t},extractValue:function(e,t){var o=b.Hooks.registered[e];if(o){var n=o[0],r=o[1];return(t=b.Hooks.cleanRootPropertyValue(n,t)).toString().match(b.RegEx.valueSplit)[r]}return t},injectValue:function(e,t,o){var n=b.Hooks.registered[e];if(n){var r,i=n[0],s=n[1];return(r=(o=b.Hooks.cleanRootPropertyValue(i,o)).toString().match(b.RegEx.valueSplit))[s]=t,r.join(" ")}return o}},Normalizations:{registered:{clip:function(e,t,o){switch(e){case"name":return"clip";case"extract":var n;return b.RegEx.wrappedValueAlreadyExtracted.test(o)?o:(n=o.toString().match(b.RegEx.valueUnwrap))?n[1].replace(/,(\s+)?/g," "):o;case"inject":return"rect("+o+")"}},blur:function(e,t,o){switch(e){case"name":return f.State.isFirefox?"filter":"-webkit-filter";case"extract":var n=parseFloat(o);if(!n&&0!==n){var r=o.toString().match(/blur\(([0-9]+[A-z]+)\)/i);n=r?r[1]:0}return n;case"inject":return parseFloat(o)?"blur("+o+")":"none"}},opacity:function(e,t,o){if(s<=8)switch(e){case"name":return"filter";case"extract":var n=o.toString().match(/alpha\(opacity=(.*)\)/i);return n?n[1]/100:1;case"inject":return t.style.zoom=1,parseFloat(o)>=1?"":"alpha(opacity="+parseInt(100*parseFloat(o),10)+")"}else switch(e){case"name":return"opacity";case"extract":case"inject":return o}}},register:function(){s&&!(s>9)||f.State.isGingerbread||(b.Lists.transformsBase=b.Lists.transformsBase.concat(b.Lists.transforms3D));for(var e=0;e<b.Lists.transformsBase.length;e++)(function(){var t=b.Lists.transformsBase[e];b.Normalizations.registered[t]=function(e,o,r){switch(e){case"name":return"transform";case"extract":return x(o)===n||x(o).transformCache[t]===n?/^scale/i.test(t)?1:0:x(o).transformCache[t].replace(/[()]/g,"");case"inject":var i=!1;switch(t.substr(0,t.length-1)){case"translate":i=!/(%|px|em|rem|vw|vh|\d)$/i.test(r);break;case"scal":case"scale":f.State.isAndroid&&x(o).transformCache[t]===n&&r<1&&(r=1),i=!/(\d)$/i.test(r);break;case"skew":case"rotate":i=!/(deg|\d)$/i.test(r)}return i||(x(o).transformCache[t]="("+r+")"),x(o).transformCache[t]}}})();for(var t=0;t<b.Lists.colors.length;t++)(function(){var e=b.Lists.colors[t];b.Normalizations.registered[e]=function(t,o,r){switch(t){case"name":return e;case"extract":var i;if(b.RegEx.wrappedValueAlreadyExtracted.test(r))i=r;else{var a,l={black:"rgb(0, 0, 0)",blue:"rgb(0, 0, 255)",gray:"rgb(128, 128, 128)",green:"rgb(0, 128, 0)",red:"rgb(255, 0, 0)",white:"rgb(255, 255, 255)"};/^[A-z]+$/i.test(r)?a=l[r]!==n?l[r]:l.black:b.RegEx.isHex.test(r)?a="rgb("+b.Values.hexToRgb(r).join(" ")+")":/^rgba?\(/i.test(r)||(a=l.black),i=(a||r).toString().match(b.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g," ")}return(!s||s>8)&&3===i.split(" ").length&&(i+=" 1"),i;case"inject":return/^rgb/.test(r)?r:(s<=8?4===r.split(" ").length&&(r=r.split(/\s+/).slice(0,3).join(" ")):3===r.split(" ").length&&(r+=" 1"),(s<=8?"rgb":"rgba")+"("+r.replace(/\s+/g,",").replace(/\.(\d)+(?=,)/g,"")+")")}}})();function o(e,t,o){if("border-box"===b.getPropertyValue(t,"boxSizing").toString().toLowerCase()===(o||!1)){var n,r,i=0,s="width"===e?["Left","Right"]:["Top","Bottom"],a=["padding"+s[0],"padding"+s[1],"border"+s[0]+"Width","border"+s[1]+"Width"];for(n=0;n<a.length;n++)r=parseFloat(b.getPropertyValue(t,a[n])),isNaN(r)||(i+=r);return o?-i:i}return 0}function r(e,t){return function(n,r,i){switch(n){case"name":return e;case"extract":return parseFloat(i)+o(e,r,t);case"inject":return parseFloat(i)-o(e,r,t)+"px"}}}b.Normalizations.registered.innerWidth=r("width",!0),b.Normalizations.registered.innerHeight=r("height",!0),b.Normalizations.registered.outerWidth=r("width"),b.Normalizations.registered.outerHeight=r("height")}},Names:{camelCase:function(e){return e.replace(/-(\w)/g,function(e,t){return t.toUpperCase()})},SVGAttribute:function(e){var t="width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2";return(s||f.State.isAndroid&&!f.State.isChrome)&&(t+="|transform"),new RegExp("^("+t+")$","i").test(e)},prefixCheck:function(e){if(f.State.prefixMatches[e])return[f.State.prefixMatches[e],!0];for(var t=["","Webkit","Moz","ms","O"],o=0,n=t.length;o<n;o++){var r;if(r=0===o?e:t[o]+e.replace(/^\w/,function(e){return e.toUpperCase()}),m.isString(f.State.prefixElement.style[r]))return f.State.prefixMatches[e]=r,[r,!0]}return[e,!1]}},Values:{hexToRgb:function(e){var t;return e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,o,n){return t+t+o+o+n+n}),(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e))?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:[0,0,0]},isCSSNullValue:function(e){return!e||/^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e)},getUnitType:function(e){return/^(rotate|skew)/i.test(e)?"deg":/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e)?"":"px"},getDisplayType:function(e){var t=e&&e.tagName.toString().toLowerCase();return/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t)?"inline":/^(li)$/i.test(t)?"list-item":/^(tr)$/i.test(t)?"table-row":/^(table)$/i.test(t)?"table":/^(tbody)$/i.test(t)?"table-row-group":"block"},addClass:function(e,t){if(e)if(e.classList)e.classList.add(t);else if(m.isString(e.className))e.className+=(e.className.length?" ":"")+t;else{var o=e.getAttribute(s<=7?"className":"class")||"";e.setAttribute("class",o+(o?" ":"")+t)}},removeClass:function(e,t){if(e)if(e.classList)e.classList.remove(t);else if(m.isString(e.className))e.className=e.className.toString().replace(new RegExp("(^|\\s)"+t.split(" ").join("|")+"(\\s|$)","gi")," ");else{var o=e.getAttribute(s<=7?"className":"class")||"";e.setAttribute("class",o.replace(new RegExp("(^|s)"+t.split(" ").join("|")+"(s|$)","gi")," "))}}},getPropertyValue:function(e,o,r,i){function a(e,o){var r=0;if(s<=8)r=h.css(e,o);else{var l=!1;/^(width|height)$/.test(o)&&0===b.getPropertyValue(e,"display")&&(l=!0,b.setPropertyValue(e,"display",b.Values.getDisplayType(e)));var c,d=function(){l&&b.setPropertyValue(e,"display","none")};if(!i){if("height"===o&&"border-box"!==b.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var u=e.offsetHeight-(parseFloat(b.getPropertyValue(e,"borderTopWidth"))||0)-(parseFloat(b.getPropertyValue(e,"borderBottomWidth"))||0)-(parseFloat(b.getPropertyValue(e,"paddingTop"))||0)-(parseFloat(b.getPropertyValue(e,"paddingBottom"))||0);return d(),u}if("width"===o&&"border-box"!==b.getPropertyValue(e,"boxSizing").toString().toLowerCase()){var m=e.offsetWidth-(parseFloat(b.getPropertyValue(e,"borderLeftWidth"))||0)-(parseFloat(b.getPropertyValue(e,"borderRightWidth"))||0)-(parseFloat(b.getPropertyValue(e,"paddingLeft"))||0)-(parseFloat(b.getPropertyValue(e,"paddingRight"))||0);return d(),m}}c=x(e)===n?t.getComputedStyle(e,null):x(e).computedStyle?x(e).computedStyle:x(e).computedStyle=t.getComputedStyle(e,null),"borderColor"===o&&(o="borderTopColor"),""!==(r=9===s&&"filter"===o?c.getPropertyValue(o):c[o])&&null!==r||(r=e.style[o]),d()}if("auto"===r&&/^(top|right|bottom|left)$/i.test(o)){var p=a(e,"position");("fixed"===p||"absolute"===p&&/top|left/i.test(o))&&(r=h(e).position()[o]+"px")}return r}var l;if(b.Hooks.registered[o]){var c=o,d=b.Hooks.getRoot(c);r===n&&(r=b.getPropertyValue(e,b.Names.prefixCheck(d)[0])),b.Normalizations.registered[d]&&(r=b.Normalizations.registered[d]("extract",e,r)),l=b.Hooks.extractValue(c,r)}else if(b.Normalizations.registered[o]){var u,m;"transform"!==(u=b.Normalizations.registered[o]("name",e))&&(m=a(e,b.Names.prefixCheck(u)[0]),b.Values.isCSSNullValue(m)&&b.Hooks.templates[o]&&(m=b.Hooks.templates[o][1])),l=b.Normalizations.registered[o]("extract",e,m)}if(!/^[\d-]/.test(l)){var p=x(e);if(p&&p.isSVG&&b.Names.SVGAttribute(o))if(/^(height|width)$/i.test(o))try{l=e.getBBox()[o]}catch(e){l=0}else l=e.getAttribute(o);else l=a(e,b.Names.prefixCheck(o)[0])}return b.Values.isCSSNullValue(l)&&(l=0),f.debug>=2&&console.log("Get "+o+": "+l),l},setPropertyValue:function(e,o,n,r,i){var a=o;if("scroll"===o)i.container?i.container["scroll"+i.direction]=n:"Left"===i.direction?t.scrollTo(n,i.alternateValue):t.scrollTo(i.alternateValue,n);else if(b.Normalizations.registered[o]&&"transform"===b.Normalizations.registered[o]("name",e))b.Normalizations.registered[o]("inject",e,n),a="transform",n=x(e).transformCache[o];else{if(b.Hooks.registered[o]){var l=o,c=b.Hooks.getRoot(o);r=r||b.getPropertyValue(e,c),n=b.Hooks.injectValue(l,n,r),o=c}if(b.Normalizations.registered[o]&&(n=b.Normalizations.registered[o]("inject",e,n),o=b.Normalizations.registered[o]("name",e)),a=b.Names.prefixCheck(o)[0],s<=8)try{e.style[a]=n}catch(e){f.debug&&console.log("Browser does not support ["+n+"] for ["+a+"]")}else{var d=x(e);d&&d.isSVG&&b.Names.SVGAttribute(o)?e.setAttribute(o,n):e.style[a]=n}f.debug>=2&&console.log("Set "+o+" ("+a+"): "+n)}return[a,n]},flushTransformCache:function(e){var t="",o=x(e);if((s||f.State.isAndroid&&!f.State.isChrome)&&o&&o.isSVG){var n=function(t){return parseFloat(b.getPropertyValue(e,t))},r={translate:[n("translateX"),n("translateY")],skewX:[n("skewX")],skewY:[n("skewY")],scale:1!==n("scale")?[n("scale"),n("scale")]:[n("scaleX"),n("scaleY")],rotate:[n("rotateZ"),0,0]};h.each(x(e).transformCache,function(e){/^translate/i.test(e)?e="translate":/^scale/i.test(e)?e="scale":/^rotate/i.test(e)&&(e="rotate"),r[e]&&(t+=e+"("+r[e].join(" ")+") ",delete r[e])})}else{var i,a;h.each(x(e).transformCache,function(o){if(i=x(e).transformCache[o],"transformPerspective"===o)return a=i,!0;9===s&&"rotateZ"===o&&(o="rotate"),t+=o+i+" "}),a&&(t="perspective"+a+" "+t)}b.setPropertyValue(e,"transform",t)}};b.Hooks.register(),b.Normalizations.register(),f.hook=function(e,t,o){var r;return e=u(e),h.each(e,function(e,i){if(x(i)===n&&f.init(i),o===n)r===n&&(r=b.getPropertyValue(i,t));else{var s=b.setPropertyValue(i,t,o);"transform"===s[0]&&f.CSS.flushTransformCache(i),r=s}}),r};var y=function(){var e;function r(){return i?v.promise||null:s}var i,s,a,l,c,p,g=arguments[0]&&(arguments[0].p||h.isPlainObject(arguments[0].properties)&&!arguments[0].properties.names||m.isString(arguments[0].properties));m.isWrapped(this)?(i=!1,a=0,l=this,s=this):(i=!0,a=1,l=g?arguments[0].elements||arguments[0].e:arguments[0]);var v={promise:null,resolver:null,rejecter:null};if(i&&f.Promise&&(v.promise=new f.Promise(function(e,t){v.resolver=e,v.rejecter=t})),g?(c=arguments[0].properties||arguments[0].p,p=arguments[0].options||arguments[0].o):(c=arguments[a],p=arguments[a+1]),l=u(l)){var w,_=l.length,S=0;if(!/^(stop|finish|finishAll|pause|resume)$/i.test(c)&&!h.isPlainObject(p)){p={};for(var T=a+1;T<arguments.length;T++)m.isArray(arguments[T])||!/^(fast|normal|slow)$/i.test(arguments[T])&&!/^\d/.test(arguments[T])?m.isString(arguments[T])||m.isArray(arguments[T])?p.easing=arguments[T]:m.isFunction(arguments[T])&&(p.complete=arguments[T]):p.duration=arguments[T]}switch(c){case"scroll":w="scroll";break;case"reverse":w="reverse";break;case"pause":var M=(new Date).getTime();return h.each(l,function(e,t){C(t,M)}),h.each(f.State.calls,function(e,t){var o=!1;t&&h.each(t[1],function(e,r){var i=p===n?"":p;return!0!==i&&t[2].queue!==i&&(p!==n||!1!==t[2].queue)||(h.each(l,function(e,n){if(n===r)return t[5]={resume:!1},o=!0,!1}),!o&&void 0)})}),r();case"resume":return h.each(l,function(e,t){k(t)}),h.each(f.State.calls,function(e,t){var o=!1;t&&h.each(t[1],function(e,r){var i=p===n?"":p;return!0!==i&&t[2].queue!==i&&(p!==n||!1!==t[2].queue)||!t[5]||(h.each(l,function(e,n){if(n===r)return t[5].resume=!0,o=!0,!1}),!o&&void 0)})}),r();case"finish":case"finishAll":case"stop":h.each(l,function(e,t){x(t)&&x(t).delayTimer&&(clearTimeout(x(t).delayTimer.setTimeout),x(t).delayTimer.next&&x(t).delayTimer.next(),delete x(t).delayTimer),"finishAll"!==c||!0!==p&&!m.isString(p)||(h.each(h.queue(t,m.isString(p)?p:""),function(e,t){m.isFunction(t)&&t()}),h.queue(t,m.isString(p)?p:"",[]))});var B=[];return h.each(f.State.calls,function(e,t){t&&h.each(t[1],function(o,r){var i=p===n?"":p;if(!0!==i&&t[2].queue!==i&&(p!==n||!1!==t[2].queue))return!0;h.each(l,function(o,n){if(n===r)if((!0===p||m.isString(p))&&(h.each(h.queue(n,m.isString(p)?p:""),function(e,t){m.isFunction(t)&&t(null,!0)}),h.queue(n,m.isString(p)?p:"",[])),"stop"===c){var s=x(n);s&&s.tweensContainer&&(!0===i||""===i)&&h.each(s.tweensContainer,function(e,t){t.endValue=t.currentValue}),B.push(e)}else"finish"!==c&&"finishAll"!==c||(t[2].duration=1)})})}),"stop"===c&&(h.each(B,function(e,t){A(t,!0)}),v.promise&&v.resolver(l)),r();default:if(!h.isPlainObject(c)||m.isEmptyObject(c)){if(m.isString(c)&&f.Redirects[c]){var R=(e=h.extend({},p)).duration,N=e.delay||0;return!0===e.backwards&&(l=h.extend(!0,[],l).reverse()),h.each(l,function(t,o){parseFloat(e.stagger)?e.delay=N+parseFloat(e.stagger)*t:m.isFunction(e.stagger)&&(e.delay=N+e.stagger.call(o,t,_)),e.drag&&(e.duration=parseFloat(R)||(/^(callout|transition)/.test(c)?1e3:400),e.duration=Math.max(e.duration*(e.backwards?1-t/_:(t+1)/_),.75*e.duration,200)),f.Redirects[c].call(o,o,e||{},t,_,l,v.promise?v:n)}),r()}var V="Velocity: First argument ("+c+") was not a property map, a known action, or a registered redirect. Aborting.";return v.promise?v.rejecter(new Error(V)):t.console&&console.log(V),r()}w="start"}var D={lastParent:null,lastPosition:null,lastFontSize:null,lastPercentToPxWidth:null,lastPercentToPxHeight:null,lastEmToPx:null,remToPx:null,vwToPx:null,vhToPx:null},P=[];h.each(l,function(e,r){m.isNode(r)&&function(e,r){var i,s,a=h.extend({},f.defaults,p),u={};switch(x(e)===n&&f.init(e),parseFloat(a.delay)&&!1!==a.queue&&h.queue(e,a.queue,function(t,o){if(!0===o)return!0;f.velocityQueueEntryFlag=!0;var n=f.State.delayedElements.count++;f.State.delayedElements[n]=e;var r,i=(r=n,function(){f.State.delayedElements[r]=!1,t()});x(e).delayBegin=(new Date).getTime(),x(e).delay=parseFloat(a.delay),x(e).delayTimer={setTimeout:setTimeout(t,parseFloat(a.delay)),next:i}}),a.duration.toString().toLowerCase()){case"fast":a.duration=200;break;case"normal":a.duration=400;break;case"slow":a.duration=600;break;default:a.duration=parseFloat(a.duration)||1}function g(s){var g,y;if(a.begin&&0===S)try{a.begin.call(l,l)}catch(e){setTimeout(function(){throw e},1)}if("scroll"===w){var C,k,T,A=/^x$/i.test(a.axis)?"Left":"Top",M=parseFloat(a.offset)||0;a.container?m.isWrapped(a.container)||m.isNode(a.container)?(a.container=a.container[0]||a.container,T=(C=a.container["scroll"+A])+h(e).position()[A.toLowerCase()]+M):a.container=null:(C=f.State.scrollAnchor[f.State["scrollProperty"+A]],k=f.State.scrollAnchor[f.State["scrollProperty"+("Left"===A?"Top":"Left")]],T=h(e).offset()[A.toLowerCase()]+M),u={scroll:{rootPropertyValue:!1,startValue:C,currentValue:C,endValue:T,unitType:"",easing:a.easing,scrollData:{container:a.container,direction:A,alternateValue:k}},element:e},f.debug&&console.log("tweensContainer (scroll): ",u.scroll,e)}else if("reverse"===w){if(!(g=x(e)))return;if(!g.tweensContainer)return void h.dequeue(e,a.queue);for(var B in"none"===g.opts.display&&(g.opts.display="auto"),"hidden"===g.opts.visibility&&(g.opts.visibility="visible"),g.opts.loop=!1,g.opts.begin=null,g.opts.complete=null,p.easing||delete a.easing,p.duration||delete a.duration,a=h.extend({},g.opts,a),y=h.extend(!0,{},g?g.tweensContainer:null))if(y.hasOwnProperty(B)&&"element"!==B){var R=y[B].startValue;y[B].startValue=y[B].currentValue=y[B].endValue,y[B].endValue=R,m.isEmptyObject(p)||(y[B].easing=a.easing),f.debug&&console.log("reverse tweensContainer ("+B+"): "+JSON.stringify(y[B]),e)}u=y}else if("start"===w){(g=x(e))&&g.tweensContainer&&!0===g.isAnimating&&(y=g.tweensContainer);var N=function(t,o){var n,i,s;return m.isFunction(t)&&(t=t.call(e,r,_)),m.isArray(t)?(n=t[0],!m.isArray(t[1])&&/^[\d-]/.test(t[1])||m.isFunction(t[1])||b.RegEx.isHex.test(t[1])?s=t[1]:m.isString(t[1])&&!b.RegEx.isHex.test(t[1])&&f.Easings[t[1]]||m.isArray(t[1])?(i=o?t[1]:E(t[1],a.duration),s=t[2]):s=t[1]||t[2]):n=t,o||(i=i||a.easing),m.isFunction(n)&&(n=n.call(e,r,_)),m.isFunction(s)&&(s=s.call(e,r,_)),[n||0,i,s]},V=function(r,s){var l,c=b.Hooks.getRoot(r),d=!1,p=s[0],v=s[1],w=s[2];if(g&&g.isSVG||"tween"===c||!1!==b.Names.prefixCheck(c)[1]||b.Normalizations.registered[c]!==n){(a.display!==n&&null!==a.display&&"none"!==a.display||a.visibility!==n&&"hidden"!==a.visibility)&&/opacity|filter/.test(r)&&!w&&0!==p&&(w=0),a._cacheValues&&y&&y[r]?(w===n&&(w=y[r].endValue+y[r].unitType),d=g.rootPropertyValueCache[c]):b.Hooks.registered[r]?w===n?(d=b.getPropertyValue(e,c),w=b.getPropertyValue(e,r,d)):d=b.Hooks.templates[c][1]:w===n&&(w=b.getPropertyValue(e,r));var _,x,C,k=!1,S=function(e,t){var o,n;return n=(t||"0").toString().toLowerCase().replace(/[%A-z]+$/,function(e){return o=e,""}),o||(o=b.Values.getUnitType(e)),[n,o]};if(w!==p&&m.isString(w)&&m.isString(p)){l="";var T=0,E=0,O=[],A=[],M=0,B=0,R=0;for(w=b.Hooks.fixColors(w),p=b.Hooks.fixColors(p);T<w.length&&E<p.length;){var N=w[T],V=p[E];if(/[\d\.-]/.test(N)&&/[\d\.-]/.test(V)){for(var P=N,I=V,L=".",F=".";++T<w.length;){if((N=w[T])===L)L="..";else if(!/\d/.test(N))break;P+=N}for(;++E<p.length;){if((V=p[E])===F)F="..";else if(!/\d/.test(V))break;I+=V}var z=b.Hooks.getUnit(w,T),H=b.Hooks.getUnit(p,E);if(T+=z.length,E+=H.length,z===H)P===I?l+=P+z:(l+="{"+O.length+(B?"!":"")+"}"+z,O.push(parseFloat(P)),A.push(parseFloat(I)));else{var U=parseFloat(P),Z=parseFloat(I);l+=(M<5?"calc":"")+"("+(U?"{"+O.length+(B?"!":"")+"}":"0")+z+" + "+(Z?"{"+(O.length+(U?1:0))+(B?"!":"")+"}":"0")+H+")",U&&(O.push(U),A.push(0)),Z&&(O.push(0),A.push(Z))}}else{if(N!==V){M=0;break}l+=N,T++,E++,0===M&&"c"===N||1===M&&"a"===N||2===M&&"l"===N||3===M&&"c"===N||M>=4&&"("===N?M++:(M&&M<5||M>=4&&")"===N&&--M<5)&&(M=0),0===B&&"r"===N||1===B&&"g"===N||2===B&&"b"===N||3===B&&"a"===N||B>=3&&"("===N?(3===B&&"a"===N&&(R=1),B++):R&&","===N?++R>3&&(B=R=0):(R&&B<(R?5:4)||B>=(R?4:3)&&")"===N&&--B<(R?5:4))&&(B=R=0)}}T===w.length&&E===p.length||(f.debug&&console.error('Trying to pattern match mis-matched strings ["'+p+'", "'+w+'"]'),l=n),l&&(O.length?(f.debug&&console.log('Pattern found "'+l+'" -> ',O,A,"["+w+","+p+"]"),w=O,p=A,x=C=""):l=n)}if(l||(w=(_=S(r,w))[0],C=_[1],p=(_=S(r,p))[0].replace(/^([+-\/*])=/,function(e,t){return k=t,""}),x=_[1],w=parseFloat(w)||0,p=parseFloat(p)||0,"%"===x&&(/^(fontSize|lineHeight)$/.test(r)?(p/=100,x="em"):/^scale/.test(r)?(p/=100,x=""):/(Red|Green|Blue)$/i.test(r)&&(p=p/100*255,x=""))),/[\/*]/.test(k))x=C;else if(C!==x&&0!==w)if(0===p)x=C;else{i=i||function(){var n={myParent:e.parentNode||o.body,position:b.getPropertyValue(e,"position"),fontSize:b.getPropertyValue(e,"fontSize")},r=n.position===D.lastPosition&&n.myParent===D.lastParent,i=n.fontSize===D.lastFontSize;D.lastParent=n.myParent,D.lastPosition=n.position,D.lastFontSize=n.fontSize;var s=100,a={};if(i&&r)a.emToPx=D.lastEmToPx,a.percentToPxWidth=D.lastPercentToPxWidth,a.percentToPxHeight=D.lastPercentToPxHeight;else{var l=g&&g.isSVG?o.createElementNS("http://www.w3.org/2000/svg","rect"):o.createElement("div");f.init(l),n.myParent.appendChild(l),h.each(["overflow","overflowX","overflowY"],function(e,t){f.CSS.setPropertyValue(l,t,"hidden")}),f.CSS.setPropertyValue(l,"position",n.position),f.CSS.setPropertyValue(l,"fontSize",n.fontSize),f.CSS.setPropertyValue(l,"boxSizing","content-box"),h.each(["minWidth","maxWidth","width","minHeight","maxHeight","height"],function(e,t){f.CSS.setPropertyValue(l,t,s+"%")}),f.CSS.setPropertyValue(l,"paddingLeft",s+"em"),a.percentToPxWidth=D.lastPercentToPxWidth=(parseFloat(b.getPropertyValue(l,"width",null,!0))||1)/s,a.percentToPxHeight=D.lastPercentToPxHeight=(parseFloat(b.getPropertyValue(l,"height",null,!0))||1)/s,a.emToPx=D.lastEmToPx=(parseFloat(b.getPropertyValue(l,"paddingLeft"))||1)/s,n.myParent.removeChild(l)}return null===D.remToPx&&(D.remToPx=parseFloat(b.getPropertyValue(o.body,"fontSize"))||16),null===D.vwToPx&&(D.vwToPx=parseFloat(t.innerWidth)/100,D.vhToPx=parseFloat(t.innerHeight)/100),a.remToPx=D.remToPx,a.vwToPx=D.vwToPx,a.vhToPx=D.vhToPx,f.debug>=1&&console.log("Unit ratios: "+JSON.stringify(a),e),a}();var $=/margin|padding|left|right|width|text|word|letter/i.test(r)||/X$/.test(r)||"x"===r?"x":"y";switch(C){case"%":w*="x"===$?i.percentToPxWidth:i.percentToPxHeight;break;case"px":break;default:w*=i[C+"ToPx"]}switch(x){case"%":w*=1/("x"===$?i.percentToPxWidth:i.percentToPxHeight);break;case"px":break;default:w*=1/i[x+"ToPx"]}}switch(k){case"+":p=w+p;break;case"-":p=w-p;break;case"*":p*=w;break;case"/":p=w/p}u[r]={rootPropertyValue:d,startValue:w,currentValue:w,endValue:p,unitType:x,easing:v},l&&(u[r].pattern=l),f.debug&&console.log("tweensContainer ("+r+"): "+JSON.stringify(u[r]),e)}else f.debug&&console.log("Skipping ["+c+"] due to a lack of browser support.")};for(var I in c)if(c.hasOwnProperty(I)){var L=b.Names.camelCase(I),F=N(c[I]);if(d(b.Lists.colors)){var z=F[0],H=F[1],U=F[2];if(b.RegEx.isHex.test(z)){for(var Z=["Red","Green","Blue"],$=b.Values.hexToRgb(z),j=U?b.Values.hexToRgb(U):n,W=0;W<Z.length;W++){var q=[$[W]];H&&q.push(H),j!==n&&q.push(j[W]),V(L+Z[W],q)}continue}}V(L,F)}u.element=e}u.element&&(b.Values.addClass(e,"velocity-animating"),P.push(u),(g=x(e))&&(""===a.queue&&(g.tweensContainer=u,g.opts=a),g.isAnimating=!0),S===_-1?(f.State.calls.push([P,l,a,null,v.resolver,null,0]),!1===f.State.isTicking&&(f.State.isTicking=!0,O())):S++)}if(!1!==f.mock&&(!0===f.mock?a.duration=a.delay=1:(a.duration*=parseFloat(f.mock)||1,a.delay*=parseFloat(f.mock)||1)),a.easing=E(a.easing,a.duration),a.begin&&!m.isFunction(a.begin)&&(a.begin=null),a.progress&&!m.isFunction(a.progress)&&(a.progress=null),a.complete&&!m.isFunction(a.complete)&&(a.complete=null),a.display!==n&&null!==a.display&&(a.display=a.display.toString().toLowerCase(),"auto"===a.display&&(a.display=f.CSS.Values.getDisplayType(e))),a.visibility!==n&&null!==a.visibility&&(a.visibility=a.visibility.toString().toLowerCase()),a.mobileHA=a.mobileHA&&f.State.isMobile&&!f.State.isGingerbread,!1===a.queue)if(a.delay){var y=f.State.delayedElements.count++;f.State.delayedElements[y]=e;var C=(s=y,function(){f.State.delayedElements[s]=!1,g()});x(e).delayBegin=(new Date).getTime(),x(e).delay=parseFloat(a.delay),x(e).delayTimer={setTimeout:setTimeout(g,parseFloat(a.delay)),next:C}}else g();else h.queue(e,a.queue,function(e,t){if(!0===t)return v.promise&&v.resolver(l),!0;f.velocityQueueEntryFlag=!0,g()});""!==a.queue&&"fx"!==a.queue||"inprogress"===h.queue(e)[0]||h.dequeue(e)}(r,e)}),(e=h.extend({},f.defaults,p)).loop=parseInt(e.loop,10);var I=2*e.loop-1;if(e.loop)for(var L=0;L<I;L++){var F={delay:e.delay,progress:e.progress};L===I-1&&(F.display=e.display,F.visibility=e.visibility,F.complete=e.complete),y(l,"reverse",F)}return r()}v.promise&&(c&&p&&!1===p.promiseRejectEmpty?v.resolver():v.rejecter())};(f=h.extend(y,f)).animate=y;var w=t.requestAnimationFrame||a;if(!f.State.isMobile&&o.hidden!==n){var _=function(){o.hidden?(w=function(e){return setTimeout(function(){e(!0)},16)},O()):w=t.requestAnimationFrame||a};_(),o.addEventListener("visibilitychange",_)}return e.Velocity=f,e!==t&&(e.fn.velocity=y,e.fn.velocity.defaults=f.defaults),h.each(["Down","Up"],function(e,t){f.Redirects["slide"+t]=function(e,o,r,i,s,a){var l=h.extend({},o),c=l.begin,d=l.complete,u={},m={height:"",marginTop:"",marginBottom:"",paddingTop:"",paddingBottom:""};l.display===n&&(l.display="Down"===t?"inline"===f.CSS.Values.getDisplayType(e)?"inline-block":"block":"none"),l.begin=function(){for(var o in 0===r&&c&&c.call(s,s),m)if(m.hasOwnProperty(o)){u[o]=e.style[o];var n=b.getPropertyValue(e,o);m[o]="Down"===t?[n,0]:[0,n]}u.overflow=e.style.overflow,e.style.overflow="hidden"},l.complete=function(){for(var t in u)u.hasOwnProperty(t)&&(e.style[t]=u[t]);r===i-1&&(d&&d.call(s,s),a&&a.resolver(s))},f(e,m,l)}}),h.each(["In","Out"],function(e,t){f.Redirects["fade"+t]=function(e,o,r,i,s,a){var l=h.extend({},o),c=l.complete,d={opacity:"In"===t?1:0};0!==r&&(l.begin=null),l.complete=r!==i-1?null:function(){c&&c.call(s,s),a&&a.resolver(s)},l.display===n&&(l.display="In"===t?"auto":"none"),f(this,d,l)}}),f}function x(e){var t=h.data(e,"velocity");return null===t?n:t}function C(e,t){var o=x(e);o&&o.delayTimer&&!o.delayPaused&&(o.delayRemaining=o.delay-t+o.delayBegin,o.delayPaused=!0,clearTimeout(o.delayTimer.setTimeout))}function k(e,t){var o=x(e);o&&o.delayTimer&&o.delayPaused&&(o.delayPaused=!1,o.delayTimer.setTimeout=setTimeout(o.delayTimer.next,o.delayRemaining))}function S(e){return function(t){return Math.round(t*e)*(1/e)}}function T(e,o,n,r){var i=.1,s="Float32Array"in t;if(4!==arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var l=s?new Float32Array(11):new Array(11);function c(e,t){return 1-3*t+3*e}function d(e,t){return 3*t-6*e}function u(e){return 3*e}function h(e,t,o){return((c(t,o)*e+d(t,o))*e+u(t))*e}function m(e,t,o){return 3*c(t,o)*e*e+2*d(t,o)*e+u(t)}var p=!1;var g=function(t){return p||(p=!0,e===o&&n===r||function(){for(var t=0;t<11;++t)l[t]=h(t*i,e,n)}()),e===o&&n===r?t:0===t?0:1===t?1:h(function(t){for(var o=0,r=1;10!==r&&l[r]<=t;++r)o+=i;--r;var s=o+(t-l[r])/(l[r+1]-l[r])*i,a=m(s,e,n);return a>=.001?function(t,o){for(var r=0;r<4;++r){var i=m(o,e,n);if(0===i)return o;o-=(h(o,e,n)-t)/i}return o}(t,s):0===a?s:function(t,o,r){var i,s,a=0;do{(i=h(s=o+(r-o)/2,e,n)-t)>0?r=s:o=s}while(Math.abs(i)>1e-7&&++a<10);return s}(t,o,o+i)}(t),o,r)};g.getControlPoints=function(){return[{x:e,y:o},{x:n,y:r}]};var f="generateBezier("+[e,o,n,r]+")";return g.toString=function(){return f},g}function E(e,t){var o=e;return m.isString(e)?f.Easings[e]||(o=!1):o=m.isArray(e)&&1===e.length?S.apply(null,e):m.isArray(e)&&2===e.length?v.apply(null,e.concat([t])):!(!m.isArray(e)||4!==e.length)&&T.apply(null,e),!1===o&&(o=f.Easings[f.defaults.easing]?f.defaults.easing:g),o}function O(e){if(e){var t=f.timestamp&&!0!==e?e:l.now(),o=f.State.calls.length;o>1e4&&(f.State.calls=function(e){for(var t=-1,o=e?e.length:0,n=[];++t<o;){var r=e[t];r&&n.push(r)}return n}(f.State.calls),o=f.State.calls.length);for(var r=0;r<o;r++)if(f.State.calls[r]){var i=f.State.calls[r],a=i[0],c=i[2],d=i[3],u=!d,p=null,g=i[5],v=i[6];if(d||(d=f.State.calls[r][3]=t-16),g){if(!0!==g.resume)continue;d=i[3]=Math.round(t-v-16),i[5]=null}v=i[6]=t-d;for(var y=Math.min(v/c.duration,1),_=0,C=a.length;_<C;_++){var k=a[_],S=k.element;if(x(S)){var T=!1;for(var E in c.display!==n&&null!==c.display&&"none"!==c.display&&("flex"===c.display&&h.each(["-webkit-box","-moz-box","-ms-flexbox","-webkit-flex"],function(e,t){b.setPropertyValue(S,"display",t)}),b.setPropertyValue(S,"display",c.display)),c.visibility!==n&&"hidden"!==c.visibility&&b.setPropertyValue(S,"visibility",c.visibility),k)if(k.hasOwnProperty(E)&&"element"!==E){var M,B=k[E],R=m.isString(B.easing)?f.Easings[B.easing]:B.easing;if(m.isString(B.pattern)){var N=1===y?function(e,t,o){var n=B.endValue[t];return o?Math.round(n):n}:function(e,t,o){var n=B.startValue[t],r=B.endValue[t]-n,i=n+r*R(y,c,r);return o?Math.round(i):i};M=B.pattern.replace(/{(\d+)(!)?}/g,N)}else if(1===y)M=B.endValue;else{var V=B.endValue-B.startValue;M=B.startValue+V*R(y,c,V)}if(!u&&M===B.currentValue)continue;if(B.currentValue=M,"tween"===E)p=M;else{var D;if(b.Hooks.registered[E]){D=b.Hooks.getRoot(E);var P=x(S).rootPropertyValueCache[D];P&&(B.rootPropertyValue=P)}var I=b.setPropertyValue(S,E,B.currentValue+(s<9&&0===parseFloat(M)?"":B.unitType),B.rootPropertyValue,B.scrollData);b.Hooks.registered[E]&&(b.Normalizations.registered[D]?x(S).rootPropertyValueCache[D]=b.Normalizations.registered[D]("extract",null,I[1]):x(S).rootPropertyValueCache[D]=I[1]),"transform"===I[0]&&(T=!0)}}c.mobileHA&&x(S).transformCache.translate3d===n&&(x(S).transformCache.translate3d="(0px, 0px, 0px)",T=!0),T&&b.flushTransformCache(S)}}c.display!==n&&"none"!==c.display&&(f.State.calls[r][2].display=!1),c.visibility!==n&&"hidden"!==c.visibility&&(f.State.calls[r][2].visibility=!1),c.progress&&c.progress.call(i[1],i[1],y,Math.max(0,d+c.duration-t),d,p),1===y&&A(r)}}f.State.isTicking&&w(O)}function A(e,t){if(!f.State.calls[e])return!1;for(var o=f.State.calls[e][0],r=f.State.calls[e][1],i=f.State.calls[e][2],s=f.State.calls[e][4],a=!1,l=0,c=o.length;l<c;l++){var d=o[l].element;t||i.loop||("none"===i.display&&b.setPropertyValue(d,"display",i.display),"hidden"===i.visibility&&b.setPropertyValue(d,"visibility",i.visibility));var u=x(d);if(!0!==i.loop&&(h.queue(d)[1]===n||!/\.velocityQueueEntryFlag/i.test(h.queue(d)[1]))&&u){u.isAnimating=!1,u.rootPropertyValueCache={};var m=!1;h.each(b.Lists.transforms3D,function(e,t){var o=/^scale/.test(t)?1:0,r=u.transformCache[t];u.transformCache[t]!==n&&new RegExp("^\\("+o+"[^.]").test(r)&&(m=!0,delete u.transformCache[t])}),i.mobileHA&&(m=!0,delete u.transformCache.translate3d),m&&b.flushTransformCache(d),b.Values.removeClass(d,"velocity-animating")}if(!t&&i.complete&&!i.loop&&l===c-1)try{i.complete.call(r,r)}catch(e){setTimeout(function(){throw e},1)}s&&!0!==i.loop&&s(r),u&&!0===i.loop&&!t&&(h.each(u.tweensContainer,function(e,t){if(/^rotate/.test(e)&&(parseFloat(t.startValue)-parseFloat(t.endValue))%360==0){var o=t.startValue;t.startValue=t.endValue,t.endValue=o}/^backgroundPosition/.test(e)&&100===parseFloat(t.endValue)&&"%"===t.unitType&&(t.endValue=0,t.startValue=100)}),f(d,"reverse",{loop:!0,delay:i.delay})),!1!==i.queue&&h.dequeue(d,i.queue)}f.State.calls[e]=!1;for(var p=0,g=f.State.calls.length;p<g;p++)if(!1!==f.State.calls[p]){a=!0;break}!1===a&&(f.State.isTicking=!1,delete f.State.calls,f.State.calls=[])}i().fn.velocity=i().fn.animate}(window.jQuery||window.Zepto||window,window,window?window.document:void 0)},"object"==typeof e.exports?e.exports=n():"function"==typeof define&&o.amdO?define(n):n()},20436(e,t){!function(o){"use strict";if(o){var n,r,i,s=(i=o.document.createTextNode("")).ownerDocument!==o.document&&"function"==typeof o.wrap&&o.wrap(i)===i?o.wrap(o):o,a=s.document,l=s.DocumentFragment||W,c=s.SVGElement||W,d=s.SVGSVGElement||W,u=s.SVGElementInstance||W,h=s.HTMLElement||s.Element,m=s.PointerEvent||s.MSPointerEvent,p=Math.hypot||function(e,t){return Math.sqrt(e*e+t*t)},g={},f=[],v=[],b=[],y=!1,w={},_={base:{accept:null,actionChecker:null,styleCursor:!0,preventDefault:"auto",origin:{x:0,y:0},deltaSource:"page",allowFrom:null,ignoreFrom:null,_context:a,dropChecker:null},drag:{enabled:!1,manualStart:!0,max:1/0,maxPerElement:1,snap:null,restrict:null,inertia:null,autoScroll:null,axis:"xy"},drop:{enabled:!1,accept:null,overlap:"pointer"},resize:{enabled:!1,manualStart:!1,max:1/0,maxPerElement:1,snap:null,restrict:null,inertia:null,autoScroll:null,square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},gesture:{manualStart:!1,enabled:!1,max:1/0,maxPerElement:1,restrict:null},perAction:{manualStart:!1,max:1/0,maxPerElement:1,snap:{enabled:!1,endOnly:!1,range:1/0,targets:null,offsets:null,relativePoints:null},restrict:{enabled:!1,endOnly:!1},autoScroll:{enabled:!1,container:null,margin:60,speed:300},inertia:{enabled:!1,resistance:10,minSpeed:100,endSpeed:10,allowResume:!0,zeroResumeDelta:!0,smoothEndDuration:300}},_holdDuration:600},x={interaction:null,i:null,x:0,y:0,scroll:function(){var e,t,o,n,r=x.interaction.target.options[x.interaction.prepared.name].autoScroll,i=r.container||me(x.interaction.element),s=(new Date).getTime(),a=(s-x.prevTimeX)/1e3,l=(s-x.prevTimeY)/1e3;r.velocity?(e=r.velocity.x,t=r.velocity.y):e=t=r.speed,n=t*l,((o=e*a)>=1||n>=1)&&(G(i)?i.scrollBy(x.x*o,x.y*n):i&&(i.scrollLeft+=x.x*o,i.scrollTop+=x.y*n),o>=1&&(x.prevTimeX=s),n>=1&&(x.prevTimeY=s)),x.isScrolling&&(L(x.i),x.i=I(x.scroll))},isScrolling:!1,prevTimeX:0,prevTimeY:0,start:function(e){x.isScrolling=!0,L(x.i),x.interaction=e,x.prevTimeX=(new Date).getTime(),x.prevTimeY=(new Date).getTime(),x.i=I(x.scroll)},stop:function(){x.isScrolling=!1,L(x.i)}},C="ontouchstart"in s||s.DocumentTouch&&a instanceof s.DocumentTouch,k=m&&!/Chrome/.test(navigator.userAgent),S=C||k?20:10,T=1,E=0,O=1/0,A=a.all&&!s.atob?{drag:"move",resizex:"e-resize",resizey:"s-resize",resizexy:"se-resize",resizetop:"n-resize",resizeleft:"w-resize",resizebottom:"s-resize",resizeright:"e-resize",resizetopleft:"se-resize",resizebottomright:"se-resize",resizetopright:"ne-resize",resizebottomleft:"ne-resize",gesture:""}:{drag:"move",resizex:"ew-resize",resizey:"ns-resize",resizexy:"nwse-resize",resizetop:"ns-resize",resizeleft:"ew-resize",resizebottom:"ns-resize",resizeright:"ew-resize",resizetopleft:"nwse-resize",resizebottomright:"nwse-resize",resizetopright:"nesw-resize",resizebottomleft:"nesw-resize",gesture:""},M={drag:!0,resize:!0,gesture:!0},B="onmousewheel"in a?"mousewheel":"wheel",R=["dragstart","dragmove","draginertiastart","dragend","dragenter","dragleave","dropactivate","dropdeactivate","dropmove","drop","resizestart","resizemove","resizeinertiastart","resizeend","gesturestart","gesturemove","gestureinertiastart","gestureend","down","move","up","cancel","tap","doubletap","hold"],N={},V="Opera"==navigator.appName&&C&&navigator.userAgent.match("Presto"),D=/iP(hone|od|ad)/.test(navigator.platform)&&/OS 7[^\d]/.test(navigator.appVersion),P="matches"in Element.prototype?"matches":"webkitMatchesSelector"in Element.prototype?"webkitMatchesSelector":"mozMatchesSelector"in Element.prototype?"mozMatchesSelector":"oMatchesSelector"in Element.prototype?"oMatchesSelector":"msMatchesSelector",I=o.requestAnimationFrame,L=o.cancelAnimationFrame,F=function(){var e="attachEvent"in s&&!("addEventListener"in s),t=e?"attachEvent":"addEventListener",o=e?"detachEvent":"removeEventListener",n=e?"on":"",r=[],i=[],a=[];function l(){this.returnValue=!1}function c(){this.cancelBubble=!0}function d(){this.cancelBubble=!0,this.immediatePropagationStopped=!0}return{add:function(o,s,u,h){var m=Xe(r,o),p=i[m];if(p||(p={events:{},typeCount:0},m=r.push(o)-1,i.push(p),a.push(e?{supplied:[],wrapped:[],useCount:[]}:null)),p.events[s]||(p.events[s]=[],p.typeCount++),!Ke(p.events[s],u)){var g;if(e){var f=a[m],v=Xe(f.supplied,u),b=f.wrapped[v]||function(e){e.immediatePropagationStopped||(e.target=e.srcElement,e.currentTarget=o,e.preventDefault=e.preventDefault||l,e.stopPropagation=e.stopPropagation||c,e.stopImmediatePropagation=e.stopImmediatePropagation||d,/mouse|click/.test(e.type)&&(e.pageX=e.clientX+me(o).document.documentElement.scrollLeft,e.pageY=e.clientY+me(o).document.documentElement.scrollTop),u(e))};g=o[t](n+s,b,Boolean(h)),-1===v?(f.supplied.push(u),f.wrapped.push(b),f.useCount.push(1)):f.useCount[v]++}else g=o[t](s,u,h||!1);return p.events[s].push(u),g}},remove:function t(s,l,c,d){var u,h,m,p=Xe(r,s),g=i[p],f=c;if(g&&g.events)if(e&&(m=Xe((h=a[p]).supplied,c),f=h.wrapped[m]),"all"!==l){if(g.events[l]){var v=g.events[l].length;if("all"===c){for(u=0;u<v;u++)t(s,l,g.events[l][u],Boolean(d));return}for(u=0;u<v;u++)if(g.events[l][u]===c){s[o](n+l,f,d||!1),g.events[l].splice(u,1),e&&h&&(h.useCount[m]--,0===h.useCount[m]&&(h.supplied.splice(m,1),h.wrapped.splice(m,1),h.useCount.splice(m,1)));break}g.events[l]&&0===g.events[l].length&&(g.events[l]=null,g.typeCount--)}g.typeCount||(i.splice(p,1),r.splice(p,1),a.splice(p,1))}else for(l in g.events)g.events.hasOwnProperty(l)&&t(s,l,"all")},useAttachEvent:e,_elements:r,_targets:i,_attachedListeners:a}}(),z={webkit:/(Movement[XY]|Radius[XY]|RotationAngle|Force)$/};Ve.prototype={getPageXY:function(e,t){return ce(e,t)},getClientXY:function(e,t){return de(e,t)},setEventXY:function(e,t){return o=e,ce(r=(n=t).length>1?ve(n):n[0],g),o.page.x=g.x,o.page.y=g.y,de(r,g),o.client.x=g.x,o.client.y=g.y,void(o.timeStamp=(new Date).getTime());var o,n,r},pointerOver:function(e,t,o){if(!this.prepared.name&&this.mouse){var r=[],i=[],s=this.element;this.addPointer(e),!this.target||!Oe(this.target,this.element,o)&&Ae(this.target,this.element,o)||(this.target=null,this.element=null,this.matches=[],this.matchElements=[]);var a=v.get(o),l=a&&!Oe(a,o,o)&&Ae(a,o,o)&&Ue(a.getAction(e,t,this,o),a);l&&!Ne(a,o,l)&&(l=null),l?(this.target=a,this.element=o,this.matches=[],this.matchElements=[]):(v.forEachSelector(function(e,t){e&&Ee(e,o)&&!Oe(e,o,o)&&Ae(e,o,o)&&Je(o,t)&&(r.push(e),i.push(o))}),this.validateSelector(e,t,r,i)?(this.matches=r,this.matchElements=i,this.pointerHover(e,t,this.matches,this.matchElements),F.add(o,k?n.move:"mousemove",H.pointerHover)):this.target&&(ke(s,o)?(this.pointerHover(e,t,this.matches,this.matchElements),F.add(this.element,k?n.move:"mousemove",H.pointerHover)):(this.target=null,this.element=null,this.matches=[],this.matchElements=[])))}},pointerHover:function(e,t,o,n,r,i){var s,a=this.target;!this.prepared.name&&this.mouse?(this.setEventXY(this.curCoords,[e]),r?s=this.validateSelector(e,t,r,i):a&&(s=Ue(a.getAction(this.pointers[0],t,this,this.element),this.target)),a&&a.options.styleCursor&&(a._doc.documentElement.style.cursor=s?Fe(s):"")):this.prepared.name&&this.checkAndPreventDefault(t,a,this.element)},pointerOut:function(e,t,o){this.prepared.name||(v.get(o)||F.remove(o,k?n.move:"mousemove",H.pointerHover),this.target&&this.target.options.styleCursor&&!this.interacting()&&(this.target._doc.documentElement.style.cursor=""))},selectorDown:function(e,t,o,n){var i,s=this,a=F.useAttachEvent?ne({},t):t,l=o,c=this.addPointer(e);if(this.holdTimers[c]=setTimeout(function(){s.pointerHold(F.useAttachEvent?a:e,a,o,n)},_._holdDuration),this.pointerIsDown=!0,this.inertiaStatus.active&&this.target.selector)for(;q(l);){if(l===this.element&&Ue(this.target.getAction(e,t,this,this.element),this.target).name===this.prepared.name)return L(this.inertiaStatus.i),this.inertiaStatus.active=!1,void this.collectEventTargets(e,t,o,"down");l=Te(l)}if(this.interacting())this.collectEventTargets(e,t,o,"down");else{for(this.setEventXY(this.curCoords,[e]),this.downEvent=t;q(l)&&!i;)this.matches=[],this.matchElements=[],v.forEachSelector(d),i=this.validateSelector(e,t,this.matches,this.matchElements),l=Te(l);if(i)return this.prepared.name=i.name,this.prepared.axis=i.axis,this.prepared.edges=i.edges,this.collectEventTargets(e,t,o,"down"),this.pointerDown(e,t,o,n,i);this.downTimes[c]=(new Date).getTime(),this.downTargets[c]=o,re(this.downPointer,e),ie(this.prevCoords,this.curCoords),this.pointerWasMoved=!1,this.collectEventTargets(e,t,o,"down")}function d(e,t,n){var i=r?n.querySelectorAll(t):void 0;Ee(e,l)&&!Oe(e,l,o)&&Ae(e,l,o)&&Je(l,t,i)&&(s.matches.push(e),s.matchElements.push(l))}},pointerDown:function(e,t,o,n,r){if(r||this.inertiaStatus.active||!this.pointerWasMoved||!this.prepared.name){this.pointerIsDown=!0,this.downEvent=t;var i,s=this.addPointer(e);if(this.pointerIds.length>1&&this.target._element===this.element){var a=Ue(r||this.target.getAction(e,t,this,this.element),this.target);Ne(this.target,this.element,a)&&(i=a),this.prepared.name=null}else if(!this.prepared.name){var l=v.get(n);l&&!Oe(l,n,o)&&Ae(l,n,o)&&(i=Ue(r||l.getAction(e,t,this,n),l))&&Ne(l,n,i)&&(this.target=l,this.element=n)}var c=this.target,d=c&&c.options;if(!c||!r&&this.prepared.name)this.inertiaStatus.active&&n===this.element&&Ue(c.getAction(e,t,this,this.element),c).name===this.prepared.name&&(L(this.inertiaStatus.i),this.inertiaStatus.active=!1,this.checkAndPreventDefault(t,c,this.element));else{if(i=i||Ue(r||c.getAction(e,t,this,n),c,this.element),this.setEventXY(this.startCoords,this.pointers),!i)return;d.styleCursor&&(c._doc.documentElement.style.cursor=Fe(i)),this.resizeAxes="resize"===i.name?i.axis:null,"gesture"===i&&this.pointerIds.length<2&&(i=null),this.prepared.name=i.name,this.prepared.axis=i.axis,this.prepared.edges=i.edges,this.snapStatus.snappedX=this.snapStatus.snappedY=this.restrictStatus.restrictedX=this.restrictStatus.restrictedY=NaN,this.downTimes[s]=(new Date).getTime(),this.downTargets[s]=o,re(this.downPointer,e),ie(this.prevCoords,this.startCoords),this.pointerWasMoved=!1,this.checkAndPreventDefault(t,c,this.element)}}else this.checkAndPreventDefault(t,this.target,this.element)},setModifications:function(e,t){var o=this.target,n=!0,r=Be(o,this.prepared.name)&&(!o.options[this.prepared.name].snap.endOnly||t),i=Re(o,this.prepared.name)&&(!o.options[this.prepared.name].restrict.endOnly||t);return r?this.setSnapping(e):this.snapStatus.locked=!1,i?this.setRestriction(e):this.restrictStatus.restricted=!1,r&&this.snapStatus.locked&&!this.snapStatus.changed?n=i&&this.restrictStatus.restricted&&this.restrictStatus.changed:i&&this.restrictStatus.restricted&&!this.restrictStatus.changed&&(n=!1),n},setStartOffsets:function(e,t,o){var n,r,i=t.getRect(o),s=_e(t,o),a=t.options[this.prepared.name].snap,l=t.options[this.prepared.name].restrict;i?(this.startOffset.left=this.startCoords.page.x-i.left,this.startOffset.top=this.startCoords.page.y-i.top,this.startOffset.right=i.right-this.startCoords.page.x,this.startOffset.bottom=i.bottom-this.startCoords.page.y,n="width"in i?i.width:i.right-i.left,r="height"in i?i.height:i.bottom-i.top):this.startOffset.left=this.startOffset.top=this.startOffset.right=this.startOffset.bottom=0,this.snapOffsets.splice(0);var c=a&&"startCoords"===a.offset?{x:this.startCoords.page.x-s.x,y:this.startCoords.page.y-s.y}:a&&a.offset||{x:0,y:0};if(i&&a&&a.relativePoints&&a.relativePoints.length)for(var d=0;d<a.relativePoints.length;d++)this.snapOffsets.push({x:this.startOffset.left-n*a.relativePoints[d].x+c.x,y:this.startOffset.top-r*a.relativePoints[d].y+c.y});else this.snapOffsets.push(c);i&&l.elementRect?(this.restrictOffset.left=this.startOffset.left-n*l.elementRect.left,this.restrictOffset.top=this.startOffset.top-r*l.elementRect.top,this.restrictOffset.right=this.startOffset.right-n*(1-l.elementRect.right),this.restrictOffset.bottom=this.startOffset.bottom-r*(1-l.elementRect.bottom)):this.restrictOffset.left=this.restrictOffset.top=this.restrictOffset.right=this.restrictOffset.bottom=0},start:function(e,t,o){this.interacting()||!this.pointerIsDown||this.pointerIds.length<("gesture"===e.name?2:1)||(-1===Xe(b,this)&&b.push(this),this.prepared.name||this.setEventXY(this.startCoords,this.pointers),this.prepared.name=e.name,this.prepared.axis=e.axis,this.prepared.edges=e.edges,this.target=t,this.element=o,this.setStartOffsets(e.name,t,o),this.setModifications(this.startCoords.page),this.prevEvent=this[this.prepared.name+"Start"](this.downEvent))},pointerMove:function(e,t,o,n,i){if(this.inertiaStatus.active){var s=this.inertiaStatus.upCoords.page,a=this.inertiaStatus.upCoords.client,l={pageX:s.x+this.inertiaStatus.sx,pageY:s.y+this.inertiaStatus.sy,clientX:a.x+this.inertiaStatus.sx,clientY:a.y+this.inertiaStatus.sy};this.setEventXY(this.curCoords,[l])}else this.recordPointer(e),this.setEventXY(this.curCoords,this.pointers);var c,d,u=this.curCoords.page.x===this.prevCoords.page.x&&this.curCoords.page.y===this.prevCoords.page.y&&this.curCoords.client.x===this.prevCoords.client.x&&this.curCoords.client.y===this.prevCoords.client.y,h=this.mouse?0:Xe(this.pointerIds,ue(e));if(this.pointerIsDown&&!this.pointerWasMoved&&(c=this.curCoords.client.x-this.startCoords.client.x,d=this.curCoords.client.y-this.startCoords.client.y,this.pointerWasMoved=p(c,d)>T),u||this.pointerIsDown&&!this.pointerWasMoved||(this.pointerIsDown&&clearTimeout(this.holdTimers[h]),this.collectEventTargets(e,t,o,"move")),this.pointerIsDown)if(u&&this.pointerWasMoved&&!i)this.checkAndPreventDefault(t,this.target,this.element);else if(se(this.pointerDelta,this.prevCoords,this.curCoords),this.prepared.name){if(this.pointerWasMoved&&(!this.inertiaStatus.active||e instanceof Ie&&/inertiastart/.test(e.type))){if(!this.interacting()&&(se(this.pointerDelta,this.prevCoords,this.curCoords),"drag"===this.prepared.name)){var m=Math.abs(c),g=Math.abs(d),f=this.target.options.drag.axis,b=m>g?"x":m<g?"y":"xy";if("xy"!==b&&"xy"!==f&&f!==b){this.prepared.name=null;for(var y=o;q(y);){var w=v.get(y);if(w&&w!==this.target&&!w.options.drag.manualStart&&"drag"===w.getAction(this.downPointer,this.downEvent,this,y).name&&Me(b,w)){this.prepared.name="drag",this.target=w,this.element=y;break}y=Te(y)}if(!this.prepared.name){var _=this,x=function(e,t,n){var i=r?n.querySelectorAll(t):void 0;if(e!==_.target)return Ee(e,o)&&!e.options.drag.manualStart&&!Oe(e,y,o)&&Ae(e,y,o)&&Je(y,t,i)&&"drag"===e.getAction(_.downPointer,_.downEvent,_,y).name&&Me(b,e)&&Ne(e,y,"drag")?e:void 0};for(y=o;q(y);){var C=v.forEachSelector(x);if(C){this.prepared.name="drag",this.target=C,this.element=y;break}y=Te(y)}}}}var k=!!this.prepared.name&&!this.interacting();if(k&&(this.target.options[this.prepared.name].manualStart||!Ne(this.target,this.element,this.prepared)))return void this.stop(t);this.prepared.name&&this.target&&(k&&this.start(this.prepared,this.target,this.element),(this.setModifications(this.curCoords.page,i)||k)&&(this.prevEvent=this[this.prepared.name+"Move"](t)),this.checkAndPreventDefault(t,this.target,this.element))}ie(this.prevCoords,this.curCoords),(this.dragging||this.resizing)&&this.autoScrollMove(e)}},dragStart:function(e){var t=new Ie(this,e,"drag","start",this.element);this.dragging=!0,this.target.fire(t),this.activeDrops.dropzones=[],this.activeDrops.elements=[],this.activeDrops.rects=[],this.dynamicDrop||this.setActiveDrops(this.element);var o=this.getDropEvents(e,t);return o.activate&&this.fireActiveDrops(o.activate),t},dragMove:function(e){var t=this.target,o=new Ie(this,e,"drag","move",this.element),n=this.element,r=this.getDrop(o,e,n);this.dropTarget=r.dropzone,this.dropElement=r.element;var i=this.getDropEvents(e,o);return t.fire(o),i.leave&&this.prevDropTarget.fire(i.leave),i.enter&&this.dropTarget.fire(i.enter),i.move&&this.dropTarget.fire(i.move),this.prevDropTarget=this.dropTarget,this.prevDropElement=this.dropElement,o},resizeStart:function(e){var t=new Ie(this,e,"resize","start",this.element);if(this.prepared.edges){var o=this.target.getRect(this.element);if(this.target.options.resize.square||this.target.options.resize.preserveAspectRatio){var n=ne({},this.prepared.edges);n.top=n.top||n.left&&!n.bottom,n.left=n.left||n.top&&!n.right,n.bottom=n.bottom||n.right&&!n.top,n.right=n.right||n.bottom&&!n.left,this.prepared._linkedEdges=n}else this.prepared._linkedEdges=null;this.target.options.resize.preserveAspectRatio&&(this.resizeStartAspectRatio=o.width/o.height),this.resizeRects={start:o,current:ne({},o),restricted:ne({},o),previous:ne({},o),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},t.rect=this.resizeRects.restricted,t.deltaRect=this.resizeRects.delta}return this.target.fire(t),this.resizing=!0,t},resizeMove:function(e){var t=new Ie(this,e,"resize","move",this.element),o=this.prepared.edges,n=this.target.options.resize.invert,r="reposition"===n||"negate"===n;if(o){var i,s=t.dx,a=t.dy,l=this.resizeRects.start,c=this.resizeRects.current,d=this.resizeRects.restricted,u=this.resizeRects.delta,h=ne(this.resizeRects.previous,d),m=o;if(this.target.options.resize.preserveAspectRatio){var p=this.resizeStartAspectRatio;o=this.prepared._linkedEdges,m.left&&m.bottom||m.right&&m.top?a=-s/p:m.left||m.right?a=s/p:(m.top||m.bottom)&&(s=a*p)}else this.target.options.resize.square&&(o=this.prepared._linkedEdges,m.left&&m.bottom||m.right&&m.top?a=-s:m.left||m.right?a=s:(m.top||m.bottom)&&(s=a));for(var g in o.top&&(c.top+=a),o.bottom&&(c.bottom+=a),o.left&&(c.left+=s),o.right&&(c.right+=s),r?(ne(d,c),"reposition"===n&&(d.top>d.bottom&&(i=d.top,d.top=d.bottom,d.bottom=i),d.left>d.right&&(i=d.left,d.left=d.right,d.right=i))):(d.top=Math.min(c.top,l.bottom),d.bottom=Math.max(c.bottom,l.top),d.left=Math.min(c.left,l.right),d.right=Math.max(c.right,l.left)),d.width=d.right-d.left,d.height=d.bottom-d.top,d)u[g]=d[g]-h[g];t.edges=this.prepared.edges,t.rect=d,t.deltaRect=u}return this.target.fire(t),t},gestureStart:function(e){var t=new Ie(this,e,"gesture","start",this.element);return t.ds=0,this.gesture.startDistance=this.gesture.prevDistance=t.distance,this.gesture.startAngle=this.gesture.prevAngle=t.angle,this.gesture.scale=1,this.gesturing=!0,this.target.fire(t),t},gestureMove:function(e){return this.pointerIds.length?((t=new Ie(this,e,"gesture","move",this.element)).ds=t.scale-this.gesture.scale,this.target.fire(t),this.gesture.prevAngle=t.angle,this.gesture.prevDistance=t.distance,t.scale===1/0||null===t.scale||void 0===t.scale||isNaN(t.scale)||(this.gesture.scale=t.scale),t):this.prevEvent;var t},pointerHold:function(e,t,o){this.collectEventTargets(e,t,o,"hold")},pointerUp:function(e,t,o,n){var r=this.mouse?0:Xe(this.pointerIds,ue(e));clearTimeout(this.holdTimers[r]),this.collectEventTargets(e,t,o,"up"),this.collectEventTargets(e,t,o,"tap"),this.pointerEnd(e,t,o,n),this.removePointer(e)},pointerCancel:function(e,t,o,n){var r=this.mouse?0:Xe(this.pointerIds,ue(e));clearTimeout(this.holdTimers[r]),this.collectEventTargets(e,t,o,"cancel"),this.pointerEnd(e,t,o,n),this.removePointer(e)},ie8Dblclick:function(e,t,o){this.prevTap&&t.clientX===this.prevTap.clientX&&t.clientY===this.prevTap.clientY&&o===this.prevTap.target&&(this.downTargets[0]=o,this.downTimes[0]=(new Date).getTime(),this.collectEventTargets(e,t,o,"tap"))},pointerEnd:function(e,t,o,n){var r,i=this.target,s=i&&i.options,a=s&&this.prepared.name&&s[this.prepared.name].inertia,l=this.inertiaStatus;if(this.interacting()){if(l.active&&!l.ending)return;var c,d,u,h=(new Date).getTime(),m=!1,p=Be(i,this.prepared.name)&&s[this.prepared.name].snap.endOnly,g=Re(i,this.prepared.name)&&s[this.prepared.name].restrict.endOnly,f=0,v=0;if(c=this.dragging?"x"===s.drag.axis?Math.abs(this.pointerDelta.client.vx):"y"===s.drag.axis?Math.abs(this.pointerDelta.client.vy):this.pointerDelta.client.speed:this.pointerDelta.client.speed,u=(d=a&&a.enabled&&"gesture"!==this.prepared.name&&t!==l.startEvent)&&h-this.curCoords.timeStamp<50&&c>a.minSpeed&&c>a.endSpeed,d&&!u&&(p||g)){var b={};b.snap=b.restrict=b,p&&(this.setSnapping(this.curCoords.page,b),b.locked&&(f+=b.dx,v+=b.dy)),g&&(this.setRestriction(this.curCoords.page,b),b.restricted&&(f+=b.dx,v+=b.dy)),(f||v)&&(m=!0)}if(u||m){if(ie(l.upCoords,this.curCoords),this.pointers[0]=l.startEvent=new Ie(this,t,this.prepared.name,"inertiastart",this.element),l.t0=h,i.fire(l.startEvent),u){l.vx0=this.pointerDelta.client.vx,l.vy0=this.pointerDelta.client.vy,l.v0=c,this.calcInertia(l);var y,w=ne({},this.curCoords.page),_=_e(i,this.element);if(w.x=w.x+l.xe-_.x,w.y=w.y+l.ye-_.y,(y={useStatusXY:!0,x:w.x,y:w.y,dx:0,dy:0,snap:null}).snap=y,f=v=0,p){var x=this.setSnapping(this.curCoords.page,y);x.locked&&(f+=x.dx,v+=x.dy)}if(g){var C=this.setRestriction(this.curCoords.page,y);C.restricted&&(f+=C.dx,v+=C.dy)}l.modifiedXe+=f,l.modifiedYe+=v,l.i=I(this.boundInertiaFrame)}else l.smoothEnd=!0,l.xe=f,l.ye=v,l.sx=l.sy=0,l.i=I(this.boundSmoothEndFrame);return void(l.active=!0)}(p||g)&&this.pointerMove(e,t,o,n,!0)}if(this.dragging){r=new Ie(this,t,"drag","end",this.element);var k=this.element,S=this.getDrop(r,t,k);this.dropTarget=S.dropzone,this.dropElement=S.element;var T=this.getDropEvents(t,r);T.leave&&this.prevDropTarget.fire(T.leave),T.enter&&this.dropTarget.fire(T.enter),T.drop&&this.dropTarget.fire(T.drop),T.deactivate&&this.fireActiveDrops(T.deactivate),i.fire(r)}else this.resizing?(r=new Ie(this,t,"resize","end",this.element),i.fire(r)):this.gesturing&&(r=new Ie(this,t,"gesture","end",this.element),i.fire(r));this.stop(t)},collectDrops:function(e){var t,o=[],n=[];for(e=e||this.element,t=0;t<v.length;t++)if(v[t].options.drop.enabled){var r=v[t],i=r.options.drop.accept;if(!(q(i)&&i!==e||te(i)&&!Je(e,i)))for(var s=r.selector?r._context.querySelectorAll(r.selector):[r._element],a=0,l=s.length;a<l;a++){var c=s[a];c!==e&&(o.push(r),n.push(c))}}return{dropzones:o,elements:n}},fireActiveDrops:function(e){var t,o,n,r;for(t=0;t<this.activeDrops.dropzones.length;t++)o=this.activeDrops.dropzones[t],(n=this.activeDrops.elements[t])!==r&&(e.target=n,o.fire(e)),r=n},setActiveDrops:function(e){var t=this.collectDrops(e,!0);this.activeDrops.dropzones=t.dropzones,this.activeDrops.elements=t.elements,this.activeDrops.rects=[];for(var o=0;o<this.activeDrops.dropzones.length;o++)this.activeDrops.rects[o]=this.activeDrops.dropzones[o].getRect(this.activeDrops.elements[o])},getDrop:function(e,t,o){var n=[];y&&this.setActiveDrops(o);for(var r=0;r<this.activeDrops.dropzones.length;r++){var i=this.activeDrops.dropzones[r],s=this.activeDrops.elements[r],a=this.activeDrops.rects[r];n.push(i.dropCheck(e,t,this.target,o,s,a)?s:null)}var l=function(e){var t,o,n,r,i,s=e[0],a=s?0:-1,l=[],u=[];for(r=1;r<e.length;r++)if((t=e[r])&&t!==s)if(s){if(t.parentNode!==t.ownerDocument)if(s.parentNode!==t.ownerDocument){if(!l.length)for(o=s;o.parentNode&&o.parentNode!==o.ownerDocument;)l.unshift(o),o=o.parentNode;if(s instanceof h&&t instanceof c&&!(t instanceof d)){if(t===s.parentNode)continue;o=t.ownerSVGElement}else o=t;for(u=[];o.parentNode!==o.ownerDocument;)u.unshift(o),o=o.parentNode;for(i=0;u[i]&&u[i]===l[i];)i++;var m=[u[i-1],u[i],l[i]];for(n=m[0].lastChild;n;){if(n===m[1]){s=t,a=r,l=[];break}if(n===m[2])break;n=n.previousSibling}}else s=t,a=r}else s=t,a=r;return a}(n);return{dropzone:this.activeDrops.dropzones[l]||null,element:this.activeDrops.elements[l]||null}},getDropEvents:function(e,t){var o={enter:null,leave:null,activate:null,deactivate:null,move:null,drop:null};return this.dropElement!==this.prevDropElement&&(this.prevDropTarget&&(o.leave={target:this.prevDropElement,dropzone:this.prevDropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dragleave"},t.dragLeave=this.prevDropElement,t.prevDropzone=this.prevDropTarget),this.dropTarget&&(o.enter={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dragenter"},t.dragEnter=this.dropElement,t.dropzone=this.dropTarget)),"dragend"===t.type&&this.dropTarget&&(o.drop={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"drop"},t.dropzone=this.dropTarget),"dragstart"===t.type&&(o.activate={target:null,dropzone:null,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dropactivate"}),"dragend"===t.type&&(o.deactivate={target:null,dropzone:null,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,timeStamp:t.timeStamp,type:"dropdeactivate"}),"dragmove"===t.type&&this.dropTarget&&(o.move={target:this.dropElement,dropzone:this.dropTarget,relatedTarget:t.target,draggable:t.interactable,dragEvent:t,interaction:this,dragmove:t,timeStamp:t.timeStamp,type:"dropmove"},t.dropzone=this.dropTarget),o},currentAction:function(){return(this.dragging?"drag":this.resizing&&"resize")||this.gesturing&&"gesture"||null},interacting:function(){return this.dragging||this.resizing||this.gesturing},clearTargets:function(){this.target=this.element=null,this.dropTarget=this.dropElement=this.prevDropTarget=this.prevDropElement=null},stop:function(e){if(this.interacting()){x.stop(),this.matches=[],this.matchElements=[];var t=this.target;t.options.styleCursor&&(t._doc.documentElement.style.cursor=""),e&&J(e.preventDefault)&&this.checkAndPreventDefault(e,t,this.element),this.dragging&&(this.activeDrops.dropzones=this.activeDrops.elements=this.activeDrops.rects=null)}this.clearTargets(),this.pointerIsDown=this.snapStatus.locked=this.dragging=this.resizing=this.gesturing=!1,this.prepared.name=this.prevEvent=null,this.inertiaStatus.resumeDx=this.inertiaStatus.resumeDy=0;for(var o=0;o<this.pointers.length;o++)-1===Xe(this.pointerIds,ue(this.pointers[o]))&&this.pointers.splice(o,1)},inertiaFrame:function(){var e,t,o,n,r,i=this.inertiaStatus,s=this.target.options[this.prepared.name].inertia.resistance,a=(new Date).getTime()/1e3-i.t0;if(a<i.te){var l=1-(Math.exp(-s*a)-i.lambda_v0)/i.one_ve_v0;if(i.modifiedXe===i.xe&&i.modifiedYe===i.ye)i.sx=i.xe*l,i.sy=i.ye*l;else{var c=(e=i.xe,t=i.ye,o=i.modifiedXe,n=i.modifiedYe,{x:xe(r=l,0,e,o),y:xe(r,0,t,n)});i.sx=c.x,i.sy=c.y}this.pointerMove(i.startEvent,i.startEvent),i.i=I(this.boundInertiaFrame)}else i.ending=!0,i.sx=i.modifiedXe,i.sy=i.modifiedYe,this.pointerMove(i.startEvent,i.startEvent),this.pointerEnd(i.startEvent,i.startEvent),i.active=i.ending=!1},smoothEndFrame:function(){var e=this.inertiaStatus,t=(new Date).getTime()-e.t0,o=this.target.options[this.prepared.name].inertia.smoothEndDuration;t<o?(e.sx=Ce(t,0,e.xe,o),e.sy=Ce(t,0,e.ye,o),this.pointerMove(e.startEvent,e.startEvent),e.i=I(this.boundSmoothEndFrame)):(e.ending=!0,e.sx=e.xe,e.sy=e.ye,this.pointerMove(e.startEvent,e.startEvent),this.pointerEnd(e.startEvent,e.startEvent),e.smoothEnd=e.active=e.ending=!1)},addPointer:function(e){var t=ue(e),o=this.mouse?0:Xe(this.pointerIds,t);return-1===o&&(o=this.pointerIds.length),this.pointerIds[o]=t,this.pointers[o]=e,o},removePointer:function(e){var t=ue(e),o=this.mouse?0:Xe(this.pointerIds,t);-1!==o&&(this.pointers.splice(o,1),this.pointerIds.splice(o,1),this.downTargets.splice(o,1),this.downTimes.splice(o,1),this.holdTimers.splice(o,1))},recordPointer:function(e){var t=this.mouse?0:Xe(this.pointerIds,ue(e));-1!==t&&(this.pointers[t]=e)},collectEventTargets:function(e,t,o,n){var i=this.mouse?0:Xe(this.pointerIds,ue(e));if("tap"!==n||!this.pointerWasMoved&&this.downTargets[i]&&this.downTargets[i]===o){for(var s=[],a=[],l=o;l;)je.isSet(l)&&je(l)._iEvents[n]&&(s.push(je(l)),a.push(l)),v.forEachSelector(c),l=Te(l);(s.length||"tap"===n)&&this.firePointers(e,t,o,s,a,n)}function c(e,t,i){var c=r?i.querySelectorAll(t):void 0;e._iEvents[n]&&q(l)&&Ee(e,l)&&!Oe(e,l,o)&&Ae(e,l,o)&&Je(l,t,c)&&(s.push(e),a.push(l))}},firePointers:function(e,t,o,n,r,i){var s,a,l,c=this.mouse?0:Xe(this.pointerIds,ue(e)),d={};for("doubletap"===i?d=e:(re(d,t),t!==e&&re(d,e),d.preventDefault=Le,d.stopPropagation=Ie.prototype.stopPropagation,d.stopImmediatePropagation=Ie.prototype.stopImmediatePropagation,d.interaction=this,d.timeStamp=(new Date).getTime(),d.originalEvent=t,d.originalPointer=e,d.type=i,d.pointerId=ue(e),d.pointerType=this.mouse?"mouse":k?te(e.pointerType)?e.pointerType:[,,"touch","pen","mouse"][e.pointerType]:"touch"),"tap"===i&&(d.dt=d.timeStamp-this.downTimes[c],a=d.timeStamp-this.tapTime,l=!!(this.prevTap&&"doubletap"!==this.prevTap.type&&this.prevTap.target===d.target&&a<500),d.double=l,this.tapTime=d.timeStamp),s=0;s<n.length&&(d.currentTarget=r[s],d.interactable=n[s],n[s].fire(d),!(d.immediatePropagationStopped||d.propagationStopped&&r[s+1]!==d.currentTarget));s++);if(l){var u={};ne(u,d),u.dt=a,u.type="doubletap",this.collectEventTargets(u,t,o,"doubletap"),this.prevTap=u}else"tap"===i&&(this.prevTap=d)},validateSelector:function(e,t,o,n){for(var r=0,i=o.length;r<i;r++){var s=o[r],a=n[r],l=Ue(s.getAction(e,t,this,a),s);if(l&&Ne(s,a,l))return this.target=s,this.element=a,l}},setSnapping:function(e,t){var o,n,r,i=this.target.options[this.prepared.name].snap,s=[];if((t=t||this.snapStatus).useStatusXY)n={x:t.x,y:t.y};else{var a=_e(this.target,this.element);(n=ne({},e)).x-=a.x,n.y-=a.y}t.realX=n.x,t.realY=n.y,n.x=n.x-this.inertiaStatus.resumeDx,n.y=n.y-this.inertiaStatus.resumeDy;for(var l=i.targets?i.targets.length:0,c=0;c<this.snapOffsets.length;c++){var d={x:n.x-this.snapOffsets[c].x,y:n.y-this.snapOffsets[c].y};for(r=0;r<l;r++)(o=J(i.targets[r])?i.targets[r](d.x,d.y,this):i.targets[r])&&s.push({x:Q(o.x)?o.x+this.snapOffsets[c].x:d.x,y:Q(o.y)?o.y+this.snapOffsets[c].y:d.y,range:Q(o.range)?o.range:i.range})}var u,h={target:null,inRange:!1,distance:0,range:0,dx:0,dy:0};for(r=0,l=s.length;r<l;r++){var m=(o=s[r]).range,g=o.x-n.x,f=o.y-n.y,v=p(g,f),b=v<=m;m===1/0&&h.inRange&&h.range!==1/0&&(b=!1),h.target&&!(b?h.inRange&&m!==1/0?v/m<h.distance/h.range:m===1/0&&h.range!==1/0||v<h.distance:!h.inRange&&v<h.distance)||(m===1/0&&(b=!0),h.target=o,h.distance=v,h.range=m,h.inRange=b,h.dx=g,h.dy=f,t.range=m)}return h.target?(u=t.snappedX!==h.target.x||t.snappedY!==h.target.y,t.snappedX=h.target.x,t.snappedY=h.target.y):(u=!0,t.snappedX=NaN,t.snappedY=NaN),t.dx=h.dx,t.dy=h.dy,t.changed=u||h.inRange&&!t.locked,t.locked=h.inRange,t},setRestriction:function(e,t){var o,n,r,i,s=this.target,a=s&&s.options[this.prepared.name].restrict,l=a&&a.restriction;return l?(o=o=(t=t||this.restrictStatus).useStatusXY?{x:t.x,y:t.y}:ne({},e),t.snap&&t.snap.locked&&(o.x+=t.snap.dx||0,o.y+=t.snap.dy||0),o.x-=this.inertiaStatus.resumeDx,o.y-=this.inertiaStatus.resumeDy,t.dx=0,t.dy=0,t.restricted=!1,te(l)&&!(l="parent"===l?Te(this.element):"self"===l?s.getRect(this.element):Se(this.element,l))||(J(l)&&(l=l(o.x,o.y,this.element)),q(l)&&(l=ge(l)),n=l,l?"x"in l&&"y"in l?(r=Math.max(Math.min(n.x+n.width-this.restrictOffset.right,o.x),n.x+this.restrictOffset.left),i=Math.max(Math.min(n.y+n.height-this.restrictOffset.bottom,o.y),n.y+this.restrictOffset.top)):(r=Math.max(Math.min(n.right-this.restrictOffset.right,o.x),n.left+this.restrictOffset.left),i=Math.max(Math.min(n.bottom-this.restrictOffset.bottom,o.y),n.top+this.restrictOffset.top)):(r=o.x,i=o.y),t.dx=r-o.x,t.dy=i-o.y,t.changed=t.restrictedX!==r||t.restrictedY!==i,t.restricted=!(!t.dx&&!t.dy),t.restrictedX=r,t.restrictedY=i),t):t},checkAndPreventDefault:function(e,t,o){if(t=t||this.target){var n=t.options,r=n.preventDefault;if("auto"!==r||!o||/^(input|select|textarea)$/i.test(e.target.nodeName))"always"!==r||e.preventDefault();else{if(/down|start/i.test(e.type)&&"drag"===this.prepared.name&&"xy"!==n.drag.axis)return;if(n[this.prepared.name]&&n[this.prepared.name].manualStart&&!this.interacting())return;e.preventDefault()}}},calcInertia:function(e){var t=this.target.options[this.prepared.name].inertia,o=t.resistance,n=-Math.log(t.endSpeed/e.v0)/o;e.x0=this.prevEvent.pageX,e.y0=this.prevEvent.pageY,e.t0=e.startEvent.timeStamp/1e3,e.sx=e.sy=0,e.modifiedXe=e.xe=(e.vx0-n)/o,e.modifiedYe=e.ye=(e.vy0-n)/o,e.te=n,e.lambda_v0=o/e.v0,e.one_ve_v0=1-t.endSpeed/e.v0},autoScrollMove:function(e){if(this.interacting()&&function(e,t){var o=e.options;return/^resize/.test(t)&&(t="resize"),o[t].autoScroll&&o[t].autoScroll.enabled}(this.target,this.prepared.name))if(this.inertiaStatus.active)x.x=x.y=0;else{var t,o,n,r,i=this.target.options[this.prepared.name].autoScroll,s=i.container||me(this.element);if(G(s))r=e.clientX<x.margin,t=e.clientY<x.margin,o=e.clientX>s.innerWidth-x.margin,n=e.clientY>s.innerHeight-x.margin;else{var a=pe(s);r=e.clientX<a.left+x.margin,t=e.clientY<a.top+x.margin,o=e.clientX>a.right-x.margin,n=e.clientY>a.bottom-x.margin}x.x=o?1:r?-1:0,x.y=n?1:t?-1:0,x.isScrolling||(x.margin=i.margin,x.speed=i.speed,x.start(this))}},_updateEventTargets:function(e,t){this._eventTarget=e,this._curEventTarget=t}},Ie.prototype={preventDefault:W,stopImmediatePropagation:function(){this.immediatePropagationStopped=this.propagationStopped=!0},stopPropagation:function(){this.propagationStopped=!0}};for(var H={},U=["dragStart","dragMove","resizeStart","resizeMove","gestureStart","gestureMove","pointerOver","pointerOut","pointerHover","selectorDown","pointerDown","pointerMove","pointerUp","pointerCancel","pointerEnd","addPointer","removePointer","recordPointer","autoScrollMove"],Z=0,$=U.length;Z<$;Z++){var j=U[Z];H[j]=Pe(j)}v.indexOfElement=function(e,t){t=t||a;for(var o=0;o<this.length;o++){var n=this[o];if(n.selector===e&&n._context===t||!n.selector&&n._element===e)return o}return-1},v.get=function(e,t){return this[this.indexOfElement(e,t&&t.context)]},v.forEachSelector=function(e){for(var t=0;t<this.length;t++){var o=this[t];if(o.selector){var n=e(o,o.selector,o._context,t,this);if(void 0!==n)return n}}},We.prototype={setOnEvents:function(e,t){return"drop"===e?(J(t.ondrop)&&(this.ondrop=t.ondrop),J(t.ondropactivate)&&(this.ondropactivate=t.ondropactivate),J(t.ondropdeactivate)&&(this.ondropdeactivate=t.ondropdeactivate),J(t.ondragenter)&&(this.ondragenter=t.ondragenter),J(t.ondragleave)&&(this.ondragleave=t.ondragleave),J(t.ondropmove)&&(this.ondropmove=t.ondropmove)):(e="on"+e,J(t.onstart)&&(this[e+"start"]=t.onstart),J(t.onmove)&&(this[e+"move"]=t.onmove),J(t.onend)&&(this[e+"end"]=t.onend),J(t.oninertiastart)&&(this[e+"inertiastart"]=t.oninertiastart)),this},draggable:function(e){return K(e)?(this.options.drag.enabled=!1!==e.enabled,this.setPerAction("drag",e),this.setOnEvents("drag",e),/^x$|^y$|^xy$/.test(e.axis)?this.options.drag.axis=e.axis:null===e.axis&&delete this.options.drag.axis,this):ee(e)?(this.options.drag.enabled=e,this):this.options.drag},setPerAction:function(e,t){for(var o in t)o in _[e]&&(K(t[o])?(this.options[e][o]=ne(this.options[e][o]||{},t[o]),K(_.perAction[o])&&"enabled"in _.perAction[o]&&(this.options[e][o].enabled=!1!==t[o].enabled)):ee(t[o])&&K(_.perAction[o])?this.options[e][o].enabled=t[o]:void 0!==t[o]&&(this.options[e][o]=t[o]))},dropzone:function(e){return K(e)?(this.options.drop.enabled=!1!==e.enabled,this.setOnEvents("drop",e),/^(pointer|center)$/.test(e.overlap)?this.options.drop.overlap=e.overlap:Q(e.overlap)&&(this.options.drop.overlap=Math.max(Math.min(1,e.overlap),0)),"accept"in e&&(this.options.drop.accept=e.accept),"checker"in e&&(this.options.drop.checker=e.checker),this):ee(e)?(this.options.drop.enabled=e,this):this.options.drop},dropCheck:function(e,t,o,n,r,i){var s=!1;if(!(i=i||this.getRect(r)))return!!this.options.drop.checker&&this.options.drop.checker(e,t,s,this,r,o,n);var a=this.options.drop.overlap;if("pointer"===a){var l,c,d=ce(e),u=_e(o,n);d.x+=u.x,d.y+=u.y,l=d.x>i.left&&d.x<i.right,c=d.y>i.top&&d.y<i.bottom,s=l&&c}var h=o.getRect(n);if("center"===a){var m=h.left+h.width/2,p=h.top+h.height/2;s=m>=i.left&&m<=i.right&&p>=i.top&&p<=i.bottom}return Q(a)&&(s=Math.max(0,Math.min(i.right,h.right)-Math.max(i.left,h.left))*Math.max(0,Math.min(i.bottom,h.bottom)-Math.max(i.top,h.top))/(h.width*h.height)>=a),this.options.drop.checker&&(s=this.options.drop.checker(e,t,s,this,r,o,n)),s},dropChecker:function(e){return J(e)?(this.options.drop.checker=e,this):null===e?(delete this.options.getRect,this):this.options.drop.checker},accept:function(e){return q(e)||oe(e)?(this.options.drop.accept=e,this):null===e?(delete this.options.drop.accept,this):this.options.drop.accept},resizable:function(e){return K(e)?(this.options.resize.enabled=!1!==e.enabled,this.setPerAction("resize",e),this.setOnEvents("resize",e),/^x$|^y$|^xy$/.test(e.axis)?this.options.resize.axis=e.axis:null===e.axis&&(this.options.resize.axis=_.resize.axis),ee(e.preserveAspectRatio)?this.options.resize.preserveAspectRatio=e.preserveAspectRatio:ee(e.square)&&(this.options.resize.square=e.square),this):ee(e)?(this.options.resize.enabled=e,this):this.options.resize},squareResize:function(e){return ee(e)?(this.options.resize.square=e,this):null===e?(delete this.options.resize.square,this):this.options.resize.square},gesturable:function(e){return K(e)?(this.options.gesture.enabled=!1!==e.enabled,this.setPerAction("gesture",e),this.setOnEvents("gesture",e),this):ee(e)?(this.options.gesture.enabled=e,this):this.options.gesture},autoScroll:function(e){return K(e)?e=ne({actions:["drag","resize"]},e):ee(e)&&(e={actions:["drag","resize"],enabled:e}),this.setOptions("autoScroll",e)},snap:function(e){var t=this.setOptions("snap",e);return t===this?this:t.drag},setOptions:function(e,t){var o,n=t&&X(t.actions)?t.actions:["drag"];if(K(t)||ee(t)){for(o=0;o<n.length;o++){var r=/resize/.test(n[o])?"resize":n[o];if(K(this.options[r])){var i=this.options[r][e];K(t)?(ne(i,t),i.enabled=!1!==t.enabled,"snap"===e&&("grid"===i.mode?i.targets=[je.createSnapGrid(ne({offset:i.gridOffset||{x:0,y:0}},i.grid||{}))]:"anchor"===i.mode?i.targets=i.anchors:"path"===i.mode&&(i.targets=i.paths),"elementOrigin"in t&&(i.relativePoints=[t.elementOrigin]))):ee(t)&&(i.enabled=t)}}return this}var s={},a=["drag","resize","gesture"];for(o=0;o<a.length;o++)e in _[a[o]]&&(s[a[o]]=this.options[a[o]][e]);return s},inertia:function(e){var t=this.setOptions("inertia",e);return t===this?this:t.drag},getAction:function(e,t,o,n){var r=this.defaultActionChecker(e,o,n);return this.options.actionChecker?this.options.actionChecker(e,t,r,this,n,o):r},defaultActionChecker:He,actionChecker:function(e){return J(e)?(this.options.actionChecker=e,this):null===e?(delete this.options.actionChecker,this):this.options.actionChecker},getRect:function(e){return e=e||this._element,this.selector&&!q(e)&&(e=this._context.querySelector(this.selector)),ge(e)},rectChecker:function(e){return J(e)?(this.getRect=e,this):null===e?(delete this.options.getRect,this):this.getRect},styleCursor:function(e){return ee(e)?(this.options.styleCursor=e,this):null===e?(delete this.options.styleCursor,this):this.options.styleCursor},preventDefault:function(e){return/^(always|never|auto)$/.test(e)?(this.options.preventDefault=e,this):ee(e)?(this.options.preventDefault=e?"always":"never",this):this.options.preventDefault},origin:function(e){return oe(e)||K(e)?(this.options.origin=e,this):this.options.origin},deltaSource:function(e){return"page"===e||"client"===e?(this.options.deltaSource=e,this):this.options.deltaSource},restrict:function(e){if(!K(e))return this.setOptions("restrict",e);for(var t,o=["drag","resize","gesture"],n=0;n<o.length;n++){var r=o[n];if(r in e){var i=ne({actions:[r],restriction:e[r]},e);t=this.setOptions("restrict",i)}}return t},context:function(){return this._context},_context:a,ignoreFrom:function(e){return oe(e)||q(e)?(this.options.ignoreFrom=e,this):this.options.ignoreFrom},allowFrom:function(e){return oe(e)||q(e)?(this.options.allowFrom=e,this):this.options.allowFrom},element:function(){return this._element},fire:function(e){if(!e||!e.type||!Ke(R,e.type))return this;var t,o,n,r="on"+e.type;if(e.type in this._iEvents)for(o=0,n=(t=this._iEvents[e.type]).length;o<n&&!e.immediatePropagationStopped;o++)t[o].name,t[o](e);if(J(this[r])&&(this[r].name,this[r](e)),e.type in N&&(t=N[e.type]))for(o=0,n=t.length;o<n&&!e.immediatePropagationStopped;o++)t[o].name,t[o](e);return this},on:function(e,t,o){var n;if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),X(e)){for(n=0;n<e.length;n++)this.on(e[n],t,o);return this}if(K(e)){for(var r in e)this.on(r,e[r],t);return this}if("wheel"===e&&(e=B),o=!!o,Ke(R,e))e in this._iEvents?this._iEvents[e].push(t):this._iEvents[e]=[t];else if(this.selector){if(!w[e])for(w[e]={selectors:[],contexts:[],listeners:[]},n=0;n<f.length;n++)F.add(f[n],e,Ze),F.add(f[n],e,$e,!0);var i,s=w[e];for(i=s.selectors.length-1;i>=0&&(s.selectors[i]!==this.selector||s.contexts[i]!==this._context);i--);-1===i&&(i=s.selectors.length,s.selectors.push(this.selector),s.contexts.push(this._context),s.listeners.push([])),s.listeners[i].push([t,o])}else F.add(this._element,e,t,o);return this},off:function(e,t,o){var n;if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),X(e)){for(n=0;n<e.length;n++)this.off(e[n],t,o);return this}if(K(e)){for(var r in e)this.off(r,e[r],t);return this}var i,s=-1;if(o=!!o,"wheel"===e&&(e=B),Ke(R,e))(i=this._iEvents[e])&&-1!==(s=Xe(i,t))&&this._iEvents[e].splice(s,1);else if(this.selector){var a=w[e],l=!1;if(!a)return this;for(s=a.selectors.length-1;s>=0;s--)if(a.selectors[s]===this.selector&&a.contexts[s]===this._context){var c=a.listeners[s];for(n=c.length-1;n>=0;n--){var d=c[n][0],u=c[n][1];if(d===t&&u===o){c.splice(n,1),c.length||(a.selectors.splice(s,1),a.contexts.splice(s,1),a.listeners.splice(s,1),F.remove(this._context,e,Ze),F.remove(this._context,e,$e,!0),a.selectors.length||(w[e]=null)),l=!0;break}}if(l)break}}else F.remove(this._element,e,t,o);return this},set:function(e){K(e)||(e={}),this.options=ne({},_.base);var t,o=["drag","drop","resize","gesture"],n=["draggable","dropzone","resizable","gesturable"],r=ne(ne({},_.perAction),e[i]||{});for(t=0;t<o.length;t++){var i=o[t];this.options[i]=ne({},_[i]),this.setPerAction(i,r),this[n[t]](e[i])}var s=["accept","actionChecker","allowFrom","deltaSource","dropChecker","ignoreFrom","origin","preventDefault","rectChecker","styleCursor"];for(t=0,$=s.length;t<$;t++){var a=s[t];this.options[a]=_.base[a],a in e&&this[a](e[a])}return this},unset:function(){if(F.remove(this._element,"all"),te(this.selector))for(var e in w)for(var t=w[e],o=0;o<t.selectors.length;o++){t.selectors[o]===this.selector&&t.contexts[o]===this._context&&(t.selectors.splice(o,1),t.contexts.splice(o,1),t.listeners.splice(o,1),t.selectors.length||(w[e]=null)),F.remove(this._context,e,Ze),F.remove(this._context,e,$e,!0);break}else F.remove(this,"all"),this.options.styleCursor&&(this._element.style.cursor="");return this.dropzone(!1),v.splice(Xe(v,this),1),je}},We.prototype.snap=qe(We.prototype.snap,"Interactable#snap is deprecated. See the new documentation for snapping at http://interactjs.io/docs/snapping"),We.prototype.restrict=qe(We.prototype.restrict,"Interactable#restrict is deprecated. See the new documentation for resticting at http://interactjs.io/docs/restriction"),We.prototype.inertia=qe(We.prototype.inertia,"Interactable#inertia is deprecated. See the new documentation for inertia at http://interactjs.io/docs/inertia"),We.prototype.autoScroll=qe(We.prototype.autoScroll,"Interactable#autoScroll is deprecated. See the new documentation for autoScroll at http://interactjs.io/docs/#autoscroll"),We.prototype.squareResize=qe(We.prototype.squareResize,"Interactable#squareResize is deprecated. See http://interactjs.io/docs/#resize-square"),We.prototype.accept=qe(We.prototype.accept,"Interactable#accept is deprecated. use Interactable#dropzone({ accept: target }) instead"),We.prototype.dropChecker=qe(We.prototype.dropChecker,"Interactable#dropChecker is deprecated. use Interactable#dropzone({ dropChecker: checkerFunction }) instead"),We.prototype.context=qe(We.prototype.context,"Interactable#context as a method is deprecated. It will soon be a DOM Node instead"),je.isSet=function(e,t){return-1!==v.indexOfElement(e,t&&t.context)},je.on=function(e,t,o){if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),X(e)){for(var n=0;n<e.length;n++)je.on(e[n],t,o);return je}if(K(e)){for(var r in e)je.on(r,e[r],t);return je}return Ke(R,e)?N[e]?N[e].push(t):N[e]=[t]:F.add(a,e,t,o),je},je.off=function(e,t,o){if(te(e)&&-1!==e.search(" ")&&(e=e.trim().split(/ +/)),X(e)){for(var n=0;n<e.length;n++)je.off(e[n],t,o);return je}if(K(e)){for(var r in e)je.off(r,e[r],t);return je}var i;return Ke(R,e)?e in N&&-1!==(i=Xe(N[e],t))&&N[e].splice(i,1):F.remove(a,e,t,o),je},je.enableDragging=qe(function(e){return null!=e?(M.drag=e,je):M.drag},"interact.enableDragging is deprecated and will soon be removed."),je.enableResizing=qe(function(e){return null!=e?(M.resize=e,je):M.resize},"interact.enableResizing is deprecated and will soon be removed."),je.enableGesturing=qe(function(e){return null!=e?(M.gesture=e,je):M.gesture},"interact.enableGesturing is deprecated and will soon be removed."),je.eventTypes=R,je.debug=function(){var e=b[0]||new Ve;return{interactions:b,target:e.target,dragging:e.dragging,resizing:e.resizing,gesturing:e.gesturing,prepared:e.prepared,matches:e.matches,matchElements:e.matchElements,prevCoords:e.prevCoords,startCoords:e.startCoords,pointerIds:e.pointerIds,pointers:e.pointers,addPointer:H.addPointer,removePointer:H.removePointer,recordPointer:H.recordPointer,snap:e.snapStatus,restrict:e.restrictStatus,inertia:e.inertiaStatus,downTime:e.downTimes[0],downEvent:e.downEvent,downPointer:e.downPointer,prevEvent:e.prevEvent,Interactable:We,interactables:v,pointerIsDown:e.pointerIsDown,defaultOptions:_,defaultActionChecker:He,actionCursors:A,dragMove:H.dragMove,resizeMove:H.resizeMove,gestureMove:H.gestureMove,pointerUp:H.pointerUp,pointerDown:H.pointerDown,pointerMove:H.pointerMove,pointerHover:H.pointerHover,eventTypes:R,events:F,globalEvents:N,delegatedEvents:w,prefixedPropREs:z}},je.getPointerAverage=ve,je.getTouchBBox=be,je.getTouchDistance=ye,je.getTouchAngle=we,je.getElementRect=ge,je.getElementClientRect=pe,je.matchesSelector=Je,je.closest=Se,je.margin=qe(function(e){return Q(e)?(S=e,je):S},"interact.margin is deprecated. Use interact(target).resizable({ margin: number }); instead."),je.supportsTouch=function(){return C},je.supportsPointerEvent=function(){return k},je.stop=function(e){for(var t=b.length-1;t>=0;t--)b[t].stop(e);return je},je.dynamicDrop=function(e){return ee(e)?(y=e,je):y},je.pointerMoveTolerance=function(e){return Q(e)?(T=e,this):T},je.maxInteractions=function(e){return Q(e)?(O=e,this):O},je.createSnapGrid=function(e){return function(t,o){var n=0,r=0;K(e.offset)&&(n=e.offset.x,r=e.offset.y);var i=Math.round((t-n)/e.x),s=Math.round((o-r)/e.y);return{x:i*e.x+n,y:s*e.y+r,range:e.range}}},Ye(a),P in Element.prototype&&J(Element.prototype[P])||(r=function(e,t,o){for(var n=0,r=(o=o||e.parentNode.querySelectorAll(t)).length;n<r;n++)if(o[n]===e)return!0;return!1}),function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;n<t.length&&!o.requestAnimationFrame;++n)I=o[t[n]+"RequestAnimationFrame"],L=o[t[n]+"CancelAnimationFrame"]||o[t[n]+"CancelRequestAnimationFrame"];I||(I=function(t){var o=(new Date).getTime(),n=Math.max(0,16-(o-e)),r=setTimeout(function(){t(o+n)},n);return e=o+n,r}),L||(L=function(e){clearTimeout(e)})}(),e.exports&&(t=e.exports=je),t.interact=je}function W(){}function q(e){if(!e||"object"!=typeof e)return!1;var t=me(e)||s;return/object|function/.test(typeof t.Element)?e instanceof t.Element:1===e.nodeType&&"string"==typeof e.nodeName}function G(e){return e===s||!(!e||!e.Window)&&e instanceof e.Window}function Y(e){return!!e&&e instanceof l}function X(e){return K(e)&&void 0!==typeof e.length&&J(e.splice)}function K(e){return!!e&&"object"==typeof e}function J(e){return"function"==typeof e}function Q(e){return"number"==typeof e}function ee(e){return"boolean"==typeof e}function te(e){return"string"==typeof e}function oe(e){return!!te(e)&&(a.querySelector(e),!0)}function ne(e,t){for(var o in t)e[o]=t[o];return e}function re(e,t){for(var o in t){var n=!1;for(var r in z)if(0===o.indexOf(r)&&z[r].test(o)){n=!0;break}n||(e[o]=t[o])}return e}function ie(e,t){e.page=e.page||{},e.page.x=t.page.x,e.page.y=t.page.y,e.client=e.client||{},e.client.x=t.client.x,e.client.y=t.client.y,e.timeStamp=t.timeStamp}function se(e,t,o){e.page.x=o.page.x-t.page.x,e.page.y=o.page.y-t.page.y,e.client.x=o.client.x-t.client.x,e.client.y=o.client.y-t.client.y,e.timeStamp=(new Date).getTime()-t.timeStamp;var n=Math.max(e.timeStamp/1e3,.001);e.page.speed=p(e.page.x,e.page.y)/n,e.page.vx=e.page.x/n,e.page.vy=e.page.y/n,e.client.speed=p(e.client.x,e.page.y)/n,e.client.vx=e.client.x/n,e.client.vy=e.client.y/n}function ae(e){return e instanceof s.Event||C&&s.Touch&&e instanceof s.Touch}function le(e,t,o){return e=e||"page",(o=o||{}).x=t[e+"X"],o.y=t[e+"Y"],o}function ce(e,t){return t=t||{},V&&ae(e)?(le("screen",e,t),t.x+=s.scrollX,t.y+=s.scrollY):le("page",e,t),t}function de(e,t){return t=t||{},V&&ae(e)?le("screen",e,t):le("client",e,t),t}function ue(e){return Q(e.pointerId)?e.pointerId:e.identifier}function he(e){return e instanceof u?e.correspondingUseElement:e}function me(e){if(G(e))return e;var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||s}function pe(e){var t=e instanceof c?e.getBoundingClientRect():e.getClientRects()[0];return t&&{left:t.left,right:t.right,top:t.top,bottom:t.bottom,width:t.width||t.right-t.left,height:t.height||t.bottom-t.top}}function ge(e){var t,o=pe(e);if(!D&&o){var n={x:(t=(t=me(e))||s).scrollX||t.document.documentElement.scrollLeft,y:t.scrollY||t.document.documentElement.scrollTop};o.left+=n.x,o.right+=n.x,o.top+=n.y,o.bottom+=n.y}return o}function fe(e){var t=[];return X(e)?(t[0]=e[0],t[1]=e[1]):"touchend"===e.type?1===e.touches.length?(t[0]=e.touches[0],t[1]=e.changedTouches[0]):0===e.touches.length&&(t[0]=e.changedTouches[0],t[1]=e.changedTouches[1]):(t[0]=e.touches[0],t[1]=e.touches[1]),t}function ve(e){for(var t,o={pageX:0,pageY:0,clientX:0,clientY:0,screenX:0,screenY:0},n=0;n<e.length;n++)for(t in o)o[t]+=e[n][t];for(t in o)o[t]/=e.length;return o}function be(e){if(e.length||e.touches&&e.touches.length>1){var t=fe(e),o=Math.min(t[0].pageX,t[1].pageX),n=Math.min(t[0].pageY,t[1].pageY);return{x:o,y:n,left:o,top:n,width:Math.max(t[0].pageX,t[1].pageX)-o,height:Math.max(t[0].pageY,t[1].pageY)-n}}}function ye(e,t){var o=(t=t||_.deltaSource)+"X",n=t+"Y",r=fe(e),i=r[0][o]-r[1][o],s=r[0][n]-r[1][n];return p(i,s)}function we(e,t,o){var n=(o=o||_.deltaSource)+"X",r=o+"Y",i=fe(e),s=i[0][n]-i[1][n],a=i[0][r]-i[1][r],l=180*Math.atan(a/s)/Math.PI;if(Q(t)){var c=(l-t)%360;c>315?l-=360+l/360|0:c>135?l-=180+l/360|0:c<-315?l+=360+l/360|0:c<-135&&(l+=180+l/360|0)}return l}function _e(e,t){var o=e?e.options.origin:_.origin;return"parent"===o?o=Te(t):"self"===o?o=e.getRect(t):oe(o)&&(o=Se(t,o)||{x:0,y:0}),J(o)&&(o=o(e&&t)),q(o)&&(o=ge(o)),o.x="x"in o?o.x:o.left,o.y="y"in o?o.y:o.top,o}function xe(e,t,o,n){var r=1-e;return r*r*t+2*r*e*o+e*e*n}function Ce(e,t,o,n){return-o*(e/=n)*(e-2)+t}function ke(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function Se(e,t){for(var o=Te(e);q(o);){if(Je(o,t))return o;o=Te(o)}return null}function Te(e){var t=e.parentNode;if(Y(t)){for(;(t=t.host)&&Y(t););return t}return t}function Ee(e,t){return e._context===t.ownerDocument||ke(e._context,t)}function Oe(e,t,o){var n=e.options.ignoreFrom;return!(!n||!q(o))&&(te(n)?Qe(o,n,t):!!q(n)&&ke(n,o))}function Ae(e,t,o){var n=e.options.allowFrom;return!n||!!q(o)&&(te(n)?Qe(o,n,t):!!q(n)&&ke(n,o))}function Me(e,t){if(!t)return!1;var o=t.options.drag.axis;return"xy"===e||"xy"===o||o===e}function Be(e,t){var o=e.options;return/^resize/.test(t)&&(t="resize"),o[t].snap&&o[t].snap.enabled}function Re(e,t){var o=e.options;return/^resize/.test(t)&&(t="resize"),o[t].restrict&&o[t].restrict.enabled}function Ne(e,t,o){for(var n=e.options,r=n[o.name].max,i=n[o.name].maxPerElement,s=0,a=0,l=0,c=0,d=b.length;c<d;c++){var u=b[c],h=u.prepared.name;if(u.interacting()){if(++s>=O)return!1;if(u.target===e){if((a+=h===o.name|0)>=r)return!1;if(u.element===t&&(l++,h!==o.name||l>=i))return!1}}}return O>0}function Ve(){if(this.target=null,this.element=null,this.dropTarget=null,this.dropElement=null,this.prevDropTarget=null,this.prevDropElement=null,this.prepared={name:null,axis:null,edges:null},this.matches=[],this.matchElements=[],this.inertiaStatus={active:!1,smoothEnd:!1,ending:!1,startEvent:null,upCoords:{},xe:0,ye:0,sx:0,sy:0,t0:0,vx0:0,vys:0,duration:0,resumeDx:0,resumeDy:0,lambda_v0:0,one_ve_v0:0,i:null},J(Function.prototype.bind))this.boundInertiaFrame=this.inertiaFrame.bind(this),this.boundSmoothEndFrame=this.smoothEndFrame.bind(this);else{var e=this;this.boundInertiaFrame=function(){return e.inertiaFrame()},this.boundSmoothEndFrame=function(){return e.smoothEndFrame()}}this.activeDrops={dropzones:[],elements:[],rects:[]},this.pointers=[],this.pointerIds=[],this.downTargets=[],this.downTimes=[],this.holdTimers=[],this.prevCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},this.curCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},this.startCoords={page:{x:0,y:0},client:{x:0,y:0},timeStamp:0},this.pointerDelta={page:{x:0,y:0,vx:0,vy:0,speed:0},client:{x:0,y:0,vx:0,vy:0,speed:0},timeStamp:0},this.downEvent=null,this.downPointer={},this._eventTarget=null,this._curEventTarget=null,this.prevEvent=null,this.tapTime=0,this.prevTap=null,this.startOffset={left:0,right:0,top:0,bottom:0},this.restrictOffset={left:0,right:0,top:0,bottom:0},this.snapOffsets=[],this.gesture={start:{x:0,y:0},startDistance:0,prevDistance:0,distance:0,scale:1,startAngle:0,prevAngle:0},this.snapStatus={x:0,y:0,dx:0,dy:0,realX:0,realY:0,snappedX:0,snappedY:0,targets:[],locked:!1,changed:!1},this.restrictStatus={dx:0,dy:0,restrictedX:0,restrictedY:0,snap:null,restricted:!1,changed:!1},this.restrictStatus.snap=this.snapStatus,this.pointerIsDown=!1,this.pointerWasMoved=!1,this.gesturing=!1,this.dragging=!1,this.resizing=!1,this.resizeAxes="xy",this.mouse=!1,b.push(this)}function De(e,t,o){var n,r=0,i=b.length,s=/mouse/i.test(e.pointerType||t)||4===e.pointerType,a=ue(e);if(/down|start/i.test(t))for(r=0;r<i;r++){var l=o;if((n=b[r]).inertiaStatus.active&&n.target.options[n.prepared.name].inertia.allowResume&&n.mouse===s)for(;l;){if(l===n.element)return n;l=Te(l)}}if(s||!C&&!k){for(r=0;r<i;r++)if(b[r].mouse&&!b[r].inertiaStatus.active)return b[r];for(r=0;r<i;r++)if(b[r].mouse&&(!/down/.test(t)||!b[r].inertiaStatus.active))return n;return(n=new Ve).mouse=!0,n}for(r=0;r<i;r++)if(Ke(b[r].pointerIds,a))return b[r];if(/up|end|out/i.test(t))return null;for(r=0;r<i;r++)if((!(n=b[r]).prepared.name||n.target.options.gesture.enabled)&&!n.interacting()&&(s||!n.mouse))return n;return new Ve}function Pe(e){return function(t){var o,n,r=he(t.path?t.path[0]:t.target),i=he(t.currentTarget);if(C&&/touch/.test(t.type))for(E=(new Date).getTime(),n=0;n<t.changedTouches.length;n++){var s=t.changedTouches[n];(o=De(s,t.type,r))&&(o._updateEventTargets(r,i),o[e](s,t,r,i))}else{if(!k&&/mouse/.test(t.type)){for(n=0;n<b.length;n++)if(!b[n].mouse&&b[n].pointerIsDown)return;if((new Date).getTime()-E<500)return}if(!(o=De(t,t.type,r)))return;o._updateEventTargets(r,i),o[e](t,t,r,i)}}}function Ie(e,t,o,n,r,i){var s,a,l=e.target,c=e.snapStatus,d=e.restrictStatus,u=e.pointers,h=(l&&l.options||_).deltaSource,m=h+"X",g=h+"Y",f=l?l.options:_,v=_e(l,r),b="start"===n,y="end"===n,w=b?e.startCoords:e.curCoords;r=r||e.element,a=ne({},w.page),s=ne({},w.client),a.x-=v.x,a.y-=v.y,s.x-=v.x,s.y-=v.y;var x=f[o].snap&&f[o].snap.relativePoints;!Be(l,o)||b&&x&&x.length||(this.snap={range:c.range,locked:c.locked,x:c.snappedX,y:c.snappedY,realX:c.realX,realY:c.realY,dx:c.dx,dy:c.dy},c.locked&&(a.x+=c.dx,a.y+=c.dy,s.x+=c.dx,s.y+=c.dy)),!Re(l,o)||b&&f[o].restrict.elementRect||!d.restricted||(a.x+=d.dx,a.y+=d.dy,s.x+=d.dx,s.y+=d.dy,this.restrict={dx:d.dx,dy:d.dy}),this.pageX=a.x,this.pageY=a.y,this.clientX=s.x,this.clientY=s.y,this.x0=e.startCoords.page.x-v.x,this.y0=e.startCoords.page.y-v.y,this.clientX0=e.startCoords.client.x-v.x,this.clientY0=e.startCoords.client.y-v.y,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.button=t.button,this.buttons=t.buttons,this.target=r,this.t0=e.downTimes[0],this.type=o+(n||""),this.interaction=e,this.interactable=l;var C=e.inertiaStatus;if(C.active&&(this.detail="inertia"),i&&(this.relatedTarget=i),y?"client"===h?(this.dx=s.x-e.startCoords.client.x,this.dy=s.y-e.startCoords.client.y):(this.dx=a.x-e.startCoords.page.x,this.dy=a.y-e.startCoords.page.y):b?(this.dx=0,this.dy=0):"inertiastart"===n?(this.dx=e.prevEvent.dx,this.dy=e.prevEvent.dy):"client"===h?(this.dx=s.x-e.prevEvent.clientX,this.dy=s.y-e.prevEvent.clientY):(this.dx=a.x-e.prevEvent.pageX,this.dy=a.y-e.prevEvent.pageY),e.prevEvent&&"inertia"===e.prevEvent.detail&&!C.active&&f[o].inertia&&f[o].inertia.zeroResumeDelta&&(C.resumeDx+=this.dx,C.resumeDy+=this.dy,this.dx=this.dy=0),"resize"===o&&e.resizeAxes?f.resize.square?("y"===e.resizeAxes?this.dx=this.dy:this.dy=this.dx,this.axes="xy"):(this.axes=e.resizeAxes,"x"===e.resizeAxes?this.dy=0:"y"===e.resizeAxes&&(this.dx=0)):"gesture"===o&&(this.touches=[u[0],u[1]],b?(this.distance=ye(u,h),this.box=be(u),this.scale=1,this.ds=0,this.angle=we(u,void 0,h),this.da=0):y||t instanceof Ie?(this.distance=e.prevEvent.distance,this.box=e.prevEvent.box,this.scale=e.prevEvent.scale,this.ds=this.scale-1,this.angle=e.prevEvent.angle,this.da=this.angle-e.gesture.startAngle):(this.distance=ye(u,h),this.box=be(u),this.scale=this.distance/e.gesture.startDistance,this.angle=we(u,e.gesture.prevAngle,h),this.ds=this.scale-e.gesture.prevScale,this.da=this.angle-e.gesture.prevAngle)),b)this.timeStamp=e.downTimes[0],this.dt=0,this.duration=0,this.speed=0,this.velocityX=0,this.velocityY=0;else if("inertiastart"===n)this.timeStamp=e.prevEvent.timeStamp,this.dt=e.prevEvent.dt,this.duration=e.prevEvent.duration,this.speed=e.prevEvent.speed,this.velocityX=e.prevEvent.velocityX,this.velocityY=e.prevEvent.velocityY;else if(this.timeStamp=(new Date).getTime(),this.dt=this.timeStamp-e.prevEvent.timeStamp,this.duration=this.timeStamp-e.downTimes[0],t instanceof Ie){var k=this[m]-e.prevEvent[m],S=this[g]-e.prevEvent[g],T=this.dt/1e3;this.speed=p(k,S)/T,this.velocityX=k/T,this.velocityY=S/T}else this.speed=e.pointerDelta[h].speed,this.velocityX=e.pointerDelta[h].vx,this.velocityY=e.pointerDelta[h].vy;if((y||"inertiastart"===n)&&e.prevEvent.speed>600&&this.timeStamp-e.prevEvent.timeStamp<150){var E=180*Math.atan2(e.prevEvent.velocityY,e.prevEvent.velocityX)/Math.PI;E<0&&(E+=360);var O=112.5<=E&&E<247.5,A=202.5<=E&&E<337.5,M=!O&&(292.5<=E||E<67.5),B=!A&&22.5<=E&&E<157.5;this.swipe={up:A,down:B,left:O,right:M,angle:E,speed:e.prevEvent.speed,velocity:{x:e.prevEvent.velocityX,y:e.prevEvent.velocityY}}}}function Le(){this.originalEvent.preventDefault()}function Fe(e){var t="";if("drag"===e.name&&(t=A.drag),"resize"===e.name)if(e.axis)t=A[e.name+e.axis];else if(e.edges){for(var o="resize",n=["top","bottom","left","right"],r=0;r<4;r++)e.edges[n[r]]&&(o+=n[r]);t=A[o]}return t}function ze(e,t,o,n,r,i,s){if(!t)return!1;if(!0===t){var a=Q(i.width)?i.width:i.right-i.left,l=Q(i.height)?i.height:i.bottom-i.top;if(a<0&&("left"===e?e="right":"right"===e&&(e="left")),l<0&&("top"===e?e="bottom":"bottom"===e&&(e="top")),"left"===e)return o.x<(a>=0?i.left:i.right)+s;if("top"===e)return o.y<(l>=0?i.top:i.bottom)+s;if("right"===e)return o.x>(a>=0?i.right:i.left)-s;if("bottom"===e)return o.y>(l>=0?i.bottom:i.top)-s}return!!q(n)&&(q(t)?t===n:Qe(n,t,r))}function He(e,t,o){var n,r=this.getRect(o),i=!1,s=null,a=null,l=ne({},t.curCoords.page),c=this.options;if(!r)return null;if(M.resize&&c.resize.enabled){var d=c.resize;if(n={left:!1,right:!1,top:!1,bottom:!1},K(d.edges)){for(var u in n)n[u]=ze(u,d.edges[u],l,t._eventTarget,o,r,d.margin||S);n.left=n.left&&!n.right,n.top=n.top&&!n.bottom,i=n.left||n.right||n.top||n.bottom}else{var h="y"!==c.resize.axis&&l.x>r.right-S,m="x"!==c.resize.axis&&l.y>r.bottom-S;i=h||m,a=(h?"x":"")+(m?"y":"")}}return s=i?"resize":M.drag&&c.drag.enabled?"drag":null,M.gesture&&t.pointerIds.length>=2&&!t.dragging&&!t.resizing&&(s="gesture"),s?{name:s,axis:a,edges:n}:null}function Ue(e,t){if(!K(e))return null;var o=e.name,n=t.options;return("resize"===o&&n.resize.enabled||"drag"===o&&n.drag.enabled||"gesture"===o&&n.gesture.enabled)&&M[o]?("resize"!==o&&"resizeyx"!==o||(o="resizexy"),e):null}function Ze(e,t){var o={},n=w[e.type],r=he(e.path?e.path[0]:e.target),i=r;for(var s in t=!!t,e)o[s]=e[s];for(o.originalEvent=e,o.preventDefault=Le;q(i);){for(var a=0;a<n.selectors.length;a++){var l=n.selectors[a],c=n.contexts[a];if(Je(i,l)&&ke(c,r)&&ke(c,i)){var d=n.listeners[a];o.currentTarget=i;for(var u=0;u<d.length;u++)d[u][1]===t&&d[u][0](o)}}i=Te(i)}}function $e(e){return Ze.call(this,e,!0)}function je(e,t){return v.get(e,t)||new We(e,t)}function We(e,t){var o;if(this._element=e,this._iEvents=this._iEvents||{},oe(e)){this.selector=e;var r=t&&t.context;o=r?me(r):s,r&&(o.Node?r instanceof o.Node:q(r)||r===o.document)&&(this._context=r)}else o=me(e),q(e)&&(k?(F.add(this._element,n.down,H.pointerDown),F.add(this._element,n.move,H.pointerHover)):(F.add(this._element,"mousedown",H.pointerDown),F.add(this._element,"mousemove",H.pointerHover),F.add(this._element,"touchstart",H.pointerDown),F.add(this._element,"touchmove",H.pointerHover)));this._doc=o.document,Ke(f,this._doc)||Ye(this._doc),v.push(this),this.set(t)}function qe(e,t){var o=!1;return function(){return o||(s.console.warn(t),o=!0),e.apply(this,arguments)}}function Ge(e){for(var t=0;t<b.length;t++)b[t].pointerEnd(e,e)}function Ye(e){if(!Ke(f,e)){var t=e.defaultView||e.parentWindow;for(var o in w)F.add(e,o,Ze),F.add(e,o,$e,!0);k?(n=m===t.MSPointerEvent?{up:"MSPointerUp",down:"MSPointerDown",over:"mouseover",out:"mouseout",move:"MSPointerMove",cancel:"MSPointerCancel"}:{up:"pointerup",down:"pointerdown",over:"pointerover",out:"pointerout",move:"pointermove",cancel:"pointercancel"},F.add(e,n.down,H.selectorDown),F.add(e,n.move,H.pointerMove),F.add(e,n.over,H.pointerOver),F.add(e,n.out,H.pointerOut),F.add(e,n.up,H.pointerUp),F.add(e,n.cancel,H.pointerCancel),F.add(e,n.move,H.autoScrollMove)):(F.add(e,"mousedown",H.selectorDown),F.add(e,"mousemove",H.pointerMove),F.add(e,"mouseup",H.pointerUp),F.add(e,"mouseover",H.pointerOver),F.add(e,"mouseout",H.pointerOut),F.add(e,"touchstart",H.selectorDown),F.add(e,"touchmove",H.pointerMove),F.add(e,"touchend",H.pointerUp),F.add(e,"touchcancel",H.pointerCancel),F.add(e,"mousemove",H.autoScrollMove),F.add(e,"touchmove",H.autoScrollMove)),F.add(t,"blur",Ge);try{if(t.frameElement){var r=t.frameElement.ownerDocument,i=r.defaultView;F.add(r,"mouseup",H.pointerEnd),F.add(r,"touchend",H.pointerEnd),F.add(r,"touchcancel",H.pointerEnd),F.add(r,"pointerup",H.pointerEnd),F.add(r,"MSPointerUp",H.pointerEnd),F.add(i,"blur",Ge)}}catch(e){je.windowParentError=e}F.add(e,"dragstart",function(e){for(var t=0;t<b.length;t++){var o=b[t];if(o.element&&(o.element===e.target||ke(o.element,e.target)))return void o.checkAndPreventDefault(e,o.target,o.element)}}),F.useAttachEvent&&(F.add(e,"selectstart",function(e){var t=b[0];t.currentAction()&&t.checkAndPreventDefault(e)}),F.add(e,"dblclick",Pe("ie8Dblclick"))),f.push(e)}}function Xe(e,t){for(var o=0,n=e.length;o<n;o++)if(e[o]===t)return o;return-1}function Ke(e,t){return-1!==Xe(e,t)}function Je(e,t,n){return r?r(e,t,n):(s!==o&&(t=t.replace(/\/deep\//g," ")),e[P](t))}function Qe(e,t,o){for(;q(e);){if(Je(e,t))return!0;if((e=Te(e))===o)return Je(e,t)}return!1}}("undefined"==typeof window?void 0:window)},62439(e,t,o){var n;!function(r,i){if(r){for(var s,a={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},l={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},c={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},d={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},u=1;u<20;++u)a[111+u]="f"+u;for(u=0;u<=9;++u)a[u+96]=u.toString();y.prototype.bind=function(e,t,o){var n=this;return e=e instanceof Array?e:[e],n._bindMultiple.call(n,e,t,o),n},y.prototype.unbind=function(e,t){return this.bind.call(this,e,function(){},t)},y.prototype.trigger=function(e,t){var o=this;return o._directMap[e+":"+t]&&o._directMap[e+":"+t]({},e),o},y.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},y.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1)return!1;if(b(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var o=e.composedPath()[0];o!==e.target&&(t=o)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},y.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},y.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(a[t]=e[t]);s=null},y.init=function(){var e=y(i);for(var t in e)"_"!==t.charAt(0)&&(y[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},y.init(),r.Mousetrap=y,e.exports&&(e.exports=y),void 0===(n=function(){return y}.call(t,o,t,e))||(e.exports=n)}function h(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)}function m(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return a[e.which]?a[e.which]:l[e.which]?l[e.which]:String.fromCharCode(e.which).toLowerCase()}function p(e,t){return e.sort().join(",")===t.sort().join(",")}function g(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function f(e,t,o){return o||(o=function(){if(!s)for(var e in s={},a)e>95&&e<112||a.hasOwnProperty(e)&&(s[a[e]]=e);return s}()[e]?"keydown":"keypress"),"keypress"==o&&t.length&&(o="keydown"),o}function v(e,t){var o,n,r,i=[];for(o=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),r=0;r<o.length;++r)n=o[r],d[n]&&(n=d[n]),t&&"keypress"!=t&&c[n]&&(n=c[n],i.push("shift")),g(n)&&i.push(n);return{key:n,modifiers:i,action:t=f(n,i,t)}}function b(e,t){return null!==e&&e!==i&&(e===t||b(e.parentNode,t))}function y(e){var t=this;if(e=e||i,!(t instanceof y))return new y(e);t.target=e,t._callbacks={},t._directMap={};var o,n={},r=!1,s=!1,a=!1;function l(e){e=e||{};var t,o=!1;for(t in n)e[t]?o=!0:n[t]=0;o||(a=!1)}function c(e,o,r,i,s,a){var l,c,d=[],u=r.type;if(!t._callbacks[e])return[];for("keyup"==u&&g(e)&&(o=[e]),l=0;l<t._callbacks[e].length;++l)if(c=t._callbacks[e][l],(i||!c.seq||n[c.seq]==c.level)&&u==c.action&&("keypress"==u&&!r.metaKey&&!r.ctrlKey||p(o,c.modifiers))){var h=!i&&c.combo==s,m=i&&c.seq==i&&c.level==a;(h||m)&&t._callbacks[e].splice(l,1),d.push(c)}return d}function d(e,o,n,r){t.stopCallback(o,o.target||o.srcElement,n,r)||!1===e(o,n)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(o),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(o))}function u(e){"number"!=typeof e.which&&(e.which=e.keyCode);var o=m(e);o&&("keyup"!=e.type||r!==o?t.handleKey(o,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):r=!1)}function f(e,i,s,u,h){t._directMap[e+":"+s]=i;var p,g=(e=e.replace(/\s+/g," ")).split(" ");g.length>1?function(e,t,i,s){function c(t){return function(){a=t,++n[e],clearTimeout(o),o=setTimeout(l,1e3)}}function u(t){d(i,t,e),"keyup"!==s&&(r=m(t)),setTimeout(l,10)}n[e]=0;for(var h=0;h<t.length;++h){var p=h+1===t.length?u:c(s||v(t[h+1]).action);f(t[h],p,s,e,h)}}(e,g,i,s):(p=v(e,s),t._callbacks[p.key]=t._callbacks[p.key]||[],c(p.key,p.modifiers,{type:p.action},u,e,h),t._callbacks[p.key][u?"unshift":"push"]({callback:i,modifiers:p.modifiers,action:p.action,seq:u,level:h,combo:e}))}t._handleKey=function(e,t,o){var n,r=c(e,t,o),i={},u=0,h=!1;for(n=0;n<r.length;++n)r[n].seq&&(u=Math.max(u,r[n].level));for(n=0;n<r.length;++n)if(r[n].seq){if(r[n].level!=u)continue;h=!0,i[r[n].seq]=1,d(r[n].callback,o,r[n].combo,r[n].seq)}else h||d(r[n].callback,o,r[n].combo);var m="keypress"==o.type&&s;o.type!=a||g(e)||m||l(i),s=h&&"keydown"==o.type},t._bindMultiple=function(e,t,o){for(var n=0;n<e.length;++n)f(e[n],t,o)},h(e,"keypress",u),h(e,"keydown",u),h(e,"keyup",u)}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)},61938(e,t,o){var n,r,i;!function(){"use strict";r=[o(41669)],n=function(e,t){var o={beforeShow:d,move:d,change:d,show:d,hide:d,color:!1,flat:!1,showInput:!1,allowEmpty:!1,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!1,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:7,cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:!1,className:"",containerClassName:"",replacerClassName:"",showAlpha:!1,theme:"sp-light",palette:[["#ffffff","#000000","#ff0000","#ff8000","#ffff00","#008000","#0000ff","#4b0082","#9400d3"]],selectionPalette:[],disabled:!1,offset:null},n=[],r=!!/msie/i.exec(window.navigator.userAgent),i=function(){function e(e,t){return!!~(""+e).indexOf(t)}var t=document.createElement("div").style;return t.cssText="background-color:rgba(0,0,0,.5)",e(t.backgroundColor,"rgba")||e(t.backgroundColor,"hsla")}(),s=["<div class='sp-replacer'>","<div class='sp-preview'><div class='sp-preview-inner'></div></div>","<div class='sp-dd'>&#9660;</div>","</div>"].join(""),a=function(){var e="";if(r)for(var t=1;t<=6;t++)e+="<div class='sp-"+t+"'></div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'></div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'></button>","</div>","</div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'></div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'></div>","</div>","</div>","</div>","<div class='sp-clear sp-clear-display'>","</div>","<div class='sp-hue'>","<div class='sp-slider'></div>",e,"</div>","</div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>","</div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false'  />","</div>","<div class='sp-initial sp-thumb sp-cf'></div>","<div class='sp-button-container sp-cf'>","<a class='sp-cancel' href='#'></a>","<button type='button' class='sp-choose'></button>","</div>","</div>","</div>"].join("")}();function l(t,o,n,r){for(var s=[],a=0;a<t.length;a++){var l=t[a];if(l){var c=tinycolor(l),d=c.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light";d+=tinycolor.equals(o,l)?" sp-thumb-active":"";var u=c.toString(r.preferredFormat||"rgb"),h=i?"background-color:"+c.toRgbString():"filter:"+c.toFilter();s.push('<span title="'+u+'" data-color="'+c.toRgbString()+'" class="'+d+'"><span class="sp-thumb-inner" style="'+h+';"></span></span>')}else{s.push(e("<div />").append(e('<span data-color="" style="background-color:transparent;" class="sp-clear-display"></span>').attr("title",r.noColorSelectedText)).html())}}return"<div class='sp-cf "+n+"'>"+s.join("")+"</div>"}function c(c,d){var g,f,v,b,y=function(t,n){var r=e.extend({},o,t);return r.callbacks={move:h(r.move,n),change:h(r.change,n),show:h(r.show,n),hide:h(r.hide,n),beforeShow:h(r.beforeShow,n)},r}(d,c),w=y.flat,_=y.showSelectionPalette,x=y.localStorageKey,C=y.theme,k=y.callbacks,S=(g=Ze,f=10,function(){var e=this,t=arguments,o=function(){b=null,g.apply(e,t)};v&&clearTimeout(b),!v&&b||(b=setTimeout(o,f))}),T=!1,E=!1,O=0,A=0,M=0,B=0,R=0,N=0,V=0,D=0,P=0,I=0,L=1,F=[],z=[],H={},U=y.selectionPalette.slice(0),Z=y.maxSelectionSize,$="sp-dragging",j=null,W=c.ownerDocument,q=(W.body,e(c)),G=!1,Y=e(a,W).addClass(C),X=Y.find(".sp-picker-container"),K=Y.find(".sp-color"),J=Y.find(".sp-dragger"),Q=Y.find(".sp-hue"),ee=Y.find(".sp-slider"),te=Y.find(".sp-alpha-inner"),oe=Y.find(".sp-alpha"),ne=Y.find(".sp-alpha-handle"),re=Y.find(".sp-input"),ie=Y.find(".sp-palette"),se=Y.find(".sp-initial"),ae=Y.find(".sp-cancel"),le=Y.find(".sp-clear"),ce=Y.find(".sp-choose"),de=Y.find(".sp-palette-toggle"),ue=q.is("input"),he=ue&&"color"===q.attr("type")&&p(),me=ue&&!w,pe=me?e(s).addClass(C).addClass(y.className).addClass(y.replacerClassName):e([]),ge=me?pe:q,fe=pe.find(".sp-preview-inner"),ve=y.color||ue&&q.val(),be=!1,ye=y.preferredFormat,we=!y.showButtons||y.clickoutFiresChange,_e=!ve,xe=y.allowEmpty&&!he;function Ce(){if(y.showPaletteOnly&&(y.showPalette=!0),de.text(y.showPaletteOnly?y.togglePaletteMoreText:y.togglePaletteLessText),y.palette){F=y.palette.slice(0),z=Array.isArray(F[0])?F:[F],H={};for(var e=0;e<z.length;e++)for(var t=0;t<z[e].length;t++){var o=tinycolor(z[e][t]).toRgbString();H[o]=!0}}Y.toggleClass("sp-flat",w),Y.toggleClass("sp-input-disabled",!y.showInput),Y.toggleClass("sp-alpha-enabled",y.showAlpha),Y.toggleClass("sp-clear-enabled",xe),Y.toggleClass("sp-buttons-disabled",!y.showButtons),Y.toggleClass("sp-palette-buttons-disabled",!y.togglePaletteOnly),Y.toggleClass("sp-palette-disabled",!y.showPalette),Y.toggleClass("sp-palette-only",y.showPaletteOnly),Y.toggleClass("sp-initial-disabled",!y.showInitial),Y.addClass(y.className).addClass(y.containerClassName),Ze()}function ke(){if(x&&window.localStorage){try{var t=window.localStorage[x].split(",#");t.length>1&&(delete window.localStorage[x],e.each(t,function(e,t){Se(t)}))}catch(e){}try{U=window.localStorage[x].split(";")}catch(e){}}}function Se(t){if(_){var o=tinycolor(t).toRgbString();if(!H[o]&&-1===e.inArray(o,U))for(U.push(o);U.length>Z;)U.shift();if(x&&window.localStorage)try{window.localStorage[x]=U.join(";")}catch(e){}}}function Te(){var t=Le(),o=e.map(z,function(e,o){return l(e,t,"sp-palette-row sp-palette-row-"+o,y)});ke(),U&&o.push(l(function(){var e=[];if(y.showPalette)for(var t=0;t<U.length;t++){var o=tinycolor(U[t]).toRgbString();H[o]||e.push(U[t])}return e.reverse().slice(0,y.maxSelectionSize)}(),t,"sp-palette-row sp-palette-row-selection",y)),ie.html(o.join(""))}function Ee(){if(y.showInitial){var e=be,t=Le();se.html(l([e,t],t,"sp-palette-row-initial",y))}}function Oe(){(A<=0||O<=0||B<=0)&&Ze(),E=!0,Y.addClass($),j=null,q.trigger("dragstart.spectrum",[Le()])}function Ae(){E=!1,Y.removeClass($),q.trigger("dragstop.spectrum",[Le()])}function Me(){var e=re.val();if(null!==e&&""!==e||!xe){var t=tinycolor(e);t.isValid()?(Ie(t),Fe(),Ue()):re.addClass("sp-validation-error")}else Ie(null),Fe(),Ue()}function Be(){T?De():Re()}function Re(){var t=e.Event("beforeShow.spectrum");T?Ze():(q.trigger(t,[Le()]),!1===k.beforeShow(Le())||t.isDefaultPrevented()||(function(){for(var e=0;e<n.length;e++)n[e]&&n[e].hide()}(),T=!0,e(W).on("keydown.spectrum",Ne),e(W).on("click.spectrum",Ve),e(window).on("resize.spectrum",S),pe.addClass("sp-active"),Y.removeClass("sp-hidden"),Ze(),ze(),be=Le(),Ee(),k.show(be),q.trigger("show.spectrum",[be])))}function Ne(e){27===e.keyCode&&De()}function Ve(e){2!=e.button&&(E||(we?Ue(!0):Pe(),De()))}function De(){T&&!w&&(T=!1,e(W).off("keydown.spectrum",Ne),e(W).off("click.spectrum",Ve),e(window).off("resize.spectrum",S),pe.removeClass("sp-active"),Y.addClass("sp-hidden"),k.hide(Le()),q.trigger("hide.spectrum",[Le()]))}function Pe(){Ie(be,!0),Ue(!0)}function Ie(e,t){var o,n;tinycolor.equals(e,Le())?ze():(!e&&xe?_e=!0:(_e=!1,n=(o=tinycolor(e)).toHsv(),D=n.h%360/360,P=n.s,I=n.v,L=n.a),ze(),o&&o.isValid()&&!t&&(ye=y.preferredFormat||o.getFormat()))}function Le(e){return e=e||{},xe&&_e?null:tinycolor.fromRatio({h:D,s:P,v:I,a:Math.round(1e3*L)/1e3},{format:e.format||ye})}function Fe(){ze(),k.move(Le()),q.trigger("move.spectrum",[Le()])}function ze(){re.removeClass("sp-validation-error"),He();var e=tinycolor.fromRatio({h:D,s:1,v:1});K.css("background-color",e.toHexString());var t=ye;L<1&&(0!==L||"name"!==t)&&("hex"!==t&&"hex3"!==t&&"hex6"!==t&&"name"!==t||(t="rgb"));var o=Le({format:t}),n="";if(fe.removeClass("sp-clear-display"),fe.css("background-color","transparent"),!o&&xe)fe.addClass("sp-clear-display");else{var s=o.toHexString(),a=o.toRgbString();if(i||1===o.alpha?fe.css("background-color",a):(fe.css("background-color","transparent"),fe.css("filter",o.toFilter())),y.showAlpha){var l=o.toRgb();l.a=0;var c=tinycolor(l).toRgbString(),d="linear-gradient(left, "+c+", "+s+")";r?te.css("filter",tinycolor(c).toFilter({gradientType:1},s)):(te.css("background","-webkit-"+d),te.css("background","-moz-"+d),te.css("background","-ms-"+d),te.css("background","linear-gradient(to right, "+c+", "+s+")"))}n=o.toString(t)}y.showInput&&re.val(n),y.showPalette&&Te(),Ee()}function He(){var e=P,t=I;if(xe&&_e)ne.hide(),ee.hide(),J.hide();else{ne.show(),ee.show(),J.show();var o=e*O,n=A-t*A;o=Math.max(-M,Math.min(O-M,o-M)),n=Math.max(-M,Math.min(A-M,n-M)),J.css({top:n+"px",left:o+"px"});var r=L*R;ne.css({left:r-N/2+"px"});var i=D*B;ee.css({top:i-V+"px"})}}function Ue(e){var t=Le(),o="",n=!tinycolor.equals(t,be);t&&(o=t.toString(ye),Se(t)),ue&&q.val(o),e&&n&&(k.change(t),q.trigger("change",[t]))}function Ze(){T&&(O=K.width(),A=K.height(),M=J.height(),Q.width(),B=Q.height(),V=ee.height(),R=oe.width(),N=ne.width(),w||(Y.css("position","absolute"),y.offset?Y.offset(y.offset):Y.offset(function(t,o){var n=0,r=t.outerWidth(),i=t.outerHeight(),s=o.outerHeight(),a=t[0].ownerDocument,l=a.documentElement,c=l.clientWidth+e(a).scrollLeft(),d=l.clientHeight+e(a).scrollTop(),u=o.offset(),h=u.left,m=u.top;return m+=s,h-=Math.min(h,h+r>c&&c>r?Math.abs(h+r-c):0),{top:m-=Math.min(m,m+i>d&&d>i?Math.abs(i+s-n):n),bottom:u.bottom,left:h,right:u.right,width:u.width,height:u.height}}(Y,ge))),He(),y.showPalette&&Te(),q.trigger("reflow.spectrum"))}function $e(){De(),G=!0,q.attr("disabled",!0),ge.addClass("sp-disabled")}!function(){if(r&&Y.find("*:not(input)").attr("unselectable","on"),Ce(),me&&q.after(pe).hide(),xe||le.hide(),w)q.after(Y).hide();else{var t="parent"===y.appendTo?q.parent():e(y.appendTo);1!==t.length&&(t=e("body")),t.append(Y)}function o(t){return t.data&&t.data.ignore?(Ie(e(t.target).closest(".sp-thumb-el").data("color")),Fe()):(Ie(e(t.target).closest(".sp-thumb-el").data("color")),Fe(),y.hideAfterPaletteSelect?(Ue(!0),De()):Ue()),!1}ke(),ge.on("click.spectrum touchstart.spectrum",function(t){G||Be(),t.stopPropagation(),e(t.target).is("input")||t.preventDefault()}),(q.is(":disabled")||!0===y.disabled)&&$e(),Y.on("click",u),re.on("change",Me),re.on("paste",function(){setTimeout(Me,1)}),re.on("keydown",function(e){13==e.keyCode&&Me()}),ae.text(y.cancelText),ae.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),Pe(),De()}),le.attr("title",y.clearText),le.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),_e=!0,Fe(),w&&Ue(!0)}),ce.text(y.chooseText),ce.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),r&&re.is(":focus")&&re.trigger("change"),!re.hasClass("sp-validation-error")&&(Ue(!0),De())}),de.text(y.showPaletteOnly?y.togglePaletteMoreText:y.togglePaletteLessText),de.on("click.spectrum",function(e){e.stopPropagation(),e.preventDefault(),y.showPaletteOnly=!y.showPaletteOnly,y.showPaletteOnly||w||Y.css("left","-="+(X.outerWidth(!0)+5)),Ce()}),m(oe,function(e,t,o){L=e/R,_e=!1,o.shiftKey&&(L=Math.round(10*L)/10),Fe()},Oe,Ae),m(Q,function(e,t){D=parseFloat(t/B),_e=!1,y.showAlpha||(L=1),Fe()},Oe,Ae),m(K,function(e,t,o){if(o.shiftKey){if(!j){var n=P*O,r=A-I*A,i=Math.abs(e-n)>Math.abs(t-r);j=i?"x":"y"}}else j=null;var s=!j||"y"===j;(!j||"x"===j)&&(P=parseFloat(e/O)),s&&(I=parseFloat((A-t)/A)),_e=!1,y.showAlpha||(L=1),Fe()},Oe,Ae),ve?(Ie(ve),ze(),ye=y.preferredFormat||tinycolor(ve).format,Se(ve)):ze(),w&&Re();var n=r?"mousedown.spectrum":"click.spectrum touchstart.spectrum";ie.on(n,".sp-thumb-el",o),se.on(n,".sp-thumb-el:nth-child(1)",{ignore:!0},o)}();var je={show:Re,hide:De,toggle:Be,reflow:Ze,option:function(o,n){return o===t?e.extend({},y):n===t?y[o]:(y[o]=n,"preferredFormat"===o&&(ye=y.preferredFormat),void Ce())},enable:function(){G=!1,q.attr("disabled",!1),ge.removeClass("sp-disabled")},disable:$e,offset:function(e){y.offset=e,Ze()},set:function(e){Ie(e),Ue()},get:Le,destroy:function(){q.show(),ge.off("click.spectrum touchstart.spectrum"),Y.remove(),pe.remove(),n[je.id]=null},container:Y};return je.id=n.push(je)-1,je}function d(){}function u(e){e.stopPropagation()}function h(e,t){var o=Array.prototype.slice,n=o.call(arguments,2);return function(){return e.apply(t,n.concat(o.call(arguments)))}}function m(t,o,n,i){o=o||function(){},n=n||function(){},i=i||function(){};var s=document,a=!1,l={},c=0,d=0,u="ontouchstart"in window,h={};function m(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),e.returnValue=!1}function p(e){if(a){if(r&&s.documentMode<9&&!e.button)return g();var n=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0],i=n&&n.pageX||e.pageX,h=n&&n.pageY||e.pageY,p=Math.max(0,Math.min(i-l.left,d)),f=Math.max(0,Math.min(h-l.top,c));u&&m(e),o.apply(t,[p,f,e])}}function g(){a&&(e(s).off(h),e(s.body).removeClass("sp-dragging"),setTimeout(function(){i.apply(t,arguments)},0)),a=!1}h.selectstart=m,h.dragstart=m,h["touchmove mousemove"]=p,h["touchend mouseup"]=g,e(t).on("touchstart mousedown",function(o){(o.which?3==o.which:2==o.button)||a||!1!==n.apply(t,arguments)&&(a=!0,c=e(t).height(),d=e(t).width(),l=e(t).offset(),e(s).on(h),e(s.body).addClass("sp-dragging"),p(o),m(o))})}function p(){return e.fn.spectrum.inputTypeColorSupport()}var g="spectrum.id";e.fn.spectrum=function(t,o){if("string"==typeof t){var r=this,i=Array.prototype.slice.call(arguments,1);return this.each(function(){var o=n[e(this).data(g)];if(o){var s=o[t];if(!s)throw new Error("Spectrum: no such method: '"+t+"'");"get"==t?r=o.get():"container"==t?r=o.container:"option"==t?r=o.option.apply(o,i):"destroy"==t?(o.destroy(),e(this).removeData(g)):s.apply(o,i)}}),r}return this.spectrum("destroy").each(function(){var o=c(this,e.extend({},e(this).data(),t));e(this).data(g,o.id)})},e.fn.spectrum.load=!0,e.fn.spectrum.loadOpts={},e.fn.spectrum.draggable=m,e.fn.spectrum.defaults=o,e.fn.spectrum.inputTypeColorSupport=function t(){if(void 0===t._cachedResult){var o=e("<input type='color'/>")[0];t._cachedResult="color"===o.type&&""!==o.value}return t._cachedResult},e.spectrum={},e.spectrum.localization={},e.spectrum.palettes={},e.fn.spectrum.processNativeColorInputs=function(){var t=e("input[type=color]");t.length&&!p()&&t.spectrum({preferredFormat:"hex6"})},function(){var e=/^[\s,#]+/,t=/\s+$/,o=0,n=Math,r=n.round,i=n.min,s=n.max,a=n.random,l=function(a,c){if(c=c||{},(a=a||"")instanceof l)return a;if(!(this instanceof l))return new l(a,c);var d=function(o){var r={r:0,g:0,b:0},a=1,l=!1,c=!1;return"string"==typeof o&&(o=function(o){o=o.replace(e,"").replace(t,"").toLowerCase();var n,r=!1;if(T[o])o=T[o],r=!0;else if("transparent"==o)return{r:0,g:0,b:0,a:0,format:"name"};return(n=L.rgb.exec(o))?{r:n[1],g:n[2],b:n[3]}:(n=L.rgba.exec(o))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=L.hsl.exec(o))?{h:n[1],s:n[2],l:n[3]}:(n=L.hsla.exec(o))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=L.hsv.exec(o))?{h:n[1],s:n[2],v:n[3]}:(n=L.hsva.exec(o))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=L.hex8.exec(o))?{a:V(n[1]),r:B(n[2]),g:B(n[3]),b:B(n[4]),format:r?"name":"hex8"}:(n=L.hex6.exec(o))?{r:B(n[1]),g:B(n[2]),b:B(n[3]),format:r?"name":"hex"}:!!(n=L.hex3.exec(o))&&{r:B(n[1]+""+n[1]),g:B(n[2]+""+n[2]),b:B(n[3]+""+n[3]),format:r?"name":"hex"}}(o)),"object"==typeof o&&(o.hasOwnProperty("r")&&o.hasOwnProperty("g")&&o.hasOwnProperty("b")?(d=o.r,u=o.g,h=o.b,r={r:255*A(d,255),g:255*A(u,255),b:255*A(h,255)},l=!0,c="%"===String(o.r).substr(-1)?"prgb":"rgb"):o.hasOwnProperty("h")&&o.hasOwnProperty("s")&&o.hasOwnProperty("v")?(o.s=N(o.s),o.v=N(o.v),r=function(e,t,o){e=6*A(e,360),t=A(t,100),o=A(o,100);var r=n.floor(e),i=e-r,s=o*(1-t),a=o*(1-i*t),l=o*(1-(1-i)*t),c=r%6;return{r:255*[o,a,s,s,l,o][c],g:255*[l,o,o,a,s,s][c],b:255*[s,s,l,o,o,a][c]}}(o.h,o.s,o.v),l=!0,c="hsv"):o.hasOwnProperty("h")&&o.hasOwnProperty("s")&&o.hasOwnProperty("l")&&(o.s=N(o.s),o.l=N(o.l),r=function(e,t,o){var n,r,i;function s(e,t,o){return o<0&&(o+=1),o>1&&(o-=1),o<1/6?e+6*(t-e)*o:o<.5?t:o<2/3?e+(t-e)*(2/3-o)*6:e}if(e=A(e,360),t=A(t,100),o=A(o,100),0===t)n=r=i=o;else{var a=o<.5?o*(1+t):o+t-o*t,l=2*o-a;n=s(l,a,e+1/3),r=s(l,a,e),i=s(l,a,e-1/3)}return{r:255*n,g:255*r,b:255*i}}(o.h,o.s,o.l),l=!0,c="hsl"),o.hasOwnProperty("a")&&(a=o.a)),a=O(a),{ok:l,format:o.format||c,r:i(255,s(r.r,0)),g:i(255,s(r.g,0)),b:i(255,s(r.b,0)),a};var d,u,h}(a);this._originalInput=a,this._r=d.r,this._g=d.g,this._b=d.b,this._a=d.a,this._roundA=r(1e3*this._a)/1e3,this._format=c.format||d.format,this._gradientType=c.gradientType,this._r<1&&(this._r=r(this._r)),this._g<1&&(this._g=r(this._g)),this._b<1&&(this._b=r(this._b)),this._ok=d.ok,this._tc_id=o++};function c(e,t,o){e=A(e,255),t=A(t,255),o=A(o,255);var n,r,a=s(e,t,o),l=i(e,t,o),c=(a+l)/2;if(a==l)n=r=0;else{var d=a-l;switch(r=c>.5?d/(2-a-l):d/(a+l),a){case e:n=(t-o)/d+(t<o?6:0);break;case t:n=(o-e)/d+2;break;case o:n=(e-t)/d+4}n/=6}return{h:n,s:r,l:c}}function d(e,t,o){e=A(e,255),t=A(t,255),o=A(o,255);var n,r,a=s(e,t,o),l=i(e,t,o),c=a,d=a-l;if(r=0===a?0:d/a,a==l)n=0;else{switch(a){case e:n=(t-o)/d+(t<o?6:0);break;case t:n=(o-e)/d+2;break;case o:n=(e-t)/d+4}n/=6}return{h:n,s:r,v:c}}function u(e,t,o,n){var i=[R(r(e).toString(16)),R(r(t).toString(16)),R(r(o).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function h(e,t,o,n){return[R((i=n,Math.round(255*parseFloat(i)).toString(16))),R(r(e).toString(16)),R(r(t).toString(16)),R(r(o).toString(16))].join("");var i}function m(e,t){t=0===t?0:t||10;var o=l(e).toHsl();return o.s-=t/100,o.s=M(o.s),l(o)}function p(e,t){t=0===t?0:t||10;var o=l(e).toHsl();return o.s+=t/100,o.s=M(o.s),l(o)}function g(e){return l(e).desaturate(100)}function f(e,t){t=0===t?0:t||10;var o=l(e).toHsl();return o.l+=t/100,o.l=M(o.l),l(o)}function v(e,t){t=0===t?0:t||10;var o=l(e).toRgb();return o.r=s(0,i(255,o.r-r(-t/100*255))),o.g=s(0,i(255,o.g-r(-t/100*255))),o.b=s(0,i(255,o.b-r(-t/100*255))),l(o)}function b(e,t){t=0===t?0:t||10;var o=l(e).toHsl();return o.l-=t/100,o.l=M(o.l),l(o)}function y(e,t){var o=l(e).toHsl(),n=(r(o.h)+t)%360;return o.h=n<0?360+n:n,l(o)}function w(e){var t=l(e).toHsl();return t.h=(t.h+180)%360,l(t)}function _(e){var t=l(e).toHsl(),o=t.h;return[l(e),l({h:(o+120)%360,s:t.s,l:t.l}),l({h:(o+240)%360,s:t.s,l:t.l})]}function x(e){var t=l(e).toHsl(),o=t.h;return[l(e),l({h:(o+90)%360,s:t.s,l:t.l}),l({h:(o+180)%360,s:t.s,l:t.l}),l({h:(o+270)%360,s:t.s,l:t.l})]}function C(e){var t=l(e).toHsl(),o=t.h;return[l(e),l({h:(o+72)%360,s:t.s,l:t.l}),l({h:(o+216)%360,s:t.s,l:t.l})]}function k(e,t,o){t=t||6,o=o||30;var n=l(e).toHsl(),r=360/o,i=[l(e)];for(n.h=(n.h-(r*t>>1)+720)%360;--t;)n.h=(n.h+r)%360,i.push(l(n));return i}function S(e,t){t=t||6;for(var o=l(e).toHsv(),n=o.h,r=o.s,i=o.v,s=[],a=1/t;t--;)s.push(l({h:n,s:r,v:i})),i=(i+a)%1;return s}l.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},setAlpha:function(e){return this._a=O(e),this._roundA=r(1e3*this._a)/1e3,this},toHsv:function(){var e=d(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=d(this._r,this._g,this._b),t=r(360*e.h),o=r(100*e.s),n=r(100*e.v);return 1==this._a?"hsv("+t+", "+o+"%, "+n+"%)":"hsva("+t+", "+o+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=c(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=c(this._r,this._g,this._b),t=r(360*e.h),o=r(100*e.s),n=r(100*e.l);return 1==this._a?"hsl("+t+", "+o+"%, "+n+"%)":"hsla("+t+", "+o+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return u(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(){return h(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:r(this._r),g:r(this._g),b:r(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+r(this._r)+", "+r(this._g)+", "+r(this._b)+")":"rgba("+r(this._r)+", "+r(this._g)+", "+r(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:r(100*A(this._r,255))+"%",g:r(100*A(this._g,255))+"%",b:r(100*A(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+r(100*A(this._r,255))+"%, "+r(100*A(this._g,255))+"%, "+r(100*A(this._b,255))+"%)":"rgba("+r(100*A(this._r,255))+"%, "+r(100*A(this._g,255))+"%, "+r(100*A(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(E[u(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+h(this._r,this._g,this._b,this._a),o=t,n=this._gradientType?"GradientType = 1, ":"";return e&&(o=l(e).toHex8String()),"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+o+")"},toString:function(e){var t=!!e;e=e||this._format;var o=!1,n=this._a<1&&this._a>=0;return t||!n||"hex"!==e&&"hex6"!==e&&"hex3"!==e&&"name"!==e?("rgb"===e&&(o=this.toRgbString()),"prgb"===e&&(o=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(o=this.toHexString()),"hex3"===e&&(o=this.toHexString(!0)),"hex8"===e&&(o=this.toHex8String()),"name"===e&&(o=this.toName()),"hsl"===e&&(o=this.toHslString()),"hsv"===e&&(o=this.toHsvString()),o||this.toHexString()):"name"===e&&0===this._a?this.toName():this.toRgbString()},_applyModification:function(e,t){var o=e.apply(null,[this].concat([].slice.call(t)));return this._r=o._r,this._g=o._g,this._b=o._b,this.setAlpha(o._a),this},lighten:function(){return this._applyModification(f,arguments)},brighten:function(){return this._applyModification(v,arguments)},darken:function(){return this._applyModification(b,arguments)},desaturate:function(){return this._applyModification(m,arguments)},saturate:function(){return this._applyModification(p,arguments)},greyscale:function(){return this._applyModification(g,arguments)},spin:function(){return this._applyModification(y,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(w,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(C,arguments)},triad:function(){return this._applyCombination(_,arguments)},tetrad:function(){return this._applyCombination(x,arguments)}},l.fromRatio=function(e,t){if("object"==typeof e){var o={};for(var n in e)e.hasOwnProperty(n)&&(o[n]="a"===n?e[n]:N(e[n]));e=o}return l(e,t)},l.equals=function(e,t){return!(!e||!t)&&l(e).toRgbString()==l(t).toRgbString()},l.random=function(){return l.fromRatio({r:a(),g:a(),b:a()})},l.mix=function(e,t,o){o=0===o?0:o||50;var n,r=l(e).toRgb(),i=l(t).toRgb(),s=o/100,a=2*s-1,c=i.a-r.a,d=1-(n=((n=a*c==-1?a:(a+c)/(1+a*c))+1)/2),u={r:i.r*n+r.r*d,g:i.g*n+r.g*d,b:i.b*n+r.b*d,a:i.a*s+r.a*(1-s)};return l(u)},l.readability=function(e,t){var o=l(e),n=l(t),r=o.toRgb(),i=n.toRgb(),s=o.getBrightness(),a=n.getBrightness(),c=Math.max(r.r,i.r)-Math.min(r.r,i.r)+Math.max(r.g,i.g)-Math.min(r.g,i.g)+Math.max(r.b,i.b)-Math.min(r.b,i.b);return{brightness:Math.abs(s-a),color:c}},l.isReadable=function(e,t){var o=l.readability(e,t);return o.brightness>125&&o.color>500},l.mostReadable=function(e,t){for(var o=null,n=0,r=!1,i=0;i<t.length;i++){var s=l.readability(e,t[i]),a=s.brightness>125&&s.color>500,c=s.brightness/125*3+s.color/500;(a&&!r||a&&r&&c>n||!a&&!r&&c>n)&&(r=a,n=c,o=l(t[i]))}return o};var T=l.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},E=l.hexNames=function(e){var t={};for(var o in e)e.hasOwnProperty(o)&&(t[e[o]]=o);return t}(T);function O(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function A(e,t){(function(e){return"string"==typeof e&&-1!=e.indexOf(".")&&1===parseFloat(e)})(e)&&(e="100%");var o=function(e){return"string"==typeof e&&-1!=e.indexOf("%")}(e);return e=i(t,s(0,parseFloat(e))),o&&(e=parseInt(e*t,10)/100),n.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function M(e){return i(1,s(0,e))}function B(e){return parseInt(e,16)}function R(e){return 1==e.length?"0"+e:""+e}function N(e){return e<=1&&(e=100*e+"%"),e}function V(e){return B(e)/255}var D,P,I,L=(P="[\\s|\\(]+("+(D="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",I="[\\s|\\(]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")[,|\\s]+("+D+")\\s*\\)?",{rgb:new RegExp("rgb"+P),rgba:new RegExp("rgba"+I),hsl:new RegExp("hsl"+P),hsla:new RegExp("hsla"+I),hsv:new RegExp("hsv"+P),hsva:new RegExp("hsva"+I),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});window.tinycolor=l}(),e(function(){e.fn.spectrum.load&&e.fn.spectrum.processNativeColorInputs()})},void 0===(i=n.apply(t,r))||(e.exports=i)}()},37905(e,t,o){o(69036)},69036(){!function(){"use strict";var e=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.ModelManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":t;var o,n,r,i})(t)===e,o=e=>t=>typeof t===e,n=e=>t=>e===t,r=t("string"),i=t("object"),s=t("array"),a=n(null),l=o("boolean"),c=n(void 0),d=e=>!(e=>null==e)(e),u=o("function"),h=o("number"),m=()=>{},p=e=>()=>e,g=e=>e,f=(e,t)=>e===t;function v(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const b=e=>t=>!e(t),y=e=>e(),w=p(!1),_=p(!0);class x{constructor(e,t){this.tag=e,this.value=t}static some(e){return new x(!0,e)}static none(){return x.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?x.some(e(this.value)):x.none()}bind(e){return this.tag?e(this.value):x.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:x.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return d(e)?x.some(e):x.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}x.singletonNone=new x(!1);const C=Array.prototype.slice,k=Array.prototype.indexOf,S=Array.prototype.push,T=(e,t)=>{return o=e,n=t,k.call(o,n)>-1;var o,n},E=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},O=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},A=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n},M=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},B=(e,t)=>{const o=[],n=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];(t(i,r)?o:n).push(i)}return{pass:o,fail:n}},R=(e,t)=>{const o=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t(r,n)&&o.push(r)}return o},N=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,(e,n)=>{o=t(o,e,n)}),o),V=(e,t,o)=>(M(e,(e,n)=>{o=t(o,e,n)}),o),D=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n<r;n++){const r=e[n];if(t(r,n))return x.some(r);if(o(r,n))break}return x.none()})(e,t,w),P=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return x.some(o);return x.none()},I=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!s(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);S.apply(t,e[o])}return t},L=(e,t)=>I(A(e,t)),F=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},z=(e,t)=>{const o={};for(let n=0,r=e.length;n<r;n++){const r=e[n];o[String(r)]=t(r,n)}return o},H=(e,t)=>t>=0&&t<e.length?x.some(e[t]):x.none(),U=e=>H(e,0),Z=e=>H(e,e.length-1),$=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return x.none()},j=Object.keys,W=Object.hasOwnProperty,q=(e,t)=>{const o=j(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}},G=(e,t)=>Y(e,(e,o)=>({k:o,v:t(e,o)})),Y=(e,t)=>{const o={};return q(e,(e,n)=>{const r=t(e,n);o[r.k]=r.v}),o},X=(e,t)=>{const o=[];return q(e,(e,n)=>{o.push(t(e,n))}),o},K=e=>X(e,g),J=(e,t)=>W.call(e,t),Q=e=>{if(!s(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return M(e,(n,r)=>{const i=j(n);if(1!==i.length)throw new Error("one and only one name per case");const a=i[0],l=n[a];if(void 0!==o[a])throw new Error("duplicate key detected:"+a);if("cata"===a)throw new Error("cannot have a case named cata (sorry)");if(!s(l))throw new Error("case arguments must be an array");t.push(a),o[a]=(...o)=>{const n=o.length;if(n!==l.length)throw new Error("Wrong number of arguments to case "+a+". Expected "+l.length+" ("+l+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const n=j(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!F(t,e=>T(n,e)))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[a].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:a,params:o})}}}}),o},ee=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},te=e=>e.slice(0).sort(),oe=(e,t)=>{const o=R(t,t=>!T(e,t));o.length>0&&(e=>{throw new Error("Unsupported keys for object: "+te(e).join(", "))})(o)},ne=e=>((e,t)=>((e,t,o)=>{if(0===t.length)throw new Error("You must specify at least one required field.");return((e,t)=>{if(!s(t))throw new Error("The "+e+" fields must be an array. Was: "+t+".");M(t,t=>{if(!r(t))throw new Error("The value "+t+" in the "+e+" fields was not a string.")})})("required",t),(e=>{const t=te(e);D(t,(e,o)=>o<t.length-1&&e===t[o+1]).each(e=>{throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+t.join(", ")+"].")})})(t),n=>{const r=j(n);F(t,e=>T(r,e))||((e,t)=>{throw new Error("All required keys ("+te(e).join(", ")+") were not specified. Specified keys were: "+te(t).join(", ")+".")})(t,r),e(t,r);const i=R(t,e=>!o.validate(n[e],e));return i.length>0&&((e,t)=>{throw new Error("All values need to be of type: "+t+". Keys ("+te(e).join(", ")+") were not.")})(i,o.label),n}})(e,t,{validate:u,label:"function"}))(oe,e),re=e=>{const t=t=>t(e),o=p(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:_,isError:w,map:t=>se.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>x.some(e)};return r},ie=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:w,isError:_,map:t,mapError:t=>se.error(t(e)),bind:t,exists:w,forall:_,getOr:g,or:g,getOrThunk:y,orThunk:y,getOrDie:(n=String(e),()=>{throw new Error(n)}),each:m,toOptional:x.none};var n;return o},se={value:re,error:ie,fromOption:(e,t)=>e.fold(()=>ie(t),re)},ae="undefined"!=typeof window?window:Function("return this;")(),le=e=>{const t=e.replace(/\./g,"-");return{resolve:e=>t+"-"+e}},ce=(e,t,o=f)=>e.exists(e=>o(e,t)),de=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},ue=(e,t)=>e?x.some(t):x.none(),he=(e,t)=>((e,t)=>{let o=null!=t?t:ae;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t),me=()=>{const e=(e=>{const t=ee(x.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(x.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(x.some(e))}}})(m);return{...e,on:t=>e.get().each(t)}},pe=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,ge=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!c(n)||r+t.length<=n)},fe=(e,t)=>pe(e,t,0),ve=(e,t)=>pe(e,t,e.length-t.length),be=(e=>t=>t.replace(e,""))(/^\s+|\s+$/g),ye=e=>e.length>0,we=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},_e=["tfoot","thead","tbody","colgroup"],xe=(e,t,o)=>({element:e,rowspan:t,colspan:o}),Ce=(e,t,o)=>({element:e,cells:t,section:o}),ke=(e,t,o)=>({element:e,isNew:t,isLocked:o}),Se=(e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}),Te=(e,t,o)=>{const n=e.cells,r=n.slice(0,t),i=n.slice(t),s=r.concat(o).concat(i);return Ae(e,s)},Ee=(e,t,o)=>Te(e,t,[o]),Oe=(e,t,o)=>{e.cells[t]=o},Ae=(e,t)=>Se(e.element,t,e.section,e.isNew),Me=(e,t)=>e.cells[t],Be=(e,t)=>Me(e,t).element,Re=e=>e.cells.length,Ne=e=>{const t=B(e,e=>"colgroup"===e.section);return{rows:t.fail,cols:t.pass}},Ve=(e,t,o)=>{const n=A(e.cells,o);return Se(t(e.element),n,e.section,!0)},De=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Pe={fromHtml:(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return De(o.childNodes[0])},fromTag:(e,t)=>{const o=(t||document).createElement(e);return De(o)},fromText:(e,t)=>{const o=(t||document).createTextNode(e);return De(o)},fromDom:De,fromPoint:(e,t,o)=>x.from(e.dom.elementFromPoint(t,o)).map(De)},Ie=(e,t)=>{const o=e.document.createRange();return o.selectNode(t.dom),o},Le=(e,t)=>{const o=e.document.createRange();return Fe(o,t),o},Fe=(e,t)=>e.selectNodeContents(t.dom),ze=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold(e=>{r.setStartBefore(e.dom)},(e,t)=>{r.setStart(e.dom,t)},e=>{r.setStartAfter(e.dom)}),((e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})})(n,o),n},He=(e,t,o,n,r)=>{const i=e.document.createRange();return i.setStart(t.dom,o),i.setEnd(n.dom,r),i},Ue=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),Ze=Q([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),$e=(e,t,o)=>t(Pe.fromDom(o.startContainer),o.startOffset,Pe.fromDom(o.endContainer),o.endOffset),je=(e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:p(e),rtl:x.none}),relative:(t,o)=>({ltr:we(()=>ze(e,t,o)),rtl:we(()=>x.some(ze(e,o,t)))}),exact:(t,o,n,r)=>({ltr:we(()=>He(e,t,o,n,r)),rtl:we(()=>x.some(He(e,n,r,t,o)))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter(e=>!1===e.collapsed).map(e=>Ze.rtl(Pe.fromDom(e.endContainer),e.endOffset,Pe.fromDom(e.startContainer),e.startOffset)).getOrThunk(()=>$e(0,Ze.ltr,o)):$e(0,Ze.ltr,o)})(0,o)},We=(e,t)=>je(e,t).match({ltr:(t,o,n,r)=>{const i=e.document.createRange();return i.setStart(t.dom,o),i.setEnd(n.dom,r),i},rtl:(t,o,n,r)=>{const i=e.document.createRange();return i.setStart(n.dom,r),i.setEnd(t.dom,o),i}});Ze.ltr,Ze.rtl;const qe=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Ge=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,Ye=(e,t)=>{const o=void 0===t?document:t.dom;return Ge(o)?x.none():x.from(o.querySelector(e)).map(Pe.fromDom)},Xe=(e,t)=>e.dom===t.dom,Ke=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Je=qe,Qe=()=>et(0,0),et=(e,t)=>({major:e,minor:t}),tt={nu:et,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?Qe():((e,t)=>{const o=((e,t)=>{for(let o=0;o<e.length;o++){const n=e[o];if(n.test(t))return n}})(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return et(n(1),n(2))})(e,o)},unknown:Qe},ot=(e,t)=>{const o=String(t).toLowerCase();return D(e,e=>e.search(o))},nt=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,rt=e=>t=>ge(t,e),it=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>ge(e,"edge/")&&ge(e,"chrome")&&ge(e,"safari")&&ge(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,nt],search:e=>ge(e,"chrome")&&!ge(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>ge(e,"msie")||ge(e,"trident")},{name:"Opera",versionRegexes:[nt,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:rt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:rt("firefox")},{name:"Safari",versionRegexes:[nt,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(ge(e,"safari")||ge(e,"mobile/"))&&ge(e,"applewebkit")}],st=[{name:"Windows",search:rt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>ge(e,"iphone")||ge(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:rt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:rt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:rt("linux"),versionRegexes:[]},{name:"Solaris",search:rt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:rt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:rt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],at={browsers:p(it),oses:p(st)},lt="Edge",ct="Chromium",dt="Opera",ut="Firefox",ht="Safari",mt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(lt),isChromium:n(ct),isIE:n("IE"),isOpera:n(dt),isFirefox:n(ut),isSafari:n(ht)}},pt=()=>mt({current:void 0,version:tt.unknown()}),gt=mt,ft=(p(lt),p(ct),p("IE"),p(dt),p(ut),p(ht),"Windows"),vt="Android",bt="Linux",yt="macOS",wt="Solaris",_t="FreeBSD",xt="ChromeOS",Ct=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(ft),isiOS:n("iOS"),isAndroid:n(vt),isMacOS:n(yt),isLinux:n(bt),isSolaris:n(wt),isFreeBSD:n(_t),isChromeOS:n(xt)}},kt=()=>Ct({current:void 0,version:tt.unknown()}),St=Ct,Tt=(p(ft),p("iOS"),p(vt),p(bt),p(yt),p(wt),p(_t),p(xt),e=>window.matchMedia(e).matches);let Et=we(()=>((e,t,o)=>{const n=at.browsers(),r=at.oses(),i=t.bind(e=>((e,t)=>$(t.brands,t=>{const o=t.brand.toLowerCase();return D(e,e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())}).map(e=>({current:e.name,version:tt.nu(parseInt(t.version,10),0)}))}))(n,e)).orThunk(()=>((e,t)=>ot(e,t).map(e=>{const o=tt.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(n,e)).fold(pt,gt),s=((e,t)=>ot(e,t).map(e=>{const o=tt.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(r,e).fold(kt,St),a=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),i=e.isiOS()&&!r,s=e.isiOS()||e.isAndroid(),a=s||n("(pointer:coarse)"),l=r||!i&&s&&n("(min-device-width:768px)"),c=i||s&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:p(r),isiPhone:p(i),isTablet:p(l),isPhone:p(c),isTouch:p(a),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:p(d),isDesktop:p(u)}})(s,i,e,o);return{browser:i,os:s,deviceType:a}})(window.navigator.userAgent,x.from(window.navigator.userAgentData),Tt));const Ot=()=>Et(),At=Object.getPrototypeOf,Mt=e=>{const t=he("ownerDocument.defaultView",e);return i(e)&&((e=>((e,t)=>{const o=((e,t)=>he(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(At(e).constructor.name))},Bt=e=>e.dom.nodeName.toLowerCase(),Rt=e=>e.dom.nodeType,Nt=e=>t=>Rt(t)===e,Vt=e=>8===Rt(e)||"#comment"===Bt(e),Dt=e=>Pt(e)&&Mt(e.dom),Pt=Nt(1),It=Nt(3),Lt=Nt(9),Ft=Nt(11),zt=e=>t=>Pt(t)&&Bt(t)===e,Ht=e=>Pe.fromDom(e.dom.ownerDocument),Ut=e=>Lt(e)?e:Ht(e),Zt=e=>x.from(e.dom.parentNode).map(Pe.fromDom),$t=e=>x.from(e.dom.parentElement).map(Pe.fromDom),jt=(e,t)=>{const o=u(t)?t:w;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=Pe.fromDom(e);if(r.push(t),!0===o(t))break;n=e}return r},Wt=e=>x.from(e.dom.previousSibling).map(Pe.fromDom),qt=e=>x.from(e.dom.nextSibling).map(Pe.fromDom),Gt=e=>A(e.dom.childNodes,Pe.fromDom),Yt=(e,t)=>{const o=e.dom.childNodes;return x.from(o[t]).map(Pe.fromDom)},Xt=e=>Ft(e)&&d(e.dom.host),Kt=e=>Pe.fromDom(e.dom.getRootNode()),Jt=e=>Pe.fromDom(e.dom.host),Qt=e=>{const t=Pe.fromDom((e=>{if(d(e.target)){const t=Pe.fromDom(e.target);if(Pt(t)&&d(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return U(t)}}return x.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=(i=n,s=o,(...e)=>i(s.apply(null,e)));var i,s;return((e,t,o,n,r,i,s)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:i,raw:s}))(t,e.clientX,e.clientY,o,n,r,e)},eo=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},to=_,oo=(e,t,o)=>((e,t,o,n)=>((e,t,o,n,r)=>{const i=((e,t)=>o=>{e(o)&&t(Qt(o))})(o,n);return e.dom.addEventListener(t,i,r),{unbind:v(eo,e,t,i,r)}})(e,t,o,n,!1))(e,t,to,o),no=Qt,ro=(e,t)=>{Zt(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},io=(e,t)=>{qt(e).fold(()=>{Zt(e).each(e=>{ao(e,t)})},e=>{ro(e,t)})},so=(e,t)=>{const o=(e=>Yt(e,0))(e);o.fold(()=>{ao(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},ao=(e,t)=>{e.dom.appendChild(t.dom)},lo=(e,t)=>{ro(e,t),ao(t,e)},co=(e,t)=>{M(t,(o,n)=>{const r=0===n?e:t[n-1];io(r,o)})},uo=(e,t)=>{M(t,t=>{ao(e,t)})},ho=(e,t,o)=>{if(!(r(o)||l(o)||h(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},mo=(e,t,o)=>{ho(e.dom,t,o)},po=(e,t)=>{const o=e.dom;q(t,(e,t)=>{ho(o,t,e)})},go=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},fo=(e,t)=>x.from(go(e,t)),vo=(e,t)=>{e.dom.removeAttribute(t)},bo=e=>V(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}),yo=e=>{e.dom.textContent="",M(Gt(e),e=>{wo(e)})},wo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},_o=e=>{const t=Gt(e);t.length>0&&co(e,t),wo(e)},xo=(e,t)=>Pe.fromDom(e.dom.cloneNode(t)),Co=e=>xo(e,!1),ko=e=>xo(e,!0),So=(e,t)=>{const o=Pe.fromTag(t),n=bo(e);return po(o,n),o},To=e=>void 0!==e.style&&u(e.style.getPropertyValue),Eo=e=>{const t=It(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=Kt(e);return Xt(t)?x.some(t):x.none()})(Pe.fromDom(t)).fold(()=>o.body.contains(t),(n=Eo,r=Jt,e=>n(r(e))));var n,r},Oo=(e,t,o)=>{if(!r(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);To(e)&&e.style.setProperty(t,o)},Ao=(e,t,o)=>{const n=e.dom;Oo(n,t,o)},Mo=(e,t)=>{const o=e.dom;q(t,(e,t)=>{Oo(o,t,e)})},Bo=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||Eo(e)?n:Ro(o,t)},Ro=(e,t)=>To(e)?e.style.getPropertyValue(t):"",No=(e,t)=>{const o=e.dom,n=Ro(o,t);return x.from(n).filter(e=>e.length>0)},Vo=(e,t)=>{((e,t)=>{To(e)&&e.style.removeProperty(t)})(e.dom,t),ce(fo(e,"style").map(be),"")&&vo(e,"style")},Do=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=Bo(o,e);return parseFloat(t)||0}return n},n=(e,t)=>V(t,(t,o)=>{const n=Bo(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r},0);return{set:(t,o)=>{if(!h(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;To(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},Po=(e,t,o)=>((e,t)=>(e=>{const t=parseFloat(e);return isNaN(t)?x.none():x.some(t)})(e).getOr(t))(Bo(e,t),o),Io=Do("height",e=>{const t=e.dom;return Eo(e)?t.getBoundingClientRect().height:t.offsetHeight}),Lo=e=>Io.get(e),Fo=e=>Io.getOuter(e),zo=Do("width",e=>e.dom.offsetWidth);Do("width",e=>{const t=e.dom;return Eo(e)?t.getBoundingClientRect().width:t.offsetWidth});const Ho=e=>zo.get(e),Uo=e=>zo.getOuter(e),Zo=e=>((e,t)=>{const o=e.dom,n=o.getBoundingClientRect().width||o.offsetWidth;return"border-box"===t?n:((e,t,o,n)=>t-Po(e,`padding-${o}`,0)-Po(e,`padding-${n}`,0)-Po(e,`border-${o}-width`,0)-Po(e,`border-${n}-width`,0))(e,n,"left","right")})(e,"content-box"),$o=(e,t)=>({left:e,top:t,translate:(o,n)=>$o(e+o,t+n)}),jo=$o,Wo=(e,t)=>void 0!==e?e:void 0!==t?t:0,qo=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return jo(o.offsetLeft,o.offsetTop);const i=Wo(null==n?void 0:n.pageYOffset,r.scrollTop),s=Wo(null==n?void 0:n.pageXOffset,r.scrollLeft),a=Wo(r.clientTop,o.clientTop),l=Wo(r.clientLeft,o.clientLeft);return Go(e).translate(s-l,i-a)},Go=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?jo(o.offsetLeft,o.offsetTop):Eo(e)?(e=>{const t=e.getBoundingClientRect();return jo(t.left,t.top)})(t):jo(0,0)},Yo=(e=>{const t=t=>e(t)?x.from(t.dom.nodeValue):x.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(It),Xo=e=>Yo.get(e),Ko=e=>Yo.getOption(e),Jo=(e,t)=>Yo.set(e,t),Qo=(e,t)=>o=>"rtl"===en(o)?t:e,en=e=>"rtl"===Bo(e,"direction")?"rtl":"ltr";var tn=(e,t,o,n,r)=>e(o,n)?x.some(o):u(r)&&r(o)?x.none():t(o,n,r);const on=(e,t,o)=>{let n=e.dom;const r=u(o)?o:w;for(;n.parentNode;){n=n.parentNode;const e=Pe.fromDom(n);if(t(e))return x.some(e);if(r(e))break}return x.none()},nn=(e,t,o)=>tn((e,t)=>t(e),on,e,t,o),rn=(e,t,o)=>on(e,e=>qe(e,t),o),sn=(e,t)=>(e=>D(e.dom.childNodes,e=>{return o=Pe.fromDom(e),qe(o,t);var o}).map(Pe.fromDom))(e),an=(e,t)=>Ye(t,e),ln=(e,t,o)=>tn((e,t)=>qe(e,t),rn,e,t,o),cn=e=>void 0!==e.dom.classList,dn=(e,t)=>((e,t,o)=>{const n=((e,t)=>{const o=go(e,t);return void 0===o||""===o?[]:o.split(" ")})(e,t).concat([o]);return mo(e,t,n.join(" ")),!0})(e,"class",t),un=(e,t)=>{cn(e)?e.dom.classList.add(t):dn(e,t)},hn=(e,t)=>cn(e)&&e.dom.classList.contains(t),mn=e=>ln(e,"[contenteditable]"),pn=(e,t=!1)=>Eo(e)?e.dom.isContentEditable:mn(e).fold(p(t),e=>"true"===gn(e)),gn=e=>e.dom.contentEditable,fn=(e,t)=>{let o=[];return M(Gt(e),e=>{t(e)&&(o=o.concat([e])),o=o.concat(fn(e,t))}),o},vn=(e,t,o)=>((e,o,n)=>R(jt(e,n),e=>qe(e,t)))(e,0,o),bn=(e,t)=>(e=>R(Gt(e),e=>qe(e,t)))(e),yn=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return Ge(o)?[]:A(o.querySelectorAll(e),Pe.fromDom)})(t,e),wn=e=>"img"===Bt(e)?1:Ko(e).fold(()=>Gt(e).length,e=>e.length),_n=["img","br"],xn=e=>Ko(e).filter(e=>0!==e.trim().length||e.indexOf(" ")>-1).isSome()||T(_n,Bt(e))||(e=>Dt(e)&&"false"===go(e,"contenteditable"))(e),Cn=e=>((e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const r=Pe.fromDom(e.childNodes[n]);if(t(r))return x.some(r);const i=o(e.childNodes[n]);if(i.isSome())return i}return x.none()};return o(e.dom)})(e,xn),kn=e=>Sn(e,xn),Sn=(e,t)=>{const o=e=>{const n=Gt(e);for(let e=n.length-1;e>=0;e--){const r=n[e];if(t(r))return x.some(r);const i=o(r);if(i.isSome())return i}return x.none()};return o(e)},Tn=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),En=Q([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),On={before:En.before,on:En.on,after:En.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(g,g,g)},An=Q([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Mn={domRange:An.domRange,relative:An.relative,exact:An.exact,exactFromRange:e=>An.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>Pe.fromDom(e.startContainer),relative:(e,t)=>On.getStart(e),exact:(e,t,o,n)=>e}))(e);return Pe.fromDom(Ut(t).dom.defaultView)},range:Tn},Bn=(e,t)=>{const o=Bt(e);return"input"===o?On.after(e):T(["br","img"],o)?0===t?On.before(e):On.after(e):On.on(e,t)},Rn=e=>x.from(e.getSelection()),Nn=(e,t)=>{Rn(e).each(e=>{e.removeAllRanges(),e.addRange(t)})},Vn=(e,t,o,n,r)=>{const i=He(e,t,o,n,r);Nn(e,i)},Dn=(e,t)=>je(e,t).match({ltr:(t,o,n,r)=>{Vn(e,t,o,n,r)},rtl:(t,o,n,r)=>{Rn(e).each(i=>{if(i.setBaseAndExtent)i.setBaseAndExtent(t.dom,o,n.dom,r);else if(i.extend)try{((e,t,o,n,r,i)=>{t.collapse(o.dom,n),t.extend(r.dom,i)})(0,i,t,o,n,r)}catch(i){Vn(e,n,r,t,o)}else Vn(e,n,r,t,o)})}}),Pn=(e,t,o,n,r)=>{const i=((e,t,o,n)=>{const r=Bn(e,t),i=Bn(o,n);return Mn.relative(r,i)})(t,o,n,r);Dn(e,i)},In=(e,t,o)=>{const n=((e,t)=>{const o=e.fold(On.before,Bn,On.after),n=t.fold(On.before,Bn,On.after);return Mn.relative(o,n)})(t,o);Dn(e,n)},Ln=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return x.some(Tn(Pe.fromDom(t.startContainer),t.startOffset,Pe.fromDom(o.endContainer),o.endOffset))}return x.none()},Fn=e=>{if(null===e.anchorNode||null===e.focusNode)return Ln(e);{const t=Pe.fromDom(e.anchorNode),o=Pe.fromDom(e.focusNode);return((e,t,o,n)=>{const r=((e,t,o,n)=>{const r=Ht(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),i=Xe(e,o)&&t===n;return r.collapsed&&!i})(t,e.anchorOffset,o,e.focusOffset)?x.some(Tn(t,e.anchorOffset,o,e.focusOffset)):Ln(e)}},zn=(e,t,o=!0)=>{const n=(o?Le:Ie)(e,t);Nn(e,n)},Hn=e=>(e=>Rn(e).filter(e=>e.rangeCount>0).bind(Fn))(e).map(e=>Mn.exact(e.start,e.soffset,e.finish,e.foffset)),Un=(e,t,o)=>((e,t,o)=>((e,t,o)=>e.caretPositionFromPoint?((e,t,o)=>{var n;return x.from(null===(n=e.caretPositionFromPoint)||void 0===n?void 0:n.call(e,t,o)).bind(t=>{if(null===t.offsetNode)return x.none();const o=e.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),x.some(o)})})(e,t,o):e.caretRangeFromPoint?((e,t,o)=>{var n;return x.from(null===(n=e.caretRangeFromPoint)||void 0===n?void 0:n.call(e,t,o))})(e,t,o):x.none())(e.document,t,o).map(e=>Tn(Pe.fromDom(e.startContainer),e.startOffset,Pe.fromDom(e.endContainer),e.endOffset)))(e,t,o),Zn={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},$n=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),jn=e=>A(e,p(0)),Wn=(e,t,o,n,r)=>r(e.slice(0,t)).concat(n).concat(r(e.slice(o))),qn=e=>(t,o,n,r)=>{if(e(n)){const e=Math.max(r,t[o]-Math.abs(n)),i=Math.abs(e-t[o]);return n>=0?i:-i}return n},Gn=qn(e=>e<0),Yn=qn(_),Xn=()=>{const e=(e,t,o,n)=>{const r=(100+o)/100,i=Math.max(n,(e[t]+o)/r);return A(e,(e,o)=>(o===t?i:e/r)-e)},t=(t,o,n,r,i,s)=>s?e(t,o,r,i):((e,t,o,n,r)=>{const i=Gn(e,t,n,r);return Wn(e,t,o+1,[i,0],jn)})(t,o,n,r,i);return{resizeTable:(e,t)=>e(t),clampTableDelta:Gn,calcLeftEdgeDeltas:t,calcMiddleDeltas:(e,o,n,r,i,s,a)=>t(e,n,r,i,s,a),calcRightEdgeDeltas:(t,o,n,r,i,s)=>{if(s)return e(t,n,r,i);{const e=Gn(t,n,r,i);return jn(t.slice(0,n)).concat([e])}},calcRedestributedWidths:(e,t,o,n)=>{if(n){const n=(t+o)/t,r=A(e,e=>e/n);return{delta:100*n-100,newSizes:r}}return{delta:o,newSizes:e}}}},Kn=()=>{const e=(e,t,o,n,r)=>{const i=Yn(e,n>=0?o:t,n,r);return Wn(e,t,o+1,[i,-i],jn)};return{resizeTable:(e,t,o)=>{o&&e(t)},clampTableDelta:(e,t,o,n,r)=>{if(r){if(o>=0)return o;{const t=V(e,(e,t)=>e+t-n,0);return Math.max(-t,o)}}return Gn(e,t,o,n)},calcLeftEdgeDeltas:e,calcMiddleDeltas:(t,o,n,r,i,s)=>e(t,n,r,i,s),calcRightEdgeDeltas:(e,t,o,n,r,i)=>{if(i)return jn(e);{const t=n/e.length;return A(e,p(t))}},calcRedestributedWidths:(e,t,o,n)=>({delta:0,newSizes:e})}},Jn=(e,t,o=0)=>fo(e,t).map(e=>parseInt(e,10)).getOr(o),Qn=(e,t)=>Jn(e,t,1),er=e=>zt("col")(e)?Jn(e,"span",1)>1:Qn(e,"colspan")>1,tr=(e,t)=>parseInt(Bo(e,t),10),or=p(10),nr=p(10),rr=(e,t)=>ir(e,t,_),ir=(e,t,o)=>L(Gt(e),e=>qe(e,t)?o(e)?[e]:[]:ir(e,t,o)),sr=(e,t)=>((e,t,o=w)=>o(t)?x.none():T(e,Bt(t))?x.some(t):rn(t,e.join(","),e=>qe(e,"table")||o(e)))(["td","th"],e,t),ar=e=>rr(e,"th,td"),lr=e=>qe(e,"colgroup")?bn(e,"col"):L(ur(e),e=>bn(e,"col")),cr=(e,t)=>ln(e,"table",t),dr=e=>rr(e,"tr"),ur=e=>cr(e).fold(p([]),e=>bn(e,"colgroup")),hr=zt("th"),mr=e=>F(e,e=>hr(e.element)),pr=(e,t)=>e&&t?"sectionCells":e?"section":"cells",gr=e=>{const t="thead"===e.section,o=ce(fr(e.cells),"th");return"tfoot"===e.section?{type:"footer"}:t||o?{type:"header",subType:pr(t,o)}:{type:"body"}},fr=e=>{const t=R(e,e=>hr(e.element));return 0===t.length?x.some("td"):t.length===e.length?x.some("th"):x.none()},vr=(e,t)=>A(e,e=>{if("colgroup"===Bt(e)){const t=A(lr(e),e=>{const t=Jn(e,"span",1);return xe(e,1,t)});return Ce(e,t,"colgroup")}{const o=A(ar(e),e=>{const t=Jn(e,"rowspan",1),o=Jn(e,"colspan",1);return xe(e,t,o)});return Ce(e,o,t(e))}}),br=e=>Zt(e).map(e=>{const t=Bt(e);return(e=>T(_e,e))(t)?t:"tbody"}).getOr("tbody"),yr=e=>{const t=dr(e),o=[...ur(e),...t];return vr(o,br)},wr="data-snooker-locked-cols",_r=e=>fo(e,wr).bind(e=>x.from(e.match(/\d+/g))).map(e=>z(e,_)),xr=e=>{const t=V(Ne(e).rows,(e,t)=>(M(t.cells,(t,o)=>{t.isLocked&&(e[o]=!0)}),e),{}),o=X(t,(e,t)=>parseInt(t,10));return(e=>{const t=C.call(e,0);return t.sort(void 0),t})(o)},Cr=(e,t)=>e+","+t,kr=(e,t)=>{const o=L(e.all,e=>e.cells);return R(o,t)},Sr=e=>{const t={},o=[],n=U(e).map(e=>e.element).bind(cr).bind(_r).getOr({});let r=0,i=0,s=0;const{pass:a,fail:l}=B(e,e=>"colgroup"===e.section);M(l,e=>{const a=[];M(e.cells,e=>{let o=0;for(;void 0!==t[Cr(s,o)];)o++;const r=((e,t)=>J(e,t)&&void 0!==e[t]&&null!==e[t])(n,o.toString()),l=((e,t,o,n,r,i)=>({element:e,rowspan:t,colspan:o,row:n,column:r,isLocked:i}))(e.element,e.rowspan,e.colspan,s,o,r);for(let n=0;n<e.colspan;n++)for(let r=0;r<e.rowspan;r++){const e=o+n,a=Cr(s+r,e);t[a]=l,i=Math.max(i,e+1)}a.push(l)}),r++,o.push(Ce(e.element,a,e.section)),s++});const{columns:c,colgroups:d}=Z(a).map(e=>{const t=(e=>{const t={};let o=0;return M(e.cells,e=>{const n=e.colspan;O(n,r=>{const i=o+r;t[i]=((e,t,o)=>({element:e,colspan:t,column:o}))(e.element,n,i)}),o+=n}),t})(e),o=((e,t)=>({element:e,columns:t}))(e.element,K(t));return{colgroups:[o],columns:t}}).getOrThunk(()=>({colgroups:[],columns:{}})),u=((e,t)=>({rows:e,columns:t}))(r,i);return{grid:u,access:t,all:o,columns:c,colgroups:d}},Tr=e=>{const t=yr(e);return Sr(t)},Er=Sr,Or=(e,t,o)=>x.from(e.access[Cr(t,o)]),Ar=(e,t,o)=>{const n=kr(e,e=>o(t,e.element));return n.length>0?x.some(n[0]):x.none()},Mr=kr,Br=e=>L(e.all,e=>e.cells),Rr=e=>K(e.columns),Nr=e=>j(e.columns).length>0,Vr=(e,t)=>x.from(e.columns[t]),Dr=(e,t,o)=>ke(o(e.element,t),!0,e.isLocked),Pr=(e,t)=>e.section!==t?Se(e.element,e.cells,t,e.isNew):e,Ir=()=>({transformRow:Pr,transformCell:(e,t,o)=>{const n=o(e.element,t),r="td"!==Bt(n)?(e=>{const t=So(e,"td");io(e,t);const o=Gt(e);return uo(t,o),wo(e),t})(n):n;return ke(r,e.isNew,e.isLocked)}}),Lr=()=>({transformRow:Pr,transformCell:Dr}),Fr=()=>({transformRow:(e,t)=>Pr(e,"thead"===t?"tbody":t),transformCell:Dr}),zr=Ir,Hr=Lr,Ur=Fr,Zr=()=>({transformRow:g,transformCell:Dr}),$r=(e,t=_)=>{const o=e.grid,n=O(o.columns,g),r=O(o.rows,g);return A(n,o=>jr(()=>L(r,t=>Or(e,t,o).filter(e=>e.column===o).toArray()),e=>1===e.colspan&&t(e.element),()=>Or(e,0,o)))},jr=(e,t,o)=>{const n=e();return D(n,t).orThunk(()=>x.from(n[0]).orThunk(o)).map(e=>e.element)},Wr=e=>{const t=e.grid,o=O(t.rows,g),n=O(t.columns,g);return A(o,t=>jr(()=>L(n,o=>Or(e,t,o).filter(e=>e.row===t).fold(p([]),e=>[e])),e=>1===e.rowspan,()=>Or(e,t,0)))},qr=(e,t)=>({row:e,y:t}),Gr=(e,t)=>({col:e,x:t}),Yr=e=>qo(e).left+Uo(e),Xr=e=>qo(e).left,Kr=(e,t)=>Gr(e,Xr(t)),Jr=(e,t)=>Gr(e,Yr(t)),Qr=e=>qo(e).top,ei=(e,t)=>qr(e,Qr(t)),ti=(e,t)=>qr(e,Qr(t)+Fo(t)),oi=(e,t,o)=>{if(0===o.length)return[];const n=A(o.slice(1),(t,o)=>t.map(t=>e(o,t))),r=o[o.length-1].map(e=>t(o.length-1,e));return n.concat([r])},ni={delta:g,positions:e=>oi(ei,ti,e),edge:Qr},ri=Qo({delta:g,edge:Xr,positions:e=>oi(Kr,Jr,e)},{delta:e=>-e,edge:Yr,positions:e=>oi(Jr,Kr,e)}),ii={delta:(e,t)=>ri(t).delta(e,t),positions:(e,t)=>ri(t).positions(e,t),edge:e=>ri(e).edge(e)},si=/(\d+(\.\d+)?)%/,ai=/(\d+(\.\d+)?)px|em/,li=zt("col"),ci=zt("tr"),di=(e,t,o)=>{const n=$t(e).getOrThunk(()=>(e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return Pe.fromDom(t)})(Ht(e)));return t(e)/o(n)*100},ui=(e,t)=>{Ao(e,"width",t+"px")},hi=(e,t)=>{Ao(e,"width",t+"%")},mi=(e,t)=>{Ao(e,"height",t+"px")},pi=e=>{const t=(e=>{return Po(t=e,"height",t.dom.offsetHeight)+"px";var t})(e);return t?((e,t,o,n)=>{const r=parseFloat(e);return ve(e,"%")&&"table"!==Bt(t)?((e,t,o,n)=>{const r=cr(e).map(e=>{const n=o(e);return Math.floor(t/100*n)}).getOr(t);return n(e,r),r})(t,r,o,n):r})(t,e,Lo,mi):Lo(e)},gi=(e,t)=>No(e,t).orThunk(()=>fo(e,t).map(e=>e+"px")),fi=e=>gi(e,"width"),vi=e=>di(e,Ho,Zo),bi=e=>{return li(e)?Ho(e):Po(t=e,"width",t.dom.offsetWidth);var t},yi=e=>ci(e)?Lo(e):((e,t,o)=>o(e)/Qn(e,"rowspan"))(e,0,pi),wi=(e,t,o)=>{Ao(e,"width",t+o)},_i=e=>di(e,Ho,Zo)+"%",xi=p(si),Ci=zt("col"),ki=e=>fi(e).getOrThunk(()=>bi(e)+"px"),Si=e=>{return(t=e,gi(t,"height")).getOrThunk(()=>yi(e)+"px");var t},Ti=(e,t,o,n,r,i)=>e.filter(n).fold(()=>i(((e,t)=>{if(t<0||t>=e.length-1)return x.none();const o=e[t].fold(()=>{const o=(e=>{const t=C.call(e,0);return t.reverse(),t})(e.slice(0,t));return $(o,(e,t)=>e.map(e=>({value:e,delta:t+1})))},e=>x.some({value:e,delta:0})),n=e[t+1].fold(()=>{const o=e.slice(t+1);return $(o,(e,t)=>e.map(e=>({value:e,delta:t+1})))},e=>x.some({value:e,delta:1}));return o.bind(e=>n.map(t=>{const o=t.delta+e.delta;return Math.abs(t.value-e.value)/o}))})(o,t)),e=>r(e)),Ei=(e,t,o,n)=>{const r=$r(e),i=Nr(e)?(e=>A(Rr(e),e=>x.from(e.element)))(e):r,s=[x.some(ii.edge(t))].concat(A(ii.positions(r,t),e=>e.map(e=>e.x))),a=b(er);return A(i,(e,t)=>Ti(e,t,s,a,e=>{if((e=>{const t=Ot().browser,o=t.isChromium()||t.isFirefox();return!Ci(e)||o})(e))return o(e);{const e=null!=(i=r[t])?g(i):x.none();return Ti(e,t,s,a,e=>n(x.some(Ho(e))),n)}var i},n))},Oi=e=>e.map(e=>e+"px").getOr(""),Ai=(e,t,o)=>Ei(e,t,bi,e=>e.getOrThunk(o.minCellWidth)),Mi=(e,t,o,n)=>{const r=Wr(e),i=A(e.all,e=>x.some(e.element)),s=[x.some(ni.edge(t))].concat(A(ni.positions(r,t),e=>e.map(e=>e.y)));return A(i,(e,t)=>Ti(e,t,s,_,o,n))},Bi=(e,t)=>()=>Eo(e)?t(e):parseFloat(No(e,"width").getOr("0")),Ri=e=>{const t=Bi(e,e=>parseFloat(_i(e))),o=Bi(e,Ho);return{width:t,pixelWidth:o,getWidths:(t,o)=>((e,t,o)=>Ei(e,t,vi,e=>e.fold(()=>o.minCellWidth(),e=>e/o.pixelWidth()*100)))(t,e,o),getCellDelta:e=>e/o()*100,singleColumnWidth:(e,t)=>[100-e],minCellWidth:()=>or()/o()*100,setElementWidth:hi,adjustTableWidth:o=>{const n=t();hi(e,n+o/100*n)},isRelative:!0,label:"percent"}},Ni=e=>{const t=Bi(e,Ho);return{width:t,pixelWidth:t,getWidths:(t,o)=>Ai(t,e,o),getCellDelta:g,singleColumnWidth:(e,t)=>[Math.max(or(),e+t)-e],minCellWidth:or,setElementWidth:ui,adjustTableWidth:o=>{const n=t()+o;ui(e,n)},isRelative:!1,label:"pixel"}},Vi=e=>fi(e).fold(()=>(e=>{const t=Bi(e,Ho),o=p(0);return{width:t,pixelWidth:t,getWidths:(t,o)=>Ai(t,e,o),getCellDelta:o,singleColumnWidth:p([0]),minCellWidth:o,setElementWidth:m,adjustTableWidth:m,isRelative:!0,label:"none"}})(e),t=>((e,t)=>null!==xi().exec(t)?Ri(e):Ni(e))(e,t)),Di=Ni,Pi=Ri,Ii=(e,t,o,n)=>{o===n?vo(e,t):mo(e,t,o)},Li=(e,t,o)=>{Z(bn(e,t)).fold(()=>so(e,o),e=>io(e,o))},Fi=(e,t)=>{const o=[],n=[],r=e=>A(e,e=>{e.isNew&&o.push(e.element);const t=e.element;return yo(t),M(e.cells,e=>{e.isNew&&n.push(e.element),Ii(e.element,"colspan",e.colspan,1),Ii(e.element,"rowspan",e.rowspan,1),ao(t,e.element)}),t}),i=e=>L(e,e=>A(e.cells,e=>(Ii(e.element,"span",e.colspan,1),e.element))),s=(t,o)=>{const n=((e,t)=>{const o=sn(e,t).getOrThunk(()=>{const o=Pe.fromTag(t,Ht(e).dom);return"thead"===t?Li(e,"caption,colgroup",o):"colgroup"===t?Li(e,"caption",o):ao(e,o),o});return yo(o),o})(e,o),s=("colgroup"===o?i:r)(t);uo(n,s)},a=(t,o)=>{t.length>0?s(t,o):(t=>{sn(e,t).each(wo)})(o)},l=[],c=[],d=[],u=[];return M(t,e=>{switch(e.section){case"thead":l.push(e);break;case"tbody":c.push(e);break;case"tfoot":d.push(e);break;case"colgroup":u.push(e)}}),a(u,"colgroup"),a(l,"thead"),a(c,"tbody"),a(d,"tfoot"),{newRows:o,newCells:n}},zi=(e,t)=>{if(0===e.length)return 0;const o=e[0];return P(e,e=>!t(o.element,e.element)).getOr(e.length)},Hi=(e,t)=>{const o=A(e,e=>A(e.cells,w));return A(e,(n,r)=>{const i=L(n.cells,(n,i)=>{if(!1===o[r][i]){const d=((e,t,o,n)=>{const r=((e,t)=>e[t])(e,t),i="colgroup"===r.section,s=zi(r.cells.slice(o),n),a=i?1:zi(((e,t)=>A(e,e=>Me(e,t)))(e.slice(t),o),n);return{colspan:s,rowspan:a}})(e,r,i,t);return((e,t,n,r)=>{for(let i=e;i<e+n;i++)for(let e=t;e<t+r;e++)o[i][e]=!0})(r,i,d.rowspan,d.colspan),[(s=n.element,a=d.rowspan,l=d.colspan,c=n.isNew,{element:s,rowspan:a,colspan:l,isNew:c})]}return[];var s,a,l,c});return((e,t,o,n)=>({element:e,cells:t,section:o,isNew:n}))(n.element,i,n.section,n.isNew)})},Ui=(e,t,o)=>{const n=[];M(e.colgroups,r=>{const i=[];for(let n=0;n<e.grid.columns;n++){const r=Vr(e,n).map(e=>ke(e.element,o,!1)).getOrThunk(()=>ke(t.colGap(),!0,!1));i.push(r)}n.push(Se(r.element,i,"colgroup",o))});for(let r=0;r<e.grid.rows;r++){const i=[];for(let n=0;n<e.grid.columns;n++){const s=Or(e,r,n).map(e=>ke(e.element,o,e.isLocked)).getOrThunk(()=>ke(t.gap(),!0,!1));i.push(s)}const s=e.all[r],a=Se(s.element,i,s.section,o);n.push(a)}return n},Zi=e=>Hi(e,Xe),$i=(e,t)=>$(e.all,e=>D(e.cells,e=>Xe(t,e.element))),ji=(e,t,o)=>{const n=A(t.selection,t=>sr(t).bind(t=>$i(e,t)).filter(o)),r=de(n);return ue(r.length>0,r)},Wi=(e,t,o,n,r,i,s,a,l)=>{const c=Tr(i),d=x.from(null==l?void 0:l.section).getOrThunk(Zr);return t(c,s).map(t=>{const o=((e,t)=>Ui(e,t,!1))(c,a),n=e(o,t,Xe,r(a),d),i=xr(n.grid);return{info:t,grid:Zi(n.grid),cursor:n.cursor,lockedColumns:i}}).bind(e=>{const t=Fi(i,e.grid),r=x.from(null==l?void 0:l.sizing).getOrThunk(()=>Vi(i)),s=x.from(null==l?void 0:l.resize).getOrThunk(Kn);return o(i,e.grid,e.info,{sizing:r,resize:s,section:d}),n(i),vo(i,wr),e.lockedColumns.length>0&&mo(i,wr,e.lockedColumns.join(",")),x.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})},qi=(e,t)=>sr(t.element).bind(o=>$i(e,o).map(e=>({...e,generators:t.generators,clipboard:t.clipboard}))),Gi=(e,t)=>ji(e,t,_).map(e=>({cells:e,generators:t.generators,clipboard:t.clipboard})),Yi=(e,t)=>ji(e,t,_),Xi=(e,t)=>ji(e,t,e=>!e.isLocked),Ki=(e,t)=>F(t,t=>((e,t)=>$i(e,t).exists(e=>!e.isLocked))(e,t)),Ji=(e,t)=>((e,t)=>t.mergable)(0,t).filter(t=>Ki(e,t.cells)),Qi=(e,t)=>((e,t)=>t.unmergable)(0,t).filter(t=>Ki(e,t)),es={...Q([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}])},ts=(e,t,o)=>{const n=((e,t)=>Nr(e)?((e,t)=>{const o=Rr(e);return A(o,(e,o)=>({element:e.element,width:t[o],colspan:e.colspan}))})(e,t):((e,t)=>{const o=Br(e);return A(o,e=>{const o=((e,t,o)=>{let n=0;for(let r=e;r<t;r++)n+=void 0!==o[r]?o[r]:0;return n})(e.column,e.column+e.colspan,t);return{element:e.element,width:o,colspan:e.colspan}})})(e,t))(e,t);M(n,e=>{o.setElementWidth(e.element,e.width)})},os=(e,t,o,n,r)=>{const i=Tr(e),s=r.getCellDelta(t),a=r.getWidths(i,r),l=o===i.grid.columns-1,c=n.clampTableDelta(a,o,s,r.minCellWidth(),l),d=((e,t,o,n,r)=>{const i=e.slice(0),s=((e,t)=>0===e.length?es.none():1===e.length?es.only(0):0===t?es.left(0,1):t===e.length-1?es.right(t-1,t):t>0&&t<e.length-1?es.middle(t-1,t,t+1):es.none())(e,t),a=p(A(i,p(0)));return s.fold(a,e=>n.singleColumnWidth(i[e],o),(e,t)=>r.calcLeftEdgeDeltas(i,e,t,o,n.minCellWidth(),n.isRelative),(e,t,s)=>r.calcMiddleDeltas(i,e,t,s,o,n.minCellWidth(),n.isRelative),(e,t)=>r.calcRightEdgeDeltas(i,e,t,o,n.minCellWidth(),n.isRelative))})(a,o,c,r,n),u=A(d,(e,t)=>e+a[t]);ts(i,u,r),n.resizeTable(r.adjustTableWidth,c,l)},ns=(e,t,o)=>{const n=Tr(e),r=((e,t)=>Mi(e,t,yi,e=>e.getOrThunk(nr)))(n,e),i=A(r,(e,n)=>o===n?Math.max(t+e,nr()):e),s=((e,t)=>A(e.all,(e,o)=>({element:e.element,height:t[o]})))(n,i);M(s,e=>{mi(e.element,e.height)}),M(Br(n),e=>{(e=>{Vo(e,"height")})(e.element)});const a=N(i,(e,t)=>e+t,0);mi(e,a)},rs=(e,t)=>{if(!er(e)){const o=(e=>fi(e).bind(e=>{return t=e,o=["fixed","relative","empty"],x.from($n.exec(t)).bind(e=>{const t=Number(e[1]),n=e[2];return((e,t)=>E(t,t=>E(Zn[t],t=>e===t)))(n,o)?x.some({value:t,unit:n}):x.none()});var t,o}))(e);o.each(o=>{const n=o.value/2;wi(e,n,o.unit),wi(t,n,o.unit)})}},is=(e,t,o)=>{const n=Jn(e,t,1);1===o||n<=1?vo(e,t):mo(e,t,Math.min(o,n))},ss=(e,t)=>o=>{const n=o.column+o.colspan-1,r=o.column;return n>=e&&r<t},as=(e,t,o)=>{const n=e[o].element,r=Pe.fromTag("td");ao(r,Pe.fromTag("br")),(t?ao:so)(n,r)},ls=zt("col"),cs=zt("colgroup"),ds=e=>"tr"===Bt(e)||cs(e),us=e=>({element:e,colspan:Jn(e,"colspan",1),rowspan:Jn(e,"rowspan",1)}),hs=e=>fo(e,"scope").map(e=>e.substr(0,3)),ms=(e,t=us)=>{const o=o=>{if(ds(o))return cs((r={element:o}).element)?e.colgroup(r):e.row(r);{const r=o,i=(t=>ls(t.element)?e.col(t):e.cell(t))(t(r));return n=x.some({item:r,replacement:i}),i}var r};let n=x.none();return{getOrInit:(e,t)=>n.fold(()=>o(e),n=>t(e,n.item)?n.replacement:o(e))}},ps=e=>t=>{const o=[],n=n=>{const r="td"===e?{scope:null}:{},i=t.replace(n,e,r);return o.push({item:n,sub:i}),i};return{replaceOrInit:(e,t)=>{if(ds(e)||ls(e))return e;{const r=e;return((e,t)=>D(o,o=>t(o.item,e)))(r,t).fold(()=>n(r),o=>t(e,o.item)?o.sub:n(r))}}}},gs=e=>({unmerge:t=>{const o=hs(t);return o.each(e=>mo(t,"scope",e)),()=>{const n=e.cell({element:t,colspan:1,rowspan:1});return Vo(n,"width"),Vo(t,"width"),o.each(e=>mo(n,"scope",e)),n}},merge:e=>(Vo(e[0],"width"),(()=>{const t=de(A(e,hs));if(0===t.length)return x.none();{const e=t[0],o=["row","col"];return E(t,t=>t!==e&&T(o,t))?x.none():x.from(e)}})().fold(()=>vo(e[0],"scope"),t=>mo(e[0],"scope",t+"group")),p(e[0]))}),fs=Q([{invalid:["raw"]},{pixels:["value"]},{percent:["value"]}]),vs=(e,t,o)=>{const n=o.substring(0,o.length-e.length),r=parseFloat(n);return n===r.toString()?t(r):fs.invalid(o)},bs={...fs,from:e=>ve(e,"%")?vs("%",fs.percent,e):ve(e,"px")?vs("px",fs.pixels,e):fs.invalid(e)},ys=(e,t,o)=>{const n=bs.from(o),r=F(e,e=>"0px"===e)?((e,t)=>{const o=e.fold(()=>p(""),e=>p(e/t+"px"),()=>p(100/t+"%"));return O(t,o)})(n,e.length):((e,t,o)=>e.fold(()=>t,e=>((e,t,o)=>{const n=o/t;return A(e,e=>bs.from(e).fold(()=>e,e=>e*n+"px",e=>e/100*o+"px"))})(t,o,e),e=>((e,t)=>A(e,e=>bs.from(e).fold(()=>e,e=>e/t*100+"%",e=>e+"%")))(t,o)))(n,e,t);return xs(r)},ws=(e,t)=>0===e.length?t:N(e,(e,t)=>bs.from(t).fold(p(0),g,g)+e,0),_s=(e,t)=>bs.from(e).fold(p(e),e=>e+t+"px",e=>e+t+"%"),xs=e=>{if(0===e.length)return e;const t=N(e,(e,t)=>{const o=bs.from(t).fold(()=>({value:t,remainder:0}),e=>(e=>{const t=Math.floor(e);return{value:t+"px",remainder:e-t}})(e),e=>({value:e+"%",remainder:0}));return{output:[o.value].concat(e.output),remainder:e.remainder+o.remainder}},{output:[],remainder:0}),o=t.output;return o.slice(0,o.length-1).concat([_s(o[o.length-1],Math.round(t.remainder))])},Cs=bs.from,ks=(e,t,o)=>{const n=Tr(e),r=n.all,i=Br(n),s=Rr(n);t.each(t=>{const o=Cs(t).fold(p("px"),p("px"),p("%")),r=Ho(e),a=((e,t)=>Ei(e,t,ki,Oi))(n,e),l=ys(a,r,t);Nr(n)?((e,t,o)=>{M(t,(t,n)=>{const r=ws([e[n]],or());Ao(t.element,"width",r+o)})})(l,s,o):((e,t,o)=>{M(t,t=>{const n=e.slice(t.column,t.colspan+t.column),r=ws(n,or());Ao(t.element,"width",r+o)})})(l,i,o),Ao(e,"width",t)}),o.each(t=>{const o=Lo(e),s=((e,t)=>Mi(e,t,Si,Oi))(n,e);((e,t,o)=>{M(o,e=>{Vo(e.element,"height")}),M(t,(t,o)=>{Ao(t.element,"height",e[o])})})(ys(s,o,t),r,i),Ao(e,"height",t)})},Ss=e=>fi(e).exists(e=>si.test(e)),Ts=e=>fi(e).exists(e=>ai.test(e)),Es=e=>fi(e).isNone();var Os=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],As=()=>({up:p({selector:rn,closest:ln,predicate:on,all:jt}),down:p({selector:yn,predicate:fn}),styles:p({get:Bo,getRaw:No,set:Ao,remove:Vo}),attrs:p({get:go,set:mo,remove:vo,copyTo:(e,t)=>{const o=bo(e);po(t,o)}}),insert:p({before:ro,after:io,afterAll:co,append:ao,appendAll:uo,prepend:so,wrap:lo}),remove:p({unwrap:_o,remove:wo}),create:p({nu:Pe.fromTag,clone:e=>Pe.fromDom(e.dom.cloneNode(!1)),text:Pe.fromText}),query:p({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:Wt,nextSibling:qt}),property:p({children:Gt,name:Bt,parent:Zt,document:e=>Ut(e).dom,isText:It,isComment:Vt,isElement:Pt,isSpecial:e=>{const t=Bt(e);return T(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>Pt(e)?fo(e,"lang"):x.none(),getText:Xo,setText:Jo,isBoundary:e=>!!Pt(e)&&("body"===Bt(e)||T(Os,Bt(e))),isEmptyTag:e=>!!Pt(e)&&T(["br","img","hr","input"],Bt(e)),isNonEditable:e=>Pt(e)&&"false"===go(e,"contenteditable")}),eq:Xe,is:Je});const Ms=(e,t)=>({item:e,mode:t}),Bs=(e,t,o,n=Rs)=>e.property().parent(t).map(e=>Ms(e,n)),Rs=(e,t,o,n=Ns)=>o.sibling(e,t).map(e=>Ms(e,n)),Ns=(e,t,o,n=Ns)=>{const r=e.property().children(t);return o.first(r).map(e=>Ms(e,n))},Vs=[{current:Bs,next:Rs,fallback:x.none()},{current:Rs,next:Ns,fallback:x.some(Bs)},{current:Ns,next:Ns,fallback:x.some(Rs)}],Ds=(e,t,o,n,r=Vs)=>D(r,e=>e.current===o).bind(o=>o.current(e,t,n,o.next).orThunk(()=>o.fallback.bind(o=>Ds(e,t,o,n)))),Ps=(e,t,o,n,r,i)=>Ds(e,t,n,r).bind(t=>i(t.item)?x.none():o(t.item)?x.some(t.item):Ps(e,t.item,o,t.mode,r,i)),Is=(e,t)=>({element:e,offset:t}),Ls=(e,t,o)=>e.property().isText(t)&&0===e.property().getText(t).trim().length||e.property().isComment(t)?o(t).bind(t=>Ls(e,t,o).orThunk(()=>x.some(t))):x.none(),Fs=(e,t)=>e.property().isText(t)?e.property().getText(t).length:e.property().children(t).length,zs=(e,t)=>{const o=Ls(e,t,e.query().prevSibling).getOr(t);if(e.property().isText(o))return Is(o,Fs(e,o));const n=e.property().children(o);return n.length>0?zs(e,n[n.length-1]):Is(o,Fs(e,o))},Hs=zs,Us=As(),Zs=e=>t=>0===e.property().children(t).length,$s=(e,t,o,n)=>Ps(e,t,o,Rs,{sibling:(e,t)=>e.query().prevSibling(t),first:e=>e.length>0?x.some(e[e.length-1]):x.none()},n),js=(e,t,o,n)=>Ps(e,t,o,Rs,{sibling:(e,t)=>e.query().nextSibling(t),first:e=>e.length>0?x.some(e[0]):x.none()},n),Ws=As(),qs=(e,t)=>((e,t,o)=>$s(e,t,Zs(e),o))(Ws,e,t),Gs=(e,t)=>((e,t,o)=>js(e,t,Zs(e),o))(Ws,e,t),Ys=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Xs=(e,t,o,n)=>{const r=t(e,o);return N(n,(o,n)=>{const r=t(e,n);return Ks(e,o,r)},r)},Ks=(e,t,o)=>t.bind(t=>o.filter(v(e.eq,t))),Js=As(),Qs=(e,t)=>((e,t,o)=>o.length>0?((e,t,o,n)=>n(e,t,o[0],o.slice(1)))(e,t,o,Xs):x.none())(Js,(t,o)=>e(o),t),ea=As(),ta=e=>((e,t)=>{const o=e.property().name(t);return T(Ys,o)})(ea,e),oa=e=>((e,t)=>{const o=e.property().name(t);return T(["ol","ul"],o)})(ea,e),na=e=>{const t=zt("br"),o=e=>kn(e).bind(o=>{const n=qt(o).map(e=>!!ta(e)||!!((e,t)=>T(["br","img","hr","input"],e.property().name(t)))(ea,e)&&"img"!==Bt(e)).getOr(!1);return Zt(o).map(r=>{return!0===n||("li"===Bt(i=r)||on(i,oa).isSome())||t(o)||ta(r)&&!Xe(e,r)?[]:[Pe.fromTag("br")];var i})}).getOr([]),n=(()=>{const n=L(e,e=>{const n=Gt(e);return(e=>F(e,e=>t(e)||It(e)&&0===Xo(e).trim().length))(n)?[]:n.concat(o(e))});return 0===n.length?[Pe.fromTag("br")]:n})();yo(e[0]),uo(e[0],n)},ra=e=>{vo(e,"width"),vo(e,"height")},ia=e=>{const t=_i(e);ks(e,x.some(t),x.none()),ra(e)},sa=e=>{const t=(e=>Ho(e)+"px")(e);ks(e,x.some(t),x.none()),ra(e)},aa=e=>{Vo(e,"width");const t=lr(e),o=t.length>0?t:ar(e);M(o,e=>{Vo(e,"width"),ra(e)}),ra(e)},la={scope:["row","col"]},ca=e=>()=>{const t=Pe.fromTag("td",e.dom);return ao(t,Pe.fromTag("br",e.dom)),t},da=e=>()=>Pe.fromTag("col",e.dom),ua=e=>()=>Pe.fromTag("colgroup",e.dom),ha=e=>()=>Pe.fromTag("tr",e.dom),ma=(e,t,o)=>{const n=((e,t)=>{const o=So(e,t),n=Gt(ko(e));return uo(o,n),o})(e,t);return q(o,(e,t)=>{null===e?vo(n,t):mo(n,t,e)}),n},pa=e=>e,ga=(e,t,o)=>{const n=(e,t)=>{((e,t)=>{const o=e.dom,n=t.dom;To(o)&&To(n)&&(n.style.cssText=o.style.cssText)})(e.element,t),Vo(t,"height"),1!==e.colspan&&Vo(t,"width")};return{col:o=>{const r=Pe.fromTag(Bt(o.element),t.dom);return n(o,r),e(o.element,r),r},colgroup:ua(t),row:ha(t),cell:r=>{const i=Pe.fromTag(Bt(r.element),t.dom),s=o.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),a=s.length>0?((e,t,o)=>Cn(e).map(n=>{const r=o.join(","),i=vn(n,r,t=>Xe(t,e));return N(i,(e,t)=>{const o=Co(t);return ao(e,o),o},t)}).getOr(t))(r.element,i,s):i;return ao(a,Pe.fromTag("br")),n(r,i),((e,t)=>{q(la,(o,n)=>fo(e,n).filter(e=>T(o,e)).each(e=>mo(t,n,e)))})(r.element,i),e(r.element,i),i},replace:ma,colGap:da(t),gap:ca(t)}},fa=e=>({col:da(e),colgroup:ua(e),row:ha(e),cell:ca(e),replace:pa,colGap:da(e),gap:ca(e)}),va=e=>Tr(e).grid,ba=(e,t,o,n)=>{const r=Ne(e).rows;let i=!0;for(let e=0;e<r.length;e++)for(let s=0;s<Re(r[0]);s++){const a=r[e],l=Me(a,s),c=o(l.element,t);c&&!i?Oe(a,s,ke(n(),!0,l.isLocked)):c&&(i=!1)}return e},ya=(e,t)=>({rowDelta:0,colDelta:Re(e[0])-Re(t[0])}),wa=(e,t)=>({rowDelta:e.length-t.length,colDelta:0}),_a=(e,t,o,n)=>{const r="colgroup"===t.section?o.col:o.cell;return O(e,e=>ke(r(),!0,n(e)))},xa=(e,t,o,n)=>{const r=e[e.length-1];return e.concat(O(t,()=>{const e="colgroup"===r.section?o.colgroup:o.row,t=Ve(r,e,g),i=_a(t.cells.length,t,o,e=>J(n,e.toString()));return Ae(t,i)}))},Ca=(e,t,o,n)=>A(e,e=>{const r=_a(t,e,o,w);return Te(e,n,r)}),ka=(e,t,o)=>{const n=t.colDelta<0?Ca:g,r=t.rowDelta<0?xa:g,i=xr(e),s=Re(e[0]),a=E(i,e=>e===s-1),l=n(e,Math.abs(t.colDelta),o,a?s-1:s),c=xr(l);return r(l,Math.abs(t.rowDelta),o,z(c,_))},Sa=(e,t,o,n)=>{const r=v(n,Me(e[t],o).element),i=e[t];return e.length>1&&Re(i)>1&&(o>0&&r(Be(i,o-1))||o<i.cells.length-1&&r(Be(i,o+1))||t>0&&r(Be(e[t-1],o))||t<e.length-1&&r(Be(e[t+1],o)))},Ta=(e,t,o)=>R(o,o=>o>=e.column&&o<=Re(t[0])+e.column),Ea=(e,t,o,n,r)=>{((e,t,o,n)=>{t>0&&t<e[0].cells.length&&M(e,e=>{const r=e.cells[t-1];let i=0;const s=n();for(;e.cells.length>t+i&&o(r.element,e.cells[t+i].element);)Oe(e,t+i,ke(s,!0,e.cells[t+i].isLocked)),i++})})(t,e,r,n.cell);const i=wa(o,t),s=ka(o,i,n),a=wa(t,s),l=ka(t,a,n);return A(l,(t,o)=>Te(t,e,s[o].cells))},Oa=(e,t,o,n,r)=>{((e,t,o,n)=>{const r=Ne(e).rows;if(t>0&&t<r.length){const e=((e,t)=>V(e,(e,o)=>E(e,e=>t(e.element,o.element))?e:e.concat([o]),[]))(r[t-1].cells,o);M(e,e=>{let i=x.none();for(let s=t;s<r.length;s++)for(let t=0;t<Re(r[0]);t++){const a=r[s],l=Me(a,t);o(l.element,e.element)&&(i.isNone()&&(i=x.some(n())),i.each(e=>{Oe(a,t,ke(e,!0,l.isLocked))}))}})}})(t,e,r,n.cell);const i=xr(t),s=ya(t,o),a={...s,colDelta:s.colDelta-i.length},l=ka(t,a,n),{cols:c,rows:d}=Ne(l),u=xr(l),h=ya(o,t),m={...h,colDelta:h.colDelta+u.length},p=(f=n,v=u,A(o,e=>V(v,(t,o)=>{const n=_a(1,e,f,_)[0];return Ee(t,o,n)},e))),g=ka(p,m,n);var f,v;return[...c,...d.slice(0,e),...g,...d.slice(e,d.length)]},Aa=(e,t,o,n,r)=>{const{rows:i,cols:s}=Ne(e),a=i.slice(0,t),l=i.slice(t);return[...s,...a,((e,t,o,n)=>Ve(e,e=>n(e,o),t))(i[o],(e,o)=>t>0&&t<i.length&&n(Be(i[t-1],o),Be(i[t],o))?Me(i[t],o):ke(r(e.element,n),!0,e.isLocked),n,r),...l]},Ma=(e,t,o,n,r)=>A(e,e=>{const i=t>0&&t<Re(e)&&n(Be(e,t-1),Be(e,t)),s=((e,t,o,n,r,i,s)=>{if("colgroup"!==o&&n)return Me(e,t);{const t=Me(e,r);return ke(s(t.element,i),!0,!1)}})(e,t,e.section,i,o,n,r);return Ee(e,t,s)}),Ba=(e,t,o,n)=>((e,t,o,n)=>void 0!==Be(e[t],o)&&t>0&&n(Be(e[t-1],o),Be(e[t],o)))(e,t,o,n)||((e,t,o)=>t>0&&o(Be(e,t-1),Be(e,t)))(e[t],o,n),Ra=(e,t,o,n)=>{const r=e=>(e=>"row"===e?(e=>Qn(e,"rowspan")>1)(t):er(t))(e)?`${e}group`:e;return e?hr(t)?r(o):null:n&&hr(t)?r("row"===o?"col":"row"):null},Na=(e,t,o)=>ke(o(e.element,t),!0,e.isLocked),Va=(e,t,o,n,r,i,s)=>A(e,(e,a)=>(e=>{const l=e.cells,c=A(l,(e,l)=>{if((e=>E(t,t=>o(e.element,t.element)))(e)){const t=s(e,a,l)?r(e,o,n):e;return i(t,a,l).each(e=>{var o,n;o=t.element,n={scope:x.from(e)},q(n,(e,t)=>{e.fold(()=>{vo(o,t)},e=>{ho(o.dom,t,e)})})}),t}return e});return Se(e.element,c,e.section,e.isNew)})(e)),Da=(e,t,o)=>L(e,(n,r)=>Ba(e,r,t,o)?[]:[Me(n,t)]),Pa=(e,t,o,n,r)=>{const i=Ne(e).rows,s=L(t,e=>Da(i,e,n)),a=A(i,e=>mr(e.cells)),l=((e,t)=>F(t,g)&&mr(e)?_:(e,o,n)=>!("th"===Bt(e.element)&&t[o]))(s,a),c=((e,t)=>(o,n)=>x.some(Ra(e,o.element,"row",t[n])))(o,a);return Va(e,s,n,r,Na,c,l)},Ia=(e,t,o,n)=>{const r=Ne(e).rows,i=A(t,e=>Me(r[e.row],e.column));return Va(e,i,o,n,Na,x.none,_)},La=e=>V(e,(e,t)=>E(e,e=>e.column===t.column)?e:e.concat([t]),[]).sort((e,t)=>e.column-t.column),Fa=e=>pn(e,!0),za=e=>{0===ar(e).length&&wo(e)},Ha=(e,t)=>({grid:e,cursor:t}),Ua=(e,t,o)=>{const n=((e,t,o)=>{var n,r;const i=Ne(e).rows;return x.from(null===(r=null===(n=i[t])||void 0===n?void 0:n.cells[o])||void 0===r?void 0:r.element).filter(Fa).orThunk(()=>(e=>$(e,e=>$(e.cells,e=>{const t=e.element;return ue(Fa(t),t)})))(i))})(e,t,o);return Ha(e,n)},Za=e=>V(e,(e,t)=>E(e,e=>e.row===t.row)?e:e.concat([t]),[]).sort((e,t)=>e.row-t.row),$a=(e,t,o,n)=>{const r=t[0].row,i=Za(t),s=N(i,(e,t)=>({grid:Aa(e.grid,r,t.row+e.delta,o,n.getOrInit),delta:e.delta+1}),{grid:e,delta:0}).grid;return Ua(s,r,t[0].column)},ja=(e,t,o,n)=>{const r=Za(t),i=r[r.length-1],s=i.row+i.rowspan,a=N(r,(e,t)=>Aa(e,s,t.row,o,n.getOrInit),e);return Ua(a,s,t[0].column)},Wa=(e,t,o,n)=>{const r=t.details,i=La(r),s=i[0].column,a=N(i,(e,t)=>({grid:Ma(e.grid,s,t.column+e.delta,o,n.getOrInit),delta:e.delta+1}),{grid:e,delta:0}).grid;return Ua(a,r[0].row,s)},qa=(e,t,o,n)=>{const r=t.details,i=r[r.length-1],s=i.column+i.colspan,a=La(r),l=N(a,(e,t)=>Ma(e,s,t.column,o,n.getOrInit),e);return Ua(l,r[0].row,s)},Ga=(e,t,o,n)=>{const r=La(t),i=A(r,e=>e.column),s=Pa(e,i,!0,o,n.replaceOrInit);return Ua(s,t[0].row,t[0].column)},Ya=(e,t,o,n)=>{const r=Ia(e,t,o,n.replaceOrInit);return Ua(r,t[0].row,t[0].column)},Xa=(e,t,o,n)=>{const r=La(t),i=A(r,e=>e.column),s=Pa(e,i,!1,o,n.replaceOrInit);return Ua(s,t[0].row,t[0].column)},Ka=(e,t,o,n)=>{const r=Ia(e,t,o,n.replaceOrInit);return Ua(r,t[0].row,t[0].column)},Ja=(e,t)=>(o,n,r,i,s)=>{const a=Za(n),l=A(a,e=>e.row),c=((e,t,o,n,r,i,s)=>{const{cols:a,rows:l}=Ne(e),c=l[t[0]],d=L(t,e=>((e,t,o)=>{const n=e[t];return L(n.cells,(n,r)=>Ba(e,t,r,o)?[]:[n])})(l,e,r)),u=A(c.cells,(e,t)=>mr(Da(l,t,r))),h=[...l];M(t,e=>{h[e]=s.transformRow(l[e],o)});const m=[...a,...h],p=((e,t)=>F(t,g)&&mr(e.cells)?_:(e,o,n)=>!("th"===Bt(e.element)&&t[n]))(c,u),f=((e,t)=>(o,n,r)=>x.some(Ra(e,o.element,"col",t[r])))(n,u);return Va(m,d,r,i,s.transformCell,f,p)})(o,l,e,t,r,i.replaceOrInit,s);return Ua(c,n[0].row,n[0].column)},Qa=Ja("thead",!0),el=Ja("tbody",!1),tl=Ja("tfoot",!1),ol=(e,t,o,n)=>{const r=La(t.details),i=((e,t)=>L(e,e=>{const o=e.cells,n=N(t,(e,t)=>t>=0&&t<e.length?e.slice(0,t).concat(e.slice(t+1)):e,o);return n.length>0?[Se(e.element,n,e.section,e.isNew)]:[]}))(e,A(r,e=>e.column)),s=i.length>0?i[0].cells.length-1:0;return Ua(i,r[0].row,Math.min(r[0].column,s))},nl=(e,t,o,n)=>{const r=Za(t),i=((e,t,o)=>{const{rows:n,cols:r}=Ne(e);return[...r,...n.slice(0,t),...n.slice(o+1)]})(e,r[0].row,r[r.length-1].row),s=Math.max(Ne(i).rows.length-1,0);return Ua(i,Math.min(t[0].row,s),t[0].column)},rl=(e,t,o,n)=>{const r=t.cells;na(r);const i=((e,t,o,n)=>{const r=Ne(e).rows;if(0===r.length)return e;for(let e=t.startRow;e<=t.finishRow;e++)for(let o=t.startCol;o<=t.finishCol;o++){const t=r[e],i=Me(t,o).isLocked;Oe(t,o,ke(n(),!1,i))}return e})(e,t.bounds,0,n.merge(r));return Ha(i,x.from(r[0]))},il=(e,t,o,n)=>{const r=N(t,(e,t)=>ba(e,t,o,n.unmerge(t)),e);return Ha(r,x.from(t[0]))},sl=(e,t,o,n)=>{const r=((e,t)=>{const o=Tr(e);return Ui(o,t,!0)})(t.clipboard,t.generators);var i,s;return((e,t,o,n,r)=>{const i=xr(t),s=((e,t,o)=>{const n=Re(t[0]),r=Ne(t).cols.length+e.row,i=O(n-e.column,t=>t+e.column);return{row:r,column:D(i,e=>F(o,t=>t!==e)).getOr(n-1)}})(e,t,i),a=Ne(o).rows,l=Ta(s,a,i),c=((e,t,o)=>{if(e.row>=t.length||e.column>Re(t[0]))return se.error("invalid start address out of table bounds, row: "+e.row+", column: "+e.column);const n=t.slice(e.row),r=n[0].cells.slice(e.column),i=Re(o[0]),s=o.length;return se.value({rowDelta:n.length-s,colDelta:r.length-i})})(s,t,a);return c.map(e=>{const o={...e,colDelta:e.colDelta-l.length},i=ka(t,o,n),c=xr(i),d=Ta(s,a,c);return((e,t,o,n,r,i)=>{const s=e.row,a=e.column,l=s+o.length,c=a+Re(o[0])+i.length,d=z(i,_);for(let e=s;e<l;e++){let i=0;for(let l=a;l<c;l++){if(d[l]){i++;continue}Sa(t,e,l,r)&&ba(t,Be(t[e],l),r,n.cell);const c=l-a-i,u=Me(o[e-s],c),h=u.element,m=n.replace(h);Oe(t[e],l,ke(m,!0,u.isLocked))}}return t})(s,i,a,n,r,d)})})((i=t.row,s=t.column,{row:i,column:s}),e,r,t.generators,o).fold(()=>Ha(e,x.some(t.element)),e=>Ua(e,t.row,t.column))},al=(e,t,o)=>{const n=((e,t)=>vr(e,()=>t))(e,o.section),r=Er(n);return Ui(r,t,!0)},ll=(e,t,o,n)=>{const r=Ne(e).rows,i=t.cells[0].column,s=r[t.cells[0].row],a=al(t.clipboard,t.generators,s),l=Ea(i,e,a,t.generators,o);return Ua(l,t.cells[0].row,t.cells[0].column)},cl=(e,t,o,n)=>{const r=Ne(e).rows,i=t.cells[t.cells.length-1].column+t.cells[t.cells.length-1].colspan,s=r[t.cells[0].row],a=al(t.clipboard,t.generators,s),l=Ea(i,e,a,t.generators,o);return Ua(l,t.cells[0].row,i)},dl=(e,t,o,n)=>{const r=Ne(e).rows,i=t.cells[0].row,s=r[i],a=al(t.clipboard,t.generators,s),l=Oa(i,e,a,t.generators,o);return Ua(l,t.cells[0].row,t.cells[0].column)},ul=(e,t,o,n)=>{const r=Ne(e).rows,i=t.cells[t.cells.length-1].row+t.cells[t.cells.length-1].rowspan,s=r[t.cells[0].row],a=al(t.clipboard,t.generators,s),l=Oa(i,e,a,t.generators,o);return Ua(l,i,t.cells[0].column)},hl=(e,t,o,n)=>((e,t,o,n)=>{const r=Er(t),i=n.getWidths(r,n);ts(r,i,n)})(0,t,0,n.sizing),ml=(e,t,o,n)=>((e,t,o,n,r)=>{const i=Er(t),s=n.getWidths(i,n),a=n.pixelWidth(),{newSizes:l,delta:c}=r.calcRedestributedWidths(s,a,o.pixelDelta,n.isRelative);ts(i,l,n),n.adjustTableWidth(c)})(0,t,o,n.sizing,n.resize),pl=(e,t)=>E(t,e=>0===e.column&&e.isLocked),gl=(e,t)=>E(t,t=>t.column+t.colspan>=e.grid.columns&&t.isLocked),fl=(e,t)=>{const o=$r(e),n=La(t);return V(n,(e,t)=>e+o[t.column].map(Uo).getOr(0),0)},vl=e=>(t,o)=>Yi(t,o).filter(o=>!(e?pl:gl)(t,o)).map(e=>({details:e,pixelDelta:fl(t,e)})),bl=(e,t)=>Xi(e,t).map(t=>({details:t,pixelDelta:-fl(e,t)})),yl=e=>(t,o)=>Gi(t,o).filter(o=>!(e?pl:gl)(t,o.cells)),wl=ps("th"),_l=ps("td"),xl=(e,t,o,n)=>Wi($a,Yi,m,m,ms,e,t,o,n),Cl=(e,t,o,n)=>Wi(ja,Yi,m,m,ms,e,t,o,n),kl=(e,t,o,n)=>Wi(Wa,vl(!0),ml,m,ms,e,t,o,n),Sl=(e,t,o,n)=>Wi(qa,vl(!1),ml,m,ms,e,t,o,n),Tl=(e,t,o,n)=>Wi(ol,bl,ml,za,ms,e,t,o,n),El=(e,t,o,n)=>Wi(nl,Yi,m,za,ms,e,t,o,n),Ol=(e,t,o,n)=>Wi(Ga,Xi,m,m,wl,e,t,o,n),Al=(e,t,o,n)=>Wi(Xa,Xi,m,m,_l,e,t,o,n),Ml=(e,t,o,n)=>Wi(Qa,Yi,m,m,wl,e,t,o,n),Bl=(e,t,o,n)=>Wi(el,Yi,m,m,_l,e,t,o,n),Rl=(e,t,o,n)=>Wi(tl,Yi,m,m,_l,e,t,o,n),Nl=(e,t,o,n)=>Wi(Ya,Xi,m,m,wl,e,t,o,n),Vl=(e,t,o,n)=>Wi(Ka,Xi,m,m,_l,e,t,o,n),Dl=(e,t,o,n)=>Wi(rl,Ji,hl,m,gs,e,t,o,n),Pl=(e,t,o,n)=>Wi(il,Qi,hl,m,gs,e,t,o,n),Il=(e,t,o,n)=>Wi(sl,qi,hl,m,ms,e,t,o,n),Ll=(e,t,o,n)=>Wi(ll,yl(!0),m,m,ms,e,t,o,n),Fl=(e,t,o,n)=>Wi(cl,yl(!1),m,m,ms,e,t,o,n),zl=(e,t,o,n)=>Wi(dl,Gi,m,m,ms,e,t,o,n),Hl=(e,t,o,n)=>Wi(ul,Gi,m,m,ms,e,t,o,n),Ul=(e,t)=>{const o=Tr(e);return Yi(o,t).bind(e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,i=I(A(o.all,e=>R(e.cells,e=>e.column>=n&&e.column<r)));return fr(i)}).getOr("")},Zl=(e,t)=>{const o=Tr(e);return Yi(o,t).bind(fr).getOr("")},$l=(e,t)=>{const o=Tr(e);return Yi(o,t).bind(e=>{const t=e[e.length-1],n=e[0].row,r=t.row+t.rowspan;return(e=>{const t=A(e,e=>gr(e).type),o=T(t,"header"),n=T(t,"footer");if(o||n){const e=T(t,"body");return!o||e||n?o||e||!n?x.none():x.some("footer"):x.some("header")}return x.some("body")})(o.all.slice(n,r))}).getOr("")},jl=(e,t)=>{const o=t.column,n=t.column+t.colspan-1,r=t.row,i=t.row+t.rowspan-1;return o<=e.finishCol&&n>=e.startCol&&r<=e.finishRow&&i>=e.startRow},Wl=(e,t)=>t.column>=e.startCol&&t.column+t.colspan-1<=e.finishCol&&t.row>=e.startRow&&t.row+t.rowspan-1<=e.finishRow,ql=(e,t,o)=>{const n=Ar(e,t,Xe),r=Ar(e,o,Xe);return n.bind(e=>r.map(t=>{return o=e,n=t,{startRow:Math.min(o.row,n.row),startCol:Math.min(o.column,n.column),finishRow:Math.max(o.row+o.rowspan-1,n.row+n.rowspan-1),finishCol:Math.max(o.column+o.colspan-1,n.column+n.colspan-1)};var o,n}))},Gl=(e,t,o)=>ql(e,t,o).map(t=>{const o=Mr(e,v(jl,t));return A(o,e=>e.element)}),Yl=(e,t)=>Ar(e,t,(e,t)=>Ke(t,e)).map(e=>e.element),Xl=(e,t,o)=>{const n=Jl(e);return Gl(n,t,o)},Kl=(e,t,o,n,r)=>{const i=Jl(e),s=Xe(e,o)?x.some(t):Yl(i,t),a=Xe(e,r)?x.some(n):Yl(i,n);return s.bind(e=>a.bind(t=>Gl(i,e,t)))},Jl=Tr,Ql={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},colGroups:!1},ec=()=>Pe.fromTag("th"),tc=()=>Pe.fromTag("td"),oc=(e,t,o,n)=>O(e,e=>((e,t,o,n)=>{const r=Pe.fromTag("tr");for(let i=0;i<e;i++){const e=n<t||i<o?ec():tc();i<o&&mo(e,"scope","row"),n<t&&mo(e,"scope","col"),ao(e,Pe.fromTag("br")),ao(r,e)}return r})(t,o,n,e)),nc=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=R(t,t=>t!==e)},trigger:(...o)=>{const n={};M(e,(e,t)=>{n[e]=o[t]}),M(t,e=>{e(n)})}}},rc=e=>({registry:G(e,e=>({bind:e.bind,unbind:e.unbind})),trigger:G(e,e=>e.trigger)}),ic=ne(["compare","extract","mutate","sink"]),sc=ne(["element","start","stop","destroy"]),ac=ne(["forceDrop","drop","move","delayDrop"]),lc=()=>{const e=(()=>{const e=rc({move:nc(["info"])});return{onEvent:m,reset:m,events:e.registry}})(),t=(()=>{let e=x.none();const t=rc({move:nc(["info"])});return{onEvent:(o,n)=>{n.extract(o).each(o=>{const r=((t,o)=>{const n=e.map(e=>t.compare(e,o));return e=x.some(o),n})(n,o);r.each(e=>{t.trigger.move(e)})})},reset:()=>{e=x.none()},events:t.registry}})();let o=e;return{on:()=>{o.reset(),o=t},off:()=>{o.reset(),o=e},isOn:()=>o===t,onEvent:(e,t)=>{o.onEvent(e,t)},events:t.events}},cc=le("ephox-dragster").resolve;var dc=ic({compare:(e,t)=>jo(t.left-e.left,t.top-e.top),extract:e=>x.some(jo(e.x,e.y)),sink:(e,t)=>{const o=(e=>{const t={layerClass:cc("blocker"),...e},o=Pe.fromTag("div");return mo(o,"role","presentation"),Mo(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),un(o,cc("blocker")),un(o,t.layerClass),{element:p(o),destroy:()=>{wo(o)}}})(t),n=oo(o.element(),"mousedown",e.forceDrop),r=oo(o.element(),"mouseup",e.drop),i=oo(o.element(),"mousemove",e.move),s=oo(o.element(),"mouseout",e.delayDrop);return sc({element:o.element,start:e=>{ao(e,o.element())},stop:()=>{wo(o.element())},destroy:()=>{o.destroy(),r.unbind(),i.unbind(),s.unbind(),n.unbind()}})},mutate:(e,t)=>{e.mutate(t.left,t.top)}});const uc=le("ephox-snooker").resolve,hc=uc("resizer-bar"),mc=uc("resizer-rows"),pc=uc("resizer-cols"),gc=e=>{const t=yn(e.parent(),"."+hc);M(t,wo)},fc=(e,t,o)=>{const n=e.origin();M(t,t=>{t.each(t=>{const r=o(n,t);un(r,hc),ao(e.parent(),r)})})},vc=(e,t,o,n,r)=>{const i=qo(o),s=t.isResizable,a=n.length>0?ni.positions(n,o):[],l=a.length>0?((e,t)=>L(e.all,(e,o)=>t(e.element)?[o]:[]))(e,s):[];((e,t,o,n)=>{fc(e,t,(e,t)=>{const r=((e,t,o,n)=>{const r=Pe.fromTag("div");return Mo(r,{position:"absolute",left:t+"px",top:o-3.5+"px",height:"7px",width:n+"px"}),po(r,{"data-mce-bogus":"all","data-row":e,role:"presentation"}),r})(t.row,o.left-e.left,t.y-e.top,n);return un(r,mc),r})})(t,R(a,(e,t)=>E(l,e=>t===e)),i,Uo(o));const c=r.length>0?ii.positions(r,o):[],d=c.length>0?((e,t)=>{const o=[];return O(e.grid.columns,n=>{Vr(e,n).map(e=>e.element).forall(t)&&o.push(n)}),R(o,o=>{const n=Mr(e,e=>e.column===o);return F(n,e=>t(e.element))})})(e,s):[];((e,t,o,n)=>{fc(e,t,(e,t)=>{const r=((e,t,o,n,r)=>{const i=Pe.fromTag("div");return Mo(i,{position:"absolute",left:t-3.5+"px",top:o+"px",height:r+"px",width:"7px"}),po(i,{"data-mce-bogus":"all","data-column":e,role:"presentation"}),i})(t.col,t.x-e.left,o.top-e.top,0,n);return un(r,pc),r})})(t,R(c,(e,t)=>E(d,e=>t===e)),i,Fo(o))},bc=(e,t)=>{if(gc(e),e.isResizable(t)){const o=Tr(t),n=Wr(o),r=$r(o);vc(o,e,t,n,r)}},yc=(e,t)=>{const o=yn(e.parent(),"."+hc);M(o,t)},wc=e=>{yc(e,e=>{Ao(e,"display","none")})},_c=e=>{yc(e,e=>{Ao(e,"display","block")})},xc=uc("resizer-bar-dragging"),Cc=e=>{const t=(()=>{const e=rc({drag:nc(["xDelta","yDelta","target"])});let t=x.none();const o=(()=>{const e=rc({drag:nc(["xDelta","yDelta"])});return{mutate:(t,o)=>{e.trigger.drag(t,o)},events:e.registry}})();return o.events.drag.bind(o=>{t.each(t=>{e.trigger.drag(o.xDelta,o.yDelta,t)})}),{assign:e=>{t=x.some(e)},get:()=>t,mutate:o.mutate,events:e.registry}})(),o=((e,t={})=>{var o;return((e,t,o)=>{let n=!1;const r=rc({start:nc([]),stop:nc([])}),i=lc(),s=()=>{d.stop(),i.isOn()&&(i.off(),r.trigger.stop())},l=(e=>{let t=null;const o=()=>{a(t)||(clearTimeout(t),t=null)};return{cancel:o,throttle:(...n)=>{o(),t=setTimeout(()=>{t=null,e.apply(null,n)},200)}}})(s);i.events.move.bind(o=>{t.mutate(e,o.info)});const c=e=>(...t)=>{n&&e.apply(null,t)},d=t.sink(ac({forceDrop:s,drop:c(s),move:c(e=>{l.cancel(),i.onEvent(e,t)}),delayDrop:c(l.throttle)}),o);return{element:d.element,go:e=>{d.start(e),i.on(),r.trigger.start()},on:()=>{n=!0},off:()=>{n=!1},isActive:()=>n,destroy:()=>{d.destroy()},events:r.registry}})(e,null!==(o=t.mode)&&void 0!==o?o:dc,t)})(t,{});let n=x.none();const r=(e,t)=>x.from(go(e,t));t.events.drag.bind(e=>{r(e.target,"data-row").each(t=>{const o=tr(e.target,"top");Ao(e.target,"top",o+e.yDelta+"px")}),r(e.target,"data-column").each(t=>{const o=tr(e.target,"left");Ao(e.target,"left",o+e.xDelta+"px")})});const i=(e,t)=>tr(e,t)-Jn(e,"data-initial-"+t,0);o.events.stop.bind(()=>{t.get().each(t=>{n.each(o=>{r(t,"data-row").each(e=>{const n=i(t,"top");vo(t,"data-initial-top"),u.trigger.adjustHeight(o,n,parseInt(e,10))}),r(t,"data-column").each(e=>{const n=i(t,"left");vo(t,"data-initial-left"),u.trigger.adjustWidth(o,n,parseInt(e,10))}),bc(e,o)})})});const s=(n,r)=>{u.trigger.startAdjust(),t.assign(n),mo(n,"data-initial-"+r,tr(n,r)),un(n,xc),Ao(n,"opacity","0.2"),o.go(e.dragContainer())},l=oo(e.parent(),"mousedown",e=>{var t;t=e.target,hn(t,mc)&&s(e.target,"top"),(e=>hn(e,pc))(e.target)&&s(e.target,"left")}),c=t=>Xe(t,e.view()),d=oo(e.view(),"mouseover",t=>{var r;(r=t.target,ln(r,"table",c).filter(pn)).fold(()=>{Eo(t.target)&&!(e=>hn(e,"ephox-snooker-resizer-bar")||hn(e,"ephox-dragster-blocker"))(t.target)&&gc(e)},t=>{o.isActive()&&(n=x.some(t),bc(e,t))})}),u=rc({adjustHeight:nc(["table","delta","row"]),adjustWidth:nc(["table","delta","column"]),startAdjust:nc([])});return{destroy:()=>{l.unbind(),d.unbind(),o.destroy(),gc(e)},refresh:t=>{bc(e,t)},on:o.on,off:o.off,hideBars:v(wc,e),showBars:v(_c,e),events:u.registry}},kc=e=>t=>t.options.get(e),Sc="100%",Tc=e=>{var t;const o=e.dom,n=null!==(t=o.getParent(e.selection.getStart(),o.isBlock))&&void 0!==t?t:e.getBody();return Zo(Pe.fromDom(n))+"px"},Ec=e=>x.from(e.options.get("table_clone_elements")),Oc=kc("table_header_type"),Ac=kc("table_column_resizing"),Mc=e=>"preservetable"===Ac(e),Bc=e=>"resizetable"===Ac(e),Rc=kc("table_sizing_mode"),Nc=e=>"relative"===Rc(e),Vc=e=>"fixed"===Rc(e),Dc=e=>"responsive"===Rc(e),Pc=kc("table_resize_bars"),Ic=kc("table_style_by_css"),Lc=kc("table_merge_content_on_paste"),Fc=e=>{const t=e.options,o=t.get("table_default_attributes");return t.isSet("table_default_attributes")?o:((e,t)=>Dc(e)||Ic(e)?t:Vc(e)?{...t,width:Tc(e)}:{...t,width:Sc})(e,o)},zc=kc("table_use_colgroups"),Hc=e=>Pe.fromDom(e.getBody()),Uc=e=>t=>Xe(t,Hc(e)),Zc=e=>{vo(e,"data-mce-style");const t=e=>vo(e,"data-mce-style");M(ar(e),t),M(lr(e),t),M(dr(e),t)},$c=e=>Pe.fromDom(e.selection.getStart()),jc=e=>e.getBoundingClientRect().width,Wc=e=>e.getBoundingClientRect().height,qc=e=>(t,o)=>{const n=t.dom.getStyle(o,e)||t.dom.getAttrib(o,e);return x.from(n).filter(ye)},Gc=qc("width"),Yc=qc("height"),Xc=e=>nn(e,zt("table")).exists(pn),Kc=e=>rn(e,"table"),Jc=(e,t,o)=>{const n=e=>t=>void 0!==o&&o(t)||Xe(t,e);return Xe(e,t)?x.some({boxes:x.some([e]),start:e,finish:t}):Kc(e).bind(r=>Kc(t).bind(i=>{if(Xe(r,i))return x.some({boxes:Xl(r,e,t),start:e,finish:t});if(Ke(r,i)){const o=vn(t,"td,th",n(r)),s=o.length>0?o[o.length-1]:t;return x.some({boxes:Kl(r,e,r,t,i),start:e,finish:s})}if(Ke(i,r)){const o=vn(e,"td,th",n(i)),s=o.length>0?o[o.length-1]:e;return x.some({boxes:Kl(i,e,r,t,i),start:e,finish:s})}return((e,t)=>((e,t,o,n=w)=>{const r=[t].concat(e.up().all(t)),i=[o].concat(e.up().all(o)),s=e=>P(e,n).fold(()=>e,t=>e.slice(0,t+1)),a=s(r),l=s(i),c=D(a,t=>E(l,((e,t)=>v(e.eq,t))(e,t)));return{firstpath:a,secondpath:l,shared:c}})(Js,e,t,void 0))(e,t).shared.bind(s=>ln(s,"table",o).bind(o=>{const s=vn(t,"td,th",n(o)),a=s.length>0?s[s.length-1]:t,l=vn(e,"td,th",n(o)),c=l.length>0?l[l.length-1]:e;return x.some({boxes:Kl(o,e,r,t,i),start:c,finish:a})}))}))},Qc=(e,t)=>{const o=yn(e,t);return o.length>0?x.some(o):x.none()},ed=(e,t,o)=>an(e,t).bind(t=>an(e,o).bind(e=>Qs(Kc,[t,e]).map(o=>({first:t,last:e,table:o})))),td=(e,t,o,n,r)=>((e,t)=>D(e,e=>qe(e,t)))(e,r).bind(e=>((e,t,o)=>cr(e).bind(n=>((e,t,o,n)=>Ar(e,t,Xe).bind(t=>{const r=o>0?t.row+t.rowspan-1:t.row,i=n>0?t.column+t.colspan-1:t.column;return Or(e,r+o,i+n).map(e=>e.element)}))(Jl(n),e,t,o)))(e,t,o).bind(e=>((e,t)=>rn(e,"table").bind(o=>an(o,t).bind(t=>Jc(t,e).bind(e=>e.boxes.map(t=>({boxes:t,start:e.start,finish:e.finish}))))))(e,n))),od=(e,t)=>Qc(e,t),nd=(e,t,o)=>ed(e,t,o).bind(t=>{const o=t=>Xe(e,t),n="thead,tfoot,tbody,table",r=rn(t.first,n,o),i=rn(t.last,n,o);return r.bind(e=>i.bind(o=>Xe(e,o)?((e,t,o)=>((e,t,o)=>ql(e,t,o).bind(t=>((e,t)=>{let o=!0;const n=v(Wl,t);for(let r=t.startRow;r<=t.finishRow;r++)for(let i=t.startCol;i<=t.finishCol;i++)o=o&&Or(e,r,i).exists(n);return o?x.some(t):x.none()})(e,t)))(Jl(e),t,o))(t.table,t.first,t.last):x.none()))}),rd=g,id=e=>{const t=(e,t)=>fo(e,t).exists(e=>parseInt(e,10)>1);return e.length>0&&F(e,e=>t(e,"rowspan")||t(e,"colspan"))?x.some(e):x.none()},sd=(e,t,o)=>t.length<=1?x.none():nd(e,o.firstSelectedSelector,o.lastSelectedSelector).map(e=>({bounds:e,cells:t})),ad=(e,t)=>({selection:e,kill:t}),ld=()=>({tag:"none"}),cd=e=>({tag:"multiple",elements:e}),dd=e=>({tag:"single",element:e}),ud=(e,t,o,n)=>({start:On.on(e,t),finish:On.on(o,n)}),hd=(e,t)=>{const o=We(e,t);return Tn(Pe.fromDom(o.startContainer),o.startOffset,Pe.fromDom(o.endContainer),o.endOffset)},md=ud,pd=(e,t,o,n,r)=>Xe(o,n)?x.none():Jc(o,n,t).bind(t=>{const n=t.boxes.getOr([]);return n.length>1?(r(e,n,t.start,t.finish),x.some(ad(x.some(md(o,0,o,wn(o))),!0))):x.none()}),gd=Q([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),fd=e=>ln(e,"tr"),vd={...gd,verify:(e,t,o,n,r,i,s)=>ln(n,"td,th",s).bind(o=>ln(t,"td,th",s).map(t=>Xe(o,t)?Xe(n,o)&&wn(o)===r?i(t):gd.none("in same cell"):Qs(fd,[o,t]).fold(()=>((e,t,o)=>{const n=e.getRect(t),r=e.getRect(o);return r.right>n.left&&r.left<n.right})(e,t,o)?gd.success():i(t),e=>i(t)))).getOr(gd.none("default")),cata:(e,t,o,n,r)=>e.fold(t,o,n,r)},bd=zt("br"),yd=(e,t,o)=>t(e,o).bind(e=>It(e)&&0===Xo(e).trim().length?yd(e,t,o):x.some(e)),wd=(e,t,o,n)=>((e,t)=>Yt(e,t).filter(bd).orThunk(()=>Yt(e,t-1).filter(bd)))(t,o).bind(t=>n.traverse(t).fold(()=>yd(t,n.gather,e).map(n.relative),e=>(e=>Zt(e).bind(t=>{const o=Gt(t);return((e,t)=>P(e,v(Xe,t)))(o,e).map(n=>((e,t,o,n)=>({parent:e,children:t,element:o,index:n}))(t,o,e,n))}))(e).map(e=>On.on(e.parent,e.index)))),_d=(e,t)=>({left:e.left,top:e.top+t,right:e.right,bottom:e.bottom+t}),xd=(e,t)=>({left:e.left,top:e.top-t,right:e.right,bottom:e.bottom-t}),Cd=(e,t,o)=>({left:e.left+t,top:e.top+o,right:e.right+t,bottom:e.bottom+o}),kd=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom}),Sd=(e,t)=>x.some(e.getRect(t)),Td=(e,t,o)=>Pt(t)?Sd(e,t).map(kd):It(t)?((e,t,o)=>o>=0&&o<wn(t)?e.getRangedRect(t,o,t,o+1):o>0?e.getRangedRect(t,o-1,t,o):x.none())(e,t,o).map(kd):x.none(),Ed=(e,t)=>Pt(t)?Sd(e,t).map(kd):It(t)?e.getRangedRect(t,0,t,wn(t)).map(kd):x.none(),Od=Q([{none:[]},{retry:["caret"]}]),Ad=(e,t,o)=>nn(t,ta).fold(w,t=>Ed(e,t).exists(e=>((e,t)=>e.left<t.left||Math.abs(t.right-e.left)<1||e.left>t.right)(o,e))),Md={point:e=>e.bottom,adjuster:(e,t,o,n,r)=>{const i=_d(r,5);return Math.abs(o.bottom-n.bottom)<1||o.top>r.bottom?Od.retry(i):o.top===r.bottom?Od.retry(_d(r,1)):Ad(e,t,r)?Od.retry(Cd(i,5,0)):Od.none()},move:_d,gather:Gs},Bd=(e,t,o,n,r)=>0===r?x.some(n):((e,t,o)=>e.elementFromPoint(t,o).filter(e=>"table"===Bt(e)).isSome())(e,n.left,t.point(n))?((e,t,o,n,r)=>Bd(e,t,o,t.move(n,5),r))(e,t,o,n,r-1):e.situsFromPoint(n.left,t.point(n)).bind(i=>i.start.fold(x.none,i=>Ed(e,i).bind(s=>t.adjuster(e,i,s,o,n).fold(x.none,n=>Bd(e,t,o,n,r-1))).orThunk(()=>x.some(n)),x.none)),Rd=(e,t,o)=>{const n=e.move(o,5),r=Bd(t,e,o,n,100).getOr(n);return((e,t,o)=>e.point(t)>o.getInnerHeight()?x.some(e.point(t)-o.getInnerHeight()):e.point(t)<0?x.some(-e.point(t)):x.none())(e,r,t).fold(()=>t.situsFromPoint(r.left,e.point(r)),o=>(t.scrollBy(0,o),t.situsFromPoint(r.left,e.point(r)-o)))},Nd={tryUp:v(Rd,{point:e=>e.top,adjuster:(e,t,o,n,r)=>{const i=xd(r,5);return Math.abs(o.top-n.top)<1||o.bottom<r.top?Od.retry(i):o.bottom===r.top?Od.retry(xd(r,1)):Ad(e,t,r)?Od.retry(Cd(i,5,0)):Od.none()},move:xd,gather:qs}),tryDown:v(Rd,Md),getJumpSize:p(5)},Vd=(e,t,o)=>e.getSelection().bind(n=>((e,t,o,n)=>{const r=bd(t)?((e,t,o)=>o.traverse(t).orThunk(()=>yd(t,o.gather,e)).map(o.relative))(e,t,n):wd(e,t,o,n);return r.map(e=>({start:e,finish:e}))})(t,n.finish,n.foffset,o).fold(()=>x.some(Is(n.finish,n.foffset)),r=>{const i=e.fromSitus(r);return s=vd.verify(e,n.finish,n.foffset,i.finish,i.foffset,o.failure,t),vd.cata(s,e=>x.none(),()=>x.none(),e=>x.some(Is(e,0)),e=>x.some(Is(e,wn(e))));var s})),Dd=(e,t,o,n,r,i)=>0===i?x.none():Ld(e,t,o,n,r).bind(s=>{const a=e.fromSitus(s),l=vd.verify(e,o,n,a.finish,a.foffset,r.failure,t);return vd.cata(l,()=>x.none(),()=>x.some(s),s=>Xe(o,s)&&0===n?Pd(e,o,n,xd,r):Dd(e,t,s,0,r,i-1),s=>Xe(o,s)&&n===wn(s)?Pd(e,o,n,_d,r):Dd(e,t,s,wn(s),r,i-1))}),Pd=(e,t,o,n,r)=>Td(e,t,o).bind(t=>Id(e,r,n(t,Nd.getJumpSize()))),Id=(e,t,o)=>{const n=Ot().browser;return n.isChromium()||n.isSafari()||n.isFirefox()?t.retry(e,o):x.none()},Ld=(e,t,o,n,r)=>Td(e,o,n).bind(t=>Id(e,r,t)),Fd=(e,t,o,n,r)=>ln(n,"td,th",t).bind(n=>ln(n,"table",t).bind(i=>((e,t)=>on(e,e=>Zt(e).exists(e=>Xe(e,t)),void 0).isSome())(r,i)?((e,t,o)=>Vd(e,t,o).bind(n=>Dd(e,t,n.element,n.offset,o,20).map(e.fromSitus)))(e,t,o).bind(e=>ln(e.finish,"td,th",t).map(t=>({start:n,finish:t,range:e}))):x.none())),zd=(e,t,o,n,r,i)=>i(n,t).orThunk(()=>Fd(e,t,o,n,r).map(e=>{const t=e.range;return ad(x.some(md(t.start,t.soffset,t.finish,t.foffset)),!0)})),Hd=(e,t)=>ln(e,"tr",t).bind(e=>ln(e,"table",t).bind(o=>{const n=yn(o,"tr");return Xe(e,n[0])?((e,t,o)=>$s(Ws,e,e=>kn(e).isSome(),o))(o,0,t).map(e=>{const t=wn(e);return ad(x.some(md(e,t,e,t)),!0)}):x.none()})),Ud=(e,t)=>ln(e,"tr",t).bind(e=>ln(e,"table",t).bind(o=>{const n=yn(o,"tr");return Xe(e,n[n.length-1])?((e,t,o)=>js(Ws,e,e=>Cn(e).isSome(),o))(o,0,t).map(e=>ad(x.some(md(e,0,e,0)),!0)):x.none()})),Zd=(e,t,o,n,r,i,s)=>Fd(e,o,n,r,i).bind(e=>pd(t,o,e.start,e.finish,s)),$d=(e,t)=>ln(e,"td,th",t),jd=e=>$t(e).exists(pn),Wd={traverse:qt,gather:Gs,relative:On.before,retry:Nd.tryDown,failure:vd.failedDown},qd={traverse:Wt,gather:qs,relative:On.before,retry:Nd.tryUp,failure:vd.failedUp},Gd=e=>t=>t===e,Yd=Gd(38),Xd=Gd(40),Kd=e=>e>=37&&e<=40,Jd={isBackward:Gd(37),isForward:Gd(39)},Qd={isBackward:Gd(39),isForward:Gd(37)},eu=e=>({elementFromPoint:(t,o)=>Pe.fromPoint(Pe.fromDom(e.document),t,o),getRect:e=>e.dom.getBoundingClientRect(),getRangedRect:(t,o,n,r)=>{const i=Mn.exact(t,o,n,r);return((e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?x.some(o).map(Ue):x.none()})(We(e,t)))(e,i)},getSelection:()=>Hn(e).map(t=>hd(e,t)),fromSitus:t=>{const o=Mn.relative(t.start,t.finish);return hd(e,o)},situsFromPoint:(t,o)=>Un(e,t,o).map(e=>ud(e.start,e.soffset,e.finish,e.foffset)),clearSelection:()=>{(e=>{Rn(e).each(e=>e.removeAllRanges())})(e)},collapseSelection:(t=!1)=>{Hn(e).each(o=>o.fold(e=>e.collapse(t),(o,n)=>{const r=t?o:n;In(e,r,r)},(o,n,r,i)=>{const s=t?o:r,a=t?n:i;Pn(e,s,a,s,a)}))},setSelection:t=>{Pn(e,t.start,t.soffset,t.finish,t.foffset)},setRelativeSelection:(t,o)=>{In(e,t,o)},selectNode:t=>{zn(e,t,!1)},selectContents:t=>{zn(e,t)},getInnerHeight:()=>e.innerHeight,getScrollY:()=>(e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return jo(o,n)})(Pe.fromDom(e.document)).top,scrollBy:(t,o)=>{((e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollBy(e,t)})(t,o,Pe.fromDom(e.document))}}),tu=(e,t)=>({rows:e,cols:t}),ou=e=>nn(e,Dt).exists(pn),nu=(e,t)=>ou(e)||ou(t),ru="data-mce-selected",iu="data-mce-first-selected",su="data-mce-last-selected",au="["+ru+"]",lu={selected:ru,selectedSelector:"td["+ru+"],th["+ru+"]",firstSelected:iu,firstSelectedSelector:"td["+iu+"],th["+iu+"]",lastSelected:su,lastSelectedSelector:"td["+su+"],th["+su+"]"},cu=(e,t,o)=>({element:o,mergable:sd(t,e,lu),unmergable:id(e),selection:rd(e)}),du=e=>(t,o)=>{const n=Bt(t),r="col"===n||"colgroup"===n?cr(i=t).bind(e=>od(e,lu.firstSelectedSelector)).fold(p(i),e=>e[0]):t;var i;return ln(r,e,o)},uu=du("th,td,caption"),hu=du("th,td"),mu=e=>{return t=e.model.table.getSelectedCells(),A(t,Pe.fromDom);var t},pu=(e,t)=>{e.on("BeforeGetContent",t=>{const o=o=>{t.preventDefault(),(e=>cr(e[0]).map(e=>{const t=((e,t)=>{const o=e=>qe(e.element,t),n=ko(e),r=yr(n),i=Vi(e),s=Er(r),a=((e,t)=>{const o=e.grid.columns;let n=e.grid.rows,r=o,i=0,s=0;const a=[],l=[];return q(e.access,e=>{if(a.push(e),t(e)){l.push(e);const t=e.row,o=t+e.rowspan-1,a=e.column,c=a+e.colspan-1;t<n?n=t:o>i&&(i=o),a<r?r=a:c>s&&(s=c)}}),((e,t,o,n,r,i)=>({minRow:e,minCol:t,maxRow:o,maxCol:n,allCells:r,selectedCells:i}))(n,r,i,s,a,l)})(s,o),l="th:not("+t+"),td:not("+t+")",c=ir(n,"th,td",e=>qe(e,l));M(c,wo),((e,t,o,n)=>{const r=R(e,e=>"colgroup"!==e.section),i=t.grid.columns,s=t.grid.rows;for(let e=0;e<s;e++){let s=!1;for(let a=0;a<i;a++)e<o.minRow||e>o.maxRow||a<o.minCol||a>o.maxCol||(Or(t,e,a).filter(n).isNone()?as(r,s,e):s=!0)}})(r,s,a,o);const d=((e,t,o,n)=>{if(0===n.minCol&&t.grid.columns===n.maxCol+1)return 0;const r=Ai(t,e,o),i=V(r,(e,t)=>e+t,0),s=V(r.slice(n.minCol,n.maxCol+1),(e,t)=>e+t,0),a=s/i*o.pixelWidth()-o.pixelWidth();return o.getCellDelta(a)})(e,Tr(e),i,a);return((e,t,o,n)=>{q(o.columns,e=>{(e.column<t.minCol||e.column>t.maxCol)&&wo(e.element)});const r=R(rr(e,"tr"),e=>0===e.dom.childElementCount);M(r,wo),t.minCol!==t.maxCol&&t.minRow!==t.maxRow||M(rr(e,"th,td"),e=>{vo(e,"rowspan"),vo(e,"colspan")}),vo(e,wr),vo(e,"data-snooker-col-series"),Vi(e).adjustTableWidth(n)})(n,a,s,d),n})(e,au);return Zc(t),[t]}))(o).each(o=>{const n="text"===t.format?((e,t)=>{const o=e.getDoc(),n=Kt(Pe.fromDom(e.getBody())),r=Pe.fromTag("div",o);mo(r,"data-mce-bogus","all"),Mo(r,{position:"fixed",left:"-9999999px",top:"0",overflow:"hidden",opacity:"0"});const i=(e=>Xt(e)?e:Pe.fromDom(Ut(e).dom.body))(n);uo(r,t),ao(i,r);const s=r.dom.innerText;return wo(r),s})(e,o):((e,t)=>A(t,t=>e.selection.serializer.serialize(t.dom,{})).join(""))(e,o);t.content=n})};if(!0===t.selection){const t=(e=>R(mu(e),e=>qe(e,lu.selectedSelector)))(e);t.length>=1&&o(t)}}),e.on("BeforeSetContent",o=>{if(!0===o.selection&&!0===o.paste){const n=mu(e);U(n).each(n=>{cr(n).each(r=>{const i=R((e=>{const t=document.createElement("div");return t.innerHTML=e,Gt(Pe.fromDom(t))})(o.content),e=>"meta"!==Bt(e)),s=zt("table");if(Lc(e)&&1===i.length&&s(i[0])){o.preventDefault();const s=Pe.fromDom(e.getDoc()),a=fa(s),l=((e,t,o)=>({element:e,clipboard:t,generators:o}))(n,i[0],a);t.pasteCells(r,l).each(()=>{e.focus()})}})})}})},gu=(e,t)=>e.dispatch("NewRow",{node:t}),fu=(e,t)=>e.dispatch("NewCell",{node:t}),vu=(e,t,o)=>{e.dispatch("TableModified",{...o,table:t})},bu={structure:!1,style:!0},yu={structure:!0,style:!1},wu={structure:!0,style:!0},_u=(e,t)=>Nc(e)?Pi(t):Vc(e)?Di(t):Vi(t),xu=(e,t,o)=>{const n=e=>"table"===Bt(Hc(e)),r=Ec(e),i=Bc(e)?m:rs,s=t=>{switch(Oc(e)){case"section":return zr();case"sectionCells":return Hr();case"cells":return Ur();default:return((e,t)=>{var o;switch((o=Tr(e),$(o.all,e=>{const t=gr(e);return"header"===t.type?x.from(t.subType):x.none()})).getOr(t)){case"section":return Ir();case"sectionCells":return Lr();case"cells":return Fr()}})(t,"section")}},a=(n,i,a,l)=>(c,d,u=!1)=>{Zc(c);const h=Pe.fromDom(e.getDoc()),m=ga(a,h,r),p={sizing:_u(e,c),resize:Bc(e)?Xn():Kn(),section:s(c)};return i(c)?n(c,d,m,p).bind(n=>{t.refresh(c.dom),M(n.newRows,t=>{gu(e,t.dom)}),M(n.newCells,t=>{fu(e,t.dom)});const r=((t,n)=>n.cursor.fold(()=>{const n=ar(t);return U(n).filter(Eo).map(n=>{o.clearSelectedCells(t.dom);const r=e.dom.createRng();return r.selectNode(n.dom),e.selection.setRng(r),mo(n,"data-mce-selected","1"),r})},n=>{const r=Hs(Us,n),i=e.dom.createRng();return i.setStart(r.element.dom,r.offset),i.setEnd(r.element.dom,r.offset),e.selection.setRng(i),o.clearSelectedCells(t.dom),x.some(i)}))(c,n);return Eo(c)&&(Zc(c),u||vu(e,c.dom,l)),r.map(e=>({rng:e,effect:l}))}):x.none()},l=a(El,t=>!n(e)||va(t).rows>1,m,yu),c=a(Tl,t=>!n(e)||va(t).columns>1,m,yu);return{deleteRow:l,deleteColumn:c,insertRowsBefore:a(xl,_,m,yu),insertRowsAfter:a(Cl,_,m,yu),insertColumnsBefore:a(kl,_,i,yu),insertColumnsAfter:a(Sl,_,i,yu),mergeCells:a(Dl,_,m,yu),unmergeCells:a(Pl,_,m,yu),pasteColsBefore:a(Ll,_,m,yu),pasteColsAfter:a(Fl,_,m,yu),pasteRowsBefore:a(zl,_,m,yu),pasteRowsAfter:a(Hl,_,m,yu),pasteCells:a(Il,_,m,wu),makeCellsHeader:a(Nl,_,m,yu),unmakeCellsHeader:a(Vl,_,m,yu),makeColumnsHeader:a(Ol,_,m,yu),unmakeColumnsHeader:a(Al,_,m,yu),makeRowsHeader:a(Ml,_,m,yu),makeRowsBody:a(Bl,_,m,yu),makeRowsFooter:a(Rl,_,m,yu),getTableRowType:$l,getTableCellType:Zl,getTableColType:Ul}},Cu=(e,t)=>{e.selection.select(t.dom,!0),e.selection.collapse(!0)},ku=(e,t,o,n,i)=>{const s=(e=>{const t=e.options,o=t.get("table_default_styles");return t.isSet("table_default_styles")?o:((e,t)=>Dc(e)||!Ic(e)?t:Vc(e)?{...t,width:Tc(e)}:{...t,width:Sc})(e,o)})(e),a={styles:s,attributes:Fc(e),colGroups:zc(e)};return e.undoManager.ignore(()=>{const r=((e,t,o,n,r,i=Ql)=>{const s=Pe.fromTag("table"),a="cells"!==r;Mo(s,i.styles),po(s,i.attributes),i.colGroups&&ao(s,(e=>{const t=Pe.fromTag("colgroup");return O(e,()=>ao(t,Pe.fromTag("col"))),t})(t));const l=Math.min(e,o);if(a&&o>0){const e=Pe.fromTag("thead");ao(s,e);const i=oc(o,t,"sectionCells"===r?l:0,n);uo(e,i)}const c=Pe.fromTag("tbody");ao(s,c);const d=oc(a?e-l:e,t,a?0:o,n);return uo(c,d),s})(o,t,i,n,Oc(e),a);mo(r,"data-mce-id","__mce");const s=(e=>{const t=Pe.fromTag("div"),o=Pe.fromDom(e.dom.cloneNode(!0));return ao(t,o),(e=>e.dom.innerHTML)(t)})(r);e.insertContent(s),e.addVisual()}),an(Hc(e),'table[data-mce-id="__mce"]').map(t=>(Vc(e)?sa(t):Dc(e)?aa(t):(Nc(e)||(e=>r(e)&&-1!==e.indexOf("%"))(s.width))&&ia(t),Zc(t),vo(t,"data-mce-id"),((e,t)=>{M(yn(t,"tr"),t=>{gu(e,t.dom),M(yn(t,"th,td"),t=>{fu(e,t.dom)})})})(e,t),((e,t)=>{an(t,"td,th").each(v(Cu,e))})(e,t),t.dom)).getOrNull()};var Su=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.FakeClipboard");const Tu="x-tinymce/dom-table-",Eu=Tu+"rows",Ou=Tu+"columns",Au=e=>{const t=Su.FakeClipboardItem(e);Su.write([t])},Mu=e=>{var t;const o=null!==(t=Su.read())&&void 0!==t?t:[];return $(o,t=>x.from(t.getType(e)))},Bu=e=>{Mu(e).isSome()&&Su.clear()},Ru=e=>{e.fold(Vu,e=>Au({[Eu]:e}))},Nu=()=>Mu(Eu),Vu=()=>Bu(Eu),Du=e=>{e.fold(Iu,e=>Au({[Ou]:e}))},Pu=()=>Mu(Ou),Iu=()=>Bu(Ou),Lu=e=>uu($c(e),Uc(e)).filter(Xc),Fu=(e,t)=>{const o=Uc(e),n=e=>cr(e,o),s=t=>(e=>hu($c(e),Uc(e)).filter(Xc))(e).bind(e=>n(e).map(o=>t(o,e))),a=t=>{e.focus()},l=(t,o=!1)=>s((n,r)=>{const i=cu(mu(e),n,r);t(n,i,o).each(a)}),c=()=>s((t,o)=>((e,t,o)=>{const n=Tr(e);return Yi(n,t).bind(e=>{const t=Ui(n,o,!1),r=Ne(t).rows.slice(e[0].row,e[e.length-1].row+e[e.length-1].rowspan),i=L(r,e=>{const t=R(e.cells,e=>!e.isLocked);return t.length>0?[{...e,cells:t}]:[]}),s=Zi(i);return ue(s.length>0,s)}).map(e=>A(e,e=>{const t=Co(e.element);return M(e.cells,e=>{const o=ko(e.element);Ii(o,"colspan",e.colspan,1),Ii(o,"rowspan",e.rowspan,1),ao(t,o)}),t}))})(t,cu(mu(e),t,o),ga(m,Pe.fromDom(e.getDoc()),x.none()))),d=()=>s((t,o)=>((e,t)=>{const o=Tr(e);return Xi(o,t).map(e=>{const t=e[e.length-1],n=e[0].column,r=t.column+t.colspan,i=((e,t,o)=>{if(Nr(e)){const n=R(Rr(e),ss(t,o)),r=A(n,e=>{const n=ko(e.element);return is(n,"span",o-t),n}),i=Pe.fromTag("colgroup");return uo(i,r),[i]}return[]})(o,n,r),s=((e,t,o)=>A(e.all,e=>{const n=R(e.cells,ss(t,o)),r=A(n,e=>{const n=ko(e.element);return is(n,"colspan",o-t),n}),i=Pe.fromTag("tr");return uo(i,r),i}))(o,n,r);return[...i,...s]})})(t,cu(mu(e),t,o))),u=(t,o)=>o().each(o=>{const n=A(o,e=>ko(e));s((o,r)=>{const i=fa(Pe.fromDom(e.getDoc())),s=((e,t,o,n)=>({selection:rd(e),clipboard:o,generators:n}))(mu(e),0,n,i);t(o,s).each(a)})}),p=e=>(t,o)=>((e,t)=>J(e,t)?x.from(e[t]):x.none())(o,"type").each(t=>{l(e(t),o.no_events)});q({mceTableSplitCells:()=>l(t.unmergeCells),mceTableMergeCells:()=>l(t.mergeCells),mceTableInsertRowBefore:()=>l(t.insertRowsBefore),mceTableInsertRowAfter:()=>l(t.insertRowsAfter),mceTableInsertColBefore:()=>l(t.insertColumnsBefore),mceTableInsertColAfter:()=>l(t.insertColumnsAfter),mceTableDeleteCol:()=>l(t.deleteColumn),mceTableDeleteRow:()=>l(t.deleteRow),mceTableCutCol:()=>d().each(e=>{Du(e),l(t.deleteColumn)}),mceTableCutRow:()=>c().each(e=>{Ru(e),l(t.deleteRow)}),mceTableCopyCol:()=>d().each(e=>Du(e)),mceTableCopyRow:()=>c().each(e=>Ru(e)),mceTablePasteColBefore:()=>u(t.pasteColsBefore,Pu),mceTablePasteColAfter:()=>u(t.pasteColsAfter,Pu),mceTablePasteRowBefore:()=>u(t.pasteRowsBefore,Nu),mceTablePasteRowAfter:()=>u(t.pasteRowsAfter,Nu),mceTableDelete:()=>Lu(e).each(t=>{cr(t,o).filter(b(o)).each(t=>{const o=Pe.fromText("");if(io(t,o),wo(t),e.dom.isEmpty(e.getBody()))e.setContent(""),e.selection.setCursorLocation();else{const t=e.dom.createRng();t.setStart(o.dom,0),t.setEnd(o.dom,0),e.selection.setRng(t),e.nodeChanged()}})}),mceTableCellToggleClass:(t,o)=>{s(t=>{const n=mu(e),r=F(n,t=>e.formatter.match("tablecellclass",{value:o},t.dom)),i=r?e.formatter.remove:e.formatter.apply;M(n,e=>i("tablecellclass",{value:o},e.dom)),vu(e,t.dom,bu)})},mceTableToggleClass:(t,o)=>{s(t=>{e.formatter.toggle("tableclass",{value:o},t.dom),vu(e,t.dom,bu)})},mceTableToggleCaption:()=>{Lu(e).each(t=>{cr(t,o).each(o=>{sn(o,"caption").fold(()=>{const t=Pe.fromTag("caption");ao(t,Pe.fromText("Caption")),((e,t)=>{Yt(e,0).fold(()=>{ao(e,t)},e=>{ro(e,t)})})(o,t),e.selection.setCursorLocation(t.dom,0)},n=>{zt("caption")(t)&&Ye("td",o).each(t=>e.selection.setCursorLocation(t.dom,0)),wo(n)}),vu(e,o.dom,yu)})})},mceTableSizingMode:(t,n)=>(t=>Lu(e).each(n=>{Dc(e)||Vc(e)||Nc(e)||cr(n,o).each(o=>{"relative"!==t||Ss(o)?"fixed"!==t||Ts(o)?"responsive"!==t||Es(o)||aa(o):sa(o):ia(o),Zc(o),vu(e,o.dom,yu)})}))(n),mceTableCellType:p(e=>"th"===e?t.makeCellsHeader:t.unmakeCellsHeader),mceTableColType:p(e=>"th"===e?t.makeColumnsHeader:t.unmakeColumnsHeader),mceTableRowType:p(e=>{switch(e){case"header":return t.makeRowsHeader;case"footer":return t.makeRowsFooter;default:return t.makeRowsBody}})},(t,o)=>e.addCommand(o,t)),e.addCommand("mceInsertTable",(t,o)=>{((e,t,o,n={})=>{const r=e=>h(e)&&e>0;if(r(t)&&r(o)){const r=n.headerRows||0,i=n.headerColumns||0;return ku(e,o,t,i,r)}console.error("Invalid values for mceInsertTable - rows and columns values are required to insert a table.")})(e,o.rows,o.columns,o.options)}),e.addCommand("mceTableApplyCellStyle",(t,o)=>{const s=e=>"tablecell"+e.toLowerCase().replace("-","");if(!i(o))return;const a=R(mu(e),Xc);if(0===a.length)return;const l=((e,t)=>{const o={};return((e,t,o,n)=>{q(e,(e,r)=>{(t(e,r)?o:n)(e,r)})})(e,t,(e=>(t,o)=>{e[o]=t})(o),m),o})(o,(t,o)=>e.formatter.has(s(o))&&r(t));(e=>{for(const t in e)if(W.call(e,t))return!1;return!0})(l)||(q(l,(t,o)=>{const n=s(o);M(a,o=>{""===t?e.formatter.remove(n,{value:null},o.dom,!0):e.formatter.apply(n,{value:t},o.dom)})}),n(a[0]).each(t=>vu(e,t.dom,bu)))})},zu=e=>!hn(Pe.fromDom(e.target),"ephox-snooker-resizer-bar"),Hu=(e,t)=>{const o=(r=lu.selectedSelector,{get:()=>od(Pe.fromDom(e.getBody()),r).fold(()=>hu($c(e),Uc(e)).fold(ld,dd),cd)}),n=((e,t,o)=>{const n=t=>{vo(t,e.selected),vo(t,e.firstSelected),vo(t,e.lastSelected)},r=t=>{mo(t,e.selected,"1")},i=e=>{s(e),o()},s=t=>{const o=yn(t,`${e.selectedSelector},${e.firstSelectedSelector},${e.lastSelectedSelector}`);M(o,n)};return{clearBeforeUpdate:s,clear:i,selectRange:(o,n,s,a)=>{i(o),M(n,r),mo(s,e.firstSelected,"1"),mo(a,e.lastSelected,"1"),t(n,s,a)},selectedSelector:e.selectedSelector,firstSelectedSelector:e.firstSelectedSelector,lastSelectedSelector:e.lastSelectedSelector}})(lu,(t,o,n)=>{cr(o).each(r=>{const i=A(t,e=>e.dom),s=Ec(e),a=ga(m,Pe.fromDom(e.getDoc()),s),l=((e,t,o)=>{const n=Tr(e);return Yi(n,t).map(e=>{const t=Ui(n,o,!1),{rows:r}=Ne(t),i=((e,t)=>{const o=e.slice(0,t[t.length-1].row+1),n=Zi(o);return L(n,e=>{const o=e.cells.slice(0,t[t.length-1].column+1);return A(o,e=>e.element)})})(r,e),s=((e,t)=>{const o=e.slice(t[0].row+t[0].rowspan-1,e.length),n=Zi(o);return L(n,e=>{const o=e.cells.slice(t[0].column+t[0].colspan-1,e.cells.length);return A(o,e=>e.element)})})(r,e);return{upOrLeftCells:i,downOrRightCells:s}})})(r,{selection:mu(e)},a).map(e=>G(e,e=>A(e,e=>e.dom))).getOrUndefined();((e,t,o,n,r)=>{e.dispatch("TableSelectionChange",{cells:t,start:o,finish:n,otherCells:r})})(e,i,o.dom,n.dom,l)})},()=>(e=>{e.dispatch("TableSelectionClear")})(e));var r;return e.on("init",o=>{const r=e.getWin(),i=Hc(e),s=Uc(e),a=((e,t,o,n)=>{const r=((e,t,o,n)=>{const r=me(),i=r.clear,s=i=>{r.on(r=>{n.clearBeforeUpdate(t),$d(i.target,o).each(s=>{Jc(r,s,o).each(o=>{const r=o.boxes.getOr([]);if(1===r.length){const e=r[0],o="false"===gn(e),s=ce(mn(i.target),e,Xe);o&&s&&n.selectRange(t,r,e,e)}else r.length>1&&(n.selectRange(t,r,o.start,o.finish),e.selectContents(s))})})})};return{clearstate:i,mousedown:e=>{n.clear(t),$d(e.target,o).filter(jd).each(r.set)},mouseover:e=>{s(e)},mouseup:e=>{s(e),i()}}})(eu(e),t,o,n);return{clearstate:r.clearstate,mousedown:r.mousedown,mouseover:r.mouseover,mouseup:r.mouseup}})(r,i,s,n),l=((e,t,o,n)=>{const r=eu(e),i=()=>(n.clear(t),x.none());return{keydown:(e,s,a,l,c,d)=>{const u=e.raw,h=u.which,m=!0===u.shiftKey,p=Qc(t,n.selectedSelector).fold(()=>(Kd(h)&&!m&&n.clearBeforeUpdate(t),Kd(h)&&m&&!nu(s,l)?x.none:Xd(h)&&m?v(Zd,r,t,o,Wd,l,s,n.selectRange):Yd(h)&&m?v(Zd,r,t,o,qd,l,s,n.selectRange):Xd(h)?v(zd,r,o,Wd,l,s,Ud):Yd(h)?v(zd,r,o,qd,l,s,Hd):x.none),e=>{const o=o=>()=>{const i=$(o,o=>((e,t,o,n,r)=>td(n,e,t,r.firstSelectedSelector,r.lastSelectedSelector).map(e=>(r.clearBeforeUpdate(o),r.selectRange(o,e.boxes,e.start,e.finish),e.boxes)))(o.rows,o.cols,t,e,n));return i.fold(()=>ed(t,n.firstSelectedSelector,n.lastSelectedSelector).map(e=>{const o=Xd(h)||d.isForward(h)?On.after:On.before;return r.setRelativeSelection(On.on(e.first,0),o(e.table)),n.clear(t),ad(x.none(),!0)}),e=>x.some(ad(x.none(),!0)))};return Kd(h)&&m&&!nu(s,l)?x.none:Xd(h)&&m?o([tu(1,0)]):Yd(h)&&m?o([tu(-1,0)]):d.isBackward(h)&&m?o([tu(0,-1),tu(-1,0)]):d.isForward(h)&&m?o([tu(0,1),tu(1,0)]):Kd(h)&&!m?i:x.none});return p()},keyup:(e,r,i,s,a)=>Qc(t,n.selectedSelector).fold(()=>{const l=e.raw,c=l.which;return!0===l.shiftKey&&Kd(c)&&nu(r,s)?((e,t,o,n,r,i,s)=>Xe(o,r)&&n===i?x.none():ln(o,"td,th",t).bind(o=>ln(r,"td,th",t).bind(n=>pd(e,t,o,n,s))))(t,o,r,i,s,a,n.selectRange):x.none()},x.none)}})(r,i,s,n),c=((e,t,o,n)=>{const r=eu(e);return(e,i)=>{n.clearBeforeUpdate(t),Jc(e,i,o).each(e=>{const o=e.boxes.getOr([]);n.selectRange(t,o,e.start,e.finish),r.selectContents(i),r.collapseSelection()})}})(r,i,s,n);e.on("TableSelectorChange",e=>c(e.start,e.finish));const d=(t,o)=>{(e=>!0===e.raw.shiftKey)(t)&&(o.kill&&t.kill(),o.selection.each(t=>{const o=Mn.relative(t.start,t.finish),n=We(r,o);e.selection.setRng(n)}))},u=e=>0===e.button,h=(()=>{const e=ee(Pe.fromDom(i)),t=ee(0);return{touchEnd:o=>{const n=Pe.fromDom(o.target);if(zt("td")(n)||zt("th")(n)){const r=e.get(),i=t.get();Xe(r,n)&&o.timeStamp-i<300&&(o.preventDefault(),c(n,n))}e.set(n),t.set(o.timeStamp)}}})();e.on("dragstart",e=>{a.clearstate()}),e.on("mousedown",e=>{u(e)&&zu(e)&&a.mousedown(no(e))}),e.on("mouseover",e=>{var t;(void 0===(t=e).buttons||1&t.buttons)&&zu(e)&&a.mouseover(no(e))}),e.on("mouseup",e=>{u(e)&&zu(e)&&a.mouseup(no(e))}),e.on("touchend",h.touchEnd),e.on("keyup",t=>{const o=no(t);if(o.raw.shiftKey&&Kd(o.raw.which)){const t=e.selection.getRng(),n=Pe.fromDom(t.startContainer),r=Pe.fromDom(t.endContainer);l.keyup(o,n,t.startOffset,r,t.endOffset).each(e=>{d(o,e)})}}),e.on("keydown",o=>{const n=no(o);t.hide();const r=e.selection.getRng(),i=Pe.fromDom(r.startContainer),s=Pe.fromDom(r.endContainer),a=Qo(Jd,Qd)(Pe.fromDom(e.selection.getStart()));l.keydown(n,i,r.startOffset,s,r.endOffset,a).each(e=>{d(n,e)}),t.show()}),e.on("NodeChange",()=>{const t=e.selection,o=Pe.fromDom(t.getStart()),r=Pe.fromDom(t.getEnd());Qs(cr,[o,r]).fold(()=>n.clear(i),m)})}),e.on("PreInit",()=>{e.serializer.addTempAttr(lu.firstSelected),e.serializer.addTempAttr(lu.lastSelected)}),{getSelectedCells:()=>((e,t)=>{switch(e.tag){case"none":return t();case"single":return(e=>[e.dom])(e.element);case"multiple":return(e=>A(e,e=>e.dom))(e.elements)}})(o.get(),p([])),clearSelectedCells:e=>n.clear(Pe.fromDom(e))}},Uu=e=>d(e)&&"TABLE"===e.nodeName,Zu="bar-",$u=e=>"false"!==go(e,"data-mce-resize"),ju=e=>{const t=me(),o=me(),n=me();let r,i,s,a;const l=t=>_u(e,t),c=()=>Mc(e)?Kn():Xn(),d=(t,o,n,d)=>{const u=(e=>{return fe(t=e,"corner-")?(e=>e.substring(7))(t):t;var t})(o),h=ve(u,"e"),m=fe(u,"n");if(""===i&&ia(t),""===a&&(e=>{const t=(e=>Lo(e)+"px")(e);ks(e,x.none(),x.some(t)),ra(e)})(t),n!==r&&""!==i){Ao(t,"width",i);const o=c(),s=l(t),a=Mc(e)||h?(e=>va(e).columns)(t)-1:0;os(t,n-r,a,o,s)}else if((e=>/^(\d+(\.\d+)?)%$/.test(e))(i)){const e=parseFloat(i.replace("%",""));Ao(t,"width",n*e/r+"%")}if((e=>/^(\d+(\.\d+)?)px$/.test(e))(i)&&(e=>{const t=Tr(e);Nr(t)||M(ar(e),e=>{const t=Bo(e,"width");Ao(e,"width",t),vo(e,"width")})})(t),d!==s&&""!==a){Ao(t,"height",a);const e=m?0:(e=>va(e).rows)(t)-1;ns(t,d-s,e)}};e.on("init",()=>{const r=((e,t)=>((e,t)=>({parent:p(e),view:p(e),dragContainer:p(e),origin:()=>qo(e),isResizable:t}))(Pe.fromDom(e.getBody()),t))(e,$u);if(n.set(r),(e=>{const t=e.options.get("object_resizing");return T(t.split(","),"table")})(e)&&Pc(e)){const n=((e,t,o)=>{const n=ni,r=ii,i=Cc(e),s=rc({beforeResize:nc(["table","type"]),afterResize:nc(["table","type"]),startDrag:nc([])});return i.events.adjustHeight.bind(e=>{const t=e.table;s.trigger.beforeResize(t,"row");const o=n.delta(e.delta,t);ns(t,o,e.row),s.trigger.afterResize(t,"row")}),i.events.startAdjust.bind(e=>{s.trigger.startDrag()}),i.events.adjustWidth.bind(e=>{const n=e.table;s.trigger.beforeResize(n,"col");const i=r.delta(e.delta,n),a=o(n);os(n,i,e.column,t,a),s.trigger.afterResize(n,"col")}),{on:i.on,off:i.off,refreshBars:i.refresh,hideBars:i.hideBars,showBars:i.showBars,destroy:i.destroy,events:s.registry}})(r,c(),l);e.mode.isReadOnly()||n.on(),n.events.startDrag.bind(o=>{t.set(e.selection.getRng())}),n.events.beforeResize.bind(t=>{const o=t.table.dom;((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(e,o,jc(o),Wc(o),Zu+t.type)}),n.events.afterResize.bind(o=>{const n=o.table,r=n.dom;Zc(n),t.on(t=>{e.selection.setRng(t),e.focus()}),((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(e,r,jc(r),Wc(r),Zu+o.type),e.undoManager.add()}),o.set(n)}}),e.on("ObjectResizeStart",t=>{const o=t.target;if(Uu(o)&&!e.mode.isReadOnly()){const n=Pe.fromDom(o);M(e.dom.select(".mce-clonedresizable"),t=>{e.dom.addClass(t,"mce-"+Ac(e)+"-columns")}),!Ts(n)&&Vc(e)?sa(n):!Ss(n)&&Nc(e)&&ia(n),Es(n)&&fe(t.origin,Zu)&&ia(n),r=t.width,i=Dc(e)?"":Gc(e,o).getOr(""),s=t.height,a=Yc(e,o).getOr("")}}),e.on("ObjectResized",t=>{const o=t.target;if(Uu(o)){const n=Pe.fromDom(o),r=t.origin;(e=>fe(e,"corner-"))(r)&&d(n,r,t.width,t.height),Zc(n),vu(e,n.dom,bu)}});const u=()=>{o.on(e=>{e.on(),e.showBars()})},h=()=>{o.on(e=>{e.off(),e.hideBars()})};return e.on("DisabledStateChange",e=>{e.state?h():u()}),e.on("SwitchMode",()=>{e.mode.isReadOnly()?h():u()}),e.on("dragstart dragend",e=>{"dragstart"===e.type?h():u()}),e.on("remove",()=>{o.on(e=>{e.destroy()})}),{refresh:e=>{o.on(t=>t.refreshBars(Pe.fromDom(e)))},hide:()=>{o.on(e=>e.hideBars())},show:()=>{o.on(e=>e.showBars())}}},Wu=e=>{(e=>{const t=e.options.register;t("table_clone_elements",{processor:"string[]"}),t("table_use_colgroups",{processor:"boolean",default:!0}),t("table_header_type",{processor:e=>{const t=T(["section","cells","sectionCells","auto"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: section, cells, sectionCells or auto."}},default:"section"}),t("table_sizing_mode",{processor:"string",default:"auto"}),t("table_default_attributes",{processor:"object",default:{border:"1"}}),t("table_default_styles",{processor:"object",default:{"border-collapse":"collapse"}}),t("table_column_resizing",{processor:e=>{const t=T(["preservetable","resizetable"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be preservetable, or resizetable."}},default:"preservetable"}),t("table_resize_bars",{processor:"boolean",default:!0}),t("table_style_by_css",{processor:"boolean",default:!0}),t("table_merge_content_on_paste",{processor:"boolean",default:!0})})(e);const t=ju(e),o=Hu(e,t),n=xu(e,t,o);return Fu(e,n),((e,t)=>{const o=Uc(e),n=t=>hu($c(e)).bind(n=>cr(n,o).map(o=>{const r=cu(mu(e),o,n);return t(o,r)})).getOr("");q({mceTableRowType:()=>n(t.getTableRowType),mceTableCellType:()=>n(t.getTableCellType),mceTableColType:()=>n(t.getTableColType)},(t,o)=>e.addQueryValueHandler(o,t))})(e,n),pu(e,n),{getSelectedCells:o.getSelectedCells,clearSelectedCells:o.clearSelectedCells}};e.add("dom",e=>({table:Wu(e)}))}()},66136(e,t,o){o(40901)},40901(){!function(){"use strict";window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.PluginManager").add("code",e=>((e=>{e.addCommand("mceCodeEditor",()=>{(e=>{const t=(e=>e.getContent({source_view:!0}))(e);e.windowManager.open({title:"Source Code",size:"large",body:{type:"panel",items:[{type:"textarea",name:"code"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:{code:t},onSubmit:t=>{((e,t)=>{e.focus(),e.undoManager.transact(()=>{e.setContent(t)}),e.selection.setCursorLocation(),e.nodeChanged()})(e,t.getData().code),t.close()}})})(e)})})(e),(e=>{const t=()=>e.execCommand("mceCodeEditor");e.ui.registry.addButton("code",{icon:"sourcecode",tooltip:"Source code",onAction:t}),e.ui.registry.addMenuItem("code",{icon:"sourcecode",text:"Source code",onAction:t})})(e),{}))}()},79589(e,t,o){o(75858)},75858(){!function(){"use strict";var e=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":t;var o,n,r,i})(t)===e,o=e=>t=>typeof t===e,n=t("string"),r=t("object"),i=t("array"),s=e=>null===e;const a=o("boolean"),l=e=>!(e=>null==e)(e),c=o("function"),d=(e,t)=>{if(i(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},u=()=>{},h=(e,t)=>e===t;class m{constructor(e,t){this.tag=e,this.value=t}static some(e){return new m(!0,e)}static none(){return m.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?m.some(e(this.value)):m.none()}bind(e){return this.tag?e(this.value):m.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:m.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return l(e)?m.some(e):m.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}m.singletonNone=new m(!1),Array.prototype.slice;const p=Array.prototype.indexOf,g=Array.prototype.push,f=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!i(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);g.apply(t,e[o])}return t};c(Array.from)&&Array.from;const v=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return m.none()},b=Object.keys,y=Object.hasOwnProperty,w=(e,t)=>y.call(e,t),_=(e,t,o=h)=>e.exists(e=>o(e,t)),x=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},C=(e,t)=>e?m.some(t):m.none(),k=e=>t=>t.options.get(e),S=k("link_assume_external_targets"),T=k("link_context_toolbar"),E=k("link_list"),O=k("link_default_target"),A=k("link_default_protocol"),M=k("link_target_list"),B=k("link_rel_list"),R=k("link_class_list"),N=k("link_title"),V=k("allow_unsafe_link_target"),D=k("link_quicklink"),P=k("link_attributes_postprocess");var I=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.URI"),L=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.dom.TreeWalker"),F=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.Tools");const z=e=>l(e)&&"a"===e.nodeName.toLowerCase(),H=e=>z(e)&&!!$(e),U=(e,t)=>{if(e.collapsed)return[];{const o=e.cloneContents(),n=o.firstChild,r=new L(n,o),i=[];let s=n;do{t(s)&&i.push(s)}while(s=r.next());return i}},Z=e=>/^\w+:/i.test(e),$=e=>{var t,o;return null!==(o=null!==(t=e.getAttribute("data-mce-href"))&&void 0!==t?t:e.getAttribute("href"))&&void 0!==o?o:""},j=(e,t)=>{const o=["noopener"],n=e?e.split(/\s+/):[],r=e=>e.filter(e=>-1===F.inArray(o,e)),i=t?(e=>(e=r(e)).length>0?e.concat(o):o)(n):r(n);return i.length>0?(e=>F.trim(e.sort().join(" ")))(i):""},W=(e,t)=>(t=t||Y(e.selection.getRng())[0]||e.selection.getNode(),Q(t)?m.from(e.dom.select("a[href]",t)[0]):m.from(e.dom.getParent(t,"a[href]"))),q=(e,t)=>W(e,t).isSome(),G=(e,t)=>t.fold(()=>e.getContent({format:"text"}),e=>e.innerText||e.textContent||"").replace(/\uFEFF/g,""),Y=e=>U(e,H),X=e=>F.grep(e,H),K=e=>X(e).length>0,J=e=>{const t=e.schema.getTextInlineElements();if(W(e).exists(e=>e.hasAttribute("data-mce-block")))return!1;const o=e.selection.getRng();return!!o.collapsed||0===U(o,e=>1===e.nodeType&&!z(e)&&!w(t,e.nodeName.toLowerCase())).length},Q=e=>l(e)&&"FIGURE"===e.nodeName&&/\bimage\b/i.test(e.className),ee=(e,t,o)=>{const n=e.selection.getNode(),r=W(e,n),i=((e,t)=>{const o={...t};if(0===B(e).length&&!V(e)){const e=j(o.rel,"_blank"===o.target);o.rel=e||null}return m.from(o.target).isNone()&&!1===M(e)&&(o.target=O(e)),o.href=((e,t)=>"http"!==t&&"https"!==t||Z(e)?e:t+"://"+e)(o.href,S(e)),o})(e,(e=>{return t=["title","rel","class","target"],o=(t,o)=>(e[o].each(e=>{t[o]=e.length>0?e:null}),t),n={href:e.href},((e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)})(t,(e,t)=>{n=o(n,e)}),n;var t,o,n})(o)),s=P(e);l(s)&&s(i),e.undoManager.transact(()=>{o.href===t.href&&t.attach(),r.fold(()=>{((e,t,o,n)=>{const r=e.dom;Q(t)?ie(r,t,n):o.fold(()=>{e.execCommand("mceInsertLink",!1,n);const t=e.selection.getEnd(),o=r.createRng();o.setStartAfter(t),o.setEndAfter(t),e.selection.setRng(o)},t=>{e.insertContent(r.createHTML("a",n,r.encode(t)))})})(e,n,o.text,i)},t=>{e.focus(),((e,t,o,n)=>{o.each(e=>{w(t,"innerText")?t.innerText=e:t.textContent=e}),e.dom.setAttribs(t,n);const r=e.dom.createRng();r.setStartAfter(t),r.setEndAfter(t),e.selection.setRng(r)})(e,t,o.text,i)})})},te=e=>{const{class:t,href:o,rel:n,target:r,text:i,title:a}=e;return(e=>{const t={};var o;return((e,t,o,n)=>{((e,t)=>{const o=b(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}})(e,(e,r)=>{(t(e,r)?o:n)(e,r)})})(e,(e,t)=>!1===s(e),(o=t,(e,t)=>{o[t]=e}),u),t})({class:t.getOrNull(),href:o,rel:n.getOrNull(),target:r.getOrNull(),text:i.getOrNull(),title:a.getOrNull()})},oe=(e,t,o)=>{const n=((e,t)=>{const o=e.options.get,n={allow_html_data_urls:o("allow_html_data_urls"),allow_script_urls:o("allow_script_urls"),allow_svg_data_urls:o("allow_svg_data_urls")},r=t.href;return{...t,href:I.isDomSafe(r,"a",n)?r:""}})(e,o);e.hasPlugin("rtc",!0)?e.execCommand("createlink",!1,te(n)):ee(e,t,n)},ne=e=>{e.hasPlugin("rtc",!0)?e.execCommand("unlink"):(e=>{e.undoManager.transact(()=>{const t=e.selection.getNode();Q(t)?re(e,t):(e=>{const t=e.dom,o=e.selection,n=o.getBookmark(),r=o.getRng().cloneRange(),i=t.getParent(r.startContainer,"a[href]",e.getBody()),s=t.getParent(r.endContainer,"a[href]",e.getBody());i&&r.setStartBefore(i),s&&r.setEndAfter(s),o.setRng(r),e.execCommand("unlink"),o.moveToBookmark(n)})(e),e.focus()})})(e)},re=(e,t)=>{var o;const n=e.dom.select("img",t)[0];if(n){const r=e.dom.getParents(n,"a[href]",t)[0];r&&(null===(o=r.parentNode)||void 0===o||o.insertBefore(n,r),e.dom.remove(r))}},ie=(e,t,o)=>{var n;const r=e.select("img",t)[0];if(r){const t=e.create("a",o);null===(n=r.parentNode)||void 0===n||n.insertBefore(t,r),t.appendChild(r)}},se=e=>n(e.value)?e.value:"",ae=(e,t)=>{const o=[];return F.each(e,e=>{const r=(e=>n(e.text)?e.text:n(e.title)?e.title:"")(e);if(void 0!==e.menu){const n=ae(e.menu,t);o.push({text:r,items:n})}else{const n=t(e);o.push({text:r,value:n})}}),o},le=(e=se)=>t=>m.from(t).map(t=>ae(t,e)),ce=e=>le(se)(e),de=le,ue=(e,t)=>o=>({name:e,type:"listbox",label:t,items:o}),he=se,me=(e,t)=>v(t,t=>(e=>{return w(t=e,o="items")&&void 0!==t[o]&&null!==t[o];var t,o})(t)?me(e,t.items):C(t.value===e,t)),pe=(e,t)=>{const o={text:e.text,title:e.title},n=(e,n)=>{const r=(i=t,s=n,"link"===s?i.link:"anchor"===s?i.anchor:m.none()).getOr([]);var i,s;return((e,t,o,n)=>{const r=n[t],i=e.length>0;return void 0!==r?me(r,o).map(t=>({url:{value:t.value,meta:{text:i?e:t.text,attach:u}},text:i?e:t.text})):m.none()})(o.text,n,r,e)};return{onChange:(e,t)=>{const r=t.name;return"url"===r?(e=>{const t=(n=e.url,C(o.text.length<=0,m.from(null===(r=n.meta)||void 0===r?void 0:r.text).getOr(n.value)));var n,r;const i=(e=>{var t;return C(o.title.length<=0,m.from(null===(t=e.meta)||void 0===t?void 0:t.title).getOr(""))})(e.url);return t.isSome()||i.isSome()?m.some({...t.map(e=>({text:e})).getOr({}),...i.map(e=>({title:e})).getOr({})}):m.none()})(e()):((e,t)=>p.call(e,t))(["anchor","link"],r)>-1?n(e(),r):"text"===r||"title"===r?(o[r]=e()[r],m.none()):m.none()}}};var ge=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.Delay");const fe=e=>{const t=e.href;return t.indexOf("@")>0&&-1===t.indexOf("/")&&-1===t.indexOf("mailto:")?m.some({message:"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?",preprocess:e=>({...e,href:"mailto:"+t})}):m.none()},ve=(e,t)=>o=>{const n=o.href;return 1===e&&!Z(n)||0===e&&/^\s*www(\.|\d\.)/i.test(n)?m.some({message:`The URL you entered seems to be an external link. Do you want to add the required ${t}:// prefix?`,preprocess:e=>({...e,href:t+"://"+n})}):m.none()},be=e=>{const t=e.dom.select("a:not([href])"),o=f(((e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n})(t,e=>{const t=e.name||e.id;return t?[{text:t,value:"#"+t}]:[]}));return o.length>0?m.some([{text:"None",value:""}].concat(o)):m.none()},ye=e=>{const t=R(e);return t.length>0?ce(t):m.none()},we=e=>{try{return m.some(JSON.parse(e))}catch(e){return m.none()}},_e=(e,t)=>{const o=B(e);if(o.length>0){const n=_(t,"_blank"),r=e=>j(he(e),n);return(!1===V(e)?de(r):ce)(o)}return m.none()},xe=[{text:"Current window",value:""},{text:"New window",value:"_blank"}],Ce=e=>{const t=M(e);return i(t)?ce(t).orThunk(()=>m.some(xe)):!1===t?m.none():m.some(xe)},ke=(e,t,o)=>{const n=e.getAttrib(t,o);return null!==n&&n.length>0?m.some(n):m.none()},Se=(e,t)=>(e=>{const t=t=>e.convertURL(t.value||t.url||"","href"),o=E(e);return new Promise(e=>{n(o)?fetch(o).then(e=>e.ok?e.text().then(we):Promise.reject()).then(e,()=>e(m.none())):c(o)?o(t=>e(m.some(t))):e(m.from(o))}).then(e=>e.bind(de(t)).map(e=>e.length>0?[{text:"None",value:""}].concat(e):e))})(e).then(o=>{const n=((e,t)=>{const o=e.dom,n=J(e)?m.some(G(e.selection,t)):m.none(),r=t.bind(e=>m.from(o.getAttrib(e,"href"))),i=t.bind(e=>m.from(o.getAttrib(e,"target"))),s=t.bind(e=>ke(o,e,"rel")),a=t.bind(e=>ke(o,e,"class"));return{url:r,text:n,title:t.bind(e=>ke(o,e,"title")),target:i,rel:s,linkClass:a}})(e,t);return{anchor:n,catalogs:{targets:Ce(e),rels:_e(e,n.target),classes:ye(e),anchor:be(e),link:o},optNode:t,flags:{titleEnabled:N(e)}}}),Te=e=>{const t=(e=>{const t=W(e);return Se(e,t)})(e);t.then(t=>{const o=((e,t)=>o=>{const n=o.getData();if(!n.url.value)return ne(e),void o.close();const r=e=>m.from(n[e]).filter(o=>!_(t.anchor[e],o)),i={href:n.url.value,text:r("text"),target:r("target"),rel:r("rel"),class:r("linkClass"),title:r("title")},s={href:n.url.value,attach:void 0!==n.url.meta&&n.url.meta.attach?n.url.meta.attach:u};((e,t)=>v([fe,ve(S(e),A(e))],e=>e(t)).fold(()=>Promise.resolve(t),o=>new Promise(n=>{((e,t,o)=>{const n=e.selection.getRng();ge.setEditorTimeout(e,()=>{e.windowManager.confirm(t,t=>{e.selection.setRng(n),o(t)})})})(e,o.message,e=>{n(e?o.preprocess(t):t)})})))(e,i).then(t=>{oe(e,s,t)}),o.close()})(e,t);return((e,t,o)=>{const n=e.anchor.text.map(()=>({name:"text",type:"input",label:"Text to display"})).toArray(),r=e.flags.titleEnabled?[{name:"title",type:"input",label:"Title"}]:[],i=((e,t)=>{const o=e.anchor,n=o.url.getOr("");return{url:{value:n,meta:{original:{value:n}}},text:o.text.getOr(""),title:o.title.getOr(""),anchor:n,link:n,rel:o.rel.getOr(""),target:o.target.or(t).getOr(""),linkClass:o.linkClass.getOr("")}})(e,m.from(O(o))),s=e.catalogs,a=pe(i,s);return{title:"Insert/Edit Link",size:"normal",body:{type:"panel",items:f([[{name:"url",type:"urlinput",filetype:"file",label:"URL",picker_text:"Browse links"}],n,r,x([s.anchor.map(ue("anchor","Anchors")),s.rels.map(ue("rel","Rel")),s.targets.map(ue("target","Open link in...")),s.link.map(ue("link","Link list")),s.classes.map(ue("linkClass","Class"))])])},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:i,onChange:(e,{name:t})=>{a.onChange(e.getData,{name:t}).each(t=>{e.setData(t)})},onSubmit:t}})(t,o,e)}).then(t=>{e.windowManager.open(t)})};var Ee=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.VK");const Oe=(e,t)=>{if(t){const n=$(t);if(/^#/.test(n)){const t=e.dom.select(`${n},[name="${o=n,((e,t)=>((e,t)=>""===t||e.length>=t.length&&e.substr(0,0+t.length)===t)(e,t))(o,"#")?(e=>e.substring(1))(o):o}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else(e=>{const t=document.createElement("a");t.target="_blank",t.href=e,t.rel="noreferrer noopener";const o=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});document.dispatchEvent(o),((e,t)=>{document.body.appendChild(e),e.dispatchEvent(t),document.body.removeChild(e)})(t,o)})(t.href)}var o},Ae=(e,t)=>{const o=X(e.dom.getParents(t));return C(1===o.length,o[0])},Me=e=>e.selection.isCollapsed()||(e=>{const t=e.selection.getRng(),o=t.startContainer;return H(o)&&t.startContainer===t.endContainer&&1===e.dom.select("img",o).length})(e)?Ae(e,e.selection.getStart()):(e=>{const t=Y(e.selection.getRng());return C(t.length>0,t[0]).or(Ae(e,e.selection.getNode()))})(e),Be=e=>()=>{e.execCommand("mceLink",!1,{dialog:!0})},Re=(e,t)=>(e.on("NodeChange",t),()=>e.off("NodeChange",t)),Ne=e=>t=>{const o=()=>{t.setActive(!e.mode.isReadOnly()&&q(e,e.selection.getNode())),t.setEnabled(e.selection.isEditable())};return o(),Re(e,o)},Ve=e=>t=>{const o=()=>{t.setEnabled(e.selection.isEditable())};return o(),Re(e,o)},De=e=>t=>{const o=e.dom.getParents(e.selection.getStart()),n=o=>{t.setEnabled((t=>{return K(t)||(o=e.selection.getRng(),Y(o).length>0);var o})(o)&&e.selection.isEditable())};return n(o),Re(e,e=>n(e.parents))},Pe=e=>{const t=(e=>{const t=(()=>{const e=(e=>{const t=(e=>{let t=e;return{get:()=>t,set:e=>{t=e}}})(m.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(m.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(m.some(e))}}})(u);return{...e,on:t=>e.get().each(t)}})(),o=()=>t.get().or(Me(e));return e.on("contextmenu",o=>{Ae(e,o.target).each(t.set)}),e.on("SelectionChange",()=>{t.isSet()||Me(e).each(t.set)}),e.on("click",o=>{t.clear();const n=X(e.dom.getParents(o.target));1===n.length&&Ee.metaKeyPressed(o)&&(o.preventDefault(),Oe(e,n[0]))}),e.on("keydown",n=>{t.clear(),!n.isDefaultPrevented()&&13===n.keyCode&&(e=>!0===e.altKey&&!1===e.shiftKey&&!1===e.ctrlKey&&!1===e.metaKey)(n)&&o().each(t=>{n.preventDefault(),Oe(e,t)})}),{gotoSelectedLink:()=>o().each(t=>Oe(e,t))}})(e);((e,t)=>{e.ui.registry.addToggleButton("link",{icon:"link",tooltip:"Insert/edit link",shortcut:"Meta+K",onAction:Be(e),onSetup:Ne(e)}),e.ui.registry.addButton("openlink",{icon:"new-tab",tooltip:"Open link",onAction:t.gotoSelectedLink,onSetup:De(e)}),e.ui.registry.addButton("unlink",{icon:"unlink",tooltip:"Remove link",onAction:()=>ne(e),onSetup:De(e)})})(e,t),((e,t)=>{e.ui.registry.addMenuItem("openlink",{text:"Open link",icon:"new-tab",onAction:t.gotoSelectedLink,onSetup:De(e)}),e.ui.registry.addMenuItem("link",{icon:"link",text:"Link...",shortcut:"Meta+K",onAction:Be(e),onSetup:Ve(e)}),e.ui.registry.addMenuItem("unlink",{icon:"unlink",text:"Remove link",onAction:()=>ne(e),onSetup:De(e)})})(e,t),(e=>{e.ui.registry.addContextMenu("link",{update:t=>e.dom.isEditable(t)?K(e.dom.getParents(t,"a"))?"link unlink openlink":"link":""})})(e),((e,t)=>{const o=t=>{const o=e.selection.getNode();return t.setEnabled(q(e,o)&&e.selection.isEditable()),u};e.ui.registry.addContextForm("quicklink",{launch:{type:"contextformtogglebutton",icon:"link",tooltip:"Link",onSetup:Ne(e)},label:"Link",predicate:t=>T(e)&&q(e,t),initValue:()=>W(e).fold(()=>"",$),commands:[{type:"contextformtogglebutton",icon:"link",tooltip:"Link",primary:!0,onSetup:t=>{const o=e.selection.getNode();return t.setActive(q(e,o)),Ne(e)(t)},onAction:t=>{const o=t.getValue(),n=(t=>{const o=W(e),n=J(e);if(o.isNone()&&n){const n=G(e.selection,o);return C(0===n.length,t)}return m.none()})(o);oe(e,{href:o,attach:u},{href:o,text:n,title:m.none(),rel:m.none(),target:m.from(O(e)),class:m.none()}),(e=>{e.selection.collapse(!1)})(e),t.hide()}},{type:"contextformbutton",icon:"unlink",tooltip:"Remove link",onSetup:o,onAction:t=>{ne(e),t.hide()}},{type:"contextformbutton",icon:"new-tab",tooltip:"Open link",onSetup:o,onAction:e=>{t.gotoSelectedLink(),e.hide()}}]})})(e,t)};e.add("link",e=>{(e=>{const t=e.options.register;t("link_assume_external_targets",{processor:e=>{const t=n(e)||a(e);return t?!0===e?{value:1,valid:t}:"http"===e||"https"===e?{value:e,valid:t}:{value:0,valid:t}:{valid:!1,message:"Must be a string or a boolean."}},default:!1}),t("link_context_toolbar",{processor:"boolean",default:!1}),t("link_list",{processor:e=>n(e)||c(e)||d(e,r)}),t("link_default_target",{processor:"string"}),t("link_default_protocol",{processor:"string",default:"https"}),t("link_target_list",{processor:e=>a(e)||d(e,r),default:!0}),t("link_rel_list",{processor:"object[]",default:[]}),t("link_class_list",{processor:"object[]",default:[]}),t("link_title",{processor:"boolean",default:!0}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("link_quicklink",{processor:"boolean",default:!1}),t("link_attributes_postprocess",{processor:"function"})})(e),(e=>{e.addCommand("mceLink",(t,o)=>{!0!==(null==o?void 0:o.dialog)&&D(e)?e.dispatch("contexttoolbar-show",{toolbarKey:"quicklink"}):Te(e)})})(e),Pe(e),(e=>{e.addShortcut("Meta+K","",()=>{e.execCommand("mceLink")})})(e)})}()},53646(e,t,o){o(68819)},68819(){!function(){"use strict";var e=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.PluginManager");const t=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&(o=n=e,(r=String).prototype.isPrototypeOf(o)||(null===(i=n.constructor)||void 0===i?void 0:i.name)===r.name)?"string":t;var o,n,r,i})(t)===e,o=e=>t=>typeof t===e,n=t("string"),r=t("object"),i=t("array"),s=o("boolean"),a=e=>!(e=>null==e)(e),l=o("function"),c=o("number"),d=()=>{},u=e=>()=>e,h=(e,t)=>e===t,m=e=>t=>!e(t),p=u(!1);class g{constructor(e,t){this.tag=e,this.value=t}static some(e){return new g(!0,e)}static none(){return g.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?g.some(e(this.value)):g.none()}bind(e){return this.tag?e(this.value):g.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:g.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return a(e)?g.some(e):g.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}g.singletonNone=new g(!1);const f=Array.prototype.slice,v=Array.prototype.indexOf,b=Array.prototype.push,y=(e,t)=>{return o=e,n=t,v.call(o,n)>-1;var o,n},w=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},_=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n},x=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},C=(e,t)=>{const o=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t(r,n)&&o.push(r)}return o},k=(e,t,o)=>(x(e,(e,n)=>{o=t(o,e,n)}),o),S=(e,t,o)=>{for(let n=0,r=e.length;n<r;n++){const r=e[n];if(t(r,n))return g.some(r);if(o(r,n))break}return g.none()},T=(e,t)=>S(e,t,p),E=(e,t)=>(e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!i(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);b.apply(t,e[o])}return t})(_(e,t)),O=e=>{const t=f.call(e,0);return t.reverse(),t},A=(e,t)=>t>=0&&t<e.length?g.some(e[t]):g.none(),M=e=>A(e,0),B=e=>A(e,e.length-1),R=(e,t)=>{const o=[],n=l(t)?e=>w(o,o=>t(o,e)):e=>y(o,e);for(let t=0,r=e.length;t<r;t++){const r=e[t];n(r)||o.push(r)}return o},N=Object.keys,V=(e,t)=>{const o=N(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}},D="undefined"!=typeof window?window:Function("return this;")(),P=(e,t,o=h)=>e.exists(e=>o(e,t)),I=(e,t,o)=>e.isSome()&&t.isSome()?g.some(o(e.getOrDie(),t.getOrDie())):g.none(),L=(e,t)=>((e,t)=>{let o=null!=t?t:D;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t),F=(z=/^\s+|\s+$/g,e=>e.replace(z,""));var z;const H=e=>"\ufeff"===e,U=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},Z=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return U(o.childNodes[0])},$=(e,t)=>{const o=(t||document).createElement(e);return U(o)},j=U,W=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},q=(e,t)=>e.dom===t.dom,G=W,Y=Object.getPrototypeOf,X=e=>{const t=L("ownerDocument.defaultView",e);return r(e)&&((e=>((e,t)=>{const o=((e,t)=>L(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Y(e).constructor.name))},K=e=>e.dom.nodeName.toLowerCase(),J=e=>e.dom.nodeType,Q=e=>t=>J(t)===e,ee=e=>te(e)&&X(e.dom),te=Q(1),oe=Q(3),ne=Q(11),re=e=>t=>te(t)&&K(t)===e,ie=e=>g.from(e.dom.parentNode).map(j),se=e=>_(e.dom.childNodes,j),ae=(e,t)=>{const o=e.dom.childNodes;return g.from(o[t]).map(j)},le=e=>ae(e,0),ce=e=>ae(e,e.dom.childNodes.length-1),de=e=>j(e.dom.host),ue=(e,t)=>{ie(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},he=(e,t)=>{e.dom.appendChild(t.dom)},me=(e,t)=>{x(t,t=>{he(e,t)})},pe=(e,t)=>{const o=e.dom;V(t,(e,t)=>{((e,t,o)=>{if(!(n(o)||s(o)||c(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")})(o,t,e)})},ge=e=>k(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}),fe=e=>{e.dom.textContent="",x(se(e),e=>{ve(e)})},ve=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},be=e=>(e=>j(e.dom.cloneNode(!0)))(e),ye=(e,t)=>{const o=((e,t)=>{const o=$(t),n=ge(e);return pe(o,n),o})(e,t);var n,r;r=o,(e=>g.from(e.dom.nextSibling).map(j))(n=e).fold(()=>{ie(n).each(e=>{he(e,r)})},e=>{ue(e,r)});const i=se(e);return me(o,i),ve(e),o},we=e=>_(e,j),_e=e=>{const t=oe(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=(e=>j(e.dom.getRootNode()))(e);return ne(o=t)&&a(o.dom.host)?g.some(t):g.none();var o})(j(t)).fold(()=>o.body.contains(t),(n=_e,r=de,e=>n(r(e))));var n,r},xe=(e,t,o)=>{((e,t,o)=>{if(!n(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);(e=>void 0!==e.style&&l(e.style.getPropertyValue))(e)&&e.style.setProperty(t,o)})(e.dom,t,o)},Ce=(e,t)=>{const o=(t||document).createDocumentFragment();return x(e,e=>{o.appendChild(e.dom)}),j(o)};var ke=(e,t,o,n,r)=>e(o,n)?g.some(o):l(r)&&r(o)?g.none():t(o,n,r);const Se=(e,t,o)=>{let n=e.dom;const r=l(o)?o:p;for(;n.parentNode;){n=n.parentNode;const e=j(n);if(t(e))return g.some(e);if(r(e))break}return g.none()},Te=(e,t,o)=>ke((e,t)=>t(e),Se,e,t,o),Ee=(e,t,o)=>Se(e,e=>W(e,t),o);var Oe=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.dom.RangeUtils"),Ae=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.dom.TreeWalker"),Me=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.VK"),Be=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.dom.DOMUtils"),Re=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.Tools");const Ne=e=>t=>a(t)&&t.nodeName.toLowerCase()===e,Ve=e=>t=>a(t)&&e.test(t.nodeName),De=e=>a(e)&&3===e.nodeType,Pe=e=>a(e)&&1===e.nodeType,Ie=Ve(/^(OL|UL|DL)$/),Le=Ve(/^(OL|UL)$/),Fe=Ne("ol"),ze=Ve(/^(LI|DT|DD)$/),He=Ve(/^(DT|DD)$/),Ue=Ve(/^(TH|TD)$/),Ze=Ne("br"),$e=(e,t)=>a(t)&&t.nodeName in e.schema.getTextBlockElements(),je=(e,t)=>a(e)&&e.nodeName in t,We=(e,t)=>a(t)&&t.nodeName in e.schema.getVoidElements(),qe=(e,t,o)=>{const n=e.isEmpty(t);return!(o&&e.select("span[data-mce-type=bookmark]",t).length>0)&&n},Ge=(e,t)=>e.isChildOf(t,e.getRoot()),Ye=e=>t=>t.options.get(e),Xe=Ye("lists_indent_on_tab"),Ke=Ye("forced_root_block"),Je=Ye("forced_root_block_attrs"),Qe=(e,t,o={})=>{const n=e.dom,r=e.schema.getBlockElements(),i=n.createFragment(),s=Ke(e),a=Je(e);let l,c,d=!1;for(c=n.create(s,{...a,...o.style?{style:o.style}:{}}),je(t.firstChild,r)||i.appendChild(c);l=t.firstChild;){const e=l.nodeName;d||"SPAN"===e&&"bookmark"===l.getAttribute("data-mce-type")||(d=!0),je(l,r)?(i.appendChild(l),c=null):(c||(c=n.create(s,a),i.appendChild(c)),c.appendChild(l))}return!d&&c&&c.appendChild(n.create("br",{"data-mce-bogus":"1"})),i},et=Be.DOM,tt=re("dd"),ot=re("dt"),nt=(e,t)=>{var o;tt(t)?ye(t,"dt"):ot(t)&&(o=t,g.from(o.dom.parentElement).map(j)).each(o=>((e,t,o)=>{const n=et.select('span[data-mce-type="bookmark"]',t),r=Qe(e,o),i=et.createRng();i.setStartAfter(o),i.setEndAfter(t);const s=i.extractContents();for(let t=s.firstChild;t;t=t.firstChild)if("LI"===t.nodeName&&e.dom.isEmpty(t)){et.remove(t);break}e.dom.isEmpty(s)||et.insertAfter(s,t),et.insertAfter(r,t);const a=o.parentElement;a&&qe(e.dom,a)&&(e=>{const t=e.parentNode;t&&Re.each(n,e=>{t.insertBefore(e,o.parentNode)}),et.remove(e)})(a),et.remove(o),qe(e.dom,t)&&et.remove(t)})(e,o.dom,t.dom))},rt=e=>{ot(e)&&ye(e,"dd")},it=(e,t)=>{if(De(e))return{container:e,offset:t};const o=Oe.getNode(e,t);return De(o)?{container:o,offset:t>=e.childNodes.length?o.data.length:0}:o.previousSibling&&De(o.previousSibling)?{container:o.previousSibling,offset:o.previousSibling.data.length}:o.nextSibling&&De(o.nextSibling)?{container:o.nextSibling,offset:0}:{container:e,offset:t}},st=e=>{const t=e.cloneRange(),o=it(e.startContainer,e.startOffset);t.setStart(o.container,o.offset);const n=it(e.endContainer,e.endOffset);return t.setEnd(n.container,n.offset),t},at=["OL","UL","DL"],lt=at.join(","),ct=(e,t)=>{const o=t||e.selection.getStart(!0);return e.dom.getParent(o,lt,ht(e,o))},dt=e=>{const t=e.selection.getSelectedBlocks();return C(((e,t)=>{const o=Re.map(t,t=>e.dom.getParent(t,"li,dd,dt",ht(e,t))||t);return R(o)})(e,t),ze)},ut=(e,t)=>{const o=e.dom.getParents(t,"TD,TH");return o.length>0?o[0]:e.getBody()},ht=(e,t)=>{const o=e.dom.getParents(t,e.dom.isBlock),n=T(o,t=>{return(t=>t.nodeName.toLowerCase()!==Ke(e))(t)&&(o=e.schema,!Ie(n=t)&&!ze(n)&&w(at,e=>o.isValidChild(n.nodeName,e)));var o,n});return n.getOr(e.getBody())},mt=(e,t)=>{const o=e.dom.getParents(t,"ol,ul",ht(e,t));return B(o)},pt=(e,t)=>{const o=_(t,t=>mt(e,t).getOr(t));return R(o)},gt=e=>/\btox\-/.test(e.className),ft=(e,t)=>S(e,Ie,Ue).exists(e=>e.nodeName===t&&!gt(e)),vt=(e,t)=>null!==t&&!e.dom.isEditable(t),bt=(e,t)=>{const o=e.dom.getParent(t,"ol,ul,dl");return vt(e,o)||!e.selection.isEditable()},yt=(e,t)=>{const o=e.selection.getNode();return t({parents:e.dom.getParents(o),element:o}),e.on("NodeChange",t),()=>e.off("NodeChange",t)},wt=(e,t,o)=>e.dispatch("ListMutation",{action:t,element:o}),_t=e=>G(e,"OL,UL"),xt=e=>le(e).exists(_t),Ct=e=>"listAttributes"in e,kt=e=>"isComment"in e,St=e=>e.depth>0,Tt=e=>e.isSelected,Et=e=>{const t=se(e),o=ce(e).exists(_t)?t.slice(0,-1):t;return _(o,be)},Ot=(e,t)=>{he(e.item,t.list)},At=(e,t)=>{const o={list:$(t,e),item:$("li",e)};return he(o.list,o.item),o},Mt=(e,t,o)=>{const n=t.slice(0,o.depth);return B(n).each(t=>{if(Ct(o)){const n=((e,t,o)=>{const n=$("li",e);return pe(n,t),me(n,o),n})(e,o.itemAttributes,o.content);((e,t)=>{he(e.list,t),e.item=t})(t,n),((e,t)=>{K(e.list)!==t.listType&&(e.list=ye(e.list,t.listType)),pe(e.list,t.listAttributes)})(t,o)}else if((e=>"isFragment"in e)(o))me(t.item,o.content);else{const e=Z(`\x3c!--${o.content}--\x3e`);he(t.list,e)}}),n},Bt=(e,t)=>{let o=g.none();const n=k(t,(t,n,r)=>kt(n)?0===r?(o=g.some(n),t):Mt(e,t,n):n.depth>t.length?((e,t,o)=>{const n=((e,t,o)=>{const n=[];for(let r=0;r<o;r++)n.push(At(e,Ct(t)?t.listType:t.parentListType));return n})(e,o,o.depth-t.length);var r;return(e=>{for(let t=1;t<e.length;t++)Ot(e[t-1],e[t])})(n),((e,t)=>{for(let t=0;t<e.length-1;t++)xe(e[t].item,"list-style-type","none");B(e).each(e=>{Ct(t)&&(pe(e.list,t.listAttributes),pe(e.item,t.itemAttributes)),me(e.item,t.content)})})(n,o),r=n,I(B(t),M(r),Ot),t.concat(n)})(e,t,n):Mt(e,t,n),[]);return o.each(e=>{const t=Z(`\x3c!--${e.content}--\x3e`);M(n).each(e=>{((e,t)=>{le(e).fold(()=>{he(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})})(e.list,t)})}),M(n).map(e=>e.list)},Rt=e=>(x(e,(t,o)=>{((e,t)=>{const o=e[t].depth,n=e=>e.depth===o&&!e.dirty,r=e=>e.depth<o;return S(O(e.slice(0,t)),n,r).orThunk(()=>S(e.slice(t+1),n,r))})(e,o).fold(()=>{t.dirty&&Ct(t)&&(e=>{e.listAttributes=((e,t)=>{const o={};var n;return((e,t,o,n)=>{V(e,(e,r)=>{(t(e,r)?o:n)(e,r)})})(e,t,(n=o,(e,t)=>{n[t]=e}),d),o})(e.listAttributes,(e,t)=>"start"!==t)})(t)},e=>{return n=e,void(Ct(o=t)&&Ct(n)&&(o.listType=n.listType,o.listAttributes={...n.listAttributes}));var o,n})}),e),Nt=(e,t,o,n)=>{var r,i;if(8===J(i=n)||"#comment"===K(i))return[{depth:e+1,content:null!==(r=n.dom.nodeValue)&&void 0!==r?r:"",dirty:!1,isSelected:!1,isComment:!0}];t.each(e=>{q(e.start,n)&&o.set(!0)});const s=((e,t,o)=>ie(e).filter(te).map(n=>({depth:t,dirty:!1,isSelected:o,content:Et(e),itemAttributes:ge(e),listAttributes:ge(n),listType:K(n),isInPreviousLi:!1})))(n,e,o.get());t.each(e=>{q(e.end,n)&&o.set(!1)});const a=ce(n).filter(_t).map(n=>Dt(e,t,o,n)).getOr([]);return s.toArray().concat(a)},Vt=(e,t,o,n)=>le(n).filter(_t).fold(()=>Nt(e,t,o,n),r=>{const i=k(se(n),(n,i,s)=>{if(0===s)return n;if(G(i,"LI"))return n.concat(Nt(e,t,o,i));{const t={isFragment:!0,depth:e,content:[i],isSelected:!1,dirty:!1,parentListType:K(r)};return n.concat(t)}},[]);return Dt(e,t,o,r).concat(i)}),Dt=(e,t,o,n)=>E(se(n),n=>(_t(n)?Dt:Vt)(e+1,t,o,n)),Pt=(e,t,o)=>{const n=((e,t)=>{const o=(()=>{let e=!1;return{get:()=>e,set:t=>{e=t}}})();return _(e,e=>({sourceList:e,entries:Dt(0,t,o,e)}))})(t,(e=>{const t=_(dt(e),j);return I(T(t,m(xt)),T(O(t),m(xt)),(e,t)=>({start:e,end:t}))})(e));x(n,t=>{((e,t)=>{x(C(e,Tt),e=>((e,t)=>{switch(e){case"Indent":t.depth++;break;case"Outdent":t.depth--;break;case"Flatten":t.depth=0}t.dirty=!0})(t,e))})(t.entries,o);const n=((e,t)=>E(((e,t)=>{if(0===e.length)return[];{let o=t(e[0]);const n=[];let r=[];for(let i=0,s=e.length;i<s;i++){const s=e[i],a=t(s);a!==o&&(n.push(r),r=[]),o=a,r.push(s)}return 0!==r.length&&n.push(r),n}})(t,St),t=>M(t).exists(St)?((e,t)=>{const o=Rt(t);return Bt(e.contentDocument,o).toArray()})(e,t):((e,t)=>{const o=Rt(t);return _(o,t=>{const o=kt(t)?Ce([Z(`\x3c!--${t.content}--\x3e`)]):Ce(t.content),n=Ct(t)?t.itemAttributes:{};return j(Qe(e,o.dom,n))})})(e,t)))(e,t.entries);var r;x(n,t=>{wt(e,"Indent"===o?"IndentList":"OutdentList",t.dom)}),r=t.sourceList,x(n,e=>{ue(r,e)}),ve(t.sourceList)})},It=(e,t)=>{const o=we((e=>{const t=(e=>{const t=mt(e,e.selection.getStart()),o=C(e.selection.getSelectedBlocks(),Le);return t.toArray().concat(o)})(e),o=(e=>{const t=e.selection.getStart();return e.dom.getParents(t,"ol,ul",ht(e,t))})(e);return T(o,e=>{return t=j(e),ie(t).exists(e=>ze(e.dom)&&le(e).exists(e=>!Ie(e.dom))&&ce(e).exists(e=>!Ie(e.dom)));var t}).fold(()=>pt(e,t),e=>[e])})(e)),n=we((e=>C(dt(e),He))(e));let r=!1;if(o.length||n.length){const i=e.selection.getBookmark();Pt(e,o,t),((e,t,o)=>{x(o,"Indent"===t?rt:t=>nt(e,t))})(e,t,n),e.selection.moveToBookmark(i),e.selection.setRng(st(e.selection.getRng())),e.nodeChanged(),r=!0}return r},Lt=(e,t)=>!(e=>{const t=ct(e);return vt(e,t)||!e.selection.isEditable()})(e)&&It(e,t),Ft=e=>Lt(e,"Indent"),zt=e=>Lt(e,"Outdent"),Ht=e=>Lt(e,"Flatten");var Ut=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.dom.BookmarkManager");const Zt=Be.DOM,$t=e=>{const t={},o=o=>{let n=e[o?"startContainer":"endContainer"],r=e[o?"startOffset":"endOffset"];if(Pe(n)){const e=Zt.create("span",{"data-mce-type":"bookmark"});n.hasChildNodes()?(r=Math.min(r,n.childNodes.length-1),o?n.insertBefore(e,n.childNodes[r]):Zt.insertAfter(e,n.childNodes[r])):n.appendChild(e),n=e,r=0}t[o?"startContainer":"endContainer"]=n,t[o?"startOffset":"endOffset"]=r};return o(!0),e.collapsed||o(),t},jt=e=>{const t=t=>{let o=e[t?"startContainer":"endContainer"],n=e[t?"startOffset":"endOffset"];if(o){if(Pe(o)&&o.parentNode){const e=o;n=(e=>{var t;let o=null===(t=e.parentNode)||void 0===t?void 0:t.firstChild,n=0;for(;o;){if(o===e)return n;Pe(o)&&"bookmark"===o.getAttribute("data-mce-type")||n++,o=o.nextSibling}return-1})(o),o=o.parentNode,Zt.remove(e),!o.hasChildNodes()&&Zt.isBlock(o)&&o.appendChild(Zt.create("br"))}e[t?"startContainer":"endContainer"]=o,e[t?"startOffset":"endOffset"]=n}};t(!0),t();const o=Zt.createRng();return o.setStart(e.startContainer,e.startOffset),e.endContainer&&o.setEnd(e.endContainer,e.endOffset),st(o)},Wt=e=>{switch(e){case"UL":return"ToggleUlList";case"OL":return"ToggleOlList";case"DL":return"ToggleDLList"}},qt=(e,t)=>{Re.each(t,(t,o)=>{e.setAttribute(o,t)})},Gt=(e,t,o)=>{((e,t,o)=>{const n=o["list-style-type"]?o["list-style-type"]:null;e.setStyle(t,"list-style-type",n)})(e,t,o),((e,t,o)=>{qt(t,o["list-attributes"]),Re.each(e.select("li",t),e=>{qt(e,o["list-item-attributes"])})})(e,t,o)},Yt=(e,t)=>a(t)&&!je(t,e.schema.getBlockElements()),Xt=(e,t,o,n)=>{let r=t[o?"startContainer":"endContainer"];const i=t[o?"startOffset":"endOffset"];Pe(r)&&(r=r.childNodes[Math.min(i,r.childNodes.length-1)]||r),!o&&Ze(r.nextSibling)&&(r=r.nextSibling);const s=(t,o)=>{var r;const i=new Ae(t,(t=>{for(;!e.dom.isBlock(t)&&t.parentNode&&n!==t;)t=t.parentNode;return t})(t)),s=o?"next":"prev";let a;for(;a=i[s]();)if(!We(e,a)&&!H(a.textContent)&&0!==(null===(r=a.textContent)||void 0===r?void 0:r.length))return g.some(a);return g.none()};if(o&&De(r))if(H(r.textContent))r=s(r,!1).getOr(r);else for(null!==r.parentNode&&Yt(e,r.parentNode)&&(r=r.parentNode);null!==r.previousSibling&&(Yt(e,r.previousSibling)||De(r.previousSibling));)r=r.previousSibling;if(!o&&De(r))if(H(r.textContent))r=s(r,!0).getOr(r);else for(null!==r.parentNode&&Yt(e,r.parentNode)&&(r=r.parentNode);null!==r.nextSibling&&(Yt(e,r.nextSibling)||De(r.nextSibling));)r=r.nextSibling;for(;r.parentNode!==n;){const t=r.parentNode;if($e(e,r))return r;if(/^(TD|TH)$/.test(t.nodeName))return r;r=t}return r},Kt=(e,t,o)=>{const n=e.selection.getRng();let r="LI";const i=ht(e,((e,t)=>{const o=e.selection.getStart(!0),n=Xt(e,t,!0,e.getBody());return r=j(n),i=j(t.commonAncestorContainer),s=r,a=function(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}(q,i),Se(s,a,void 0).isSome()?t.commonAncestorContainer:o;var r,i,s,a})(e,n)),s=e.dom;if("false"===s.getContentEditable(e.selection.getNode()))return;"DL"===(t=t.toUpperCase())&&(r="DT");const a=$t(n),l=C(((e,t,o)=>{const n=[],r=e.dom,i=Xt(e,t,!0,o),s=Xt(e,t,!1,o);let a;const l=[];for(let e=i;e&&(l.push(e),e!==s);e=e.nextSibling);return Re.each(l,t=>{var i;if($e(e,t))return n.push(t),void(a=null);if(r.isBlock(t)||Ze(t))return Ze(t)&&r.remove(t),void(a=null);const s=t.nextSibling;Ut.isBookmarkNode(t)&&(Ie(s)||$e(e,s)||!s&&t.parentNode===o)?a=null:(a||(a=r.create("p"),null===(i=t.parentNode)||void 0===i||i.insertBefore(a,t),n.push(a)),a.appendChild(t))}),n})(e,n,i),e.dom.isEditable);Re.each(l,n=>{let i;const a=n.previousSibling,l=n.parentNode;ze(l)||(a&&Ie(a)&&a.nodeName===t&&((e,t,o)=>{const n=e.getStyle(t,"list-style-type");let r=o?o["list-style-type"]:"";return r=null===r?"":r,n===r})(s,a,o)?(i=a,n=s.rename(n,r),a.appendChild(n)):(i=s.create(t),l.insertBefore(i,n),i.appendChild(n),n=s.rename(n,r)),((e,t)=>{Re.each(["margin","margin-right","margin-bottom","margin-left","margin-top","padding","padding-right","padding-bottom","padding-left","padding-top"],o=>e.setStyle(t,o,""))})(s,n),Gt(s,i,o),Qt(e.dom,i))}),e.selection.setRng(jt(a))},Jt=(e,t,o)=>{return((e,t)=>Ie(e)&&e.nodeName===(null==t?void 0:t.nodeName))(t,o)&&((e,t,o)=>e.getStyle(t,"list-style-type",!0)===e.getStyle(o,"list-style-type",!0))(e,t,o)&&(n=o,t.className===n.className);var n},Qt=(e,t)=>{let o,n=t.nextSibling;if(Jt(e,t,n)){const r=n;for(;o=r.firstChild;)t.appendChild(o);e.remove(r)}if(n=t.previousSibling,Jt(e,t,n)){const r=n;for(;o=r.lastChild;)t.insertBefore(o,t.firstChild);e.remove(r)}},eo=(e,t,o,n)=>{if(t.nodeName!==o){const r=e.dom.rename(t,o);Gt(e.dom,r,n),wt(e,Wt(o),r)}else Gt(e.dom,t,n),wt(e,Wt(o),t)},to=(e,t,o,n)=>{if(t.classList.forEach((e,o,n)=>{e.startsWith("tox-")&&(n.remove(e),0===n.length&&t.removeAttribute("class"))}),t.nodeName!==o){const r=e.dom.rename(t,o);Gt(e.dom,r,n),wt(e,Wt(o),r)}else Gt(e.dom,t,n),wt(e,Wt(o),t)},oo=e=>"list-style-type"in e,no=(e,t,o)=>{const n=ct(e);if(bt(e,n))return;const i=(e=>{const t=ct(e),o=e.selection.getSelectedBlocks();return((e,t)=>a(e)&&1===t.length&&t[0]===e)(t,o)?(e=>C(e.querySelectorAll(lt),Ie))(t):C(o,e=>Ie(e)&&t!==e)})(e),s=r(o)?o:{};i.length>0?((e,t,o,n,r)=>{const i=Ie(t);if(!i||t.nodeName!==n||oo(r)||gt(t)){Kt(e,n,r);const s=$t(e.selection.getRng()),a=i?[t,...o]:o,l=i&&gt(t)?to:eo;Re.each(a,t=>{l(e,t,n,r)}),e.selection.setRng(jt(s))}else Ht(e)})(e,n,i,t,s):((e,t,o,n)=>{if(t!==e.getBody())if(t)if(t.nodeName!==o||oo(n)||gt(t)){const r=$t(e.selection.getRng());gt(t)&&t.classList.forEach((e,o,n)=>{e.startsWith("tox-")&&(n.remove(e),0===n.length&&t.removeAttribute("class"))}),Gt(e.dom,t,n);const i=e.dom.rename(t,o);Qt(e.dom,i),e.selection.setRng(jt(r)),Kt(e,o,n),wt(e,Wt(o),i)}else Ht(e);else Kt(e,o,n),wt(e,Wt(o),t)})(e,n,t,s)},ro=Be.DOM,io=(e,t)=>{const o=Re.grep(e.select("ol,ul",t));Re.each(o,t=>{((e,t)=>{const o=t.parentElement;if(o&&"LI"===o.nodeName&&o.firstChild===t){const n=o.previousSibling;n&&"LI"===n.nodeName?(n.appendChild(t),qe(e,o)&&ro.remove(o)):ro.setStyle(o,"listStyleType","none")}if(Ie(o)){const e=o.previousSibling;e&&"LI"===e.nodeName&&e.appendChild(t)}})(e,t)})},so=(e,t,o,n)=>{let r=t.startContainer;const i=t.startOffset;if(De(r)&&(o?i<r.data.length:i>0))return r;const s=e.schema.getNonEmptyElements();Pe(r)&&(r=Oe.getNode(r,i));const a=new Ae(r,n);o&&((e,t)=>!!Ze(t)&&e.isBlock(t.nextSibling)&&!Ze(t.previousSibling))(e.dom,r)&&a.next();const l=o?a.next.bind(a):a.prev2.bind(a);for(;r=l();){if("LI"===r.nodeName&&!r.hasChildNodes())return r;if(s[r.nodeName])return r;if(De(r)&&r.data.length>0)return r}return null},ao=(e,t)=>{const o=t.childNodes;return 1===o.length&&!Ie(o[0])&&e.isBlock(o[0])},lo=e=>g.from(e).map(j).filter(ee).exists(e=>((e,t=!1)=>{return _e(e)?e.dom.isContentEditable:(o=e,ke((e,t)=>W(e,t),Ee,o,"[contenteditable]",void 0)).fold(u(t),e=>"true"===(e=>e.dom.contentEditable)(e));var o})(e)&&!y(["details"],K(e))),co=(e,t,o)=>{let n;const r=ao(e,o)?o.firstChild:o;if(((e,t)=>{ao(e,t)&&lo(t.firstChild)&&e.remove(t.firstChild,!0)})(e,t),!qe(e,t,!0))for(;n=t.firstChild;)r.appendChild(n)},uo=(e,t,o)=>{let n;const r=t.parentNode;if(!Ge(e,t)||!Ge(e,o))return;Ie(o.lastChild)&&(n=o.lastChild),r===o.lastChild&&Ze(r.previousSibling)&&e.remove(r.previousSibling);const i=o.lastChild;i&&Ze(i)&&t.hasChildNodes()&&e.remove(i),qe(e,o,!0)&&fe(j(o)),co(e,t,o),n&&o.appendChild(n);const s=((e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)})(j(o),j(t))?e.getParents(t,Ie,o):[];e.remove(t),x(s,t=>{qe(e,t)&&t!==e.getRoot()&&e.remove(t)})},ho=(e,t)=>{const o=e.dom,n=e.selection,r=n.getStart(),i=ut(e,r),s=o.getParent(n.getStart(),"LI",i);if(s){const r=s.parentElement;if(r===e.getBody()&&qe(o,r))return!0;const a=st(n.getRng()),l=o.getParent(so(e,a,t,i),"LI",i),c=l&&(t?o.isChildOf(s,l):o.isChildOf(l,s));if(l&&l!==s&&!c)return e.undoManager.transact(()=>{var o,n;t?((e,t,o,n)=>{const r=e.dom;if(r.isEmpty(n))((e,t,o)=>{fe(j(o)),uo(e.dom,t,o),e.selection.setCursorLocation(o,0)})(e,o,n);else{const i=$t(t);uo(r,o,n),e.selection.setRng(jt(i))}})(e,a,l,s):(null===(n=(o=s).parentNode)||void 0===n?void 0:n.firstChild)===o?zt(e):((e,t,o,n)=>{const r=$t(t);uo(e.dom,o,n);const i=jt(r);e.selection.setRng(i)})(e,a,s,l)}),!0;if(c&&!t&&l!==s){const t=a.commonAncestorContainer.parentElement;return!(!t||o.isChildOf(l,t)||(e.undoManager.transact(()=>{const n=$t(a);co(o,t,l),t.remove();const r=jt(n);e.selection.setRng(r)}),0))}if(!l&&!t&&0===a.startOffset&&0===a.endOffset)return e.undoManager.transact(()=>{Ht(e)}),!0}return!1},mo=e=>{const t=e.selection.getStart(),o=ut(e,t);return e.dom.getParent(t,"LI,DT,DD",o)||dt(e).length>0},po=(e,t)=>{const o=e.selection;return!bt(e,o.getNode())&&(o.isCollapsed()?((e,t)=>ho(e,t)||((e,t)=>{const o=e.dom,n=e.selection.getStart(),r=ut(e,n),i=o.getParent(n,o.isBlock,r);if(i&&o.isEmpty(i,void 0,{checkRootAsContent:!0})){const n=st(e.selection.getRng()),s=so(e,n,t,r),a=o.getParent(s,"LI",r);if(s&&a){const l=e=>y(["td","th","caption"],K(e)),c=e=>e.dom===r;return!!((e,t,o=h)=>I(e,t,o).getOr(e.isNone()&&t.isNone()))(Te(j(a),l,c),Te(j(n.startContainer),l,c),q)&&(e.undoManager.transact(()=>{const n=a.parentNode;((e,t,o)=>{const n=e.getParent(t.parentNode,e.isBlock,o);e.remove(t),n&&e.isEmpty(n)&&e.remove(n)})(o,i,r),Qt(o,n),e.selection.select(s,!0),e.selection.collapse(t)}),!0)}}return!1})(e,t))(e,t):(e=>!!mo(e)&&(e.undoManager.transact(()=>{let t=!0;const o=()=>t=!1;e.on("input",o),e.execCommand("Delete"),e.off("input",o),t&&e.dispatch("input"),io(e.dom,e.getBody())}),!0))(e))},go=e=>{const t=O(F(e).split("")),o=_(t,(e,t)=>{const o=e.toUpperCase().charCodeAt(0)-"A".charCodeAt(0)+1;return Math.pow(26,t)*o});return k(o,(e,t)=>e+t,0)},fo=e=>{if(--e<0)return"";{const t=e%26,o=Math.floor(e/26);return fo(o)+String.fromCharCode("A".charCodeAt(0)+t)}},vo=e=>{const t=parseInt(e.start,10);return P(e.listStyleType,"upper-alpha")?fo(t):P(e.listStyleType,"lower-alpha")?fo(t).toLowerCase():e.start},bo=(e,t)=>()=>{const o=ct(e);return a(o)&&o.nodeName===t},yo=e=>{e.addCommand("mceListProps",()=>{(e=>{const t=ct(e);Fe(t)&&!bt(e,t)&&e.windowManager.open({title:"List Properties",body:{type:"panel",items:[{type:"input",name:"start",label:"Start list at number",inputMode:"numeric"}]},initialData:{start:vo({start:e.dom.getAttrib(t,"start","1"),listStyleType:g.from(e.dom.getStyle(t,"list-style-type"))})},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],onSubmit:t=>{(e=>{switch((e=>/^[0-9]+$/.test(e)?2:/^[A-Z]+$/.test(e)?0:/^[a-z]+$/.test(e)?1:e.length>0?4:3)(e)){case 2:return g.some({listStyleType:g.none(),start:e});case 0:return g.some({listStyleType:g.some("upper-alpha"),start:go(e).toString()});case 1:return g.some({listStyleType:g.some("lower-alpha"),start:go(e).toString()});case 3:return g.some({listStyleType:g.none(),start:""});case 4:return g.none()}})(t.getData().start).each(t=>{e.execCommand("mceListUpdate",!1,{attrs:{start:"1"===t.start?"":t.start},styles:{"list-style-type":t.listStyleType.getOr("")}})}),t.close()}})})(e)})};var wo=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.html.Node");const _o=e=>3===e.type,xo=e=>0===e.length,Co=e=>{const t=(t,o)=>{const n=wo.create("li");x(t,e=>n.append(e)),o?e.insert(n,o,!0):e.append(n)},o=k(e.children(),(e,o)=>_o(o)?[...e,o]:xo(e)||_o(o)?e:(t(e,o),[]),[]);xo(o)||t(o)},ko=(e,t)=>o=>(o.setEnabled(e.selection.isEditable()),yt(e,n=>{o.setActive(ft(n.parents,t)),o.setEnabled(!bt(e,n.element)&&e.selection.isEditable())})),So=(e,t)=>o=>yt(e,n=>o.setEnabled(ft(n.parents,t)&&!bt(e,n.element)));e.add("lists",e=>((e=>{(0,e.options.register)("lists_indent_on_tab",{processor:"boolean",default:!0})})(e),(e=>{e.on("PreInit",()=>{const{parser:t}=e;t.addNodeFilter("ul,ol",e=>x(e,Co))})})(e),e.hasPlugin("rtc",!0)?yo(e):((e=>{Xe(e)&&(e=>{e.on("keydown",t=>{t.keyCode!==Me.TAB||Me.metaKeyPressed(t)||e.undoManager.transact(()=>{(t.shiftKey?zt(e):Ft(e))&&t.preventDefault()})})})(e),(e=>{e.on("ExecCommand",t=>{const o=t.command.toLowerCase();"delete"!==o&&"forwarddelete"!==o||!mo(e)||io(e.dom,e.getBody())}),e.on("keydown",t=>{t.keyCode===Me.BACKSPACE?po(e,!1)&&t.preventDefault():t.keyCode===Me.DELETE&&po(e,!0)&&t.preventDefault()})})(e)})(e),(e=>{e.on("BeforeExecCommand",t=>{const o=t.command.toLowerCase();"indent"===o?Ft(e):"outdent"===o&&zt(e)}),e.addCommand("InsertUnorderedList",(t,o)=>{no(e,"UL",o)}),e.addCommand("InsertOrderedList",(t,o)=>{no(e,"OL",o)}),e.addCommand("InsertDefinitionList",(t,o)=>{no(e,"DL",o)}),e.addCommand("RemoveList",()=>{Ht(e)}),yo(e),e.addCommand("mceListUpdate",(t,o)=>{r(o)&&((e,t)=>{const o=ct(e);null===o||bt(e,o)||e.undoManager.transact(()=>{r(t.styles)&&e.dom.setStyles(o,t.styles),r(t.attrs)&&V(t.attrs,(t,n)=>e.dom.setAttrib(o,n,t))})})(e,o)}),e.addQueryStateHandler("InsertUnorderedList",bo(e,"UL")),e.addQueryStateHandler("InsertOrderedList",bo(e,"OL")),e.addQueryStateHandler("InsertDefinitionList",bo(e,"DL"))})(e)),(e=>{const t=t=>()=>e.execCommand(t);e.hasPlugin("advlist")||(e.ui.registry.addToggleButton("numlist",{icon:"ordered-list",active:!1,tooltip:"Numbered list",onAction:t("InsertOrderedList"),onSetup:ko(e,"OL")}),e.ui.registry.addToggleButton("bullist",{icon:"unordered-list",active:!1,tooltip:"Bullet list",onAction:t("InsertUnorderedList"),onSetup:ko(e,"UL")}))})(e),(e=>{const t={text:"List properties...",icon:"ordered-list",onAction:()=>e.execCommand("mceListProps"),onSetup:So(e,"OL")};e.ui.registry.addMenuItem("listprops",t),e.ui.registry.addContextMenu("lists",{update:t=>{const o=ct(e,t);return Fe(o)?["listprops"]:[]}})})(e),(e=>({backspaceDelete:t=>{po(e,t)}}))(e)))}()},45710(e,t,o){o(86175)},86175(){!function(){"use strict";const e=Object.getPrototypeOf,t=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},o=e=>o=>(e=>{const o=typeof e;return null===e?"null":"object"===o&&Array.isArray(e)?"array":"object"===o&&t(e,String,(e,t)=>t.isPrototypeOf(e))?"string":o})(o)===e,n=e=>t=>typeof t===e,r=e=>t=>e===t,i=o("string"),s=o("object"),a=o=>((o,n)=>s(o)&&t(o,n,(t,o)=>e(t)===o))(o,Object),l=o("array"),c=r(null),d=n("boolean"),u=r(void 0),h=e=>null==e,m=e=>!h(e),p=n("function"),g=n("number"),f=(e,t)=>{if(l(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},v=()=>{},b=e=>()=>e(),y=(e,t)=>(...o)=>e(t.apply(null,o)),w=e=>()=>e,_=e=>e,x=(e,t)=>e===t;function C(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const k=e=>t=>!e(t),S=e=>()=>{throw new Error(e)},T=e=>e(),E=w(!1),O=w(!0);class A{constructor(e,t){this.tag=e,this.value=t}static some(e){return new A(!0,e)}static none(){return A.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?A.some(e(this.value)):A.none()}bind(e){return this.tag?e(this.value):A.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:A.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return m(e)?A.some(e):A.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}A.singletonNone=new A(!1);const M=Array.prototype.slice,B=Array.prototype.indexOf,R=Array.prototype.push,N=(e,t)=>B.call(e,t),V=(e,t)=>N(e,t)>-1,D=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},P=(e,t)=>{const o=[];for(let n=0;n<e;n++)o.push(t(n));return o},I=(e,t)=>{const o=[];for(let n=0;n<e.length;n+=t){const r=M.call(e,n,n+t);o.push(r)}return o},L=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n},F=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},z=(e,t)=>{const o=[],n=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];(t(i,r)?o:n).push(i)}return{pass:o,fail:n}},H=(e,t)=>{const o=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t(r,n)&&o.push(r)}return o},U=(e,t,o)=>(((e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)})(e,(e,n)=>{o=t(o,e,n)}),o),Z=(e,t,o)=>(F(e,(e,n)=>{o=t(o,e,n)}),o),$=(e,t)=>((e,t,o)=>{for(let n=0,r=e.length;n<r;n++){const r=e[n];if(t(r,n))return A.some(r);if(o(r,n))break}return A.none()})(e,t,E),j=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return A.some(o);return A.none()},W=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!l(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);R.apply(t,e[o])}return t},q=(e,t)=>W(L(e,t)),G=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},Y=e=>{const t=M.call(e,0);return t.reverse(),t},X=(e,t)=>H(e,e=>!V(t,e)),K=(e,t)=>{const o={};for(let n=0,r=e.length;n<r;n++){const r=e[n];o[String(r)]=t(r,n)}return o},J=e=>[e],Q=(e,t)=>{const o=M.call(e,0);return o.sort(t),o},ee=(e,t)=>t>=0&&t<e.length?A.some(e[t]):A.none(),te=e=>ee(e,0),oe=e=>ee(e,e.length-1),ne=p(Array.from)?Array.from:e=>M.call(e),re=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return A.none()},ie=Object.keys,se=Object.hasOwnProperty,ae=(e,t)=>{const o=ie(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}},le=(e,t)=>ce(e,(e,o)=>({k:o,v:t(e,o)})),ce=(e,t)=>{const o={};return ae(e,(e,n)=>{const r=t(e,n);o[r.k]=r.v}),o},de=e=>(t,o)=>{e[o]=t},ue=(e,t,o,n)=>{ae(e,(e,r)=>{(t(e,r)?o:n)(e,r)})},he=(e,t)=>{const o={};return ue(e,t,de(o),v),o},me=(e,t)=>{const o=[];return ae(e,(e,n)=>{o.push(t(e,n))}),o},pe=(e,t)=>{const o=ie(e);for(let n=0,r=o.length;n<r;n++){const r=o[n],i=e[r];if(t(i,r,e))return A.some(i)}return A.none()},ge=e=>me(e,_),fe=(e,t)=>ve(e,t)?A.from(e[t]):A.none(),ve=(e,t)=>se.call(e,t),be=(e,t)=>ve(e,t)&&void 0!==e[t]&&null!==e[t],ye=e=>{if(!l(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return F(e,(n,r)=>{const i=ie(n);if(1!==i.length)throw new Error("one and only one name per case");const s=i[0],a=n[s];if(void 0!==o[s])throw new Error("duplicate key detected:"+s);if("cata"===s)throw new Error("cannot have a case named cata (sorry)");if(!l(a))throw new Error("case arguments must be an array");t.push(s),o[s]=(...o)=>{const n=o.length;if(n!==a.length)throw new Error("Wrong number of arguments to case "+s+". Expected "+a.length+" ("+a+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const n=ie(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!G(t,e=>V(n,e)))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[s].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:s,params:o})}}}}),o},we=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},_e=e=>{let t=A.none(),o=[];const n=e=>{r()?i(e):o.push(e)},r=()=>t.isSome(),i=e=>{t.each(t=>{setTimeout(()=>{e(t)},0)})};return e(e=>{r()||(t=A.some(e),F(o,i),o=[])}),{get:n,map:e=>_e(t=>{n(o=>{t(e(o))})}),isReady:r}},xe={nu:_e,pure:e=>_e(t=>{t(e)})},Ce=e=>{setTimeout(()=>{throw e},0)},ke=e=>{const t=t=>{e().then(t,Ce)};return{map:t=>ke(()=>e().then(t)),bind:t=>ke(()=>e().then(e=>t(e).toPromise())),anonBind:t=>ke(()=>e().then(()=>t.toPromise())),toLazy:()=>xe.nu(t),toCached:()=>{let t=null;return ke(()=>(null===t&&(t=e()),t))},toPromise:e,get:t}},Se=e=>ke(()=>new Promise(e)),Te=e=>ke(()=>Promise.resolve(e)),Ee=e=>{const t=t=>t(e),o=w(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:O,isError:E,map:t=>Ae.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>A.some(e)};return r},Oe=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:E,isError:O,map:t,mapError:t=>Ae.error(t(e)),bind:t,exists:E,forall:O,getOr:_,or:_,getOrThunk:T,orThunk:T,getOrDie:S(String(e)),each:v,toOptional:A.none};return o},Ae={value:Ee,error:Oe,fromOption:(e,t)=>e.fold(()=>Oe(t),Ee)},Me=e=>({...e,toCached:()=>Me(e.toCached()),bindFuture:t=>Me(e.bind(e=>e.fold(e=>Te(Ae.error(e)),e=>t(e)))),bindResult:t=>Me(e.map(e=>e.bind(t))),mapResult:t=>Me(e.map(e=>e.map(t))),mapError:t=>Me(e.map(e=>e.mapError(t))),foldResult:(t,o)=>e.map(e=>e.fold(t,o)),withTimeout:(t,o)=>Me(Se(n=>{let r=!1;const i=setTimeout(()=>{r=!0,n(Ae.error(o()))},t);e.get(e=>{r||(clearTimeout(i),n(e))})}))}),Be=e=>Me(Se(e)),Re="undefined"!=typeof window?window:Function("return this;")(),Ne=(e,t,o,n)=>{const r=e+t;return r>n?o:r<o?n:r},Ve=(e,t,o)=>Math.min(Math.max(e,t),o);let De=0;const Pe=e=>{const t=(new Date).getTime(),o=Math.floor(window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295*1e9);return De++,e+"_"+o+De+String(t)},Ie=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;n<t.length;n++){const r=t[n];for(const t in r)ve(r,t)&&(o[t]=e(o[t],r[t]))}return o},Le=Ie((e,t)=>a(e)&&a(t)?Le(e,t):t),Fe=Ie((e,t)=>t),ze=(e,t,o=x)=>e.exists(e=>o(e,t)),He=e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t},Ue=(e,t,o)=>e.isSome()&&t.isSome()?A.some(o(e.getOrDie(),t.getOrDie())):A.none(),Ze=(e,t)=>null!=e?A.some(t(e)):A.none(),$e=(e,t)=>e?A.some(t):A.none(),je=(e,t)=>((e,t)=>{let o=null!=t?t:Re;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t);ye([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const We=e=>{const t=we(A.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(A.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(A.some(e))}}},qe=()=>We(e=>e.unbind()),Ge=()=>{const e=We(v);return{...e,on:t=>e.get().each(t)}},Ye=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,Xe=(e,t)=>Je(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Ke=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!u(n)||r+t.length<=n)},Je=(e,t)=>Ye(e,t,0),Qe=(e,t)=>Ye(e,t,e.length-t.length),et=(ft=/^\s+|\s+$/g,e=>e.replace(ft,"")),tt=e=>e.length>0,ot=e=>!tt(e),nt=(e,t)=>{let o=null;const n=()=>{c(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout(()=>{o=null,e.apply(null,r)},t)}}},rt=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},it=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},st=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return it(o.childNodes[0])},at=(e,t)=>{const o=(t||document).createElement(e);return it(o)},lt=(e,t)=>{const o=(t||document).createTextNode(e);return it(o)},ct=it,dt=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold(e=>{r.setStartBefore(e.dom)},(e,t)=>{r.setStart(e.dom,t)},e=>{r.setStartAfter(e.dom)}),((e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})})(n,o),n},ut=(e,t,o,n,r)=>{const i=e.document.createRange();return i.setStart(t.dom,o),i.setEnd(n.dom,r),i},ht=e=>({left:e.left,top:e.top,right:e.right,bottom:e.bottom,width:e.width,height:e.height}),mt=ye([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),pt=(e,t,o)=>t(ct(o.startContainer),o.startOffset,ct(o.endContainer),o.endOffset),gt=(e,t)=>((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:w(e),rtl:A.none}),relative:(t,o)=>({ltr:rt(()=>dt(e,t,o)),rtl:rt(()=>A.some(dt(e,o,t)))}),exact:(t,o,n,r)=>({ltr:rt(()=>ut(e,t,o,n,r)),rtl:rt(()=>A.some(ut(e,n,r,t,o)))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter(e=>!1===e.collapsed).map(e=>mt.rtl(ct(e.endContainer),e.endOffset,ct(e.startContainer),e.startOffset)).getOrThunk(()=>pt(0,mt.ltr,o)):pt(0,mt.ltr,o)})(0,o)})(e,t).match({ltr:(t,o,n,r)=>{const i=e.document.createRange();return i.setStart(t.dom,o),i.setEnd(n.dom,r),i},rtl:(t,o,n,r)=>{const i=e.document.createRange();return i.setStart(n.dom,r),i.setEnd(t.dom,o),i}});var ft;mt.ltr,mt.rtl;const vt=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},bt=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,yt=(e,t)=>{const o=void 0===t?document:t.dom;return bt(o)?A.none():A.from(o.querySelector(e)).map(ct)},wt=(e,t)=>e.dom===t.dom,_t=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},xt=()=>Ct(0,0),Ct=(e,t)=>({major:e,minor:t}),kt={nu:Ct,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?xt():((e,t)=>{const o=((e,t)=>{for(let o=0;o<e.length;o++){const n=e[o];if(n.test(t))return n}})(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return Ct(n(1),n(2))})(e,o)},unknown:xt},St=(e,t)=>{const o=String(t).toLowerCase();return $(e,e=>e.search(o))},Tt=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Et=e=>t=>Ke(t,e),Ot=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Ke(e,"edge/")&&Ke(e,"chrome")&&Ke(e,"safari")&&Ke(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Tt],search:e=>Ke(e,"chrome")&&!Ke(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Ke(e,"msie")||Ke(e,"trident")},{name:"Opera",versionRegexes:[Tt,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Et("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Et("firefox")},{name:"Safari",versionRegexes:[Tt,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Ke(e,"safari")||Ke(e,"mobile/"))&&Ke(e,"applewebkit")}],At=[{name:"Windows",search:Et("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Ke(e,"iphone")||Ke(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Et("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:Et("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Et("linux"),versionRegexes:[]},{name:"Solaris",search:Et("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Et("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:Et("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Mt={browsers:w(Ot),oses:w(At)},Bt="Edge",Rt="Chromium",Nt="Opera",Vt="Firefox",Dt="Safari",Pt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(Bt),isChromium:n(Rt),isIE:n("IE"),isOpera:n(Nt),isFirefox:n(Vt),isSafari:n(Dt)}},It=()=>Pt({current:void 0,version:kt.unknown()}),Lt=Pt,Ft=(w(Bt),w(Rt),w("IE"),w(Nt),w(Vt),w(Dt),"Windows"),zt="Android",Ht="Linux",Ut="macOS",Zt="Solaris",$t="FreeBSD",jt="ChromeOS",Wt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Ft),isiOS:n("iOS"),isAndroid:n(zt),isMacOS:n(Ut),isLinux:n(Ht),isSolaris:n(Zt),isFreeBSD:n($t),isChromeOS:n(jt)}},qt=()=>Wt({current:void 0,version:kt.unknown()}),Gt=Wt,Yt=(w(Ft),w("iOS"),w(zt),w(Ht),w(Ut),w(Zt),w($t),w(jt),e=>window.matchMedia(e).matches);let Xt=rt(()=>((e,t,o)=>{const n=Mt.browsers(),r=Mt.oses(),i=t.bind(e=>((e,t)=>re(t.brands,t=>{const o=t.brand.toLowerCase();return $(e,e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())}).map(e=>({current:e.name,version:kt.nu(parseInt(t.version,10),0)}))}))(n,e)).orThunk(()=>((e,t)=>St(e,t).map(e=>{const o=kt.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(n,e)).fold(It,Lt),s=((e,t)=>St(e,t).map(e=>{const o=kt.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(r,e).fold(qt,Gt),a=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),i=e.isiOS()&&!r,s=e.isiOS()||e.isAndroid(),a=s||n("(pointer:coarse)"),l=r||!i&&s&&n("(min-device-width:768px)"),c=i||s&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:w(r),isiPhone:w(i),isTablet:w(l),isPhone:w(c),isTouch:w(a),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:w(d),isDesktop:w(u)}})(s,i,e,o);return{browser:i,os:s,deviceType:a}})(window.navigator.userAgent,A.from(window.navigator.userAgentData),Yt));const Kt=()=>Xt(),Jt=Object.getPrototypeOf,Qt=e=>{const t=je("ownerDocument.defaultView",e);return s(e)&&((e=>((e,t)=>{const o=((e,t)=>je(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Jt(e).constructor.name))},eo=e=>e.dom.nodeName.toLowerCase(),to=e=>t=>(e=>e.dom.nodeType)(t)===e,oo=e=>no(e)&&Qt(e.dom),no=to(1),ro=to(3),io=to(9),so=to(11),ao=e=>t=>no(t)&&eo(t)===e,lo=e=>ct(e.dom.ownerDocument),co=e=>io(e)?e:lo(e),uo=e=>ct(co(e).dom.documentElement),ho=e=>ct(co(e).dom.defaultView),mo=e=>A.from(e.dom.parentNode).map(ct),po=e=>A.from(e.dom.parentElement).map(ct),go=e=>A.from(e.dom.offsetParent).map(ct),fo=e=>L(e.dom.childNodes,ct),vo=(e,t)=>{const o=e.dom.childNodes;return A.from(o[t]).map(ct)},bo=e=>vo(e,0),yo=(e,t)=>({element:e,offset:t}),wo=(e,t)=>{const o=fo(e);return o.length>0&&t<o.length?yo(o[t],0):yo(e,t)},_o=e=>so(e)&&m(e.dom.host),xo=e=>ct(e.dom.getRootNode()),Co=e=>_o(e)?e:ct(co(e).dom.body),ko=e=>{const t=xo(e);return _o(t)?A.some(t):A.none()},So=e=>ct(e.dom.host),To=e=>{const t=ct((e=>{if(m(e.target)){const t=ct(e.target);if(no(t)&&(e=>m(e.dom.shadowRoot))(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return te(t)}}return A.from(e.target)})(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=y(n,o);return((e,t,o,n,r,i,s)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:i,raw:s}))(t,e.clientX,e.clientY,o,n,r,e)},Eo=(e,t,o,n,r)=>{const i=((e,t)=>o=>{e(o)&&t(To(o))})(o,n);return e.dom.addEventListener(t,i,r),{unbind:C(Oo,e,t,i,r)}},Oo=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},Ao=O,Mo=(e,t,o)=>((e,t,o,n)=>Eo(e,t,o,n,!1))(e,t,Ao,o),Bo=(e,t,o)=>((e,t,o,n)=>Eo(e,t,o,n,!0))(e,t,Ao,o),Ro=To,No=()=>ct(document),Vo=(e,t=!1)=>e.dom.focus({preventScroll:t}),Do=e=>e.dom.blur(),Po=e=>{const t=xo(e).dom;return e.dom===t.activeElement},Io=(e=No())=>A.from(e.dom.activeElement).map(ct),Lo=e=>Io(xo(e)).filter(t=>e.dom.contains(t.dom)),Fo=(e,t)=>{mo(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},zo=(e,t)=>{const o=(e=>A.from(e.dom.nextSibling).map(ct))(e);o.fold(()=>{mo(e).each(e=>{Uo(e,t)})},e=>{Fo(e,t)})},Ho=(e,t)=>{bo(e).fold(()=>{Uo(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},Uo=(e,t)=>{e.dom.appendChild(t.dom)},Zo=(e,t)=>{F(t,t=>{Uo(e,t)})},$o=(e,t,o)=>{if(!(i(o)||d(o)||g(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},jo=(e,t,o)=>{$o(e.dom,t,o)},Wo=(e,t)=>{const o=e.dom;ae(t,(e,t)=>{$o(o,t,e)})},qo=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},Go=(e,t)=>A.from(qo(e,t)),Yo=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},Xo=(e,t)=>{e.dom.removeAttribute(t)},Ko=e=>{e.dom.textContent="",F(fo(e),e=>{Jo(e)})},Jo=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},Qo=(e,t)=>ct(e.dom.cloneNode(t)),en=e=>e.dom.innerHTML,tn=(e,t)=>{const o=lo(e).dom,n=ct(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,fo(ct(o))})(t,o);Zo(n,r),Ko(e),Uo(e,n)},on=e=>new Promise((t,o)=>{const n=()=>{i(),t(e)},r=[Mo(e,"load",n),Mo(e,"error",()=>{i(),o("Unable to load data from image: "+e.dom.src)})],i=()=>F(r,e=>e.unbind());e.dom.complete&&n()}),nn=e=>void 0!==e.style&&p(e.style.getPropertyValue),rn=e=>{const t=ro(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return ko(ct(t)).fold(()=>o.body.contains(t),(n=rn,r=So,e=>n(r(e))));var n,r},sn=()=>an(ct(document)),an=e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return ct(t)},ln=(e,t,o)=>{if(!i(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);nn(e)&&e.style.setProperty(t,o)},cn=(e,t)=>{nn(e)&&e.style.removeProperty(t)},dn=(e,t,o)=>{const n=e.dom;ln(n,t,o)},un=(e,t)=>{const o=e.dom;ae(t,(e,t)=>{ln(o,t,e)})},hn=(e,t)=>{const o=e.dom;ae(t,(e,t)=>{e.fold(()=>{cn(o,t)},e=>{ln(o,t,e)})})},mn=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||rn(e)?n:pn(o,t)},pn=(e,t)=>nn(e)?e.style.getPropertyValue(t):"",gn=(e,t)=>{const o=e.dom,n=pn(o,t);return A.from(n).filter(e=>e.length>0)},fn=e=>{const t={},o=e.dom;if(nn(o))for(let e=0;e<o.style.length;e++){const n=o.style.item(e);t[n]=o.style[n]}return t},vn=(e,t,o)=>{const n=at(e);return dn(n,t,o),gn(n,t).isSome()},bn=(e,t)=>{const o=e.dom;cn(o,t),ze(Go(e,"style").map(et),"")&&Xo(e,"style")},yn=e=>e.dom.offsetWidth,wn=(e,t)=>{const o=o=>{const n=t(o);if(n<=0||null===n){const t=mn(o,e);return parseFloat(t)||0}return n},n=(e,t)=>Z(t,(t,o)=>{const n=mn(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r},0);return{set:(t,o)=>{if(!g(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;nn(n)&&(n.style[e]=o+"px")},get:o,getOuter:o,aggregate:n,max:(e,t,o)=>{const r=n(e,o);return t>r?t-r:0}}},_n=wn("height",e=>{const t=e.dom;return rn(e)?t.getBoundingClientRect().height:t.offsetHeight}),xn=e=>_n.get(e),Cn=e=>_n.getOuter(e),kn=e=>!(e=>e.offsetWidth<=0&&e.offsetHeight<=0)(e.dom),Sn=wn("width",e=>e.dom.offsetWidth),Tn=wn("width",e=>{const t=e.dom;return rn(e)?t.getBoundingClientRect().width:t.offsetWidth}),En=e=>Sn.get(e),On=e=>Sn.getOuter(e),An=e=>Tn.getOuter(e),Mn=(e,t)=>({left:e,top:t,translate:(o,n)=>Mn(e+o,t+n)}),Bn=Mn,Rn=(e,t)=>void 0!==e?e:void 0!==t?t:0,Nn=e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Bn(o.offsetLeft,o.offsetTop);const i=Rn(null==n?void 0:n.pageYOffset,r.scrollTop),s=Rn(null==n?void 0:n.pageXOffset,r.scrollLeft),a=Rn(r.clientTop,o.clientTop),l=Rn(r.clientLeft,o.clientLeft);return Vn(e).translate(s-l,i-a)},Vn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Bn(o.offsetLeft,o.offsetTop):rn(e)?(e=>{const t=e.getBoundingClientRect();return Bn(t.left,t.top)})(t):Bn(0,0)},Dn=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Bn(o,n)},Pn=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},In=(e=>{const t=t=>e(t)?A.from(t.dom.nodeValue):A.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(ro),Ln=(e,t)=>o=>"rtl"===Fn(o)?t:e,Fn=e=>"rtl"===mn(e,"direction")?"rtl":"ltr",zn=(e,t)=>{const o=qo(e,t);return void 0===o||""===o?[]:o.split(" ")};var Hn=(e,t,o,n,r)=>e(o,n)?A.some(o):p(r)&&r(o)?A.none():t(o,n,r);const Un=(e,t,o)=>{let n=e.dom;const r=p(o)?o:E;for(;n.parentNode;){n=n.parentNode;const e=ct(n);if(t(e))return A.some(e);if(r(e))break}return A.none()},Zn=(e,t,o)=>Hn((e,t)=>t(e),Un,e,t,o),$n=(e,t)=>$(e.dom.childNodes,e=>t(ct(e))).map(ct),jn=(e,t,o)=>Un(e,e=>vt(e,t),o),Wn=(e,t)=>(e=>{const o=e.dom;return o.parentNode?$n(ct(o.parentNode),o=>!wt(e,o)&&vt(o,t)):A.none()})(e),qn=(e,t)=>$n(e,e=>vt(e,t)),Gn=(e,t)=>yt(t,e),Yn=(e,t,o)=>Hn((e,t)=>vt(e,t),jn,e,t,o),Xn=(e,t)=>{e.dom.checked=t},Kn=e=>e.dom.checked,Jn=e=>void 0!==e.dom.classList,Qn=e=>zn(e,"class"),er=(e,t)=>((e,t,o)=>{const n=zn(e,t).concat([o]);return jo(e,t,n.join(" ")),!0})(e,"class",t),tr=(e,t)=>((e,t,o)=>{const n=H(zn(e,t),e=>e!==o);return n.length>0?jo(e,t,n.join(" ")):Xo(e,t),!1})(e,"class",t),or=(e,t)=>{Jn(e)?e.dom.classList.add(t):er(e,t)},nr=e=>{0===(Jn(e)?e.dom.classList:Qn(e)).length&&Xo(e,"class")},rr=(e,t)=>{Jn(e)?e.dom.classList.remove(t):tr(e,t),nr(e)},ir=(e,t)=>Jn(e)&&e.dom.classList.contains(t),sr=(e,t)=>{F(t,t=>{or(e,t)})},ar=(e,t)=>{F(t,t=>{rr(e,t)})},lr=e=>Jn(e)?(e=>{const t=e.dom.classList,o=new Array(t.length);for(let e=0;e<t.length;e++){const n=t.item(e);null!==n&&(o[e]=n)}return o})(e):Qn(e),cr=e=>e.dom.value,dr=(e,t)=>{if(void 0===t)throw new Error("Value.set was undefined");e.dom.value=t},ur=(e,t,o)=>H(((e,t)=>{const o=p(t)?t:E;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=ct(e);if(r.push(t),!0===o(t))break;n=e}return r})(e,o),t),hr=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return bt(o)?[]:L(o.querySelectorAll(e),ct)})(t,e),mr=(e,t,o)=>Zn(e,t,o).isSome(),pr=(e,t,o)=>Yn(e,t,o).isSome(),gr=e=>p(e)?e:E,fr=(e,t,o)=>{let n=e.dom;const r=gr(o);for(;n.parentNode;){n=n.parentNode;const e=ct(n),o=t(e);if(o.isSome())return o;if(r(e))break}return A.none()},vr=(e,t,o)=>{const n=t(e),r=gr(o);return n.orThunk(()=>r(e)?A.none():fr(e,t,r))},br=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),yr=ye([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),wr=(yr.before,yr.on,yr.after,e=>e.fold(_,_,_)),_r=ye([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),xr={domRange:_r.domRange,relative:_r.relative,exact:_r.exact,exactFromRange:e=>_r.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>ct(e.startContainer),relative:(e,t)=>wr(e),exact:(e,t,o,n)=>e}))(e);return ho(t)},range:br},Cr=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),o=e.getRangeAt(e.rangeCount-1);return A.some(br(ct(t.startContainer),t.startOffset,ct(o.endContainer),o.endOffset))}return A.none()},kr=e=>{if(null===e.anchorNode||null===e.focusNode)return Cr(e);{const t=ct(e.anchorNode),o=ct(e.focusNode);return((e,t,o,n)=>{const r=((e,t,o,n)=>{const r=lo(e).dom.createRange();return r.setStart(e.dom,t),r.setEnd(o.dom,n),r})(e,t,o,n),i=wt(e,o)&&t===n;return r.collapsed&&!i})(t,e.anchorOffset,o,e.focusOffset)?A.some(br(t,e.anchorOffset,o,e.focusOffset)):Cr(e)}},Sr=(e,t)=>(e=>{const t=e.getClientRects(),o=t.length>0?t[0]:e.getBoundingClientRect();return o.width>0||o.height>0?A.some(o).map(ht):A.none()})(gt(e,t)),Tr={unsupportedLength:["em","ex","cap","ch","ic","rem","lh","rlh","vw","vh","vi","vb","vmin","vmax","cm","mm","Q","in","pc","pt","px"],fixed:["px","pt"],relative:["%"],empty:[""]},Er=(()=>{const e="[0-9]+",t="[eE][+-]?"+e,o=e=>`(?:${e})?`,n=["Infinity",e+"\\."+o(e)+o(t),"\\."+e+o(t),e+o(t)].join("|");return new RegExp(`^([+-]?(?:${n}))(.*)$`)})(),Or=(e,t)=>A.from(Er.exec(e)).bind(e=>{const o=Number(e[1]),n=e[2];return((e,t)=>D(t,t=>D(Tr[t],t=>e===t)))(n,t)?A.some({value:o,unit:n}):A.none()}),Ar=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Mr=e=>{const t=void 0===e?window:e,o=t.document,n=Dn(ct(o));return(e=>{const t=void 0===e?window:e;return Kt().browser.isFirefox()?A.none():A.from(t.visualViewport)})(t).fold(()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return Ar(n.left,n.top,o,r)},e=>Ar(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height))},Br=(e,t)=>e.view(t).fold(w([]),t=>{const o=e.owner(t),n=Br(e,o);return[t].concat(n)});var Rr=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?A.none():A.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(ct)},owner:e=>lo(e)});const Nr=e=>{const t=No(),o=Dn(t),n=((e,t)=>{const o=t.owner(e),n=Br(t,o);return A.some(n)})(e,Rr);return n.fold(C(Nn,e),t=>{const n=Vn(e),r=U(t,(e,t)=>{const o=Vn(t);return{left:e.left+o.left,top:e.top+o.top}},{left:0,top:0});return Bn(r.left+n.left+o.left,r.top+n.top+o.top)})},Vr=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Dr=e=>{const t=Nn(e),o=On(e),n=Cn(e);return Vr(t.left,t.top,o,n)},Pr=e=>{const t=Nr(e),o=On(e),n=Cn(e);return Vr(t.left,t.top,o,n)},Ir=(e,t)=>{const o=Math.max(e.x,t.x),n=Math.max(e.y,t.y),r=Math.min(e.right,t.right),i=Math.min(e.bottom,t.bottom);return Vr(o,n,r-o,i-n)},Lr=()=>Mr(window),Fr=(e,t)=>wt(e.element,t.event.target),zr=e=>(ze(gn(e,"position"),"fixed")?A.none():go(e)).orThunk(()=>{const t=at("span");return mo(e).bind(e=>{Uo(e,t);const o=go(t);return Jo(t),o})}),Hr=e=>zr(e).map(Nn).getOrThunk(()=>Bn(0,0));var Ur;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(Ur||(Ur={}));const Zr=(e,t,o)=>e.stype===Ur.Error?t(e.serror):o(e.svalue),$r=e=>({stype:Ur.Value,svalue:e}),jr=e=>({stype:Ur.Error,serror:e}),Wr=$r,qr=jr,Gr=Zr,Yr=e=>s(e)&&ie(e).length>100?" removed due to size":JSON.stringify(e,null,2),Xr=(e,t)=>qr([{path:e,getErrorInfo:t}]),Kr=e=>({extract:(t,o)=>((e,t)=>e.stype===Ur.Error?t(e.serror):e)(e(o),e=>((e,t)=>Xr(e,w(t)))(t,e)),toString:w("val")}),Jr=Kr(Wr),Qr=w(Jr),ei=(e,t)=>Kr(o=>{const n=typeof o;return e(o)?Wr(o):qr(`Expected type: ${t} but got: ${n}`)}),ti=ei(g,"number"),oi=ei(i,"string"),ni=ei(d,"boolean"),ri=ei(p,"function"),ii=e=>{if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every(t=>ii(e[t]));default:return!1}},si=Kr(e=>ii(e)?Wr(e):qr("Expected value to be acceptable for sending via postMessage")),ai=e=>({tag:"defaultedThunk",process:e}),li=e=>ai(w(e)),ci=e=>({tag:"mergeWithThunk",process:e}),di=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),ui=(e,t,o)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return o(e.newKey,e.instantiator)}},hi=e=>{const t=(e=>{const t=[],o=[];return F(e,e=>{Zr(e,e=>o.push(e),e=>t.push(e))}),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,y(qr,W)(o)):Wr(t.values);var o},mi=(e,t,o,n)=>n(fe(e,t).getOrThunk(()=>o(e))),pi=(e,t,o,n,r)=>{const i=e=>r.extract(t.concat([n]),e),s=e=>e.fold(()=>Wr(A.none()),e=>((e,t)=>e.stype===Ur.Value?{stype:Ur.Value,svalue:t(e.svalue)}:e)(r.extract(t.concat([n]),e),A.some));switch(e.tag){case"required":return((e,t,o,n)=>fe(t,o).fold(()=>((e,t,o)=>Xr(e,()=>'Could not find valid *required* value for "'+t+'" in '+Yr(o)))(e,o,t),n))(t,o,n,i);case"defaultedThunk":return mi(o,n,e.process,i);case"option":return((e,t,o)=>o(fe(e,t)))(o,n,s);case"defaultedOptionThunk":return((e,t,o,n)=>n(fe(e,t).map(t=>!0===t?o(e):t)))(o,n,e.process,s);case"mergeWithThunk":return mi(o,n,w({}),t=>{const n=Le(e.process(o),t);return i(n)})}},gi=e=>({extract:(t,o)=>e().extract(t,o),toString:()=>e().toString()}),fi=e=>ie(he(e,m)),vi=e=>{const t=bi(e),o=U(e,(e,t)=>ui(t,t=>Le(e,{[t]:!0}),w(e)),{});return{extract:(e,n)=>{const r=d(n)?[]:fi(n),i=H(r,e=>!be(o,e));return 0===i.length?t.extract(e,n):((e,t)=>Xr(e,()=>"There are unsupported fields: ["+t.join(", ")+"] specified"))(e,i)},toString:t.toString}},bi=e=>({extract:(t,o)=>((e,t,o)=>{const n={},r=[];for(const i of o)ui(i,(o,i,s,a)=>{const l=pi(s,e,t,o,a);Gr(l,e=>{r.push(...e)},e=>{n[i]=e})},(e,o)=>{n[e]=o(t)});return r.length>0?qr(r):Wr(n)})(t,o,e),toString:()=>{const t=L(e,e=>ui(e,(e,t,o,n)=>e+" -> "+n.toString(),(e,t)=>"state("+e+")"));return"obj{\n"+t.join("\n")+"}"}}),yi=e=>({extract:(t,o)=>{const n=L(o,(o,n)=>e.extract(t.concat(["["+n+"]"]),o));return hi(n)},toString:()=>"array("+e.toString()+")"}),wi=(e,t)=>{const o=void 0!==t?t:_;return{extract:(t,n)=>{const r=[];for(const i of e){const e=i.extract(t,n);if(e.stype===Ur.Value)return{stype:Ur.Value,svalue:o(e.svalue)};r.push(e)}return hi(r)},toString:()=>"oneOf("+L(e,e=>e.toString()).join(", ")+")"}},_i=(e,t)=>({extract:(o,n)=>{const r=ie(n),i=((t,o)=>yi(Kr(e)).extract(t,o))(o,r);return((e,t)=>e.stype===Ur.Value?t(e.svalue):e)(i,e=>{const r=L(e,e=>di(e,e,{tag:"required",process:{}},t));return bi(r).extract(o,n)})},toString:()=>"setOf("+t.toString()+")"}),xi=y(yi,bi),Ci=(e,t)=>({extract:(o,n)=>fe(n,e).fold(()=>((e,t)=>Xr(e,()=>'Choice schema did not contain choice key: "'+t+'"'))(o,e),e=>((e,t,o,n)=>fe(o,n).fold(()=>((e,t,o)=>Xr(e,()=>'The chosen schema: "'+o+'" did not exist in branches: '+Yr(t)))(e,o,n),o=>o.extract(e.concat(["branch: "+n]),t)))(o,n,t,e)),toString:()=>"chooseOn("+e+"). Possible values: "+ie(t)}),ki=e=>Kr(t=>e(t).fold(qr,Wr)),Si=(e,t)=>_i(t=>e(t).fold(jr,$r),t),Ti=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===Ur.Error?{stype:Ur.Error,serror:t(e.serror)}:e)(t.extract([e],o),e=>({input:o,errors:e})))(e,t,o),Zr(n,Ae.error,Ae.value);var n},Ei=e=>e.fold(e=>{throw new Error(Ai(e))},_),Oi=(e,t,o)=>Ei(Ti(e,t,o)),Ai=e=>"Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:w("... (only showing first ten failures)")}]):e;return L(t,e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo())})(e.errors).join("\n")+"\n\nInput object: "+Yr(e.input),Mi=(e,t)=>Ci(e,le(t,bi)),Bi=(e,t)=>((e,t)=>{const o=rt(t);return{extract:(e,t)=>o().extract(e,t),toString:()=>o().toString()}})(0,t),Ri=di,Ni=(e,t)=>({tag:"custom",newKey:e,instantiator:t}),Vi=e=>ki(t=>V(e,t)?Ae.value(t):Ae.error(`Unsupported value: "${t}", choose one of "${e.join(", ")}".`)),Di=e=>Ri(e,e,{tag:"required",process:{}},Qr()),Pi=(e,t)=>Ri(e,e,{tag:"required",process:{}},t),Ii=e=>Pi(e,ti),Li=e=>Pi(e,oi),Fi=(e,t)=>Ri(e,e,{tag:"required",process:{}},Vi(t)),zi=e=>Pi(e,ri),Hi=(e,t)=>Ri(e,e,{tag:"required",process:{}},bi(t)),Ui=(e,t)=>Ri(e,e,{tag:"required",process:{}},xi(t)),Zi=(e,t)=>Ri(e,e,{tag:"required",process:{}},yi(t)),$i=e=>Ri(e,e,{tag:"option",process:{}},Qr()),ji=(e,t)=>Ri(e,e,{tag:"option",process:{}},t),Wi=e=>ji(e,ti),qi=e=>ji(e,oi),Gi=(e,t)=>ji(e,Vi(t)),Yi=e=>ji(e,ri),Xi=(e,t)=>ji(e,yi(t)),Ki=(e,t)=>ji(e,bi(t)),Ji=(e,t)=>Ri(e,e,li(t),Qr()),Qi=(e,t,o)=>Ri(e,e,li(t),o),es=(e,t)=>Qi(e,t,ti),ts=(e,t)=>Qi(e,t,oi),os=(e,t,o)=>Qi(e,t,Vi(o)),ns=(e,t)=>Qi(e,t,ni),rs=(e,t)=>Qi(e,t,ri),is=(e,t,o)=>Qi(e,t,yi(o)),ss=(e,t,o)=>Qi(e,t,bi(o)),as=(e,t)=>((e,t)=>({[e]:t}))(e,t),ls=e=>(e=>{const t={};return F(e,e=>{t[e.key]=e.value}),t})(e),cs=w,ds=cs("touchstart"),us=cs("touchmove"),hs=cs("touchend"),ms=cs("touchcancel"),ps=cs("mousedown"),gs=cs("mousemove"),fs=cs("mouseout"),vs=cs("mouseup"),bs=cs("mouseover"),ys=cs("focusin"),ws=cs("focusout"),_s=cs("keydown"),xs=cs("keyup"),Cs=cs("input"),ks=cs("change"),Ss=cs("click"),Ts=cs("transitioncancel"),Es=cs("transitionend"),Os=cs("transitionstart"),As=cs("selectstart"),Ms=e=>w("alloy."+e),Bs={tap:Ms("tap")},Rs=Ms("focus"),Ns=Ms("blur.post"),Vs=Ms("paste.post"),Ds=Ms("receive"),Ps=Ms("execute"),Is=Ms("focus.item"),Ls=Bs.tap,Fs=Ms("longpress"),zs=Ms("sandbox.close"),Hs=Ms("typeahead.cancel"),Us=Ms("system.init"),Zs=Ms("system.touchmove"),$s=Ms("system.touchend"),js=Ms("system.scroll"),Ws=Ms("system.resize"),qs=Ms("system.attached"),Gs=Ms("system.detached"),Ys=Ms("system.dismissRequested"),Xs=Ms("system.repositionRequested"),Ks=Ms("focusmanager.shifted"),Js=Ms("slotcontainer.visibility"),Qs=Ms("system.external.element.scroll"),ea=Ms("change.tab"),ta=Ms("dismiss.tab"),oa=Ms("highlight"),na=Ms("dehighlight"),ra=e=>(e=>{if(_o(e))return"#shadow-root";{const t=(e=>Qo(e,!1))(e);return(e=>{const t=at("div"),o=ct(e.dom.cloneNode(!0));return Uo(t,o),en(t)})(t)}})(e);var ia;!function(e){e[e.STOP=0]="STOP",e[e.NORMAL=1]="NORMAL",e[e.LOGGING=2]="LOGGING"}(ia||(ia={}));const sa=we({}),aa=["alloy/data/Fields","alloy/debugging/Debugging"],la=(e,t,o)=>((e,t,o)=>{switch(fe(sa.get(),e).orThunk(()=>{const t=ie(sa.get());return re(t,t=>e.indexOf(t)>-1?A.some(sa.get()[t]):A.none())}).getOr(ia.NORMAL)){case ia.NORMAL:return o(ca());case ia.LOGGING:{const n=((e,t)=>{const o=[],n=(new Date).getTime();return{logEventCut:(e,t,n)=>{o.push({outcome:"cut",target:t,purpose:n})},logEventStopped:(e,t,n)=>{o.push({outcome:"stopped",target:t,purpose:n})},logNoParent:(e,t,n)=>{o.push({outcome:"no-parent",target:t,purpose:n})},logEventNoHandlers:(e,t)=>{o.push({outcome:"no-handlers-left",target:t})},logEventResponse:(e,t,n)=>{o.push({outcome:"response",purpose:n,target:t})},write:()=>{const r=(new Date).getTime();V(["mousemove","mouseover","mouseout",Us()],e)||console.log(e,{event:e,time:r-n,target:t.dom,sequence:L(o,e=>V(["cut","stopped","response"],e.outcome)?"{"+e.purpose+"} "+e.outcome+" at ("+ra(e.target)+")":e.outcome)})}}})(e,t),r=o(n);return n.write(),r}case ia.STOP:return!0}})(e,t,o),ca=w({logEventCut:v,logEventStopped:v,logNoParent:v,logEventNoHandlers:v,logEventResponse:v,write:v}),da=w([Di("menu"),Di("selectedMenu")]),ua=w([Di("item"),Di("selectedItem")]);w(bi(ua().concat(da())));const ha=w(bi(ua())),ma=Hi("initSize",[Di("numColumns"),Di("numRows")]),pa=()=>Hi("markers",[Di("backgroundMenu")].concat(da()).concat(ua())),ga=e=>Hi("markers",L(e,Di)),fa=(e,t,o)=>((()=>{const e=new Error;if(void 0!==e.stack){const t=e.stack.split("\n");$(t,e=>e.indexOf("alloy")>0&&!D(aa,t=>e.indexOf(t)>-1)).getOr("unknown")}})(),Ri(t,t,o,ki(e=>Ae.value((...t)=>e.apply(void 0,t))))),va=e=>fa(0,e,li(v)),ba=e=>fa(0,e,li(A.none)),ya=e=>fa(0,e,{tag:"required",process:{}}),wa=e=>fa(0,e,{tag:"required",process:{}}),_a=(e,t)=>Ni(e,w(t)),xa=e=>Ni(e,_),Ca=w(ma),ka=e=>L(e,e=>Qe(e,"/*")?e.substring(0,e.length-2):e),Sa=(e,t)=>{const o=e.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),i=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:ka(i)}),e},Ta=(e,t)=>{let o=null;return{cancel:()=>{null!==o&&(clearTimeout(o),o=null)},schedule:(...n)=>{o=setTimeout(()=>{e.apply(null,n),o=null},t)}}},Ea=e=>{const t=e.raw;return void 0===t.touches||1!==t.touches.length?A.none():A.some(t.touches[0])};var Oa;!function(e){e.OnFocusMode="onFocus",e.OnEnterOrSpaceMode="onEnterOrSpace",e.OnApiMode="onApi"}(Oa||(Oa={}));const Aa="placeholder",Ma=ye([{single:["required","valueThunk"]},{multiple:["required","valueThunks"]}]),Ba=e=>ve(e,"uiType"),Ra=(e,t,o,n)=>((e,t,o,n)=>Ba(o)&&o.uiType===Aa?((e,t,o,n)=>e.exists(e=>e!==o.owner)?Ma.single(!0,w(o)):fe(n,o.name).fold(()=>{throw new Error("Unknown placeholder component: "+o.name+"\nKnown: ["+ie(n)+"]\nNamespace: "+e.getOr("none")+"\nSpec: "+JSON.stringify(o,null,2))},e=>e.replace()))(e,0,o,n):Ma.single(!1,w(o)))(e,0,o,n).fold((r,i)=>{const s=Ba(o)?i(t,o.config,o.validated):i(t),a=fe(s,"components").getOr([]),l=q(a,o=>Ra(e,t,o,n));return[{...s,components:l}]},(e,n)=>{if(Ba(o)){const e=n(t,o.config,o.validated);return o.validated.preprocess.getOr(_)(e)}return n(t)}),Na=Ma.single,Va=Ma.multiple,Da=w(Aa),Pa=ye([{required:["data"]},{external:["data"]},{optional:["data"]},{group:["data"]}]),Ia=Ji("factory",{sketch:_}),La=Ji("schema",[]),Fa=Di("name"),za=Ri("pname","pname",ai(e=>"<alloy."+Pe(e.name)+">"),Qr()),Ha=Ni("schema",()=>[$i("preprocess")]),Ua=Ji("defaults",w({})),Za=Ji("overrides",w({})),$a=bi([Ia,La,Fa,za,Ua,Za]),ja=bi([Ia,La,Fa,Ua,Za]),Wa=bi([Ia,La,Fa,za,Ua,Za]),qa=bi([Ia,Ha,Fa,Di("unit"),za,Ua,Za]),Ga=e=>e.fold(A.some,A.none,A.some,A.some),Ya=e=>{const t=e=>e.name;return e.fold(t,t,t,t)},Xa=(e,t)=>o=>{const n=Oi("Converting part type",t,o);return e(n)},Ka=Xa(Pa.required,$a),Ja=Xa(Pa.external,ja),Qa=Xa(Pa.optional,Wa),el=Xa(Pa.group,qa),tl=w("entirety");var ol=Object.freeze({__proto__:null,required:Ka,external:Ja,optional:Qa,group:el,asNamedPart:Ga,name:Ya,asCommon:e=>e.fold(_,_,_,_),original:tl});const nl=(e,t,o,n)=>Le(t.defaults(e,o,n),o,{uid:e.partUids[t.name]},t.overrides(e,o,n)),rl=(e,t)=>{const o={};return F(t,t=>{Ga(t).each(t=>{const n=il(e,t.pname);o[t.name]=o=>{const r=Oi("Part: "+t.name+" in "+e,bi(t.schema),o);return{...n,config:o,validated:r}}})}),o},il=(e,t)=>({uiType:Da(),owner:e,name:t}),sl=(e,t,o)=>({uiType:Da(),owner:e,name:t,config:o,validated:{}}),al=e=>q(e,e=>e.fold(A.none,A.some,A.none,A.none).map(e=>Hi(e.name,e.schema.concat([xa(tl())]))).toArray()),ll=e=>L(e,Ya),cl=(e,t,o)=>((e,t,o)=>{const n={},r={};return F(o,e=>{e.fold(e=>{n[e.pname]=Na(!0,(t,o,n)=>e.factory.sketch(nl(t,e,o,n)))},e=>{const o=t.parts[e.name];r[e.name]=w(e.factory.sketch(nl(t,e,o[tl()]),o))},e=>{n[e.pname]=Na(!1,(t,o,n)=>e.factory.sketch(nl(t,e,o,n)))},e=>{n[e.pname]=Va(!0,(t,o,n)=>{const r=t[e.name];return L(r,o=>e.factory.sketch(Le(e.defaults(t,o,n),o,e.overrides(t,o))))})})}),{internals:w(n),externals:w(r)}})(0,t,o),dl=(e,t,o)=>((e,t,o,n)=>{const r=le(n,(e,t)=>((e,t)=>{let o=!1;return{name:w(e),required:()=>t.fold((e,t)=>e,(e,t)=>e),used:()=>o,replace:()=>{if(o)throw new Error("Trying to use the same placeholder more than once: "+e);return o=!0,t}}})(t,e)),i=((e,t,o,n)=>q(o,o=>Ra(e,t,o,n)))(e,t,o,r);return ae(r,o=>{if(!1===o.used()&&o.required())throw new Error("Placeholder: "+o.name()+" was not found in components list\nNamespace: "+e.getOr("none")+"\nComponents: "+JSON.stringify(t.components,null,2))}),i})(A.some(e),t,t.components,o),ul=(e,t,o)=>{const n=t.partUids[o];return e.getSystem().getByUid(n).toOptional()},hl=(e,t,o)=>ul(e,t,o).getOrDie("Could not find part: "+o),ml=(e,t,o)=>{const n={},r=t.partUids,i=e.getSystem();return F(o,e=>{n[e]=w(i.getByUid(r[e]))}),n},pl=(e,t)=>{const o=e.getSystem();return le(t.partUids,(e,t)=>w(o.getByUid(e)))},gl=e=>ie(e.partUids),fl=(e,t,o)=>{const n={},r=t.partUids,i=e.getSystem();return F(o,e=>{n[e]=w(i.getByUid(r[e]).getOrDie())}),n},vl=(e,t)=>{const o=ll(t);return ls(L(o,t=>({key:t,value:e+"-"+t})))},bl=e=>Ri("partUids","partUids",ci(t=>vl(t.uid,e)),Qr());var yl=Object.freeze({__proto__:null,generate:rl,generateOne:sl,schemas:al,names:ll,substitutes:cl,components:dl,defaultUids:vl,defaultUidsSchema:bl,getAllParts:pl,getAllPartNames:gl,getPart:ul,getPartOrDie:hl,getParts:ml,getPartsOrDie:fl});const wl=["valignCentre","alignLeft","alignRight","alignCentre","top","bottom","left","right","inset"],_l=(e,t,o,n=1)=>{const r=e*n,i=t*n,s=e=>fe(o,e).getOr([]),a=(e,t,o)=>{const n=X(wl,o);return{offset:Bn(e,t),classesOn:q(o,s),classesOff:q(n,s)}};return{southeast:()=>a(-e,t,["top","alignLeft"]),southwest:()=>a(e,t,["top","alignRight"]),south:()=>a(-e/2,t,["top","alignCentre"]),northeast:()=>a(-e,-t,["bottom","alignLeft"]),northwest:()=>a(e,-t,["bottom","alignRight"]),north:()=>a(-e/2,-t,["bottom","alignCentre"]),east:()=>a(e,-t/2,["valignCentre","left"]),west:()=>a(-e,-t/2,["valignCentre","right"]),insetNortheast:()=>a(r,i,["top","alignLeft","inset"]),insetNorthwest:()=>a(-r,i,["top","alignRight","inset"]),insetNorth:()=>a(-r/2,i,["top","alignCentre","inset"]),insetSoutheast:()=>a(r,-i,["bottom","alignLeft","inset"]),insetSouthwest:()=>a(-r,-i,["bottom","alignRight","inset"]),insetSouth:()=>a(-r/2,-i,["bottom","alignCentre","inset"]),insetEast:()=>a(-r,-i/2,["valignCentre","right","inset"]),insetWest:()=>a(r,-i/2,["valignCentre","left","inset"])}},xl=()=>_l(0,0,{}),Cl=(e,t,o,n,r,i,s,a=!1)=>({x:e,y:t,bubble:o,direction:n,placement:r,restriction:i,label:`${s}-${r}`,alwaysFit:a}),kl=ye([{southeast:[]},{southwest:[]},{northeast:[]},{northwest:[]},{south:[]},{north:[]},{east:[]},{west:[]}]),Sl=kl.southeast,Tl=kl.southwest,El=kl.northeast,Ol=kl.northwest,Al=kl.south,Ml=kl.north,Bl=kl.east,Rl=kl.west,Nl=(e,t)=>K(["left","right","top","bottom"],o=>fe(t,o).map(t=>((e,t)=>{switch(t){case 1:return e.x;case 0:return e.x+e.width;case 2:return e.y;case 3:return e.y+e.height}})(e,t))),Vl="layout",Dl=e=>e.x,Pl=(e,t)=>e.x+e.width/2-t.width/2,Il=(e,t)=>e.x+e.width-t.width,Ll=(e,t)=>e.y-t.height,Fl=e=>e.y+e.height,zl=(e,t)=>e.y+e.height/2-t.height/2,Hl=(e,t,o)=>Cl(Dl(e),Fl(e),o.southeast(),Sl(),"southeast",Nl(e,{left:1,top:3}),Vl),Ul=(e,t,o)=>Cl(Il(e,t),Fl(e),o.southwest(),Tl(),"southwest",Nl(e,{right:0,top:3}),Vl),Zl=(e,t,o)=>Cl(Dl(e),Ll(e,t),o.northeast(),El(),"northeast",Nl(e,{left:1,bottom:2}),Vl),$l=(e,t,o)=>Cl(Il(e,t),Ll(e,t),o.northwest(),Ol(),"northwest",Nl(e,{right:0,bottom:2}),Vl),jl=(e,t,o)=>Cl(Pl(e,t),Ll(e,t),o.north(),Ml(),"north",Nl(e,{bottom:2}),Vl),Wl=(e,t,o)=>Cl(Pl(e,t),Fl(e),o.south(),Al(),"south",Nl(e,{top:3}),Vl),ql=(e,t,o)=>Cl((e=>e.x+e.width)(e),zl(e,t),o.east(),Bl(),"east",Nl(e,{left:0}),Vl),Gl=(e,t,o)=>Cl(((e,t)=>e.x-t.width)(e,t),zl(e,t),o.west(),Rl(),"west",Nl(e,{right:1}),Vl),Yl=()=>[Hl,Ul,Zl,$l,Wl,jl,ql,Gl],Xl=()=>[Ul,Hl,$l,Zl,Wl,jl,ql,Gl],Kl=()=>[Zl,$l,Hl,Ul,jl,Wl],Jl=()=>[$l,Zl,Ul,Hl,jl,Wl],Ql=()=>[Hl,Ul,Zl,$l,Wl,jl],ec=()=>[Ul,Hl,$l,Zl,Wl,jl],tc="data-alloy-placement",oc=e=>Go(e,tc),nc="layout-inset",rc=e=>e.x,ic=(e,t)=>e.x+e.width/2-t.width/2,sc=(e,t)=>e.x+e.width-t.width,ac=e=>e.y,lc=(e,t)=>e.y+e.height-t.height,cc=(e,t)=>e.y+e.height/2-t.height/2,dc=(e,t,o)=>Cl(sc(e,t),lc(e,t),o.insetSouthwest(),Ol(),"southwest",Nl(e,{right:0,bottom:3}),nc),uc=(e,t,o)=>Cl(rc(e),lc(e,t),o.insetSoutheast(),El(),"southeast",Nl(e,{left:1,bottom:3}),nc),hc=(e,t,o)=>Cl(sc(e,t),ac(e),o.insetNorthwest(),Tl(),"northwest",Nl(e,{right:0,top:2}),nc),mc=(e,t,o)=>Cl(rc(e),ac(e),o.insetNortheast(),Sl(),"northeast",Nl(e,{left:1,top:2}),nc),pc=(e,t,o)=>Cl(ic(e,t),ac(e),o.insetNorth(),Al(),"north",Nl(e,{top:2}),nc),gc=(e,t,o)=>Cl(ic(e,t),lc(e,t),o.insetSouth(),Ml(),"south",Nl(e,{bottom:3}),nc),fc=(e,t,o)=>Cl(sc(e,t),cc(e,t),o.insetEast(),Rl(),"east",Nl(e,{right:0}),nc),vc=(e,t,o)=>Cl(rc(e),cc(e,t),o.insetWest(),Bl(),"west",Nl(e,{left:1}),nc),bc=e=>{switch(e){case"north":return pc;case"northeast":return mc;case"northwest":return hc;case"south":return gc;case"southeast":return uc;case"southwest":return dc;case"east":return fc;case"west":return vc}},yc=(e,t,o,n,r)=>oc(n).map(bc).getOr(pc)(e,t,o,n,r),wc=e=>{switch(e){case"north":return gc;case"northeast":return uc;case"northwest":return dc;case"south":return pc;case"southeast":return mc;case"southwest":return hc;case"east":return vc;case"west":return fc}},_c=(e,t,o,n,r)=>oc(n).map(wc).getOr(pc)(e,t,o,n,r),xc=(e,t)=>{((e,t)=>{const o=_n.max(e,t,["margin-top","border-top-width","padding-top","padding-bottom","border-bottom-width","margin-bottom"]);dn(e,"max-height",o+"px")})(e,Math.floor(t))},Cc=w((e,t)=>{xc(e,t),un(e,{"overflow-x":"hidden","overflow-y":"auto"})}),kc=w((e,t)=>{xc(e,t)}),Sc=w((e,t)=>{((e,t)=>{const o=Sn.max(e,t,["margin-left","border-left-width","padding-left","padding-right","border-right-width","margin-right"]);dn(e,"max-width",o+"px")})(e,Math.floor(t))});var Tc;!function(e){e.TopToBottom="toptobottom",e.BottomToTop="bottomtotop"}(Tc||(Tc={}));const Ec="data-alloy-vertical-dir",Oc=e=>mr(e,e=>no(e)&&qo(e,"data-alloy-vertical-dir")===Tc.BottomToTop);var Ac;!function(e){e[e.HighlightMenuAndItem=0]="HighlightMenuAndItem",e[e.HighlightJustMenu=1]="HighlightJustMenu",e[e.HighlightNone=2]="HighlightNone"}(Ac||(Ac={}));const Mc={init:()=>Bc({readState:w("No State required")})},Bc=e=>e,Rc={can:O,abort:E,run:v},Nc=e=>{if(!be(e,"can")&&!be(e,"abort")&&!be(e,"run"))throw new Error("EventHandler defined by: "+JSON.stringify(e,null,2)+" does not have can, abort, or run!");return{...Rc,...e}},Vc=(e,t)=>{Lc(e,e.element,t,{})},Dc=(e,t,o)=>{Lc(e,e.element,t,o)},Pc=e=>{Vc(e,Ps())},Ic=(e,t,o)=>{Lc(e,t,o,{})},Lc=(e,t,o,n)=>{const r={target:t,...n};e.getSystem().triggerEvent(o,t,r)},Fc=(e,t,o,n)=>{e.getSystem().triggerEvent(o,t,n.event)},zc=e=>ls(e),Hc=(e,t)=>({key:e,value:Nc({abort:t})}),Uc=e=>({key:e,value:Nc({run:(e,t)=>{t.event.prevent()}})}),Zc=(e,t)=>({key:e,value:Nc({run:t})}),$c=(e,t,o)=>({key:e,value:Nc({run:(e,n)=>{t.apply(void 0,[e,n].concat(o))}})}),jc=e=>t=>({key:e,value:Nc({run:(e,o)=>{Fr(e,o)&&t(e,o)}})}),Wc=(e,t,o)=>((e,t)=>Zc(e,(o,n)=>{o.getSystem().getByUid(t).each(t=>{Fc(t,t.element,e,n)})}))(e,t.partUids[o]),qc=(e,t)=>Zc(e,(e,o)=>{const n=o.event,r=e.getSystem().getByDom(n.target).getOrThunk(()=>vr(n.target,t=>e.getSystem().getByDom(t).toOptional(),E).getOr(e));t(e,r,o)}),Gc=e=>Zc(e,(e,t)=>{t.cut()}),Yc=e=>Zc(e,(e,t)=>{t.stop()}),Xc=(e,t)=>jc(e)(t),Kc=jc(qs()),Jc=jc(Gs()),Qc=jc(Us()),ed=(e=>t=>Zc(e,t))(Ps()),td=e=>({classes:u(e.classes)?[]:e.classes,attributes:u(e.attributes)?{}:e.attributes,styles:u(e.styles)?{}:e.styles}),od=(e,t,o)=>Qc((n,r)=>{o(n,e,t)}),nd=e=>({key:e,value:void 0}),rd=(e,t,o,n,r,i,s)=>{const a=e=>be(e,o)?e[o]():A.none(),l=le(r,(e,t)=>((e,t,o)=>((e,t,o)=>{const n=o.toString(),r=n.indexOf(")")+1,i=n.indexOf("("),s=n.substring(i+1,r-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:t,parameters:ka(s.slice(0,1).concat(s.slice(3)))}),e})((n,...r)=>{const i=[n].concat(r);return n.config({name:w(e)}).fold(()=>{throw new Error("We could not find any behaviour configuration for: "+e+". Using API: "+o)},e=>{const o=Array.prototype.slice.call(i,1);return t.apply(void 0,[n,e.config,e.state].concat(o))})},o,t))(o,e,t)),c={...le(i,(e,t)=>Sa(e,t)),...l,revoke:C(nd,o),config:t=>{const n=Oi(o+"-config",e,t);return{key:o,value:{config:n,me:c,configAsRaw:rt(()=>Oi(o+"-config",e,t)),initialConfig:t,state:s}}},schema:w(t),exhibit:(e,t)=>Ue(a(e),fe(n,"exhibit"),(e,o)=>o(t,e.config,e.state)).getOrThunk(()=>td({})),name:w(o),handlers:e=>a(e).map(e=>fe(n,"events").getOr(()=>({}))(e.config,e.state)).getOr({})};return c},id=e=>ls(e),sd=vi([Di("fields"),Di("name"),Ji("active",{}),Ji("apis",{}),Ji("state",Mc),Ji("extra",{})]),ad=e=>{const t=Oi("Creating behaviour: "+e.name,sd,e);return((e,t,o,n,r,i)=>{const s=vi(e),a=Ki(t,[(l=e,ji("config",vi(l)))]);var l;return rd(s,a,t,o,n,r,i)})(t.fields,t.name,t.active,t.apis,t.extra,t.state)},ld=vi([Di("branchKey"),Di("branches"),Di("name"),Ji("active",{}),Ji("apis",{}),Ji("state",Mc),Ji("extra",{})]),cd=e=>{const t=Oi("Creating behaviour: "+e.name,ld,e);return((e,t,o,n,r,i)=>{const s=e,a=Ki(t,[ji("config",e)]);return rd(s,a,t,o,n,r,i)})(Mi(t.branchKey,t.branches),t.name,t.active,t.apis,t.extra,t.state)},dd=w(void 0),ud=(e,t)=>{const o=((e,t)=>{const o=zc(t);return ad({fields:[Di("enabled")],name:e,active:{events:w(o)}})})(e,t);return{key:e,value:{config:{},me:o,configAsRaw:w({}),initialConfig:{},state:Mc}}},hd=(e,t)=>{t.ignore||(Vo(e.element),t.onFocus(e))};var md=Object.freeze({__proto__:null,focus:hd,blur:(e,t)=>{t.ignore||Do(e.element)},isFocused:e=>Po(e.element)}),pd=Object.freeze({__proto__:null,exhibit:(e,t)=>{const o=t.ignore?{}:{attributes:{tabindex:"-1"}};return td(o)},events:e=>zc([Zc(Rs(),(t,o)=>{hd(t,e),o.stop()})].concat(e.stopMousedown?[Zc(ps(),(e,t)=>{t.event.prevent()})]:[]))}),gd=[va("onFocus"),Ji("stopMousedown",!1),Ji("ignore",!1)];const fd=ad({fields:gd,name:"focusing",active:pd,apis:md}),vd=[8],bd=[9],yd=[13],wd=[27],_d=[32],xd=[37],Cd=[38],kd=[39],Sd=[40],Td=(e,t,o)=>{const n=Y(e.slice(0,t)),r=Y(e.slice(t+1));return $(n.concat(r),o)},Ed=(e,t,o)=>{const n=Y(e.slice(0,t));return $(n,o)},Od=(e,t,o)=>{const n=e.slice(0,t),r=e.slice(t+1);return $(r.concat(n),o)},Ad=(e,t,o)=>{const n=e.slice(t+1);return $(n,o)},Md=e=>t=>{const o=t.raw;return V(e,o.which)},Bd=e=>t=>G(e,e=>e(t)),Rd=e=>!0===e.raw.shiftKey,Nd=e=>!0===e.raw.ctrlKey,Vd=k(Rd),Dd=(e,t)=>({matches:e,classification:t}),Pd=(e,t,o,n)=>{const r=hr(e.element,"."+t.highlightClass);F(r,o=>{D(n,e=>wt(e.element,o))||(rr(o,t.highlightClass),e.getSystem().getByDom(o).each(o=>{t.onDehighlight(e,o),Vc(o,na())}))})},Id=(e,t,o,n)=>{Pd(e,t,0,[n]),Ld(e,t,o,n)||(or(n.element,t.highlightClass),t.onHighlight(e,n),Vc(n,oa()))},Ld=(e,t,o,n)=>ir(n.element,t.highlightClass),Fd=(e,t,o)=>Gn(e.element,"."+t.itemClass).bind(t=>e.getSystem().getByDom(t).toOptional()),zd=(e,t,o)=>{const n=hr(e.element,"."+t.itemClass);return(n.length>0?A.some(n[n.length-1]):A.none()).bind(t=>e.getSystem().getByDom(t).toOptional())},Hd=(e,t,o,n)=>{const r=hr(e.element,"."+t.itemClass);return j(r,e=>ir(e,t.highlightClass)).bind(t=>{const o=Ne(t,n,0,r.length-1);return e.getSystem().getByDom(r[o]).toOptional()})},Ud=(e,t,o)=>{const n=hr(e.element,"."+t.itemClass);return He(L(n,t=>e.getSystem().getByDom(t).toOptional()))};var Zd=Object.freeze({__proto__:null,dehighlightAll:(e,t,o)=>Pd(e,t,0,[]),dehighlight:(e,t,o,n)=>{Ld(e,t,o,n)&&(rr(n.element,t.highlightClass),t.onDehighlight(e,n),Vc(n,na()))},highlight:Id,highlightFirst:(e,t,o)=>{Fd(e,t).each(n=>{Id(e,t,o,n)})},highlightLast:(e,t,o)=>{zd(e,t).each(n=>{Id(e,t,o,n)})},highlightAt:(e,t,o,n)=>{((e,t,o,n)=>{const r=hr(e.element,"."+t.itemClass);return A.from(r[n]).fold(()=>Ae.error(new Error("No element found with index "+n)),e.getSystem().getByDom)})(e,t,0,n).fold(e=>{throw e},n=>{Id(e,t,o,n)})},highlightBy:(e,t,o,n)=>{const r=Ud(e,t);$(r,n).each(n=>{Id(e,t,o,n)})},isHighlighted:Ld,getHighlighted:(e,t,o)=>Gn(e.element,"."+t.highlightClass).bind(t=>e.getSystem().getByDom(t).toOptional()),getFirst:Fd,getLast:zd,getPrevious:(e,t,o)=>Hd(e,t,0,-1),getNext:(e,t,o)=>Hd(e,t,0,1),getCandidates:Ud}),$d=[Di("highlightClass"),Di("itemClass"),va("onHighlight"),va("onDehighlight")];const jd=ad({fields:$d,name:"highlighting",apis:Zd}),Wd=(e,t,o)=>{t.exists(e=>o.exists(t=>wt(t,e)))||Dc(e,Ks(),{prevFocus:t,newFocus:o})},qd=()=>{const e=e=>Lo(e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().triggerFocus(o,t.element);const r=e(t);Wd(t,n,r)}}},Gd=()=>{const e=e=>jd.getHighlighted(e).map(e=>e.element);return{get:e,set:(t,o)=>{const n=e(t);t.getSystem().getByDom(o).fold(v,e=>{jd.highlight(t,e)});const r=e(t);Wd(t,n,r)}}},Yd=(e,t,o,n,r)=>{const i=(e,t,o,n,r)=>{return(i=o(e,t,n,r),s=t.event,$(i,e=>e.matches(s)).map(e=>e.classification)).bind(o=>o(e,t,n,r));var i,s},s={schema:()=>e.concat([Ji("focusManager",qd()),Qi("focusInside","onFocus",ki(e=>V(["onFocus","onEnterOrSpace","onApi"],e)?Ae.value(e):Ae.error("Invalid value for focusInside"))),_a("handler",s),_a("state",t),_a("sendFocusIn",r)]),processKey:i,toEvents:(e,t)=>{const s=e.focusInside!==Oa.OnFocusMode?A.none():r(e).map(o=>Zc(Rs(),(n,r)=>{o(n,e,t),r.stop()})),a=[Zc(_s(),(n,s)=>{i(n,s,o,e,t).fold(()=>{((o,n)=>{const i=Md(_d.concat(yd))(n.event);e.focusInside===Oa.OnEnterOrSpaceMode&&i&&Fr(o,n)&&r(e).each(r=>{r(o,e,t),n.stop()})})(n,s)},e=>{s.stop()})}),Zc(xs(),(o,r)=>{i(o,r,n,e,t).each(e=>{r.stop()})})];return zc(s.toArray().concat(a))}};return s},Xd=e=>{const t=[$i("onEscape"),$i("onEnter"),Ji("selector",'[data-alloy-tabstop="true"]:not(:disabled)'),Ji("firstTabstop",0),Ji("useTabstopAt",O),$i("visibilitySelector")].concat([e]),o=(e,t)=>{const o=e.visibilitySelector.bind(e=>Yn(t,e)).getOr(t);return xn(o)>0},n=(e,t)=>t.focusManager.get(e).bind(e=>Yn(e,t.selector)),r=(e,t,n)=>{((e,t)=>{const n=hr(e.element,t.selector),r=H(n,e=>o(t,e));return A.from(r[t.firstTabstop])})(e,t).each(o=>{t.focusManager.set(e,o)})},i=(e,t,r,i)=>{const s=H(hr(e.element,r.selector),e=>o(r,e));return n(e,r).bind(t=>j(s,C(wt,t)).bind(t=>((e,t,n,r,i)=>i(t,n,e=>((e,t)=>o(e,t)&&e.useTabstopAt(t))(r,e)).fold(()=>r.cyclic?A.some(!0):A.none(),t=>(r.focusManager.set(e,t),A.some(!0))))(e,s,t,r,i)))},s=(e,t,o)=>{const n=o.cyclic?Td:Ed;return i(e,0,o,n)},a=(e,t,o)=>{const n=o.cyclic?Od:Ad;return i(e,0,o,n)},l=w([Dd(Bd([Rd,Md(bd)]),s),Dd(Md(bd),a),Dd(Bd([Vd,Md(yd)]),(e,t,o)=>o.onEnter.bind(o=>o(e,t)))]),c=w([Dd(Md(wd),(e,t,o)=>o.onEscape.bind(o=>o(e,t))),Dd(Md(bd),(e,t,o)=>n(e,o).filter(e=>!o.useTabstopAt(e)).bind(n=>((e=>(e=>mo(e))(e).bind(bo).exists(t=>wt(t,e)))(n)?s:a)(e,t,o)))]);return Yd(t,Mc.init,l,c,()=>A.some(r))};var Kd=Xd(Ni("cyclic",E)),Jd=Xd(Ni("cyclic",O));const Qd=e=>ao("input")(e)&&"radio"!==qo(e,"type")||ao("textarea")(e),eu=(e,t,o)=>Qd(o)&&Md(_d)(t.event)?A.none():((e,t,o)=>(Ic(e,o,Ps()),A.some(!0)))(e,0,o),tu=(e,t)=>A.some(!0),ou=[Ji("execute",eu),Ji("useSpace",!1),Ji("useEnter",!0),Ji("useControlEnter",!1),Ji("useDown",!1)],nu=(e,t,o)=>o.execute(e,t,e.element);var ru=Yd(ou,Mc.init,(e,t,o,n)=>{const r=o.useSpace&&!Qd(e.element)?_d:[],i=o.useEnter?yd:[],s=o.useDown?Sd:[],a=r.concat(i).concat(s);return[Dd(Md(a),nu)].concat(o.useControlEnter?[Dd(Bd([Nd,Md(yd)]),nu)]:[])},(e,t,o,n)=>o.useSpace&&!Qd(e.element)?[Dd(Md(_d),tu)]:[],()=>A.none());const iu=()=>{const e=Ge();return Bc({readState:()=>e.get().map(e=>({numRows:String(e.numRows),numColumns:String(e.numColumns)})).getOr({numRows:"?",numColumns:"?"}),setGridSize:(t,o)=>{e.set({numRows:t,numColumns:o})},getNumRows:()=>e.get().map(e=>e.numRows),getNumColumns:()=>e.get().map(e=>e.numColumns)})};var su=Object.freeze({__proto__:null,flatgrid:iu,init:e=>e.state(e)});const au=e=>(t,o,n,r)=>{const i=e(t.element);return uu(i,t,o,n,r)},lu=(e,t)=>{const o=Ln(e,t);return au(o)},cu=(e,t)=>{const o=Ln(t,e);return au(o)},du=e=>(t,o,n,r)=>uu(e,t,o,n,r),uu=(e,t,o,n,r)=>n.focusManager.get(t).bind(o=>e(t.element,o,n,r)).map(e=>(n.focusManager.set(t,e),!0)),hu=du,mu=du,pu=du,gu=(e,t,o)=>{const n=hr(e,o);return(e=>j(e,e=>wt(e,t)).map(t=>({index:t,candidates:e})))(H(n,kn))},fu=(e,t)=>j(e,e=>wt(t,e)),vu=(e,t,o,n)=>n(Math.floor(t/o),t%o).bind(t=>{const n=t.row*o+t.column;return n>=0&&n<e.length?A.some(e[n]):A.none()}),bu=(e,t,o,n,r)=>vu(e,t,n,(t,i)=>{const s=t===o-1?e.length-t*n:n,a=Ne(i,r,0,s-1);return A.some({row:t,column:a})}),yu=(e,t,o,n,r)=>vu(e,t,n,(t,i)=>{const s=Ne(t,r,0,o-1),a=s===o-1?e.length-s*n:n,l=Ve(i,0,a-1);return A.some({row:s,column:l})}),wu=[Di("selector"),Ji("execute",eu),ba("onEscape"),Ji("captureTab",!1),Ca()],_u=(e,t,o)=>{Gn(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},xu=e=>(t,o,n,r)=>gu(t,o,n.selector).bind(t=>e(t.candidates,t.index,r.getNumRows().getOr(n.initSize.numRows),r.getNumColumns().getOr(n.initSize.numColumns))),Cu=(e,t,o)=>o.captureTab?A.some(!0):A.none(),ku=xu((e,t,o,n)=>bu(e,t,o,n,-1)),Su=xu((e,t,o,n)=>bu(e,t,o,n,1)),Tu=xu((e,t,o,n)=>yu(e,t,o,n,-1)),Eu=xu((e,t,o,n)=>yu(e,t,o,n,1)),Ou=w([Dd(Md(xd),lu(ku,Su)),Dd(Md(kd),cu(ku,Su)),Dd(Md(Cd),hu(Tu)),Dd(Md(Sd),mu(Eu)),Dd(Bd([Rd,Md(bd)]),Cu),Dd(Bd([Vd,Md(bd)]),Cu),Dd(Md(_d.concat(yd)),(e,t,o,n)=>((e,t)=>t.focusManager.get(e).bind(e=>Yn(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)))]),Au=w([Dd(Md(wd),(e,t,o)=>o.onEscape(e,t)),Dd(Md(_d),tu)]);var Mu=Yd(wu,iu,Ou,Au,()=>A.some(_u));const Bu=(e,t,o,n,r)=>{const i=(e,t,o)=>r(e,t,n,0,o.length-1,o[t],t=>{return n=o[t],"button"===eo(n)&&"disabled"===qo(n,"disabled")?i(e,t,o):A.from(o[t]);var n});return gu(e,o,t).bind(e=>{const t=e.index,o=e.candidates;return i(t,t,o)})},Ru=(e,t,o,n)=>Bu(e,t,o,n,(e,t,o,n,r,i,s)=>{const a=Ve(t+o,n,r);return a===e?A.from(i):s(a)}),Nu=(e,t,o,n)=>Bu(e,t,o,n,(e,t,o,n,r,i,s)=>{const a=Ne(t,o,n,r);return a===e?A.none():s(a)}),Vu=[Di("selector"),Ji("getInitial",A.none),Ji("execute",eu),ba("onEscape"),Ji("executeOnMove",!1),Ji("allowVertical",!0),Ji("allowHorizontal",!0),Ji("cycles",!0)],Du=(e,t,o)=>((e,t)=>t.focusManager.get(e).bind(e=>Yn(e,t.selector)))(e,o).bind(n=>o.execute(e,t,n)),Pu=(e,t,o)=>{t.getInitial(e).orThunk(()=>Gn(e.element,t.selector)).each(o=>{t.focusManager.set(e,o)})},Iu=(e,t,o)=>(o.cycles?Nu:Ru)(e,o.selector,t,-1),Lu=(e,t,o)=>(o.cycles?Nu:Ru)(e,o.selector,t,1),Fu=e=>(t,o,n,r)=>e(t,o,n,r).bind(()=>n.executeOnMove?Du(t,o,n):A.some(!0)),zu=w([Dd(Md(_d),tu),Dd(Md(wd),(e,t,o)=>o.onEscape(e,t))]);var Hu=Yd(Vu,Mc.init,(e,t,o,n)=>{const r=[...o.allowHorizontal?xd:[]].concat(o.allowVertical?Cd:[]),i=[...o.allowHorizontal?kd:[]].concat(o.allowVertical?Sd:[]);return[Dd(Md(r),Fu(lu(Iu,Lu))),Dd(Md(i),Fu(cu(Iu,Lu))),Dd(Md(yd),Du),Dd(Md(_d),Du)]},zu,()=>A.some(Pu));const Uu=(e,t,o)=>A.from(e[t]).bind(e=>A.from(e[o]).map(e=>({rowIndex:t,columnIndex:o,cell:e}))),Zu=(e,t,o,n)=>{const r=e[t].length,i=Ne(o,n,0,r-1);return Uu(e,t,i)},$u=(e,t,o,n)=>{const r=Ne(o,n,0,e.length-1),i=e[r].length,s=Ve(t,0,i-1);return Uu(e,r,s)},ju=(e,t,o,n)=>{const r=e[t].length,i=Ve(o+n,0,r-1);return Uu(e,t,i)},Wu=(e,t,o,n)=>{const r=Ve(o+n,0,e.length-1),i=e[r].length,s=Ve(t,0,i-1);return Uu(e,r,s)},qu=[Hi("selectors",[Di("row"),Di("cell")]),Ji("cycles",!0),Ji("previousSelector",A.none),Ji("execute",eu)],Gu=(e,t,o)=>{t.previousSelector(e).orThunk(()=>{const o=t.selectors;return Gn(e.element,o.cell)}).each(o=>{t.focusManager.set(e,o)})},Yu=(e,t)=>(o,n,r)=>{const i=r.cycles?e:t;return Yn(n,r.selectors.row).bind(e=>{const t=hr(e,r.selectors.cell);return fu(t,n).bind(t=>{const n=hr(o,r.selectors.row);return fu(n,e).bind(e=>{const o=((e,t)=>L(e,e=>hr(e,t.selectors.cell)))(n,r);return i(o,e,t).map(e=>e.cell)})})})},Xu=Yu((e,t,o)=>Zu(e,t,o,-1),(e,t,o)=>ju(e,t,o,-1)),Ku=Yu((e,t,o)=>Zu(e,t,o,1),(e,t,o)=>ju(e,t,o,1)),Ju=Yu((e,t,o)=>$u(e,o,t,-1),(e,t,o)=>Wu(e,o,t,-1)),Qu=Yu((e,t,o)=>$u(e,o,t,1),(e,t,o)=>Wu(e,o,t,1)),eh=w([Dd(Md(xd),lu(Xu,Ku)),Dd(Md(kd),cu(Xu,Ku)),Dd(Md(Cd),hu(Ju)),Dd(Md(Sd),mu(Qu)),Dd(Md(_d.concat(yd)),(e,t,o)=>Lo(e.element).bind(n=>o.execute(e,t,n)))]),th=w([Dd(Md(_d),tu)]);var oh=Yd(qu,Mc.init,eh,th,()=>A.some(Gu));const nh=[Di("selector"),Ji("execute",eu),Ji("moveOnTab",!1)],rh=(e,t,o)=>o.focusManager.get(e).bind(n=>o.execute(e,t,n)),ih=(e,t,o)=>{Gn(e.element,t.selector).each(o=>{t.focusManager.set(e,o)})},sh=(e,t,o)=>Nu(e,o.selector,t,-1),ah=(e,t,o)=>Nu(e,o.selector,t,1),lh=w([Dd(Md(Cd),pu(sh)),Dd(Md(Sd),pu(ah)),Dd(Bd([Rd,Md(bd)]),(e,t,o,n)=>o.moveOnTab?pu(sh)(e,t,o,n):A.none()),Dd(Bd([Vd,Md(bd)]),(e,t,o,n)=>o.moveOnTab?pu(ah)(e,t,o,n):A.none()),Dd(Md(yd),rh),Dd(Md(_d),rh)]),ch=w([Dd(Md(_d),tu)]);var dh=Yd(nh,Mc.init,lh,ch,()=>A.some(ih));const uh=[ba("onSpace"),ba("onEnter"),ba("onShiftEnter"),ba("onLeft"),ba("onRight"),ba("onTab"),ba("onShiftTab"),ba("onUp"),ba("onDown"),ba("onEscape"),Ji("stopSpaceKeyup",!1),$i("focusIn")];var hh=Yd(uh,Mc.init,(e,t,o)=>[Dd(Md(_d),o.onSpace),Dd(Bd([Vd,Md(yd)]),o.onEnter),Dd(Bd([Rd,Md(yd)]),o.onShiftEnter),Dd(Bd([Rd,Md(bd)]),o.onShiftTab),Dd(Bd([Vd,Md(bd)]),o.onTab),Dd(Md(Cd),o.onUp),Dd(Md(Sd),o.onDown),Dd(Md(xd),o.onLeft),Dd(Md(kd),o.onRight),Dd(Md(_d),o.onSpace)],(e,t,o)=>[...o.stopSpaceKeyup?[Dd(Md(_d),tu)]:[],Dd(Md(wd),o.onEscape)],e=>e.focusIn);const mh=Kd.schema(),ph=Jd.schema(),gh=Hu.schema(),fh=Mu.schema(),vh=oh.schema(),bh=ru.schema(),yh=dh.schema(),wh=hh.schema(),_h=cd({branchKey:"mode",branches:Object.freeze({__proto__:null,acyclic:mh,cyclic:ph,flow:gh,flatgrid:fh,matrix:vh,execution:bh,menu:yh,special:wh}),name:"keying",active:{events:(e,t)=>e.handler.toEvents(e,t)},apis:{focusIn:(e,t,o)=>{t.sendFocusIn(t).fold(()=>{e.getSystem().triggerFocus(e.element,e.element)},n=>{n(e,t,o)})},setGridSize:(e,t,o,n,r)=>{(e=>be(e,"setGridSize"))(o)?o.setGridSize(n,r):console.error("Layout does not support setGridSize")}},state:su}),xh=Pe("alloy-premade"),Ch=e=>(Object.defineProperty(e.element.dom,xh,{value:e.uid,writable:!0}),as(xh,e)),kh=e=>fe(e,xh),Sh=e=>((e,t)=>{const o=t.toString(),n=o.indexOf(")")+1,r=o.indexOf("("),i=o.substring(r+1,n-1).split(/,\s*/);return e.toFunctionAnnotation=()=>({name:"OVERRIDE",parameters:ka(i.slice(1))}),e})((t,...o)=>e(t.getApis(),t,...o),e),Th=e=>e.getSystem().isConnected(),Eh=e=>{Vc(e,Gs());const t=e.components();F(t,Eh)},Oh=e=>{const t=e.components();F(t,Oh),Vc(e,qs())},Ah=(e,t)=>{e.getSystem().addToWorld(t),rn(e.element)&&Oh(t)},Mh=e=>{Eh(e),e.getSystem().removeFromWorld(e)},Bh=(e,t)=>{Uo(e.element,t.element)},Rh=(e,t)=>{Nh(e,t,Uo)},Nh=(e,t,o)=>{e.getSystem().addToWorld(t),o(e.element,t.element),rn(e.element)&&Oh(t),e.syncComponents()},Vh=e=>{Eh(e),Jo(e.element),e.getSystem().removeFromWorld(e)},Dh=e=>{const t=mo(e.element).bind(t=>e.getSystem().getByDom(t).toOptional());Vh(e),t.each(e=>{e.syncComponents()})},Ph=e=>{const t=e.components();F(t,Vh),Ko(e.element),e.syncComponents()},Ih=(e,t)=>{Fh(e,t,Uo)},Lh=(e,t)=>{Fh(e,t,zo)},Fh=(e,t,o)=>{o(e,t.element);const n=fo(t.element);F(n,e=>{t.getByDom(e).each(Oh)})},zh=e=>{const t=fo(e.element);F(t,t=>{e.getByDom(t).each(Eh)}),Jo(e.element)},Hh=(e,t,o)=>{o.fold(()=>Uo(e,t),e=>{wt(e,t)||(Fo(e,t),Jo(e))})},Uh=(e,t,o)=>{const n=L(t,o),r=fo(e);return F(r.slice(n.length),Jo),n},Zh=(e,t,o,n)=>{const r=vo(e,t),i=n(o,r),s=((e,t,o)=>vo(e,t).map(e=>{if(o.exists(t=>!wt(t,e))){const t=o.map(eo).getOr("span"),n=at(t);return Fo(e,n),n}return e}))(e,t,r);return Hh(e,i.element,s),i},$h=(e,t)=>{const o=xo(t),n=Io(o).bind(e=>{const o=t=>wt(e,t);return o(t)?A.some(t):((e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const r=ct(e.childNodes[n]);if(t(r))return A.some(r);const i=o(e.childNodes[n]);if(i.isSome())return i}return A.none()};return o(e.dom)})(t,o)}),r=e(t);return n.each(e=>{Io(o).filter(t=>wt(t,e)).fold(()=>{Vo(e)},v)}),r},jh=(e,t)=>{$h(()=>{((e,t,o)=>{const n=e.components();(e=>{F(e.components(),e=>Jo(e.element)),Ko(e.element),e.syncComponents()})(e);const r=o(t),i=X(n,r);F(i,t=>{Eh(t),e.getSystem().removeFromWorld(t)}),F(r,t=>{Th(t)?Bh(e,t):(e.getSystem().addToWorld(t),Bh(e,t),rn(e.element)&&Oh(t))}),e.syncComponents()})(e,t,()=>L(t,e.getSystem().build))},e.element)},Wh=(e,t)=>{$h(()=>{((o,n)=>{const r=o.components(),i=q(n,e=>kh(e).toArray());F(r,e=>{V(i,e)||Mh(e)});const s=((e,t,o)=>Uh(e,t,(t,n)=>Zh(e,n,t,o)))(e.element,t,e.getSystem().buildOrPatch),a=X(r,s);F(a,e=>{Th(e)&&Mh(e)}),F(s,e=>{Th(e)||Ah(o,e)}),o.syncComponents()})(e,t)},e.element)},qh=(e,t,o,n)=>{Mh(t);const r=Zh(e.element,o,n,e.getSystem().buildOrPatch);Ah(e,r),e.syncComponents()},Gh=(e,t,o)=>{const n=e.getSystem().build(o);Nh(e,n,t)},Yh=(e,t,o,n)=>{Dh(t),Gh(e,(e,t)=>((e,t,o)=>{vo(e,o).fold(()=>{Uo(e,t)},e=>{Fo(e,t)})})(e,t,o),n)},Xh=(e,t)=>e.components(),Kh=(e,t,o,n,r)=>{const i=Xh(e);return A.from(i[n]).map(o=>(r.fold(()=>Dh(o),r=>{(t.reuseDom?qh:Yh)(e,o,n,r)}),o))};var Jh=Object.freeze({__proto__:null,append:(e,t,o,n)=>{Gh(e,Uo,n)},prepend:(e,t,o,n)=>{Gh(e,Ho,n)},remove:(e,t,o,n)=>{const r=Xh(e),i=$(r,e=>wt(n.element,e.element));i.each(Dh)},replaceAt:Kh,replaceBy:(e,t,o,n,r)=>{const i=Xh(e);return j(i,n).bind(o=>Kh(e,t,0,o,r))},set:(e,t,o,n)=>(t.reuseDom?Wh:jh)(e,n),contents:Xh});const Qh=ad({fields:[ns("reuseDom",!0)],name:"replacing",apis:Jh}),em=zc([(e=>({key:e,value:Nc({can:(e,t)=>{const o=t.event,n=o.originator,r=o.target;return!((e,t,o)=>wt(t,e.element)&&!wt(t,o))(e,n,r)||(console.warn(Rs()+" did not get interpreted by the desired target. \nOriginator: "+ra(n)+"\nTarget: "+ra(r)+"\nCheck the "+Rs()+" event handlers"),!1)}})}))(Rs())]);var tm=Object.freeze({__proto__:null,events:em});const om=w("alloy-id-"),nm=w("data-alloy-id"),rm=om(),im=nm(),sm=(e,t)=>{Object.defineProperty(e.dom,im,{value:t,writable:!0})},am=e=>{const t=no(e)?e.dom[im]:null;return A.from(t)},lm=e=>Pe(e),cm=_,dm=e=>{const t=t=>`The component must be in a context to execute: ${t}`+(e?"\n"+ra(e().element)+" is not in context.":""),o=e=>()=>{throw new Error(t(e))},n=e=>()=>{console.warn(t(e))};return{debugInfo:w("fake"),triggerEvent:n("triggerEvent"),triggerFocus:n("triggerFocus"),triggerEscape:n("triggerEscape"),broadcast:n("broadcast"),broadcastOn:n("broadcastOn"),broadcastEvent:n("broadcastEvent"),build:o("build"),buildOrPatch:o("buildOrPatch"),addToWorld:o("addToWorld"),removeFromWorld:o("removeFromWorld"),addToGui:o("addToGui"),removeFromGui:o("removeFromGui"),getByUid:o("getByUid"),getByDom:o("getByDom"),isConnected:E}},um=dm(),hm=(e,t)=>{const o={};return ae(e,(e,n)=>{ae(e,(e,r)=>{const i=fe(o,r).getOr([]);o[r]=i.concat([t(n,e)])})}),o},mm=e=>e.cHandler,pm=(e,t)=>({name:e,handler:t}),gm=(e,t)=>{const o={};return F(e,e=>{o[e.name()]=e.handlers(t)}),o},fm=(e,t,o)=>{const n=t[o];return n?((e,t,o,n)=>{try{const r=Q(o,(o,r)=>{const i=o[t],s=r[t],a=n.indexOf(i),l=n.indexOf(s);if(-1===a)throw new Error("The ordering for "+e+" does not have an entry for "+i+".\nOrder specified: "+JSON.stringify(n,null,2));if(-1===l)throw new Error("The ordering for "+e+" does not have an entry for "+s+".\nOrder specified: "+JSON.stringify(n,null,2));return a<l?-1:l<a?1:0});return Ae.value(r)}catch(e){return Ae.error([e])}})("Event: "+o,"name",e,n).map(e=>(e=>{const t=(e=>(...t)=>Z(e,(e,o)=>e&&(e=>e.can)(o).apply(void 0,t),!0))(e),o=(e=>(...t)=>Z(e,(e,o)=>e||(e=>e.abort)(o).apply(void 0,t),!1))(e);return{can:t,abort:o,run:(...t)=>{F(e,e=>{e.run.apply(void 0,t)})}}})(L(e,e=>e.handler))):((e,t)=>Ae.error(["The event ("+e+') has more than one behaviour that listens to it.\nWhen this occurs, you must specify an event ordering for the behaviours in your spec (e.g. [ "listing", "toggling" ]).\nThe behaviours that can trigger it are: '+JSON.stringify(L(t,e=>e.name),null,2)]))(o,e)},vm=(e,t)=>((e,t)=>{const o=(e=>{const t=[],o=[];return F(e,e=>{e.fold(e=>{t.push(e)},e=>{o.push(e)})}),{errors:t,values:o}})(e);return o.errors.length>0?(n=o.errors,Ae.error(W(n))):((e,t)=>0===e.length?Ae.value(t):Ae.value(Le(t,Fe.apply(void 0,e))))(o.values,t);var n})(me(e,(e,o)=>(1===e.length?Ae.value(e[0].handler):fm(e,t,o)).map(n=>{const r=(e=>{const t=(e=>p(e)?{can:O,abort:E,run:e}:e)(e);return(e,o,...n)=>{const r=[e,o].concat(n);t.abort.apply(void 0,r)?o.stop():t.can.apply(void 0,r)&&t.run.apply(void 0,r)}})(n),i=e.length>1?H(t[o],t=>D(e,e=>e.name===t)).join(" > "):e[0].name;return as(o,((e,t)=>({handler:e,purpose:t}))(r,i))})),{}),bm="alloy.base.behaviour",ym=bi([Ri("dom","dom",{tag:"required",process:{}},bi([Di("tag"),Ji("styles",{}),Ji("classes",[]),Ji("attributes",{}),$i("value"),$i("innerHtml")])),Di("components"),Di("uid"),Ji("events",{}),Ji("apis",{}),Ri("eventOrder","eventOrder",(Bm={[Ps()]:["disabling",bm,"toggling","typeaheadevents"],[Rs()]:[bm,"focusing","keying"],[Us()]:[bm,"disabling","toggling","representing","tooltipping"],[Cs()]:[bm,"representing","streaming","invalidating"],[Gs()]:[bm,"representing","item-events","toolbar-button-events","tooltipping"],[ps()]:["focusing",bm,"item-type-events"],[ds()]:["focusing",bm,"item-type-events"],[bs()]:["item-type-events","tooltipping"],[Ds()]:["receiving","reflecting","tooltipping"]},ci(w(Bm))),Qr()),$i("domModification")]),wm=e=>e.events,_m=(e,t)=>{const o=ie(e),n=ie(t),r=X(n,o),i=(e=>{const o={},n={};return ue(e,(e,o)=>!ve(t,o)||e!==t[o],de(o),de(n)),{t:o,f:n}})(e).t;return{toRemove:r,toSet:i}},xm=(e,t)=>{const o=t.filter(t=>eo(t)===e.tag&&!(e=>e.innerHtml.isSome()&&e.domChildren.length>0)(e)&&!(e=>ve(e.dom,xh))(t)).bind(t=>((e,t)=>{try{const o=((e,t)=>{const{class:o,style:n,...r}=(e=>Z(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}))(t),{toSet:i,toRemove:s}=_m(e.attributes,r),a=fn(t),{toSet:l,toRemove:c}=_m(e.styles,a),d=lr(t),u=X(d,e.classes),h=X(e.classes,d);return F(s,e=>Xo(t,e)),Wo(t,i),sr(t,h),ar(t,u),F(c,e=>bn(t,e)),un(t,l),e.innerHtml.fold(()=>{const o=e.domChildren;((e,t)=>{Uh(e,t,(t,o)=>{const n=vo(e,o);return Hh(e,t,n),t})})(t,o)},e=>{tn(t,e)}),(()=>{const o=t,n=e.value.getOrUndefined();n!==cr(o)&&dr(o,null!=n?n:"")})(),t})(e,t);return A.some(o)}catch(e){return A.none()}})(e,t)).getOrThunk(()=>(e=>{const t=at(e.tag);Wo(t,e.attributes),sr(t,e.classes),un(t,e.styles),e.innerHtml.each(e=>tn(t,e));const o=e.domChildren;return Zo(t,o),e.value.each(e=>{dr(t,e)}),t})(e));return sm(o,e.uid),o},Cm=e=>{const t=(e=>{const t=fe(e,"behaviours").getOr({});return q(ie(t),e=>{const o=t[e];return m(o)?[o.me]:[]})})(e);return((e,t)=>((e,t)=>{const o=L(t,e=>Ki(e.name(),[Di("config"),Ji("state",Mc)])),n=Ti("component.behaviours",bi(o),e.behaviours).fold(t=>{throw new Error(Ai(t)+"\nComplete spec:\n"+JSON.stringify(e,null,2))},_);return{list:t,data:le(n,e=>{const t=e.map(e=>({config:e.config,state:e.state.init(e.config)}));return w(t)})}})(e,t))(e,t)},km=(e,t)=>{const o=()=>h,n=we(um),r=Ei((e=>Ti("custom.definition",ym,e))(e)),i=Cm(e),s=(e=>e.list)(i),a=(e=>e.data)(i),l=((e,t,o)=>{const n={...(r=e).dom,uid:r.uid,domChildren:L(r.components,e=>e.element)};var r;const i=(e=>e.domModification.fold(()=>td({}),td))(e),s={"alloy.base.modification":i},a=t.length>0?((e,t,o,n)=>{const r={...t};F(o,t=>{r[t.name()]=t.exhibit(e,n)});const i=hm(r,(e,t)=>({name:e,modification:t})),s=e=>U(e,(e,t)=>({...t.modification,...e}),{}),a=U(i.classes,(e,t)=>t.modification.concat(e),[]),l=s(i.attributes),c=s(i.styles);return td({classes:a,attributes:l,styles:c})})(o,s,t,n):i;return l=n,c=a,{...l,attributes:{...l.attributes,...c.attributes},styles:{...l.styles,...c.styles},classes:l.classes.concat(c.classes)};var l,c})(r,s,a),c=xm(l,t),d=((e,t,o)=>{const n={"alloy.base.behaviour":wm(e)};return((e,t,o,n)=>{const r=((e,t,o)=>{const n={...o,...gm(t,e)};return hm(n,pm)})(e,o,n);return vm(r,t)})(o,e.eventOrder,t,n).getOrDie()})(r,s,a),u=we(r.components),h={uid:e.uid,getSystem:n.get,config:t=>{const o=a;return(p(o[t.name()])?o[t.name()]:()=>{throw new Error("Could not find "+t.name()+" in "+JSON.stringify(e,null,2))})()},hasConfigured:e=>p(a[e.name()]),spec:e,readState:e=>a[e]().map(e=>e.state.readState()).getOr("not enabled"),getApis:()=>r.apis,connect:e=>{n.set(e)},disconnect:()=>{n.set(dm(o))},element:c,syncComponents:()=>{const e=fo(c),t=q(e,e=>n.get().getByDom(e).fold(()=>[],J));u.set(t)},components:u.get,events:d};return h},Sm=e=>{const t=lt(e);return Tm({element:t})},Tm=e=>{const t=Oi("external.component",vi([Di("element"),$i("uid")]),e),o=we(dm()),n=t.uid.getOrThunk(()=>lm("external"));sm(t.element,n);const r={uid:n,getSystem:o.get,config:A.none,hasConfigured:E,connect:e=>{o.set(e)},disconnect:()=>{o.set(dm(()=>r))},getApis:()=>({}),element:t.element,spec:e,readState:w("No state"),syncComponents:v,components:w([]),events:{}};return Ch(r)},Em=lm,Om=(e,t)=>kh(e).getOrThunk(()=>((e,t)=>{const{events:o,...n}=cm(e),r=((e,t)=>{const o=fe(e,"components").getOr([]);return t.fold(()=>L(o,Am),e=>L(o,(t,o)=>Om(t,vo(e,o))))})(n,t),i={...n,events:{...tm,...o},components:r};return Ae.value(km(i,t))})((e=>ve(e,"uid"))(e)?e:{uid:Em(""),...e},t).getOrDie()),Am=e=>Om(e,A.none()),Mm=Ch;var Bm,Rm=Object.freeze({__proto__:null,block:(e,t,o,n)=>{jo(e.element,"aria-busy",!0);const r=t.getRoot(e).getOr(e),i=id([_h.config({mode:"special",onTab:()=>A.some(!0),onShiftTab:()=>A.some(!0)}),fd.config({})]),s=n(r,i),a=r.getSystem().build(s);Qh.append(r,Mm(a)),a.hasConfigured(_h)&&t.focus&&_h.focusIn(a),o.isBlocked()||t.onBlock(e),o.blockWith(()=>Qh.remove(r,a))},unblock:(e,t,o)=>{Xo(e.element,"aria-busy"),o.isBlocked()&&t.onUnblock(e),o.clear()},isBlocked:(e,t,o)=>o.isBlocked()}),Nm=[rs("getRoot",A.none),ns("focus",!0),va("onBlock"),va("onUnblock")];const Vm=ad({fields:Nm,name:"blocking",apis:Rm,state:Object.freeze({__proto__:null,init:()=>{const e=We(e=>e.destroy());return Bc({readState:e.isSet,blockWith:t=>{e.set({destroy:t})},clear:e.clear,isBlocked:e.isSet})}})});var Dm=Object.freeze({__proto__:null,getCurrent:(e,t,o)=>t.find(e)});const Pm=[Di("find")],Im=ad({fields:Pm,name:"composing",apis:Dm});var Lm=Object.freeze({__proto__:null,getCoupled:(e,t,o,n)=>o.getOrCreate(e,t,n),getExistingCoupled:(e,t,o,n)=>o.getExisting(e,t,n)}),Fm=[Pi("others",Si(Ae.value,Qr()))],zm=Object.freeze({__proto__:null,init:()=>{const e={},t=(t,o)=>{if(0===ie(t.others).length)throw new Error("Cannot find any known coupled components");return fe(e,o)},o=w({});return Bc({readState:o,getExisting:(e,o,n)=>t(o,n).orThunk(()=>(fe(o.others,n).getOrDie("No information found for coupled component: "+n),A.none())),getOrCreate:(o,n,r)=>t(n,r).getOrThunk(()=>{const t=fe(n.others,r).getOrDie("No information found for coupled component: "+r)(o),i=o.getSystem().build(t);return e[r]=i,i})})}});const Hm=ad({fields:Fm,name:"coupling",apis:Lm,state:zm}),Um=["input","button","textarea","select"],Zm=(e,t,o)=>{(t.disabled()?Ym:Xm)(e,t)},$m=(e,t)=>!0===t.useNative&&V(Um,eo(e.element)),jm=e=>{jo(e.element,"disabled","disabled")},Wm=e=>{Xo(e.element,"disabled")},qm=e=>{jo(e.element,"aria-disabled","true")},Gm=e=>{jo(e.element,"aria-disabled","false")},Ym=(e,t,o)=>{t.disableClass.each(t=>{or(e.element,t)}),($m(e,t)?jm:qm)(e),t.onDisabled(e)},Xm=(e,t,o)=>{t.disableClass.each(t=>{rr(e.element,t)}),($m(e,t)?Wm:Gm)(e),t.onEnabled(e)},Km=(e,t)=>$m(e,t)?(e=>Yo(e.element,"disabled"))(e):(e=>"true"===qo(e.element,"aria-disabled"))(e);var Jm=Object.freeze({__proto__:null,enable:Xm,disable:Ym,isDisabled:Km,onLoad:Zm,set:(e,t,o,n)=>{(n?Ym:Xm)(e,t)}}),Qm=Object.freeze({__proto__:null,exhibit:(e,t)=>td({classes:t.disabled()?t.disableClass.toArray():[]}),events:(e,t)=>zc([Hc(Ps(),(t,o)=>Km(t,e)),od(e,t,Zm)])}),ep=[rs("disabled",E),Ji("useNative",!0),$i("disableClass"),va("onDisabled"),va("onEnabled")];const tp=ad({fields:ep,name:"disabling",active:Qm,apis:Jm}),op=(e,t,o,n,r)=>{const i=e=>e+"px";return{position:e,left:t.map(i),top:o.map(i),right:n.map(i),bottom:r.map(i)}},np=(e,t)=>{hn(e,(e=>({...e,position:A.some(e.position)}))(t))},rp=(e,t)=>{const o=e.element;or(o,t.transitionClass),rr(o,t.fadeOutClass),or(o,t.fadeInClass),t.onShow(e)},ip=(e,t)=>{const o=e.element;or(o,t.transitionClass),rr(o,t.fadeInClass),or(o,t.fadeOutClass),t.onHide(e)},sp=(e,t)=>e.y>=t.y,ap=(e,t)=>e.bottom<=t.bottom,lp=(e,t,o)=>({location:"top",leftX:t,topY:o.bounds.y-e.y}),cp=(e,t,o)=>({location:"bottom",leftX:t,bottomY:e.bottom-o.bounds.bottom}),dp=e=>e.box.x-e.win.x,up=(e,t,o)=>o.getInitialPos().map(o=>{const n=((e,t)=>{const o=t.optScrollEnv.fold(w(e.bounds.y),t=>t.scrollElmTop+(e.bounds.y-t.currentScrollTop));return Bn(e.bounds.x,o)})(o,t);return{box:Vr(n.left,n.top,En(e),xn(e)),location:o.location}}),hp=(e,t,o,n,r)=>{const i=((e,t)=>{const o=t.optScrollEnv.fold(w(e.y),t=>e.y+t.currentScrollTop-t.scrollElmTop);return Bn(e.x,o)})(t,o),s=Vr(i.left,i.top,t.width,t.height);n.setInitialPos({style:fn(e),position:mn(e,"position")||"static",bounds:s,location:r.location})},mp=(e,t,o)=>o.getInitialPos().bind(n=>{var r;switch(o.clearInitialPos(),n.position){case"static":return A.some({morph:"static"});case"absolute":const o=zr(e).getOr(sn()),i=Dr(o),s=null!==(r=o.dom.scrollTop)&&void 0!==r?r:0;return A.some({morph:"absolute",positionCss:op("absolute",fe(n.style,"left").map(e=>t.x-i.x),fe(n.style,"top").map(e=>t.y-i.y+s),fe(n.style,"right").map(e=>i.right-t.right),fe(n.style,"bottom").map(e=>i.bottom-t.bottom))});default:return A.none()}}),pp=e=>{switch(e.location){case"top":return A.some({morph:"fixed",positionCss:op("fixed",A.some(e.leftX),A.some(e.topY),A.none(),A.none())});case"bottom":return A.some({morph:"fixed",positionCss:op("fixed",A.some(e.leftX),A.none(),A.none(),A.some(e.bottomY))});default:return A.none()}},gp=(e,t,o)=>{const n=e.element;return ze(gn(n,"position"),"fixed")?((e,t,o)=>((e,t,o)=>up(e,t,o).filter(({box:e})=>((e,t,o)=>G(e,e=>{switch(e){case"bottom":return ap(t,o.bounds);case"top":return sp(t,o.bounds)}}))(o.getModes(),e,t)).bind(({box:t})=>mp(e,t,o)))(e,t,o).orThunk(()=>t.optScrollEnv.bind(n=>up(e,t,o)).bind(({box:e,location:o})=>{const n=Lr(),r=dp({win:n,box:e}),i="top"===o?lp(n,r,t):cp(n,r,t);return pp(i)})))(n,t,o):((e,t,o)=>{const n=Dr(e),r=Lr(),i=((e,t,o)=>{const n=t.win,r=t.box,i=dp(t);return re(e,e=>{switch(e){case"bottom":return ap(r,o.bounds)?A.none():A.some(cp(n,i,o));case"top":return sp(r,o.bounds)?A.none():A.some(lp(n,i,o));default:return A.none()}}).getOr({location:"no-dock"})})(o.getModes(),{win:r,box:n},t);return"top"===i.location||"bottom"===i.location?(hp(e,n,t,o,i),pp(i)):A.none()})(n,t,o)},fp=(e,t,o)=>{o.setDocked(!1),F(["left","right","top","bottom","position"],t=>bn(e.element,t)),t.onUndocked(e)},vp=(e,t,o,n)=>{const r="fixed"===n.position;o.setDocked(r),np(e.element,n),(r?t.onDocked:t.onUndocked)(e)},bp=(e,t,o,n,r=!1)=>{t.contextual.each(t=>{t.lazyContext(e).each(i=>{const s=((e,t)=>e.y<t.bottom&&e.bottom>t.y)(i,n.bounds);s!==o.isVisible()&&(o.setVisible(s),r&&!s?(sr(e.element,[t.fadeOutClass]),t.onHide(e)):(s?rp:ip)(e,t))})})},yp=(e,t,o,n,r)=>{bp(e,t,o,n,!0),vp(e,t,o,r.positionCss)},wp=(e,t,o)=>{e.getSystem().isConnected()&&((e,t,o)=>{const n=t.lazyViewport(e);bp(e,t,o,n),gp(e,n,o).each(r=>{((e,t,o,n,r)=>{switch(r.morph){case"static":return fp(e,t,o);case"absolute":return vp(e,t,o,r.positionCss);case"fixed":yp(e,t,o,n,r)}})(e,t,o,n,r)})})(e,t,o)},_p=(e,t,o)=>{o.isDocked()&&((e,t,o)=>{const n=e.element;o.setDocked(!1);const r=t.lazyViewport(e);((e,t,o)=>{const n=e.element;return up(n,t,o).bind(({box:e})=>mp(n,e,o))})(e,r,o).each(n=>{switch(n.morph){case"static":fp(e,t,o);break;case"absolute":vp(e,t,o,n.positionCss)}}),o.setVisible(!0),t.contextual.each(t=>{ar(n,[t.fadeInClass,t.fadeOutClass,t.transitionClass]),t.onShow(e)}),wp(e,t,o)})(e,t,o)},xp=e=>(t,o,n)=>{const r=o.lazyViewport(t);((e,t,o,n)=>{const r=Dr(e),i=Lr(),s=n(i,dp({win:i,box:r}),t);return"bottom"===s.location||"top"===s.location?(((e,t,o,n,r)=>{n.getInitialPos().fold(()=>hp(e,t,o,n,r),()=>v)})(e,r,t,o,s),pp(s)):A.none()})(t.element,r,n,e).each(e=>{yp(t,o,n,r,e)})},Cp=xp(lp),kp=xp(cp);var Sp=Object.freeze({__proto__:null,refresh:wp,reset:_p,isDocked:(e,t,o)=>o.isDocked(),getModes:(e,t,o)=>o.getModes(),setModes:(e,t,o,n)=>o.setModes(n),forceDockToTop:Cp,forceDockToBottom:kp}),Tp=Object.freeze({__proto__:null,events:(e,t)=>zc([Xc(Es(),(o,n)=>{e.contextual.each(e=>{ir(o.element,e.transitionClass)&&(ar(o.element,[e.transitionClass,e.fadeInClass]),(t.isVisible()?e.onShown:e.onHidden)(o)),n.stop()})}),Zc(js(),(o,n)=>{wp(o,e,t)}),Zc(Qs(),(o,n)=>{wp(o,e,t)}),Zc(Ws(),(o,n)=>{_p(o,e,t)})])}),Ep=[Ki("contextual",[Li("fadeInClass"),Li("fadeOutClass"),Li("transitionClass"),zi("lazyContext"),va("onShow"),va("onShown"),va("onHide"),va("onHidden")]),rs("lazyViewport",()=>({bounds:Lr(),optScrollEnv:A.none()})),is("modes",["top","bottom"],oi),va("onDocked"),va("onUndocked")];const Op=ad({fields:Ep,name:"docking",active:Tp,apis:Sp,state:Object.freeze({__proto__:null,init:e=>{const t=we(!1),o=we(!0),n=Ge(),r=we(e.modes);return Bc({isDocked:t.get,setDocked:t.set,getInitialPos:n.get,setInitialPos:n.set,clearInitialPos:n.clear,isVisible:o.get,setVisible:o.set,getModes:r.get,setModes:r.set,readState:()=>`docked:  ${t.get()}, visible: ${o.get()}, modes: ${r.get().join(",")}`})}})}),Ap=ye([{offset:["x","y"]},{absolute:["x","y"]},{fixed:["x","y"]}]),Mp=e=>t=>t.translate(-e.left,-e.top),Bp=e=>t=>t.translate(e.left,e.top),Rp=e=>(t,o)=>Z(e,(e,t)=>t(e),Bn(t,o)),Np=(e,t,o)=>e.fold(Rp([Bp(o),Mp(t)]),Rp([Mp(t)]),Rp([])),Vp=(e,t,o)=>e.fold(Rp([Bp(o)]),Rp([]),Rp([Bp(t)])),Dp=(e,t,o)=>e.fold(Rp([]),Rp([Mp(o)]),Rp([Bp(t),Mp(o)])),Pp=(e,t,o)=>{const n=e.fold((e,t)=>({position:A.some("absolute"),left:A.some(e+"px"),top:A.some(t+"px")}),(e,t)=>({position:A.some("absolute"),left:A.some(e-o.left+"px"),top:A.some(t-o.top+"px")}),(e,t)=>({position:A.some("fixed"),left:A.some(e+"px"),top:A.some(t+"px")}));return{right:A.none(),bottom:A.none(),...n}},Ip=(e,t,o,n)=>{const r=(e,r)=>(i,s)=>{const a=e(t,o,n);return r(i.getOr(a.left),s.getOr(a.top))};return e.fold(r(Dp,Lp),r(Vp,Fp),r(Np,zp))},Lp=Ap.offset,Fp=Ap.absolute,zp=Ap.fixed,Hp=(e,t)=>{const o=qo(e,t);return u(o)?NaN:parseInt(o,10)},Up=(e,t,o,n,r,i)=>{const s=((e,t,o,n)=>((e,t)=>{const o=e.element,n=Hp(o,t.leftAttr),r=Hp(o,t.topAttr);return isNaN(n)||isNaN(r)?A.none():A.some(Bn(n,r))})(e,t).fold(()=>o,e=>zp(e.left+n.left,e.top+n.top)))(e,t,o,n),a=t.mustSnap?$p(e,t,s,r,i):jp(e,t,s,r,i),l=Np(s,r,i);return((e,t,o)=>{const n=e.element;jo(n,t.leftAttr,o.left+"px"),jo(n,t.topAttr,o.top+"px")})(e,t,l),a.fold(()=>({coord:zp(l.left,l.top),extra:A.none()}),e=>({coord:e.output,extra:e.extra}))},Zp=(e,t,o,n)=>re(e,e=>{const r=e.sensor,i=((e,t,o,n,r,i)=>{const s=Vp(e,r,i),a=Vp(t,r,i);return Math.abs(s.left-a.left)<=o&&Math.abs(s.top-a.top)<=n})(t,r,e.range.left,e.range.top,o,n);return i?A.some({output:Ip(e.output,t,o,n),extra:e.extra}):A.none()}),$p=(e,t,o,n,r)=>{const i=t.getSnapPoints(e);return Zp(i,o,n,r).orThunk(()=>{const e=Z(i,(e,t)=>{const i=t.sensor,s=((e,t,o,n,r,i)=>{const s=Vp(e,r,i),a=Vp(t,r,i),l=Math.abs(s.left-a.left),c=Math.abs(s.top-a.top);return Bn(l,c)})(o,i,t.range.left,t.range.top,n,r);return e.deltas.fold(()=>({deltas:A.some(s),snap:A.some(t)}),o=>(s.left+s.top)/2<=(o.left+o.top)/2?{deltas:A.some(s),snap:A.some(t)}:e)},{deltas:A.none(),snap:A.none()});return e.snap.map(e=>({output:Ip(e.output,o,n,r),extra:e.extra}))})},jp=(e,t,o,n,r)=>{const i=t.getSnapPoints(e);return Zp(i,o,n,r)};var Wp=Object.freeze({__proto__:null,snapTo:(e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const t=lo(e.element),o=Dn(t),i=Hr(r),s=((e,t,o)=>({coord:Ip(e.output,e.output,t,o),extra:e.extra}))(n,o,i),a=Pp(s.coord,0,i);hn(r,a)}}});const qp=(e,t)=>ss(e,{},L(t,t=>{return o=t.name(),n="Cannot configure "+t.name()+" for "+e,Ri(o,o,{tag:"option",process:{}},Kr(e=>qr("The field: "+o+" is forbidden. "+n)));var o,n}).concat([Ni("dump",_)])),Gp=e=>e.dump,Yp=(e,t)=>({...id(t),...e.dump}),Xp=qp,Kp=Yp,Jp=(e,t,o,n,r)=>{const i=((e,t)=>(e.length>0?[Hi("parts",e)]:[]).concat([Di("uid"),Ji("dom",{}),Ji("components",[]),xa("originalSpec"),Ji("debug.sketcher",{})]).concat(t))(n,r);return Oi(e+" [SpecSchema]",vi(i.concat(t)),o)},Qp=(e,t,o,n,r)=>{const i=eg(r),s=al(o),a=bl(o),l=Jp(e,t,i,s,[a]),c=cl(0,l,o);return n(l,dl(e,l,c.internals()),i,c.externals())},eg=e=>(e=>ve(e,"uid"))(e)?e:{...e,uid:lm("uid")},tg=vi([Di("name"),Di("factory"),Di("configFields"),Ji("apis",{}),Ji("extraApis",{})]),og=vi([Di("name"),Di("factory"),Di("configFields"),Di("partFields"),Ji("apis",{}),Ji("extraApis",{})]),ng=e=>{const t=Oi("Sketcher for "+e.name,tg,e),o=le(t.apis,Sh),n=le(t.extraApis,(e,t)=>Sa(e,t));return{name:t.name,configFields:t.configFields,sketch:e=>((e,t,o,n)=>{const r=eg(n);return o(Jp(e,t,r,[],[]),r)})(t.name,t.configFields,t.factory,e),...o,...n}},rg=e=>{const t=Oi("Sketcher for "+e.name,og,e),o=rl(t.name,t.partFields),n=le(t.apis,Sh),r=le(t.extraApis,(e,t)=>Sa(e,t));return{name:t.name,partFields:t.partFields,configFields:t.configFields,sketch:e=>Qp(t.name,t.configFields,t.partFields,t.factory,e),parts:o,...n,...r}},ig=ng({name:"Container",factory:e=>{const{attributes:t,...o}=e.dom;return{uid:e.uid,dom:{tag:"div",attributes:{role:"presentation",...t},...o},components:e.components,behaviours:Gp(e.containerBehaviours),events:e.events,domModification:e.domModification,eventOrder:e.eventOrder}},configFields:[Ji("components",[]),qp("containerBehaviours",[]),Ji("events",{}),Ji("domModification",{}),Ji("eventOrder",{})]}),sg="data-initial-z-index",ag=(e,t)=>{e.getSystem().addToGui(t),(e=>{mo(e.element).filter(no).each(t=>{gn(t,"z-index").each(e=>{jo(t,sg,e)}),dn(t,"z-index",mn(e.element,"z-index"))})})(t)},lg=e=>{(e=>{mo(e.element).filter(no).each(e=>{Go(e,sg).fold(()=>bn(e,"z-index"),t=>dn(e,"z-index",t)),Xo(e,sg)})})(e),e.getSystem().removeFromGui(e)},cg=(e,t,o)=>e.getSystem().build(ig.sketch({dom:{styles:{left:"0px",top:"0px",width:"100%",height:"100%",position:"fixed","z-index":"1000000000000000"},classes:[t]},events:o}));var dg=Ki("snaps",[Di("getSnapPoints"),va("onSensor"),Di("leftAttr"),Di("topAttr"),Ji("lazyViewport",Lr),Ji("mustSnap",!1)]);const ug=[Ji("useFixed",E),Di("blockerClass"),Ji("getTarget",_),Ji("onDrag",v),Ji("repositionTarget",!0),Ji("onDrop",v),rs("getBounds",Lr),dg],hg=e=>{return(t=gn(e,"left"),o=gn(e,"top"),n=gn(e,"position"),t.isSome()&&o.isSome()&&n.isSome()?A.some(((e,t,o)=>("fixed"===o?zp:Lp)(parseInt(e,10),parseInt(t,10)))(t.getOrDie(),o.getOrDie(),n.getOrDie())):A.none()).getOrThunk(()=>{const t=Nn(e);return Fp(t.left,t.top)});var t,o,n},mg=(e,t)=>({bounds:e.getBounds(),height:Cn(t.element),width:On(t.element)}),pg=(e,t,o,n,r)=>{const i=o.update(n,r),s=o.getStartData().getOrThunk(()=>mg(t,e));i.each(o=>{((e,t,o,n)=>{const r=t.getTarget(e.element);if(t.repositionTarget){const i=lo(e.element),s=Dn(i),a=Hr(r),l=hg(r),c=((e,t,o,n,r,i,s)=>((e,t,o,n,r)=>{const i=r.bounds,s=Vp(t,o,n),a=Ve(s.left,i.x,i.x+i.width-r.width),l=Ve(s.top,i.y,i.y+i.height-r.height),c=Fp(a,l);return t.fold(()=>{const e=Dp(c,o,n);return Lp(e.left,e.top)},w(c),()=>{const e=Np(c,o,n);return zp(e.left,e.top)})})(0,t.fold(()=>{const e=(t=o,s=i.left,a=i.top,t.fold((e,t)=>Lp(e+s,t+a),(e,t)=>Fp(e+s,t+a),(e,t)=>zp(e+s,t+a)));var t,s,a;const l=Np(e,n,r);return zp(l.left,l.top)},t=>{const s=Up(e,t,o,i,n,r);return s.extra.each(o=>{t.onSensor(e,o)}),s.coord}),n,r,s))(e,t.snaps,l,s,a,n,o),d=Pp(c,0,a);hn(r,d)}t.onDrag(e,r,n)})(e,t,s,o)})},gg=(e,t,o,n)=>{t.each(lg),o.snaps.each(t=>{((e,t)=>{((e,t)=>{const o=e.element;Xo(o,t.leftAttr),Xo(o,t.topAttr)})(e,t)})(e,t)});const r=o.getTarget(e.element);n.reset(),o.onDrop(e,r)},fg=e=>(t,o)=>{const n=e=>{o.setStartData(mg(t,e))};return zc([Zc(js(),e=>{o.getStartData().each(()=>n(e))}),...e(t,o,n)])};var vg=Object.freeze({__proto__:null,getData:e=>A.from(Bn(e.x,e.y)),getDelta:(e,t)=>Bn(t.left-e.left,t.top-e.top)});const bg=(e,t,o)=>[Zc(ps(),(n,r)=>{if(0!==r.event.raw.button)return;r.stop();const i=()=>gg(n,A.some(l),e,t),s=Ta(i,200),a={drop:i,delayDrop:s.schedule,forceDrop:i,move:o=>{s.cancel(),pg(n,e,t,vg,o)}},l=cg(n,e.blockerClass,(e=>zc([Zc(ps(),e.forceDrop),Zc(vs(),e.drop),Zc(gs(),(t,o)=>{e.move(o.event)}),Zc(fs(),e.delayDrop)]))(a));o(n),ag(n,l)})],yg=[...ug,_a("dragger",{handlers:fg(bg)})];var wg=Object.freeze({__proto__:null,getData:e=>{const t=e.raw.touches;return 1===t.length?(e=>{const t=e[0];return A.some(Bn(t.clientX,t.clientY))})(t):A.none()},getDelta:(e,t)=>Bn(t.left-e.left,t.top-e.top)});const _g=(e,t,o)=>{const n=Ge(),r=o=>{gg(o,n.get(),e,t),n.clear()};return[Zc(ds(),(i,s)=>{s.stop();const a=()=>r(i),l={drop:a,delayDrop:v,forceDrop:a,move:o=>{pg(i,e,t,wg,o)}},c=cg(i,e.blockerClass,(e=>zc([Zc(ds(),e.forceDrop),Zc(hs(),e.drop),Zc(ms(),e.drop),Zc(us(),(t,o)=>{e.move(o.event)})]))(l));n.set(c),o(i),ag(i,c)}),Zc(us(),(o,n)=>{n.stop(),pg(o,e,t,wg,n.event)}),Zc(hs(),(e,t)=>{t.stop(),r(e)}),Zc(ms(),r)]},xg=yg,Cg=[...ug,_a("dragger",{handlers:fg(_g)})],kg=[...ug,_a("dragger",{handlers:fg((e,t,o)=>[...bg(e,t,o),..._g(e,t,o)])})];var Sg=Object.freeze({__proto__:null,mouse:xg,touch:Cg,mouseOrTouch:kg}),Tg=Object.freeze({__proto__:null,init:()=>{let e=A.none(),t=A.none();const o=w({});return Bc({readState:o,reset:()=>{e=A.none(),t=A.none()},update:(t,o)=>t.getData(o).bind(o=>((t,o)=>{const n=e.map(e=>t.getDelta(e,o));return e=A.some(o),n})(t,o)),getStartData:()=>t,setStartData:e=>{t=A.some(e)}})}});const Eg=cd({branchKey:"mode",branches:Sg,name:"dragging",active:{events:(e,t)=>e.dragger.handlers(e,t)},extra:{snap:e=>({sensor:e.sensor,range:e.range,output:e.output,extra:A.from(e.extra)})},state:Tg,apis:Wp}),Og=["input","textarea"],Ag=e=>{const t=eo(e);return V(Og,t)},Mg=(e,t)=>{const o=t.getRoot(e).getOr(e.element);rr(o,t.invalidClass),t.notify.each(t=>{Ag(e.element)&&jo(e.element,"aria-invalid",!1),t.getContainer(e).each(e=>{tn(e,t.validHtml)}),t.onValid(e)})},Bg=(e,t,o,n)=>{const r=t.getRoot(e).getOr(e.element);or(r,t.invalidClass),t.notify.each(t=>{Ag(e.element)&&jo(e.element,"aria-invalid",!0),t.getContainer(e).each(e=>{tn(e,n)}),t.onInvalid(e,n)})},Rg=(e,t,o)=>t.validator.fold(()=>Te(Ae.value(!0)),t=>t.validate(e)),Ng=(e,t,o)=>(t.notify.each(t=>{t.onValidate(e)}),Rg(e,t).map(o=>e.getSystem().isConnected()?o.fold(o=>(Bg(e,t,0,o),Ae.error(o)),o=>(Mg(e,t),Ae.value(o))):Ae.error("No longer in system")));var Vg=Object.freeze({__proto__:null,markValid:Mg,markInvalid:Bg,query:Rg,run:Ng,isInvalid:(e,t)=>{const o=t.getRoot(e).getOr(e.element);return ir(o,t.invalidClass)}}),Dg=Object.freeze({__proto__:null,events:(e,t)=>e.validator.map(t=>zc([Zc(t.onEvent,t=>{Ng(t,e).get(_)})].concat(t.validateOnLoad?[Kc(t=>{Ng(t,e).get(v)})]:[]))).getOr({})}),Pg=[Di("invalidClass"),Ji("getRoot",A.none),Ki("notify",[Ji("aria","alert"),Ji("getContainer",A.none),Ji("validHtml",""),va("onValid"),va("onInvalid"),va("onValidate")]),Ki("validator",[Di("validate"),Ji("onEvent","input"),Ji("validateOnLoad",!0)])];const Ig=(e,t,o)=>{t.store.manager.onLoad(e,t,o)},Lg=(e,t,o)=>{t.store.manager.onUnload(e,t,o)};var Fg=Object.freeze({__proto__:null,onLoad:Ig,onUnload:Lg,setValue:(e,t,o,n)=>{t.store.manager.setValue(e,t,o,n)},getValue:(e,t,o)=>t.store.manager.getValue(e,t,o),getState:(e,t,o)=>o}),zg=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.resetOnDom?[Kc((o,n)=>{Ig(o,e,t)}),Jc((o,n)=>{Lg(o,e,t)})]:[od(e,t,Ig)];return zc(o)}});const Hg=()=>{const e=we(null);return Bc({set:e.set,get:e.get,isNotSet:()=>null===e.get(),clear:()=>{e.set(null)},readState:()=>({mode:"memory",value:e.get()})})},Ug=()=>{const e=we({}),t=we({});return Bc({readState:()=>({mode:"dataset",dataByValue:e.get(),dataByText:t.get()}),lookup:o=>fe(e.get(),o).orThunk(()=>fe(t.get(),o)),update:o=>{const n=e.get(),r=t.get(),i={},s={};F(o,e=>{i[e.value]=e,fe(e,"meta").each(t=>{fe(t,"text").each(t=>{s[t]=e})})}),e.set({...n,...i}),t.set({...r,...s})},clear:()=>{e.set({}),t.set({})}})};var Zg=Object.freeze({__proto__:null,memory:Hg,dataset:Ug,manual:()=>Bc({readState:v}),init:e=>e.store.manager.state(e)});const $g=(e,t,o,n)=>{const r=t.store;o.update([n]),r.setValue(e,n),t.onSetValue(e,n)};var jg=[$i("initialValue"),Di("getFallbackEntry"),Di("getDataKey"),Di("setValue"),_a("manager",{setValue:$g,getValue:(e,t,o)=>{const n=t.store,r=n.getDataKey(e);return o.lookup(r).getOrThunk(()=>n.getFallbackEntry(r))},onLoad:(e,t,o)=>{t.store.initialValue.each(n=>{$g(e,t,o,n)})},onUnload:(e,t,o)=>{o.clear()},state:Ug})],Wg=[Di("getValue"),Ji("setValue",v),$i("initialValue"),_a("manager",{setValue:(e,t,o,n)=>{t.store.setValue(e,n),t.onSetValue(e,n)},getValue:(e,t,o)=>t.store.getValue(e),onLoad:(e,t,o)=>{t.store.initialValue.each(o=>{t.store.setValue(e,o)})},onUnload:v,state:Mc.init})],qg=[$i("initialValue"),_a("manager",{setValue:(e,t,o,n)=>{o.set(n),t.onSetValue(e,n)},getValue:(e,t,o)=>o.get(),onLoad:(e,t,o)=>{t.store.initialValue.each(e=>{o.isNotSet()&&o.set(e)})},onUnload:(e,t,o)=>{o.clear()},state:Hg})],Gg=[Qi("store",{mode:"memory"},Mi("mode",{memory:qg,manual:Wg,dataset:jg})),va("onSetValue"),Ji("resetOnDom",!1)];const Yg=ad({fields:Gg,name:"representing",active:zg,apis:Fg,extra:{setValueFrom:(e,t)=>{const o=Yg.getValue(t);Yg.setValue(e,o)}},state:Zg}),Xg=ad({fields:Pg,name:"invalidating",active:Dg,apis:Vg,extra:{validation:e=>t=>{const o=Yg.getValue(t);return Te(e(o))}}});var Kg=Object.freeze({__proto__:null,exhibit:(e,t)=>td({classes:[],styles:t.useFixed()?{}:{position:"relative"}})});const Jg=ye([{none:[]},{relative:["x","y","width","height"]},{fixed:["x","y","width","height"]}]),Qg=(e,t,o,n,r,i)=>{const s=t.rect,a=s.x-o,l=s.y-n,c=r-(a+s.width),d=i-(l+s.height),u=A.some(a),h=A.some(l),m=A.some(c),p=A.some(d),g=A.none();return t.direction.fold(()=>op(e,u,h,g,g),()=>op(e,g,h,m,g),()=>op(e,u,g,g,p),()=>op(e,g,g,m,p),()=>op(e,u,h,g,g),()=>op(e,u,g,g,p),()=>op(e,u,h,g,g),()=>op(e,g,h,m,g))},ef=(e,t)=>e.fold(()=>{const e=t.rect;return op("absolute",A.some(e.x),A.some(e.y),A.none(),A.none())},(e,o,n,r)=>Qg("absolute",t,e,o,n,r),(e,o,n,r)=>Qg("fixed",t,e,o,n,r)),tf=(e,t)=>{const o=C(Nr,t),n=e.fold(o,o,()=>{const e=Dn();return Nr(t).translate(-e.left,-e.top)}),r=On(t),i=Cn(t);return Vr(n.left,n.top,r,i)},of=(e,t)=>t.fold(()=>e.fold(Lr,Lr,Vr),t=>e.fold(w(t),w(t),()=>{const o=nf(e,t.x,t.y);return Vr(o.left,o.top,t.width,t.height)})),nf=(e,t,o)=>{const n=Bn(t,o);return e.fold(w(n),w(n),()=>{const e=Dn();return n.translate(-e.left,-e.top)})};Jg.none;const rf=Jg.relative,sf=Jg.fixed,af=ye([{fit:["reposition"]},{nofit:["reposition","visibleW","visibleH","isVisible"]}]),lf=(e,t,o,n)=>{const r=e.bubble,i=r.offset,s=((e,t,o)=>{const n=(n,r)=>t[n].map(t=>{const i="top"===n||"bottom"===n,s=i?o.top:o.left,a=("left"===n||"top"===n?Math.max:Math.min)(t,r)+s;return i?Ve(a,e.y,e.bottom):Ve(a,e.x,e.right)}).getOr(r),r=n("left",e.x),i=n("top",e.y),s=n("right",e.right),a=n("bottom",e.bottom);return Vr(r,i,s-r,a-i)})(n,e.restriction,i),a=e.x+i.left,l=e.y+i.top,c=Vr(a,l,t,o),{originInBounds:d,sizeInBounds:u,visibleW:h,visibleH:m}=((e,t)=>{const{x:o,y:n,right:r,bottom:i}=t,{x:s,y:a,right:l,bottom:c,width:d,height:u}=e;return{originInBounds:s>=o&&s<=r&&a>=n&&a<=i,sizeInBounds:l<=r&&l>=o&&c<=i&&c>=n,visibleW:Math.min(d,s>=o?r-s:l-o),visibleH:Math.min(u,a>=n?i-a:c-n)}})(c,s),p=d&&u,g=p?c:((e,t)=>{const{x:o,y:n,right:r,bottom:i}=t,{x:s,y:a,width:l,height:c}=e,d=Math.max(o,r-l),u=Math.max(n,i-c),h=Ve(s,o,d),m=Ve(a,n,u),p=Math.min(h+l,r)-h,g=Math.min(m+c,i)-m;return Vr(h,m,p,g)})(c,s),f=g.width>0&&g.height>0,{maxWidth:v,maxHeight:b}=((e,t,o)=>{const n=w(t.bottom-o.y),r=w(o.bottom-t.y),i=((e,t,o,n)=>e.fold(t,t,n,n,t,n,o,o))(e,r,r,n),s=w(t.right-o.x),a=w(o.right-t.x),l=((e,t,o,n)=>e.fold(t,n,t,n,o,o,t,n))(e,a,a,s);return{maxWidth:l,maxHeight:i}})(e.direction,g,n),y={rect:g,maxHeight:b,maxWidth:v,direction:e.direction,placement:e.placement,classes:{on:r.classesOn,off:r.classesOff},layout:e.label,testY:l};return p||e.alwaysFit?af.fit(y):af.nofit(y,h,m,f)},cf=["top","bottom","right","left"],df="data-alloy-transition-timer",uf=(e,t,o,n,r,s)=>{const a=((e,t,o)=>o.exists(o=>{const n=e.mode;return"all"===n||o[n]!==t[n]}))(n,r,s);if(a||((e,t)=>((e,t)=>G(t,t=>ir(e,t)))(e,t.classes))(e,n)){dn(e,"position",o.position);const s=tf(t,e),l=ef(t,{...r,rect:s}),c=K(cf,e=>l[e]);((e,t)=>{const o=e=>parseFloat(e).toFixed(3);return pe(t,(t,n)=>!((e,t,o=x)=>Ue(e,t,o).getOr(e.isNone()&&t.isNone()))(e[n].map(o),t.map(o))).isSome()})(o,c)&&(hn(e,c),a&&((e,t)=>{sr(e,t.classes),Go(e,df).each(t=>{clearTimeout(parseInt(t,10)),Xo(e,df)}),((e,t)=>{const o=qe(),n=qe();let r;const s=t=>{var o;const n=null!==(o=t.raw.pseudoElement)&&void 0!==o?o:"";return wt(t.target,e)&&ot(n)&&V(cf,t.raw.propertyName)},a=i=>{if(h(i)||s(i)){o.clear(),n.clear();const s=null==i?void 0:i.raw.type;(h(s)||s===Es())&&(clearTimeout(r),Xo(e,df),ar(e,t.classes))}},l=Mo(e,Os(),t=>{s(t)&&(l.unbind(),o.set(Mo(e,Es(),a)),n.set(Mo(e,Ts(),a)))}),c=(e=>{const t=t=>{const o=mn(e,t).split(/\s*,\s*/);return H(o,tt)},o=e=>{if(i(e)&&/^[\d.]+/.test(e)){const t=parseFloat(e);return Qe(e,"ms")?t:1e3*t}return 0},n=t("transition-delay"),r=t("transition-duration");return Z(r,(e,t,r)=>{const i=o(n[r])+o(t);return Math.max(e,i)},0)})(e);requestAnimationFrame(()=>{r=setTimeout(a,c+17),jo(e,df,r)})})(e,t)})(e,n),yn(e))}else ar(e,n.classes)},hf=(e,t,o)=>void 0===e[t]?o:e[t],mf=(e,t,o,n)=>{const r=((e,t,o,n)=>{bn(t,"max-height"),bn(t,"max-width");const r=(i=t,{width:Math.ceil(An(i)),height:Cn(i)});var i;return((e,t,o,n,r,i)=>{const s=n.width,a=n.height,l=(t,l,c,d,u)=>{const h=t(o,n,r,e,i),m=lf(h,s,a,i);return m.fold(w(m),(e,t,o,n)=>(u===n?o>d||t>c:!u&&n)?m:af.nofit(l,c,d,u))};return Z(t,(e,t)=>{const o=C(l,t);return e.fold(w(e),o)},af.nofit({rect:o,maxHeight:n.height,maxWidth:n.width,direction:Sl(),placement:"southeast",classes:{on:[],off:[]},layout:"none",testY:o.y},-1,-1,!1)).fold(_,_)})(t,n.preference,e,r,o,n.bounds)})(e,t,o,n);return((e,t,o)=>{const n=ef(o.origin,t);o.transition.each(r=>{uf(e,o.origin,n,r,t,o.lastPlacement)}),np(e,n)})(t,r,n),((e,t)=>{((e,t)=>{jo(e,tc,t)})(e,t.placement)})(t,r),((e,t)=>{const o=t.classes;ar(e,o.off),sr(e,o.on)})(t,r),((e,t,o)=>{(0,o.maxHeightFunction)(e,t.maxHeight)})(t,r,n),((e,t,o)=>{(0,o.maxWidthFunction)(e,t.maxWidth)})(t,r,n),{layout:r.layout,placement:r.placement}},pf=_,gf=()=>Ki("layouts",[Di("onLtr"),Di("onRtl"),$i("onBottomLtr"),$i("onBottomRtl")]),ff=(e,t,o,n,r,i,s)=>{const a=s.map(Oc).getOr(!1),l=t.layouts.map(t=>t.onLtr(e)),c=t.layouts.map(t=>t.onRtl(e)),d=a?t.layouts.bind(t=>t.onBottomLtr.map(t=>t(e))).or(l).getOr(r):l.getOr(o),u=a?t.layouts.bind(t=>t.onBottomRtl.map(t=>t(e))).or(c).getOr(i):c.getOr(n);return Ln(d,u)(e)};var vf=[Di("hotspot"),$i("bubble"),Ji("overrides",{}),gf(),_a("placement",(e,t,o)=>{const n=t.hotspot,r=tf(o,n.element),i=ff(e.element,t,Ql(),ec(),Kl(),Jl(),A.some(t.hotspot.element));return A.some(pf({anchorBox:r,bubble:t.bubble.getOr(xl()),overrides:t.overrides,layouts:i}))})],bf=[Di("x"),Di("y"),Ji("height",0),Ji("width",0),Ji("bubble",xl()),Ji("overrides",{}),gf(),_a("placement",(e,t,o)=>{const n=nf(o,t.x,t.y),r=Vr(n.left,n.top,t.width,t.height),i=ff(e.element,t,Yl(),Xl(),Yl(),Xl(),A.none());return A.some(pf({anchorBox:r,bubble:t.bubble,overrides:t.overrides,layouts:i}))})];const yf=ye([{screen:["point"]},{absolute:["point","scrollLeft","scrollTop"]}]),wf=e=>e.fold(_,(e,t,o)=>e.translate(-t,-o)),_f=e=>e.fold(_,_),xf=e=>Z(e,(e,t)=>e.translate(t.left,t.top),Bn(0,0)),Cf=e=>{const t=L(e,_f);return xf(t)},kf=yf.screen,Sf=yf.absolute,Tf=(e,t,o)=>{const n=lo(e.element),r=Dn(n),i=((e,t,o)=>{const n=ho(o.root).dom;return A.from(n.frameElement).map(ct).filter(t=>{const o=lo(t),n=lo(e.element);return wt(o,n)}).map(Nn)})(e,0,o).getOr(r);return Sf(i,r.left,r.top)},Ef=(e,t,o,n)=>{const r=kf(Bn(e,t));return A.some(((e,t,o)=>({point:e,width:t,height:o}))(r,o,n))},Of=(e,t,o,n,r)=>e.map(e=>{const i=[t,e.point],s=(a=()=>Cf(i),l=()=>Cf(i),c=()=>(e=>{const t=L(e,wf);return xf(t)})(i),n.fold(a,l,c));var a,l,c;const d=(p=s.left,g=s.top,f=e.width,v=e.height,{x:p,y:g,width:f,height:v}),u=o.showAbove?Kl():Ql(),h=o.showAbove?Jl():ec(),m=ff(r,o,u,h,u,h,A.none());var p,g,f,v;return pf({anchorBox:d,bubble:o.bubble.getOr(xl()),overrides:o.overrides,layouts:m})});var Af=[Di("node"),Di("root"),$i("bubble"),gf(),Ji("overrides",{}),Ji("showAbove",!1),_a("placement",(e,t,o)=>{const n=Tf(e,0,t);return t.node.filter(rn).bind(r=>{const i=r.dom.getBoundingClientRect(),s=Ef(i.left,i.top,i.width,i.height),a=t.node.getOr(e.element);return Of(s,n,t,o,a)})})];const Mf=(e,t)=>({element:e,offset:t}),Bf=(e,t)=>ro(e)?Mf(e,t):((e,t)=>{const o=fo(e);if(0===o.length)return Mf(e,t);if(t<o.length)return Mf(o[t],0);{const e=o[o.length-1],t=ro(e)?(e=>In.get(e))(e).length:fo(e).length;return Mf(e,t)}})(e,t),Rf=e=>void 0!==e.foffset,Nf=(e,t)=>t.getSelection.getOrThunk(()=>()=>(e=>(e=>A.from(e.getSelection()))(e).filter(e=>e.rangeCount>0).bind(kr))(e))().map(e=>{if(Rf(e)){const t=Bf(e.start,e.soffset),o=Bf(e.finish,e.foffset);return xr.range(t.element,t.offset,o.element,o.offset)}return e});var Vf=[$i("getSelection"),Di("root"),$i("bubble"),gf(),Ji("overrides",{}),Ji("showAbove",!1),_a("placement",(e,t,o)=>{const n=ho(t.root).dom,r=Tf(e,0,t),i=Nf(n,t).bind(e=>{if(Rf(e)){const t=((e,t)=>(e=>{const t=e.getBoundingClientRect();return t.width>0||t.height>0?A.some(t).map(ht):A.none()})(gt(e,t)))(n,xr.exactFromRange(e)).orThunk(()=>{const t=lt("\ufeff");Fo(e.start,t);const o=Sr(n,xr.exact(t,0,t,1));return Jo(t),o});return t.bind(e=>Ef(e.left,e.top,e.width,e.height))}{const t=le(e,e=>e.dom.getBoundingClientRect()),o={left:Math.min(t.firstCell.left,t.lastCell.left),right:Math.max(t.firstCell.right,t.lastCell.right),top:Math.min(t.firstCell.top,t.lastCell.top),bottom:Math.max(t.firstCell.bottom,t.lastCell.bottom)};return Ef(o.left,o.top,o.right-o.left,o.bottom-o.top)}}),s=Nf(n,t).bind(e=>Rf(e)?no(e.start)?A.some(e.start):po(e.start):A.some(e.firstCell)).getOr(e.element);return Of(i,r,t,o,s)})];const Df="link-layout",Pf=e=>e.x+e.width,If=(e,t)=>e.x-t.width,Lf=(e,t)=>e.y-t.height+e.height,Ff=e=>e.y,zf=(e,t,o)=>Cl(Pf(e),Ff(e),o.southeast(),Sl(),"southeast",Nl(e,{left:0,top:2}),Df),Hf=(e,t,o)=>Cl(If(e,t),Ff(e),o.southwest(),Tl(),"southwest",Nl(e,{right:1,top:2}),Df),Uf=(e,t,o)=>Cl(Pf(e),Lf(e,t),o.northeast(),El(),"northeast",Nl(e,{left:0,bottom:3}),Df),Zf=(e,t,o)=>Cl(If(e,t),Lf(e,t),o.northwest(),Ol(),"northwest",Nl(e,{right:1,bottom:3}),Df),$f=()=>[zf,Hf,Uf,Zf],jf=()=>[Hf,zf,Zf,Uf];var Wf=[Di("item"),gf(),Ji("overrides",{}),_a("placement",(e,t,o)=>{const n=tf(o,t.item.element),r=ff(e.element,t,$f(),jf(),$f(),jf(),A.none());return A.some(pf({anchorBox:n,bubble:xl(),overrides:t.overrides,layouts:r}))})],qf=Mi("type",{selection:Vf,node:Af,hotspot:vf,submenu:Wf,makeshift:bf});const Gf=[Zi("classes",oi),os("mode","all",["all","layout","placement"])],Yf=[Ji("useFixed",E),$i("getBounds")],Xf=[Pi("anchor",qf),Ki("transition",Gf)],Kf=(e,t,o,n,r,i)=>{const s=Oi("placement.info",bi(Xf),r),a=s.anchor,l=n.element,c=o.get(n.uid);$h(()=>{dn(l,"position","fixed");const r=gn(l,"visibility");dn(l,"visibility","hidden");const d=t.useFixed()?(()=>{const e=document.documentElement;return sf(0,0,e.clientWidth,e.clientHeight)})():(e=>{const t=Nn(e.element),o=e.element.dom.getBoundingClientRect();return rf(t.left,t.top,o.width,o.height)})(e);a.placement(e,a,d).each(e=>{const r=i.orThunk(()=>t.getBounds.map(T)),a=((e,t,o,n,r,i)=>((e,t,o,n,r,i,s,a)=>{const l=hf(s,"maxHeightFunction",Cc()),c=hf(s,"maxWidthFunction",v),d=e.anchorBox,u=e.origin,h={bounds:of(u,i),origin:u,preference:n,maxHeightFunction:l,maxWidthFunction:c,lastPlacement:r,transition:a};return mf(d,t,o,h)})(((e,t)=>((e,t)=>({anchorBox:e,origin:t}))(e,t))(t.anchorBox,e),n.element,t.bubble,t.layouts,r,o,t.overrides,i))(d,e,r,n,c,s.transition);o.set(n.uid,a)}),r.fold(()=>{bn(l,"visibility")},e=>{dn(l,"visibility",e)}),gn(l,"left").isNone()&&gn(l,"top").isNone()&&gn(l,"right").isNone()&&gn(l,"bottom").isNone()&&ze(gn(l,"position"),"fixed")&&bn(l,"position")},l)};var Jf=Object.freeze({__proto__:null,position:(e,t,o,n,r)=>{const i=A.none();Kf(e,t,o,n,r,i)},positionWithinBounds:Kf,getMode:(e,t,o)=>t.useFixed()?"fixed":"absolute",reset:(e,t,o,n)=>{const r=n.element;F(["position","left","right","top","bottom"],e=>bn(r,e)),(e=>{Xo(e,tc)})(r),o.clear(n.uid)}});const Qf=ad({fields:Yf,name:"positioning",active:Kg,apis:Jf,state:Object.freeze({__proto__:null,init:()=>{let e={};return Bc({readState:()=>e,clear:t=>{m(t)?delete e[t]:e={}},set:(t,o)=>{e[t]=o},get:t=>fe(e,t)})}})});var ev=Object.freeze({__proto__:null,events:e=>zc([Zc(Ds(),(t,o)=>{const n=e.channels,r=ie(n),i=o,s=((e,t)=>t.universal?e:H(e,e=>V(t.channels,e)))(r,i);F(s,e=>{const o=n[e],r=o.schema,s=Oi("channel["+e+"] data\nReceiver: "+ra(t.element),r,i.data);o.onReceive(t,s)})})])}),tv=[Pi("channels",Si(Ae.value,vi([ya("onReceive"),Ji("schema",Qr())])))];const ov=ad({fields:tv,name:"receiving",active:ev});var nv=Object.freeze({__proto__:null,events:(e,t)=>{const o=(o,n)=>{e.updateState.each(e=>{const r=e(o,n);t.set(r)}),e.renderComponents.each(r=>{const i=r(n,t.get());(e.reuseDom?Wh:jh)(o,i)})};return zc([Zc(Ds(),(t,n)=>{const r=n;if(!r.universal){const n=e.channel;V(r.channels,n)&&o(t,r.data)}}),Kc((t,n)=>{e.initialData.each(e=>{o(t,e)})})])}}),rv=Object.freeze({__proto__:null,getState:(e,t,o)=>o}),iv=[Di("channel"),$i("renderComponents"),$i("updateState"),$i("initialData"),ns("reuseDom",!0)];const sv=ad({fields:iv,name:"reflecting",active:nv,apis:rv,state:Object.freeze({__proto__:null,init:()=>{const e=we(A.none());return{readState:()=>e.get().getOr("none"),get:e.get,set:e.set,clear:()=>e.set(A.none())}}})}),av=(e,t,o,n)=>{o.get().each(t=>{Ph(e)});const r=t.getAttachPoint(e);Rh(r,e);const i=e.getSystem().build(n);return Rh(e,i),o.set(i),i},lv=(e,t,o,n)=>{const r=av(e,t,o,n);return t.onOpen(e,r),r},cv=(e,t,o)=>{o.get().each(n=>{Ph(e),Dh(e),t.onClose(e,n),o.clear()})},dv=(e,t,o)=>o.isOpen(),uv=(e,t,o)=>{const n=t.getAttachPoint(e);dn(e.element,"position",Qf.getMode(n)),((e,t,o)=>{gn(e.element,t).fold(()=>{Xo(e.element,o)},t=>{jo(e.element,o,t)}),dn(e.element,t,"hidden")})(e,"visibility",t.cloakVisibilityAttr)},hv=(e,t,o)=>{(e=>D(["top","left","right","bottom"],t=>gn(e,t).isSome()))(e.element)||bn(e.element,"position"),((e,t,o)=>{Go(e.element,o).fold(()=>bn(e.element,t),o=>dn(e.element,t,o))})(e,"visibility",t.cloakVisibilityAttr)};var mv=Object.freeze({__proto__:null,cloak:uv,decloak:hv,open:lv,openWhileCloaked:(e,t,o,n,r)=>{uv(e,t),lv(e,t,o,n),r(),hv(e,t)},close:cv,isOpen:dv,isPartOf:(e,t,o,n)=>dv(0,0,o)&&o.get().exists(o=>t.isPartOf(e,o,n)),getState:(e,t,o)=>o.get(),setContent:(e,t,o,n)=>o.get().map(()=>av(e,t,o,n))}),pv=Object.freeze({__proto__:null,events:(e,t)=>zc([Zc(zs(),(o,n)=>{cv(o,e,t)})])}),gv=[va("onOpen"),va("onClose"),Di("isPartOf"),Di("getAttachPoint"),Ji("cloakVisibilityAttr","data-precloak-visibility")],fv=Object.freeze({__proto__:null,init:()=>{const e=Ge(),t=w("not-implemented");return Bc({readState:t,isOpen:e.isSet,clear:e.clear,set:e.set,get:e.get})}});const vv=ad({fields:gv,name:"sandboxing",active:pv,apis:mv,state:fv}),bv=(e,t)=>t.getAnimationRoot.fold(()=>e.element,t=>t(e)),yv=e=>e.dimension.property,wv=(e,t)=>e.dimension.getDimension(t),_v=(e,t)=>{const o=bv(e,t);ar(o,[t.shrinkingClass,t.growingClass])},xv=(e,t)=>{rr(e.element,t.openClass),or(e.element,t.closedClass),dn(e.element,yv(t),"0px"),yn(e.element)},Cv=(e,t)=>{rr(e.element,t.closedClass),or(e.element,t.openClass),bn(e.element,yv(t))},kv=(e,t,o,n)=>{o.setCollapsed(),dn(e.element,yv(t),wv(t,e.element)),_v(e,t),xv(e,t),t.onStartShrink(e),t.onShrunk(e)},Sv=(e,t,o,n)=>{const r=n.getOrThunk(()=>wv(t,e.element));o.setCollapsed(),dn(e.element,yv(t),r),yn(e.element);const i=bv(e,t);rr(i,t.growingClass),or(i,t.shrinkingClass),xv(e,t),t.onStartShrink(e)},Tv=(e,t,o)=>{const n=wv(t,e.element);("0px"===n?kv:Sv)(e,t,o,A.some(n))},Ev=(e,t,o)=>{const n=bv(e,t),r=ir(n,t.shrinkingClass),i=wv(t,e.element);Cv(e,t);const s=wv(t,e.element);(r?()=>{dn(e.element,yv(t),i),yn(e.element)}:()=>{xv(e,t)})(),rr(n,t.shrinkingClass),or(n,t.growingClass),Cv(e,t),dn(e.element,yv(t),s),o.setExpanded(),t.onStartGrow(e)},Ov=(e,t,o)=>{const n=bv(e,t);return!0===ir(n,t.growingClass)},Av=(e,t,o)=>{const n=bv(e,t);return!0===ir(n,t.shrinkingClass)};var Mv=Object.freeze({__proto__:null,refresh:(e,t,o)=>{if(o.isExpanded()){bn(e.element,yv(t));const o=wv(t,e.element);dn(e.element,yv(t),o)}},grow:(e,t,o)=>{o.isExpanded()||Ev(e,t,o)},shrink:(e,t,o)=>{o.isExpanded()&&Tv(e,t,o)},immediateShrink:(e,t,o)=>{o.isExpanded()&&kv(e,t,o)},hasGrown:(e,t,o)=>o.isExpanded(),hasShrunk:(e,t,o)=>o.isCollapsed(),isGrowing:Ov,isShrinking:Av,isTransitioning:(e,t,o)=>Ov(e,t)||Av(e,t),toggleGrow:(e,t,o)=>{(o.isExpanded()?Tv:Ev)(e,t,o)},disableTransitions:_v,immediateGrow:(e,t,o)=>{o.isExpanded()||(Cv(e,t),dn(e.element,yv(t),wv(t,e.element)),_v(e,t),o.setExpanded(),t.onStartGrow(e),t.onGrown(e))}}),Bv=Object.freeze({__proto__:null,exhibit:(e,t,o)=>{const n=t.expanded;return td(n?{classes:[t.openClass],styles:{}}:{classes:[t.closedClass],styles:as(t.dimension.property,"0px")})},events:(e,t)=>zc([Xc(Es(),(o,n)=>{n.event.raw.propertyName===e.dimension.property&&(_v(o,e),t.isExpanded()&&bn(o.element,e.dimension.property),(t.isExpanded()?e.onGrown:e.onShrunk)(o))})])}),Rv=[Di("closedClass"),Di("openClass"),Di("shrinkingClass"),Di("growingClass"),$i("getAnimationRoot"),va("onShrunk"),va("onStartShrink"),va("onGrown"),va("onStartGrow"),Ji("expanded",!1),Pi("dimension",Mi("property",{width:[_a("property","width"),_a("getDimension",e=>En(e)+"px")],height:[_a("property","height"),_a("getDimension",e=>xn(e)+"px")]}))];const Nv=ad({fields:Rv,name:"sliding",active:Bv,apis:Mv,state:Object.freeze({__proto__:null,init:e=>{const t=we(e.expanded);return Bc({isExpanded:()=>!0===t.get(),isCollapsed:()=>!1===t.get(),setCollapsed:C(t.set,!1),setExpanded:C(t.set,!0),readState:()=>"expanded: "+t.get()})}})});var Vv=Object.freeze({__proto__:null,events:(e,t)=>{const o=e.stream.streams.setup(e,t);return zc([Zc(e.event,o),Jc(()=>t.cancel())].concat(e.cancelEvent.map(e=>[Zc(e,()=>t.cancel())]).getOr([])))}});const Dv=e=>{const t=we(null);return Bc({readState:()=>({timer:null!==t.get()?"set":"unset"}),setTimer:e=>{t.set(e)},cancel:()=>{const e=t.get();null!==e&&e.cancel()}})};var Pv=Object.freeze({__proto__:null,throttle:Dv,init:e=>e.stream.streams.state(e)}),Iv=[Pi("stream",Mi("mode",{throttle:[Di("delay"),Ji("stopEvent",!0),_a("streams",{setup:(e,t)=>{const o=e.stream,n=nt(e.onStream,o.delay);return t.setTimer(n),(e,t)=>{n.throttle(e,t),o.stopEvent&&t.stop()}},state:Dv})]})),Ji("event","input"),$i("cancelEvent"),ya("onStream")];const Lv=ad({fields:Iv,name:"streaming",active:Vv,state:Pv});var Fv=Object.freeze({__proto__:null,exhibit:(e,t)=>td({attributes:ls([{key:t.tabAttr,value:"true"}])})}),zv=[Ji("tabAttr","data-alloy-tabstop")];const Hv=ad({fields:zv,name:"tabstopping",active:Fv}),Uv=(e,t,o,n)=>{const r=o.get();o.set(n),((e,t,o)=>{t.toggleClass.each(t=>{o.get()?or(e.element,t):rr(e.element,t)})})(e,t,o),((e,t,o)=>{const n=t.aria;n.update(e,n,o.get())})(e,t,o),r!==n&&t.onToggled(e,n)},Zv=(e,t,o)=>{Uv(e,t,o,!o.get())},$v=(e,t,o)=>{Uv(e,t,o,t.selected)};var jv=Object.freeze({__proto__:null,onLoad:$v,toggle:Zv,isOn:(e,t,o)=>o.get(),on:(e,t,o)=>{Uv(e,t,o,!0)},off:(e,t,o)=>{Uv(e,t,o,!1)},set:Uv}),Wv=Object.freeze({__proto__:null,exhibit:()=>td({}),events:(e,t)=>{const o=(n=e,r=t,i=Zv,ed(e=>{i(e,n,r)}));var n,r,i;const s=od(e,t,$v);return zc(W([e.toggleOnExecute?[o]:[],[s]]))}});const qv=(e,t,o)=>{jo(e.element,"aria-expanded",o)};var Gv=[Ji("selected",!1),$i("toggleClass"),Ji("toggleOnExecute",!0),va("onToggled"),Qi("aria",{mode:"none"},Mi("mode",{pressed:[Ji("syncWithExpanded",!1),_a("update",(e,t,o)=>{jo(e.element,"aria-pressed",o),t.syncWithExpanded&&qv(e,0,o)})],checked:[_a("update",(e,t,o)=>{jo(e.element,"aria-checked",o)})],expanded:[_a("update",qv)],selected:[_a("update",(e,t,o)=>{jo(e.element,"aria-selected",o)})],none:[_a("update",v)]}))];const Yv=ad({fields:Gv,name:"toggling",active:Wv,apis:jv,state:(Xv=!1,{init:()=>{const e=we(Xv);return{get:()=>e.get(),set:t=>e.set(t),clear:()=>e.set(Xv),readState:()=>e.get()}}})});var Xv;const Kv=Pe("tooltip.exclusive"),Jv=Pe("tooltip.show"),Qv=Pe("tooltip.hide"),eb=Pe("tooltip.immediateHide"),tb=Pe("tooltip.immediateShow"),ob=(e,t,o)=>{e.getSystem().broadcastOn([Kv],{})};var nb=Object.freeze({__proto__:null,hideAllExclusive:ob,immediateOpenClose:(e,t,o,n)=>Vc(e,n?tb:eb),isEnabled:(e,t,o)=>o.isEnabled(),setComponents:(e,t,o,n)=>{o.getTooltip().each(e=>{e.getSystem().isConnected()&&Qh.set(e,n)})},setEnabled:(e,t,o,n)=>o.setEnabled(n)}),rb=Object.freeze({__proto__:null,events:(e,t)=>{const o=o=>{t.getTooltip().each(n=>{n.getSystem().isConnected()&&(Dh(n),e.onHide(o,n),t.clearTooltip())}),t.clearTimer()},n=o=>{if(!t.isShowing()&&t.isEnabled()){ob(o);const n=e.lazySink(o).getOrDie(),r=o.getSystem().build({dom:e.tooltipDom,components:e.tooltipComponents,events:zc("normal"===e.mode?[Zc(bs(),e=>{Vc(o,Jv)}),Zc(fs(),e=>{Vc(o,Qv)})]:[]),behaviours:id([Qh.config({})])});t.setTooltip(r),Rh(n,r),e.onShow(o,r),Qf.position(n,r,{anchor:e.anchor(o)})}},r=o=>{t.getTooltip().each(t=>{const n=e.lazySink(o).getOrDie();Qf.position(n,t,{anchor:e.anchor(o)})})};return zc(W([[Qc(t=>{e.onSetup(t)}),Zc(Jv,o=>{t.resetTimer(()=>{n(o)},e.delayForShow())}),Zc(Qv,n=>{t.resetTimer(()=>{o(n)},e.delayForHide())}),Zc(tb,e=>{t.resetTimer(()=>{n(e)},0)}),Zc(eb,e=>{t.resetTimer(()=>{o(e)},0)}),Zc(Ds(),(e,t)=>{const n=t;n.universal||V(n.channels,Kv)&&o(e)}),Jc(e=>{o(e)})],(()=>{switch(e.mode){case"normal":return[Zc(ys(),e=>{Vc(e,tb)}),Zc(Ns(),e=>{Vc(e,eb)}),Zc(bs(),e=>{Vc(e,Jv)}),Zc(fs(),e=>{Vc(e,Qv)})];case"follow-highlight":return[Zc(oa(),(e,t)=>{Vc(e,Jv)}),Zc(na(),e=>{Vc(e,Qv)})];case"children-normal":return[Zc(ys(),(o,n)=>{Lo(o.element).each(i=>{vt(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Vc(o,tb)},n=>{t.isShowing()&&(e.onShow(o,n),r(o))})})}),Zc(Ns(),e=>{Lo(e.element).fold(()=>{Vc(e,eb)},v)}),Zc(bs(),o=>{Gn(o.element,"[data-mce-tooltip]:hover").each(n=>{t.getTooltip().fold(()=>{Vc(o,Jv)},n=>{t.isShowing()&&(e.onShow(o,n),r(o))})})}),Zc(fs(),e=>{Gn(e.element,"[data-mce-tooltip]:hover").fold(()=>{Vc(e,Qv)},v)})];default:return[Zc(ys(),(o,n)=>{Lo(o.element).each(i=>{vt(n.event.target,"[data-mce-tooltip]")&&t.getTooltip().fold(()=>{Vc(o,tb)},n=>{t.isShowing()&&(e.onShow(o,n),r(o))})})}),Zc(Ns(),e=>{Lo(e.element).fold(()=>{Vc(e,eb)},v)})]}})()]))}}),ib=[Di("lazySink"),Di("tooltipDom"),Ji("exclusive",!0),Ji("tooltipComponents",[]),rs("delayForShow",w(300)),rs("delayForHide",w(100)),rs("onSetup",v),os("mode","normal",["normal","follow-highlight","children-keyboard-focus","children-normal"]),Ji("anchor",e=>({type:"hotspot",hotspot:e,layouts:{onLtr:w([Wl,jl,Hl,Zl,Ul,$l]),onRtl:w([Wl,jl,Hl,Zl,Ul,$l])},bubble:_l(0,-2,{})})),va("onHide"),va("onShow")],sb=Object.freeze({__proto__:null,init:()=>{const e=we(!0),t=Ge(),o=Ge(),n=()=>{t.on(clearTimeout)},r=w("not-implemented");return Bc({getTooltip:o.get,isShowing:o.isSet,setTooltip:o.set,clearTooltip:o.clear,clearTimer:n,resetTimer:(e,o)=>{n(),t.set(setTimeout(e,o))},readState:r,isEnabled:()=>e.get(),setEnabled:t=>e.set(t)})}});const ab=ad({fields:ib,name:"tooltipping",active:rb,state:sb,apis:nb}),lb=ad({fields:[],name:"unselecting",active:Object.freeze({__proto__:null,events:()=>zc([Hc(As(),O)]),exhibit:()=>td({styles:{"-webkit-user-select":"none","user-select":"none","-ms-user-select":"none","-moz-user-select":"-moz-none"},attributes:{unselectable:"on"}})})}),cb=e=>{const t=st(e),o=fo(t),n=(e=>{const t=void 0!==e.dom.attributes?e.dom.attributes:[];return Z(t,(e,t)=>"class"===t.name?e:{...e,[t.name]:t.value},{})})(t),r=(e=>Array.prototype.slice.call(e.dom.classList,0))(t),i=0===o.length?{}:{innerHtml:en(t)};return{tag:eo(t),classes:r,attributes:n,...i}},db=e=>{const t=(e=>void 0!==e.uid)(e)&&be(e,"uid")?e.uid:lm("memento");return{get:e=>e.getSystem().getByUid(t).getOrDie(),getOpt:e=>e.getSystem().getByUid(t).toOptional(),asSpec:()=>({...e,uid:t})}},ub=yl,hb=ol,mb=w("dismiss.popups"),pb=w("reposition.popups"),gb=w("mouse.released"),fb=(e,t)=>{const o={stopBackspace:!0,...t},n=(e=>{const t=Ge(),o=we(!1),n=Ta(t=>{e.triggerEvent(Fs(),t),o.set(!0)},400),r=ls([{key:ds(),value:e=>(Ea(e).each(r=>{n.cancel();const i={x:r.clientX,y:r.clientY,target:e.target};n.schedule(e),o.set(!1),t.set(i)}),A.none())},{key:us(),value:e=>(n.cancel(),Ea(e).each(e=>{t.on(o=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(e,o)&&t.clear()})}),A.none())},{key:hs(),value:r=>(n.cancel(),t.get().filter(e=>wt(e.target,r.target)).map(t=>o.get()?(r.prevent(),!1):e.triggerEvent(Ls(),r)))}]);return{fireIfReady:(e,t)=>fe(r,t).bind(t=>t(e))}})(o),r=L(["touchstart","touchmove","touchend","touchcancel","gesturestart","mousedown","mouseup","mouseover","mousemove","mouseout","click"].concat(["selectstart","input","contextmenu","change","transitionend","transitioncancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","keyup"]),t=>Mo(e,t,e=>{n.fireIfReady(e,t).each(t=>{t&&e.kill()}),o.triggerEvent(t,e)&&e.kill()})),i=Ge(),s=Mo(e,"paste",e=>{n.fireIfReady(e,"paste").each(t=>{t&&e.kill()}),o.triggerEvent("paste",e)&&e.kill(),i.set(setTimeout(()=>{o.triggerEvent(Vs(),e)},0))}),a=Mo(e,"keydown",e=>{o.triggerEvent("keydown",e)?e.kill():o.stopBackspace&&(e=>e.raw.which===vd[0]&&!V(["input","textarea"],eo(e.target))&&!pr(e.target,'[contenteditable="true"]'))(e)&&e.prevent()}),l=Mo(e,"focusin",e=>{o.triggerEvent("focusin",e)&&e.kill()}),c=Ge(),d=Mo(e,"focusout",e=>{o.triggerEvent("focusout",e)&&e.kill(),c.set(setTimeout(()=>{o.triggerEvent(Ns(),e)},0))});return{unbind:()=>{F(r,e=>{e.unbind()}),a.unbind(),l.unbind(),d.unbind(),s.unbind(),i.on(clearTimeout),c.on(clearTimeout)}}},vb=(e,t)=>{const o=fe(e,"target").getOr(t);return we(o)},bb=ye([{stopped:[]},{resume:["element"]},{complete:[]}]),yb=(e,t,o,n,r,i)=>{const s=e(t,n),a=((e,t)=>{const o=we(!1),n=we(!1);return{stop:()=>{o.set(!0)},cut:()=>{n.set(!0)},isStopped:o.get,isCut:n.get,event:e,setSource:t.set,getSource:t.get}})(o,r);return s.fold(()=>(i.logEventNoHandlers(t,n),bb.complete()),e=>{const o=e.descHandler;return mm(o)(a),a.isStopped()?(i.logEventStopped(t,e.element,o.purpose),bb.stopped()):a.isCut()?(i.logEventCut(t,e.element,o.purpose),bb.complete()):mo(e.element).fold(()=>(i.logNoParent(t,e.element,o.purpose),bb.complete()),n=>(i.logEventResponse(t,e.element,o.purpose),bb.resume(n)))})},wb=(e,t,o,n,r,i)=>yb(e,t,o,n,r,i).fold(O,n=>wb(e,t,o,n,r,i),E),_b=(e,t,o,n,r)=>{const i=vb(o,n);return wb(e,t,o,n,i,r)},xb=()=>{const e=(()=>{const e={};return{registerId:(t,o,n)=>{ae(n,(n,r)=>{const i=void 0!==e[r]?e[r]:{};i[o]=((e,t)=>({cHandler:C.apply(void 0,[e.handler].concat(t)),purpose:e.purpose}))(n,t),e[r]=i})},unregisterId:t=>{ae(e,(e,o)=>{ve(e,t)&&delete e[t]})},filterByType:t=>fe(e,t).map(e=>me(e,(e,t)=>((e,t)=>({id:e,descHandler:t}))(t,e))).getOr([]),find:(t,o,n)=>fe(e,o).bind(e=>vr(n,t=>((e,t)=>am(t).bind(t=>fe(e,t)).map(e=>((e,t)=>({element:e,descHandler:t}))(t,e)))(e,t),t))}})(),t={},o=o=>{am(o.element).each(o=>{delete t[o],e.unregisterId(o)})};return{find:(t,o,n)=>e.find(t,o,n),filter:t=>e.filterByType(t),register:n=>{const r=(e=>{const t=e.element;return am(t).getOrThunk(()=>((e,t)=>{const o=Pe(rm+"uid-");return sm(t,o),o})(0,e.element))})(n);be(t,r)&&((e,n)=>{const r=t[n];if(r!==e)throw new Error('The tagId "'+n+'" is already used by: '+ra(r.element)+"\nCannot use it for: "+ra(e.element)+"\nThe conflicting element is"+(rn(r.element)?" ":" not ")+"already in the DOM");o(e)})(n,r);const i=[n];e.registerId(i,r,n.events),t[r]=n},unregister:o,getById:e=>fe(t,e)}},Cb=e=>{const t=t=>mo(e.element).fold(O,e=>wt(t,e)),o=xb(),n=(e,n)=>o.find(t,e,n),r=fb(e.element,{triggerEvent:(e,t)=>la(e,t.target,o=>((e,t,o,n)=>_b(e,t,o,o.target,n))(n,e,t,o))}),i={debugInfo:w("real"),triggerEvent:(e,t,o)=>{la(e,t,r=>_b(n,e,o,t,r))},triggerFocus:(e,t)=>{am(e).fold(()=>{Vo(e)},o=>{la(Rs(),e,o=>(((e,t,o,n,r)=>{const i=vb(o,n);yb(e,t,o,n,i,r)})(n,Rs(),{originator:t,kill:v,prevent:v,target:e},e,o),!1))})},triggerEscape:(e,t)=>{i.triggerEvent("keydown",e.element,t.event)},getByUid:e=>p(e),getByDom:e=>g(e),build:Am,buildOrPatch:Om,addToGui:e=>{l(e)},removeFromGui:e=>{c(e)},addToWorld:e=>{s(e)},removeFromWorld:e=>{a(e)},broadcast:e=>{u(e)},broadcastOn:(e,t)=>{h(e,t)},broadcastEvent:(e,t)=>{m(e,t)},isConnected:O},s=e=>{e.connect(i),ro(e.element)||(o.register(e),F(e.components(),s),i.triggerEvent(Us(),e.element,{target:e.element}))},a=e=>{ro(e.element)||(F(e.components(),a),o.unregister(e)),e.disconnect()},l=t=>{Rh(e,t)},c=e=>{Dh(e)},d=e=>{const t=o.filter(Ds());F(t,t=>{const o=t.descHandler;mm(o)(e)})},u=e=>{d({universal:!0,data:e})},h=(e,t)=>{d({universal:!1,channels:e,data:t})},m=(e,t)=>((e,t)=>{const o=(e=>{const t=we(!1);return{stop:()=>{t.set(!0)},cut:v,isStopped:t.get,isCut:E,event:e,setSource:S("Cannot set source of a broadcasted event"),getSource:S("Cannot get source of a broadcasted event")}})(t);return F(e,e=>{const t=e.descHandler;mm(t)(o)}),o.isStopped()})(o.filter(e),t),p=e=>o.getById(e).fold(()=>Ae.error(new Error('Could not find component with uid: "'+e+'" in system.')),Ae.value),g=e=>{const t=am(e).getOr("not found");return p(t)};return s(e),{root:e,element:e.element,destroy:()=>{r.unbind(),Jo(e.element)},add:l,remove:c,getByUid:p,getByDom:g,addToWorld:s,removeFromWorld:a,broadcast:u,broadcastOn:h,broadcastEvent:m}},kb=()=>{const e=(e,t)=>{t.stop(),Pc(e)};return[Zc(Ss(),e),Zc(Ls(),e),Gc(ds()),Gc(ps())]},Sb=e=>zc(W([e.map(e=>ed((t,o)=>{e(t),o.stop()})).toArray(),kb()])),Tb=ng({name:"Button",factory:e=>{const t=Sb(e.action),o=e.dom.tag,n=t=>fe(e.dom,"attributes").bind(e=>fe(e,t));return{uid:e.uid,dom:e.dom,components:e.components,events:t,behaviours:Kp(e.buttonBehaviours,[fd.config({}),_h.config({mode:"execution",useSpace:!0,useEnter:!0})]),domModification:{attributes:"button"===o?{type:n("type").getOr("button"),...n("role").map(e=>({role:e})).getOr({})}:{role:e.role.getOr(n("role").getOr("button"))}},eventOrder:e.eventOrder}},configFields:[Ji("uid",void 0),Di("dom"),Ji("components",[]),Xp("buttonBehaviours",[fd,_h]),$i("action"),$i("role"),Ji("eventOrder",{})]}),Eb=w([Ji("shell",!1),Di("makeItem"),Ji("setupItem",v),Xp("listBehaviours",[Qh])]),Ob=Qa({name:"items",overrides:()=>({behaviours:id([Qh.config({})])})}),Ab=w([Ob]),Mb=rg({name:w("CustomList")(),configFields:Eb(),partFields:Ab(),factory:(e,t,o,n)=>{const r=e.shell?{behaviours:[Qh.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:r.components,behaviours:Yp(e.listBehaviours,r.behaviours),apis:{setItems:(t,o)=>{var n;(n=t,e.shell?A.some(n):ul(n,e,"items")).fold(()=>{throw console.error("Custom List was defined to not be a shell, but no item container was specified in components"),new Error("Custom List was defined to not be a shell, but no item container was specified in components")},n=>{const r=Qh.contents(n),i=o.length,s=i-r.length,a=s>0?P(s,()=>e.makeItem()):[],l=r.slice(i);F(l,e=>Qh.remove(n,e)),F(a,e=>Qh.append(n,e));const c=Qh.contents(n);F(c,(n,r)=>{e.setupItem(t,n,o[r],r)})})}}}},apis:{setItems:(e,t,o)=>{e.setItems(t,o)}}}),Bb="aria-controls",Rb=()=>{const e=Pe(Bb);return{id:e,link:t=>{jo(t,Bb,e)},unlink:e=>{Xo(e,Bb)}}},Nb=(e,t)=>mr(t,t=>wt(t,e.element),E)||((e,t)=>(e=>Zn(e,e=>{if(!no(e))return!1;const t=qo(e,"id");return void 0!==t&&t.indexOf(Bb)>-1}).bind(e=>{const t=qo(e,"id"),o=xo(e);return Gn(o,`[${Bb}="${t}"]`)}))(t).exists(t=>Nb(e,t)))(e,t),Vb="alloy.item-hover",Db="alloy.item-focus",Pb="alloy.item-toggled",Ib=e=>{(Lo(e.element).isNone()||fd.isFocused(e))&&(fd.isFocused(e)||fd.focus(e),Dc(e,Vb,{item:e}))},Lb=e=>{Dc(e,Db,{item:e})},Fb=w(Vb),zb=w(Db),Hb=w(Pb),Ub=e=>e.role.fold(()=>e.toggling.map(e=>e.exclusive?"menuitemradio":"menuitemcheckbox").getOr("menuitem"),_);var Zb=[Di("data"),Di("components"),Di("dom"),Ji("hasSubmenu",!1),$i("toggling"),$i("role"),Xp("itemBehaviours",[Yv,fd,_h,Yg]),Ji("ignoreFocus",!1),Ji("domModification",{}),_a("builder",e=>({dom:e.dom,domModification:{...e.domModification,attributes:{role:Ub(e),...e.domModification.attributes,"aria-haspopup":e.hasSubmenu,...e.hasSubmenu?{"aria-expanded":!1}:{}}},behaviours:Kp(e.itemBehaviours,[e.toggling.fold(Yv.revoke,t=>Yv.config(((e,t)=>({aria:{mode:t?"selected":"checked"},...he(e,(e,t)=>"exclusive"!==t),onToggled:(t,o)=>{p(e.onToggled)&&e.onToggled(t,o),((e,t)=>{Dc(e,Pb,{item:e,state:t})})(t,o)}}))(t,e.role.exists(e=>"option"===e)))),fd.config({ignore:e.ignoreFocus,stopMousedown:e.ignoreFocus,onFocus:e=>{Lb(e)}}),_h.config({mode:"execution"}),Yg.config({store:{mode:"memory",initialValue:e.data}}),ud("item-type-events",[...kb(),Zc(bs(),Ib),Zc(Is(),fd.focus)])]),components:e.components,eventOrder:e.eventOrder})),Ji("eventOrder",{})],$b=[Di("dom"),Di("components"),_a("builder",e=>({dom:e.dom,components:e.components,events:zc([Yc(Is())])}))];const jb=w("item-widget"),Wb=w([Ka({name:"widget",overrides:e=>({behaviours:id([Yg.config({store:{mode:"manual",getValue:t=>e.data,setValue:v}})])})})]),qb=[Di("uid"),Di("data"),Di("components"),Di("dom"),Ji("autofocus",!1),Ji("ignoreFocus",!1),Xp("widgetBehaviours",[Yg,fd,_h]),Ji("domModification",{}),bl(Wb()),_a("builder",e=>{const t=cl(jb(),e,Wb()),o=dl(jb(),e,t.internals()),n=t=>ul(t,e,"widget").map(e=>(_h.focusIn(e),e)),r=(t,o)=>Qd(o.event.target)?A.none():e.autofocus?(o.setSource(t.element),A.none()):A.none();return{dom:e.dom,components:o,domModification:e.domModification,events:zc([ed((e,t)=>{n(e).each(e=>{t.stop()})}),Zc(bs(),Ib),Zc(Is(),(t,o)=>{e.autofocus?n(t):fd.focus(t)})]),behaviours:Kp(e.widgetBehaviours,[Yg.config({store:{mode:"memory",initialValue:e.data}}),fd.config({ignore:e.ignoreFocus,onFocus:e=>{Lb(e)}}),_h.config({mode:"special",focusIn:e.autofocus?e=>{n(e)}:dd(),onLeft:r,onRight:r,onEscape:(t,o)=>fd.isFocused(t)||e.autofocus?e.autofocus?(o.setSource(t.element),A.none()):A.none():(fd.focus(t),A.some(!0))})])}})],Gb=Mi("type",{widget:qb,item:Zb,separator:$b}),Yb=w([el({factory:{sketch:e=>{const t=Oi("menu.spec item",Gb,e);return t.builder(t)}},name:"items",unit:"item",defaults:(e,t)=>ve(t,"uid")?t:{...t,uid:lm("item")},overrides:(e,t)=>({type:t.type,ignoreFocus:e.fakeFocus,domModification:{classes:[e.markers.item]}})})]),Xb=w([qi("role"),Di("value"),Di("items"),Di("dom"),Di("components"),Ji("eventOrder",{}),qp("menuBehaviours",[jd,Yg,Im,_h]),Qi("movement",{mode:"menu",moveOnTab:!0},Mi("mode",{grid:[Ca(),_a("config",(e,t)=>({mode:"flatgrid",selector:"."+e.markers.item,initSize:{numColumns:t.initSize.numColumns,numRows:t.initSize.numRows},focusManager:e.focusManager}))],matrix:[_a("config",(e,t)=>({mode:"matrix",selectors:{row:t.rowSelector,cell:"."+e.markers.item},previousSelector:t.previousSelector,focusManager:e.focusManager})),Di("rowSelector"),Ji("previousSelector",A.none)],menu:[Ji("moveOnTab",!0),_a("config",(e,t)=>({mode:"menu",selector:"."+e.markers.item,moveOnTab:t.moveOnTab,focusManager:e.focusManager}))]})),Pi("markers",ha()),Ji("fakeFocus",!1),Ji("focusManager",qd()),va("onHighlight"),va("onDehighlight"),Ji("showMenuRole",!0)]),Kb=w("alloy.menu-focus"),Jb=rg({name:"Menu",configFields:Xb(),partFields:Yb(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Yp(e.menuBehaviours,[jd.config({highlightClass:e.markers.selectedItem,itemClass:e.markers.item,onHighlight:e.onHighlight,onDehighlight:e.onDehighlight}),Yg.config({store:{mode:"memory",initialValue:e.value}}),Im.config({find:A.some}),_h.config(e.movement.config(e,e.movement))]),events:zc([Zc(zb(),(e,t)=>{const o=t.event;e.getSystem().getByDom(o.target).each(o=>{jd.highlight(e,o),t.stop(),Dc(e,Kb(),{menu:e,item:o})})}),Zc(Fb(),(e,t)=>{const o=t.event.item;jd.highlight(e,o)}),Zc(Hb(),(e,t)=>{const{item:o,state:n}=t.event;n&&"menuitemradio"===qo(o.element,"role")&&((e,t)=>{const o=hr(e.element,'[role="menuitemradio"][aria-checked="true"]');F(o,o=>{wt(o,t.element)||e.getSystem().getByDom(o).each(e=>{Yv.off(e)})})})(e,o)})]),components:t,eventOrder:e.eventOrder,...e.showMenuRole?{domModification:{attributes:{role:e.role.getOr("menu")}}}:{}})}),Qb=(e,t,o,n)=>fe(o,n).bind(n=>fe(e,n).bind(n=>{const r=Qb(e,t,o,n);return A.some([n].concat(r))})).getOr([]),ey=e=>"prepared"===e.type?A.some(e.menu):A.none(),ty=()=>{const e=we({}),t=we({}),o=we({}),n=Ge(),r=we({}),i=e=>s(e).bind(ey),s=e=>fe(t.get(),e),a=t=>fe(e.get(),t);return{setMenuBuilt:(e,o)=>{t.set({...t.get(),[e]:{type:"prepared",menu:o}})},setContents:(i,s,a,l)=>{n.set(i),e.set(a),t.set(s),r.set(l);const c=((e,t)=>{const o={};ae(e,(e,t)=>{F(e,e=>{o[e]=t})});const n=t,r=ce(t,(e,t)=>({k:e,v:t})),i=le(r,(e,t)=>[t].concat(Qb(o,n,r,t)));return le(o,e=>fe(i,e).getOr([e]))})(l,a);o.set(c)},expand:t=>fe(e.get(),t).map(e=>{const n=fe(o.get(),t).getOr([]);return[e].concat(n)}),refresh:e=>fe(o.get(),e),collapse:e=>fe(o.get(),e).bind(e=>e.length>1?A.some(e.slice(1)):A.none()),lookupMenu:s,lookupItem:a,otherMenus:e=>{const t=r.get();return X(ie(t),e)},getPrimary:()=>n.get().bind(i),getMenus:()=>t.get(),clear:()=>{e.set({}),t.set({}),o.set({}),n.clear()},isClear:()=>n.get().isNone(),getTriggeringPath:(t,r)=>{const s=H(a(t).toArray(),e=>i(e).isSome());return fe(o.get(),t).bind(t=>{const o=Y(s.concat(t));return(e=>{const t=[];for(let o=0;o<e.length;o++){const n=e[o];if(!n.isSome())return A.none();t.push(n.getOrDie())}return A.some(t)})(q(o,(t,s)=>((t,o,n)=>i(t).bind(r=>(t=>pe(e.get(),(e,o)=>e===t))(t).bind(e=>o(e).map(e=>({triggeredMenu:r,triggeringItem:e,triggeringPath:n})))))(t,r,o.slice(0,s+1)).fold(()=>ze(n.get(),t)?[]:[A.none()],e=>[A.some(e)])))})}}},oy=ey,ny=Pe("tiered-menu-item-highlight"),ry=Pe("tiered-menu-item-dehighlight"),iy=w("collapse-item"),sy=ng({name:"TieredMenu",configFields:[wa("onExecute"),wa("onEscape"),ya("onOpenMenu"),ya("onOpenSubmenu"),va("onRepositionMenu"),va("onCollapseMenu"),Ji("highlightOnOpen",Ac.HighlightMenuAndItem),Hi("data",[Di("primary"),Di("menus"),Di("expansions")]),Ji("fakeFocus",!1),va("onHighlightItem"),va("onDehighlightItem"),va("onHover"),pa(),Di("dom"),Ji("navigateOnHover",!0),Ji("stayInDom",!1),qp("tmenuBehaviours",[_h,jd,Im,Qh]),Ji("eventOrder",{})],apis:{collapseMenu:(e,t)=>{e.collapseMenu(t)},highlightPrimary:(e,t)=>{e.highlightPrimary(t)},repositionMenus:(e,t)=>{e.repositionMenus(t)}},factory:(e,t)=>{const o=Ge(),n=ty(),r=e=>Yg.getValue(e).value,i=t=>le(e.data.menus,(e,t)=>q(e.items,e=>"separator"===e.type?[]:[e.data.value])),s=jd.highlight,a=(t,o)=>{s(t,o),jd.getHighlighted(o).orThunk(()=>jd.getFirst(o)).each(n=>{e.fakeFocus?jd.highlight(o,n):Ic(t,n.element,Is())})},l=(e,t)=>He(L(t,t=>e.lookupMenu(t).bind(e=>"prepared"===e.type?A.some(e.menu):A.none()))),c=(t,o,n)=>{const r=l(o,o.otherMenus(n));F(r,o=>{ar(o.element,[e.markers.backgroundMenu]),e.stayInDom||Qh.remove(t,o)})},d=(t,n)=>{const i=(t=>o.get().getOrThunk(()=>{const n={},i=hr(t.element,`.${e.markers.item}`),s=H(i,e=>"true"===qo(e,"aria-haspopup"));return F(s,e=>{t.getSystem().getByDom(e).each(e=>{const t=r(e);n[t]=e})}),o.set(n),n}))(t);ae(i,(e,t)=>{const o=V(n,t);jo(e.element,"aria-expanded",o)})},u=(t,o,n)=>A.from(n[0]).bind(r=>o.lookupMenu(r).bind(r=>{if("notbuilt"===r.type)return A.none();{const i=r.menu,s=l(o,n.slice(1));return F(s,t=>{or(t.element,e.markers.backgroundMenu)}),rn(i.element)||Qh.append(t,Mm(i)),ar(i.element,[e.markers.backgroundMenu]),a(t,i),c(t,o,n),A.some(i)}}));let h;!function(e){e[e.HighlightSubmenu=0]="HighlightSubmenu",e[e.HighlightParent=1]="HighlightParent"}(h||(h={}));const m=(t,o,i=h.HighlightSubmenu)=>{if(o.hasConfigured(tp)&&tp.isDisabled(o))return A.some(o);{const s=r(o);return n.expand(s).bind(r=>(d(t,r),A.from(r[0]).bind(s=>n.lookupMenu(s).bind(a=>{const l=((e,t,o)=>{if("notbuilt"===o.type){const r=e.getSystem().build(o.nbMenu());return n.setMenuBuilt(t,r),r}return o.menu})(t,s,a);return rn(l.element)||Qh.append(t,Mm(l)),e.onOpenSubmenu(t,o,l,Y(r)),i===h.HighlightSubmenu?(jd.highlightFirst(l),u(t,n,r)):(jd.dehighlightAll(l),A.some(o))}))))}},p=(t,o)=>{const i=r(o);return n.collapse(i).bind(r=>(d(t,r),u(t,n,r).map(n=>(e.onCollapseMenu(t,o,n),n))))},g=t=>(o,n)=>Yn(n.getSource(),`.${e.markers.item}`).bind(e=>o.getSystem().getByDom(e).toOptional().bind(e=>t(o,e).map(O))),f=zc([Zc(Kb(),(e,t)=>{const o=t.event.item;n.lookupItem(r(o)).each(()=>{const o=t.event.menu;jd.highlight(e,o);const i=r(t.event.item);n.refresh(i).each(t=>c(e,n,t))})}),ed((t,o)=>{const n=o.event.target;t.getSystem().getByDom(n).each(o=>{0===r(o).indexOf("collapse-item")&&p(t,o),m(t,o,h.HighlightSubmenu).fold(()=>{e.onExecute(t,o)},v)})}),Kc((t,o)=>{(t=>{const o=((t,o,n)=>le(n,(n,r)=>{const i=()=>Jb.sketch({...n,value:r,markers:e.markers,fakeFocus:e.fakeFocus,onHighlight:(e,t)=>{Dc(e,ny,{menuComp:e,itemComp:t})},onDehighlight:(e,t)=>{Dc(e,ry,{menuComp:e,itemComp:t})},focusManager:e.fakeFocus?Gd():qd()});return r===o?{type:"prepared",menu:t.getSystem().build(i())}:{type:"notbuilt",nbMenu:i}}))(t,e.data.primary,e.data.menus),r=i();return n.setContents(e.data.primary,o,e.data.expansions,r),n.getPrimary()})(t).each(o=>{Qh.append(t,Mm(o)),e.onOpenMenu(t,o),e.highlightOnOpen===Ac.HighlightMenuAndItem?a(t,o):e.highlightOnOpen===Ac.HighlightJustMenu&&s(t,o)})}),Zc(ny,(t,o)=>{e.onHighlightItem(t,o.event.menuComp,o.event.itemComp)}),Zc(ry,(t,o)=>{e.onDehighlightItem(t,o.event.menuComp,o.event.itemComp)}),...e.navigateOnHover?[Zc(Fb(),(t,o)=>{const i=o.event.item;((e,t)=>{const o=r(t);n.refresh(o).bind(t=>(d(e,t),u(e,n,t)))})(t,i),m(t,i,h.HighlightParent),e.onHover(t,i)})]:[]]),b=e=>jd.getHighlighted(e).bind(jd.getHighlighted),y={collapseMenu:e=>{b(e).each(t=>{p(e,t)})},highlightPrimary:e=>{n.getPrimary().each(t=>{a(e,t)})},repositionMenus:t=>{const o=n.getPrimary().bind(e=>b(t).bind(e=>{const t=r(e),o=ge(n.getMenus()),i=He(L(o,oy));return n.getTriggeringPath(t,e=>((e,t,o)=>re(t,e=>{if(!e.getSystem().isConnected())return A.none();const t=jd.getCandidates(e);return $(t,e=>r(e)===o)}))(0,i,e))}).map(t=>({primary:e,triggeringPath:t})));o.fold(()=>{(e=>A.from(e.components()[0]).filter(e=>"menu"===qo(e.element,"role")))(t).each(o=>{e.onRepositionMenu(t,o,[])})},({primary:o,triggeringPath:n})=>{e.onRepositionMenu(t,o,n)})}};return{uid:e.uid,dom:e.dom,markers:e.markers,behaviours:Yp(e.tmenuBehaviours,[_h.config({mode:"special",onRight:g((e,t)=>Qd(t.element)?A.none():m(e,t,h.HighlightSubmenu)),onLeft:g((e,t)=>Qd(t.element)?A.none():p(e,t)),onEscape:g((t,o)=>p(t,o).orThunk(()=>e.onEscape(t,o).map(()=>t))),focusIn:(e,t)=>{n.getPrimary().each(t=>{Ic(e,t.element,Is())})}}),jd.config({highlightClass:e.markers.selectedMenu,itemClass:e.markers.menu}),Im.config({find:e=>jd.getHighlighted(e)}),Qh.config({})]),eventOrder:e.eventOrder,apis:y,events:f}},extraApis:{tieredData:(e,t,o)=>({primary:e,menus:t,expansions:o}),singleData:(e,t)=>({primary:e,menus:as(e,t),expansions:{}}),collapseItem:e=>({value:Pe(iy()),meta:{text:e}})}}),ay=w("sink"),ly=w(Qa({name:ay(),overrides:w({dom:{tag:"div"},behaviours:id([Qf.config({useFixed:O})]),events:zc([Gc(_s()),Gc(ps()),Gc(Ss())])})})),cy=vi([Ji("isExtraPart",E),Ki("fireEventInstead",[Ji("event",Ys())])]),dy=e=>{const t=Oi("Dismissal",cy,e);return{[mb()]:{schema:vi([Di("target")]),onReceive:(e,o)=>{vv.isOpen(e)&&(vv.isPartOf(e,o.target)||t.isExtraPart(e,o.target)||t.fireEventInstead.fold(()=>vv.close(e),t=>Vc(e,t.event)))}}}},uy=vi([Ki("fireEventInstead",[Ji("event",Xs())]),zi("doReposition")]),hy=e=>{const t=Oi("Reposition",uy,e);return{[pb()]:{onReceive:e=>{vv.isOpen(e)&&t.fireEventInstead.fold(()=>t.doReposition(e),t=>Vc(e,t.event))}}}},my=(e,t)=>{const o=e.getHotspot(t).getOr(t),n="hotspot",r=e.getAnchorOverrides();return e.layouts.fold(()=>({type:n,hotspot:o,overrides:r}),e=>({type:n,hotspot:o,overrides:r,layouts:e}))},py=(e,t,o,n,r,i,s)=>{const a=((e,t,o,n,r,i,s)=>{const a=((e,t,o)=>(0,e.fetch)(o).map(t))(e,t,n),l=vy(n,e);return a.map(t=>t.bind(t=>{const a=t.menus[t.primary];return A.from(a).each(t=>{e.listRole.each(e=>{t.role=e})}),A.from(sy.sketch({...i.menu(),uid:lm(""),data:t,highlightOnOpen:s,onOpenMenu:(e,t)=>{const n=l().getOrDie();Qf.position(n,t,{anchor:o}),vv.decloak(r)},onOpenSubmenu:(e,t,o)=>{const n=l().getOrDie();Qf.position(n,o,{anchor:{type:"submenu",item:t}}),vv.decloak(r)},onRepositionMenu:(e,t,n)=>{const r=l().getOrDie();Qf.position(r,t,{anchor:o}),F(n,e=>{Qf.position(r,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem}})})},onEscape:()=>(fd.focus(n),vv.close(r),A.some(!0))}))}))})(e,t,my(e,o),o,n,r,s);return a.map(e=>(e.fold(()=>{vv.isOpen(n)&&vv.close(n)},e=>{vv.cloak(n),vv.open(n,e),i(n)}),n))},gy=(e,t,o,n,r,i,s)=>(vv.close(n),Te(n)),fy=(e,t,o,n,r,i)=>{const s=Hm.getCoupled(o,"sandbox");return(vv.isOpen(s)?gy:py)(e,t,o,s,n,r,i)},vy=(e,t)=>e.getSystem().getByUid(t.uid+"-"+ay()).map(e=>()=>Ae.value(e)).getOrThunk(()=>t.lazySink.fold(()=>()=>Ae.error(new Error("No internal sink is specified, nor could an external sink be found")),t=>()=>t(e))),by=e=>{vv.getState(e).each(e=>{sy.repositionMenus(e)})},yy=(e,t,o)=>{const n=Rb(),r=vy(t,e);return{dom:{tag:"div",classes:e.sandboxClasses,attributes:{id:n.id}},behaviours:Kp(e.sandboxBehaviours,[Yg.config({store:{mode:"memory",initialValue:t}}),vv.config({onOpen:(r,i)=>{const s=my(e,t);n.link(t.element),e.matchWidth&&((e,t,o)=>{const n=Im.getCurrent(t).getOr(t),r=En(e.element);o?dn(n.element,"min-width",r+"px"):((e,t)=>{Sn.set(e,t)})(n.element,r)})(s.hotspot,i,e.useMinWidth),e.onOpen(s,r,i),void 0!==o&&void 0!==o.onOpen&&o.onOpen(r,i)},onClose:(e,i)=>{n.unlink(t.element),r().getOr(i).element.dom.dispatchEvent(new window.FocusEvent("focusout")),void 0!==o&&void 0!==o.onClose&&o.onClose(e,i)},isPartOf:(e,o,n)=>Nb(o,n)||Nb(t,n),getAttachPoint:()=>r().getOrDie()}),Im.config({find:e=>vv.getState(e).bind(e=>Im.getCurrent(e))}),ov.config({channels:{...dy({isExtraPart:E}),...hy({doReposition:by})}})])}},wy=e=>{const t=Hm.getCoupled(e,"sandbox");by(t)},_y=()=>[Ji("sandboxClasses",[]),Xp("sandboxBehaviours",[Im,ov,vv,Yg])],xy=w([Di("dom"),Di("fetch"),va("onOpen"),ba("onExecute"),Ji("getHotspot",A.some),Ji("getAnchorOverrides",w({})),gf(),qp("dropdownBehaviours",[Yv,Hm,_h,fd]),Di("toggleClass"),Ji("eventOrder",{}),$i("lazySink"),Ji("matchWidth",!1),Ji("useMinWidth",!1),$i("role"),$i("listRole")].concat(_y())),Cy=w([Ja({schema:[pa(),Ji("fakeFocus",!1)],name:"menu",defaults:e=>({onExecute:e.onExecute})}),ly()]),ky=rg({name:"Dropdown",configFields:xy(),partFields:Cy(),factory:(e,t,o,n)=>{const r=e=>{vv.getState(e).each(e=>{sy.highlightPrimary(e)})},i=(t,o,r)=>fy(e,_,t,n,o,r),s={expand:e=>{Yv.isOn(e)||i(e,v,Ac.HighlightNone).get(v)},open:e=>{Yv.isOn(e)||i(e,v,Ac.HighlightMenuAndItem).get(v)},refetch:t=>Hm.getExistingCoupled(t,"sandbox").fold(()=>i(t,v,Ac.HighlightMenuAndItem).map(v),o=>py(e,_,t,o,n,v,Ac.HighlightMenuAndItem).map(v)),isOpen:Yv.isOn,close:e=>{Yv.isOn(e)&&i(e,v,Ac.HighlightMenuAndItem).get(v)},repositionMenus:e=>{Yv.isOn(e)&&wy(e)}},a=(e,t)=>(Pc(e),A.some(!0));return{uid:e.uid,dom:e.dom,components:t,behaviours:Yp(e.dropdownBehaviours,[Yv.config({toggleClass:e.toggleClass,aria:{mode:"expanded"}}),Hm.config({others:{sandbox:t=>yy(e,t,{onOpen:()=>Yv.on(t),onClose:()=>Yv.off(t)})}}),_h.config({mode:"special",onSpace:a,onEnter:a,onDown:(e,t)=>{if(ky.isOpen(e)){const t=Hm.getCoupled(e,"sandbox");r(t)}else ky.open(e);return A.some(!0)},onEscape:(e,t)=>ky.isOpen(e)?(ky.close(e),A.some(!0)):A.none()}),fd.config({})]),events:Sb(A.some(e=>{i(e,r,Ac.HighlightMenuAndItem).get(v)})),eventOrder:{...e.eventOrder,[Ps()]:["disabling","toggling","alloy.base.behaviour"]},apis:s,domModification:{attributes:{"aria-haspopup":e.listRole.getOr("true"),...e.role.fold(()=>({}),e=>({role:e})),..."button"===e.dom.tag?{type:fe(e.dom,"attributes").bind(e=>fe(e,"type")).getOr("button")}:{}}}}},apis:{open:(e,t)=>e.open(t),refetch:(e,t)=>e.refetch(t),expand:(e,t)=>e.expand(t),close:(e,t)=>e.close(t),isOpen:(e,t)=>e.isOpen(t),repositionMenus:(e,t)=>e.repositionMenus(t)}}),Sy="form",Ty=[qp("formBehaviours",[Yg])],Ey=e=>"<alloy.field."+e+">",Oy=(e,t)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Yp(e.formBehaviours,[Yg.config({store:{mode:"manual",getValue:t=>{const o=pl(t,e);return le(o,(e,t)=>e().bind(e=>{return o=Im.getCurrent(e),n=new Error(`Cannot find a current component to extract the value from for form part '${t}': `+ra(e.element)),o.fold(()=>Ae.error(n),Ae.value);var o,n}).map(Yg.getValue))},setValue:(t,o)=>{ae(o,(o,n)=>{ul(t,e,n).each(e=>{Im.getCurrent(e).each(e=>{Yg.setValue(e,o)})})})}}})]),apis:{getField:(t,o)=>ul(t,e,o).bind(Im.getCurrent)}}),Ay={getField:Sh((e,t,o)=>e.getField(t,o)),sketch:e=>{const t=(()=>{const e=[];return{field:(t,o)=>(e.push(t),sl(Sy,Ey(t),o)),record:w(e)}})(),o=e(t),n=t.record(),r=L(n,e=>Ka({name:e,pname:Ey(e)}));return Qp(Sy,Ty,r,Oy,o)}},My=w([Di("dom"),Ji("shell",!0),qp("toolbarBehaviours",[Qh])]),By=w([Qa({name:"groups",overrides:()=>({behaviours:id([Qh.config({})])})})]),Ry=rg({name:"Toolbar",configFields:My(),partFields:By(),factory:(e,t,o,n)=>{const r=e.shell?{behaviours:[Qh.config({})],components:[]}:{behaviours:[],components:t};return{uid:e.uid,dom:e.dom,components:r.components,behaviours:Yp(e.toolbarBehaviours,r.behaviours),apis:{setGroups:(t,o)=>{var n;(n=t,e.shell?A.some(n):ul(n,e,"groups")).fold(()=>{throw console.error("Toolbar was defined to not be a shell, but no groups container was specified in components"),new Error("Toolbar was defined to not be a shell, but no groups container was specified in components")},e=>{Qh.set(e,o)})},refresh:v},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)}}}),Ny=w([ga(["toggledClass"]),Di("lazySink"),zi("fetch"),Yi("getBounds"),Ki("fireDismissalEventInstead",[Ji("event",Ys())]),gf(),va("onToggled")]),Vy=w([Ja({name:"button",overrides:e=>({dom:{attributes:{"aria-haspopup":"true"}},buttonBehaviours:id([Yv.config({toggleClass:e.markers.toggledClass,aria:{mode:"expanded"},toggleOnExecute:!1,onToggled:e.onToggled})])})}),Ja({factory:Ry,schema:My(),name:"toolbar",overrides:e=>({toolbarBehaviours:id([_h.config({mode:"cyclic",onEscape:t=>(ul(t,e,"button").each(fd.focus),A.none())})])})})]),Dy=Ge(),Py=(e,t)=>{const o=Hm.getCoupled(e,"toolbarSandbox");vv.isOpen(o)?vv.close(o):vv.open(o,t.toolbar())},Iy=(e,t,o,n)=>{const r=o.getBounds.map(e=>e()),i=o.lazySink(e).getOrDie();Qf.positionWithinBounds(i,t,{anchor:{type:"hotspot",hotspot:e,layouts:n,overrides:{maxWidthFunction:Sc()}}},r)},Ly=(e,t,o,n,r)=>{Ry.setGroups(t,r),Iy(e,t,o,n),Yv.on(e)},Fy=rg({name:"FloatingToolbarButton",factory:(e,t,o,n)=>({...Tb.sketch({...n.button(),action:e=>{Py(e,n)},buttonBehaviours:Kp({dump:n.button().buttonBehaviours},[Hm.config({others:{toolbarSandbox:t=>((e,t,o)=>{const n=Rb();return{dom:{tag:"div",attributes:{id:n.id}},behaviours:id([_h.config({mode:"special",onEscape:e=>(vv.close(e),A.some(!0))}),vv.config({onOpen:(r,i)=>{const s=Dy.get().getOr(!1);o.fetch().get(r=>{Ly(e,i,o,t.layouts,r),n.link(e.element),s||_h.focusIn(i)})},onClose:()=>{Yv.off(e),Dy.get().getOr(!1)||fd.focus(e),n.unlink(e.element)},isPartOf:(t,o,n)=>Nb(o,n)||Nb(e,n),getAttachPoint:()=>o.lazySink(e).getOrDie()}),ov.config({channels:{...dy({isExtraPart:E,...o.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...hy({doReposition:()=>{vv.getState(Hm.getCoupled(e,"toolbarSandbox")).each(n=>{Iy(e,n,o,t.layouts)})}})}})])}})(t,o,e)}})])}),apis:{setGroups:(t,n)=>{vv.getState(Hm.getCoupled(t,"toolbarSandbox")).each(r=>{Ly(t,r,e,o.layouts,n)})},reposition:t=>{vv.getState(Hm.getCoupled(t,"toolbarSandbox")).each(n=>{Iy(t,n,e,o.layouts)})},toggle:e=>{Py(e,n)},toggleWithoutFocusing:e=>{((e,t)=>{Dy.set(!0),Py(e,t),Dy.clear()})(e,n)},getToolbar:e=>vv.getState(Hm.getCoupled(e,"toolbarSandbox")),isOpen:e=>vv.isOpen(Hm.getCoupled(e,"toolbarSandbox"))}}),configFields:Ny(),partFields:Vy(),apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggleWithoutFocusing(t)},getToolbar:(e,t)=>e.getToolbar(t),isOpen:(e,t)=>e.isOpen(t)}}),zy=w([Ji("prefix","form-field"),qp("fieldBehaviours",[Im,Yg])]),Hy=w([Qa({schema:[Di("dom")],name:"label"}),Qa({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[Di("text")],name:"aria-descriptor"}),Ka({factory:{sketch:e=>{const t=((e,t)=>{const o={};return ae(e,(e,n)=>{V(t,n)||(o[n]=e)}),o})(e,["factory"]);return e.factory.sketch(t)}},schema:[Di("factory")],name:"field"})]),Uy=rg({name:"FormField",configFields:zy(),partFields:Hy(),factory:(e,t,o,n)=>{const r=Yp(e.fieldBehaviours,[Im.config({find:t=>ul(t,e,"field")}),Yg.config({store:{mode:"manual",getValue:e=>Im.getCurrent(e).bind(Yg.getValue),setValue:(e,t)=>{Im.getCurrent(e).each(e=>{Yg.setValue(e,t)})}}})]),i=zc([Kc((t,o)=>{const n=ml(t,e,["label","field","aria-descriptor"]);n.field().each(t=>{const o=Pe(e.prefix);n.label().each(e=>{jo(e.element,"for",o),jo(t.element,"id",o)}),n["aria-descriptor"]().each(o=>{const n=Pe(e.prefix);jo(o.element,"id",n),jo(t.element,"aria-describedby",n)})})})]),s={getField:t=>ul(t,e,"field"),getLabel:t=>ul(t,e,"label")};return{uid:e.uid,dom:e.dom,components:t,behaviours:r,events:i,apis:s}},apis:{getField:(e,t)=>e.getField(t),getLabel:(e,t)=>e.getLabel(t)}}),Zy=w([Ji("field1Name","field1"),Ji("field2Name","field2"),ya("onLockedChange"),ga(["lockClass"]),Ji("locked",!1),Xp("coupledFieldBehaviours",[Im,Yg]),rs("onInput",v)]),$y=(e,t)=>Ka({factory:Uy,name:e,overrides:e=>({fieldBehaviours:id([ud("coupled-input-behaviour",[Zc(Cs(),o=>{((e,t,o)=>ul(e,t,o).bind(Im.getCurrent))(o,e,t).each(t=>{ul(o,e,"lock").each(n=>{Yv.isOn(n)&&e.onLockedChange(o,t,n),e.onInput(o)})})})])])})}),jy=w([$y("field1","field2"),$y("field2","field1"),Ka({factory:Tb,schema:[Di("dom")],name:"lock",overrides:e=>({buttonBehaviours:id([Yv.config({selected:e.locked,toggleClass:e.markers.lockClass,aria:{mode:"pressed"}})])})})]),Wy=rg({name:"FormCoupledInputs",configFields:Zy(),partFields:jy(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Kp(e.coupledFieldBehaviours,[Im.config({find:A.some}),Yg.config({store:{mode:"manual",getValue:t=>{const o=fl(t,e,["field1","field2"]);return{[e.field1Name]:Yg.getValue(o.field1()),[e.field2Name]:Yg.getValue(o.field2())}},setValue:(t,o)=>{const n=fl(t,e,["field1","field2"]);be(o,e.field1Name)&&Yg.setValue(n.field1(),o[e.field1Name]),be(o,e.field2Name)&&Yg.setValue(n.field2(),o[e.field2Name])}}})]),apis:{getField1:t=>ul(t,e,"field1"),getField2:t=>ul(t,e,"field2"),getLock:t=>ul(t,e,"lock")}}),apis:{getField1:(e,t)=>e.getField1(t),getField2:(e,t)=>e.getField2(t),getLock:(e,t)=>e.getLock(t)}}),qy=ng({name:"HtmlSelect",configFields:[Di("options"),qp("selectBehaviours",[fd,Yg]),Ji("selectClasses",[]),Ji("selectAttributes",{}),$i("data")],factory:(e,t)=>{const o=L(e.options,e=>({dom:{tag:"option",value:e.value,innerHtml:e.text}})),n=e.data.map(e=>as("initialValue",e)).getOr({});return{uid:e.uid,dom:{tag:"select",classes:e.selectClasses,attributes:e.selectAttributes},components:o,behaviours:Yp(e.selectBehaviours,[fd.config({}),Yg.config({store:{mode:"manual",getValue:e=>cr(e.element),setValue:(t,o)=>{const n=te(e.options);$(e.options,e=>e.value===o).isSome()?dr(t.element,o):-1===t.element.dom.selectedIndex&&""===o&&n.each(e=>dr(t.element,e.value))},...n}})])}}}),Gy=ng({name:"InlineView",configFields:[Di("lazySink"),va("onShow"),va("onHide"),Yi("onEscape"),qp("inlineBehaviours",[vv,Yg,ov]),Ki("fireDismissalEventInstead",[Ji("event",Ys())]),Ki("fireRepositionEventInstead",[Ji("event",Xs())]),Ji("getRelated",A.none),Ji("isExtraPart",E),Ji("eventOrder",A.none)],factory:(e,t)=>{const o=(t,o,n,r)=>{const i=e.lazySink(t).getOrDie();vv.openWhileCloaked(t,o,()=>Qf.positionWithinBounds(i,t,n,r())),Yg.setValue(t,A.some({mode:"position",config:n,getBounds:r}))},n=(t,o,n,r)=>{const i=((e,t,o,n,r)=>{const i=()=>e.lazySink(t),s="horizontal"===n.type?{layouts:{onLtr:()=>Ql(),onRtl:()=>ec()}}:{},a=e=>(e=>2===e.length)(e)?s:{};return sy.sketch({dom:{tag:"div"},data:n.data,markers:n.menu.markers,highlightOnOpen:n.menu.highlightOnOpen,fakeFocus:n.menu.fakeFocus,onEscape:()=>(vv.close(t),e.onEscape.map(e=>e(t)),A.some(!0)),onExecute:()=>A.some(!0),onOpenMenu:(e,t)=>{Qf.positionWithinBounds(i().getOrDie(),t,o,r())},onOpenSubmenu:(e,t,o,n)=>{const r=i().getOrDie();Qf.position(r,o,{anchor:{type:"submenu",item:t,...a(n)}})},onRepositionMenu:(e,t,n)=>{const s=i().getOrDie();Qf.positionWithinBounds(s,t,o,r()),F(n,e=>{const t=a(e.triggeringPath);Qf.position(s,e.triggeredMenu,{anchor:{type:"submenu",item:e.triggeringItem,...t}})})}})})(e,t,o,n,r);vv.open(t,i),Yg.setValue(t,A.some({mode:"menu",menu:i}))},r=t=>{vv.isOpen(t)&&Yg.getValue(t).each(o=>{switch(o.mode){case"menu":vv.getState(t).each(sy.repositionMenus);break;case"position":const n=e.lazySink(t).getOrDie();Qf.positionWithinBounds(n,t,o.config,o.getBounds())}})},i={setContent:(e,t)=>{vv.setContent(e,t)},showAt:(e,t,n)=>{const r=A.none;o(e,t,n,r)},showWithinBounds:o,showMenuAt:(e,t,o)=>{n(e,t,o,A.none)},showMenuWithinBounds:n,hide:e=>{vv.isOpen(e)&&(Yg.setValue(e,A.none()),vv.close(e))},getContent:e=>vv.getState(e),reposition:r,isOpen:vv.isOpen};return{uid:e.uid,dom:e.dom,behaviours:Yp(e.inlineBehaviours,[vv.config({isPartOf:(t,o,n)=>Nb(o,n)||((t,o)=>e.getRelated(t).exists(e=>Nb(e,o)))(t,n),getAttachPoint:t=>e.lazySink(t).getOrDie(),onOpen:t=>{e.onShow(t)},onClose:t=>{e.onHide(t)}}),Yg.config({store:{mode:"memory",initialValue:A.none()}}),ov.config({channels:{...dy({isExtraPart:t.isExtraPart,...e.fireDismissalEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({})}),...hy({...e.fireRepositionEventInstead.map(e=>({fireEventInstead:{event:e.event}})).getOr({}),doReposition:r})}})]),eventOrder:e.eventOrder,apis:i}},apis:{showAt:(e,t,o,n)=>{e.showAt(t,o,n)},showWithinBounds:(e,t,o,n,r)=>{e.showWithinBounds(t,o,n,r)},showMenuAt:(e,t,o,n)=>{e.showMenuAt(t,o,n)},showMenuWithinBounds:(e,t,o,n,r)=>{e.showMenuWithinBounds(t,o,n,r)},hide:(e,t)=>{e.hide(t)},isOpen:(e,t)=>e.isOpen(t),getContent:(e,t)=>e.getContent(t),setContent:(e,t,o)=>{e.setContent(t,o)},reposition:(e,t)=>{e.reposition(t)}}}),Yy=w([ts("type","text"),$i("data"),Ji("inputAttributes",{}),Ji("inputStyles",{}),Ji("tag","input"),Ji("inputClasses",[]),va("onSetValue"),rs("fromInputValue",_),rs("toInputValue",_),Ji("styles",{}),Ji("eventOrder",{}),qp("inputBehaviours",[Yg,fd]),Ji("selectOnFocus",!0)]),Xy=e=>id([fd.config({onFocus:e.selectOnFocus?t=>{const o=t.element,n=cr(o);"range"!==e.type&&o.dom.setSelectionRange(0,n.length)}:v})]),Ky=e=>({...Xy(e),...Yp(e.inputBehaviours,[Yg.config({store:{mode:"manual",...e.data.map(e=>({initialValue:e})).getOr({}),getValue:t=>e.fromInputValue(cr(t.element)),setValue:(t,o)=>{cr(t.element)!==o&&dr(t.element,e.toInputValue(o))}},onSetValue:e.onSetValue})])}),Jy=e=>({tag:e.tag,attributes:{type:e.type,...e.inputAttributes},styles:e.inputStyles,classes:e.inputClasses}),Qy=ng({name:"Input",configFields:Yy(),factory:(e,t)=>({uid:e.uid,dom:Jy(e),components:[],behaviours:Ky(e),eventOrder:e.eventOrder})}),ew=rl(jb(),Wb()),tw=w([Di("lazySink"),$i("dragBlockClass"),rs("getBounds",Lr),Ji("useTabstopAt",O),Ji("firstTabstop",0),Ji("eventOrder",{}),qp("modalBehaviours",[_h]),ba("onExecute"),wa("onEscape")]),ow={sketch:_},nw=w([Qa({name:"draghandle",overrides:(e,t)=>({behaviours:id([Eg.config({mode:"mouse",getTarget:e=>jn(e,'[role="dialog"]').getOr(e),blockerClass:e.dragBlockClass.getOrDie(new Error("The drag blocker class was not specified for a dialog with a drag handle: \n"+JSON.stringify(t,null,2)).message),getBounds:e.getDragBounds})])})}),Ka({schema:[Di("dom")],name:"title"}),Ka({factory:ow,schema:[Di("dom")],name:"close"}),Ka({factory:ow,schema:[Di("dom")],name:"body"}),Qa({factory:ow,schema:[Di("dom")],name:"footer"}),Ja({factory:{sketch:(e,t)=>({...e,dom:t.dom,components:t.components})},schema:[Ji("dom",{tag:"div",styles:{position:"fixed",left:"0px",top:"0px",right:"0px",bottom:"0px"}}),Ji("components",[])],name:"blocker"})]),rw=rg({name:"ModalDialog",configFields:tw(),partFields:nw(),factory:(e,t,o,n)=>{const r=Ge(),i=Pe("modal-events"),s={...e.eventOrder,[qs()]:[i].concat(e.eventOrder["alloy.system.attached"]||[])},a=Kt();return{uid:e.uid,dom:e.dom,components:t,apis:{show:t=>{r.set(t);const o=e.lazySink(t).getOrDie(),i=n.blocker(),s=o.getSystem().build({...i,components:i.components.concat([Mm(t)]),behaviours:id([fd.config({}),ud("dialog-blocker-events",[Xc(ys(),()=>{Vm.isBlocked(t)||_h.focusIn(t)})])])});Rh(o,s),_h.focusIn(t)},hide:e=>{r.clear(),mo(e.element).each(t=>{e.getSystem().getByDom(t).each(e=>{Dh(e)})})},getBody:t=>hl(t,e,"body"),getFooter:t=>ul(t,e,"footer"),setIdle:e=>{Vm.unblock(e)},setBusy:(e,t)=>{Vm.block(e,t)}},eventOrder:s,domModification:{attributes:{role:"dialog","aria-modal":"true"}},behaviours:Yp(e.modalBehaviours,[Qh.config({}),_h.config({mode:"cyclic",onEnter:e.onExecute,onEscape:e.onEscape,useTabstopAt:e.useTabstopAt,firstTabstop:e.firstTabstop}),Vm.config({getRoot:r.get}),ud(i,[Kc(t=>{const o=hl(t,e,"title").element,n=(e=>e.dom.textContent)(o);a.os.isMacOS()&&m(n)?jo(t.element,"aria-label",n):((e,t)=>{const o=Go(e,"id").fold(()=>{const e=Pe("dialog-label");return jo(t,"id",e),e},_);jo(e,"aria-labelledby",o)})(t.element,o)})])])}},apis:{show:(e,t)=>{e.show(t)},hide:(e,t)=>{e.hide(t)},getBody:(e,t)=>e.getBody(t),getFooter:(e,t)=>e.getFooter(t),setBusy:(e,t,o)=>{e.setBusy(t,o)},setIdle:(e,t)=>{e.setIdle(t)}}}),iw=Qa({schema:[Di("dom")],name:"label"}),sw=e=>Qa({name:e+"-edge",overrides:t=>t.model.manager.edgeActions[e].fold(()=>({}),e=>({events:zc([$c(ds(),(t,o,n)=>e(t,n),[t]),$c(ps(),(t,o,n)=>e(t,n),[t]),$c(gs(),(t,o,n)=>{n.mouseIsDown.get()&&e(t,n)},[t])])}))}),aw=sw("top-left"),lw=sw("top"),cw=sw("top-right"),dw=sw("right"),uw=sw("bottom-right"),hw=sw("bottom"),mw=sw("bottom-left"),pw=sw("left"),gw=Ka({name:"thumb",defaults:w({dom:{styles:{position:"absolute"}}}),overrides:e=>({events:zc([Wc(ds(),e,"spectrum"),Wc(us(),e,"spectrum"),Wc(hs(),e,"spectrum"),Wc(ps(),e,"spectrum"),Wc(gs(),e,"spectrum"),Wc(vs(),e,"spectrum")])})}),fw=e=>Rd(e.event),vw=Ka({schema:[Ni("mouseIsDown",()=>we(!1))],name:"spectrum",overrides:e=>{const t=e.model.manager,o=(o,n)=>t.getValueFromEvent(n).map(n=>t.setValueFrom(o,e,n));return{behaviours:id([_h.config({mode:"special",onLeft:(o,n)=>t.onLeft(o,e,fw(n)),onRight:(o,n)=>t.onRight(o,e,fw(n)),onUp:(o,n)=>t.onUp(o,e,fw(n)),onDown:(o,n)=>t.onDown(o,e,fw(n))}),Hv.config({}),fd.config({})]),events:zc([Zc(ds(),o),Zc(us(),o),Zc(ps(),o),Zc(gs(),(t,n)=>{e.mouseIsDown.get()&&o(t,n)})])}}});var bw=[iw,pw,dw,lw,hw,aw,cw,mw,uw,gw,vw];const yw=w("slider.change.value"),ww=e=>{const t=e.event.raw;if((e=>-1!==e.type.indexOf("touch"))(t)){const e=t;return void 0!==e.touches&&1===e.touches.length?A.some(e.touches[0]).map(e=>Bn(e.clientX,e.clientY)):A.none()}{const e=t;return void 0!==e.clientX?A.some(e).map(e=>Bn(e.clientX,e.clientY)):A.none()}},_w=e=>e.model.minX,xw=e=>e.model.minY,Cw=e=>e.model.minX-1,kw=e=>e.model.minY-1,Sw=e=>e.model.maxX,Tw=e=>e.model.maxY,Ew=e=>e.model.maxX+1,Ow=e=>e.model.maxY+1,Aw=(e,t,o)=>t(e)-o(e),Mw=e=>Aw(e,Sw,_w),Bw=e=>Aw(e,Tw,xw),Rw=e=>Mw(e)/2,Nw=e=>Bw(e)/2,Vw=(e,t)=>t?e.stepSize*e.speedMultiplier:e.stepSize,Dw=e=>e.snapToGrid,Pw=e=>e.snapStart,Iw=e=>e.rounded,Lw=(e,t)=>void 0!==e[t+"-edge"],Fw=e=>Lw(e,"left"),zw=e=>Lw(e,"right"),Hw=e=>Lw(e,"top"),Uw=e=>Lw(e,"bottom"),Zw=e=>e.model.value.get(),$w=(e,t)=>({x:e,y:t}),jw=(e,t)=>{Dc(e,yw(),{value:t})},Ww=(e,t,o,n)=>e<t?e:e>o?o:e===t?t-1:Math.max(t,e-n),qw=(e,t,o,n)=>e>o?e:e<t?t:e===o?o+1:Math.min(o,e+n),Gw=(e,t,o)=>Math.max(t,Math.min(o,e)),Yw=e=>{const{min:t,max:o,range:n,value:r,step:i,snap:s,snapStart:a,rounded:l,hasMinEdge:c,hasMaxEdge:d,minBound:u,maxBound:h,screenRange:m}=e,p=c?t-1:t,g=d?o+1:o;if(r<u)return p;if(r>h)return g;{const e=((e,t,o)=>Math.min(o,Math.max(e,t))-t)(r,u,h),c=Gw(e/m*n+t,p,g);return s&&c>=t&&c<=o?((e,t,o,n,r)=>r.fold(()=>{const r=e-t,i=Math.round(r/n)*n;return Gw(t+i,t-1,o+1)},t=>{const r=(e-t)%n,i=Math.round(r/n),s=Math.floor((e-t)/n),a=Math.floor((o-t)/n),l=t+Math.min(a,s+i)*n;return Math.max(t,l)}))(c,t,o,i,a):l?Math.round(c):c}},Xw=e=>{const{min:t,max:o,range:n,value:r,hasMinEdge:i,hasMaxEdge:s,maxBound:a,maxOffset:l,centerMinEdge:c,centerMaxEdge:d}=e;return r<t?i?0:c:r>o?s?a:d:(r-t)/n*l},Kw="top",Jw="right",Qw="bottom",e_="left",t_=e=>e.element.dom.getBoundingClientRect(),o_=(e,t)=>e[t],n_=e=>{const t=t_(e);return o_(t,e_)},r_=e=>{const t=t_(e);return o_(t,Jw)},i_=e=>{const t=t_(e);return o_(t,Kw)},s_=e=>{const t=t_(e);return o_(t,Qw)},a_=e=>{const t=t_(e);return o_(t,"width")},l_=e=>{const t=t_(e);return o_(t,"height")},c_=(e,t,o)=>(e+t)/2-o,d_=(e,t)=>{const o=t_(e),n=t_(t),r=o_(o,e_),i=o_(o,Jw),s=o_(n,e_);return c_(r,i,s)},u_=(e,t)=>{const o=t_(e),n=t_(t),r=o_(o,Kw),i=o_(o,Qw),s=o_(n,Kw);return c_(r,i,s)},h_=(e,t)=>{Dc(e,yw(),{value:t})},m_=(e,t,o)=>{const n={min:_w(t),max:Sw(t),range:Mw(t),value:o,step:Vw(t),snap:Dw(t),snapStart:Pw(t),rounded:Iw(t),hasMinEdge:Fw(t),hasMaxEdge:zw(t),minBound:n_(e),maxBound:r_(e),screenRange:a_(e)};return Yw(n)},p_=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?qw:Ww)(Zw(o),_w(o),Sw(o),Vw(o,n));return h_(t,r),A.some(r)})(e,t,o,n).map(O),g_=(e,t,o,n,r,i)=>{const s=((e,t,o,n,r)=>{const i=a_(e),s=n.bind(t=>A.some(d_(t,e))).getOr(0),a=r.bind(t=>A.some(d_(t,e))).getOr(i),l={min:_w(t),max:Sw(t),range:Mw(t),value:o,hasMinEdge:Fw(t),hasMaxEdge:zw(t),minBound:n_(e),minOffset:0,maxBound:r_(e),maxOffset:i,centerMinEdge:s,centerMaxEdge:a};return Xw(l)})(t,i,o,n,r);return n_(t)-n_(e)+s},f_=p_(-1),v_=p_(1),b_=A.none,y_=A.none,w_={"top-left":A.none(),top:A.none(),"top-right":A.none(),right:A.some((e,t)=>{jw(e,Ew(t))}),"bottom-right":A.none(),bottom:A.none(),"bottom-left":A.none(),left:A.some((e,t)=>{jw(e,Cw(t))})};var __=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=m_(e,t,o);return h_(e,n),n},setToMin:(e,t)=>{const o=_w(t);h_(e,o)},setToMax:(e,t)=>{const o=Sw(t);h_(e,o)},findValueOfOffset:m_,getValueFromEvent:e=>ww(e).map(e=>e.left),findPositionOfValue:g_,setPositionFromValue:(e,t,o,n)=>{const r=Zw(o),i=g_(e,n.getSpectrum(e),r,n.getLeftEdge(e),n.getRightEdge(e),o),s=En(t.element)/2;dn(t.element,"left",i-s+"px")},onLeft:f_,onRight:v_,onUp:b_,onDown:y_,edgeActions:w_});const x_=(e,t)=>{Dc(e,yw(),{value:t})},C_=(e,t,o)=>{const n={min:xw(t),max:Tw(t),range:Bw(t),value:o,step:Vw(t),snap:Dw(t),snapStart:Pw(t),rounded:Iw(t),hasMinEdge:Hw(t),hasMaxEdge:Uw(t),minBound:i_(e),maxBound:s_(e),screenRange:l_(e)};return Yw(n)},k_=e=>(t,o,n)=>((e,t,o,n)=>{const r=(e>0?qw:Ww)(Zw(o),xw(o),Tw(o),Vw(o,n));return x_(t,r),A.some(r)})(e,t,o,n).map(O),S_=(e,t,o,n,r,i)=>{const s=((e,t,o,n,r)=>{const i=l_(e),s=n.bind(t=>A.some(u_(t,e))).getOr(0),a=r.bind(t=>A.some(u_(t,e))).getOr(i),l={min:xw(t),max:Tw(t),range:Bw(t),value:o,hasMinEdge:Hw(t),hasMaxEdge:Uw(t),minBound:i_(e),minOffset:0,maxBound:s_(e),maxOffset:i,centerMinEdge:s,centerMaxEdge:a};return Xw(l)})(t,i,o,n,r);return i_(t)-i_(e)+s},T_=A.none,E_=A.none,O_=k_(-1),A_=k_(1),M_={"top-left":A.none(),top:A.some((e,t)=>{jw(e,kw(t))}),"top-right":A.none(),right:A.none(),"bottom-right":A.none(),bottom:A.some((e,t)=>{jw(e,Ow(t))}),"bottom-left":A.none(),left:A.none()};var B_=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=C_(e,t,o);return x_(e,n),n},setToMin:(e,t)=>{const o=xw(t);x_(e,o)},setToMax:(e,t)=>{const o=Tw(t);x_(e,o)},findValueOfOffset:C_,getValueFromEvent:e=>ww(e).map(e=>e.top),findPositionOfValue:S_,setPositionFromValue:(e,t,o,n)=>{const r=Zw(o),i=S_(e,n.getSpectrum(e),r,n.getTopEdge(e),n.getBottomEdge(e),o),s=xn(t.element)/2;dn(t.element,"top",i-s+"px")},onLeft:T_,onRight:E_,onUp:O_,onDown:A_,edgeActions:M_});const R_=(e,t)=>{Dc(e,yw(),{value:t})},N_=(e,t)=>({x:e,y:t}),V_=(e,t)=>(o,n,r)=>((e,t,o,n,r)=>{const i=e>0?qw:Ww,s=t?Zw(n).x:i(Zw(n).x,_w(n),Sw(n),Vw(n,r)),a=t?i(Zw(n).y,xw(n),Tw(n),Vw(n,r)):Zw(n).y;return R_(o,N_(s,a)),A.some(s)})(e,t,o,n,r).map(O),D_=V_(-1,!1),P_=V_(1,!1),I_=V_(-1,!0),L_=V_(1,!0),F_={"top-left":A.some((e,t)=>{jw(e,$w(Cw(t),kw(t)))}),top:A.some((e,t)=>{jw(e,$w(Rw(t),kw(t)))}),"top-right":A.some((e,t)=>{jw(e,$w(Ew(t),kw(t)))}),right:A.some((e,t)=>{jw(e,$w(Ew(t),Nw(t)))}),"bottom-right":A.some((e,t)=>{jw(e,$w(Ew(t),Ow(t)))}),bottom:A.some((e,t)=>{jw(e,$w(Rw(t),Ow(t)))}),"bottom-left":A.some((e,t)=>{jw(e,$w(Cw(t),Ow(t)))}),left:A.some((e,t)=>{jw(e,$w(Cw(t),Nw(t)))})};var z_=Object.freeze({__proto__:null,setValueFrom:(e,t,o)=>{const n=m_(e,t,o.left),r=C_(e,t,o.top),i=N_(n,r);return R_(e,i),i},setToMin:(e,t)=>{const o=_w(t),n=xw(t);R_(e,N_(o,n))},setToMax:(e,t)=>{const o=Sw(t),n=Tw(t);R_(e,N_(o,n))},getValueFromEvent:e=>ww(e),setPositionFromValue:(e,t,o,n)=>{const r=Zw(o),i=g_(e,n.getSpectrum(e),r.x,n.getLeftEdge(e),n.getRightEdge(e),o),s=S_(e,n.getSpectrum(e),r.y,n.getTopEdge(e),n.getBottomEdge(e),o),a=En(t.element)/2,l=xn(t.element)/2;dn(t.element,"left",i-a+"px"),dn(t.element,"top",s-l+"px")},onLeft:D_,onRight:P_,onUp:I_,onDown:L_,edgeActions:F_});const H_=rg({name:"Slider",configFields:[Ji("stepSize",1),Ji("speedMultiplier",10),Ji("onChange",v),Ji("onChoose",v),Ji("onInit",v),Ji("onDragStart",v),Ji("onDragEnd",v),Ji("snapToGrid",!1),Ji("rounded",!0),$i("snapStart"),Pi("model",Mi("mode",{x:[Ji("minX",0),Ji("maxX",100),Ni("value",e=>we(e.mode.minX)),Di("getInitialValue"),_a("manager",__)],y:[Ji("minY",0),Ji("maxY",100),Ni("value",e=>we(e.mode.minY)),Di("getInitialValue"),_a("manager",B_)],xy:[Ji("minX",0),Ji("maxX",100),Ji("minY",0),Ji("maxY",100),Ni("value",e=>we({x:e.mode.minX,y:e.mode.minY})),Di("getInitialValue"),_a("manager",z_)]})),qp("sliderBehaviours",[_h,Yg]),Ni("mouseIsDown",()=>we(!1))],partFields:bw,factory:(e,t,o,n)=>{const r=t=>hl(t,e,"thumb"),i=t=>hl(t,e,"spectrum"),s=t=>ul(t,e,"left-edge"),a=t=>ul(t,e,"right-edge"),l=t=>ul(t,e,"top-edge"),c=t=>ul(t,e,"bottom-edge"),d=e.model,u=d.manager,h=(t,o)=>{u.setPositionFromValue(t,o,e,{getLeftEdge:s,getRightEdge:a,getTopEdge:l,getBottomEdge:c,getSpectrum:i})},m=(e,t)=>{d.value.set(t);const o=r(e);h(e,o)},p=t=>{const o=e.mouseIsDown.get();e.mouseIsDown.set(!1),o&&ul(t,e,"thumb").each(o=>{const n=d.value.get();e.onChoose(t,o,n)})},g=(t,o)=>{o.stop(),e.mouseIsDown.set(!0),e.onDragStart(t,r(t))},f=(t,o)=>{o.stop(),e.onDragEnd(t,r(t)),p(t)},v=t=>{ul(t,e,"spectrum").map(_h.focusIn)};return{uid:e.uid,dom:e.dom,components:t,behaviours:Yp(e.sliderBehaviours,[_h.config({mode:"special",focusIn:v}),Yg.config({store:{mode:"manual",getValue:e=>d.value.get(),setValue:m}}),ov.config({channels:{[gb()]:{onReceive:p}}})]),events:zc([Zc(yw(),(t,o)=>{((t,o)=>{m(t,o);const n=r(t);e.onChange(t,n,o),A.some(!0)})(t,o.event.value)}),Kc((t,o)=>{const n=d.getInitialValue();d.value.set(n);const s=r(t);h(t,s);const a=i(t);e.onInit(t,s,a,d.value.get())}),Zc(ds(),g),Zc(hs(),f),Zc(ps(),(e,t)=>{v(e),g(e,t)}),Zc(vs(),f)]),apis:{resetToMin:t=>{u.setToMin(t,e)},resetToMax:t=>{u.setToMax(t,e)},setValue:m,refresh:h},domModification:{styles:{position:"relative"}}}},apis:{setValue:(e,t,o)=>{e.setValue(t,o)},resetToMin:(e,t)=>{e.resetToMin(t)},resetToMax:(e,t)=>{e.resetToMax(t)},refresh:(e,t)=>{e.refresh(t)}}}),U_="container",Z_=[qp("slotBehaviours",[])],$_=e=>"<alloy.field."+e+">",j_=(e,t)=>{const o=t=>gl(e),n=(t,o)=>(n,r)=>ul(n,e,r).map(e=>t(e,r)).getOr(o),r=(e,t)=>"true"!==qo(e.element,"aria-hidden"),i=n(r,!1),s=n((e,t)=>{if(r(e)){const o=e.element;dn(o,"display","none"),jo(o,"aria-hidden","true"),Dc(e,Js(),{name:t,visible:!1})}}),a=(e=>(t,o)=>{F(o,o=>e(t,o))})(s),l=n((e,t)=>{if(!r(e)){const o=e.element;bn(o,"display"),Xo(o,"aria-hidden"),Dc(e,Js(),{name:t,visible:!0})}}),c={getSlotNames:o,getSlot:(t,o)=>ul(t,e,o),isShowing:i,hideSlot:s,hideAllSlots:e=>a(e,o()),showSlot:l};return{uid:e.uid,dom:e.dom,components:t,behaviours:Gp(e.slotBehaviours),apis:c}},W_=le({getSlotNames:(e,t)=>e.getSlotNames(t),getSlot:(e,t,o)=>e.getSlot(t,o),isShowing:(e,t,o)=>e.isShowing(t,o),hideSlot:(e,t,o)=>e.hideSlot(t,o),hideAllSlots:(e,t)=>e.hideAllSlots(t),showSlot:(e,t,o)=>e.showSlot(t,o)},e=>Sh(e)),q_={...W_,sketch:e=>{const t=(()=>{const e=[];return{slot:(t,o)=>(e.push(t),sl(U_,$_(t),o)),record:w(e)}})(),o=e(t),n=t.record(),r=L(n,e=>Ka({name:e,pname:$_(e)}));return Qp(U_,Z_,r,j_,o)}},G_=w([Di("toggleClass"),Di("fetch"),ya("onExecute"),Ji("getHotspot",A.some),Ji("getAnchorOverrides",w({})),gf(),ya("onItemExecute"),$i("lazySink"),Di("dom"),va("onOpen"),qp("splitDropdownBehaviours",[Hm,_h,fd]),Ji("matchWidth",!1),Ji("useMinWidth",!1),Ji("eventOrder",{}),$i("role"),$i("listRole")].concat(_y())),Y_=Ka({factory:Tb,schema:[Di("dom")],name:"arrow",defaults:()=>({buttonBehaviours:id([fd.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(Pc)},buttonBehaviours:id([Yv.config({toggleOnExecute:!1,toggleClass:e.toggleClass})])})}),X_=Ka({factory:Tb,schema:[Di("dom")],name:"button",defaults:()=>({buttonBehaviours:id([fd.revoke()])}),overrides:e=>({dom:{tag:"span",attributes:{role:"presentation"}},action:t=>{t.getSystem().getByUid(e.uid).each(o=>{e.onExecute(o,t)})}})}),K_=w([Y_,X_,Qa({factory:{sketch:e=>({uid:e.uid,dom:{tag:"span",styles:{display:"none"},attributes:{"aria-hidden":"true"},innerHtml:e.text}})},schema:[Di("text")],name:"aria-descriptor"}),Ja({schema:[pa()],name:"menu",defaults:e=>({onExecute:(t,o)=>{t.getSystem().getByUid(e.uid).each(n=>{e.onItemExecute(n,t,o)})}})}),ly()]),J_=rg({name:"SplitDropdown",configFields:G_(),partFields:K_(),factory:(e,t,o,n)=>{const r=e=>{Im.getCurrent(e).each(e=>{jd.highlightFirst(e),_h.focusIn(e)})},i=t=>{fy(e,_,t,n,r,Ac.HighlightMenuAndItem).get(v)},s=t=>{const o=hl(t,e,"button");return Pc(o),A.some(!0)},a={...zc([Kc((t,o)=>{ul(t,e,"aria-descriptor").each(e=>{const o=Pe("aria");jo(e.element,"id",o),jo(t.element,"aria-describedby",o)})})]),...Sb(A.some(i))},l={repositionMenus:e=>{Yv.isOn(e)&&wy(e)}};return{uid:e.uid,dom:e.dom,components:t,apis:l,eventOrder:{...e.eventOrder,[Ps()]:["disabling","toggling","alloy.base.behaviour"]},events:a,behaviours:Yp(e.splitDropdownBehaviours,[Hm.config({others:{sandbox:t=>{const o=hl(t,e,"arrow");return yy(e,t,{onOpen:()=>{Yv.on(o),Yv.on(t)},onClose:()=>{Yv.off(o),Yv.off(t)}})}}}),_h.config({mode:"special",onSpace:s,onEnter:s,onDown:e=>(i(e),A.some(!0))}),fd.config({}),Yv.config({toggleOnExecute:!1,aria:{mode:"expanded"}})]),domModification:{attributes:{role:e.role.getOr("button"),"aria-haspopup":!0}}}},apis:{repositionMenus:(e,t)=>e.repositionMenus(t)}}),Q_=(e,t,o)=>({within:e,extra:t,withinWidth:o}),ex=(e,t,o)=>{const n=Z(e,(e,t)=>((e,t)=>{const n=o(e);return A.some({element:e,start:t,finish:t+n,width:n})})(t,e.len).fold(w(e),t=>({len:t.finish,list:e.list.concat([t])})),{len:0,list:[]}).list,r=H(n,e=>e.finish<=t),i=U(r,(e,t)=>e+t.width,0);return{within:r,extra:n.slice(r.length),withinWidth:i}},tx=e=>L(e,e=>e.element),ox=(e,t)=>{const o=L(t,e=>Mm(e));Ry.setGroups(e,o)},nx=(e,t,o)=>{const n=t.builtGroups.get();if(0===n.length)return;const r=hl(e,t,"primary"),i=Hm.getCoupled(e,"overflowGroup");dn(r.element,"visibility","hidden");const s=n.concat([i]),a=re(s,e=>Lo(e.element).bind(t=>e.getSystem().getByDom(t).toOptional()));o([]),ox(r,s);const l=((e,t,o,n)=>{const r=((e,t,o)=>{const n=ex(t,e,o);return 0===n.extra.length?A.some(n):A.none()})(e,t,o).getOrThunk(()=>ex(t,e-o(n),o)),i=r.within,s=r.extra,a=r.withinWidth;return 1===s.length&&s[0].width<=o(n)?((e,t,o)=>{const n=tx(e.concat(t));return Q_(n,[],o)})(i,s,a):s.length>=1?((e,t,o,n)=>{const r=tx(e).concat([o]);return Q_(r,tx(t),n)})(i,s,n,a):((e,t,o)=>Q_(tx(e),[],o))(i,0,a)})(En(r.element),t.builtGroups.get(),e=>Math.ceil(e.element.dom.getBoundingClientRect().width),i);0===l.extra.length?(Qh.remove(r,i),o([])):(ox(r,l.within),o(l.extra)),bn(r.element,"visibility"),yn(r.element),a.each(fd.focus)},rx=w([qp("splitToolbarBehaviours",[Hm]),Ni("builtGroups",()=>we([]))]),ix=w([ga(["overflowToggledClass"]),Yi("getOverflowBounds"),Di("lazySink"),Ni("overflowGroups",()=>we([])),va("onOpened"),va("onClosed")].concat(rx())),sx=w([Ka({factory:Ry,schema:My(),name:"primary"}),Ja({schema:My(),name:"overflow"}),Ja({name:"overflow-button"}),Ja({name:"overflow-group"})]),ax=w([Di("items"),ga(["itemSelector"]),qp("tgroupBehaviours",[_h])]),lx=w([el({name:"items",unit:"item"})]),cx=rg({name:"ToolbarGroup",configFields:ax(),partFields:lx(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,behaviours:Yp(e.tgroupBehaviours,[_h.config({mode:"flow",selector:e.markers.itemSelector})]),domModification:{attributes:{role:"toolbar"}}})}),dx=e=>L(e,e=>Mm(e)),ux=(e,t,o)=>{nx(e,o,n=>{o.overflowGroups.set(n),t.getOpt(e).each(e=>{Fy.setGroups(e,dx(n))})})},hx=rg({name:"SplitFloatingToolbar",configFields:ix(),partFields:sx(),factory:(e,t,o,n)=>{const r=db(Fy.sketch({fetch:()=>Se(t=>{t(dx(e.overflowGroups.get()))}),layouts:{onLtr:()=>[Ul,Hl],onRtl:()=>[Hl,Ul],onBottomLtr:()=>[$l,Zl],onBottomRtl:()=>[Zl,$l]},getBounds:o.getOverflowBounds,lazySink:e.lazySink,fireDismissalEventInstead:{},markers:{toggledClass:e.markers.overflowToggledClass},parts:{button:n["overflow-button"](),toolbar:n.overflow()},onToggled:(t,o)=>e[o?"onOpened":"onClosed"](t)}));return{uid:e.uid,dom:e.dom,components:t,behaviours:Yp(e.splitToolbarBehaviours,[Hm.config({others:{overflowGroup:()=>cx.sketch({...n["overflow-group"](),items:[r.asSpec()]})}})]),apis:{setGroups:(t,o)=>{e.builtGroups.set(L(o,t.getSystem().build)),ux(t,r,e)},refresh:t=>ux(t,r,e),toggle:e=>{r.getOpt(e).each(e=>{Fy.toggle(e)})},toggleWithoutFocusing:e=>{r.getOpt(e).each(Fy.toggleWithoutFocusing)},isOpen:e=>r.getOpt(e).map(Fy.isOpen).getOr(!1),reposition:e=>{r.getOpt(e).each(e=>{Fy.reposition(e)})},getOverflow:e=>r.getOpt(e).bind(Fy.getToolbar)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},reposition:(e,t)=>{e.reposition(t)},toggle:(e,t)=>{e.toggle(t)},toggleWithoutFocusing:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t),getOverflow:(e,t)=>e.getOverflow(t)}}),mx=w([ga(["closedClass","openClass","shrinkingClass","growingClass","overflowToggledClass"]),va("onOpened"),va("onClosed")].concat(rx())),px=w([Ka({factory:Ry,schema:My(),name:"primary"}),Ka({factory:Ry,schema:My(),name:"overflow",overrides:e=>({toolbarBehaviours:id([Nv.config({dimension:{property:"height"},closedClass:e.markers.closedClass,openClass:e.markers.openClass,shrinkingClass:e.markers.shrinkingClass,growingClass:e.markers.growingClass,onShrunk:t=>{ul(t,e,"overflow-button").each(e=>{Yv.off(e)}),e.onClosed(t)},onGrown:t=>{e.onOpened(t)},onStartGrow:t=>{ul(t,e,"overflow-button").each(Yv.on)}}),_h.config({mode:"acyclic",onEscape:t=>(ul(t,e,"overflow-button").each(fd.focus),A.some(!0))})])})}),Ja({name:"overflow-button",overrides:e=>({buttonBehaviours:id([Yv.config({toggleClass:e.markers.overflowToggledClass,aria:{mode:"expanded"},toggleOnExecute:!1})])})}),Ja({name:"overflow-group"})]),gx=(e,t,o)=>{ul(e,t,"overflow-button").each(n=>{ul(e,t,"overflow").each(r=>{if(fx(e,t),Nv.hasShrunk(r)){const e=t.onOpened;t.onOpened=n=>{o||_h.focusIn(r),e(n),t.onOpened=e}}else{const e=t.onClosed;t.onClosed=r=>{o||fd.focus(n),e(r),t.onClosed=e}}Nv.toggleGrow(r)})})},fx=(e,t)=>{ul(e,t,"overflow").each(o=>{nx(e,t,e=>{const t=L(e,e=>Mm(e));Ry.setGroups(o,t)}),ul(e,t,"overflow-button").each(e=>{Nv.hasGrown(o)&&Yv.on(e)}),Nv.refresh(o)})},vx=rg({name:"SplitSlidingToolbar",configFields:mx(),partFields:px(),factory:(e,t,o,n)=>{const r="alloy.toolbar.toggle";return{uid:e.uid,dom:e.dom,components:t,behaviours:Yp(e.splitToolbarBehaviours,[Hm.config({others:{overflowGroup:e=>cx.sketch({...n["overflow-group"](),items:[Tb.sketch({...n["overflow-button"](),action:t=>{Vc(e,r)}})]})}}),ud("toolbar-toggle-events",[Zc(r,t=>{gx(t,e,!1)})])]),apis:{setGroups:(t,o)=>{((t,o)=>{const n=L(o,t.getSystem().build);e.builtGroups.set(n)})(t,o),fx(t,e)},refresh:t=>fx(t,e),toggle:t=>{gx(t,e,!1)},toggleWithoutFocusing:t=>{gx(t,e,!0)},isOpen:t=>((e,t)=>ul(e,t,"overflow").map(Nv.hasGrown).getOr(!1))(t,e)},domModification:{attributes:{role:"group"}}}},apis:{setGroups:(e,t,o)=>{e.setGroups(t,o)},refresh:(e,t)=>{e.refresh(t)},toggle:(e,t)=>{e.toggle(t)},isOpen:(e,t)=>e.isOpen(t)}}),bx=ng({name:"TabButton",configFields:[Ji("uid",void 0),Di("value"),Ri("dom","dom",ci(()=>({attributes:{role:"tab",id:Pe("aria"),"aria-selected":"false"}})),Qr()),$i("action"),Ji("domModification",{}),qp("tabButtonBehaviours",[fd,_h,Yg]),Di("view")],factory:(e,t)=>({uid:e.uid,dom:e.dom,components:e.components,events:Sb(e.action),behaviours:Yp(e.tabButtonBehaviours,[fd.config({}),_h.config({mode:"execution",useSpace:!0,useEnter:!0}),Yg.config({store:{mode:"memory",initialValue:e.value}})]),domModification:e.domModification})}),yx=w([Di("tabs"),Di("dom"),Ji("clickToDismiss",!1),qp("tabbarBehaviours",[jd,_h]),ga(["tabClass","selectedClass"])]),wx=el({factory:bx,name:"tabs",unit:"tab",overrides:e=>{const t=(e,t)=>{jd.dehighlight(e,t),Dc(e,ta(),{tabbar:e,button:t})},o=(e,t)=>{jd.highlight(e,t),Dc(e,ea(),{tabbar:e,button:t})};return{action:n=>{const r=n.getSystem().getByUid(e.uid).getOrDie(),i=jd.isHighlighted(r,n);(i&&e.clickToDismiss?t:i?v:o)(r,n)},domModification:{classes:[e.markers.tabClass]}}}}),_x=w([wx]),xx=rg({name:"Tabbar",configFields:yx(),partFields:_x(),factory:(e,t,o,n)=>({uid:e.uid,dom:e.dom,components:t,"debug.sketcher":"Tabbar",domModification:{attributes:{role:"tablist"}},behaviours:Yp(e.tabbarBehaviours,[jd.config({highlightClass:e.markers.selectedClass,itemClass:e.markers.tabClass,onHighlight:(e,t)=>{jo(t.element,"aria-selected","true")},onDehighlight:(e,t)=>{jo(t.element,"aria-selected","false")}}),_h.config({mode:"flow",getInitial:e=>jd.getHighlighted(e).map(e=>e.element),selector:"."+e.markers.tabClass,executeOnMove:!0})])})}),Cx=ng({name:"Tabview",configFields:[qp("tabviewBehaviours",[Qh])],factory:(e,t)=>({uid:e.uid,dom:e.dom,behaviours:Yp(e.tabviewBehaviours,[Qh.config({})]),domModification:{attributes:{role:"tabpanel"}}})}),kx=w([Ji("selectFirst",!0),va("onChangeTab"),va("onDismissTab"),Ji("tabs",[]),qp("tabSectionBehaviours",[])]),Sx=Ka({factory:xx,schema:[Di("dom"),Hi("markers",[Di("tabClass"),Di("selectedClass")])],name:"tabbar",defaults:e=>({tabs:e.tabs})}),Tx=Ka({factory:Cx,name:"tabview"}),Ex=w([Sx,Tx]),Ox=rg({name:"TabSection",configFields:kx(),partFields:Ex(),factory:(e,t,o,n)=>{const r=(t,o)=>{ul(t,e,"tabbar").each(e=>{o(e).each(Pc)})};return{uid:e.uid,dom:e.dom,components:t,behaviours:Gp(e.tabSectionBehaviours),events:zc(W([e.selectFirst?[Kc((e,t)=>{r(e,jd.getFirst)})]:[],[Zc(ea(),(t,o)=>{(t=>{const o=Yg.getValue(t);ul(t,e,"tabview").each(n=>{$(e.tabs,e=>e.value===o).each(o=>{const r=o.view();Go(t.element,"id").each(e=>{jo(n.element,"aria-labelledby",e)}),Qh.set(n,r),e.onChangeTab(n,t,r)})})})(o.event.button)}),Zc(ta(),(t,o)=>{const n=o.event.button;e.onDismissTab(t,n)})]])),apis:{getViewItems:t=>ul(t,e,"tabview").map(e=>Qh.contents(e)).getOr([]),showTab:(e,t)=>{r(e,e=>{const o=jd.getCandidates(e);return $(o,e=>Yg.getValue(e)===t).filter(t=>!jd.isHighlighted(e,t))})}}}},apis:{getViewItems:(e,t)=>e.getViewItems(t),showTab:(e,t,o)=>{e.showTab(t,o)}}}),Ax=(e,t,o)=>{const n=Yg.getValue(o);Yg.setValue(t,n),Bx(t)},Mx=(e,t)=>{const o=e.element,n=cr(o),r=o.dom;"number"!==qo(o,"type")&&t(r,n)},Bx=e=>{Mx(e,(e,t)=>e.setSelectionRange(t.length,t.length))},Rx=w("alloy.typeahead.itemexecute"),Nx=w([$i("lazySink"),Di("fetch"),Ji("minChars",5),Ji("responseTime",1e3),va("onOpen"),Ji("getHotspot",A.some),Ji("getAnchorOverrides",w({})),Ji("layouts",A.none()),Ji("eventOrder",{}),ss("model",{},[Ji("getDisplayText",e=>void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.value),Ji("selectsOver",!0),Ji("populateFromBrowse",!0)]),va("onSetValue"),ba("onExecute"),va("onItemExecute"),Ji("inputClasses",[]),Ji("inputAttributes",{}),Ji("inputStyles",{}),Ji("matchWidth",!0),Ji("useMinWidth",!1),Ji("dismissOnBlur",!0),ga(["openClass"]),$i("initialData"),$i("listRole"),qp("typeaheadBehaviours",[fd,Yg,Lv,_h,Yv,Hm]),Ni("lazyTypeaheadComp",()=>we(A.none)),Ni("previewing",()=>we(!0))].concat(Yy()).concat(_y())),Vx=w([Ja({schema:[pa()],name:"menu",overrides:e=>({fakeFocus:!0,onHighlightItem:(t,o,n)=>{e.previewing.get()?e.lazyTypeaheadComp.get().each(t=>{((e,t,o)=>{if(e.selectsOver){const n=Yg.getValue(t),r=e.getDisplayText(n),i=Yg.getValue(o);return 0===e.getDisplayText(i).indexOf(r)?A.some(()=>{Ax(0,t,o),((e,t)=>{Mx(e,(e,o)=>e.setSelectionRange(t,o.length))})(t,r.length)}):A.none()}return A.none()})(e.model,t,n).fold(()=>{e.model.selectsOver?(jd.dehighlight(o,n),e.previewing.set(!0)):e.previewing.set(!1)},t=>{t(),e.previewing.set(!1)})}):e.lazyTypeaheadComp.get().each(t=>{e.model.populateFromBrowse&&Ax(e.model,t,n),Go(n.element,"id").each(e=>jo(t.element,"aria-activedescendant",e))})},onExecute:(t,o)=>e.lazyTypeaheadComp.get().map(e=>(Dc(e,Rx(),{item:o}),!0)),onHover:(t,o)=>{e.previewing.set(!1),e.lazyTypeaheadComp.get().each(t=>{e.model.populateFromBrowse&&Ax(e.model,t,o)})}})})]),Dx=rg({name:"Typeahead",configFields:Nx(),partFields:Vx(),factory:(e,t,o,n)=>{const r=(t,o,r)=>{e.previewing.set(!1);const i=Hm.getCoupled(t,"sandbox");if(vv.isOpen(i))Im.getCurrent(i).each(e=>{jd.getHighlighted(e).fold(()=>{r(e)},()=>{Fc(i,e.element,"keydown",o)})});else{const o=e=>{Im.getCurrent(e).each(r)};py(e,s(t),t,i,n,o,Ac.HighlightMenuAndItem).get(v)}},i=Xy(e),s=e=>t=>t.map(t=>{const o=ge(t.menus),n=q(o,e=>H(e.items,e=>"item"===e.type));return Yg.getState(e).update(L(n,e=>e.data)),t}),a=e=>Im.getCurrent(e),l="typeaheadevents",c=[fd.config({}),Yg.config({onSetValue:e.onSetValue,store:{mode:"dataset",getDataKey:e=>cr(e.element),getFallbackEntry:e=>({value:e,meta:{}}),setValue:(t,o)=>{dr(t.element,e.model.getDisplayText(o))},...e.initialData.map(e=>as("initialValue",e)).getOr({})}}),Lv.config({stream:{mode:"throttle",delay:e.responseTime,stopEvent:!1},onStream:(t,o)=>{const r=Hm.getCoupled(t,"sandbox");if(fd.isFocused(t)&&cr(t.element).length>=e.minChars){const o=a(r).bind(e=>jd.getHighlighted(e).map(Yg.getValue));e.previewing.set(!0);const i=t=>{a(r).each(t=>{o.fold(()=>{e.model.selectsOver&&jd.highlightFirst(t)},e=>{jd.highlightBy(t,t=>Yg.getValue(t).value===e.value),jd.getHighlighted(t).orThunk(()=>(jd.highlightFirst(t),A.none()))})})};py(e,s(t),t,r,n,i,Ac.HighlightJustMenu).get(v)}},cancelEvent:Hs()}),_h.config({mode:"special",onDown:(e,t)=>(r(e,t,jd.highlightFirst),A.some(!0)),onEscape:e=>{const t=Hm.getCoupled(e,"sandbox");return vv.isOpen(t)?(vv.close(t),A.some(!0)):A.none()},onUp:(e,t)=>(r(e,t,jd.highlightLast),A.some(!0)),onEnter:t=>{const o=Hm.getCoupled(t,"sandbox"),n=vv.isOpen(o);if(n&&!e.previewing.get())return a(o).bind(e=>jd.getHighlighted(e)).map(e=>(Dc(t,Rx(),{item:e}),!0));{const r=Yg.getValue(t);return Vc(t,Hs()),e.onExecute(o,t,r),n&&vv.close(o),A.some(!0)}}}),Yv.config({toggleClass:e.markers.openClass,aria:{mode:"expanded"}}),Hm.config({others:{sandbox:t=>yy(e,t,{onOpen:()=>Yv.on(t),onClose:()=>{e.lazyTypeaheadComp.get().each(e=>Xo(e.element,"aria-activedescendant")),Yv.off(t)}})}}),ud(l,[Kc(t=>{e.lazyTypeaheadComp.set(A.some(t))}),Jc(t=>{e.lazyTypeaheadComp.set(A.none())}),ed(t=>{const o=v;fy(e,s(t),t,n,o,Ac.HighlightMenuAndItem).get(v)}),Zc(Rx(),(t,o)=>{const n=Hm.getCoupled(t,"sandbox");Ax(e.model,t,o.event.item),Vc(t,Hs()),e.onItemExecute(t,n,o.event.item,Yg.getValue(t)),vv.close(n),Bx(t)})].concat(e.dismissOnBlur?[Zc(Ns(),e=>{const t=Hm.getCoupled(e,"sandbox");Lo(t.element).isNone()&&vv.close(t)})]:[]))],d={[Gs()]:[Yg.name(),Lv.name(),l],...e.eventOrder};return{uid:e.uid,dom:Jy(Le(e,{inputAttributes:{role:"combobox","aria-autocomplete":"list","aria-haspopup":"true"}})),behaviours:{...i,...Yp(e.typeaheadBehaviours,c)},eventOrder:d}}});var Px,Ix,Lx=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.ThemeManager"),Fx=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.Delay"),zx=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.dom.DOMUtils"),Hx=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.EditorManager"),Ux=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.Env");!function(e){e.default="wrap",e.floating="floating",e.sliding="sliding",e.scrolling="scrolling"}(Px||(Px={})),function(e){e.auto="auto",e.top="top",e.bottom="bottom"}(Ix||(Ix={}));const Zx=e=>t=>t.options.get(e),$x=e=>t=>A.from(e(t)),jx=e=>{const t=Ux.deviceType.isPhone(),o=Ux.deviceType.isTablet()||t,n=e.options.register,r=e=>i(e)||!1===e,s=e=>i(e)||g(e);n("skin",{processor:e=>i(e)||!1===e,default:"oxide"}),n("skin_url",{processor:"string"}),n("height",{processor:s,default:Math.max(e.getElement().offsetHeight,400)}),n("width",{processor:s,default:zx.DOM.getStyle(e.getElement(),"width")}),n("min_height",{processor:"number",default:100}),n("min_width",{processor:"number"}),n("max_height",{processor:"number"}),n("max_width",{processor:"number"}),n("style_formats",{processor:"object[]"}),n("style_formats_merge",{processor:"boolean",default:!1}),n("style_formats_autohide",{processor:"boolean",default:!1}),n("line_height_formats",{processor:"string",default:"1 1.1 1.2 1.3 1.4 1.5 2"}),n("font_family_formats",{processor:"string",default:"Andale Mono=andale mono,monospace;Arial=arial,helvetica,sans-serif;Arial Black=arial black,sans-serif;Book Antiqua=book antiqua,palatino,serif;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,palatino,serif;Helvetica=helvetica,arial,sans-serif;Impact=impact,sans-serif;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco,monospace;Times New Roman=times new roman,times,serif;Trebuchet MS=trebuchet ms,geneva,sans-serif;Verdana=verdana,geneva,sans-serif;Webdings=webdings;Wingdings=wingdings,zapf dingbats"}),n("font_size_formats",{processor:"string",default:"8pt 10pt 12pt 14pt 18pt 24pt 36pt"}),n("font_size_input_default_unit",{processor:"string",default:"pt"}),n("block_formats",{processor:"string",default:"Paragraph=p;Heading 1=h1;Heading 2=h2;Heading 3=h3;Heading 4=h4;Heading 5=h5;Heading 6=h6;Preformatted=pre"}),n("content_langs",{processor:"object[]"}),n("removed_menuitems",{processor:"string",default:""}),n("menubar",{processor:e=>i(e)||d(e),default:!t}),n("menu",{processor:"object",default:{}}),n("toolbar",{processor:e=>d(e)||i(e)||l(e)?{value:e,valid:!0}:{valid:!1,message:"Must be a boolean, string or array."},default:!0}),P(9,e=>{n("toolbar"+(e+1),{processor:"string"})}),n("toolbar_mode",{processor:"string",default:o?"scrolling":"floating"}),n("toolbar_groups",{processor:"object",default:{}}),n("toolbar_location",{processor:"string",default:Ix.auto}),n("toolbar_persist",{processor:"boolean",default:!1}),n("toolbar_sticky",{processor:"boolean",default:e.inline}),n("toolbar_sticky_offset",{processor:"number",default:0}),n("fixed_toolbar_container",{processor:"string",default:""}),n("fixed_toolbar_container_target",{processor:"object"}),n("ui_mode",{processor:"string",default:"combined"}),n("file_picker_callback",{processor:"function"}),n("file_picker_validator_handler",{processor:"function"}),n("file_picker_types",{processor:"string"}),n("typeahead_urls",{processor:"boolean",default:!0}),n("anchor_top",{processor:r,default:"#top"}),n("anchor_bottom",{processor:r,default:"#bottom"}),n("draggable_modal",{processor:"boolean",default:!1}),n("statusbar",{processor:"boolean",default:!0}),n("elementpath",{processor:"boolean",default:!0}),n("branding",{processor:"boolean",default:!0}),n("promotion",{processor:"boolean",default:!0}),n("resize",{processor:e=>"both"===e||d(e),default:!Ux.deviceType.isTouch()}),n("sidebar_show",{processor:"string"}),n("help_accessibility",{processor:"boolean",default:e.hasPlugin("help")}),n("default_font_stack",{processor:"string[]",default:[]})},Wx=Zx("readonly"),qx=Zx("disabled"),Gx=Zx("height"),Yx=Zx("width"),Xx=$x(Zx("min_width")),Kx=$x(Zx("min_height")),Jx=$x(Zx("max_width")),Qx=$x(Zx("max_height")),eC=$x(Zx("style_formats")),tC=Zx("style_formats_merge"),oC=Zx("style_formats_autohide"),nC=Zx("content_langs"),rC=Zx("removed_menuitems"),iC=Zx("toolbar_mode"),sC=Zx("toolbar_groups"),aC=Zx("toolbar_location"),lC=Zx("fixed_toolbar_container"),cC=Zx("fixed_toolbar_container_target"),dC=Zx("toolbar_persist"),uC=Zx("toolbar_sticky_offset"),hC=Zx("menubar"),mC=Zx("toolbar"),pC=Zx("file_picker_callback"),gC=Zx("file_picker_validator_handler"),fC=Zx("font_size_input_default_unit"),vC=Zx("file_picker_types"),bC=Zx("typeahead_urls"),yC=Zx("anchor_top"),wC=Zx("anchor_bottom"),_C=Zx("draggable_modal"),xC=Zx("statusbar"),CC=Zx("elementpath"),kC=Zx("branding"),SC=Zx("resize"),TC=Zx("paste_as_text"),EC=Zx("sidebar_show"),OC=Zx("promotion"),AC=Zx("help_accessibility"),MC=Zx("default_font_stack"),BC=Zx("skin"),RC=e=>!1===e.options.get("skin"),NC=e=>!1!==e.options.get("menubar"),VC=e=>{const t=e.options.get("skin_url");if(RC(e))return t;if(t)return e.documentBaseURI.toAbsolute(t);{const t=e.options.get("skin");return Hx.baseURL+"/skins/ui/"+t}},DC=e=>e.options.get("line_height_formats").split(" "),PC=e=>{const t=mC(e),o=i(t),n=l(t)&&t.length>0;return!LC(e)&&(n||o||!0===t)},IC=e=>{const t=P(9,t=>e.options.get("toolbar"+(t+1))),o=H(t,i);return $e(o.length>0,o)},LC=e=>IC(e).fold(()=>{const t=mC(e);return f(t,i)&&t.length>0},O),FC=e=>aC(e)===Ix.bottom,zC=e=>{var t;if(!e.inline)return A.none();const o=null!==(t=lC(e))&&void 0!==t?t:"";if(o.length>0)return Gn(sn(),o);const n=cC(e);return m(n)?A.some(ct(n)):A.none()},HC=e=>e.inline&&zC(e).isSome(),UC=e=>zC(e).getOrThunk(()=>Co(xo(ct(e.getElement())))),ZC=e=>e.inline&&!NC(e)&&!PC(e)&&!LC(e),$C=e=>(e.options.get("toolbar_sticky")||e.inline)&&!HC(e)&&!ZC(e),jC=e=>!HC(e)&&"split"===e.options.get("ui_mode"),WC=e=>{const t=e.options.get("menu");return le(t,e=>({...e,items:e.items}))};var qC=Object.freeze({__proto__:null,get ToolbarMode(){return Px},get ToolbarLocation(){return Ix},register:jx,getSkinUrl:VC,getSkinUrlOption:e=>A.from(e.options.get("skin_url")),isReadOnly:Wx,isDisabled:qx,getSkin:BC,isSkinDisabled:RC,getHeightOption:Gx,getWidthOption:Yx,getMinWidthOption:Xx,getMinHeightOption:Kx,getMaxWidthOption:Jx,getMaxHeightOption:Qx,getUserStyleFormats:eC,shouldMergeStyleFormats:tC,shouldAutoHideStyleFormats:oC,getLineHeightFormats:DC,getContentLanguages:nC,getRemovedMenuItems:rC,isMenubarEnabled:NC,isMultipleToolbars:LC,isToolbarEnabled:PC,isToolbarPersist:dC,getMultipleToolbarsOption:IC,getUiContainer:UC,useFixedContainer:HC,isSplitUiMode:jC,getToolbarMode:iC,isDraggableModal:_C,isDistractionFree:ZC,isStickyToolbar:$C,getStickyToolbarOffset:uC,getToolbarLocation:aC,isToolbarLocationBottom:FC,getToolbarGroups:sC,getMenus:WC,getMenubar:hC,getToolbar:mC,getFilePickerCallback:pC,getFilePickerTypes:vC,useTypeaheadUrls:bC,getAnchorTop:yC,getAnchorBottom:wC,getFilePickerValidatorHandler:gC,getFontSizeInputDefaultUnit:fC,useStatusBar:xC,useElementPath:CC,promotionEnabled:OC,useBranding:kC,getResize:SC,getPasteAsText:TC,getSidebarShow:EC,useHelpAccessibility:AC,getDefaultFontStack:MC});const GC=["visible","hidden","clip"],YC=e=>et(e).length>0&&!V(GC,e),XC=e=>{if(oo(e)){const t=mn(e,"overflow-x"),o=mn(e,"overflow-y");return YC(t)||YC(o)}return!1},KC=e=>e.plugins.fullscreen&&e.plugins.fullscreen.isFullscreen(),JC=(e,t)=>jC(e)?((e,t)=>{const o=ur(t,XC),n=0===o.length?ko(t).map(So).map(e=>ur(e,XC)).getOr([]):o;return te(n).map(t=>({element:t,others:n.slice(1),isFullscreen:()=>KC(e)}))})(e,t):A.none(),QC=e=>{const t=[...L(e.others,Dr),Lr()];return e.isFullscreen()?Lr():((e,t)=>Z(t,(e,t)=>Ir(e,t),e))(Dr(e.element),t)},{entries:ek,setPrototypeOf:tk,isFrozen:ok,getPrototypeOf:nk,getOwnPropertyDescriptor:rk}=Object;let{freeze:ik,seal:sk,create:ak}=Object,{apply:lk,construct:ck}="undefined"!=typeof Reflect&&Reflect;ik||(ik=function(e){return e}),sk||(sk=function(e){return e}),lk||(lk=function(e,t,o){return e.apply(t,o)}),ck||(ck=function(e,t){return new e(...t)});const dk=Sk(Array.prototype.forEach),uk=Sk(Array.prototype.lastIndexOf),hk=Sk(Array.prototype.pop),mk=Sk(Array.prototype.push),pk=Sk(Array.prototype.splice),gk=Sk(String.prototype.toLowerCase),fk=Sk(String.prototype.toString),vk=Sk(String.prototype.match),bk=Sk(String.prototype.replace),yk=Sk(String.prototype.indexOf),wk=Sk(String.prototype.trim),_k=Sk(Object.prototype.hasOwnProperty),xk=Sk(RegExp.prototype.test),Ck=(kk=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return ck(kk,t)});var kk;function Sk(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return lk(e,t,n)}}function Tk(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gk;tk&&tk(e,null);let n=t.length;for(;n--;){let r=t[n];if("string"==typeof r){const e=o(r);e!==r&&(ok(t)||(t[n]=e),r=e)}e[r]=!0}return e}function Ek(e){for(let t=0;t<e.length;t++)_k(e,t)||(e[t]=null);return e}function Ok(e){const t=ak(null);for(const[o,n]of ek(e))_k(e,o)&&(Array.isArray(n)?t[o]=Ek(n):n&&"object"==typeof n&&n.constructor===Object?t[o]=Ok(n):t[o]=n);return t}function Ak(e,t){for(;null!==e;){const o=rk(e,t);if(o){if(o.get)return Sk(o.get);if("function"==typeof o.value)return Sk(o.value)}e=nk(e)}return function(){return null}}const Mk=ik(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Bk=ik(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Rk=ik(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Nk=ik(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Vk=ik(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Dk=ik(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Pk=ik(["#text"]),Ik=ik(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Lk=ik(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Fk=ik(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zk=ik(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Hk=sk(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Uk=sk(/<%[\w\W]*|[\w\W]*%>/gm),Zk=sk(/\$\{[\w\W]*/gm),$k=sk(/^data-[\-\w.\u00B7-\uFFFF]+$/),jk=sk(/^aria-[\-\w]+$/),Wk=sk(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qk=sk(/^(?:\w+script|data):/i),Gk=sk(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Yk=sk(/^html$/i),Xk=sk(/^[a-z][.\w]*(-[.\w]+)+$/i);var Kk=Object.freeze({__proto__:null,ARIA_ATTR:jk,ATTR_WHITESPACE:Gk,CUSTOM_ELEMENT:Xk,DATA_ATTR:$k,DOCTYPE_NAME:Yk,ERB_EXPR:Uk,IS_ALLOWED_URI:Wk,IS_SCRIPT_OR_DATA:qk,MUSTACHE_EXPR:Hk,TMPLIT_EXPR:Zk});const Jk=function(){return"undefined"==typeof window?null:window};var Qk=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Jk();const o=t=>e(t);if(o.version="3.2.6",o.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return o.isSupported=!1,o;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:m,trustedTypes:p}=t,g=c.prototype,f=Ak(g,"cloneNode"),v=Ak(g,"remove"),b=Ak(g,"nextSibling"),y=Ak(g,"childNodes"),w=Ak(g,"parentNode");if("function"==typeof a){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let _,x="";const{implementation:C,createNodeIterator:k,createDocumentFragment:S,getElementsByTagName:T}=n,{importNode:E}=r;let O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};o.isSupported="function"==typeof ek&&"function"==typeof w&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:M,TMPLIT_EXPR:B,DATA_ATTR:R,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:V,ATTR_WHITESPACE:D,CUSTOM_ELEMENT:P}=Kk;let{IS_ALLOWED_URI:I}=Kk,L=null;const F=Tk({},[...Mk,...Bk,...Rk,...Vk,...Pk]);let z=null;const H=Tk({},[...Ik,...Lk,...Fk,...zk]);let U=Object.seal(ak(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Z=null,$=null,j=!0,W=!0,q=!1,G=!0,Y=!1,X=!0,K=!1,J=!1,Q=!1,ee=!1,te=!1,oe=!1,ne=!0,re=!1,ie=!0,se=!1,ae={},le=null;const ce=Tk({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const ue=Tk({},["audio","video","img","source","image","track"]);let he=null;const me=Tk({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let ve=fe,be=!1,ye=null;const we=Tk({},[pe,ge,fe],fk);let _e=Tk({},["mi","mo","mn","ms","mtext"]),xe=Tk({},["annotation-xml"]);const Ce=Tk({},["title","style","font","a","script"]);let ke=null;const Se=["application/xhtml+xml","text/html"];let Te=null,Ee=null;const Oe=n.createElement("form"),Ae=function(e){return e instanceof RegExp||e instanceof Function},Me=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=Ok(e),ke=-1===Se.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Te="application/xhtml+xml"===ke?fk:gk,L=_k(e,"ALLOWED_TAGS")?Tk({},e.ALLOWED_TAGS,Te):F,z=_k(e,"ALLOWED_ATTR")?Tk({},e.ALLOWED_ATTR,Te):H,ye=_k(e,"ALLOWED_NAMESPACES")?Tk({},e.ALLOWED_NAMESPACES,fk):we,he=_k(e,"ADD_URI_SAFE_ATTR")?Tk(Ok(me),e.ADD_URI_SAFE_ATTR,Te):me,de=_k(e,"ADD_DATA_URI_TAGS")?Tk(Ok(ue),e.ADD_DATA_URI_TAGS,Te):ue,le=_k(e,"FORBID_CONTENTS")?Tk({},e.FORBID_CONTENTS,Te):ce,Z=_k(e,"FORBID_TAGS")?Tk({},e.FORBID_TAGS,Te):Ok({}),$=_k(e,"FORBID_ATTR")?Tk({},e.FORBID_ATTR,Te):Ok({}),ae=!!_k(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,X=!1!==e.SAFE_FOR_XML,K=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,ne=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||Wk,ve=e.NAMESPACE||fe,_e=e.MATHML_TEXT_INTEGRATION_POINTS||_e,xe=e.HTML_INTEGRATION_POINTS||xe,U=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(U.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(W=!1),te&&(ee=!0),ae&&(L=Tk({},Pk),z=[],!0===ae.html&&(Tk(L,Mk),Tk(z,Ik)),!0===ae.svg&&(Tk(L,Bk),Tk(z,Lk),Tk(z,zk)),!0===ae.svgFilters&&(Tk(L,Rk),Tk(z,Lk),Tk(z,zk)),!0===ae.mathMl&&(Tk(L,Vk),Tk(z,Fk),Tk(z,zk))),e.ADD_TAGS&&(L===F&&(L=Ok(L)),Tk(L,e.ADD_TAGS,Te)),e.ADD_ATTR&&(z===H&&(z=Ok(z)),Tk(z,e.ADD_ATTR,Te)),e.ADD_URI_SAFE_ATTR&&Tk(he,e.ADD_URI_SAFE_ATTR,Te),e.FORBID_CONTENTS&&(le===ce&&(le=Ok(le)),Tk(le,e.FORBID_CONTENTS,Te)),ie&&(L["#text"]=!0),K&&Tk(L,["html","head","body"]),L.table&&(Tk(L,["tbody"]),delete Z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Ck('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Ck('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=e.TRUSTED_TYPES_POLICY,x=_.createHTML("")}else void 0===_&&(_=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(p,i)),null!==_&&"string"==typeof x&&(x=_.createHTML(""));ik&&ik(e),Ee=e}},Be=Tk({},[...Bk,...Rk,...Nk]),Re=Tk({},[...Vk,...Dk]),Ne=function(e){mk(o.removed,{element:e});try{w(e).removeChild(e)}catch(t){v(e)}},Ve=function(e,t){try{mk(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){mk(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},De=function(e){let t=null,o=null;if(Q)e="<remove></remove>"+e;else{const t=vk(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===ke&&ve===fe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=_?_.createHTML(e):e;if(ve===fe)try{t=(new m).parseFromString(r,ke)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(ve,"template",null);try{t.documentElement.innerHTML=be?x:r}catch(e){}}const i=t.body||t.documentElement;return e&&o&&i.insertBefore(n.createTextNode(o),i.childNodes[0]||null),ve===fe?T.call(t,K?"html":"body")[0]:K?t.documentElement:i},Pe=function(e){return k.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ie=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Le=function(e){return"function"==typeof l&&e instanceof l};function Fe(e,t,n){dk(e,e=>{e.call(o,t,n,Ee)})}const ze=function(e){let t=null;if(Fe(O.beforeSanitizeElements,e,null),Ie(e))return Ne(e),!0;const n=Te(e.nodeName);if(Fe(O.uponSanitizeElement,e,{tagName:n,allowedTags:L}),X&&e.hasChildNodes()&&!Le(e.firstElementChild)&&xk(/<[/\w!]/g,e.innerHTML)&&xk(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(7===e.nodeType)return Ne(e),!0;if(X&&8===e.nodeType&&xk(/<[/\w]/g,e.data))return Ne(e),!0;if(!L[n]||Z[n]){if(!Z[n]&&Ue(n)){if(U.tagNameCheck instanceof RegExp&&xk(U.tagNameCheck,n))return!1;if(U.tagNameCheck instanceof Function&&U.tagNameCheck(n))return!1}if(ie&&!le[n]){const t=w(e)||e.parentNode,o=y(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n){const r=f(o[n],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}return Ne(e),!0}return e instanceof c&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ve,tagName:"template"});const o=gk(e.tagName),n=gk(t.tagName);return!!ye[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===fe?"svg"===o:t.namespaceURI===pe?"svg"===o&&("annotation-xml"===n||_e[n]):Boolean(Be[o]):e.namespaceURI===pe?t.namespaceURI===fe?"math"===o:t.namespaceURI===ge?"math"===o&&xe[n]:Boolean(Re[o]):e.namespaceURI===fe?!(t.namespaceURI===ge&&!xe[n])&&!(t.namespaceURI===pe&&!_e[n])&&!Re[o]&&(Ce[o]||!Be[o]):!("application/xhtml+xml"!==ke||!ye[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!xk(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&3===e.nodeType&&(t=e.textContent,dk([A,M,B],e=>{t=bk(t,e," ")}),e.textContent!==t&&(mk(o.removed,{element:e.cloneNode()}),e.textContent=t)),Fe(O.afterSanitizeElements,e,null),!1):(Ne(e),!0)},He=function(e,t,o){if(ne&&("id"===t||"name"===t)&&(o in n||o in Oe))return!1;if(W&&!$[t]&&xk(R,t));else if(j&&xk(N,t));else if(!z[t]||$[t]){if(!(Ue(e)&&(U.tagNameCheck instanceof RegExp&&xk(U.tagNameCheck,e)||U.tagNameCheck instanceof Function&&U.tagNameCheck(e))&&(U.attributeNameCheck instanceof RegExp&&xk(U.attributeNameCheck,t)||U.attributeNameCheck instanceof Function&&U.attributeNameCheck(t))||"is"===t&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&xk(U.tagNameCheck,o)||U.tagNameCheck instanceof Function&&U.tagNameCheck(o))))return!1}else if(he[t]);else if(xk(I,bk(o,D,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==yk(o,"data:")||!de[e])if(q&&!xk(V,bk(o,D,"")));else if(o)return!1;return!0},Ue=function(e){return"annotation-xml"!==e&&vk(e,P)},Ze=function(e){Fe(O.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ie(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let r=t.length;for(;r--;){const i=t[r],{name:s,namespaceURI:a,value:l}=i,c=Te(s),d=l;let u="value"===s?d:wk(d);if(n.attrName=c,n.attrValue=u,n.keepAttr=!0,n.forceKeepAttr=void 0,Fe(O.uponSanitizeAttribute,e,n),u=n.attrValue,!re||"id"!==c&&"name"!==c||(Ve(s,e),u="user-content-"+u),X&&xk(/((--!?|])>)|<\/(style|title)/i,u)){Ve(s,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){Ve(s,e);continue}if(!G&&xk(/\/>/i,u)){Ve(s,e);continue}Y&&dk([A,M,B],e=>{u=bk(u,e," ")});const h=Te(e.nodeName);if(He(h,c,u)){if(_&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(a);else switch(p.getAttributeType(h,c)){case"TrustedHTML":u=_.createHTML(u);break;case"TrustedScriptURL":u=_.createScriptURL(u)}if(u!==d)try{a?e.setAttributeNS(a,s,u):e.setAttribute(s,u),Ie(e)?Ne(e):hk(o.removed)}catch(t){Ve(s,e)}}else Ve(s,e)}Fe(O.afterSanitizeAttributes,e,null)},$e=function e(t){let o=null;const n=Pe(t);for(Fe(O.beforeSanitizeShadowDOM,t,null);o=n.nextNode();)Fe(O.uponSanitizeShadowNode,o,null),ze(o),Ze(o),o.content instanceof s&&e(o.content);Fe(O.afterSanitizeShadowDOM,t,null)};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,i=null,a=null,c=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Le(e)){if("function"!=typeof e.toString)throw Ck("toString is not a function");if("string"!=typeof(e=e.toString()))throw Ck("dirty is not a string, aborting")}if(!o.isSupported)return e;if(J||Me(t),o.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){const t=Te(e.nodeName);if(!L[t]||Z[t])throw Ck("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)n=De("\x3c!----\x3e"),i=n.ownerDocument.importNode(e,!0),1===i.nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?n=i:n.appendChild(i);else{if(!ee&&!Y&&!K&&-1===e.indexOf("<"))return _&&oe?_.createHTML(e):e;if(n=De(e),!n)return ee?null:oe?x:""}n&&Q&&Ne(n.firstChild);const d=Pe(se?e:n);for(;a=d.nextNode();)ze(a),Ze(a),a.content instanceof s&&$e(a.content);if(se)return e;if(ee){if(te)for(c=S.call(n.ownerDocument);n.firstChild;)c.appendChild(n.firstChild);else c=n;return(z.shadowroot||z.shadowrootmode)&&(c=E.call(r,c,!0)),c}let u=K?n.outerHTML:n.innerHTML;return K&&L["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&xk(Yk,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),Y&&dk([A,M,B],e=>{u=bk(u,e," ")}),_&&oe?_.createHTML(u):u},o.setConfig=function(){Me(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),J=!0},o.clearConfig=function(){Ee=null,J=!1},o.isValidAttribute=function(e,t,o){Ee||Me({});const n=Te(e),r=Te(t);return He(n,r,o)},o.addHook=function(e,t){"function"==typeof t&&mk(O[e],t)},o.removeHook=function(e,t){if(void 0!==t){const o=uk(O[e],t);return-1===o?void 0:pk(O[e],o,1)[0]}return hk(O[e])},o.removeHooks=function(e){O[e]=[]},o.removeAllHooks=function(){O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();const eS=e=>Qk().sanitize(e);var tS=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.I18n");const oS={indent:!0,outdent:!0,"table-insert-column-after":!0,"table-insert-column-before":!0,"paste-column-after":!0,"paste-column-before":!0,"unordered-list":!0,"list-bull-circle":!0,"list-bull-disc":!0,"list-bull-default":!0,"list-bull-square":!0},nS="temporary-placeholder",rS=e=>()=>fe(e,nS).getOr("!not found!"),iS=(e,t)=>{const o=e.toLowerCase();if(tS.isRtl()){const e=((e,t)=>Qe(e,t)?e:((e,t)=>e+t)(e,t))(o,"-rtl");return ve(t,e)?e:o}return o},sS=(e,t)=>fe(t,iS(e,t)),aS=(e,t)=>{const o=t();return sS(e,o).getOrThunk(rS(o))},lS=()=>ud("add-focusable",[Kc(e=>{qn(e.element,"svg").each(e=>jo(e,"focusable","false"))})]),cS=(e,t,o,n)=>{var r,i;const s=(e=>!!tS.isRtl()&&ve(oS,e))(t)?["tox-icon--flip"]:[],a=fe(o,iS(t,o)).or(n).getOrThunk(rS(o));return{dom:{tag:e.tag,attributes:null!==(r=e.attributes)&&void 0!==r?r:{},classes:e.classes.concat(s),innerHtml:a},behaviours:id([...null!==(i=e.behaviours)&&void 0!==i?i:[],lS()])}},dS=(e,t,o,n=A.none())=>cS(t,e,o(),n),uS={success:"checkmark",error:"warning",err:"error",warning:"warning",warn:"warning",info:"info"},hS=ng({name:"Notification",factory:e=>{const t=Pe("notification-text"),o=db({dom:cb(`<p id=${t}>${eS(e.backstageProvider.translate(e.text))}</p>`),behaviours:id([Qh.config({})])}),n=e=>({dom:{tag:"div",classes:["tox-bar"],styles:{width:`${e}%`}}}),r=e=>({dom:{tag:"div",classes:["tox-text"],innerHtml:`${e}%`}}),i=db({dom:{tag:"div",classes:e.progress?["tox-progress-bar","tox-progress-indicator"]:["tox-progress-bar"]},components:[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(0)]},r(0)],behaviours:id([Qh.config({})])}),s={updateProgress:(e,t)=>{e.getSystem().isConnected()&&i.getOpt(e).each(e=>{Qh.set(e,[{dom:{tag:"div",classes:["tox-bar-container"]},components:[n(t)]},r(t)])})},updateText:(e,t)=>{if(e.getSystem().isConnected()){const n=o.get(e);Qh.set(n,[Sm(t)])}}},a=W([e.icon.toArray(),[e.level],A.from(uS[e.level]).toArray()]),l=db(Tb.sketch({dom:{tag:"button",classes:["tox-notification__dismiss","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":e.backstageProvider.translate("Close")}},components:[dS("close",{tag:"span",classes:["tox-icon"]},e.iconProvider)],buttonBehaviours:id([Hv.config({}),ab.config({...e.backstageProvider.tooltips.getConfig({tooltipText:e.backstageProvider.translate("Close")})})]),action:t=>{e.onAction(t)}})),c=((e,t,o)=>{const n=o(),r=$(e,e=>ve(n,iS(e,n)));return cS({tag:"div",classes:["tox-notification__icon"]},r.getOr(nS),n,A.none())})(a,0,e.iconProvider),d=[c,{dom:{tag:"div",classes:["tox-notification__body"]},components:[o.asSpec()],behaviours:id([Qh.config({})])}];return{uid:e.uid,dom:{tag:"div",attributes:{role:"alert","aria-labelledby":t},classes:["tox-notification","tox-notification--in",`tox-notification--${e.level}`]},behaviours:id([Hv.config({}),fd.config({}),_h.config({mode:"special",onEscape:t=>(e.onAction(t),A.some(!0))})]),components:d.concat(e.progress?[i.asSpec()]:[]).concat([l.asSpec()]),apis:s}},configFields:[os("level","info",["success","error","warning","warn","info"]),Di("progress"),$i("icon"),Di("onAction"),Di("text"),Di("iconProvider"),Di("backstageProvider")],apis:{updateProgress:(e,t,o)=>{e.updateProgress(t,o)},updateText:(e,t,o)=>{e.updateText(t,o)}}});var mS=(e,t,o,n)=>{const r=t.backstage.shared,i=()=>ct(""===e.queryCommandValue("ToggleView")?e.getContentAreaContainer():e.getContainer()),s=()=>{const e=Dr(i());return A.some(e)},a=e=>{s().each(t=>{F(e,e=>{bn(e.element,"width"),En(e.element)>t.width&&dn(e.element,"width",t.width+"px")})})};return{open:(t,l,c)=>{const d=()=>{n.on(t=>{l();const o=c();(e=>{Qh.remove(e,u),h()})(t),((t,o)=>{0===fo(t.element).length?((t,o)=>{Gy.hide(t),n.clear(),o&&e.focus()})(t,o):((e,t)=>{t&&_h.focusIn(e)})(t,o)})(t,o)})},u=Am(hS.sketch({text:t.text,level:V(["success","error","warning","warn","info"],t.type)?t.type:void 0,progress:!0===t.progressBar,icon:t.icon,onAction:d,iconProvider:r.providers.icons,backstageProvider:r.providers}));if(n.isSet()){const e=Mm(u);n.on(t=>{Qh.append(t,e),Gy.reposition(t),u.hasConfigured(Op)&&Op.refresh(t),a(t.components())})}else{const t=Am(Gy.sketch({dom:{tag:"div",classes:["tox-notifications-container"],attributes:{"aria-label":"Notifications",role:"region"}},lazySink:r.getSink,fireDismissalEventInstead:{},...r.header.isPositionedAtTop()?{}:{fireRepositionEventInstead:{}},inlineBehaviours:id([_h.config({mode:"cyclic",selector:".tox-notification, .tox-notification a, .tox-notification button"}),Qh.config({}),...$C(e)&&r.header.isPositionedAtTop()?[]:[Op.config({contextual:{lazyContext:()=>A.some(Dr(i())),fadeInClass:"tox-notification-container-dock-fadein",fadeOutClass:"tox-notification-container-dock-fadeout",transitionClass:"tox-notification-container-dock-transition"},modes:["top"],lazyViewport:t=>JC(e,t.element).map(e=>({bounds:QC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Nn(e.element).top})})).getOrThunk(()=>({bounds:Lr(),optScrollEnv:A.none()}))})]])})),a=Mm(u),l={maxHeightFunction:kc()},c={...r.anchors.banner(),overrides:l};n.set(t),o.add(t),Gy.showWithinBounds(t,a,{anchor:c},s)}g(t.timeout)&&t.timeout>0&&Fx.setEditorTimeout(e,()=>{d()},t.timeout);const h=()=>{n.on(e=>{Gy.reposition(e),e.hasConfigured(Op)&&Op.refresh(e),a(e.components())})};return{close:d,reposition:h,text:e=>{hS.updateText(u,e)},settings:t,getEl:()=>u.element.dom,progressBar:{value:e=>{hS.updateProgress(u,e)}}}},close:e=>{e.close()},getArgs:e=>e.settings}};var pS;!function(e){e[e.CLOSE_ON_EXECUTE=0]="CLOSE_ON_EXECUTE",e[e.BUBBLE_TO_SANDBOX=1]="BUBBLE_TO_SANDBOX"}(pS||(pS={}));var gS=pS;const fS="tox-menu-nav__js",vS="tox-collection__item",bS="tox-swatch",yS={normal:fS,color:bS},wS="tox-collection__item--enabled",_S="tox-collection__item-icon",xS="tox-collection__item-label",CS="tox-collection__item-caret",kS="tox-collection__item--active",SS="tox-collection__item-container",TS="tox-collection__item-container--row",ES=e=>fe(yS,e).getOr(fS),OS=e=>"color"===e?"tox-swatches":"tox-menu",AS=e=>({backgroundMenu:"tox-background-menu",selectedMenu:"tox-selected-menu",selectedItem:"tox-collection__item--active",hasIcons:"tox-menu--has-icons",menu:OS(e),tieredMenu:"tox-tiered-menu"}),MS=e=>{const t=AS(e);return{backgroundMenu:t.backgroundMenu,selectedMenu:t.selectedMenu,menu:t.menu,selectedItem:t.selectedItem,item:ES(e)}},BS=(e,t,o)=>{const n=AS(o);return{tag:"div",classes:W([[n.menu,`tox-menu-${t}-column`],e?[n.hasIcons]:[]])}},RS=[Jb.parts.items({})],NS=(e,t,o)=>{const n=AS(o);return{dom:{tag:"div",classes:W([[n.tieredMenu]])},markers:MS(o)}},VS=Pe("refetch-trigger-event"),DS=Pe("redirect-menu-item-interaction"),PS="tox-menu__searcher",IS=e=>Gn(e.element,`.${PS}`).bind(t=>e.getSystem().getByDom(t).toOptional()),LS=IS,FS=e=>({fetchPattern:Yg.getValue(e),selectionStart:e.element.dom.selectionStart,selectionEnd:e.element.dom.selectionEnd}),zS=e=>{const t=(e,t)=>(t.cut(),A.none()),o=(e,t)=>{const o={interactionEvent:t.event,eventType:t.event.raw.type};return Dc(e,DS,o),A.some(!0)},n="searcher-events";return{dom:{tag:"div",classes:[vS]},components:[Qy.sketch({inputClasses:[PS,"tox-textfield"],inputAttributes:{...e.placeholder.map(t=>({placeholder:e.i18n(t)})).getOr({}),type:"search","aria-autocomplete":"list"},inputBehaviours:id([ud(n,[Zc(Cs(),e=>{Vc(e,VS)}),Zc(_s(),(e,t)=>{"Escape"===t.event.raw.key&&t.stop()})]),_h.config({mode:"special",onLeft:t,onRight:t,onSpace:t,onEnter:o,onEscape:o,onUp:o,onDown:o})]),eventOrder:{keydown:[n,_h.name()]}})]}},HS="tox-collection--results__js",US=e=>{var t;return e.dom?{...e,dom:{...e.dom,attributes:{...null!==(t=e.dom.attributes)&&void 0!==t?t:{},id:Pe("aria-item-search-result-id"),"aria-selected":"false"}}}:e},ZS=(e,t)=>o=>{const n=I(o,t);return L(n,t=>({dom:e,components:t}))},$S=(e,t)=>{const o=[];let n=[];return F(e,(e,r)=>{t(e,r)?(n.length>0&&o.push(n),n=[],(ve(e.dom,"innerHtml")||e.components&&e.components.length>0)&&n.push(e)):n.push(e)}),n.length>0&&o.push(n),L(o,e=>({dom:{tag:"div",classes:["tox-collection__group"]},components:e}))},jS=(e,t,o)=>Jb.parts.items({preprocess:n=>{const r=L(n,o);return"auto"!==e&&e>1?ZS({tag:"div",classes:["tox-collection__group"]},e)(r):$S(r,(e,o)=>"separator"===t[o].type)}}),WS=(e,t,o=!0)=>({dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[jS(e,t,_)]}),qS=e=>D(e,e=>"icon"in e&&void 0!==e.icon),GS=e=>(console.error(Ai(e)),console.log(e),A.none()),YS=(e,t,o,n,r)=>{const i=(s=o,{dom:{tag:"div",classes:["tox-collection","tox-collection--horizontal"]},components:[Jb.parts.items({preprocess:e=>$S(e,(e,t)=>"separator"===s[t].type)})]});var s;return{value:e,dom:i.dom,components:i.components,items:o}},XS=(e,t,o,n,r)=>{if("color"===r.menuType){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-swatches-menu"]},components:[{dom:{tag:"div",classes:["tox-swatches"]},components:[Jb.parts.items({preprocess:"auto"!==e?ZS({tag:"div",classes:["tox-swatches__row"]},e):_})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("imageselector"===r.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-image-selector-menu"]},components:[{dom:{tag:"div",classes:["tox-image-selector"]},components:[Jb.parts.items({preprocess:"auto"!==e?ZS({tag:"div",classes:["tox-image-selector__row"]},e):_})]}]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType&&"auto"===n){const t=WS(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("normal"===r.menuType||"searchable"===r.menuType){const t="searchable"!==r.menuType?WS(n,o):"search-with-field"===r.searchMode.searchMode?((e,t,o)=>{const n=Pe("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection"].concat(1===e?["tox-collection--list"]:["tox-collection--grid"])},components:[zS({i18n:tS.translate,placeholder:o.placeholder}),{dom:{tag:"div",classes:[...1===e?["tox-collection--list"]:["tox-collection--grid"],HS],attributes:{id:n}},components:[jS(e,t,US)]}]}})(n,o,r.searchMode):((e,t)=>{const o=Pe("aria-controls-search-results");return{dom:{tag:"div",classes:["tox-menu","tox-collection",HS].concat(1===e?["tox-collection--list"]:["tox-collection--grid"]),attributes:{id:o}},components:[jS(e,t,US)]}})(n,o);return{value:e,dom:t.dom,components:t.components,items:o}}if("listpreview"===r.menuType&&"auto"!==n){const t=(e=>({dom:{tag:"div",classes:["tox-menu","tox-collection","tox-collection--toolbar","tox-collection--toolbar-lg"]},components:[Jb.parts.items({preprocess:ZS({tag:"div",classes:["tox-collection__group"]},e)})]}))(n);return{value:e,dom:t.dom,components:t.components,items:o}}return{value:e,dom:BS(t,n,r.menuType),components:RS,items:o}},KS=Li("type"),JS=Li("name"),QS=Li("label"),eT=Li("text"),tT=Li("title"),oT=Li("icon"),nT=Li("url"),rT=Li("value"),iT=zi("fetch"),sT=zi("getSubmenuItems"),aT=zi("onAction"),lT=zi("onItemAction"),cT=rs("onSetup",()=>v),dT=qi("name"),uT=qi("text"),hT=qi("role"),mT=qi("icon"),pT=qi("tooltip"),gT=qi("label"),fT=qi("shortcut"),vT=Yi("select"),bT=ns("active",!1),yT=ns("borderless",!1),wT=ns("enabled",!0),_T=ns("primary",!1),xT=e=>Ji("columns",e),CT=Ji("meta",{}),kT=rs("onAction",v),ST=e=>ts("type",e),TT=e=>Ri("name","name",ai(()=>Pe(`${e}-name`)),oi),ET=[KS,eT,Fi("level",["info","warn","error","success"]),oT,Ji("url","")],OT=bi(ET),AT=[KS,eT,wT,TT("button"),mT,yT,Gi("buttonType",["primary","secondary","toolbar"]),_T,ts("context","mode:design")],MT=bi(AT),BT=[KS,JS],RT=BT.concat([gT]),NT=BT.concat([QS,wT,ts("context","mode:design")]),VT=bi(NT),DT=ni,PT=RT.concat([xT("auto"),ts("context","mode:design")]),IT=bi(PT),LT=xi([rT,eT,oT]),FT=RT.concat([ts("storageKey","default"),ts("context","mode:design")]),zT=bi(FT),HT=oi,UT=bi(RT),ZT=oi,$T=BT.concat([ts("tag","textarea"),Li("scriptId"),Li("scriptUrl"),Yi("onFocus"),Qi("settings",void 0,si)]),jT=BT.concat([ts("tag","textarea"),zi("init")]),WT=ki(e=>Ti("customeditor.old",vi(jT),e).orThunk(()=>Ti("customeditor.new",vi($T),e))),qT=oi,GT=[wT,uT,hT,fT,Ri("value","value",ai(()=>Pe("menuitem-value")),Qr()),CT,ts("context","mode:design")];const YT=bi([KS,JS].concat(GT)),XT=ni,KT=[TT("button"),mT,os("align","end",["start","end"]),_T,wT,Gi("buttonType",["primary","secondary"]),ts("context","mode:design")],JT=[...KT,eT],QT=[Fi("type",["submit","cancel","custom"]),...JT],eE=[Fi("type",["menu"]),uT,pT,mT,Zi("items",YT),...KT],tE=[...KT,Fi("type",["togglebutton"]),pT,mT,uT,ns("active",!1)],oE=Mi("type",{submit:QT,cancel:QT,custom:QT,menu:eE,togglebutton:tE}),nE=RT.concat([ts("context","mode:design")]),rE=bi(nE),iE=yi(Jr),sE=e=>[KS,Ii("columns"),e],aE=[KS,Li("html"),os("presets","presentation",["presentation","document"]),rs("onInit",v),ns("stretched",!1)],lE=bi(aE),cE=RT.concat([ns("border",!1),ns("sandboxed",!0),ns("streamContent",!1),ns("transparent",!0)]),dE=bi(cE),uE=oi,hE=bi(BT.concat([qi("height")])),mE=bi([Li("url"),Wi("zoom"),Wi("cachedWidth"),Wi("cachedHeight")]),pE=RT.concat([qi("inputMode"),qi("placeholder"),ns("maximized",!1),wT,ts("context","mode:design")]),gE=bi(pE),fE=oi,vE=e=>[KS,QS,e,os("align","start",["start","center","end"]),qi("for")],bE=[eT,rT],yE=[eT,Zi("items",Bi(0,()=>wE))],wE=wi([bi(bE),bi(yE)]),_E=RT.concat([Zi("items",wE),wT,ts("context","mode:design")]),xE=bi(_E),CE=oi,kE=RT.concat([Ui("items",[eT,rT]),es("size",1),wT,ts("context","mode:design")]),SE=bi(kE),TE=oi,EE=RT.concat([ns("constrain",!0),wT,ts("context","mode:design")]),OE=bi(EE),AE=bi([Li("width"),Li("height")]),ME=BT.concat([QS,es("min",0),es("max",0)]),BE=bi(ME),RE=ti,NE=[KS,Zi("header",oi),Zi("cells",yi(oi))],VE=bi(NE),DE=RT.concat([qi("placeholder"),ns("maximized",!1),wT,ts("context","mode:design")]),PE=bi(DE),IE=oi,LE=[ts("buttonType","default"),qi("text"),qi("tooltip"),qi("icon"),Qi("search",!1,wi([ni,bi([qi("placeholder")])],e=>d(e)?e?A.some({placeholder:A.none()}):A.none():A.some(e))),zi("fetch"),rs("onSetup",()=>v),ts("context","mode:design")],FE=bi([KS,...LE]),zE=e=>Ti("menubutton",FE,e),HE=[Fi("type",["directory","leaf"]),tT,Li("id"),ji("menu",FE),qi("customStateIcon"),qi("customStateIconTooltip")],UE=bi(HE),ZE=HE.concat([Zi("children",Bi(0,()=>Ci("type",{directory:$E,leaf:UE})))]),$E=bi(ZE),jE=Ci("type",{directory:$E,leaf:UE}),WE=[KS,Zi("items",jE),Yi("onLeafAction"),Yi("onToggleExpand"),is("defaultExpandedIds",[],oi),qi("defaultSelectedId")],qE=bi(WE),GE=RT.concat([os("filetype","file",["image","media","file"]),wT,qi("picker_text"),ts("context","mode:design")]),YE=bi(GE),XE=bi([rT,CT]),KE=e=>Ri("items","items",{tag:"required",process:{}},yi(ki(t=>Ti(`Checking item of ${e}`,JE,t).fold(e=>Ae.error(Ai(e)),e=>Ae.value(e))))),JE=gi(()=>{return Ci("type",{alertbanner:OT,bar:bi((e=KE("bar"),[KS,e])),button:MT,checkbox:VT,colorinput:zT,colorpicker:UT,dropzone:rE,grid:bi(sE(KE("grid"))),iframe:dE,input:gE,listbox:xE,selectbox:SE,sizeinput:OE,slider:BE,textarea:PE,urlinput:YE,customeditor:WT,htmlpanel:lE,imagepreview:hE,collection:IT,label:bi(vE(KE("label"))),table:VE,tree:qE,panel:eO});var e}),QE=[KS,Ji("classes",[]),Zi("items",JE)],eO=bi(QE),tO=[TT("tab"),tT,Zi("items",JE)],oO=[KS,Ui("tabs",tO)],nO=bi(oO),rO=JT,iO=oE,sO=bi([Li("title"),Pi("body",Ci("type",{panel:eO,tabpanel:nO})),ts("size","normal"),is("buttons",[],iO),Ji("initialData",{}),rs("onAction",v),rs("onChange",v),rs("onSubmit",v),rs("onClose",v),rs("onCancel",v),rs("onTabChange",v)]),aO=bi([Fi("type",["cancel","custom"]),...rO]),lO=bi([Li("title"),Li("url"),Wi("height"),Wi("width"),Xi("buttons",aO),rs("onAction",v),rs("onCancel",v),rs("onClose",v),rs("onMessage",v)]),cO=e=>s(e)?[e].concat(q(ge(e),cO)):l(e)?q(e,cO):[],dO=e=>i(e.type)&&i(e.name),uO={checkbox:DT,colorinput:HT,colorpicker:ZT,dropzone:iE,input:fE,iframe:uE,imagepreview:mE,selectbox:TE,sizeinput:AE,slider:RE,listbox:CE,size:AE,textarea:IE,urlinput:XE,customeditor:qT,collection:LT,togglemenuitem:XT},hO=e=>{const t=(e=>H(cO(e),dO))(e),o=q(t,e=>(e=>A.from(uO[e.type]))(e).fold(()=>[],t=>[Pi(e.name,t)]));return bi(o)},mO=e=>{var t;return{internalDialog:Ei(Ti("dialog",sO,e)),dataValidator:hO(e),initialData:null!==(t=e.initialData)&&void 0!==t?t:{}}},pO={open:(e,t)=>{const o=mO(t);return e(o.internalDialog,o.initialData,o.dataValidator)},openUrl:(e,t)=>e(Ei(Ti("dialog",lO,t))),redial:e=>mO(e)},gO=bi([KS,uT]),fO=bi([ST("autocompleteitem"),bT,wT,CT,rT,uT,mT]);bi([KS,Li("trigger"),es("minChars",1),xT(1),es("maxResults",10),Yi("matches"),iT,aT,is("highlightOn",[],oi)]);const vO=[wT,pT,mT,uT,cT,ts("context","mode:design")],bO=bi([KS,aT,fT].concat(vO)),yO=e=>Ti("toolbarbutton",bO,e),wO=[bT].concat(vO),_O=bi(wO.concat([KS,aT,fT])),xO=e=>Ti("ToggleButton",_O,e),CO=[rs("predicate",E),os("scope","node",["node","editor"]),os("position","selection",["node","selection","line"])],kO=vO.concat([ST("contextformbutton"),ts("align","end"),_T,aT,Ni("original",_)]),SO=wO.concat([ST("contextformbutton"),ts("align","end"),_T,aT,Ni("original",_)]),TO=vO.concat([ST("contextformbutton")]),EO=wO.concat([ST("contextformtogglebutton")]),OO=[gT,Zi("commands",Mi("type",{contextformbutton:kO,contextformtogglebutton:SO})),ji("launch",Mi("type",{contextformbutton:TO,contextformtogglebutton:EO})),rs("onInput",v),rs("onSetup",v)],AO=[...CO,...OO,Fi("type",["contextform"]),rs("initValue",w("")),qi("placeholder")],MO=[...CO,...OO,Fi("type",["contextsliderform"]),rs("initValue",w(0)),rs("min",w(0)),rs("max",w(100))],BO=[...CO,...OO,Fi("type",["contextsizeinputform"]),rs("initValue",w({width:"",height:""}))],RO=Mi("type",{contextform:AO,contextsliderform:MO,contextsizeinputform:BO}),NO=vO.concat([ST("contexttoolbarbutton")]),VO=bi([ST("contexttoolbar"),Ki("launch",NO),Pi("items",wi([oi,xi([qi("name"),qi("label"),Zi("items",oi)])]))].concat(CO)),DO=e=>({name:e.name.getOrUndefined(),label:e.label.getOrUndefined(),items:e.items}),PO=[KS,Li("src"),qi("alt"),is("classes",[],oi)],IO=bi(PO),LO=[KS,eT,dT,is("classes",["tox-collection__item-label"],oi)],FO=bi(LO),zO=gi(()=>Ci("type",{cardimage:IO,cardtext:FO,cardcontainer:HO})),HO=bi([KS,ts("direction","horizontal"),ts("align","left"),ts("valign","middle"),Zi("items",zO)]),UO=bi([KS,gT,Zi("items",zO),cT,kT].concat(GT)),ZO=bi([KS,bT,mT,gT].concat(GT)),$O=[KS,Li("fancytype"),kT],jO=[Ji("initData",{})].concat($O),WO=[Yi("select"),ss("initData",{},[ns("allowCustomColors",!0),ts("storageKey","default"),Xi("colors",Qr())])].concat($O),qO=[Yi("select"),Hi("initData",[Ii("columns"),is("items",[],Qr())])].concat($O),GO=Mi("fancytype",{inserttable:jO,colorswatch:WO,imageselect:qO}),YO=bi([KS,bT,nT,gT,pT].concat(GT)),XO=bi([KS,bT,oT,QS,pT,rT].concat(GT)),KO=bi([KS,cT,kT,mT].concat(GT)),JO=bi([KS,sT,cT,mT].concat(GT)),QO=bi([KS,mT,bT,cT,aT].concat(GT)),eA=bi([mT,pT,rs("onShow",v),rs("onHide",v),cT]),tA=bi([KS,Pi("items",wi([xi([JS,Zi("items",oi)]),oi]))].concat(vO)),oA=bi([KS,pT,mT,uT,vT,iT,cT,os("presets","normal",["normal","color","listpreview"]),xT(1),aT,lT,ts("context","mode:design")]),nA=[uT,mT,qi("tooltip"),os("buttonType","secondary",["primary","secondary"]),ns("borderless",!1),zi("onAction"),ts("context","mode:design")],rA={button:[...nA,eT,Fi("type",["button"])],togglebutton:[...nA,ns("active",!1),Fi("type",["togglebutton"])]},iA=[Fi("type",["group"]),is("buttons",[],Mi("type",rA))],sA=Mi("type",{...rA,group:iA}),aA=bi([is("buttons",[],sA),zi("onShow"),zi("onHide")]),lA=(e,t,o)=>{const n=hr(e.element,"."+o);if(n.length>0){const e=j(n,e=>{const o=e.dom.getBoundingClientRect().top,r=n[0].dom.getBoundingClientRect().top;return Math.abs(o-r)>t}).getOr(n.length);return A.some({numColumns:e,numRows:Math.ceil(n.length/e)})}return A.none()},cA=e=>((e,t)=>id([ud(e,t)]))(Pe("unnamed-events"),e),dA=e=>tp.config({disabled:e,disableClass:"tox-collection__item--state-disabled"}),uA=e=>tp.config({disabled:e}),hA=e=>tp.config({disabled:e,disableClass:"tox-tbtn--disabled"}),mA=e=>tp.config({disabled:e,disableClass:"tox-tbtn--disabled",useNative:!1}),pA=(e,t)=>{const o=e.getApi(t);return e=>{e(o)}},gA=(e,t)=>Kc(o=>{p(e.onBeforeSetup)&&e.onBeforeSetup(o),pA(e,o)(o=>{const n=e.onSetup(o);p(n)&&t.set(n)})}),fA=(e,t)=>Jc(o=>pA(e,o)(t.get())),vA=(e,t,o)=>Jc(n=>(o.set(Yg.getValue(n)),pA(e,n)(t.get()))),bA="silver.uistate",yA="setDisabled",wA="init",_A=["switchmode",wA],xA=(e,t)=>{const o=e.mainUi.outerContainer,n=[e.mainUi.mothership,...e.uiMotherships];t===yA&&F(n,e=>{e.broadcastOn([mb()],{target:o.element})}),F(n,e=>{e.broadcastOn([bA],t)})},CA=(e,t)=>{e.on("init SwitchMode",e=>{xA(t,e.type)}),e.on("DisabledStateChange",o=>{if(!o.isDefaultPrevented()){const n=o.state?yA:wA;xA(t,n),o.state||e.nodeChanged()}}),e.on("NodeChange",o=>{const n=e.ui.isEnabled()?o.type:yA;xA(t,n)}),Wx(e)&&e.mode.set("readonly")},kA=e=>ov.config({channels:{[bA]:{onReceive:(t,o)=>{if(o===yA||"setEnabled"===o)return void tp.set(t,o===yA);const{contextType:n,shouldDisable:r}=e();("mode"!==n||V(_A,o))&&tp.set(t,r)}}}}),SA=(e,t)=>ed((o,n)=>{pA(e,o)(e.onAction),e.triggersSubmenu||t!==gS.CLOSE_ON_EXECUTE||(o.getSystem().isConnected()&&Vc(o,zs()),n.stop())}),TA={[Ps()]:["disabling","alloy.base.behaviour","toggling","item-events"]},EA=He,OA=(e,t,o,n)=>{const r=we(v);return{type:"item",dom:t.dom,components:EA(t.optComponents),data:e.data,eventOrder:TA,hasSubmenu:e.triggersSubmenu,itemBehaviours:id([ud("item-events",[SA(e,o),gA(e,r),fA(e,r)]),dA(()=>!e.enabled||n.checkUiComponentContext(e.context).shouldDisable),kA(()=>n.checkUiComponentContext(e.context)),Qh.config({})].concat(e.itemBehaviours))}},AA=e=>({value:e.value,meta:{text:e.text.getOr(""),...e.meta}}),MA=(e,t)=>{var o,n;const r=at("div");return or(r,"tox-image-selector-loading-spinner"),{dom:{tag:e.tag,attributes:null!==(o=e.attributes)&&void 0!==o?o:{},classes:e.classes},components:[{dom:{tag:"div",classes:["tox-image-selector-image-wrapper"]},components:[{dom:{tag:"img",attributes:{src:t},classes:["tox-image-selector-image-img"]}}]},...e.checkMark.toArray()],behaviours:id([...null!==(n=e.behaviours)&&void 0!==n?n:[],ud("render-image-events",[Kc(e=>{var t;t=e.element,or(t,"tox-image-selector-loading-spinner-wrapper"),Uo(t,r),Gn(e.element,"img").each(t=>{on(t).catch(e=>{console.error(e)}).finally(()=>{(e=>{rr(e,"tox-image-selector-loading-spinner-wrapper"),Jo(r)})(e.element)})})})])])}},BA=e=>{const t=Ux.os.isMacOS()||Ux.os.isiOS(),o=t?{alt:"⌥",ctrl:"⌃",shift:"⇧",meta:"⌘",access:"⌃⌥"}:{meta:"Ctrl",access:"Shift+Alt"},n=e.split("+"),r=L(n,e=>{const t=e.toLowerCase().trim();return ve(o,t)?o[t]:e});return t?r.join(""):r.join("+")},RA=(e,t,o=[_S])=>dS(e,{tag:"div",classes:o},t),NA=e=>({dom:{tag:"div",classes:[xS]},components:[Sm(tS.translate(e))]}),VA=(e,t)=>({dom:{tag:"div",classes:t,innerHtml:e}}),DA=(e,t)=>({dom:{tag:"div",classes:[xS]},components:[{dom:{tag:e.tag,styles:e.styles},components:[Sm(tS.translate(t))]}]}),PA=e=>({dom:{tag:"div",classes:["tox-collection__item-accessory"]},components:[Sm(BA(e))]}),IA=e=>RA("checkmark",e,["tox-collection__item-checkmark"]),LA=(e,t)=>{const o=e.map(e=>({attributes:{id:Pe("menu-item"),"aria-label":tS.translate(e)}})).getOr({});return{tag:"div",classes:[fS,vS].concat(t),...o}},FA=e=>({dom:{tag:"label"},components:[Sm(e)]}),zA=(e,t,o,n=A.none())=>"color"===e.presets?((e,t,o)=>{const n=e.value,r=e.iconContent.map(e=>((e,t,o)=>{const n=t();return sS(e,n).or(o).getOrThunk(rS(n))})(e,t.icons,o)),i=e.ariaLabel.map(e=>({"aria-label":t.translate(e),"data-mce-name":e})).getOr({});return{dom:(()=>{const e=bS,t=r.getOr(""),o={tag:"div",attributes:i,classes:[e]};return"custom"===n?{...o,tag:"button",classes:[...o.classes,"tox-swatches__picker-btn"],innerHtml:t}:"remove"===n?{...o,classes:[...o.classes,"tox-swatch--remove"],innerHtml:t}:m(n)?{...o,attributes:{...o.attributes,"data-mce-color":n},styles:{"background-color":n},innerHtml:t}:o})(),optComponents:[]}})(e,t,n):"img"===e.presets?(e=>{var t,o;return{dom:LA(e.ariaLabel,["tox-collection__item-image-selector"]),optComponents:[A.some((t=e.iconContent.getOrDie(),o={tag:"div",classes:["tox-collection__item-image"],checkMark:e.checkMark},MA(o,t))),e.labelContent.map(FA)]}})(e):((e,t,o,n)=>{const r={tag:"div",classes:[_S]},i=o?e.iconContent.map(e=>dS(e,r,t.icons,n)).orThunk(()=>A.some({dom:r})):A.none(),s=e.checkMark,a=A.from(e.meta).fold(()=>NA,e=>ve(e,"style")?C(DA,e.style):NA),l=e.htmlContent.fold(()=>e.textContent.map(a),e=>A.some(VA(e,[xS])));return{dom:LA(e.ariaLabel,[]),optComponents:[i,l,e.shortcutContent.map(PA),s,e.caret,e.labelContent.map(FA)]}})(e,t,o,n),HA=(e,t,o)=>fe(e,"tooltipWorker").map(e=>[ab.config({lazySink:t.getSink,tooltipDom:{tag:"div",classes:["tox-tooltip-worker-container"]},tooltipComponents:[],anchor:e=>({type:"submenu",item:e,overrides:{maxHeightFunction:kc}}),mode:"follow-highlight",onShow:(t,o)=>{e(e=>{ab.setComponents(t,[Tm({element:ct(e)})])})}})]).getOrThunk(()=>o.map(e=>[ab.config({...t.providers.tooltips.getConfig({tooltipText:e}),mode:"follow-highlight"})]).getOr([])),UA=(e,t)=>{const o=(e=>zx.DOM.encode(e))(tS.translate(e));if(t.length>0){const e=new RegExp((e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))(t),"gi");return o.replace(e,e=>`<span class="tox-autocompleter-highlight">${e}</span>`)}return o},ZA=(e,t)=>L(e,e=>{switch(e.type){case"cardcontainer":return((e,t)=>{const o="vertical"===e.direction?"tox-collection__item-container--column":TS,n="left"===e.align?"tox-collection__item-container--align-left":"tox-collection__item-container--align-right";return{dom:{tag:"div",classes:[SS,o,n,(()=>{switch(e.valign){case"top":return"tox-collection__item-container--valign-top";case"middle":return"tox-collection__item-container--valign-middle";case"bottom":return"tox-collection__item-container--valign-bottom"}})()]},components:t}})(e,ZA(e.items,t));case"cardimage":return((e,t,o)=>({dom:{tag:"img",classes:t,attributes:{src:e,alt:o.getOr("")}}}))(e.src,e.classes,e.alt);case"cardtext":const o=e.name.exists(e=>V(t.cardText.highlightOn,e)),n=o?A.from(t.cardText.matchText).getOr(""):"";return VA(UA(e.text,n),e.classes)}}),$A=(e,t,o,n,r,i,s,a=!0)=>{const l=zA({presets:o,textContent:t?e.text:A.none(),htmlContent:A.none(),labelContent:e.label,ariaLabel:e.text,iconContent:e.icon,shortcutContent:t?e.shortcut:A.none(),checkMark:t?A.some(IA(s.icons)):A.none(),caret:A.none(),value:e.value},s,a),c=e.text.filter(w(!t)).map(e=>ab.config(s.tooltips.getConfig({tooltipText:s.translate(e)})));return Le(OA({context:e.context,data:AA(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Yv.set(e,t)},isActive:()=>Yv.isOn(e),isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t)}),onAction:t=>n(e.value),onSetup:e=>(e.setActive(r),v),triggersSubmenu:!1,itemBehaviours:[...c.toArray()]},l,i,s),{toggling:{toggleClass:wS,toggleOnExecute:!1,selected:e.active,exclusive:!0}})},jA=e=>({value:YA(e)}),WA=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,qA=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,GA=e=>WA.test(e)||qA.test(e),YA=e=>Xe(e,"#").toUpperCase(),XA=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},KA=e=>{const t=XA(e.red)+XA(e.green)+XA(e.blue);return jA(t)},JA=(e,t,o)=>({hue:e,saturation:t,value:o}),QA=e=>{let t=0,o=0,n=0;const r=e.red/255,i=e.green/255,s=e.blue/255,a=Math.min(r,Math.min(i,s)),l=Math.max(r,Math.max(i,s));return a===l?(n=a,JA(0,0,100*n)):(t=r===a?3:s===a?1:5,t=60*(t-(r===a?i-s:s===a?r-i:s-r)/(l-a)),o=(l-a)/l,n=l,JA(Math.round(t),Math.round(100*o),Math.round(100*n)))},eM=Math.min,tM=Math.max,oM=Math.round,nM=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,rM=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,iM=(e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}),sM=e=>{const t=parseInt(e,10);return t.toString()===e&&t>=0&&t<=255},aM=e=>{let t,o,n;const r=(e.hue||0)%360;let i=e.saturation/100,s=e.value/100;if(i=tM(0,eM(i,1)),s=tM(0,eM(s,1)),0===i)return t=o=n=oM(255*s),iM(t,o,n,1);const a=r/60,l=s*i,c=l*(1-Math.abs(a%2-1)),d=s-l;switch(Math.floor(a)){case 0:t=l,o=c,n=0;break;case 1:t=c,o=l,n=0;break;case 2:t=0,o=l,n=c;break;case 3:t=0,o=c,n=l;break;case 4:t=c,o=0,n=l;break;case 5:t=l,o=0,n=c;break;default:t=o=n=0}return t=oM(255*(t+d)),o=oM(255*(o+d)),n=oM(255*(n+d)),iM(t,o,n,1)},lM=e=>{const t=(e=>{const t=(e=>{const t=e.value.replace(WA,(e,t,o,n)=>t+t+o+o+n+n);return{value:t}})(e),o=qA.exec(t.value);return null===o?["FFFFFF","FF","FF","FF"]:o})(e),o=parseInt(t[1],16),n=parseInt(t[2],16),r=parseInt(t[3],16);return iM(o,n,r,1)},cM=(e,t,o,n)=>{const r=parseInt(e,10),i=parseInt(t,10),s=parseInt(o,10),a=parseFloat(n);return iM(r,i,s,a)},dM=e=>{const t=nM.exec(e);if(null!==t)return A.some(cM(t[1],t[2],t[3],"1"));const o=rM.exec(e);return null!==o?A.some(cM(o[1],o[2],o[3],o[4])):A.none()},uM=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,hM=iM(255,0,0,1),mM=e=>KA(aM(e)),pM=(e,t)=>{e.dispatch("ResizeContent",t)},gM=(e,t)=>{e.dispatch("TextColorChange",t)},fM=(e,t)=>e.dispatch("ResolveName",{name:t.nodeName.toLowerCase(),target:t}),vM=e=>{e.dispatch("ContextToolbarClose")},bM=(e,t)=>()=>{e(),t()},yM=(e,t=O)=>_M(e,"NodeChange",o=>{o.setEnabled(e.selection.isEditable()&&t())}),wM=(e,t)=>o=>{const n=yM(e)(o),r=((e,t)=>o=>{const n=qe(),r=()=>{o.setActive(e.formatter.match(t));const r=e.formatter.formatChanged(t,o.setActive);n.set(r)};return e.initialized?r():e.once("init",r),()=>{e.off("init",r),n.clear()}})(e,t)(o);return()=>{n(),r()}},_M=(e,t,o)=>n=>{const r=()=>o(n),i=()=>{o(n),e.on(t,r)};return e.initialized?i():e.once("init",i),()=>{e.off("init",i),e.off(t,r)}},xM=e=>t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("mceToggleFormat",!1,t.format)})},CM=(e,t)=>()=>e.execCommand(t);var kM=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.LocalStorage");const SM={},TM=e=>fe(SM,e).getOrThunk(()=>{const t=`tinymce-custom-colors-${e}`,o=kM.getItem(t);if(h(o)){const e=kM.getItem("tinymce-custom-colors");kM.setItem(t,m(e)?e:"[]")}const n=((e,t=10)=>{const o=kM.getItem(e),n=i(o)?JSON.parse(o):[],r=t-(s=n).length<0?s.slice(0,t):s;var s;const a=e=>{r.splice(e,1)};return{add:o=>{((e,t)=>{const o=N(e,t);return-1===o?A.none():A.some(o)})(r,o).each(a),r.unshift(o),r.length>t&&r.pop(),kM.setItem(e,JSON.stringify(r))},state:()=>r.slice(0)}})(t,10);return SM[e]=n,n}),EM=(e,t)=>{TM(e).add(t)},OM="forecolor",AM="hilitecolor",MM=e=>{const t=[];for(let o=0;o<e.length;o+=2)t.push({text:e[o+1],value:e[o],icon:"checkmark",type:"choiceitem"});return t},BM=e=>t=>t.options.get(e),RM="#000000",NM=(e,t)=>t===OM&&e.options.isSet("color_map_foreground")?BM("color_map_foreground")(e):t===AM&&e.options.isSet("color_map_background")?BM("color_map_background")(e):e.options.isSet("color_map_raw")?BM("color_map_raw")(e):BM("color_map")(e),VM=(e,t="default")=>Math.max(5,Math.ceil(Math.sqrt(NM(e,t).length))),DM=(e,t)=>{const o=BM("color_cols")(e),n=VM(e,t);return o===VM(e)?n:o},PM=(e,t="default")=>Math.round(t===OM?BM("color_cols_foreground")(e):t===AM?BM("color_cols_background")(e):BM("color_cols")(e)),IM=BM("custom_colors"),LM=BM("color_default_foreground"),FM=BM("color_default_background"),zM=(e,t)=>{const o=ct(e.selection.getStart()),n="hilitecolor"===t?vr(o,e=>{if(no(e)){const t=mn(e,"background-color");return $e((e=>dM(e).exists(e=>0!==e.alpha))(t),t)}return A.none()}).getOr("rgba(0, 0, 0, 0)"):mn(o,"color");return dM(n).map(e=>"#"+KA(e).value)},HM=e=>{const t="choiceitem",o={type:t,text:"Remove color",icon:"color-swatch-remove-color",value:"remove"};return e?[o,{type:t,text:"Custom color",icon:"color-picker",value:"custom"}]:[o]},UM=(e,t,o,n)=>{"custom"===o?KM(e)(o=>{o.each(o=>{EM(t,o),e.execCommand("mceApplyTextcolor",t,o),n(o)})},zM(e,t).getOr(RM)):"remove"===o?(n(""),e.execCommand("mceRemoveTextcolor",t)):(n(o),e.execCommand("mceApplyTextcolor",t,o))},ZM=(e,t,o)=>e.concat((e=>L(TM(e).state(),e=>({type:"choiceitem",text:e,icon:"checkmark",value:e})))(t).concat(HM(o))),$M=(e,t,o)=>n=>{n(ZM(e,t,o))},jM=(e,t,o)=>{const n="forecolor"===t?"tox-icon-text-color__color":"tox-icon-highlight-bg-color__color";e.setIconFill(n,o)},WM=(e,t)=>{e.setTooltip(t)},qM=(e,t)=>o=>{const n=zM(e,t);return ze(n,o.toUpperCase())},GM=(e,t,o)=>{if(ot(o))return"forecolor"===t?"Text color":"Background color";const n="forecolor"===t?"Text color {0}":"Background color {0}",r=ZM(NM(e,t),t,!1),i=$(r,e=>e.value===o).getOr({text:""}).text;return e.translate([n,e.translate(i)])},YM=(e,t,o,n)=>{e.ui.registry.addSplitButton(t,{tooltip:GM(e,o,n.get()),presets:"color",icon:"forecolor"===t?"text-color":"highlight-bg-color",select:qM(e,o),columns:PM(e,o),fetch:$M(NM(e,o),o,IM(e)),onAction:t=>{UM(e,o,n.get(),v)},onItemAction:(r,i)=>{UM(e,o,i,o=>{n.set(o),gM(e,{name:t,color:o})})},onSetup:r=>{jM(r,t,n.get());const i=n=>{n.name===t&&(jM(r,n.name,n.color),WM(r,GM(e,o,n.color)))};return e.on("TextColorChange",i),bM(yM(e)(r),()=>{e.off("TextColorChange",i)})}})},XM=(e,t,o,n,r)=>{e.ui.registry.addNestedMenuItem(t,{text:n,icon:"forecolor"===t?"text-color":"highlight-bg-color",onSetup:n=>(WM(n,GM(e,o,r.get())),jM(n,t,r.get()),yM(e)(n)),getSubmenuItems:()=>[{type:"fancymenuitem",fancytype:"colorswatch",select:qM(e,o),initData:{storageKey:o},onAction:n=>{UM(e,o,n.value,o=>{r.set(o),gM(e,{name:t,color:o})})}}]})},KM=e=>(t,o)=>{let n=!1;const r={colorpicker:o};e.windowManager.open({title:"Color Picker",size:"normal",body:{type:"panel",items:[{type:"colorpicker",name:"colorpicker",label:"Color"}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:r,onAction:(e,t)=>{"hex-valid"===t.name&&(n=t.value)},onSubmit:o=>{const r=o.getData().colorpicker;n?(t(A.from(r)),o.close()):e.windowManager.alert(e.translate(["Invalid hex color code: {0}",r]))},onClose:v,onCancel:()=>{t(A.none())}})},JM=(e,t,o,n,r,i,s,a)=>{const l=qS(t),c=QM(t,o,n,"color"!==r?"normal":"color",i,s,a);return XS(e,l,c,n,{menuType:r})},QM=(e,t,o,n,r,i,s)=>He(L(e,a=>{return"choiceitem"===a.type?(l=a,Ti("choicemenuitem",ZO,l)).fold(GS,a=>A.some($A(a,1===o,n,t,i(a.value),r,s,qS(e)))):"imageitem"===a.type?(e=>Ti("imagemenuitem",YO,e))(a).fold(GS,e=>A.some(((e,t,o,n,r)=>{const i=zA({presets:"img",textContent:A.none(),htmlContent:A.none(),ariaLabel:e.tooltip,iconContent:A.some(e.url),labelContent:e.label,shortcutContent:A.none(),checkMark:A.some(IA(r.icons)),caret:A.none(),value:e.value},r,!0),s=e.tooltip.map(e=>ab.config(r.tooltips.getConfig({tooltipText:r.translate(e)})));return Le(OA({context:e.context,data:AA(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Yv.set(e,t)},isActive:()=>Yv.isOn(e),isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t)}),onAction:o=>{t(e.value),o.setActive(!0)},onSetup:e=>(e.setActive(o),v),triggersSubmenu:!1,itemBehaviours:[...s.toArray()]},i,n,r),{toggling:{toggleClass:wS,toggleOnExecute:!1,selected:e.active,exclusive:!0}})})(e,t,i(e.value),r,s))):"resetimage"===a.type?(e=>Ti("resetimageitem",XO,e))(a).fold(GS,a=>A.some($A({...a,type:"choiceitem",text:a.tooltip,icon:A.some(a.icon),label:A.some(a.label)},1===o,n,t,i(a.value),r,s,qS(e)))):A.none();var l})),eB=(e,t)=>{const o=MS(t);return 1===e?{mode:"menu",moveOnTab:!0}:"auto"===e?{mode:"grid",selector:"."+o.item,initSize:{numColumns:1,numRows:1}}:{mode:"matrix",rowSelector:"."+{color:"tox-swatches__row",imageselector:"tox-image-selector__row",listpreview:"tox-collection__group",normal:"tox-collection__group"}[t],previousSelector:e=>"color"===t?Gn(e.element,"[aria-checked=true]"):A.none()}},tB=Pe("cell-over"),oB=Pe("cell-execute"),nB=(e,t,o)=>{const n=o=>Dc(o,oB,{row:e,col:t}),r=(e,t)=>{t.stop(),n(e)};return Am({dom:{tag:"div",attributes:{role:"button","aria-label":o}},behaviours:id([ud("insert-table-picker-cell",[Zc(bs(),fd.focus),Zc(Ps(),n),Zc(Ss(),r),Zc(Ls(),r)]),Yv.config({toggleClass:"tox-insert-table-picker__selected",toggleOnExecute:!1}),fd.config({onFocus:o=>Dc(o,tB,{row:e,col:t})})])})},rB=e=>q(e,e=>L(e,Mm)),iB=(e,t)=>Sm(`${t}x${e}`),sB={inserttable:(e,t)=>{const o=(e=>(t,o)=>e.shared.providers.translate(["{0} columns, {1} rows",o,t]))(t),n=(e=>{const t=[];for(let o=0;o<10;o++){const n=[];for(let t=0;t<10;t++){const r=e(o+1,t+1);n.push(nB(o,t,r))}t.push(n)}return t})(o),r=iB(0,0),i=db({dom:{tag:"span",classes:["tox-insert-table-picker__label"]},components:[r],behaviours:id([Qh.config({})])});return{type:"widget",data:{value:Pe("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ew.widget({dom:{tag:"div",classes:["tox-insert-table-picker"]},components:rB(n).concat(i.asSpec()),behaviours:id([ud("insert-table-picker",[Kc(e=>{Qh.set(i.get(e),[r])}),qc(tB,(e,t,o)=>{const{row:r,col:s}=o.event;((e,t,o)=>{for(let n=0;n<10;n++)for(let r=0;r<10;r++)Yv.set(e[n][r],n<=t&&r<=o)})(n,r,s),Qh.set(i.get(e),[iB(r+1,s+1)])}),qc(oB,(t,o,n)=>{const{row:r,col:i}=n.event;Vc(t,zs()),e.onAction({numRows:r+1,numColumns:i+1})})]),_h.config({initSize:{numRows:10,numColumns:10},mode:"flatgrid",selector:'[role="button"]'})])})]}},colorswatch:(e,t)=>{const o=((e,t)=>{const o=e.initData.allowCustomColors&&t.colorinput.hasCustomColors();return e.initData.colors.fold(()=>ZM(t.colorinput.getColors(e.initData.storageKey),e.initData.storageKey,o),e=>e.concat(HM(o)))})(e,t),n=t.colorinput.getColorCols(e.initData.storageKey),r="color",i=JM(Pe("menu-value"),o,t=>{e.onAction({value:t})},n,r,gS.CLOSE_ON_EXECUTE,e.select.getOr(E),t.shared.providers),s={...i,markers:MS(r),movement:eB(n,r),showMenuRole:!1};return{type:"widget",data:{value:Pe("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem"]},autofocus:!0,components:[ew.widget(Jb.sketch(s))]}},imageselect:(e,t)=>{const o="imageselector",n=e.initData.columns,r=JM(Pe("menu-value"),e.initData.items,t=>{e.onAction({value:t})},n,o,gS.CLOSE_ON_EXECUTE,e.select.getOr(E),t.shared.providers),i={...r,markers:MS(o),movement:eB(n,o),showMenuRole:!1};return{type:"widget",data:{value:Pe("widget-id")},dom:{tag:"div",classes:["tox-fancymenuitem","tox-collection--toolbar"]},autofocus:!0,components:[ew.widget(Jb.sketch(i))]}}},aB=e=>({type:"separator",dom:{tag:"div",classes:[vS,"tox-collection__group-heading"]},components:e.text.map(Sm).toArray()}),lB=(e,t,o)=>{LS(e).each(e=>{var n;((e,t)=>{Go(t.element,"id").each(t=>jo(e.element,"aria-activedescendant",t))})(e,o),(ir((n=t).element,HS)?A.some(n.element):Gn(n.element,"."+HS)).each(t=>{Go(t,"id").each(t=>jo(e.element,"aria-controls",t))})}),jo(o.element,"aria-selected","true")},cB=(e,t,o)=>{jo(o.element,"aria-selected","false")},dB=e=>Hm.getExistingCoupled(e,"sandbox").bind(IS).map(FS).map(e=>e.fetchPattern).getOr("");var uB;!function(e){e[e.ContentFocus=0]="ContentFocus",e[e.UiFocus=1]="UiFocus"}(uB||(uB={}));const hB=(e,t,o,n,r)=>{const i=o.shared.providers,s=e=>r?{...e,shortcut:A.none(),icon:e.text.isSome()?A.none():e.icon}:e;switch(e.type){case"menuitem":return(a=e,Ti("menuitem",KO,a)).fold(GS,e=>A.some(((e,t,o,n=!0)=>{const r=zA({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),labelContent:A.none(),ariaLabel:e.text,caret:A.none(),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return OA({context:e.context,data:AA(e),getApi:e=>({isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t)}),enabled:e.enabled,onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o)})(s(e),t,i,n)));case"nestedmenuitem":return(e=>Ti("nestedmenuitem",JO,e))(e).fold(GS,e=>A.some(((e,t,o,n=!0,r=!1)=>{const i=r?(s=o.icons,RA("chevron-down",s,[CS])):(e=>RA("chevron-right",e,[CS]))(o.icons);var s;const a=zA({presets:"normal",iconContent:e.icon,textContent:e.text,htmlContent:A.none(),ariaLabel:e.text,labelContent:A.none(),caret:A.some(i),checkMark:A.none(),shortcutContent:e.shortcut},o,n);return OA({context:e.context,data:AA(e),getApi:e=>({isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t),setIconFill:(t,o)=>{Gn(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{jo(e,"fill",o)})},setTooltip:t=>{const n=o.translate(t);jo(e.element,"aria-label",n)}}),enabled:e.enabled,onAction:v,onSetup:e.onSetup,triggersSubmenu:!0,itemBehaviours:[]},a,t,o)})(s(e),t,i,n,r)));case"togglemenuitem":return(e=>Ti("togglemenuitem",QO,e))(e).fold(GS,e=>A.some(((e,t,o,n=!0)=>{const r=zA({iconContent:e.icon,textContent:e.text,htmlContent:A.none(),labelContent:A.none(),ariaLabel:e.text,checkMark:A.some(IA(o.icons)),caret:A.none(),shortcutContent:e.shortcut,presets:"normal",meta:e.meta},o,n);return Le(OA({context:e.context,data:AA(e),enabled:e.enabled,getApi:e=>({setActive:t=>{Yv.set(e,t)},isActive:()=>Yv.isOn(e),isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t)}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:[]},r,t,o),{toggling:{toggleClass:wS,toggleOnExecute:!1,selected:e.active},role:e.role.getOrUndefined()})})(s(e),t,i,n)));case"separator":return(e=>Ti("separatormenuitem",gO,e))(e).fold(GS,e=>A.some(aB(e)));case"fancymenuitem":return(e=>Ti("fancymenuitem",GO,e))(e).fold(GS,e=>((e,t)=>fe(sB,e.fancytype).map(o=>o(e,t)))(e,o));default:return console.error("Unknown item in general menu",e),A.none()}var a},mB=(e,t,o,n,r,i,s)=>{const a=1===n,l=!a||qS(e);return He(L(e,e=>{switch(e.type){case"separator":return(n=e,Ti("Autocompleter.Separator",gO,n)).fold(GS,e=>A.some(aB(e)));case"cardmenuitem":return(e=>Ti("cardmenuitem",UO,e))(e).fold(GS,e=>A.some(((e,t,o,n)=>{const r={dom:LA(e.label,[]),optComponents:[A.some({dom:{tag:"div",classes:[SS,TS]},components:ZA(e.items,n)})]};return OA({context:"mode:design",data:AA({text:A.none(),...e}),enabled:e.enabled,getApi:e=>({isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>{tp.set(e,!t),F(hr(e.element,"*"),o=>{e.getSystem().getByDom(o).each(e=>{e.hasConfigured(tp)&&tp.set(e,!t)})})}}),onAction:e.onAction,onSetup:e.onSetup,triggersSubmenu:!1,itemBehaviours:A.from(n.itemBehaviours).getOr([])},r,t,o.providers)})({...e,onAction:t=>{e.onAction(t),o(e.value,e.meta)}},r,i,{itemBehaviours:HA(e.meta,i,A.none()),cardText:{matchText:t,highlightOn:s}})));default:return(e=>Ti("Autocompleter.Item",fO,e))(e).fold(GS,e=>A.some(((e,t,o,n,r,i,s,a=!0)=>{const l=zA({presets:n,textContent:A.none(),htmlContent:o?e.text.map(e=>UA(e,t)):A.none(),ariaLabel:e.text,labelContent:A.none(),iconContent:e.icon,shortcutContent:A.none(),checkMark:A.none(),caret:A.none(),value:e.value},s.providers,a,e.icon),c=e.text.filter(e=>!o&&""!==e);return OA({context:"mode:design",data:AA(e),enabled:e.enabled,getApi:w({}),onAction:t=>r(e.value,e.meta),onSetup:w(v),triggersSubmenu:!1,itemBehaviours:HA(e,s,c)},l,i,s.providers)})(e,t,a,"normal",o,r,i,l)))}var n}))},pB=(e,t,o,n,r,i)=>{const s=qS(t),a=He(L(t,e=>{const t=e=>hB(e,o,n,(e=>r?!ve(e,"text"):s)(e),r);return"nestedmenuitem"===e.type&&e.getSubmenuItems().length<=0?t({...e,enabled:!1}):t(e)})),l=(e=>"no-search"===e.searchMode?{menuType:"normal"}:{menuType:"searchable",searchMode:e})(i);return(r?YS:XS)(e,s,a,1,l)},gB=e=>sy.singleData(e.value,e),fB=e=>br(ct(e.startContainer),e.startOffset,ct(e.endContainer),e.endOffset),vB=(e,t)=>{const o=Pe("autocompleter"),n=we(!1),r=we(!1),i=Ge(),s=Am(Gy.sketch({dom:{tag:"div",classes:["tox-autocompleter"],attributes:{id:o}},components:[],fireDismissalEventInstead:{},inlineBehaviours:id([ud("dismissAutocompleter",[Zc(Ys(),()=>u()),Zc(oa(),(t,o)=>{Go(o.event.target,"id").each(t=>jo(ct(e.getBody()),"aria-activedescendant",t))})])]),lazySink:t.getSink})),a=()=>Gy.isOpen(s),l=r.get,c=()=>{if(a()){Gy.hide(s),e.dom.remove(o,!1);const t=ct(e.getBody());Go(t,"aria-owns").filter(e=>e===o).each(()=>{Xo(t,"aria-owns"),Xo(t,"aria-activedescendant")})}},d=()=>Gy.getContent(s).bind(e=>ee(e.components(),0)),u=()=>e.execCommand("mceAutocompleterClose"),h=r=>{const a=(o=>{const r=re(o,e=>A.from(e.columns)).getOr(1);return q(o,o=>{const s=o.items;return mB(s,o.matchText,(t,r)=>{const s={hide:()=>u(),reload:t=>{c(),e.execCommand("mceAutocompleterReload",!1,{fetchOptions:t})}};e.execCommand("mceAutocompleterRefreshActiveRange"),i.get().each(e=>{n.set(!0),o.onAction(s,e,t,r),n.set(!1)})},r,gS.BUBBLE_TO_SANDBOX,t,o.highlightOn)})})(r);a.length>0?(((t,o)=>{const n=re(t,e=>A.from(e.columns)).getOr(1);Gy.showMenuAt(s,{anchor:{type:"selection",getSelection:()=>i.get().map(fB),root:ct(e.getBody())}},((e,t,o,n)=>{const r=eB(t,n),i=MS(n);return{data:gB({...e,movement:r,menuBehaviours:cA("auto"!==t?[]:[Kc((e,t)=>{lA(e,4,i.item).each(({numColumns:t,numRows:o})=>{_h.setGridSize(e,o,t)})})])}),menu:{markers:MS(n),fakeFocus:o===uB.ContentFocus}}})(XS("autocompleter-value",!0,o,n,{menuType:"normal"}),n,uB.ContentFocus,"normal")),d().each(jd.highlightFirst)})(r,a),jo(ct(e.getBody()),"aria-owns",o),e.inline||m()):c()},m=()=>{e.dom.get(o)&&e.dom.remove(o,!1);const t=e.getDoc().documentElement,n=e.selection.getNode(),r=(e=>Qo(e,!0))(s.element);un(r,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",top:`${n.offsetTop}px`,left:`${n.offsetLeft}px`}),e.dom.add(t,r.dom),Gn(r,'[role="menu"]').each(e=>{bn(e,"position"),bn(e,"max-height")})};e.on("AutocompleterStart",({lookupData:e})=>{r.set(!0),n.set(!1),h(e)}),e.on("AutocompleterUpdate",({lookupData:e})=>h(e)),e.on("AutocompleterUpdateActiveRange",({range:e})=>i.set(e)),e.on("AutocompleterEnd",()=>{c(),r.set(!1),n.set(!1),i.clear()});((e,t)=>{const o=(e,t)=>{Dc(e,_s(),{raw:t})},n=()=>e.getMenu().bind(jd.getHighlighted);t.on("keydown",t=>{const r=t.which;e.isActive()&&(e.isMenuOpen()?13===r?(n().each(Pc),t.preventDefault()):40===r?(n().fold(()=>{e.getMenu().each(jd.highlightFirst)},e=>{o(e,t)}),t.preventDefault(),t.stopImmediatePropagation()):37!==r&&38!==r&&39!==r||n().each(e=>{o(e,t),t.preventDefault(),t.stopImmediatePropagation()}):13!==r&&38!==r&&40!==r||e.cancelIfNecessary())}),t.on("NodeChange",()=>{!e.isActive()||e.isProcessingAction()||t.queryCommandState("mceAutoCompleterInRange")||e.cancelIfNecessary()})})({cancelIfNecessary:u,isMenuOpen:a,isActive:l,isProcessingAction:n.get,getMenu:d},e)};var bB=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.html.Entities");const yB=(e,t,o,n)=>{const r=wB(e,t,o,n);return Uy.sketch(r)},wB=(e,t,o,n)=>({dom:_B(o),components:e.toArray().concat([t]),fieldBehaviours:id(n)}),_B=e=>({tag:"div",classes:["tox-form__group"].concat(e)}),xB=(e,t)=>Uy.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Sm(t.translate(e))]}),CB=Pe("form-component-change"),kB=Pe("form-component-input"),SB=Pe("form-close"),TB=Pe("form-cancel"),EB=Pe("form-action"),OB=Pe("form-submit"),AB=Pe("form-block"),MB=Pe("form-unblock"),BB=Pe("form-tabchange"),RB=Pe("form-resize"),NB=(e,t,o)=>{const n=e.label.map(e=>xB(e,t)),r=t.icons(),i=e=>(t,o)=>{Yn(o.event.target,"[data-collection-item-value]").each(n=>{e(t,o,n,qo(n,"data-collection-item-value"))})},s=i((o,n,r,i)=>{n.stop(),t.checkUiComponentContext("mode:design").shouldDisable||t.isDisabled()||Dc(o,EB,{name:e.name,value:i})}),a=[Zc(bs(),i((e,t,o)=>{Vo(o,!0)})),Zc(Ss(),s),Zc(Ls(),s),Zc(ys(),i((e,t,o)=>{Gn(e.element,"."+kS).each(e=>{rr(e,kS)}),or(o,kS)})),Zc(ws(),i(e=>{Gn(e.element,"."+kS).each(e=>{rr(e,kS),Do(e)})})),ed(i((t,o,n,r)=>{Dc(t,EB,{name:e.name,value:r})}))],l=(e,t)=>L(hr(e.element,".tox-collection__item"),t),c=Uy.parts.field({dom:{tag:"div",classes:["tox-collection"].concat(1!==e.columns?["tox-collection--grid"]:["tox-collection--list"])},components:[],factory:{sketch:_},behaviours:id([tp.config({disabled:()=>t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{l(e,e=>{or(e,"tox-collection__item--state-disabled"),jo(e,"aria-disabled",!0)})},onEnabled:e=>{l(e,e=>{rr(e,"tox-collection__item--state-disabled"),Xo(e,"aria-disabled")})}}),kA(()=>t.checkUiComponentContext(e.context)),Qh.config({}),ab.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{Gn(e.element,"."+kS+"[data-mce-tooltip]").each(o=>{Go(o,"data-mce-tooltip").each(o=>{ab.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-keyboard-focus",anchor:e=>({type:"node",node:Gn(e.element,"."+kS).orThunk(()=>yt(".tox-collection__item")),root:e.element,layouts:{onLtr:w([Wl,jl,Hl,Zl,Ul,$l]),onRtl:w([Wl,jl,Hl,Zl,Ul,$l])},bubble:_l(0,-2,{})})}),Yg.config({store:{mode:"memory",initialValue:o.getOr([])},onSetValue:(o,n)=>{((o,n)=>{const i=t.checkUiComponentContext("mode:design").shouldDisable||t.isDisabled()?" tox-collection__item--state-disabled":"",s=L(n,t=>{const o=tS.translate(t.text),n=1===e.columns?`<div class="tox-collection__item-label">${o}</div>`:"",s=`<div class="tox-collection__item-icon">${(e=>{var t;return null!==(t=r[e])&&void 0!==t?t:e})(t.icon)}</div>`,a={_:" "," - ":" ","-":" "},l=o.replace(/\_| \- |\-/g,e=>a[e]);return`<div data-mce-tooltip="${l}" class="tox-collection__item${i}" tabindex="-1" data-collection-item-value="${bB.encodeAllRaw(t.value)}" aria-label="${l}">${s}${n}</div>`}),a="auto"!==e.columns&&e.columns>1?I(s,e.columns):[s],l=L(a,e=>`<div class="tox-collection__group">${e.join("")}</div>`);tn(o.element,l.join(""))})(o,n),"auto"===e.columns&&lA(o,5,"tox-collection__item").each(({numRows:e,numColumns:t})=>{_h.setGridSize(o,e,t)}),Vc(o,RB)}}),Hv.config({}),_h.config((d=e.columns,1===d?{mode:"menu",moveOnTab:!1,selector:".tox-collection__item"}:"auto"===d?{mode:"flatgrid",selector:".tox-collection__item",initSize:{numColumns:1,numRows:1}}:{mode:"matrix",selectors:{row:".tox-collection__group",cell:`.${vS}`}})),ud("collection-events",a)]),eventOrder:{[Ps()]:["disabling","alloy.base.behaviour","collection-events"],[ys()]:["collection-events","tooltipping"]}});var d;return yB(n,c,["tox-form__group--collection"],[])},VB=Pe("color-input-change"),DB=Pe("color-swatch-change"),PB=Pe("color-picker-cancel"),IB=()=>Im.config({find:A.some}),LB=e=>Im.config({find:t=>vo(t.element,e).bind(e=>t.getSystem().getByDom(e).toOptional())}),FB=bi([Ji("preprocess",_),Ji("postprocess",_)]),zB=(e,t)=>{const o=Oi("RepresentingConfigs.memento processors",FB,t);return Yg.config({store:{mode:"manual",getValue:t=>{const n=e.get(t),r=Yg.getValue(n);return o.postprocess(r)},setValue:(t,n)=>{const r=o.preprocess(n),i=e.get(t);Yg.setValue(i,r)}}})},HB=(e,t,o)=>Yg.config({store:{mode:"manual",...e.map(e=>({initialValue:e})).getOr({}),getValue:t,setValue:o}}),UB=(e,t,o)=>HB(e,e=>t(e.element),(e,t)=>o(e.element,t)),ZB=e=>Yg.config({store:{mode:"memory",initialValue:e}}),$B=Pe("rgb-hex-update"),jB=Pe("slider-update"),WB=Pe("palette-update"),qB=Pe("valid-input"),GB=Pe("invalid-input"),YB=Pe("validating-input"),XB="colorcustom.rgb.",KB={isEnabled:O,setEnabled:v,immediatelyShow:v,immediatelyHide:v},JB=(e,t,o,n,r,i)=>{const s=(e,t)=>{const o=t.get();e!==o.isEnabled()&&(o.setEnabled(e),e?o.immediatelyShow():o.immediatelyHide())},a=(o,n,r)=>Xg.config({invalidClass:t("invalid"),notify:{onValidate:e=>{Dc(e,YB,{type:o})},onValid:e=>{s(!1,r),Dc(e,qB,{type:o,value:Yg.getValue(e)})},onInvalid:e=>{s(!0,r),Dc(e,GB,{type:o,value:Yg.getValue(e)})}},validator:{validate:t=>{const o=Yg.getValue(t),r=n(o)?Ae.value(!0):Ae.error(e("aria.input.invalid"));return Te(r)},validateOnLoad:!1}}),l=(o,n,s,l,c)=>{const d=we(KB),u=e(XB+"range"),h=Uy.parts.label({dom:{tag:"label"},components:[Sm(s)]}),m=Uy.parts.field({data:c,factory:Qy,inputAttributes:{type:"text","aria-label":l,..."hex"===n?{"aria-live":"polite"}:{}},inputClasses:[t("textfield")],inputBehaviours:id([a(n,o,d),Hv.config({}),ab.config({...r({tooltipText:"",onSetup:e=>{d.set({isEnabled:()=>ab.isEnabled(e),setEnabled:t=>ab.setEnabled(e,t),immediatelyShow:()=>ab.immediateOpenClose(e,!0),immediatelyHide:()=>ab.immediateOpenClose(e,!1)}),ab.setEnabled(e,!1)},onShow:(o,r)=>{ab.setComponents(o,[{dom:{tag:"p",classes:[t("rgb-warning-note")]},components:[Sm(e("hex"===n?"colorcustom.rgb.invalidHex":"colorcustom.rgb.invalid"))]}])}})})]),onSetValue:e=>{Xg.isInvalid(e)&&Xg.run(e).get(v)}}),p=Pe("aria-invalid"),g=db(i("invalid",A.some(p),"warning")),f=[h,m,db({dom:{tag:"div",classes:[t("invalid-icon")]},components:[g.asSpec()]}).asSpec()],b="hex"!==n?[Uy.parts["aria-descriptor"]({text:u})]:[],y=f.concat(b);return{dom:{tag:"div",attributes:{role:"presentation"},classes:[t("rgb-container")]},components:y}},c=(e,t)=>{const o=t.red,n=t.green,r=t.blue;Yg.setValue(e,{red:o,green:n,blue:r})},d=db({dom:{tag:"div",classes:[t("rgba-preview")],styles:{"background-color":"white"},attributes:{role:"presentation"}}}),u=(e,t)=>{d.getOpt(e).each(e=>{dn(e.element,"background-color","#"+t.value)})},h=ng({factory:()=>{const r={red:we(A.some(255)),green:we(A.some(255)),blue:we(A.some(255)),hex:we(A.some("ffffff"))},i=e=>r[e].get(),s=(e,t)=>{r[e].set(t)},a=e=>{const t=e.red,o=e.green,n=e.blue;s("red",A.some(t)),s("green",A.some(o)),s("blue",A.some(n))},h=(e,t)=>{const o=t.event;"hex"!==o.type?s(o.type,A.none()):n(e)},m=(e,t)=>{const n=t.event;(e=>"hex"===e.type)(n)?((e,t)=>{o(e);const n=jA(t);s("hex",A.some(n.value));const r=lM(n);c(e,r),a(r),Dc(e,$B,{hex:n}),u(e,n)})(e,n.value):((e,t,o)=>{const n=parseInt(o,10);s(t,A.some(n)),i("red").bind(e=>i("green").bind(t=>i("blue").map(o=>iM(e,t,o,1)))).each(t=>{const o=((e,t)=>{const o=KA(t);return Ay.getField(e,"hex").each(t=>{fd.isFocused(t)||Yg.setValue(e,{hex:o.value})}),o})(e,t);Dc(e,$B,{hex:o}),u(e,o)})})(e,n.type,n.value)},p=t=>({label:e(XB+t+".label"),description:e(XB+t+".description")}),g=p("red"),f=p("green"),v=p("blue"),b=p("hex");return Le(Ay.sketch(o=>({dom:{tag:"form",classes:[t("rgb-form")],attributes:{"aria-label":e("aria.color.picker")}},components:[o.field("red",Uy.sketch(l(sM,"red",g.label,g.description,255))),o.field("green",Uy.sketch(l(sM,"green",f.label,f.description,255))),o.field("blue",Uy.sketch(l(sM,"blue",v.label,v.description,255))),o.field("hex",Uy.sketch(l(GA,"hex",b.label,b.description,"ffffff"))),d.asSpec()],formBehaviours:id([Xg.config({invalidClass:t("form-invalid")}),ud("rgb-form-events",[Zc(qB,m),Zc(GB,h),Zc(YB,h)])])})),{apis:{updateHex:(e,t)=>{Yg.setValue(e,{hex:t.value}),((e,t)=>{const o=lM(t);c(e,o),a(o)})(e,t),u(e,t)}}})},name:"RgbForm",configFields:[],apis:{updateHex:(e,t,o)=>{e.updateHex(t,o)}},extraApis:{}});return h},QB=(e,t,o,n)=>{const r=ng({name:"ColourPicker",configFields:[Di("dom"),Ji("onValidHex",v),Ji("onInvalidHex",v)],factory:r=>{const i=JB(e,t,r.onValidHex,r.onInvalidHex,o,n),s=((e,t)=>{const o=H_.parts.spectrum({dom:{tag:"canvas",attributes:{role:"presentation"},classes:[t("sv-palette-spectrum")]}}),n=H_.parts.thumb({dom:{tag:"div",attributes:{role:"presentation"},classes:[t("sv-palette-thumb")],innerHtml:`<div class=${t("sv-palette-inner-thumb")} role="presentation"></div>`}}),r=(e,t)=>{const{width:o,height:n}=e,r=e.getContext("2d");if(null===r)return;r.fillStyle=t,r.fillRect(0,0,o,n);const i=r.createLinearGradient(0,0,o,0);i.addColorStop(0,"rgba(255,255,255,1)"),i.addColorStop(1,"rgba(255,255,255,0)"),r.fillStyle=i,r.fillRect(0,0,o,n);const s=r.createLinearGradient(0,0,0,n);s.addColorStop(0,"rgba(0,0,0,0)"),s.addColorStop(1,"rgba(0,0,0,1)"),r.fillStyle=s,r.fillRect(0,0,o,n)},i=ng({factory:i=>{const s=w({x:0,y:0}),a=id([Im.config({find:A.some}),fd.config({})]);return H_.sketch({dom:{tag:"div",attributes:{role:"slider","aria-valuetext":e(["Saturation {0}%, Brightness {1}%",0,0])},classes:[t("sv-palette")]},model:{mode:"xy",getInitialValue:s},rounded:!1,components:[o,n],onChange:(t,o,n)=>{g(n)||jo(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",Math.floor(n.x),Math.floor(100-n.y)])),Dc(t,WB,{value:n})},onInit:(e,t,o,n)=>{r(o.element.dom,uM(hM))},sliderBehaviours:a})},name:"SaturationBrightnessPalette",configFields:[],apis:{setHue:(e,t,o)=>{((e,t)=>{const o=e.components()[0].element.dom,n=JA(t,100,100),i=aM(n);r(o,uM(i))})(t,o)},setThumb:(t,o,n)=>{((t,o)=>{const n=QA(lM(o));H_.setValue(t,{x:n.saturation,y:100-n.value}),jo(t.element,"aria-valuetext",e(["Saturation {0}%, Brightness {1}%",n.saturation,n.value]))})(o,n)}},extraApis:{}});return i})(e,t),a={paletteRgba:we(hM),paletteHue:we(0)},l=db(((e,t)=>{const o=H_.parts.spectrum({dom:{tag:"div",classes:[t("hue-slider-spectrum")],attributes:{role:"presentation"}}}),n=H_.parts.thumb({dom:{tag:"div",classes:[t("hue-slider-thumb")],attributes:{role:"presentation"}}});return H_.sketch({dom:{tag:"div",classes:[t("hue-slider")],attributes:{role:"slider","aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":120}},rounded:!1,model:{mode:"y",getInitialValue:w(0)},components:[o,n],sliderBehaviours:id([fd.config({})]),onChange:(e,t,o)=>{jo(e.element,"aria-valuenow",Math.floor(360-3.6*o)),Dc(e,jB,{value:o})}})})(0,t)),c=db(s.sketch({})),d=db(i.sketch({})),u=(e,t,o)=>{c.getOpt(e).each(e=>{s.setHue(e,o)})},h=(e,t)=>{d.getOpt(e).each(e=>{i.updateHex(e,t)})},m=(e,t,o)=>{l.getOpt(e).each(e=>{H_.setValue(e,(e=>100-e/360*100)(o))})},p=(e,t)=>{c.getOpt(e).each(e=>{s.setThumb(e,t)})},f=(e,t,o,n)=>{((e,t)=>{const o=lM(e);a.paletteRgba.set(o),a.paletteHue.set(t)})(t,o),F(n,n=>{n(e,t,o)})};return{uid:r.uid,dom:r.dom,components:[c.asSpec(),l.asSpec(),d.asSpec()],behaviours:id([ud("colour-picker-events",[Zc($B,(()=>{const e=[u,m,p];return(t,o)=>{const n=o.event.hex,r=(e=>QA(lM(e)))(n);f(t,n,r.hue,e)}})()),Zc(WB,(()=>{const e=[h];return(t,o)=>{const n=o.event.value,r=a.paletteHue.get(),i=JA(r,n.x,100-n.y),s=mM(i);f(t,s,r,e)}})()),Zc(jB,(()=>{const e=[u,h];return(t,o)=>{const n=(e=>(100-e)/100*360)(o.event.value),r=a.paletteRgba.get(),i=QA(r),s=JA(n,i.saturation,i.value),l=mM(s);f(t,l,n,e)}})())]),Im.config({find:e=>d.getOpt(e)}),_h.config({mode:"acyclic"})])}}});return r},eR={"colorcustom.rgb.red.label":"R","colorcustom.rgb.red.description":"Red channel","colorcustom.rgb.green.label":"G","colorcustom.rgb.green.description":"Green channel","colorcustom.rgb.blue.label":"B","colorcustom.rgb.blue.description":"Blue channel","colorcustom.rgb.hex.label":"#","colorcustom.rgb.hex.description":"Hex color code","colorcustom.rgb.range":"Range 0 to 255","colorcustom.rgb.invalid":"Numbers only, 0 to 255","colorcustom.rgb.invalidHex":"Hexadecimal only, 000000 to FFFFFF","aria.color.picker":"Color Picker","aria.input.invalid":"Invalid input"};var tR=window.mailpoetTinymce.util.Tools.resolve("mailpoetTinymce.Resource");const oR=e=>ve(e,"init");var nR=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.Tools");const rR=Pe("browse.files.event"),iR=(e,t,o)=>{const n=(e,t)=>{t.stop()},r=e=>(t,o)=>{F(e,e=>{e(t,o)})},i=db({dom:{tag:"input",attributes:{type:"file",accept:"image/*"},styles:{display:"none"}},behaviours:id([ud("input-file-events",[Gc(Ss()),Gc(Ls())])])}),s=e.label.map(e=>xB(e,t)),a=Uy.parts.field({factory:Tb,dom:{tag:"button",styles:{position:"relative"},classes:["tox-button","tox-button--secondary"]},components:[Sm(t.translate("Browse for an image")),i.asSpec()],action:e=>{i.get(e).element.dom.click()},buttonBehaviours:id([IB(),ZB(o.getOr([])),Hv.config({}),uA(()=>t.checkUiComponentContext(e.context).shouldDisable),kA(()=>t.checkUiComponentContext(e.context))])}),l={dom:{tag:"div",classes:["tox-dropzone-container"]},behaviours:id([tp.config({disabled:()=>t.checkUiComponentContext(e.context).shouldDisable}),kA(()=>t.checkUiComponentContext(e.context)),Yv.config({toggleClass:"dragenter",toggleOnExecute:!1}),ud("dropzone-events",[Zc("dragenter",r([n,Yv.toggle])),Zc("dragleave",r([n,Yv.toggle])),Zc("dragover",n),Zc("drop",r([n,(e,t)=>{var o;if(!tp.isDisabled(e)){const n=t.event.raw;Dc(e,rR,{files:null===(o=n.dataTransfer)||void 0===o?void 0:o.files})}}])),Zc(ks(),(e,t)=>{const o=t.event.raw.target;Dc(e,rR,{files:o.files})})])]),components:[{dom:{tag:"div",classes:["tox-dropzone"],styles:{}},components:[{dom:{tag:"p"},components:[Sm(t.translate("Drop an image here"))]},a]}]};return yB(s,l,["tox-form__group--stretched"],[ud("handle-files",[Zc(rR,(o,n)=>{Uy.getField(o).each(o=>{var r,i;r=o,(i=n.event.files)&&(Yg.setValue(r,((e,t)=>{const o=nR.explode(t.getOption("images_file_types"));return H(ne(e),e=>D(o,t=>Qe(e.name.toLowerCase(),`.${t.toLowerCase()}`)))})(i,t)),Dc(r,CB,{name:e.name}))})})])])},sR=Pe("alloy-fake-before-tabstop"),aR=Pe("alloy-fake-after-tabstop"),lR=e=>({dom:{tag:"div",styles:{width:"1px",height:"1px",outline:"none"},attributes:{tabindex:"0"},classes:e},behaviours:id([fd.config({ignore:!0}),Hv.config({})])}),cR=(e,t)=>({dom:{tag:"div",classes:["tox-navobj",...e.getOr([])]},components:[lR([sR]),t,lR([aR])],behaviours:id([LB(1)])}),dR=(e,t)=>{Dc(e,_s(),{raw:{which:9,shiftKey:t}})},uR=(e,t)=>{const o=t.element;ir(o,sR)?dR(e,!0):ir(o,aR)&&dR(e,!1)},hR=e=>pr(e,["."+sR,"."+aR].join(","),E),mR=Pe("update-dialog"),pR=Pe("update-title"),gR=Pe("update-body"),fR=Pe("update-footer"),vR=Pe("body-send-message"),bR=Pe("dialog-focus-shifted"),yR=Kt().browser,wR=yR.isSafari(),_R=yR.isFirefox(),xR=wR||_R,CR=yR.isChromium(),kR=({scrollTop:e,scrollHeight:t,clientHeight:o})=>Math.ceil(e)+o>=t,SR=(e,t)=>e.scrollTo(0,"bottom"===t?99999999:t),TR=(e,t,o)=>{const n=e.dom;A.from(n.contentDocument).fold(o,e=>{let o=0;const r=((e,t)=>{const o=e.body;return A.from(!/^<!DOCTYPE (html|HTML)/.test(t)&&(!CR&&!wR||m(o)&&(0!==o.scrollTop||Math.abs(o.scrollHeight-o.clientHeight)>1))?o:e.documentElement)})(e,t).map(e=>(o=e.scrollTop,e)).forall(kR),i=()=>{const e=n.contentWindow;m(e)&&(r?SR(e,"bottom"):!r&&xR&&0!==o&&SR(e,o))};wR&&n.addEventListener("load",i,{once:!0}),e.open(),e.write(t),e.close(),wR||i()})},ER=$e(xR,wR?500:200).map(e=>((e,t)=>{let o=null,n=null;return{cancel:()=>{c(o)||(clearTimeout(o),o=null,n=null)},throttle:(...r)=>{n=r,c(o)&&(o=setTimeout(()=>{const t=n;o=null,n=null,e.apply(null,t)},t))}}})(TR,e)),OR=Pe("toolbar.button.execute"),AR=Pe("common-button-display-events"),MR={[Ps()]:["disabling","alloy.base.behaviour","toggling","toolbar-button-events","tooltipping"],[qs()]:["toolbar-button-events",AR],[Gs()]:["toolbar-button-events","dropdown-events","tooltipping"],[ps()]:["focusing","alloy.base.behaviour",AR]},BR=e=>dn(e.element,"width",mn(e.element,"width")),RR=(e,t,o)=>dS(e,{tag:"span",classes:["tox-icon","tox-tbtn__icon-wrap"],behaviours:o},t),NR=(e,t)=>RR(e,t,[]),VR=(e,t)=>RR(e,t,[Qh.config({})]),DR=(e,t,o)=>({dom:{tag:"span",classes:[`${t}__select-label`]},components:[Sm(o.translate(e))],behaviours:id([Qh.config({})])}),PR=Pe("update-menu-text"),IR=Pe("update-menu-icon"),LR=Pe("update-tooltip-text"),FR=(e,t,o,n)=>{const r=we(v),i=we(e.tooltip),s=e.text.map(e=>db(DR(e,t,o.providers))),a=e.icon.map(e=>db(VR(e,o.providers.icons))),l=(e,t)=>{const o=Yg.getValue(e);return fd.focus(o),Dc(o,"keydown",{raw:t.event.raw}),ky.close(o),A.some(!0)},c=e.role.fold(()=>({}),e=>({role:e})),d=A.from(e.listRole).map(e=>({listRole:e})).getOr({}),u=e.ariaLabel.fold(()=>({}),e=>({"aria-label":o.providers.translate(e)})),h=dS("chevron-down",{tag:"div",classes:[`${t}__select-chevron`]},o.providers.icons),p=Pe("common-button-display-events"),g="dropdown-events",f=db(ky.sketch({...e.uid?{uid:e.uid}:{},...c,...d,dom:{tag:"button",classes:[t,`${t}--select`].concat(L(e.classes,e=>`${t}--${e}`)),attributes:{...u,...m(n)?{"data-mce-name":n}:{}}},components:EA([a.map(e=>e.asSpec()),s.map(e=>e.asSpec()),A.some(h)]),matchWidth:!0,useMinWidth:!0,onOpen:(t,o,n)=>{e.searchable&&(e=>{LS(e).each(e=>fd.focus(e))})(n)},dropdownBehaviours:id([...e.dropdownBehaviours,uA(()=>e.disabled||o.providers.checkUiComponentContext(e.context).shouldDisable),kA(()=>o.providers.checkUiComponentContext(e.context)),lb.config({}),Qh.config({}),...e.tooltip.map(t=>ab.config(o.providers.tooltips.getConfig({tooltipText:o.providers.translate(t),onShow:t=>{if(Ue(i.get(),e.tooltip,(e,t)=>t!==e).getOr(!1)){const e=o.providers.translate(i.get().getOr(""));ab.setComponents(t,o.providers.tooltips.getComponents({tooltipText:e}))}}}))).toArray(),ud(g,[gA(e,r),fA(e,r)]),ud(p,[Kc((t,o)=>{"listbox"!==e.listRole&&BR(t)})]),ud("update-dropdown-width-variable",[Zc(Ws(),(e,t)=>ky.close(e))]),ud("menubutton-update-display-text",[Zc(PR,(e,t)=>{s.bind(t=>t.getOpt(e)).each(e=>{Qh.set(e,[Sm(o.providers.translate(t.event.text))])})}),Zc(IR,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{Qh.set(e,[VR(t.event.icon,o.providers.icons)])})}),Zc(LR,(e,t)=>{const n=o.providers.translate(t.event.text);jo(e.element,"aria-label",n),i.set(A.some(t.event.text))})])]),eventOrder:Le(MR,{[ps()]:["focusing","alloy.base.behaviour","item-type-events","normal-dropdown-events"],[qs()]:["toolbar-button-events",ab.name(),g,p]}),sandboxBehaviours:id([_h.config({mode:"special",onLeft:l,onRight:l}),ud("dropdown-sandbox-events",[Zc(VS,(e,t)=>{(e=>{const t=Yg.getValue(e),o=IS(e).map(FS);ky.refetch(t).get(()=>{const e=Hm.getCoupled(t,"sandbox");o.each(t=>IS(e).each(e=>((e,t)=>{Yg.setValue(e,t.fetchPattern),e.element.dom.selectionStart=t.selectionStart,e.element.dom.selectionEnd=t.selectionEnd})(e,t)))})})(e),t.stop()}),Zc(DS,(e,t)=>{((e,t)=>{(e=>vv.getState(e).bind(jd.getHighlighted).bind(jd.getHighlighted))(e).each(o=>{((e,t,o,n)=>{const r={...n,target:t};e.getSystem().triggerEvent(o,t,r)})(e,o.element,t.event.eventType,t.event.interactionEvent)})})(e,t),t.stop()})])]),lazySink:o.getSink,toggleClass:`${t}--active`,parts:{menu:{...NS(0,e.columns,e.presets),fakeFocus:e.searchable,..."listbox"===e.listRole?{}:{onHighlightItem:lB,onCollapseMenu:(e,t,o)=>{jd.getHighlighted(o).each(t=>{lB(e,o,t)})},onDehighlightItem:cB}}},getAnchorOverrides:()=>({maxHeightFunction:(e,t)=>{Cc()(e,t-10)}}),fetch:t=>Se(C(e.fetch,t))}));return f.asSpec()},zR=e=>"separator"===e.type,HR={type:"separator"},UR=(e,t)=>{const o=((e,t)=>{const o=Z(e,(e,o)=>(e=>i(e))(o)?""===o?e:"|"===o?e.length>0&&!zR(e[e.length-1])?e.concat([HR]):e:ve(t,o.toLowerCase())?e.concat([t[o.toLowerCase()]]):e:e.concat([o]),[]);return o.length>0&&zR(o[o.length-1])&&o.pop(),o})(i(e)?e.split(" "):e,t);return U(o,(e,o)=>{if((e=>ve(e,"getSubmenuItems"))(o)){const n=(e=>{const t=fe(e,"value").getOrThunk(()=>Pe("generated-menu-item"));return Le({value:t},e)})(o),r=((e,t)=>{const o=e.getSubmenuItems(),n=UR(o,t);return{item:e,menus:Le(n.menus,{[e.value]:n.items}),expansions:Le(n.expansions,{[e.value]:e.value})}})(n,t);return{menus:Le(e.menus,r.menus),items:[r.item,...e.items],expansions:Le(e.expansions,r.expansions)}}return{...e,items:[o,...e.items]}},{menus:{},expansions:{},items:[]})},ZR=(e,t,o,n)=>{const r=Pe("primary-menu"),i=UR(e,o.shared.providers.menuItems());if(0===i.items.length)return A.none();const s=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-field",placeholder:e.placeholder})))(n),a=pB(r,i.items,t,o,n.isHorizontalMenu,s),l=(e=>e.search.fold(()=>({searchMode:"no-search"}),e=>({searchMode:"search-with-results"})))(n),c=le(i.menus,(e,n)=>pB(n,e,t,o,!1,l)),d=Le(c,as(r,a));return A.from(sy.tieredData(r,d,i.expansions))},$R=e=>!ve(e,"items"),jR="data-value",WR=(e,t,o,n,r)=>L(o,o=>$R(o)?{type:"togglemenuitem",...r?{}:{role:"option"},text:o.text,value:o.value,active:o.value===n,onAction:()=>{Yg.setValue(e,o.value),Dc(e,CB,{name:t}),fd.focus(e)}}:{type:"nestedmenuitem",text:o.text,getSubmenuItems:()=>WR(e,t,o.items,n,r)}),qR=(e,t)=>re(e,e=>$R(e)?$e(e.value===t,e):qR(e.items,t)),GR=e=>{const t={"":0,px:0,pt:1,mm:1,pc:2,ex:2,em:2,ch:2,rem:2,cm:3,in:4,"%":4};let o=e.value.toFixed((n=e.unit)in t?t[n]:1);var n;return-1!==o.indexOf(".")&&(o=o.replace(/\.?0*$/,"")),o+e.unit},YR=e=>{const t=/^\s*(\d+(?:\.\d+)?)\s*(|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vmin|vmax|%)\s*$/.exec(e);if(null!==t){const e=parseFloat(t[1]),o=t[2];return Ae.value({value:e,unit:o})}return Ae.error(e)},XR=(e,t)=>{const o={"":96,px:96,pt:72,cm:2.54,pc:12,mm:25.4,in:1},n=e=>ve(o,e);return e.unit===t?A.some(e.value):n(e.unit)&&n(t)?o[e.unit]===o[t]?A.some(e.value):A.some(e.value/o[e.unit]*o[t]):A.none()},KR=e=>A.none(),JR=(e,t)=>{const o=YR(e).toOptional(),n=YR(t).toOptional();return Ue(o,n,(e,t)=>XR(e,t.unit).map(e=>t.value/e).map(e=>{return o=e,n=t.unit,e=>XR(e,n).map(e=>({value:e*o,unit:n}));var o,n}).getOr(KR)).getOr(KR)},QR=(e,t)=>{const o=e.label.map(e=>xB(e,t)),n=[tp.config({disabled:()=>e.disabled||t.checkUiComponentContext(e.context).shouldDisable}),kA(()=>t.checkUiComponentContext(e.context)),_h.config({mode:"execution",useEnter:!0!==e.multiline,useControlEnter:!0===e.multiline,execute:e=>(Vc(e,OB),A.some(!0))}),ud("textfield-change",[Zc(Cs(),(t,o)=>{Dc(t,CB,{name:e.name})}),Zc(Vs(),(t,o)=>{Dc(t,CB,{name:e.name})})]),Hv.config({})],r=e.validation.map(e=>Xg.config({getRoot:e=>po(e.element),invalidClass:"tox-invalid",validator:{validate:t=>{const o=Yg.getValue(t),n=e.validator(o);return Te(!0===n?Ae.value(o):Ae.error(n))},validateOnLoad:e.validateOnLoad}})).toArray(),i={...e.placeholder.fold(w({}),e=>({placeholder:t.translate(e)})),...e.inputMode.fold(w({}),e=>({inputmode:e})),"data-mce-name":e.name},s=Uy.parts.field({tag:!0===e.multiline?"textarea":"input",...e.data.map(e=>({data:e})).getOr({}),inputAttributes:i,inputClasses:[e.classname],inputBehaviours:id(W([n,r])),selectOnFocus:!1,factory:Qy}),a=e.multiline?{dom:{tag:"div",classes:["tox-textarea-wrap"]},components:[s]}:s,l=(e.flex?["tox-form__group--stretched"]:[]).concat(e.maximized?["tox-form-group--maximize"]:[]),c=[tp.config({disabled:()=>e.disabled||t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{Uy.getField(e).each(tp.disable)},onEnabled:e=>{Uy.getField(e).each(tp.enable)}}),kA(()=>t.checkUiComponentContext(e.context))];return yB(o,a,l,c)},eN=e=>({isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t),setActive:t=>{const o=e.element;t?(or(o,"tox-tbtn--enabled"),jo(o,"aria-pressed",!0)):(rr(o,"tox-tbtn--enabled"),Xo(o,"aria-pressed"))},isActive:()=>ir(e.element,"tox-tbtn--enabled"),setTooltip:t=>{Dc(e,LR,{text:t})},setText:t=>{Dc(e,PR,{text:t})},setIcon:t=>Dc(e,IR,{icon:t})}),tN=(e,t,o,n,r=!0,i)=>{const s="bordered"===e.buttonType?["bordered"]:[];return FR({text:e.text,icon:e.icon,tooltip:e.tooltip,ariaLabel:e.tooltip,searchable:e.search.isSome(),role:n,fetch:(t,n)=>{const r={pattern:e.search.isSome()?dB(t):""};e.fetch(t=>{n(ZR(t,gS.CLOSE_ON_EXECUTE,o,{isHorizontalMenu:!1,search:e.search}))},r,eN(t))},onSetup:e.onSetup,getApi:e=>eN(e),columns:1,presets:"normal",classes:s,dropdownBehaviours:[...r?[Hv.config({})]:[]],context:e.context},t,o.shared,i)},oN=(e,t,o)=>{const n=e=>n=>{const r=!n.isActive();n.setActive(r),e.storage.set(r),o.shared.getSink().each(o=>{t().getOpt(o).each(t=>{Vo(t.element),Dc(t,EB,{name:e.name,value:e.storage.get()})})})},r=e=>t=>{t.setActive(e.storage.get())};return t=>{t(L(e,e=>{const t=e.text.fold(()=>({}),e=>({text:e}));return{type:e.type,active:!1,...t,context:e.context,onAction:n(e),onSetup:r(e)}}))}},nN=e=>({dom:{tag:"span",classes:["tox-tree__label"],attributes:{"aria-label":e}},components:[Sm(e)]}),rN=(e,t,o)=>{e.customStateIcon.each(n=>t.push(aN(n,o.shared.providers.icons,e.customStateIconTooltip.fold(()=>[],e=>[ab.config(o.shared.providers.tooltips.getConfig({tooltipText:e}))]),["tox-icon-custom-state"])))},iN=Pe("leaf-label-event-id"),sN=({leaf:e,onLeafAction:t,visible:o,treeId:n,selectedId:r,backstage:i})=>{const s=e.menu.map(e=>tN(e,"tox-mbtn",i,A.none(),o)),a=[nN(e.title)];return rN(e,a,i),s.each(e=>a.push(e)),Tb.sketch({dom:{tag:"div",classes:["tox-tree--leaf__label","tox-trbtn"].concat(o?["tox-tree--leaf__label--visible"]:[])},components:a,role:"treeitem",action:o=>{t(e.id),o.getSystem().broadcastOn([`update-active-item-${n}`],{value:e.id})},eventOrder:{[_s()]:[iN,"keying"]},buttonBehaviours:id([...o?[Hv.config({})]:[],Yv.config({toggleClass:"tox-trbtn--enabled",toggleOnExecute:!1,aria:{mode:"selected"}}),ov.config({channels:{[`update-active-item-${n}`]:{onReceive:(t,o)=>{(o.value===e.id?Yv.on:Yv.off)(t)}}}}),ud(iN,[Kc((t,o)=>{r.each(o=>{(o===e.id?Yv.on:Yv.off)(t)})}),Zc(_s(),(e,t)=>{const o="ArrowLeft"===t.event.raw.code,n="ArrowRight"===t.event.raw.code;o?(jn(e.element,".tox-tree--directory").each(t=>{e.getSystem().getByDom(t).each(e=>{qn(t,".tox-tree--directory__label").each(t=>{e.getSystem().getByDom(t).each(fd.focus)})})}),t.stop()):n&&t.stop()})])])})},aN=(e,t,o,n,r)=>dS(e,{tag:"span",classes:["tox-tree__icon-wrap","tox-icon"].concat(n||[]),behaviours:o,attributes:r},t),lN=Pe("directory-label-event-id"),cN=({directory:e,visible:t,noChildren:o,backstage:n})=>{const r=e.menu.map(e=>tN(e,"tox-mbtn",n,A.none())),i=[{dom:{tag:"div",classes:["tox-chevron"]},components:[(s=n.shared.providers.icons,aN("chevron-right",s,[]))]},nN(e.title)];var s;rN(e,i,n),r.each(e=>{i.push(e)});const a=t=>{jn(t.element,".tox-tree--directory").each(o=>{t.getSystem().getByDom(o).each(o=>{const n=!Yv.isOn(o);Yv.toggle(o),Dc(t,"expand-tree-node",{expanded:n,node:e.id})})})};return Tb.sketch({dom:{tag:"div",classes:["tox-tree--directory__label","tox-trbtn"].concat(t?["tox-tree--directory__label--visible"]:[])},components:i,action:a,eventOrder:{[_s()]:[lN,"keying"]},buttonBehaviours:id([...t?[Hv.config({})]:[],ud(lN,[Zc(_s(),(e,t)=>{const n="ArrowRight"===t.event.raw.code,r="ArrowLeft"===t.event.raw.code;n&&o&&t.stop(),(n||r)&&jn(e.element,".tox-tree--directory").each(o=>{e.getSystem().getByDom(o).each(o=>{!Yv.isOn(o)&&n||Yv.isOn(o)&&r?(a(e),t.stop()):r&&!Yv.isOn(o)&&(jn(o.element,".tox-tree--directory").each(e=>{qn(e,".tox-tree--directory__label").each(e=>{o.getSystem().getByDom(e).each(fd.focus)})}),t.stop())})})})])])})},dN=({children:e,onLeafAction:t,visible:o,treeId:n,expandedIds:r,selectedId:i,backstage:s})=>({dom:{tag:"div",classes:["tox-tree--directory__children"]},components:e.map(e=>"leaf"===e.type?sN({leaf:e,selectedId:i,onLeafAction:t,visible:o,treeId:n,backstage:s}):hN({directory:e,expandedIds:r,selectedId:i,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:s})),behaviours:id([Nv.config({dimension:{property:"height"},closedClass:"tox-tree--directory__children--closed",openClass:"tox-tree--directory__children--open",growingClass:"tox-tree--directory__children--growing",shrinkingClass:"tox-tree--directory__children--shrinking",expanded:o}),Qh.config({})])}),uN=Pe("directory-event-id"),hN=({directory:e,onLeafAction:t,labelTabstopping:o,treeId:n,backstage:r,expandedIds:i,selectedId:s})=>{const{children:a}=e,l=we(i),c=i.includes(e.id);return{dom:{tag:"div",classes:["tox-tree--directory"],attributes:{role:"treeitem"}},components:[cN({directory:e,visible:o,noChildren:0===e.children.length,backstage:r}),dN({children:a,expandedIds:i,selectedId:s,onLeafAction:t,visible:c,treeId:n,backstage:r})],behaviours:id([ud(uN,[Kc((e,t)=>{Yv.set(e,c)}),Zc("expand-tree-node",(e,t)=>{const{expanded:o,node:n}=t.event;l.set(o?[...l.get(),n]:l.get().filter(e=>e!==n))})]),Yv.config({...e.children.length>0?{aria:{mode:"expanded"}}:{},toggleClass:"tox-tree--directory--expanded",onToggled:(e,o)=>{const i=e.components()[1],c=(d=o,a.map(e=>"leaf"===e.type?sN({leaf:e,selectedId:s,onLeafAction:t,visible:d,treeId:n,backstage:r}):hN({directory:e,expandedIds:l.get(),selectedId:s,onLeafAction:t,labelTabstopping:d,treeId:n,backstage:r})));var d;o?Nv.grow(i):Nv.shrink(i),Qh.set(i,c)}})])}},mN=Pe("tree-event-id"),pN=(e,t,o=[],n,r,i,s)=>{const a=t.fold(()=>({}),e=>({action:e})),l={buttonBehaviours:id([dA(()=>!e.enabled||s.checkUiComponentContext(e.context).shouldDisable),kA(()=>s.checkUiComponentContext(e.context)),Hv.config({}),...i.map(e=>ab.config(s.tooltips.getConfig({tooltipText:s.translate(e)}))).toArray(),ud("button press",[Uc("click")])].concat(o)),eventOrder:{click:["button press","alloy.base.behaviour"],mousedown:["button press","alloy.base.behaviour"]},...a},c=Le(l,{dom:n});return Le(c,{components:r})},gN=(e,t,o,n=[],r)=>{const i={tag:"button",classes:["tox-tbtn"],attributes:{...e.tooltip.map(e=>({"aria-label":o.translate(e)})).getOr({}),"data-mce-name":r}},s=e.icon.map(e=>NR(e,o.icons)),a=EA([s]);return pN(e,t,n,i,a,e.tooltip,o)},fN=e=>{switch(e){case"primary":return["tox-button"];case"toolbar":return["tox-tbtn"];default:return["tox-button","tox-button--secondary"]}},vN=(e,t,o,n=[],r=[])=>{const i=o.translate(e.text),s=e.icon.map(e=>NR(e,o.icons)),a=[s.getOrThunk(()=>Sm(i))],l=e.buttonType.getOr(e.primary||e.borderless?"primary":"secondary"),c={tag:"button",classes:[...fN(l),...s.isSome()?["tox-button--icon"]:[],...e.borderless?["tox-button--naked"]:[],...r],attributes:{"aria-label":i,"data-mce-name":e.text}},d=e.icon.map(w(i));return pN(e,t,n,c,a,d,o)},bN=(e,t,o,n=[],r=[])=>{const i=vN(e,A.some(t),o,n,r);return Tb.sketch(i)},yN=(e,t)=>o=>{"custom"===t?Dc(o,EB,{name:e,value:{}}):"submit"===t?Vc(o,OB):"cancel"===t?Vc(o,TB):console.error("Unknown button type: ",t)},wN=(e,t,o)=>{if(((e,t)=>"menu"===t)(0,t)){const t=()=>i,n=e,r={...e,buttonType:"default",type:"menubutton",search:A.none(),onSetup:t=>(t.setEnabled(e.enabled),v),fetch:oN(n.items,t,o)},i=db(tN(r,"tox-tbtn",o,A.none(),!0,e.text.or(e.tooltip).getOrUndefined()));return i.asSpec()}if(((e,t)=>"custom"===t||"cancel"===t||"submit"===t)(0,t)){const n=yN(e.name,t),r={...e,context:"cancel"===t?"any":e.context,borderless:!1};return bN(r,n,o.shared.providers,[])}if(((e,t)=>"togglebutton"===t)(0,t))return((e,t,o)=>{var n,r;const i=e.icon.map(e=>VR(e,t.icons)).map(db),s=e.buttonType.getOr(e.primary?"primary":"secondary"),a={...e,name:null!==(n=e.name)&&void 0!==n?n:"",primary:"primary"===s,tooltip:e.tooltip,enabled:null!==(r=e.enabled)&&void 0!==r&&r,borderless:!1},l=a.tooltip.or(e.text).map(e=>({"aria-label":t.translate(e)})).getOr({}),c=fN(null!=s?s:"secondary"),d=e.icon.isSome()&&e.text.isSome(),u={tag:"button",classes:[...c.concat(e.icon.isSome()?["tox-button--icon"]:[]),...e.active?["tox-button--enabled"]:[],...d?["tox-button--icon-and-text"]:[]],attributes:{...l,...m(o)?{"data-mce-name":o}:{}}},h=t.translate(e.text.getOr("")),p=Sm(h),g=[...EA([i.map(e=>e.asSpec())]),...e.text.isSome()?[p]:[]],f=pN(a,A.some(o=>{Dc(o,EB,{name:e.name,value:{setIcon:e=>{i.map(n=>n.getOpt(o).each(o=>{Qh.set(o,[VR(e,t.icons)])}))}}})}),[],u,g,e.tooltip,t);return Tb.sketch(f)})(e,o.shared.providers,e.text.or(e.tooltip).getOrUndefined());throw console.error("Unknown footer button type: ",t),new Error("Unknown footer button type")},_N={type:"separator"},xN=e=>({type:"menuitem",value:e.url,text:e.title,meta:{attach:e.attach},onAction:v}),CN=(e,t)=>({type:"menuitem",value:t,text:e,meta:{attach:void 0},onAction:v}),kN=(e,t)=>(e=>L(e,xN))(((e,t)=>H(t,t=>t.type===e))(e,t)),SN=e=>kN("header",e.targets),TN=e=>kN("anchor",e.targets),EN=e=>A.from(e.anchorTop).map(e=>CN("<top>",e)).toArray(),ON=e=>A.from(e.anchorBottom).map(e=>CN("<bottom>",e)).toArray(),AN=(e,t)=>{const o=e.toLowerCase();return H(t,e=>{var t;const n=void 0!==e.meta&&void 0!==e.meta.text?e.meta.text:e.text,r=null!==(t=e.value)&&void 0!==t?t:"";return Ke(n.toLowerCase(),o)||Ke(r.toLowerCase(),o)})},MN=Pe("aria-invalid"),BN=e=>(t,o,n,r,i)=>fe(o,"name").fold(()=>e(o,r,A.none(),i),s=>t.field(s,e(o,r,fe(n,s),i))),RN={bar:BN((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-bar","tox-form__controls-h-stack"]},components:L(e.items,t.interpreter)}))(e,t.shared)),collection:BN((e,t,o)=>NB(e,t.shared.providers,o)),alertbanner:BN((e,t)=>((e,t)=>{const o=aS(e.icon,t.icons);return ig.sketch({dom:{tag:"div",attributes:{role:"alert"},classes:["tox-notification","tox-notification--in",`tox-notification--${e.level}`]},components:[{dom:{tag:"div",classes:["tox-notification__icon"],innerHtml:e.url?void 0:o},components:e.url?[Tb.sketch({dom:{tag:"button",classes:["tox-button","tox-button--naked","tox-button--icon"],innerHtml:o,attributes:{title:t.translate(e.iconTooltip)}},action:t=>Dc(t,EB,{name:"alert-banner",value:e.url}),buttonBehaviours:id([lS()])})]:void 0},{dom:{tag:"div",classes:["tox-notification__body"],innerHtml:t.translate(e.text)}}]})})(e,t.shared.providers)),input:BN((e,t,o)=>((e,t,o)=>QR({name:e.name,multiline:!1,label:e.label,inputMode:e.inputMode,placeholder:e.placeholder,flex:!1,disabled:!e.enabled,classname:"tox-textfield",validation:A.none(),maximized:e.maximized,data:o,context:e.context},t))(e,t.shared.providers,o)),textarea:BN((e,t,o)=>((e,t,o)=>QR({name:e.name,multiline:!0,label:e.label,inputMode:A.none(),placeholder:e.placeholder,flex:!0,disabled:!e.enabled,classname:"tox-textarea",validation:A.none(),maximized:e.maximized,data:o,context:e.context},t))(e,t.shared.providers,o)),label:BN((e,t,o,n)=>((e,t,o)=>{const n="tox-label",r="center"===e.align?[`${n}--center`]:[],i="end"===e.align?[`${n}--end`]:[],s=db({dom:{tag:"label",classes:[n,...r,...i]},components:[Sm(t.providers.translate(e.label))]}),a=L(e.items,t.interpreter);return{dom:{tag:"div",classes:["tox-form__group"]},components:[s.asSpec(),...a],behaviours:id([IB(),Qh.config({}),(l=A.none(),UB(l,en,tn)),_h.config({mode:"acyclic"}),ud("label",[Kc(t=>{e.for.each(e=>{o(e).each(e=>{s.getOpt(t).each(t=>{var o;const n=null!==(o=qo(e.element,"id"))&&void 0!==o?o:Pe("form-field");jo(e.element,"id",n),jo(t.element,"for",n)})})})})])])};var l})(e,t.shared,n)),iframe:(BV=(e,t,o)=>((e,t,o)=>{const n="tox-dialog__iframe",r=e.transparent?[]:[`${n}--opaque`],i=e.border?["tox-navobj-bordered"]:[],s={...e.label.map(e=>({title:e})).getOr({}),...o.map(e=>({srcdoc:e})).getOr({}),...e.sandboxed?{sandbox:"allow-scripts allow-same-origin"}:{}},a=((e,t)=>{const o=we(e.getOr(""));return{getValue:e=>o.get(),setValue:(e,n)=>{if(o.get()!==n){const o=e.element,r=()=>jo(o,"srcdoc",n);t?ER.fold(w(TR),e=>e.throttle)(o,n,r):r()}o.set(n)}}})(o,e.streamContent),l=e.label.map(e=>xB(e,t)),c=Uy.parts.field({factory:{sketch:e=>cR(A.from(i),{uid:e.uid,dom:{tag:"iframe",attributes:s,classes:[n,...r]},behaviours:id([Hv.config({}),fd.config({}),HB(o,a.getValue,a.setValue),ov.config({channels:{[bR]:{onReceive:(e,t)=>{t.newFocus.each(t=>{po(e.element).each(o=>{(wt(e.element,t)?or:rr)(o,"tox-navobj-bordered-focus")})})}}}})])})}});return yB(l,c,["tox-form__group--stretched"],[])})(e,t.shared.providers,o),(e,t,o,n,r)=>{const i=Le(t,{source:"dynamic"});return BN(BV)(e,i,o,n,r)}),button:BN((e,t)=>((e,t)=>{const o=yN(e.name,"custom");return n=A.none(),r=Uy.parts.field({factory:Tb,...vN(e,A.some(o),t,[ZB(""),IB()])}),yB(n,r,[],[]);var n,r})(e,t.shared.providers)),checkbox:BN((e,t,o)=>((e,t,o)=>{const n=e=>(e.element.dom.click(),A.some(!0)),r=Uy.parts.field({factory:{sketch:_},dom:{tag:"input",classes:["tox-checkbox__input"],attributes:{type:"checkbox"}},behaviours:id([IB(),tp.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{po(e.element).each(e=>or(e,"tox-checkbox--disabled"))},onEnabled:e=>{po(e.element).each(e=>rr(e,"tox-checkbox--disabled"))}}),Hv.config({}),fd.config({}),UB(o,Kn,Xn),_h.config({mode:"special",onEnter:n,onSpace:n,stopSpaceKeyup:!0}),ud("checkbox-events",[Zc(ks(),(t,o)=>{Dc(t,CB,{name:e.name})})])])}),i=Uy.parts.label({dom:{tag:"span",classes:["tox-checkbox__label"]},components:[Sm(t.translate(e.label))],behaviours:id([lb.config({})])}),s=e=>dS("checked"===e?"selected":"unselected",{tag:"span",classes:["tox-icon","tox-checkbox-icon__"+e]},t.icons),a=db({dom:{tag:"div",classes:["tox-checkbox__icons"]},components:[s("checked"),s("unchecked")]});return Uy.sketch({dom:{tag:"label",classes:["tox-checkbox"]},components:[r,a.asSpec(),i],fieldBehaviours:id([tp.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable}),kA(()=>t.checkUiComponentContext(e.context))])})})(e,t.shared.providers,o)),colorinput:BN((e,t,o)=>((e,t,o,n)=>{const r=Uy.parts.field({factory:Qy,inputClasses:["tox-textfield"],data:n,onSetValue:e=>Xg.run(e).get(v),inputBehaviours:id([tp.config({disabled:()=>t.providers.isDisabled()||t.providers.checkUiComponentContext(e.context).shouldDisable}),kA(()=>t.providers.checkUiComponentContext(e.context)),Hv.config({}),Xg.config({invalidClass:"tox-textbox-field-invalid",getRoot:e=>po(e.element),notify:{onValid:e=>{const t=Yg.getValue(e);Dc(e,VB,{color:t})}},validator:{validateOnLoad:!1,validate:e=>{const t=Yg.getValue(e);if(0===t.length)return Te(Ae.value(!0));{const e=at("span");dn(e,"background-color",t);const o=gn(e,"background-color").fold(()=>Ae.error("blah"),e=>Ae.value(t));return Te(o)}}}})]),selectOnFocus:!1}),i=e.label.map(e=>xB(e,t.providers)),s=(e,t)=>{Dc(e,DB,{value:t})},a=db(((e,t)=>ky.sketch({dom:e.dom,components:e.components,toggleClass:"mce-active",dropdownBehaviours:id([uA(()=>t.providers.isDisabled()||t.providers.checkUiComponentContext(e.context).shouldDisable),kA(()=>t.providers.checkUiComponentContext(e.context)),lb.config({}),Hv.config({})]),layouts:e.layouts,sandboxClasses:["tox-dialog__popups"],lazySink:t.getSink,fetch:o=>Se(t=>e.fetch(t)).map(n=>A.from(gB(Le(JM(Pe("menu-value"),n,t=>{e.onItemAction(o,t)},e.columns,e.presets,gS.CLOSE_ON_EXECUTE,E,t.providers),{movement:eB(e.columns,e.presets)})))),parts:{menu:NS(0,0,e.presets)}}))({dom:{tag:"span",attributes:{"aria-label":t.providers.translate("Color swatch")}},layouts:{onRtl:()=>[Ul,Hl,Wl],onLtr:()=>[Hl,Ul,Wl]},components:[],fetch:$M(o.getColors(e.storageKey),e.storageKey,o.hasCustomColors()),columns:o.getColorCols(e.storageKey),presets:"color",onItemAction:(t,n)=>{a.getOpt(t).each(t=>{"custom"===n?o.colorPicker(o=>{o.fold(()=>Vc(t,PB),o=>{s(t,o),EM(e.storageKey,o)})},"#ffffff"):s(t,"remove"===n?"":n)})},context:e.context},t));return Uy.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:i.toArray().concat([{dom:{tag:"div",classes:["tox-color-input"]},components:[r,a.asSpec()]}]),fieldBehaviours:id([ud("form-field-events",[Zc(VB,(t,o)=>{a.getOpt(t).each(e=>{dn(e.element,"background-color",o.event.color)}),Dc(t,CB,{name:e.name})}),Zc(DB,(e,t)=>{Uy.getField(e).each(o=>{Yg.setValue(o,t.event.value),Im.getCurrent(e).each(fd.focus)})}),Zc(PB,(e,t)=>{Uy.getField(e).each(t=>{Im.getCurrent(e).each(fd.focus)})})])])})})(e,t.shared,t.colorinput,o)),colorpicker:BN((e,t,o)=>((e,t,o)=>{const n=e=>"tox-"+e,r=QB((e=>t=>i(t)?e.translate(eR[t]):e.translate(t))(t),n,t.tooltips.getConfig,(e,o,n=e,r=e)=>dS(n,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:t.translate(r),"aria-live":"polite",...o.fold(()=>({}),e=>({id:e}))}},t.icons)),s=db(r.sketch({dom:{tag:"div",classes:[n("color-picker-container")],attributes:{role:"presentation"}},onValidHex:e=>{Dc(e,EB,{name:"hex-valid",value:!0})},onInvalidHex:e=>{Dc(e,EB,{name:"hex-valid",value:!1})}}));return{dom:{tag:"div"},components:[s.asSpec()],behaviours:id([HB(o,e=>{const t=s.get(e);return Im.getCurrent(t).bind(e=>Yg.getValue(e).hex).map(e=>"#"+Xe(e,"#")).getOr("")},(e,t)=>{const o=A.from(/^#([a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?)/.exec(t)).bind(e=>ee(e,1)),n=s.get(e);Im.getCurrent(n).fold(()=>{console.log("Can not find form")},e=>{Yg.setValue(e,{hex:o.getOr("")}),Ay.getField(e,"hex").each(e=>{Vc(e,Cs())})})}),IB()])}})(0,t.shared.providers,o)),dropzone:BN((e,t,o)=>iR(e,t.shared.providers,o)),grid:BN((e,t)=>((e,t)=>({dom:{tag:"div",classes:["tox-form__grid",`tox-form__grid--${e.columns}col`]},components:L(e.items,t.interpreter)}))(e,t.shared)),listbox:BN((e,t,o)=>((e,t,o)=>{const n=D(e.items,e=>!$R(e)),r=t.shared.providers,i=o.bind(t=>qR(e.items,t)).orThunk(()=>te(e.items).filter($R)),s=e.label.map(e=>xB(e,r)),a=Uy.parts.field({dom:{},factory:{sketch:o=>FR({context:e.context,uid:o.uid,text:i.map(e=>e.text),icon:A.none(),tooltip:A.none(),role:$e(!n,"combobox"),...n?{}:{listRole:"listbox"},ariaLabel:e.label,fetch:(o,r)=>{const i=WR(o,e.name,e.items,Yg.getValue(o),n);r(ZR(i,gS.CLOSE_ON_EXECUTE,t,{isHorizontalMenu:!1,search:A.none()}))},onSetup:w(v),getApi:w({}),columns:1,presets:"normal",classes:[],dropdownBehaviours:[Hv.config({}),HB(i.map(e=>e.value),e=>qo(e.element,jR),(t,o)=>{qR(e.items,o).each(e=>{jo(t.element,jR,e.value),Dc(t,PR,{text:e.text})})})]},"tox-listbox",t.shared)}}),l={dom:{tag:"div",classes:["tox-listboxfield"]},components:[a]};return Uy.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:W([s.toArray(),[l]]),fieldBehaviours:id([tp.config({disabled:()=>!e.enabled||r.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{Uy.getField(e).each(tp.disable)},onEnabled:e=>{Uy.getField(e).each(tp.enable)}})])})})(e,t,o)),selectbox:BN((e,t,o)=>((e,t,o)=>{const n=L(e.items,e=>({text:t.translate(e.text),value:e.value})),r=e.label.map(e=>xB(e,t)),i=Uy.parts.field({dom:{},...o.map(e=>({data:e})).getOr({}),selectAttributes:{size:e.size},options:n,factory:qy,selectBehaviours:id([tp.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable}),Hv.config({}),ud("selectbox-change",[Zc(ks(),(t,o)=>{Dc(t,CB,{name:e.name})})])])}),s=e.size>1?A.none():A.some(dS("chevron-down",{tag:"div",classes:["tox-selectfield__icon-js"]},t.icons)),a={dom:{tag:"div",classes:["tox-selectfield"]},components:W([[i],s.toArray()])};return Uy.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:W([r.toArray(),[a]]),fieldBehaviours:id([tp.config({disabled:()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{Uy.getField(e).each(tp.disable)},onEnabled:e=>{Uy.getField(e).each(tp.enable)}}),kA(()=>t.checkUiComponentContext(e.context))])})})(e,t.shared.providers,o)),sizeinput:BN((e,t)=>((e,t)=>{let o=KR;const n=Pe("ratio-event"),r=e=>dS(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),i=()=>!e.enabled||t.checkUiComponentContext(e.context).shouldDisable,s=kA(()=>t.checkUiComponentContext(e.context)),a=e.label.getOr("Constrain proportions"),l=t.translate(a),c=Wy.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":l,"data-mce-name":a}},components:[r("lock"),r("unlock")],buttonBehaviours:id([tp.config({disabled:i}),s,Hv.config({}),ab.config(t.tooltips.getConfig({tooltipText:l}))])}),d=e=>({dom:{tag:"div",classes:["tox-form__group"]},components:e}),u=t=>Uy.parts.field({factory:Qy,inputClasses:["tox-textfield"],inputBehaviours:id([tp.config({disabled:i}),s,Hv.config({}),ud("size-input-events",[Zc(ys(),(e,o)=>{Dc(e,n,{isField1:t})}),Zc(ks(),(t,o)=>{Dc(t,CB,{name:e.name})})])]),selectOnFocus:!1}),h=e=>({dom:{tag:"label",classes:["tox-label"]},components:[Sm(t.translate(e))]}),m=Wy.parts.field1(d([Uy.parts.label(h("Width")),u(!0)])),p=Wy.parts.field2(d([Uy.parts.label(h("Height")),u(!1)]));return Wy.sketch({dom:{tag:"div",classes:["tox-form__group"]},components:[{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:[m,p,d([h(" "),c])]}],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,n)=>{YR(Yg.getValue(e)).each(e=>{o(e).each(e=>{Yg.setValue(t,GR(e))})})},coupledFieldBehaviours:id([tp.config({disabled:i,onDisabled:e=>{Wy.getField1(e).bind(Uy.getField).each(tp.disable),Wy.getField2(e).bind(Uy.getField).each(tp.disable),Wy.getLock(e).each(tp.disable)},onEnabled:e=>{Wy.getField1(e).bind(Uy.getField).each(tp.enable),Wy.getField2(e).bind(Uy.getField).each(tp.enable),Wy.getLock(e).each(tp.enable)}}),kA(()=>t.checkUiComponentContext("mode:design")),ud("size-input-events2",[Zc(n,(e,t)=>{const n=t.event.isField1,r=n?Wy.getField1(e):Wy.getField2(e),i=n?Wy.getField2(e):Wy.getField1(e),s=r.map(Yg.getValue).getOr(""),a=i.map(Yg.getValue).getOr("");o=JR(s,a)})])])})})(e,t.shared.providers)),slider:BN((e,t,o)=>((e,t,o)=>{const n=H_.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Sm(t.translate(e.label))]}),r=H_.parts.spectrum({dom:{tag:"div",classes:["tox-slider__rail"],attributes:{role:"presentation"}}}),i=H_.parts.thumb({dom:{tag:"div",classes:["tox-slider__handle"],attributes:{role:"presentation"}}});return H_.sketch({dom:{tag:"div",classes:["tox-slider"],attributes:{role:"presentation"}},model:{mode:"x",minX:e.min,maxX:e.max,getInitialValue:w(o.getOrThunk(()=>(Math.abs(e.max)-Math.abs(e.min))/2))},components:[n,r,i],sliderBehaviours:id([IB(),fd.config({})]),onChoose:(t,o,n)=>{Dc(t,CB,{name:e.name,value:n})},onChange:(t,o,n)=>{Dc(t,CB,{name:e.name,value:n})}})})(e,t.shared.providers,o)),urlinput:BN((e,t,o)=>((e,t,o,n)=>{const r=t.shared.providers,i=t=>{const n=Yg.getValue(t);o.addToHistory(n.value,e.filetype)},s={...n.map(e=>({initialData:e})).getOr({}),dismissOnBlur:!0,inputClasses:["tox-textfield"],sandboxClasses:["tox-dialog__popups"],inputAttributes:{"aria-errormessage":MN,type:"url"},minChars:0,responseTime:0,fetch:n=>{const r=((e,t,o)=>{var n,r;const i=Yg.getValue(t),s=null!==(r=null===(n=null==i?void 0:i.meta)||void 0===n?void 0:n.text)&&void 0!==r?r:i.value;return o.getLinkInformation().fold(()=>[],t=>{const n=AN(s,(e=>L(e,e=>CN(e,e)))(o.getHistory(e)));return"file"===e?(r=[n,AN(s,SN(t)),AN(s,W([EN(t),TN(t),ON(t)]))],Z(r,(e,t)=>0===e.length||0===t.length?e.concat(t):e.concat(_N,t),[])):n;var r})})(e.filetype,n,o),i=ZR(r,gS.BUBBLE_TO_SANDBOX,t,{isHorizontalMenu:!1,search:A.none()});return Te(i)},getHotspot:e=>m.getOpt(e),onSetValue:(e,t)=>{e.hasConfigured(Xg)&&Xg.run(e).get(v)},typeaheadBehaviours:id([...o.getValidationHandler().map(t=>Xg.config({getRoot:e=>po(e.element),invalidClass:"tox-control-wrap--status-invalid",notify:{onInvalid:(e,t)=>{c.getOpt(e).each(e=>{jo(e.element,"title",r.translate(t))})}},validator:{validate:o=>{const n=Yg.getValue(o);return Be(o=>{t({type:e.filetype,url:n.value},e=>{if("invalid"===e.status){const t=Ae.error(e.message);o(t)}else{const t=Ae.value(e.message);o(t)}})})},validateOnLoad:!1}})).toArray(),tp.config({disabled:()=>!e.enabled||r.checkUiComponentContext(e.context).shouldDisable}),Hv.config({}),ud("urlinput-events",[Zc(Cs(),t=>{const o=cr(t.element),n=o.trim();n!==o&&dr(t.element,n),"file"===e.filetype&&Dc(t,CB,{name:e.name})}),Zc(ks(),t=>{Dc(t,CB,{name:e.name}),i(t)}),Zc(Vs(),t=>{Dc(t,CB,{name:e.name}),i(t)})])]),eventOrder:{[Cs()]:["streaming","urlinput-events","invalidating"]},model:{getDisplayText:e=>e.value,selectsOver:!1,populateFromBrowse:!1},markers:{openClass:"tox-textfield--popup-open"},lazySink:t.shared.getSink,parts:{menu:NS(0,0,"normal")},onExecute:(e,t,o)=>{Dc(t,OB,{})},onItemExecute:(t,o,n,r)=>{i(t),Dc(t,CB,{name:e.name})}},a=Uy.parts.field({...s,factory:Dx}),l=e.label.map(e=>xB(e,r)),c=db(((e,t,o=e,n=e)=>dS(o,{tag:"div",classes:["tox-icon","tox-control-wrap__status-icon-"+e],attributes:{title:r.translate(n),"aria-live":"polite",...t.fold(()=>({}),e=>({id:e}))}},r.icons))("invalid",A.some(MN),"warning")),d=db({dom:{tag:"div",classes:["tox-control-wrap__status-icon-wrap"]},components:[c.asSpec()]}),u=o.getUrlPicker(e.filetype),h=Pe("browser.url.event"),m=db({dom:{tag:"div",classes:["tox-control-wrap"]},components:[a,d.asSpec()],behaviours:id([tp.config({disabled:()=>!e.enabled||r.checkUiComponentContext(e.context).shouldDisable})])}),p=db(bN({context:e.context,name:e.name,icon:A.some("browse"),text:e.picker_text.or(e.label).getOr(""),enabled:e.enabled,primary:!1,buttonType:A.none(),borderless:!0},e=>Vc(e,h),r,[],["tox-browse-url"]));return Uy.sketch({dom:_B([]),components:l.toArray().concat([{dom:{tag:"div",classes:["tox-form__controls-h-stack"]},components:W([[m.asSpec()],u.map(()=>p.asSpec()).toArray()])}]),fieldBehaviours:id([tp.config({disabled:()=>!e.enabled||r.checkUiComponentContext(e.context).shouldDisable,onDisabled:e=>{Uy.getField(e).each(tp.disable),p.getOpt(e).each(tp.disable)},onEnabled:e=>{Uy.getField(e).each(tp.enable),p.getOpt(e).each(tp.enable)}}),kA(()=>r.checkUiComponentContext(e.context)),ud("url-input-events",[Zc(h,t=>{Im.getCurrent(t).each(o=>{const n=Yg.getValue(o),r={fieldname:e.name,...n};u.each(n=>{n(r).get(n=>{Yg.setValue(o,n),Dc(t,CB,{name:e.name})})})})})])])})})(e,t,t.urlinput,o)),customeditor:BN(e=>{const t=Ge(),o=db({dom:{tag:e.tag}}),n=Ge(),r=!oR(e)&&e.onFocus.isSome()?[fd.config({onFocus:t=>{e.onFocus.each(e=>{e(t.element.dom)})}}),Hv.config({})]:[];return{dom:{tag:"div",classes:["tox-custom-editor"]},behaviours:id([ud("custom-editor-events",[Kc(r=>{o.getOpt(r).each(o=>{(oR(e)?e.init(o.element.dom):tR.load(e.scriptId,e.scriptUrl).then(t=>t(o.element.dom,e.settings))).then(e=>{n.on(t=>{e.setValue(t)}),n.clear(),t.set(e)})})})]),HB(A.none(),()=>t.get().fold(()=>n.get().getOr(""),e=>e.getValue()),(e,o)=>{t.get().fold(()=>n.set(o),e=>e.setValue(o))}),IB()].concat(r)),components:[o.asSpec()]}}),htmlpanel:BN((e,t)=>((e,t)=>{const o=["tox-form__group",...e.stretched?["tox-form__group--stretched"]:[]],n=ud("htmlpanel",[Kc(t=>{e.onInit(t.element.dom)})]);return"presentation"===e.presets?ig.sketch({dom:{tag:"div",classes:o,innerHtml:e.html},containerBehaviours:id([ab.config({...t.tooltips.getConfig({tooltipText:"",onShow:e=>{Gn(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Lo(e.element)).each(o=>{Go(o,"data-mce-tooltip").each(o=>{ab.setComponents(e,t.tooltips.getComponents({tooltipText:o}))})})}}),mode:"children-normal",anchor:e=>({type:"node",node:Gn(e.element,"[data-mce-tooltip]:hover").orThunk(()=>Lo(e.element).filter(e=>Go(e,"data-mce-tooltip").isSome())),root:e.element,layouts:{onLtr:w([Wl,jl,Hl,Zl,Ul,$l]),onRtl:w([Wl,jl,Hl,Zl,Ul,$l])},bubble:_l(0,-2,{})})}),n])}):ig.sketch({dom:{tag:"div",classes:o,innerHtml:e.html,attributes:{role:"document"}},containerBehaviours:id([Hv.config({}),fd.config({}),n])})})(e,t.shared.providers)),imagepreview:BN((e,t,o)=>((e,t)=>{const o=we(t.getOr({url:""})),n=db({dom:{tag:"img",classes:["tox-imagepreview__image"],attributes:t.map(e=>({src:e.url})).getOr({})}}),r=db({dom:{tag:"div",classes:["tox-imagepreview__container"],attributes:{role:"presentation"}},components:[n.asSpec()]}),i={};e.height.each(e=>i.height=e);const s=t.map(e=>({url:e.url,zoom:A.from(e.zoom),cachedWidth:A.from(e.cachedWidth),cachedHeight:A.from(e.cachedHeight)}));return{dom:{tag:"div",classes:["tox-imagepreview"],styles:i,attributes:{role:"presentation"}},components:[r.asSpec()],behaviours:id([IB(),HB(s,()=>o.get(),(e,t)=>{const i={url:t.url};t.zoom.each(e=>i.zoom=e),t.cachedWidth.each(e=>i.cachedWidth=e),t.cachedHeight.each(e=>i.cachedHeight=e),o.set(i);const s=()=>{const{cachedWidth:t,cachedHeight:o,zoom:n}=i;if(!u(t)&&!u(o)){if(u(n)){const n=((e,t,o)=>{const n=En(e),r=xn(e);return Math.min(n/t,r/o,1)})(e.element,t,o);i.zoom=n}const s=((e,t,o,n,r)=>{const i=o*r,s=n*r,a=Math.max(0,e/2-i/2),l=Math.max(0,t/2-s/2);return{left:a.toString()+"px",top:l.toString()+"px",width:i.toString()+"px",height:s.toString()+"px"}})(En(e.element),xn(e.element),t,o,i.zoom);r.getOpt(e).each(e=>{un(e.element,s)})}};n.getOpt(e).each(o=>{const n=o.element;t.url!==qo(n,"src")&&(jo(n,"src",t.url),rr(e.element,"tox-imagepreview__loaded")),s(),on(n).then(t=>{e.getSystem().isConnected()&&(or(e.element,"tox-imagepreview__loaded"),i.cachedWidth=t.dom.naturalWidth,i.cachedHeight=t.dom.naturalHeight,s())})})})])}})(e,o)),table:BN((e,t)=>((e,t)=>{const o=e=>({dom:{tag:"td",innerHtml:t.translate(e)}});return{dom:{tag:"table",classes:["tox-dialog__table"]},components:[(r=e.header,{dom:{tag:"thead"},components:[{dom:{tag:"tr"},components:L(r,e=>({dom:{tag:"th",innerHtml:t.translate(e)}}))}]}),(n=e.cells,{dom:{tag:"tbody"},components:L(n,e=>({dom:{tag:"tr"},components:L(e,o)}))})],behaviours:id([Hv.config({}),fd.config({})])};var n,r})(e,t.shared.providers)),tree:BN((e,t)=>((e,t)=>{const o=e.onLeafAction.getOr(v),n=e.onToggleExpand.getOr(v),r=e.defaultExpandedIds,i=we(r),s=we(e.defaultSelectedId),a=Pe("tree-id"),l=(n,r)=>e.items.map(e=>"leaf"===e.type?sN({leaf:e,selectedId:n,onLeafAction:o,visible:!0,treeId:a,backstage:t}):hN({directory:e,selectedId:n,onLeafAction:o,expandedIds:r,labelTabstopping:!0,treeId:a,backstage:t}));return{dom:{tag:"div",classes:["tox-tree"],attributes:{role:"tree"}},components:l(s.get(),i.get()),behaviours:id([_h.config({mode:"flow",selector:".tox-tree--leaf__label--visible, .tox-tree--directory__label--visible",cycles:!1}),ud(mN,[Zc("expand-tree-node",(e,t)=>{const{expanded:o,node:r}=t.event;i.set(o?[...i.get(),r]:i.get().filter(e=>e!==r)),n(i.get(),{expanded:o,node:r})})]),ov.config({channels:{[`update-active-item-${a}`]:{onReceive:(e,t)=>{s.set(A.some(t.value)),Qh.set(e,l(A.some(t.value),i.get()))}}}}),Qh.config({})])}})(e,t)),panel:BN((e,t)=>((e,t)=>({dom:{tag:"div",classes:e.classes},components:L(e.items,t.shared.interpreter)}))(e,t))},NN={field:(e,t)=>t,record:w([])},VN=(e,t,o,n,r)=>{const i=Le(n,{shared:{interpreter:t=>DN(e,t,o,i,r)}});return DN(e,t,o,i,r)},DN=(e,t,o,n,r)=>fe(RN,t.type).fold(()=>(console.error(`Unknown factory type "${t.type}", defaulting to container: `,t),t),i=>i(e,t,o,n,r)),PN=(e,t,o,n)=>DN(NN,e,t,o,n),IN={valignCentre:[],alignCentre:[],alignLeft:[],alignRight:[],right:[],left:[],bottom:[],top:[]},LN=(e,t,o)=>{const n={maxHeightFunction:kc()};return()=>o()?{type:"node",root:Co(xo(e())),node:A.from(e()),bubble:_l(12,12,IN),layouts:{onRtl:()=>[mc],onLtr:()=>[hc]},overrides:n}:{type:"hotspot",hotspot:t(),bubble:_l(-12,12,IN),layouts:{onRtl:()=>[Hl,Ul,Wl],onLtr:()=>[Ul,Hl,Wl]},overrides:n}},FN=(e,t,o,n)=>{const r={maxHeightFunction:kc()};return()=>n()?{type:"node",root:Co(xo(t())),node:A.from(t()),bubble:_l(12,12,IN),layouts:{onRtl:()=>[pc],onLtr:()=>[pc]},overrides:r}:e?{type:"node",root:Co(xo(t())),node:A.from(t()),bubble:_l(0,-Cn(t()),IN),layouts:{onRtl:()=>[jl],onLtr:()=>[jl]},overrides:r}:{type:"hotspot",hotspot:o(),bubble:_l(0,0,IN),layouts:{onRtl:()=>[jl],onLtr:()=>[jl]},overrides:r}},zN=(e,t,o)=>()=>o()?{type:"node",root:Co(xo(e())),node:A.from(e()),layouts:{onRtl:()=>[pc],onLtr:()=>[pc]}}:{type:"hotspot",hotspot:t(),layouts:{onRtl:()=>[Wl],onLtr:()=>[Wl]}},HN=(e,t)=>()=>({type:"selection",root:t(),getSelection:()=>{const t=e.selection.getRng(),o=e.model.table.getSelectedCells();if(o.length>1){const e=o[0],t=o[o.length-1],n={firstCell:ct(e),lastCell:ct(t)};return A.some(n)}return A.some(xr.range(ct(t.startContainer),t.startOffset,ct(t.endContainer),t.endOffset))}}),UN=e=>t=>({type:"node",root:e(),node:t}),ZN=(e,t,o,n)=>{const r=HC(e),i=()=>ct(e.getBody()),s=()=>ct(e.getContentAreaContainer()),a=()=>r||!n();return{inlineDialog:LN(s,t,a),inlineBottomDialog:FN(e.inline,s,o,a),banner:zN(s,t,a),cursor:HN(e,i),node:UN(i)}},$N=e=>(t,o)=>{KM(e)(t,o)},jN=e=>()=>IM(e),WN=e=>t=>NM(e,t),qN=e=>t=>PM(e,t),GN=e=>()=>_C(e),YN=e=>be(e,"items"),XN=e=>be(e,"format"),KN=[{title:"Headings",items:[{title:"Heading 1",format:"h1"},{title:"Heading 2",format:"h2"},{title:"Heading 3",format:"h3"},{title:"Heading 4",format:"h4"},{title:"Heading 5",format:"h5"},{title:"Heading 6",format:"h6"}]},{title:"Inline",items:[{title:"Bold",format:"bold"},{title:"Italic",format:"italic"},{title:"Underline",format:"underline"},{title:"Strikethrough",format:"strikethrough"},{title:"Superscript",format:"superscript"},{title:"Subscript",format:"subscript"},{title:"Code",format:"code"}]},{title:"Blocks",items:[{title:"Paragraph",format:"p"},{title:"Blockquote",format:"blockquote"},{title:"Div",format:"div"},{title:"Pre",format:"pre"}]},{title:"Align",items:[{title:"Left",format:"alignleft"},{title:"Center",format:"aligncenter"},{title:"Right",format:"alignright"},{title:"Justify",format:"alignjustify"}]}],JN=e=>Z(e,(e,t)=>{if(ve(t,"items")){const o=JN(t.items);return{customFormats:e.customFormats.concat(o.customFormats),formats:e.formats.concat([{title:t.title,items:o.formats}])}}if(ve(t,"inline")||(e=>ve(e,"block"))(t)||(e=>ve(e,"selector"))(t)){const o=`custom-${i(t.name)?t.name:t.title.toLowerCase()}`;return{customFormats:e.customFormats.concat([{name:o,format:t}]),formats:e.formats.concat([{title:t.title,format:o,icon:t.icon}])}}return{...e,formats:e.formats.concat(t)}},{customFormats:[],formats:[]}),QN=e=>eC(e).map(t=>{const o=((e,t)=>{const o=JN(t),n=t=>{F(t,t=>{e.formatter.has(t.name)||e.formatter.register(t.name,t.format)})};return e.formatter?n(o.customFormats):e.on("init",()=>{n(o.customFormats)}),o.formats})(e,t);return tC(e)?KN.concat(o):o}).getOr(KN),eV=(e,t,o)=>({...e,type:"formatter",isSelected:t(e.format),getStylePreview:o(e.format)}),tV=(e,t,o,n)=>{const r=t=>L(t,t=>YN(t)?(e=>{const t=r(e.items);return{...e,type:"submenu",getStyleItems:w(t)}})(t):XN(t)?(e=>eV(e,o,n))(t):(e=>{const t=ie(e);return 1===t.length&&V(t,"title")})(t)?{...t,type:"separator"}:(t=>{const r=i(t.name)?t.name:Pe(t.title),s=`custom-${r}`,a={...t,type:"formatter",format:s,isSelected:o(s),getStylePreview:n(s)};return e.formatter.register(r,a),a})(t));return r(t)},oV=e=>{let t=0;const o=e=>[{dom:{tag:"div",classes:["tox-tooltip__body"]},components:[Sm(e.tooltipText)]}];return{getConfig:n=>({delayForShow:()=>t>0?60:300,delayForHide:w(300),exclusive:!0,lazySink:e,tooltipDom:{tag:"div",classes:["tox-tooltip","tox-tooltip--up"]},tooltipComponents:o(n),onShow:(e,o)=>{t++,n.onShow&&n.onShow(e,o)},onHide:(e,o)=>{t--,n.onHide&&n.onHide(e,o)},onSetup:n.onSetup}),getComponents:o}},nV=nR.trim,rV=e=>t=>{if((e=>m(e)&&1===e.nodeType)(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},iV=rV("true"),sV=rV("false"),aV=(e,t,o,n,r)=>({type:e,title:t,url:o,level:n,attach:r}),lV=e=>e.innerText||e.textContent,cV=e=>(e=>e&&"A"===e.nodeName&&void 0!==(e.id||e.name))(e)&&uV(e),dV=e=>e&&/^(H[1-6])$/.test(e.nodeName),uV=e=>(e=>{let t=e;for(;t=t.parentNode;){const e=t.contentEditable;if(e&&"inherit"!==e)return iV(t)}return!1})(e)&&!sV(e),hV=e=>dV(e)&&uV(e),mV=e=>{var t;const o=(e=>e.id?e.id:Pe("h"))(e);return aV("header",null!==(t=lV(e))&&void 0!==t?t:"","#"+o,(e=>dV(e)?parseInt(e.nodeName.substr(1),10):0)(e),()=>{e.id=o})},pV=e=>{const t=e.id||e.name,o=lV(e);return aV("anchor",o||"#"+t,"#"+t,0,v)},gV=e=>nV(e.title).length>0,fV=e=>{const t=(e=>{const t=L(hr(ct(e),"h1,h2,h3,h4,h5,h6,a:not([href])"),e=>e.dom);return t})(e);return H((e=>L(H(e,hV),mV))(t).concat((e=>L(H(e,cV),pV))(t)),gV)},vV="tinymce-url-history",bV=e=>i(e)&&/^https?/.test(e),yV=e=>s(e)&&pe(e,e=>{return!(l(t=e)&&t.length<=5&&G(t,bV));var t}).isNone(),wV=()=>{const e=kM.getItem(vV);if(null===e)return{};let t;try{t=JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return console.log("Local storage "+vV+" was not valid JSON",e),{};throw e}return yV(t)?t:(console.log("Local storage "+vV+" was not valid format",t),{})},_V=e=>{const t=wV();return fe(t,e).getOr([])},xV=(e,t)=>{if(!bV(e))return;const o=wV(),n=fe(o,t).getOr([]),r=H(n,t=>t!==e);o[t]=[e].concat(r).slice(0,5),(e=>{if(!yV(e))throw new Error("Bad format for history:\n"+JSON.stringify(e));kM.setItem(vV,JSON.stringify(e))})(o)},CV=e=>!!e,kV=e=>le(nR.makeMap(e,/[, ]/),CV),SV=e=>A.from(pC(e)),TV=e=>A.from(e).filter(i).getOrUndefined(),EV=e=>({getHistory:_V,addToHistory:xV,getLinkInformation:()=>(e=>bC(e)?A.some({targets:fV(e.getBody()),anchorTop:TV(yC(e)),anchorBottom:TV(wC(e))}):A.none())(e),getValidationHandler:()=>(e=>A.from(gC(e)))(e),getUrlPicker:t=>((e,t)=>((e,t)=>{const o=(e=>{const t=A.from(vC(e)).filter(CV).map(kV);return SV(e).fold(E,e=>t.fold(O,e=>ie(e).length>0&&e))})(e);return d(o)?o?SV(e):A.none():o[t]?SV(e):A.none()})(e,t).map(o=>n=>Se(r=>{const a={filetype:t,fieldname:n.fieldname,...A.from(n.meta).getOr({})};o.call(e,(e,t)=>{if(!i(e))throw new Error("Expected value to be string");if(void 0!==t&&!s(t))throw new Error("Expected meta to be a object");r({value:e,meta:t})},n.value,a)})))(e,t)}),OV=v,AV=E,MV=w([]);var BV,RV=Object.freeze({__proto__:null,setup:OV,isDocked:AV,getBehaviours:MV});const NV=w(Pe("toolbar-height-change")),VV={fadeInClass:"tox-editor-dock-fadein",fadeOutClass:"tox-editor-dock-fadeout",transitionClass:"tox-editor-dock-transition"},DV="tox-tinymce--toolbar-sticky-on",PV="tox-tinymce--toolbar-sticky-off",IV=(e,t)=>V(Op.getModes(e),t),LV=e=>{const t=e.element;po(t).each(o=>{const n="padding-"+Op.getModes(e)[0];if(Op.isDocked(e)){const e=En(o);dn(t,"width",e+"px"),dn(o,n,(e=>Cn(e)+(parseInt(mn(e,"margin-top"),10)||0)+(parseInt(mn(e,"margin-bottom"),10)||0))(t)+"px")}else bn(t,"width"),bn(o,n)})},FV=(e,t)=>{t?(rr(e,VV.fadeOutClass),sr(e,[VV.transitionClass,VV.fadeInClass])):(rr(e,VV.fadeInClass),sr(e,[VV.fadeOutClass,VV.transitionClass]))},zV=(e,t)=>{const o=ct(e.getContainer());t?(or(o,DV),rr(o,PV)):(or(o,PV),rr(o,DV))},HV=(e,t)=>{const o=Ge(),n=t.getSink,r=e=>{n().each(t=>e(t.element))},i=t=>{e.inline||LV(t),zV(e,Op.isDocked(t)),t.getSystem().broadcastOn([pb()],{}),n().each(e=>e.getSystem().broadcastOn([pb()],{}))},s=e.inline?[]:[ov.config({channels:{[NV()]:{onReceive:LV}}})];return[fd.config({}),Op.config({contextual:{lazyContext:t=>{const o=Cn(t.element),n=e.inline?e.getContentAreaContainer():e.getContainer();return A.from(n).map(n=>{const r=Dr(ct(n));return JC(e,t.element).fold(()=>{const e=r.height-o,n=r.y+(IV(t,"top")?0:o);return Vr(r.x,n,r.width,e)},e=>{const n=Ir(r,QC(e)),i=IV(t,"top")?n.y:n.y+o;return Vr(n.x,i,n.width,n.height-o)})})},onShow:()=>{r(e=>FV(e,!0))},onShown:e=>{r(e=>ar(e,[VV.transitionClass,VV.fadeInClass])),o.get().each(t=>{((e,t)=>{const o=lo(t);Io(o).filter(e=>!wt(t,e)).filter(t=>wt(t,ct(o.dom.body))||_t(e,t)).each(()=>Vo(t))})(e.element,t),o.clear()})},onHide:e=>{((e,t)=>Lo(e).orThunk(()=>t().toOptional().bind(e=>Lo(e.element))))(e.element,n).fold(o.clear,o.set),r(e=>FV(e,!1))},onHidden:()=>{r(e=>ar(e,[VV.transitionClass]))},...VV},lazyViewport:t=>JC(e,t.element).fold(()=>{const o=Lr(),n=uC(e),r=o.y+(IV(t,"top")&&!KC(e)?n:0),i=o.height-(IV(t,"bottom")?n:0);return{bounds:Vr(o.x,r,o.width,i),optScrollEnv:A.none()}},e=>({bounds:QC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Nn(e.element).top})})),modes:[t.header.getDockingMode()],onDocked:i,onUndocked:i}),...s]};var UV=Object.freeze({__proto__:null,setup:(e,t,o)=>{e.inline||(t.header.isPositionedAtTop()||e.on("ResizeEditor",()=>{o().each(Op.reset)}),e.on("ResizeWindow ResizeEditor",()=>{o().each(LV)}),e.on("SkinLoaded",()=>{o().each(e=>{Op.isDocked(e)?Op.reset(e):Op.refresh(e)})}),e.on("FullscreenStateChanged",()=>{o().each(Op.reset)})),e.on("AfterScrollIntoView",e=>{o().each(t=>{Op.refresh(t);const o=t.element;kn(o)&&((e,t)=>{const o=lo(t),n=ho(t).dom.innerHeight,r=Dn(o),i=ct(e.elm),s=Pr(i),a=xn(i),l=s.y,c=l+a,d=Nn(t),u=xn(t),h=d.top,m=h+u,p=Math.abs(h-r.top)<2,g=Math.abs(m-(r.top+n))<2;if(p&&l<m)Pn(r.left,l-u,o);else if(g&&c>h){const e=l-n+a+u;Pn(r.left,e,o)}})(e,o)})}),e.on("PostRender",()=>{zV(e,!1)})},isDocked:e=>e().map(Op.isDocked).getOr(!1),getBehaviours:HV}),ZV=ng({factory:(e,t)=>{const o={focus:_h.focusIn,setMenus:(e,o)=>{const n=L(o,e=>{const o={type:"menubutton",text:e.text,fetch:t=>{t(e.getItems())},context:"any"},n=zE(o).mapError(e=>Ai(e)).getOrDie();return tN(n,"tox-mbtn",t.backstage,A.some("menuitem"))});Qh.set(e,n)}};return{uid:e.uid,dom:e.dom,components:[],behaviours:id([Qh.config({}),ud("menubar-events",[Kc(t=>{e.onSetup(t)}),Zc(bs(),(e,t)=>{Gn(e.element,".tox-mbtn--active").each(o=>{Yn(t.event.target,".tox-mbtn").each(t=>{wt(o,t)||e.getSystem().getByDom(o).each(o=>{e.getSystem().getByDom(t).each(e=>{ky.expand(e),ky.close(o),fd.focus(e)})})})})}),Zc(Ks(),(e,t)=>{t.event.prevFocus.bind(t=>e.getSystem().getByDom(t).toOptional()).each(o=>{t.event.newFocus.bind(t=>e.getSystem().getByDom(t).toOptional()).each(e=>{ky.isOpen(o)&&(ky.expand(e),ky.close(o))})})})]),_h.config({mode:"flow",selector:".tox-mbtn",onEscape:t=>(e.onEscape(t),A.some(!0))}),Hv.config({})]),apis:o,domModification:{attributes:{role:"menubar"}}}},name:"silver.Menubar",configFields:[Di("dom"),Di("uid"),Di("onEscape"),Di("backstage"),Ji("onSetup",v)],apis:{focus:(e,t)=>{e.focus(t)},setMenus:(e,t,o)=>{e.setMenus(t,o)}}});const $V=e=>({element:()=>e.element.dom}),jV=(e,t)=>{const o=L(ie(t),e=>{const o=t[e],n=Ei((e=>Ti("sidebar",eA,e))(o));return{name:e,getApi:$V,onSetup:n.onSetup,onShow:n.onShow,onHide:n.onHide}});return L(o,t=>{const n=we(v);return e.slot(t.name,{dom:{tag:"div",classes:["tox-sidebar__pane"]},behaviours:cA([gA(t,n),fA(t,n),Zc(Js(),(e,t)=>{const n=t.event,r=$(o,e=>e.name===n.name);r.each(t=>{(n.visible?t.onShow:t.onHide)(t.getApi(e))})})])})})},WV=e=>q_.sketch(t=>({dom:{tag:"div",classes:["tox-sidebar__pane-container"]},components:jV(t,e),slotBehaviours:cA([Kc(e=>q_.hideAllSlots(e))])})),qV=(e,t)=>{jo(e,"role",t)},GV=e=>Im.getCurrent(e).bind(e=>Nv.isGrowing(e)||Nv.hasGrown(e)?Im.getCurrent(e).bind(e=>$(q_.getSlotNames(e),t=>q_.isShowing(e,t))):A.none()),YV=Pe("FixSizeEvent"),XV=Pe("AutoSizeEvent"),KV=e=>Im.getCurrent(e).each(e=>Vo(e.element,!0)),JV=(e,t,o)=>{const n=we(!1),r=Ge(),i=o=>{var r;n.get()&&(!(e=>"focusin"===e.type)(r=o)||!(r.composed?te(r.composedPath()):A.from(r.target)).map(ct).filter(no).exists(e=>ir(e,"mce-pastebin")))&&(o.preventDefault(),KV(t()),e.editorManager.setActive(e))};e.inline||e.on("PreInit",()=>{e.dom.bind(e.getWin(),"focusin",i),e.on("BeforeExecCommand",e=>{"mcefocus"===e.command.toLowerCase()&&!0!==e.value&&i(e)})});const s=r=>{r!==n.get()&&(n.set(r),((e,t,o,n)=>{const r=t.element;if(((e,t)=>{const o="tabindex",n=`data-mce-${o}`;A.from(e.iframeElement).map(ct).each(e=>{t?(Go(e,o).each(t=>jo(e,n,t)),jo(e,o,-1)):(Xo(e,o),Go(e,n).each(t=>{jo(e,o,t),Xo(e,n)}))})})(e,o),o)Vm.block(t,(e=>(t,o)=>({dom:{tag:"div",attributes:{"aria-label":e.translate("Loading..."),tabindex:"0"},classes:["tox-throbber__busy-spinner"]},components:[{dom:cb('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}))(n)),bn(r,"display"),Xo(r,"aria-hidden"),e.hasFocus()&&KV(t);else{const o=Im.getCurrent(t).exists(e=>Po(e.element));Vm.unblock(t),dn(r,"display","none"),jo(r,"aria-hidden","true"),o&&e.focus()}})(e,t(),r,o.providers),((e,t)=>{e.dispatch("AfterProgressState",{state:t})})(e,r))};e.on("ProgressState",t=>{if(r.on(clearTimeout),g(t.time)){const o=Fx.setEditorTimeout(e,()=>s(t.state),t.time);r.set(o)}else s(t.state),r.clear()})},QV=e=>{const t=e.label.isNone()?e.title.fold(()=>({}),e=>({attributes:{"aria-label":e}})):e.label.fold(()=>({}),e=>({attributes:{"aria-label":e}}));return{dom:{tag:"div",classes:["tox-toolbar__group"].concat(e.label.isSome()?["tox-toolbar__group_with_label"]:[]),...t},components:[...e.label.map(e=>({dom:{tag:"span",classes:["tox-label","tox-label--context-toolbar"]},components:[Sm(e)]})).toArray(),cx.parts.items({})],items:e.items,markers:{itemSelector:"*:not(.tox-split-button) > .tox-tbtn:not([disabled]), .tox-split-button:not([disabled]), .tox-toolbar-nav-item:not([disabled]), .tox-number-input:not([disabled])"},tgroupBehaviours:id([Hv.config({}),fd.config({ignore:!0})])}},eD=e=>cx.sketch(QV(e)),tD=(e,t)=>{const o=Kc(t=>{const o=L(e.initGroups,eD);Ry.setGroups(t,o)});return id([mA(()=>e.providers.checkUiComponentContext("any").shouldDisable),kA(()=>e.providers.checkUiComponentContext("any")),_h.config({mode:t,onEscape:e.onEscape,visibilitySelector:".tox-toolbar__overflow",selector:".tox-toolbar__group"}),ud("toolbar-events",[o])])},oD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return{uid:e.uid,dom:{tag:"div",classes:["tox-toolbar-overlord"]},parts:{"overflow-group":QV({title:A.none(),label:A.none(),items:[]}),"overflow-button":gN({context:"any",name:"more",icon:A.some("more-drawer"),enabled:!0,tooltip:A.some("Reveal or hide additional toolbar items"),primary:!1,buttonType:A.none(),borderless:!1},A.none(),e.providers,[],"overflow-button")},splitToolbarBehaviours:tD(e,t)}},nD=e=>{const t=oD(e),o=hx.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}});return hx.sketch({...t,lazySink:e.getSink,getOverflowBounds:()=>{const t=e.moreDrawerData.lazyHeader().element,o=Pr(t),n=uo(t),r=Pr(n),i=Math.max(n.dom.scrollHeight,r.height);return Vr(o.x+4,r.y,o.width-8,i)},parts:{...t.parts,overflow:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:e.attributes}}},components:[o],markers:{overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>e.onToggled(t,!0),onClosed:t=>e.onToggled(t,!1)})},rD=e=>{const t=vx.parts.primary({dom:{tag:"div",classes:["tox-toolbar__primary"]}}),o=vx.parts.overflow({dom:{tag:"div",classes:["tox-toolbar__overflow"]}}),n=oD(e);return vx.sketch({...n,components:[t,o],markers:{openClass:"tox-toolbar__overflow--open",closedClass:"tox-toolbar__overflow--closed",growingClass:"tox-toolbar__overflow--growing",shrinkingClass:"tox-toolbar__overflow--shrinking",overflowToggledClass:"tox-tbtn--enabled"},onOpened:t=>{t.getSystem().broadcastOn([NV()],{type:"opened"}),e.onToggled(t,!0)},onClosed:t=>{t.getSystem().broadcastOn([NV()],{type:"closed"}),e.onToggled(t,!1)}})},iD=e=>{const t=e.cyclicKeying?"cyclic":"acyclic";return Ry.sketch({uid:e.uid,dom:{tag:"div",classes:["tox-toolbar"].concat(e.type===Px.scrolling?["tox-toolbar--scrolling"]:[])},components:[Ry.parts.groups({})],toolbarBehaviours:tD(e,t)})},sD=(e,t)=>((e,t)=>{var o,n;const r="togglebutton"===e.type,i=e.icon.map(e=>VR(e,t.icons)).map(db),s={...e,name:r?e.text.getOr(e.icon.getOr("")):null!==(o=e.text)&&void 0!==o?o:e.icon.getOr(""),primary:"primary"===e.buttonType,buttonType:A.from(e.buttonType),tooltip:e.tooltip,icon:e.icon,enabled:!0,borderless:e.borderless},a=fN(null!==(n=e.buttonType)&&void 0!==n?n:"secondary"),l=r?e.text.map(t.translate):A.some(t.translate(e.text)),c=l.map(Sm),d=s.tooltip.or(l).map(e=>({"aria-label":t.translate(e)})).getOr({}),u=i.map(e=>e.asSpec()),h=EA([u,c]),m=e.icon.isSome()&&c.isSome(),p={tag:"button",classes:a.concat(...e.icon.isSome()&&!m?["tox-button--icon"]:[]).concat(...m?["tox-button--icon-and-text"]:[]).concat(...e.borderless?["tox-button--naked"]:[]).concat(..."togglebutton"===e.type&&e.active?["tox-button--enabled"]:[]),attributes:d},g=pN(s,A.some(o=>{const n=e=>{i.map(n=>n.getOpt(o).each(o=>{Qh.set(o,[VR(e,t.icons)])}))};return r?e.onAction({setIcon:n,setActive:e=>{const t=o.element;e?(or(t,"tox-button--enabled"),jo(t,"aria-pressed",!0)):(rr(t,"tox-button--enabled"),Xo(t,"aria-pressed"))},isActive:()=>ir(o.element,"tox-button--enabled"),focus:()=>Vo(o.element)}):"button"===e.type?e.onAction({setIcon:n}):void 0}),[],p,h,e.tooltip,t);return Tb.sketch(g)})(e,t),aD=Kt().deviceType,lD=aD.isPhone(),cD=aD.isTablet();var dD=rg({name:"silver.View",configFields:[Di("viewConfig")],partFields:[Qa({factory:{sketch:e=>{let t=!1;const o=L(e.buttons,o=>"group"===o.type?(t=!0,((e,t)=>({dom:{tag:"div",classes:["tox-view__toolbar__group"]},components:L(e.buttons,e=>sD(e,t))}))(o,e.providers)):sD(o,e.providers));return{uid:e.uid,dom:{tag:"div",classes:[t?"tox-view__toolbar":"tox-view__header",...lD||cD?["tox-view--mobile","tox-view--scrolling"]:[]]},behaviours:id([fd.config({}),_h.config({mode:"flow",selector:"button, .tox-button",focusInside:Oa.OnEnterOrSpaceMode})]),components:t?o:[ig.sketch({dom:{tag:"div",classes:["tox-view__header-start"]},components:[]}),ig.sketch({dom:{tag:"div",classes:["tox-view__header-end"]},components:o})]}}},schema:[Di("buttons"),Di("providers")],name:"header"}),Qa({factory:{sketch:e=>({uid:e.uid,behaviours:id([fd.config({}),Hv.config({})]),dom:{tag:"div",classes:["tox-view__pane"]}})},schema:[],name:"pane"})],factory:(e,t,o,n)=>{const r={getPane:t=>ub.getPart(t,e,"pane"),getOnShow:t=>e.viewConfig.onShow,getOnHide:t=>e.viewConfig.onHide};return{uid:e.uid,dom:e.dom,components:t,behaviours:id([fd.config({}),_h.config({mode:"cyclic",focusInside:Oa.OnEnterOrSpaceMode})]),apis:r}},apis:{getPane:(e,t)=>e.getPane(t),getOnShow:(e,t)=>e.getOnShow(t),getOnHide:(e,t)=>e.getOnHide(t)}});const uD=(e,t,o)=>me(t,(t,n)=>{const r=Ei(Ti("view",aA,t));return e.slot(n,dD.sketch({dom:{tag:"div",classes:["tox-view"]},viewConfig:r,components:[...r.buttons.length>0?[dD.parts.header({buttons:r.buttons,providers:o})]:[],dD.parts.pane({})]}))}),hD=(e,t)=>q_.sketch(o=>({dom:{tag:"div",classes:["tox-view-wrap__slot-container"]},components:uD(o,e,t),slotBehaviours:cA([Kc(e=>q_.hideAllSlots(e))])})),mD=e=>$(q_.getSlotNames(e),t=>q_.isShowing(e,t)),pD=(e,t,o)=>{q_.getSlot(e,t).each(e=>{dD.getPane(e).each(t=>{var n;o(e)((n=t.element.dom,{getContainer:w(n)}))})})};var gD=ng({factory:(e,t)=>{const o={setViews:(e,o)=>{Qh.set(e,[hD(o,t.backstage.shared.providers)])},whichView:e=>Im.getCurrent(e).bind(mD),toggleView:(e,t,o,n)=>Im.getCurrent(e).exists(r=>{const i=mD(r),s=i.exists(e=>n===e),a=q_.getSlot(r,n).isSome();return a&&(q_.hideAllSlots(r),s?((e=>{const t=e.element;dn(t,"display","none"),jo(t,"aria-hidden","true")})(e),t()):(o(),(e=>{const t=e.element;bn(t,"display"),Xo(t,"aria-hidden")})(e),q_.showSlot(r,n),((e,t)=>{pD(e,t,dD.getOnShow)})(r,n)),i.each(e=>((e,t)=>pD(e,t,dD.getOnHide))(r,e))),a})};return{uid:e.uid,dom:{tag:"div",classes:["tox-view-wrap"],attributes:{"aria-hidden":"true"},styles:{display:"none"}},components:[],behaviours:id([Qh.config({}),Im.config({find:e=>{const t=Qh.contents(e);return te(t)}})]),apis:o}},name:"silver.ViewWrapper",configFields:[Di("backstage")],apis:{setViews:(e,t,o)=>e.setViews(t,o),toggleView:(e,t,o,n,r)=>e.toggleView(t,o,n,r),whichView:(e,t)=>e.whichView(t)}});const fD=hb.optional({factory:ZV,name:"menubar",schema:[Di("backstage")]}),vD=hb.optional({factory:{sketch:e=>Mb.sketch({uid:e.uid,dom:e.dom,listBehaviours:id([_h.config({mode:"acyclic",selector:".tox-toolbar"})]),makeItem:()=>iD({type:e.type,uid:Pe("multiple-toolbar-item"),cyclicKeying:!1,initGroups:[],providers:e.providers,onEscape:()=>(e.onEscape(),A.some(!0))}),setupItem:(e,t,o,n)=>{Ry.setGroups(t,o)},shell:!0})},name:"multiple-toolbar",schema:[Di("dom"),Di("onEscape")]}),bD=hb.optional({factory:{sketch:e=>{const t=(e=>e.type===Px.sliding?rD:e.type===Px.floating?nD:iD)(e);return t({type:e.type,uid:e.uid,onEscape:()=>(e.onEscape(),A.some(!0)),onToggled:(t,o)=>e.onToolbarToggled(o),cyclicKeying:!1,initGroups:[],getSink:e.getSink,providers:e.providers,moreDrawerData:{lazyToolbar:e.lazyToolbar,lazyMoreButton:e.lazyMoreButton,lazyHeader:e.lazyHeader},attributes:e.attributes})}},name:"toolbar",schema:[Di("dom"),Di("onEscape"),Di("getSink")]}),yD=hb.optional({factory:{sketch:e=>{const t=e.editor,o=e.sticky?HV:MV;return{uid:e.uid,dom:e.dom,components:e.components,behaviours:id(o(t,e.sharedBackstage))}}},name:"header",schema:[Di("dom")]}),wD=hb.optional({factory:{sketch:e=>{const t=e.promotionLink?[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/tinymce-upgrade-to-cloud/?utm_campaign=self_hosted_upgrade_promo&utm_source=tiny&utm_medium=referral",rel:"noopener",target:"_blank","aria-hidden":"true"},classes:["tox-promotion-link"],innerHtml:"💝Get all features"}}]:[];return{uid:e.uid,dom:e.dom,components:t}}},name:"promotion",schema:[Di("dom"),Di("promotionLink")]}),_D=hb.optional({name:"socket",schema:[Di("dom")]}),xD=hb.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-sidebar"],attributes:{role:"presentation"}},components:[{dom:{tag:"div",classes:["tox-sidebar__slider"]},components:[],behaviours:id([Hv.config({}),fd.config({}),Nv.config({dimension:{property:"width"},closedClass:"tox-sidebar--sliding-closed",openClass:"tox-sidebar--sliding-open",shrinkingClass:"tox-sidebar--sliding-shrinking",growingClass:"tox-sidebar--sliding-growing",onShrunk:e=>{Im.getCurrent(e).each(q_.hideAllSlots),Vc(e,XV)},onGrown:e=>{Vc(e,XV)},onStartGrow:e=>{Dc(e,YV,{width:gn(e.element,"width").getOr("")})},onStartShrink:e=>{Dc(e,YV,{width:En(e.element)+"px"})}}),Qh.config({}),Im.config({find:e=>{const t=Qh.contents(e);return te(t)}})])}],behaviours:id([LB(0),ud("sidebar-sliding-events",[Zc(YV,(e,t)=>{dn(e.element,"width",t.event.width)}),Zc(XV,(e,t)=>{bn(e.element,"width")})])])})},name:"sidebar",schema:[Di("dom")]}),CD=hb.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",attributes:{"aria-hidden":"true"},classes:["tox-throbber"],styles:{display:"none"}},behaviours:id([Qh.config({}),Vm.config({focus:!1}),Im.config({find:e=>te(e.components())})]),components:[]})},name:"throbber",schema:[Di("dom")]}),kD=hb.optional({factory:gD,name:"viewWrapper",schema:[Di("backstage")]}),SD=hb.optional({factory:{sketch:e=>({uid:e.uid,dom:{tag:"div",classes:["tox-editor-container"]},components:e.components})},name:"editorContainer",schema:[]});var TD=rg({name:"OuterContainer",factory:(e,t,o)=>{let n=!1;const r=e=>{Wn(e,".tox-statusbar").each(e=>{"none"===mn(e,"display")&&"true"===qo(e,"aria-hidden")?(bn(e,"display"),Xo(e,"aria-hidden")):(dn(e,"display","none"),jo(e,"aria-hidden","true"))})},s={getSocket:t=>ub.getPart(t,e,"socket"),setSidebar:(t,o,n)=>{ub.getPart(t,e,"sidebar").each(e=>((e,t,o)=>{Im.getCurrent(e).each(n=>{Qh.set(n,[WV(t)]);const r=null==o?void 0:o.toLowerCase();i(r)&&ve(t,r)&&Im.getCurrent(n).each(t=>{q_.showSlot(t,r),Nv.immediateGrow(n),bn(n.element,"width"),qV(e.element,"region")})})})(e,o,n))},toggleSidebar:(t,o)=>{ub.getPart(t,e,"sidebar").each(e=>((e,t)=>{Im.getCurrent(e).each(o=>{Im.getCurrent(o).each(n=>{Nv.hasGrown(o)?q_.isShowing(n,t)?(Nv.shrink(o),qV(e.element,"presentation")):(q_.hideAllSlots(n),q_.showSlot(n,t),qV(e.element,"region")):(q_.hideAllSlots(n),q_.showSlot(n,t),Nv.grow(o),qV(e.element,"region"))})})})(e,o))},whichSidebar:t=>ub.getPart(t,e,"sidebar").bind(GV).getOrNull(),getHeader:t=>ub.getPart(t,e,"header"),getToolbar:t=>ub.getPart(t,e,"toolbar"),setToolbar:(t,o)=>{ub.getPart(t,e,"toolbar").each(e=>{const t=L(o,eD);e.getApis().setGroups(e,t)})},setToolbars:(t,o)=>{ub.getPart(t,e,"multiple-toolbar").each(e=>{const t=L(o,e=>L(e,eD));Mb.setItems(e,t)})},refreshToolbar:t=>{ub.getPart(t,e,"toolbar").each(e=>e.getApis().refresh(e))},toggleToolbarDrawer:t=>{ub.getPart(t,e,"toolbar").each(e=>{Ze(e.getApis().toggle,t=>t(e))})},toggleToolbarDrawerWithoutFocusing:t=>{ub.getPart(t,e,"toolbar").each(e=>{Ze(e.getApis().toggleWithoutFocusing,t=>t(e))})},isToolbarDrawerToggled:t=>ub.getPart(t,e,"toolbar").bind(e=>A.from(e.getApis().isOpen).map(t=>t(e))).getOr(!1),getThrobber:t=>ub.getPart(t,e,"throbber"),focusToolbar:t=>{ub.getPart(t,e,"toolbar").orThunk(()=>ub.getPart(t,e,"multiple-toolbar")).each(e=>{_h.focusIn(e)})},setMenubar:(t,o)=>{ub.getPart(t,e,"menubar").each(e=>{ZV.setMenus(e,o)})},focusMenubar:t=>{ub.getPart(t,e,"menubar").each(e=>{ZV.focus(e)})},setViews:(t,o)=>{ub.getPart(t,e,"viewWrapper").each(e=>{gD.setViews(e,o)})},toggleView:(t,o)=>ub.getPart(t,e,"viewWrapper").exists(e=>gD.toggleView(e,()=>s.showMainView(t),()=>s.hideMainView(t),o)),whichView:t=>ub.getPart(t,e,"viewWrapper").bind(gD.whichView).getOrNull(),hideMainView:t=>{n=s.isToolbarDrawerToggled(t),n&&s.toggleToolbarDrawer(t),ub.getPart(t,e,"editorContainer").each(e=>{const t=e.element;r(t),dn(t,"display","none"),jo(t,"aria-hidden","true")})},showMainView:t=>{n&&s.toggleToolbarDrawer(t),ub.getPart(t,e,"editorContainer").each(e=>{const t=e.element;r(t),bn(t,"display"),Xo(t,"aria-hidden")})}};return{uid:e.uid,dom:e.dom,components:t,apis:s,behaviours:e.behaviours}},configFields:[Di("dom"),Di("behaviours")],partFields:[yD,fD,bD,vD,_D,xD,wD,CD,kD,SD],apis:{getSocket:(e,t)=>e.getSocket(t),setSidebar:(e,t,o,n)=>{e.setSidebar(t,o,n)},toggleSidebar:(e,t,o)=>{e.toggleSidebar(t,o)},whichSidebar:(e,t)=>e.whichSidebar(t),getHeader:(e,t)=>e.getHeader(t),getToolbar:(e,t)=>e.getToolbar(t),setToolbar:(e,t,o)=>{e.setToolbar(t,o)},setToolbars:(e,t,o)=>{e.setToolbars(t,o)},refreshToolbar:(e,t)=>e.refreshToolbar(t),toggleToolbarDrawer:(e,t)=>{e.toggleToolbarDrawer(t)},toggleToolbarDrawerWithoutFocusing:(e,t)=>{e.toggleToolbarDrawerWithoutFocusing(t)},isToolbarDrawerToggled:(e,t)=>e.isToolbarDrawerToggled(t),getThrobber:(e,t)=>e.getThrobber(t),setMenubar:(e,t,o)=>{e.setMenubar(t,o)},focusMenubar:(e,t)=>{e.focusMenubar(t)},focusToolbar:(e,t)=>{e.focusToolbar(t)},setViews:(e,t,o)=>{e.setViews(t,o)},toggleView:(e,t,o)=>e.toggleView(t,o),whichView:(e,t)=>e.whichView(t)}});const ED={file:{title:"File",items:"newdocument restoredraft | preview | importword exportpdf exportword | export print | deleteallconversations"},edit:{title:"Edit",items:"undo redo | cut copy paste pastetext | selectall | searchreplace"},view:{title:"View",items:"code revisionhistory | visualaid visualchars visualblocks | spellchecker | preview fullscreen | showcomments"},insert:{title:"Insert",items:"image link media addcomment pageembed inserttemplate codesample inserttable accordion math | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents footnotes | mergetags | insertdatetime"},format:{title:"Format",items:"bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | language | removeformat"},tools:{title:"Tools",items:"aidialog aishortcuts | spellchecker spellcheckerlanguage | autocorrect capitalization | a11ycheck code typography wordcount addtemplate"},table:{title:"Table",items:"inserttable | cell row column | advtablesort | tableprops deletetable"},help:{title:"Help",items:"help"}},OD=e=>e.split(" "),AD=(e,t)=>{const o={...ED,...t.menus},n=ie(t.menus).length>0,r=void 0===t.menubar||!0===t.menubar?OD("file edit view insert format tools table help"):OD(!1===t.menubar?"":t.menubar),s=H(r,e=>{const o=ve(ED,e);return n?o||fe(t.menus,e).exists(e=>ve(e,"items")):o}),a=L(s,n=>{const r=o[n];return((e,t,o)=>{const n=rC(o).split(/[ ,]/);return{text:e.title,getItems:()=>q(e.items,e=>{const o=e.toLowerCase();return 0===o.trim().length||D(n,e=>e===o)?[]:"separator"===o||"|"===o?[{type:"separator"}]:t.menuItems[o]?[t.menuItems[o]]:[]})}})({title:r.title,items:OD(r.items)},t,e)});return H(a,e=>e.getItems().length>0&&D(e.getItems(),e=>i(e)||"separator"!==e.type))},MD=(e,t,o)=>(e.on("remove",()=>o.unload(t)),o.load(t)),BD=(e,t,o,n)=>(e.on("remove",()=>n.unloadRawCss(t)),n.loadRawCss(t,o)),RD=e=>A.from(mailpoetTinymce.Resource.get(e)).filter(i),ND=(e,t,o="")=>{const n=(e=>{const t=BC(e);return t?A.from(t):A.none()})(e).map(e=>((e,t)=>"ui/"+e+"/"+t)(e,`${t}.css`)),r=n.bind(RD);return Ue(n,r,(e,t)=>({_kind:"load-raw",key:e,css:t})).getOrThunk(()=>{const n=e.editorManager.suffix;return{_kind:"load-stylesheet",url:o+`/${t}${n}.css`}})},VD=(e,t)=>{const o=e.ui.styleSheetLoader,n=ND(e,"skin",t);switch(n._kind){case"load-raw":const{key:t,css:r}=n;return BD(e,t,r,o),Promise.resolve();case"load-stylesheet":const{url:i}=n;return MD(e,i,o);default:return Promise.resolve()}},DD=(e,t)=>{var o;if(o=ct(e.getElement()),!ko(o).isSome())return Promise.resolve();{const o=zx.DOM.styleSheetLoader,n=ND(e,"skin.shadowdom",t);switch(n._kind){case"load-raw":const{key:t,css:r}=n;return BD(e,t,r,o),Promise.resolve();case"load-stylesheet":const{url:i}=n;return MD(e,i,o);default:return Promise.resolve()}}},PD=(e,t)=>(async(e,t)=>{const o=VC(t);if(await((e,t,o)=>{const n=ND(e,t?"content.inline":"content",o);switch(n._kind){case"load-raw":const{key:r,css:i}=n;return t?BD(e,r,i,e.ui.styleSheetLoader):e.on("PostRender",()=>{BD(e,r,i,e.dom.styleSheetLoader)}),Promise.resolve();case"load-stylesheet":const{url:s}=n;return o&&e.contentCSS.push(s),Promise.resolve();default:return Promise.resolve()}})(t,e,o),!RC(t)&&i(o))return Promise.all([VD(t,o),DD(t,o)]).then()})(e,t).then((e=>{const t=()=>{e._skinLoaded=!0,(e=>{e.dispatch("SkinLoaded")})(e)};return()=>{e.initialized?t():e.on("init",t)}})(t),(e=>()=>((e,t)=>{e.dispatch("SkinLoadError",t)})(e,{message:"Skin could not be loaded"}))(t)),ID=C(PD,!1),LD=C(PD,!0),FD=e=>({isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t),setText:t=>Dc(e,PR,{text:t}),setIcon:t=>Dc(e,IR,{icon:t})}),zD=e=>({setActive:t=>{Yv.set(e,t)},isActive:()=>Yv.isOn(e),isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t),setText:t=>Dc(e,PR,{text:t}),setIcon:t=>Dc(e,IR,{icon:t})}),HD=(e,t)=>e.map(e=>({"aria-label":t.translate(e)})).getOr({}),UD=Pe("focus-button"),ZD=(e,t,o,n,r,i,s)=>{const a=t.map(e=>db(DR(e,"tox-tbtn",r))),l=e.map(e=>db(VR(e,r.icons)));return{dom:{tag:"button",classes:["tox-tbtn"].concat(t.isSome()?["tox-tbtn--select"]:[]),attributes:{...HD(o,r),...m(s)?{"data-mce-name":s}:{}}},components:EA([l.map(e=>e.asSpec()),a.map(e=>e.asSpec())]),eventOrder:{[ps()]:["focusing","alloy.base.behaviour",AR],[qs()]:[AR,"toolbar-group-button-events"],[Gs()]:[AR,"toolbar-group-button-events","tooltipping"]},buttonBehaviours:id([mA(()=>r.checkUiComponentContext(i).shouldDisable),kA(()=>r.checkUiComponentContext(i)),ud(AR,[Kc((e,t)=>BR(e)),Zc(PR,(e,t)=>{a.bind(t=>t.getOpt(e)).each(e=>{Qh.set(e,[Sm(r.translate(t.event.text))])})}),Zc(IR,(e,t)=>{l.bind(t=>t.getOpt(e)).each(e=>{Qh.set(e,[VR(t.event.icon,r.icons)])})}),Zc(ps(),(e,t)=>{t.event.prevent(),Vc(e,UD)})])].concat(n.getOr([])))}},$D=(e,t,o,n)=>{var r;const i=we(v),s=ZD(e.icon,e.text,e.tooltip,A.none(),o,e.context,n);return Tb.sketch({dom:s.dom,components:s.components,eventOrder:MR,buttonBehaviours:{...id([ud("toolbar-button-events",[(a={onAction:e.onAction,getApi:t.getApi},ed((e,t)=>{pA(a,e)(t=>{Dc(e,OR,{buttonApi:t}),a.onAction(t)})})),gA(t,i),fA(t,i)]),...e.tooltip.map(t=>ab.config(o.tooltips.getConfig({tooltipText:o.translate(t)+e.shortcut.map(e=>` (${BA(e)})`).getOr("")}))).toArray(),mA(()=>!e.enabled||o.checkUiComponentContext(e.context).shouldDisable),kA(()=>o.checkUiComponentContext(e.context))].concat(t.toolbarButtonBehaviours)),[AR]:null===(r=s.buttonBehaviours)||void 0===r?void 0:r[AR]}});var a},jD=(e,t,o,n)=>$D(e,{toolbarButtonBehaviours:o.length>0?[ud("toolbarButtonWith",o)]:[],getApi:FD,onSetup:e.onSetup},t,n),WD=(e,t,o,n)=>$D(e,{toolbarButtonBehaviours:[Qh.config({}),Yv.config({toggleClass:"tox-tbtn--enabled",aria:{mode:"pressed"},toggleOnExecute:!1})].concat(o.length>0?[ud("toolbarToggleButtonWith",o)]:[]),getApi:zD,onSetup:e.onSetup},t,n),qD=(e,t,o)=>n=>Se(e=>t.fetch(e)).map(r=>A.from(gB(Le(JM(Pe("menu-value"),r,o=>{t.onItemAction(e(n),o)},t.columns,t.presets,gS.CLOSE_ON_EXECUTE,t.select.getOr(E),o),{movement:eB(t.columns,t.presets),menuBehaviours:cA("auto"!==t.columns?[]:[Kc((e,o)=>{lA(e,4,ES(t.presets)).each(({numRows:t,numColumns:o})=>{_h.setGridSize(e,t,o)})})])})))),GD=e=>{Gy.getContent(e).each(e=>{Gn(e.element,".tox-toolbar-slider__input,.tox-toolbar-textfield").fold(()=>_h.focusIn(e),Vo)})},YD=Pe("forward-slide"),XD=Pe("backward-slide"),KD=Pe("change-slide-event"),JD="tox-pop--resizing",QD=(e,t,o)=>ot(o)?e.translate(t):e.translate([t,e.translate(o)]),eP=(e,t)=>{const o=(o,r,i,s)=>{const a=e.shared.providers.translate(o.title);if("separator"===o.type)return A.some({type:"separator",text:a});if("submenu"===o.type){const e=q(o.getStyleItems(),e=>n(e,r,s));return 0===r&&e.length<=0?A.none():A.some({type:"nestedmenuitem",text:a,enabled:e.length>0,getSubmenuItems:()=>q(o.getStyleItems(),e=>n(e,r,s))})}return A.some({type:"togglemenuitem",text:a,icon:o.icon,active:o.isSelected(s),enabled:!i,onAction:t.onAction(o),...o.getStylePreview().fold(()=>({}),e=>({meta:{style:e}}))})},n=(e,n,r)=>{const i="formatter"===e.type&&t.isInvalid(e);return 0===n?i?[]:o(e,n,!1,r).toArray():o(e,n,i,r).toArray()},r=e=>{const o=t.getCurrentValue(),r=t.shouldHide?0:1;return q(e,e=>n(e,r,o))};return{validateItems:r,getFetch:(e,t)=>(o,n)=>{const i=t(),s=r(i);n(ZR(s,gS.CLOSE_ON_EXECUTE,e,{isHorizontalMenu:!1,search:A.none()}))}}},tP=(e,t)=>{const o=t.dataset,n="basic"===o.type?()=>L(o.data,e=>eV(e,t.isSelectedFor,t.getPreviewFor)):o.getData;return{items:eP(e,t),getStyleItems:n}},oP=(e,t,o,n,r,i)=>{const{items:s,getStyleItems:a}=tP(t,o),l=we(o.tooltip);return FR({context:"mode:design",text:o.icon.isSome()?A.none():o.text,icon:o.icon,ariaLabel:A.some(o.tooltip),tooltip:A.none(),role:A.none(),fetch:s.getFetch(t,a),onSetup:t=>{const i=o=>t.setTooltip(QD(e,n(o.value),o.value));return e.on(r,i),bM(_M(e,"NodeChange",t=>{const n=t.getComponent();o.updateText(n),tp.set(t.getComponent(),!e.selection.isEditable()||0===a().length)})(t),()=>e.off(r,i))},getApi:e=>({getComponent:w(e),setTooltip:o=>{const n=t.shared.providers.translate(o);jo(e.element,"aria-label",n),l.set(o)}}),columns:1,presets:"normal",classes:o.icon.isSome()?[]:["bespoke"],dropdownBehaviours:[ab.config({...t.shared.providers.tooltips.getConfig({tooltipText:t.shared.providers.translate(o.tooltip),onShow:e=>{if(o.tooltip!==l.get()){const o=t.shared.providers.translate(l.get());ab.setComponents(e,t.shared.providers.tooltips.getComponents({tooltipText:o}))}}})})]},"tox-tbtn",t.shared,i)};var nP;!function(e){e[e.SemiColon=0]="SemiColon",e[e.Space=1]="Space"}(nP||(nP={}));const rP=(e,t,o)=>{const n=(r=((e,t)=>t===nP.SemiColon?e.replace(/;$/,"").split(";"):e.split(" "))(e.options.get(t),o),L(r,e=>{let t=e,o=e;const n=e.split("=");return n.length>1&&(t=n[0],o=n[1]),{title:t,format:o}}));var r;return{type:"basic",data:n}},iP=w("Alignment {0}"),sP="left",aP=[{title:"Left",icon:"align-left",format:"alignleft",command:"JustifyLeft"},{title:"Center",icon:"align-center",format:"aligncenter",command:"JustifyCenter"},{title:"Right",icon:"align-right",format:"alignright",command:"JustifyRight"},{title:"Justify",icon:"align-justify",format:"alignjustify",command:"JustifyFull"}],lP=e=>{const t={type:"basic",data:aP};return{tooltip:QD(e,iP(),sP),text:A.none(),icon:A.some("align-left"),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:e=>A.none,onAction:t=>()=>$(aP,e=>e.format===t.format).each(t=>e.execCommand(t.command)),updateText:t=>{const o=$(aP,t=>e.formatter.match(t.format)).fold(w(sP),e=>e.title.toLowerCase());Dc(t,IR,{icon:`align-${o}`}),((e,t)=>{e.dispatch("AlignTextUpdate",t)})(e,{value:o})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},cP=(e,t)=>{const o=t(),n=L(o,e=>e.format);return A.from(e.formatter.closest(n)).bind(e=>$(o,t=>t.format===e))},dP=w("Block {0}"),uP="Paragraph",hP=e=>{const t=rP(e,"block_formats",nP.SemiColon);return{tooltip:QD(e,dP(),uP),text:A.some(uP),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:xM(e),updateText:o=>{const n=cP(e,()=>t.data).fold(w(uP),e=>e.title);Dc(o,PR,{text:n}),((e,t)=>{e.dispatch("BlocksTextUpdate",t)})(e,{value:n})},dataset:t,shouldHide:!1,isInvalid:t=>!e.formatter.canApply(t.format)}},mP=w("Font {0}"),pP="System Font",gP=["-apple-system","Segoe UI","Roboto","Helvetica Neue","sans-serif"],fP=e=>{const t=e.split(/\s*,\s*/);return L(t,e=>e.replace(/^['"]+|['"]+$/g,""))},vP=(e,t)=>t.length>0&&G(t,t=>e.indexOf(t.toLowerCase())>-1),bP=e=>{const t=()=>{const t=e=>e?fP(e)[0]:"",n=e.queryCommandValue("FontName"),r=o.data,i=n?n.toLowerCase():"",s=MC(e),a=$(r,e=>{const o=e.format;return o.toLowerCase()===i||t(o).toLowerCase()===t(i).toLowerCase()}).orThunk(()=>$e(((e,t)=>{if(0===e.indexOf("-apple-system")||t.length>0){const o=fP(e.toLowerCase());return vP(o,gP)||vP(o,t)}return!1})(i,s),{title:pP,format:i}));return{matchOpt:a,font:n}},o=rP(e,"font_family_formats",nP.SemiColon);return{tooltip:QD(e,mP(),pP),text:A.some(pP),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getCurrentValue:()=>{const{matchOpt:e}=t();return e},getPreviewFor:e=>()=>A.some({tag:"div",styles:-1===e.indexOf("dings")?{"font-family":e}:{}}),onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontName",!1,t.format)})},updateText:o=>{const{matchOpt:n,font:r}=t(),i=n.fold(w(r),e=>e.title);Dc(o,PR,{text:i}),((e,t)=>{e.dispatch("FontFamilyTextUpdate",t)})(e,{value:i})},dataset:o,shouldHide:!1,isInvalid:E}};var yP=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.VK");const wP=w("Font size {0}"),_P="12pt",xP={"8pt":"1","10pt":"2","12pt":"3","14pt":"4","18pt":"5","24pt":"6","36pt":"7"},CP={"xx-small":"7pt","x-small":"8pt",small:"10pt",medium:"12pt",large:"14pt","x-large":"18pt","xx-large":"24pt"},kP=(e,t)=>/[0-9.]+px$/.test(e)?((e,t)=>{const o=Math.pow(10,t);return Math.round(e*o)/o})(72*parseInt(e,10)/96,t||0)+"pt":fe(CP,e).getOr(e),SP=e=>fe(xP,e).getOr(""),TP=e=>{const t=()=>{let t=A.none();const o=n.data,r=e.queryCommandValue("FontSize");if(r)for(let e=3;t.isNone()&&e>=0;e--){const n=kP(r,e),i=SP(n);t=$(o,e=>e.format===r||e.format===n||e.format===i)}return{matchOpt:t,size:r}},o=w(A.none),n=rP(e,"font_size_formats",nP.Space);return{tooltip:QD(e,wP(),_P),text:A.some(_P),icon:A.none(),isSelectedFor:e=>t=>t.exists(t=>t.format===e),getPreviewFor:o,getCurrentValue:()=>{const{matchOpt:e}=t();return e},onAction:t=>()=>{e.undoManager.transact(()=>{e.focus(),e.execCommand("FontSize",!1,t.format)})},updateText:o=>{const{matchOpt:n,size:r}=t(),i=n.fold(w(r),e=>e.title);Dc(o,PR,{text:i}),((e,t)=>{e.dispatch("FontSizeTextUpdate",t)})(e,{value:i})},dataset:n,shouldHide:!1,isInvalid:E}},EP=e=>ot(e)?"Formats":"Format {0}",OP=(e,t)=>{const o="Formats";return{tooltip:QD(e,EP(""),""),text:A.some(o),icon:A.none(),isSelectedFor:t=>()=>e.formatter.match(t),getCurrentValue:A.none,getPreviewFor:t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},onAction:xM(e),updateText:t=>{const n=e=>YN(e)?q(e.items,n):XN(e)?[{title:e.title,format:e.format}]:[],r=q(QN(e),n),i=cP(e,w(r)).fold(w({title:o,tooltipLabel:""}),e=>({title:e.title,tooltipLabel:e.title}));Dc(t,PR,{text:i.title}),((e,t)=>{e.dispatch("StylesTextUpdate",t)})(e,{value:i.tooltipLabel})},shouldHide:oC(e),isInvalid:t=>!e.formatter.canApply(t.format),dataset:t}},AP=[{name:"history",items:["undo","redo"]},{name:"ai",items:["aidialog","aishortcuts"]},{name:"styles",items:["styles"]},{name:"formatting",items:["bold","italic"]},{name:"alignment",items:["alignleft","aligncenter","alignright","alignjustify"]},{name:"indentation",items:["outdent","indent"]},{name:"permanent pen",items:["permanentpen"]},{name:"comments",items:["addcomment"]}],MP=(e,t)=>(o,n,r,i)=>{const s=e(o).mapError(e=>Ai(e)).getOrDie();return t(s,n,r,i)},BP={button:MP(yO,(e,t,o,n)=>((e,t,o)=>jD(e,t,[],o))(e,t.shared.providers,n)),togglebutton:MP(xO,(e,t,o,n)=>((e,t,o)=>WD(e,t,[],o))(e,t.shared.providers,n)),menubutton:MP(zE,(e,t,o,n)=>tN(e,"tox-tbtn",t,A.none(),!1,n)),splitbutton:MP(e=>Ti("SplitButton",oA,e),(e,t,o,n)=>((e,t,o)=>{const n=we(e.tooltip.getOr("")),r=e=>({isEnabled:()=>!tp.isDisabled(e),setEnabled:t=>tp.set(e,!t),setIconFill:(t,o)=>{Gn(e.element,`svg path[class="${t}"], rect[class="${t}"]`).each(e=>{jo(e,"fill",o)})},setActive:t=>{jo(e.element,"aria-pressed",t),Gn(e.element,"span").each(o=>{e.getSystem().getByDom(o).each(e=>Yv.set(e,t))})},isActive:()=>Gn(e.element,"span").exists(t=>e.getSystem().getByDom(t).exists(Yv.isOn)),setText:t=>Gn(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Dc(e,PR,{text:t}))),setIcon:t=>Gn(e.element,"span").each(o=>e.getSystem().getByDom(o).each(e=>Dc(e,IR,{icon:t}))),setTooltip:o=>{const r=t.providers.translate(o);jo(e.element,"aria-label",r),n.set(o)}}),i=we(v),s={getApi:r,onSetup:e.onSetup};return J_.sketch({dom:{tag:"div",classes:["tox-split-button"],attributes:{"aria-pressed":!1,...HD(e.tooltip,t.providers),...m(o)?{"data-mce-name":o}:{}}},onExecute:t=>{const o=r(t);o.isEnabled()&&e.onAction(o)},onItemExecute:(e,t,o)=>{},splitDropdownBehaviours:id([ud("split-dropdown-events",[Kc((e,t)=>BR(e)),Zc(UD,fd.focus),gA(s,i),fA(s,i)]),hA(()=>t.providers.isDisabled()||t.providers.checkUiComponentContext(e.context).shouldDisable),kA(()=>t.providers.checkUiComponentContext(e.context)),lb.config({}),...e.tooltip.map(e=>ab.config({...t.providers.tooltips.getConfig({tooltipText:t.providers.translate(e),onShow:o=>{if(n.get()!==e){const e=t.providers.translate(n.get());ab.setComponents(o,t.providers.tooltips.getComponents({tooltipText:e}))}}})})).toArray()]),eventOrder:{[qs()]:["alloy.base.behaviour","split-dropdown-events","tooltipping"],[Gs()]:["split-dropdown-events","tooltipping"]},toggleClass:"tox-tbtn--enabled",lazySink:t.getSink,fetch:qD(r,e,t.providers),parts:{menu:NS(0,e.columns,e.presets)},components:[J_.parts.button(ZD(e.icon,e.text,A.none(),A.some([Yv.config({toggleClass:"tox-tbtn--enabled",toggleOnExecute:!1}),mA(E),kA(w({contextType:"any",shouldDisable:!1}))]),t.providers,e.context)),J_.parts.arrow({dom:{tag:"button",classes:["tox-tbtn","tox-split-button__chevron"],innerHtml:aS("chevron-down",t.providers.icons)},buttonBehaviours:id([hA(E),kA(w({contextType:"any",shouldDisable:!1}))])}),J_.parts["aria-descriptor"]({text:t.providers.translate("To open the popup, press Shift+Enter")})]})})(e,t.shared,n)),grouptoolbarbutton:MP(e=>Ti("GroupToolbarButton",tA,e),(e,t,o,n)=>{const r=o.ui.registry.getAll().buttons,i={[Ec]:t.shared.header.isPositionedAtTop()?Tc.TopToBottom:Tc.BottomToTop};if(iC(o)===Px.floating)return((e,t,o,n,r)=>{const i=t.shared,s=we(v),a={toolbarButtonBehaviours:[],getApi:FD,onSetup:e.onSetup},l=[ud("toolbar-group-button-events",[gA(a,s),fA(a,s)]),...e.tooltip.map(e=>ab.config(t.shared.providers.tooltips.getConfig({tooltipText:t.shared.providers.translate(e)}))).toArray()];return Fy.sketch({lazySink:i.getSink,fetch:()=>Se(t=>{t(L(o(e.items),eD))}),markers:{toggledClass:"tox-tbtn--enabled"},parts:{button:ZD(e.icon,e.text,e.tooltip,A.some(l),i.providers,e.context,r),toolbar:{dom:{tag:"div",classes:["tox-toolbar__overflow"],attributes:n}}}})})(e,t,e=>NP(o,{buttons:r,toolbar:e,allowToolbarGroups:!1},t,A.none()),i,n);throw new Error("Toolbar groups are only supported when using floating toolbar mode")})},RP={styles:(e,t)=>{const o={type:"advanced",...t.styles};return oP(e,t,OP(e,o),EP,"StylesTextUpdate","styles")},fontsize:(e,t)=>oP(e,t,TP(e),wP,"FontSizeTextUpdate","fontsize"),fontsizeinput:(e,t)=>((e,t,o,n)=>{let r=A.none();const i=_M(e,"NodeChange SwitchMode DisabledStateChange",t=>{const n=t.getComponent();r=A.some(n),o.updateInputValue(n),tp.set(n,!e.selection.isEditable()||qx(e))}),s=e=>({getComponent:w(e)}),a=we(v),l=Pe("custom-number-input-events"),c=(e,t,n)=>{const i=r.map(e=>Yg.getValue(e)).getOr(""),s=o.getNewValue(i,e),a=i.length-`${s}`.length,l=r.map(e=>e.element.dom.selectionStart-a),c=r.map(e=>e.element.dom.selectionEnd-a);o.onAction(s,n),r.each(e=>{Yg.setValue(e,s),t&&(l.each(t=>e.element.dom.selectionStart=t),c.each(t=>e.element.dom.selectionEnd=t))})},d=(e,t)=>c((e,t)=>e-t,e,t),u=(e,t)=>c((e,t)=>e+t,e,t),h=e=>po(e.element).fold(A.none,e=>(Vo(e),A.some(!0))),p=e=>Po(e.element)?(bo(e.element).each(e=>Vo(e)),A.some(!0)):A.none(),g=(o,n,r,i)=>{const a=we(v),l=t.shared.providers.translate(r),c=Pe("altExecuting"),d=_M(e,"NodeChange SwitchMode DisabledStateChange",t=>{tp.set(t.getComponent(),!e.selection.isEditable()||qx(e))}),u=e=>{tp.isDisabled(e)||o(!0)};return Tb.sketch({dom:{tag:"button",attributes:{"aria-label":l,"data-mce-name":n},classes:i.concat(n)},components:[NR(n,t.shared.providers.icons)],buttonBehaviours:id([tp.config({}),ab.config(t.shared.providers.tooltips.getConfig({tooltipText:l})),ud(c,[gA({onSetup:d,getApi:s},a),fA({getApi:s},a),Zc(_s(),(e,t)=>{t.event.raw.keyCode!==yP.SPACEBAR&&t.event.raw.keyCode!==yP.ENTER||tp.isDisabled(e)||o(!1)}),Zc(Ss(),u),Zc(hs(),u)])]),eventOrder:{[_s()]:[c,"keying"],[Ss()]:[c,"alloy.base.behaviour"],[hs()]:[c,"alloy.base.behaviour"],[qs()]:["alloy.base.behaviour",c,"tooltipping"],[Gs()]:[c,"tooltipping"]}})},f=db(g(e=>d(!1,e),"minus","Decrease font size",[])),b=db(g(e=>u(!1,e),"plus","Increase font size",[])),y=db({dom:{tag:"div",classes:["tox-input-wrapper"]},components:[Qy.sketch({inputBehaviours:id([tp.config({}),ud(l,[gA({onSetup:i,getApi:s},a),fA({getApi:s},a)]),ud("input-update-display-text",[Zc(PR,(e,t)=>{Yg.setValue(e,t.event.text)}),Zc(ws(),e=>{o.onAction(Yg.getValue(e))}),Zc(ks(),e=>{o.onAction(Yg.getValue(e))})]),_h.config({mode:"special",onEnter:e=>(c(_,!0,!0),A.some(!0)),onEscape:h,onUp:e=>(u(!0,!1),A.some(!0)),onDown:e=>(d(!0,!1),A.some(!0)),onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())})])})],behaviours:id([fd.config({}),_h.config({mode:"special",onEnter:p,onSpace:p,onEscape:h}),ud("input-wrapper-events",[Zc(bs(),e=>{F([f,b],t=>{const o=ct(t.get(e).element.dom);Po(o)&&Do(o)})})])])});return{dom:{tag:"div",classes:["tox-number-input"],attributes:{...m(n)?{"data-mce-name":n}:{}}},components:[f.asSpec(),y.asSpec(),b.asSpec()],behaviours:id([fd.config({}),_h.config({mode:"flow",focusInside:Oa.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-input-wrapper",onEscape:e=>Po(e.element)?A.none():(Vo(e.element),A.some(!0))})])}})(e,t,(e=>{const t=()=>e.queryCommandValue("FontSize");return{updateInputValue:e=>Dc(e,PR,{text:t()}),onAction:(t,o)=>e.execCommand("FontSize",!1,t,{skip_focus:!o}),getNewValue:(o,n)=>{Or(o,["unsupportedLength","empty"]);const r=t(),i=Or(o,["unsupportedLength","empty"]).or(Or(r,["unsupportedLength","empty"])),s=i.map(e=>e.value).getOr(16),a=fC(e),l=i.map(e=>e.unit).filter(e=>""!==e).getOr(a),c=n(s,(e=>{var t;return null!==(t={em:{step:.1},cm:{step:.1},in:{step:.1},pc:{step:.1},ch:{step:.1},rem:{step:.1}}[e])&&void 0!==t?t:{step:1}})(l).step),d=`${(e=>e>=0)(c)?c:s}${l}`;return d!==r&&((e,t)=>{e.dispatch("FontSizeInputTextUpdate",t)})(e,{value:d}),d}}})(e),"fontsizeinput"),fontfamily:(e,t)=>oP(e,t,bP(e),mP,"FontFamilyTextUpdate","fontfamily"),blocks:(e,t)=>oP(e,t,hP(e),dP,"BlocksTextUpdate","blocks"),align:(e,t)=>oP(e,t,lP(e),iP,"AlignTextUpdate","align"),navigateback:(e,t)=>{const o=Ei(yO({type:"button",icon:"chevron-left",tooltip:"Back",onAction:v}));return jD(o,t.shared.providers,[Zc(OR,e=>{Vc(e,XD)})])}},NP=(e,t,o,n)=>{const r=(e=>{const t=e.toolbar,o=e.buttons;return!1===t?[]:void 0===t||!0===t?(e=>{const t=L(AP,t=>{const o=H(t.items,t=>ve(e,t)||ve(RP,t));return{name:t.name,items:o}});return H(t,e=>e.items.length>0)})(o):i(t)?(e=>{const t=e.split("|");return L(t,e=>({items:e.trim().split(" ")}))})(t):(e=>f(e,e=>(ve(e,"name")||ve(e,"label"))&&ve(e,"items")))(t)?t:(console.error("Toolbar type should be string, string[], boolean or ToolbarGroup[]"),[])})(t),s=L(r,r=>{const i=q(r.items,r=>0===r.trim().length?[]:((e,t,o,n,r,i)=>fe(t,o.toLowerCase()).orThunk(()=>i.bind(e=>re(e,e=>fe(t,e+o.toLowerCase())))).fold(()=>fe(RP,o.toLowerCase()).map(t=>t(e,r)),t=>"grouptoolbarbutton"!==t.type||n?((e,t,o,n)=>fe(BP,e.type).fold(()=>(console.error("skipping button defined by",e),A.none()),r=>A.some(r(e,t,o,n))))(t,r,e,o.toLowerCase()):(console.warn(`Ignoring the '${o}' toolbar button. Group toolbar buttons are only supported when using floating toolbar mode and cannot be nested.`),A.none())))(e,t.buttons,r,t.allowToolbarGroups,o,n).toArray());return{title:A.from(e.translate(r.name)),label:$e(void 0!==r.label,e.translate(r.label)),items:i}});return H(s,e=>e.items.length>0)},VP=(e,t,o,n)=>{const r=t.mainUi.outerContainer,s=o.toolbar,a=o.buttons;if(f(s,i)){const t=s.map(t=>{const r={toolbar:t,buttons:a,allowToolbarGroups:o.allowToolbarGroups};return NP(e,r,n,A.none())});TD.setToolbars(r,t)}else TD.setToolbar(r,NP(e,o,n,A.none()))},DP=Kt(),PP=DP.os.isiOS()&&DP.os.version.major<=12;var IP=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:i,uiMotherships:s}=t,a=we(0),l=i.outerContainer;ID(e);const d=ct(r.targetNode),u=Co(xo(d));Lh(d,i.mothership),((e,t,o)=>{jC(e)&&Lh(o.mainUi.mothership.element,o.popupUi.mothership),Ih(t,o.dialogUi.mothership)})(e,u,t),e.on("PostRender",()=>{TD.setSidebar(l,o.sidebar,EC(e))}),e.on("SkinLoaded",()=>{VP(e,t,o,n),a.set(e.getWin().innerWidth),TD.setMenubar(l,AD(e,o)),TD.setViews(l,o.views),((e,t)=>{const{uiMotherships:o}=t,n=e.dom;let r=e.getWin();const i=e.getDoc().documentElement,s=we(Bn(r.innerWidth,r.innerHeight)),a=we(Bn(i.offsetWidth,i.offsetHeight)),l=()=>{const t=s.get();t.left===r.innerWidth&&t.top===r.innerHeight||(s.set(Bn(r.innerWidth,r.innerHeight)),pM(e))},c=()=>{const t=e.getDoc().documentElement,o=a.get();o.left===t.offsetWidth&&o.top===t.offsetHeight||(a.set(Bn(t.offsetWidth,t.offsetHeight)),pM(e))},d=t=>{((e,t)=>{e.dispatch("ScrollContent",t)})(e,t)};n.bind(r,"resize",l),n.bind(r,"scroll",d);const u=Bo(ct(e.getBody()),"load",c);e.on("hide",()=>{F(o,e=>{dn(e.element,"display","none")})}),e.on("show",()=>{F(o,e=>{bn(e.element,"display")})}),e.on("NodeChange",c),e.on("remove",()=>{u.unbind(),n.unbind(r,"resize",l),n.unbind(r,"scroll",d),r=null})})(e,t)});const h=TD.getSocket(l).getOrDie("Could not find expected socket element");if(PP){un(h.element,{overflow:"scroll","-webkit-overflow-scrolling":"touch"});const t=(e=>{let t=null;return{cancel:()=>{c(t)||(clearTimeout(t),t=null)},throttle:(...o)=>{c(t)&&(t=setTimeout(()=>{t=null,e.apply(null,o)},20))}}})(()=>{e.dispatch("ScrollContent")}),o=Mo(h.element,"scroll",t.throttle);e.on("remove",o.unbind)}CA(e,t),e.addCommand("ToggleSidebar",(t,o)=>{TD.toggleSidebar(l,o),(e=>{e.dispatch("ToggleSidebar")})(e)}),e.addQueryValueHandler("ToggleSidebar",()=>{var e;return null!==(e=TD.whichSidebar(l))&&void 0!==e?e:""}),e.addCommand("ToggleView",(t,o)=>{if(TD.toggleView(l,o)){const t=l.element;i.mothership.broadcastOn([mb()],{target:t}),F(s,e=>{e.broadcastOn([mb()],{target:t})}),c(TD.whichView(l))&&(e.focus(),e.nodeChanged(),TD.refreshToolbar(l)),(e=>{e.dispatch("ToggleView")})(e)}}),e.addQueryValueHandler("ToggleView",()=>{var e;return null!==(e=TD.whichView(l))&&void 0!==e?e:""});const m=iC(e);m!==Px.sliding&&m!==Px.floating||e.on("ResizeWindow ResizeEditor ResizeContent",()=>{const o=e.getWin().innerWidth;o!==a.get()&&(TD.refreshToolbar(t.mainUi.outerContainer),a.set(o))});const p={setEnabled:e=>{xA(t,e?"setEnabled":"setDisabled")},isEnabled:()=>!tp.isDisabled(l)};return{iframeContainer:h.element.dom,editorContainer:l.element.dom,api:p}}});const LP=e=>g(e)?e+"px":e,FP=(e,t,o)=>{const n=t.filter(t=>e<t),r=o.filter(t=>e>t);return n.or(r).getOr(e)},zP=e=>{const t=Yx(e),o=Xx(e),n=Jx(e);return(r=t,/^[0-9\.]+(|px)$/i.test(""+r)?A.some(parseInt(""+r,10)):A.none()).map(e=>FP(e,o,n));var r},{ToolbarLocation:HP,ToolbarMode:UP}=qC,ZP=(e,t,o,n,r)=>{const{mainUi:i,uiMotherships:s}=o,a=zx.DOM,l=HC(e),c=$C(e),d=Jx(e).or(zP(e)),u=n.shared.header,h=u.isPositionedAtTop,m=iC(e),p=m===UP.sliding||m===UP.floating,g=we(!1),f=()=>g.get()&&!e.removed,v=e=>p?e.fold(w(0),e=>e.components().length>1?xn(e.components()[1].element):0):0,b=()=>{F(s,e=>{e.broadcastOn([pb()],{})})},y=o=>{if(!f())return;l||r.on(e=>{const o=d.getOrThunk(()=>Mr().width-Vn(t).left-10);dn(e.element,"max-width",o+"px")});const n=Dn(),s=!(l||l||!(Nn(i.outerContainer.element).left+On(i.outerContainer.element)>=window.innerWidth-40||gn(i.outerContainer.element,"width").isSome())||(dn(i.outerContainer.element,"position","absolute"),dn(i.outerContainer.element,"left","0px"),bn(i.outerContainer.element,"width"),0));if(p&&TD.refreshToolbar(i.outerContainer),!l){const o=Dn(),a=$e(n.left!==o.left,n);((o,n)=>{r.on(r=>{const s=TD.getToolbar(i.outerContainer),a=v(s),l=Dr(t),c=((e,t)=>jC(e)?zr(t):A.none())(e,i.outerContainer.element),d=c.fold(()=>l.x,e=>{const t=Dr(e);return wt(e,sn())?l.x:l.x-t.x}),u=$e(o,Math.ceil(i.outerContainer.element.dom.getBoundingClientRect().width)).filter(e=>e>150).map(e=>{const t=n.getOr(Dn()),o=window.innerWidth-(d-t.left),r=Math.max(Math.min(e,o),150);return o<e&&dn(i.outerContainer.element,"width",r+"px"),{width:r+"px"}}).getOr({width:"max-content"}),m={position:"absolute",left:Math.round(d)+"px",top:c.fold(()=>h()?Math.max(l.y-xn(r.element)+a,0):l.bottom,e=>{var t;const o=Dr(e),n=null!==(t=e.dom.scrollTop)&&void 0!==t?t:0,i=wt(e,sn())?Math.max(l.y-xn(r.element)+a,0):l.y-o.y+n-xn(r.element)+a;return h()?i:l.bottom})+"px"};un(i.outerContainer.element,{...m,...u})})})(s,a),a.each(e=>{Pn(e.left,o.top)})}c&&r.on(o),b()},_=()=>!(l||!c||!f())&&r.get().exists(o=>{const n=u.getDockingMode(),s=(o=>{switch(aC(e)){case HP.auto:const e=TD.getToolbar(i.outerContainer),n=v(e),r=xn(o.element)-n,s=Dr(t);if(s.y>r)return"top";{const e=uo(t),o=Math.max(e.dom.scrollHeight,xn(e));return s.bottom<o-r||Lr().bottom<s.bottom-r?"bottom":"top"}case HP.bottom:return"bottom";case HP.top:default:return"top"}})(o);return s!==n&&(a=s,r.on(e=>{Op.setModes(e,[a]),u.setDockingMode(a);const t=h()?Tc.TopToBottom:Tc.BottomToTop;jo(e.element,Ec,t)}),!0);var a});return{isVisible:f,isPositionedAtTop:h,show:()=>{g.set(!0),dn(i.outerContainer.element,"display","flex"),a.addClass(e.getBody(),"mce-edit-focus"),F(s,e=>{bn(e.element,"display")}),_(),jC(e)?y(e=>Op.isDocked(e)?Op.reset(e):Op.refresh(e)):y(Op.refresh)},hide:()=>{g.set(!1),dn(i.outerContainer.element,"display","none"),a.removeClass(e.getBody(),"mce-edit-focus"),F(s,e=>{dn(e.element,"display","none")})},update:y,updateMode:()=>{_()&&y(Op.reset)},repositionPopups:b}},$P=(e,t)=>{const o=Dr(e);return{pos:t?o.y:o.bottom,bounds:o}};var jP=Object.freeze({__proto__:null,render:(e,t,o,n,r)=>{const{mainUi:i}=t,s=Ge(),a=ct(r.targetNode),l=ZP(e,a,t,n,s),c=dC(e);LD(e);const d=()=>{if(s.isSet())return void l.show();s.set(TD.getHeader(i.outerContainer).getOrDie());const r=UC(e);jC(e)?(Lh(a,i.mothership),Lh(a,t.popupUi.mothership)):Ih(r,i.mothership),Ih(r,t.dialogUi.mothership);const d=()=>{VP(e,t,o,n),TD.setMenubar(i.outerContainer,AD(e,o)),l.show(),((e,t,o,n)=>{const r=we($P(t,o.isPositionedAtTop())),i=n=>{const{pos:i,bounds:s}=$P(t,o.isPositionedAtTop()),{pos:a,bounds:l}=r.get(),c=s.height!==l.height||s.width!==l.width;r.set({pos:i,bounds:s}),c&&pM(e,n),o.isVisible()&&(a!==i?o.update(Op.reset):c&&(o.updateMode(),o.repositionPopups()))};n||(e.on("activate",o.show),e.on("deactivate",o.hide)),e.on("SkinLoaded ResizeWindow",()=>o.update(Op.reset)),e.on("NodeChange keydown",e=>{requestAnimationFrame(()=>i(e))});let s=0;const a=nt(()=>o.update(Op.refresh),33);e.on("ScrollWindow",()=>{const e=Dn().left;e!==s&&(s=e,a.throttle()),o.updateMode()}),jC(e)&&e.on("ElementScroll",e=>{o.update(Op.refresh)});const l=qe();l.set(Bo(ct(e.getBody()),"load",e=>i(e.raw))),e.on("remove",()=>{l.clear()})})(e,a,l,c),e.nodeChanged()};c?e.once("SkinLoaded",d):d()};e.on("show",d),e.on("hide",l.hide),c||(e.on("focus",d),e.on("blur",l.hide)),e.on("init",()=>{(e.hasFocus()||c)&&d()}),CA(e,t);const u={show:d,hide:l.hide,setEnabled:e=>{xA(t,e?"setEnabled":"setDisabled")},isEnabled:()=>!tp.isDisabled(i.outerContainer)};return{editorContainer:i.outerContainer.element.dom,api:u}}});const WP="contexttoolbar-hide",qP=(e,t,o)=>({setInputEnabled:t=>{!t&&o&&Vo(o),tp.set(e,!t)},isInputEnabled:()=>!tp.isDisabled(e),hide:()=>{Vc(e,zs())},back:()=>{Vc(e,XD)},getValue:()=>t.get().getOrThunk(()=>Yg.getValue(e)),setValue:o=>{e.getSystem().isConnected()?Yg.setValue(e,o):t.set(o)}}),GP=(e,t,o)=>Zc(OR,(n,r)=>{const i=e.get(n),s=qP(i,o,n.element);t.onAction(s,r.event.buttonApi)}),YP=(e,t,o,n)=>{const r=L(t,t=>db(((e,t,o,n)=>(e=>"contextformtogglebutton"===e.type)(t)?((e,t,o,n)=>{const{primary:r,...i}=t.original,s=Ei(xO({...i,type:"togglebutton",onAction:v}));return WD(s,o,[GP(e,t,n)])})(e,t,o,n):((e,t,o,n)=>{const{primary:r,...i}=t.original,s=Ei(yO({...i,type:"button",onAction:v}));return jD(s,o,[GP(e,t,n)])})(e,t,o,n))(e,t,o,n)));return{asSpecs:()=>L(r,e=>e.asSpec()),findPrimary:e=>re(t,(t,o)=>t.primary?A.from(r[o]).bind(t=>t.getOpt(e)).filter(k(tp.isDisabled)):A.none())}},XP=(e,t,o,n)=>{const{width:r,height:i}=e.initValue();let s=KR;const a=Pe("ratio-event"),l=e=>qP(e,n),c=e=>dS(e,{tag:"span",classes:["tox-icon","tox-lock-icon__"+e]},t.icons),d=()=>!1,u=e.label.getOr("Constrain proportions"),h=t.translate(u),m=Wy.parts.lock({dom:{tag:"button",classes:["tox-lock","tox-lock-context-form-size-input","tox-button","tox-button--naked","tox-button--icon"],attributes:{"aria-label":h,"data-mce-name":u}},components:[c("lock"),c("unlock")],buttonBehaviours:id([tp.config({disabled:d}),Hv.config({}),ab.config(t.tooltips.getConfig({tooltipText:h}))])}),p=e=>({dom:{tag:"div",classes:["tox-context-form__group"]},components:e}),g=e=>jn(e.element,"div.tox-focusable-wrapper").fold(A.none,e=>(Vo(e),A.some(!0))),f=e=>Uy.parts.field({factory:Qy,inputClasses:["tox-textfield","tox-toolbar-textfield","tox-textfield-size"],data:e?r:i,inputBehaviours:id([tp.config({disabled:d}),Hv.config({}),ud("size-input-toolbar-events",[Zc(ys(),(t,o)=>{Dc(t,a,{isField1:e})})]),_h.config({mode:"special",onEnter:o,onEscape:g})]),selectOnFocus:!1}),b=e=>({dom:{tag:"label",classes:["tox-label"]},components:[Sm(t.translate(e))]}),y=e=>({dom:{tag:"div",classes:["tox-focusable-wrapper","tox-toolbar-nav-item"]},components:[e],behaviours:id([Hv.config({}),fd.config({}),_h.config({mode:"special",onEnter:e=>Gn(e.element,"input").fold(A.none,e=>(Vo(e),A.some(!0)))})])}),w=y(Wy.parts.field1(p([Uy.parts.label(b("Width:")),f(!0)]))),_=y(Wy.parts.field2(p([Uy.parts.label(b("Height:")),f(!1)]))),x=we(v),C=[gA({onBeforeSetup:e=>Gn(e.element,"input").each(Vo),onSetup:e.onSetup,getApi:l},x),vA({getApi:l},x,n)];return Wy.sketch({dom:{tag:"div",classes:["tox-context-form__group"]},components:[w,p([m]),_],field1Name:"width",field2Name:"height",locked:!0,markers:{lockClass:"tox-locked"},onLockedChange:(e,t,o)=>{YR(Yg.getValue(e)).each(e=>{s(e).each(e=>{Yg.setValue(t,GR(e))})})},onInput:e=>Vc(e,kB),coupledFieldBehaviours:id([fd.config({}),_h.config({mode:"flow",focusInside:Oa.OnEnterOrSpaceMode,cycles:!1,selector:"button, .tox-focusable-wrapper"}),tp.config({disabled:d,onDisabled:e=>{Wy.getField1(e).bind(Uy.getField).each(tp.disable),Wy.getField2(e).bind(Uy.getField).each(tp.disable),Wy.getLock(e).each(tp.disable)},onEnabled:e=>{Wy.getField1(e).bind(Uy.getField).each(tp.enable),Wy.getField2(e).bind(Uy.getField).each(tp.enable),Wy.getLock(e).each(tp.enable)}}),kA(()=>t.checkUiComponentContext("mode:design")),ud("size-input-toolbar-events2",[Zc(a,(e,t)=>{const o=t.event.isField1,n=o?Wy.getField1(e):Wy.getField2(e),r=o?Wy.getField2(e):Wy.getField1(e),i=n.map(Yg.getValue).getOr(""),a=r.map(Yg.getValue).getOr("");s=JR(i,a)}),Zc(kB,t=>e.onInput(l(t))),...C])])})},KP=(e,t,o)=>Uy.sketch({dom:{tag:"div",classes:["tox-context-form__group"]},components:[...e.toArray(),t],fieldBehaviours:id([tp.config({disabled:()=>o.checkUiComponentContext("mode:design").shouldDisable,onDisabled:e=>{(e=>{Lo(e.element).each(e=>{jn(e,'[tabindex="-1"]').each(e=>{Vo(e)})})})(e),Uy.getField(e).each(tp.disable)},onEnabled:e=>{Uy.getField(e).each(tp.enable)}})])}),JP=(e,t,o,n)=>{const r=we(v),i=e=>qP(e,n),s=e.label.map(e=>Uy.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Sm(t.translate(e))]})),a=Uy.parts.field({factory:Qy,type:"range",inputClasses:["tox-toolbar-slider__input","tox-toolbar-nav-item"],inputAttributes:{min:String(e.min()),max:String(e.max())},data:e.initValue().toString(),fromInputValue:t=>(e=>{const t=parseFloat(e);return isNaN(t)?A.none():A.some(t)})(t).getOr(e.min()),toInputValue:e=>String(e),inputBehaviours:id([tp.config({disabled:()=>t.checkUiComponentContext("mode:design").shouldDisable}),kA(()=>t.checkUiComponentContext("mode:design")),_h.config({mode:"special",onEnter:o,onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())}),ud("slider-events",[gA({onSetup:e.onSetup,getApi:i,onBeforeSetup:_h.focusIn},r),vA({getApi:i},r,n),Zc(Cs(),t=>{e.onInput(i(t))})])])});return KP(s,a,t)},QP=(e,t,o,n)=>{const r=we(v),i=e=>qP(e,n),s=e.label.map(e=>Uy.parts.label({dom:{tag:"label",classes:["tox-label"]},components:[Sm(t.translate(e))]})),a={...e.placeholder.map(e=>({placeholder:t.translate(e)})).getOr({})},l=Uy.parts.field({factory:Qy,inputClasses:["tox-toolbar-textfield","tox-toolbar-nav-item"],inputAttributes:a,data:e.initValue(),selectOnFocus:!0,inputBehaviours:id([tp.config({disabled:()=>t.checkUiComponentContext("mode:design").shouldDisable}),kA(()=>t.checkUiComponentContext("mode:design")),_h.config({mode:"special",onEnter:o,onLeft:(e,t)=>(t.cut(),A.none()),onRight:(e,t)=>(t.cut(),A.none())}),ud("input-events",[gA({onSetup:e.onSetup,getApi:e=>jn(e.element,".tox-toolbar").bind(e=>Gn(e,"button:enabled")).fold(()=>qP(e,n),t=>qP(e,n,t)),onBeforeSetup:_h.focusIn},r),vA({getApi:i},r,n),Zc(Cs(),t=>{e.onInput(i(t))})])])});return KP(s,l,t)},eI=(e,t,o)=>{const n=Ge(),r=db(e(o,e=>s.findPrimary(e).orThunk(()=>a.findPrimary(e)).map(e=>(Pc(e),!0)),n)),i=z(t.commands,e=>"start"===e.align),s=YP(r,i.pass,o,n),a=YP(r,i.fail,o,n);return H([{title:A.none(),label:A.none(),items:s.asSpecs()},{title:A.none(),label:A.none(),items:[r.asSpec()]},{title:A.none(),label:A.none(),items:a.asSpecs()}],e=>e.items.length>0)},tI=(e,t)=>{switch(e.type){case"contextform":return eI(C(QP,e),e,t);case"contextsliderform":return eI(C(JP,e),e,t);case"contextsizeinputform":return eI(C(XP,e),e,t)}},oI=(e,t,o)=>t.bottom-e.y>=o&&e.bottom-t.y>=o,nI=e=>{const t=(e=>{const t=e.getBoundingClientRect();if(t.height<=0&&t.width<=0){const o=wo(ct(e.startContainer),e.startOffset).element;return(ro(o)?mo(o):A.some(o)).filter(no).map(e=>e.dom.getBoundingClientRect()).getOr(t)}return t})(e.selection.getRng());if(e.inline){const e=Dn();return Vr(e.left+t.left,e.top+t.top,t.width,t.height)}{const o=Pr(ct(e.getBody()));return Vr(o.x+t.left,o.y+t.top,t.width,t.height)}},rI=(e,t,o,n=0)=>{const r=Mr(window),i=Dr(ct(e.getContentAreaContainer())),s=NC(e)||PC(e)||LC(e),{x:a,width:l}=((e,t,o)=>{const n=Math.max(e.x+o,t.x);return{x:n,width:Math.min(e.right-o,t.right)-n}})(i,r,n);if(e.inline&&!s)return Vr(a,r.y,l,r.height);{const s=t.header.isPositionedAtTop(),{y:c,bottom:d}=((e,t,o,n,r,i)=>{const s=ct(e.getContainer()),a=Gn(s,".tox-editor-header").getOr(s),l=Dr(a),c=l.y>=t.bottom,d=n&&!c;if(e.inline&&d)return{y:Math.max(l.bottom+i,o.y),bottom:o.bottom};if(e.inline&&!d)return{y:o.y,bottom:Math.min(l.y-i,o.bottom)};const u="line"===r?Dr(s):t;return d?{y:Math.max(l.bottom+i,o.y),bottom:Math.min(u.bottom-i,o.bottom)}:{y:Math.max(u.y+i,o.y),bottom:Math.min(l.y-i,o.bottom)}})(e,i,r,s,o,n);return Vr(a,c,l,d-c)}},iI={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"],inset:["tox-pop--inset"]},sI={maxHeightFunction:kc(),maxWidthFunction:Sc()},aI=e=>"node"===e,lI=(e,t,o,n,r)=>{const i=nI(e),s=n.lastElement().exists(e=>wt(o,e));return((e,t)=>{const o=e.selection.getRng(),n=wo(ct(o.startContainer),o.startOffset);return o.startContainer===o.endContainer&&o.startOffset===o.endOffset-1&&wt(n.element,t)})(e,o)?s?yc:pc:s?((e,o)=>{const r=gn(e,"position");dn(e,"position",o);const s=oI(i,Dr(t),-20)&&!n.isReposition()?_c:yc;return r.each(t=>dn(e,"position",t)),s})(t,n.getMode()):("fixed"===n.getMode()?r.y+Dn().top:r.y)+(xn(t)+12)<=i.y?pc:gc},cI=(e,t,o,n)=>{const r=t=>(n,r,i,s,a)=>({...lI(e,s,t,o,a)({...n,y:a.y,height:a.height},r,i,s,a),alwaysFit:!0}),i=e=>aI(n)?[r(e)]:[];return t?{onLtr:e=>[Wl,Hl,Ul,Zl,$l,jl].concat(i(e)),onRtl:e=>[Wl,Ul,Hl,$l,Zl,jl].concat(i(e))}:{onLtr:e=>[jl,Wl,Zl,Hl,$l,Ul].concat(i(e)),onRtl:e=>[jl,Wl,$l,Ul,Zl,Hl].concat(i(e))}},dI=(e,t)=>{const o=H(t,t=>t.predicate(e.dom)),{pass:n,fail:r}=z(o,e=>"contexttoolbar"===e.type);return{contextToolbars:n,contextForms:r}},uI=(e,t)=>{const o={},n=[],r=[],i={},s={},a=ie(e);return F(a,a=>{const l=e[a];"contextform"===l.type||"contextsliderform"===l.type||"contextsizeinputform"===l.type?((e,a)=>{const l=Ei(Ti("ContextForm",RO,a));o[e]=l,l.launch.map(o=>{i["form:"+e]={...a.launch,type:"contextformtogglebutton"===o.type?"togglebutton":"button",onAction:()=>{t(l)}}}),"editor"===l.scope?r.push(l):n.push(l),s[e]=l})(a,l):"contexttoolbar"===l.type&&((e,o)=>{var a;(a=o,Ti("ContextToolbar",VO,a)).each(a=>{a.launch.isSome()&&(i["toolbar:"+e]={...o.launch,type:"button",onAction:()=>{t(a)}}),"editor"===o.scope?r.push(a):n.push(a),s[e]=a})})(a,l)}),{forms:o,inNodeScope:n,inEditorScope:r,lookupTable:s,formNavigators:i}},hI="tox-pop--transition",mI=(e,t,o,n)=>{const r=n.backstage,s=r.shared,a=Kt().deviceType.isTouch,l=Ge(),c=Ge(),d=Ge(),u=(e=>{const t=we([]),o=Gy.sketch({dom:{tag:"div",classes:["tox-pop"]},fireDismissalEventInstead:{event:"doNotDismissYet"},onShow:e=>{t.set([]),Gy.getContent(e).each(e=>{bn(e.element,"visibility")}),rr(e.element,JD),bn(e.element,"width")},onHide:()=>{t.set([]),e.onHide()},inlineBehaviours:id([ud("context-toolbar-events",[Xc(Es(),(e,t)=>{"width"===t.event.raw.propertyName&&(rr(e.element,JD),bn(e.element,"width"))}),Zc(KD,(e,t)=>{const o=e.element;bn(o,"width");const n=En(o),r=Lo(e.element).isSome();bn(o,"left"),bn(o,"right"),bn(o,"max-width"),Gy.setContent(e,t.event.contents),or(o,JD);const i=En(o);dn(o,"transition","none"),Gy.reposition(e),bn(o,"transition"),dn(o,"width",n+"px"),t.event.focus.fold(()=>{r&&GD(e)},t=>{Io(xo(e.element)).fold(()=>Vo(t),e=>{wt(e,t)||Vo(t)})}),setTimeout(()=>{dn(e.element,"width",i+"px")},0)}),Zc(YD,(e,o)=>{Gy.getContent(e).each(o=>{t.set(t.get().concat([{bar:o,focus:Io(xo(e.element))}]))}),Dc(e,KD,{contents:o.event.forwardContents,focus:A.none()})}),Zc(XD,(o,n)=>{e.onBack(),oe(t.get()).each(e=>{t.set(t.get().slice(0,t.get().length-1)),Dc(o,KD,{contents:Mm(e.bar),focus:e.focus})})})]),_h.config({mode:"special",onEscape:o=>oe(t.get()).fold(()=>e.onEscape(),e=>(Vc(o,XD),A.some(!0)))})]),lazySink:()=>Ae.value(e.sink)});return{sketch:o,inSubtoolbar:()=>t.get().length>0}})({sink:o,onEscape:()=>(e.focus(),vM(e),A.some(!0)),onHide:()=>{vM(e)},onBack:()=>{(e=>{e.dispatch("ContextFormSlideBack")})(e)}}),h=Am(u.sketch),m=()=>{const t=d.get().getOr("node"),o=aI(t)?1:0;return rI(e,s,t,o)},p=()=>!(e.removed||a()&&r.isContextMenuOpen()),g=()=>{if(p()){const t=m(),o=ze(d.get(),"node")?((e,t)=>t.filter(e=>rn(e)&&oo(e)).map(Pr).getOrThunk(()=>nI(e)))(e,l.get()):nI(e);return t.height<=0||!oI(o,t,.01)}return!0},f=()=>{l.clear(),c.clear(),d.clear(),Gy.hide(h)},b=()=>{if(Gy.isOpen(h)){const e=h.element;bn(e,"display"),g()?dn(e,"display","none"):(c.set(0),Gy.reposition(h))}},y=t=>({dom:{tag:"div",classes:["tox-pop__dialog"]},components:[t],behaviours:id([_h.config({mode:"acyclic"}),ud("pop-dialog-wrap-events",[Kc(t=>{e.shortcuts.add("ctrl+F9","focus statusbar",()=>_h.focusIn(t))}),Jc(t=>{e.shortcuts.remove("ctrl+F9")})])])}),w=e=>{const t=x([e]);Dc(h,YD,{forwardContents:y(t)})},_=rt(()=>uI(t,w)),x=t=>{const{buttons:o}=e.ui.registry.getAll(),r={...o,..._().formNavigators},a=iC(e)===Px.scrolling?Px.scrolling:Px.default,l=W(L(t,t=>{return"contexttoolbar"===t.type?((t,o)=>NP(e,{buttons:t,toolbar:o.items,allowToolbarGroups:!1},n.backstage,A.some(["form:","toolbar:"])))(r,(o=t,{...o,launch:o.launch.getOrUndefined(),items:i(o.items)?o.items:L(o.items,DO)})):((e,t)=>tI(e,t))(t,s.providers);var o}));return iD({type:a,uid:Pe("context-toolbar"),initGroups:l,onEscape:A.none,cyclicKeying:!0,providers:s.providers})},C=(t,n)=>{if(S.cancel(),!p())return;const r=x(t),i=t[0].position,u=((t,n)=>{const r="node"===t?s.anchors.node(n):s.anchors.cursor(),i=((e,t,o,n)=>"line"===t?{bubble:_l(12,0,iI),layouts:{onLtr:()=>[ql],onRtl:()=>[Gl]},overrides:sI}:{bubble:_l(0,12,iI,1/12),layouts:cI(e,o,n,t),overrides:sI})(e,t,a(),{lastElement:l.get,isReposition:()=>ze(c.get(),0),getMode:()=>Qf.getMode(o)});return Le(r,i)})(i,n);d.set(i),c.set(1);const f=h.element;bn(f,"display"),(e=>ze(Ue(e,l.get(),wt),!0))(n)||(rr(f,hI),Qf.reset(o,h)),Gy.showWithinBounds(h,y(r),{anchor:u,transition:{classes:[hI],mode:"placement"}},()=>A.some(m())),n.fold(l.clear,l.set),g()&&dn(f,"display","none")};let k=!1;const S=nt(()=>{!e.hasFocus()||e.removed||k||(ir(h.element,hI)?S.throttle():((e,t)=>{const o=ct(t.getBody()),n=e=>wt(e,o),r=ct(t.selection.getNode());return(e=>!n(e)&&!_t(o,e))(r)?A.none():((e,t,o)=>{const n=dI(e,t);if(n.contextForms.length>0)return A.some({elem:e,toolbars:[n.contextForms[0]]});{const t=dI(e,o);if(t.contextForms.length>0)return A.some({elem:e,toolbars:[t.contextForms[0]]});if(n.contextToolbars.length>0||t.contextToolbars.length>0){const o=(e=>{if(e.length<=1)return e;{const t=t=>D(e,e=>e.position===t),o=t=>H(e,e=>e.position===t),n=t("selection"),r=t("node");if(n||r){if(r&&n){const e=o("node"),t=L(o("selection"),e=>({...e,position:"node"}));return e.concat(t)}return o(n?"selection":"node")}return o("line")}})(n.contextToolbars.concat(t.contextToolbars));return A.some({elem:e,toolbars:o})}return A.none()}})(r,e.inNodeScope,e.inEditorScope).orThunk(()=>((e,t,o)=>e(t)?A.none():fr(t,e=>{if(no(e)){const{contextToolbars:t,contextForms:n}=dI(e,o.inNodeScope),r=n.length>0?n:(e=>{if(e.length<=1)return e;{const t=t=>$(e,e=>e.position===t);return t("selection").orThunk(()=>t("node")).orThunk(()=>t("line")).map(e=>e.position).fold(()=>[],t=>H(e,e=>e.position===t))}})(t);return r.length>0?A.some({elem:e,toolbars:r}):A.none()}return A.none()},e))(n,r,e))})(_(),e).fold(f,e=>{C(e.toolbars,A.some(e.elem))}))},17);e.on("init",()=>{e.on("remove",f),e.on("ScrollContent ScrollWindow ObjectResized ResizeEditor longpress",b),e.on("click focus SetContent",S.throttle),e.on("keyup",e=>{var t;((t=e.keyCode)!==yP.ENTER&&t!==yP.SPACEBAR||!u.inSubtoolbar())&&S.throttle()}),e.on(WP,f),e.on("contexttoolbar-show",t=>{const o=_();fe(o.lookupTable,t.toolbarKey).each(o=>{C([o],$e(t.target!==e,t.target)),GD(h)})}),e.on("focusout",t=>{Fx.setEditorTimeout(e,()=>{Lo(o.element).isNone()&&Lo(h.element).isNone()&&!e.hasFocus()&&f()},0)}),e.on("SwitchMode",()=>{e.mode.isReadOnly()&&f()}),e.on("DisabledStateChange",e=>{e.state&&f()}),e.on("ExecCommand",({command:e})=>{"toggleview"===e.toLowerCase()&&f()}),e.on("AfterProgressState",t=>{t.state?f():e.hasFocus()&&S.throttle()}),e.on("dragstart",()=>{k=!0}),e.on("dragend drop",()=>{k=!1}),e.on("NodeChange",e=>{u.inSubtoolbar()?(dn(h.element,"transition","none"),b(),bn(h.element,"transition")):Lo(h.element).fold(S.throttle,v)})})},pI=(e,t)=>{const o=()=>{const o=t.getOptions(e),n=t.getCurrent(e).map(t.hash),r=Ge();return L(o,o=>({type:"togglemenuitem",text:t.display(o),onSetup:i=>{const s=e=>{e&&(r.on(e=>e.setActive(!1)),r.set(i)),i.setActive(e)};s(ze(n,t.hash(o)));const a=t.watcher(e,o,s);return()=>{r.clear(),a()}},onAction:()=>t.setCurrent(e,o)}))};e.ui.registry.addMenuButton(t.name,{tooltip:t.text,icon:t.icon,fetch:e=>e(o()),onSetup:t.onToolbarSetup}),e.ui.registry.addNestedMenuItem(t.name,{type:"nestedmenuitem",text:t.text,getSubmenuItems:o,onSetup:t.onMenuSetup})},gI=e=>{pI(e,(e=>({name:"lineheight",text:"Line height",icon:"line-height",getOptions:DC,hash:e=>(e=>Or(e,["fixed","relative","empty"]).map(({value:e,unit:t})=>e+t))(e).getOr(e),display:_,watcher:(e,t,o)=>e.formatter.formatChanged("lineheight",o,!1,{value:t}).unbind,getCurrent:e=>A.from(e.queryCommandValue("LineHeight")),setCurrent:(e,t)=>e.execCommand("LineHeight",!1,t),onToolbarSetup:yM(e),onMenuSetup:yM(e)}))(e)),(e=>A.from(nC(e)).map(t=>({name:"language",text:"Language",icon:"language",getOptions:w(t),hash:e=>u(e.customCode)?e.code:`${e.code}/${e.customCode}`,display:e=>e.title,watcher:(e,t,o)=>{var n;return e.formatter.formatChanged("lang",o,!1,{value:t.code,customValue:null!==(n=t.customCode)&&void 0!==n?n:null}).unbind},getCurrent:e=>{const t=ct(e.selection.getNode());return vr(t,e=>A.some(e).filter(no).bind(e=>Go(e,"lang").map(t=>({code:t,customCode:Go(e,"data-mce-lang").getOrUndefined(),title:""}))))},setCurrent:(e,t)=>e.execCommand("Lang",!1,t),onToolbarSetup:t=>{const o=qe();return t.setActive(e.formatter.match("lang",{},void 0,!0)),o.set(e.formatter.formatChanged("lang",t.setActive,!0)),bM(o.clear,yM(e)(t))},onMenuSetup:yM(e)})))(e).each(t=>pI(e,t))},fI=e=>_M(e,"NodeChange",t=>{t.setEnabled(e.queryCommandState("outdent")&&e.selection.isEditable())}),vI=(e,t)=>o=>{o.setActive(t.get());const n=e=>{t.set(e.state),o.setActive(e.state)};return e.on("PastePlainTextToggle",n),bM(()=>e.off("PastePlainTextToggle",n),yM(e)(o))},bI=(e,t)=>()=>{e.execCommand("mceToggleFormat",!1,t)},yI=e=>{(e=>{(e=>{nR.each([{name:"bold",text:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",icon:"superscript"}],(t,o)=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:wM(e,t.name),onAction:bI(e,t.name),shortcut:t.shortcut})});for(let t=1;t<=6;t++){const o="h"+t,n=`Access+${t}`;e.ui.registry.addToggleButton(o,{text:o.toUpperCase(),tooltip:"Heading "+t,onSetup:wM(e,o),onAction:bI(e,o),shortcut:n})}})(e),(e=>{nR.each([{name:"copy",text:"Copy",action:"Copy",icon:"copy",context:"any"},{name:"help",text:"Help",action:"mceHelp",icon:"help",shortcut:"Alt+0",context:"any"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A",context:"any"},{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"print",text:"Print",action:"mcePrint",icon:"print",shortcut:"Meta+P",context:"any"}],t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onAction:CM(e,t.action),shortcut:t.shortcut,context:t.context})}),nR.each([{name:"cut",text:"Cut",action:"Cut",icon:"cut"},{name:"paste",text:"Paste",action:"Paste",icon:"paste"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"remove",text:"Remove",action:"Delete",icon:"remove"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],t=>{e.ui.registry.addButton(t.name,{tooltip:t.text,icon:t.icon,onSetup:yM(e),onAction:CM(e,t.action)})})})(e),(e=>{nR.each([{name:"blockquote",text:"Blockquote",action:"mceBlockQuote",icon:"quote"}],t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:CM(e,t.action),onSetup:wM(e,t.name)})})})(e)})(e),(e=>{nR.each([{name:"newdocument",text:"New document",action:"mceNewDocument",icon:"new-document"},{name:"copy",text:"Copy",action:"Copy",icon:"copy",shortcut:"Meta+C",context:"any"},{name:"selectall",text:"Select all",action:"SelectAll",icon:"select-all",shortcut:"Meta+A",context:"any"},{name:"print",text:"Print...",action:"mcePrint",icon:"print",shortcut:"Meta+P",context:"any"}],t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onAction:CM(e,t.action),context:t.context})}),nR.each([{name:"bold",text:"Bold",action:"Bold",icon:"bold",shortcut:"Meta+B"},{name:"italic",text:"Italic",action:"Italic",icon:"italic",shortcut:"Meta+I"},{name:"underline",text:"Underline",action:"Underline",icon:"underline",shortcut:"Meta+U"},{name:"strikethrough",text:"Strikethrough",action:"Strikethrough",icon:"strike-through"},{name:"subscript",text:"Subscript",action:"Subscript",icon:"subscript"},{name:"superscript",text:"Superscript",action:"Superscript",icon:"superscript"},{name:"removeformat",text:"Clear formatting",action:"RemoveFormat",icon:"remove-formatting"},{name:"cut",text:"Cut",action:"Cut",icon:"cut",shortcut:"Meta+X"},{name:"paste",text:"Paste",action:"Paste",icon:"paste",shortcut:"Meta+V"},{name:"hr",text:"Horizontal line",action:"InsertHorizontalRule",icon:"horizontal-rule"}],t=>{e.ui.registry.addMenuItem(t.name,{text:t.text,icon:t.icon,shortcut:t.shortcut,onSetup:yM(e),onAction:CM(e,t.action)})}),e.ui.registry.addMenuItem("codeformat",{text:"Code",icon:"sourcecode",onSetup:yM(e),onAction:bI(e,"code")})})(e)},wI=(e,t)=>_M(e,"Undo Redo AddUndo TypingUndo ClearUndos SwitchMode",o=>{o.setEnabled(!e.mode.isReadOnly()&&e.undoManager[t]())}),_I=e=>_M(e,"VisualAid",t=>{t.setActive(e.hasVisual)}),xI=(e,t)=>{(e=>{F([{name:"alignleft",text:"Align left",cmd:"JustifyLeft",icon:"align-left"},{name:"aligncenter",text:"Align center",cmd:"JustifyCenter",icon:"align-center"},{name:"alignright",text:"Align right",cmd:"JustifyRight",icon:"align-right"},{name:"alignjustify",text:"Justify",cmd:"JustifyFull",icon:"align-justify"}],t=>{e.ui.registry.addToggleButton(t.name,{tooltip:t.text,icon:t.icon,onAction:CM(e,t.cmd),onSetup:wM(e,t.name)})}),e.ui.registry.addButton("alignnone",{tooltip:"No alignment",icon:"align-none",onSetup:yM(e),onAction:CM(e,"JustifyNone")})})(e),yI(e),((e,t)=>{((e,t)=>{const o=tP(t,lP(e));e.ui.registry.addNestedMenuItem("align",{text:t.shared.providers.translate("Align"),onSetup:yM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=tP(t,bP(e));e.ui.registry.addNestedMenuItem("fontfamily",{text:t.shared.providers.translate("Fonts"),onSetup:yM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o={type:"advanced",...t.styles},n=tP(t,OP(e,o));e.ui.registry.addNestedMenuItem("styles",{text:"Formats",onSetup:yM(e,()=>n.getStyleItems().length>0),getSubmenuItems:()=>n.items.validateItems(n.getStyleItems())})})(e,t),((e,t)=>{const o=tP(t,hP(e));e.ui.registry.addNestedMenuItem("blocks",{text:"Blocks",onSetup:yM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t),((e,t)=>{const o=tP(t,TP(e));e.ui.registry.addNestedMenuItem("fontsize",{text:"Font sizes",onSetup:yM(e),getSubmenuItems:()=>o.items.validateItems(o.getStyleItems())})})(e,t)})(e,t),(e=>{(e=>{e.ui.registry.addMenuItem("undo",{text:"Undo",icon:"undo",shortcut:"Meta+Z",onSetup:wI(e,"hasUndo"),onAction:CM(e,"undo")}),e.ui.registry.addMenuItem("redo",{text:"Redo",icon:"redo",shortcut:"Meta+Y",onSetup:wI(e,"hasRedo"),onAction:CM(e,"redo")})})(e),(e=>{e.ui.registry.addButton("undo",{tooltip:"Undo",icon:"undo",enabled:!1,onSetup:wI(e,"hasUndo"),onAction:CM(e,"undo"),shortcut:"Meta+Z"}),e.ui.registry.addButton("redo",{tooltip:"Redo",icon:"redo",enabled:!1,onSetup:wI(e,"hasRedo"),onAction:CM(e,"redo"),shortcut:"Meta+Y"})})(e)})(e),(e=>{(e=>{e.addCommand("mceApplyTextcolor",(t,o)=>{((e,t,o)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.apply(t,{value:o}),e.nodeChanged()})})(e,t,o)}),e.addCommand("mceRemoveTextcolor",t=>{((e,t)=>{e.undoManager.transact(()=>{e.focus(),e.formatter.remove(t,{value:null},void 0,!0),e.nodeChanged()})})(e,t)})})(e);const t=LM(e),o=FM(e),n=we(t),r=we(o);YM(e,"forecolor","forecolor",n),YM(e,"backcolor","hilitecolor",r),XM(e,"forecolor","forecolor","Text color",n),XM(e,"backcolor","hilitecolor","Background color",r)})(e),(e=>{(e=>{e.ui.registry.addButton("visualaid",{tooltip:"Visual aids",text:"Visual aids",onAction:CM(e,"mceToggleVisualAid"),context:"any"})})(e),(e=>{e.ui.registry.addToggleMenuItem("visualaid",{text:"Visual aids",onSetup:_I(e),onAction:CM(e,"mceToggleVisualAid"),context:"any"})})(e)})(e),(e=>{(e=>{e.ui.registry.addButton("outdent",{tooltip:"Decrease indent",icon:"outdent",onSetup:fI(e),onAction:CM(e,"outdent")}),e.ui.registry.addButton("indent",{tooltip:"Increase indent",icon:"indent",onSetup:yM(e),onAction:CM(e,"indent")})})(e)})(e),gI(e),(e=>{const t=we(TC(e)),o=()=>e.execCommand("mceTogglePlainTextPaste");e.ui.registry.addToggleButton("pastetext",{active:!1,icon:"paste-text",tooltip:"Paste as text",onAction:o,onSetup:vI(e,t)}),e.ui.registry.addToggleMenuItem("pastetext",{text:"Paste as text",icon:"paste-text",onAction:o,onSetup:vI(e,t)})})(e),(e=>{e.ui.registry.addContext("editable",()=>e.selection.isEditable()),e.ui.registry.addContext("mode",t=>e.mode.get()===t),e.ui.registry.addContext("any",O),e.ui.registry.addContext("formatting",t=>e.formatter.canApply(t)),e.ui.registry.addContext("insert",t=>e.schema.isValidChild(e.selection.getNode().tagName,t))})(e)},CI=e=>i(e)?e.split(/[ ,]/):e,kI=e=>t=>t.options.get(e),SI=kI("contextmenu_never_use_native"),TI=kI("contextmenu_avoid_overlap"),EI=e=>{const t=e.ui.registry.getAll().contextMenus,o=e.options.get("contextmenu");return e.options.isSet("contextmenu")?o:H(o,e=>ve(t,e))},OI=(e,t)=>({type:"makeshift",x:e,y:t}),AI=e=>"longpress"===e.type||0===e.type.indexOf("touch"),MI=(e,t)=>"contextmenu"===t.type||"longpress"===t.type?e.inline?(e=>{if(AI(e)){const t=e.touches[0];return OI(t.pageX,t.pageY)}return OI(e.pageX,e.pageY)})(t):((e,t)=>{const o=zx.DOM.getPos(e);return((e,t,o)=>OI(e.x+t,e.y+o))(t,o.x,o.y)})(e.getContentAreaContainer(),(e=>{if(AI(e)){const t=e.touches[0];return OI(t.clientX,t.clientY)}return OI(e.clientX,e.clientY)})(t)):BI(e),BI=e=>({type:"selection",root:ct(e.selection.getNode())}),RI=(e,t,o)=>{switch(o){case"node":return(e=>({type:"node",node:A.some(ct(e.selection.getNode())),root:ct(e.getBody())}))(e);case"point":return MI(e,t);case"selection":return BI(e)}},NI=(e,t,o,n,r,i)=>{const s=o(),a=RI(e,t,i);ZR(s,gS.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!1,search:A.none()}).map(e=>{t.preventDefault(),Gy.showMenuAt(r,{anchor:a},{menu:{markers:MS("normal")},data:e})})},VI={onLtr:()=>[Wl,Hl,Ul,Zl,$l,jl,pc,gc,mc,uc,hc,dc],onRtl:()=>[Wl,Ul,Hl,$l,Zl,jl,pc,gc,hc,dc,mc,uc]},DI={valignCentre:[],alignCentre:[],alignLeft:["tox-pop--align-left"],alignRight:["tox-pop--align-right"],right:["tox-pop--right"],left:["tox-pop--left"],bottom:["tox-pop--bottom"],top:["tox-pop--top"]},PI=(e,t,o,n,r,i)=>{const s=Kt(),a=s.os.isiOS(),l=s.os.isMacOS(),c=s.os.isAndroid(),d=s.deviceType.isTouch(),u=()=>{const s=o();((e,t,o,n,r,i,s)=>{const a=((e,t,o)=>{const n=RI(e,t,o);return{bubble:_l(0,"point"===o?12:0,DI),layouts:VI,overrides:{maxWidthFunction:Sc(),maxHeightFunction:kc()},...n}})(e,t,i);ZR(o,gS.CLOSE_ON_EXECUTE,n,{isHorizontalMenu:!0,search:A.none()}).map(o=>{t.preventDefault();const l=s?Ac.HighlightMenuAndItem:Ac.HighlightNone;Gy.showMenuWithinBounds(r,{anchor:a},{menu:{markers:MS("normal"),highlightOnOpen:l},data:o,type:"horizontal"},()=>A.some(rI(e,n.shared,"node"===i?"node":"selection"))),e.dispatch(WP)})})(e,t,s,n,r,i,!(c||a||l&&d))};if((l||a)&&"node"!==i){const o=()=>{(e=>{const t=e.selection.getRng(),o=()=>{Fx.setEditorTimeout(e,()=>{e.selection.setRng(t)},10),i()};e.once("touchend",o);const n=e=>{e.preventDefault(),e.stopImmediatePropagation()};e.on("mousedown",n,!0);const r=()=>i();e.once("longpresscancel",r);const i=()=>{e.off("touchend",o),e.off("longpresscancel",r),e.off("mousedown",n)}})(e),u()};((e,t)=>{const o=e.selection;if(o.isCollapsed()||t.touches.length<1)return!1;{const n=t.touches[0],r=o.getRng();return Sr(e.getWin(),xr.domRange(r)).exists(e=>e.left<=n.clientX&&e.right>=n.clientX&&e.top<=n.clientY&&e.bottom>=n.clientY)}})(e,t)?o():(e.once("selectionchange",o),e.once("touchend",()=>e.off("selectionchange",o)))}else u()},II=e=>i(e)?"|"===e:"separator"===e.type,LI={type:"separator"},FI=e=>{const t=e=>({text:e.text,icon:e.icon,enabled:e.enabled,shortcut:e.shortcut});if(i(e))return e;switch(e.type){case"separator":return LI;case"submenu":return{type:"nestedmenuitem",...t(e),getSubmenuItems:()=>{const t=e.getSubmenuItems();return i(t)?t:L(t,FI)}};default:const o=e;return{type:"menuitem",...t(o),onAction:b(o.onAction)}}},zI=(e,t)=>{if(0===t.length)return e;const o=oe(e).filter(e=>!II(e)).fold(()=>[],e=>[LI]);return e.concat(o).concat(t).concat([LI])},HI=(e,t)=>!(e=>"longpress"===e.type||ve(e,"touches"))(t)&&(2!==t.button||t.target===e.getBody()&&""===t.pointerType),UI=(e,t)=>HI(e,t)?e.selection.getStart(!0):t.target,ZI=(e,t,o)=>{const n=Kt().deviceType.isTouch,r=Am(Gy.sketch({dom:{tag:"div"},lazySink:t,onEscape:()=>e.focus(),onShow:()=>o.setContextMenuState(!0),onHide:()=>o.setContextMenuState(!1),fireDismissalEventInstead:{},inlineBehaviours:id([ud("dismissContextMenu",[Zc(Ys(),(t,o)=>{vv.close(t),e.focus()})])])})),s=()=>Gy.hide(r),a=t=>{if(SI(e)&&t.preventDefault(),((e,t)=>t.ctrlKey&&!SI(e))(e,t)||(e=>0===EI(e).length)(e))return;const s=((e,t)=>{const o=TI(e),n=HI(e,t)?"selection":"point";if(tt(o)){const r=UI(e,t);return pr(ct(r),o)?"node":n}return n})(e,t);(n()?PI:NI)(e,t,()=>{const o=UI(e,t),n=e.ui.registry.getAll(),r=EI(e);return((e,t,o)=>{const n=Z(t,(t,n)=>fe(e,n.toLowerCase()).map(e=>{const n=e.update(o);if(i(n)&&tt(et(n)))return zI(t,n.split(" "));if(l(n)&&n.length>0){const e=L(n,FI);return zI(t,e)}return t}).getOrThunk(()=>t.concat([n])),[]);return n.length>0&&II(n[n.length-1])&&n.pop(),n})(n.contextMenus,r,o)},o,r,s)};e.on("init",()=>{const t="ResizeEditor ScrollContent ScrollWindow longpresscancel"+(n()?"":" ResizeWindow");e.on(t,s),e.on("longpress contextmenu",a)})},$I=(e,t,o,n,r,i)=>e.fold(()=>Eg.snap({sensor:Fp(o-20,n-20),range:Bn(r,i),output:Fp(A.some(o),A.some(n)),extra:{td:t}}),e=>{const r=o-20,i=n-20,s=e.element.dom.getBoundingClientRect();return Eg.snap({sensor:Fp(r,i),range:Bn(40,40),output:Fp(A.some(o-s.width/2),A.some(n-s.height/2)),extra:{td:t}})}),jI=(e,t,o)=>({getSnapPoints:e,leftAttr:"data-drag-left",topAttr:"data-drag-top",onSensor:(e,n)=>{const r=n.td;((e,t)=>e.exists(e=>wt(e,t)))(t.get(),r)||(t.set(r),o(r))},mustSnap:!0}),WI=e=>db(Tb.sketch({dom:{tag:"div",classes:["tox-selector"]},buttonBehaviours:id([Eg.config({mode:"mouseOrTouch",blockerClass:"blocker",snaps:e}),lb.config({})]),eventOrder:{mousedown:["dragging","alloy.base.behaviour"],touchstart:["dragging","alloy.base.behaviour"]}})),qI=(e,t)=>{const o=we([]),n=we([]),r=we(!1),i=Ge(),s=Ge(),a=e=>{const o=Pr(e);return $I(u.getOpt(t),e,o.x,o.y,o.width,o.height)},l=e=>{const o=Pr(e);return $I(h.getOpt(t),e,o.right,o.bottom,o.width,o.height)},c=jI(()=>L(o.get(),e=>a(e)),i,t=>{s.get().each(o=>{e.dispatch("TableSelectorChange",{start:t,finish:o})})}),d=jI(()=>L(n.get(),e=>l(e)),s,t=>{i.get().each(o=>{e.dispatch("TableSelectorChange",{start:o,finish:t})})}),u=WI(c),h=WI(d),m=Am(u.asSpec()),p=Am(h.asSpec()),g=(t,o,n,r)=>{const i=n(o);Eg.snapTo(t,i),((t,o)=>{const n=o.dom.getBoundingClientRect();bn(t.element,"display");const i=ho(ct(e.getBody())).dom.innerHeight,s=n[r]<0,a=((e,t)=>e[r]>t)(n,i);(s||a)&&dn(t.element,"display","none")})(t,o)},f=e=>g(m,e,a,"top"),v=e=>g(p,e,l,"bottom");if(Kt().deviceType.isTouch()){const a=e=>L(e,ct);e.on("TableSelectionChange",e=>{r.get()||(Rh(t,m),Rh(t,p),r.set(!0));const l=ct(e.start),c=ct(e.finish);i.set(l),s.set(c),A.from(e.otherCells).each(e=>{o.set(a(e.upOrLeftCells)),n.set(a(e.downOrRightCells)),f(l),v(c)})}),e.on("ResizeEditor ResizeWindow ScrollContent",()=>{i.get().each(f),s.get().each(v)}),e.on("TableSelectionClear",()=>{r.get()&&(Dh(m),Dh(p),r.set(!1)),i.clear(),s.clear()})}},GI=e=>"BR"===e.nodeName||!!e.getAttribute("data-mce-bogus")||"bookmark"===e.getAttribute("data-mce-type"),YI=(e,t,o)=>{var n;const r=null!==(n=t.delimiter)&&void 0!==n?n:"›";return{dom:{tag:"div",classes:["tox-statusbar__path"],attributes:{role:"navigation"}},behaviours:id([_h.config({mode:"flow",selector:"div[role=button]"}),tp.config({disabled:o.isDisabled}),kA(()=>o.checkUiComponentContext("any")),Hv.config({}),Qh.config({}),ud("elementPathEvents",[Kc((t,n)=>{e.shortcuts.add("alt+F11","focus statusbar elementpath",()=>_h.focusIn(t)),e.on("NodeChange",n=>{const i=(t=>{const o=[];let n=t.length;for(;n-- >0;){const r=t[n];if(1===r.nodeType&&!GI(r)){const t=fM(e,r);if(t.isDefaultPrevented()||o.push({name:t.name,element:r}),t.isPropagationStopped())break}}return o})(n.parents),s=i.length>0?Z(i,(t,n,i)=>{const s=((t,n,r)=>Tb.sketch({dom:{tag:"div",classes:["tox-statusbar__path-item"],attributes:{"data-index":r}},components:[Sm(t)],action:t=>{e.focus(),e.selection.select(n),e.nodeChanged()},buttonBehaviours:id([ab.config({...o.tooltips.getConfig({tooltipText:o.translate(["Select the {0} element",n.nodeName.toLowerCase()]),onShow:(e,t)=>{((e,t)=>{const o=A.from(qo(e,"id")).getOrThunk(()=>{const e=Pe("aria");return jo(t,"id",e),e});jo(e,"aria-describedby",o)})(e.element,t.element)},onHide:e=>{var t;t=e.element,Xo(t,"aria-describedby")}})}),uA(o.isDisabled),kA(()=>o.checkUiComponentContext("any"))])}))(n.name,n.element,i);return 0===i?t.concat([s]):t.concat([{dom:{tag:"div",classes:["tox-statusbar__path-divider"],attributes:{"aria-hidden":!0}},components:[Sm(` ${r} `)]},s])},[]):[];Qh.set(t,s)})})])]),components:[]}};var XI;!function(e){e[e.None=0]="None",e[e.Both=1]="Both",e[e.Vertical=2]="Vertical"}(XI||(XI={}));const KI=(e,t,o)=>{const n=ct(e.getContainer()),r=((e,t,o,n,r)=>{const i={height:FP(n+t.top,Kx(e),Qx(e))};return o===XI.Both&&(i.width=FP(r+t.left,Xx(e),Jx(e))),i})(e,t,o,xn(n),En(n));ae(r,(e,t)=>{g(e)&&dn(n,t,LP(e))}),(e=>{e.dispatch("ResizeEditor")})(e)},JI=(e,t,o,n)=>{const r=Bn(20*o,20*n);return KI(e,r,t),A.some(!0)},QI=(e,t)=>{const o=()=>{const o=[],n=AC(e),r=CC(e),i=kC(e)||e.hasPlugin("wordcount");return r&&o.push(YI(e,{},t)),n&&o.push((()=>{const e=BA("Alt+0");return{dom:{tag:"div",classes:["tox-statusbar__help-text"]},components:[Sm(tS.translate(["Press {0} for help",e]))]}})()),i&&o.push((()=>{const o=[];return e.hasPlugin("wordcount")&&o.push(((e,t)=>{const o=(e,o,n)=>Qh.set(e,[Sm(t.translate(["{0} "+n,o[n]]))]);return Tb.sketch({dom:{tag:"button",classes:["tox-statusbar__wordcount"]},components:[],buttonBehaviours:id([uA(t.isDisabled),kA(()=>t.checkUiComponentContext("any")),Hv.config({}),Qh.config({}),Yg.config({store:{mode:"memory",initialValue:{mode:"words",count:{words:0,characters:0}}}}),ud("wordcount-events",[ed(e=>{const t=Yg.getValue(e),n="words"===t.mode?"characters":"words";Yg.setValue(e,{mode:n,count:t.count}),o(e,t.count,n)}),Kc(t=>{e.on("wordCountUpdate",e=>{const{mode:n}=Yg.getValue(t);Yg.setValue(t,{mode:n,count:e.wordCount}),o(t,e.wordCount,n)})})])]),eventOrder:{[Ps()]:["disabling","alloy.base.behaviour","wordcount-events"]}})})(e,t)),kC(e)&&o.push({dom:{tag:"span",classes:["tox-statusbar__branding"]},components:[{dom:{tag:"a",attributes:{href:"https://www.tiny.cloud/powered-by-tiny?utm_campaign=poweredby&utm_source=tiny&utm_medium=referral&utm_content=v7",rel:"noopener",target:"_blank","aria-label":e.translate(["Build with {0}","TinyMCE"])},innerHtml:e.translate(["Build with {0}",'<svg height="16" viewBox="0 0 80 16" width="80" xmlns="http://www.w3.org/2000/svg"><g opacity=".8"><path d="m80 3.537v-2.202h-7.976v11.585h7.976v-2.25h-5.474v-2.621h4.812v-2.069h-4.812v-2.443zm-10.647 6.929c-.493.217-1.13.337-1.864.337s-1.276-.156-1.805-.47a3.732 3.732 0 0 1 -1.3-1.298c-.324-.554-.48-1.191-.48-1.877s.156-1.335.48-1.877a3.635 3.635 0 0 1 1.3-1.299 3.466 3.466 0 0 1 1.805-.481c.65 0 .914.06 1.263.18.36.12.698.277.986.47.289.192.578.384.842.6l.12.085v-2.586l-.023-.024c-.385-.35-.855-.614-1.384-.818-.53-.205-1.155-.313-1.877-.313-.721 0-1.6.144-2.333.445a5.773 5.773 0 0 0 -1.937 1.251 5.929 5.929 0 0 0 -1.324 1.9c-.324.735-.48 1.565-.48 2.455s.156 1.72.48 2.454c.325.734.758 1.383 1.324 1.913.553.53 1.215.938 1.937 1.25a6.286 6.286 0 0 0 2.333.434c.819 0 1.384-.108 1.961-.313.59-.216 1.083-.505 1.468-.866l.024-.024v-2.49l-.12.096c-.41.337-.878.626-1.396.866zm-14.869-4.15-4.8-5.04-.024-.025h-.902v11.67h2.502v-6.847l2.827 3.08.385.409.397-.41 2.791-3.067v6.845h2.502v-11.679h-.902l-4.788 5.052z"/><path clip-rule="evenodd" d="m15.543 5.137c0-3.032-2.466-5.113-4.957-5.137-.36 0-.745.024-1.094.096-.157.024-3.85.758-3.85.758-3.032.602-4.62 2.466-4.704 4.788-.024.89-.024 4.27-.024 4.27.036 3.165 2.406 5.138 5.017 5.126.337 0 1.119-.109 1.287-.145.144-.024.385-.084.746-.144.661-.12 1.684-.325 3.067-.602 2.37-.409 4.103-2.009 4.44-4.33.156-1.023.084-4.692.084-4.692zm-3.213 3.308-2.346.457v2.31l-5.859 1.143v-5.75l2.346-.458v3.441l3.513-.686v-3.44l-3.513.685v-2.297l5.859-1.143v5.75zm20.09-3.296-.083-1.023h-2.13v8.794h2.346v-4.884c0-1.107.95-1.985 2.057-1.997 1.095 0 1.901.89 1.901 1.997v4.884h2.346v-5.245c-.012-2.105-1.588-3.777-3.67-3.765a3.764 3.764 0 0 0 -2.778 1.25l.012-.011zm-6.014-4.102 2.346-.458v2.298l-2.346.457z" fill-rule="evenodd"/><path d="m28.752 4.126h-2.346v8.794h2.346z"/><path clip-rule="evenodd" d="m43.777 15.483 4.043-11.357h-2.418l-1.54 4.355-.445 1.324-.36-1.324-1.54-4.355h-2.418l3.151 8.794-1.083 3.08zm-21.028-5.51c0 .722.541 1.034.878 1.034s.638-.048.95-.144l.518 1.708c-.217.145-.879.518-2.13.518a2.565 2.565 0 0 1 -2.562-2.587c-.024-1.082-.024-2.49 0-4.21h-1.54v-2.142h1.54v-1.912l2.346-.458v2.37h2.201v2.142h-2.2v3.693-.012z" fill-rule="evenodd"/></g></svg>\n'.trim()])},behaviours:id([fd.config({})])}]}),{dom:{tag:"div",classes:["tox-statusbar__right-container"]},components:o}})()),o.length>0?[{dom:{tag:"div",classes:["tox-statusbar__text-container",...(()=>{const e="tox-statusbar__text-container--flex-start",t="tox-statusbar__text-container--flex-end";if(n){const o="tox-statusbar__text-container-3-cols";return i||r?i&&!r?[o,t]:[o,e]:[o,"tox-statusbar__text-container--space-around"]}return[i&&!r?t:e]})()]},components:o}]:[]};return{dom:{tag:"div",classes:["tox-statusbar"]},components:(()=>{const n=o(),r=((e,t)=>{const o=(e=>{const t=SC(e);return!1===t?XI.None:"both"===t?XI.Both:XI.Vertical})(e);if(o===XI.None)return A.none();const n=o===XI.Both?"Press the arrow keys to resize the editor.":"Press the Up and Down arrow keys to resize the editor.",r=o===XI.Both?"tox-statusbar__resize-cursor-both":"tox-statusbar__resize-cursor-default";return A.some(dS("resize-handle",{tag:"div",classes:["tox-statusbar__resize-handle",r],attributes:{"aria-label":t.translate(n),"data-mce-name":"resize-handle"},behaviours:[Eg.config({mode:"mouse",repositionTarget:!1,onDrag:(t,n,r)=>KI(e,r,o),blockerClass:"tox-blocker"}),_h.config({mode:"special",onLeft:()=>JI(e,o,-1,0),onRight:()=>JI(e,o,1,0),onUp:()=>JI(e,o,0,-1),onDown:()=>JI(e,o,0,1)}),Hv.config({}),fd.config({}),ab.config(t.tooltips.getConfig({tooltipText:t.translate("Resize")}))]},t.icons))})(e,t);return n.concat(r.toArray())})()}},eL=(e,t)=>t.get().getOrDie(`UI for ${e} has not been rendered`),tL=(e,t)=>{const o=e.inline,n=o?jP:IP,r=$C(e)?UV:RV,i=(()=>{const e=Ge(),t=Ge(),o=Ge();return{dialogUi:e,popupUi:t,mainUi:o,getUiMotherships:()=>{const o=e.get().map(e=>e.mothership),n=t.get().map(e=>e.mothership);return o.fold(()=>n.toArray(),e=>n.fold(()=>[e],t=>wt(e.element,t.element)?[e]:[e,t]))},lazyGetInOuterOrDie:(e,t)=>()=>o.get().bind(e=>t(e.outerContainer)).getOrDie(`Could not find ${e} element in OuterContainer`)}})(),s=Ge(),a=Ge(),l=Ge(),c=Kt().deviceType.isTouch()?["tox-platform-touch"]:[],d=FC(e),u=iC(e),h=db({dom:{tag:"div",classes:["tox-anchorbar"]}}),m=db({dom:{tag:"div",classes:["tox-bottom-anchorbar"]}}),p=()=>i.mainUi.get().map(e=>e.outerContainer).bind(TD.getHeader),g=i.lazyGetInOuterOrDie("anchor bar",h.getOpt),f=i.lazyGetInOuterOrDie("bottom anchor bar",m.getOpt),v=i.lazyGetInOuterOrDie("toolbar",TD.getToolbar),b=i.lazyGetInOuterOrDie("throbber",TD.getThrobber),y=((e,t,o,n)=>{const r=we(!1),i=(e=>{const t=we(FC(e)?"bottom":"top");return{isPositionedAtTop:()=>"top"===t.get(),getDockingMode:t.get,setDockingMode:t.set}})(t),s={icons:()=>t.ui.registry.getAll().icons,menuItems:()=>t.ui.registry.getAll().menuItems,translate:tS.translate,isDisabled:()=>!t.ui.isEnabled(),getOption:t.options.get,tooltips:oV(e.dialog),checkUiComponentContext:e=>{if(qx(t))return{contextType:"disabled",shouldDisable:!0};const[o,n=""]=e.split(":"),r=t.ui.registry.getAll().contexts;return{contextType:o,shouldDisable:!fe(r,o).fold(()=>fe(r,"mode").map(e=>e("design")).getOr(!1),e=>"!"===n.charAt(0)?!e(n.slice(1)):e(n))}}},a=EV(t),l=(e=>{const t=t=>()=>e.formatter.match(t),o=t=>()=>{const o=e.formatter.get(t);return void 0!==o?A.some({tag:o.length>0&&(o[0].inline||o[0].block)||"div",styles:e.dom.parseStyle(e.formatter.getCssText(t))}):A.none()},n=we([]),r=we([]),i=we(!1);return e.on("PreInit",r=>{const i=QN(e),s=tV(e,i,t,o);n.set(s)}),e.on("addStyleModifications",n=>{const s=tV(e,n.items,t,o);r.set(s),i.set(n.replace)}),{getData:()=>{const e=i.get()?[]:n.get(),t=r.get();return e.concat(t)}}})(t),c=(e=>({colorPicker:$N(e),hasCustomColors:jN(e),getColors:WN(e),getColorCols:qN(e)}))(t),d=(e=>({isDraggableModal:GN(e)}))(t),u={shared:{providers:s,anchors:ZN(t,o,n,i.isPositionedAtTop),header:i},urlinput:a,styles:l,colorinput:c,dialog:d,isContextMenuOpen:()=>r.get(),setContextMenuState:e=>r.set(e)},h=e=>A.none(),m={...u,shared:{...u.shared,interpreter:e=>PN(e,{},m,h),getSink:e.popup}},p={...u,shared:{...u.shared,interpreter:e=>PN(e,{},p,h),getSink:e.dialog}};return{popup:m,dialog:p}})({popup:()=>Ae.fromOption(i.popupUi.get().map(e=>e.sink),"(popup) UI has not been rendered"),dialog:()=>Ae.fromOption(i.dialogUi.get().map(e=>e.sink),"UI has not been rendered")},e,g,f),w=()=>{const t=(()=>{const t={attributes:{[Ec]:d?Tc.BottomToTop:Tc.TopToBottom}},o=TD.parts.menubar({dom:{tag:"div",classes:["tox-menubar"]},backstage:y.popup,onEscape:()=>{e.focus()}}),n=TD.parts.toolbar({dom:{tag:"div",classes:["tox-toolbar"]},getSink:y.popup.shared.getSink,providers:y.popup.shared.providers,onEscape:()=>{e.focus()},onToolbarToggled:t=>{((e,t)=>{e.dispatch("ToggleToolbarDrawer",{state:t})})(e,t)},type:u,lazyToolbar:v,lazyHeader:()=>p().getOrDie("Could not find header element"),...t}),r=TD.parts["multiple-toolbar"]({dom:{tag:"div",classes:["tox-toolbar-overlord"]},providers:y.popup.shared.providers,onEscape:()=>{e.focus()},type:u}),i=LC(e),s=PC(e),a=NC(e),l=OC(e),c=i||s||a,m=[(g=l,TD.parts.promotion({dom:{tag:"div",classes:["tox-promotion"]},promotionLink:g})),o];var g;return TD.parts.header({dom:{tag:"div",classes:["tox-editor-header"].concat(c?[]:["tox-editor-header--empty"]),...t},components:W([a?m:[],i?[r]:s?[n]:[],HC(e)?[]:[h.asSpec()]]),sticky:$C(e),editor:e,sharedBackstage:y.popup.shared})})(),n={dom:{tag:"div",classes:["tox-sidebar-wrap"]},components:[TD.parts.socket({dom:{tag:"div",classes:["tox-edit-area"]}}),TD.parts.sidebar({dom:{tag:"div",classes:["tox-sidebar"]}})]},r=TD.parts.throbber({dom:{tag:"div",classes:["tox-throbber"]},backstage:y.popup}),i=TD.parts.viewWrapper({backstage:y.popup}),a=xC(e)&&!o?A.some(QI(e,y.popup.shared.providers)):A.none(),l=W([d?[]:[t],o?[]:[n],d?[t]:[]]),g=TD.parts.editorContainer({components:W([l,o?[]:[m.asSpec()]])}),f=ZC(e),b={role:"application",...tS.isRtl()?{dir:"rtl"}:{},...f?{"aria-hidden":"true"}:{}},w=Am(TD.sketch({dom:{tag:"div",classes:["tox","tox-tinymce"].concat(o?["tox-tinymce-inline"]:[]).concat(d?["tox-tinymce--toolbar-bottom"]:[]).concat(c),styles:{visibility:"hidden",...f?{opacity:"0",border:"0"}:{}},attributes:b},components:[g,...o?[]:[i,...a.toArray()],r],behaviours:id([kA(()=>y.popup.shared.providers.checkUiComponentContext("any")),tp.config({disableClass:"tox-tinymce--disabled"}),_h.config({mode:"cyclic",selector:".tox-menubar, .tox-toolbar, .tox-toolbar__primary, .tox-toolbar__overflow--open, .tox-sidebar__overflow--open, .tox-statusbar__path, .tox-statusbar__wordcount, .tox-statusbar__branding a, .tox-statusbar__resize-handle"})])})),_=Cb(w);return s.set(_),{mothership:_,outerContainer:w}},_=t=>{const o=LP((e=>(e=>{const t=((e,t)=>{if("number"==typeof t)return A.from(t);const o=/^([0-9.]+)(pt|em|px)$/.exec(t.trim());if(o){const t=o[2],n=Number.parseFloat(o[1]);if(Number.isNaN(n)||n<0)return A.none();if("em"===t)return A.from(n*Number.parseFloat(window.getComputedStyle(e.dom).fontSize));if("pt"===t)return A.from(.75*n);if("px"===t)return A.from(n)}return A.none()})(ct(e.targetElm),Gx(e)),o=Kx(e),n=Qx(e);return t.map(e=>FP(e,o,n))})(e).getOr(Gx(e)))(e)),n=LP((e=>zP(e).getOr(Yx(e)))(e));return e.inline||(vn("div","width",n)&&dn(t.element,"width",n),vn("div","height",o)?dn(t.element,"height",o):dn(t.element,"height","400px")),o};return{popups:{backstage:y.popup,getMothership:()=>eL("popups",l)},dialogs:{backstage:y.dialog,getMothership:()=>eL("dialogs",a)},renderUI:()=>{const o=w(),s=(()=>{const t=UC(e),o=wt(sn(),t)&&"grid"===mn(t,"display"),n={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-tinymce-aux"].concat(c),attributes:{...tS.isRtl()?{dir:"rtl"}:{}}},behaviours:id([Qf.config({useFixed:()=>r.isDocked(p)})])},i={dom:{styles:{width:document.body.clientWidth+"px"}},events:zc([Zc(Ws(),e=>{dn(e.element,"width",document.body.clientWidth+"px")})])},s=Am(Le(n,o?i:{})),l=Cb(s);return a.set(l),{sink:s,mothership:l}})(),d=jC(e)?(()=>{const e={dom:{tag:"div",classes:["tox","tox-silver-sink","tox-silver-popup-sink","tox-tinymce-aux"].concat(c),attributes:{...tS.isRtl()?{dir:"rtl"}:{}}},behaviours:id([Qf.config({useFixed:()=>r.isDocked(p),getBounds:()=>t.getPopupSinkBounds()})])},o=Am(e),n=Cb(o);return l.set(n),{sink:o,mothership:n}})():(e=>(l.set(e.mothership),e))(s);i.dialogUi.set(s),i.popupUi.set(d),i.mainUi.set(o);return(t=>{const{mainUi:o,popupUi:i,uiMotherships:s}=t;le(sC(e),(t,o)=>{e.ui.registry.addGroupToolbarButton(o,t)});const{buttons:a,menuItems:l,contextToolbars:c,sidebars:d,views:h}=e.ui.registry.getAll(),m=IC(e),g={menuItems:l,menus:WC(e),menubar:hC(e),toolbar:m.getOrThunk(()=>mC(e)),allowToolbarGroups:u===Px.floating,buttons:a,sidebar:d,views:h};var f;f=o.outerContainer,e.addShortcut("alt+F9","focus menubar",()=>{TD.focusMenubar(f)}),e.addShortcut("alt+F10","focus toolbar",()=>{TD.focusToolbar(f)}),e.addCommand("ToggleToolbarDrawer",(e,t)=>{(null==t?void 0:t.skipFocus)?TD.toggleToolbarDrawerWithoutFocusing(f):TD.toggleToolbarDrawer(f)}),e.addQueryStateHandler("ToggleToolbarDrawer",()=>TD.isToolbarDrawerToggled(f)),((e,t,o)=>{const n=(e,n)=>{F([t,...o],t=>{t.broadcastEvent(e,n)})},r=(e,n)=>{F([t,...o],t=>{t.broadcastOn([e],n)})},i=e=>r(mb(),{target:e.target}),s=No(),a=Mo(s,"touchstart",i),l=Mo(s,"touchmove",e=>n(Zs(),e)),c=Mo(s,"touchend",e=>n($s(),e)),d=Mo(s,"mousedown",i),u=Mo(s,"mouseup",e=>{0===e.raw.button&&r(gb(),{target:e.target})}),h=e=>r(mb(),{target:ct(e.target)}),m=e=>{0===e.button&&r(gb(),{target:ct(e.target)})},p=()=>{F(e.editorManager.get(),t=>{e!==t&&t.dispatch("DismissPopups",{relatedTarget:e})})},g=e=>n(js(),Ro(e)),f=e=>{r(pb(),{}),n(Ws(),Ro(e))},v=xo(ct(e.getElement())),b=Bo(v,"scroll",o=>{requestAnimationFrame(()=>{if(null!=e.getContainer()){const r=JC(e,t.element).map(e=>[e.element,...e.others]).getOr([]);D(r,e=>wt(e,o.target))&&(e.dispatch("ElementScroll",{target:o.target.dom}),n(Qs(),o))}})}),y=()=>r(pb(),{}),w=t=>{t.state&&r(mb(),{target:ct(e.getContainer())})},_=e=>{r(mb(),{target:ct(e.relatedTarget.getContainer())})},x=t=>e.dispatch("focusin",t),C=t=>e.dispatch("focusout",t);e.on("PostRender",()=>{e.on("click",h),e.on("tap",h),e.on("mouseup",m),e.on("mousedown",p),e.on("ScrollWindow",g),e.on("ResizeWindow",f),e.on("ResizeEditor",y),e.on("AfterProgressState",w),e.on("DismissPopups",_),F([t,...o],e=>{e.element.dom.addEventListener("focusin",x),e.element.dom.addEventListener("focusout",C)})}),e.on("remove",()=>{e.off("click",h),e.off("tap",h),e.off("mouseup",m),e.off("mousedown",p),e.off("ScrollWindow",g),e.off("ResizeWindow",f),e.off("ResizeEditor",y),e.off("AfterProgressState",w),e.off("DismissPopups",_),F([t,...o],e=>{e.element.dom.removeEventListener("focusin",x),e.element.dom.removeEventListener("focusout",C)}),d.unbind(),a.unbind(),l.unbind(),c.unbind(),u.unbind(),b.unbind()}),e.on("detach",()=>{F([t,...o],zh),F([t,...o],e=>e.destroy())})})(e,o.mothership,s),r.setup(e,y.popup.shared,p),xI(e,y.popup),ZI(e,y.popup.shared.getSink,y.popup),(e=>{const{sidebars:t}=e.ui.registry.getAll();F(ie(t),o=>{const n=t[o],r=()=>ze(A.from(e.queryCommandValue("ToggleSidebar")),o);e.ui.registry.addToggleButton(o,{icon:n.icon,tooltip:n.tooltip,onAction:t=>{e.execCommand("ToggleSidebar",!1,o),t.setActive(r())},onSetup:t=>{t.setActive(r());const o=()=>t.setActive(r());return e.on("ToggleSidebar",o),()=>{e.off("ToggleSidebar",o)}},context:"any"})})})(e),JV(e,b,y.popup.shared),mI(e,c,i.sink,{backstage:y.popup}),qI(e,i.sink);const v={targetNode:e.getElement(),height:_(o.outerContainer)};return n.render(e,t,g,y.popup,v)})({popupUi:d,dialogUi:s,mainUi:o,uiMotherships:i.getUiMotherships()})}}},oL=e=>{const t=[],o={};return ae(e,(e,n)=>{e.fold(()=>{t.push(n)},e=>{o[n]=e})}),t.length>0?Ae.error(t):Ae.value(o)},nL=(e,t,o,n)=>{const r=db(Ay.sketch(r=>({dom:{tag:"div",classes:["tox-form"].concat(e.classes)},components:L(e.items,e=>VN(r,e,t,o,n))})));return{dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[r.asSpec()]}],behaviours:id([_h.config({mode:"acyclic",useTabstopAt:k(hR)}),(i=r,Im.config({find:i.getOpt})),zB(r,{postprocess:e=>oL(e).fold(e=>(console.error(e),{}),_)}),ud("dialog-body-panel",[Zc(ys(),(e,t)=>{e.getSystem().broadcastOn([bR],{newFocus:A.some(t.event.target)})})])])};var i},rL=(e,t)=>{dn(e,"height",t+"px"),dn(e,"flex-basis",t+"px")},iL=(e,t,o)=>{jn(e,'[role="dialog"]').each(e=>{Gn(e,'[role="tablist"]').each(n=>{o.get().map(o=>(dn(t,"height","0"),dn(t,"flex-basis","0"),Math.min(o,((e,t,o)=>{const n=uo(e).dom,r=jn(e,".tox-dialog-wrap").getOr(e);let i;i="fixed"===mn(r,"position")?Math.max(n.clientHeight,window.innerHeight):Math.max(n.offsetHeight,n.scrollHeight);const s=xn(t),a=t.dom.offsetLeft>=o.dom.offsetLeft+En(o)?Math.max(xn(o),s):s,l=parseInt(mn(e,"margin-top"),10)||0,c=parseInt(mn(e,"margin-bottom"),10)||0;return i-(xn(e)+l+c-a)})(e,t,n)))).each(e=>{rL(t,e)})})})},sL=e=>Gn(e,'[role="tabpanel"]'),aL="send-data-to-section",lL="send-data-to-view",cL=(e,t,o,n)=>{const r=we({}),i=e=>{const t=Yg.getValue(e),o=oL(t).getOr({}),n=r.get(),i=Le(n,o);r.set(i)},s=e=>{const t=r.get();Yg.setValue(e,t)},a=we(null),l=L(e.tabs,e=>({value:e.name,dom:{tag:"div",classes:["tox-dialog__body-nav-item"]},components:[Sm(o.shared.providers.translate(e.title))],view:()=>[Ay.sketch(r=>({dom:{tag:"div",classes:["tox-form"]},components:L(e.items,e=>VN(r,e,t,o,n)),formBehaviours:id([_h.config({mode:"acyclic",useTabstopAt:k(hR)}),ud("TabView.form.events",[Kc(s),Jc(i)]),ov.config({channels:ls([{key:aL,value:{onReceive:i}},{key:lL,value:{onReceive:s}}])})])}))]})),c=(e=>{const t=Ge(),o=[Kc(o=>{const n=o.element;sL(n).each(r=>{dn(r,"visibility","hidden"),o.getSystem().getByDom(r).toOptional().each(o=>{const n=((e,t,o)=>L(e,(n,r)=>{Qh.set(o,e[r].view());const i=t.dom.getBoundingClientRect();return Qh.set(o,[]),i.height}))(e,r,o),i=(e=>te(Q(e,(e,t)=>e>t?-1:e<t?1:0)))(n);i.fold(t.clear,t.set)}),iL(n,r,t),bn(r,"visibility"),((e,t)=>{te(e).each(e=>Ox.showTab(t,e.value))})(e,o),requestAnimationFrame(()=>{iL(n,r,t)})})}),Zc(Ws(),e=>{const o=e.element;sL(o).each(e=>{iL(o,e,t)})}),Zc(RB,(e,o)=>{const n=e.element;sL(n).each(e=>{const o=Io(xo(e));dn(e,"visibility","hidden");const r=gn(e,"height").map(e=>parseInt(e,10));bn(e,"height"),bn(e,"flex-basis");const i=e.dom.getBoundingClientRect().height;r.forall(e=>i>e)?(t.set(i),iL(n,e,t)):r.each(t=>{rL(e,t)}),bn(e,"visibility"),o.each(Vo)})})];return{extraEvents:o,selectFirst:!1}})(l);return Ox.sketch({dom:{tag:"div",classes:["tox-dialog__body"]},onChangeTab:(e,t,o)=>{const n=Yg.getValue(t);Dc(e,BB,{name:n,oldName:a.get()}),a.set(n)},tabs:l,components:[Ox.parts.tabbar({dom:{tag:"div",classes:["tox-dialog__body-nav"]},components:[xx.parts.tabs({})],markers:{tabClass:"tox-tab",selectedClass:"tox-dialog__body-nav-item--active"},tabbarBehaviours:id([Hv.config({})])}),Ox.parts.tabview({dom:{tag:"div",classes:["tox-dialog__body-content"]}})],selectFirst:c.selectFirst,tabSectionBehaviours:id([ud("tabpanel",c.extraEvents),_h.config({mode:"acyclic"}),Im.config({find:e=>te(Ox.getViewItems(e))}),HB(A.none(),e=>(e.getSystem().broadcastOn([aL],{}),r.get()),(e,t)=>{r.set(t),e.getSystem().broadcastOn([lL],{})})])})},dL=(e,t,o,n,r,i)=>({dom:{tag:"div",classes:["tox-dialog__content-js"],attributes:{...o.map(e=>({id:e})).getOr({}),...r?{"aria-live":"polite"}:{}}},components:[],behaviours:id([LB(0),sv.config({channel:`${gR}-${t}`,updateState:(e,t)=>A.some({isTabPanel:()=>"tabpanel"===t.body.type}),renderComponents:e=>{const t=e.body;return"tabpanel"===t.type?[cL(t,e.initialData,n,i)]:[nL(t,e.initialData,n,i)]},initialData:e})])}),uL=Ux.deviceType.isTouch(),hL=(e,t)=>({dom:{tag:"div",styles:{display:"none"},classes:["tox-dialog__header"]},components:[e,t]}),mL=(e,t)=>rw.parts.close(Tb.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":t.translate("Close")}},action:e,buttonBehaviours:id([Hv.config({})])})),pL=()=>rw.parts.title({dom:{tag:"div",classes:["tox-dialog__title"],innerHtml:"",styles:{display:"none"}}}),gL=(e,t)=>rw.parts.body({dom:{tag:"div",classes:["tox-dialog__body"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-content"]},components:[{dom:cb(`<p>${eS(t.translate(e))}</p>`)}]}]}),fL=e=>rw.parts.footer({dom:{tag:"div",classes:["tox-dialog__footer"]},components:e}),vL=(e,t)=>[ig.sketch({dom:{tag:"div",classes:["tox-dialog__footer-start"]},components:e}),ig.sketch({dom:{tag:"div",classes:["tox-dialog__footer-end"]},components:t})],bL=e=>{const t="tox-dialog",o=t+"-wrap",n=o+"__backdrop",r=t+"__disable-scroll";return rw.sketch({lazySink:e.lazySink,onEscape:t=>(e.onEscape(t),A.some(!0)),useTabstopAt:e=>!hR(e),firstTabstop:e.firstTabstop,dom:{tag:"div",classes:[t].concat(e.extraClasses),styles:{position:"relative",...e.extraStyles}},components:[e.header,e.body,...e.footer.toArray()],parts:{blocker:{dom:cb(`<div class="${o}"></div>`),components:[{dom:{tag:"div",classes:uL?[n,n+"--opaque"]:[n]}}]}},dragBlockClass:o,modalBehaviours:id([fd.config({}),ud("dialog-events",e.dialogEvents.concat([Xc(ys(),(e,t)=>{Vm.isBlocked(e)||_h.focusIn(e)}),Zc(Ks(),(e,t)=>{e.getSystem().broadcastOn([bR],{newFocus:t.event.newFocus})})])),ud("scroll-lock",[Kc(()=>{or(sn(),r)}),Jc(()=>{rr(sn(),r)})]),...e.extraBehaviours]),eventOrder:{[Ps()]:["dialog-events"],[qs()]:["scroll-lock","dialog-events","alloy.base.behaviour"],[Gs()]:["alloy.base.behaviour","dialog-events","scroll-lock"],...e.eventOrder}})},yL=e=>Tb.sketch({dom:{tag:"button",classes:["tox-button","tox-button--icon","tox-button--naked"],attributes:{type:"button","aria-label":e.translate("Close"),"data-mce-name":"close"}},buttonBehaviours:id([Hv.config({}),ab.config(e.tooltips.getConfig({tooltipText:e.translate("Close")}))]),components:[dS("close",{tag:"span",classes:["tox-icon"]},e.icons)],action:e=>{Vc(e,TB)}}),wL=(e,t,o,n)=>({dom:{tag:"h1",classes:["tox-dialog__title"],attributes:{...o.map(e=>({id:e})).getOr({})}},components:[],behaviours:id([sv.config({channel:`${pR}-${t}`,initialData:e,renderComponents:e=>[Sm(n.translate(e.title))]})])}),_L=()=>({dom:cb('<div class="tox-dialog__draghandle"></div>')}),xL=(e,t,o)=>((e,t,o)=>{const n=rw.parts.title(wL(e,t,A.none(),o)),r=rw.parts.draghandle(_L()),i=rw.parts.close(yL(o)),s=[n].concat(e.draggable?[r]:[]).concat([i]);return ig.sketch({dom:cb('<div class="tox-dialog__header"></div>'),components:s})})({title:o.shared.providers.translate(e),draggable:o.dialog.isDraggableModal()},t,o.shared.providers),CL=(e,t,o,n)=>({dom:{tag:"div",classes:["tox-dialog__busy-spinner"],attributes:{"aria-label":o.translate(e)},styles:{left:"0px",right:"0px",bottom:"0px",top:`${n.getOr(0)}px`,position:"absolute"}},behaviours:t,components:[{dom:cb('<div class="tox-spinner"><div></div><div></div><div></div></div>')}]}),kL=(e,t,o)=>({onClose:()=>o.closeWindow(),onBlock:o=>{const n=Gn(e().element,".tox-dialog__header").map(e=>xn(e));rw.setBusy(e(),(e,r)=>CL(o.message,r,t,n))},onUnblock:()=>{rw.setIdle(e())}}),SL="tox-dialog--fullscreen",TL="tox-dialog--width-lg",EL="tox-dialog--width-md",OL=e=>{switch(e){case"large":return A.some(TL);case"medium":return A.some(EL);default:return A.none()}},AL=(e,t)=>{const o=ct(t.element.dom);ir(o,SL)||(ar(o,[TL,EL]),OL(e).each(e=>or(o,e)))},ML=(e,t)=>{const o=ct(e.element.dom),n=lr(o),r=$(n,e=>e===TL||e===EL).or(OL(t));((e,t)=>{F(t,t=>{((e,t)=>{const o=Jn(e)?e.dom.classList.toggle(t):((e,t)=>V(Qn(e),t)?tr(e,t):er(e,t))(e,t);nr(e)})(e,t)})})(o,[SL,...r.toArray()])},BL=(e,t,o)=>Am(bL({...e,firstTabstop:1,lazySink:o.shared.getSink,extraBehaviours:[ZB({}),...e.extraBehaviours],onEscape:e=>{Vc(e,TB)},dialogEvents:t,eventOrder:{[Ds()]:[sv.name(),ov.name()],[qs()]:["scroll-lock",sv.name(),"messages","dialog-events","alloy.base.behaviour"],[Gs()]:["alloy.base.behaviour","dialog-events","messages",sv.name(),"scroll-lock"]}})),RL=(e,t={})=>L(e,e=>"menu"===e.type?(e=>{const o=L(e.items,e=>{const o=fe(t,e.name).getOr(we(!1));return{...e,storage:o}});return{...e,items:o}})(e):e),NL=e=>Z(e,(e,t)=>"menu"===t.type?Z(t.items,(e,t)=>(e[t.name]=t.storage,e),e):e,{}),VL=(e,t)=>[qc(ys(),uR),e(SB,(e,o,n,r)=>{Po(r.element)&&Io(xo(r.element)).each(Do),t.onClose(),o.onClose()}),e(TB,(e,t,o,n)=>{t.onCancel(e),Vc(n,SB)}),Zc(MB,(e,o)=>t.onUnblock()),Zc(AB,(e,o)=>t.onBlock(o.event))],DL=(e,t,o)=>{const n=(t,o)=>Zc(t,(t,n)=>{r(t,(r,i)=>{o(e(),r,n.event,t)})}),r=(e,t)=>{sv.getState(e).get().each(o=>{t(o.internalDialog,e)})};return[...VL(n,t),n(OB,(e,t)=>t.onSubmit(e)),n(CB,(e,t,o)=>{t.onChange(e,{name:o.name})}),n(EB,(e,t,n,r)=>{const i=()=>r.getSystem().isConnected()?_h.focusIn(r):void 0,s=e=>Yo(e,"disabled")||Go(e,"aria-disabled").exists(e=>"true"===e),a=xo(r.element),l=Io(a);t.onAction(e,{name:n.name,value:n.value}),Io(a).fold(i,e=>{s(e)||l.exists(t=>_t(e,t)&&s(t))?i():o().toOptional().filter(t=>!_t(t.element,e)).each(i)})}),n(BB,(e,t,o)=>{t.onTabChange(e,{newTabName:o.name,oldTabName:o.oldName})}),Jc(t=>{const o=e();Yg.setValue(t,o.getData())})]},PL=(e,t)=>{const o=t.map(e=>e.footerButtons).getOr([]),n=z(o,e=>"start"===e.align),r=(e,t)=>ig.sketch({dom:{tag:"div",classes:[`tox-dialog__footer-${e}`]},components:L(t,e=>e.memento.asSpec())});return[r("start",n.pass),r("end",n.fail)]},IL=(e,t,o)=>({dom:cb('<div class="tox-dialog__footer"></div>'),components:[],behaviours:id([sv.config({channel:`${fR}-${t}`,initialData:e,updateState:(e,t)=>{const n=L(t.buttons,e=>{const t=db(((e,t)=>wN(e,e.type,t))(e,o));return{name:e.name,align:e.align,memento:t}});return A.some({lookupByName:t=>((e,t,o)=>$(t,e=>e.name===o).bind(t=>t.memento.getOpt(e)))(e,n,t),footerButtons:n})},renderComponents:PL})])}),LL=(e,t,o)=>rw.parts.footer(IL(e,t,o)),FL=(e,t)=>{if(e.getRoot().getSystem().isConnected()){const o=Im.getCurrent(e.getFormWrapper()).getOr(e.getFormWrapper());return Ay.getField(o,t).orThunk(()=>{const o=e.getFooter().bind(e=>sv.getState(e).get());return o.bind(e=>e.lookupByName(t))})}return A.none()},zL=(e,t,o)=>{const n=t=>{const o=e.getRoot();o.getSystem().isConnected()&&t(o)},r={getData:()=>{const t=e.getRoot(),n=t.getSystem().isConnected()?e.getFormWrapper():t;return{...Yg.getValue(n),...le(o,e=>e.get())}},setData:t=>{n(n=>{const i=r.getData(),s=Le(i,t),a=((e,t)=>{const o=e.getRoot();return sv.getState(o).get().map(e=>Ei(Ti("data",e.dataValidator,t))).getOr(t)})(e,s),l=e.getFormWrapper();Yg.setValue(l,a),ae(o,(e,t)=>{ve(s,t)&&e.set(s[t])})})},setEnabled:(t,o)=>{FL(e,t).each(o?tp.enable:tp.disable)},focus:t=>{FL(e,t).each(fd.focus)},block:e=>{if(!i(e))throw new Error("The dialogInstanceAPI.block function should be passed a blocking message of type string as an argument");n(t=>{Dc(t,AB,{message:e})})},unblock:()=>{n(e=>{Vc(e,MB)})},showTab:t=>{n(o=>{const n=e.getBody();sv.getState(n).get().exists(e=>e.isTabPanel())&&Im.getCurrent(n).each(e=>{Ox.showTab(e,t)})})},redial:i=>{n(n=>{const s=e.getId(),a=t(i),l=RL(a.internalDialog.buttons,o);n.getSystem().broadcastOn([`${mR}-${s}`],a),n.getSystem().broadcastOn([`${pR}-${s}`],a.internalDialog),n.getSystem().broadcastOn([`${gR}-${s}`],a.internalDialog),n.getSystem().broadcastOn([`${fR}-${s}`],{...a.internalDialog,buttons:l}),r.setData(a.initialData)})},close:()=>{n(e=>{Vc(e,SB)})},toggleFullscreen:e.toggleFullscreen};return r},HL=(e,t,o,n=!1,r)=>{const i=Pe("dialog"),s=Pe("dialog-label"),a=Pe("dialog-content"),l=e.internalDialog,c=we(l.size),d=OL(c.get()).toArray(),u=db(((e,t,o,n)=>ig.sketch({dom:cb('<div class="tox-dialog__header"></div>'),components:[wL(e,t,A.some(o),n),_L(),yL(n)],containerBehaviours:id([Eg.config({mode:"mouse",blockerClass:"blocker",getTarget:e=>Yn(e,'[role="dialog"]').getOrDie(),snaps:{getSnapPoints:()=>[],leftAttr:"data-drag-left",topAttr:"data-drag-top"},onDrag:(e,t)=>{e.getSystem().broadcastOn([pb()],{target:t})}})])}))({title:l.title,draggable:!0},i,s,o.shared.providers)),h=db(((e,t,o,n,r,i)=>dL(e,t,A.some(o),n,r,i))({body:l.body,initialData:l.initialData},i,a,o,n,e=>FL(y,e))),m=RL(l.buttons),p=NL(m),g=$e(0!==m.length,db(((e,t,o)=>IL(e,t,o))({buttons:m},i,o))),f=DL(()=>_,{onBlock:e=>{Vm.block(b,(t,n)=>{const r=u.getOpt(b).map(e=>xn(e.element));return CL(e.message,n,o.shared.providers,r)})},onUnblock:()=>{Vm.unblock(b)},onClose:()=>t.closeWindow()},o.shared.getSink),v=Kt().os,b=Am({dom:{tag:"div",classes:["tox-dialog","tox-dialog-inline",...d],attributes:{role:"dialog",...v.isMacOS()?{"aria-label":l.title}:{"aria-labelledby":s}}},eventOrder:{[Ds()]:[sv.name(),ov.name()],[Ps()]:["execute-on-form"],[qs()]:["reflecting","execute-on-form"]},behaviours:id([_h.config({mode:"cyclic",onEscape:e=>(Vc(e,SB),A.some(!0)),useTabstopAt:e=>!hR(e)&&("button"!==eo(e)||"disabled"!==qo(e,"disabled")),firstTabstop:1}),sv.config({channel:`${mR}-${i}`,updateState:(e,t)=>(c.set(t.internalDialog.size),AL(t.internalDialog.size,e),r(),A.some(t)),initialData:e}),fd.config({}),ud("execute-on-form",f.concat([Xc(ys(),(e,t)=>{_h.focusIn(e)}),Zc(Ks(),(e,t)=>{e.getSystem().broadcastOn([bR],{newFocus:t.event.newFocus})})])),Vm.config({getRoot:()=>A.some(b)}),Qh.config({}),ZB({})]),components:[u.asSpec(),h.asSpec(),...g.map(e=>e.asSpec()).toArray()]}),y={getId:w(i),getRoot:w(b),getFooter:()=>g.map(e=>e.get(b)),getBody:()=>h.get(b),getFormWrapper:()=>{const e=h.get(b);return Im.getCurrent(e).getOr(e)},toggleFullscreen:()=>{ML(b,c.get())}},_=zL(y,t.redial,p);return{dialog:b,instanceApi:_}};var UL=window.mailpoetTinymce.util.Tools.resolve("window.mailpoetTinymce.util.URI");const ZL=["insertContent","setContent","execCommand","close","block","unblock"],$L=e=>s(e)&&-1!==ZL.indexOf(e.mceAction),jL=(e,t,o,n)=>{const r=Pe("dialog"),a=xL(e.title,r,n),l=(e=>{const t={dom:{tag:"div",classes:["tox-dialog__content-js"]},components:[{dom:{tag:"div",classes:["tox-dialog__body-iframe"]},components:[cR(A.none(),{dom:{tag:"iframe",attributes:{src:e.url}},behaviours:id([Hv.config({}),fd.config({})])})]}],behaviours:id([_h.config({mode:"acyclic",useTabstopAt:k(hR)})])};return rw.parts.body(t)})(e),c=e.buttons.bind(e=>0===e.length?A.none():A.some(LL({buttons:e},r,n))),u=((e,t)=>{const o=(e,t)=>Zc(e,(e,o)=>{n(e,(n,r)=>{t(w,n,o.event,e)})}),n=(e,t)=>{sv.getState(e).get().each(o=>{t(o,e)})};return[...VL(o,t),o(EB,(e,t,o)=>{t.onAction(e,{name:o.name})})]})(0,kL(()=>y,n.shared.providers,t)),h={...e.height.fold(()=>({}),e=>({height:e+"px","max-height":e+"px"})),...e.width.fold(()=>({}),e=>({width:e+"px","max-width":e+"px"}))},p=e.width.isNone()&&e.height.isNone()?["tox-dialog--width-lg"]:[],g=new UL(e.url,{base_uri:new UL(window.location.href)}),f=`${g.protocol}://${g.host}${g.port?":"+g.port:""}`,v=qe(),b=[sv.config({channel:`${mR}-${r}`,updateState:(e,t)=>A.some(t),initialData:e}),ud("messages",[Kc(()=>{const t=Mo(ct(window),"message",t=>{if(g.isSameOrigin(new UL(t.raw.origin))){const n=t.raw.data;$L(n)?((e,t,o)=>{switch(o.mceAction){case"insertContent":e.insertContent(o.content);break;case"setContent":e.setContent(o.content);break;case"execCommand":const n=!!d(o.ui)&&o.ui;e.execCommand(o.cmd,n,o.value);break;case"close":t.close();break;case"block":t.block(o.message);break;case"unblock":t.unblock()}})(o,w,n):(e=>!$L(e)&&s(e)&&ve(e,"mceAction"))(n)&&e.onMessage(w,n)}});v.set(t)}),Jc(v.clear)]),ov.config({channels:{[vR]:{onReceive:(e,t)=>{Gn(e.element,"iframe").each(e=>{const o=e.dom.contentWindow;m(o)&&o.postMessage(t,f)})}}}})],y=BL({id:r,header:a,body:l,footer:c,extraClasses:p,extraBehaviours:b,extraStyles:h},u,n),w=(e=>{const t=t=>{e.getSystem().isConnected()&&t(e)};return{block:e=>{if(!i(e))throw new Error("The urlDialogInstanceAPI.block function should be passed a blocking message of type string as an argument");t(t=>{Dc(t,AB,{message:e})})},unblock:()=>{t(e=>{Vc(e,MB)})},close:()=>{t(e=>{Vc(e,SB)})},sendMessage:e=>{t(t=>{t.getSystem().broadcastOn([vR],e)})}}})(y);return{dialog:y,instanceApi:w}},WL=(e,t)=>Ei(Ti("data",t,e)),qL=e=>pr(e,".tox-alert-dialog")||pr(e,".tox-confirm-dialog"),GL=(e,t,o,n)=>t&&o?[]:[Op.config({contextual:{lazyContext:()=>A.some(Dr(ct(e.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition",onHide:n},modes:["top"],lazyViewport:t=>JC(e,t.element).map(e=>({bounds:QC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Nn(e.element).top})})).getOrThunk(()=>({bounds:Lr(),optScrollEnv:A.none()}))})],YL=e=>{const t=e.editor,o=$C(t),n=(e=>{const t=e.shared;return{open:(o,n)=>{const r=()=>{rw.hide(l),n()},i=db(wN({context:"any",name:"close-alert",text:"OK",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"cancel",e)),s=pL(),a=mL(r,t.providers),l=Am(bL({lazySink:()=>t.getSink(),header:hL(s,a),body:gL(o,t.providers),footer:A.some(fL(vL([],[i.asSpec()]))),onEscape:r,extraClasses:["tox-alert-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Zc(TB,r)],eventOrder:{}}));rw.show(l);const c=i.get(l);fd.focus(c)}}})(e.backstages.dialog),r=(e=>{const t=e.shared;return{open:(o,n)=>{const r=e=>{rw.hide(c),n(e)},i=db(wN({context:"any",name:"yes",text:"Yes",primary:!0,buttonType:A.some("primary"),align:"end",enabled:!0,icon:A.none()},"submit",e)),s=wN({context:"any",name:"no",text:"No",primary:!1,buttonType:A.some("secondary"),align:"end",enabled:!0,icon:A.none()},"cancel",e),a=pL(),l=mL(()=>r(!1),t.providers),c=Am(bL({lazySink:()=>t.getSink(),header:hL(a,l),body:gL(o,t.providers),footer:A.some(fL(vL([],[s,i.asSpec()]))),onEscape:()=>r(!1),extraClasses:["tox-confirm-dialog"],extraBehaviours:[],extraStyles:{},dialogEvents:[Zc(TB,()=>r(!1)),Zc(OB,()=>r(!0))],eventOrder:{}}));rw.show(c);const d=i.get(c);fd.focus(d)}}})(e.backstages.dialog),i=(t,o)=>pO.open((t,n,r)=>{const i=n,s=((e,t,o)=>{const n=Pe("dialog"),r=e.internalDialog,i=xL(r.title,n,o),s=we(r.size),a=OL(s.get()).toArray(),l=((e,t,o,n)=>{const r=dL(e,t,A.none(),o,!1,n);return rw.parts.body(r)})({body:r.body,initialData:r.initialData},n,o,e=>FL(g,e)),c=RL(r.buttons),d=NL(c),u=$e(0!==c.length,LL({buttons:c},n,o)),h=DL(()=>f,kL(()=>p,o.shared.providers,t),o.shared.getSink),m={id:n,header:i,body:l,footer:u,extraClasses:a,extraBehaviours:[sv.config({channel:`${mR}-${n}`,updateState:(e,t)=>(s.set(t.internalDialog.size),AL(t.internalDialog.size,e),A.some(t)),initialData:e})],extraStyles:{}},p=BL(m,h,o),g={getId:w(n),getRoot:w(p),getBody:()=>rw.getBody(p),getFooter:()=>rw.getFooter(p),getFormWrapper:()=>{const e=rw.getBody(p);return Im.getCurrent(e).getOr(e)},toggleFullscreen:()=>{ML(p,s.get())}},f=zL(g,t.redial,d);return{dialog:p,instanceApi:f}})({dataValidator:r,initialData:i,internalDialog:t},{redial:pO.redial,closeWindow:()=>{rw.hide(s.dialog),o(s.instanceApi)}},e.backstages.dialog);return rw.show(s.dialog),s.instanceApi.setData(i),s.instanceApi},t),s=(n,r,i,s)=>pO.open((n,a,l)=>{const c=WL(a,l),d=Ge(),u=e.backstages.popup.shared.header.isPositionedAtTop(),h=()=>d.on(e=>{Gy.reposition(e),o&&u||Op.refresh(e)}),m=HL({dataValidator:l,initialData:c,internalDialog:n},{redial:pO.redial,closeWindow:()=>{d.on(Gy.hide),t.off("ResizeEditor",h),t.off("ScrollWindow",p),d.clear(),i(m.instanceApi)}},e.backstages.popup,s.ariaAttrs,h),p=()=>m.dialog.getSystem().broadcastOn([pb()],{target:m.dialog.element}),g=Am(Gy.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:s.persistent?{event:"doNotDismissYet"}:{},...u?{}:{fireRepositionEventInstead:{}},inlineBehaviours:id([ud("window-manager-inline-events",[Zc(Ys(),(e,t)=>{Vc(m.dialog,TB)})]),...GL(t,o,u,()=>m.dialog.getSystem().broadcastOn([mb()],{target:m.dialog.element}))]),isExtraPart:(e,t)=>qL(t)}));return d.set(g),Gy.showWithinBounds(g,Mm(m.dialog),{anchor:r},()=>{const e=t.inline?sn():ct(t.getContainer()),o=Dr(e);return A.some(o)}),o&&u||(Op.refresh(g),t.on("ResizeEditor",h)),t.on("ScrollWindow",p),m.instanceApi.setData(c),_h.focusIn(m.dialog),m.instanceApi},n),a=(o,n,r,i)=>pO.open((o,s,a)=>{const l=WL(s,a),c=Ge(),d=e.backstages.popup.shared.header.isPositionedAtTop(),u=()=>c.on(e=>{Gy.reposition(e),Op.refresh(e)}),h=HL({dataValidator:a,initialData:l,internalDialog:o},{redial:pO.redial,closeWindow:()=>{c.on(Gy.hide),t.off("ResizeEditor ScrollWindow ElementScroll",u),c.clear(),r(h.instanceApi)}},e.backstages.popup,i.ariaAttrs,u),m=Am(Gy.sketch({lazySink:e.backstages.popup.shared.getSink,dom:{tag:"div",classes:[]},fireDismissalEventInstead:i.persistent?{event:"doNotDismissYet"}:{},...d?{}:{fireRepositionEventInstead:{}},inlineBehaviours:id([ud("window-manager-inline-events",[Zc(Ys(),(e,t)=>{Vc(h.dialog,TB)})]),Op.config({contextual:{lazyContext:()=>A.some(Dr(ct(t.getContentAreaContainer()))),fadeInClass:"tox-dialog-dock-fadein",fadeOutClass:"tox-dialog-dock-fadeout",transitionClass:"tox-dialog-dock-transition"},modes:["top","bottom"],lazyViewport:e=>JC(t,e.element).map(e=>({bounds:QC(e),optScrollEnv:A.some({currentScrollTop:e.element.dom.scrollTop,scrollElmTop:Nn(e.element).top})})).getOrThunk(()=>({bounds:Lr(),optScrollEnv:A.none()}))})]),isExtraPart:(e,t)=>qL(t)}));return c.set(m),Gy.showWithinBounds(m,Mm(h.dialog),{anchor:n},()=>e.backstages.popup.shared.getSink().toOptional().bind(e=>{const o=JC(t,e.element).map(e=>QC(e)).getOr(Lr()),n=Dr(ct(t.getContentAreaContainer())),r=Ir(n,o);return A.some(Vr(r.x,r.y,r.width,r.height-15))})),Op.refresh(m),t.on("ResizeEditor ScrollWindow ElementScroll ResizeWindow",u),h.instanceApi.setData(l),_h.focusIn(h.dialog),h.instanceApi},o);return{open:(t,o,n)=>{if(!u(o)){if("toolbar"===o.inline)return s(t,e.backstages.popup.shared.anchors.inlineDialog(),n,o);if("bottom"===o.inline)return a(t,e.backstages.popup.shared.anchors.inlineBottomDialog(),n,o);if("cursor"===o.inline)return s(t,e.backstages.popup.shared.anchors.cursor(),n,o)}return i(t,n)},openUrl:(o,n)=>((o,n)=>pO.openUrl(o=>{const r=jL(o,{closeWindow:()=>{rw.hide(r.dialog),n(r.instanceApi)}},t,e.backstages.dialog);return rw.show(r.dialog),r.instanceApi},o))(o,n),alert:(e,t)=>{n.open(e,t)},close:e=>{e.close()},confirm:(e,t)=>{r.open(e,t)}}},XL=e=>{jx(e),(e=>{const t=e.options.register,o=e=>{return f(e,i)?{value:(t=e,MM(t.map((e,t)=>t%2==0?"#"+(e=>{return(t=e,GA(t)?A.some({value:YA(t)}):A.none()).orThunk(()=>dM(e).map(KA)).getOrThunk(()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const o=t.getContext("2d");o.clearRect(0,0,t.width,t.height),o.fillStyle="#FFFFFF",o.fillStyle=e,o.fillRect(0,0,1,1);const n=o.getImageData(0,0,1,1).data,r=n[0],i=n[1],s=n[2],a=n[3];return KA(iM(r,i,s,a))});var t})(e).value:e))),valid:!0}:{valid:!1,message:"Must be an array of strings."};var t},n=e=>g(e)&&e>0?{value:e,valid:!0}:{valid:!1,message:"Must be a positive number."};t("color_map",{processor:o,default:["#BFEDD2","Light Green","#FBEEB8","Light Yellow","#F8CAC6","Light Red","#ECCAFA","Light Purple","#C2E0F4","Light Blue","#2DC26B","Green","#F1C40F","Yellow","#E03E2D","Red","#B96AD9","Purple","#3598DB","Blue","#169179","Dark Turquoise","#E67E23","Orange","#BA372A","Dark Red","#843FA1","Dark Purple","#236FA1","Dark Blue","#ECF0F1","Light Gray","#CED4D9","Medium Gray","#95A5A6","Gray","#7E8C8D","Dark Gray","#34495E","Navy Blue","#000000","Black","#ffffff","White"]}),t("color_map_raw",{processor:e=>f(e,i)?{value:MM(e),valid:!0}:{valid:!1,message:"Must be an array of strings."}}),t("color_map_background",{processor:o}),t("color_map_foreground",{processor:o}),t("color_cols",{processor:n,default:VM(e)}),t("color_cols_foreground",{processor:n,default:DM(e,OM)}),t("color_cols_background",{processor:n,default:DM(e,AM)}),t("custom_colors",{processor:"boolean",default:!0}),t("color_default_foreground",{processor:"string",default:RM}),t("color_default_background",{processor:"string",default:RM})})(e),(e=>{const t=e.options.register;t("contextmenu_avoid_overlap",{processor:"string",default:""}),t("contextmenu_never_use_native",{processor:"boolean",default:!1}),t("contextmenu",{processor:e=>!1===e?{value:[],valid:!0}:i(e)||f(e,i)?{value:CI(e),valid:!0}:{valid:!1,message:"Must be false or a string."},default:"link linkchecker image editimage table spellchecker configurepermanentpen"})})(e)};Lx.add("silver",e=>{XL(e);let t=()=>Lr();const{dialogs:o,popups:n,renderUI:r}=tL(e,{getPopupSinkBounds:()=>t()});vB(e,n.backstage.shared);const i=YL({editor:e,backstages:{popup:n.backstage,dialog:o.backstage}}),s=Ge();return{renderUI:()=>{const o=r();return JC(e,n.getMothership().element).each(e=>{t=()=>QC(e)}),o},getWindowManagerImpl:w(i),getNotificationManagerImpl:()=>mS(e,{backstage:n.backstage},n.getMothership(),s),getPromotionElement:()=>Gn(ct(e.getContainer()),".tox-promotion").map(e=>e.dom).getOrNull()}})}()},78774(e){!function(){"use strict";var t=function(e){if(null===e)return"null";if(void 0===e)return"undefined";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t},o=function(e){return{eq:e}},n=o(function(e,t){return e===t}),r=function(e){return o(function(t,o){if(t.length!==o.length)return!1;for(var n=t.length,r=0;r<n;r++)if(!e.eq(t[r],o[r]))return!1;return!0})},i=function(e){return o(function(t,i){var s=Object.keys(t),a=Object.keys(i);if(!function(e,t){return function(e,t){return o(function(o,n){return e.eq(t(o),t(n))})}(r(e),function(e){return function(e,t){return Array.prototype.slice.call(e).sort(t)}(e,t)})}(n).eq(s,a))return!1;for(var l=s.length,c=0;c<l;c++){var d=s[c];if(!e.eq(t[d],i[d]))return!1}return!0})},s=o(function(e,o){if(e===o)return!0;var n=t(e);return n===t(o)&&(function(e){return-1!==["undefined","boolean","number","string","function","xml","null"].indexOf(e)}(n)?e===o:"array"===n?r(s).eq(e,o):"object"===n&&i(s).eq(e,o))});const a=Object.getPrototypeOf,l=(e,t,o)=>{var n;return!!o(e,t.prototype)||(null===(n=e.constructor)||void 0===n?void 0:n.name)===t.name},c=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&l(e,String,(e,t)=>t.isPrototypeOf(e))?"string":t})(t)===e,d=e=>t=>typeof t===e,u=e=>t=>e===t,h=(e,t)=>p(e)&&l(e,t,(e,t)=>a(e)===t),m=c("string"),p=c("object"),g=e=>h(e,Object),f=c("array"),v=u(null),b=d("boolean"),y=u(void 0),w=e=>null==e,_=e=>!w(e),x=d("function"),C=d("number"),k=(e,t)=>{if(f(e)){for(let o=0,n=e.length;o<n;++o)if(!t(e[o]))return!1;return!0}return!1},S=()=>{},T=(e,t)=>(...o)=>e(t.apply(null,o)),E=(e,t)=>o=>e(t(o)),O=e=>()=>e,A=e=>e,M=(e,t)=>e===t;function B(e,...t){return(...o)=>{const n=t.concat(o);return e.apply(null,n)}}const R=e=>t=>!e(t),N=e=>()=>{throw new Error(e)},V=e=>e(),D=e=>{e()},P=O(!1),I=O(!0);class L{constructor(e,t){this.tag=e,this.value=t}static some(e){return new L(!0,e)}static none(){return L.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?L.some(e(this.value)):L.none()}bind(e){return this.tag?e(this.value):L.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:L.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return _(e)?L.some(e):L.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}L.singletonNone=new L(!1);const F=Array.prototype.slice,z=Array.prototype.indexOf,H=Array.prototype.push,U=(e,t)=>z.call(e,t),Z=(e,t)=>U(e,t)>-1,$=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return!0;return!1},j=(e,t)=>{const o=e.length,n=new Array(o);for(let r=0;r<o;r++){const o=e[r];n[r]=t(o,r)}return n},W=(e,t)=>{for(let o=0,n=e.length;o<n;o++)t(e[o],o)},q=(e,t)=>{for(let o=e.length-1;o>=0;o--)t(e[o],o)},G=(e,t)=>{const o=[],n=[];for(let r=0,i=e.length;r<i;r++){const i=e[r];(t(i,r)?o:n).push(i)}return{pass:o,fail:n}},Y=(e,t)=>{const o=[];for(let n=0,r=e.length;n<r;n++){const r=e[n];t(r,n)&&o.push(r)}return o},X=(e,t,o)=>(q(e,(e,n)=>{o=t(o,e,n)}),o),K=(e,t,o)=>(W(e,(e,n)=>{o=t(o,e,n)}),o),J=(e,t,o)=>{for(let n=0,r=e.length;n<r;n++){const r=e[n];if(t(r,n))return L.some(r);if(o(r,n))break}return L.none()},Q=(e,t)=>J(e,t,P),ee=(e,t)=>{for(let o=0,n=e.length;o<n;o++)if(t(e[o],o))return L.some(o);return L.none()},te=e=>{const t=[];for(let o=0,n=e.length;o<n;++o){if(!f(e[o]))throw new Error("Arr.flatten item "+o+" was not an array, input: "+e);H.apply(t,e[o])}return t},oe=(e,t)=>te(j(e,t)),ne=(e,t)=>{for(let o=0,n=e.length;o<n;++o)if(!0!==t(e[o],o))return!1;return!0},re=e=>{const t=F.call(e,0);return t.reverse(),t},ie=(e,t)=>Y(e,e=>!Z(t,e)),se=(e,t)=>{const o={};for(let n=0,r=e.length;n<r;n++){const r=e[n];o[String(r)]=t(r,n)}return o},ae=(e,t)=>{const o=F.call(e,0);return o.sort(t),o},le=(e,t)=>t>=0&&t<e.length?L.some(e[t]):L.none(),ce=e=>le(e,0),de=e=>le(e,e.length-1),ue=x(Array.from)?Array.from:e=>F.call(e),he=(e,t)=>{for(let o=0;o<e.length;o++){const n=t(e[o],o);if(n.isSome())return n}return L.none()},me=(e,t)=>{const o=[],n=x(t)?e=>$(o,o=>t(o,e)):e=>Z(o,e);for(let t=0,r=e.length;t<r;t++){const r=e[t];n(r)||o.push(r)}return o},pe=Object.keys,ge=Object.hasOwnProperty,fe=(e,t)=>{const o=pe(e);for(let n=0,r=o.length;n<r;n++){const r=o[n];t(e[r],r)}},ve=(e,t)=>be(e,(e,o)=>({k:o,v:t(e,o)})),be=(e,t)=>{const o={};return fe(e,(e,n)=>{const r=t(e,n);o[r.k]=r.v}),o},ye=e=>(t,o)=>{e[o]=t},we=(e,t,o,n)=>{fe(e,(e,r)=>{(t(e,r)?o:n)(e,r)})},_e=(e,t)=>{const o={};return we(e,t,ye(o),S),o},xe=(e,t)=>{const o=[];return fe(e,(e,n)=>{o.push(t(e,n))}),o},Ce=e=>xe(e,A),ke=(e,t)=>Se(e,t)?L.from(e[t]):L.none(),Se=(e,t)=>ge.call(e,t),Te=(e,t)=>Se(e,t)&&void 0!==e[t]&&null!==e[t],Ee=e=>{if(!f(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],o={};return W(e,(n,r)=>{const i=pe(n);if(1!==i.length)throw new Error("one and only one name per case");const s=i[0],a=n[s];if(void 0!==o[s])throw new Error("duplicate key detected:"+s);if("cata"===s)throw new Error("cannot have a case named cata (sorry)");if(!f(a))throw new Error("case arguments must be an array");t.push(s),o[s]=(...o)=>{const n=o.length;if(n!==a.length)throw new Error("Wrong number of arguments to case "+s+". Expected "+a.length+" ("+a+"), got "+n);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[r].apply(null,o)},match:e=>{const n=pe(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!ne(t,e=>Z(n,e)))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[s].apply(null,o)},log:e=>{console.log(e,{constructors:t,constructor:s,params:o})}}}}),o},Oe=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},Ae=e=>{const t=t=>t(e),o=O(e),n=()=>r,r={tag:!0,inner:e,fold:(t,o)=>o(e),isValue:I,isError:P,map:t=>Be.value(t(e)),mapError:n,bind:t,exists:t,forall:t,getOr:o,or:n,getOrThunk:o,orThunk:n,getOrDie:o,each:t=>{t(e)},toOptional:()=>L.some(e)};return r},Me=e=>{const t=()=>o,o={tag:!1,inner:e,fold:(t,o)=>t(e),isValue:P,isError:I,map:t,mapError:t=>Be.error(t(e)),bind:t,exists:P,forall:I,getOr:A,or:A,getOrThunk:V,orThunk:V,getOrDie:N(String(e)),each:S,toOptional:L.none};return o},Be={value:Ae,error:Me,fromOption:(e,t)=>e.fold(()=>Me(t),Ae)},Re="undefined"!=typeof window?window:Function("return this;")(),Ne=()=>window.crypto.getRandomValues(new Uint32Array(1))[0]/4294967295;let Ve=0;const De=e=>{const t=(new Date).getTime(),o=Math.floor(1e9*Ne());return Ve++,e+"_"+o+Ve+String(t)},Pe=e=>(...t)=>{if(0===t.length)throw new Error("Can't merge zero objects");const o={};for(let n=0;n<t.length;n++){const r=t[n];for(const t in r)Se(r,t)&&(o[t]=e(o[t],r[t]))}return o},Ie=Pe((e,t)=>g(e)&&g(t)?Ie(e,t):t),Le=Pe((e,t)=>t),Fe=(e,t,o=M)=>e.exists(e=>o(e,t)),ze=(e,t,o=M)=>He(e,t,o).getOr(e.isNone()&&t.isNone()),He=(e,t,o)=>e.isSome()&&t.isSome()?L.some(o(e.getOrDie(),t.getOrDie())):L.none(),Ue=(e,t)=>e?L.some(t):L.none(),Ze=(e,t)=>((e,t)=>{let o=null!=t?t:Re;for(let t=0;t<e.length&&null!=o;++t)o=o[e[t]];return o})(e.split("."),t);Ee([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const $e=e=>{const t=Oe(L.none()),o=()=>t.get().each(e=>clearInterval(e));return{clear:()=>{o(),t.set(L.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:n=>{o(),t.set(L.some(setInterval(n,e)))}}},je=()=>{const e=(e=>{const t=Oe(L.none()),o=()=>t.get().each(e);return{clear:()=>{o(),t.set(L.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{o(),t.set(L.some(e))}}})(S);return{...e,on:t=>e.get().each(t)}},We=(e,t,o)=>""===t||e.length>=t.length&&e.substr(o,o+t.length)===t,qe=(e,t)=>Ye(e,t)?((e,t)=>e.substring(t))(e,t.length):e,Ge=(e,t,o=0,n)=>{const r=e.indexOf(t,o);return-1!==r&&(!!y(n)||r+t.length<=n)},Ye=(e,t)=>We(e,t,0),Xe=(e,t)=>We(e,t,e.length-t.length),Ke=e=>t=>t.replace(e,""),Je=Ke(/^\s+|\s+$/g),Qe=Ke(/^\s+/g),et=Ke(/\s+$/g),tt=e=>e.length>0,ot=e=>!tt(e),nt=(e,t=10)=>{const o=parseInt(e,t);return isNaN(o)?L.none():L.some(o)},rt=(e,t)=>{let o=null;return{cancel:()=>{v(o)||(clearTimeout(o),o=null)},throttle:(...n)=>{v(o)&&(o=setTimeout(()=>{o=null,e.apply(null,n)},t))}}},it=(e,t)=>{let o=null;const n=()=>{v(o)||(clearTimeout(o),o=null)};return{cancel:n,throttle:(...r)=>{n(),o=setTimeout(()=>{o=null,e.apply(null,r)},t)}}},st=e=>{let t,o=!1;return(...n)=>(o||(o=!0,t=e.apply(null,n)),t)},at="\ufeff",lt=" ",ct=e=>e===at,dt=e=>{const t={};return W(e,e=>{t[e]={}}),pe(t)},ut=e=>void 0!==e.length,ht=Array.isArray,mt=(e,t,o)=>{if(!e)return!1;if(o=o||e,ut(e)){for(let n=0,r=e.length;n<r;n++)if(!1===t.call(o,e[n],n,e))return!1}else for(const n in e)if(Se(e,n)&&!1===t.call(o,e[n],n,e))return!1;return!0},pt=(e,t)=>{const o=[];return mt(e,(n,r)=>{o.push(t(n,r,e))}),o},gt=(e,t)=>{const o=[];return mt(e,(n,r)=>{t&&!t(n,r,e)||o.push(n)}),o},ft=(e,t,o,n)=>{let r=y(o)?e[0]:o;for(let o=0;o<e.length;o++)r=t.call(n,r,e[o],o);return r},vt=(e,t,o)=>{for(let n=0,r=e.length;n<r;n++)if(t.call(o,e[n],n,e))return n;return-1},bt=e=>e[e.length-1],yt=()=>wt(0,0),wt=(e,t)=>({major:e,minor:t}),_t={nu:wt,detect:(e,t)=>{const o=String(t).toLowerCase();return 0===e.length?yt():((e,t)=>{const o=((e,t)=>{for(let o=0;o<e.length;o++){const n=e[o];if(n.test(t))return n}})(e,t);if(!o)return{major:0,minor:0};const n=e=>Number(t.replace(o,"$"+e));return wt(n(1),n(2))})(e,o)},unknown:yt},xt=(e,t)=>{const o=String(t).toLowerCase();return Q(e,e=>e.search(o))},Ct=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,kt=e=>t=>Ge(t,e),St=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>Ge(e,"edge/")&&Ge(e,"chrome")&&Ge(e,"safari")&&Ge(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ct],search:e=>Ge(e,"chrome")&&!Ge(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>Ge(e,"msie")||Ge(e,"trident")},{name:"Opera",versionRegexes:[Ct,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:kt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:kt("firefox")},{name:"Safari",versionRegexes:[Ct,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(Ge(e,"safari")||Ge(e,"mobile/"))&&Ge(e,"applewebkit")}],Tt=[{name:"Windows",search:kt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>Ge(e,"iphone")||Ge(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:kt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:kt("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:kt("linux"),versionRegexes:[]},{name:"Solaris",search:kt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:kt("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:kt("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Et={browsers:O(St),oses:O(Tt)},Ot="Edge",At="Chromium",Mt="Opera",Bt="Firefox",Rt="Safari",Nt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isEdge:n(Ot),isChromium:n(At),isIE:n("IE"),isOpera:n(Mt),isFirefox:n(Bt),isSafari:n(Rt)}},Vt=()=>Nt({current:void 0,version:_t.unknown()}),Dt=Nt,Pt=(O(Ot),O(At),O("IE"),O(Mt),O(Bt),O(Rt),"Windows"),It="Android",Lt="Linux",Ft="macOS",zt="Solaris",Ht="FreeBSD",Ut="ChromeOS",Zt=e=>{const t=e.current,o=e.version,n=e=>()=>t===e;return{current:t,version:o,isWindows:n(Pt),isiOS:n("iOS"),isAndroid:n(It),isMacOS:n(Ft),isLinux:n(Lt),isSolaris:n(zt),isFreeBSD:n(Ht),isChromeOS:n(Ut)}},$t=()=>Zt({current:void 0,version:_t.unknown()}),jt=Zt,Wt=(O(Pt),O("iOS"),O(It),O(Lt),O(Ft),O(zt),O(Ht),O(Ut),e=>window.matchMedia(e).matches);let qt=st(()=>((e,t,o)=>{const n=Et.browsers(),r=Et.oses(),i=t.bind(e=>((e,t)=>he(t.brands,t=>{const o=t.brand.toLowerCase();return Q(e,e=>{var t;return o===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())}).map(e=>({current:e.name,version:_t.nu(parseInt(t.version,10),0)}))}))(n,e)).orThunk(()=>((e,t)=>xt(e,t).map(e=>{const o=_t.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(n,e)).fold(Vt,Dt),s=((e,t)=>xt(e,t).map(e=>{const o=_t.detect(e.versionRegexes,t);return{current:e.name,version:o}}))(r,e).fold($t,jt),a=((e,t,o,n)=>{const r=e.isiOS()&&!0===/ipad/i.test(o),i=e.isiOS()&&!r,s=e.isiOS()||e.isAndroid(),a=s||n("(pointer:coarse)"),l=r||!i&&s&&n("(min-device-width:768px)"),c=i||s&&!l,d=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(o),u=!c&&!l&&!d;return{isiPad:O(r),isiPhone:O(i),isTablet:O(l),isPhone:O(c),isTouch:O(a),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:O(d),isDesktop:O(u)}})(s,i,e,o);return{browser:i,os:s,deviceType:a}})(window.navigator.userAgent,L.from(window.navigator.userAgentData),Wt));const Gt=()=>qt(),Yt=Object.getPrototypeOf,Xt=e=>{const t=Ze("ownerDocument.defaultView",e);return p(e)&&((e=>((e,t)=>{const o=((e,t)=>Ze(e,t))(e,t);if(null==o)throw new Error(e+" not available on this browser");return o})("HTMLElement",e))(t).prototype.isPrototypeOf(e)||/^HTML\w*Element$/.test(Yt(e).constructor.name))},Kt=window.navigator.userAgent,Jt=Gt(),Qt=Jt.browser,eo=Jt.os,to=Jt.deviceType,oo=-1!==Kt.indexOf("Windows Phone"),no={transparentSrc:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",documentMode:Qt.isIE()?document.documentMode||7:10,cacheSuffix:null,container:null,canHaveCSP:!Qt.isIE(),windowsPhone:oo,browser:{current:Qt.current,version:Qt.version,isChromium:Qt.isChromium,isEdge:Qt.isEdge,isFirefox:Qt.isFirefox,isIE:Qt.isIE,isOpera:Qt.isOpera,isSafari:Qt.isSafari},os:{current:eo.current,version:eo.version,isAndroid:eo.isAndroid,isChromeOS:eo.isChromeOS,isFreeBSD:eo.isFreeBSD,isiOS:eo.isiOS,isLinux:eo.isLinux,isMacOS:eo.isMacOS,isSolaris:eo.isSolaris,isWindows:eo.isWindows},deviceType:{isDesktop:to.isDesktop,isiPad:to.isiPad,isiPhone:to.isiPhone,isPhone:to.isPhone,isTablet:to.isTablet,isTouch:to.isTouch,isWebView:to.isWebView}},ro=/^\s*|\s*$/g,io=e=>w(e)?"":(""+e).replace(ro,""),so=function(e,t,o,n){n=n||this,e&&(o&&(e=e[o]),mt(e,(e,r)=>!1!==t.call(n,e,r,o)&&(so(e,t,o,n),!0)))},ao={trim:io,isArray:ht,is:(e,t)=>t?!("array"!==t||!ht(e))||typeof e===t:void 0!==e,toArray:e=>{if(ht(e))return e;{const t=[];for(let o=0,n=e.length;o<n;o++)t[o]=e[o];return t}},makeMap:(e,t,o={})=>{const n=m(e)?e.split(t||","):e||[];let r=n.length;for(;r--;)o[n[r]]={};return o},each:mt,map:pt,grep:gt,inArray:(e,t)=>{if(e)for(let o=0,n=e.length;o<n;o++)if(e[o]===t)return o;return-1},hasOwn:Se,extend:(e,...t)=>{for(let o=0;o<t.length;o++){const n=t[o];for(const t in n)if(Se(n,t)){const o=n[t];void 0!==o&&(e[t]=o)}}return e},walk:so,resolve:(e,t=window)=>{const o=e.split(".");for(let e=0,n=o.length;e<n&&(t=t[o[e]]);e++);return t},explode:(e,t)=>f(e)?e:""===e?[]:pt(e.split(t||","),io),_addCacheSuffix:e=>{const t=no.cacheSuffix;return t&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}},lo=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},co=(e,t)=>{const o=(t||document).createElement("div");if(o.innerHTML=e,!o.hasChildNodes()||o.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return lo(o.childNodes[0])},uo=(e,t)=>{const o=(t||document).createElement(e);return lo(o)},ho=(e,t)=>{const o=(t||document).createTextNode(e);return lo(o)},mo=lo,po=(e,t,o)=>L.from(e.dom.elementFromPoint(t,o)).map(lo),go=(e,t,o)=>{const n=e.document.createRange();var r;return r=n,t.fold(e=>{r.setStartBefore(e.dom)},(e,t)=>{r.setStart(e.dom,t)},e=>{r.setStartAfter(e.dom)}),((e,t)=>{t.fold(t=>{e.setEndBefore(t.dom)},(t,o)=>{e.setEnd(t.dom,o)},t=>{e.setEndAfter(t.dom)})})(n,o),n},fo=(e,t,o,n,r)=>{const i=e.document.createRange();return i.setStart(t.dom,o),i.setEnd(n.dom,r),i},vo=Ee([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),bo=(e,t,o)=>t(mo(o.startContainer),o.startOffset,mo(o.endContainer),o.endOffset);vo.ltr,vo.rtl;const yo=(e,t)=>{const o=e.dom;if(1!==o.nodeType)return!1;{const e=o;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},wo=e=>1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType||0===e.childElementCount,_o=(e,t)=>e.dom===t.dom,xo=(e,t)=>{const o=e.dom,n=t.dom;return o!==n&&o.contains(n)},Co=(e,t)=>{const o=[],n=e=>(o.push(e),t(e));let r=t(e);do{r=r.bind(n)}while(r.isSome());return o},ko=e=>e.dom.nodeName.toLowerCase(),So=e=>e.dom.nodeType,To=e=>t=>So(t)===e,Eo=e=>Oo(e)&&Xt(e.dom),Oo=To(1),Ao=To(3),Mo=To(9),Bo=To(11),Ro=e=>t=>Oo(t)&&ko(t)===e,No=e=>mo(e.dom.ownerDocument),Vo=e=>Mo(e)?e:No(e),Do=e=>mo(Vo(e).dom.defaultView),Po=e=>L.from(e.dom.parentNode).map(mo),Io=e=>L.from(e.dom.parentElement).map(mo),Lo=(e,t)=>{const o=x(t)?t:P;let n=e.dom;const r=[];for(;null!==n.parentNode&&void 0!==n.parentNode;){const e=n.parentNode,t=mo(e);if(r.push(t),!0===o(t))break;n=e}return r},Fo=e=>L.from(e.dom.previousSibling).map(mo),zo=e=>L.from(e.dom.nextSibling).map(mo),Ho=e=>re(Co(e,Fo)),Uo=e=>Co(e,zo),Zo=e=>j(e.dom.childNodes,mo),$o=(e,t)=>{const o=e.dom.childNodes;return L.from(o[t]).map(mo)},jo=e=>$o(e,0),Wo=e=>$o(e,e.dom.childNodes.length-1),qo=e=>e.dom.childNodes.length,Go=e=>Bo(e)&&_(e.dom.host),Yo=e=>mo(e.dom.getRootNode()),Xo=e=>Go(e)?e:(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return mo(t)})(Vo(e)),Ko=e=>mo(e.dom.host),Jo=e=>{if(_(e.target)){const t=mo(e.target);if(Oo(t)&&Qo(t)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return ce(t)}}return L.from(e.target)},Qo=e=>_(e.dom.shadowRoot),en=(e,t,o,n)=>((e,t,o,n,r)=>{const i=((e,t)=>o=>{e(o)&&t((e=>{const t=mo(Jo(e).getOr(e.target)),o=()=>e.stopPropagation(),n=()=>e.preventDefault(),r=T(n,o);return((e,t,o,n,r,i,s)=>({target:e,x:t,y:o,stop:n,prevent:r,kill:i,raw:s}))(t,e.clientX,e.clientY,o,n,r,e)})(o))})(o,n);return e.dom.addEventListener(t,i,r),{unbind:B(tn,e,t,i,r)}})(e,t,o,n,!1),tn=(e,t,o,n)=>{e.dom.removeEventListener(t,o,n)},on=I,nn=()=>mo(document),rn=(e,t=!1)=>e.dom.focus({preventScroll:t}),sn=e=>{const t=Yo(e).dom;return e.dom===t.activeElement},an=(e=nn())=>L.from(e.dom.activeElement).map(mo),ln=(e,t)=>{Po(e).each(o=>{o.dom.insertBefore(t.dom,e.dom)})},cn=(e,t)=>{zo(e).fold(()=>{Po(e).each(e=>{un(e,t)})},e=>{ln(e,t)})},dn=(e,t)=>{jo(e).fold(()=>{un(e,t)},o=>{e.dom.insertBefore(t.dom,o.dom)})},un=(e,t)=>{e.dom.appendChild(t.dom)},hn=(e,t)=>{ln(e,t),un(t,e)},mn=(e,t)=>{W(t,t=>{un(e,t)})},pn=(e,t,o)=>{if(!(m(o)||b(o)||C(o)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",o,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,o+"")},gn=(e,t,o)=>{pn(e.dom,t,o)},fn=(e,t)=>{const o=e.dom;fe(t,(e,t)=>{pn(o,t,e)})},vn=(e,t)=>{const o=e.dom.getAttribute(t);return null===o?void 0:o},bn=(e,t)=>L.from(vn(e,t)),yn=(e,t)=>{const o=e.dom;return!(!o||!o.hasAttribute)&&o.hasAttribute(t)},wn=(e,t)=>{e.dom.removeAttribute(t)},_n=e=>K(e.dom.attributes,(e,t)=>(e[t.name]=t.value,e),{}),xn=e=>{e.dom.textContent="",W(Zo(e),e=>{Cn(e)})},Cn=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},kn=e=>{const t=Zo(e);var o,n;t.length>0&&(o=e,W(n=t,(e,t)=>{const r=0===t?o:n[t-1];cn(r,e)})),Cn(e)},Sn=(e,t)=>mo(e.dom.cloneNode(t)),Tn=e=>Sn(e,!1),En=e=>Sn(e,!0),On=e=>j(e,mo),An=e=>e.dom.innerHTML,Mn=(e,t)=>{const o=No(e).dom,n=mo(o.createDocumentFragment()),r=((e,t)=>{const o=(t||document).createElement("div");return o.innerHTML=e,Zo(mo(o))})(t,o);mn(n,r),xn(e),un(e,n)},Bn=e=>void 0!==e.style&&x(e.style.getPropertyValue),Rn=e=>{const t=Ao(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const o=t.ownerDocument;return(e=>{const t=Yo(e);return Go(t)?L.some(t):L.none()})(mo(t)).fold(()=>o.body.contains(t),E(Rn,Ko))},Nn=(e,t,o)=>{if(!m(o))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",o,":: Element ",e),new Error("CSS value must be a string: "+o);Bn(e)&&e.style.setProperty(t,o)},Vn=(e,t,o)=>{const n=e.dom;Nn(n,t,o)},Dn=(e,t)=>{const o=e.dom;fe(t,(e,t)=>{Nn(o,t,e)})},Pn=(e,t)=>{const o=e.dom,n=window.getComputedStyle(o).getPropertyValue(t);return""!==n||Rn(e)?n:In(o,t)},In=(e,t)=>Bn(e)?e.style.getPropertyValue(t):"",Ln=(e,t)=>{const o=e.dom,n=In(o,t);return L.from(n).filter(e=>e.length>0)},Fn=e=>{const t={},o=e.dom;if(Bn(o))for(let e=0;e<o.style.length;e++){const n=o.style.item(e);t[n]=o.style[n]}return t},zn=(e,t)=>{((e,t)=>{Bn(e)&&e.style.removeProperty(t)})(e.dom,t),Fe(bn(e,"style").map(Je),"")&&wn(e,"style")},Hn=(e=>{const t=t=>{const o=(e=>{const t=e.dom;return Rn(e)?t.getBoundingClientRect().height:t.offsetHeight})(t);if(o<=0||null===o){const o=Pn(t,e);return parseFloat(o)||0}return o},o=(e,t)=>K(t,(t,o)=>{const n=Pn(e,o),r=void 0===n?0:parseInt(n,10);return isNaN(r)?t:t+r},0);return{set:(t,o)=>{if(!C(o)&&!o.match(/^[0-9]+$/))throw new Error(e+".set accepts only positive integer values. Value was "+o);const n=t.dom;Bn(n)&&(n.style[e]=o+"px")},get:t,getOuter:t,aggregate:o,max:(e,t,n)=>{const r=o(e,n);return t>r?t-r:0}}})("height"),Un=(e,t)=>({left:e,top:t,translate:(o,n)=>Un(e+o,t+n)}),Zn=Un,$n=(e,t)=>void 0!==e?e:void 0!==t?t:0,jn=e=>{const t=e.dom,o=t.ownerDocument.body;return o===t?Zn(o.offsetLeft,o.offsetTop):Rn(e)?(e=>{const t=e.getBoundingClientRect();return Zn(t.left,t.top)})(t):Zn(0,0)},Wn=e=>{const t=void 0!==e?e.dom:document,o=t.body.scrollLeft||t.documentElement.scrollLeft,n=t.body.scrollTop||t.documentElement.scrollTop;return Zn(o,n)},qn=(e,t,o)=>{const n=(void 0!==o?o.dom:document).defaultView;n&&n.scrollTo(e,t)},Gn=(e,t)=>{Gt().browser.isSafari()&&x(e.dom.scrollIntoViewIfNeeded)?e.dom.scrollIntoViewIfNeeded(!1):e.dom.scrollIntoView(t)},Yn=(e,t)=>{const o=(t||document).createDocumentFragment();return W(e,e=>{o.appendChild(e.dom)}),mo(o)},Xn=(e=>{const t=t=>e(t)?L.from(t.dom.nodeValue):L.none();return{get:o=>{if(!e(o))throw new Error("Can only get text value of a text node");return t(o).getOr("")},getOption:t,set:(t,o)=>{if(!e(t))throw new Error("Can only set raw text value of a text node");t.dom.nodeValue=o}}})(Ao),Kn=e=>Xn.get(e),Jn=(e,t)=>Xn.set(e,t),Qn=(e,t)=>{const o=vn(e,t);return void 0===o||""===o?[]:o.split(" ")};var er=(e,t,o,n,r)=>e(o,n)?L.some(o):x(r)&&r(o)?L.none():t(o,n,r);const tr=(e,t,o)=>{let n=e.dom;const r=x(o)?o:P;for(;n.parentNode;){n=n.parentNode;const e=mo(n);if(t(e))return L.some(e);if(r(e))break}return L.none()},or=(e,t,o)=>er((e,t)=>t(e),tr,e,t,o),nr=(e,t)=>{const o=e=>{for(let n=0;n<e.childNodes.length;n++){const r=mo(e.childNodes[n]);if(t(r))return L.some(r);const i=o(e.childNodes[n]);if(i.isSome())return i}return L.none()};return o(e.dom)},rr=(e,t,o)=>tr(e,e=>yo(e,t),o),ir=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return wo(o)?L.none():L.from(o.querySelector(e)).map(mo)})(t,e),sr=(e,t,o)=>er((e,t)=>yo(e,t),rr,e,t,o),ar=e=>void 0!==e.dom.classList,lr=e=>Qn(e,"class"),cr=(e,t)=>((e,t,o)=>{const n=Qn(e,t).concat([o]);return gn(e,t,n.join(" ")),!0})(e,"class",t),dr=(e,t)=>((e,t,o)=>{const n=Y(Qn(e,t),e=>e!==o);return n.length>0?gn(e,t,n.join(" ")):wn(e,t),!1})(e,"class",t),ur=(e,t)=>{ar(e)?e.dom.classList.add(t):cr(e,t)},hr=e=>{0===(ar(e)?e.dom.classList:lr(e)).length&&wn(e,"class")},mr=(e,t)=>{ar(e)?e.dom.classList.remove(t):dr(e,t),hr(e)},pr=(e,t)=>ar(e)&&e.dom.classList.contains(t),gr=(e,t=!1)=>{return Rn(e)?e.dom.isContentEditable:(o=e,sr(o,"[contenteditable]")).fold(O(t),e=>"true"===fr(e));var o},fr=e=>e.dom.contentEditable,vr=(e,t)=>{e.dom.contentEditable=t?"true":"false"},br=(e,t)=>{let o=[];return W(Zo(e),e=>{t(e)&&(o=o.concat([e])),o=o.concat(br(e,t))}),o},yr=(e,t)=>((e,t)=>{const o=void 0===t?document:t.dom;return wo(o)?[]:j(o.querySelectorAll(e),mo)})(t,e),wr=(e,t,o)=>tr(e,t,o).isSome(),_r=(e,t)=>((e,t)=>{const o=e.dom;return o.parentNode?((e,t)=>Q(e.dom.childNodes,e=>t(mo(e))).map(mo))(mo(o.parentNode),o=>!_o(e,o)&&t(o)):L.none()})(e,t).isSome(),xr=(e,t)=>nr(e,t).isSome(),Cr=e=>x(e)?e:P,kr=(e,t,o)=>{const n=t(e),r=Cr(o);return n.orThunk(()=>r(e)?L.none():((e,t,o)=>{let n=e.dom;const r=Cr(o);for(;n.parentNode;){n=n.parentNode;const e=mo(n),o=t(e);if(o.isSome())return o;if(r(e))break}return L.none()})(e,t,r))},Sr=["img","br"],Tr=e=>{return(t=e,Xn.getOption(t)).filter(e=>0!==e.trim().length||e.indexOf(lt)>-1).isSome()||Z(Sr,ko(e))||(e=>Eo(e)&&"false"===vn(e,"contenteditable"))(e);var t},Er=(e,t,o,n)=>({start:e,soffset:t,finish:o,foffset:n}),Or=Ee([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Ar={before:Or.before,on:Or.on,after:Or.after,cata:(e,t,o,n)=>e.fold(t,o,n),getStart:e=>e.fold(A,A,A)},Mr=Ee([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Br={domRange:Mr.domRange,relative:Mr.relative,exact:Mr.exact,exactFromRange:e=>Mr.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>mo(e.startContainer),relative:(e,t)=>Ar.getStart(e),exact:(e,t,o,n)=>e}))(e);return Do(t)},range:Er},Rr=(e,t)=>{const o=ko(e);return"input"===o?Ar.after(e):Z(["br","img"],o)?0===t?Ar.before(e):Ar.after(e):Ar.on(e,t)},Nr=(e,t)=>{const o=e.fold(Ar.before,Rr,Ar.after),n=t.fold(Ar.before,Rr,Ar.after);return Br.relative(o,n)},Vr=(e,t,o,n)=>{const r=Rr(e,t),i=Rr(o,n);return Br.relative(r,i)},Dr=e=>{const t=Br.getWin(e).dom,o=(e,o,n,r)=>fo(t,e,o,n,r),n=(e=>e.match({domRange:e=>{const t=mo(e.startContainer),o=mo(e.endContainer);return Vr(t,e.startOffset,o,e.endOffset)},relative:Nr,exact:Vr}))(e);return((e,t)=>{const o=((e,t)=>t.match({domRange:e=>({ltr:O(e),rtl:L.none}),relative:(t,o)=>({ltr:st(()=>go(e,t,o)),rtl:st(()=>L.some(go(e,o,t)))}),exact:(t,o,n,r)=>({ltr:st(()=>fo(e,t,o,n,r)),rtl:st(()=>L.some(fo(e,n,r,t,o)))})}))(e,t);return((e,t)=>{const o=t.ltr();return o.collapsed?t.rtl().filter(e=>!1===e.collapsed).map(e=>vo.rtl(mo(e.endContainer),e.endOffset,mo(e.startContainer),e.startOffset)).getOrThunk(()=>bo(0,vo.ltr,o)):bo(0,vo.ltr,o)})(0,o)})(t,n).match({ltr:o,rtl:o})},Pr=(e,t,o)=>((e,t,o)=>((e,t,o)=>e.caretPositionFromPoint?((e,t,o)=>{var n;return L.from(null===(n=e.caretPositionFromPoint)||void 0===n?void 0:n.call(e,t,o)).bind(t=>{if(null===t.offsetNode)return L.none();const o=e.createRange();return o.setStart(t.offsetNode,t.offset),o.collapse(),L.some(o)})})(e,t,o):e.caretRangeFromPoint?((e,t,o)=>{var n;return L.from(null===(n=e.caretRangeFromPoint)||void 0===n?void 0:n.call(e,t,o))})(e,t,o):L.none())(e.document,t,o).map(e=>Er(mo(e.startContainer),e.startOffset,mo(e.endContainer),e.endOffset)))(e,t,o),Ir=(e,t,o,n)=>({x:e,y:t,width:o,height:n,right:e+o,bottom:t+n}),Lr=e=>{const t=void 0===e?window:e,o=t.document,n=Wn(mo(o));return(e=>{const t=void 0===e?window:e;return Gt().browser.isFirefox()?L.none():L.from(t.visualViewport)})(t).fold(()=>{const e=t.document.documentElement,o=e.clientWidth,r=e.clientHeight;return Ir(n.left,n.top,o,r)},e=>Ir(Math.max(e.pageLeft,n.left),Math.max(e.pageTop,n.top),e.width,e.height))};class Fr{constructor(e,t){this.node=e,this.rootNode=t,this.current=this.current.bind(this),this.next=this.next.bind(this),this.prev=this.prev.bind(this),this.prev2=this.prev2.bind(this)}current(){return this.node}next(e){return this.node=this.findSibling(this.node,"firstChild","nextSibling",e),this.node}prev(e){return this.node=this.findSibling(this.node,"lastChild","previousSibling",e),this.node}prev2(e){return this.node=this.findPreviousNode(this.node,e),this.node}findSibling(e,t,o,n){if(e){if(!n&&e[t])return e[t];if(e!==this.rootNode){let t=e[o];if(t)return t;for(let n=e.parentNode;n&&n!==this.rootNode;n=n.parentNode)if(t=n[o],t)return t}}}findPreviousNode(e,t){if(e){const o=e.previousSibling;if(this.rootNode&&o===this.rootNode)return;if(o){if(!t)for(let e=o.lastChild;e;e=e.lastChild)if(!e.lastChild)return e;return o}const n=e.parentNode;if(n&&n!==this.rootNode)return n}}}const zr=/^[ \t\r\n]*$/,Hr=e=>zr.test(e),Ur=e=>"\n"===e||"\r"===e,Zr=(e,t=4,o=!0,n=!0)=>{const r=((e,t)=>t<=0?"":new Array(t+1).join(" "))(0,t),i=e.replace(/\t/g,r),s=K(i,(e,t)=>(e=>-1!==" \f\t\v".indexOf(e))(t)||t===lt?e.pcIsSpace||""===e.str&&o||e.str.length===i.length-1&&n||((e,t)=>t<e.length&&t>=0&&Ur(e[t]))(i,e.str.length+1)?{pcIsSpace:!1,str:e.str+lt}:{pcIsSpace:!0,str:e.str+" "}:{pcIsSpace:Ur(t),str:e.str+t},{pcIsSpace:!1,str:""});return s.str},$r=e=>t=>!!t&&t.nodeType===e,jr=e=>!!e&&!Object.getPrototypeOf(e),Wr=$r(1),qr=e=>Wr(e)&&Eo(mo(e)),Gr=e=>{const t=e.toLowerCase();return e=>_(e)&&e.nodeName.toLowerCase()===t},Yr=e=>{const t=e.map(e=>e.toLowerCase());return e=>{if(e&&e.nodeName){const o=e.nodeName.toLowerCase();return Z(t,o)}return!1}},Xr=(e,t)=>{const o=t.toLowerCase().split(" ");return t=>{if(Wr(t)){const n=t.ownerDocument.defaultView;if(n)for(let r=0;r<o.length;r++){const i=n.getComputedStyle(t,null);if((i?i.getPropertyValue(e):null)===o[r])return!0}}return!1}},Kr=e=>Wr(e)&&e.hasAttribute("data-mce-bogus"),Jr=e=>Wr(e)&&"TABLE"===e.tagName,Qr=e=>t=>{if(qr(t)){if(t.contentEditable===e)return!0;if(t.getAttribute("data-mce-contenteditable")===e)return!0}return!1},ei=Yr(["textarea","input"]),ti=$r(3),oi=$r(4),ni=$r(7),ri=$r(8),ii=$r(9),si=$r(11),ai=Gr("br"),li=Gr("img"),ci=Gr("a"),di=Qr("true"),ui=Qr("false"),hi=e=>qr(e)&&e.isContentEditable&&_(e.parentElement)&&!e.parentElement.isContentEditable,mi=Yr(["td","th"]),pi=Yr(["td","th","caption"]),gi=Yr(["video","audio","object","embed"]),fi=Gr("li"),vi=Gr("details"),bi=Gr("summary"),yi={skipBogus:!0,includeZwsp:!1,checkRootAsContent:!1},wi=e=>Wr(e)&&e.hasAttribute("data-mce-bookmark");const _i=(e,t,o,n)=>ti(e)&&!((e,t,o)=>Hr(e.data)&&!((e,t,o)=>{const n=mo(t),r=mo(e),i=o.getWhitespaceElements();return wr(r,e=>Se(i,ko(e)),B(_o,n))})(e,t,o))(e,t,o)&&(!n.includeZwsp||!(e=>{for(const t of e)if(!ct(t))return!1;return!0})(e.data)),xi=(e,t,o,n)=>x(n.isContent)&&n.isContent(t)||((e,t)=>Wr(e)&&Se(t.getNonEmptyElements(),e.nodeName))(t,e)||wi(t)||(e=>Wr(e)&&"A"===e.nodeName&&!e.hasAttribute("href")&&(e.hasAttribute("name")||e.hasAttribute("id")))(t)||_i(t,o,e,n)||ui(t)||di(t)&&(e=>Io(mo(e)).exists(e=>!gr(e)))(t),Ci=(e,t,o)=>{const n={...yi,...o};if(n.checkRootAsContent&&xi(e,t,t,n))return!1;let r=t.firstChild,i=0;if(!r)return!0;const s=new Fr(r,t);do{if(n.skipBogus&&Wr(r)){const e=r.getAttribute("data-mce-bogus");if(e){r=s.next("all"===e);continue}}if(ri(r))r=s.next(!0);else if(ai(r))i++,r=s.next();else{if(xi(e,r,t,n))return!1;r=s.next()}}while(r);return i<=1},ki=(e,t,o)=>Ci(e,t.dom,{checkRootAsContent:!0,...o}),Si=(e,t,o)=>xi(e,t,t,{includeZwsp:yi.includeZwsp,...o}),Ti=e=>{const t=e.toLowerCase();return"svg"===t?"svg":"math"===t?"math":"html"},Ei=e=>"html"!==Ti(e),Oi=e=>Ei(e.nodeName),Ai=e=>Ti(e.nodeName),Mi=["svg","math"],Bi="data-mce-block",Ri=e=>j((e=>Y(pe(e),e=>!/[A-Z]/.test(e)))(e),e=>{const t=CSS.escape(e);return`${t}:`+j(Mi,e=>`not(${e} ${t})`).join(":")}).join(","),Ni=(e,t)=>_(t.querySelector(e))?(t.setAttribute(Bi,"true"),"inline-boundary"===t.getAttribute("data-mce-selected")&&t.removeAttribute("data-mce-selected"),!0):(t.removeAttribute(Bi),!1),Vi=(e,t)=>{const o=Ri(e.getTransparentElements()),n=Ri(e.getBlockElements());return Y(t.querySelectorAll(o),e=>Ni(n,e))},Di=(e,t,o)=>{var n;const r=o?"lastChild":"firstChild";for(let o=t[r];o;o=o[r])if(Ci(e,o,{checkRootAsContent:!0}))return void(null===(n=o.parentNode)||void 0===n||n.removeChild(o))},Pi=(e,t,o)=>{const n=e.getBlockElements(),r=mo(t),i=e=>ko(e)in n,s=e=>_o(e,r);W(On(o),t=>{tr(t,i,s).each(o=>{const n=(t=>Y(Zo(t),t=>i(t)&&!e.isValidChild(ko(o),ko(t))))(t);if(n.length>0){const t=Io(o);W(n,t=>{tr(t,i,s).each(o=>{((e,t,o)=>{const n=document.createRange(),r=t.parentNode;if(r){n.setStartBefore(t),n.setEndBefore(o);const i=n.extractContents();Di(e,i,!0),n.setStartAfter(o),n.setEndAfter(t);const s=n.extractContents();Di(e,s,!1),Ci(e,i,{checkRootAsContent:!0})||r.insertBefore(i,t),Ci(e,o,{checkRootAsContent:!0})||r.insertBefore(o,t),Ci(e,s,{checkRootAsContent:!0})||r.insertBefore(s,t),r.removeChild(t)}})(e,o.dom,t.dom)})}),t.each(t=>Vi(e,t.dom))}})})},Ii=(e,t)=>{const o=Vi(e,t);Pi(e,t,o),((e,t,o)=>{W([...o,...Ui(e,t)?[t]:[]],t=>W(yr(mo(t),t.nodeName.toLowerCase()),t=>{Zi(e,t.dom)&&kn(t)}))})(e,t,o)},Li=(e,t)=>{if(Hi(e,t)){const o=Ri(e.getBlockElements());Ni(o,t)}},Fi=e=>e.hasAttribute(Bi),zi=(e,t)=>Se(e.getTransparentElements(),t),Hi=(e,t)=>Wr(t)&&zi(e,t.nodeName),Ui=(e,t)=>Hi(e,t)&&Fi(t),Zi=(e,t)=>Hi(e,t)&&!Fi(t),$i=(e,t)=>1===t.type&&zi(e,t.name)&&m(t.attr(Bi)),ji=Gt().browser,Wi=e=>Q(e,Oo),qi=(e,t)=>e.children&&Z(e.children,t),Gi=(e,t={})=>{let o=0;const n={},r=mo(e),i=Vo(r),s=e=>{un(Xo(r),e)},a=e=>{const t=Xo(r);ir(t,"#"+e).each(Cn)},l=e=>ke(n,e).getOrThunk(()=>({id:"mce-u"+o++,passed:[],failed:[],count:0})),c=e=>new Promise((o,r)=>{let a;const c=ao._addCacheSuffix(e),d=l(c);n[c]=d,d.count++;const u=(e,t)=>{W(e,D),d.status=t,d.passed=[],d.failed=[],a&&(a.onload=null,a.onerror=null,a=null)},h=()=>u(d.passed,2),m=()=>u(d.failed,3);if(o&&d.passed.push(o),r&&d.failed.push(r),1===d.status)return;if(2===d.status)return void h();if(3===d.status)return void m();d.status=1;const p=uo("link",i.dom);fn(p,{rel:"stylesheet",type:"text/css",id:d.id}),t.contentCssCors&&gn(p,"crossOrigin","anonymous"),t.referrerPolicy&&gn(p,"referrerpolicy",t.referrerPolicy),a=p.dom,a.onload=h,a.onerror=m,s(p),gn(p,"href",c)}),d=e=>{const t=ao._addCacheSuffix(e);ke(n,t).each(e=>{0===--e.count&&(delete n[t],a(e.id))})};return{load:c,loadRawCss:(e,t)=>{const o=l(e);n[e]=o,o.count++;const r=uo("style",i.dom);fn(r,{rel:"stylesheet",type:"text/css",id:o.id,"data-mce-key":e}),r.dom.innerHTML=t,s(r)},loadAll:e=>Promise.allSettled(j(e,e=>c(e).then(O(e)))).then(e=>{const t=G(e,e=>"fulfilled"===e.status);return t.fail.length>0?Promise.reject(j(t.fail,e=>e.reason)):j(t.pass,e=>e.value)}),unload:d,unloadRawCss:e=>{ke(n,e).each(t=>{0===--t.count&&(delete n[e],a(t.id))})},unloadAll:e=>{W(e,e=>{d(e)})},_setReferrerPolicy:e=>{t.referrerPolicy=e},_setContentCssCors:e=>{t.contentCssCors=e}}},Yi=(()=>{const e=new WeakMap;return{forElement:(t,o)=>{const n=Yo(t).dom;return L.from(e.get(n)).getOrThunk(()=>{const t=Gi(n,o);return e.set(n,t),t})}}})(),Xi=(e,t)=>_(e)&&(Si(t,e)||t.isInline(e.nodeName.toLowerCase())),Ki=e=>(e=>"span"===e.nodeName.toLowerCase())(e)&&"bookmark"===e.getAttribute("data-mce-type"),Ji=(e,t,o,n)=>{var r;const i=n||t;if(Wr(t)&&Ki(t))return t;const s=t.childNodes;for(let t=s.length-1;t>=0;t--)Ji(e,s[t],o,i);if(Wr(t)){const e=t.childNodes;1===e.length&&Ki(e[0])&&(null===(r=t.parentNode)||void 0===r||r.insertBefore(e[0],t))}return(e=>si(e)||ii(e))(t)||Si(o,t)||(e=>!!Wr(e)&&e.childNodes.length>0)(t)||((e,t,o)=>ti(e)&&e.data.length>0&&((e,t,o)=>{const n=new Fr(e,t).prev(!1),r=new Fr(e,t).next(!1),i=y(n)||Xi(n,o),s=y(r)||Xi(r,o);return i&&s})(e,t,o))(t,i,o)||e.remove(t),t},Qi=ao.makeMap,es=/[&<>\"\u0060\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ts=/[<>&\u007E-\uD7FF\uE000-\uFFEF]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,os=/[<>&\"\']/g,ns=/&#([a-z0-9]+);?|&([a-z0-9]+);/gi,rs={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"},is={'"':"&quot;","'":"&#39;","<":"&lt;",">":"&gt;","&":"&amp;","`":"&#96;"},ss={"&lt;":"<","&gt;":">","&amp;":"&","&quot;":'"',"&apos;":"'"},as=(e,t)=>{const o={};if(e){const n=e.split(",");t=t||10;for(let e=0;e<n.length;e+=2){const r=String.fromCharCode(parseInt(n[e],t));if(!is[r]){const t="&"+n[e+1]+";";o[r]=t,o[t]=r}}return o}},ls=as("50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,t9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro",32),cs=(e,t)=>e.replace(t?es:ts,e=>is[e]||e),ds=(e,t)=>e.replace(t?es:ts,e=>e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":is[e]||"&#"+e.charCodeAt(0)+";"),us=(e,t,o)=>{const n=o||ls;return e.replace(t?es:ts,e=>is[e]||n[e]||e)},hs={encodeRaw:cs,encodeAllRaw:e=>(""+e).replace(os,e=>is[e]||e),encodeNumeric:ds,encodeNamed:us,getEncodeFunc:(e,t)=>{const o=as(t)||ls,n=Qi(e.replace(/\+/g,","));return n.named&&n.numeric?(e,t)=>e.replace(t?es:ts,e=>void 0!==is[e]?is[e]:void 0!==o[e]?o[e]:e.length>1?"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";":"&#"+e.charCodeAt(0)+";"):n.named?t?(e,t)=>us(e,t,o):us:n.numeric?ds:cs},decode:e=>e.replace(ns,(e,t)=>t?(t="x"===t.charAt(0).toLowerCase()?parseInt(t.substr(1),16):parseInt(t,10))>65535?(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t))):rs[t]||String.fromCharCode(t):ss[e]||ls[e]||(e=>{const t=uo("div").dom;return t.innerHTML=e,t.textContent||t.innerText||e})(e))},ms=(e,t)=>(e=ao.trim(e))?e.split(t||" "):[],ps=e=>new RegExp("^"+e.replace(/([?+*])/g,".$1")+"$"),gs=e=>Object.freeze(["id","accesskey","class","dir","lang","style","tabindex","title","role",..."html4"!==e?["contenteditable","contextmenu","draggable","dropzone","hidden","spellcheck","translate","itemprop","itemscope","itemtype"]:[],..."html5-strict"!==e?["xml:lang"]:[]]),fs=e=>{let t,o;t="address blockquote div dl fieldset form h1 h2 h3 h4 h5 h6 hr menu ol p pre table ul",o="a abbr b bdo br button cite code del dfn em embed i iframe img input ins kbd label map noscript object q s samp script select small span strong sub sup textarea u var #text #comment","html4"!==e&&(t+=" article aside details dialog figure main header footer hgroup section nav a ins del canvas map",o+=" audio canvas command data datalist mark meter output picture progress time wbr video ruby bdi keygen svg"),"html5-strict"!==e&&(o=[o,"acronym applet basefont big font strike tt"].join(" "),t=[t,"center dir isindex noframes"].join(" "));const n=[t,o].join(" ");return{blockContent:t,phrasingContent:o,flowContent:n}},vs=e=>{const{blockContent:t,phrasingContent:o,flowContent:n}=fs(e),r=e=>Object.freeze(e.split(" "));return Object.freeze({blockContent:r(t),phrasingContent:r(o),flowContent:r(n)})},bs={html4:st(()=>vs("html4")),html5:st(()=>vs("html5")),"html5-strict":st(()=>vs("html5-strict"))},ys=(e,t)=>{const{blockContent:o,phrasingContent:n,flowContent:r}=bs[e]();return"blocks"===t?L.some(o):"phrasing"===t?L.some(n):"flow"===t?L.some(r):L.none()},ws=e=>L.from(/^(@?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)$/.exec(e)).map(e=>({preset:"@"===e[1],name:e[2]})),_s={},xs=ao.makeMap,Cs=ao.each,ks=ao.extend,Ss=ao.explode,Ts=(e,t={})=>{const o=xs(e," ",xs(e.toUpperCase()," "));return ks(o,t)},Es=e=>Ts("td th li dt dd figcaption caption details summary",e.getTextBlockElements()),Os=(e,t)=>{if(e){const o={};return m(e)&&(e={"*":e}),Cs(e,(e,n)=>{o[n]=o[n.toUpperCase()]="map"===t?xs(e,/[, ]/):Ss(e,/[, ]/)}),o}},As=(e={})=>{var t;const o={},n={};let r=[];const i={},s={},a=(t,o,n)=>{const r=e[t];if(r)return xs(r,/[, ]/,xs(r.toUpperCase(),/[, ]/));{let e=_s[t];return e||(e=Ts(o,n),_s[t]=e),e}},l=null!==(t=e.schema)&&void 0!==t?t:"html5",c=(e=>{const t=gs(e),{phrasingContent:o,flowContent:n}=fs(e),r={},i=(e,t,o)=>{r[e]={attributes:se(t,O({})),attributesOrder:t,children:se(o,O({}))}},s=(e,o="",n="")=>{const r=ms(n),s=ms(e);let a=s.length;const l=[...t,...ms(o)];for(;a--;)i(s[a],l.slice(),r)},a=(e,t)=>{const o=ms(e),n=ms(t);let i=o.length;for(;i--;){const e=r[o[i]];for(let t=0,o=n.length;t<o;t++)e.attributes[n[t]]={},e.attributesOrder.push(n[t])}};return"html5-strict"!==e&&(W(ms("acronym applet basefont big font strike tt"),e=>{s(e,"",o)}),W(ms("center dir isindex noframes"),e=>{s(e,"",n)})),s("html","manifest","head body"),s("head","","base command link meta noscript script style title"),s("title hr noscript br"),s("base","href target"),s("link","href rel media hreflang type sizes hreflang"),s("meta","name http-equiv content charset"),s("style","media type scoped"),s("script","src async defer type charset"),s("body","onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onload onmessage onoffline ononline onpagehide onpageshow onpopstate onresize onscroll onstorage onunload",n),s("dd div","",n),s("address dt caption","","html4"===e?o:n),s("h1 h2 h3 h4 h5 h6 pre p abbr code var samp kbd sub sup i b u bdo span legend em strong small s cite dfn","",o),s("blockquote","cite",n),s("ol","reversed start type","li"),s("ul","","li"),s("li","value",n),s("dl","","dt dd"),s("a","href target rel media hreflang type","html4"===e?o:n),s("q","cite",o),s("ins del","cite datetime",n),s("img","src sizes srcset alt usemap ismap width height"),s("iframe","src name width height",n),s("embed","src type width height"),s("object","data type typemustmatch name usemap form width height",[n,"param"].join(" ")),s("param","name value"),s("map","name",[n,"area"].join(" ")),s("area","alt coords shape href target rel media hreflang type"),s("table","border","caption colgroup thead tfoot tbody tr"+("html4"===e?" col":"")),s("colgroup","span","col"),s("col","span"),s("tbody thead tfoot","","tr"),s("tr","","td th"),s("td","colspan rowspan headers",n),s("th","colspan rowspan headers scope abbr",n),s("form","accept-charset action autocomplete enctype method name novalidate target",n),s("fieldset","disabled form name",[n,"legend"].join(" ")),s("label","form for",o),s("input","accept alt autocomplete checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min multiple name pattern readonly required size src step type value width"),s("button","disabled form formaction formenctype formmethod formnovalidate formtarget name type value","html4"===e?n:o),s("select","disabled form multiple name required size","option optgroup"),s("optgroup","disabled label","option"),s("option","disabled label selected value"),s("textarea","cols dirname disabled form maxlength name readonly required rows wrap"),s("menu","type label",[n,"li"].join(" ")),s("noscript","",n),"html4"!==e&&(s("wbr"),s("ruby","",[o,"rt rp"].join(" ")),s("figcaption","",n),s("mark rt rp bdi","",o),s("summary","",[o,"h1 h2 h3 h4 h5 h6"].join(" ")),s("canvas","width height",n),s("data","value",o),s("video","src crossorigin poster preload autoplay mediagroup loop muted controls width height buffered",[n,"track source"].join(" ")),s("audio","src crossorigin preload autoplay mediagroup loop muted controls buffered volume",[n,"track source"].join(" ")),s("picture","","img source"),s("source","src srcset type media sizes"),s("track","kind src srclang label default"),s("datalist","",[o,"option"].join(" ")),s("article section nav aside main header footer","",n),s("hgroup","","h1 h2 h3 h4 h5 h6"),s("figure","",[n,"figcaption"].join(" ")),s("time","datetime",o),s("dialog","open",n),s("command","type label icon disabled checked radiogroup command"),s("output","for form name",o),s("progress","value max",o),s("meter","value min max low high optimum",o),s("details","open",[n,"summary"].join(" ")),s("keygen","autofocus challenge disabled form keytype name"),i("svg","id tabindex lang xml:space class style x y width height viewBox preserveAspectRatio zoomAndPan transform".split(" "),[])),"html5-strict"!==e&&(a("script","language xml:space"),a("style","xml:space"),a("object","declare classid code codebase codetype archive standby align border hspace vspace"),a("embed","align name hspace vspace"),a("param","valuetype type"),a("a","charset name rev shape coords"),a("br","clear"),a("applet","codebase archive code object alt name width height align hspace vspace"),a("img","name longdesc align border hspace vspace"),a("iframe","longdesc frameborder marginwidth marginheight scrolling align"),a("font basefont","size color face"),a("input","usemap align"),a("select"),a("textarea"),a("h1 h2 h3 h4 h5 h6 div p legend caption","align"),a("ul","type compact"),a("li","type"),a("ol dl menu dir","compact"),a("pre","width xml:space"),a("hr","align noshade size width"),a("isindex","prompt"),a("table","summary width frame rules cellspacing cellpadding align bgcolor"),a("col","width align char charoff valign"),a("colgroup","width align char charoff valign"),a("thead","align char charoff valign"),a("tr","align char charoff valign bgcolor"),a("th","axis align char charoff valign nowrap bgcolor width height"),a("form","accept"),a("td","abbr axis scope align char charoff valign nowrap bgcolor width height"),a("tfoot","align char charoff valign"),a("tbody","align char charoff valign"),a("area","nohref"),a("body","background bgcolor text link vlink alink")),"html4"!==e&&(a("input button select textarea","autofocus"),a("input textarea","placeholder"),a("a","download"),a("link script img","crossorigin"),a("img","loading"),a("iframe","sandbox seamless allow allowfullscreen loading referrerpolicy")),"html4"!==e&&W([r.video,r.audio],e=>{delete e.children.audio,delete e.children.video}),W(ms("a form meter progress dfn"),e=>{r[e]&&delete r[e].children[e]}),delete r.caption.children.table,delete r.script,r})(l);!1===e.verify_html&&(e.valid_elements="*[*]");const d=Os(e.valid_styles),u=Os(e.invalid_styles,"map"),h=Os(e.valid_classes,"map"),g=a("whitespace_elements","pre script noscript style textarea video audio iframe object code"),v=a("self_closing_elements","colgroup dd dt li option p td tfoot th thead tr"),y=a("void_elements","area base basefont br col frame hr img input isindex link meta param embed source wbr track"),w=a("boolean_attributes","checked compact declare defer disabled ismap multiple nohref noresize noshade nowrap readonly selected autoplay loop controls allowfullscreen"),_="td th iframe video audio object script code",x=a("non_empty_elements",_+" pre svg textarea summary",y),C=a("move_caret_before_on_enter_elements",_+" table",y),k="h1 h2 h3 h4 h5 h6",S=a("text_block_elements",k+" p div address pre form blockquote center dir fieldset header footer article section hgroup aside main nav figure"),T=a("block_elements","hr table tbody thead tfoot th tr td li ol ul caption dl dt dd noscript menu isindex option datalist select optgroup figcaption details summary html body multicol listing",S),E=a("text_inline_elements","span strong b em i font s strike u var cite dfn code mark q sup sub samp"),A=a("transparent_elements","a ins del canvas map"),M=a("wrap_block_elements","pre "+k);Cs("script noscript iframe noframes noembed title style textarea xmp plaintext".split(" "),e=>{s[e]=new RegExp("</"+e+"[^>]*>","gi")});const B=e=>{const t=L.from(o["@"]),n=/[*?+]/;W(((e,t)=>{const o=/^([#+\-])?([^\[!\/]+)(?:\/([^\[!]+))?(?:(!?)\[([^\]]+)])?$/;return oe(ms(t,","),t=>{const n=o.exec(t);if(n){const t=n[1],o=n[2],r=n[3],i=n[4],s=n[5],a={attributes:{},attributesOrder:[]};if(e.each(e=>((e,t)=>{fe(e.attributes,(e,o)=>{t.attributes[o]=e}),t.attributesOrder.push(...e.attributesOrder)})(e,a)),"#"===t?a.paddEmpty=!0:"-"===t&&(a.removeEmpty=!0),"!"===i&&(a.removeEmptyAttrs=!0),s&&((e,t)=>{const o=/^([!\-])?(\w+[\\:]:\w+|[^=~<]+)?(?:([=~<])(.*))?$/,n=/[*?+]/,{attributes:r,attributesOrder:i}=t;W(ms(e,"|"),e=>{const s=o.exec(e);if(s){const e={},o=s[1],a=s[2].replace(/[\\:]:/g,":"),l=s[3],c=s[4];if("!"===o&&(t.attributesRequired=t.attributesRequired||[],t.attributesRequired.push(a),e.required=!0),"-"===o)return delete r[a],void i.splice(ao.inArray(i,a),1);if(l&&("="===l?(t.attributesDefault=t.attributesDefault||[],t.attributesDefault.push({name:a,value:c}),e.defaultValue=c):"~"===l?(t.attributesForced=t.attributesForced||[],t.attributesForced.push({name:a,value:c}),e.forcedValue=c):"<"===l&&(e.validValues=ao.makeMap(c,"?"))),n.test(a)){const o=e;t.attributePatterns=t.attributePatterns||[],o.pattern=ps(a),t.attributePatterns.push(o)}else r[a]||i.push(a),r[a]=e}})})(s,a),r&&(a.outputName=o),"@"===o){if(!e.isNone())return[];e=L.some(a)}return[r?{name:o,element:a,aliasName:r}:{name:o,element:a}]}return[]})})(t,null!=e?e:""),({name:e,element:t,aliasName:i})=>{if(i&&(o[i]=t),n.test(e)){const o=t;o.pattern=ps(e),r.push(o)}else o[e]=t})},R=e=>{r=[],W(pe(o),e=>{delete o[e]}),B(e)},N=(e,t)=>{var r,s;delete _s.text_block_elements,delete _s.block_elements;const a=!!t.extends&&!ne(t.extends),c=t.extends;if(n[e]=c?n[c]:{},i[e]=null!=c?c:e,x[e.toUpperCase()]={},x[e]={},a||(T[e.toUpperCase()]={},T[e]={}),c&&!o[e]&&o[c]){const t=(e=>{const t=e=>f(e)?j(e,t):(e=>p(e)&&e.source&&"[object RegExp]"===Object.prototype.toString.call(e))(e)?new RegExp(e.source,e.flags):p(e)?ve(e,t):e;return t(e)})(o[c]);delete t.removeEmptyAttrs,delete t.removeEmpty,o[e]=t}else o[e]={attributesOrder:[],attributes:{}};if(f(t.attributes)){const n=e=>{i.attributesOrder.push(e),i.attributes[e]={}},i=null!==(r=o[e])&&void 0!==r?r:{};delete i.attributesDefault,delete i.attributesForced,delete i.attributePatterns,delete i.attributesRequired,i.attributesOrder=[],i.attributes={},W(t.attributes,e=>{const t=gs(l);ws(e).each(({preset:e,name:o})=>{e?"global"===o&&W(t,n):n(o)})}),o[e]=i}if(b(t.padEmpty)){const n=null!==(s=o[e])&&void 0!==s?s:{};n.paddEmpty=t.padEmpty,o[e]=n}if(f(t.children)){const o={},r=e=>{o[e]={}},i=e=>{ys(l,e).each(e=>{W(e,r)})};W(t.children,e=>{ws(e).each(({preset:e,name:t})=>{e?i(t):r(t)})}),n[e]=o}c&&fe(n,(t,o)=>{t[c]&&(n[o]=t=ks({},n[o]),t[e]=t[c])})},V=e=>{p(e)?fe(e,(e,t)=>N(t,e)):m(e)&&(e=>{W((e=>{const t=/^(~)?(.+)$/;return oe(ms(e,","),e=>{const o=t.exec(e);return o?[{cloneName:"~"===o[1]?"span":"div",name:o[2]}]:[]})})(null!=e?e:""),({name:e,cloneName:t})=>{N(e,{extends:t})})})(e)},D=e=>{W((e=>{const t=/^([+\-]?)([A-Za-z0-9_\-.\u00b7\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u037d\u037f-\u1fff\u200c-\u200d\u203f-\u2040\u2070-\u218f\u2c00-\u2fef\u3001-\ud7ff\uf900-\ufdcf\ufdf0-\ufffd]+)\[([^\]]+)]$/;return oe(ms(e,","),e=>{const o=t.exec(e);if(o){const e=o[1],t=e?(e=>"-"===e?"remove":"add")(e):"replace";return[{operation:t,name:o[2],validChildren:oe(ms(o[3],"|"),e=>ws(e).toArray())}]}return[]})})(null!=e?e:""),({operation:e,name:t,validChildren:o})=>{const r="replace"===e?{"#comment":{}}:n[t],i=t=>{"remove"===e?delete r[t]:r[t]={}};W(o,({preset:e,name:t})=>{e?(e=>{ys(l,e).each(e=>{W(e,i)})})(t):i(t)}),n[t]=r})},P=e=>{const t=o[e];if(t)return t;let n=r.length;for(;n--;){const t=r[n];if(t.pattern.test(e))return t}},I=O(d),F=O(u),z=O(h),H=O(w),U=O(T),Z=O(S),$=O(E),q=O(Object.seal(y)),G=O(v),Y=O(x),X=O(C),K=O(g),J=O(A),Q=O(M),ee=O(Object.seal(s)),te=(e,t)=>{const o=P(e);if(o){if(!t)return!0;{if(o.attributes[t])return!0;const e=o.attributePatterns;if(e){let o=e.length;for(;o--;)if(e[o].pattern.test(t))return!0}}}return!1},ne=e=>Se(U(),e),re=e=>!Ye(e,"#")&&te(e)&&!ne(e),ie=O(i);return e.valid_elements?(R(e.valid_elements),Cs(c,(e,t)=>{n[t]=e.children})):(Cs(c,(e,t)=>{o[t]={attributes:e.attributes,attributesOrder:e.attributesOrder},n[t]=e.children}),Cs(ms("strong/b em/i"),e=>{const t=ms(e,"/");o[t[1]].outputName=t[0]}),Cs(E,(t,n)=>{o[n]&&(e.padd_empty_block_inline_children&&(o[n].paddInEmptyBlock=!0),o[n].removeEmpty=!0)}),Cs(ms("ol ul blockquote a table tbody"),e=>{o[e]&&(o[e].removeEmpty=!0)}),Cs(ms("p h1 h2 h3 h4 h5 h6 th td pre div address caption li summary"),e=>{o[e]&&(o[e].paddEmpty=!0)}),Cs(ms("span"),e=>{o[e].removeEmptyAttrs=!0})),delete o.svg,V(e.custom_elements),D(e.valid_children),B(e.extended_valid_elements),D("+ol[ul|ol],+ul[ul|ol]"),Cs({dd:"dl",dt:"dl",li:"ul ol",td:"tr",th:"tr",tr:"tbody thead tfoot",tbody:"table",thead:"table",tfoot:"table",legend:"fieldset",area:"map",param:"video audio object"},(e,t)=>{o[t]&&(o[t].parentsRequired=ms(e))}),e.invalid_elements&&Cs(Ss(e.invalid_elements),e=>{o[e]&&delete o[e]}),P("span")||B("span[!data-mce-type|*]"),{type:l,children:n,elements:o,getValidStyles:I,getValidClasses:z,getBlockElements:U,getInvalidStyles:F,getVoidElements:q,getTextBlockElements:Z,getTextInlineElements:$,getBoolAttrs:H,getElementRule:P,getSelfClosingElements:G,getNonEmptyElements:Y,getMoveCaretBeforeOnEnterElements:X,getWhitespaceElements:K,getTransparentElements:J,getSpecialElements:ee,isValidChild:(e,t)=>{const o=n[e.toLowerCase()];return!(!o||!o[t.toLowerCase()])},isValid:te,isBlock:ne,isInline:re,isWrapper:e=>Se(Q(),e)||re(e),getCustomElements:ie,addValidElements:B,setValidElements:R,addCustomElements:V,addValidChildren:D}},Ms=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Bs=e=>(e=>{return{value:(t=e,qe(t,"#").toUpperCase())};var t})(Ms(e.red)+Ms(e.green)+Ms(e.blue)),Rs=/^\s*rgb\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*\)\s*$/i,Ns=/^\s*rgba\s*\(\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*(\d+)\s*[,\s]\s*((?:\d?\.\d+|\d+)%?)\s*\)\s*$/i,Vs=(e,t,o,n)=>((e,t,o,n)=>({red:e,green:t,blue:o,alpha:n}))(parseInt(e,10),parseInt(t,10),parseInt(o,10),parseFloat(n)),Ds=e=>Rs.test(e)?"rgb":Ns.test(e)?"rgba":"other",Ps=e=>{const t=Rs.exec(e);if(null!==t)return L.some(Vs(t[1],t[2],t[3],"1"));const o=Ns.exec(e);return null!==o?L.some(Vs(o[1],o[2],o[3],o[4])):L.none()},Is=e=>`rgba(${e.red},${e.green},${e.blue},${e.alpha})`,Ls=e=>Ps(e).map(Bs).map(e=>"#"+e.value).getOr(e),Fs=(e={},t)=>{const o=/(?:url(?:(?:\(\s*\"([^\"]+)\"\s*\))|(?:\(\s*\'([^\']+)\'\s*\))|(?:\(\s*([^)\s]+)\s*\))))|(?:\'([^\']+)\')|(?:\"([^\"]+)\")/gi,n=/\s*([^:]+):\s*([^;]+);?/g,r=/\s+$/,i={};let s,a;const l=at;t&&(s=t.getValidStyles(),a=t.getInvalidStyles());const c="\\\" \\' \\; \\: ; : \ufeff".split(" ");for(let e=0;e<c.length;e++)i[c[e]]=l+e,i[l+e]=c[e];const d={parse:t=>{const s={};let a=!1;const c=e.url_converter,u=e.url_converter_scope||d,h=(e,t,o)=>{const n=s[e+"-top"+t];if(!n)return;const r=s[e+"-right"+t];if(!r)return;const i=s[e+"-bottom"+t];if(!i)return;const a=s[e+"-left"+t];if(!a)return;const l=[n,r,i,a];let c=l.length-1;for(;c--&&l[c]===l[c+1];);c>-1&&o||(s[e+t]=-1===c?l[0]:l.join(" "),delete s[e+"-top"+t],delete s[e+"-right"+t],delete s[e+"-bottom"+t],delete s[e+"-left"+t])},m=e=>{const t=s[e];if(!t)return;const o=t.indexOf(",")>-1?[t]:t.split(" ");let n=o.length;for(;n--;)if(o[n]!==o[0])return!1;return s[e]=o[0],!0},p=e=>(a=!0,i[e]),g=(e,t)=>(a&&(e=e.replace(/\uFEFF[0-9]/g,e=>i[e])),t||(e=e.replace(/\\([\'\";:])/g,"$1")),e),f=e=>String.fromCharCode(parseInt(e.slice(1),16)),v=e=>e.replace(/\\[0-9a-f]+/gi,f),b=(t,o,n,r,i,s)=>{if(i=i||s)return"'"+(i=g(i)).replace(/\'/g,"\\'")+"'";if(o=g(o||n||r||""),!e.allow_script_urls){const t=o.replace(/[\s\r\n]+/g,"");if(/(java|vb)script:/i.test(t))return"";if(!e.allow_svg_data_urls&&/^data:image\/svg/i.test(t))return""}return c&&(o=c.call(u,o,"style")),"url('"+o.replace(/\'/g,"\\'")+"')"};if(t){let i;for(t=(t=t.replace(/[\u0000-\u001F]/g,"")).replace(/\\[\"\';:\uFEFF]/g,p).replace(/\"[^\"]+\"|\'[^\']+\'/g,e=>e.replace(/[;:]/g,p));i=n.exec(t);){n.lastIndex=i.index+i[0].length;let t=i[1].replace(r,"").toLowerCase(),c=i[2].replace(r,"");if(t&&c){if(t=v(t),c=v(c),-1!==t.indexOf(l)||-1!==t.indexOf('"'))continue;if(!e.allow_script_urls&&("behavior"===t||/expression\s*\(|\/\*|\*\//.test(c)))continue;"font-weight"===t&&"700"===c?c="bold":"color"!==t&&"background-color"!==t||(c=c.toLowerCase()),"rgb"===Ds(c)&&Ps(c).each(e=>{c=Ls(Is(e)).toLowerCase()}),c=c.replace(o,b),s[t]=a?g(c,!0):c}}h("border","",!0),h("border","-width"),h("border","-color"),h("border","-style"),h("padding",""),h("margin",""),w="border-style",_="border-color",m(y="border-width")&&m(w)&&m(_)&&(s.border=s[y]+" "+s[w]+" "+s[_],delete s[y],delete s[w],delete s[_]),"medium none"===s.border&&delete s.border,"none"===s["border-image"]&&delete s["border-image"]}var y,w,_;return s},serialize:(e,t)=>{let o="";const n=(t,n)=>{const r=n[t];if(r)for(let t=0,n=r.length;t<n;t++){const n=r[t],i=e[n];i&&(o+=(o.length>0?" ":"")+n+": "+i+";")}};return t&&s?(n("*",s),n(t,s)):fe(e,(e,n)=>{e&&((e,t)=>{if(!a||!t)return!0;let o=a["*"];return!(o&&o[e]||(o=a[t],o&&o[e]))})(n,t)&&(o+=(o.length>0?" ":"")+n+": "+e+";")}),o}};return d},zs={keyLocation:!0,layerX:!0,layerY:!0,returnValue:!0,webkitMovementX:!0,webkitMovementY:!0,keyIdentifier:!0,mozPressure:!0,mozInputSource:!0},Hs=(e,t)=>{const o=null!=t?t:{};for(const t in e)Se(zs,t)||(o[t]=e[t]);return _(e.composedPath)&&(o.composedPath=()=>e.composedPath()),_(e.getModifierState)&&(o.getModifierState=t=>e.getModifierState(t)),_(e.getTargetRanges)&&(o.getTargetRanges=()=>e.getTargetRanges()),o},Us=(e,t,o,n)=>{var r;const i=Hs(t,n);return i.type=e,w(i.target)&&(i.target=null!==(r=i.srcElement)&&void 0!==r?r:o),(e=>w(e.preventDefault)||(e=>e instanceof Event||x(e.initEvent))(e))(t)&&(i.preventDefault=()=>{i.defaultPrevented=!0,i.isDefaultPrevented=I,x(t.preventDefault)&&t.preventDefault()},i.stopPropagation=()=>{i.cancelBubble=!0,i.isPropagationStopped=I,x(t.stopPropagation)&&t.stopPropagation()},i.stopImmediatePropagation=()=>{i.isImmediatePropagationStopped=I,i.stopPropagation()},(e=>e.isDefaultPrevented===I||e.isDefaultPrevented===P)(i)||(i.isDefaultPrevented=!0===i.defaultPrevented?I:P,i.isPropagationStopped=!0===i.cancelBubble?I:P,i.isImmediatePropagationStopped=P)),i},Zs=/^(?:mouse|contextmenu)|click/,$s=(e,t,o,n)=>{e.addEventListener(t,o,n||!1)},js=(e,t,o,n)=>{e.removeEventListener(t,o,n||!1)},Ws=(e,t)=>{const o=Us(e.type,e,document,t);if((e=>_(e)&&Zs.test(e.type))(e)&&y(e.pageX)&&!y(e.clientX)){const t=o.target.ownerDocument||document,n=t.documentElement,r=t.body,i=o;i.pageX=e.clientX+(n&&n.scrollLeft||r&&r.scrollLeft||0)-(n&&n.clientLeft||r&&r.clientLeft||0),i.pageY=e.clientY+(n&&n.scrollTop||r&&r.scrollTop||0)-(n&&n.clientTop||r&&r.clientTop||0)}return o},qs=(e,t,o)=>{const n=e.document,r={type:"ready"};if(o.domLoaded)return void t(r);const i=()=>{js(e,"DOMContentLoaded",i),js(e,"load",i),o.domLoaded||(o.domLoaded=!0,t(r)),e=null};"complete"===n.readyState||"interactive"===n.readyState&&n.body?i():$s(e,"DOMContentLoaded",i),o.domLoaded||$s(e,"load",i)};class Gs{constructor(){this.domLoaded=!1,this.events={},this.count=1,this.expando="mce-data-"+(+new Date).toString(32),this.hasFocusIn="onfocusin"in document.documentElement,this.count=1}bind(e,t,o,n){const r=this;let i;const s=window,a=e=>{r.executeHandlers(Ws(e||s.event),l)};if(!e||ti(e)||ri(e))return o;let l;e[r.expando]?l=e[r.expando]:(l=r.count++,e[r.expando]=l,r.events[l]={}),n=n||e;const c=t.split(" ");let d=c.length;for(;d--;){let t=c[d],u=a,h=!1,m=!1;"DOMContentLoaded"===t&&(t="ready"),r.domLoaded&&"ready"===t&&"complete"===e.readyState?o.call(n,Ws({type:t})):(r.hasFocusIn||"focusin"!==t&&"focusout"!==t||(h=!0,m="focusin"===t?"focus":"blur",u=e=>{const t=Ws(e||s.event);t.type="focus"===t.type?"focusin":"focusout",r.executeHandlers(t,l)}),i=r.events[l][t],i?"ready"===t&&r.domLoaded?o(Ws({type:t})):i.push({func:o,scope:n}):(r.events[l][t]=i=[{func:o,scope:n}],i.fakeName=m,i.capture=h,i.nativeHandler=u,"ready"===t?qs(e,u,r):$s(e,m||t,u,h)))}return e=i=null,o}unbind(e,t,o){if(!e||ti(e)||ri(e))return this;const n=e[this.expando];if(n){let r=this.events[n];if(t){const n=t.split(" ");let i=n.length;for(;i--;){const t=n[i],s=r[t];if(s){if(o){let e=s.length;for(;e--;)if(s[e].func===o){const o=s.nativeHandler,n=s.fakeName,i=s.capture,a=s.slice(0,e).concat(s.slice(e+1));a.nativeHandler=o,a.fakeName=n,a.capture=i,r[t]=a}}o&&0!==s.length||(delete r[t],js(e,s.fakeName||t,s.nativeHandler,s.capture))}}}else fe(r,(t,o)=>{js(e,t.fakeName||o,t.nativeHandler,t.capture)}),r={};for(const e in r)if(Se(r,e))return this;delete this.events[n];try{delete e[this.expando]}catch(t){e[this.expando]=null}}return this}fire(e,t,o){return this.dispatch(e,t,o)}dispatch(e,t,o){if(!e||ti(e)||ri(e))return this;const n=Ws({type:t,target:e},o);do{const t=e[this.expando];t&&this.executeHandlers(n,t),e=e.parentNode||e.ownerDocument||e.defaultView||e.parentWindow}while(e&&!n.isPropagationStopped());return this}clean(e){if(!e||ti(e)||ri(e))return this;if(e[this.expando]&&this.unbind(e),e.getElementsByTagName||(e=e.document),e&&e.getElementsByTagName){this.unbind(e);const t=e.getElementsByTagName("*");let o=t.length;for(;o--;)(e=t[o])[this.expando]&&this.unbind(e)}return this}destroy(){this.events={}}cancel(e){return e&&(e.preventDefault(),e.stopImmediatePropagation()),!1}executeHandlers(e,t){const o=this.events[t],n=o&&o[e.type];if(n)for(let t=0,o=n.length;t<o;t++){const o=n[t];if(o&&!1===o.func.call(o.scope,e)&&e.preventDefault(),e.isImmediatePropagationStopped())return}}}Gs.Event=new Gs;const Ys=ao.each,Xs=ao.grep,Ks="data-mce-style",Js=ao.makeMap("fill-opacity font-weight line-height opacity orphans widows z-index zoom"," "),Qs=(e,t,o)=>{w(o)||""===o?wn(e,t):gn(e,t,o)},ea=e=>e.replace(/[A-Z]/g,e=>"-"+e.toLowerCase()),ta=(e,t)=>{let o=0;if(e)for(let n=e.nodeType,r=e.previousSibling;r;r=r.previousSibling){const e=r.nodeType;(!t||!ti(r)||e!==n&&r.data.length)&&(o++,n=e)}return o},oa=(e,t)=>{const o=vn(t,"style"),n=e.serialize(e.parse(o),ko(t));Qs(t,Ks,n)},na=(e,t,o)=>{const n=ea(t);w(o)||""===o?zn(e,n):Vn(e,n,((e,t)=>C(e)?Se(Js,t)?e+"":e+"px":e)(o,n))},ra=(e,t={})=>{const o={},n=window,r={};let i=0;const s=Yi.forElement(mo(e),{contentCssCors:t.contentCssCors,referrerPolicy:t.referrerPolicy}),a=[],l=t.schema?t.schema:As({}),c=Fs({url_converter:t.url_converter,url_converter_scope:t.url_converter_scope},t.schema),d=t.ownEvents?new Gs:Gs.Event,u=l.getBlockElements(),h=t=>t&&e&&m(t)?e.getElementById(t):t,p=e=>{const t=h(e);return _(t)?mo(t):null},v=(e,t,o="")=>{let n;const r=p(e);if(_(r)&&Oo(r)){const e=Y[t];n=e&&e.get?e.get(r.dom,t):vn(r,t)}return _(n)?n:o},b=e=>{const t=h(e);return w(t)?[]:t.attributes},y=(e,o,n)=>{R(e,e=>{if(Wr(e)){const r=mo(e),i=""===n?null:n,s=vn(r,o),a=Y[o];a&&a.set?a.set(r.dom,i,o):Qs(r,o,i),s!==i&&t.onSetAttrib&&t.onSetAttrib({attrElm:r.dom,attrName:o,attrValue:i})}})},C=()=>t.root_element||e.body,k=(t,o)=>((e,t,o)=>{let n=0,r=0;const i=e.ownerDocument;if(o=o||e,t){if(o===e&&t.getBoundingClientRect&&"static"===Pn(mo(e),"position")){const o=t.getBoundingClientRect();return n=o.left+(i.documentElement.scrollLeft||e.scrollLeft)-i.documentElement.clientLeft,r=o.top+(i.documentElement.scrollTop||e.scrollTop)-i.documentElement.clientTop,{x:n,y:r}}let s=t;for(;s&&s!==o&&s.nodeType&&!qi(s,o);){const e=s;n+=e.offsetLeft||0,r+=e.offsetTop||0,s=e.offsetParent}for(s=t.parentNode;s&&s!==o&&s.nodeType&&!qi(s,o);)n-=s.scrollLeft||0,r-=s.scrollTop||0,s=s.parentNode;r+=(e=>ji.isFirefox()&&"table"===ko(e)?Wi(Zo(e)).filter(e=>"caption"===ko(e)).bind(e=>Wi(Uo(e)).map(t=>{const o=t.dom.offsetTop,n=e.dom.offsetTop,r=e.dom.offsetHeight;return o<=n?-r:0})).getOr(0):0)(mo(t))}return{x:n,y:r}})(e.body,h(t),o),T=(e,t,o)=>{const n=h(e);var r;if(!w(n)&&(qr(n)||Wr(r=n)&&"http://www.w3.org/2000/svg"===r.namespaceURI))return o?Pn(mo(n),ea(t)):("float"===(t=t.replace(/-(\D)/g,(e,t)=>t.toUpperCase()))&&(t="cssFloat"),n.style?n.style[t]:void 0)},E=e=>{const t=h(e);if(!t)return{w:0,h:0};let o=T(t,"width"),n=T(t,"height");return o&&-1!==o.indexOf("px")||(o="0"),n&&-1!==n.indexOf("px")||(n="0"),{w:parseInt(o,10)||t.offsetWidth||t.clientWidth,h:parseInt(n,10)||t.offsetHeight||t.clientHeight}},A=(e,t)=>{if(!e)return!1;const o=f(e)?e:[e];return $(o,e=>yo(mo(e),t))},M=(e,t,o,n)=>{const r=[];let i=h(e);n=void 0===n;const s=o||("BODY"!==C().nodeName?C().parentNode:null);if(m(t))if("*"===t)t=Wr;else{const e=t;t=t=>A(t,e)}for(;i&&!(i===s||w(i.nodeType)||ii(i)||si(i));){if(!t||t(i)){if(!n)return[i];r.push(i)}i=i.parentNode}return n?r:null},B=(e,t,o)=>{let n=t;if(e){m(t)&&(n=e=>A(e,t));for(let t=e[o];t;t=t[o])if(x(n)&&n(t))return t}return null},R=function(e,t,o){const n=null!=o?o:this;if(f(e)){const o=[];return Ys(e,(e,r)=>{const i=h(e);i&&o.push(t.call(n,i,r))}),o}{const o=h(e);return!!o&&t.call(n,o)}},N=(e,t)=>{R(e,e=>{fe(t,(t,o)=>{y(e,o,t)})})},V=(e,t)=>{R(e,e=>{const o=mo(e);Mn(o,t)})},D=(t,o,n,r,i)=>R(t,t=>{const s=m(o)?e.createElement(o):o;return _(n)&&N(s,n),r&&(!m(r)&&r.nodeType?s.appendChild(r):m(r)&&V(s,r)),i?s:t.appendChild(s)}),P=(t,o,n)=>D(e.createElement(t),t,o,n,!0),I=hs.encodeAllRaw,L=(e,t)=>R(e,e=>{const o=mo(e);return t&&W(Zo(o),e=>{Ao(e)&&0===e.dom.length?Cn(e):ln(o,e)}),Cn(o),o.dom}),F=(e,t,o)=>{R(e,e=>{if(Wr(e)){const n=mo(e),r=t.split(" ");W(r,e=>{_(o)?(o?ur:mr)(n,e):((e,t)=>{const o=ar(e)?e.dom.classList.toggle(t):((e,t)=>Z(lr(e),t)?dr(e,t):cr(e,t))(e,t);hr(e)})(n,e)})}})},z=(e,t,o)=>R(t,n=>{var r;const i=f(t)?e.cloneNode(!0):e;return o&&Ys(Xs(n.childNodes),e=>{i.appendChild(e)}),null===(r=n.parentNode)||void 0===r||r.replaceChild(i,n),n}),H=()=>e.createRange(),U=(o,r,i,s)=>{if(f(o)){let e=o.length;const t=[];for(;e--;)t[e]=U(o[e],r,i,s);return t}return!t.collect||o!==e&&o!==n||a.push([o,r,i,s]),d.bind(o,r,i,s||G)},j=(t,o,r)=>{if(f(t)){let e=t.length;const n=[];for(;e--;)n[e]=j(t[e],o,r);return n}if(a.length>0&&(t===e||t===n)){let e=a.length;for(;e--;){const[n,i,s]=a[e];t!==n||o&&o!==i||r&&r!==s||d.unbind(n,i,s)}}return d.unbind(t,o,r)},q=e=>{if(e&&qr(e)){const t=e.getAttribute("data-mce-contenteditable");return t&&"inherit"!==t?t:"inherit"!==e.contentEditable?e.contentEditable:null}return null},G={doc:e,settings:t,win:n,files:r,stdMode:!0,boxModel:!0,styleSheetLoader:s,boundEvents:a,styles:c,schema:l,events:d,isBlock:e=>m(e)?Se(u,e):Wr(e)&&(Se(u,e.nodeName)||Ui(l,e)),root:null,clone:(e,t)=>e.cloneNode(t),getRoot:C,getViewPort:e=>{const t=Lr(e);return{x:t.x,y:t.y,w:t.width,h:t.height}},getRect:e=>{const t=h(e),o=k(t),n=E(t);return{x:o.x,y:o.y,w:n.w,h:n.h}},getSize:E,getParent:(e,t,o)=>{const n=M(e,t,o,!1);return n&&n.length>0?n[0]:null},getParents:M,get:h,getNext:(e,t)=>B(e,t,"nextSibling"),getPrev:(e,t)=>B(e,t,"previousSibling"),select:(o,n)=>{var r,i;const s=null!==(i=null!==(r=h(n))&&void 0!==r?r:t.root_element)&&void 0!==i?i:e;return x(s.querySelectorAll)?ue(s.querySelectorAll(o)):[]},is:A,add:D,create:P,createHTML:(e,t,o="")=>{let n="<"+e;for(const e in t)Te(t,e)&&(n+=" "+e+'="'+I(t[e])+'"');return ot(o)&&Se(l.getVoidElements(),e)?n+" />":n+">"+o+"</"+e+">"},createFragment:t=>{const o=e.createElement("div"),n=e.createDocumentFragment();let r;for(n.appendChild(o),t&&(o.innerHTML=t);r=o.firstChild;)n.appendChild(r);return n.removeChild(o),n},remove:L,setStyle:(e,o,n)=>{R(e,e=>{const r=mo(e);na(r,o,n),t.update_styles&&oa(c,r)})},getStyle:T,setStyles:(e,o)=>{R(e,e=>{const n=mo(e);fe(o,(e,t)=>{na(n,t,e)}),t.update_styles&&oa(c,n)})},removeAllAttribs:e=>R(e,e=>{const t=e.attributes;for(let o=t.length-1;o>=0;o--)e.removeAttributeNode(t.item(o))}),setAttrib:y,setAttribs:N,getAttrib:v,getPos:k,parseStyle:e=>c.parse(e),serializeStyle:(e,t)=>c.serialize(e,t),addStyle:t=>{if(G!==ra.DOM&&e===document){if(o[t])return;o[t]=!0}let n=e.getElementById("mceDefaultStyles");if(!n){n=e.createElement("style"),n.id="mceDefaultStyles",n.type="text/css";const t=e.head;t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(e.createTextNode(t))},loadCSS:e=>{e||(e=""),W(e.split(","),e=>{r[e]=!0,s.load(e).catch(S)})},addClass:(e,t)=>{F(e,t,!0)},removeClass:(e,t)=>{F(e,t,!1)},hasClass:(e,t)=>{const o=p(e),n=t.split(" ");return _(o)&&ne(n,e=>pr(o,e))},toggleClass:F,show:e=>{R(e,e=>zn(mo(e),"display"))},hide:e=>{R(e,e=>Vn(mo(e),"display","none"))},isHidden:e=>{const t=p(e);return _(t)&&Fe(Ln(t,"display"),"none")},uniqueId:e=>(e||"mce_")+i++,setHTML:V,getOuterHTML:e=>{const t=p(e);return _(t)?Wr(t.dom)?t.dom.outerHTML:(e=>{const t=uo("div"),o=mo(e.dom.cloneNode(!0));return un(t,o),An(t)})(t):""},setOuterHTML:(e,t)=>{R(e,e=>{Wr(e)&&(e.outerHTML=t)})},decode:hs.decode,encode:I,insertAfter:(e,t)=>{const o=h(t);return R(e,e=>{const t=null==o?void 0:o.parentNode,n=null==o?void 0:o.nextSibling;return t&&(n?t.insertBefore(e,n):t.appendChild(e)),e})},replace:z,rename:(e,t)=>{if(e.nodeName!==t.toUpperCase()){const o=P(t);return Ys(b(e),t=>{y(o,t.nodeName,v(e,t.nodeName))}),z(o,e,!0),o}return e},findCommonAncestor:(e,t)=>{let o=e;for(;o;){let e=t;for(;e&&o!==e;)e=e.parentNode;if(o===e)break;o=o.parentNode}return!o&&e.ownerDocument?e.ownerDocument.documentElement:o},run:R,getAttribs:b,isEmpty:(e,t,o)=>{if(g(t)){const n=e=>{const o=e.nodeName.toLowerCase();return Boolean(t[o])};return Ci(l,e,{...o,isContent:n})}return Ci(l,e,o)},createRng:H,nodeIndex:ta,split:(e,t,o)=>{let n,r,i=H();if(e&&t&&e.parentNode&&t.parentNode){const s=e.parentNode;return i.setStart(s,ta(e)),i.setEnd(t.parentNode,ta(t)),n=i.extractContents(),i=H(),i.setStart(t.parentNode,ta(t)+1),i.setEnd(s,ta(e)+1),r=i.extractContents(),s.insertBefore(Ji(G,n,l),e),o?s.insertBefore(o,e):s.insertBefore(t,e),s.insertBefore(Ji(G,r,l),e),L(e),o||t}},bind:U,unbind:j,fire:(e,t,o)=>d.dispatch(e,t,o),dispatch:(e,t,o)=>d.dispatch(e,t,o),getContentEditable:q,getContentEditableParent:e=>{const t=C();let o=null;for(let n=e;n&&n!==t&&(o=q(n),null===o);n=n.parentNode);return o},isEditable:e=>{if(_(e)){const t=Wr(e)?e:e.parentElement;return _(t)&&qr(t)&&gr(mo(t))}return!1},destroy:()=>{if(a.length>0){let e=a.length;for(;e--;){const[t,o,n]=a[e];d.unbind(t,o,n)}}fe(r,(e,t)=>{s.unload(t),delete r[t]})},isChildOf:(e,t)=>e===t||t.contains(e),dumpRng:e=>"startContainer: "+e.startContainer.nodeName+", startOffset: "+e.startOffset+", endContainer: "+e.endContainer.nodeName+", endOffset: "+e.endOffset},Y=((e,t,o)=>{const n=t.keep_values,r={set:(e,n,r)=>{const i=mo(e);x(t.url_converter)&&_(n)&&(n=t.url_converter.call(t.url_converter_scope||o(),String(n),r,e)),Qs(i,"data-mce-"+r,n),Qs(i,r,n)},get:(e,t)=>{const o=mo(e);return vn(o,"data-mce-"+t)||vn(o,t)}},i={style:{set:(t,o)=>{const r=mo(t);n&&Qs(r,Ks,o),wn(r,"style"),m(o)&&Dn(r,e.parse(o))},get:t=>{const o=mo(t),n=vn(o,Ks)||vn(o,"style");return e.serialize(e.parse(n),ko(o))}}};return n&&(i.href=i.src=r),i})(c,t,O(G));return G};ra.DOM=ra(document),ra.nodeIndex=ta;const ia=ra.DOM;class sa{constructor(e={}){this.states={},this.queue=[],this.scriptLoadedCallbacks={},this.queueLoadedCallbacks=[],this.loading=!1,this.settings=e}_setReferrerPolicy(e){this.settings.referrerPolicy=e}loadScript(e){return new Promise((t,o)=>{const n=ia;let r;const i=()=>{n.remove(s),r&&(r.onerror=r.onload=r=null)},s=n.uniqueId();r=document.createElement("script"),r.id=s,r.type="text/javascript",r.src=ao._addCacheSuffix(e),this.settings.referrerPolicy&&n.setAttrib(r,"referrerpolicy",this.settings.referrerPolicy),r.onload=()=>{i(),t()},r.onerror=()=>{i(),o("Failed to load script: "+e)},(document.getElementsByTagName("head")[0]||document.body).appendChild(r)})}isDone(e){return 2===this.states[e]}markDone(e){this.states[e]=2}add(e){const t=this;return t.queue.push(e),void 0===t.states[e]&&(t.states[e]=0),new Promise((o,n)=>{t.scriptLoadedCallbacks[e]||(t.scriptLoadedCallbacks[e]=[]),t.scriptLoadedCallbacks[e].push({resolve:o,reject:n})})}load(e){return this.add(e)}remove(e){delete this.states[e],delete this.scriptLoadedCallbacks[e]}loadQueue(){const e=this.queue;return this.queue=[],this.loadScripts(e)}loadScripts(e){const t=this,o=(e,o)=>{ke(t.scriptLoadedCallbacks,o).each(t=>{W(t,t=>t[e](o))}),delete t.scriptLoadedCallbacks[o]},n=e=>{const t=Y(e,e=>"rejected"===e.status);return t.length>0?Promise.reject(oe(t,({reason:e})=>f(e)?e:[e])):Promise.resolve()},r=e=>Promise.allSettled(j(e,e=>2===t.states[e]?(o("resolve",e),Promise.resolve()):3===t.states[e]?(o("reject",e),Promise.reject(e)):(t.states[e]=1,t.loadScript(e).then(()=>{t.states[e]=2,o("resolve",e);const i=t.queue;return i.length>0?(t.queue=[],r(i).then(n)):Promise.resolve()},()=>(t.states[e]=3,o("reject",e),Promise.reject(e)))))),i=e=>(t.loading=!0,r(e).then(e=>{t.loading=!1;const o=t.queueLoadedCallbacks.shift();return L.from(o).each(D),n(e)})),s=dt(e);return t.loading?new Promise((e,o)=>{t.queueLoadedCallbacks.push(()=>{i(s).then(e,o)})}):i(s)}}sa.ScriptLoader=new sa;const aa={},la=Oe("en"),ca=()=>ke(aa,la.get()),da={getData:()=>ve(aa,e=>({...e})),setCode:e=>{e&&la.set(e)},getCode:()=>la.get(),add:(e,t)=>{let o=aa[e];o||(aa[e]=o={});const n=j(pe(t),e=>e.toLowerCase());fe(t,(e,r)=>{const i=r.toLowerCase();i!==r&&((e,t)=>{const o=e.indexOf(t);return-1!==o&&e.indexOf(t,o+1)>o})(n,i)?(Se(t,i)||(o[i]=e),o[r]=e):o[i]=e})},translate:e=>{const t=ca().getOr({}),o=e=>x(e)?Object.prototype.toString.call(e):n(e)?"":""+e,n=e=>""===e||null==e,r=e=>{const n=o(e);return Se(t,n)?o(t[n]):ke(t,n.toLowerCase()).map(o).getOr(n)},i=e=>e.replace(/{context:\w+}$/,"");if(n(e))return"";if(p(s=e)&&Se(s,"raw"))return o(e.raw);var s;if((e=>f(e)&&e.length>1)(e)){const t=e.slice(1);return i(r(e[0]).replace(/\{([0-9]+)\}/g,(e,n)=>Se(t,n)?o(t[n]):e))}return i(r(e))},isRtl:()=>ca().bind(e=>ke(e,"_dir")).exists(e=>"rtl"===e),hasCode:e=>Se(aa,e)},ua=()=>{const e=[],t={},o={},n=[],r=(e,t)=>{const o=Y(n,o=>o.name===e&&o.state===t);W(o,e=>e.resolve())},i=e=>Se(t,e),s=(e,o)=>{const n=da.getCode();!n||o&&-1===(","+(o||"")+",").indexOf(","+n+",")||sa.ScriptLoader.add(t[e]+"/langs/"+n+".js")},a=(e,t="added")=>"added"===t&&(e=>Se(o,e))(e)||"loaded"===t&&i(e)?Promise.resolve():new Promise(o=>{n.push({name:e,state:t,resolve:o})});return{items:e,urls:t,lookup:o,get:e=>{if(o[e])return o[e].instance},requireLangPack:(e,t)=>{!1!==ua.languageLoad&&(i(e)?s(e,t):a(e,"loaded").then(()=>s(e,t)))},add:(t,n)=>(e.push(n),o[t]={instance:n},r(t,"added"),n),remove:e=>{delete t[e],delete o[e]},createUrl:(e,t)=>m(t)?m(e)?{prefix:"",resource:t,suffix:""}:{prefix:e.prefix,resource:t,suffix:e.suffix}:t,load:(e,n)=>{if(t[e])return Promise.resolve();let i=m(n)?n:n.prefix+n.resource+n.suffix;0!==i.indexOf("/")&&-1===i.indexOf("://")&&(i=ua.baseURL+"/"+i),t[e]=i.substring(0,i.lastIndexOf("/"));const s=()=>(r(e,"loaded"),Promise.resolve());return o[e]?s():sa.ScriptLoader.add(i).then(s)},waitFor:a}};ua.languageLoad=!0,ua.baseURL="",ua.PluginManager=ua(),ua.ThemeManager=ua(),ua.ModelManager=ua();const ha=O("mce-annotation"),ma=O("data-mce-annotation"),pa=O("data-mce-annotation-uid"),ga=O("data-mce-annotation-active"),fa=O("data-mce-annotation-classes"),va=O("data-mce-annotation-attrs"),ba=e=>t=>_o(t,e),ya=(e,t)=>{const o=e.selection.getRng(),n=mo(o.startContainer),r=mo(e.getBody()),i=t.fold(()=>"."+ha(),e=>`[${ma()}="${e}"]`),s=$o(n,o.startOffset).getOr(n);return sr(s,i,ba(r)).bind(t=>bn(t,`${pa()}`).bind(o=>bn(t,`${ma()}`).map(t=>{const n=_a(e,o);return{uid:o,name:t,elements:n}})))},wa=(e,t)=>yn(e,"data-mce-bogus")||((e,t,o)=>rr(e,'[data-mce-bogus="all"]',o).isSome())(e,0,ba(t)),_a=(e,t)=>{const o=mo(e.getBody()),n=yr(o,`[${pa()}="${t}"]`);return Y(n,e=>!wa(e,o))},xa=(e,t)=>{const o=mo(e.getBody()),n=yr(o,`[${ma()}="${t}"]`),r={};return W(n,e=>{if(!wa(e,o)){const t=vn(e,pa()),o=ke(r,t).getOr([]);r[t]=o.concat([e])}}),r},Ca=(e,t,o=P)=>{const n=new Fr(e,t),r=e=>{let t;do{t=n[e]()}while(t&&!ti(t)&&!o(t));return L.from(t).filter(ti)};return{current:()=>L.from(n.current()).filter(ti),next:()=>r("next"),prev:()=>r("prev"),prev2:()=>r("prev2")}},ka=(e,t)=>{const o=t||(t=>e.isBlock(t)||ai(t)||ui(t)),n=(e,t,o,r)=>{if(ti(e)){const o=r(e,t,e.data);if(-1!==o)return L.some({container:e,offset:o})}return o().bind(e=>n(e.container,e.offset,o,r))};return{backwards:(t,r,i,s)=>{const a=Ca(t,null!=s?s:e.getRoot(),o);return n(t,r,()=>a.prev().map(e=>({container:e,offset:e.length})),i).getOrNull()},forwards:(t,r,i,s)=>{const a=Ca(t,null!=s?s:e.getRoot(),o);return n(t,r,()=>a.next().map(e=>({container:e,offset:0})),i).getOrNull()}}},Sa=e=>{let t;return o=>(t=t||se(e,I),Se(t,ko(o)))},Ta=e=>Oo(e)&&"br"===ko(e),Ea=Sa(["h1","h2","h3","h4","h5","h6","p","div","address","pre","form","blockquote","center","dir","fieldset","header","footer","article","section","hgroup","aside","nav","figure"]),Oa=Sa(["ul","ol","dl"]),Aa=Sa(["li","dd","dt"]),Ma=Sa(["thead","tbody","tfoot"]),Ba=Sa(["td","th"]),Ra=Sa(["pre","script","textarea","style"]),Na=()=>{const e=uo("br");return gn(e,"data-mce-bogus","1"),e},Va=e=>{xn(e),un(e,Na())},Da=at,Pa=ct,Ia=e=>e.replace(/\uFEFF/g,""),La=Wr,Fa=ti,za=e=>(Fa(e)&&(e=e.parentNode),La(e)&&e.hasAttribute("data-mce-caret")),Ha=e=>Fa(e)&&Pa(e.data),Ua=e=>za(e)||Ha(e),Za=e=>e.firstChild!==e.lastChild||!ai(e.firstChild),$a=e=>{const t=e.container();return!!ti(t)&&(t.data.charAt(e.offset())===Da||e.isAtStart()&&Ha(t.previousSibling))},ja=e=>{const t=e.container();return!!ti(t)&&(t.data.charAt(e.offset()-1)===Da||e.isAtEnd()&&Ha(t.nextSibling))},Wa=e=>Fa(e)&&e.data[0]===Da,qa=e=>Fa(e)&&e.data[e.data.length-1]===Da,Ga=e=>e&&e.hasAttribute("data-mce-caret")?((e=>{var t;const o=e.getElementsByTagName("br"),n=o[o.length-1];Kr(n)&&(null===(t=n.parentNode)||void 0===t||t.removeChild(n))})(e),e.removeAttribute("data-mce-caret"),e.removeAttribute("data-mce-bogus"),e.removeAttribute("style"),e.removeAttribute("data-mce-style"),e.removeAttribute("_moz_abspos"),e):null,Ya=e=>za(e.startContainer),Xa=Math.round,Ka=e=>e?{left:Xa(e.left),top:Xa(e.top),bottom:Xa(e.bottom),right:Xa(e.right),width:Xa(e.width),height:Xa(e.height)}:{left:0,top:0,bottom:0,right:0,width:0,height:0},Ja=(e,t)=>(e=Ka(e),t||(e.left=e.left+e.width),e.right=e.left,e.width=0,e),Qa=(e,t,o)=>e>=0&&e<=Math.min(t.height,o.height)/2,el=(e,t)=>{const o=Math.min(t.height/2,e.height/2);return e.bottom-o<t.top||!(e.top>t.bottom)&&Qa(t.top-e.bottom,e,t)},tl=(e,t)=>e.top>t.bottom||!(e.bottom<t.top)&&Qa(t.bottom-e.top,e,t),ol=(e,t,o)=>{const n=Math.max(Math.min(t,e.left+e.width),e.left),r=Math.max(Math.min(o,e.top+e.height),e.top);return Math.sqrt((t-n)*(t-n)+(o-r)*(o-r))},nl=e=>{const t=e.startContainer,o=e.startOffset;return t===e.endContainer&&t.hasChildNodes()&&e.endOffset===o+1?t.childNodes[o]:null},rl=(e,t)=>{if(Wr(e)&&e.hasChildNodes()){const o=e.childNodes,n=((e,t,o)=>Math.min(Math.max(e,0),o))(t,0,o.length-1);return o[n]}return e},il=new RegExp("[̀-ͯ҃-҇҈-҉֑-ֽֿׁ-ׂׄ-ׇׅؐ-ًؚ-ٰٟۖ-ۜ۟-ۤۧ-۪ۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣣ-ंऺ़ु-ै्॑-ॗॢ-ॣঁ়াু-ৄ্ৗৢ-ৣਁ-ਂ਼ੁ-ੂੇ-ੈੋ-੍ੑੰ-ੱੵઁ-ં઼ુ-ૅે-ૈ્ૢ-ૣଁ଼ାିୁ-ୄ୍ୖୗୢ-ୣஂாீ்ௗఀా-ీె-ైొ-్ౕ-ౖౢ-ౣಁ಼ಿೂೆೌ-್ೕ-ೖೢ-ೣഁാു-ൄ്ൗൢ-ൣ්ාි-ුූෟัิ-ฺ็-๎ັິ-ູົ-ຼ່-ໍ༘-ཱ༹༙༵༷-ཾྀ-྄྆-྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္-်ွ-ှၘ-ၙၞ-ၠၱ-ၴႂႅ-ႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒ-ᝓᝲ-ᝳ឴-឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧ-ᤨᤲ᤹-᤻ᨗ-ᨘᨛᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼᪰-᪽᪾ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀ-ᮁᮢ-ᮥᮨ-ᮩ᮫-ᮭ᯦ᯨ-ᯩᯭᯯ-ᯱᰬ-ᰳᰶ-᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᳸-᳹᷀-᷵᷼-᷿‌-‍⃐-⃜⃝-⃠⃡⃢-⃤⃥-⃰⳯-⵿⳱ⷠ-〪ⷿ-〭〮-゙〯-゚꙯꙰-꙲ꙴ-꙽ꚞ-ꚟ꛰-꛱ꠂ꠆ꠋꠥ-ꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꧥꨩ-ꨮꨱ-ꨲꨵ-ꨶꩃꩌꩼꪰꪲ-ꪴꪷ-ꪸꪾ-꪿꫁ꫬ-ꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-゙︯-゚]"),sl=e=>m(e)&&e.charCodeAt(0)>=768&&il.test(e),al=di,ll=ui,cl=ai,dl=ti,ul=Yr(["script","style","textarea"]),hl=Yr(["img","input","textarea","hr","iframe","video","audio","object","embed"]),ml=Yr(["table"]),pl=Ua,gl=e=>!pl(e)&&(dl(e)?!ul(e.parentNode):hl(e)||cl(e)||ml(e)||fl(e)),fl=e=>!(e=>Wr(e)&&"true"===e.getAttribute("unselectable"))(e)&&ll(e),vl=(e,t)=>gl(e)&&((e,t)=>{for(let o=e.parentNode;o&&o!==t;o=o.parentNode){if(fl(o))return!1;if(al(o))return!0}return!0})(e,t),bl=Wr,yl=gl,wl=Xr("display","block table"),_l=Xr("float","left right"),xl=((...e)=>t=>{for(let o=0;o<e.length;o++)if(!e[o](t))return!1;return!0})(bl,yl,R(_l)),Cl=R(Xr("white-space","pre pre-line pre-wrap")),kl=ti,Sl=ai,Tl=ra.nodeIndex,El=(e,t)=>t<0&&Wr(e)&&e.hasChildNodes()?void 0:rl(e,t),Ol=e=>e?e.createRange():ra.DOM.createRng(),Al=e=>m(e)&&/[\r\n\t ]/.test(e),Ml=e=>!!e.setStart&&!!e.setEnd,Bl=e=>{const t=e.startContainer,o=e.startOffset;if(Al(e.toString())&&Cl(t.parentNode)&&ti(t)){const e=t.data;if(Al(e[o-1])||Al(e[o+1]))return!0}return!1},Rl=e=>0===e.left&&0===e.right&&0===e.top&&0===e.bottom,Nl=e=>{var t;let o;const n=e.getClientRects();return o=n.length>0?Ka(n[0]):Ka(e.getBoundingClientRect()),!Ml(e)&&Sl(e)&&Rl(o)?(e=>{const t=e.ownerDocument,o=Ol(t),n=t.createTextNode(lt),r=e.parentNode;r.insertBefore(n,e),o.setStart(n,0),o.setEnd(n,1);const i=Ka(o.getBoundingClientRect());return r.removeChild(n),i})(e):Rl(o)&&Ml(e)&&null!==(t=(e=>{const t=e.startContainer,o=e.endContainer,n=e.startOffset,r=e.endOffset;if(t===o&&ti(o)&&0===n&&1===r){const t=e.cloneRange();return t.setEndAfter(o),Nl(t)}return null})(e))&&void 0!==t?t:o},Vl=(e,t)=>{const o=Ja(e,t);return o.width=1,o.right=o.left+1,o},Dl=(e,t,o)=>{const n=()=>(o||(o=(e=>{const t=[],o=e=>{var o,n;0!==e.height&&(t.length>0&&(o=e,n=t[t.length-1],o.left===n.left&&o.top===n.top&&o.bottom===n.bottom&&o.right===n.right)||t.push(e))},n=(e,t)=>{const n=Ol(e.ownerDocument);if(t<e.data.length){if(sl(e.data[t]))return;if(sl(e.data[t-1])&&(n.setStart(e,t),n.setEnd(e,t+1),!Bl(n)))return void o(Vl(Nl(n),!1))}t>0&&(n.setStart(e,t-1),n.setEnd(e,t),Bl(n)||o(Vl(Nl(n),!1))),t<e.data.length&&(n.setStart(e,t),n.setEnd(e,t+1),Bl(n)||o(Vl(Nl(n),!0)))},r=e.container(),i=e.offset();if(kl(r))return n(r,i),t;if(bl(r))if(e.isAtEnd()){const e=El(r,i);kl(e)&&n(e,e.data.length),xl(e)&&!Sl(e)&&o(Vl(Nl(e),!1))}else{const s=El(r,i);if(kl(s)&&n(s,0),xl(s)&&e.isAtEnd())return o(Vl(Nl(s),!1)),t;const a=El(e.container(),e.offset()-1);xl(a)&&!Sl(a)&&(wl(a)||wl(s)||!xl(s))&&o(Vl(Nl(a),!1)),xl(s)&&o(Vl(Nl(s),!0))}return t})(Dl(e,t))),o);return{container:O(e),offset:O(t),toRange:()=>{const o=Ol(e.ownerDocument);return o.setStart(e,t),o.setEnd(e,t),o},getClientRects:n,isVisible:()=>n().length>0,isAtStart:()=>(kl(e),0===t),isAtEnd:()=>kl(e)?t>=e.data.length:t>=e.childNodes.length,isEqual:o=>o&&e===o.container()&&t===o.offset(),getNode:o=>El(e,o?t-1:t)}};Dl.fromRangeStart=e=>Dl(e.startContainer,e.startOffset),Dl.fromRangeEnd=e=>Dl(e.endContainer,e.endOffset),Dl.after=e=>Dl(e.parentNode,Tl(e)+1),Dl.before=e=>Dl(e.parentNode,Tl(e)),Dl.isAbove=(e,t)=>He(ce(t.getClientRects()),de(e.getClientRects()),el).getOr(!1),Dl.isBelow=(e,t)=>He(de(t.getClientRects()),ce(e.getClientRects()),tl).getOr(!1),Dl.isAtStart=e=>!!e&&e.isAtStart(),Dl.isAtEnd=e=>!!e&&e.isAtEnd(),Dl.isTextPosition=e=>!!e&&ti(e.container()),Dl.isElementPosition=e=>!Dl.isTextPosition(e);const Pl=(e,t)=>{ti(t)&&0===t.data.length&&e.remove(t)},Il=(e,t,o)=>{si(o)?((e,t,o)=>{const n=L.from(o.firstChild),r=L.from(o.lastChild);t.insertNode(o),n.each(t=>Pl(e,t.previousSibling)),r.each(t=>Pl(e,t.nextSibling))})(e,t,o):((e,t,o)=>{t.insertNode(o),Pl(e,o.previousSibling),Pl(e,o.nextSibling)})(e,t,o)},Ll=ti,Fl=Kr,zl=ra.nodeIndex,Hl=e=>{const t=e.parentNode;return Fl(t)?Hl(t):t},Ul=e=>e?ft(e.childNodes,(e,t)=>(Fl(t)&&"BR"!==t.nodeName?e=e.concat(Ul(t)):e.push(t),e),[]):[],Zl=e=>t=>e===t,$l=e=>(Ll(e)?"text()":e.nodeName.toLowerCase())+"["+(e=>{let t,o;t=Ul(Hl(e)),o=vt(t,Zl(e),e),t=t.slice(0,o+1);const n=ft(t,(e,o,n)=>(Ll(o)&&Ll(t[n-1])&&e++,e),0);return t=gt(t,Yr([e.nodeName])),o=vt(t,Zl(e),e),o-n})(e)+"]",jl=(e,t)=>{let o,n=[],r=t.container(),i=t.offset();if(Ll(r))o=((e,t)=>{let o=e;for(;(o=o.previousSibling)&&Ll(o);)t+=o.data.length;return t})(r,i);else{const e=r.childNodes;i>=e.length?(o="after",i=e.length-1):o="before",r=e[i]}n.push($l(r));let s=((e,t)=>{const o=[];for(let n=t.parentNode;n&&n!==e;n=n.parentNode)o.push(n);return o})(e,r);return s=gt(s,R(Kr)),n=n.concat(pt(s,e=>$l(e))),n.reverse().join("/")+","+o},Wl=(e,t)=>{if(!t)return null;const o=t.split(","),n=o[0].split("/"),r=o.length>1?o[1]:"before",i=ft(n,(e,t)=>{const o=/([\w\-\(\)]+)\[([0-9]+)\]/.exec(t);return o?("text()"===o[1]&&(o[1]="#text"),((e,t,o)=>{let n=Ul(e);return n=gt(n,(e,t)=>!Ll(e)||!Ll(n[t-1])),n=gt(n,Yr([t])),n[o]})(e,o[1],parseInt(o[2],10))):null},e);if(!i)return null;if(!Ll(i)&&i.parentNode){let e;return e="after"===r?zl(i)+1:zl(i),Dl(i.parentNode,e)}return((e,t)=>{let o=e,n=0;for(;Ll(o);){const r=o.data.length;if(t>=n&&t<=n+r){e=o,t-=n;break}if(!Ll(o.nextSibling)){e=o,t=r;break}n+=r,o=o.nextSibling}return Ll(e)&&t>e.data.length&&(t=e.data.length),Dl(e,t)})(i,parseInt(r,10))},ql=ui,Gl=(e,t,o,n,r)=>{const i=r?n.startContainer:n.endContainer;let s=r?n.startOffset:n.endOffset;const a=[],l=e.getRoot();if(ti(i))a.push(o?((e,t,o)=>{let n=e(t.data.slice(0,o)).length;for(let o=t.previousSibling;o&&ti(o);o=o.previousSibling)n+=e(o.data).length;return n})(t,i,s):s);else{let t=0;const n=i.childNodes;s>=n.length&&n.length&&(t=1,s=Math.max(0,n.length-1)),a.push(e.nodeIndex(n[s],o)+t)}for(let t=i;t&&t!==l;t=t.parentNode)a.push(e.nodeIndex(t,o));return a},Yl=(e,t,o)=>{let n=0;return ao.each(e.select(t),e=>"all"===e.getAttribute("data-mce-bogus")?void 0:e!==o&&void n++),n},Xl=(e,t)=>{let o=t?e.startContainer:e.endContainer,n=t?e.startOffset:e.endOffset;if(Wr(o)&&"TR"===o.nodeName){const r=o.childNodes;o=r[Math.min(t?n:n-1,r.length-1)],o&&(n=t?0:o.childNodes.length,t?e.setStart(o,n):e.setEnd(o,n))}},Kl=e=>(Xl(e,!0),Xl(e,!1),e),Jl=(e,t)=>{if(Wr(e)&&(e=rl(e,t),ql(e)))return e;if(Ua(e)){ti(e)&&za(e)&&(e=e.parentNode);let t=e.previousSibling;if(ql(t))return t;if(t=e.nextSibling,ql(t))return t}},Ql=(e,t,o)=>{const n=o.getNode(),r=o.getRng();if("IMG"===n.nodeName||ql(n)){const e=n.nodeName;return{name:e,index:Yl(o.dom,e,n)}}const i=(e=>Jl(e.startContainer,e.startOffset)||Jl(e.endContainer,e.endOffset))(r);if(i){const e=i.tagName;return{name:e,index:Yl(o.dom,e,i)}}return((e,t,o,n)=>{const r=t.dom,i=Gl(r,e,o,n,!0),s=t.isForward(),a=Ya(n)?{isFakeCaret:!0}:{};return t.isCollapsed()?{start:i,forward:s,...a}:{start:i,end:Gl(r,e,o,n,!1),forward:s,...a}})(e,o,t,r)},ec=(e,t,o)=>{const n={"data-mce-type":"bookmark",id:t,style:"overflow:hidden;line-height:0px"};return o?e.create("span",n,"&#xFEFF;"):e.create("span",n)},tc=(e,t)=>{const o=e.dom;let n=e.getRng();const r=o.uniqueId(),i=e.isCollapsed(),s=e.getNode(),a=s.nodeName,l=e.isForward();if("IMG"===a)return{name:a,index:Yl(o,a,s)};const c=Kl(n.cloneRange());if(!i){c.collapse(!1);const e=ec(o,r+"_end",t);Il(o,c,e)}n=Kl(n),n.collapse(!0);const d=ec(o,r+"_start",t);return Il(o,n,d),e.moveToBookmark({id:r,keep:!0,forward:l}),{id:r,forward:l}},oc=B(Ql,A,!0),nc=e=>"inline-command"===e.type||"inline-format"===e.type,rc=e=>"block-command"===e.type||"block-format"===e.type,ic=e=>{var t;const o=t=>Be.error({message:t,pattern:e}),n=(t,n,r)=>{if(void 0!==e.format){let r;if(f(e.format)){if(!ne(e.format,m))return o(t+" pattern has non-string items in the `format` array");r=e.format}else{if(!m(e.format))return o(t+" pattern has non-string `format` parameter");r=[e.format]}return Be.value(n(r))}return void 0!==e.cmd?m(e.cmd)?Be.value(r(e.cmd,e.value)):o(t+" pattern has non-string `cmd` parameter"):o(t+" pattern is missing both `format` and `cmd` parameters")};if(!p(e))return o("Raw pattern is not an object");if(!m(e.start))return o("Raw pattern is missing `start` parameter");if(void 0!==e.end){if(!m(e.end))return o("Inline pattern has non-string `end` parameter");if(0===e.start.length&&0===e.end.length)return o("Inline pattern has empty `start` and `end` parameters");let t=e.start,r=e.end;return 0===r.length&&(r=t,t=""),n("Inline",e=>({type:"inline-format",start:t,end:r,format:e}),(e,o)=>({type:"inline-command",start:t,end:r,cmd:e,value:o}))}if(void 0!==e.replacement)return m(e.replacement)?0===e.start.length?o("Replacement pattern has empty `start` parameter"):Be.value({type:"inline-command",start:"",end:e.start,cmd:"mceInsertContent",value:e.replacement}):o("Replacement pattern has non-string `replacement` parameter");{const r=null!==(t=e.trigger)&&void 0!==t?t:"space";return 0===e.start.length?o("Block pattern has empty `start` parameter"):n("Block",t=>({type:"block-format",start:e.start,format:t[0],trigger:r}),(t,o)=>({type:"block-command",start:e.start,cmd:t,value:o,trigger:r}))}},sc=e=>Y(e,rc),ac=e=>Y(e,nc),lc=(e,t)=>({...e,blockPatterns:Y(e.blockPatterns,e=>((e,t)=>("block-command"===e.type||"block-format"===e.type)&&e.trigger===t)(e,t))}),cc=e=>{const t=(e=>{const t=[],o=[];return W(e,e=>{e.fold(e=>{t.push(e)},e=>{o.push(e)})}),{errors:t,values:o}})(j(e,ic));return W(t.errors,e=>console.error(e.message,e.pattern)),t.values},dc=(e,t,o)=>{e.dispatch(t,o)},uc=(e,t,o,n)=>{e.dispatch("FormatApply",{format:t,node:o,vars:n})},hc=(e,t,o,n)=>{e.dispatch("FormatRemove",{format:t,node:o,vars:n})},mc=(e,t)=>e.dispatch("SetContent",t),pc=(e,t)=>e.dispatch("GetContent",t),gc=(e,t)=>{e.dispatch("AutocompleterUpdateActiveRange",t)},fc=(e,t)=>e.dispatch("PastePlainTextToggle",{state:t}),vc=Gt().deviceType,bc=vc.isTouch(),yc=ra.DOM,wc=e=>h(e,RegExp),_c=e=>t=>t.options.get(e),xc=e=>m(e)||p(e),Cc=(e,t="")=>o=>{const n=m(o);if(n){if(-1!==o.indexOf("=")){const r=(e=>{const t=e.indexOf("=")>0?e.split(/[;,](?![^=;,]*(?:[;,]|$))/):e.split(",");return K(t,(e,t)=>{const o=t.split("="),n=o[0],r=o.length>1?o[1]:n;return e[Je(n)]=Je(r),e},{})})(o);return{value:ke(r,e.id).getOr(t),valid:n}}return{value:o,valid:n}}return{valid:!1,message:"Must be a string."}},kc=_c("iframe_attrs"),Sc=_c("doctype"),Tc=_c("document_base_url"),Ec=_c("body_id"),Oc=_c("body_class"),Ac=_c("content_security_policy"),Mc=_c("br_in_pre"),Bc=_c("forced_root_block"),Rc=_c("forced_root_block_attrs"),Nc=_c("newline_behavior"),Vc=_c("br_newline_selector"),Dc=_c("no_newline_selector"),Pc=_c("keep_styles"),Ic=_c("end_container_on_empty_block"),Lc=_c("automatic_uploads"),Fc=_c("images_reuse_filename"),zc=_c("images_replace_blob_uris"),Hc=_c("icons"),Uc=_c("icons_url"),Zc=_c("images_upload_url"),$c=_c("images_upload_base_path"),jc=_c("images_upload_credentials"),Wc=_c("images_upload_handler"),qc=_c("content_css_cors"),Gc=_c("referrer_policy"),Yc=_c("language"),Xc=_c("language_url"),Kc=_c("indent_use_margin"),Jc=_c("indentation"),Qc=_c("content_css"),ed=_c("content_style"),td=_c("font_css"),od=_c("directionality"),nd=_c("inline_boundaries_selector"),rd=_c("object_resizing"),id=_c("resize_img_proportional"),sd=_c("placeholder"),ad=_c("event_root"),ld=_c("service_message"),cd=_c("theme"),dd=_c("theme_url"),ud=_c("model"),hd=_c("model_url"),md=_c("inline_boundaries"),pd=_c("formats"),gd=_c("preview_styles"),fd=_c("format_empty_lines"),vd=_c("format_noneditable_selector"),bd=_c("custom_ui_selector"),yd=_c("inline"),wd=_c("hidden_input"),_d=_c("submit_patch"),xd=_c("add_form_submit_trigger"),Cd=_c("add_unload_trigger"),kd=_c("custom_undo_redo_levels"),Sd=_c("disable_nodechange"),Td=_c("readonly"),Ed=_c("editable_root"),Od=_c("content_css_cors"),Ad=_c("plugins"),Md=_c("external_plugins"),Bd=_c("block_unsupported_drop"),Rd=_c("visual"),Nd=_c("visual_table_class"),Vd=_c("visual_anchor_class"),Dd=_c("iframe_aria_text"),Pd=_c("setup"),Id=_c("init_instance_callback"),Ld=_c("urlconverter_callback"),Fd=_c("auto_focus"),zd=_c("browser_spellcheck"),Hd=_c("protect"),Ud=_c("paste_block_drop"),Zd=_c("paste_data_images"),$d=_c("paste_preprocess"),jd=_c("paste_postprocess"),Wd=_c("newdocument_content"),qd=_c("paste_webkit_styles"),Gd=_c("paste_remove_styles_if_webkit"),Yd=_c("paste_merge_formats"),Xd=_c("smart_paste"),Kd=_c("paste_as_text"),Jd=_c("paste_tab_spaces"),Qd=_c("allow_html_data_urls"),eu=_c("text_patterns"),tu=_c("text_patterns_lookup"),ou=_c("noneditable_class"),nu=_c("editable_class"),ru=_c("noneditable_regexp"),iu=_c("preserve_cdata"),su=_c("highlight_on_focus"),au=_c("xss_sanitization"),lu=_c("init_content_sync"),cu=e=>ao.explode(e.options.get("images_file_types")),du=_c("table_tab_navigation"),uu=_c("details_initial_state"),hu=_c("details_serialized_state"),mu=_c("sandbox_iframes"),pu=e=>e.options.get("sandbox_iframes_exclusions"),gu=_c("convert_unsafe_embeds"),fu=_c("license_key"),vu=_c("api_key"),bu=_c("disabled"),yu=Wr,wu=ti,_u=e=>{const t=e.parentNode;t&&t.removeChild(e)},xu=e=>{const t=Ia(e);return{count:e.length-t.length,text:t}},Cu=e=>{let t;for(;-1!==(t=e.data.lastIndexOf(Da));)e.deleteData(t,1)},ku=(e,t)=>(Tu(e),t),Su=(e,t)=>Dl.isTextPosition(t)?((e,t)=>wu(e)&&t.container()===e?((e,t)=>{const o=xu(e.data.substr(0,t.offset())),n=xu(e.data.substr(t.offset()));return(o.text+n.text).length>0?(Cu(e),Dl(e,t.offset()-o.count)):t})(e,t):ku(e,t))(e,t):((e,t)=>t.container()===e.parentNode?((e,t)=>{const o=t.container(),n=((e,t)=>{const o=U(e,t);return-1===o?L.none():L.some(o)})(ue(o.childNodes),e).map(e=>e<t.offset()?Dl(o,t.offset()-1):t).getOr(t);return Tu(e),n})(e,t):ku(e,t))(e,t),Tu=e=>{yu(e)&&Ua(e)&&(Za(e)?e.removeAttribute("data-mce-caret"):_u(e)),wu(e)&&(Cu(e),0===e.data.length&&_u(e))},Eu=ui,Ou=gi,Au=mi,Mu=(e,t,o)=>{const n=Ja(t.getBoundingClientRect(),o);let r,i;if("BODY"===e.tagName){const t=e.ownerDocument.documentElement;r=e.scrollLeft||t.scrollLeft,i=e.scrollTop||t.scrollTop}else{const t=e.getBoundingClientRect();r=e.scrollLeft-t.left,i=e.scrollTop-t.top}n.left+=r,n.right+=r,n.top+=i,n.bottom+=i,n.width=1;let s=t.offsetWidth-t.clientWidth;return s>0&&(o&&(s*=-1),n.left+=s,n.right+=s),n},Bu=(e,t,o,n)=>{const r=je();let i,s;const a=Bc(e),l=e.dom,c=()=>{(e=>{var t,o;const n=yr(mo(e),"*[contentEditable=false],video,audio,embed,object");for(let e=0;e<n.length;e++){const r=n[e].dom;let i=r.previousSibling;if(qa(i)){const e=i.data;1===e.length?null===(t=i.parentNode)||void 0===t||t.removeChild(i):i.deleteData(e.length-1,1)}i=r.nextSibling,Wa(i)&&(1===i.data.length?null===(o=i.parentNode)||void 0===o||o.removeChild(i):i.deleteData(0,1))}})(t),s&&(Tu(s),s=null),r.on(e=>{l.remove(e.caret),r.clear()}),i&&(clearInterval(i),i=void 0)};return{isShowing:r.isSet,show:(e,d)=>{let u;if(c(),Au(d))return null;if(!o(d))return s=((e,t)=>{var o;const n=(null!==(o=e.ownerDocument)&&void 0!==o?o:document).createTextNode(Da),r=e.parentNode;if(t){const t=e.previousSibling;if(Fa(t)){if(Ua(t))return t;if(qa(t))return t.splitText(t.data.length-1)}null==r||r.insertBefore(n,e)}else{const t=e.nextSibling;if(Fa(t)){if(Ua(t))return t;if(Wa(t))return t.splitText(1),t}e.nextSibling?null==r||r.insertBefore(n,e.nextSibling):null==r||r.appendChild(n)}return n})(d,e),u=d.ownerDocument.createRange(),Nu(s.nextSibling)?(u.setStart(s,0),u.setEnd(s,0)):(u.setStart(s,1),u.setEnd(s,1)),u;{const o=((e,t,o)=>{var n;const r=(null!==(n=t.ownerDocument)&&void 0!==n?n:document).createElement(e);r.setAttribute("data-mce-caret",o?"before":"after"),r.setAttribute("data-mce-bogus","all"),r.appendChild(Na().dom);const i=t.parentNode;return o?null==i||i.insertBefore(r,t):t.nextSibling?null==i||i.insertBefore(r,t.nextSibling):null==i||i.appendChild(r),r})(a,d,e),c=Mu(t,d,e);l.setStyle(o,"top",c.top),l.setStyle(o,"caret-color","transparent"),s=o;const h=l.create("div",{class:"mce-visual-caret","data-mce-bogus":"all"});l.setStyles(h,{...c}),l.add(t,h),r.set({caret:h,element:d,before:e}),e&&l.addClass(h,"mce-visual-caret-before"),i=window.setInterval(()=>{r.on(e=>{n()?l.toggleClass(e.caret,"mce-visual-caret-hidden"):l.addClass(e.caret,"mce-visual-caret-hidden")})},500),u=d.ownerDocument.createRange(),u.setStart(o,0),u.setEnd(o,0)}return u},hide:c,getCss:()=>".mce-visual-caret {position: absolute;background-color: black;background-color: currentcolor;}.mce-visual-caret-hidden {display: none;}*[data-mce-caret] {position: absolute;left: -1000px;right: auto;top: 0;margin: 0;padding: 0;}",reposition:()=>{r.on(e=>{const o=Mu(t,e.element,e.before);l.setStyles(e.caret,{...o})})},destroy:()=>clearInterval(i)}},Ru=()=>no.browser.isFirefox(),Nu=e=>Eu(e)||Ou(e),Vu=e=>(Nu(e)||Jr(e)&&Ru())&&Io(mo(e)).exists(gr),Du=di,Pu=ui,Iu=gi,Lu=Xr("display","block table table-cell table-row table-caption list-item"),Fu=Ua,zu=za,Hu=Wr,Uu=ti,Zu=gl,$u=e=>1===e,ju=e=>-1===e,Wu=(e,t)=>{let o;for(;o=e(t);)if(!zu(o))return o;return null},qu=(e,t,o,n,r)=>{const i=new Fr(e,n),s=Pu(e)||zu(e);let a;if(ju(t)){if(s&&(a=Wu(i.prev.bind(i),!0),o(a)))return a;for(;a=Wu(i.prev.bind(i),r);)if(o(a))return a}if($u(t)){if(s&&(a=Wu(i.next.bind(i),!0),o(a)))return a;for(;a=Wu(i.next.bind(i),r);)if(o(a))return a}return null},Gu=(e,t)=>{for(;e&&e!==t;){if(Lu(e))return e;e=e.parentNode}return null},Yu=(e,t,o)=>Gu(e.container(),o)===Gu(t.container(),o),Xu=(e,t)=>{if(!t)return L.none();const o=t.container(),n=t.offset();return Hu(o)?L.from(o.childNodes[n+e]):L.none()},Ku=(e,t)=>{var o;const n=(null!==(o=t.ownerDocument)&&void 0!==o?o:document).createRange();return e?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),n},Ju=(e,t,o)=>Gu(t,e)===Gu(o,e),Qu=(e,t,o)=>{const n=e?"previousSibling":"nextSibling";let r=o;for(;r&&r!==t;){let e=r[n];if(e&&Fu(e)&&(e=e[n]),Pu(e)||Iu(e)){if(Ju(t,e,r))return e;break}if(Zu(e))break;r=r.parentNode}return null},eh=B(Ku,!0),th=B(Ku,!1),oh=(e,t,o)=>{let n;const r=B(Qu,!0,t),i=B(Qu,!1,t),s=o.startContainer,a=o.startOffset;if(za(s)){const e=Uu(s)?s.parentNode:s,t=e.getAttribute("data-mce-caret");if("before"===t&&(n=e.nextSibling,Vu(n)))return eh(n);if("after"===t&&(n=e.previousSibling,Vu(n)))return th(n)}if(!o.collapsed)return o;if(ti(s)){if(Fu(s)){if(1===e){if(n=i(s),n)return eh(n);if(n=r(s),n)return th(n)}if(-1===e){if(n=r(s),n)return th(n);if(n=i(s),n)return eh(n)}return o}if(qa(s)&&a>=s.data.length-1)return 1===e&&(n=i(s),n)?eh(n):o;if(Wa(s)&&a<=1)return-1===e&&(n=r(s),n)?th(n):o;if(a===s.data.length)return n=i(s),n?eh(n):o;if(0===a)return n=r(s),n?th(n):o}return o},nh=(e,t)=>Xu(e?0:-1,t).filter(Pu),rh=(e,t,o)=>{const n=oh(e,t,o);return-1===e?Dl.fromRangeStart(n):Dl.fromRangeEnd(n)},ih=e=>L.from(e.getNode()).map(mo),sh=(e,t)=>{let o=t;for(;o=e(o);)if(o.isVisible())return o;return o},ah=(e,t)=>{const o=Yu(e,t);return!(o||!ai(e.getNode()))||o},lh=ui,ch=ti,dh=Wr,uh=ai,hh=gl,mh=e=>hl(e)||(e=>!!fl(e)&&!K(ue(e.getElementsByTagName("*")),(e,t)=>e||al(t),!1))(e),ph=vl,gh=(e,t)=>e.hasChildNodes()&&t<e.childNodes.length?e.childNodes[t]:null,fh=(e,t)=>{if($u(e)){if(hh(t.previousSibling)&&!ch(t.previousSibling))return Dl.before(t);if(ch(t))return Dl(t,0)}if(ju(e)){if(hh(t.nextSibling)&&!ch(t.nextSibling))return Dl.after(t);if(ch(t))return Dl(t,t.data.length)}return ju(e)?uh(t)?Dl.before(t):Dl.after(t):Dl.before(t)},vh=(e,t,o)=>{let n,r,i,s;if(!dh(o)||!t)return null;if(t.isEqual(Dl.after(o))&&o.lastChild){if(s=Dl.after(o.lastChild),ju(e)&&hh(o.lastChild)&&dh(o.lastChild))return uh(o.lastChild)?Dl.before(o.lastChild):s}else s=t;const a=s.container();let l=s.offset();if(ch(a)){if(ju(e)&&l>0)return Dl(a,--l);if($u(e)&&l<a.length)return Dl(a,++l);n=a}else{if(ju(e)&&l>0&&(r=gh(a,l-1),hh(r)))return!mh(r)&&(i=qu(r,e,ph,r),i)?ch(i)?Dl(i,i.data.length):Dl.after(i):ch(r)?Dl(r,r.data.length):Dl.before(r);if($u(e)&&l<a.childNodes.length&&(r=gh(a,l),hh(r)))return uh(r)?((e,t)=>{const o=t.nextSibling;return o&&hh(o)?ch(o)?Dl(o,0):Dl.before(o):vh(1,Dl.after(t),e)})(o,r):!mh(r)&&(i=qu(r,e,ph,r),i)?ch(i)?Dl(i,0):Dl.before(i):ch(r)?Dl(r,0):Dl.after(r);n=r||s.getNode()}if(n&&($u(e)&&s.isAtEnd()||ju(e)&&s.isAtStart())&&(n=qu(n,e,I,o,!0),ph(n,o)))return fh(e,n);r=n?qu(n,e,ph,o):n;const c=bt(Y(((e,t)=>{const o=[];let n=e;for(;n&&n!==t;)o.push(n),n=n.parentNode;return o})(a,o),lh));return!c||r&&c.contains(r)?r?fh(e,r):null:(s=$u(e)?Dl.after(c):Dl.before(c),s)},bh=e=>({next:t=>vh(1,t,e),prev:t=>vh(-1,t,e)}),yh=e=>Dl.isTextPosition(e)?0===e.offset():gl(e.getNode()),wh=e=>{if(Dl.isTextPosition(e)){const t=e.container();return e.offset()===t.data.length}return gl(e.getNode(!0))},_h=(e,t)=>!Dl.isTextPosition(e)&&!Dl.isTextPosition(t)&&e.getNode()===t.getNode(!0),xh=(e,t,o)=>{const n=bh(t);return L.from(e?n.next(o):n.prev(o))},Ch=(e,t,o)=>xh(e,t,o).bind(n=>Yu(o,n,t)&&((e,t,o)=>{return e?!_h(t,o)&&(n=t,!(!Dl.isTextPosition(n)&&ai(n.getNode())))&&wh(t)&&yh(o):!_h(o,t)&&yh(t)&&wh(o);var n})(e,o,n)?xh(e,t,n):L.some(n)),kh=(e,t,o,n)=>Ch(e,t,o).bind(o=>n(o)?kh(e,t,o,n):L.some(o)),Sh=(e,t)=>{const o=e?t.firstChild:t.lastChild;return ti(o)?L.some(Dl(o,e?0:o.data.length)):o?gl(o)?L.some(e?Dl.before(o):ai(n=o)?Dl.before(n):Dl.after(n)):((e,t,o)=>{const n=e?Dl.before(o):Dl.after(o);return xh(e,t,n)})(e,t,o):L.none();var n},Th=B(xh,!0),Eh=B(xh,!1),Oh=B(Sh,!0),Ah=B(Sh,!1),Mh="_mce_caret",Bh=e=>Wr(e)&&e.id===Mh,Rh=(e,t)=>{let o=t;for(;o&&o!==e;){if(Bh(o))return o;o=o.parentNode}return null},Nh=e=>Se(e,"name"),Vh=e=>ao.isArray(e.start),Dh=e=>!(!Nh(e)&&b(e.forward))||e.forward,Ph=(e,t)=>(Wr(t)&&e.isBlock(t)&&!t.innerHTML&&(t.innerHTML='<br data-mce-bogus="1" />'),t),Ih=(e,t)=>Ah(e).fold(P,e=>(t.setStart(e.container(),e.offset()),t.setEnd(e.container(),e.offset()),!0)),Lh=(e,t,o)=>!(!(e=>!e.hasChildNodes())(t)||!Rh(e,t)||(((e,t)=>{var o;const n=(null!==(o=e.ownerDocument)&&void 0!==o?o:document).createTextNode(Da);e.appendChild(n),t.setStart(n,0),t.setEnd(n,0)})(t,o),0)),Fh=(e,t,o,n)=>{const r=o[t?"start":"end"],i=e.getRoot();if(r){let e=i,o=r[0];for(let t=r.length-1;e&&t>=1;t--){const o=e.childNodes;if(Lh(i,e,n))return!0;if(r[t]>o.length-1)return!!Lh(i,e,n)||Ih(e,n);e=o[r[t]]}ti(e)&&(o=Math.min(r[0],e.data.length)),Wr(e)&&(o=Math.min(r[0],e.childNodes.length)),t?n.setStart(e,o):n.setEnd(e,o)}return!0},zh=e=>ti(e)&&e.data.length>0,Hh=(e,t,o)=>{const n=e.get(o.id+"_"+t),r=null==n?void 0:n.parentNode,i=o.keep;if(n&&r){let s,a;if("start"===t?i?n.hasChildNodes()?(s=n.firstChild,a=1):zh(n.nextSibling)?(s=n.nextSibling,a=0):zh(n.previousSibling)?(s=n.previousSibling,a=n.previousSibling.data.length):(s=r,a=e.nodeIndex(n)+1):(s=r,a=e.nodeIndex(n)):i?n.hasChildNodes()?(s=n.firstChild,a=1):zh(n.previousSibling)?(s=n.previousSibling,a=n.previousSibling.data.length):(s=r,a=e.nodeIndex(n)):(s=r,a=e.nodeIndex(n)),!i){const r=n.previousSibling,i=n.nextSibling;let l;for(ao.each(ao.grep(n.childNodes),e=>{ti(e)&&(e.data=e.data.replace(/\uFEFF/g,""))});l=e.get(o.id+"_"+t);)e.remove(l,!0);if(ti(i)&&ti(r)&&!no.browser.isOpera()){const t=r.data.length;r.appendData(i.data),e.remove(i),s=r,a=t}}return L.some(Dl(s,a))}return L.none()},Uh=(e,t,o)=>((e,t,o=!1)=>2===t?Ql(Ia,o,e):3===t?(e=>{const t=e.getRng();return{start:jl(e.dom.getRoot(),Dl.fromRangeStart(t)),end:jl(e.dom.getRoot(),Dl.fromRangeEnd(t)),forward:e.isForward()}})(e):t?(e=>({rng:e.getRng(),forward:e.isForward()}))(e):tc(e,!1))(e,t,o),Zh=(e,t)=>{((e,t)=>{const o=e.dom;if(t){if(Vh(t))return((e,t)=>{const o=e.createRng();return Fh(e,!0,t,o)&&Fh(e,!1,t,o)?L.some({range:o,forward:Dh(t)}):L.none()})(o,t);if((e=>m(e.start))(t))return((e,t)=>{const o=L.from(Wl(e.getRoot(),t.start)),n=L.from(Wl(e.getRoot(),t.end));return He(o,n,(o,n)=>{const r=e.createRng();return r.setStart(o.container(),o.offset()),r.setEnd(n.container(),n.offset()),{range:r,forward:Dh(t)}})})(o,t);if((e=>Se(e,"id"))(t))return((e,t)=>{const o=Hh(e,"start",t),n=Hh(e,"end",t);return He(o,n.or(o),(o,n)=>{const r=e.createRng();return r.setStart(Ph(e,o.container()),o.offset()),r.setEnd(Ph(e,n.container()),n.offset()),{range:r,forward:Dh(t)}})})(o,t);if(Nh(t))return((e,t)=>L.from(e.select(t.name)[t.index]).map(t=>{const o=e.createRng();return o.selectNode(t),{range:o,forward:!0}}))(o,t);if((e=>Se(e,"rng"))(t))return L.some({range:t.rng,forward:Dh(t)})}return L.none()})(e,t).each(({range:t,forward:o})=>{e.setRng(t,o)})},$h=e=>Wr(e)&&"SPAN"===e.tagName&&"bookmark"===e.getAttribute("data-mce-type"),jh=(Wh=lt,e=>Wh===e);var Wh;const qh=e=>""!==e&&-1!==" \f\n\r\t\v".indexOf(e),Gh=e=>!qh(e)&&!jh(e)&&!ct(e),Yh=e=>{const t=[];if(e)for(let o=0;o<e.rangeCount;o++)t.push(e.getRangeAt(o));return t},Xh=(e,t)=>{const o=yr(t,"td[data-mce-selected],th[data-mce-selected]");return o.length>0?o:(e=>Y((e=>oe(e,e=>{const t=nl(e);return t?[mo(t)]:[]}))(e),Ba))(e)},Kh=e=>Xh(Yh(e.selection.getSel()),mo(e.getBody())),Jh=(e,t)=>rr(e,"table",t),Qh=e=>jo(e).fold(O([e]),t=>[e].concat(Qh(t))),em=e=>Wo(e).fold(O([e]),t=>"br"===ko(t)?Fo(t).map(t=>[e].concat(em(t))).getOr([]):[e].concat(em(t))),tm=(e,t)=>He((e=>{const t=e.startContainer,o=e.startOffset;return ti(t)?0===o?L.some(mo(t)):L.none():L.from(t.childNodes[o]).map(mo)})(t),(e=>{const t=e.endContainer,o=e.endOffset;return ti(t)?o===t.data.length?L.some(mo(t)):L.none():L.from(t.childNodes[o-1]).map(mo)})(t),(t,o)=>{const n=Q(Qh(e),B(_o,t)),r=Q(em(e),B(_o,o));return n.isSome()&&r.isSome()}).getOr(!1),om=(e,t,o,n)=>{const r=o,i=new Fr(o,r),s=_e(e.schema.getMoveCaretBeforeOnEnterElements(),(e,t)=>!Z(["td","th","table"],t.toLowerCase()));let a=o;do{if(ti(a)&&0!==ao.trim(a.data).length)return void(n?t.setStart(a,0):t.setEnd(a,a.data.length));if(s[a.nodeName])return void(n?t.setStartBefore(a):"BR"===a.nodeName?t.setEndBefore(a):t.setEndAfter(a))}while(a=n?i.next():i.prev());"BODY"===r.nodeName&&(n?t.setStart(r,0):t.setEnd(r,r.childNodes.length))},nm=e=>{const t=e.selection.getSel();return _(t)&&t.rangeCount>0},rm=(e,t)=>{const o=Kh(e);o.length>0?W(o,o=>{const n=o.dom,r=e.dom.createRng();r.setStartBefore(n),r.setEndAfter(n),t(r,!0)}):t(e.selection.getRng(),!1)},im=(e,t,o)=>{const n=tc(e,t);o(n),e.moveToBookmark(n)},sm=e=>C(null==e?void 0:e.nodeType),am=e=>Wr(e)&&!$h(e)&&!Bh(e)&&!Kr(e),lm=(e,t,o)=>{const{selection:n,dom:r}=e,i=n.getNode(),s=ui(i);im(n,!0,()=>{t()}),s&&ui(i)&&r.isChildOf(i,e.getBody())?e.selection.select(i):o(n.getStart())&&cm(r,n)},cm=(e,t)=>{var o,n;const r=t.getRng(),{startContainer:i,startOffset:s}=r;if(!((e,t)=>{if(am(t)&&!/^(TD|TH)$/.test(t.nodeName)){const o=e.getAttrib(t,"data-mce-selected"),n=parseInt(o,10);return!isNaN(n)&&n>0}return!1})(e,t.getNode())&&Wr(i)){const a=i.childNodes,l=e.getRoot();let c;if(s<a.length){const t=a[s];c=new Fr(t,null!==(o=e.getParent(t,e.isBlock))&&void 0!==o?o:l)}else{const t=a[a.length-1];c=new Fr(t,null!==(n=e.getParent(t,e.isBlock))&&void 0!==n?n:l),c.next(!0)}for(let o=c.current();o;o=c.next()){if("false"===e.getContentEditable(o))return;if(ti(o)&&!mm(o))return r.setStart(o,0),void t.setRng(r)}}},dm=(e,t,o)=>{if(e){const n=t?"nextSibling":"previousSibling";for(e=o?e:e[n];e;e=e[n])if(Wr(e)||!mm(e))return e}},um=(e,t)=>!!e.getTextBlockElements()[t.nodeName.toLowerCase()]||Ui(e,t),hm=(e,t,o)=>e.schema.isValidChild(t,o),mm=(e,t=!1)=>{if(_(e)&&ti(e)){const o=t?e.data.replace(/ /g," "):e.data;return Hr(o)}return!1},pm=(e,t)=>{const o=e.dom;return am(t)&&"false"===o.getContentEditable(t)&&((e,t)=>{const o="[data-mce-cef-wrappable]",n=vd(e),r=ot(n)?o:`${o},${n}`;return yo(mo(t),r)})(e,t)&&0===o.select('[contenteditable="true"]',t).length},gm=(e,t)=>x(e)?e(t):(_(t)&&(e=e.replace(/%(\w+)/g,(e,o)=>t[o]||e)),e),fm=(e,t)=>(t=t||"",e=""+((e=e||"").nodeName||e),t=""+(t.nodeName||t),e.toLowerCase()===t.toLowerCase()),vm=(e,t)=>{if(w(e))return null;{let o=String(e);return"color"!==t&&"backgroundColor"!==t||(o=Ls(o)),"fontWeight"===t&&700===e&&(o="bold"),"fontFamily"===t&&(o=o.replace(/[\'\"]/g,"").replace(/,\s+/g,",")),o}},bm=(e,t,o)=>{const n=e.getStyle(t,o);return vm(n,o)},ym=(e,t)=>{let o;return e.getParent(t,t=>!!Wr(t)&&(o=e.getStyle(t,"text-decoration"),!!o&&"none"!==o)),o},wm=(e,t,o)=>e.getParents(t,o,e.getRoot()),_m=(e,t,o)=>{const n=e.formatter.get(t);return _(n)&&$(n,o)},xm=e=>Te(e,"block"),Cm=e=>Te(e,"selector"),km=e=>Te(e,"inline"),Sm=e=>Cm(e)&&!1!==e.expand&&!km(e),Tm=e=>(e=>{const t=[];let o=e;for(;o;){if(ti(o)&&o.data!==Da||o.childNodes.length>1)return[];Wr(o)&&t.push(o),o=o.firstChild}return t})(e).length>0,Em=e=>Bh(e.dom)&&Tm(e.dom),Om=$h,Am=wm,Mm=mm,Bm=um,Rm=e=>ai(e)&&e.getAttribute("data-mce-bogus")&&!e.nextSibling,Nm=(e,t)=>{let o=t;for(;o;){if(Wr(o)&&e.getContentEditable(o))return"false"===e.getContentEditable(o)?o:t;o=o.parentNode}return t},Vm=(e,t,o,n)=>{const r=t.data;if(e){for(let e=o;e>0;e--)if(n(r.charAt(e-1)))return e}else for(let e=o;e<r.length;e++)if(n(r.charAt(e)))return e;return-1},Dm=(e,t,o)=>Vm(e,t,o,e=>jh(e)||qh(e)),Pm=(e,t,o)=>Vm(e,t,o,Gh),Im=(e,t,o,n,r,i)=>{let s;const a=e.getParent(o,t=>hi(t)||e.isBlock(t)),l=_(a)?a:t,c=(t,o,n)=>{const i=ka(e),a=r?i.backwards:i.forwards;return L.from(a(t,o,(e,t)=>Om(e.parentNode)?-1:(s=e,n(r,e,t)),l))};return c(o,n,Dm).bind(e=>i?c(e.container,e.offset+(r?-1:0),Pm):L.some(e)).orThunk(()=>s?L.some({container:s,offset:r?0:s.length}):L.none())},Lm=(e,t,o,n,r)=>{const i=n[r];ti(n)&&ot(n.data)&&i&&(n=i);const s=Am(e,n);for(let n=0;n<s.length;n++)for(let r=0;r<t.length;r++){const i=t[r];if((!_(i.collapsed)||i.collapsed===o.collapsed)&&Cm(i)&&e.is(s[n],i.selector))return s[n]}return n},Fm=(e,t,o,n)=>{var r;let i=o;const s=e.getRoot(),a=t[0];if(xm(a)&&(i=a.wrapper?null:e.getParent(o,a.block,s)),!i){const t=null!==(r=e.getParent(o,"LI,TD,TH,SUMMARY"))&&void 0!==r?r:s;i=e.getParent(ti(o)?o.parentNode:o,t=>t!==s&&Bm(e.schema,t),t)}if(i&&xm(a)&&a.wrapper&&(i=Am(e,i,"ul,ol").reverse()[0]||i),!i)for(i=o;i&&i[n]&&!e.isBlock(i[n])&&(i=i[n],!fm(i,"br")););return i||o},zm=(e,t,o,n)=>{const r=o.parentNode;return!_(o[n])&&(!(r!==t&&!w(r)&&!e.isBlock(r))||zm(e,t,r,n))},Hm=(e,t,o,n,r,i)=>{let s=o;const a=r?"previousSibling":"nextSibling",l=e.getRoot();if(ti(o)&&!Mm(o)&&(r?n>0:n<o.data.length))return o;for(;s;){if(hi(s))return o;if(!t[0].block_expand&&e.isBlock(s))return i?s:o;for(let t=s[a];t;t=t[a]){const o=ti(t)&&!zm(e,l,t,a);if(!Om(t)&&!Rm(t)&&!Mm(t,o))return s}if(s===l||s.parentNode===l){o=s;break}s=s.parentNode}return o},Um=e=>Om(e.parentNode)||Om(e),Zm=(e,t,o,n={})=>{const{includeTrailingSpace:r=!1,expandToBlock:i=!0}=n,s=e.getParent(t.commonAncestorContainer,e=>hi(e)),a=_(s)?s:e.getRoot();let{startContainer:l,startOffset:c,endContainer:d,endOffset:u}=t;const h=o[0];return Wr(l)&&l.hasChildNodes()&&(l=rl(l,c),ti(l)&&(c=0)),Wr(d)&&d.hasChildNodes()&&(d=rl(d,t.collapsed?u:u-1),ti(d)&&(u=d.data.length)),l=Nm(e,l),d=Nm(e,d),Um(l)&&(l=Om(l)?l:l.parentNode,l=t.collapsed?l.previousSibling||l:l.nextSibling||l,ti(l)&&(c=t.collapsed?l.length:0)),Um(d)&&(d=Om(d)?d:d.parentNode,d=t.collapsed?d.nextSibling||d:d.previousSibling||d,ti(d)&&(u=t.collapsed?0:d.length)),t.collapsed&&(Im(e,a,l,c,!0,r).each(({container:e,offset:t})=>{l=e,c=t}),Im(e,a,d,u,!1,r).each(({container:e,offset:t})=>{d=e,u=t})),(km(h)||h.block_expand)&&(km(h)&&ti(l)&&0!==c||(l=Hm(e,o,l,c,!0,i)),km(h)&&ti(d)&&u!==d.data.length||(d=Hm(e,o,d,u,!1,i))),Sm(h)&&(l=Lm(e,o,t,l,"previousSibling"),d=Lm(e,o,t,d,"nextSibling")),(xm(h)||Cm(h))&&(l=Fm(e,o,l,"previousSibling"),d=Fm(e,o,d,"nextSibling"),xm(h)&&(e.isBlock(l)||(l=Hm(e,o,l,c,!0,i),ti(l)&&(c=0)),e.isBlock(d)||(d=Hm(e,o,d,u,!1,i),ti(d)&&(u=d.data.length)))),Wr(l)&&l.parentNode&&(c=e.nodeIndex(l),l=l.parentNode),Wr(d)&&d.parentNode&&(u=e.nodeIndex(d)+1,d=d.parentNode),{startContainer:l,startOffset:c,endContainer:d,endOffset:u}},$m=(e,t,o)=>{var n;const r=t.startOffset,i=rl(t.startContainer,r),s=t.endOffset,a=rl(t.endContainer,s-1),l=e=>{const t=e[0];ti(t)&&t===i&&r>=t.data.length&&e.splice(0,1);const o=e[e.length-1];return 0===s&&e.length>0&&o===a&&ti(o)&&e.splice(e.length-1,1),e},c=(e,t,o)=>{const n=[];for(;e&&e!==o;e=e[t])n.push(e);return n},d=(t,o)=>e.getParent(t,e=>e.parentNode===o,o),u=(e,t,n)=>{const r=n?"nextSibling":"previousSibling";for(let i=e,s=i.parentNode;i&&i!==t;i=s){s=i.parentNode;const t=c(i===e?i:i[r],r);t.length&&(n||t.reverse(),o(l(t)))}};if(i===a)return o(l([i]));const h=null!==(n=e.findCommonAncestor(i,a))&&void 0!==n?n:e.getRoot();if(e.isChildOf(i,a))return u(i,h,!0);if(e.isChildOf(a,i))return u(a,h);const m=d(i,h)||i,p=d(a,h)||a;u(i,m,!0);const g=c(m===i?m:m.nextSibling,"nextSibling",p===a?p.nextSibling:p);g.length&&o(l(g)),u(a,p)},jm=['pre[class*=language-][contenteditable="false"]',"figure.image","div[data-ephox-embed-iri]","div.tiny-pageembed","div.mce-toc","div[data-mce-toc]","div.mce-footnotes"],Wm=(e,t,o,n,r,i)=>{const{uid:s=t,...a}=o;ur(e,ha()),gn(e,`${pa()}`,s),gn(e,`${ma()}`,n);const{attributes:l={},classes:c=[]}=r(s,a);if(fn(e,l),((e,t)=>{W(t,t=>{ur(e,t)})})(e,c),i){c.length>0&&gn(e,`${fa()}`,c.join(","));const t=pe(l);t.length>0&&gn(e,`${va()}`,t.join(","))}},qm=(e,t,o,n,r)=>{const i=uo("span",e);return Wm(i,t,o,n,r,!1),i},Gm=(e,t,o,n,r,i)=>{const s=[],a=qm(e.getDoc(),o,i,n,r),l=je(),c=()=>{l.clear()},d=e=>{W(e,u)},u=t=>{switch(((e,t,o,n)=>Io(t).fold(()=>"skipping",r=>"br"===n||(e=>Ao(e)&&Kn(e)===Da)(t)?"valid":(e=>Oo(e)&&pr(e,ha()))(t)?"existing":Bh(t.dom)?"caret":$(jm,e=>yo(t,e))?"valid-block":hm(e,o,n)&&hm(e,ko(r),o)?"valid":"invalid-child"))(e,t,"span",ko(t))){case"invalid-child":{c();const e=Zo(t);d(e),c();break}case"valid-block":c(),Wm(t,o,i,n,r,!0);break;case"valid":{const e=l.get().getOrThunk(()=>{const e=Tn(a);return s.push(e),l.set(e),e});hn(t,e);break}}};return $m(e.dom,t,e=>{c(),(e=>{const t=j(e,mo);d(t)})(e)}),s},Ym=e=>{const t=(()=>{const e={};return{register:(t,o)=>{e[t]={name:t,settings:o}},lookup:t=>ke(e,t).map(e=>e.settings),getNames:()=>pe(e)}})();((e,t)=>{const o=ma(),n=e=>L.from(e.attr(o)).bind(t.lookup),r=e=>{var t,o;e.attr(pa(),null),e.attr(ma(),null),e.attr(ga(),null);const n=L.from(e.attr(va())).map(e=>e.split(",")).getOr([]),r=L.from(e.attr(fa())).map(e=>e.split(",")).getOr([]);W(n,t=>e.attr(t,null));const i=null!==(o=null===(t=e.attr("class"))||void 0===t?void 0:t.split(" "))&&void 0!==o?o:[],s=ie(i,[ha()].concat(r));e.attr("class",s.length>0?s.join(" "):null),e.attr(fa(),null),e.attr(va(),null)};e.serializer.addTempAttr(ga()),e.serializer.addAttributeFilter(o,e=>{for(const t of e)n(t).each(e=>{!1===e.persistent&&("span"===t.name?t.unwrap():r(t))})})})(e,t);const o=((e,t)=>{const o=Oe({}),n=()=>({listeners:[],previous:je()}),r=(e,t)=>{i(e,e=>(t(e),e))},i=(e,t)=>{const r=o.get(),i=t(ke(r,e).getOrThunk(n));r[e]=i,o.set(r)},s=(t,o)=>{W(_a(e,t),e=>{o?gn(e,ga(),"true"):wn(e,ga())})},a=it(()=>{const o=ae(t.getNames());W(o,t=>{i(t,o=>{const n=o.previous.get();return ya(e,L.some(t)).fold(()=>{n.each(e=>{(e=>{r(e,t=>{W(t.listeners,t=>t(!1,e))})})(t),o.previous.clear(),s(e,!1)})},({uid:e,name:t,elements:i})=>{Fe(n,e)||(n.each(e=>s(e,!1)),((e,t,o)=>{r(e,n=>{W(n.listeners,n=>n(!0,e,{uid:t,nodes:j(o,e=>e.dom)}))})})(t,e,i),o.previous.set(e),s(e,!0))}),{previous:o.previous,listeners:o.listeners}})})},30);return e.on("remove",()=>{a.cancel()}),e.on("NodeChange",()=>{a.throttle()}),{addListener:(e,t)=>{i(e,e=>({previous:e.previous,listeners:e.listeners.concat([t])}))}}})(e,t),n=Ro("span"),r=e=>{W(e,e=>{n(e)?kn(e):(e=>{mr(e,ha()),wn(e,`${pa()}`),wn(e,`${ma()}`),wn(e,`${ga()}`);const t=bn(e,`${va()}`).map(e=>e.split(",")).getOr([]),o=bn(e,`${fa()}`).map(e=>e.split(",")).getOr([]);var n;W(t,t=>wn(e,t)),n=e,W(o,e=>{mr(n,e)}),wn(e,`${fa()}`),wn(e,`${va()}`)})(e)})};return{register:(e,o)=>{t.register(e,o)},annotate:(o,n)=>{t.lookup(o).each(t=>{((e,t,o,n)=>{e.undoManager.transact(()=>{const r=e.selection,i=r.getRng(),s=Kh(e).length>0,a=De("mce-annotation");if(i.collapsed&&!s&&((e,t)=>{const o=Zm(e.dom,t,[{inline:"span"}]);t.setStart(o.startContainer,o.startOffset),t.setEnd(o.endContainer,o.endOffset),e.selection.setRng(t)})(e,i),r.getRng().collapsed&&!s){const i=qm(e.getDoc(),a,n,t,o.decorate);Mn(i,lt),r.getRng().insertNode(i.dom),r.select(i.dom)}else im(r,!1,()=>{rm(e,r=>{Gm(e,r,a,t,o.decorate,n)})})})})(e,o,t,n)})},annotationChanged:(e,t)=>{o.addListener(e,t)},remove:t=>{ya(e,L.some(t)).each(({elements:t})=>{const o=e.selection.getBookmark();r(t),e.selection.moveToBookmark(o)})},removeAll:t=>{const o=e.selection.getBookmark();fe(xa(e,t),(e,t)=>{r(e)}),e.selection.moveToBookmark(o)},getAll:t=>{const o=xa(e,t);return ve(o,e=>j(e,e=>e.dom))}}},Xm=e=>({getBookmark:B(Uh,e),moveToBookmark:B(Zh,e)});Xm.isBookmarkNode=$h;const Km=(e,t,o)=>!o.collapsed&&$(o.getClientRects(),o=>((e,t,o)=>t>=e.left&&t<=e.right&&o>=e.top&&o<=e.bottom)(o,e,t)),Jm=(e,t)=>{const o=Ao(t)?Kn(t).length:Zo(t).length+1;return e>o?o:e<0?0:e},Qm=e=>Br.range(e.start,Jm(e.soffset,e.start),e.finish,Jm(e.foffset,e.finish)),ep=(e,t)=>!jr(t.dom)&&(xo(e,t)||_o(e,t)),tp=e=>t=>ep(e,t.start)&&ep(e,t.finish),op=e=>Br.range(mo(e.startContainer),e.startOffset,mo(e.endContainer),e.endOffset),np=e=>{const t=document.createRange();try{return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),L.some(t)}catch(e){return L.none()}},rp=e=>{const t=(e=>e.inline||no.browser.isFirefox())(e)?(o=mo(e.getBody()),(e=>{const t=e.getSelection();return(t&&0!==t.rangeCount?L.from(t.getRangeAt(0)):L.none()).map(op)})(Do(o).dom).filter(tp(o))):L.none();var o;e.bookmark=t.isSome()?t:e.bookmark},ip=e=>(e.bookmark?e.bookmark:L.none()).bind(t=>{return o=mo(e.getBody()),n=t,L.from(n).filter(tp(o)).map(Qm);var o,n}).bind(np),sp={isEditorUIElement:e=>{const t=e.className.toString();return-1!==t.indexOf("tox-")||-1!==t.indexOf("mce-")}},ap={setEditorTimeout:(e,t,o)=>((e,t)=>(C(t)||(t=0),window.setTimeout(e,t)))(()=>{e.removed||t()},o),setEditorInterval:(e,t,o)=>{const n=((e,t)=>(C(t)||(t=0),window.setInterval(e,t)))(()=>{e.removed?window.clearInterval(n):t()},o);return n}},lp=(e,t)=>e.view(t).fold(O([]),t=>{const o=e.owner(t),n=lp(e,o);return[t].concat(n)});var cp=Object.freeze({__proto__:null,view:e=>{var t;return(e.dom===document?L.none():L.from(null===(t=e.dom.defaultView)||void 0===t?void 0:t.frameElement)).map(mo)},owner:e=>Vo(e)});const dp=e=>{const t=nn(),o=Wn(t),n=((e,t)=>{const o=t.owner(e);return lp(t,o)})(e,cp),r=jn(e),i=X(n,(e,t)=>{const o=jn(t);return{left:e.left+o.left,top:e.top+o.top}},{left:0,top:0});return Zn(i.left+r.left+o.left,i.top+r.top+o.top)};let up;const hp=ra.DOM,mp=e=>{const t=e.classList;return void 0!==t&&(t.contains("tox-edit-area")||t.contains("tox-edit-area__iframe")||t.contains("mce-content-body"))},pp=(e,t)=>{const o=bd(e),n=hp.getParent(t,t=>(e=>Wr(e)&&sp.isEditorUIElement(e))(t)||!!o&&e.dom.is(t,o));return null!==n},gp=e=>{try{const t=Yo(mo(e.getElement()));return an(t).fold(()=>document.body,e=>e.dom)}catch(e){return document.body}},fp=(e,t)=>{const o=t.editor;(e=>{const t=rt(()=>{rp(e)},0);e.on("init",()=>{e.inline&&((e,t)=>{const o=()=>{t.throttle()};ra.DOM.bind(document,"mouseup",o),e.on("remove",()=>{ra.DOM.unbind(document,"mouseup",o)})})(e,t),((e,t)=>{((e,t)=>{e.on("mouseup touchend",e=>{t.throttle()})})(e,t),e.on("keyup NodeChange AfterSetSelectionRange",t=>{(e=>"nodechange"===e.type&&e.selectionChange)(t)||rp(e)})})(e,t)}),e.on("remove",()=>{t.cancel()})})(o);const n=(e,t)=>{su(e)&&!0!==e.inline&&t(mo(e.getContainer()),"tox-edit-focus")};o.on("focusin",()=>{const t=e.focusedEditor;if(mp(gp(o))&&n(o,ur),t!==o){t&&t.dispatch("blur",{focusedEditor:o}),e.setActive(o),e.focusedEditor=o,o.dispatch("focus",{blurredEditor:t}),o.focus(!0);const n=Gt().browser;!0!==o.inline&&(n.isSafari()||n.isChromium())&&(e=>{if(!e.iframeElement)return;const t=mo(e.iframeElement),o=dp(t),n=Lr(window);(o.top<n.y||o.top>n.bottom-25)&&t.dom.scrollIntoView({block:"center"})})(o)}}),o.on("focusout",()=>{ap.setEditorTimeout(o,()=>{const t=e.focusedEditor;mp(gp(o))&&t===o||n(o,mr),pp(o,gp(o))||t!==o||(o.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null)})}),up||(up=t=>{const o=e.activeEditor;o&&Jo(t).each(t=>{const n=t;n.ownerDocument===document&&(n===document.body||pp(o,n)||e.focusedEditor!==o||(o.dispatch("blur",{focusedEditor:null}),e.focusedEditor=null))})},hp.bind(document,"focusin",up))},vp=(e,t)=>{e.focusedEditor===t.editor&&(e.focusedEditor=null),!e.activeEditor&&up&&(hp.unbind(document,"focusin",up),up=null)},bp=(e,t)=>{((e,t)=>(e=>e.collapsed?L.from(rl(e.startContainer,e.startOffset)).map(mo):L.none())(t).bind(t=>Ma(t)?L.some(t):xo(e,t)?L.none():L.some(e)))(mo(e.getBody()),t).bind(e=>Oh(e.dom)).fold(()=>{e.selection.normalize()},t=>e.selection.setRng(t.toRange()))},yp=e=>{if(e.setActive)try{e.setActive()}catch(t){e.focus()}else e.focus()},wp=e=>e.inline?(e=>{const t=e.getBody();return t&&(o=mo(t),sn(o)||(n=o,an(Yo(n)).filter(e=>n.dom.contains(e.dom))).isSome());var o,n})(e):(e=>_(e.iframeElement)&&sn(mo(e.iframeElement)))(e),_p=e=>wp(e)||(e=>{const t=Yo(mo(e.getElement()));return an(t).filter(t=>!mp(t.dom)&&pp(e,t.dom)).isSome()})(e),xp=e=>e.editorManager.setActive(e),Cp={BACKSPACE:8,DELETE:46,DOWN:40,ENTER:13,ESC:27,LEFT:37,RIGHT:39,SPACEBAR:32,TAB:9,UP:38,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,modifierPressed:e=>e.shiftKey||e.ctrlKey||e.altKey||Cp.metaKeyPressed(e),metaKeyPressed:e=>no.os.isMacOS()||no.os.isiOS()?e.metaKey:e.ctrlKey&&!e.altKey},kp="data-mce-selected",Sp=Math.abs,Tp=Math.round,Ep={nw:[0,0,-1,-1],ne:[1,0,1,-1],se:[1,1,1,1],sw:[0,1,-1,1]},Op=(e,t)=>{const o=t.dom,n=t.getDoc(),r=document,i=t.getBody();let s,a,l,c,d,u,h,m,p,g,f,v,b,y,w;const x=e=>_(e)&&(li(e)||o.is(e,"figure.image")),C=e=>gi(e)||o.hasClass(e,"mce-preview-object"),k=e=>{const o=e.target;((e,t)=>{if((e=>"longpress"===e.type||0===e.type.indexOf("touch"))(e)){const o=e.touches[0];return x(e.target)&&!Km(o.clientX,o.clientY,t)}return x(e.target)&&!Km(e.clientX,e.clientY,t)})(e,t.selection.getRng())&&!e.isDefaultPrevented()&&t.selection.select(o)},S=e=>o.hasClass(e,"mce-preview-object")&&_(e.firstElementChild)?[e,e.firstElementChild]:o.is(e,"figure.image")?[e.querySelector("img")]:[e],T=e=>{const n=rd(t);return!(!n||t.mode.isReadOnly())&&"false"!==e.getAttribute("data-mce-resize")&&e!==t.getBody()&&(o.hasClass(e,"mce-preview-object")&&_(e.firstElementChild)?yo(mo(e.firstElementChild),n):yo(mo(e),n))},E=(e,n,r)=>{if(_(r)){const i=S(e);W(i,e=>{e.style[n]||!t.schema.isValid(e.nodeName.toLowerCase(),n)?o.setStyle(e,n,r):o.setAttrib(e,n,""+r)})}},O=(e,t,o)=>{E(e,"width",t),E(e,"height",o)},A=e=>{let n,r,d,_,k;n=e.screenX-u,r=e.screenY-h,v=n*c[2]+m,b=r*c[3]+p,v=v<5?5:v,b=b<5?5:b,d=(x(s)||C(s))&&!1!==id(t)?!Cp.modifierPressed(e):Cp.modifierPressed(e),d&&(Sp(n)>Sp(r)?(b=Tp(v*g),v=Tp(b/g)):(v=Tp(b/g),b=Tp(v*g))),O(a,v,b),_=c.startPos.x+n,k=c.startPos.y+r,_=_>0?_:0,k=k>0?k:0,o.setStyles(l,{left:_,top:k,display:"block"}),l.innerHTML=v+" &times; "+b,n=i.scrollWidth-y,r=i.scrollHeight-w,n+r!==0&&o.setStyles(l,{left:_-n,top:k-r}),f||(((e,t,o,n,r)=>{e.dispatch("ObjectResizeStart",{target:t,width:o,height:n,origin:r})})(t,s,m,p,"corner-"+c.name),f=!0)},M=()=>{const e=f;f=!1,e&&(E(s,"width",v),E(s,"height",b)),o.unbind(n,"mousemove",A),o.unbind(n,"mouseup",M),r!==n&&(o.unbind(r,"mousemove",A),o.unbind(r,"mouseup",M)),o.remove(a),o.remove(l),o.remove(d),B(s),e&&(((e,t,o,n,r)=>{e.dispatch("ObjectResized",{target:t,width:o,height:n,origin:r})})(t,s,v,b,"corner-"+c.name),o.setAttrib(s,"style",o.getAttrib(s,"style"))),t.nodeChanged()},B=e=>{P();const f=o.getPos(e,i),_=f.x,x=f.y,k=e.getBoundingClientRect(),E=k.width||k.right-k.left,B=k.height||k.bottom-k.top;s!==e&&(N(),s=e,v=b=0);const R=t.dispatch("ObjectSelected",{target:e});T(e)&&!R.isDefaultPrevented()?fe(Ep,(e,t)=>{let f=o.get("mceResizeHandle"+t);f&&o.remove(f),f=o.add(i,"div",{id:"mceResizeHandle"+t,"data-mce-bogus":"all",class:"mce-resizehandle",unselectable:!0,style:"cursor:"+t+"-resize; margin:0; padding:0"}),o.bind(f,"mousedown",f=>{f.stopImmediatePropagation(),f.preventDefault(),(f=>{const v=S(s)[0];u=f.screenX,h=f.screenY,m=v.clientWidth,p=v.clientHeight,g=p/m,c=e,c.name=t,c.startPos={x:E*e[0]+_,y:B*e[1]+x},y=i.scrollWidth,w=i.scrollHeight,d=o.add(i,"div",{class:"mce-resize-backdrop","data-mce-bogus":"all"}),o.setStyles(d,{position:"fixed",left:"0",top:"0",width:"100%",height:"100%"}),a=((e,t)=>{if(C(t))return e.create("img",{src:no.transparentSrc});if(Jr(t)){const o=Ye(c.name,"n")?ce:de,n=t.cloneNode(!0);return o(e.select("tr",n)).each(t=>{const o=e.select("td,th",t);e.setStyle(t,"height",null),W(o,t=>e.setStyle(t,"height",null))}),n}return t.cloneNode(!0)})(o,s),o.addClass(a,"mce-clonedresizable"),o.setAttrib(a,"data-mce-bogus","all"),a.contentEditable="false",o.setStyles(a,{left:_,top:x,margin:0}),O(a,E,B),a.removeAttribute(kp),i.appendChild(a),o.bind(n,"mousemove",A),o.bind(n,"mouseup",M),r!==n&&(o.bind(r,"mousemove",A),o.bind(r,"mouseup",M)),l=o.add(i,"div",{class:"mce-resize-helper","data-mce-bogus":"all"},m+" &times; "+p)})(f)}),e.elm=f,o.setStyles(f,{left:E*e[0]+_-f.offsetWidth/2,top:B*e[1]+x-f.offsetHeight/2})}):N(!1)},R=rt(B,0),N=(e=!0)=>{R.cancel(),P(),s&&e&&s.removeAttribute(kp),fe(Ep,(e,t)=>{const n=o.get("mceResizeHandle"+t);n&&(o.unbind(n),o.remove(n))})},V=(e,t)=>o.isChildOf(e,t),D=n=>{if(f||t.removed||t.composing)return;const r="mousedown"===n.type?n.target:e.getNode(),s=sr(mo(r),"table,img,figure.image,hr,video,span.mce-preview-object,details").map(e=>e.dom).filter(e=>o.isEditable(e.parentElement)||"IMG"===e.nodeName&&o.isEditable(e)).getOrUndefined(),a=_(s)?o.getAttrib(s,kp,"1"):"1";if(W(o.select(`img[${kp}],hr[${kp}]`),e=>{e.removeAttribute(kp)}),_(s)&&V(s,i)&&_p(t)){I();const t=e.getStart(!0);if(V(t,s)&&V(e.getEnd(!0),s))return o.setAttrib(s,kp,a),void R.throttle(s)}N()},P=()=>{fe(Ep,e=>{e.elm&&(o.unbind(e.elm),delete e.elm)})},I=()=>{try{t.getDoc().execCommand("enableObjectResizing",!1,"false")}catch(e){}};return t.on("init",()=>{I(),t.on("NodeChange ResizeEditor ResizeWindow ResizeContent drop",D),t.on("keyup compositionend",e=>{s&&"TABLE"===s.nodeName&&D(e)}),t.on("hide blur",N),t.on("contextmenu longpress",k,!0)}),t.on("remove",P),{isResizable:T,showResizeRect:B,hideResizeRect:N,updateResizeRect:D,destroy:()=>{R.cancel(),s=a=d=null}}},Ap=(e,t,o)=>{const n=Do(mo(o));return Pr(n.dom,e,t).map(e=>{const t=o.createRange();return t.setStart(e.start.dom,e.soffset),t.setEnd(e.finish.dom,e.foffset),t}).getOrUndefined()},Mp=(e,t)=>_(e)&&_(t)&&e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset,Bp=(e,t,o)=>null!==((e,t,o)=>{let n=e;for(;n&&n!==t;){if(o(n))return n;n=n.parentNode}return null})(e,t,o),Rp=(e,t,o)=>Bp(e,t,e=>e.nodeName===o),Np=(e,t)=>Ua(e)&&!Bp(e,t,Bh),Vp=(e,t,o)=>{const n=t.parentNode;if(n){const r=new Fr(t,e.getParent(n,e.isBlock)||e.getRoot());let i;for(;i=r[o?"prev":"next"]();)if(ai(i))return!0}return!1},Dp=(e,t,o,n,r)=>{const i=e.getRoot(),s=e.schema.getNonEmptyElements(),a=r.parentNode;let l,c;if(!a)return L.none();const d=e.getParent(a,e.isBlock)||i;if(n&&ai(r)&&t&&e.isEmpty(d))return L.some(Dl(a,e.nodeIndex(r)));const u=new Fr(r,d);for(;c=u[n?"prev":"next"]();){if("false"===e.getContentEditableParent(c)||Np(c,i))return L.none();if(ti(c)&&c.data.length>0)return Rp(c,i,"A")?L.none():L.some(Dl(c,n?c.data.length:0));if(e.isBlock(c)||s[c.nodeName.toLowerCase()])return L.none();l=c}return ri(l)?L.none():o&&l?L.some(Dl(l,0)):L.none()},Pp=(e,t,o,n)=>{const r=e.getRoot();let i,s=!1,a=o?n.startContainer:n.endContainer,l=o?n.startOffset:n.endOffset;const c=Wr(a)&&l===a.childNodes.length,d=e.schema.getNonEmptyElements();let u=o;if(Ua(a))return L.none();if(Wr(a)&&l>a.childNodes.length-1&&(u=!1),ii(a)&&(a=r,l=0),a===r){if(u&&(i=a.childNodes[l>0?l-1:0],i)){if(Ua(i))return L.none();if(d[i.nodeName]||Jr(i))return L.none()}if(a.hasChildNodes()){if(l=Math.min(!u&&l>0?l-1:l,a.childNodes.length-1),a=a.childNodes[l],l=ti(a)&&c?a.data.length:0,!t&&a===r.lastChild&&Jr(a))return L.none();if(((e,t)=>{let o=t;for(;o&&o!==e;){if(ui(o))return!0;o=o.parentNode}return!1})(r,a)||Ua(a))return L.none();if(vi(a))return L.none();if(a.hasChildNodes()&&!Jr(a)){i=a;const t=new Fr(a,r);do{if(ui(i)||Ua(i)){s=!1;break}if(ti(i)&&i.data.length>0){l=u?0:i.data.length,a=i,s=!0;break}if(d[i.nodeName.toLowerCase()]&&!pi(i)){l=e.nodeIndex(i),a=i.parentNode,u||l++,s=!0;break}}while(i=u?t.next():t.prev())}}}return t&&(ti(a)&&0===l&&Dp(e,c,t,!0,a).each(e=>{a=e.container(),l=e.offset(),s=!0}),Wr(a)&&(i=a.childNodes[l],i||(i=a.childNodes[l-1]),!i||!ai(i)||(e=>{var t;return"A"===(null===(t=e.previousSibling)||void 0===t?void 0:t.nodeName)})(i)||Vp(e,i,!1)||Vp(e,i,!0)||Dp(e,c,t,!0,i).each(e=>{a=e.container(),l=e.offset(),s=!0}))),u&&!t&&ti(a)&&l===a.data.length&&Dp(e,c,t,!1,a).each(e=>{a=e.container(),l=e.offset(),s=!0}),s&&a?L.some(Dl(a,l)):L.none()},Ip=(e,t)=>{const o=t.collapsed,n=t.cloneRange(),r=Dl.fromRangeStart(t);return Pp(e,o,!0,n).each(e=>{o&&Dl.isAbove(r,e)||n.setStart(e.container(),e.offset())}),o||Pp(e,o,!1,n).each(e=>{n.setEnd(e.container(),e.offset())}),o&&n.collapse(!0),Mp(t,n)?L.none():L.some(n)},Lp=(e,t)=>e.splitText(t),Fp=e=>{let t=e.startContainer,o=e.startOffset,n=e.endContainer,r=e.endOffset;if(t===n&&ti(t)){if(o>0&&o<t.data.length)if(n=Lp(t,o),t=n.previousSibling,r>o){r-=o;const e=Lp(n,r).previousSibling;t=n=e,r=e.data.length,o=0}else r=0}else if(ti(t)&&o>0&&o<t.data.length&&(t=Lp(t,o),o=0),ti(n)&&r>0&&r<n.data.length){const e=Lp(n,r).previousSibling;n=e,r=e.data.length}return{startContainer:t,startOffset:o,endContainer:n,endOffset:r}},zp=e=>({walk:(t,o)=>$m(e,t,o),split:Fp,expand:(t,o={type:"word"})=>{if("word"===o.type){const o=Zm(e,t,[{inline:"span"}],{includeTrailingSpace:!1,expandToBlock:!1}),n=e.createRng();return n.setStart(o.startContainer,o.startOffset),n.setEnd(o.endContainer,o.endOffset),n}return t},normalize:t=>Ip(e,t).fold(P,e=>(t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),!0))});zp.compareRanges=Mp,zp.getCaretRangeFromPoint=Ap,zp.getSelectedNode=nl,zp.getNode=rl;const Hp=e=>"textarea"===ko(e),Up=(e,t)=>{const o=(e=>{const t=e.dom.ownerDocument,o=t.body,n=t.defaultView,r=t.documentElement;if(o===e.dom)return Zn(o.offsetLeft,o.offsetTop);const i=$n(null==n?void 0:n.pageYOffset,r.scrollTop),s=$n(null==n?void 0:n.pageXOffset,r.scrollLeft),a=$n(r.clientTop,o.clientTop),l=$n(r.clientLeft,o.clientLeft);return jn(e).translate(s-l,i-a)})(e),n=(e=>Hn.get(e))(e);return{element:e,bottom:o.top+n,height:n,pos:o,cleanup:t}},Zp=(e,t,o,n)=>{qp(e,(r,i)=>jp(e,t,o,n),o)},$p=(e,t,o,n,r)=>{const i={elm:n.element.dom,alignToTop:r};((e,t)=>e.dispatch("ScrollIntoView",t).isDefaultPrevented())(e,i)||(o(e,t,Wn(t).top,n,r),((e,t)=>{e.dispatch("AfterScrollIntoView",t)})(e,i))},jp=(e,t,o,n)=>{const r=mo(e.getBody()),i=mo(e.getDoc());r.dom.offsetWidth;const s=((e,t)=>{const o=((e,t)=>{const o=Zo(e);if(0===o.length||Hp(e))return{element:e,offset:t};if(t<o.length&&!Hp(o[t]))return{element:o[t],offset:0};{const n=o[o.length-1];return Hp(n)?{element:e,offset:t}:"img"===ko(n)?{element:n,offset:1}:Ao(n)?{element:n,offset:Kn(n).length}:{element:n,offset:Zo(n).length}}})(e,t),n=co('<span data-mce-bogus="all" style="display: inline-block;">\ufeff</span>');return ln(o.element,n),Up(n,()=>Cn(n))})(mo(o.startContainer),o.startOffset);$p(e,i,t,s,n),s.cleanup()},Wp=(e,t,o,n)=>{const r=mo(e.getDoc());$p(e,r,o,(e=>Up(mo(e),S))(t),n)},qp=(e,t,o)=>{const n=o.startContainer,r=o.startOffset,i=o.endContainer,s=o.endOffset;t(mo(n),mo(i));const a=e.dom.createRng();a.setStart(n,r),a.setEnd(i,s),e.selection.setRng(o)},Gp=(e,t,o,n,r)=>{const i=t.pos;if(n)qn(i.left,Math.max(0,i.top-30),r);else{const n=i.top-o+t.height+30;qn(-e.getBody().getBoundingClientRect().left,n,r)}},Yp=(e,t,o,n,r,i)=>{const s=n+o,a=r.pos.top,l=r.bottom,c=l-a>=n;a<o?Gp(e,r,n,!1!==i,t):a>s?Gp(e,r,n,c?!1!==i:!0===i,t):l>s&&!c&&Gp(e,r,n,!0===i,t)},Xp=(e,t,o,n,r)=>{const i=Do(t).dom.innerHeight;Yp(e,t,o,i,n,r)},Kp=(e,t,o,n,r)=>{const i=Do(t).dom.innerHeight;Yp(e,t,o,i,n,r);const s=dp(n.element),a=Lr(window);s.top<a.y?Gn(n.element,!1!==r):s.top>a.bottom&&Gn(n.element,!0===r)},Jp=(e,t,o)=>Zp(e,Xp,t,o),Qp=(e,t,o)=>Wp(e,t,Xp,o),eg=(e,t,o)=>Zp(e,Kp,t,o),tg=(e,t,o)=>Wp(e,t,Kp,o),og=(e,t,o)=>{(e.inline?Jp:eg)(e,t,o)},ng=(e,t)=>t.collapsed?e.isEditable(t.startContainer):e.isEditable(t.startContainer)&&e.isEditable(t.endContainer),rg=(e,t,o,n,r)=>{const i=o?t.startContainer:t.endContainer,s=o?t.startOffset:t.endOffset;return L.from(i).map(mo).map(e=>n&&t.collapsed?e:$o(e,r(e,s)).getOr(e)).bind(e=>Oo(e)?L.some(e):Po(e).filter(Oo)).map(e=>e.dom).getOr(e)},ig=(e,t,o=!1)=>rg(e,t,!0,o,(e,t)=>Math.min(qo(e),t)),sg=(e,t,o=!1)=>rg(e,t,!1,o,(e,t)=>t>0?t-1:t),ag=(e,t)=>{const o=e;for(;e&&ti(e)&&0===e.length;)e=t?e.nextSibling:e.previousSibling;return e||o},lg=(e,t)=>j(t,t=>{const o=e.dispatch("GetSelectionRange",{range:t});return o.range!==t?o.range:t}),cg={"#text":3,"#comment":8,"#cdata":4,"#pi":7,"#doctype":10,"#document-fragment":11},dg=(e,t,o)=>{const n=o?"lastChild":"firstChild",r=o?"prev":"next";if(e[n])return e[n];if(e!==t){let o=e[r];if(o)return o;for(let n=e.parent;n&&n!==t;n=n.parent)if(o=n[r],o)return o}},ug=e=>{var t;const o=null!==(t=e.value)&&void 0!==t?t:"";if(!Hr(o))return!1;const n=e.parent;return!n||"span"===n.name&&!n.attr("style")||!/^[ ]+$/.test(o)},hg=e=>{const t="a"===e.name&&!e.attr("href")&&e.attr("id");return e.attr("name")||e.attr("id")&&!e.firstChild||e.attr("data-mce-bookmark")||t};class mg{static create(e,t){const o=new mg(e,cg[e]||1);return t&&fe(t,(e,t)=>{o.attr(t,e)}),o}constructor(e,t){this.name=e,this.type=t,1===t&&(this.attributes=[],this.attributes.map={})}replace(e){const t=this;return e.parent&&e.remove(),t.insert(e,t),t.remove(),t}attr(e,t){const o=this;if(!m(e))return _(e)&&fe(e,(e,t)=>{o.attr(t,e)}),o;const n=o.attributes;if(n){if(void 0!==t){if(null===t){if(e in n.map){delete n.map[e];let t=n.length;for(;t--;)if(n[t].name===e)return n.splice(t,1),o}return o}if(e in n.map){let o=n.length;for(;o--;)if(n[o].name===e){n[o].value=t;break}}else n.push({name:e,value:t});return n.map[e]=t,o}return n.map[e]}}clone(){const e=this,t=new mg(e.name,e.type),o=e.attributes;if(o){const e=[];e.map={};for(let t=0,n=o.length;t<n;t++){const n=o[t];"id"!==n.name&&(e[e.length]={name:n.name,value:n.value},e.map[n.name]=n.value)}t.attributes=e}return t.value=e.value,t}wrap(e){const t=this;return t.parent&&(t.parent.insert(e,t),e.append(t)),t}unwrap(){const e=this;for(let t=e.firstChild;t;){const o=t.next;e.insert(t,e,!0),t=o}e.remove()}remove(){const e=this,t=e.parent,o=e.next,n=e.prev;return t&&(t.firstChild===e?(t.firstChild=o,o&&(o.prev=null)):n&&(n.next=o),t.lastChild===e?(t.lastChild=n,n&&(n.next=null)):o&&(o.prev=n),e.parent=e.next=e.prev=null),e}append(e){const t=this;e.parent&&e.remove();const o=t.lastChild;return o?(o.next=e,e.prev=o,t.lastChild=e):t.lastChild=t.firstChild=e,e.parent=t,e}insert(e,t,o){e.parent&&e.remove();const n=t.parent||this;return o?(t===n.firstChild?n.firstChild=e:t.prev&&(t.prev.next=e),e.prev=t.prev,e.next=t,t.prev=e):(t===n.lastChild?n.lastChild=e:t.next&&(t.next.prev=e),e.next=t.next,e.prev=t,t.next=e),e.parent=n,e}getAll(e){const t=this,o=[];for(let n=t.firstChild;n;n=dg(n,t))n.name===e&&o.push(n);return o}children(){const e=[];for(let t=this.firstChild;t;t=t.next)e.push(t);return e}empty(){const e=this;if(e.firstChild){const t=[];for(let o=e.firstChild;o;o=dg(o,e))t.push(o);let o=t.length;for(;o--;){const e=t[o];e.parent=e.firstChild=e.lastChild=e.next=e.prev=null}}return e.firstChild=e.lastChild=null,e}isEmpty(e,t={},o){var n;const r=this;let i=r.firstChild;if(hg(r))return!1;if(i)do{if(1===i.type){if(i.attr("data-mce-bogus"))continue;if(e[i.name])return!1;if(hg(i))return!1}if(8===i.type)return!1;if(3===i.type&&!ug(i))return!1;if(3===i.type&&i.parent&&t[i.parent.name]&&Hr(null!==(n=i.value)&&void 0!==n?n:""))return!1;if(o&&o(i))return!1}while(i=dg(i,r));return!0}walk(e){return dg(this,null,e)}}const pg=ao.makeMap("NOSCRIPT STYLE SCRIPT XMP IFRAME NOEMBED NOFRAMES PLAINTEXT"," "),gg=e=>m(e.nodeValue)&&e.nodeValue.includes(Da),fg=e=>(0===e.length?"":`${j(e,e=>`[${e}]`).join(",")},`)+'[data-mce-bogus="all"]',vg=e=>document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,e=>gg(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP),bg=e=>document.createTreeWalker(e,NodeFilter.SHOW_TEXT,e=>{if(gg(e)){const t=e.parentNode;return t&&Se(pg,t.nodeName)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}return NodeFilter.FILTER_SKIP}),yg=e=>null!==vg(e).nextNode(),wg=e=>null!==bg(e).nextNode(),_g=(e,t)=>null!==t.querySelector(fg(e)),xg=(e,t)=>{W(((e,t)=>t.querySelectorAll(fg(e)))(e,t),t=>{const o=mo(t);"all"===vn(o,"data-mce-bogus")?Cn(o):W(e,e=>{yn(o,e)&&wn(o,e)})})},Cg=e=>{let t=e.nextNode();for(;null!==t;)t.nodeValue=null,t=e.nextNode()},kg=T(Cg,vg),Sg=T(Cg,bg),Tg=(e,t)=>{const o=[{condition:B(_g,t),action:B(xg,t)},{condition:yg,action:kg},{condition:wg,action:Sg}];let n=e,r=!1;return W(o,({condition:t,action:o})=>{t(n)&&(r||(n=e.cloneNode(!0),r=!0),o(n))}),n},Eg=e=>{const t=yr(e,"[data-mce-bogus]");W(t,e=>{"all"===vn(e,"data-mce-bogus")?Cn(e):Ta(e)?(ln(e,ho(at)),Cn(e)):kn(e)})},Og=e=>{const t=yr(e,"input");W(t,e=>{wn(e,"name")})},Ag=(e,t,o)=>{let n;return n="raw"===t.format?ao.trim(Ia(Tg(o,e.serializer.getTempAttrs()).innerHTML)):"text"===t.format?((e,t)=>{const o=e.getDoc(),n=Yo(mo(e.getBody())),r=uo("div",o);gn(r,"data-mce-bogus","all"),Dn(r,{position:"fixed",left:"-9999999px",top:"0"}),Mn(r,t.innerHTML),Eg(r),Og(r);const i=(e=>Go(e)?e:mo(Vo(e).dom.body))(n);un(i,r);const s=Ia(r.dom.innerText);return Cn(r),s})(e,o):"tree"===t.format?e.serializer.serialize(o,t):((e,t)=>{const o=Bc(e),n=new RegExp(`^(<${o}[^>]*>(&nbsp;|&#160;|\\s| |<br \\/>|)<\\/${o}>[\r\n]*|<br \\/>[\r\n]*)$`);return t.replace(n,"")})(e,e.serializer.serialize(o,t)),"text"!==t.format&&!Ra(mo(o))&&m(n)?ao.trim(n):n},Mg=ao.makeMap,Bg=e=>{const t=[],o=(e=e||{}).indent,n=Mg(e.indent_before||""),r=Mg(e.indent_after||""),i=hs.getEncodeFunc(e.entity_encoding||"raw",e.entities),s="xhtml"!==e.element_format;return{start:(e,a,l)=>{if(o&&n[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}if(t.push("<",e),a)for(let e=0,o=a.length;e<o;e++){const o=a[e];t.push(" ",o.name,'="',i(o.value,!0),'"')}if(t[t.length]=!l||s?">":" />",l&&o&&r[e]&&t.length>0){const e=t[t.length-1];e.length>0&&"\n"!==e&&t.push("\n")}},end:e=>{let n;t.push("</",e,">"),o&&r[e]&&t.length>0&&(n=t[t.length-1],n.length>0&&"\n"!==n&&t.push("\n"))},text:(e,o)=>{e.length>0&&(t[t.length]=o?e:i(e))},cdata:e=>{t.push("<![CDATA[",e,"]]>")},comment:e=>{t.push("\x3c!--",e,"--\x3e")},pi:(e,n)=>{n?t.push("<?",e," ",i(n),"?>"):t.push("<?",e,"?>"),o&&t.push("\n")},doctype:e=>{t.push("<!DOCTYPE",e,">",o?"\n":"")},reset:()=>{t.length=0},getContent:()=>t.join("").replace(/\n$/,"")}},Rg=(e={},t=As())=>{const o=Bg(e);return e.validate=!("validate"in e)||e.validate,{serialize:n=>{const r=e.validate,i={3:e=>{var t;o.text(null!==(t=e.value)&&void 0!==t?t:"",e.raw)},8:e=>{var t;o.comment(null!==(t=e.value)&&void 0!==t?t:"")},7:e=>{o.pi(e.name,e.value)},10:e=>{var t;o.doctype(null!==(t=e.value)&&void 0!==t?t:"")},4:e=>{var t;o.cdata(null!==(t=e.value)&&void 0!==t?t:"")},11:e=>{let t=e;if(t=t.firstChild)do{s(t)}while(t=t.next)}};o.reset();const s=e=>{var n;const a=i[e.type];if(a)a(e);else{const i=e.name,a=i in t.getVoidElements();let l=e.attributes;if(r&&l&&l.length>1){const o=[];o.map={};const n=t.getElementRule(e.name);if(n){for(let e=0,t=n.attributesOrder.length;e<t;e++){const t=n.attributesOrder[e];if(t in l.map){const e=l.map[t];o.map[t]=e,o.push({name:t,value:e})}}for(let e=0,t=l.length;e<t;e++){const t=l[e].name;if(!(t in o.map)){const e=l.map[t];o.map[t]=e,o.push({name:t,value:e})}}l=o}}if(o.start(i,l,a),Ei(i))m(e.value)&&o.text(e.value,!0),o.end(i);else if(!a){let t=e.firstChild;if(t){"pre"!==i&&"textarea"!==i||3!==t.type||"\n"!==(null===(n=t.value)||void 0===n?void 0:n[0])||o.text("\n",!0);do{s(t)}while(t=t.next)}o.end(i)}}};return 1!==n.type||e.inner?3===n.type?i[3](n):i[11](n):s(n),o.getContent()}}},Ng=new Set;W(["margin","margin-left","margin-right","margin-top","margin-bottom","padding","padding-left","padding-right","padding-top","padding-bottom","border","border-width","border-style","border-color","background","background-attachment","background-clip","background-image","background-origin","background-position","background-repeat","background-size","float","position","left","right","top","bottom","z-index","display","transform","width","max-width","min-width","height","max-height","min-height","overflow","overflow-x","overflow-y","text-overflow","vertical-align","transition","transition-delay","transition-duration","transition-property","transition-timing-function"],e=>{Ng.add(e)});const Vg=new Set;W(["background-color"],e=>{Vg.add(e)});const Dg=["font","text-decoration","text-emphasis"],Pg=(e,t)=>pe(((e,t)=>e.parseStyle(e.getAttrib(t,"style")))(e,t)),Ig=(e,t)=>$(Pg(e,t),e=>(e=>Ng.has(e))(e)),Lg=(e,t,o)=>L.from(o.container()).filter(ti).exists(n=>{const r=e?0:-1;return t(n.data.charAt(o.offset()+r))}),Fg=B(Lg,!0,qh),zg=B(Lg,!1,qh),Hg=e=>{const t=e.container();return ti(t)&&(0===t.data.length||Pa(t.data)&&Xm.isBookmarkNode(t.parentNode))},Ug=(e,t)=>o=>Xu(e?0:-1,o).filter(t).isSome(),Zg=e=>li(e)&&"block"===Pn(mo(e),"display"),$g=e=>ui(e)&&!(e=>Wr(e)&&"all"===e.getAttribute("data-mce-bogus"))(e),jg=Ug(!0,Zg),Wg=Ug(!1,Zg),qg=Ug(!0,gi),Gg=Ug(!1,gi),Yg=Ug(!0,Jr),Xg=Ug(!1,Jr),Kg=Ug(!0,$g),Jg=Ug(!1,$g),Qg=(e,t)=>((e,t,o)=>xo(t,e)?Lo(e,e=>o(e)||_o(e,t)).slice(0,-1):[])(e,t,P),ef=(e,t)=>[e].concat(Qg(e,t)),tf=(e,t,o)=>kh(e,t,o,Hg),of=(e,t,o)=>Q(ef(mo(t.container()),e),(e=>t=>e.isBlock(ko(t)))(o)),nf=(e,t,o,n)=>tf(e,t.dom,o).forall(e=>of(t,o,n).fold(()=>!Yu(e,o,t.dom),n=>!Yu(e,o,t.dom)&&xo(n,mo(e.container())))),rf=(e,t,o,n)=>of(t,o,n).fold(()=>tf(e,t.dom,o).forall(e=>!Yu(e,o,t.dom)),t=>tf(e,t.dom,o).isNone()),sf=B(rf,!1),af=B(rf,!0),lf=B(nf,!1),cf=B(nf,!0),df=e=>ih(e).exists(Ta),uf=(e,t,o,n)=>{const r=Y(ef(mo(o.container()),t),e=>n.isBlock(ko(e))),i=ce(r).getOr(t);return xh(e,i.dom,o).filter(df)},hf=(e,t,o)=>ih(t).exists(Ta)||uf(!0,e,t,o).isSome(),mf=(e,t,o)=>(e=>L.from(e.getNode(!0)).map(mo))(t).exists(Ta)||uf(!1,e,t,o).isSome(),pf=B(uf,!1),gf=B(uf,!0),ff=e=>Dl.isTextPosition(e)&&!e.isAtStart()&&!e.isAtEnd(),vf=(e,t,o)=>{const n=Y(ef(mo(t.container()),e),e=>o.isBlock(ko(e)));return ce(n).getOr(e)},bf=(e,t,o)=>ff(t)?zg(t):zg(t)||Eh(vf(e,t,o).dom,t).exists(zg),yf=(e,t,o)=>ff(t)?Fg(t):Fg(t)||Th(vf(e,t,o).dom,t).exists(Fg),wf=e=>ih(e).bind(e=>or(e,Oo)).exists(e=>(e=>Z(["pre","pre-wrap"],e))(Pn(e,"white-space"))),_f=(e,t)=>o=>{return n=new Fr(o,e)[t](),_(n)&&ui(n)&&Lu(n);var n},xf=(e,t,o)=>!wf(t)&&(((e,t,o)=>((e,t)=>Eh(e.dom,t).isNone())(e,t)||((e,t)=>Th(e.dom,t).isNone())(e,t)||sf(e,t,o)||af(e,t,o)||mf(e,t,o)||hf(e,t,o))(e,t,o)||bf(e,t,o)||yf(e,t,o)),Cf=(e,t,o)=>!wf(t)&&(sf(e,t,o)||lf(e,t,o)||mf(e,t,o)||bf(e,t,o)||((e,t)=>{const o=Eh(e.dom,t).getOr(t),n=_f(e.dom,"prev");return t.isAtStart()&&(n(t.container())||n(o.container()))})(e,t)),kf=(e,t,o)=>!wf(t)&&(af(e,t,o)||cf(e,t,o)||hf(e,t,o)||yf(e,t,o)||((e,t)=>{const o=Th(e.dom,t).getOr(t),n=_f(e.dom,"next");return t.isAtEnd()&&(n(t.container())||n(o.container()))})(e,t)),Sf=(e,t,o)=>Cf(e,t,o)||kf(e,(e=>{const t=e.container(),o=e.offset();return ti(t)&&o<t.data.length?Dl(t,o+1):e})(t),o),Tf=(e,t)=>jh(e.charAt(t)),Ef=(e,t)=>qh(e.charAt(t)),Of=(e,t,o,n)=>{const r=t.data,i=Dl(t,0);return o||!Tf(r,0)||Sf(e,i,n)?!!(o&&Ef(r,0)&&Cf(e,i,n))&&(t.data=lt+r.slice(1),!0):(t.data=" "+r.slice(1),!0)},Af=(e,t,o,n)=>{const r=t.data,i=Dl(t,r.length-1);return o||!Tf(r,r.length-1)||Sf(e,i,n)?!!(o&&Ef(r,r.length-1)&&kf(e,i,n))&&(t.data=r.slice(0,-1)+lt,!0):(t.data=r.slice(0,-1)+" ",!0)},Mf=(e,t,o)=>{const n=t.container();if(!ti(n))return L.none();if((e=>{const t=e.container();return ti(t)&&Ge(t.data,lt)})(t)){const r=Of(e,n,!1,o)||(e=>{const t=e.data,o=(e=>{const t=e.split("");return j(t,(e,o)=>jh(e)&&o>0&&o<t.length-1&&Gh(t[o-1])&&Gh(t[o+1])?" ":e).join("")})(t);return o!==t&&(e.data=o,!0)})(n)||Af(e,n,!1,o);return Ue(r,t)}if(Sf(e,t,o)){const r=Of(e,n,!0,o)||Af(e,n,!0,o);return Ue(r,t)}return L.none()},Bf=(e,t,o,n)=>{if(0===o)return;const r=mo(e),i=tr(r,e=>n.isBlock(ko(e))).getOr(r),s=e.data.slice(t,t+o),a=t+o>=e.data.length&&kf(i,Dl(e,e.data.length),n),l=0===t&&Cf(i,Dl(e,0),n);e.replaceData(t,o,Zr(s,4,l,a))},Rf=(e,t,o)=>{const n=e.data.slice(t),r=n.length-Qe(n).length;Bf(e,t,r,o)},Nf=(e,t,o)=>{const n=e.data.slice(0,t),r=n.length-et(n).length;Bf(e,t-r,r,o)},Vf=(e,t,o,n,r=!0)=>{const i=et(e.data).length,s=r?e:t,a=r?t:e;return r?s.appendData(a.data):s.insertData(0,a.data),Cn(mo(a)),n&&Rf(s,i,o),s},Df=(e,t)=>((e,t)=>{const o=e.container(),n=e.offset();return!Dl.isTextPosition(e)&&o===t.parentNode&&n>Dl.before(t).offset()})(t,e)?Dl(t.container(),t.offset()-1):t,Pf=e=>{return gl(e.previousSibling)?L.some((t=e.previousSibling,ti(t)?Dl(t,t.data.length):Dl.after(t))):e.previousSibling?Ah(e.previousSibling):L.none();var t},If=e=>{return gl(e.nextSibling)?L.some((t=e.nextSibling,ti(t)?Dl(t,0):Dl.before(t))):e.nextSibling?Oh(e.nextSibling):L.none();var t},Lf=(e,t,o)=>((e,t,o)=>e?((e,t)=>If(t).orThunk(()=>Pf(t)).orThunk(()=>((e,t)=>Th(e,Dl.after(t)).orThunk(()=>Eh(e,Dl.before(t))))(e,t)))(t,o):((e,t)=>Pf(t).orThunk(()=>If(t)).orThunk(()=>((e,t)=>L.from(t.previousSibling?t.previousSibling:t.parentNode).bind(t=>Eh(e,Dl.before(t))).orThunk(()=>Th(e,Dl.after(t))))(e,t)))(t,o))(e,t,o).map(B(Df,o)),Ff=(e,t,o)=>{o.fold(()=>{e.focus()},o=>{e.selection.setRng(o.toRange(),t)})},zf=(e,t)=>t&&Se(e.schema.getBlockElements(),ko(t)),Hf=(e,t,o,n=!0,r=!1)=>{const i=Lf(t,e.getBody(),o.dom),s=tr(o,B(zf,e),(a=e.getBody(),e=>e.dom===a));var a;const l=((e,t,o,n)=>{const r=Fo(e).filter(Ao),i=zo(e).filter(Ao);return Cn(e),(s=r,a=i,l=t,c=(e,t,r)=>{const i=e.dom,s=t.dom,a=i.data.length;return Vf(i,s,o,n),r.container()===s?Dl(i,a):r},s.isSome()&&a.isSome()&&l.isSome()?L.some(c(s.getOrDie(),a.getOrDie(),l.getOrDie())):L.none()).orThunk(()=>(n&&(r.each(e=>Nf(e.dom,e.dom.length,o)),i.each(e=>Rf(e.dom,0,o))),t));var s,a,l,c})(o,i,e.schema,((e,t)=>Se(e.schema.getTextInlineElements(),ko(t)))(e,o));e.dom.isEmpty(e.getBody())?(e.setContent(""),e.selection.setCursorLocation()):s.bind(t=>((e,t,o)=>{if(ki(e,t)){const e=co('<br data-mce-bogus="1">');return o?W(Zo(t),e=>{Em(e)||Cn(e)}):xn(t),un(t,e),L.some(Dl.before(e.dom))}return L.none()})(e.schema,t,r)).fold(()=>{n&&Ff(e,t,l)},o=>{n&&Ff(e,t,L.some(o))})},Uf=/[\u0591-\u07FF\uFB1D-\uFDFF\uFE70-\uFEFC]/,Zf=(e,t)=>yo(mo(t),nd(e))&&!Ui(e.schema,t)&&e.dom.isEditable(t),$f=e=>{var t;return"rtl"===ra.DOM.getStyle(e,"direction",!0)||(e=>Uf.test(e))(null!==(t=e.textContent)&&void 0!==t?t:"")},jf=(e,t,o)=>{const n=((e,t,o)=>Y(ra.DOM.getParents(o.container(),"*",t),e))(e,t,o);return L.from(n[n.length-1])},Wf=(e,t)=>{const o=t.container(),n=t.offset();return e?Ha(o)?ti(o.nextSibling)?Dl(o.nextSibling,0):Dl.after(o):$a(t)?Dl(o,n+1):t:Ha(o)?ti(o.previousSibling)?Dl(o.previousSibling,o.previousSibling.data.length):Dl.before(o):ja(t)?Dl(o,n-1):t},qf=B(Wf,!0),Gf=B(Wf,!1),Yf=(e,t)=>{const o=e=>e.stopImmediatePropagation();e.on("beforeinput input",o,!0),e.getDoc().execCommand(t),e.off("beforeinput input",o)},Xf=e=>Yf(e,"Delete"),Kf=e=>Yf(e,"ForwardDelete"),Jf=e=>Ea(e)||Aa(e),Qf=(e,t)=>xo(e,t)?or(t,Jf,(e=>t=>Fe(Po(t),e,_o))(e)):L.none(),ev=(e,t=!0)=>{e.dom.isEmpty(e.getBody())&&e.setContent("",{no_selection:!t})},tv=(e,t,o)=>He(Oh(o),Ah(o),(n,r)=>{const i=Wf(!0,n),s=Wf(!1,r),a=Wf(!1,t);return e?Th(o,a).exists(e=>e.isEqual(s)&&t.isEqual(i)):Eh(o,a).exists(e=>e.isEqual(i)&&t.isEqual(s))}).getOr(!0),ov=e=>{var t;return(8===So(t=e)||"#comment"===ko(t)?Fo(e):Wo(e)).bind(ov).orThunk(()=>L.some(e))},nv=(e,t,o,n=!0)=>{var r;t.deleteContents();const i=ov(o).getOr(o),s=mo(null!==(r=e.dom.getParent(i.dom,e.dom.isBlock))&&void 0!==r?r:o.dom);if(s.dom===e.getBody()?ev(e,n):ki(e.schema,s,{checkRootAsContent:!1})&&(Va(s),n&&e.selection.setCursorLocation(s.dom,0)),!_o(o,s)){const t=Fe(Po(s),o)?[]:Po(a=s).map(Zo).map(e=>Y(e,e=>!_o(a,e))).getOr([]);W(t.concat(Zo(o)),t=>{_o(t,s)||xo(t,s)||!ki(e.schema,t)||Cn(t)})}var a},rv=e=>yr(e,"td,th"),iv=(e,t)=>Jh(mo(e),t),sv=(e,t)=>({start:e,end:t}),av=Ee([{singleCellTable:["rng","cell"]},{fullTable:["table"]},{partialTable:["cells","outsideDetails"]},{multiTable:["startTableCells","endTableCells","betweenRng"]}]),lv=(e,t)=>sr(mo(e),"td,th",t),cv=e=>!_o(e.start,e.end),dv=(e,t)=>Jh(e.start,t).bind(o=>Jh(e.end,t).bind(e=>Ue(_o(o,e),o))),uv=e=>t=>dv(t,e).map(e=>((e,t,o)=>({rng:e,table:t,cells:o}))(t,e,rv(e))),hv=(e,t,o,n)=>{if(o.collapsed||!e.forall(cv))return L.none();if(t.isSameTable){const t=e.bind(uv(n));return L.some({start:t,end:t})}{const e=lv(o.startContainer,n),t=lv(o.endContainer,n),r=e.bind((e=>t=>Jh(t,e).bind(e=>de(rv(e)).map(e=>sv(t,e))))(n)).bind(uv(n)),i=t.bind((e=>t=>Jh(t,e).bind(e=>ce(rv(e)).map(e=>sv(e,t))))(n)).bind(uv(n));return L.some({start:r,end:i})}},mv=(e,t)=>ee(e,e=>_o(e,t)),pv=e=>He(mv(e.cells,e.rng.start),mv(e.cells,e.rng.end),(t,o)=>e.cells.slice(t,o+1)),gv=(e,t)=>{const{startTable:o,endTable:n}=t,r=e.cloneRange();return o.each(e=>r.setStartAfter(e.dom)),n.each(e=>r.setEndBefore(e.dom)),r},fv=(e,t)=>{const o=(e=>t=>_o(e,t))(e),n=((e,t)=>{const o=lv(e.startContainer,t),n=lv(e.endContainer,t);return He(o,n,sv)})(t,o),r=((e,t)=>{const o=iv(e.startContainer,t),n=iv(e.endContainer,t),r=o.isSome(),i=n.isSome(),s=He(o,n,_o).getOr(!1);return(e=>He(e.startTable,e.endTable,(t,o)=>{const n=xr(t,e=>_o(e,o)),r=xr(o,e=>_o(e,t));return n||r?{...e,startTable:n?L.none():e.startTable,endTable:r?L.none():e.endTable,isSameTable:!1,isMultiTable:!1}:e}).getOr(e))({startTable:o,endTable:n,isStartInTable:r,isEndInTable:i,isSameTable:s,isMultiTable:!s&&r&&i})})(t,o);return((e,t,o)=>e.exists(e=>((e,t)=>!cv(e)&&dv(e,t).exists(e=>{const t=e.dom.rows;return 1===t.length&&1===t[0].cells.length}))(e,o)&&tm(e.start,t)))(n,t,o)?n.map(e=>av.singleCellTable(t,e.start)):r.isMultiTable?((e,t,o,n)=>hv(e,t,o,n).bind(({start:e,end:n})=>{const r=e.bind(pv).getOr([]),i=n.bind(pv).getOr([]);if(r.length>0&&i.length>0){const e=gv(o,t);return L.some(av.multiTable(r,i,e))}return L.none()}))(n,r,t,o):((e,t,o,n)=>hv(e,t,o,n).bind(({start:e,end:t})=>e.or(t)).bind(e=>{const{isSameTable:n}=t,r=pv(e).getOr([]);if(n&&e.cells.length===r.length)return L.some(av.fullTable(e.table));if(r.length>0){if(n)return L.some(av.partialTable(r,L.none()));{const e=gv(o,t);return L.some(av.partialTable(r,L.some({...t,rng:e})))}}return L.none()}))(n,r,t,o)},vv=e=>W(e,e=>{wn(e,"contenteditable"),Va(e)}),bv=(e,t,o,n)=>{const r=o.cloneRange();n?(r.setStart(o.startContainer,o.startOffset),r.setEndAfter(t.dom.lastChild)):(r.setStartBefore(t.dom.firstChild),r.setEnd(o.endContainer,o.endOffset)),xv(e,r,t,!1).each(e=>e())},yv=e=>{const t=Kh(e),o=mo(e.selection.getNode());mi(o.dom)&&ki(e.schema,o)?e.selection.setCursorLocation(o.dom,0):e.selection.collapse(!0),t.length>1&&$(t,e=>_o(e,o))&&gn(o,"data-mce-selected","1")},wv=(e,t,o)=>L.some(()=>{const n=e.selection.getRng(),r=o.bind(({rng:o,isStartInTable:r})=>{const i=((e,t)=>L.from(e.dom.getParent(t,e.dom.isBlock)).map(mo))(e,r?o.endContainer:o.startContainer);o.deleteContents(),((e,t,o)=>{o.each(o=>{t?Cn(o):(Va(o),e.selection.setCursorLocation(o.dom,0))})})(e,r,i.filter(B(ki,e.schema)));const s=r?t[0]:t[t.length-1];return bv(e,s,n,r),ki(e.schema,s)?L.none():L.some(r?t.slice(1):t.slice(0,-1))}).getOr(t);vv(r),yv(e)}),_v=(e,t,o,n)=>L.some(()=>{const r=e.selection.getRng(),i=t[0],s=o[o.length-1];bv(e,i,r,!0),bv(e,s,r,!1);const a=ki(e.schema,i)?t:t.slice(1),l=ki(e.schema,s)?o:o.slice(0,-1);vv(a.concat(l)),n.deleteContents(),yv(e)}),xv=(e,t,o,n=!0)=>L.some(()=>{nv(e,t,o,n)}),Cv=(e,t)=>L.some(()=>Hf(e,!1,t)),kv=(e,t)=>Q(ef(t,e),Ba),Sv=(e,t)=>Q(ef(t,e),Ro("caption")),Tv=(e,t)=>L.some(()=>{Va(t),e.selection.setCursorLocation(t.dom,0)}),Ev=(e,t)=>e?Yg(t):Xg(t),Ov=(e,t,o)=>{const n=mo(e.getBody());return Sv(n,o).fold(()=>((e,t,o,n)=>{const r=Dl.fromRangeStart(e.selection.getRng());return kv(o,n).bind(n=>ki(e.schema,n,{checkRootAsContent:!1})?Tv(e,n):((e,t,o,n,r)=>Ch(o,e.getBody(),r).bind(e=>kv(t,mo(e.getNode())).bind(e=>_o(e,n)?L.none():L.some(S))))(e,o,t,n,r))})(e,t,n,o).orThunk(()=>Ue(((e,t)=>{const o=Dl.fromRangeStart(e.selection.getRng());return Ev(t,o)||xh(t,e.getBody(),o).exists(e=>Ev(t,e))})(e,t),S)),o=>((e,t,o,n)=>{const r=Dl.fromRangeStart(e.selection.getRng());return ki(e.schema,n)?Tv(e,n):((e,t,o,n,r)=>Ch(o,e.getBody(),r).fold(()=>L.some(S),i=>((e,t,o,n)=>Oh(e.dom).bind(r=>Ah(e.dom).map(e=>t?o.isEqual(r)&&n.isEqual(e):o.isEqual(e)&&n.isEqual(r))).getOr(!0))(n,o,r,i)?((e,t)=>Tv(e,t))(e,n):((e,t,o)=>Sv(e,mo(o.getNode())).fold(()=>L.some(S),e=>Ue(!_o(e,t),S)))(t,n,i)))(e,o,t,n,r)})(e,t,n,o))},Av=(e,t)=>{const o=mo(e.selection.getStart(!0)),n=Kh(e);return e.selection.isCollapsed()&&0===n.length?Ov(e,t,o):((e,t,o)=>{const n=mo(e.getBody()),r=e.selection.getRng();return 0!==o.length?wv(e,o,L.none()):((e,t,o,n)=>Sv(t,n).fold(()=>((e,t,o)=>fv(t,o).bind(t=>t.fold(B(xv,e),B(Cv,e),B(wv,e),B(_v,e))))(e,t,o),t=>((e,t)=>Tv(e,t))(e,t)))(e,n,r,t)})(e,o,n)},Mv=(e,t)=>{let o=t;for(;o&&o!==e;){if(di(o)||ui(o))return o;o=o.parentNode}return null},Bv=["data-ephox-","data-mce-","data-alloy-","data-snooker-","_"],Rv=ao.each,Nv=e=>{const t=e.dom,o=new Set(e.serializer.getTempAttrs()),n=e=>$(Bv,t=>Ye(e,t))||o.has(e);return{compare:(e,o)=>{if(e.nodeName!==o.nodeName||e.nodeType!==o.nodeType)return!1;const r=e=>{const o={};return Rv(t.getAttribs(e),r=>{const i=r.nodeName.toLowerCase();"style"===i||n(i)||(o[i]=t.getAttrib(e,i))}),o},i=(e,t)=>{for(const o in e)if(Se(e,o)){const n=t[o];if(y(n))return!1;if(e[o]!==n)return!1;delete t[o]}for(const e in t)if(Se(t,e))return!1;return!0};if(Wr(e)&&Wr(o)){if(!i(r(e),r(o)))return!1;if(!i(t.parseStyle(t.getAttrib(e,"style")),t.parseStyle(t.getAttrib(o,"style"))))return!1}return!$h(e)&&!$h(o)},isAttributeInternal:n}},Vv=e=>["h1","h2","h3","h4","h5","h6"].includes(e.name),Dv=(e,t,o,n)=>{const r=o.name;for(let t=0,i=e.length;t<i;t++){const i=e[t];if(i.name===r){const e=n.nodes[r];e?e.nodes.push(o):n.nodes[r]={filter:i,nodes:[o]}}}if(o.attributes)for(let e=0,r=t.length;e<r;e++){const r=t[e],i=r.name;if(i in o.attributes.map){const e=n.attributes[i];e?e.nodes.push(o):n.attributes[i]={filter:r,nodes:[o]}}}},Pv=(e,t)=>{const o=(e,o)=>{fe(e,e=>{const n=ue(e.nodes);W(e.filter.callbacks,r=>{for(let t=n.length-1;t>=0;t--){const r=n[t];(o?void 0!==r.attr(e.filter.name):r.name===e.filter.name)&&!w(r.parent)||n.splice(t,1)}n.length>0&&r(n,e.filter.name,t)})})};o(e.nodes,!1),o(e.attributes,!0)},Iv=(e,t,o,n={})=>{const r=((e,t,o)=>{const n={nodes:{},attributes:{}};return o.firstChild&&((e,t)=>{let o=e;for(;o=o.walk();)t(o)})(o,o=>{Dv(e,t,o,n)}),n})(e,t,o);Pv(r,n)},Lv=(e,t,o,n)=>{if((e.pad_empty_with_br||t.insert)&&o(n)){const e=new mg("br",1);t.insert&&e.attr("data-mce-bogus","1"),n.empty().append(e)}else n.empty().append(new mg("#text",3)).value=lt},Fv=(e,t)=>{const o=null==e?void 0:e.firstChild;return _(o)&&o===e.lastChild&&o.name===t},zv=(e,t,o,n)=>n.isEmpty(t,o,t=>((e,t)=>{const o=e.getElementRule(t.name);return!0===(null==o?void 0:o.paddEmpty)})(e,t)),Hv=e=>{let t;for(let o=e;o;o=o.parent){const e=o.attr("contenteditable");if("false"===e)break;"true"===e&&(t=o)}return L.from(t)},Uv=(e,t,o=e.parent)=>{if(t.getSpecialElements()[e.name])e.empty().remove();else{const n=e.children();for(const e of n)o&&!t.isValidChild(o.name,e.name)&&Uv(e,t,o);e.unwrap()}},Zv=(e,t,o,n=S)=>{const r=t.getTextBlockElements(),i=t.getNonEmptyElements(),s=t.getWhitespaceElements(),a=ao.makeMap("tr,td,th,tbody,thead,tfoot,table,summary"),l=new Set,c=e=>e!==o&&!a[e.name];for(let o=0;o<e.length;o++){const a=e[o];let d,u,h;if(!a.parent||l.has(a))continue;if(r[a.name]&&"li"===a.parent.name){let e=a.next;for(;e&&r[e.name];)e.name="li",l.add(e),a.parent.insert(e,a.parent),e=e.next;a.unwrap();continue}const m=[a];for(d=a.parent;d&&!t.isValidChild(d.name,a.name)&&c(d);d=d.parent)m.push(d);if(d&&m.length>1)if($v(t,a,d))Uv(a,t);else{m.reverse(),u=m[0].clone(),n(u);let e=u;for(let o=0;o<m.length-1;o++){t.isValidChild(e.name,m[o].name)&&o>0?(h=m[o].clone(),n(h),e.append(h)):h=e;for(let e=m[o].firstChild;e&&e!==m[o+1];){const t=e.next;h.append(e),e=t}e=h}zv(t,i,s,u)?d.insert(a,m[0],!0):(d.insert(u,m[0],!0),d.insert(a,u)),d=m[0],(zv(t,i,s,d)||Fv(d,"br"))&&d.empty().remove()}else if(a.parent){if("li"===a.name){let e=a.prev;if(e&&("ul"===e.name||"ol"===e.name)){e.append(a);continue}if(e=a.next,e&&("ul"===e.name||"ol"===e.name)&&e.firstChild){e.insert(a,e.firstChild,!0);continue}const t=new mg("ul",1);n(t),a.wrap(t);continue}if(t.isValidChild(a.parent.name,"div")&&t.isValidChild("div",a.name)){const e=new mg("div",1);n(e),a.wrap(e)}else Uv(a,t)}}},$v=(e,t,o=t.parent)=>!(!o||(!e.children[t.name]||e.isValidChild(o.name,t.name))&&("a"!==t.name||!(e=>{let t=e;for(;t;){if("a"===t.name)return!0;t=t.parent}return!1})(o))&&(!(e=>"summary"===e.name)(o)||!Vv(t)||(null==o?void 0:o.firstChild)===t&&(null==o?void 0:o.lastChild)===t)),jv=e=>e.collapsed?e:(e=>{const t=Dl.fromRangeStart(e),o=Dl.fromRangeEnd(e),n=e.commonAncestorContainer;return xh(!1,n,o).map(r=>!Yu(t,o,n)&&Yu(t,r,n)?((e,t,o,n)=>{const r=document.createRange();return r.setStart(e,t),r.setEnd(o,n),r})(t.container(),t.offset(),r.container(),r.offset()):e).getOr(e)})(e),Wv=(e,t)=>{let o=t.firstChild,n=t.lastChild;return o&&"meta"===o.name&&(o=o.next),n&&"mce_marker"===n.attr("id")&&(n=n.prev),((e,t)=>{const o=e.getNonEmptyElements();return _(t)&&(t.isEmpty(o)||((e,t)=>e.getBlockElements()[t.name]&&(e=>_(e.firstChild)&&e.firstChild===e.lastChild)(t)&&(e=>"br"===e.name||e.value===lt)(t.firstChild))(e,t))})(e,n)&&(n=null==n?void 0:n.prev),!(!o||o!==n||"ul"!==o.name&&"ol"!==o.name)},qv=e=>{return e.length>0&&(!(o=e[e.length-1]).firstChild||_(null==(t=o)?void 0:t.firstChild)&&t.firstChild===t.lastChild&&(e=>e.data===lt||ai(e))(t.firstChild))?e.slice(0,-1):e;var t,o},Gv=(e,t)=>{const o=e.getParent(t,e.isBlock);return o&&"LI"===o.nodeName?o:null},Yv=(e,t)=>{const o=Dl.after(e),n=bh(t).prev(o);return n?n.toRange():null},Xv=(e,t,o,n)=>{const r=((e,t,o)=>{const n=t.serialize(o);return(e=>{var t,o;const n=e.firstChild,r=e.lastChild;return n&&"META"===n.nodeName&&(null===(t=n.parentNode)||void 0===t||t.removeChild(n)),r&&"mce_marker"===r.id&&(null===(o=r.parentNode)||void 0===o||o.removeChild(r)),e})(e.createFragment(n))})(t,e,n),i=Gv(t,o.startContainer),s=qv((a=r.firstChild,Y(null!==(l=null==a?void 0:a.childNodes)&&void 0!==l?l:[],e=>"LI"===e.nodeName)));var a,l;const c=t.getRoot(),d=e=>{const n=Dl.fromRangeStart(o),r=bh(t.getRoot()),s=1===e?r.prev(n):r.next(n),a=null==s?void 0:s.getNode();return!a||Gv(t,a)!==i};return i?d(1)?((e,t,o)=>{const n=e.parentNode;return n&&ao.each(t,t=>{n.insertBefore(t,e)}),((e,t)=>{const o=Dl.before(e),n=bh(t).next(o);return n?n.toRange():null})(e,o)})(i,s,c):d(2)?((e,t,o,n)=>(n.insertAfter(t.reverse(),e),Yv(t[0],o)))(i,s,c,t):((e,t,o,n)=>{const r=((e,t)=>{const o=t.cloneRange(),n=t.cloneRange();return o.setStartBefore(e),n.setEndAfter(e),[o.cloneContents(),n.cloneContents()]})(e,n),i=e.parentNode;return i&&(i.insertBefore(r[0],e),ao.each(t,t=>{i.insertBefore(t,e)}),i.insertBefore(r[1],e),i.removeChild(e)),Yv(t[t.length-1],o)})(i,s,c,o):null},Kv=["pre"],Jv=mi,Qv=e=>tb(e,ti),eb=e=>tb(e,ci),tb=(e,t)=>e.startContainer===e.endContainer&&e.endOffset-e.startOffset===1&&t(e.startContainer.childNodes[e.startOffset]),ob=(e,t,o)=>{var n,r;const i=e.selection,s=e.dom,a=e.parser,l=o.merge,c=Rg({validate:!0},e.schema),d='<span id="mce_marker" data-mce-type="bookmark">&#xFEFF;</span>';o.preserve_zwsp||(t=Ia(t)),-1===t.indexOf("{$caret}")&&(t+="{$caret}"),t=t.replace(/\{\$caret\}/,d);let u=i.getRng();const h=u.startContainer,m=e.getBody();h===m&&i.isCollapsed()&&s.isBlock(m.firstChild)&&((e,t)=>_(t)&&!e.schema.getVoidElements()[t.nodeName])(e,m.firstChild)&&s.isEmpty(m.firstChild)&&(u=s.createRng(),u.setStart(m.firstChild,0),u.setEnd(m.firstChild,0),i.setRng(u)),i.isCollapsed()||(e=>{const t=e.dom,o=jv(e.selection.getRng());e.selection.setRng(o);const n=t.getParent(o.startContainer,Jv);((e,t,o)=>!!_(o)&&o===e.getParent(t.endContainer,Jv)&&tm(mo(o),t))(t,o,n)?xv(e,o,mo(n)):eb(o)||Qv(o)?o.deleteContents():e.getDoc().execCommand("Delete",!1)})(e);const p=i.getNode(),g={context:p.nodeName.toLowerCase(),data:o.data,insert:!0},f=a.parse(t,g);if(!0===o.paste&&Wv(e.schema,f)&&((e,t)=>!!Gv(e,t))(s,p))return u=Xv(c,s,i.getRng(),f),u&&i.setRng(u),t;!0===o.paste&&((e,t,o,n)=>{var r;const i=t.firstChild,s=t.lastChild,a=i===("bookmark"===s.attr("data-mce-type")?s.prev:s),l=Z(Kv,i.name);if(a&&l){const t="false"!==i.attr("contenteditable"),s=(null===(r=e.getParent(o,e.isBlock))||void 0===r?void 0:r.nodeName.toLowerCase())===i.name,a=L.from(Mv(n,o)).forall(di);return t&&s&&a}return!1})(s,f,p,e.getBody())&&(null===(n=f.firstChild)||void 0===n||n.unwrap()),(e=>{let t=e;for(;t=t.walk();)1===t.type&&t.attr("data-mce-fragment","1")})(f);let v=f.lastChild;if(v&&"mce_marker"===v.attr("id")){const t=v;for(v=v.prev;v&&"table"!==v.name;v=v.walk(!0))if(3===v.type||!s.isBlock(v.name)){v.parent&&e.schema.isValidChild(v.parent.name,"span")&&v.parent.insert(t,v,"br"===v.name);break}}if(e._selectionOverrides.showBlockCaretContainer(p),g.invalid||((e,t,o)=>{var n;return $(o.children(),Vv)&&"SUMMARY"===(null===(n=e.getParent(t,e.isBlock))||void 0===n?void 0:n.nodeName)})(s,p,f)){e.selection.setContent(d);let o,n=i.getNode();const l=e.getBody();for(ii(n)?n=o=l:o=n;o&&o!==l;)n=o,o=o.parentNode;t=n===l?l.innerHTML:s.getOuterHTML(n);const u=a.parse(t),h=(e=>{for(let t=e;t;t=t.walk())if("mce_marker"===t.attr("id"))return L.some(t);return L.none()})(u),m=h.bind(Hv).getOr(u);h.each(e=>e.replace(f));const p=f.children(),g=null!==(r=f.parent)&&void 0!==r?r:u;f.unwrap();const v=Y(p,t=>$v(e.schema,t,g));Zv(v,e.schema,m),Iv(a.getNodeFilters(),a.getAttributeFilters(),u),t=c.serialize(u),n===l?s.setHTML(l,t):s.setOuterHTML(n,t)}else t=c.serialize(f),((e,t,o)=>{var n;"all"===o.getAttribute("data-mce-bogus")?null===(n=o.parentNode)||void 0===n||n.insertBefore(e.dom.createFragment(t),o):((e,t)=>{if(e.isBlock(t)&&e.isEditable(t)){const e=t.childNodes;return 1===e.length&&ai(e[0])||0===e.length}return!1})(e.dom,o)?e.dom.setHTML(o,t):e.selection.setContent(t,{no_events:!0})})(e,t,p);var b;return((e,t)=>{const o=e.schema.getTextInlineElements(),n=e.dom;if(t){const t=e.getBody(),r=Nv(e),i="*[data-mce-fragment]",s=n.select(i);ao.each(s,e=>{const s=e=>_(o[e.nodeName.toLowerCase()]),a=e=>1===e.childNodes.length;if(!Ig(n,l=e)&&!((e,t)=>Ig(e,t)&&$(Pg(e,t),e=>(e=>Vg.has(e))(e)))(n,l)&&s(e)&&a(e)){const o=Pg(n,e),l=(e,t)=>ne(e,e=>Z(t,e)),c=t=>a(e)&&n.is(t,i)&&s(t)&&(t.nodeName===e.nodeName&&l(o,Pg(n,t))||c(t.children[0])),d=o=>_(o)&&o!==t&&(r.compare(e,o)||d(o.parentElement)),u=o=>_(o)&&o!==t&&n.is(o,i)&&(((e,t,o)=>{const n=Pg(e,t),r=Pg(e,o),i=n=>{var r,i;const s=null!==(r=e.getStyle(t,n))&&void 0!==r?r:"",a=null!==(i=e.getStyle(o,n))&&void 0!==i?i:"";return tt(s)&&tt(a)&&s!==a};return $(n,e=>{const t=t=>$(t,t=>t===e);if(!t(r)&&t(Dg)){const e=Y(r,e=>$(Dg,t=>Ye(e,t)));return $(e,i)}return i(e)})})(n,e,o)||u(o.parentElement));(c(e.children[0])||d(e.parentElement)&&!u(e.parentElement))&&n.remove(e,!0)}var l})}})(e,l),((e,t)=>{var o,n,r;let i;const s=e.dom,a=e.selection;if(!t)return;a.scrollIntoView(t);const l=Mv(e.getBody(),t);if(l&&"false"===s.getContentEditable(l))return s.remove(t),void a.select(l);let c=s.createRng();const d=t.previousSibling;if(ti(d)){c.setStart(d,null!==(n=null===(o=d.nodeValue)||void 0===o?void 0:o.length)&&void 0!==n?n:0);const e=t.nextSibling;ti(e)&&(d.appendData(e.data),null===(r=e.parentNode)||void 0===r||r.removeChild(e))}else c.setStartBefore(t),c.setEndBefore(t);const u=s.getParent(t,s.isBlock);if(s.remove(t),u&&s.isEmpty(u)){const t=Jv(u);xn(mo(u)),c.setStart(u,0),c.setEnd(u,0),t||(e=>!!e.getAttribute("data-mce-fragment"))(u)||!(i=(t=>{let o=Dl.fromRangeStart(t);return o=bh(e.getBody()).next(o),null==o?void 0:o.toRange()})(c))?s.add(u,s.create("br",t?{}:{"data-mce-bogus":"1"})):(c=i,s.remove(u))}a.setRng(c)})(e,s.get("mce_marker")),b=e.getBody(),ao.each(b.getElementsByTagName("*"),e=>{e.removeAttribute("data-mce-fragment")}),((e,t,o)=>{L.from(e.getParent(t,"td,th")).map(mo).each(e=>((e,t)=>{Wo(e).each(o=>{Fo(o).each(n=>{t.isBlock(ko(e))&&Ta(o)&&t.isBlock(ko(n))&&Cn(o)})})})(e,o))})(s,i.getStart(),e.schema),((e,t,o)=>{const n=Lo(mo(o),e=>_o(e,mo(t)));le(n,n.length-2).filter(Oo).fold(()=>Ii(e,t),t=>Ii(e,t.dom))})(e.schema,e.getBody(),i.getStart()),t},nb=e=>e instanceof mg,rb=(e,t,o)=>{e.dom.setHTML(e.getBody(),t),!0!==o&&(e=>{wp(e)&&Oh(e.getBody()).each(t=>{const o=t.getNode(),n=Jr(o)?Oh(o).getOr(t):t;e.selection.setRng(n.toRange())})})(e)},ib=fm,sb=(e,t,o)=>{const n=e.formatter.get(o);if(n)for(let o=0;o<n.length;o++){const r=n[o];if(Cm(r)&&!1===r.inherit&&e.dom.is(t,r.selector))return!0}return!1},ab=(e,t,o,n,r)=>{const i=e.dom.getRoot();if(t===i)return!1;const s=e.dom.getParent(t,t=>!!sb(e,t,o)||t.parentNode===i||!!db(e,t,o,n,!0));return!!db(e,s,o,n,r)},lb=(e,t,o)=>!(!km(o)||!ib(t,o.inline))||!(!xm(o)||!ib(t,o.block))||!!Cm(o)&&Wr(t)&&e.is(t,o.selector),cb=(e,t,o,n,r,i)=>{const s=o[n],a="attributes"===n;if(x(o.onmatch))return o.onmatch(t,o,n);if(s)if(ut(s)){for(let o=0;o<s.length;o++)if(a?e.getAttrib(t,s[o]):bm(e,t,s[o]))return!0}else for(const n in s)if(Se(s,n)){const l=a?e.getAttrib(t,n):bm(e,t,n),c=gm(s[n],i),d=w(l)||ot(l);if(d&&w(c))continue;if(r&&d&&!o.exact)return!1;if((!r||o.exact)&&!ib(l,vm(c,n)))return!1}return!0},db=(e,t,o,n,r)=>{const i=e.formatter.get(o),s=e.dom;if(i&&Wr(t))for(let o=0;o<i.length;o++){const a=i[o];if(lb(e.dom,t,a)&&cb(s,t,a,"attributes",r,n)&&cb(s,t,a,"styles",r,n)){const o=a.classes;if(o)for(let r=0;r<o.length;r++)if(!e.dom.hasClass(t,gm(o[r],n)))return;return a}}},ub=(e,t,o,n,r)=>{if(n)return ab(e,n,t,o,r);if(n=e.selection.getNode(),ab(e,n,t,o,r))return!0;const i=e.selection.getStart();return!(i===n||!ab(e,i,t,o,r))},hb=Da,mb=e=>{if(e){const t=new Fr(e,e);for(let e=t.current();e;e=t.next())if(ti(e))return e}return null},pb=e=>{const t=uo("span");return fn(t,{id:Mh,"data-mce-bogus":"1","data-mce-type":"format-caret"}),e&&un(t,ho(hb)),t},gb=(e,t,o)=>{const n=e.dom,r=e.selection;if(Tm(t))Hf(e,!1,mo(t),o,!0);else{const e=r.getRng(),o=n.getParent(t,n.isBlock),i=e.startContainer,s=e.startOffset,a=e.endContainer,l=e.endOffset,c=(e=>{const t=mb(e);return t&&t.data.charAt(0)===hb&&t.deleteData(0,1),t})(t);n.remove(t,!0),i===c&&s>0&&e.setStart(c,s-1),a===c&&l>0&&e.setEnd(c,l-1),o&&n.isEmpty(o)&&Va(mo(o)),r.setRng(e)}},fb=(e,t,o)=>{const n=e.dom,r=e.selection;if(t)gb(e,t,o);else if(!(t=Rh(e.getBody(),r.getStart())))for(;t=n.get(Mh);)gb(e,t,o)},vb=(e,t)=>(e.appendChild(t),t),bb=(e,t)=>{var o;const n=X(e,(e,t)=>vb(e,t.cloneNode(!1)),t),r=null!==(o=n.ownerDocument)&&void 0!==o?o:document;return vb(n,r.createTextNode(hb))},yb=e=>Jn(e,Kn(e).replace(new RegExp(`${lt}$`)," ")),wb=(e,t)=>{const o=()=>{null===t||e.dom.isEmpty(t)||Fo(mo(t)).each(e=>{Ao(e)?yb(e):nr(e,e=>Ao(e)).each(e=>{Ao(e)&&yb(e)})})};e.once("input",t=>{t.data&&!qh(t.data)&&(t.isComposing?e.once("compositionend",()=>{o()}):o())})},_b=(e,t,o,n)=>{const r=e.dom,a=e.selection;let l=!1;const c=e.formatter.get(t);if(!c)return;const d=a.getRng(),u=d.startContainer,h=d.startOffset;let m=u;ti(u)&&(h!==u.data.length&&(l=!0),m=m.parentNode);const p=[];let g;for(;m;){if(db(e,m,t,o,n)){g=m;break}m.nextSibling&&(l=!0),p.push(m),m=m.parentNode}if(g)if(l){const i=a.getBookmark();d.collapse(!0);let s=Zm(r,d,c,{includeTrailingSpace:!0});s=Fp(s),e.formatter.remove(t,o,s,n),a.moveToBookmark(i)}else{const l=Rh(e.getBody(),g),c=_(l)?r.getParents(g.parentNode,I,l):[],d=pb(!1).dom;((e,t,o)=>{var n,r;const i=e.dom,s=i.getParent(o,B(um,e.schema));s&&i.isEmpty(s)?null===(n=o.parentNode)||void 0===n||n.replaceChild(t,o):((e=>{const t=yr(e,"br"),o=Y((e=>{const t=[];let o=e.dom;for(;o;)t.push(mo(o)),o=o.lastChild;return t})(e).slice(-1),Ta);t.length===o.length&&W(o,Cn)})(mo(o)),i.isEmpty(o)?null===(r=o.parentNode)||void 0===r||r.replaceChild(t,o):i.insertAfter(t,o))})(e,d,null!=l?l:g);const u=((e,t,o,n,r,a)=>{const l=e.formatter,c=e.dom,d=Y(pe(l.get()),e=>e!==n&&!Ge(e,"removeformat")),u=((e,t,o)=>K(o,(o,n)=>{const r=((e,t)=>_m(e,t,e=>{const t=e=>x(e)||e.length>1&&"%"===e.charAt(0);return $(["styles","attributes"],o=>ke(e,o).exists(e=>{const o=f(e)?e:Ce(e);return $(o,t)}))}))(e,n);return e.formatter.matchNode(t,n,{},r)?o.concat([n]):o},[]))(e,o,d);if(Y(u,t=>!((e,t,o)=>{const n=["inline","block","selector","attributes","styles","classes"],r=e=>_e(e,(e,t)=>$(n,e=>e===t));return _m(e,t,t=>{const n=r(t);return _m(e,o,e=>{const t=r(e);return((e,t,o=s)=>i(o).eq(e,t))(n,t)})})})(e,t,n)).length>0){const e=o.cloneNode(!1);return c.add(t,e),l.remove(n,r,e,a),c.remove(e),L.some(e)}return L.none()})(e,d,g,t,o,n),h=bb([...p,...u.toArray(),...c],d);l&&gb(e,l,_(l)),a.setCursorLocation(h,1),wb(e,d),r.isEmpty(g)&&r.remove(g)}},xb=e=>{const t=pb(!1),o=bb(e,t.dom);return{caretContainer:t,caretPosition:Dl(o,0)}},Cb=(e,t)=>{const{caretContainer:o,caretPosition:n}=xb(t);return ln(mo(e),o),Cn(mo(e)),n},kb=(e,t)=>{if(Bh(t.dom))return!1;const o=e.schema.getTextInlineElements();return Se(o,ko(t))&&!Bh(t.dom)&&!Kr(t.dom)},Sb={},Tb=Yr(["pre"]);(e=>{Sb[e]||(Sb[e]=[]),Sb[e].push(e=>{if(!e.selection.getRng().collapsed){const t=e.selection.getSelectedBlocks(),o=Y(Y(t,Tb),(e=>t=>{const o=t.previousSibling;return Tb(o)&&Z(e,o)})(t));W(o,e=>{((e,t)=>{const o=mo(t),n=Vo(o).dom;Cn(o),mn(mo(e),[uo("br",n),uo("br",n),...Zo(o)])})(e.previousSibling,e)})}})})("pre");const Eb=["fontWeight","fontStyle","color","fontSize","fontFamily"],Ob=(e,t)=>{const o=e.get(t);return f(o)?Q(o,e=>km(e)&&"span"===e.inline&&(e=>p(e.styles)&&$(pe(e.styles),e=>Z(Eb,e)))(e)):L.none()},Ab=(e,t)=>Eh(t,Dl.fromRangeStart(e)).isNone(),Mb=(e,t)=>!1===Th(t,Dl.fromRangeEnd(e)).exists(e=>!ai(e.getNode())||Th(t,e).isSome()),Bb=e=>t=>fi(t)&&e.isEditable(t),Rb=e=>Y(e.getSelectedBlocks(),Bb(e.dom)),Nb=ao.each,Vb=e=>Wr(e)&&!$h(e)&&!Bh(e)&&!Kr(e),Db=(e,t)=>{for(let o=e;o;o=o[t]){if(ti(o)&&tt(o.data))return e;if(Wr(o)&&!$h(o))return o}return e},Pb=(e,t,o)=>{const n=Nv(e),r=qr(t)&&e.dom.isEditable(t),i=qr(o)&&e.dom.isEditable(o);if(r&&i){const r=Db(t,"previousSibling"),i=Db(o,"nextSibling");if(n.compare(r,i)){for(let e=r.nextSibling;e&&e!==i;){const t=e;e=e.nextSibling,r.appendChild(t)}return e.dom.remove(i),ao.each(ao.grep(i.childNodes),e=>{r.appendChild(e)}),r}}return o},Ib=(e,t,o,n)=>{var r;if(n&&!1!==t.merge_siblings){const t=null!==(r=Pb(e,dm(n),n))&&void 0!==r?r:n;Pb(e,t,dm(t,!0))}},Lb=(e,t,o)=>{Nb(e.childNodes,e=>{Vb(e)&&(t(e)&&o(e),e.hasChildNodes()&&Lb(e,t,o))})},Fb=(e,t)=>o=>!(!o||!bm(e,o,t)),zb=(e,t,o)=>n=>{e.setStyle(n,t,o),""===n.getAttribute("style")&&n.removeAttribute("style"),((e,t)=>{"SPAN"===t.nodeName&&0===e.getAttribs(t).length&&e.remove(t,!0)})(e,n)},Hb=Ee([{keep:[]},{rename:["name"]},{removed:[]}]),Ub=/^(src|href|style)$/,Zb=ao.each,$b=fm,jb=(e,t,o)=>e.isChildOf(t,o)&&t!==o&&!e.isBlock(o),Wb=(e,t,o)=>{let n=t[o?"startContainer":"endContainer"],r=t[o?"startOffset":"endOffset"];if(Wr(n)){const e=n.childNodes.length-1;!o&&r&&r--,n=n.childNodes[r>e?e:r]}return ti(n)&&o&&r>=n.data.length&&(n=new Fr(n,e.getBody()).next()||n),ti(n)&&!o&&0===r&&(n=new Fr(n,e.getBody()).prev()||n),n},qb=(e,t)=>{const o=t?"firstChild":"lastChild",n=e[o];return(e=>/^(TR|TH|TD)$/.test(e.nodeName))(e)&&n?"TR"===e.nodeName&&n[o]||n:e},Gb=(e,t,o,n)=>{var r;const i=e.create(o,n);return null===(r=t.parentNode)||void 0===r||r.insertBefore(i,t),i.appendChild(t),i},Yb=(e,t,o,n,r)=>{const i=mo(t),s=mo(e.create(n,r)),a=o?Uo(i):Ho(i);return mn(s,a),o?(ln(i,s),dn(s,i)):(cn(i,s),un(s,i)),s.dom},Xb=(e,t,o)=>{const n=t.parentNode;let r;const i=e.dom,s=Bc(e);xm(o)&&n===i.getRoot()&&(o.list_block&&$b(t,o.list_block)||W(ue(t.childNodes),t=>{hm(e,s,t.nodeName.toLowerCase())?r?r.appendChild(t):(r=Gb(i,t,s),i.setAttribs(r,Rc(e))):r=null})),(e=>Cm(e)&&km(e)&&Fe(ke(e,"mixed"),!0))(o)&&!$b(o.inline,t)||i.remove(t,!0)},Kb=(e,t,o)=>C(e)?{name:t,value:null}:{name:e,value:gm(t,o)},Jb=(e,t)=>{""===e.getAttrib(t,"style")&&(t.removeAttribute("style"),t.removeAttribute("data-mce-style"))},Qb=(e,t,o,n,r)=>{let i=!1;Zb(o.styles,(s,a)=>{const{name:l,value:c}=Kb(a,s,n),d=vm(c,l);(o.remove_similar||v(c)||!Wr(r)||$b(bm(e,r,l),d))&&e.setStyle(t,l,""),i=!0}),i&&Jb(e,t)},ey=(e,t,o,n,r)=>{const i=e.dom,s=Nv(e),a=e.schema;if(km(t)&&zi(a,t.inline)&&Ui(a,n)&&n.parentElement===e.getBody())return Xb(e,n,t),Hb.removed();if(!t.ceFalseOverride&&n&&"false"===i.getContentEditableParent(n))return Hb.keep();if(n&&!lb(i,n,t)&&!((e,t)=>t.links&&"A"===e.nodeName)(n,t))return Hb.keep();const l=n,c=t.preserve_attributes;if(km(t)&&"all"===t.remove&&f(c)){const e=Y(i.getAttribs(l),e=>Z(c,e.name.toLowerCase()));if(i.removeAllAttribs(l),W(e,e=>i.setAttrib(l,e.name,e.value)),e.length>0)return Hb.rename("span")}if("all"!==t.remove){Qb(i,l,t,o,r),Zb(t.attributes,(e,n)=>{const{name:s,value:a}=Kb(n,e,o);if(t.remove_similar||v(a)||!Wr(r)||$b(i.getAttrib(r,s),a)){if("class"===s){const e=i.getAttrib(l,s);if(e){let t="";if(W(e.split(/\s+/),e=>{/mce\-\w+/.test(e)&&(t+=(t?" ":"")+e)}),t)return void i.setAttrib(l,s,t)}}if(Ub.test(s)&&l.removeAttribute("data-mce-"+s),"style"===s&&Yr(["li"])(l)&&"none"===i.getStyle(l,"list-style-type"))return l.removeAttribute(s),void i.setStyle(l,"list-style-type","none");"class"===s&&l.removeAttribute("className"),l.removeAttribute(s)}}),Zb(t.classes,e=>{e=gm(e,o),Wr(r)&&!i.hasClass(r,e)||i.removeClass(l,e)});const e=i.getAttribs(l);for(let t=0;t<e.length;t++){const o=e[t].nodeName;if(!s.isAttributeInternal(o))return Hb.keep()}}return"none"!==t.remove?(Xb(e,l,t),Hb.removed()):Hb.keep()},ty=(e,t,o,n)=>ey(e,t,o,n,n).fold(O(n),t=>(e.dom.createFragment().appendChild(n),e.dom.rename(n,t)),O(null)),oy=(e,t,o,n,r)=>{(n||e.selection.isEditable())&&((e,t,o,n,r)=>{const i=e.formatter.get(t),s=i[0],a=e.dom,l=e.selection,c=n=>{const a=((e,t,o,n,r)=>{let i;return t.parentNode&&W(wm(e.dom,t.parentNode).reverse(),t=>{if(!i&&Wr(t)&&"_start"!==t.id&&"_end"!==t.id){const s=db(e,t,o,n,r);s&&!1!==s.split&&(i=t)}}),i})(e,n,t,o,r);return((e,t,o,n,r,i,s,a)=>{var l,c;let d,u;const h=e.dom;if(o){const i=o.parentNode;for(let o=n.parentNode;o&&o!==i;o=o.parentNode){let n=h.clone(o,!1);for(let o=0;o<t.length&&(n=ty(e,t[o],a,n),null!==n);o++);n&&(d&&n.appendChild(d),u||(u=n),d=n)}s.mixed&&h.isBlock(o)||(n=null!==(l=h.split(o,n))&&void 0!==l?l:n),d&&u&&(null===(c=r.parentNode)||void 0===c||c.insertBefore(d,r),u.appendChild(r),km(s)&&Ib(e,s,0,d))}return n})(e,i,a,n,n,0,s,o)},d=t=>$(i,n=>ny(e,n,o,t,t)),u=t=>{const o=ue(t.childNodes),n=d(t)||$(i,e=>lb(a,t,e)),r=t.parentNode;if(!n&&_(r)&&Sm(s)&&d(r),s.deep&&o.length)for(let e=0;e<o.length;e++)u(o[e]);W(["underline","line-through","overline"],o=>{Wr(t)&&e.dom.getStyle(t,"text-decoration")===o&&t.parentNode&&ym(a,t.parentNode)===o&&ny(e,{deep:!1,exact:!0,inline:"span",styles:{textDecoration:o}},void 0,t)})},h=e=>{const t=a.get(e?"_start":"_end");if(t){let o=t[e?"firstChild":"lastChild"];return(e=>$h(e)&&Wr(e)&&("_start"===e.id||"_end"===e.id))(o)&&(o=o[e?"firstChild":"lastChild"]),ti(o)&&0===o.data.length&&(o=e?t.previousSibling||t.nextSibling:t.nextSibling||t.previousSibling),a.remove(t,!0),o}return null},m=t=>{let o,n,r=Zm(a,t,i,{includeTrailingSpace:t.collapsed});if(s.split){if(r=Fp(r),o=Wb(e,r,!0),n=Wb(e,r),o!==n){if(o=qb(o,!0),n=qb(n,!1),jb(a,o,n)){const e=L.from(o.firstChild).getOr(o);return c(Yb(a,e,!0,"span",{id:"_start","data-mce-type":"bookmark"})),void h(!0)}if(jb(a,n,o)){const e=L.from(n.lastChild).getOr(n);return c(Yb(a,e,!1,"span",{id:"_end","data-mce-type":"bookmark"})),void h(!1)}o=Gb(a,o,"span",{id:"_start","data-mce-type":"bookmark"}),n=Gb(a,n,"span",{id:"_end","data-mce-type":"bookmark"});const e=a.createRng();e.setStartAfter(o),e.setEndBefore(n),$m(a,e,e=>{W(e,e=>{$h(e)||$h(e.parentNode)||c(e)})}),c(o),c(n),o=h(!0),n=h()}else o=n=c(o);r.startContainer=o.parentNode?o.parentNode:o,r.startOffset=a.nodeIndex(o),r.endContainer=n.parentNode?n.parentNode:n,r.endOffset=a.nodeIndex(n)+1}$m(a,r,e=>{W(e,u)})};if(n){if(sm(n)){const e=a.createRng();e.setStartBefore(n),e.setEndAfter(n),m(e)}else m(n);hc(e,t,n,o)}else l.isCollapsed()&&km(s)&&!Kh(e).length?_b(e,t,o,r):(lm(e,()=>rm(e,m),n=>km(s)&&ub(e,t,o,n)),e.nodeChanged()),((e,t,o)=>{"removeformat"===t?W(Rb(e.selection),t=>{W(Eb,o=>e.dom.setStyle(t,o,"")),Jb(e.dom,t)}):Ob(e.formatter,t).each(t=>{W(Rb(e.selection),n=>Qb(e.dom,n,t,o,null))})})(e,t,o),hc(e,t,n,o)})(e,t,o,n,r)},ny=(e,t,o,n,r)=>ey(e,t,o,n,r).fold(P,t=>(e.dom.rename(n,t),!0),I),ry=ao.each,iy=ao.each,sy=(e,t,o,n)=>{if(iy(o.styles,(o,r)=>{e.setStyle(t,r,gm(o,n))}),o.styles){const o=e.getAttrib(t,"style");o&&e.setAttrib(t,"data-mce-style",o)}},ay=(e,t,o,n)=>{const r=e.formatter.get(t),i=r[0],s=!n&&e.selection.isCollapsed(),a=e.dom,l=e.selection,c=(e,t=i)=>{x(t.onformat)&&t.onformat(e,t,o,n),sy(a,e,t,o),iy(t.attributes,(t,n)=>{a.setAttrib(e,n,gm(t,o))}),iy(t.classes,t=>{const n=gm(t,o);a.hasClass(e,n)||a.addClass(e,n)})},d=(e,t)=>{let o=!1;return iy(e,e=>!(!Cm(e)||("false"!==a.getContentEditable(t)||e.ceFalseOverride)&&(!_(e.collapsed)||e.collapsed===s)&&a.is(t,e.selector)&&!Bh(t)&&(c(t,e),o=!0,1))),o},u=e=>{if(m(e)){const t=a.create(e);return c(t),t}return null},h=(n,s,a)=>{const l=[];let h=!0;const m=i.inline||i.block,p=u(m);$m(n,s,s=>{let u;const g=s=>{let f=!1,v=h,b=!1;const y=s.parentNode,w=y.nodeName.toLowerCase(),x=n.getContentEditable(s);_(x)&&(v=h,h="true"===x,f=!0,b=pm(e,s));const C=h&&!f;if(ai(s)&&!((e,t,o,n)=>{if(fd(e)&&km(t)&&o.parentNode){const t=Es(e.schema),r=_r(mo(o),e=>Bh(e.dom));return Te(t,n)&&Ci(e.schema,o.parentNode,{skipBogus:!1,includeZwsp:!0})&&!r}return!1})(e,i,s,w))return u=null,void(xm(i)&&n.remove(s));if((n=>(e=>xm(e)&&!0===e.wrapper)(i)&&db(e,n,t,o))(s))u=null;else{if(((t,o,n)=>{const r=(e=>xm(e)&&!0!==e.wrapper)(i)&&um(e.schema,t)&&hm(e,o,m);return n&&r})(s,w,C)){const e=n.rename(s,m);return c(e),l.push(e),void(u=null)}if(Cm(i)){let e=d(r,s);if(!e&&_(y)&&Sm(i)&&(e=d(r,y)),!km(i)||e)return void(u=null)}_(p)&&((t,o,r,s)=>{const l=t.nodeName.toLowerCase(),c=hm(e,m,l)&&hm(e,o,m),d=!a&&ti(t)&&Pa(t.data),u=Bh(t),h=!km(i)||!n.isBlock(t);return(r||s)&&c&&!d&&!u&&h})(s,w,C,b)?(u||(u=n.clone(p,!1),y.insertBefore(u,s),l.push(u)),b&&f&&(h=v),u.appendChild(s)):(u=null,W(ue(s.childNodes),g),f&&(h=v),u=null)}};W(s,g)}),!0===i.links&&W(l,e=>{const t=e=>{"A"===e.nodeName&&c(e,i),W(ue(e.childNodes),t)};t(e)}),W(l,s=>{const a=(e=>{let t=0;return W(e.childNodes,e=>{(e=>_(e)&&ti(e)&&0===e.length)(e)||$h(e)||t++}),t})(s);!(l.length>1)&&n.isBlock(s)||0!==a?(km(i)||xm(i)&&i.wrapper)&&(i.exact||1!==a||(s=(e=>{const t=Q(e.childNodes,am).filter(e=>"false"!==n.getContentEditable(e)&&lb(n,e,i));return t.map(t=>{const o=n.clone(t,!1);return c(o),n.replace(o,e,!0),n.remove(t,!0),o}).getOr(e)})(s)),((e,t,o,n)=>{ry(t,t=>{km(t)&&ry(e.dom.select(t.inline,n),n=>{Vb(n)&&ny(e,t,o,n,t.exact?n:null)}),((e,t,o)=>{if(t.clear_child_styles){const n=t.links?"*:not(a)":"*";Nb(e.select(n,o),o=>{Vb(o)&&e.isEditable(o)&&Nb(t.styles,(t,n)=>{e.setStyle(o,n,"")})})}})(e.dom,t,n)})})(e,r,o,s),((e,t,o,n,r)=>{const i=r.parentNode;db(e,i,o,n)&&ny(e,t,n,r)||t.merge_with_parents&&i&&e.dom.getParent(i,i=>!!db(e,i,o,n)&&(ny(e,t,n,r),!0))})(e,i,t,o,s),((e,t,o,n)=>{if(t.styles&&t.styles.backgroundColor){const r=Fb(e,"fontSize");Lb(n,t=>r(t)&&e.isEditable(t),zb(e,"backgroundColor",gm(t.styles.backgroundColor,o)))}})(n,i,o,s),((e,t,o,n)=>{const r=t=>{if(qr(t)&&Wr(t.parentNode)&&e.isEditable(t)){const o=ym(e,t.parentNode);e.getStyle(t,"color")&&o?e.setStyle(t,"text-decoration",o):e.getStyle(t,"text-decoration")===o&&e.setStyle(t,"text-decoration",null)}};t.styles&&(t.styles.color||t.styles.textDecoration)&&(ao.walk(n,r,"childNodes"),r(n))})(n,i,0,s),((e,t,o,n)=>{if(km(t)&&("sub"===t.inline||"sup"===t.inline)){const o=Fb(e,"fontSize");Lb(n,t=>o(t)&&e.isEditable(t),zb(e,"fontSize",""));const r=Y(e.select("sup"===t.inline?"sub":"sup",n),e.isEditable);e.remove(r,!0)}})(n,i,0,s),Ib(e,i,0,s)):n.remove(s,!0)})},p=sm(n)?n:l.getNode();if("false"===a.getContentEditable(p)&&!pm(e,p))return d(r,n=p),void uc(e,t,n,o);if(i){if(n)if(sm(n)){if(!d(r,n)){const e=a.createRng();e.setStartBefore(n),e.setEndAfter(n),h(a,Zm(a,e,r),!0)}}else h(a,n,!0);else s&&km(i)&&!Kh(e).length?((e,t,o)=>{let n;const r=e.selection,i=e.formatter.get(t);if(!i)return;const s=r.getRng();let a=s.startOffset;const l=s.startContainer.nodeValue;n=Rh(e.getBody(),r.getStart());const c=/[^\s\u00a0\u00ad\u200b\ufeff]/;if(l&&a>0&&a<l.length&&c.test(l.charAt(a))&&c.test(l.charAt(a-1))){const n=r.getBookmark();s.collapse(!0);let a=Zm(e.dom,s,i);a=Fp(a),e.formatter.apply(t,o,a),r.moveToBookmark(n)}else{let i=n?mb(n):null;n&&(null==i?void 0:i.data)===hb||(d=e.getDoc(),u=pb(!0).dom,n=d.importNode(u,!0),i=n.firstChild,s.insertNode(n),a=1,wb(e,n)),e.formatter.apply(t,o,n),r.setCursorLocation(i,a)}var d,u})(e,t,o):(l.setRng(jv(l.getRng())),lm(e,()=>{rm(e,(e,t)=>{const o=t?e:Zm(a,e,r);h(a,o,!1)})},I),e.nodeChanged()),Ob(e.formatter,t).each(t=>{W((e=>Y((e=>{const t=e.getSelectedBlocks(),o=e.getRng();if(e.isCollapsed())return[];if(1===t.length)return Ab(o,t[0])&&Mb(o,t[0])?t:[];{const e=ce(t).filter(e=>Ab(o,e)).toArray(),n=de(t).filter(e=>Mb(o,e)).toArray(),r=t.slice(1,-1);return e.concat(r).concat(n)}})(e),Bb(e.dom)))(e.selection),e=>sy(a,e,t,o))});((e,t)=>{Se(Sb,e)&&W(Sb[e],e=>{e(t)})})(t,e)}uc(e,t,n,o)},ly=(e,t,o,n)=>{(n||e.selection.isEditable())&&ay(e,t,o,n)},cy=e=>Se(e,"vars"),dy=e=>e.selection.getStart(),uy=(e,t,o,n,r)=>J(t,t=>{const i=e.formatter.matchNode(t,o,null!=r?r:{},n);return!y(i)},t=>!!sb(e,t,o)||!n&&_(e.formatter.matchNode(t,o,r,!0))),hy=(e,t)=>{const o=null!=t?t:dy(e);return Y(wm(e.dom,o),e=>Wr(e)&&!Kr(e))},my=(e,t,o)=>{const n=hy(e,t);fe(o,(o,r)=>{const i=o=>{const i=uy(e,n,r,o.similar,cy(o)?o.vars:void 0),s=i.isSome();if(o.state.get()!==s){o.state.set(s);const e=i.getOr(t);cy(o)?o.callback(s,{node:e,format:r,parents:n}):W(o.callbacks,t=>t(s,{node:e,format:r,parents:n}))}};W([o.withSimilar,o.withoutSimilar],i),W(o.withVars,i)})},py=ao.explode,gy=()=>{const e={};return{addFilter:(t,o)=>{W(py(t),t=>{Se(e,t)||(e[t]={name:t,callbacks:[]}),e[t].callbacks.push(o)})},getFilters:()=>Ce(e),removeFilter:(t,o)=>{W(py(t),t=>{if(Se(e,t))if(_(o)){const n=e[t],r=Y(n.callbacks,e=>e!==o);r.length>0?n.callbacks=r:delete e[t]}else delete e[t]})}}},fy=e=>e.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),vy=(e,t,o)=>{var n;const r=Fs();t.convert_fonts_to_spans&&((e,t,o)=>{e.addNodeFilter("font",e=>{W(e,e=>{const n=t.parse(e.attr("style")),r=e.attr("color"),i=e.attr("face"),s=e.attr("size");r&&(n.color=r),i&&(n["font-family"]=i),s&&nt(s).each(e=>{n["font-size"]=o[e-1]}),e.name="span",e.attr("style",t.serialize(n)),(e=>{W(["color","face","size"],t=>{e.attr(t,null)})})(e)})})})(e,r,ao.explode(null!==(n=t.font_size_legacy_values)&&void 0!==n?n:"")),((e,t,o)=>{e.addNodeFilter("strike",e=>{const n="html4"!==t.type;W(e,e=>{if(n)e.name="s";else{const t=o.parse(e.attr("style"));t["text-decoration"]="line-through",e.name="span",e.attr("style",o.serialize(t))}})})})(e,o,r)},by=e=>{const[t,...o]=e.split(","),n=o.join(","),r=/data:([^/]+\/[^;]+)(;.+)?/.exec(t);if(r){const e=";base64"===r[2],t=(e=>{try{return decodeURIComponent(e)}catch(t){return e}})(n),o=e?(e=>{const t=/([a-z0-9+\/=\s]+)/i.exec(e);return t?t[1]:""})(t):t;return L.some({type:r[1],data:o,base64Encoded:e})}return L.none()},yy=(e,t,o=!0)=>{let n=t;if(o)try{n=atob(t)}catch(e){return L.none()}const r=new Uint8Array(n.length);for(let e=0;e<r.length;e++)r[e]=n.charCodeAt(e);return L.some(new Blob([r],{type:e}))},wy=e=>new Promise((t,o)=>{const n=new FileReader;n.onloadend=()=>{t(n.result)},n.onerror=()=>{var e;o(null===(e=n.error)||void 0===e?void 0:e.message)},n.readAsDataURL(e)});let _y=0;const xy=(e,t,o)=>by(e).bind(({data:e,type:n,base64Encoded:r})=>{if(t&&!r)return L.none();{const t=r?e:btoa(e);return o(t,n)}}),Cy=(e,t,o)=>{const n=e.create("blobid"+_y++,t,o);return e.add(n),n},ky=(e,t,o=!1)=>xy(t,o,(t,o)=>L.from(e.getByData(t,o)).orThunk(()=>yy(o,t).map(o=>Cy(e,o,t)))),Sy=/^(?:(?:(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)([A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*))(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+)?)?)$/,Ty=e=>L.from(e.match(Sy)).bind(e=>le(e,1)).map(e=>Ye(e,"www.")?e.substring(4):e),Ey=(e,t)=>{L.from(e.attr("src")).bind(Ty).forall(e=>!Z(t,e))&&e.attr("sandbox","")},Oy=(e,t)=>Ye(e,`${t}/`),{entries:Ay,setPrototypeOf:My,isFrozen:By,getPrototypeOf:Ry,getOwnPropertyDescriptor:Ny}=Object;let{freeze:Vy,seal:Dy,create:Py}=Object,{apply:Iy,construct:Ly}="undefined"!=typeof Reflect&&Reflect;Vy||(Vy=function(e){return e}),Dy||(Dy=function(e){return e}),Iy||(Iy=function(e,t,o){return e.apply(t,o)}),Ly||(Ly=function(e,t){return new e(...t)});const Fy=ew(Array.prototype.forEach),zy=ew(Array.prototype.lastIndexOf),Hy=ew(Array.prototype.pop),Uy=ew(Array.prototype.push),Zy=ew(Array.prototype.splice),$y=ew(String.prototype.toLowerCase),jy=ew(String.prototype.toString),Wy=ew(String.prototype.match),qy=ew(String.prototype.replace),Gy=ew(String.prototype.indexOf),Yy=ew(String.prototype.trim),Xy=ew(Object.prototype.hasOwnProperty),Ky=ew(RegExp.prototype.test),Jy=(Qy=TypeError,function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];return Ly(Qy,t)});var Qy;function ew(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var o=arguments.length,n=new Array(o>1?o-1:0),r=1;r<o;r++)n[r-1]=arguments[r];return Iy(e,t,n)}}function tw(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$y;My&&My(e,null);let n=t.length;for(;n--;){let r=t[n];if("string"==typeof r){const e=o(r);e!==r&&(By(t)||(t[n]=e),r=e)}e[r]=!0}return e}function ow(e){for(let t=0;t<e.length;t++)Xy(e,t)||(e[t]=null);return e}function nw(e){const t=Py(null);for(const[o,n]of Ay(e))Xy(e,o)&&(Array.isArray(n)?t[o]=ow(n):n&&"object"==typeof n&&n.constructor===Object?t[o]=nw(n):t[o]=n);return t}function rw(e,t){for(;null!==e;){const o=Ny(e,t);if(o){if(o.get)return ew(o.get);if("function"==typeof o.value)return ew(o.value)}e=Ry(e)}return function(){return null}}const iw=Vy(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),sw=Vy(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),aw=Vy(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),lw=Vy(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),cw=Vy(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),dw=Vy(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),uw=Vy(["#text"]),hw=Vy(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),mw=Vy(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),pw=Vy(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),gw=Vy(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fw=Dy(/\{\{[\w\W]*|[\w\W]*\}\}/gm),vw=Dy(/<%[\w\W]*|[\w\W]*%>/gm),bw=Dy(/\$\{[\w\W]*/gm),yw=Dy(/^data-[\-\w.\u00B7-\uFFFF]+$/),ww=Dy(/^aria-[\-\w]+$/),_w=Dy(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),xw=Dy(/^(?:\w+script|data):/i),Cw=Dy(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kw=Dy(/^html$/i),Sw=Dy(/^[a-z][.\w]*(-[.\w]+)+$/i);var Tw=Object.freeze({__proto__:null,ARIA_ATTR:ww,ATTR_WHITESPACE:Cw,CUSTOM_ELEMENT:Sw,DATA_ATTR:yw,DOCTYPE_NAME:kw,ERB_EXPR:vw,IS_ALLOWED_URI:_w,IS_SCRIPT_OR_DATA:xw,MUSTACHE_EXPR:fw,TMPLIT_EXPR:bw});const Ew=function(){return"undefined"==typeof window?null:window};var Ow=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ew();const o=t=>e(t);if(o.version="3.2.6",o.removed=[],!t||!t.document||9!==t.document.nodeType||!t.Element)return o.isSupported=!1,o;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:a,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:h,DOMParser:m,trustedTypes:p}=t,g=c.prototype,f=rw(g,"cloneNode"),v=rw(g,"remove"),b=rw(g,"nextSibling"),y=rw(g,"childNodes"),w=rw(g,"parentNode");if("function"==typeof a){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let _,x="";const{implementation:C,createNodeIterator:k,createDocumentFragment:S,getElementsByTagName:T}=n,{importNode:E}=r;let O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};o.isSupported="function"==typeof Ay&&"function"==typeof w&&C&&void 0!==C.createHTMLDocument;const{MUSTACHE_EXPR:A,ERB_EXPR:M,TMPLIT_EXPR:B,DATA_ATTR:R,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:V,ATTR_WHITESPACE:D,CUSTOM_ELEMENT:P}=Tw;let{IS_ALLOWED_URI:I}=Tw,L=null;const F=tw({},[...iw,...sw,...aw,...cw,...uw]);let z=null;const H=tw({},[...hw,...mw,...pw,...gw]);let U=Object.seal(Py(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Z=null,$=null,j=!0,W=!0,q=!1,G=!0,Y=!1,X=!0,K=!1,J=!1,Q=!1,ee=!1,te=!1,oe=!1,ne=!0,re=!1,ie=!0,se=!1,ae={},le=null;const ce=tw({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let de=null;const ue=tw({},["audio","video","img","source","image","track"]);let he=null;const me=tw({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pe="http://www.w3.org/1998/Math/MathML",ge="http://www.w3.org/2000/svg",fe="http://www.w3.org/1999/xhtml";let ve=fe,be=!1,ye=null;const we=tw({},[pe,ge,fe],jy);let _e=tw({},["mi","mo","mn","ms","mtext"]),xe=tw({},["annotation-xml"]);const Ce=tw({},["title","style","font","a","script"]);let ke=null;const Se=["application/xhtml+xml","text/html"];let Te=null,Ee=null;const Oe=n.createElement("form"),Ae=function(e){return e instanceof RegExp||e instanceof Function},Me=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Ee||Ee!==e){if(e&&"object"==typeof e||(e={}),e=nw(e),ke=-1===Se.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,Te="application/xhtml+xml"===ke?jy:$y,L=Xy(e,"ALLOWED_TAGS")?tw({},e.ALLOWED_TAGS,Te):F,z=Xy(e,"ALLOWED_ATTR")?tw({},e.ALLOWED_ATTR,Te):H,ye=Xy(e,"ALLOWED_NAMESPACES")?tw({},e.ALLOWED_NAMESPACES,jy):we,he=Xy(e,"ADD_URI_SAFE_ATTR")?tw(nw(me),e.ADD_URI_SAFE_ATTR,Te):me,de=Xy(e,"ADD_DATA_URI_TAGS")?tw(nw(ue),e.ADD_DATA_URI_TAGS,Te):ue,le=Xy(e,"FORBID_CONTENTS")?tw({},e.FORBID_CONTENTS,Te):ce,Z=Xy(e,"FORBID_TAGS")?tw({},e.FORBID_TAGS,Te):nw({}),$=Xy(e,"FORBID_ATTR")?tw({},e.FORBID_ATTR,Te):nw({}),ae=!!Xy(e,"USE_PROFILES")&&e.USE_PROFILES,j=!1!==e.ALLOW_ARIA_ATTR,W=!1!==e.ALLOW_DATA_ATTR,q=e.ALLOW_UNKNOWN_PROTOCOLS||!1,G=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Y=e.SAFE_FOR_TEMPLATES||!1,X=!1!==e.SAFE_FOR_XML,K=e.WHOLE_DOCUMENT||!1,ee=e.RETURN_DOM||!1,te=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,Q=e.FORCE_BODY||!1,ne=!1!==e.SANITIZE_DOM,re=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,se=e.IN_PLACE||!1,I=e.ALLOWED_URI_REGEXP||_w,ve=e.NAMESPACE||fe,_e=e.MATHML_TEXT_INTEGRATION_POINTS||_e,xe=e.HTML_INTEGRATION_POINTS||xe,U=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(U.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ae(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(U.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(U.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Y&&(W=!1),te&&(ee=!0),ae&&(L=tw({},uw),z=[],!0===ae.html&&(tw(L,iw),tw(z,hw)),!0===ae.svg&&(tw(L,sw),tw(z,mw),tw(z,gw)),!0===ae.svgFilters&&(tw(L,aw),tw(z,mw),tw(z,gw)),!0===ae.mathMl&&(tw(L,cw),tw(z,pw),tw(z,gw))),e.ADD_TAGS&&(L===F&&(L=nw(L)),tw(L,e.ADD_TAGS,Te)),e.ADD_ATTR&&(z===H&&(z=nw(z)),tw(z,e.ADD_ATTR,Te)),e.ADD_URI_SAFE_ATTR&&tw(he,e.ADD_URI_SAFE_ATTR,Te),e.FORBID_CONTENTS&&(le===ce&&(le=nw(le)),tw(le,e.FORBID_CONTENTS,Te)),ie&&(L["#text"]=!0),K&&tw(L,["html","head","body"]),L.table&&(tw(L,["tbody"]),delete Z.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw Jy('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw Jy('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=e.TRUSTED_TYPES_POLICY,x=_.createHTML("")}else void 0===_&&(_=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let o=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(o=t.getAttribute(n));const r="dompurify"+(o?"#"+o:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(p,i)),null!==_&&"string"==typeof x&&(x=_.createHTML(""));Vy&&Vy(e),Ee=e}},Be=tw({},[...sw,...aw,...lw]),Re=tw({},[...cw,...dw]),Ne=function(e){Uy(o.removed,{element:e});try{w(e).removeChild(e)}catch(t){v(e)}},Ve=function(e,t){try{Uy(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){Uy(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(ee||te)try{Ne(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},De=function(e){let t=null,o=null;if(Q)e="<remove></remove>"+e;else{const t=Wy(e,/^[\r\n\t ]+/);o=t&&t[0]}"application/xhtml+xml"===ke&&ve===fe&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const r=_?_.createHTML(e):e;if(ve===fe)try{t=(new m).parseFromString(r,ke)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(ve,"template",null);try{t.documentElement.innerHTML=be?x:r}catch(e){}}const i=t.body||t.documentElement;return e&&o&&i.insertBefore(n.createTextNode(o),i.childNodes[0]||null),ve===fe?T.call(t,K?"html":"body")[0]:K?t.documentElement:i},Pe=function(e){return k.call(e.ownerDocument||e,e,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Ie=function(e){return e instanceof h&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof u)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},Le=function(e){return"function"==typeof l&&e instanceof l};function Fe(e,t,n){Fy(e,e=>{e.call(o,t,n,Ee)})}const ze=function(e){let t=null;if(Fe(O.beforeSanitizeElements,e,null),Ie(e))return Ne(e),!0;const n=Te(e.nodeName);if(Fe(O.uponSanitizeElement,e,{tagName:n,allowedTags:L}),X&&e.hasChildNodes()&&!Le(e.firstElementChild)&&Ky(/<[/\w!]/g,e.innerHTML)&&Ky(/<[/\w!]/g,e.textContent))return Ne(e),!0;if(7===e.nodeType)return Ne(e),!0;if(X&&8===e.nodeType&&Ky(/<[/\w]/g,e.data))return Ne(e),!0;if(!L[n]||Z[n]){if(!Z[n]&&Ue(n)){if(U.tagNameCheck instanceof RegExp&&Ky(U.tagNameCheck,n))return!1;if(U.tagNameCheck instanceof Function&&U.tagNameCheck(n))return!1}if(ie&&!le[n]){const t=w(e)||e.parentNode,o=y(e)||e.childNodes;if(o&&t)for(let n=o.length-1;n>=0;--n){const r=f(o[n],!0);r.__removalCount=(e.__removalCount||0)+1,t.insertBefore(r,b(e))}}return Ne(e),!0}return e instanceof c&&!function(e){let t=w(e);t&&t.tagName||(t={namespaceURI:ve,tagName:"template"});const o=$y(e.tagName),n=$y(t.tagName);return!!ye[e.namespaceURI]&&(e.namespaceURI===ge?t.namespaceURI===fe?"svg"===o:t.namespaceURI===pe?"svg"===o&&("annotation-xml"===n||_e[n]):Boolean(Be[o]):e.namespaceURI===pe?t.namespaceURI===fe?"math"===o:t.namespaceURI===ge?"math"===o&&xe[n]:Boolean(Re[o]):e.namespaceURI===fe?!(t.namespaceURI===ge&&!xe[n])&&!(t.namespaceURI===pe&&!_e[n])&&!Re[o]&&(Ce[o]||!Be[o]):!("application/xhtml+xml"!==ke||!ye[e.namespaceURI]))}(e)?(Ne(e),!0):"noscript"!==n&&"noembed"!==n&&"noframes"!==n||!Ky(/<\/no(script|embed|frames)/i,e.innerHTML)?(Y&&3===e.nodeType&&(t=e.textContent,Fy([A,M,B],e=>{t=qy(t,e," ")}),e.textContent!==t&&(Uy(o.removed,{element:e.cloneNode()}),e.textContent=t)),Fe(O.afterSanitizeElements,e,null),!1):(Ne(e),!0)},He=function(e,t,o){if(ne&&("id"===t||"name"===t)&&(o in n||o in Oe))return!1;if(W&&!$[t]&&Ky(R,t));else if(j&&Ky(N,t));else if(!z[t]||$[t]){if(!(Ue(e)&&(U.tagNameCheck instanceof RegExp&&Ky(U.tagNameCheck,e)||U.tagNameCheck instanceof Function&&U.tagNameCheck(e))&&(U.attributeNameCheck instanceof RegExp&&Ky(U.attributeNameCheck,t)||U.attributeNameCheck instanceof Function&&U.attributeNameCheck(t))||"is"===t&&U.allowCustomizedBuiltInElements&&(U.tagNameCheck instanceof RegExp&&Ky(U.tagNameCheck,o)||U.tagNameCheck instanceof Function&&U.tagNameCheck(o))))return!1}else if(he[t]);else if(Ky(I,qy(o,D,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==Gy(o,"data:")||!de[e])if(q&&!Ky(V,qy(o,D,"")));else if(o)return!1;return!0},Ue=function(e){return"annotation-xml"!==e&&Wy(e,P)},Ze=function(e){Fe(O.beforeSanitizeAttributes,e,null);const{attributes:t}=e;if(!t||Ie(e))return;const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:z,forceKeepAttr:void 0};let r=t.length;for(;r--;){const i=t[r],{name:s,namespaceURI:a,value:l}=i,c=Te(s),d=l;let u="value"===s?d:Yy(d);if(n.attrName=c,n.attrValue=u,n.keepAttr=!0,n.forceKeepAttr=void 0,Fe(O.uponSanitizeAttribute,e,n),u=n.attrValue,!re||"id"!==c&&"name"!==c||(Ve(s,e),u="user-content-"+u),X&&Ky(/((--!?|])>)|<\/(style|title)/i,u)){Ve(s,e);continue}if(n.forceKeepAttr)continue;if(!n.keepAttr){Ve(s,e);continue}if(!G&&Ky(/\/>/i,u)){Ve(s,e);continue}Y&&Fy([A,M,B],e=>{u=qy(u,e," ")});const h=Te(e.nodeName);if(He(h,c,u)){if(_&&"object"==typeof p&&"function"==typeof p.getAttributeType)if(a);else switch(p.getAttributeType(h,c)){case"TrustedHTML":u=_.createHTML(u);break;case"TrustedScriptURL":u=_.createScriptURL(u)}if(u!==d)try{a?e.setAttributeNS(a,s,u):e.setAttribute(s,u),Ie(e)?Ne(e):Hy(o.removed)}catch(t){Ve(s,e)}}else Ve(s,e)}Fe(O.afterSanitizeAttributes,e,null)},$e=function e(t){let o=null;const n=Pe(t);for(Fe(O.beforeSanitizeShadowDOM,t,null);o=n.nextNode();)Fe(O.uponSanitizeShadowNode,o,null),ze(o),Ze(o),o.content instanceof s&&e(o.content);Fe(O.afterSanitizeShadowDOM,t,null)};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,i=null,a=null,c=null;if(be=!e,be&&(e="\x3c!--\x3e"),"string"!=typeof e&&!Le(e)){if("function"!=typeof e.toString)throw Jy("toString is not a function");if("string"!=typeof(e=e.toString()))throw Jy("dirty is not a string, aborting")}if(!o.isSupported)return e;if(J||Me(t),o.removed=[],"string"==typeof e&&(se=!1),se){if(e.nodeName){const t=Te(e.nodeName);if(!L[t]||Z[t])throw Jy("root node is forbidden and cannot be sanitized in-place")}}else if(e instanceof l)n=De("\x3c!----\x3e"),i=n.ownerDocument.importNode(e,!0),1===i.nodeType&&"BODY"===i.nodeName||"HTML"===i.nodeName?n=i:n.appendChild(i);else{if(!ee&&!Y&&!K&&-1===e.indexOf("<"))return _&&oe?_.createHTML(e):e;if(n=De(e),!n)return ee?null:oe?x:""}n&&Q&&Ne(n.firstChild);const d=Pe(se?e:n);for(;a=d.nextNode();)ze(a),Ze(a),a.content instanceof s&&$e(a.content);if(se)return e;if(ee){if(te)for(c=S.call(n.ownerDocument);n.firstChild;)c.appendChild(n.firstChild);else c=n;return(z.shadowroot||z.shadowrootmode)&&(c=E.call(r,c,!0)),c}let u=K?n.outerHTML:n.innerHTML;return K&&L["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&Ky(kw,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),Y&&Fy([A,M,B],e=>{u=qy(u,e," ")}),_&&oe?_.createHTML(u):u},o.setConfig=function(){Me(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),J=!0},o.clearConfig=function(){Ee=null,J=!1},o.isValidAttribute=function(e,t,o){Ee||Me({});const n=Te(e),r=Te(t);return He(n,r,o)},o.addHook=function(e,t){"function"==typeof t&&Uy(O[e],t)},o.removeHook=function(e,t){if(void 0!==t){const o=zy(O[e],t);return-1===o?void 0:Zy(O[e],o,1)[0]}return Hy(O[e])},o.removeHooks=function(e){O[e]=[]},o.removeAllHooks=function(){O={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();const Aw=ao.each,Mw=ao.trim,Bw=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Rw={ftp:21,http:80,https:443,mailto:25},Nw=["img","video"],Vw=(e,t,o)=>{const n=(e=>{try{return decodeURIComponent(e)}catch(t){return unescape(e)}})(t).replace(/\s/g,"");return!e.allow_script_urls&&(!!/((java|vb)script|mhtml):/i.test(n)||!e.allow_html_data_urls&&(/^data:image\//i.test(n)?((e,t)=>_(e)?!e:!_(t)||!Z(Nw,t))(e.allow_svg_data_urls,o)&&/^data:image\/svg\+xml/i.test(n):/^data:/i.test(n)))};class Dw{static parseDataUri(e){let t;const o=decodeURIComponent(e).split(","),n=/data:([^;]+)/.exec(o[0]);return n&&(t=n[1]),{type:t,data:o[1]}}static isDomSafe(e,t,o={}){if(o.allow_script_urls)return!0;{const n=hs.decode(e).replace(/[\s\u0000-\u001F]+/g,"");return!Vw(o,n,t)}}static getDocumentBaseUrl(e){var t;let o;return o=0!==e.protocol.indexOf("http")&&"file:"!==e.protocol?null!==(t=e.href)&&void 0!==t?t:"":e.protocol+"//"+e.host+e.pathname,/^[^:]+:\/\/\/?[^\/]+\//.test(o)&&(o=o.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(o)||(o+="/")),o}constructor(e,t={}){this.path="",this.directory="",e=Mw(e),this.settings=t;const o=t.base_uri,n=this;if(/^([\w\-]+):([^\/]{2})/i.test(e)||/^\s*#/.test(e))return void(n.source=e);const r=0===e.indexOf("//");if(0!==e.indexOf("/")||r||(e=(o&&o.protocol||"http")+"://mce_host"+e),!/^[\w\-]*:?\/\//.test(e)){const t=o?o.path:new Dw(document.location.href).directory;if(""===(null==o?void 0:o.protocol))e="//mce_host"+n.toAbsPath(t,e);else{const r=/([^#?]*)([#?]?.*)/.exec(e);r&&(e=(o&&o.protocol||"http")+"://mce_host"+n.toAbsPath(t,r[1])+r[2])}}e=e.replace(/@@/g,"(mce_at)");const i=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@\/]*):?([^:@\/]*))?@)?(\[[a-zA-Z0-9:.%]+\]|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(e);i&&Aw(Bw,(e,t)=>{let o=i[t];o&&(o=o.replace(/\(mce_at\)/g,"@@")),n[e]=o}),o&&(n.protocol||(n.protocol=o.protocol),n.userInfo||(n.userInfo=o.userInfo),n.port||"mce_host"!==n.host||(n.port=o.port),n.host&&"mce_host"!==n.host||(n.host=o.host),n.source=""),r&&(n.protocol="")}setPath(e){const t=/^(.*?)\/?(\w+)?$/.exec(e);t&&(this.path=t[0],this.directory=t[1],this.file=t[2]),this.source="",this.getURI()}toRelative(e){if("./"===e)return e;const t=new Dw(e,{base_uri:this});if("mce_host"!==t.host&&this.host!==t.host&&t.host||this.port!==t.port||this.protocol!==t.protocol&&""!==t.protocol)return t.getURI();const o=this.getURI(),n=t.getURI();if(o===n||"/"===o.charAt(o.length-1)&&o.substr(0,o.length-1)===n)return o;let r=this.toRelPath(this.path,t.path);return t.query&&(r+="?"+t.query),t.anchor&&(r+="#"+t.anchor),r}toAbsolute(e,t){const o=new Dw(e,{base_uri:this});return o.getURI(t&&this.isSameOrigin(o))}isSameOrigin(e){if(this.host==e.host&&this.protocol==e.protocol){if(this.port==e.port)return!0;const t=this.protocol?Rw[this.protocol]:null;if(t&&(this.port||t)==(e.port||t))return!0}return!1}toRelPath(e,t){let o,n,r=0,i="";const s=e.substring(0,e.lastIndexOf("/")).split("/"),a=t.split("/");if(s.length>=a.length)for(o=0,n=s.length;o<n;o++)if(o>=a.length||s[o]!==a[o]){r=o+1;break}if(s.length<a.length)for(o=0,n=a.length;o<n;o++)if(o>=s.length||s[o]!==a[o]){r=o+1;break}if(1===r)return t;for(o=0,n=s.length-(r-1);o<n;o++)i+="../";for(o=r-1,n=a.length;o<n;o++)i+=o!==r-1?"/"+a[o]:a[o];return i}toAbsPath(e,t){let o=0;const n=/\/$/.test(t)?"/":"",r=e.split("/"),i=t.split("/"),s=[];Aw(r,e=>{e&&s.push(e)});const a=[];for(let e=i.length-1;e>=0;e--)0!==i[e].length&&"."!==i[e]&&(".."!==i[e]?o>0?o--:a.push(i[e]):o++);const l=s.length-o;let c;return c=l<=0?re(a).join("/"):s.slice(0,l).join("/")+"/"+re(a).join("/"),0!==c.indexOf("/")&&(c="/"+c),n&&c.lastIndexOf("/")!==c.length-1&&(c+=n),c}getURI(e=!1){let t;return this.source&&!e||(t="",e||(this.protocol?t+=this.protocol+"://":t+="//",this.userInfo&&(t+=this.userInfo+"@"),this.host&&(t+=this.host),this.port&&(t+=":"+this.port)),this.path&&(t+=this.path),this.query&&(t+="?"+this.query),this.anchor&&(t+="#"+this.anchor),this.source=t),this.source}}const Pw=ao.makeMap("src,href,data,background,action,formaction,poster,xlink:href"),Iw="data-mce-type";let Lw=0;const Fw=(e,t,o,n,r)=>{var i,s,a,l;const c=t.validate,d=o.getSpecialElements();8===e.nodeType&&(!t.allow_conditional_comments&&/^\[if/i.test(null!==(i=e.nodeValue)&&void 0!==i?i:"")&&(e.nodeValue=" "+e.nodeValue),t.sanitize&&t.allow_html_in_comments&&m(e.nodeValue)&&(e.nodeValue=(e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))(e.nodeValue)));const u=null!==(s=null==r?void 0:r.tagName)&&void 0!==s?s:e.nodeName.toLowerCase();if("html"!==n&&o.isValid(n))return void(_(r)&&(r.allowedTags[u]=!0));if(1!==e.nodeType||"body"===u)return;const h=mo(e),p=yn(h,Iw),g=vn(h,"data-mce-bogus");if(!p&&m(g))return void("all"===g?Cn(h):kn(h));const f=o.getElementRule(u);if(!c||f){if(_(r)&&(r.allowedTags[u]=!0),c&&f&&!p){if(W(null!==(a=f.attributesForced)&&void 0!==a?a:[],e=>{gn(h,e.name,"{$uid}"===e.value?"mce_"+Lw++:e.value)}),W(null!==(l=f.attributesDefault)&&void 0!==l?l:[],e=>{yn(h,e.name)||gn(h,e.name,"{$uid}"===e.value?"mce_"+Lw++:e.value)}),f.attributesRequired&&!$(f.attributesRequired,e=>yn(h,e)))return void kn(h);if(f.removeEmptyAttrs&&(e=>{const t=e.dom.attributes;return null==t||0===t.length})(h))return void kn(h);f.outputName&&f.outputName!==u&&((e,t)=>{const o=((e,t)=>{const o=uo(t),n=_n(e);return fn(o,n),o})(e,t);cn(e,o);const n=Zo(e);mn(o,n),Cn(e)})(h,f.outputName)}}else Se(d,u)?Cn(h):kn(h)},zw=(e,t,o,n,r,i)=>"html"!==o&&!Ei(n)||!(r in Pw&&Vw(e,i,n))&&(!e.validate||t.isValid(n,r)||Ye(r,"data-")||Ye(r,"aria-")),Hw=(e,t)=>e.hasAttribute(Iw)&&("id"===t||"class"===t||"style"===t),Uw=(e,t)=>e in t.getBoolAttrs(),Zw=(e,t,o,n)=>{const{attributes:r}=e;for(let i=r.length-1;i>=0;i--){const s=r[i],a=s.name,l=s.value;zw(t,o,n,e.tagName.toLowerCase(),a,l)||Hw(e,a)?Uw(a,o)&&e.setAttribute(a,a):e.removeAttribute(a)}},$w=(e,t,o)=>{const n=Ow();return n.addHook("uponSanitizeElement",(n,r)=>{Fw(n,e,t,o.track(n),r)}),n.addHook("uponSanitizeAttribute",(n,r)=>{((e,t,o,n,r)=>{const i=e.tagName.toLowerCase(),{attrName:s,attrValue:a}=r;r.keepAttr=zw(t,o,n,i,s,a),r.keepAttr?(r.allowedAttributes[s]=!0,Uw(s,o)&&(r.attrValue=s),t.allow_svg_data_urls&&Ye(a,"data:image/svg+xml")&&(r.forceKeepAttr=!0)):Hw(e,s)&&(r.forceKeepAttr=!0)})(n,e,t,o.current(),r)}),n},jw=(e,t)=>{const o=Ow(),n=t.allow_mathml_annotation_encodings,r=f(n)&&n.length>0;o.addHook("uponSanitizeElement",(e,o)=>{var i;const s=null!==(i=o.tagName)&&void 0!==i?i:e.nodeName.toLowerCase();((e,o)=>r&&"semantics"===o?L.some(!0):"annotation"===o?L.some(Wr(e)&&(e=>{const t=e.getAttribute("encoding");return r&&m(t)&&Z(n,t)})(e)):f(t.extended_mathml_elements)&&t.extended_mathml_elements.includes(o)?L.from(!0):L.none())(e,s).each(n=>{o.allowedTags[s]=n,!n&&t.sanitize&&Wr(e)&&e.remove()})}),o.addHook("uponSanitizeAttribute",(e,o)=>{f(t.extended_mathml_attributes)&&t.extended_mathml_attributes.includes(o.attrName)&&(o.forceKeepAttr=!0)}),o.sanitize(e,{IN_PLACE:!0,USE_PROFILES:{mathMl:!0}})},Ww=e=>t=>{const o=Ai(t);if("svg"===o)(e=>{const t=["type","href","role","arcrole","title","show","actuate","label","from","to"].map(e=>`xlink:${e}`),o={IN_PLACE:!0,USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},ALLOWED_ATTR:t};Ow().sanitize(e,o)})(t);else{if("math"!==o)throw new Error("Not a namespace element");jw(t,e)}},qw=ao.makeMap,Gw=ao.extend,Yw=(e,t,o,n,r)=>{const i=e.name,s=i in o&&"title"!==i&&"textarea"!==i&&"noscript"!==i,a=t.childNodes;for(let t=0,i=a.length;t<i;t++){const i=a[t],l=new mg(i.nodeName.toLowerCase(),i.nodeType);if(Wr(i)){const e=i.attributes;for(let t=0,o=e.length;t<o;t++){const o=e[t];l.attr(o.name,o.value)}Ei(l.name)&&(n(i),l.value=i.innerHTML)}else ti(i)?(l.value=i.data,s&&(l.raw=!0)):ri(i)?l.value=r?fy(i.data):i.data:(oi(i)||ni(i))&&(l.value=i.data);Ei(l.name)||Yw(l,i,o,n,r),e.append(l)}},Xw=(e={},t=As())=>{const o=gy(),n=gy(),r={validate:!0,root_name:"body",sanitize:!0,allow_html_in_comments:!0,...e},i=new DOMParser,s=((e,t)=>{const o=(()=>{const e=je(),t=()=>e.get().map(Ai).getOr("html");return{track:o=>(Oi(o)?e.set(o):e.get().exists(e=>!e.contains(o))&&e.clear(),t()),current:t,reset:()=>{e.clear()}}})();if(e.sanitize){const n=$w(e,t,o),r=(t,r)=>{n.sanitize(t,((e,t)=>{const o={IN_PLACE:!0,ALLOW_UNKNOWN_PROTOCOLS:!0,ALLOWED_TAGS:["#comment","#cdata-section","body"],ALLOWED_ATTR:[]};return o.PARSER_MEDIA_TYPE=t,e.allow_script_urls?o.ALLOWED_URI_REGEXP=/.*/:e.allow_html_data_urls&&(o.ALLOWED_URI_REGEXP=/^(?!(\w+script|mhtml):)/i),o})(e,r)),n.removed=[],o.reset()};return{sanitizeHtmlElement:r,sanitizeNamespaceElement:Ww(e)}}return{sanitizeHtmlElement:(n,r)=>{const i=document.createNodeIterator(n,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let s;for(;s=i.nextNode();){const n=o.track(s);Fw(s,e,t,n),Wr(s)&&Zw(s,e,t,n)}o.reset()},sanitizeNamespaceElement:S}})(r,t),a=o.addFilter,l=o.getFilters,c=o.removeFilter,d=n.addFilter,u=n.getFilters,h=n.removeFilter,p=(e,o)=>{const n=m(o.attr(Iw)),r=1===o.type&&!Se(e,o.name)&&!$i(t,o)&&!Ei(o.name);return 3===o.type||r&&!n},g={schema:t,addAttributeFilter:d,getAttributeFilters:u,removeAttributeFilter:h,addNodeFilter:a,getNodeFilters:l,removeNodeFilter:c,parse:(e,o={})=>{var n;const a=r.validate,c=null!==(n=o.context)&&void 0!==n?n:r.root_name,d=((e,o,n="html")=>{const r="xhtml"===n?"application/xhtml+xml":"text/html",a=Se(t.getSpecialElements(),o.toLowerCase()),l=a?`<${o}>${e}</${o}>`:e,c=i.parseFromString("xhtml"===n?`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>${l}</body></html>`:/^[\s]*<head/i.test(e)||/^[\s]*<html/i.test(e)||/^[\s]*<!DOCTYPE/i.test(e)?`<html>${l}</html>`:`<body>${l}</body>`,r).body;return s.sanitizeHtmlElement(c,r),a?c.firstChild:c})(e,c,o.format);Ii(t,d);const h=new mg(c,11);Yw(h,d,t.getSpecialElements(),s.sanitizeNamespaceElement,r.sanitize&&r.allow_html_in_comments),d.innerHTML="";const[m,g]=((e,t,o,n)=>{const r=o.validate,i=t.getNonEmptyElements(),s=t.getWhitespaceElements(),a=Gw(qw("script,style,head,html,body,title,meta,param"),t.getBlockElements()),l=Es(t),c=/[ \t\r\n]+/g,d=/^[ \t\r\n]+/,u=/[ \t\r\n]+$/,h=e=>{let t=e.parent;for(;_(t);){if(t.name in s)return!0;t=t.parent}return!1},m=o=>o.name in a||$i(t,o)||Ei(o.name)&&o.parent===e,p=(t,o)=>{const r=o?t.prev:t.next;return!_(r)&&!w(t.parent)&&m(t.parent)&&(t.parent!==e||!0===n.isRootContent)};return[e=>{var t;if(3===e.type&&!h(e)){let o=null!==(t=e.value)&&void 0!==t?t:"";o=o.replace(c," "),(((e,t)=>_(e)&&(t(e)||"br"===e.name))(e.prev,m)||p(e,!0))&&(o=o.replace(d,"")),0===o.length||" "===o&&e.prev&&8===e.prev.type&&e.next&&8===e.next.type?e.remove():e.value=o}},e=>{var a;if(1===e.type){const a=t.getElementRule(e.name);if(r&&a){const r=zv(t,i,s,e);a.paddInEmptyBlock&&r&&(e=>{let o=e;for(;_(o);){if(o.name in l)return zv(t,i,s,o);o=o.parent}return!1})(e)?Lv(o,n,m,e):a.removeEmpty&&r?m(e)?e.remove():e.unwrap():a.paddEmpty&&(r||(e=>{var t;return Fv(e,"#text")&&(null===(t=null==e?void 0:e.firstChild)||void 0===t?void 0:t.value)===lt})(e))&&Lv(o,n,m,e)}}else if(3===e.type&&!h(e)){let t=null!==(a=e.value)&&void 0!==a?a:"";(e.next&&m(e.next)||p(e,!1))&&(t=t.replace(u,"")),0===t.length?e.remove():e.value=t}}]})(h,t,r,o),f=[],v=a?e=>((e,o)=>{$v(t,e)&&o.push(e)})(e,f):S,b={nodes:{},attributes:{}},y=e=>Dv(l(),u(),e,b);if(((e,t,o)=>{const n=[];for(let o=e,r=o;o;r=o,o=o.walk()){const i=o;W(t,e=>e(i)),w(i.parent)&&i!==e?o=r:n.push(i)}for(let e=n.length-1;e>=0;e--){const t=n[e];W(o,e=>e(t))}})(h,[m,y],[g,v]),f.reverse(),a&&f.length>0)if(o.context){const{pass:e,fail:n}=G(f,e=>e.parent===h);Zv(n,t,h,y),o.invalid=e.length>0}else Zv(f,t,h,y);const x=((e,t)=>{var o;const n=null!==(o=t.forced_root_block)&&void 0!==o?o:e.forced_root_block;return!1===n?"":!0===n?"p":n})(r,o);return x&&("body"===h.name||o.isRootContent)&&((e,o)=>{const n=Gw(qw("script,style,head,html,body,title,meta,param"),t.getBlockElements()),i=/^[ \t\r\n]+/,s=/[ \t\r\n]+$/;let a=e.firstChild,l=null;const c=e=>{var t,o;e&&(a=e.firstChild,a&&3===a.type&&(a.value=null===(t=a.value)||void 0===t?void 0:t.replace(i,"")),a=e.lastChild,a&&3===a.type&&(a.value=null===(o=a.value)||void 0===o?void 0:o.replace(s,"")))};if(t.isValidChild(e.name,o.toLowerCase())){for(;a;){const t=a.next;p(n,a)?(l||(l=new mg(o,1),l.attr(r.forced_root_block_attrs),e.insert(l,a)),l.append(a)):(c(l),l=null),a=t}c(l)}})(h,x),o.invalid||Pv(b,o),h}};return((e,t)=>{var o,n;const r=e.schema;e.addAttributeFilter("href",e=>{let o=e.length;const n=e=>{const t=e?ao.trim(e):"";return/\b(noopener)\b/g.test(t)?t:(e=>e.split(" ").filter(e=>e.length>0).concat(["noopener"]).sort().join(" "))(t)};if(!t.allow_unsafe_link_target)for(;o--;){const t=e[o];"a"===t.name&&"_blank"===t.attr("target")&&t.attr("rel",n(t.attr("rel")))}}),t.allow_html_in_named_anchor||e.addAttributeFilter("id,name",e=>{let t,o,n,r,i=e.length;for(;i--;)if(r=e[i],"a"===r.name&&r.firstChild&&!r.attr("href"))for(n=r.parent,t=r.lastChild;t&&n;)o=t.prev,n.insert(t,r),t=o}),t.fix_list_elements&&e.addNodeFilter("ul,ol",e=>{let t,o,n=e.length;for(;n--;)if(t=e[n],o=t.parent,o&&("ul"===o.name||"ol"===o.name))if(t.prev&&"li"===t.prev.name)t.prev.append(t);else{const e=new mg("li",1);e.attr("style","list-style-type: none"),t.wrap(e)}});const i=r.getValidClasses();t.validate&&i&&e.addAttributeFilter("class",e=>{var t;let o=e.length;for(;o--;){const n=e[o],r=null!==(t=n.attr("class"))&&void 0!==t?t:"",s=ao.explode(r," ");let a="";for(let e=0;e<s.length;e++){const t=s[e];let o=!1,r=i["*"];r&&r[t]&&(o=!0),r=i[n.name],!o&&r&&r[t]&&(o=!0),o&&(a&&(a+=" "),a+=t)}a.length||(a=null),n.attr("class",a)}}),((e,t)=>{const{blob_cache:o}=t;if(o){const t=e=>{const t=e.attr("src");(e=>e.attr("src")===no.transparentSrc||_(e.attr("data-mce-placeholder")))(e)||(e=>_(e.attr("data-mce-bogus")))(e)||w(t)||ky(o,t,!0).each(t=>{e.attr("src",t.blobUri())})};e.addAttributeFilter("src",e=>W(e,t))}})(e,t);const s=null!==(o=t.sandbox_iframes)&&void 0!==o&&o,a=me(null!==(n=t.sandbox_iframes_exclusions)&&void 0!==n?n:[]);t.convert_unsafe_embeds&&e.addNodeFilter("object,embed",e=>W(e,e=>{e.replace((({type:e,src:t,width:o,height:n}={},r,i)=>{const s=(e=>y(e)?"iframe":Oy(e,"image")?"img":Oy(e,"video")?"video":Oy(e,"audio")?"audio":"iframe")(e),a=new mg(s,1);return a.attr("audio"===s?{src:t}:{src:t,width:o,height:n}),"audio"!==s&&"video"!==s||a.attr("controls",""),"iframe"===s&&r&&Ey(a,i),a})({type:e.attr("type"),src:"object"===e.name?e.attr("data"):e.attr("src"),width:e.attr("width"),height:e.attr("height")},s,a))})),s&&e.addNodeFilter("iframe",e=>W(e,e=>Ey(e,a)))})(g,r),((e,t,o)=>{t.inline_styles&&vy(e,t,o)})(g,r,t),g},Kw=(e,t,o)=>{const n=(e=>nb(e)?Rg({validate:!1}).serialize(e):e)(e),r=t(n);if(r.isDefaultPrevented())return r;if(nb(e)){if(r.content!==n){const t=Xw({validate:!1,forced_root_block:!1,...o}).parse(r.content,{context:e.name});return{...r,content:t}}return{...r,content:e}}return r},Jw=e=>({sanitize:au(e),sandbox_iframes:mu(e),sandbox_iframes_exclusions:pu(e)}),Qw=(e,t)=>{if(t.no_events)return Be.value(t);{const o=((e,t)=>e.dispatch("BeforeGetContent",t))(e,t);return o.isDefaultPrevented()?Be.error(pc(e,{content:"",...o}).content):Be.value(o)}},e_=(e,t,o)=>{if(o.no_events)return t;{const n=Kw(t,t=>pc(e,{...o,content:t}),Jw(e));return n.content}},t_=(e,t)=>{if(t.no_events)return Be.value(t);{const o=Kw(t.content,o=>((e,t)=>e.dispatch("BeforeSetContent",t))(e,{...t,content:o}),Jw(e));return o.isDefaultPrevented()?(mc(e,o),Be.error(void 0)):Be.value(o)}},o_=(e,t,o)=>{o.no_events||mc(e,{...o,content:t})},n_=(e,t,o)=>({element:e,width:t,rows:o}),r_=(e,t)=>({element:e,cells:t}),i_=(e,t)=>({x:e,y:t}),s_=(e,t)=>bn(e,t).bind(nt).getOr(1),a_=(e,t,o)=>{const n=e.rows;return!!(n[o]?n[o].cells:[])[t]},l_=e=>K(e,(e,t)=>t.cells.length>e?t.cells.length:e,0),c_=(e,t)=>{const o=e.rows;for(let e=0;e<o.length;e++){const n=o[e].cells;for(let o=0;o<n.length;o++)if(_o(n[o],t))return L.some(i_(o,e))}return L.none()},d_=(e,t,o,n,r)=>{const i=[],s=e.rows;for(let e=o;e<=r;e++){const o=s[e].cells,r=t<n?o.slice(t,n+1):o.slice(n,t+1);i.push(r_(s[e].element,r))}return i},u_=e=>((e,t)=>{const o=Tn(e.element),n=uo("tbody");return mn(n,t),un(o,n),o})(e,(e=>j(e.rows,e=>{const t=j(e.cells,e=>{const t=En(e);return wn(t,"colspan"),wn(t,"rowspan"),t}),o=Tn(e.element);return mn(o,t),o}))(e)),h_=(e,t,o)=>{const n=mo(t.commonAncestorContainer),r=ef(n,e),i=Y(r,e=>o.isWrapper(ko(e))),s=((e,t)=>Q(e,e=>"li"===ko(e)&&tm(e,t)).fold(O([]),t=>(e=>Q(e,e=>"ul"===ko(e)||"ol"===ko(e)))(e).map(e=>{const t=uo(ko(e)),o=_e(Fn(e),(e,t)=>Ye(t,"list-style"));return Dn(t,o),[uo("li"),t]}).getOr([])))(r,t),a=i.concat(s.length?s:(e=>Aa(e)?Po(e).filter(Oa).fold(O([]),t=>[e,t]):Oa(e)?[e]:[])(n));return j(a,Tn)},m_=()=>Yn([]),p_=(e,t)=>((e,t)=>rr(t,"table",B(_o,e)))(e,t[0]).bind(e=>{const o=t[0],n=t[t.length-1],r=(e=>{const t=n_(Tn(e),0,[]);return W(yr(e,"tr"),(e,o)=>{W(yr(e,"td,th"),(n,r)=>{((e,t,o,n,r)=>{const i=s_(r,"rowspan"),s=s_(r,"colspan"),a=e.rows;for(let e=o;e<o+i;e++){a[e]||(a[e]=r_(En(n),[]));for(let n=t;n<t+s;n++)a[e].cells[n]=e===o&&n===t?r:Tn(r)}})(t,((e,t,o)=>{for(;a_(e,t,o);)t++;return t})(t,r,o),o,e,n)})}),n_(t.element,l_(t.rows),t.rows)})(e);return((e,t,o)=>c_(e,t).bind(t=>c_(e,o).map(o=>((e,t,o)=>{const n=t.x,r=t.y,i=o.x,s=o.y,a=r<s?d_(e,n,r,i,s):d_(e,n,s,i,r);return n_(e.element,l_(a),a)})(e,t,o))))(r,o,n).map(e=>Yn([u_(e)]))}).getOrThunk(m_),g_=(e,t,o)=>{const n=Xh(t,e);return n.length>0?p_(e,n):((e,t,o)=>t.length>0&&t[0].collapsed?m_():((e,t,o)=>((e,t)=>{const o=K(t,(e,t)=>(un(t,e),t),e);return t.length>0?Yn([o]):o})(mo(t.cloneContents()),h_(e,t,o)))(e,t[0],o))(e,t,o)},f_=(e,t)=>t>=0&&t<e.length&&qh(e.charAt(t)),v_=e=>Ia(e.innerText),b_=e=>Wr(e)?e.outerHTML:ti(e)?hs.encodeRaw(e.data,!1):ri(e)?"\x3c!--"+e.data+"--\x3e":"",y_=(e,t)=>(((e,t)=>{let o=0;W(e,e=>{0===e[0]?o++:1===e[0]?(((e,t,o)=>{const n=(e=>{let t;const o=document.createElement("div"),n=document.createDocumentFragment();for(e&&(o.innerHTML=e);t=o.firstChild;)n.appendChild(t);return n})(t);if(e.hasChildNodes()&&o<e.childNodes.length){const t=e.childNodes[o];e.insertBefore(n,t)}else e.appendChild(n)})(t,e[1],o),o++):2===e[0]&&((e,t)=>{if(e.hasChildNodes()&&t<e.childNodes.length){const o=e.childNodes[t];e.removeChild(o)}})(t,o)})})(((e,t)=>{const o=e.length+t.length+2,n=new Array(o),r=new Array(o),i=(o,n,r,s,l)=>{const c=a(o,n,r,s);if(null===c||c.start===n&&c.diag===n-s||c.end===o&&c.diag===o-r){let i=o,a=r;for(;i<n||a<s;)i<n&&a<s&&e[i]===t[a]?(l.push([0,e[i]]),++i,++a):n-o>s-r?(l.push([2,e[i]]),++i):(l.push([1,t[a]]),++a)}else{i(o,c.start,r,c.start-c.diag,l);for(let t=c.start;t<c.end;++t)l.push([0,e[t]]);i(c.end,n,c.end-c.diag,s,l)}},s=(o,n,r,i)=>{let s=o;for(;s-n<i&&s<r&&e[s]===t[s-n];)++s;return((e,t,o)=>({start:e,end:t,diag:o}))(o,s,n)},a=(o,i,a,l)=>{const c=i-o,d=l-a;if(0===c||0===d)return null;const u=c-d,h=d+c,m=(h%2==0?h:h+1)/2;let p,g,f,v,b;for(n[1+m]=o,r[1+m]=i+1,p=0;p<=m;++p){for(g=-p;g<=p;g+=2){for(f=g+m,g===-p||g!==p&&n[f-1]<n[f+1]?n[f]=n[f+1]:n[f]=n[f-1]+1,v=n[f],b=v-o+a-g;v<i&&b<l&&e[v]===t[b];)n[f]=++v,++b;if(u%2!=0&&u-p<=g&&g<=u+p&&r[f-u]<=n[f])return s(r[f-u],g+o-a,i,l)}for(g=u-p;g<=u+p;g+=2){for(f=g+m-u,g===u-p||g!==u+p&&r[f+1]<=r[f-1]?r[f]=r[f+1]-1:r[f]=r[f-1],v=r[f]-1,b=v-o+a-g;v>=o&&b>=a&&e[v]===t[b];)r[f]=v--,b--;if(u%2==0&&-p<=g&&g<=p&&r[f]<=n[f+u])return s(r[f],g+o-a,i,l)}}return null},l=[];return i(0,e.length,0,t.length,l),l})(j(ue(t.childNodes),b_),e),t),t),w_=st(()=>document.implementation.createHTMLDocument("undo")),__=e=>{const t=e.serializer.getTempAttrs(),o=Tg(e.getBody(),t);return(e=>null!==e.querySelector("iframe"))(o)?{type:"fragmented",fragments:Y(j(ue(o.childNodes),T(Ia,b_)),e=>e.length>0),content:"",bookmark:null,beforeBookmark:null}:{type:"complete",fragments:null,content:Ia(o.innerHTML),bookmark:null,beforeBookmark:null}},x_=(e,t,o)=>{const n=o?t.beforeBookmark:t.bookmark;"fragmented"===t.type?y_(t.fragments,e.getBody()):e.setContent(t.content,{format:"raw",no_selection:!_(n)||!Vh(n)||!n.isFakeCaret}),n&&(e.selection.moveToBookmark(n),e.selection.scrollIntoView())},C_=e=>"fragmented"===e.type?e.fragments.join(""):e.content,k_=e=>{const t=uo("body",w_());return Mn(t,C_(e)),W(yr(t,"*[data-mce-bogus]"),kn),An(t)},S_=(e,t)=>!(!e||!t)&&(!!((e,t)=>C_(e)===C_(t))(e,t)||((e,t)=>k_(e)===k_(t))(e,t)),T_=e=>0===e.get(),E_=(e,t,o)=>{T_(o)&&(e.typing=t)},O_=(e,t)=>{e.typing&&(E_(e,!1,t),e.add())},A_=e=>({init:{bindEvents:S},undoManager:{beforeChange:(t,o)=>((e,t,o)=>{T_(t)&&o.set(oc(e.selection))})(e,t,o),add:(t,o,n,r,i,s)=>((e,t,o,n,r,i,s)=>{const a=__(e),l=ao.extend(i||{},a);if(!T_(n)||e.removed)return null;const c=t.data[o.get()];if(e.dispatch("BeforeAddUndo",{level:l,lastLevel:c,originalEvent:s}).isDefaultPrevented())return null;if(c&&S_(c,l))return null;t.data[o.get()]&&r.get().each(e=>{t.data[o.get()].beforeBookmark=e});const d=kd(e);if(d&&t.data.length>d){for(let e=0;e<t.data.length-1;e++)t.data[e]=t.data[e+1];t.data.length--,o.set(t.data.length)}l.bookmark=oc(e.selection),o.get()<t.data.length-1&&(t.data.length=o.get()+1),t.data.push(l),o.set(t.data.length-1);const u={level:l,lastLevel:c,originalEvent:s};return o.get()>0?(e.setDirty(!0),e.dispatch("AddUndo",u),e.dispatch("change",u)):e.dispatch("AddUndo",u),l})(e,t,o,n,r,i,s),undo:(t,o,n)=>((e,t,o,n)=>{let r;return t.typing&&(t.add(),t.typing=!1,E_(t,!1,o)),n.get()>0&&(n.set(n.get()-1),r=t.data[n.get()],x_(e,r,!0),e.setDirty(!0),e.dispatch("Undo",{level:r})),r})(e,t,o,n),redo:(t,o)=>((e,t,o)=>{let n;return t.get()<o.length-1&&(t.set(t.get()+1),n=o[t.get()],x_(e,n,!1),e.setDirty(!0),e.dispatch("Redo",{level:n})),n})(e,t,o),clear:(t,o)=>((e,t,o)=>{t.data=[],o.set(0),t.typing=!1,e.dispatch("ClearUndos")})(e,t,o),reset:e=>(e=>{e.clear(),e.add()})(e),hasUndo:(t,o)=>((e,t,o)=>o.get()>0||t.typing&&t.data[0]&&!S_(__(e),t.data[0]))(e,t,o),hasRedo:(e,t)=>((e,t)=>t.get()<e.data.length-1&&!e.typing)(e,t),transact:(e,t,o)=>((e,t,o)=>(O_(e,t),e.beforeChange(),e.ignore(o),e.add()))(e,t,o),ignore:(e,t)=>((e,t)=>{try{e.set(e.get()+1),t()}finally{e.set(e.get()-1)}})(e,t),extra:(t,o,n,r)=>((e,t,o,n,r)=>{if(t.transact(n)){const n=t.data[o.get()].bookmark,i=t.data[o.get()-1];x_(e,i,!0),t.transact(r)&&(t.data[o.get()-1].beforeBookmark=n)}})(e,t,o,n,r)},formatter:{match:(t,o,n,r)=>ub(e,t,o,n,r),matchAll:(t,o)=>((e,t,o)=>{const n=[],r={},i=e.selection.getStart();return e.dom.getParent(i,i=>{for(let s=0;s<t.length;s++){const a=t[s];!r[a]&&db(e,i,a,o)&&(r[a]=!0,n.push(a))}},e.dom.getRoot()),n})(e,t,o),matchNode:(t,o,n,r)=>db(e,t,o,n,r),canApply:t=>((e,t)=>{const o=e.formatter.get(t),n=e.dom;if(o&&e.selection.isEditable()){const t=e.selection.getStart(),r=wm(n,t);for(let e=o.length-1;e>=0;e--){const t=o[e];if(!Cm(t))return!0;for(let e=r.length-1;e>=0;e--)if(n.is(r[e],t.selector))return!0}}return!1})(e,t),closest:t=>((e,t)=>{const o=t=>_o(t,mo(e.getBody()));return L.from(e.selection.getStart(!0)).bind(n=>kr(mo(n),o=>he(t,t=>((t,o)=>db(e,t.dom,o)?L.some(o):L.none())(o,t)),o)).getOrNull()})(e,t),apply:(t,o,n)=>ly(e,t,o,n),remove:(t,o,n,r)=>oy(e,t,o,n,r),toggle:(t,o,n)=>((e,t,o,n)=>{const r=e.formatter.get(t);r&&(!ub(e,t,o,n)||"toggle"in r[0]&&!r[0].toggle?ly(e,t,o,n):oy(e,t,o,n))})(e,t,o,n),formatChanged:(t,o,n,r,i)=>((e,t,o,n,r,i)=>(((e,t,o,n,r,i)=>{const s=t.get();W(o.split(","),t=>{const o=ke(s,t).getOrThunk(()=>{const e={withSimilar:{state:Oe(!1),similar:!0,callbacks:[]},withoutSimilar:{state:Oe(!1),similar:!1,callbacks:[]},withVars:[]};return s[t]=e,e}),a=()=>{const o=hy(e);return uy(e,o,t,r,i).isSome()};if(y(i)){const e=r?o.withSimilar:o.withoutSimilar;e.callbacks.push(n),1===e.callbacks.length&&e.state.set(a())}else o.withVars.push({state:Oe(a()),similar:r,vars:i,callback:n})}),t.set(s)})(e,t,o,n,r,i),{unbind:()=>((e,t,o)=>{const n=e.get();W(t.split(","),e=>ke(n,e).each(t=>{n[e]={withSimilar:{...t.withSimilar,callbacks:Y(t.withSimilar.callbacks,e=>e!==o)},withoutSimilar:{...t.withoutSimilar,callbacks:Y(t.withoutSimilar.callbacks,e=>e!==o)},withVars:Y(t.withVars,e=>e.callback!==o)}})),e.set(n)})(t,o,n)}))(e,t,o,n,r,i)},editor:{getContent:t=>((e,t)=>L.from(e.getBody()).fold(O("tree"===t.format?new mg("body",11):""),o=>Ag(e,t,o)))(e,t),setContent:(t,o)=>((e,t,o)=>L.from(e.getBody()).map(n=>nb(t)?((e,t,o,n)=>{Iv(e.parser.getNodeFilters(),e.parser.getAttributeFilters(),o);const r=Rg({validate:!1},e.schema).serialize(o),i=Ia(Ra(mo(t))?r:ao.trim(r));return rb(e,i,n.no_selection),{content:o,html:i}})(e,n,t,o):((e,t,o,n)=>{if(0===(o=Ia(o)).length||/^\s+$/.test(o)){const r='<br data-mce-bogus="1">';"TABLE"===t.nodeName?o="<tr><td>"+r+"</td></tr>":/^(UL|OL)$/.test(t.nodeName)&&(o="<li>"+r+"</li>");const i=Bc(e);return e.schema.isValidChild(t.nodeName.toLowerCase(),i.toLowerCase())?(o=r,o=e.dom.createHTML(i,Rc(e),o)):o||(o=r),rb(e,o,n.no_selection),{content:o,html:o}}{"raw"!==n.format&&(o=Rg({validate:!1},e.schema).serialize(e.parser.parse(o,{isRootContent:!0,insert:!0})));const r=Ra(mo(t))?o:ao.trim(o);return rb(e,r,n.no_selection),{content:r,html:r}}})(e,n,t,o)).getOr({content:t,html:nb(o.content)?"":o.content}))(e,t,o),insertContent:(t,o)=>ob(e,t,o),addVisual:t=>((e,t)=>{const o=e.dom,n=_(t)?t:e.getBody();W(o.select("table,a",n),t=>{switch(t.nodeName){case"TABLE":const n=Nd(e),r=o.getAttrib(t,"border");r&&"0"!==r||!e.hasVisual?o.removeClass(t,n):o.addClass(t,n);break;case"A":if(!o.getAttrib(t,"href")){const n=o.getAttrib(t,"name")||t.id,r=Vd(e);n&&e.hasVisual?o.addClass(t,r):o.removeClass(t,r)}}}),e.dispatch("VisualAid",{element:t,hasVisual:e.hasVisual})})(e,t)},selection:{getContent:(t,o)=>((e,t,o={})=>{const n=((e,t)=>({...e,format:t,get:!0,selection:!0,getInner:!0}))(o,t);return Qw(e,n).fold(A,t=>{const o=((e,t)=>{if("text"===t.format)return(e=>L.from(e.selection.getRng()).map(t=>{var o;const n=L.from(e.dom.getParent(t.commonAncestorContainer,e.dom.isBlock)),r=e.getBody(),i=(e=>e.map(e=>e.nodeName).getOr("div").toLowerCase())(n),s=mo(t.cloneContents());Eg(s),Og(s);const a=e.dom.add(r,i,{"data-mce-bogus":"all",style:"overflow: hidden; opacity: 0;"},s.dom),l=v_(a),c=Ia(null!==(o=a.textContent)&&void 0!==o?o:"");if(e.dom.remove(a),f_(c,0)||f_(c,c.length-1)){const e=n.getOr(r),t=v_(e),o=t.indexOf(l);return-1===o?l:(f_(t,o-1)?" ":"")+l+(f_(t,o+l.length)?" ":"")}return l}).getOr(""))(e);{const o=((e,t)=>{const o=e.selection.getRng(),n=e.dom.create("body"),r=e.selection.getSel(),i=lg(e,Yh(r)),s=t.contextual?g_(mo(e.getBody()),i,e.schema).dom:o.cloneContents();return s&&n.appendChild(s),e.selection.serializer.serialize(n,t)})(e,t);return"tree"===t.format?o:e.selection.isCollapsed()?"":o}})(e,t);return e_(e,o,t)})})(e,t,o)},autocompleter:{addDecoration:S,removeDecoration:S},raw:{getModel:()=>L.none()}}),M_=e=>Se(e.plugins,"rtc"),B_=e=>e.rtcInstance?e.rtcInstance:A_(e),R_=e=>{const t=e.rtcInstance;if(t)return t;throw new Error("Failed to get RTC instance not yet initialized.")},N_=e=>R_(e).init.bindEvents(),V_=e=>0===e.dom.length?(Cn(e),L.none()):L.some(e),D_=(e,t,o,n,r)=>{e.bind(e=>((n?Nf:Rf)(e.dom,n?e.dom.length:0,r),t.filter(Ao).map(t=>((e,t,o,n,r)=>{const i=e.dom,s=t.dom,a=n?i.length:s.length;n?(Vf(i,s,r,!1,!n),o.setStart(s,a)):(Vf(s,i,r,!1,!n),o.setEnd(s,a))})(e,t,o,n,r)))).orThunk(()=>{const e=((e,t)=>e.filter(e=>Xm.isBookmarkNode(e.dom)).bind(t?zo:Fo))(t,n).or(t).filter(Ao);return e.map(e=>((e,t,o)=>{Po(e).each(n=>{const r=e.dom;t&&Cf(n,Dl(r,0),o)?Rf(r,0,o):!t&&kf(n,Dl(r,r.length),o)&&Nf(r,r.length,o)})})(e,n,r))})},P_=(e,t,o)=>{if(Se(e,t)){const n=Y(e[t],e=>e!==o);0===n.length?delete e[t]:e[t]=n}};const I_=e=>!(!e||!e.ownerDocument)&&xo(mo(e.ownerDocument),mo(e)),L_=(e,t,o,n)=>{let r,i;const{selectorChangedWithUnbind:s}=((e,t)=>{let o,n;const r=(t,o)=>Q(o,o=>e.is(o,t)),i=t=>e.getParents(t,void 0,e.getRoot());return{selectorChangedWithUnbind:(e,s)=>(o||(o={},n={},t.on("NodeChange",e=>{const t=e.element,s=i(t),a={};fe(o,(e,t)=>{r(t,s).each(o=>{n[t]||(W(e,e=>{e(!0,{node:o,selector:t,parents:s})}),n[t]=e),a[t]=e})}),fe(n,(e,o)=>{a[o]||(delete n[o],W(e,e=>{e(!1,{node:t,selector:o,parents:s})}))})})),o[e]||(o[e]=[]),o[e].push(s),r(e,i(t.selection.getStart())).each(()=>{n[e]=o[e]}),{unbind:()=>{P_(o,e,s),P_(n,e,s)}})}})(e,n),a=(e,t)=>((e,t,o={})=>{const n=((e,t)=>({format:"html",...e,set:!0,selection:!0,content:t}))(o,t);t_(e,n).each(t=>{const o=((e,t)=>{if("raw"!==t.format){const o=e.selection.getRng(),n=e.dom.getParent(o.commonAncestorContainer,e.dom.isBlock),r=n?{context:n.nodeName.toLowerCase()}:{},i=e.parser.parse(t.content,{forced_root_block:!1,...r,...t});return Rg({validate:!1},e.schema).serialize(i)}return t.content})(e,t),n=e.selection.getRng();((e,t,o)=>{const n=L.from(t.firstChild).map(mo),r=L.from(t.lastChild).map(mo);e.deleteContents(),e.insertNode(t);const i=n.bind(Fo).filter(Ao).bind(V_),s=r.bind(zo).filter(Ao).bind(V_);D_(i,n,e,!0,o),D_(s,r,e,!1,o),e.collapse(!1)})(n,n.createContextualFragment(o),e.schema),e.selection.setRng(n),og(e,n),o_(e,o,t)})})(n,e,t),l=e=>{const t=d();t.collapse(!!e),u(t)},c=()=>t.getSelection?t.getSelection():t.document.selection,d=()=>{let o;const s=(e,t,o)=>{try{return t.compareBoundaryPoints(e,o)}catch(e){return-1}},a=t.document;if(_(n.bookmark)&&!wp(n)){const e=ip(n);if(e.isSome())return e.map(e=>lg(n,[e])[0]).getOr(a.createRange())}try{const e=c();e&&!jr(e.anchorNode)&&(o=e.rangeCount>0?e.getRangeAt(0):a.createRange(),o=lg(n,[o])[0])}catch(e){}if(o||(o=a.createRange()),ii(o.startContainer)&&o.collapsed){const t=e.getRoot();o.setStart(t,0),o.setEnd(t,0)}return r&&i&&(0===s(o.START_TO_START,o,r)&&0===s(o.END_TO_END,o,r)?o=i:(r=null,i=null)),o},u=(e,t)=>{if(!(e=>!!e&&I_(e.startContainer)&&I_(e.endContainer))(e))return;const o=c();if(e=n.dispatch("SetSelectionRange",{range:e,forward:t}).range,o){i=e;try{o.removeAllRanges(),o.addRange(e)}catch(e){}!1===t&&o.extend&&(o.collapse(e.endContainer,e.endOffset),o.extend(e.startContainer,e.startOffset)),r=o.rangeCount>0?o.getRangeAt(0):null}if(!e.collapsed&&e.startContainer===e.endContainer&&(null==o?void 0:o.setBaseAndExtent)&&e.endOffset-e.startOffset<2&&e.startContainer.hasChildNodes()){const t=e.startContainer.childNodes[e.startOffset];t&&"IMG"===t.nodeName&&(o.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),o.anchorNode===e.startContainer&&o.focusNode===e.endContainer||o.setBaseAndExtent(t,0,t,1))}n.dispatch("AfterSetSelectionRange",{range:e,forward:t})},h=()=>{const t=c(),o=null==t?void 0:t.anchorNode,n=null==t?void 0:t.focusNode;if(!t||!o||!n||jr(o)||jr(n))return!0;const r=e.createRng(),i=e.createRng();try{r.setStart(o,t.anchorOffset),r.collapse(!0),i.setStart(n,t.focusOffset),i.collapse(!0)}catch(e){return!0}return r.compareBoundaryPoints(r.START_TO_START,i)<=0},m={dom:e,win:t,serializer:o,editor:n,expand:(t={type:"word"})=>u(zp(e).expand(d(),t)),collapse:l,setCursorLocation:(t,o)=>{const r=e.createRng();_(t)&&_(o)?(r.setStart(t,o),r.setEnd(t,o),u(r),l(!1)):(om(e,r,n.getBody(),!0),u(r))},getContent:e=>((e,t={})=>((e,t,o)=>R_(e).selection.getContent(t,o))(e,t.format?t.format:"html",t))(n,e),setContent:a,getBookmark:(e,t)=>p.getBookmark(e,t),moveToBookmark:e=>p.moveToBookmark(e),select:(t,o)=>(((e,t,o)=>L.from(t).bind(t=>L.from(t.parentNode).map(n=>{const r=e.nodeIndex(t),i=e.createRng();return i.setStart(n,r),i.setEnd(n,r+1),o&&(om(e,i,t,!0),om(e,i,t,!1)),i})))(e,t,o).each(u),t),isCollapsed:()=>{const e=d(),t=c();return!(!e||e.item)&&(e.compareEndPoints?0===e.compareEndPoints("StartToEnd",e):!t||e.collapsed)},isEditable:()=>{if(n.mode.isReadOnly())return!1;const t=d(),o=n.getBody().querySelectorAll('[data-mce-selected="1"]');return o.length>0?ne(o,t=>e.isEditable(t.parentElement)):ng(e,t)},isForward:h,setNode:t=>(a(e.getOuterHTML(t)),t),getNode:()=>((e,t)=>{if(!t)return e;let o=t.startContainer,n=t.endContainer;const r=t.startOffset,i=t.endOffset;let s=t.commonAncestorContainer;t.collapsed||(o===n&&i-r<2&&o.hasChildNodes()&&(s=o.childNodes[r]),ti(o)&&ti(n)&&(o=o.length===r?ag(o.nextSibling,!0):o.parentNode,n=0===i?ag(n.previousSibling,!1):n.parentNode,o&&o===n&&(s=o)));const a=ti(s)?s.parentNode:s;return qr(a)?a:e})(n.getBody(),d()),getSel:c,setRng:u,getRng:d,getStart:e=>ig(n.getBody(),d(),e),getEnd:e=>sg(n.getBody(),d(),e),getSelectedBlocks:(t,o)=>((e,t,o,n)=>{const r=[],i=e.getRoot(),s=e.getParent(o||ig(i,t,t.collapsed),e.isBlock),a=e.getParent(n||sg(i,t,t.collapsed),e.isBlock);if(s&&s!==i&&r.push(s),s&&a&&s!==a){let t;const o=new Fr(s,i);for(;(t=o.next())&&t!==a;)e.isBlock(t)&&r.push(t)}return a&&s!==a&&a!==i&&r.push(a),r})(e,d(),t,o),normalize:()=>{const t=d(),o=c();if(!(Yh(o).length>1)&&nm(n)){const o=Ip(e,t);return o.each(e=>{u(e,h())}),o.getOr(t)}return t},selectorChanged:(e,t)=>(s(e,t),m),selectorChangedWithUnbind:s,getScrollContainer:()=>{let t,o=e.getRoot();for(;o&&"BODY"!==o.nodeName;){if(o.scrollHeight>o.clientHeight){t=o;break}o=o.parentNode}return t},scrollIntoView:(e,t)=>{_(e)?((e,t,o)=>{(e.inline?Qp:tg)(e,t,o)})(n,e,t):og(n,d(),t)},placeCaretAt:(e,t)=>u(Ap(e,t,n.getDoc())),getBoundingClientRect:()=>{const e=d();return e.collapsed?Dl.fromRangeStart(e).getClientRects()[0]:e.getBoundingClientRect()},destroy:()=>{t=r=i=null,g.destroy()}},p=Xm(m),g=Op(m,n);return m.bookmarkManager=p,m.controlSelection=g,m},F_=(e,t,o)=>{-1===ao.inArray(t,o)&&(e.addAttributeFilter(o,(e,t)=>{let o=e.length;for(;o--;)e[o].attr(t,null)}),t.push(o))},z_=(e,t)=>{const o=["data-mce-selected"],n={entity_encoding:"named",remove_trailing_brs:!0,pad_empty_with_br:!1,...e},r=t&&t.dom?t.dom:ra.DOM,i=t&&t.schema?t.schema:As(n),s=Xw(n,i);return((e,t,o)=>{e.addAttributeFilter("data-mce-tabindex",(e,t)=>{let o=e.length;for(;o--;){const n=e[o];n.attr("tabindex",n.attr("data-mce-tabindex")),n.attr(t,null)}}),e.addAttributeFilter("src,href,style",(e,n)=>{const r="data-mce-"+n,i=t.url_converter,s=t.url_converter_scope;let a=e.length;for(;a--;){const t=e[a];let l=t.attr(r);void 0!==l?(t.attr(n,l.length>0?l:null),t.attr(r,null)):(l=t.attr(n),"style"===n?l=o.serializeStyle(o.parseStyle(l),t.name):i&&(l=i.call(s,l,n,t.name)),t.attr(n,l.length>0?l:null))}}),e.addAttributeFilter("class",e=>{let t=e.length;for(;t--;){const o=e[t];let n=o.attr("class");n&&(n=n.replace(/(?:^|\s)mce-item-\w+(?!\S)/g,""),o.attr("class",n.length>0?n:null))}}),e.addAttributeFilter("data-mce-type",(e,t,o)=>{let n=e.length;for(;n--;){const t=e[n];if("bookmark"===t.attr("data-mce-type")&&!o.cleanup){const e=L.from(t.firstChild).exists(e=>{var t;return!Pa(null!==(t=e.value)&&void 0!==t?t:"")});e?t.unwrap():t.remove()}}}),e.addNodeFilter("script,style",(e,o)=>{var n;const r=e=>e.replace(/(<!--\[CDATA\[|\]\]-->)/g,"\n").replace(/^[\r\n]*|[\r\n]*$/g,"").replace(/^\s*((<!--)?(\s*\/\/)?\s*<!\[CDATA\[|(<!--\s*)?\/\*\s*<!\[CDATA\[\s*\*\/|(\/\/)?\s*<!--|\/\*\s*<!--\s*\*\/)\s*[\r\n]*/gi,"").replace(/\s*(\/\*\s*\]\]>\s*\*\/(-->)?|\s*\/\/\s*\]\]>(-->)?|\/\/\s*(-->)?|\]\]>|\/\*\s*-->\s*\*\/|\s*-->\s*)\s*$/g,"");let i=e.length;for(;i--;){const s=e[i],a=s.firstChild,l=null!==(n=null==a?void 0:a.value)&&void 0!==n?n:"";if("script"===o){const e=s.attr("type");e&&s.attr("type","mce-no/type"===e?null:e.replace(/^mce\-/,"")),"xhtml"===t.element_format&&a&&l.length>0&&(a.value="// <![CDATA[\n"+r(l)+"\n// ]]>")}else"xhtml"===t.element_format&&a&&l.length>0&&(a.value="\x3c!--\n"+r(l)+"\n--\x3e")}}),e.addNodeFilter("#comment",e=>{let n=e.length;for(;n--;){const r=e[n],i=r.value;t.preserve_cdata&&0===(null==i?void 0:i.indexOf("[CDATA["))&&(r.name="#cdata",r.type=4,r.value=o.decode(i.replace(/^\[CDATA\[|\]\]$/g,"")))}}),e.addNodeFilter("xml:namespace,input",(e,t)=>{let o=e.length;for(;o--;){const n=e[o];7===n.type?n.remove():1===n.type&&("input"!==t||n.attr("type")||n.attr("type","text"))}}),e.addAttributeFilter("data-mce-type",t=>{W(t,t=>{"format-caret"===t.attr("data-mce-type")&&(t.isEmpty(e.schema.getNonEmptyElements())?t.remove():t.unwrap())})}),e.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style,data-mce-selected,data-mce-expando,data-mce-block,data-mce-type,data-mce-resize,data-mce-placeholder",(e,t)=>{let o=e.length;for(;o--;)e[o].attr(t,null)}),t.remove_trailing_brs&&((e,t,o)=>{t.addNodeFilter("br",(t,n,r)=>{const i=ao.extend({},o.getBlockElements()),s=o.getNonEmptyElements(),a=o.getWhitespaceElements();i.body=1;const l=e=>e.name in i||$i(o,e);for(let n=0,c=t.length;n<c;n++){let c=t[n],d=c.parent;if(d&&l(d)&&c===d.lastChild){let t=c.prev;for(;t;){const e=t.name;if("span"!==e||"bookmark"!==t.attr("data-mce-type")){"br"===e&&(c=null);break}t=t.prev}if(c&&(c.remove(),zv(o,s,a,d))){const t=o.getElementRule(d.name);t&&(t.removeEmpty?d.remove():t.paddEmpty&&Lv(e,r,l,d))}}else{let e=c;for(;d&&d.firstChild===e&&d.lastChild===e&&(e=d,!i[d.name]);)d=d.parent;if(e===d){const e=new mg("#text",3);e.value=lt,c.replace(e)}}}})})(t,e,e.schema)})(s,n,r),{schema:i,addNodeFilter:s.addNodeFilter,addAttributeFilter:s.addAttributeFilter,serialize:(e,o={})=>{const a={format:"html",...o},l=((e,t,o)=>((e,t)=>_(e)&&e.hasEventListeners("PreProcess")&&!t.no_events)(e,o)?((e,t,o)=>{let n;const r=e.dom;let i=t.cloneNode(!0);const s=document.implementation;if(s.createHTMLDocument){const e=s.createHTMLDocument("");ao.each("BODY"===i.nodeName?i.childNodes:[i],t=>{e.body.appendChild(e.importNode(t,!0))}),i="BODY"!==i.nodeName?e.body.firstChild:e.body,n=r.doc,r.doc=e}return((e,t)=>{e.dispatch("PreProcess",t)})(e,{...o,node:i}),n&&(r.doc=n),i})(e,t,o):t)(t,e,a),c=((e,t,o)=>{const n=Ia(o.getInner?t.innerHTML:e.getOuterHTML(t));return o.selection||Ra(mo(t))?n:ao.trim(n)})(r,l,a),d=((e,t,o)=>{const n=o.selection?{forced_root_block:!1,...o}:o,r=e.parse(t,n);return(e=>{const t=e=>"br"===(null==e?void 0:e.name),o=e.lastChild;if(t(o)){const e=o.prev;t(e)&&(o.remove(),e.remove())}})(r),r})(s,c,a);return"tree"===a.format?d:((e,t,o,n,r)=>{const i=((e,t,o)=>Rg(e,t).serialize(o))(t,o,n);return((e,t,o)=>{if(!t.no_events&&e){const n=((e,t)=>e.dispatch("PostProcess",t))(e,{...t,content:o});return n.content}return o})(e,r,i)})(t,n,i,d,a)},addRules:i.addValidElements,setRules:i.setValidElements,addTempAttr:B(F_,s,o),getTempAttrs:O(o),getNodeFilters:s.getNodeFilters,getAttributeFilters:s.getAttributeFilters,removeNodeFilter:s.removeNodeFilter,removeAttributeFilter:s.removeAttributeFilter}},H_=(e,t)=>{const o=z_(e,t);return{schema:o.schema,addNodeFilter:o.addNodeFilter,addAttributeFilter:o.addAttributeFilter,serialize:o.serialize,addRules:o.addRules,setRules:o.setRules,addTempAttr:o.addTempAttr,getTempAttrs:o.getTempAttrs,getNodeFilters:o.getNodeFilters,getAttributeFilters:o.getAttributeFilters,removeNodeFilter:o.removeNodeFilter,removeAttributeFilter:o.removeAttributeFilter}},U_=(e,t,o={})=>{const n=((e,t)=>({format:"html",...e,set:!0,content:t}))(o,t);return t_(e,n).map(t=>{const o=((e,t,o)=>B_(e).editor.setContent(t,o))(e,t.content,t);return o_(e,o.html,t),o.content}).getOr(t)},Z_="autoresize_on_init,content_editable_state,padd_empty_with_br,block_elements,boolean_attributes,editor_deselector,editor_selector,elements,file_browser_callback_types,filepicker_validator_handler,force_hex_style_colors,force_p_newlines,gecko_spellcheck,images_dataimg_filter,media_scripts,mode,move_caret_before_on_enter_elements,non_empty_elements,self_closing_elements,short_ended_elements,special,spellchecker_select_languages,spellchecker_whitelist,tab_focus,tabfocus_elements,table_responsive_width,text_block_elements,text_inline_elements,toolbar_drawer,types,validate,whitespace_elements,paste_enable_default_filters,paste_filter_drop,paste_word_valid_elements,paste_retain_style_properties,paste_convert_word_fake_lists,template_cdate_classes,template_mdate_classes,template_selected_content_classes,template_preview_replace_values,template_replace_values,templates,template_cdate_format,template_mdate_format".split(","),$_=[],j_="bbcode,colorpicker,contextmenu,fullpage,legacyoutput,spellchecker,template,textcolor,rtc".split(","),W_=[{name:"export",replacedWith:"Export to PDF"}],q_=(e,t)=>{const o=Y(t,t=>Se(e,t));return ae(o)},G_=e=>{const t=q_(e,Z_),o=e.forced_root_block;return!1!==o&&""!==o||t.push("forced_root_block (false only)"),ae(t)},Y_=e=>q_(e,$_),X_=(e,t)=>{const o=ao.makeMap(e.plugins," "),n=Y(t,e=>Se(o,e));return ae(n)},K_=e=>X_(e,j_),J_=e=>X_(e,W_.map(e=>e.name)),Q_=e=>Q(W_,t=>t.name===e).fold(()=>e,t=>t.replacedWith?`${e}, replaced by ${t.replacedWith}`:e),ex=ra.DOM,tx=e=>L.from(e).each(e=>e.destroy()),ox=(()=>{const e={};return{add:(t,o)=>{e[t]=o},get:t=>e[t]?e[t]:{icons:{}},has:t=>Se(e,t)}})(),nx=ua.ModelManager,rx=(e,t)=>t.dom[e],ix=(e,t)=>parseInt(Pn(t,e),10),sx=B(rx,"clientWidth"),ax=B(rx,"clientHeight"),lx=B(ix,"margin-top"),cx=B(ix,"margin-left"),dx=e=>{const t=[],o=()=>{const t=e.theme;return t&&t.getNotificationManagerImpl?t.getNotificationManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a NotificationManager implementation.")};return{open:e,close:e,getArgs:e}})()},n=()=>L.from(t[0]),r=()=>{n().each(e=>{e.reposition()})},i=e=>{ee(t,t=>t===e).each(e=>{t.splice(e,1)})},s=(n,s=!0)=>e.removed||!(e=>{return(t=e.inline?e.getBody():e.getContentAreaContainer(),L.from(t).map(mo)).map(Rn).getOr(!1);var t})(e)?{}:(s&&e.dispatch("BeforeOpenNotification",{notification:n}),Q(t,e=>{return t=o().getArgs(e),r=n,!(t.type!==r.type||t.text!==r.text||t.progressBar||t.timeout||r.progressBar||r.timeout);var t,r}).getOrThunk(()=>{e.editorManager.setActive(e);const s=o().open(n,()=>{i(s)},()=>_p(e));return(e=>{t.push(e)})(s),r(),e.dispatch("OpenNotification",{notification:{...s}}),s})),a=O(t);return(e=>{e.on("SkinLoaded",()=>{const t=ld(e);t&&s({text:t,type:"warning",timeout:0},!1),r()}),e.on("show ResizeEditor ResizeWindow NodeChange ToggleView FullscreenStateChanged",()=>{requestAnimationFrame(r)}),e.on("remove",()=>{W(t.slice(),e=>{o().close(e)})}),e.on("keydown",e=>{var t;const o="f12"===(null===(t=e.key)||void 0===t?void 0:t.toLowerCase())||123===e.keyCode;e.altKey&&o&&(e.preventDefault(),n().map(e=>mo(e.getEl())).each(e=>rn(e)))})})(e),{open:s,close:()=>{n().each(e=>{o().close(e),i(e),r()})},getNotifications:a}},ux=ua.PluginManager,hx=ua.ThemeManager,mx=e=>{let t=[];const o=()=>{const t=e.theme;return t&&t.getWindowManagerImpl?t.getWindowManagerImpl():(()=>{const e=()=>{throw new Error("Theme did not provide a WindowManager implementation.")};return{open:e,openUrl:e,alert:e,confirm:e,close:e}})()},n=(e,t)=>(...o)=>t?t.apply(e,o):void 0,r=o=>{(t=>{e.dispatch("CloseWindow",{dialog:t})})(o),t=Y(t,e=>e!==o),0===t.length&&e.focus()},i=o=>{e.editorManager.setActive(e),rp(e),e.ui.show();const n=o();return(o=>{t.push(o),(t=>{e.dispatch("OpenWindow",{dialog:t})})(o)})(n),n};return e.on("remove",()=>{W(t,e=>{o().close(e)})}),{open:(e,t)=>i(()=>o().open(e,t,r)),openUrl:e=>i(()=>o().openUrl(e,r)),alert:(e,t,r)=>{const i=o();i.alert(e,n(r||i,t))},confirm:(e,t,r)=>{const i=o();i.confirm(e,n(r||i,t))},close:()=>{L.from(t[t.length-1]).each(e=>{o().close(e),r(e)})}}},px=(e,t)=>{e.notificationManager.open({type:"error",text:t})},gx=(e,t)=>{e._skinLoaded?px(e,t):e.on("SkinLoaded",()=>{px(e,t)})},fx=(e,t,o)=>{dc(e,t,{message:o}),console.error(o)},vx=(e,t,o)=>o?`Failed to load ${e}: ${o} from url ${t}`:`Failed to load ${e} url: ${t}`,bx=(e,...t)=>{const o=window.console;o&&(o.error?o.error(e,...t):o.log(e,...t))},yx=(e,t,o)=>{try{e.getDoc().execCommand(t,!1,String(o))}catch(e){}},wx=(e,t,o)=>{pr(e,t)&&!o?mr(e,t):o&&ur(e,t)},_x=e=>{const t=mo(e.getBody());wx(t,"mce-content-readonly",!0),e.selection.controlSelection.hideResizeRect(),e._selectionOverrides.hideFakeCaret(),(e=>{L.from(e.selection.getNode()).each(e=>{e.removeAttribute("data-mce-selected")})})(e)},xx=e=>{const t=mo(e.getBody());wx(t,"mce-content-readonly",!1),e.hasEditableRoot()&&vr(t,!0),((e,t)=>{yx(e,"StyleWithCSS",t),yx(e,"enableInlineTableEditing",t),yx(e,"enableObjectResizing",t)})(e,!1),_p(e)&&e.focus(),(e=>{e.selection.setRng(e.selection.getRng())})(e),e.nodeChanged()},Cx=e=>bu(e),kx="data-mce-contenteditable",Sx=(e,t)=>{const o=mo(e.getBody());t?(_x(e),vr(o,!1),W(yr(o,'*[contenteditable="true"]'),e=>{gn(e,kx,"true"),vr(e,!1)})):(W(yr(o,`*[${kx}="true"]`),e=>{wn(e,kx),vr(e,!0)}),xx(e))},Tx=e=>{e.parser.addAttributeFilter("contenteditable",t=>{Cx(e)&&W(t,e=>{e.attr(kx,e.attr("contenteditable")),e.attr("contenteditable","false")})}),e.serializer.addAttributeFilter(kx,t=>{Cx(e)&&W(t,e=>{e.attr("contenteditable",e.attr(kx))})}),e.serializer.addTempAttr(kx)},Ex=["copy"],Ox=e=>"content/"+e+"/content.css",Ax=(e,t)=>{const o=e.editorManager.baseURL+"/skins/content",n=`content${e.editorManager.suffix}.css`;return j(t,t=>(e=>mailpoetTinymce.Resource.has(Ox(e)))(t)?t:(e=>/^[a-z0-9\-]+$/i.test(e))(t)&&!e.inline?`${o}/${t}/${n}`:e.documentBaseURI.toAbsolute(t))},Mx=(e,t)=>{const o={};return{findAll:(n,r=I)=>{const i=Y((e=>e?ue(e.getElementsByTagName("img")):[])(n),t=>{const o=t.src;return!t.hasAttribute("data-mce-bogus")&&!t.hasAttribute("data-mce-placeholder")&&!(!o||o===no.transparentSrc)&&(Ye(o,"blob:")?!e.isUploaded(o)&&r(t):!!Ye(o,"data:")&&r(t))}),s=j(i,e=>{const n=e.src;if(Se(o,n))return o[n].then(t=>m(t)?t:{image:e,blobInfo:t.blobInfo});{const r=((e,t)=>{const o=()=>Promise.reject("Invalid data URI");if(Ye(t,"blob:")){const i=e.getByUri(t);return _(i)?Promise.resolve(i):(n=t,Ye(n,"blob:")?(e=>fetch(e).then(e=>e.ok?e.blob():Promise.reject()).catch(()=>Promise.reject({message:`Cannot convert ${e} to Blob. Resource might not exist or is inaccessible.`,uriType:"blob"})))(n):Ye(n,"data:")?(r=n,new Promise((e,t)=>{by(r).bind(({type:e,data:t,base64Encoded:o})=>yy(e,t,o)).fold(()=>t("Invalid data URI"),e)})):Promise.reject("Unknown URI format")).then(t=>wy(t).then(n=>xy(n,!1,o=>L.some(Cy(e,t,o))).getOrThunk(o)))}var n,r;return Ye(t,"data:")?ky(e,t).fold(o,e=>Promise.resolve(e)):Promise.reject("Unknown image data format")})(t,n).then(t=>(delete o[n],{image:e,blobInfo:t})).catch(e=>(delete o[n],e));return o[n]=r,r}});return Promise.all(s)}}},Bx=()=>{let e={};const t=(e,t)=>({status:e,resultUri:t}),o=t=>t in e;return{hasBlobUri:o,getResultUri:t=>{const o=e[t];return o?o.resultUri:null},isPending:t=>!!o(t)&&1===e[t].status,isUploaded:t=>!!o(t)&&2===e[t].status,markPending:o=>{e[o]=t(1,null)},markUploaded:(o,n)=>{e[o]=t(2,n)},removeFailed:t=>{delete e[t]},destroy:()=>{e={}}}};let Rx=0;const Nx=(e,t)=>{const o={},n=(e,o)=>new Promise((n,r)=>{const i=new XMLHttpRequest;i.open("POST",t.url),i.withCredentials=t.credentials,i.upload.onprogress=e=>{o(e.loaded/e.total*100)},i.onerror=()=>{r("Image upload failed due to a XHR Transport error. Code: "+i.status)},i.onload=()=>{if(i.status<200||i.status>=300)return void r("HTTP Error: "+i.status);const e=JSON.parse(i.responseText);var o,s;e&&m(e.location)?n((o=t.basePath,s=e.location,o?o.replace(/\/$/,"")+"/"+s.replace(/^\//,""):s)):r("Invalid JSON: "+i.responseText)};const s=new FormData;s.append("file",e.blob(),e.filename()),i.send(s)}),r=x(t.handler)?t.handler:n,i=(e,t)=>({url:t,blobInfo:e,status:!0}),s=(e,t)=>({url:"",blobInfo:e,status:!1,error:t}),a=(e,t)=>{ao.each(o[e],e=>{e(t)}),delete o[e]};return{upload:(l,c)=>t.url||r!==n?((t,n)=>(t=ao.grep(t,t=>!e.isUploaded(t.blobUri())),Promise.all(ao.map(t,t=>e.isPending(t.blobUri())?(e=>{const t=e.blobUri();return new Promise(e=>{o[t]=o[t]||[],o[t].push(e)})})(t):((t,o,n)=>(e.markPending(t.blobUri()),new Promise(r=>{let l,c;try{const d=()=>{l&&(l.close(),c=S)},u=o=>{d(),e.markUploaded(t.blobUri(),o),a(t.blobUri(),i(t,o)),r(i(t,o))},h=o=>{d(),e.removeFailed(t.blobUri()),a(t.blobUri(),s(t,o)),r(s(t,o))};c=e=>{e<0||e>100||L.from(l).orThunk(()=>L.from(n).map(V)).each(t=>{l=t,t.progressBar.value(e)})},o(t,c).then(u,e=>{h(m(e)?{message:e}:e)})}catch(e){r(s(t,e))}})))(t,r,n)))))(l,c):new Promise(e=>{e([])})}},Vx=e=>()=>e.notificationManager.open({text:e.translate("Image uploading..."),type:"info",timeout:-1,progressBar:!0}),Dx=(e,t)=>Nx(t,{url:Zc(e),basePath:$c(e),credentials:jc(e),handler:Wc(e)}),Px=e=>{const t=(()=>{let e=[];const t=e=>{if(!e.blob||!e.base64)throw new Error("blob and base64 representations of the image are required for BlobInfo to be created");const t=e.id||"blobid"+Rx+++(()=>{const e=()=>Math.round(4294967295*Ne()).toString(36);return"s"+(new Date).getTime().toString(36)+e()+e()+e()})(),o=e.name||t,n=e.blob;var r;return{id:O(t),name:O(o),filename:O(e.filename||o+"."+(r=n.type,{"image/jpeg":"jpg","image/jpg":"jpg","image/gif":"gif","image/png":"png","image/apng":"apng","image/avif":"avif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff"}[r.toLowerCase()]||"dat")),blob:O(n),base64:O(e.base64),blobUri:O(e.blobUri||URL.createObjectURL(n)),uri:O(e.uri)}},o=t=>Q(e,t).getOrUndefined(),n=e=>o(t=>t.id()===e);return{create:(e,o,n,r,i)=>{if(m(e))return t({id:e,name:r,filename:i,blob:o,base64:n});if(p(e))return t(e);throw new Error("Unknown input type")},add:t=>{n(t.id())||e.push(t)},get:n,getByUri:e=>o(t=>t.blobUri()===e),getByData:(e,t)=>o(o=>o.base64()===e&&o.blob().type===t),findFirst:o,removeByUri:t=>{e=Y(e,e=>e.blobUri()!==t||(URL.revokeObjectURL(e.blobUri()),!1))},destroy:()=>{W(e,e=>{URL.revokeObjectURL(e.blobUri())}),e=[]}}})();let o,n;const r=Bx(),i=[],s=t=>o=>e.selection?t(o):[],a=(e,t,o)=>{let n=0;do{n=e.indexOf(t,n),-1!==n&&(e=e.substring(0,n)+o+e.substr(n+t.length),n+=o.length-t.length+1)}while(-1!==n);return e},l=(e,t,o)=>{const n=`src="${o}"${o===no.transparentSrc?' data-mce-placeholder="1"':""}`;return e=a(e,`src="${t}"`,n),a(e,'data-mce-src="'+t+'"','data-mce-src="'+o+'"')},c=(t,o)=>{W(e.undoManager.data,e=>{"fragmented"===e.type?e.fragments=j(e.fragments,e=>l(e,t,o)):e.content=l(e.content,t,o)})},d=()=>(o||(o=Dx(e,r)),g().then(s(n=>{const r=j(n,e=>e.blobInfo);return o.upload(r,Vx(e)).then(s(o=>{const r=[];let i=!1;const s=j(o,(o,s)=>{const{blobInfo:a,image:l}=n[s];let d=!1;return o.status&&zc(e)?(o.url&&!Ge(l.src,o.url)&&(i=!0),t.removeByUri(l.src),M_(e)||((t,o)=>{const n=e.convertURL(o,"src");var r;c(t.src,o),fn(mo(t),{src:Fc(e)?(r=o,r+(-1===r.indexOf("?")?"?":"&")+(new Date).getTime()):o,"data-mce-src":n})})(l,o.url)):o.error&&(o.error.remove&&(c(l.src,no.transparentSrc),r.push(l),d=!0),((e,t)=>{gx(e,da.translate(["Failed to upload image: {0}",t]))})(e,o.error.message)),{element:l,status:o.status,uploadUri:o.url,blobInfo:a,removed:d}});return r.length>0&&!M_(e)?e.undoManager.transact(()=>{W(On(r),o=>{const n=Po(o);Cn(o),n.each((e=>t=>{((e,t)=>e.dom.isEmpty(t.dom)&&_(e.schema.getTextBlockElements()[ko(t)]))(e,t)&&un(t,co('<br data-mce-bogus="1" />'))})(e)),t.removeByUri(o.dom.src)})}):i&&e.undoManager.dispatchChange(),s}))}))),u=()=>Lc(e)?d():Promise.resolve([]),h=e=>ne(i,t=>t(e)),g=()=>(n||(n=Mx(r,t)),n.findAll(e.getBody(),h).then(s(t=>{const o=Y(t,t=>m(t)?(gx(e,t),!1):"blob"!==t.uriType);return M_(e)||W(o,e=>{c(e.image.src,e.blobInfo.blobUri()),e.image.src=e.blobInfo.blobUri(),e.image.removeAttribute("data-mce-src")}),o}))),f=o=>o.replace(/src="(blob:[^"]+)"/g,(o,n)=>{const i=r.getResultUri(n);if(i)return'src="'+i+'"';let s=t.getByUri(n);return s||(s=K(e.editorManager.get(),(e,t)=>e||t.editorUpload&&t.editorUpload.blobCache.getByUri(n),void 0)),s?'src="data:'+s.blob().type+";base64,"+s.base64()+'"':o});return e.on("SetContent",()=>{Lc(e)?u():g()}),e.on("RawSaveContent",e=>{e.content=f(e.content)}),e.on("GetContent",e=>{e.source_view||"raw"===e.format||"tree"===e.format||(e.content=f(e.content))}),e.on("PostRender",()=>{e.parser.addNodeFilter("img",e=>{W(e,e=>{const o=e.attr("src");if(!o||t.getByUri(o))return;const n=r.getResultUri(o);n&&e.attr("src",n)})})}),{blobCache:t,addFilter:e=>{i.push(e)},uploadImages:d,uploadImagesAuto:u,scanForImages:g,destroy:()=>{t.destroy(),r.destroy(),n=o=null}}},Ix={remove_similar:!0,inherit:!1},Lx={selector:"td,th",...Ix},Fx={tablecellbackgroundcolor:{styles:{backgroundColor:"%value"},...Lx},tablecellverticalalign:{styles:{"vertical-align":"%value"},...Lx},tablecellbordercolor:{styles:{borderColor:"%value"},...Lx},tablecellclass:{classes:["%value"],...Lx},tableclass:{selector:"table",classes:["%value"],...Ix},tablecellborderstyle:{styles:{borderStyle:"%value"},...Lx},tablecellborderwidth:{styles:{borderWidth:"%value"},...Lx}},zx=O(Fx),Hx=ao.each,Ux=ra.DOM,Zx=e=>_(e)&&p(e),$x=(e,t)=>{const o=t&&t.schema||As({}),n=e=>{const t=m(e)?{name:e,classes:[],attrs:{}}:e,o=Ux.create(t.name);return((e,t)=>{t.classes.length>0&&Ux.addClass(e,t.classes.join(" ")),Ux.setAttribs(e,t.attrs)})(o,t),o},r=(e,t,i)=>{let s;const a=t[0],l=Zx(a)?a.name:void 0,c=((e,t)=>{const n=o.getElementRule(e.nodeName.toLowerCase()),r=null==n?void 0:n.parentsRequired;return!(!r||!r.length)&&(t&&Z(r,t)?t:r[0])})(e,l);if(c)l===c?(s=a,t=t.slice(1)):s=c;else if(a)s=a,t=t.slice(1);else if(!i)return e;const d=s?n(s):Ux.create("div");d.appendChild(e),i&&ao.each(i,t=>{const o=n(t);d.insertBefore(o,e)});const u=Zx(s)?s.siblings:void 0;return r(d,t,u)},i=Ux.create("div");if(e.length>0){const t=e[0],o=n(t),s=Zx(t)?t.siblings:void 0;i.appendChild(r(o,e.slice(1),s))}return i},jx=e=>{let t="div";const o={name:t,classes:[],attrs:{},selector:e=ao.trim(e)};return"*"!==e&&(t=e.replace(/(?:([#\.]|::?)([\w\-]+)|(\[)([^\]]+)\]?)/g,(e,t,n,r,i)=>{switch(t){case"#":o.attrs.id=n;break;case".":o.classes.push(n);break;case":":-1!==ao.inArray("checked disabled enabled read-only required".split(" "),n)&&(o.attrs[n]=n)}if("["===r){const e=i.match(/([\w\-]+)(?:\=\"([^\"]+))?/);e&&(o.attrs[e[1]]=e[2])}return""})),o.name=t||"div",o},Wx=(e,t)=>{let o="",n=gd(e);if(""===n)return"";const r=e=>m(e)?e.replace(/%(\w+)/g,""):"",i=(t,o)=>Ux.getStyle(null!=o?o:e.getBody(),t,!0);if(m(t)){const o=e.formatter.get(t);if(!o)return"";t=o[0]}if("preview"in t){const e=t.preview;if(!1===e)return"";n=e||n}let s,a=t.block||t.inline||"span";const l=(c=t.selector,m(c)?(c=(c=c.split(/\s*,\s*/)[0]).replace(/\s*(~\+|~|\+|>)\s*/g,"$1"),ao.map(c.split(/(?:>|\s+(?![^\[\]]+\]))/),e=>{const t=ao.map(e.split(/(?:~\+|~|\+)/),jx),o=t.pop();return t.length&&(o.siblings=t),o}).reverse()):[]);var c;l.length>0?(l[0].name||(l[0].name=a),a=t.selector,s=$x(l,e)):s=$x([a],e);const d=Ux.select(a,s)[0]||s.firstChild;Hx(t.styles,(e,t)=>{const o=r(e);o&&Ux.setStyle(d,t,o)}),Hx(t.attributes,(e,t)=>{const o=r(e);o&&Ux.setAttrib(d,t,o)}),Hx(t.classes,e=>{const t=r(e);Ux.hasClass(d,t)||Ux.addClass(d,t)}),e.dispatch("PreviewFormats"),Ux.setStyles(s,{position:"absolute",left:-65535}),e.getBody().appendChild(s);const u=i("fontSize"),h=/px$/.test(u)?parseInt(u,10):0;return Hx(n.split(" "),e=>{let t=i(e,d);if(!("background-color"===e&&/transparent|rgba\s*\([^)]+,\s*0\)/.test(t)&&(t=i(e),"#ffffff"===Ls(t).toLowerCase())||"color"===e&&"#000000"===Ls(t).toLowerCase())){if("font-size"===e&&/em|%$/.test(t)){if(0===h)return;t=parseFloat(t)/(/%$/.test(t)?100:1)*h+"px"}"border"===e&&t&&(o+="padding:0 2px;"),o+=e+":"+t+";"}}),e.dispatch("AfterPreviewFormats"),Ux.remove(s),o},qx=e=>{const t=(e=>{const t={},o=(e,n)=>{e&&(m(e)?(f(n)||(n=[n]),W(n,e=>{y(e.deep)&&(e.deep=!Cm(e)),y(e.split)&&(e.split=!Cm(e)||km(e)),y(e.remove)&&Cm(e)&&!km(e)&&(e.remove="none"),Cm(e)&&km(e)&&(e.mixed=!0,e.block_expand=!0),m(e.classes)&&(e.classes=e.classes.split(/\s+/))}),t[e]=n):fe(e,(e,t)=>{o(t,e)}))};return o((e=>{const t=e.dom,o=e.schema.type,n={valigntop:[{selector:"td,th",styles:{verticalAlign:"top"}}],valignmiddle:[{selector:"td,th",styles:{verticalAlign:"middle"}}],valignbottom:[{selector:"td,th",styles:{verticalAlign:"bottom"}}],alignleft:[{selector:"figure.image",collapsed:!1,classes:"align-left",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"left"},inherit:!1,preview:!1},{selector:"img,audio,video",collapsed:!1,styles:{float:"left"},preview:"font-family font-size"},{selector:".mce-placeholder",styles:{float:"left"},ceFalseOverride:!0},{selector:"table",collapsed:!1,styles:{marginLeft:"0px",marginRight:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"left"}}],aligncenter:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"center"},inherit:!1,preview:"font-family font-size"},{selector:"figure.image",collapsed:!1,classes:"align-center",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{display:"block",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:".mce-placeholder",styles:{display:"block",marginLeft:"auto",marginRight:"auto"},ceFalseOverride:!0},{selector:"table",collapsed:!1,styles:{marginLeft:"auto",marginRight:"auto"},preview:"font-family font-size"},{selector:".mce-preview-object",ceFalseOverride:!0,styles:{display:"table",marginLeft:"auto",marginRight:"auto"},preview:!1},{selector:"[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{marginLeft:"auto",marginRight:"auto"},preview:!1}],alignright:[{selector:"figure.image",collapsed:!1,classes:"align-right",ceFalseOverride:!0,preview:"font-family font-size"},{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"right"},inherit:!1,preview:"font-family font-size"},{selector:"img,audio,video",collapsed:!1,styles:{float:"right"},preview:"font-family font-size"},{selector:".mce-placeholder",styles:{float:"right"},ceFalseOverride:!0},{selector:"table",collapsed:!1,styles:{marginRight:"0px",marginLeft:"auto"},onformat:e=>{t.setStyle(e,"float",null)},preview:"font-family font-size"},{selector:".mce-preview-object,[data-ephox-embed-iri]",ceFalseOverride:!0,styles:{float:"right"},preview:!1}],alignjustify:[{selector:"figure,p,h1,h2,h3,h4,h5,h6,td,th,tr,div,ul,ol,li,pre",styles:{textAlign:"justify"},inherit:!1,preview:"font-family font-size"}],bold:[{inline:"strong",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontWeight:"bold"}},{inline:"b",remove:"all",preserve_attributes:["class","style"]}],italic:[{inline:"em",remove:"all",preserve_attributes:["class","style"]},{inline:"span",styles:{fontStyle:"italic"}},{inline:"i",remove:"all",preserve_attributes:["class","style"]}],underline:[{inline:"span",styles:{textDecoration:"underline"},exact:!0},{inline:"u",remove:"all",preserve_attributes:["class","style"]}],strikethrough:(()=>{const e={inline:"span",styles:{textDecoration:"line-through"},exact:!0},t={inline:"strike",remove:"all",preserve_attributes:["class","style"]},n={inline:"s",remove:"all",preserve_attributes:["class","style"]};return"html4"!==o?[n,e,t]:[e,n,t]})(),forecolor:{inline:"span",styles:{color:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},hilitecolor:{inline:"span",styles:{backgroundColor:"%value"},links:!0,remove_similar:!0,clear_child_styles:!0},fontname:{inline:"span",toggle:!1,styles:{fontFamily:"%value"},clear_child_styles:!0},fontsize:{inline:"span",toggle:!1,styles:{fontSize:"%value"},clear_child_styles:!0},lineheight:{selector:"h1,h2,h3,h4,h5,h6,p,li,td,th,div",styles:{lineHeight:"%value"}},fontsize_class:{inline:"span",attributes:{class:"%value"}},blockquote:{block:"blockquote",wrapper:!0,remove:"all"},subscript:{inline:"sub"},superscript:{inline:"sup"},code:{inline:"code"},samp:{inline:"samp"},link:{inline:"a",selector:"a",remove:"all",split:!0,deep:!0,onmatch:(e,t,o)=>Wr(e)&&e.hasAttribute("href"),onformat:(e,o,n)=>{ao.each(n,(o,n)=>{t.setAttrib(e,n,o)})}},lang:{inline:"span",clear_child_styles:!0,remove_similar:!0,attributes:{lang:"%value","data-mce-lang":e=>{var t;return null!==(t=null==e?void 0:e.customValue)&&void 0!==t?t:null}}},removeformat:[{selector:"b,strong,em,i,font,u,strike,s,sub,sup,dfn,code,samp,kbd,var,cite,mark,q,del,ins,small",remove:"all",split:!0,expand:!1,block_expand:!0,deep:!0},{selector:"span",attributes:["style","class"],remove:"empty",split:!0,expand:!1,deep:!0},{selector:"*",attributes:["style","class"],split:!1,expand:!1,deep:!0}]};return ao.each("p h1 h2 h3 h4 h5 h6 div address pre dt dd".split(/\s/),e=>{n[e]={block:e,remove:"all"}}),n})(e)),o(zx()),o(pd(e)),{get:e=>_(e)?t[e]:t,has:e=>Se(t,e),register:o,unregister:e=>(e&&t[e]&&delete t[e],t)}})(e),o=Oe({});return(e=>{e.addShortcut("meta+b","","Bold"),e.addShortcut("meta+i","","Italic"),e.addShortcut("meta+u","","Underline");for(let t=1;t<=6;t++)e.addShortcut("access+"+t,"",["FormatBlock",!1,"h"+t]);e.addShortcut("access+7","",["FormatBlock",!1,"p"]),e.addShortcut("access+8","",["FormatBlock",!1,"div"]),e.addShortcut("access+9","",["FormatBlock",!1,"address"])})(e),(e=>{e.on("mouseup keydown",t=>{var o;((e,t,o)=>{const n=e.selection,r=e.getBody();fb(e,null,o),8!==t&&46!==t||!n.isCollapsed()||n.getStart().innerHTML!==hb||fb(e,Rh(r,n.getStart()),!0),37!==t&&39!==t||fb(e,Rh(r,n.getStart()),!0)})(e,t.keyCode,(o=e.selection.getRng().endContainer,ti(o)&&Xe(o.data,lt)))})})(e),M_(e)||((e,t)=>{e.set({}),t.on("NodeChange",o=>{my(t,o.element,e.get())}),t.on("FormatApply FormatRemove",o=>{const n=L.from(o.node).map(e=>sm(e)?e:e.startContainer).bind(e=>Wr(e)?L.some(e):L.from(e.parentElement)).getOrThunk(()=>dy(t));my(t,n,e.get())})})(o,e),{get:t.get,has:t.has,register:t.register,unregister:t.unregister,apply:(t,o,n)=>{((e,t,o,n)=>{R_(e).formatter.apply(t,o,n)})(e,t,o,n)},remove:(t,o,n,r)=>{((e,t,o,n,r)=>{R_(e).formatter.remove(t,o,n,r)})(e,t,o,n,r)},toggle:(t,o,n)=>{((e,t,o,n)=>{R_(e).formatter.toggle(t,o,n)})(e,t,o,n)},match:(t,o,n,r)=>((e,t,o,n,r)=>R_(e).formatter.match(t,o,n,r))(e,t,o,n,r),closest:t=>((e,t)=>R_(e).formatter.closest(t))(e,t),matchAll:(t,o)=>((e,t,o)=>R_(e).formatter.matchAll(t,o))(e,t,o),matchNode:(t,o,n,r)=>((e,t,o,n,r)=>R_(e).formatter.matchNode(t,o,n,r))(e,t,o,n,r),canApply:t=>((e,t)=>R_(e).formatter.canApply(t))(e,t),formatChanged:(t,n,r,i)=>((e,t,o,n,r,i)=>R_(e).formatter.formatChanged(t,o,n,r,i))(e,o,t,n,r,i),getCssText:B(Wx,e)}},Gx=e=>{switch(e.toLowerCase()){case"undo":case"redo":case"mcefocus":return!0;default:return!1}},Yx=e=>{const t=je(),o=Oe(0),n=Oe(0),r={data:[],typing:!1,beforeChange:()=>{((e,t,o)=>{R_(e).undoManager.beforeChange(t,o)})(e,o,t)},add:(i,s)=>((e,t,o,n,r,i,s)=>R_(e).undoManager.add(t,o,n,r,i,s))(e,r,n,o,t,i,s),dispatchChange:()=>{e.setDirty(!0);const t=__(e);t.bookmark=oc(e.selection),e.dispatch("change",{level:t,lastLevel:le(r.data,n.get()).getOrUndefined()})},undo:()=>((e,t,o,n)=>R_(e).undoManager.undo(t,o,n))(e,r,o,n),redo:()=>((e,t,o)=>R_(e).undoManager.redo(t,o))(e,n,r.data),clear:()=>{((e,t,o)=>{R_(e).undoManager.clear(t,o)})(e,r,n)},reset:()=>{((e,t)=>{R_(e).undoManager.reset(t)})(e,r)},hasUndo:()=>((e,t,o)=>R_(e).undoManager.hasUndo(t,o))(e,r,n),hasRedo:()=>((e,t,o)=>R_(e).undoManager.hasRedo(t,o))(e,r,n),transact:t=>((e,t,o,n)=>R_(e).undoManager.transact(t,o,n))(e,r,o,t),ignore:t=>{((e,t,o)=>{R_(e).undoManager.ignore(t,o)})(e,o,t)},extra:(t,o)=>{((e,t,o,n,r)=>{R_(e).undoManager.extra(t,o,n,r)})(e,r,n,t,o)}};return M_(e)||((e,t,o)=>{const n=Oe(!1),r=e=>{E_(t,!1,o),t.add({},e)};e.on("init",()=>{t.add()}),e.on("BeforeExecCommand",e=>{const n=e.command;Gx(n)||(O_(t,o),t.beforeChange())}),e.on("ExecCommand",e=>{const t=e.command;Gx(t)||r(e)}),e.on("ObjectResizeStart cut",()=>{t.beforeChange()}),e.on("SaveContent ObjectResized blur",r),e.on("dragend",r),e.on("keyup",o=>{const i=o.keyCode;if(o.isDefaultPrevented())return;const s=no.os.isMacOS()&&"Meta"===o.key;(i>=33&&i<=36||i>=37&&i<=40||45===i||o.ctrlKey||s)&&(r(),e.nodeChanged()),46!==i&&8!==i||e.nodeChanged(),n.get()&&t.typing&&!S_(__(e),t.data[0])&&(e.isDirty()||e.setDirty(!0),e.dispatch("TypingUndo"),n.set(!1),e.nodeChanged())}),e.on("keydown",e=>{const i=e.keyCode;if(e.isDefaultPrevented())return;if(i>=33&&i<=36||i>=37&&i<=40||45===i)return void(t.typing&&r(e));const s=e.ctrlKey&&!e.altKey||e.metaKey;if((i<16||i>20)&&224!==i&&91!==i&&!t.typing&&!s)return t.beforeChange(),E_(t,!0,o),t.add({},e),void n.set(!0);(no.os.isMacOS()?e.metaKey:e.ctrlKey&&!e.altKey)&&t.beforeChange()}),e.on("mousedown",e=>{t.typing&&r(e)}),e.on("input",e=>{var t;e.inputType&&("insertReplacementText"===e.inputType||"insertText"===(t=e).inputType&&null===t.data||(e=>"insertFromPaste"===e.inputType||"insertFromDrop"===e.inputType)(e))&&r(e)}),e.on("AddUndo Undo Redo ClearUndos",t=>{t.isDefaultPrevented()||e.nodeChanged()})})(e,r,o),(e=>{e.addShortcut("meta+z","","Undo"),e.addShortcut("meta+y,meta+shift+z","","Redo")})(e),r},Xx=[9,27,Cp.HOME,Cp.END,19,20,44,144,145,33,34,45,16,17,18,91,92,93,Cp.DOWN,Cp.UP,Cp.LEFT,Cp.RIGHT].concat(no.browser.isFirefox()?[224]:[]),Kx="data-mce-placeholder",Jx=e=>"keydown"===e.type||"keyup"===e.type,Qx=e=>{const t=e.keyCode;return t===Cp.BACKSPACE||t===Cp.DELETE},eC=(e,t)=>({from:e,to:t}),tC=(e,t)=>{const o=mo(e),n=mo(t.container());return Qf(o,n).map(e=>((e,t)=>({block:e,position:t}))(e,t))},oC=(e,t)=>or(t,e=>Ba(e)||di(e.dom),t=>_o(t,e)).filter(Oo).getOr(e),nC=(e,t)=>{const o=((e,t)=>{const o=Zo(e);return ee(o,e=>t.isBlock(ko(e))).fold(O(o),e=>o.slice(0,e))})(e,t);return W(o,Cn),o},rC=(e,t,o)=>{const n=ef(o,t);return Q(n.reverse(),t=>ki(e,t)).each(Cn)},iC=(e,t,o,n,r)=>{if(ki(n,o))return Va(o),Oh(o.dom);((e,t)=>0===Y(Ho(t),t=>!ki(e,t)).length)(n,r)&&ki(n,t)&&ln(r,uo("br"));const i=Eh(o.dom,Dl.before(r.dom));return W(nC(t,n),e=>{ln(r,e)}),rC(n,e,t),i},sC=(e,t,o,n)=>{if(ki(n,o)){if(ki(n,t)){const e=e=>{const t=(e,o)=>jo(e).fold(()=>o,e=>((e,t)=>e.isInline(ko(t)))(n,e)?t(e,o.concat(Tn(e))):o);return t(e,[])},r=X(e(o),(e,t)=>(hn(e,t),t),Na());xn(t),un(t,r)}return Cn(o),Oh(t.dom)}const r=Ah(o.dom);return W(nC(t,n),e=>{un(o,e)}),rC(n,e,t),r},aC=(e,t)=>{Sh(e,t.dom).bind(e=>L.from(e.getNode())).map(mo).filter(Ta).each(Cn)},lC=(e,t,o,n)=>(aC(!0,t),aC(!1,o),((e,t)=>xo(t,e)?((e,t)=>{const o=ef(t,e);return L.from(o[o.length-1])})(t,e):L.none())(t,o).fold(B(sC,e,t,o,n),B(iC,e,t,o,n))),cC=(e,t,o,n,r)=>t?lC(e,n,o,r):lC(e,o,n,r),dC=(e,t)=>{const o=mo(e.getBody()),n=((e,t,o,n)=>n.collapsed?((e,t,o,n)=>{const r=tC(t,Dl.fromRangeStart(n)),i=r.bind(n=>xh(o,t,n.position).bind(n=>tC(t,n).map(n=>((e,t,o,n)=>ai(n.position.getNode())&&!ki(e,n.block)?Sh(!1,n.block.dom).bind(e=>e.isEqual(n.position)?xh(o,t,e).bind(e=>tC(t,e)):L.some(n)).getOr(n):n)(e,t,o,n))));return He(r,i,eC).filter(e=>(e=>!_o(e.from.block,e.to.block))(e)&&((e,t)=>{const o=mo(e);return _o(oC(o,t.from.block),oC(o,t.to.block))})(t,e)&&(e=>!1===ui(e.from.block.dom)&&!1===ui(e.to.block.dom))(e)&&(e=>{const t=e=>Ea(e)||Fi(e.dom)||Aa(e);return t(e.from.block)&&t(e.to.block)})(e)&&(e=>!(xo(e.to.block,e.from.block)||xo(e.from.block,e.to.block)))(e))})(e,t,o,n):L.none())(e.schema,o.dom,t,e.selection.getRng()).map(n=>()=>{cC(o,t,n.from.block,n.to.block,e.schema).each(t=>{e.selection.setRng(t.toRange())})});return n},uC=(e,t)=>{const o=mo(t),n=B(_o,e);return tr(o,Ba,n).isSome()},hC=e=>{const t=mo(e.getBody());return((e,t)=>{const o=Eh(e.dom,Dl.fromRangeStart(t)).isNone(),n=Th(e.dom,Dl.fromRangeEnd(t)).isNone();return!((e,t)=>uC(e,t.startContainer)||uC(e,t.endContainer))(e,t)&&o&&n})(t,e.selection.getRng())?(e=>L.some(()=>{e.setContent(""),e.selection.setCursorLocation()}))(e):((e,t,o)=>{const n=t.getRng();return He(Qf(e,mo(n.startContainer)),Qf(e,mo(n.endContainer)),(r,i)=>_o(r,i)?L.none():L.some(()=>{n.deleteContents(),cC(e,!0,r,i,o).each(e=>{t.setRng(e.toRange())})})).getOr(L.none())})(t,e.selection,e.schema)},mC=(e,t)=>e.selection.isCollapsed()?L.none():hC(e),pC=(e,t,o,n,r)=>L.from(t._selectionOverrides.showCaret(e,o,n,r)),gC=(e,t)=>e.dispatch("BeforeObjectSelected",{target:t}).isDefaultPrevented()?L.none():L.some((e=>{const t=e.ownerDocument.createRange();return t.selectNode(e),t})(t)),fC=(e,t,o)=>t.collapsed?((e,t,o)=>{const n=oh(1,e.getBody(),t),r=Dl.fromRangeStart(n),i=r.getNode();if(Nu(i))return pC(1,e,i,!r.isAtEnd(),!1);const s=r.getNode(!0);if(Nu(s))return pC(1,e,s,!1,!1);const a=Mv(e.dom.getRoot(),r.getNode());return Nu(a)?pC(1,e,a,!1,o):L.none()})(e,t,o).getOr(t):t,vC=e=>Kg(e)||qg(e),bC=e=>Jg(e)||Gg(e),yC=(e,t,o,n,r,i)=>{pC(n,e,i.getNode(!r),r,!0).each(o=>{if(t.collapsed){const e=t.cloneRange();r?e.setEnd(o.startContainer,o.startOffset):e.setStart(o.endContainer,o.endOffset),e.deleteContents()}else t.deleteContents();e.selection.setRng(o)}),((e,t)=>{ti(t)&&0===t.data.length&&e.remove(t)})(e.dom,o)},wC=(e,t)=>((e,t)=>{const o=e.selection.getRng();if(!ti(o.commonAncestorContainer))return L.none();const n=t?1:-1,r=bh(e.getBody()),i=B(sh,t?r.next:r.prev),s=t?vC:bC,a=rh(n,e.getBody(),o),l=i(a),c=l?Wf(t,l):l;if(!c||!ah(a,c))return L.none();if(s(c))return L.some(()=>yC(e,o,a.getNode(),n,t,c));const d=i(c);return d&&s(d)&&ah(c,d)?L.some(()=>yC(e,o,a.getNode(),n,t,d)):L.none()})(e,t),_C=(e,t)=>{const o=e.getBody();return t?Oh(o).filter(Kg):Ah(o).filter(Jg)},xC=e=>{const t=e.selection.getRng();return!t.collapsed&&(_C(e,!0).exists(e=>e.isEqual(Dl.fromRangeStart(t)))||_C(e,!1).exists(e=>e.isEqual(Dl.fromRangeEnd(t))))},CC=Ee([{remove:["element"]},{moveToElement:["element"]},{moveToPosition:["position"]}]),kC=(e,t,o,n)=>xh(t,e,o).bind(r=>{return i=r.getNode(),_(i)&&(Ba(mo(i))||Aa(mo(i)))||((e,t,o,n,r)=>{const i=t=>r.isInline(t.nodeName.toLowerCase())&&!Yu(o,n,e);return nh(!t,o).fold(()=>nh(t,n).fold(P,i),i)})(e,t,o,r,n)?L.none():t&&ui(r.getNode())||!t&&ui(r.getNode(!0))?((e,t,o,n,r)=>{const i=r.getNode(!o);return Qf(mo(t),mo(n.getNode())).map(t=>ki(e,t)?CC.remove(t.dom):CC.moveToElement(i)).orThunk(()=>L.some(CC.moveToElement(i)))})(n,e,t,o,r):t&&Jg(o)||!t&&Kg(o)?L.some(CC.moveToPosition(r)):L.none();var i}),SC=(e,t)=>L.from(Mv(e.getBody(),t)),TC=(e,t)=>{const o=e.selection.getNode();return SC(e,o).filter(ui).fold(()=>((e,t,o,n)=>{const r=oh(t?1:-1,e,o),i=Dl.fromRangeStart(r),s=mo(e);return!t&&Jg(i)?L.some(CC.remove(i.getNode(!0))):t&&Kg(i)?L.some(CC.remove(i.getNode())):!t&&Kg(i)&&mf(s,i,n)?pf(s,i,n).map(e=>CC.remove(e.getNode())):t&&Jg(i)&&hf(s,i,n)?gf(s,i,n).map(e=>CC.remove(e.getNode())):((e,t,o,n)=>((e,t)=>{const o=t.getNode(!e),n=e?"after":"before";return Wr(o)&&o.getAttribute("data-mce-caret")===n})(t,o)?((e,t)=>w(t)?L.none():e&&ui(t.nextSibling)?L.some(CC.moveToElement(t.nextSibling)):!e&&ui(t.previousSibling)?L.some(CC.moveToElement(t.previousSibling)):L.none())(t,o.getNode(!t)).orThunk(()=>kC(e,t,o,n)):kC(e,t,o,n).bind(t=>((e,t,o)=>o.fold(e=>L.some(CC.remove(e)),e=>L.some(CC.moveToElement(e)),o=>Yu(t,o,e)?L.none():L.some(CC.moveToPosition(o))))(e,o,t)))(e,t,i,n)})(e.getBody(),t,e.selection.getRng(),e.schema).map(o=>()=>o.fold(((e,t)=>o=>(e._selectionOverrides.hideFakeCaret(),Hf(e,t,mo(o)),!0))(e,t),((e,t)=>o=>{const n=t?Dl.before(o):Dl.after(o);return e.selection.setRng(n.toRange()),!0})(e,t),(e=>t=>(e.selection.setRng(t.toRange()),!0))(e))),()=>L.some(S))},EC=e=>{const t=e.dom,o=e.selection,n=Mv(e.getBody(),o.getNode());if(di(n)&&t.isBlock(n)&&t.isEmpty(n)){const e=t.create("br",{"data-mce-bogus":"1"});t.setHTML(n,""),n.appendChild(e),o.setRng(Dl.before(e).toRange())}return!0},OC=(e,t)=>e.selection.isCollapsed()?TC(e,t):((e,t)=>{const o=e.selection.getNode();return ui(o)&&!mi(o)?SC(e,o.parentNode).filter(ui).fold(()=>L.some(()=>{var o;o=mo(e.getBody()),W(yr(o,".mce-offscreen-selection"),Cn),Hf(e,t,mo(e.selection.getNode())),ev(e)}),()=>L.some(S)):xC(e)?L.some(()=>{nv(e,e.selection.getRng(),mo(e.getBody()))}):L.none()})(e,t),AC=e=>e.hasOwnProperty("text"),MC=e=>e.hasOwnProperty("marker"),BC=(e,t)=>{const o=(e,o)=>{if(ti(e))return{text:e,offset:o};{const n=t(),r=e.childNodes;return o<r.length?(e.insertBefore(n,r[o]),{marker:n,before:!0}):(e.appendChild(n),{marker:n,before:!1})}},n=o(e.endContainer,e.endOffset);return{start:o(e.startContainer,e.startOffset),end:n}},RC=e=>{var t,o;const{start:n,end:r}=e,i=new window.Range;return AC(n)?i.setStart(n.text,n.offset):MC(n)&&(n.before?i.setStartBefore(n.marker):i.setStartAfter(n.marker),null===(t=n.marker.parentNode)||void 0===t||t.removeChild(n.marker)),AC(r)?i.setEnd(r.text,r.offset):MC(r)&&(r.before?i.setEndBefore(r.marker):i.setEndAfter(r.marker),null===(o=r.marker.parentNode)||void 0===o||o.removeChild(r.marker)),i},NC=(e,t)=>{var o;const n=e.dom,r=n.getParent(e.selection.getStart(),n.isBlock),i=n.getParent(e.selection.getEnd(),n.isBlock),s=e.getBody();if("div"===(null===(o=null==r?void 0:r.nodeName)||void 0===o?void 0:o.toLowerCase())&&r&&i&&r===s.firstChild&&i===s.lastChild&&!n.isEmpty(s)){const o=r.cloneNode(!1),n=()=>{if(t?Kf(e):Xf(e),s.firstChild!==r){const t=BC(e.selection.getRng(),()=>document.createElement("span"));Array.from(s.childNodes).forEach(e=>o.appendChild(e)),s.appendChild(o),e.selection.setRng(RC(t))}};return L.some(n)}return L.none()},VC=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const o=Dl.fromRangeStart(e.selection.getRng());return xh(t,e.getBody(),o).filter(e=>t?jg(e):Wg(e)).bind(e=>Xu(t?0:-1,e)).map(t=>()=>e.selection.select(t))})(e,t):L.none(),DC=ti,PC=e=>DC(e)&&e.data[0]===Da,IC=e=>DC(e)&&e.data[e.data.length-1]===Da,LC=e=>{var t;return(null!==(t=e.ownerDocument)&&void 0!==t?t:document).createTextNode(Da)},FC=(e,t)=>e?(e=>{var t;if(DC(e.previousSibling))return IC(e.previousSibling)||e.previousSibling.appendData(Da),e.previousSibling;if(DC(e))return PC(e)||e.insertData(0,Da),e;{const o=LC(e);return null===(t=e.parentNode)||void 0===t||t.insertBefore(o,e),o}})(t):(e=>{var t,o;if(DC(e.nextSibling))return PC(e.nextSibling)||e.nextSibling.insertData(0,Da),e.nextSibling;if(DC(e))return IC(e)||e.appendData(Da),e;{const n=LC(e);return e.nextSibling?null===(t=e.parentNode)||void 0===t||t.insertBefore(n,e.nextSibling):null===(o=e.parentNode)||void 0===o||o.appendChild(n),n}})(t),zC=B(FC,!0),HC=B(FC,!1),UC=(e,t)=>ti(e.container())?FC(t,e.container()):FC(t,e.getNode()),ZC=(e,t)=>{const o=t.get();return o&&e.container()===o&&Ha(o)},$C=(e,t)=>t.fold(t=>{Tu(e.get());const o=zC(t);return e.set(o),L.some(Dl(o,o.length-1))},t=>Oh(t).map(t=>{if(ZC(t,e)){const t=e.get();return Dl(t,1)}{Tu(e.get());const o=UC(t,!0);return e.set(o),Dl(o,1)}}),t=>Ah(t).map(t=>{if(ZC(t,e)){const t=e.get();return Dl(t,t.length-1)}{Tu(e.get());const o=UC(t,!1);return e.set(o),Dl(o,o.length-1)}}),t=>{Tu(e.get());const o=HC(t);return e.set(o),L.some(Dl(o,1))}),jC=(e,t)=>{for(let o=0;o<e.length;o++){const n=e[o].apply(null,t);if(n.isSome())return n}return L.none()},WC=Ee([{before:["element"]},{start:["element"]},{end:["element"]},{after:["element"]}]),qC=(e,t)=>Gu(t,e)||e,GC=(e,t,o)=>{const n=qf(o),r=qC(t,n.container());return jf(e,r,n).fold(()=>Th(r,n).bind(B(jf,e,r)).map(e=>WC.before(e)),L.none)},YC=(e,t)=>null===Rh(e,t),XC=(e,t,o)=>jf(e,t,o).filter(B(YC,t)),KC=(e,t,o)=>{const n=Gf(o);return XC(e,t,n).bind(e=>Eh(e,n).isNone()?L.some(WC.start(e)):L.none())},JC=(e,t,o)=>{const n=qf(o);return XC(e,t,n).bind(e=>Th(e,n).isNone()?L.some(WC.end(e)):L.none())},QC=(e,t,o)=>{const n=Gf(o),r=qC(t,n.container());return jf(e,r,n).fold(()=>Eh(r,n).bind(B(jf,e,r)).map(e=>WC.after(e)),L.none)},ek=e=>!$f(ok(e)),tk=(e,t,o)=>jC([GC,KC,JC,QC],[e,t,o]).filter(ek),ok=e=>e.fold(A,A,A,A),nk=e=>e.fold(O("before"),O("start"),O("end"),O("after")),rk=e=>e.fold(WC.before,WC.before,WC.after,WC.after),ik=e=>e.fold(WC.start,WC.start,WC.end,WC.end),sk=(e,t,o,n,r,i)=>He(jf(t,o,n),jf(t,o,r),(t,n)=>t!==n&&((e,t,o)=>{const n=Gu(t,e),r=Gu(o,e);return _(n)&&n===r})(o,t,n)?WC.after(e?t:n):i).getOr(i),ak=(e,t)=>e.fold(I,e=>{return n=t,!(nk(o=e)===nk(n)&&ok(o)===ok(n));var o,n}),lk=(e,t)=>e?t.fold(T(L.some,WC.start),L.none,T(L.some,WC.after),L.none):t.fold(L.none,T(L.some,WC.before),L.none,T(L.some,WC.end)),ck=(e,t,o)=>{const n=e?1:-1;return t.setRng(Dl(o.container(),o.offset()+n).toRange()),t.getSel().modify("move",e?"forward":"backward","word"),!0};var dk;!function(e){e[e.Br=0]="Br",e[e.Block=1]="Block",e[e.Wrap=2]="Wrap",e[e.Eol=3]="Eol"}(dk||(dk={}));const uk=(e,t)=>-1===e?re(t):t,hk=(e,t,o)=>1===e?t.next(o):t.prev(o),mk=(e,t,o,n)=>ai(n.getNode(1===t))?dk.Br:!1===Yu(o,n)?dk.Block:dk.Wrap,pk=(e,t,o,n)=>{const r=bh(o);let i=n;const s=[];for(;i;){const o=hk(t,r,i);if(!o)break;if(ai(o.getNode(!1)))return 1===t?{positions:uk(t,s).concat([o]),breakType:dk.Br,breakAt:L.some(o)}:{positions:uk(t,s),breakType:dk.Br,breakAt:L.some(o)};if(o.isVisible()){if(e(i,o)){const e=mk(0,t,i,o);return{positions:uk(t,s),breakType:e,breakAt:L.some(o)}}s.push(o),i=o}else i=o}return{positions:uk(t,s),breakType:dk.Eol,breakAt:L.none()}},gk=(e,t,o,n)=>t(o,n).breakAt.map(n=>{const r=t(o,n).positions;return-1===e?r.concat(n):[n].concat(r)}).getOr([]),fk=(e,t)=>K(e,(e,o)=>e.fold(()=>L.some(o),n=>He(ce(n.getClientRects()),ce(o.getClientRects()),(e,r)=>{const i=Math.abs(t-e.left);return Math.abs(t-r.left)<=i?o:n}).or(e)),L.none()),vk=(e,t)=>ce(t.getClientRects()).bind(t=>fk(e,t.left)),bk=B(pk,Dl.isAbove,-1),yk=B(pk,Dl.isBelow,1),wk=B(gk,-1,bk),_k=B(gk,1,yk),xk=(e,t)=>bk(e,t).breakAt.isNone(),Ck=(e,t)=>yk(e,t).breakAt.isNone(),kk=(e,t)=>vk(wk(e,t),t),Sk=(e,t)=>vk(_k(e,t),t),Tk=ui,Ek=(e,t)=>Math.abs(e.left-t),Ok=(e,t)=>Math.abs(e.right-t),Ak=(e,t)=>ft(e,(e,o)=>{const n=Math.min(Ek(e,t),Ok(e,t)),r=Math.min(Ek(o,t),Ok(o,t));return r===n&&Te(o,"node")&&Tk(o.node)||r<n?o:e}),Mk=e=>{const t=t=>j(t,t=>{const o=Ka(t);return o.node=e,o});if(Wr(e))return t(e.getClientRects());if(ti(e)){const o=e.ownerDocument.createRange();return o.setStart(e,0),o.setEnd(e,e.data.length),t(o.getClientRects())}return[]},Bk=e=>oe(e,Mk);var Rk;!function(e){e[e.Up=-1]="Up",e[e.Down=1]="Down"}(Rk||(Rk={}));const Nk=(e,t,o,n,r,i)=>{let s=0;const a=[],l=n=>{let i=Bk([n]);e===Rk.Up&&(i=i.reverse());for(let e=0;e<i.length;e++){const n=i[e];if(!o(n,c)){if(a.length>0&&t(n,bt(a))&&s++,n.line=s,r(n))return!0;a.push(n)}}return!1},c=bt(i.getClientRects());if(!c)return a;const d=i.getNode();return d&&(l(d),((e,t,o,n)=>{let r=n;for(;r=qu(r,e,vl,t);)if(o(r))return})(e,n,l,d)),a},Vk=B(Nk,Rk.Up,el,tl),Dk=B(Nk,Rk.Down,tl,el),Pk=e=>bt(e.getClientRects()),Ik=e=>t=>((e,t)=>t.line>e)(e,t),Lk=e=>t=>((e,t)=>t.line===e)(e,t),Fk=(e,t)=>{e.selection.setRng(t),og(e,e.selection.getRng())},zk=(e,t,o)=>L.some(fC(e,t,o)),Hk=(e,t,o,n,r,i)=>{const s=1===t,a=bh(e.getBody()),l=B(sh,s?a.next:a.prev),c=s?n:r;if(!o.collapsed){const n=nl(o);if(i(n))return pC(t,e,n,-1===t,!1);if(xC(e)){const e=o.cloneRange();return e.collapse(-1===t),L.from(e)}}const d=rh(t,e.getBody(),o);if(c(d))return gC(e,d.getNode(!s));let u=l(d);const h=Ya(o);if(!u)return h?L.some(o):L.none();if(u=Wf(s,u),c(u))return pC(t,e,u.getNode(!s),s,!1);const m=l(u);return m&&c(m)&&ah(u,m)?pC(t,e,m.getNode(!s),s,!1):h?zk(e,u.toRange(),!1):L.none()},Uk=(e,t,o,n,r,i)=>{const s=rh(t,e.getBody(),o),a=bt(s.getClientRects()),l=t===Rk.Down,c=e.getBody();if(!a)return L.none();if(xC(e)){const e=l?Dl.fromRangeEnd(o):Dl.fromRangeStart(o);return(l?Sk:kk)(c,e).orThunk(()=>L.from(e)).map(e=>e.toRange())}const d=(l?Dk:Vk)(c,Ik(1),s),u=Y(d,Lk(1)),h=a.left,m=Ak(u,h);if(m&&i(m.node)){const o=Math.abs(h-m.left),n=Math.abs(h-m.right);return pC(t,e,m.node,o<n,!1)}let p;if(p=n(s)?s.getNode():r(s)?s.getNode(!0):nl(o),p){const o=((e,t,o,n)=>{const r=bh(t);let i,s,a,l;const c=[];let d=0;e===Rk.Down?(i=r.next,s=tl,a=el,l=Dl.after(n)):(i=r.prev,s=el,a=tl,l=Dl.before(n));const u=Pk(l);do{if(!l.isVisible())continue;const e=Pk(l);if(a(e,u))continue;c.length>0&&s(e,bt(c))&&d++;const t=Ka(e);if(t.position=l,t.line=d,o(t))return c;c.push(t)}while(l=i(l));return c})(t,c,Ik(1),p);let n=Ak(Y(o,Lk(1)),h);if(n)return zk(e,n.position.toRange(),!1);if(n=bt(Y(o,Lk(0))),n)return zk(e,n.position.toRange(),!1)}return 0===u.length?Zk(e,l).filter(l?r:n).map(t=>fC(e,t.toRange(),!1)):L.none()},Zk=(e,t)=>{const o=e.selection.getRng(),n=t?Dl.fromRangeEnd(o):Dl.fromRangeStart(o),r=(i=n.container(),s=e.getBody(),tr(mo(i),e=>Du(e.dom),e=>e.dom===s).map(e=>e.dom).getOr(s));var i,s;if(t){const e=yk(r,n);return de(e.positions)}{const e=bk(r,n);return ce(e.positions)}},$k=(e,t,o)=>Zk(e,t).filter(o).exists(t=>(e.selection.setRng(t.toRange()),!0)),jk=(e,t)=>{const o=e.dom.createRng();o.setStart(t.container(),t.offset()),o.setEnd(t.container(),t.offset()),e.selection.setRng(o)},Wk=(e,t)=>{e?t.setAttribute("data-mce-selected","inline-boundary"):t.removeAttribute("data-mce-selected")},qk=(e,t,o)=>$C(t,o).map(t=>(jk(e,t),o)),Gk=(e,t,o)=>{const n=e.getBody(),r=((e,t,o)=>{const n=Dl.fromRangeStart(e);if(e.collapsed)return n;{const r=Dl.fromRangeEnd(e);return o?Eh(t,r).getOr(r):Th(t,n).getOr(n)}})(e.selection.getRng(),n,o);return((e,t,o,n)=>{const r=Wf(e,n),i=tk(t,o,r);return tk(t,o,r).bind(B(lk,e)).orThunk(()=>((e,t,o,n,r)=>{const i=Wf(e,r);return xh(e,o,i).map(B(Wf,e)).fold(()=>n.map(rk),r=>tk(t,o,r).map(B(sk,e,t,o,i,r)).filter(B(ak,n))).filter(ek)})(e,t,o,i,n))})(o,B(Zf,e),n,r).bind(o=>qk(e,t,o))},Yk=(e,t,o)=>!!md(e)&&Gk(e,t,o).isSome(),Xk=(e,t,o)=>!!md(t)&&((e,t)=>{const o=t.selection.getRng(),n=e?Dl.fromRangeEnd(o):Dl.fromRangeStart(o);return!!(e=>x(e.selection.getSel().modify))(t)&&(e&&$a(n)?ck(!0,t.selection,n):!(e||!ja(n))&&ck(!1,t.selection,n))})(e,t),Kk=e=>{const t=Oe(null),o=B(Zf,e);return e.on("NodeChange",n=>{md(e)&&(((e,t,o)=>{const n=j(yr(mo(t.getRoot()),'*[data-mce-selected="inline-boundary"]'),e=>e.dom),r=Y(n,e),i=Y(o,e);W(ie(r,i),B(Wk,!1)),W(ie(i,r),B(Wk,!0))})(o,e.dom,n.parents),((e,t)=>{const o=t.get();if(e.selection.isCollapsed()&&!e.composing&&o){const n=Dl.fromRangeStart(e.selection.getRng());Dl.isTextPosition(n)&&!(e=>$a(e)||ja(e))(n)&&(jk(e,Su(o,n)),t.set(null))}})(e,t),((e,t,o,n)=>{if(t.selection.isCollapsed()){const r=Y(n,e);W(r,n=>{const r=Dl.fromRangeStart(t.selection.getRng());tk(e,t.getBody(),r).bind(e=>qk(t,o,e))})}})(o,e,t,n.parents))}),t},Jk=B(Xk,!0),Qk=B(Xk,!1),eS=(e,t,o)=>{if(md(e)){const n=Zk(e,t).getOrThunk(()=>{const o=e.selection.getRng();return t?Dl.fromRangeEnd(o):Dl.fromRangeStart(o)});return tk(B(Zf,e),e.getBody(),n).exists(t=>{const n=rk(t);return $C(o,n).exists(t=>(jk(e,t),!0))})}return!1},tS=(e,t)=>o=>$C(t,o).map(t=>()=>jk(e,t)),oS=(e,t,o,n)=>{const r=e.getBody(),i=B(Zf,e);e.undoManager.ignore(()=>{e.selection.setRng(((e,t)=>{const o=document.createRange();return o.setStart(e.container(),e.offset()),o.setEnd(t.container(),t.offset()),o})(o,n)),Xf(e),tk(i,r,Dl.fromRangeStart(e.selection.getRng())).map(ik).bind(tS(e,t)).each(D)}),e.nodeChanged()},nS=(e,t,o)=>{if(e.selection.isCollapsed()&&md(e)){const n=Dl.fromRangeStart(e.selection.getRng());return((e,t,o,n)=>{const r=((e,t)=>Gu(t,e)||e)(e.getBody(),n.container()),i=B(Zf,e),s=tk(i,r,n);return s.bind(e=>o?e.fold(O(L.some(ik(e))),L.none,O(L.some(rk(e))),L.none):e.fold(L.none,O(L.some(rk(e))),L.none,O(L.some(ik(e))))).map(tS(e,t)).getOrThunk(()=>{const a=Ch(o,r,n),l=a.bind(e=>tk(i,r,e));return He(s,l,()=>jf(i,r,n).bind(t=>(e=>He(Oh(e),Ah(e),(t,o)=>{const n=Wf(!0,t),r=Wf(!1,o);return Th(e,n).forall(e=>e.isEqual(r))}).getOr(!0))(t)?L.some(()=>{Hf(e,o,mo(t))}):L.none())).getOrThunk(()=>l.bind(()=>a.map(r=>()=>{o?oS(e,t,n,r):oS(e,t,r,n)})))})})(e,t,o,n)}return L.none()},rS=(e,t)=>{const o=mo(e.getBody()),n=mo(e.selection.getStart()),r=ef(n,o);return ee(r,t).fold(O(r),e=>r.slice(0,e))},iS=e=>1===qo(e),sS=(e,t)=>{const o=B(kb,e);return oe(t,e=>o(e)?[e.dom]:[])},aS=e=>{const t=(e=>rS(e,t=>e.schema.isBlock(ko(t))))(e);return sS(e,t)},lS=(e,t)=>{const o=Y((e=>rS(e,t=>e.schema.isBlock(ko(t))||(e=>qo(e)>1)(t)))(e),iS);return de(o).bind(n=>{const r=Dl.fromRangeStart(e.selection.getRng());return tv(t,r,n.dom)&&!Em(n)?L.some(()=>((e,t,o,n)=>{const r=sS(t,n);if(0===r.length)Hf(t,e,o);else{const e=Cb(o.dom,r);t.selection.setRng(e.toRange())}})(t,e,n,o)):L.none()})},cS=(e,t)=>{const o=e.selection.getStart(),n=((e,t)=>{const o=t.parentElement;return ai(t)&&!v(o)&&e.dom.isEmpty(o)})(e,o)||Em(mo(o))?Cb(o,t):((e,t)=>{const{caretContainer:o,caretPosition:n}=xb(t);return e.insertNode(o.dom),n})(e.selection.getRng(),t);e.selection.setRng(n.toRange())},dS=e=>ti(e.startContainer),uS=e=>{const t=e.selection.getRng();return(e=>0===e.startOffset&&dS(e))(t)&&((e,t)=>{const o=t.startContainer.parentElement;return!v(o)&&kb(e,mo(o))})(e,t)&&(e=>(e=>(e=>{const t=e.startContainer.parentNode,o=e.endContainer.parentNode;return!v(t)&&!v(o)&&t.isEqualNode(o)})(e)&&(e=>{const t=e.endContainer;return e.endOffset===(ti(t)?t.length:t.childNodes.length)})(e))(e)||(e=>!e.endContainer.isEqualNode(e.commonAncestorContainer))(e))(t)},hS=(e,t)=>e.selection.isCollapsed()?lS(e,t):(e=>{if(uS(e)){const t=aS(e);return L.some(()=>{Xf(e),((e,t)=>{const o=ie(t,aS(e));o.length>0&&cS(e,o)})(e,t)})}return L.none()})(e),mS=e=>((e=>{const t=e.selection.getRng();return t.collapsed&&(dS(t)||e.dom.isEmpty(t.startContainer))&&!(e=>{return t=mo(e.selection.getStart()),o=e.schema,wr(t,e=>Bh(e.dom),e=>o.isBlock(ko(e)));var t,o})(e)})(e)&&cS(e,[]),!0),pS=(e,t,o)=>_(o)?L.some(()=>{e._selectionOverrides.hideFakeCaret(),Hf(e,t,mo(o))}):L.none(),gS=(e,t)=>e.selection.isCollapsed()?((e,t)=>{const o=t?qg:Gg,n=rh(t?1:-1,e.getBody(),e.selection.getRng());return o(n)?pS(e,t,n.getNode(!t)):L.from(Wf(t,n)).filter(e=>o(e)&&ah(n,e)).bind(o=>pS(e,t,o.getNode(!t)))})(e,t):((e,t)=>{const o=e.selection.getNode();return gi(o)?pS(e,t,o):L.none()})(e,t),fS=e=>nt(null!=e?e:"").getOr(0),vS=(e,t)=>(e||"table"===ko(t)?"margin":"padding")+("rtl"===Pn(t,"direction")?"-right":"-left"),bS=e=>{const t=wS(e);return!e.mode.isReadOnly()&&(t.length>1||((e,t)=>ne(t,t=>{const o=vS(Kc(e),t),n=Ln(t,o).map(fS).getOr(0);return"false"!==e.dom.getContentEditable(t.dom)&&n>0}))(e,t))},yS=e=>Oa(e)||Aa(e),wS=e=>Y(On(e.selection.getSelectedBlocks()),e=>!yS(e)&&!(e=>Po(e).exists(yS))(e)&&or(e,e=>di(e.dom)||ui(e.dom)).exists(e=>di(e.dom))),_S=(e,t)=>{var o,n;if(e.mode.isReadOnly())return;const{dom:r}=e,i=Jc(e),s=null!==(n=null===(o=/[a-z%]+$/i.exec(i))||void 0===o?void 0:o[0])&&void 0!==n?n:"px",a=fS(i),l=Kc(e);W(wS(e),e=>{((e,t,o,n,r,i)=>{const s=vS(o,mo(i)),a=fS(e.getStyle(i,s));if("outdent"===t){const t=Math.max(0,a-n);e.setStyle(i,s,t?t+r:"")}else{const t=a+n+r;e.setStyle(i,s,t)}})(r,t,l,a,s,e.dom)})},xS=e=>_S(e,"outdent"),CS=e=>{if(e.selection.isCollapsed()&&bS(e)){const t=e.dom,o=e.selection.getRng(),n=Dl.fromRangeStart(o),r=t.getParent(o.startContainer,t.isBlock);if(null!==r&&sf(mo(r),n,e.schema))return L.some(()=>xS(e))}return L.none()},kS=(e,t,o)=>he([CS,OC,wC,(e,o)=>nS(e,t,o),dC,Av,VC,gS,mC,hS,NC],t=>t(e,o)).filter(t=>e.selection.isEditable()),SS=e=>void 0===e.touches||1!==e.touches.length?L.none():L.some(e.touches[0]),TS=(e,t)=>Se(e,t.nodeName),ES=(e,t)=>!!ti(t)||!!Wr(t)&&!(TS(e.getBlockElements(),t)||$h(t)||Ui(e,t)||Oi(t)),OS=(e,t)=>{if(ti(t)){if(0===t.data.length)return!0;if(/^\s+$/.test(t.data))return!t.nextSibling||TS(e,t.nextSibling)||Oi(t.nextSibling)}return!1},AS=e=>e.dom.create(Bc(e),Rc(e)),MS=(e,t,o)=>{const n=mo(AS(e)),r=Na();un(n,r),o(t,n);const i=document.createRange();return i.setStartBefore(r.dom),i.setEndBefore(r.dom),i},BS=e=>t=>-1!==(" "+t.attr("class")+" ").indexOf(e),RS=(e,t,o)=>function(n){const r=arguments,i=r[r.length-2],s=i>0?t.charAt(i-1):"";if('"'===s)return n;if(">"===s){const e=t.lastIndexOf("<",i);if(-1!==e&&-1!==t.substring(e,i).indexOf('contenteditable="false"'))return n}return'<span class="'+o+'" data-mce-content="'+e.dom.encode(r[0])+'">'+e.dom.encode("string"==typeof r[1]?r[1]:r[0])+"</span>"},NS=(e,t)=>ne(e,e=>{const o=t.match(e);return null!==o&&o[0].length===t.length}),VS=(e,t)=>{t.hasAttribute("data-mce-caret")&&(Ga(t),e.selection.setRng(e.selection.getRng()),e.selection.scrollIntoView(t))},DS=(e,t)=>{const o=(e=>ir(mo(e.getBody()),"*[data-mce-caret]").map(e=>e.dom).getOrNull())(e);if(o)return"compositionstart"===t.type?(t.preventDefault(),t.stopPropagation(),void VS(e,o)):void(Za(o)&&(VS(e,o),e.undoManager.add()))},PS=ui,IS=(e,t,o)=>{const n=bh(e.getBody()),r=B(sh,1===t?n.next:n.prev);if(o.collapsed){const n=e.dom.getParent(o.startContainer,"PRE");if(!n)return;if(!r(Dl.fromRangeStart(o))){const o=mo((e=>{const t=e.dom.create(Bc(e));return t.innerHTML='<br data-mce-bogus="1">',t})(e));1===t?cn(mo(n),o):ln(mo(n),o),e.selection.select(o.dom,!0),e.selection.collapse()}}},LS=(e,t)=>((e,t)=>{const o=t?1:-1,n=e.selection.getRng();return((e,t,o)=>Hk(t,e,o,Kg,Jg,PS))(o,e,n).orThunk(()=>(IS(e,o,n),L.none()))})(e,((e,t)=>{const o=t?e.getEnd(!0):e.getStart(!0);return $f(o)?!t:t})(e.selection,t)).exists(t=>(Fk(e,t),!0)),FS=(e,t)=>((e,t)=>{const o=t?1:-1,n=e.selection.getRng();return((e,t,o)=>Uk(t,e,o,e=>Kg(e)||Yg(e),e=>Jg(e)||Xg(e),PS))(o,e,n).orThunk(()=>(IS(e,o,n),L.none()))})(e,t).exists(t=>(Fk(e,t),!0)),zS=(e,t)=>$k(e,t,t?Jg:Kg),HS=(e,t)=>_C(e,!t).map(o=>{const n=o.toRange(),r=e.selection.getRng();return t?n.setStart(r.startContainer,r.startOffset):n.setEnd(r.endContainer,r.endOffset),n}).exists(t=>(Fk(e,t),!0)),US=e=>Z(["figcaption"],ko(e)),ZS=(e,t)=>!!e.selection.isCollapsed()&&((e,t)=>{const o=mo(e.getBody()),n=Dl.fromRangeStart(e.selection.getRng());return((e,t,o)=>{const n=B(_o,t);return or(mo(e.container()),e=>o.isBlock(ko(e)),n).filter(US)})(n,o,e.schema).exists(()=>{if(((e,t,o)=>t?Ck(e.dom,o):xk(e.dom,o))(o,t,n)){const n=MS(e,o,t?un:dn);return e.selection.setRng(n),!0}return!1})})(e,t),$S=(e,t)=>((e,t)=>t?L.from(e.dom.getParent(e.selection.getNode(),"details")).map(t=>((e,t)=>{const o=e.selection.getRng(),n=Dl.fromRangeStart(o);return!(e.getBody().lastChild!==t||!Ck(t,n)||(e.execCommand("InsertNewBlockAfter"),0))})(e,t)).getOr(!1):L.from(e.dom.getParent(e.selection.getNode(),"summary")).bind(t=>L.from(e.dom.getParent(t,"details")).map(o=>((e,t,o)=>{const n=e.selection.getRng(),r=Dl.fromRangeStart(n);return!(e.getBody().firstChild!==t||!xk(o,r)||(e.execCommand("InsertNewBlockBefore"),0))})(e,o,t))).getOr(!1))(e,t),jS={shiftKey:!1,altKey:!1,ctrlKey:!1,metaKey:!1,keyCode:0},WS=(e,t)=>t.keyCode===e.keyCode&&t.shiftKey===e.shiftKey&&t.altKey===e.altKey&&t.ctrlKey===e.ctrlKey&&t.metaKey===e.metaKey,qS=(e,...t)=>()=>e.apply(null,t),GS=(e,t)=>Q(((e,t)=>oe((e=>j(e,e=>({...jS,...e})))(e),e=>WS(e,t)?[e]:[]))(e,t),e=>e.action()),YS=(e,t)=>he(((e,t)=>oe((e=>j(e,e=>({...jS,...e})))(e),e=>WS(e,t)?[e]:[]))(e,t),e=>e.action()),XS=(e,t)=>{const o=t?1:-1,n=e.selection.getRng();return Hk(e,o,n,qg,Gg,gi).exists(t=>(Fk(e,t),!0))},KS=(e,t)=>{const o=t?1:-1,n=e.selection.getRng();return Uk(e,o,n,qg,Gg,gi).exists(t=>(Fk(e,t),!0))},JS=(e,t)=>$k(e,t,t?Gg:qg),QS=(e,t,o)=>oe(Zo(e),e=>yo(e,t)?o(e)?[e]:[]:QS(e,t,o)),eT=(e,t)=>sr(e,"table",t),tT=Ee([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),oT={...tT,none:e=>tT.none(e)},nT=(e,t,o,n,r=I)=>{const i=1===n;if(!i&&o<=0)return oT.first(e[0]);if(i&&o>=e.length-1)return oT.last(e[e.length-1]);{const i=o+n,s=e[i];return r(s)?oT.middle(t,s):nT(e,t,i,n,r)}},rT=(e,t)=>eT(e,t).bind(t=>{const o=QS(t,"th,td",I);return ee(o,t=>_o(e,t)).map(e=>({index:e,all:o}))}),iT=De("image"),sT=De("event"),aT=e=>t=>{t[sT]=e},lT=aT(0),cT=aT(2),dT=aT(1),uT=e=>{const t=e;return L.from(t[sT]).exists(e=>0===e)};const hT=De("mode"),mT=e=>t=>{t[hT]=e},pT=(e,t)=>mT(t)(e),gT=mT(0),fT=mT(2),vT=mT(1),bT=e=>t=>{const o=t;return L.from(o[hT]).exists(t=>t===e)},yT=bT(0),wT=bT(1),_T=["none","copy","link","move"],xT=["none","copy","copyLink","copyMove","link","linkMove","move","all","uninitialized"],CT=()=>{const e=new window.DataTransfer;let t="move",o="all";const n={get dropEffect(){return t},set dropEffect(e){Z(_T,e)&&(t=e)},get effectAllowed(){return o},set effectAllowed(e){uT(n)&&Z(xT,e)&&(o=e)},get items(){return((e,t)=>({...t,get length(){return t.length},add:(o,n)=>{if(yT(e)){if(!m(o))return t.add(o);if(!y(n))return t.add(o,n)}return null},remove:o=>{yT(e)&&t.remove(o)},clear:()=>{yT(e)&&t.clear()}}))(n,e.items)},get files(){return wT(n)?Object.freeze({length:0,item:e=>null}):e.files},get types(){return e.types},setDragImage:(t,o,r)=>{var i;yT(n)&&(i={image:t,x:o,y:r},n[iT]=i,e.setDragImage(t,o,r))},getData:t=>wT(n)?"":e.getData(t),setData:(t,o)=>{yT(n)&&e.setData(t,o)},clearData:t=>{yT(n)&&e.clearData(t)}};return gT(n),n},kT=(e,t)=>e.setData("text/html",t),ST=(e,t,o,n,r)=>{const i=yr(mo(o),"td,th,caption").map(e=>e.dom),s=Y(((e,t)=>oe(t,t=>{const o=((e,t)=>({left:e.left-t,top:e.top-t,right:e.right+-2,bottom:e.bottom+-2,width:e.width+t,height:e.height+t}))(Ka(t.getBoundingClientRect()),-1);return[{x:o.left,y:e(o),cell:t},{x:o.right,y:e(o),cell:t}]}))(e,i),e=>t(e,r));return((e,t,o)=>K(e,(e,n)=>e.fold(()=>L.some(n),e=>{const r=Math.sqrt(Math.abs(e.x-t)+Math.abs(e.y-o)),i=Math.sqrt(Math.abs(n.x-t)+Math.abs(n.y-o));return L.some(i<r?n:e)}),L.none()))(s,n,r).map(e=>e.cell)},TT=B(ST,e=>e.bottom,(e,t)=>e.y<t),ET=B(ST,e=>e.top,(e,t)=>e.y>t),OT=(e,t,o)=>{const n=e(t,o);return(e=>e.breakType===dk.Wrap&&0===e.positions.length)(n)||!ai(o.getNode())&&(e=>e.breakType===dk.Br&&1===e.positions.length)(n)?!((e,t,o)=>o.breakAt.exists(o=>e(t,o).breakAt.isSome()))(e,t,n):n.breakAt.isNone()},AT=B(OT,bk),MT=B(OT,yk),BT=(e,t,o,n)=>{const r=e.selection.getRng(),i=t?1:-1;return!(!Ru()||!((e,t,o)=>{const n=Dl.fromRangeStart(t);return Sh(!e,o).exists(e=>e.isEqual(n))})(t,r,o)||(pC(i,e,o,!t,!1).each(t=>{Fk(e,t)}),0))},RT=(e,t,o)=>{const n=((e,t)=>{const o=t.getNode(e);return Jr(o)?L.some(o):L.none()})(!!t,o),r=!1===t;n.fold(()=>Fk(e,o.toRange()),n=>Sh(r,e.getBody()).filter(e=>e.isEqual(o)).fold(()=>Fk(e,o.toRange()),o=>((e,t,o)=>{t.undoManager.transact(()=>{const n=e?cn:ln,r=MS(t,mo(o),n);Fk(t,r)})})(t,e,n)))},NT=(e,t,o,n)=>{const r=e.selection.getRng(),i=Dl.fromRangeStart(r),s=e.getBody();if(!t&&AT(n,i)){const n=((e,t,o)=>((e,t)=>ce(t.getClientRects()).bind(t=>TT(e,t.left,t.top)).bind(e=>{return vk(Ah(o=e).map(e=>bk(o,e).positions.concat(e)).getOr([]),t);var o}))(t,o).orThunk(()=>ce(o.getClientRects()).bind(o=>fk(wk(e,Dl.before(t)),o.left))).getOr(Dl.before(t)))(s,o,i);return RT(e,t,n),!0}if(t&&MT(n,i)){const n=((e,t,o)=>((e,t)=>de(t.getClientRects()).bind(t=>ET(e,t.left,t.top)).bind(e=>{return vk(Oh(o=e).map(e=>[e].concat(yk(o,e).positions)).getOr([]),t);var o}))(t,o).orThunk(()=>ce(o.getClientRects()).bind(o=>fk(_k(e,Dl.after(t)),o.left))).getOr(Dl.after(t)))(s,o,i);return RT(e,t,n),!0}return!1},VT=(e,t,o)=>L.from(e.dom.getParent(e.selection.getNode(),"td,th")).bind(n=>L.from(e.dom.getParent(n,"table")).map(r=>o(e,t,r,n))).getOr(!1),DT=(e,t)=>VT(e,t,BT),PT=(e,t)=>VT(e,t,NT),IT=(e,t,o)=>o.fold(L.none,L.none,(e,t)=>{return(o=t,nr(o,Tr)).map(e=>(e=>{const t=Br.exact(e,0,e,0);return Dr(t)})(e));var o},o=>e.mode.isReadOnly()||!LT(o)?L.none():(e.execCommand("mceTableInsertRowAfter"),FT(e,t,o))),LT=e=>or(e,Ro("table")).exists(gr),FT=(e,t,o)=>{return IT(e,t,(r=HT,rT(n=o,void 0).fold(()=>oT.none(n),e=>nT(e.all,n,e.index,1,r))));var n,r},zT=(e,t,o)=>{return IT(e,t,(r=HT,rT(n=o,void 0).fold(()=>oT.none(),e=>nT(e.all,n,e.index,-1,r))));var n,r},HT=e=>gr(e)||xr(e,UT),UT=e=>Eo(e)&&gr(e),ZT=(e,t)=>{const o=["table","li","dl"],n=mo(e.getBody()),r=e=>{const t=ko(e);return _o(e,n)||Z(o,t)},i=e.selection.getRng();return((e,t)=>((e,t,o=P)=>o(t)?L.none():Z(e,ko(t))?L.some(t):rr(t,e.join(","),e=>yo(e,"table")||o(e)))(["td","th"],e,t))(mo(t?i.endContainer:i.startContainer),r).map(o=>(eT(o,r).each(t=>{e.model.table.clearSelectedCells(t.dom)}),e.selection.collapse(!t),(t?FT:zT)(e,r,o).each(t=>{e.selection.setRng(t)}),!0)).getOr(!1)},$T=(e,t)=>({container:e,offset:t}),jT=ra.DOM,WT=e=>t=>e===t?-1:0,qT=(e,t,o)=>{if(ti(e)&&t>=0)return L.some($T(e,t));{const n=ka(jT);return L.from(n.backwards(e,t,WT(e),o)).map(e=>$T(e.container,e.container.data.length))}},GT=(e,t,o)=>{if(!ti(e))return L.none();const n=e.data;if(t>=0&&t<=n.length)return L.some($T(e,t));{const n=ka(jT);return L.from(n.backwards(e,t,WT(e),o)).bind(e=>{const n=e.container.data;return GT(e.container,t+n.length,o)})}},YT=(e,t,o)=>{if(!ti(e))return L.none();const n=e.data;if(t<=n.length)return L.some($T(e,t));{const r=ka(jT);return L.from(r.forwards(e,t,WT(e),o)).bind(e=>YT(e.container,t-n.length,o))}},XT=(e,t,o,n,r)=>{const i=ka(e,(e=>t=>e.isBlock(t)||Z(["BR","IMG","HR","INPUT"],t.nodeName)||"false"===e.getContentEditable(t))(e));return L.from(i.backwards(t,o,n,r))},KT=e=>""!==e&&-1!=="  \ufeff\f\n\r\t\v".indexOf(e),JT=(e,t)=>e.substring(t.length),QT=(e,t,o,n=!1)=>{if(!(r=t).collapsed||!ti(r.startContainer))return L.none();var r;const i={text:"",offset:0},s=e.getParent(t.startContainer,e.isBlock)||e.getRoot();return XT(e,t.startContainer,t.startOffset,(e,t,r)=>(i.text=r+i.text,i.offset+=t,((e,t,o,n=!1)=>{let r;const i=o.charAt(0);for(r=t-1;r>=0;r--){const s=e.charAt(r);if(!n&&KT(s))return L.none();if(i===s&&Ge(e,o,r,t))break}return L.some(r)})(i.text,i.offset,o,n).getOr(t)),s).bind(e=>{const n=t.cloneRange();if(n.setStart(e.container,e.offset),n.setEnd(t.endContainer,t.endOffset),n.collapsed)return L.none();const r=(e=>Ia(e.toString().replace(/\u00A0/g," ")))(n);return 0!==r.lastIndexOf(o)?L.none():L.some({text:JT(r,o),range:n,trigger:o})})},eE=e=>{if((e=>3===e.nodeType)(e))return $T(e,e.data.length);{const t=e.childNodes;return t.length>0?eE(t[t.length-1]):$T(e,t.length)}},tE=(e,t)=>{const o=e.childNodes;return o.length>0&&t<o.length?tE(o[t],0):o.length>0&&(e=>1===e.nodeType)(e)&&o.length===t?eE(o[o.length-1]):$T(e,t)},oE=(e,t,o,n={})=>{var r;const i=t(),s=null!==(r=e.selection.getRng().startContainer.nodeValue)&&void 0!==r?r:"",a=Y(i.lookupByTrigger(o.trigger),t=>o.text.length>=t.minChars&&t.matches.getOrThunk(()=>(e=>t=>{const o=tE(t.startContainer,t.startOffset);return!((e,t)=>{var o;const n=null!==(o=e.getParent(t.container,e.isBlock))&&void 0!==o?o:e.getRoot();return XT(e,t.container,t.offset,(e,t)=>0===t?-1:t,n).filter(e=>{const t=e.container.data.charAt(e.offset-1);return!KT(t)}).isSome()})(e,o)})(e.dom))(o.range,s,o.text));if(0===a.length)return L.none();const l=Promise.all(j(a,e=>e.fetch(o.text,e.maxResults,n).then(t=>({matchText:o.text,items:t,columns:e.columns,onAction:e.onAction,highlightOn:e.highlightOn}))));return L.some({lookupData:l,context:o})};var nE;!function(e){e[e.Error=0]="Error",e[e.Value=1]="Value"}(nE||(nE={}));const rE=(e,t,o)=>e.stype===nE.Error?t(e.serror):o(e.svalue),iE=e=>({stype:nE.Value,svalue:e}),sE=e=>({stype:nE.Error,serror:e}),aE=rE,lE=e=>p(e)&&pe(e).length>100?" removed due to size":JSON.stringify(e,null,2),cE=(e,t)=>sE([{path:e,getErrorInfo:t}]),dE=e=>({extract:(t,o)=>{return n=e(o),r=e=>((e,t)=>cE(e,O(t)))(t,e),n.stype===nE.Error?r(n.serror):n;var n,r},toString:O("val")}),uE=dE(iE),hE=O(uE),mE=(e,t)=>dE(o=>{const n=typeof o;return e(o)?iE(o):sE(`Expected type: ${t} but got: ${n}`)}),pE=mE(C,"number"),gE=mE(m,"string"),fE=mE(b,"boolean"),vE=mE(x,"function"),bE=e=>{if(Object(e)!==e)return!0;switch({}.toString.call(e).slice(8,-1)){case"Boolean":case"Number":case"String":case"Date":case"RegExp":case"Blob":case"FileList":case"ImageData":case"ImageBitmap":case"ArrayBuffer":return!0;case"Array":case"Object":return Object.keys(e).every(t=>bE(e[t]));default:return!1}};dE(e=>bE(e)?iE(e):sE("Expected value to be acceptable for sending via postMessage"));const yE=e=>({tag:"defaultedThunk",process:O(e)}),wE=(e,t,o)=>{switch(e.tag){case"field":return t(e.key,e.newKey,e.presence,e.prop);case"custom":return o(e.newKey,e.instantiator)}},_E=e=>{const t=(e=>{const t=[],o=[];return W(e,e=>{rE(e,e=>o.push(e),e=>t.push(e))}),{values:t,errors:o}})(e);return t.errors.length>0?(o=t.errors,T(sE,te)(o)):iE(t.values);var o},xE=(e,t,o,n)=>n(ke(e,t).getOrThunk(()=>o(e))),CE=(e,t,o,n,r)=>{const i=e=>r.extract(t.concat([n]),e),s=e=>e.fold(()=>iE(L.none()),e=>{const o=r.extract(t.concat([n]),e);return i=o,s=L.some,i.stype===nE.Value?{stype:nE.Value,svalue:s(i.svalue)}:i;var i,s});switch(e.tag){case"required":return((e,t,o,n)=>ke(t,o).fold(()=>((e,t,o)=>cE(e,()=>'Could not find valid *required* value for "'+t+'" in '+lE(o)))(e,o,t),n))(t,o,n,i);case"defaultedThunk":return xE(o,n,e.process,i);case"option":return((e,t,o)=>o(ke(e,t)))(o,n,s);case"defaultedOptionThunk":return((e,t,o,n)=>n(ke(e,t).map(t=>!0===t?o(e):t)))(o,n,e.process,s);case"mergeWithThunk":return xE(o,n,O({}),t=>{const n=Ie(e.process(o),t);return i(n)})}},kE=e=>({extract:(t,o)=>((e,t,o)=>{const n={},r=[];for(const i of o)wE(i,(o,i,s,a)=>{const l=CE(s,e,t,o,a);aE(l,e=>{r.push(...e)},e=>{n[i]=e})},(e,o)=>{n[e]=o(t)});return r.length>0?sE(r):iE(n)})(t,o,e),toString:()=>{const t=j(e,e=>wE(e,(e,t,o,n)=>e+" -> "+n.toString(),(e,t)=>"state("+e+")"));return"obj{\n"+t.join("\n")+"}"}}),SE=(e,t,o)=>{return n=((e,t,o)=>((e,t)=>e.stype===nE.Error?{stype:nE.Error,serror:t(e.serror)}:e)(t.extract([e],o),e=>({input:o,errors:e})))(e,t,o),rE(n,Be.error,Be.value);var n},TE=(e,t,o,n)=>({tag:"field",key:e,newKey:t,presence:o,prop:n}),EE=(e,t)=>TE(e,e,{tag:"required",process:{}},t),OE=e=>EE(e,gE),AE=e=>EE(e,vE),ME=(e,t)=>TE(e,e,{tag:"option",process:{}},t),BE=e=>ME(e,gE),RE=e=>ME(e,vE),NE=(e,t)=>TE(e,e,yE(t),hE()),VE=(e,t,o)=>TE(e,e,yE(t),o),DE=(e,t)=>VE(e,t,pE),PE=(e,t)=>VE(e,t,fE),IE=(e,t)=>VE(e,t,vE),LE=OE("type");OE("name"),OE("label"),OE("text"),OE("title"),OE("icon"),OE("url");const FE=OE("value"),zE=AE("fetch");AE("getSubmenuItems");const HE=AE("onAction");AE("onItemAction"),IE("onSetup",()=>S),BE("name");const UE=BE("text");BE("role");const ZE=BE("icon");BE("url"),BE("tooltip"),BE("label"),BE("shortcut"),RE("select");const $E=PE("active",!1);PE("borderless",!1);const jE=PE("enabled",!0);PE("primary",!1);const WE=NE("meta",{});IE("onAction",S),kE([(()=>VE("type","autocompleteitem",gE))(0,"autocompleteitem"),$E,jE,WE,FE,UE,ZE]);const qE=kE([LE,OE("trigger"),DE("minChars",1),NE("columns",1),DE("maxResults",10),RE("matches"),zE,HE,(GE=gE,VE("highlightOn",[],(YE=GE,{extract:(e,t)=>{const o=j(t,(t,o)=>YE.extract(e.concat(["["+o+"]"]),t));return _E(o)},toString:()=>"array("+YE.toString()+")"})))]);var GE,YE;const XE=e=>{const t=e.ui.registry.getAll().popups,o=ve(t,e=>{return(t=e,SE("Autocompleter",qE,t)).fold(e=>{throw new Error("Errors: \n"+(e=>{const t=e.length>10?e.slice(0,10).concat([{path:[],getErrorInfo:O("... (only showing first ten failures)")}]):e;return j(t,e=>"Failed path: ("+e.path.join(" > ")+")\n"+e.getErrorInfo())})((t=e).errors).join("\n")+"\n\nInput object: "+lE(t.input));var t},A);var t}),n=dt(xe(o,e=>e.trigger)),r=Ce(o);return{dataset:o,triggers:n,lookupByTrigger:e=>Y(r,t=>t.trigger===e)}},KE=e=>{const t=je(),o=Oe(!1),n=t.isSet,r=()=>{n()&&((e=>{e.dispatch("AutocompleterEnd")})(e),o.set(!1),t.clear())},i=st(()=>XE(e)),s=s=>{(o=>t.get().map(t=>QT(e.dom,e.selection.getRng(),t.trigger,!0).bind(t=>oE(e,i,t,o))).getOrThunk(()=>((e,t)=>{const o=t(),n=e.selection.getRng();return((e,t,o)=>he(o.triggers,o=>QT(e,t,o)))(e.dom,n,o).bind(o=>oE(e,t,o))})(e,i)))(s).fold(r,r=>{(e=>{n()||t.set({trigger:e.trigger,matchLength:e.text.length})})(r.context),r.lookupData.then(n=>{t.get().map(i=>{const s=r.context;i.trigger===s.trigger&&(t.set({...i,matchLength:s.text.length}),o.get()?(gc(e,{range:s.range}),((e,t)=>{e.dispatch("AutocompleterUpdate",t)})(e,{lookupData:n})):(o.set(!0),gc(e,{range:s.range}),((e,t)=>{e.dispatch("AutocompleterStart",t)})(e,{lookupData:n})))})})})},a=()=>t.get().bind(({trigger:t})=>{const n=e.selection.getRng();return QT(e.dom,n,t,o.get()).filter(({range:e})=>((e,t)=>{const o=e.compareBoundaryPoints(window.Range.START_TO_START,t),n=e.compareBoundaryPoints(window.Range.END_TO_END,t);return o>=0&&n<=0})(n,e)).map(({range:e})=>e)});e.addCommand("mceAutocompleterReload",(e,t)=>{const o=p(t)?t.fetchOptions:{};s(o)}),e.addCommand("mceAutocompleterClose",r),e.addCommand("mceAutocompleterRefreshActiveRange",()=>{a().each(t=>{gc(e,{range:t})})}),e.editorCommands.addQueryStateHandler("mceAutoCompleterInRange",()=>a().isSome()),((e,t)=>{const o=it(t.load,50);e.on("input",t=>{("insertCompositionText"!==t.inputType||e.composing)&&o.throttle()}),e.on("keydown",e=>{const n=e.which;8===n?o.throttle():27===n?(o.cancel(),t.cancelIfNecessary()):38!==n&&40!==n||o.cancel()},!0),e.on("remove",o.cancel)})(e,{cancelIfNecessary:r,load:s})},JE=Gt().browser.isSafari(),QE=e=>Va(mo(e)),eO=(e,t)=>{var o;return 0===e.startOffset&&e.endOffset===(null===(o=t.textContent)||void 0===o?void 0:o.length)},tO=(e,t)=>L.from(e.getParent(t.container(),"details")),oO=(e,t)=>tO(e,t).isSome(),nO=(e,t)=>{const o=t.getNode();y(o)||e.selection.setCursorLocation(o,t.offset())},rO=(e,t,o)=>{const n=e.dom.getParent(t.container(),"details");if(n&&!n.open){const t=e.dom.select("summary",n)[0];t&&(o?Oh(t):Ah(t)).each(t=>nO(e,t))}else nO(e,t)},iO=(e,t,o)=>{const{dom:n,selection:r}=e,i=e.getBody();if("character"===o){const o=Dl.fromRangeStart(r.getRng()),s=n.getParent(o.container(),n.isBlock),a=tO(n,o),l=s&&n.isEmpty(s),c=v(null==s?void 0:s.previousSibling),d=v(null==s?void 0:s.nextSibling);return!!(l&&(t?d:c)&&Ch(!t,i,o).exists(e=>oO(n,e)&&!ze(a,tO(n,e))))||Ch(t,i,o).fold(P,o=>{const r=tO(n,o);if(oO(n,o)&&!ze(a,r)){if(t||rO(e,o,!1),s&&l){if(t&&c)return!0;if(!t&&d)return!0;rO(e,o,t),e.dom.remove(s)}return!0}return!1})}return!1},sO=(e,t,o,n)=>{const r=e.selection.getRng(),i=Dl.fromRangeStart(r),s=e.getBody();return"selection"===n?((e,t)=>{const o=t.startSummary.exists(t=>t.contains(e.startContainer)),n=t.startSummary.exists(t=>t.contains(e.endContainer)),r=t.startDetails.forall(e=>t.endDetails.forall(t=>e!==t));return(o||n)&&!(o&&n)||r})(r,t):o?((e,t)=>t.startSummary.exists(t=>((e,t)=>Ah(t).exists(o=>ai(o.getNode())&&Eh(t,o).exists(t=>t.isEqual(e))||o.isEqual(e)))(e,t)))(i,t)||((e,t,o)=>o.startDetails.exists(o=>Th(e,t).forall(e=>!o.contains(e.container()))))(s,i,t):((e,t)=>t.startSummary.exists(t=>((e,t)=>Oh(t).exists(t=>t.isEqual(e)))(e,t)))(i,t)||((e,t)=>t.startDetails.exists(o=>Eh(o,e).forall(o=>t.startSummary.exists(t=>!t.contains(e.container())&&t.contains(o.container())))))(i,t)},aO=(e,t,o)=>((e,t,o)=>((e,t)=>{const o=L.from(e.getParent(t.startContainer,"details")),n=L.from(e.getParent(t.endContainer,"details"));if(o.isSome()||n.isSome()){const t=o.bind(t=>L.from(e.select("summary",t)[0]));return L.some({startSummary:t,startDetails:o,endDetails:n})}return L.none()})(e.dom,e.selection.getRng()).fold(()=>iO(e,t,o),n=>sO(e,n,t,o)||iO(e,t,o)))(e,t,o)||JE&&((e,t,o)=>{const n=e.selection,r=n.getNode(),i=n.getRng(),s=Dl.fromRangeStart(i);return!!bi(r)&&("selection"===o&&eO(i,r)||tv(t,s,r)?QE(r):e.undoManager.transact(()=>{const i=n.getSel();let{anchorNode:s,anchorOffset:a,focusNode:l,focusOffset:c}=null!=i?i:{};const d=()=>{_(s)&&_(a)&&_(l)&&_(c)&&(null==i||i.setBaseAndExtent(s,a,l,c))},u=(e,t)=>{W(e.childNodes,e=>{sm(e)&&t.appendChild(e)})},h=e.dom.create("span",{"data-mce-bogus":"1"});u(r,h),r.appendChild(h),d(),"word"!==o&&"line"!==o||null==i||i.modify("extend",t?"right":"left",o),!n.isCollapsed()&&eO(n.getRng(),h)?QE(r):(e.execCommand(t?"ForwardDelete":"Delete"),s=null==i?void 0:i.anchorNode,a=null==i?void 0:i.anchorOffset,l=null==i?void 0:i.focusNode,c=null==i?void 0:i.focusOffset,u(h,r),d()),e.dom.remove(h)}),!0)})(e,t,o)?L.some(S):L.none(),lO=e=>(t,o,n={})=>{const r=t.getBody(),i={bubbles:!0,composed:!0,data:null,isComposing:!1,detail:0,view:null,target:r,currentTarget:r,eventPhase:Event.AT_TARGET,originalTarget:r,explicitOriginalTarget:r,isTrusted:!1,srcElement:r,cancelable:!1,preventDefault:S,inputType:o},s=Hs(new InputEvent(e));return t.dispatch(e,{...s,...i,...n})},cO=lO("input"),dO=lO("beforeinput"),uO=Gt(),hO=uO.os,mO=hO.isMacOS()||hO.isiOS(),pO=uO.browser.isFirefox(),gO=(e,t)=>{const o=e.dom,n=e.schema.getMoveCaretBeforeOnEnterElements();if(!t)return;if(/^(LI|DT|DD)$/.test(t.nodeName)){const e=(e=>{for(;e;){if(Wr(e)||ti(e)&&e.data&&/[\r\n\s]/.test(e.data))return e;e=e.nextSibling}return null})(t.firstChild);e&&/^(UL|OL|DL)$/.test(e.nodeName)&&t.insertBefore(o.doc.createTextNode(lt),t.firstChild)}const r=o.createRng();if(t.normalize(),t.hasChildNodes()){const e=new Fr(t,t);let o,i=t;for(;o=e.current();){if(ti(o)){r.setStart(o,0),r.setEnd(o,0);break}if(n[o.nodeName.toLowerCase()]){r.setStartBefore(o),r.setEndBefore(o);break}i=o,o=e.next()}o||(r.setStart(i,0),r.setEnd(i,0))}else ai(t)?t.nextSibling&&o.isBlock(t.nextSibling)?(r.setStartBefore(t),r.setEndBefore(t)):(r.setStartAfter(t),r.setEndAfter(t)):(r.setStart(t,0),r.setEnd(t,0));e.selection.setRng(r),og(e,r)},fO=(e,t)=>{const o=e.getRoot();let n,r=t;for(;r!==o&&r&&"false"!==e.getContentEditable(r);){if("true"===e.getContentEditable(r)){n=r;break}r=r.parentNode}return r!==o?n:o},vO=e=>L.from(e.dom.getParent(e.selection.getStart(!0),e.dom.isBlock)),bO=e=>{e.innerHTML='<br data-mce-bogus="1">'},yO=(e,t)=>{Bc(e).toLowerCase()===t.tagName.toLowerCase()&&((e,t,o)=>{const n=e.dom;L.from(o.style).map(n.parseStyle).each(e=>{const o={...Fn(mo(t)),...e};n.setStyles(t,o)});const r=L.from(o.class).map(e=>e.split(/\s+/)),i=L.from(t.className).map(e=>Y(e.split(/\s+/),e=>""!==e));He(r,i,(e,o)=>{const r=Y(o,t=>!Z(e,t)),i=[...e,...r];n.setAttrib(t,"class",i.join(" "))});const s=["style","class"],a=_e(o,(e,t)=>!Z(s,t));n.setAttribs(t,a)})(e,t,Rc(e))},wO=(e,t,o,n,r=!0,i,s)=>{const a=e.dom,l=e.schema,c=Bc(e),d=o?o.nodeName.toUpperCase():"";let u=t;const h=l.getTextInlineElements();let m;m=i||"TABLE"===d||"HR"===d?a.create(i||c,s||{}):o.cloneNode(!1);let p=m;if(r){do{if(h[u.nodeName]){if(Bh(u)||$h(u))continue;const e=u.cloneNode(!1);a.setAttrib(e,"id",""),m.hasChildNodes()?(e.appendChild(m.firstChild),m.appendChild(e)):(p=e,m.appendChild(e))}}while((u=u.parentNode)&&u!==n)}else a.setAttrib(m,"style",null),a.setAttrib(m,"class",null);return yO(e,m),bO(p),m},_O=(e,t)=>{const o=null==e?void 0:e.parentNode;return _(o)&&o.nodeName===t},xO=e=>_(e)&&/^(OL|UL|LI)$/.test(e.nodeName),CO=e=>_(e)&&/^(LI|DT|DD)$/.test(e.nodeName),kO=e=>{const t=e.parentNode;return CO(t)?t:e},SO=(e,t,o)=>{let n=e[o?"firstChild":"lastChild"];for(;n&&!Wr(n);)n=n[o?"nextSibling":"previousSibling"];return n===t},TO=e=>K(xe(Fn(mo(e)),(e,t)=>`${t}: ${e};`),(e,t)=>e+t,""),EO=(e,t)=>t&&"A"===t.nodeName&&e.isEmpty(t),OO=(e,t)=>e.nodeName===t||e.previousSibling&&e.previousSibling.nodeName===t,AO=(e,t)=>_(t)&&e.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&!/^(fixed|absolute)/i.test(t.style.position)&&e.isEditable(t.parentNode)&&"false"!==e.getContentEditable(t),MO=(e,t,o)=>ti(t)?e?1===o&&t.data.charAt(o-1)===Da?0:o:o===t.data.length-1&&t.data.charAt(o)===Da?t.data.length:o:o,BO={insert:(e,t)=>{let o,n,r,i,s=!1;const a=e.dom,l=e.schema.getNonEmptyElements(),c=e.selection.getRng(),d=Bc(e),u=mo(c.startContainer),h=$o(u,c.startOffset),p=h.exists(e=>Eo(e)&&!gr(e)),g=c.collapsed&&p,f=(t,n)=>wO(e,o,S,k,Pc(e),t,n),b=e=>{const t=MO(e,o,n);if(ti(o)&&(e?t>0:t<o.data.length))return!1;if((o.parentNode===S||o===S)&&s&&!e)return!0;if(e&&Wr(o)&&o===S.firstChild)return!0;if(OO(o,"TABLE")||OO(o,"HR"))return(e=>"BR"===e.nodeName||e.nextSibling&&"BR"===e.nextSibling.nodeName)(o)?!e:s&&!e||!s&&e;const r=new Fr(o,S);let i;for(ti(o)&&(e&&0===t?r.prev():e||t!==o.data.length||r.next());i=r.current();){if(Wr(i)){if(!i.getAttribute("data-mce-bogus")){const e=i.nodeName.toLowerCase();if(l[e]&&"br"!==e)return!1}}else if(ti(i)&&!Hr(i.data))return!1;e?r.prev():r.next()}return!0},y=()=>{let t;return t=/^(H[1-6]|PRE|FIGURE)$/.test(r)&&"HGROUP"!==T?f(d):f(),((e,t)=>{const o=Ic(e);return!w(t)&&(m(o)?Z(ao.explode(o),t.nodeName.toLowerCase()):o)})(e,i)&&AO(a,i)&&a.isEmpty(S,void 0,{includeZwsp:!0})?t=a.split(i,S):a.insertAfter(t,S),gO(e,t),t};Ip(a,c).each(e=>{c.setStart(e.startContainer,e.startOffset),c.setEnd(e.endContainer,e.endOffset)}),o=c.startContainer,n=c.startOffset;const x=!(!t||!t.shiftKey),C=!(!t||!t.ctrlKey);Wr(o)&&o.hasChildNodes()&&!g&&(s=n>o.childNodes.length-1,o=o.childNodes[Math.min(n,o.childNodes.length-1)]||o,n=s&&ti(o)?o.data.length:0);const k=fO(a,o);if(!k||((e,t)=>{const o=e.dom.getParent(t,"ol,ul,dl");return null!==o&&"false"===e.dom.getContentEditableParent(o)})(e,o))return;x||(o=((e,t,o,n,r)=>{var i,s;const a=e.dom,l=null!==(i=fO(a,n))&&void 0!==i?i:a.getRoot();let c=a.getParent(n,a.isBlock);if(!c||!AO(a,c)){if(c=c||l,!c.hasChildNodes()){const n=a.create(t);return yO(e,n),c.appendChild(n),o.setStart(n,0),o.setEnd(n,0),n}let i,d=n;for(;d&&d.parentNode!==c;)d=d.parentNode;for(;d&&!a.isBlock(d);)i=d,d=d.previousSibling;const u=null===(s=null==i?void 0:i.parentElement)||void 0===s?void 0:s.nodeName;if(i&&u&&e.schema.isValidChild(u,t.toLowerCase())){const s=i.parentNode,l=a.create(t);for(yO(e,l),s.insertBefore(l,i),d=i;d&&!a.isBlock(d);){const e=d.nextSibling;l.appendChild(d),d=e}o.setStart(n,r),o.setEnd(n,r)}}return n})(e,d,c,o,n));let S=a.getParent(o,a.isBlock)||a.getRoot();i=_(null==S?void 0:S.parentNode)?a.getParent(S.parentNode,a.isBlock):null,r=S?S.nodeName.toUpperCase():"";const T=i?i.nodeName.toUpperCase():"";if("LI"!==T||C||(S=i,i=i.parentNode,r=T),Wr(i)&&((e,t,o)=>!t&&o.nodeName.toLowerCase()===Bc(e)&&e.dom.isEmpty(o)&&((e,t,o)=>{let n=t;for(;n&&n!==e&&v(n.nextSibling);){const e=n.parentElement;if(!e||!o(e))return vi(e);n=e}return!1})(e.getBody(),o,t=>Se(e.schema.getTextBlockElements(),t.nodeName.toLowerCase())))(e,x,S))return((e,t,o)=>{var n,r,i;const s=t(Bc(e)),a=((e,t)=>e.dom.getParent(t,vi))(e,o);a&&(e.dom.insertAfter(s,a),gO(e,s),(null!==(i=null===(r=null===(n=o.parentElement)||void 0===n?void 0:n.childNodes)||void 0===r?void 0:r.length)&&void 0!==i?i:0)>1&&e.dom.remove(o))})(e,f,S);if(/^(LI|DT|DD)$/.test(r)&&Wr(i)&&a.isEmpty(S))return void((e,t,o,n,r)=>{const i=e.dom,s=e.selection.getRng(),a=o.parentNode;if(o===e.getBody()||!a)return;var l;xO(l=o)&&xO(l.parentNode)&&(r="LI");const c=CO(n)?TO(n):void 0;let d=CO(n)&&c?t(r,{style:TO(n)}):t(r);if(SO(o,n,!0)&&SO(o,n,!1))if(_O(o,"LI")){const e=kO(o);i.insertAfter(d,e),(e=>{var t;return(null===(t=e.parentNode)||void 0===t?void 0:t.firstChild)===e})(o)?i.remove(e):i.remove(o)}else i.replace(d,o);else if(SO(o,n,!0))_O(o,"LI")?(i.insertAfter(d,kO(o)),d.appendChild(i.doc.createTextNode(" ")),d.appendChild(o)):a.insertBefore(d,o),i.remove(n);else if(SO(o,n,!1))i.insertAfter(d,kO(o)),i.remove(n);else{o=kO(o);const e=s.cloneRange();e.setStartAfter(n),e.setEndAfter(o);const t=e.extractContents();if("LI"===r&&(e=>e.firstChild&&"LI"===e.firstChild.nodeName)(t)){const e=Y(j(d.children,mo),R(Ro("br")));d=t.firstChild,i.insertAfter(t,o),W(e,e=>dn(mo(d),e)),c&&d.setAttribute("style",c)}else i.insertAfter(t,o),i.insertAfter(d,o);i.remove(n)}gO(e,d)})(e,f,i,S,d);if(!(g||S!==e.getBody()&&AO(a,S)))return;const E=S.parentNode;let O;if(g)O=f(d),h.fold(()=>{un(u,mo(O))},e=>{ln(e,mo(O))}),e.selection.setCursorLocation(O,0);else if(za(S))O=Ga(S),a.isEmpty(S)&&bO(S),yO(e,O),gO(e,O);else if(b(!1))O=y();else if(b(!0)&&E){const t=Dl.fromRangeStart(c),o=Xg(t),n=mo(S),r=mf(n,t,e.schema)?pf(n,t,e.schema).bind(e=>L.from(e.getNode())):L.none();O=E.insertBefore(f(),S);const i=OO(S,"HR")||o?O:r.getOr(S);gO(e,i)}else{const t=(e=>{const t=e.cloneRange();return t.setStart(e.startContainer,MO(!0,e.startContainer,e.startOffset)),t.setEnd(e.endContainer,MO(!1,e.endContainer,e.endOffset)),t})(c).cloneRange();t.setEndAfter(S);const o=t.extractContents();(e=>{W(br(mo(e),Ao),e=>{const t=e.dom;t.nodeValue=Ia(t.data)})})(o),(e=>{let t=e;do{ti(t)&&(t.data=t.data.replace(/^[\r\n]+/,"")),t=t.firstChild}while(t)})(o),O=o.firstChild,a.insertAfter(o,S),((e,t,o)=>{var n;const r=[];if(!o)return;let i=o;for(;i=i.firstChild;){if(e.isBlock(i))return;Wr(i)&&!t[i.nodeName.toLowerCase()]&&r.push(i)}let s=r.length;for(;s--;)i=r[s],(!i.hasChildNodes()||i.firstChild===i.lastChild&&""===(null===(n=i.firstChild)||void 0===n?void 0:n.nodeValue)||EO(e,i))&&e.remove(i)})(a,l,O),((e,t)=>{t.normalize();const o=t.lastChild;(!o||Wr(o)&&/^(left|right)$/gi.test(e.getStyle(o,"float",!0)))&&e.add(t,"br")})(a,S),a.isEmpty(S)&&bO(S),O.normalize(),a.isEmpty(O)?(a.remove(O),y()):(yO(e,O),gO(e,O))}a.setAttrib(O,"id",""),e.dispatch("NewBlock",{newBlock:O})},fakeEventName:"insertParagraph"},RO=(e,t,o)=>{const n=e.dom.createRng();o?(n.setStartBefore(t),n.setEndBefore(t)):(n.setStartAfter(t),n.setEndAfter(t)),e.selection.setRng(n),og(e,n)},NO=(e,t)=>{const o=uo("br");ln(mo(t),o),e.undoManager.add()},VO=(e,t)=>{DO(e.getBody(),t)||cn(mo(t),uo("br"));const o=uo("br");cn(mo(t),o),RO(e,o.dom,!1),e.undoManager.add()},DO=(e,t)=>{return o=Dl.after(t),!!ai(o.getNode())||Th(e,Dl.after(t)).map(e=>ai(e.getNode())).getOr(!1);var o},PO=e=>e&&"A"===e.nodeName&&"href"in e,IO=e=>e.fold(P,PO,PO,P),LO=(e,t)=>{t.fold(S,B(NO,e),B(VO,e),S)},FO={insert:(e,t)=>{const o=(e=>{const t=B(Zf,e),o=Dl.fromRangeStart(e.selection.getRng());return tk(t,e.getBody(),o).filter(IO)})(e);o.isSome()?o.each(B(LO,e)):((e,t)=>{const o=e.selection,n=e.dom,r=o.getRng();let i,s=!1;Ip(n,r).each(e=>{r.setStart(e.startContainer,e.startOffset),r.setEnd(e.endContainer,e.endOffset)});let a=r.startOffset,l=r.startContainer;if(Wr(l)&&l.hasChildNodes()){const e=a>l.childNodes.length-1;l=l.childNodes[Math.min(a,l.childNodes.length-1)]||l,a=e&&ti(l)?l.data.length:0}let c=n.getParent(l,n.isBlock);const d=c&&c.parentNode?n.getParent(c.parentNode,n.isBlock):null,u=d?d.nodeName.toUpperCase():"",h=!(!t||!t.ctrlKey);"LI"!==u||h||(c=d),ti(l)&&a>=l.data.length&&(((e,t,o)=>{const n=new Fr(t,o);let r;const i=e.getNonEmptyElements();for(;r=n.next();)if(i[r.nodeName.toLowerCase()]||ti(r)&&r.length>0)return!0;return!1})(e.schema,l,c||n.getRoot())||(i=n.create("br"),r.insertNode(i),r.setStartAfter(i),r.setEndAfter(i),s=!0)),i=n.create("br"),Il(n,r,i),RO(e,i,s),e.undoManager.add()})(e,t)},fakeEventName:"insertLineBreak"},zO=(e,t)=>vO(e).filter(e=>t.length>0&&yo(mo(e),t)).isSome(),HO=Ee([{br:[]},{block:[]},{none:[]}]),UO=(e,t)=>(e=>zO(e,Dc(e)))(e),ZO=e=>(t,o)=>(e=>vO(e).filter(e=>Aa(mo(e))).isSome())(t)===e,$O=(e,t)=>(o,n)=>{const r=(e=>vO(e).fold(O(""),e=>e.nodeName.toUpperCase()))(o)===e.toUpperCase();return r===t},jO=e=>{const t=fO(e.dom,e.selection.getStart());return w(t)},WO=e=>$O("pre",e),qO=e=>(t,o)=>Mc(t)===e,GO=(e,t)=>(e=>zO(e,Vc(e)))(e),YO=(e,t)=>t,XO=e=>{const t=Bc(e),o=fO(e.dom,e.selection.getStart());return _(o)&&e.schema.isValidChild(o.nodeName,t)},KO=e=>{const t=e.selection.getRng(),o=mo(t.startContainer),n=$o(o,t.startOffset).map(e=>Eo(e)&&!gr(e));return t.collapsed&&n.getOr(!0)},JO=(e,t)=>(o,n)=>K(e,(e,t)=>e&&t(o,n),!0)?L.some(t):L.none(),QO=(e,t,o)=>{if(!t.mode.isReadOnly()){if(t.selection.isCollapsed()||(e=>{e.execCommand("delete")})(t),_(o)&&dO(t,e.fakeEventName).isDefaultPrevented())return;e.insert(t,o),_(o)&&cO(t,e.fakeEventName)}},eA=(e,t)=>{if(e.mode.isReadOnly())return;const o=()=>QO(FO,e,t),n=()=>QO(BO,e,t),r=((e,t)=>jC([JO([UO],HO.none()),JO([WO(!0),jO],HO.none()),JO([$O("summary",!0)],HO.br()),JO([WO(!0),qO(!1),YO],HO.br()),JO([WO(!0),qO(!1)],HO.block()),JO([WO(!0),qO(!0),YO],HO.block()),JO([WO(!0),qO(!0)],HO.br()),JO([ZO(!0),YO],HO.br()),JO([ZO(!0)],HO.block()),JO([GO],HO.br()),JO([YO],HO.br()),JO([XO],HO.block()),JO([KO],HO.block())],[e,!(!t||!t.shiftKey)]).getOr(HO.none()))(e,t);switch(Nc(e)){case"linebreak":r.fold(o,o,S);break;case"block":r.fold(n,n,S);break;case"invert":r.fold(n,o,S);break;default:r.fold(o,n,S)}},tA=Gt(),oA=tA.os.isiOS()&&tA.browser.isSafari(),nA=(e,t)=>{var o;t.isDefaultPrevented()||(t.preventDefault(),(o=e.undoManager).typing&&(o.typing=!1,o.add()),e.undoManager.transact(()=>{eA(e,t)}))},rA=Gt(),iA=e=>e.stopImmediatePropagation(),sA=e=>e.keyCode===Cp.PAGE_UP||e.keyCode===Cp.PAGE_DOWN,aA=(e,t,o)=>{o&&!e.get()?t.on("NodeChange",iA,!0):!o&&e.get()&&t.off("NodeChange",iA),e.set(o)},lA=(e,t)=>e===t||e.contains(t),cA=(e,t)=>{const o=t.container(),n=t.offset();return ti(o)?(o.insertData(n,e),L.some(Dl(o,n+e.length))):ih(t).map(o=>{const n=ho(e);return t.isAtEnd()?cn(o,n):ln(o,n),Dl(n.dom,e.length)})},dA=B(cA,lt),uA=B(cA," "),hA=e=>t=>{e.selection.setRng(t.toRange()),e.nodeChanged()},mA=e=>{const t=Dl.fromRangeStart(e.selection.getRng()),o=mo(e.getBody());if(e.selection.isCollapsed()){const n=B(Zf,e),r=Dl.fromRangeStart(e.selection.getRng());return tk(n,e.getBody(),r).bind((e=>t=>t.fold(t=>Eh(e.dom,Dl.before(t)),e=>Oh(e),e=>Ah(e),t=>Th(e.dom,Dl.after(t))))(o)).map(n=>()=>((e,t,o)=>n=>xf(e,n,o)?dA(t):uA(t))(o,t,e.schema)(n).each(hA(e)))}return L.none()},pA=e=>{return Ue(no.browser.isFirefox()&&e.selection.isEditable()&&(t=e.dom,o=e.selection.getRng().startContainer,t.isEditable(t.getParent(o,"summary"))),()=>{const t=mo(e.getBody());e.selection.isCollapsed()||e.getDoc().execCommand("Delete"),((e,t,o)=>xf(e,t,o)?dA(t):uA(t))(t,Dl.fromRangeStart(e.selection.getRng()),e.schema).each(hA(e))});var t,o},gA=e=>du(e)?[{keyCode:Cp.TAB,action:qS(ZT,e,!0)},{keyCode:Cp.TAB,shiftKey:!0,action:qS(ZT,e,!1)}]:[],fA=e=>{if(e.addShortcut("Meta+P","","mcePrint"),KE(e),M_(e))return Oe(null);{const t=Kk(e);return(e=>{e.on("beforeinput",t=>{e.selection.isEditable()&&!$(t.getTargetRanges(),t=>!((e,t)=>!lA(e.getBody(),t.startContainer)||!lA(e.getBody(),t.endContainer)||ng(e.dom,t))(e,t))||t.preventDefault()})})(e),(e=>{e.on("keyup compositionstart",B(DS,e))})(e),((e,t)=>{e.on("keydown",o=>{o.isDefaultPrevented()||((e,t,o)=>{const n=no.os.isMacOS()||no.os.isiOS();GS([{keyCode:Cp.RIGHT,action:qS(LS,e,!0)},{keyCode:Cp.LEFT,action:qS(LS,e,!1)},{keyCode:Cp.UP,action:qS(FS,e,!1)},{keyCode:Cp.DOWN,action:qS(FS,e,!0)},...n?[{keyCode:Cp.UP,action:qS(HS,e,!1),metaKey:!0,shiftKey:!0},{keyCode:Cp.DOWN,action:qS(HS,e,!0),metaKey:!0,shiftKey:!0}]:[],{keyCode:Cp.RIGHT,action:qS(DT,e,!0)},{keyCode:Cp.LEFT,action:qS(DT,e,!1)},{keyCode:Cp.UP,action:qS(PT,e,!1)},{keyCode:Cp.DOWN,action:qS(PT,e,!0)},{keyCode:Cp.UP,action:qS(PT,e,!1)},{keyCode:Cp.UP,action:qS($S,e,!1)},{keyCode:Cp.DOWN,action:qS($S,e,!0)},{keyCode:Cp.RIGHT,action:qS(XS,e,!0)},{keyCode:Cp.LEFT,action:qS(XS,e,!1)},{keyCode:Cp.UP,action:qS(KS,e,!1)},{keyCode:Cp.DOWN,action:qS(KS,e,!0)},{keyCode:Cp.RIGHT,action:qS(Yk,e,t,!0)},{keyCode:Cp.LEFT,action:qS(Yk,e,t,!1)},{keyCode:Cp.RIGHT,ctrlKey:!n,altKey:n,action:qS(Jk,e,t)},{keyCode:Cp.LEFT,ctrlKey:!n,altKey:n,action:qS(Qk,e,t)},{keyCode:Cp.UP,action:qS(ZS,e,!1)},{keyCode:Cp.DOWN,action:qS(ZS,e,!0)}],o).each(e=>{o.preventDefault()})})(e,t,o)})})(e,t),((e,t)=>{let o=!1;e.on("keydown",n=>{o=n.keyCode===Cp.BACKSPACE,n.isDefaultPrevented()||((e,t,o)=>{const n=o.keyCode===Cp.BACKSPACE?"deleteContentBackward":"deleteContentForward",r=e.selection.isCollapsed(),i=r?"character":"selection",s=e=>r?e?"word":"line":"selection";YS([{keyCode:Cp.BACKSPACE,action:qS(CS,e)},{keyCode:Cp.BACKSPACE,action:qS(OC,e,!1)},{keyCode:Cp.DELETE,action:qS(OC,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(wC,e,!1)},{keyCode:Cp.DELETE,action:qS(wC,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(nS,e,t,!1)},{keyCode:Cp.DELETE,action:qS(nS,e,t,!0)},{keyCode:Cp.BACKSPACE,action:qS(Av,e,!1)},{keyCode:Cp.DELETE,action:qS(Av,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(aO,e,!1,i)},{keyCode:Cp.DELETE,action:qS(aO,e,!0,i)},...mO?[{keyCode:Cp.BACKSPACE,altKey:!0,action:qS(aO,e,!1,s(!0))},{keyCode:Cp.DELETE,altKey:!0,action:qS(aO,e,!0,s(!0))},{keyCode:Cp.BACKSPACE,metaKey:!0,action:qS(aO,e,!1,s(!1))}]:[{keyCode:Cp.BACKSPACE,ctrlKey:!0,action:qS(aO,e,!1,s(!0))},{keyCode:Cp.DELETE,ctrlKey:!0,action:qS(aO,e,!0,s(!0))}],{keyCode:Cp.BACKSPACE,action:qS(VC,e,!1)},{keyCode:Cp.DELETE,action:qS(VC,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(gS,e,!1)},{keyCode:Cp.DELETE,action:qS(gS,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(mC,e,!1)},{keyCode:Cp.DELETE,action:qS(mC,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(dC,e,!1)},{keyCode:Cp.DELETE,action:qS(dC,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(hS,e,!1)},{keyCode:Cp.DELETE,action:qS(hS,e,!0)},{keyCode:Cp.BACKSPACE,action:qS(NC,e,!1)},{keyCode:Cp.DELETE,action:qS(NC,e,!0)}],o).filter(t=>e.selection.isEditable()).each(t=>{o.preventDefault(),dO(e,n).isDefaultPrevented()||(t(),cO(e,n))})})(e,t,n)}),e.on("keyup",t=>{t.isDefaultPrevented()||((e,t,o)=>{GS([{keyCode:Cp.BACKSPACE,action:qS(EC,e)},{keyCode:Cp.DELETE,action:qS(EC,e)},...mO?[{keyCode:Cp.BACKSPACE,altKey:!0,action:qS(mS,e)},{keyCode:Cp.DELETE,altKey:!0,action:qS(mS,e)},...o?[{keyCode:pO?224:91,action:qS(mS,e)}]:[]]:[{keyCode:Cp.BACKSPACE,ctrlKey:!0,action:qS(mS,e)},{keyCode:Cp.DELETE,ctrlKey:!0,action:qS(mS,e)}]],t)})(e,t,o),o=!1})})(e,t),(e=>{let t=L.none();e.on("keydown",o=>{o.keyCode===Cp.ENTER&&(oA&&(e=>{if(!e.collapsed)return!1;const t=e.startContainer;if(ti(t)){const o=/^[\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F\uA960-\uA97F\uD7B0-\uD7FF]$/,n=t.data.charAt(e.startOffset-1);return o.test(n)}return!1})(e.selection.getRng())?(e=>{t=L.some(e.selection.getBookmark()),e.undoManager.add()})(e):nA(e,o))}),e.on("keyup",o=>{o.keyCode===Cp.ENTER&&t.each(()=>((e,o)=>{e.undoManager.undo(),t.fold(S,t=>e.selection.moveToBookmark(t)),nA(e,o),t=L.none()})(e,o))})})(e),(e=>{e.on("keydown",t=>{t.isDefaultPrevented()||((e,t)=>{YS([{keyCode:Cp.SPACEBAR,action:qS(mA,e)},{keyCode:Cp.SPACEBAR,action:qS(pA,e)}],t).each(o=>{t.preventDefault(),dO(e,"insertText",{data:" "}).isDefaultPrevented()||(o(),cO(e,"insertText",{data:" "}))})})(e,t)})})(e),(e=>{e.on("input",t=>{t.isComposing||(e=>{const t=mo(e.getBody());e.selection.isCollapsed()&&Mf(t,Dl.fromRangeStart(e.selection.getRng()),e.schema).each(t=>{e.selection.setRng(t.toRange())})})(e)})})(e),(e=>{e.on("keydown",t=>{t.isDefaultPrevented()||((e,t)=>{GS([...gA(e)],t).each(e=>{t.preventDefault()})})(e,t)})})(e),((e,t)=>{e.on("keydown",o=>{o.isDefaultPrevented()||((e,t,o)=>{const n=no.os.isMacOS()||no.os.isiOS();GS([{keyCode:Cp.END,action:qS(zS,e,!0)},{keyCode:Cp.HOME,action:qS(zS,e,!1)},...n?[]:[{keyCode:Cp.HOME,action:qS(HS,e,!1),ctrlKey:!0,shiftKey:!0},{keyCode:Cp.END,action:qS(HS,e,!0),ctrlKey:!0,shiftKey:!0}],{keyCode:Cp.END,action:qS(JS,e,!0)},{keyCode:Cp.HOME,action:qS(JS,e,!1)},{keyCode:Cp.END,action:qS(eS,e,!0,t)},{keyCode:Cp.HOME,action:qS(eS,e,!1,t)}],o).each(e=>{o.preventDefault()})})(e,t,o)})})(e,t),((e,t)=>{if(rA.os.isMacOS())return;const o=Oe(!1);e.on("keydown",t=>{sA(t)&&aA(o,e,!0)}),e.on("keyup",n=>{n.isDefaultPrevented()||((e,t,o)=>{GS([{keyCode:Cp.PAGE_UP,action:qS(eS,e,!1,t)},{keyCode:Cp.PAGE_DOWN,action:qS(eS,e,!0,t)}],o)})(e,t,n),sA(n)&&o.get()&&(aA(o,e,!1),e.nodeChanged())})})(e,t),t}};class vA{constructor(e){let t;this.lastPath=[],this.editor=e;const o=this;"onselectionchange"in e.getDoc()||e.on("NodeChange click mouseup keyup focus",o=>{const n=e.selection.getRng(),r={startContainer:n.startContainer,startOffset:n.startOffset,endContainer:n.endContainer,endOffset:n.endOffset};"nodechange"!==o.type&&Mp(r,t)||e.dispatch("SelectionChange"),t=r}),e.on("contextmenu",()=>{rp(e),e.dispatch("SelectionChange")}),e.on("SelectionChange",()=>{const t=e.selection.getStart(!0);t&&nm(e)&&!o.isSameElementPath(t)&&e.dom.isChildOf(t,e.getBody())&&e.nodeChanged({selectionChange:!0})}),e.on("mouseup",t=>{!t.isDefaultPrevented()&&nm(e)&&("IMG"===e.selection.getNode().nodeName?ap.setEditorTimeout(e,()=>{e.nodeChanged()}):e.nodeChanged())})}nodeChanged(e={}){const t=this.editor,o=t.selection;let n;if(t.initialized&&o&&!Sd(t)&&!bu(t)){const r=t.getBody();n=o.getStart(!0)||r,n.ownerDocument===t.getDoc()&&t.dom.isChildOf(n,r)||(n=r);const i=[];t.dom.getParent(n,e=>e===r||(i.push(e),!1)),t.dispatch("NodeChange",{...e,element:n,parents:i})}}isSameElementPath(e){let t;const o=this.editor,n=re(o.dom.getParents(e,I,o.getBody()));if(n.length===this.lastPath.length){for(t=n.length;t>=0&&n[t]===this.lastPath[t];t--);if(-1===t)return this.lastPath=n,!0}return this.lastPath=n,!1}}const bA="x-tinymce/html",yA=O(bA),wA="\x3c!-- "+bA+" --\x3e",_A=e=>wA+e,xA=e=>-1!==e.indexOf(wA),CA="%MCEPASTEBIN%",kA=e=>e.dom.get("mcepastebin"),SA=e=>_(e)&&"mcepastebin"===e.id,TA=e=>e===CA,EA=(e,t)=>(ao.each(t,t=>{e=h(t,RegExp)?e.replace(t,""):e.replace(t[0],t[1])}),e),OA=e=>EA(e,[/^[\s\S]*<body[^>]*>\s*|\s*<\/body[^>]*>[\s\S]*$/gi,/<!--StartFragment-->|<!--EndFragment-->/g,[/( ?)<span class="Apple-converted-space">\u00a0<\/span>( ?)/g,(e,t,o)=>t||o?lt:" "],/<br class="Apple-interchange-newline">/g,/<br>$/i]),AA=(e,t)=>({content:e,cancelled:t}),MA=(e,t)=>(e.insertContent(t,{merge:Yd(e),paste:!0}),!0),BA=e=>/^https?:\/\/[\w\-\/+=.,!;:&%@^~(){}?#]+$/i.test(e),RA=(e,t,o)=>!(e.selection.isCollapsed()||!BA(t))&&((e,t,o)=>(e.undoManager.extra(()=>{o(e,t)},()=>{e.execCommand("mceInsertLink",!1,t)}),!0))(e,t,o),NA=(e,t,o)=>!!((e,t)=>BA(t)&&$(cu(e),e=>Xe(t.toLowerCase(),`.${e.toLowerCase()}`)))(e,t)&&((e,t,o)=>(e.undoManager.extra(()=>{o(e,t)},()=>{e.insertContent('<img src="'+t+'">')}),!0))(e,t,o),VA=(()=>{let e=0;return()=>"mceclip"+e++})(),DA=e=>{const t=CT();return kT(t,e),fT(t),t},PA=(e,t,o,n,r)=>{const i=((e,t,o)=>((e,t,o)=>{const n=((e,t,o)=>e.dispatch("PastePreProcess",{content:t,internal:o}))(e,t,o),r=((e,t)=>{const o=Xw({sanitize:au(e),sandbox_iframes:mu(e),sandbox_iframes_exclusions:pu(e),convert_unsafe_embeds:gu(e)},e.schema);o.addNodeFilter("meta",e=>{ao.each(e,e=>{e.remove()})});const n=o.parse(t,{forced_root_block:!1,isRootContent:!0});return Rg({validate:!0},e.schema).serialize(n)})(e,n.content);return e.hasEventListeners("PastePostProcess")&&!n.isDefaultPrevented()?((e,t,o)=>{const n=e.dom.create("div",{style:"display:none"},t),r=((e,t,o)=>e.dispatch("PastePostProcess",{node:t,internal:o}))(e,n,o);return AA(r.node.innerHTML,r.isDefaultPrevented())})(e,r,o):AA(r,n.isDefaultPrevented())})(e,t,o))(e,t,o);if(!i.cancelled){const t=i.content,o=()=>((e,t,o)=>{o||!Xd(e)?MA(e,t):((e,t)=>{ao.each([RA,NA,MA],o=>!o(e,t,MA))})(e,t)})(e,t,n);r?dO(e,"insertFromPaste",{dataTransfer:DA(t)}).isDefaultPrevented()||(o(),cO(e,"insertFromPaste")):o()}},IA=(e,t,o,n)=>{const r=o||xA(t);PA(e,(e=>e.replace(wA,""))(t),r,!1,n)},LA=(e,t,o)=>{const n=e.dom.encode(t).replace(/\r\n/g,"\n"),r=((e,t,o)=>{const n=e.split(/\n\n/),r=((e,t)=>{let o="<"+e;const n=xe(t,(e,t)=>t+'="'+hs.encodeAllRaw(e)+'"');return n.length&&(o+=" "+n.join(" ")),o+">"})(t,o),i="</"+t+">",s=j(n,e=>e.split(/\n/).join("<br />"));return 1===s.length?s[0]:j(s,e=>r+e+i).join("")})(Zr(n,Jd(e)),Bc(e),Rc(e));PA(e,r,!1,!0,o)},FA=e=>{const t={};if(e&&e.types)for(let o=0;o<e.types.length;o++){const n=e.types[o];try{t[n]=e.getData(n)}catch(e){t[n]=""}}return t},zA=(e,t)=>t in e&&e[t].length>0,HA=e=>zA(e,"text/html")||zA(e,"text/plain"),UA=(e,t,o)=>{const n="paste"===t.type?t.clipboardData:t.dataTransfer;var r;if(Zd(e)&&n){const i=((e,t)=>{const o=t.items?oe(ue(t.items),e=>"file"===e.kind?[e.getAsFile()]:[]):[],n=t.files?ue(t.files):[];return Y(o.length>0?o:n,(e=>{const t=cu(e);return e=>Ye(e.type,"image/")&&$(t,t=>(e=>{const t=e.toLowerCase(),o={jpg:"jpeg",jpe:"jpeg",jfi:"jpeg",jif:"jpeg",jfif:"jpeg",pjpeg:"jpeg",pjp:"jpeg",svg:"svg+xml"};return ao.hasOwn(o,t)?"image/"+o[t]:"image/"+t})(t)===e.type)})(e))})(e,n);if(i.length>0)return t.preventDefault(),(r=i,Promise.all(j(r,e=>wy(e).then(t=>({file:e,uri:t}))))).then(t=>{o&&e.selection.setRng(o),W(t,t=>{((e,t)=>{by(t.uri).each(({data:o,type:n,base64Encoded:r})=>{const i=r?o:btoa(o),s=t.file,a=e.editorUpload.blobCache,l=a.getByData(i,n),c=null!=l?l:((e,t,o,n)=>{const r=VA(),i=Fc(e)&&_(o.name),s=i?((e,t)=>{const o=t.match(/([\s\S]+?)(?:\.[a-z0-9.]+)$/i);return _(o)?e.dom.encode(o[1]):void 0})(e,o.name):r,a=i?o.name:void 0,l=t.create(r,o,n,s,a);return t.add(l),l})(e,a,s,i);IA(e,`<img src="${c.blobUri()}">`,!1,!0)})})(e,t)})}),!0}return!1},ZA=(e,t,o,n,r)=>{let i=OA(o);const s=zA(t,yA())||xA(o),a=!s&&(e=>!/<(?:\/?(?!(?:div|p|br|span)>)\w+|(?:(?!(?:span style="white-space:\s?pre;?">)|br\s?\/>))\w+\s[^>]+)>/i.test(e))(i),l=BA(i);(TA(i)||!i.length||a&&!l)&&(n=!0),(n||l)&&(i=zA(t,"text/plain")&&a?t["text/plain"]:(e=>{const t=As(),o=Xw({},t);let n="";const r=t.getVoidElements(),i=ao.makeMap("script noscript style textarea video audio iframe object"," "),s=t.getBlockElements(),a=e=>{const o=e.name,l=e;if("br"!==o){if("wbr"!==o)if(r[o]&&(n+=" "),i[o])n+=" ";else{if(3===e.type&&(n+=e.value),!(e.name in t.getVoidElements())){let t=e.firstChild;if(t)do{a(t)}while(t=t.next)}s[o]&&l.next&&(n+="\n","p"===o&&(n+="\n"))}}else n+="\n"};return e=EA(e,[/<!\[[^\]]+\]>/g]),a(o.parse(e)),n})(i)),TA(i)||(n?LA(e,i,r):IA(e,i,s,r))},$A=(e,t,o)=>{((e,t,o)=>{let n;e.on("keydown",e=>{(e=>Cp.metaKeyPressed(e)&&86===e.keyCode||e.shiftKey&&45===e.keyCode)(e)&&!e.isDefaultPrevented()&&(n=e.shiftKey&&86===e.keyCode)}),e.on("paste",r=>{if(r.isDefaultPrevented()||(e=>{var t,o;return no.os.isAndroid()&&0===(null===(o=null===(t=e.clipboardData)||void 0===t?void 0:t.items)||void 0===o?void 0:o.length)})(r))return;const i="text"===o.get()||n;n=!1;const s=FA(r.clipboardData);!HA(s)&&UA(e,r,t.getLastRng()||e.selection.getRng())||(zA(s,"text/html")?(r.preventDefault(),ZA(e,s,s["text/html"],i,!0)):zA(s,"text/plain")&&zA(s,"text/uri-list")?(r.preventDefault(),ZA(e,s,s["text/plain"],i,!0)):(t.create(),ap.setEditorTimeout(e,()=>{const o=t.getHtml();t.remove(),ZA(e,s,o,i,!1)},0)))})})(e,t,o),(e=>{const t=e=>Ye(e,"webkit-fake-url"),o=e=>Ye(e,"data:");e.parser.addNodeFilter("img",(n,r,i)=>{if(!Zd(e)&&(e=>{var t;return!0===(null===(t=e.data)||void 0===t?void 0:t.paste)})(i))for(const r of n){const n=r.attr("src");m(n)&&!r.attr("data-mce-object")&&n!==no.transparentSrc&&(t(n)||!Qd(e)&&o(n))&&r.remove()}})})(e)},jA=(e,t,o,n)=>{((e,t,o)=>{if(!e)return!1;try{return e.clearData(),e.setData("text/html",t),e.setData("text/plain",o),e.setData(yA(),t),!0}catch(e){return!1}})(e.clipboardData,t.html,t.text)?(e.preventDefault(),n()):o(t.html,n)},WA=e=>(t,o)=>{const{dom:n,selection:r}=e,i=n.create("div",{contenteditable:"false","data-mce-bogus":"all"}),s=n.create("div",{contenteditable:"true"},t);n.setStyles(i,{position:"fixed",top:"0",left:"-3000px",width:"1000px",overflow:"hidden"}),i.appendChild(s),n.add(e.getBody(),i);const a=r.getRng();s.focus();const l=n.createRng();l.selectNodeContents(s),r.setRng(l),ap.setEditorTimeout(e,()=>{r.setRng(a),n.remove(i),o()},0)},qA=e=>({html:_A(e.selection.getContent({contextual:!0})),text:e.selection.getContent({format:"text"})}),GA=e=>!e.selection.isCollapsed()||(e=>!!e.dom.getParent(e.selection.getStart(),"td[data-mce-selected],th[data-mce-selected]",e.getBody()))(e),YA=(e,t)=>{var o,n;return zp.getCaretRangeFromPoint(null!==(o=t.clientX)&&void 0!==o?o:0,null!==(n=t.clientY)&&void 0!==n?n:0,e.getDoc())},XA=(e,t)=>{e.focus(),t&&e.selection.setRng(t)},KA=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/gi,JA=e=>ao.trim(e).replace(KA,Ls).toLowerCase(),QA=(e,t,o)=>{const n=qd(e);if(o||"all"===n||!Gd(e))return t;const r=n?n.split(/[, ]/):[];if(r&&"none"!==n){const o=e.dom,n=e.selection.getNode();t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,(e,t,i,s)=>{const a=o.parseStyle(o.decode(i)),l={};for(let e=0;e<r.length;e++){const t=a[r[e]];let i=t,s=o.getStyle(n,r[e],!0);/color/.test(r[e])&&(i=JA(i),s=JA(s)),s!==i&&(l[r[e]]=t)}const c=o.serializeStyle(l,"span");return c?t+' style="'+c+'"'+s:t+s})}else t=t.replace(/(<[^>]+) style="([^"]*)"([^>]*>)/gi,"$1$3");return t=t.replace(/(<[^>]+) data-mce-style="([^"]+)"([^>]*>)/gi,(e,t,o,n)=>t+' style="'+o+'"'+n),t},eM=e=>{const t=Oe(!1),o=Oe(Kd(e)?"text":"html"),n=(e=>{const t=Oe(null);return{create:()=>((e,t)=>{const{dom:o,selection:n}=e,r=e.getBody();t.set(n.getRng());const i=o.add(e.getBody(),"div",{id:"mcepastebin",class:"mce-pastebin",contentEditable:!0,"data-mce-bogus":"all",style:"position: fixed; top: 50%; width: 10px; height: 10px; overflow: hidden; opacity: 0"},CA);no.browser.isFirefox()&&o.setStyle(i,"left","rtl"===o.getStyle(r,"direction",!0)?65535:-65535),o.bind(i,"beforedeactivate focusin focusout",e=>{e.stopPropagation()}),i.focus(),n.select(i,!0)})(e,t),remove:()=>((e,t)=>{const o=e.dom;if(kA(e)){let n;const r=t.get();for(;n=kA(e);)o.remove(n),o.unbind(n);r&&e.selection.setRng(r)}t.set(null)})(e,t),getEl:()=>kA(e),getHtml:()=>(e=>{const t=e.dom,o=(e,o)=>{e.appendChild(o),t.remove(o,!0)},[n,...r]=Y(e.getBody().childNodes,SA);W(r,e=>{o(n,e)});const i=t.select("div[id=mcepastebin]",n);for(let e=i.length-1;e>=0;e--){const r=t.create("div");n.insertBefore(r,i[e]),o(r,i[e])}return n?n.innerHTML:""})(e),getLastRng:t.get}})(e);(e=>{(no.browser.isChromium()||no.browser.isSafari())&&((e,t)=>{e.on("PastePreProcess",o=>{o.content=t(e,o.content,o.internal)})})(e,QA)})(e),((e,t)=>{e.addCommand("mceTogglePlainTextPaste",()=>{((e,t)=>{"text"===t.get()?(t.set("html"),fc(e,!1)):(t.set("text"),fc(e,!0)),e.focus()})(e,t)}),e.addCommand("mceInsertClipboardContent",(t,o)=>{o.html&&IA(e,o.html,o.internal,!1),o.text&&LA(e,o.text,!1)})})(e,o),(e=>{const t=t=>o=>{t(e,o)},o=$d(e);x(o)&&e.on("PastePreProcess",t(o));const n=jd(e);x(n)&&e.on("PastePostProcess",t(n))})(e),e.addQueryStateHandler("mceTogglePlainTextPaste",()=>"text"===o.get()),e.on("PreInit",()=>{(e=>{e.on("cut",(e=>t=>{!t.isDefaultPrevented()&&GA(e)&&e.selection.isEditable()&&jA(t,qA(e),WA(e),()=>{if(no.browser.isChromium()||no.browser.isFirefox()){const t=e.selection.getRng();ap.setEditorTimeout(e,()=>{e.selection.setRng(t),e.execCommand("Delete")},0)}else e.execCommand("Delete")})})(e)),e.on("copy",(e=>t=>{!t.isDefaultPrevented()&&GA(e)&&jA(t,qA(e),WA(e),S)})(e))})(e),((e,t)=>{Ud(e)&&e.on("dragend dragover draggesture dragdrop drop drag",e=>{e.preventDefault(),e.stopPropagation()}),Zd(e)||e.on("drop",e=>{const t=e.dataTransfer;t&&(e=>$(e.files,e=>/^image\//.test(e.type)))(t)&&e.preventDefault()}),e.on("drop",o=>{if(o.isDefaultPrevented())return;const n=YA(e,o);if(w(n))return;const r=FA(o.dataTransfer),i=zA(r,yA());if((!HA(r)||(e=>{const t=e["text/plain"];return!!t&&0===t.indexOf("file://")})(r))&&UA(e,o,n))return;const s=r[yA()],a=s||r["text/html"]||r["text/plain"],l=((e,t,o,n)=>{const r=e.getParent(o,e=>Ui(t,e));if(!v(e.getParent(o,"summary")))return!0;if(r&&Se(n,"text/html")){const e=(new DOMParser).parseFromString(n["text/html"],"text/html").body;return!v(e.querySelector(r.nodeName.toLowerCase()))}return!1})(e.dom,e.schema,n.startContainer,r),c=t.get();c&&!l||a&&(o.preventDefault(),ap.setEditorTimeout(e,()=>{e.undoManager.transact(()=>{(s||c&&l)&&e.execCommand("Delete"),XA(e,n);const t=OA(a);r["text/html"]?IA(e,t,i,!0):LA(e,t,!0)})}))}),e.on("dragstart",e=>{t.set(!0)}),e.on("dragover dragend",o=>{Zd(e)&&!t.get()&&(o.preventDefault(),XA(e,YA(e,o))),"dragend"===o.type&&t.set(!1)}),(e=>{e.on("input",t=>{const o=e=>v(e.querySelector("summary"));if("deleteByDrag"===t.inputType){const t=Y(e.dom.select("details"),o);W(t,t=>{ai(t.firstChild)&&t.firstChild.remove();const o=e.dom.create("summary");o.appendChild(Na().dom),t.prepend(o)})}})})(e)})(e,t),$A(e,n,o)})},tM=ai,oM=ti,nM=e=>ui(e.dom),rM=e=>t=>_o(mo(e),t),iM=(e,t)=>or(mo(e),nM,rM(t)),sM=(e,t,o)=>{const n=new Fr(e,t),r=o?n.next.bind(n):n.prev.bind(n);let i=e;for(let t=o?e:r();t&&!tM(t);t=r())gl(t)&&(i=t);return i},aM=e=>{const t=((e,t,o)=>{const n=Dl.fromRangeStart(e).getNode(),r=((e,t,o)=>or(mo(e),e=>(e=>di(e.dom))(e)||o.isBlock(ko(e)),rM(t)).getOr(mo(t)).dom)(n,t,o),i=sM(n,r,!1),s=sM(n,r,!0),a=document.createRange();return iM(i,r).fold(()=>{oM(i)?a.setStart(i,0):a.setStartBefore(i)},e=>a.setStartBefore(e.dom)),iM(s,r).fold(()=>{oM(s)?a.setEnd(s,s.data.length):a.setEndAfter(s)},e=>a.setEndAfter(e.dom)),a})(e.selection.getRng(),e.getBody(),e.schema);e.selection.setRng(jv(t))};var lM;!function(e){e.Before="before",e.After="after"}(lM||(lM={}));const cM=(e,t)=>Math.abs(e.left-t),dM=(e,t)=>Math.abs(e.right-t),uM=(e,t)=>(e=>K(e,(e,t)=>e.fold(()=>L.some(t),e=>{const o=Math.min(t.left,e.left),n=Math.min(t.top,e.top),r=Math.max(t.right,e.right),i=Math.max(t.bottom,e.bottom);return L.some({top:n,right:r,bottom:i,left:o,width:r-o,height:i-n})}),L.none()))(Y(e,e=>{return(o=t)>=(n=e).top&&o<=n.bottom;var o,n})).fold(()=>[[],e],t=>{const{pass:o,fail:n}=G(e,e=>((e,t)=>{const o=((e,t)=>Math.max(0,Math.min(e.bottom,t.bottom)-Math.max(e.top,t.top)))(e,t)/Math.min(e.height,t.height);return((e,t)=>e.top<t.bottom&&e.bottom>t.top)(e,t)&&o>.5})(e,t));return[o,n]}),hM=(e,t,o)=>t>e.left&&t<e.right?0:Math.min(Math.abs(e.left-t),Math.abs(e.right-t)),mM=(e,t,o,n)=>{const r=e=>gl(e.node)?L.some(e):Wr(e.node)?mM(ue(e.node.childNodes),t,o,!1):L.none(),i=(e,i)=>{const s=ae(e,(e,n)=>i(e,t,o)-i(n,t,o));return he(s,r).map(e=>n&&!ti(e.node)&&s.length>1?((e,n,i)=>r(n).filter(n=>Math.abs(i(e,t,o)-i(n,t,o))<2&&ti(n.node)))(e,s[1],i).getOr(e):e)},[s,a]=uM(Bk(e),o),{pass:l,fail:c}=G(a,e=>e.top<o);return i(s,hM).orThunk(()=>i(c,ol)).orThunk(()=>i(l,ol))},pM=(e,t,o)=>((e,t,o)=>{const n=mo(e),r=Vo(n),i=po(r,t,o).filter(e=>xo(n,e)).getOr(n);return((e,t,o,n)=>{const r=(t,i)=>{const s=Y(t.dom.childNodes,R(e=>Wr(e)&&e.classList.contains("mce-drag-container")));return i.fold(()=>mM(s,o,n,!0),e=>{const t=Y(s,t=>t!==e.dom);return mM(t,o,n,!0)}).orThunk(()=>(_o(t,e)?L.none():Io(t)).bind(e=>r(e,L.some(t))))};return r(t,L.none())})(n,i,t,o)})(e,t,o).filter(e=>Vu(e.node)).map(e=>((e,t)=>({node:e.node,position:cM(e,t)<dM(e,t)?lM.Before:lM.After}))(e,t)),gM=e=>{var t,o;const n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.documentElement,s=r.defaultView;return{top:n.top+(null!==(t=null==s?void 0:s.scrollY)&&void 0!==t?t:0)-i.clientTop,left:n.left+(null!==(o=null==s?void 0:s.scrollX)&&void 0!==o?o:0)-i.clientLeft}},fM=e=>({target:e,srcElement:e}),vM=(e,t,o,n)=>{const r=((e,t)=>{const o=(e=>{const t=CT(),o=(e=>{const t=e;return L.from(t[hT])})(e);return fT(e),lT(t),t.dropEffect=e.dropEffect,t.effectAllowed=e.effectAllowed,(e=>{const t=e;return L.from(t[iT])})(e).each(e=>t.setDragImage(e.image,e.x,e.y)),W(e.types,o=>{"Files"!==o&&t.setData(o,e.getData(o))}),W(e.files,e=>t.items.add(e)),(e=>{const t=e;return L.from(t[sT])})(e).each(e=>{((e,t)=>{aT(t)(e)})(t,e)}),o.each(o=>{pT(e,o),pT(t,o)}),t})(e);return"dragstart"===t?(lT(o),gT(o)):"drop"===t?(cT(o),fT(o)):(dT(o),vT(o)),o})(o,e);return y(n)?((e,t,o)=>{const n=N("Function not supported on simulated event.");return{bubbles:!0,cancelBubble:!1,cancelable:!0,composed:!1,currentTarget:null,defaultPrevented:!1,eventPhase:0,isTrusted:!0,returnValue:!1,timeStamp:0,type:e,composedPath:n,initEvent:n,preventDefault:S,stopImmediatePropagation:S,stopPropagation:S,AT_TARGET:window.Event.AT_TARGET,BUBBLING_PHASE:window.Event.BUBBLING_PHASE,CAPTURING_PHASE:window.Event.CAPTURING_PHASE,NONE:window.Event.NONE,altKey:!1,button:0,buttons:0,clientX:0,clientY:0,ctrlKey:!1,layerX:0,layerY:0,metaKey:!1,movementX:0,movementY:0,offsetX:0,offsetY:0,pageX:0,pageY:0,relatedTarget:null,screenX:0,screenY:0,shiftKey:!1,x:0,y:0,detail:0,view:null,which:0,initUIEvent:n,initMouseEvent:n,getModifierState:n,dataTransfer:o,...fM(t)}})(e,t,r):((e,t,o,n)=>({...t,dataTransfer:n,type:e,...fM(o)}))(e,n,t,r)},bM=ui,yM=((...e)=>t=>{for(let o=0;o<e.length;o++)if(e[o](t))return!0;return!1})(bM,di),wM=(e,t,o,n)=>{const r=e.dom,i=t.cloneNode(!0);r.setStyles(i,{width:o,height:n}),r.setAttrib(i,"data-mce-selected",null);const s=r.create("div",{class:"mce-drag-container","data-mce-bogus":"all",unselectable:"on",contenteditable:"false"});return r.setStyles(s,{position:"absolute",opacity:.5,overflow:"hidden",border:0,padding:0,margin:0,width:o,height:n}),r.setStyles(i,{margin:0,boxSizing:"border-box"}),s.appendChild(i),s},_M=(e,t)=>o=>()=>{const n="left"===e?o.scrollX:o.scrollY;o.scroll({[e]:n+t,behavior:"smooth"})},xM=_M("left",-32),CM=_M("left",32),kM=_M("top",-32),SM=_M("top",32),TM=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},EM=(e,t,o,n,r)=>{"dragstart"===t&&kT(n,e.dom.getOuterHTML(o));const i=vM(t,o,n,r);return e.dispatch(t,i)},OM=(e,t)=>{const o=rt((e,o)=>((e,t,o)=>{e._selectionOverrides.hideFakeCaret(),pM(e.getBody(),t,o).fold(()=>e.selection.placeCaretAt(t,o),n=>{const r=e._selectionOverrides.showCaret(1,n.node,n.position===lM.Before,!1);r?e.selection.setRng(r):e.selection.placeCaretAt(t,o)})})(t,e,o),0);t.on("remove",o.cancel);const n=e;return r=>e.on(e=>{const i=Math.max(Math.abs(r.screenX-e.screenX),Math.abs(r.screenY-e.screenY));if(!e.dragging&&i>10){const o=EM(t,"dragstart",e.element,e.dataTransfer,r);if(_(o.dataTransfer)&&(e.dataTransfer=o.dataTransfer),o.isDefaultPrevented())return;e.dragging=!0,t.focus()}if(e.dragging){const i=r.currentTarget===t.getDoc().documentElement,l=((e,t)=>({pageX:t.pageX-e.relX,pageY:t.pageY+5}))(e,((e,t)=>{return o=(e=>e.inline?gM(e.getBody()):{left:0,top:0})(e),n=(e=>{const t=e.getBody();return e.inline?{left:t.scrollLeft,top:t.scrollTop}:{left:0,top:0}})(e),r=((e,t)=>{if(t.target.ownerDocument!==e.getDoc()){const o=gM(e.getContentAreaContainer()),n=(e=>{const t=e.getBody(),o=e.getDoc().documentElement,n={left:t.scrollLeft,top:t.scrollTop},r={left:t.scrollLeft||o.scrollLeft,top:t.scrollTop||o.scrollTop};return e.inline?n:r})(e);return{left:t.pageX-o.left+n.left,top:t.pageY-o.top+n.top}}return{left:t.pageX,top:t.pageY}})(e,t),{pageX:r.left-o.left+n.left,pageY:r.top-o.top+n.top};var o,n,r})(t,r));s=e.ghost,a=t.getBody(),s.parentNode!==a&&a.appendChild(s),((e,t,o,n,r,i,s,a,l,c,d,u)=>{let h=0,m=0;e.style.left=t.pageX+"px",e.style.top=t.pageY+"px",t.pageX+o>r&&(h=t.pageX+o-r),t.pageY+n>i&&(m=t.pageY+n-i),e.style.width=o-h+"px",e.style.height=n-m+"px";const p=l.clientHeight,g=l.clientWidth,f=s+l.getBoundingClientRect().top,v=a+l.getBoundingClientRect().left;d.on(e=>{e.intervalId.clear(),e.dragging&&u&&(s+8>=p?e.intervalId.set(SM(c)):s-8<=0?e.intervalId.set(kM(c)):a+8>=g?e.intervalId.set(CM(c)):a-8<=0?e.intervalId.set(xM(c)):f+16>=window.innerHeight?e.intervalId.set(SM(window)):f-16<=0?e.intervalId.set(kM(window)):v+16>=window.innerWidth?e.intervalId.set(CM(window)):v-16<=0&&e.intervalId.set(xM(window)))})})(e.ghost,l,e.width,e.height,e.maxX,e.maxY,r.clientY,r.clientX,t.getContentAreaContainer(),t.getWin(),n,i),o.throttle(r.clientX,r.clientY)}var s,a})},AM=(e,t,o)=>{e.on(e=>{e.intervalId.clear(),e.dragging&&o.fold(()=>EM(t,"dragend",e.element,e.dataTransfer),o=>EM(t,"dragend",e.element,e.dataTransfer,o))}),MM(e)},MM=e=>{e.on(e=>{e.intervalId.clear(),TM(e.ghost)}),e.clear()},BM=e=>{const t=je(),o=ra.DOM,n=document,r=((e,t)=>o=>{if((e=>0===e.button)(o)){const n=Q(t.dom.getParents(o.target),yM).getOr(null);if(_(n)&&((e,t,o)=>bM(o)&&o!==t&&e.isEditable(o.parentElement))(t.dom,t.getBody(),n)){const r=t.dom.getPos(n),i=t.getBody(),s=t.getDoc().documentElement;e.set({element:n,dataTransfer:CT(),dragging:!1,screenX:o.screenX,screenY:o.screenY,maxX:(t.inline?i.scrollWidth:s.offsetWidth)-2,maxY:(t.inline?i.scrollHeight:s.offsetHeight)-2,relX:o.pageX-r.x,relY:o.pageY-r.y,width:n.offsetWidth,height:n.offsetHeight,ghost:wM(t,n,n.offsetWidth,n.offsetHeight),intervalId:$e(100)})}}})(t,e),i=OM(t,e),s=((e,t)=>o=>{e.on(e=>{var n;if(e.intervalId.clear(),e.dragging){if(((e,t,o)=>!w(t)&&t!==o&&!e.dom.isChildOf(t,o)&&e.dom.isEditable(t))(t,(e=>{const t=e.getSel();if(_(t)){const e=t.getRangeAt(0).startContainer;return ti(e)?e.parentNode:e}return null})(t.selection),e.element)){const r=null!==(n=t.getDoc().elementFromPoint(o.clientX,o.clientY))&&void 0!==n?n:t.getBody();EM(t,"drop",r,e.dataTransfer,o).isDefaultPrevented()||t.undoManager.transact(()=>{((e,t)=>{const o=e.getParent(t.parentNode,e.isBlock);TM(t),o&&o!==e.getRoot()&&e.isEmpty(o)&&Va(mo(o))})(t.dom,e.element),(e=>{const t=e.getData("text/html");return""===t?L.none():L.some(t)})(e.dataTransfer).each(e=>t.insertContent(e)),t._selectionOverrides.hideFakeCaret()})}EM(t,"dragend",t.getBody(),e.dataTransfer,o)}}),MM(e)})(t,e),a=((e,t)=>o=>AM(e,t,L.some(o)))(t,e);e.on("mousedown",r),e.on("mousemove",i),e.on("mouseup",s),o.bind(n,"mousemove",i),o.bind(n,"mouseup",a),e.on("remove",()=>{o.unbind(n,"mousemove",i),o.unbind(n,"mouseup",a)}),e.on("keydown",o=>{o.keyCode===Cp.ESC&&AM(t,e,L.none())})},RM=ui,NM=(e,t)=>Mv(e.getBody(),t),VM=e=>{const t=e.selection,o=e.dom,n=e.getBody(),r=Bu(e,n,o.isBlock,()=>wp(e)),i="sel-"+o.uniqueId(),s="data-mce-selected";let a;const l=e=>e!==n&&(RM(e)||gi(e))&&o.isChildOf(e,n)&&o.isEditable(e.parentNode),c=(o,n,i,s=!0)=>e.dispatch("ShowCaret",{target:n,direction:o,before:i}).isDefaultPrevented()?null:(s&&t.scrollIntoView(n,-1===o),r.show(i,n)),d=e=>Ua(e)||Wa(e)||qa(e),u=e=>d(e.startContainer)||d(e.endContainer),h=t=>{const n=e.schema.getVoidElements(),r=o.createRng(),i=t.startContainer,s=t.startOffset,a=t.endContainer,l=t.endOffset;return Se(n,i.nodeName.toLowerCase())?0===s?r.setStartBefore(i):r.setStartAfter(i):r.setStart(i,s),Se(n,a.nodeName.toLowerCase())?0===l?r.setEndBefore(a):r.setEndAfter(a):r.setEnd(a,l),r},m=(r,d)=>{if(!r)return null;if(r.collapsed){if(!u(r)){const e=d?1:-1,t=rh(e,n,r),i=t.getNode(!d);if(_(i)){if(Vu(i))return c(e,i,!!d&&!t.isAtEnd(),!1);if(Ha(i)&&ui(i.nextSibling)){const e=o.createRng();return e.setStart(i,0),e.setEnd(i,0),e}}const s=t.getNode(d);if(_(s)){if(Vu(s))return c(e,s,!d&&!t.isAtEnd(),!1);if(Ha(s)&&ui(s.previousSibling)){const e=o.createRng();return e.setStart(s,1),e.setEnd(s,1),e}}}return null}let h=r.startContainer,m=r.startOffset;const p=r.endOffset;if(ti(h)&&0===m&&RM(h.parentNode)&&(h=h.parentNode,m=o.nodeIndex(h),h=h.parentNode),!Wr(h))return null;if(p===m+1&&h===r.endContainer){const n=h.childNodes[m];if(l(n))return(n=>{const r=n.cloneNode(!0),l=e.dispatch("ObjectSelected",{target:n,targetClone:r});if(l.isDefaultPrevented())return null;const c=((n,r)=>{const s=mo(e.getBody()),a=e.getDoc(),l=ir(s,"#"+i).getOrThunk(()=>{const e=co('<div data-mce-bogus="all" class="mce-offscreen-selection"></div>',a);return gn(e,"id",i),un(s,e),e}),c=o.createRng();xn(l),mn(l,[ho(lt,a),mo(r),ho(lt,a)]),c.setStart(l.dom.firstChild,1),c.setEnd(l.dom.lastChild,0),Dn(l,{top:o.getPos(n,e.getBody()).y+"px"}),rn(l);const d=t.getSel();return d&&(d.removeAllRanges(),d.addRange(c)),c})(n,l.targetClone),d=mo(n);return W(yr(mo(e.getBody()),`*[${s}]`),e=>{_o(d,e)||wn(e,s)}),o.getAttrib(n,s)||n.setAttribute(s,"1"),a=n,g(),c})(n)}return null},p=()=>{a&&a.removeAttribute(s),ir(mo(e.getBody()),"#"+i).each(Cn),a=null},g=()=>{r.hide()};return M_(e)||(e.on("click",t=>{o.isEditable(t.target)||(t.preventDefault(),e.focus())}),e.on("blur NewBlock",p),e.on("ResizeWindow FullscreenStateChanged",r.reposition),e.on("tap",t=>{const o=t.target,n=NM(e,o);RM(n)?(t.preventDefault(),gC(e,n).each(m)):l(o)&&gC(e,o).each(m)},!0),e.on("mousedown",r=>{const i=r.target;if(i!==n&&"HTML"!==i.nodeName&&!o.isChildOf(i,n))return;if(!((e,t,o)=>{const n=mo(e.getBody()),r=e.inline?n:mo(Vo(n).dom.documentElement),i=((e,t,o,n)=>{const r=(e=>e.dom.getBoundingClientRect())(t);return{x:o-(e?r.left+t.dom.clientLeft+cx(t):0),y:n-(e?r.top+t.dom.clientTop+lx(t):0)}})(e.inline,r,t,o);return((e,t,o)=>{const n=sx(e),r=ax(e);return t>=0&&o>=0&&t<=n&&o<=r})(r,i.x,i.y)})(e,r.clientX,r.clientY))return;p(),g();const s=NM(e,i);RM(s)?(r.preventDefault(),gC(e,s).each(m)):pM(n,r.clientX,r.clientY).each(o=>{var n;r.preventDefault(),(n=c(1,o.node,o.position===lM.Before,!1))&&t.setRng(n),qr(s)?s.focus():e.getBody().focus()})}),e.on("keypress",e=>{Cp.modifierPressed(e)||RM(t.getNode())&&e.preventDefault()}),e.on("GetSelectionRange",e=>{let t=e.range;if(a){if(!a.parentNode)return void(a=null);t=t.cloneRange(),t.selectNode(a),e.range=t}}),e.on("focusin",t=>{if(r.isShowing()&&e.getBody().contains(t.target)&&t.target!==e.getBody()&&!e.dom.isEditable(t.target.parentNode)){r.hide(),t.target.contains(e.selection.getNode())||(e.selection.select(t.target,!0),e.selection.collapse(!0));const o=m(e.selection.getRng(),!0);o&&e.selection.setRng(o)}}),e.on("SetSelectionRange",e=>{e.range=h(e.range);const t=m(e.range,e.forward);t&&(e.range=t)}),e.on("AfterSetSelectionRange",e=>{const t=e.range,n=t.startContainer.parentElement;var r;u(t)||Wr(r=n)&&"mcepastebin"===r.id||g(),(e=>_(e)&&o.hasClass(e,"mce-offscreen-selection"))(n)||p()}),(e=>{BM(e),Bd(e)&&(e=>{const t=t=>{if(!t.isDefaultPrevented()){const o=t.dataTransfer;o&&(Z(o.types,"Files")||o.files.length>0)&&(t.preventDefault(),"drop"===t.type&&gx(e,"Dropped file type is not supported"))}},o=o=>{pp(e,o.target)&&t(o)},n=()=>{const n=ra.DOM,r=e.dom,i=document,s=e.inline?e.getBody():e.getDoc(),a=["drop","dragover"];W(a,e=>{n.bind(i,e,o),r.bind(s,e,t)}),e.on("remove",()=>{W(a,e=>{n.unbind(i,e,o),r.unbind(s,e,t)})})};e.on("init",()=>{ap.setEditorTimeout(e,n,0)})})(e)})(e),(e=>{const t=rt(()=>{if(!e.removed&&e.getBody().contains(document.activeElement)){const t=e.selection.getRng();if(t.collapsed){const o=fC(e,t,!1);e.selection.setRng(o)}}},0);e.on("focus",()=>{t.throttle()}),e.on("blur",()=>{t.cancel()})})(e),(e=>{e.on("init",()=>{e.on("focusin",t=>{const o=t.target;if(gi(o)){const t=Mv(e.getBody(),o),n=ui(t)?t:o;e.selection.getNode()!==n&&gC(e,n).each(t=>e.selection.setRng(t))}})})})(e)),{showCaret:c,showBlockCaretContainer:e=>{e.hasAttribute("data-mce-caret")&&(Ga(e),t.scrollIntoView(e))},hideFakeCaret:g,destroy:()=>{r.destroy(),a=null}}},DM=(e,t)=>{let o=t;for(let t=e.previousSibling;ti(t);t=t.previousSibling)o+=t.data.length;return o},PM=(e,t,o,n,r)=>{if(ti(o)&&(n<0||n>o.data.length))return[];const i=r&&ti(o)?[DM(o,n)]:[n];let s=o;for(;s!==t&&s.parentNode;)i.push(e.nodeIndex(s,r)),s=s.parentNode;return s===t?i.reverse():[]},IM=(e,t,o,n,r,i,s=!1)=>({start:PM(e,t,o,n,s),end:PM(e,t,r,i,s)}),LM=(e,t)=>{const o=t.slice(),n=o.pop();return C(n)?K(o,(e,t)=>e.bind(e=>L.from(e.childNodes[t])),L.some(e)).bind(e=>ti(e)&&(n<0||n>e.data.length)?L.none():L.some({node:e,offset:n})):L.none()},FM=(e,t)=>LM(e,t.start).bind(({node:o,offset:n})=>LM(e,t.end).map(({node:e,offset:t})=>{const r=document.createRange();return r.setStart(o,n),r.setEnd(e,t),r})),zM=(e,t,o)=>{if(t&&e.isEmpty(t)&&!o(t)){const n=t.parentNode;e.remove(t,ti(t.firstChild)&&Hr(t.firstChild.data)),zM(e,n,o)}},HM=(e,t,o,n=!0)=>{const r=t.startContainer.parentNode,i=t.endContainer.parentNode;t.deleteContents(),n&&!o(t.startContainer)&&(ti(t.startContainer)&&0===t.startContainer.data.length&&e.remove(t.startContainer),ti(t.endContainer)&&0===t.endContainer.data.length&&e.remove(t.endContainer),zM(e,r,o),r!==i&&zM(e,i,o))},UM=(e,t)=>L.from(e.dom.getParent(t.startContainer,e.dom.isBlock)),ZM=(e,t,o)=>{const n=e.dynamicPatternsLookup({text:o,block:t});return{...e,blockPatterns:sc(n).concat(e.blockPatterns),inlinePatterns:ac(n).concat(e.inlinePatterns)}},$M=(e,t,o,n)=>{const r=e.createRng();return r.setStart(t,0),r.setEnd(o,n),r.toString()},jM=(e,t)=>e.create("span",{"data-mce-type":"bookmark",id:t}),WM=(e,t)=>{const o=e.createRng();return o.setStartAfter(t.start),o.setEndBefore(t.end),o},qM=(e,t,o)=>{const n=FM(e.getRoot(),o).getOrDie("Unable to resolve path range"),r=n.startContainer,i=n.endContainer,s=0===n.endOffset?i:i.splitText(n.endOffset),a=0===n.startOffset?r:r.splitText(n.startOffset),l=a.parentNode;return{prefix:t,end:s.parentNode.insertBefore(jM(e,t+"-end"),s),start:l.insertBefore(jM(e,t+"-start"),a)}},GM=(e,t,o)=>{zM(e,e.get(t.prefix+"-end"),o),zM(e,e.get(t.prefix+"-start"),o)},YM=e=>0===e.start.length,XM=(e,t,o,n)=>{const r=t.start;var i;return XT(e,n.container,n.offset,(i=r,(e,t)=>{const o=e.data.substring(0,t),n=o.lastIndexOf(i.charAt(i.length-1)),r=o.lastIndexOf(i);return-1!==r?r+i.length:-1!==n?n+1:-1}),o).bind(n=>{var i,s;const a=null!==(s=null===(i=o.textContent)||void 0===i?void 0:i.indexOf(r))&&void 0!==s?s:-1;if(-1!==a&&n.offset>=a+r.length){const t=e.createRng();return t.setStart(n.container,n.offset-r.length),t.setEnd(n.container,n.offset),L.some(t)}{const i=n.offset-r.length;return GT(n.container,i,o).map(t=>{const o=e.createRng();return o.setStart(t.container,t.offset),o.setEnd(n.container,n.offset),o}).filter(e=>e.toString()===r).orThunk(()=>XM(e,t,o,$T(n.container,0)))}})},KM=(e,t,o,n)=>{const r=e.dom,i=r.getRoot(),s=o.pattern,a=o.position.container,l=o.position.offset;return GT(a,l-o.pattern.end.length,t).bind(c=>{const d=IM(r,i,c.container,c.offset,a,l,n);if(YM(s))return L.some({matches:[{pattern:s,startRng:d,endRng:d}],position:c});{const a=JM(e,o.remainingPatterns,c.container,c.offset,t,n),l=a.getOr({matches:[],position:c}),u=l.position,h=((e,t,o,n,r,i=!1)=>{if(0===t.start.length&&!i){const t=e.createRng();return t.setStart(o,n),t.setEnd(o,n),L.some(t)}return qT(o,n,r).bind(o=>XM(e,t,r,o).bind(e=>{var t;if(i){if(e.endContainer===o.container&&e.endOffset===o.offset)return L.none();if(0===o.offset&&(null===(t=e.endContainer.textContent)||void 0===t?void 0:t.length)===e.endOffset)return L.none()}return L.some(e)}))})(r,s,u.container,u.offset,t,a.isNone());return h.map(e=>{const t=((e,t,o,n=!1)=>IM(e,t,o.startContainer,o.startOffset,o.endContainer,o.endOffset,n))(r,i,e,n);return{matches:l.matches.concat([{pattern:s,startRng:t,endRng:d}]),position:$T(e.startContainer,e.startOffset)}})}})},JM=(e,t,o,n,r,i)=>{const s=e.dom;return qT(o,n,s.getRoot()).bind(a=>{const l=$M(s,r,o,n);for(let s=0;s<t.length;s++){const c=t[s];if(!Xe(l,c.end))continue;const d=t.slice();d.splice(s,1);const u=KM(e,r,{pattern:c,remainingPatterns:d,position:a},i);if(u.isNone()&&n>0)return JM(e,t,o,n-1,r,i);if(u.isSome())return u}return L.none()})},QM=(e,t,o)=>{e.selection.setRng(o),"inline-format"===t.type?W(t.format,t=>{e.formatter.apply(t)}):e.execCommand(t.cmd,!1,t.value)},eB=(e,t,o,n,r,i)=>{var s;return((e,t)=>{const o=ne(e,e=>$(t,t=>e.pattern.start===t.pattern.start&&e.pattern.end===t.pattern.end));return e.length===t.length?o?e:t:e.length>t.length?e:t})(JM(e,r.inlinePatterns,o,n,t,i).fold(()=>[],e=>e.matches),JM(e,(s=r.inlinePatterns,ae(s,(e,t)=>t.end.length-e.end.length)),o,n,t,i).fold(()=>[],e=>e.matches))},tB=(e,t)=>{if(0===t.length)return;const o=e.dom,n=e.selection.getBookmark(),r=((e,t)=>{const o=De("mce_textpattern"),n=X(t,(t,n)=>{const r=qM(e,o+`_end${t.length}`,n.endRng);return t.concat([{...n,endMarker:r}])},[]);return X(n,(t,r)=>{const i=n.length-t.length-1,s=YM(r.pattern)?r.endMarker:qM(e,o+`_start${i}`,r.startRng);return t.concat([{...r,startMarker:s}])},[])})(o,t);W(r,t=>{const n=o.getParent(t.startMarker.start,o.isBlock),r=e=>e===n;YM(t.pattern)?((e,t,o,n)=>{const r=WM(e.dom,o);HM(e.dom,r,n),QM(e,t,r)})(e,t.pattern,t.endMarker,r):((e,t,o,n,r)=>{const i=e.dom,s=WM(i,n),a=WM(i,o);HM(i,a,r),HM(i,s,r);const l={prefix:o.prefix,start:o.end,end:n.start},c=WM(i,l);QM(e,t,c)})(e,t.pattern,t.startMarker,t.endMarker,r),GM(o,t.endMarker,r),GM(o,t.startMarker,r)}),e.selection.moveToBookmark(n)},oB=(e,t,o)=>((e,t,o)=>{if(ti(e)&&0>=e.length)return L.some($T(e,0));{const t=ka(jT);return L.from(t.forwards(e,0,WT(e),o)).map(e=>$T(e.container,0))}})(t,0,t).map(n=>{const r=n.container;return YT(r,o.start.length,t).each(o=>{const n=e.createRng();n.setStart(r,0),n.setEnd(o.container,o.offset),HM(e,n,e=>e===t)}),r}),nB=e=>(t,o)=>{const n=t.dom,r=o.pattern,i=FM(n.getRoot(),o.range).getOrDie("Unable to resolve path range");return UM(t,i).each(o=>{"block-format"===r.type?((e,t)=>{const o=t.get(e);return f(o)&&ce(o).exists(e=>Se(e,"block"))})(r.format,t.formatter)&&t.undoManager.transact(()=>{e(t.dom,o,r),t.formatter.apply(r.format)}):"block-command"===r.type&&t.undoManager.transact(()=>{e(t.dom,o,r),t.execCommand(r.cmd,!1,r.value)})}),!0},rB=e=>(t,o)=>{const n=(e=>ae(e,(e,t)=>t.start.length-e.start.length))(t),r=o.replace(lt," ");return Q(n,t=>e(t,o,r))},iB=(e,t)=>(o,n,r,i,s)=>{var a;void 0===s&&(s=null!==(a=n.textContent)&&void 0!==a?a:"");const l=o.dom,c=Bc(o);return l.is(n,c)?e(r.blockPatterns,s).map(e=>t&&ao.trim(s).length===e.start.length?[]:[{pattern:e,range:IM(l,l.getRoot(),n,0,n,0,i)}]).getOr([]):[]},sB=nB((e,t,o)=>{oB(e,t,o).each(e=>{const t=mo(e),o=Kn(t);/^\s[^\s]/.test(o)&&Jn(t,o.slice(1))})}),aB=rB((e,t,o)=>0===t.indexOf(e.start)||0===o.indexOf(e.start)),lB=iB(aB,!0),cB=nB(oB),dB=rB((e,t,o)=>t===e.start||o===e.start),uB=iB(dB,!1),hB=(e,t,o)=>{for(let n=0;n<e.length;n++)if(o(e[n],t))return!0;return!1},mB=e=>{const t=[",",".",";",":","!","?"],o=[32],n=()=>{return t=eu(e).filter(t=>"inline-command"!==t.type&&"block-command"!==t.type||e.queryCommandSupported(t.cmd)),o=tu(e),{inlinePatterns:ac(t),blockPatterns:sc(t),dynamicPatternsLookup:o};var t,o},r=()=>(e=>e.options.isSet("text_patterns_lookup"))(e);e.on("keydown",t=>{if(13===t.keyCode&&!Cp.modifierPressed(t)&&e.selection.isCollapsed()&&e.selection.isEditable()){const o=lc(n(),"enter");(o.inlinePatterns.length>0||o.blockPatterns.length>0||r())&&((e,t)=>((e,t)=>{const o=e.selection.getRng();return UM(e,o).map(n=>{var r;const i=Math.max(0,o.startOffset),s=ZM(t,n,null!==(r=n.textContent)&&void 0!==r?r:"");return{inlineMatches:eB(e,n,o.startContainer,i,s,!0),blockMatches:lB(e,n,s,!0)}}).filter(({inlineMatches:e,blockMatches:t})=>t.length>0||e.length>0)})(e,t).fold(P,({inlineMatches:t,blockMatches:o})=>(e.undoManager.add(),e.undoManager.extra(()=>{e.execCommand("mceInsertNewLine")},()=>{(e=>{e.insertContent(Da,{preserve_zwsp:!0})})(e),tB(e,t),((e,t)=>{if(0===t.length)return;const o=e.selection.getBookmark();W(t,t=>sB(e,t)),e.selection.moveToBookmark(o)})(e,o);const n=e.selection.getRng(),r=qT(n.startContainer,n.startOffset,e.dom.getRoot());e.execCommand("mceInsertNewLine"),r.each(t=>{const o=t.container;o.data.charAt(t.offset-1)===at&&(o.deleteData(t.offset-1,1),zM(e.dom,o.parentNode,t=>t===e.dom.getRoot()))})}),!0)))(e,o)&&t.preventDefault()}},!0),e.on("keydown",t=>{if(32===t.keyCode&&e.selection.isCollapsed()&&e.selection.isEditable()){const o=lc(n(),"space");(o.blockPatterns.length>0||r())&&((e,t)=>((e,t)=>{const o=e.selection.getRng();return UM(e,o).map(n=>{const r=Math.max(0,o.startOffset),i=$M(e.dom,n,o.startContainer,r),s=ZM(t,n,i);return uB(e,n,s,!1,i)}).filter(e=>e.length>0)})(e,t).fold(P,t=>(e.undoManager.transact(()=>{((e,t)=>{W(t,t=>cB(e,t))})(e,t)}),!0)))(e,o)&&t.preventDefault()}},!0);const i=()=>{if(e.selection.isCollapsed()&&e.selection.isEditable()){const t=lc(n(),"space");(t.inlinePatterns.length>0||r())&&((e,t)=>{const o=e.selection.getRng();UM(e,o).map(n=>{const r=Math.max(0,o.startOffset-1),i=$M(e.dom,n,o.startContainer,r),s=ZM(t,n,i),a=eB(e,n,o.startContainer,r,s,!1);a.length>0&&e.undoManager.transact(()=>{tB(e,a)})})})(e,t)}};e.on("keyup",e=>{hB(o,e,(e,t)=>e===t.keyCode&&!Cp.modifierPressed(t))&&i()}),e.on("keypress",o=>{hB(t,o,(e,t)=>e.charCodeAt(0)===t.charCode)&&ap.setEditorTimeout(e,i)})},pB=e=>{const t=ao.each,o=Cp.BACKSPACE,n=Cp.DELETE,r=e.dom,i=e.selection,s=e.parser,a=no.browser,l=a.isFirefox(),c=a.isChromium()||a.isSafari(),d=no.deviceType.isiPhone()||no.deviceType.isiPad(),u=no.os.isMacOS()||no.os.isiOS(),h=(t,o)=>{try{e.getDoc().execCommand(t,!1,String(o))}catch(e){}},m=e=>e.isDefaultPrevented(),p=()=>{e.shortcuts.add("meta+a",null,"SelectAll")},g=()=>{e.inline||r.bind(e.getDoc(),"mousedown mouseup",t=>{let o;if(t.target===e.getDoc().documentElement)if(o=i.getRng(),e.getBody().focus(),"mousedown"===t.type){if(Ua(o.startContainer))return;i.placeCaretAt(t.clientX,t.clientY)}else i.setRng(o)})},f=()=>{Range.prototype.getClientRects||e.on("mousedown",t=>{if(!m(t)&&"HTML"===t.target.nodeName){const t=e.getBody();t.blur(),ap.setEditorTimeout(e,()=>{t.focus()})}})},v=()=>{const t=Vd(e);e.on("click",o=>{const n=o.target;/^(IMG|HR)$/.test(n.nodeName)&&r.isEditable(n)&&(o.preventDefault(),e.selection.select(n),e.nodeChanged()),"A"===n.nodeName&&r.hasClass(n,t)&&0===n.childNodes.length&&r.isEditable(n.parentNode)&&(o.preventDefault(),i.select(n))})},b=()=>{e.on("keydown",e=>{if(!m(e)&&e.keyCode===o&&i.isCollapsed()&&0===i.getRng().startOffset){const t=i.getNode().previousSibling;if(t&&t.nodeName&&"table"===t.nodeName.toLowerCase())return e.preventDefault(),!1}return!0})},y=()=>{Td(e)||e.on("BeforeExecCommand mousedown",()=>{h("StyleWithCSS",!1),h("enableInlineTableEditing",!1),rd(e)||h("enableObjectResizing",!1)})},w=()=>{e.contentStyles.push("img:-moz-broken {-moz-force-broken-image-icon:1;min-width:24px;min-height:24px}")},_=()=>{e.inline||e.on("keydown",()=>{document.activeElement===document.body&&e.getWin().focus()})},x=()=>{e.inline||(e.contentStyles.push("body {min-height: 150px}"),e.on("click",t=>{let o;"HTML"===t.target.nodeName&&(o=e.selection.getRng(),e.getBody().focus(),e.selection.setRng(o),e.selection.normalize(),e.nodeChanged())}))},C=()=>{u&&e.on("keydown",t=>{!Cp.metaKeyPressed(t)||t.shiftKey||37!==t.keyCode&&39!==t.keyCode||(t.preventDefault(),e.selection.getSel().modify("move",37===t.keyCode?"backward":"forward","lineboundary"))})},k=()=>{e.on("click",e=>{let t=e.target;do{if("A"===t.tagName)return void e.preventDefault()}while(t=t.parentNode)}),e.contentStyles.push(".mce-content-body {-webkit-touch-callout: none}")},T=()=>{e.on("init",()=>{e.dom.bind(e.getBody(),"submit",e=>{e.preventDefault()})})},E=S;return M_(e)?(c&&(g(),v(),T(),p(),d&&(_(),x(),k())),l&&(f(),y(),w(),C())):(e.on("keydown",t=>{if(m(t)||t.keyCode!==Cp.BACKSPACE)return;let o=i.getRng();const n=o.startContainer,s=o.startOffset,a=r.getRoot();let l=n;if(o.collapsed&&0===s){for(;l.parentNode&&l.parentNode.firstChild===l&&l.parentNode!==a;)l=l.parentNode;"BLOCKQUOTE"===l.nodeName&&(e.formatter.toggle("blockquote",void 0,l),o=r.createRng(),o.setStart(n,0),o.setEnd(n,0),i.setRng(o))}}),(()=>{const t=e=>{const t=r.create("body"),o=e.cloneContents();return t.appendChild(o),i.serializer.serialize(t,{format:"html"})};e.on("keydown",i=>{const s=i.keyCode;if(!m(i)&&(s===n||s===o)&&e.selection.isEditable()){const o=e.selection.isCollapsed(),n=e.getBody();if(o&&!Ci(e.schema,n))return;if(!o&&!(o=>{const n=t(o),i=r.createRng();return i.selectNode(e.getBody()),n===t(i)})(e.selection.getRng()))return;i.preventDefault(),e.setContent(""),n.firstChild&&r.isBlock(n.firstChild)?e.selection.setCursorLocation(n.firstChild,0):e.selection.setCursorLocation(n,0),e.nodeChanged()}})})(),no.windowsPhone||e.on("keyup focusin mouseup",t=>{Cp.modifierPressed(t)||(e=>{const t=e.getBody(),o=e.selection.getRng();return o.startContainer===o.endContainer&&o.startContainer===t&&0===o.startOffset&&o.endOffset===t.childNodes.length})(e)||i.normalize()},!0),c&&(g(),v(),e.on("init",()=>{h("DefaultParagraphSeparator",Bc(e))}),T(),b(),s.addNodeFilter("br",e=>{let t=e.length;for(;t--;)"Apple-interchange-newline"===e[t].attr("class")&&e[t].remove()}),d?(_(),x(),k()):p()),l&&(e.on("mousedown",t=>{He(L.from(t.clientX),L.from(t.clientY),(o,n)=>{const r=e.getDoc().caretPositionFromPoint(o,n),i=(null==r?void 0:r.offsetNode.childNodes[r.offset-(r.offset>0?1:0)])||(null==r?void 0:r.offsetNode);if(i&&"IMG"===(s=i).nodeName&&e.dom.isEditable(s)){const o=i.getBoundingClientRect();t.preventDefault(),e.hasFocus()||e.focus(),e.selection.select(i),t.clientX<o.left||t.clientY<o.top?e.selection.collapse(!0):(t.clientX>o.right||t.clientY>o.bottom)&&e.selection.collapse(!1)}var s})}),e.on("keydown",t=>{if(!m(t)&&t.keyCode===o){if(!e.getBody().getElementsByTagName("hr").length)return;if(i.isCollapsed()&&0===i.getRng().startOffset){const e=i.getNode(),o=e.previousSibling;if("HR"===e.nodeName)return r.remove(e),void t.preventDefault();o&&o.nodeName&&"hr"===o.nodeName.toLowerCase()&&(r.remove(o),t.preventDefault())}}}),f(),(()=>{const o=()=>{const o=r.getAttribs(i.getStart().cloneNode(!1));return()=>{const n=i.getStart();n!==e.getBody()&&(r.setAttrib(n,"style",null),t(o,e=>{n.setAttributeNode(e.cloneNode(!0))}))}},n=()=>!i.isCollapsed()&&r.getParent(i.getStart(),r.isBlock)!==r.getParent(i.getEnd(),r.isBlock);e.on("keypress",t=>{let r;return!(!(m(t)||8!==t.keyCode&&46!==t.keyCode)&&n()&&(r=o(),e.getDoc().execCommand("delete",!1),r(),t.preventDefault(),1))}),r.bind(e.getDoc(),"cut",t=>{if(!m(t)&&n()){const t=o();ap.setEditorTimeout(e,()=>{t()})}})})(),y(),e.on("SetContent ExecCommand",e=>{"setcontent"!==e.type&&"mceInsertLink"!==e.command||t(r.select("a:not([data-mce-block])"),e=>{var t;let o=e.parentNode;const n=r.getRoot();if((null==o?void 0:o.lastChild)===e){for(;o&&!r.isBlock(o);){if((null===(t=o.parentNode)||void 0===t?void 0:t.lastChild)!==o||o===n)return;o=o.parentNode}r.add(o,"br",{"data-mce-bogus":1})}})}),w(),C(),b())),{refreshContentEditable:E,isHidden:()=>{if(!l||e.removed)return!1;const t=e.selection.getSel();return!t||!t.rangeCount||0===t.rangeCount}}},gB=ra.DOM,fB=e=>e.inline?e.getElement().nodeName.toLowerCase():void 0,vB=e=>_e(e,e=>!1===y(e)),bB=e=>{const t=e.options.get,o=e.editorUpload.blobCache;return vB({allow_conditional_comments:t("allow_conditional_comments"),allow_html_data_urls:t("allow_html_data_urls"),allow_svg_data_urls:t("allow_svg_data_urls"),allow_html_in_named_anchor:t("allow_html_in_named_anchor"),allow_script_urls:t("allow_script_urls"),allow_html_in_comments:t("allow_html_in_comments"),allow_mathml_annotation_encodings:t("allow_mathml_annotation_encodings"),allow_unsafe_link_target:t("allow_unsafe_link_target"),convert_unsafe_embeds:t("convert_unsafe_embeds"),convert_fonts_to_spans:t("convert_fonts_to_spans"),extended_mathml_attributes:t("extended_mathml_attributes"),extended_mathml_elements:t("extended_mathml_elements"),fix_list_elements:t("fix_list_elements"),font_size_legacy_values:t("font_size_legacy_values"),forced_root_block:t("forced_root_block"),forced_root_block_attrs:t("forced_root_block_attrs"),preserve_cdata:t("preserve_cdata"),inline_styles:t("inline_styles"),root_name:fB(e),sandbox_iframes:t("sandbox_iframes"),sandbox_iframes_exclusions:pu(e),sanitize:t("xss_sanitization"),validate:!0,blob_cache:o,document:e.getDoc()})},yB=e=>{const t=e.options.get;return vB({custom_elements:t("custom_elements"),extended_valid_elements:t("extended_valid_elements"),invalid_elements:t("invalid_elements"),invalid_styles:t("invalid_styles"),schema:t("schema"),valid_children:t("valid_children"),valid_classes:t("valid_classes"),valid_elements:t("valid_elements"),valid_styles:t("valid_styles"),verify_html:t("verify_html"),padd_empty_block_inline_children:t("format_empty_lines")})},wB=e=>e.inline?e.ui.styleSheetLoader:e.dom.styleSheetLoader,_B=e=>{const t=wB(e),o=td(e),n=e.contentCSS,r=()=>{t.unloadAll(n),e.inline||e.ui.styleSheetLoader.unloadAll(o)},i=()=>{e.removed?r():e.on("remove",r)};if(e.contentStyles.length>0){let t="";ao.each(e.contentStyles,e=>{t+=e+"\r\n"}),e.dom.addStyle(t)}const s=Promise.all(((e,t,o)=>{const{pass:n,fail:r}=G(t,e=>mailpoetTinymce.Resource.has(Ox(e))),i=n.map(t=>{const o=mailpoetTinymce.Resource.get(Ox(t));return m(o)?Promise.resolve(wB(e).loadRawCss(t,o)):Promise.resolve()}),s=[...i,wB(e).loadAll(r)];return e.inline?s:s.concat([e.ui.styleSheetLoader.loadAll(o)])})(e,n,o)).then(i).catch(i),a=ed(e);return a&&((e,t)=>{const o=mo(e.getBody()),n=Xo(Yo(o)),r=uo("style");gn(r,"type","text/css"),un(r,ho(t)),un(n,r),e.on("remove",()=>{Cn(r)})})(e,a),s},xB=e=>{!0!==e.removed&&((e=>{M_(e)||e.load({initial:!0,format:"html"}),e.startContent=e.getContent({format:"raw"})})(e),(e=>{e.bindPendingEventDelegates(),e.initialized=!0,(e=>{e.dispatch("Init")})(e),e.focus(!0),(e=>{const t=e.dom.getRoot();e.inline||nm(e)&&e.selection.getStart(!0)!==t||Oh(t).each(t=>{const o=t.getNode(),n=Jr(o)?Oh(o).getOr(t):t;e.selection.setRng(n.toRange())})})(e),e.nodeChanged({initial:!0});const t=Id(e);x(t)&&t.call(e,e),(e=>{const t=Fd(e);t&&ap.setEditorTimeout(e,()=>{let o;o=!0===t?e:e.editorManager.get(t),o&&!o.destroyed&&(o.focus(),o.selection.scrollIntoView())},100)})(e),Cx(e)&&Sx(e,!0)})(e))},CB=e=>{const t=e.getElement();let o=e.getDoc();e.inline&&(gB.addClass(t,"mce-content-body"),e.contentDocument=o=document,e.contentWindow=window,e.bodyElement=t,e.contentAreaContainer=t);const n=e.getBody();n.disabled=!0,e.readonly=Td(e),e._editableRoot=Ed(e),!bu(e)&&e.hasEditableRoot()&&(e.inline&&"static"===gB.getStyle(n,"position",!0)&&(n.style.position="relative"),n.contentEditable="true"),n.disabled=!1,e.editorUpload=Px(e),e.schema=As(yB(e)),e.dom=ra(o,{keep_values:!0,url_converter:e.convertURL,url_converter_scope:e,update_styles:!0,root_element:e.inline?e.getBody():null,collect:e.inline,schema:e.schema,contentCssCors:qc(e),referrerPolicy:Gc(e),onSetAttrib:t=>{e.dispatch("SetAttrib",t)}}),e.parser=(e=>{const t=Xw(bB(e),e.schema);return t.addAttributeFilter("data-mce-src,data-mce-href,data-mce-style",(e,t)=>{for(let o=0;o<e.length;o++)e[o].attr(t,null)}),t.addAttributeFilter("src,href,style,tabindex",(t,o)=>{const n=e.dom,r="data-mce-"+o;let i=t.length;for(;i--;){const s=t[i];let a=s.attr(o);if(a&&!s.attr(r)){if(0===a.indexOf("data:")||0===a.indexOf("blob:"))continue;"style"===o?(a=n.serializeStyle(n.parseStyle(a),s.name),a.length||(a=null),s.attr(r,a),s.attr(o,a)):"tabindex"===o?(s.attr(r,a),s.attr(o,null)):s.attr(r,e.convertURL(a,o,s.name))}}}),t.addNodeFilter("script",e=>{let t=e.length;for(;t--;){const o=e[t],n=o.attr("type")||"no/type";0!==n.indexOf("mce-")&&o.attr("type","mce-"+n)}}),iu(e)&&t.addNodeFilter("#cdata",t=>{var o;let n=t.length;for(;n--;){const r=t[n];r.type=8,r.name="#comment",r.value="[CDATA["+e.dom.encode(null!==(o=r.value)&&void 0!==o?o:"")+"]]"}}),t.addNodeFilter("p,h1,h2,h3,h4,h5,h6,div",t=>{let o=t.length;const n=e.schema.getNonEmptyElements();for(;o--;){const e=t[o];e.isEmpty(n)&&0===e.getAll("br").length&&e.append(new mg("br",1))}}),t})(e),e.serializer=H_((e=>{const t=e.options.get;return{...bB(e),...yB(e),...vB({remove_trailing_brs:t("remove_trailing_brs"),pad_empty_with_br:t("pad_empty_with_br"),url_converter:t("url_converter"),url_converter_scope:t("url_converter_scope"),element_format:t("element_format"),entities:t("entities"),entity_encoding:t("entity_encoding"),indent:t("indent"),indent_after:t("indent_after"),indent_before:t("indent_before")})}})(e),e),e.selection=L_(e.dom,e.getWin(),e.serializer,e),e.annotator=Ym(e),e.formatter=qx(e),e.undoManager=Yx(e),e._nodeChangeDispatcher=new vA(e),e._selectionOverrides=VM(e),(e=>{const t=je(),o=Oe(!1),n=it(t=>{e.dispatch("longpress",{...t,type:"longpress"}),o.set(!0)},400);e.on("touchstart",e=>{SS(e).each(r=>{n.cancel();const i={x:r.clientX,y:r.clientY,target:e.target};n.throttle(e),o.set(!1),t.set(i)})},!0),e.on("touchmove",r=>{n.cancel(),SS(r).each(n=>{t.on(r=>{((e,t)=>{const o=Math.abs(e.clientX-t.x),n=Math.abs(e.clientY-t.y);return o>5||n>5})(n,r)&&(t.clear(),o.set(!1),e.dispatch("longpresscancel"))})})},!0),e.on("touchend touchcancel",r=>{n.cancel(),"touchcancel"!==r.type&&t.get().filter(e=>e.target.isEqualNode(r.target)).each(()=>{o.get()?r.preventDefault():e.dispatch("tap",{...r,type:"tap"})})},!0)})(e),(e=>{(e=>{e.on("click",t=>{e.dom.getParent(t.target,"details")&&t.preventDefault()})})(e),(e=>{e.parser.addNodeFilter("details",t=>{const o=uu(e);W(t,e=>{"expanded"===o?e.attr("open","open"):"collapsed"===o&&e.attr("open",null)})}),e.serializer.addNodeFilter("details",t=>{const o=hu(e);W(t,e=>{"expanded"===o?e.attr("open","open"):"collapsed"===o&&e.attr("open",null)})})})(e)})(e),(e=>{const t="contenteditable",o=" "+ao.trim(nu(e))+" ",n=" "+ao.trim(ou(e))+" ",r=BS(o),i=BS(n),s=ru(e);s.length>0&&e.on("BeforeSetContent",t=>{((e,t,o)=>{let n=t.length,r=o.content;if("raw"!==o.format){for(;n--;)r=r.replace(t[n],RS(e,r,ou(e)));o.content=r}})(e,s,t)}),e.parser.addAttributeFilter("class",e=>{let o=e.length;for(;o--;){const n=e[o];r(n)?n.attr(t,"true"):i(n)&&n.attr(t,"false")}}),e.serializer.addAttributeFilter(t,e=>{let o=e.length;for(;o--;){const n=e[o];if(!r(n)&&!i(n))continue;const a=n.attr("data-mce-content");s.length>0&&a?NS(s,a)?(n.name="#text",n.type=3,n.raw=!0,n.value=a):n.remove():n.attr(t,null)}})})(e),M_(e)||((e=>{e.on("mousedown",t=>{t.detail>=3&&(t.preventDefault(),aM(e))})})(e),(e=>{mB(e)})(e));const r=fA(e);((e,t)=>{e.addCommand("delete",()=>{((e,t)=>{kS(e,t,!1).fold(()=>{e.selection.isEditable()&&(Xf(e),ev(e))},D)})(e,t)}),e.addCommand("forwardDelete",()=>{((e,t)=>{kS(e,t,!0).fold(()=>{e.selection.isEditable()&&Kf(e)},D)})(e,t)})})(e,r),(e=>{e.on("NodeChange",()=>(e=>{const t=e.dom,o=e.selection,n=e.schema,r=n.getBlockElements(),i=o.getStart(),s=e.getBody();let a,l,c=null;const d=Bc(e);if(!i||!Wr(i))return;const u=s.nodeName.toLowerCase();if(!n.isValidChild(u,d.toLowerCase())||((e,t,o)=>$(Qg(mo(o),mo(t)),t=>TS(e,t.dom)))(r,s,i))return;if(s.firstChild===s.lastChild&&ai(s.firstChild))return a=AS(e),a.appendChild(Na().dom),s.replaceChild(a,s.firstChild),e.selection.setCursorLocation(a,0),void e.nodeChanged();let h=s.firstChild;for(;h;)if(Wr(h)&&Li(n,h),ES(n,h)){if(OS(r,h)){l=h,h=h.nextSibling,t.remove(l);continue}if(!a){if(!c&&e.hasFocus()&&(c=BC(e.selection.getRng(),()=>document.createElement("span"))),!h.parentNode){h=null;break}a=AS(e),s.insertBefore(a,h)}l=h,h=h.nextSibling,a.appendChild(l)}else a=null,h=h.nextSibling;c&&(e.selection.setRng(RC(c)),e.nodeChanged())})(e))})(e),(e=>{var t;const o=e.dom,n=Bc(e),r=null!==(t=sd(e))&&void 0!==t?t:"",i=(t,s)=>{if((e=>{if(Jx(e)){const t=e.keyCode;return!Qx(e)&&(Cp.metaKeyPressed(e)||e.altKey||t>=112&&t<=123||Z(Xx,t))}return!1})(t))return;const a=e.getBody(),l=!(e=>Jx(e)&&!(Qx(e)||"keyup"===e.type&&229===e.keyCode))(t)&&((e,t,o)=>{if(e.isEmpty(t,void 0,{skipBogus:!1,includeZwsp:!0})){const n=t.firstElementChild;return!n||!e.getStyle(t.firstElementChild,"padding-left")&&!e.getStyle(t.firstElementChild,"padding-right")&&o===n.nodeName.toLowerCase()}return!1})(o,a,n);(""!==o.getAttrib(a,Kx)!==l||s)&&(o.setAttrib(a,Kx,l?r:null),((e,t)=>{e.dispatch("PlaceholderToggle",{state:t})})(e,l),e.on(l?"keydown":"keyup",i),e.off(l?"keyup":"keydown",i))};tt(r)&&e.on("init",t=>{i(t,!0),e.on("change SetContent ExecCommand",i),e.on("paste",t=>ap.setEditorTimeout(e,()=>i(t)))})})(e),eM(e);const i=(e=>{const t=e;return(e=>ke(e.plugins,"rtc").bind(e=>L.from(e.setup)))(e).fold(()=>(t.rtcInstance=A_(e),L.none()),e=>(t.rtcInstance=(()=>{const e=O(null),t=O("");return{init:{bindEvents:S},undoManager:{beforeChange:S,add:e,undo:e,redo:e,clear:S,reset:S,hasUndo:P,hasRedo:P,transact:e,ignore:S,extra:S},formatter:{match:P,matchAll:O([]),matchNode:O(void 0),canApply:P,closest:t,apply:S,remove:S,toggle:S,formatChanged:O({unbind:S})},editor:{getContent:t,setContent:O({content:"",html:""}),insertContent:O(""),addVisual:S},selection:{getContent:t},autocompleter:{addDecoration:S,removeDecoration:S},raw:{getModel:O(L.none())}}})(),L.some(()=>e().then(e=>(t.rtcInstance=(e=>{const t=e=>p(e)?e:{},{init:o,undoManager:n,formatter:r,editor:i,selection:s,autocompleter:a,raw:l}=e;return{init:{bindEvents:o.bindEvents},undoManager:{beforeChange:n.beforeChange,add:n.add,undo:n.undo,redo:n.redo,clear:n.clear,reset:n.reset,hasUndo:n.hasUndo,hasRedo:n.hasRedo,transact:(e,t,o)=>n.transact(o),ignore:(e,t)=>n.ignore(t),extra:(e,t,o,r)=>n.extra(o,r)},formatter:{match:(e,o,n,i)=>r.match(e,t(o),i),matchAll:r.matchAll,matchNode:r.matchNode,canApply:e=>r.canApply(e),closest:e=>r.closest(e),apply:(e,o,n)=>r.apply(e,t(o)),remove:(e,o,n,i)=>r.remove(e,t(o)),toggle:(e,o,n)=>r.toggle(e,t(o)),formatChanged:(e,t,o,n,i)=>r.formatChanged(t,o,n,i)},editor:{getContent:e=>i.getContent(e),setContent:(e,t)=>({content:i.setContent(e,t),html:""}),insertContent:(e,t)=>(i.insertContent(e),""),addVisual:i.addVisual},selection:{getContent:(e,t)=>s.getContent(t)},autocompleter:{addDecoration:a.addDecoration,removeDecoration:a.removeDecoration},raw:{getModel:()=>L.some(l.getRawModel())}}})(e),e.rtc.isRemote)))))})(e);(e=>{const t=e.getDoc(),o=e.getBody();(e=>{e.dispatch("PreInit")})(e),zd(e)||(t.body.spellcheck=!1,gB.setAttrib(o,"spellcheck","false")),e.quirks=pB(e),(e=>{e.dispatch("PostRender")})(e);const n=od(e);void 0!==n&&(o.dir=n);const r=Hd(e);r&&((e,t)=>{((e,t)=>{e.on("BeforeSetContent",e=>{W(t,t=>{e.content=e.content.replace(t,e=>"\x3c!--mce:protected "+escape(e)+"--\x3e")})})})(e,t),((e,t)=>{e.serializer.addNodeFilter("#comment",e=>{let o=e.length;for(;o--;){const n=e[o],r=n.value;if(0===(null==r?void 0:r.indexOf("mce:protected "))){const e=unescape(r).substr(14);$(t,t=>{const o=e.match(t);return null!==o&&o[0].length===e.length})?(n.name="#text",n.type=3,n.raw=!0,n.value=e):n.remove()}}})})(e,t)})(e,r),e.on("SetContent",()=>{e.addVisual(e.getBody())}),e.on("compositionstart compositionend",t=>{e.composing="compositionstart"===t.type})})(e),(e=>{const t=fu(e);var o;m(vu(e))||!y(t)&&"INVALID"!=((e=>"gpl"===e.toLowerCase())(o=t)||(e=>e.length>=64&&e.length<=255)(o)?"VALID":"INVALID")||console.warn("TinyMCE is running in evaluation mode. Provide a valid license key or add license_key: 'gpl' to the init config to agree to the open source license terms. Read more at https://www.tiny.cloud/license-key/")})(e),i.fold(()=>{const t=(e=>{let t=!1;const o=setTimeout(()=>{t||e.setProgressState(!0)},500);return()=>{clearTimeout(o),t=!0,e.setProgressState(!1)}})(e);_B(e).then(()=>{xB(e),t()})},t=>{e.setProgressState(!0),_B(e).then(()=>{t().then(t=>{e.setProgressState(!1),xB(e),N_(e)},t=>{e.notificationManager.open({type:"error",text:String(t)}),xB(e),N_(e)})})})},kB=ra.DOM,SB=ra.DOM,TB=(e,t)=>({editorContainer:e,iframeContainer:t,api:{}}),EB=e=>{const t=e.getElement();return e.inline?TB(null):(e=>{const t=SB.create("div");return SB.insertAfter(t,e),TB(t,t)})(t)},OB=async e=>{e.dispatch("ScriptsLoaded"),(e=>{const t=ao.trim(Hc(e)),o=e.ui.registry.getAll().icons,n={...ox.get("default").icons,...ox.get(t).icons};fe(n,(t,n)=>{Se(o,n)||e.ui.registry.addIcon(n,t)})})(e),(e=>{const t=cd(e);if(m(t)){const o=hx.get(t);e.theme=o(e,hx.urls[t])||{},x(e.theme.init)&&e.theme.init(e,hx.urls[t]||e.documentBaseUrl.replace(/\/$/,""))}else e.theme={}})(e),(e=>{const t=ud(e),o=nx.get(t);e.model=o(e,nx.urls[t])})(e),(e=>{const t=[];W(Ad(e),o=>{((e,t,o)=>{const n=ux.get(o),r=ux.urls[o]||e.documentBaseUrl.replace(/\/$/,"");if(o=ao.trim(o),n&&-1===ao.inArray(t,o)){if(e.plugins[o])return;try{const i=n(e,r)||{};e.plugins[o]=i,x(i.init)&&(i.init(e,r),t.push(o))}catch(t){((e,t,o)=>{const n=da.translate(["Failed to initialize plugin: {0}",t]);dc(e,"PluginLoadError",{message:n}),bx(n,o),gx(e,n)})(e,o,t)}}})(e,t,(e=>e.replace(/^\-/,""))(o))})})(e);const t=await(e=>{const t=e.getElement();return e.orgDisplay=t.style.display,m(cd(e))?(e=>{const t=e.theme.renderUI;return t?t():EB(e)})(e):x(cd(e))?(e=>{const t=e.getElement(),o=cd(e)(e,t);return o.editorContainer.nodeType&&(o.editorContainer.id=o.editorContainer.id||e.id+"_parent"),o.iframeContainer&&o.iframeContainer.nodeType&&(o.iframeContainer.id=o.iframeContainer.id||e.id+"_iframecontainer"),o.height=o.iframeHeight?o.iframeHeight:t.offsetHeight,o})(e):EB(e)})(e);((e,t)=>{const o={show:L.from(t.show).getOr(S),hide:L.from(t.hide).getOr(S),isEnabled:L.from(t.isEnabled).getOr(I),setEnabled:o=>{o&&("readonly"===e.mode.get()||Cx(e))||L.from(t.setEnabled).each(e=>e(o))}};e.ui={...e.ui,...o}})(e,L.from(t.api).getOr({})),e.editorContainer=t.editorContainer,(e=>{e.contentCSS=e.contentCSS.concat((e=>Ax(e,Qc(e)))(e),(e=>Ax(e,td(e)))(e))})(e),e.inline?CB(e):((e,t)=>{((e,t)=>{const o=no.browser.isFirefox()?Dd(e):"Rich Text Area",n=e.translate(o),r=bn(mo(e.getElement()),"tabindex").bind(nt),i=((e,t,o,n)=>{const r=uo("iframe");return n.each(e=>gn(r,"tabindex",e)),fn(r,o),fn(r,{id:e+"_ifr",frameBorder:"0",allowTransparency:"true",title:t}),ur(r,"tox-edit-area__iframe"),r})(e.id,n,kc(e),r).dom;i.onload=()=>{i.onload=null,e.dispatch("load")},e.contentAreaContainer=t.iframeContainer,e.iframeElement=i,e.iframeHTML=(e=>{let t=Sc(e)+"<html><head>";Tc(e)!==e.documentBaseUrl&&(t+='<base href="'+e.documentBaseURI.getURI()+'" />'),t+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';const o=Ec(e),n=Oc(e),r=e.translate(Dd(e));return Ac(e)&&(t+='<meta http-equiv="Content-Security-Policy" content="'+Ac(e)+'" />'),t+=`</head><body id="${o}" class="mce-content-body ${n}" data-id="${e.id}" aria-label="${r}"><br></body></html>`,t})(e),kB.add(t.iframeContainer,i)})(e,t),t.editorContainer&&(t.editorContainer.style.display=e.orgDisplay,e.hidden=kB.isHidden(t.editorContainer)),e.getElement().style.display="none",kB.setAttrib(e.id,"aria-hidden","true"),e.getElement().style.visibility=e.orgVisibility,(e=>{const t=e.iframeElement,o=()=>{e.contentDocument=t.contentDocument,CB(e)};if(lu(e)||no.browser.isFirefox()){const t=e.getDoc();t.open(),t.write(e.iframeHTML),t.close(),o()}else{const r=(n=mo(t),en(n,"load",on,()=>{r.unbind(),o()}));t.srcdoc=e.iframeHTML}var n})(e)})(e,{editorContainer:t.editorContainer,iframeContainer:t.iframeContainer})},AB=ra.DOM,MB=e=>"-"===e.charAt(0),BB=(e,t,o)=>L.from(t).filter(e=>tt(e)&&!ox.has(e)).map(t=>({url:`${e.editorManager.baseURL}/icons/${t}/icons${o}.js`,name:L.some(t)})),RB=(e,t)=>{const o=sa.ScriptLoader,n=()=>{!e.removed&&(e=>{const t=cd(e);return!m(t)||_(hx.get(t))})(e)&&(e=>{const t=ud(e);return _(nx.get(t))})(e)&&OB(e)};((e,t)=>{const o=cd(e);if(m(o)&&!MB(o)&&!Se(hx.urls,o)){const n=dd(e),r=n?e.documentBaseURI.toAbsolute(n):`themes/${o}/theme${t}.js`;hx.load(o,r).catch(()=>{((e,t,o)=>{fx(e,"ThemeLoadError",vx("theme",t,o))})(e,r,o)})}})(e,t),((e,t)=>{const o=ud(e);if("plugin"!==o&&!Se(nx.urls,o)){const n=hd(e),r=m(n)?e.documentBaseURI.toAbsolute(n):`models/${o}/model${t}.js`;nx.load(o,r).catch(()=>{((e,t,o)=>{fx(e,"ModelLoadError",vx("model",t,o))})(e,r,o)})}})(e,t),((e,t)=>{const o=Yc(t),n=Xc(t);if(!da.hasCode(o)&&"en"!==o){const r=tt(n)?n:`${t.editorManager.baseURL}/langs/${o}.js`;e.add(r).catch(()=>{((e,t,o)=>{fx(e,"LanguageLoadError",vx("language",t,o))})(t,r,o)})}})(o,e),((e,t,o)=>{const n=BB(t,"default",o),r=(e=>L.from(Uc(e)).filter(tt).map(e=>({url:e,name:L.none()})))(t).orThunk(()=>BB(t,Hc(t),""));W((e=>{const t=[],o=e=>{t.push(e)};for(let t=0;t<e.length;t++)e[t].each(o);return t})([n,r]),o=>{e.add(o.url).catch(()=>{((e,t,o)=>{fx(e,"IconsLoadError",vx("icons",t,o))})(t,o.url,o.name.getOrUndefined())})})})(o,e,t),((e,t)=>{const o=(t,o)=>{ux.load(t,o).catch(()=>{((e,t,o)=>{fx(e,"PluginLoadError",vx("plugin",t,o))})(e,o,t)})};fe(Md(e),(t,n)=>{o(n,t),e.options.set("plugins",Ad(e).concat(n))}),W(Ad(e),e=>{!(e=ao.trim(e))||ux.urls[e]||MB(e)||o(e,`plugins/${e}/plugin${t}.js`)})})(e,t),o.loadQueue().then(n,n)},NB=Gt().deviceType,VB=NB.isPhone(),DB=NB.isTablet(),PB=e=>{if(w(e))return[];{const t=f(e)?e:e.split(/[ ,]/),o=j(t,Je);return Y(o,tt)}},IB=(e,t)=>{const o=(t=>{const o={},n={};return we(t,(t,o)=>Z(e,o),ye(o),ye(n)),{t:o,f:n}})(t);return n=o.t,r=o.f,{sections:O(n),options:O(r)};var n,r},LB=(e,t)=>Se(e.sections(),t),FB=(e,t)=>({table_grid:!1,object_resizing:!1,resize:!1,toolbar_mode:ke(e,"toolbar_mode").getOr("scrolling"),toolbar_sticky:!1,...t?{menubar:!1}:{}}),zB=(e,t)=>{var o;const n=null!==(o=t.external_plugins)&&void 0!==o?o:{};return e&&e.external_plugins?ao.extend({},e.external_plugins,n):n},HB=(e,t,o,n,r)=>{var i;const s=e?{mobile:FB(null!==(i=r.mobile)&&void 0!==i?i:{},t)}:{},a=IB(["mobile"],Ie(s,r)),l=ao.extend(o,n,a.options(),((e,t)=>e&&LB(t,"mobile"))(e,a)?((e,t,o={})=>{const n=e.sections(),r=ke(n,t).getOr({});return ao.extend({},o,r)})(a,"mobile"):{},{external_plugins:zB(n,a.options())});return((e,t,o,n)=>{const r=PB(o.forced_plugins),i=PB(n.plugins),s=((e,t)=>LB(e,t)?e.sections()[t]:{})(t,"mobile"),a=((e,t,o,n)=>e&&LB(t,"mobile")?n:o)(e,t,i,s.plugins?PB(s.plugins):i),l=((e,t)=>[...PB(e),...PB(t)])(r,a);return ao.extend(n,{forced_plugins:r,plugins:l})})(e,a,n,l)},UB=e=>{(e=>{const t=t=>()=>{W("left,center,right,justify".split(","),o=>{t!==o&&e.formatter.remove("align"+o)}),"none"!==t&&(t=>{e.formatter.toggle(t,void 0),e.nodeChanged()})("align"+t)};e.editorCommands.addCommands({JustifyLeft:t("left"),JustifyCenter:t("center"),JustifyRight:t("right"),JustifyFull:t("justify"),JustifyNone:t("none")})})(e),(e=>{const t=t=>()=>{const o=e.selection,n=o.isCollapsed()?[e.dom.getParent(o.getNode(),e.dom.isBlock)]:o.getSelectedBlocks();return $(n,o=>_(e.formatter.matchNode(o,t)))};e.editorCommands.addCommands({JustifyLeft:t("alignleft"),JustifyCenter:t("aligncenter"),JustifyRight:t("alignright"),JustifyFull:t("alignjustify")},"state")})(e)},ZB=(e,t)=>{const o=e.selection,n=e.dom;return/^ | $/.test(t)?((e,t,o,n)=>{const r=mo(e.getRoot());return o=Cf(r,Dl.fromRangeStart(t),n)?o.replace(/^ /,"&nbsp;"):o.replace(/^&nbsp;/," "),kf(r,Dl.fromRangeEnd(t),n)?o.replace(/(&nbsp;| )(<br( \/)>)?$/,"&nbsp;"):o.replace(/&nbsp;(<br( \/)?>)?$/," ")})(n,o.getRng(),t,e.schema):t},$B=(e,t)=>{if(e.selection.isEditable()){const{content:o,details:n}=(e=>{if("string"!=typeof e){const t=ao.extend({paste:e.paste,data:{paste:e.paste}},e);return{content:e.content,details:t}}return{content:e,details:{}}})(t);t_(e,{...n,content:ZB(e,o),format:"html",set:!1,selection:!0}).each(t=>{const o=((e,t,o)=>B_(e).editor.insertContent(t,o))(e,t.content,n);o_(e,o,t),e.addVisual()})}},jB={"font-size":"size","font-family":"face"},WB=Ro("font"),qB=e=>(t,o)=>L.from(o).map(mo).filter(Oo).bind(o=>((e,t,o)=>kr(mo(o),t=>(t=>Ln(t,e).orThunk(()=>WB(t)?ke(jB,e).bind(e=>bn(t,e)):L.none()))(t),e=>_o(mo(t),e)))(e,t,o.dom).or(((e,t)=>L.from(ra.DOM.getStyle(t,e,!0)))(e,o.dom))).getOr(""),GB=qB("font-size"),YB=T(e=>e.replace(/[\'\"\\]/g,"").replace(/,\s+/g,","),qB("font-family")),XB=e=>Oh(e.getBody()).bind(e=>{const t=e.container();return L.from(ti(t)?t.parentNode:t)}),KB=(e,t)=>((e,t)=>(e=>L.from(e.selection.getRng()).bind(t=>{const o=e.getBody();return t.startContainer===o&&0===t.startOffset?L.none():L.from(e.selection.getStart(!0))}))(e).orThunk(B(XB,e)).map(mo).filter(Oo).bind(t))(e,E(L.some,t)),JB=(e,t)=>{if(/^[0-9.]+$/.test(t)){const o=parseInt(t,10);if(o>=1&&o<=7){const n=(e=>ao.explode(e.options.get("font_size_style_values")))(e),r=(e=>ao.explode(e.options.get("font_size_classes")))(e);return r.length>0?r[o-1]||t:n[o-1]||t}return t}return t},QB=e=>{const t=e.split(/\s*,\s*/);return j(t,e=>-1===e.indexOf(" ")||Ye(e,'"')||Ye(e,"'")?e:`'${e}'`).join(",")},eR=(e,t)=>{if(e.mode.isReadOnly())return;const o=e.dom,n=e.selection.getRng(),r=t?e.selection.getStart():e.selection.getEnd(),i=t?n.startContainer:n.endContainer,s=fO(o,i);if(!s||!s.isContentEditable)return;const a=t?ln:cn,l=Bc(e);((e,t,o,n)=>{const r=e.dom,i=e=>r.isBlock(e)&&e.parentElement===o,s=i(t)?t:r.getParent(n,i,o);return L.from(s).map(mo)})(e,r,s,i).each(t=>{const o=wO(e,i,t.dom,s,!1,l);a(t,mo(o)),e.selection.setCursorLocation(o,0),e.dispatch("NewBlock",{newBlock:o}),cO(e,"insertParagraph")})},tR=e=>{UB(e),(e=>{e.editorCommands.addCommands({"Cut,Copy,Paste":t=>{const o=e.getDoc();let n;try{o.execCommand(t)}catch(e){n=!0}if("paste"!==t||o.queryCommandEnabled(t)||(n=!0),n||!o.queryCommandSupported(t)){let t=e.translate("Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X/C/V keyboard shortcuts instead.");(no.os.isMacOS()||no.os.isiOS())&&(t=t.replace(/Ctrl\+/g,"⌘+")),e.notificationManager.open({text:t,type:"error"})}}})})(e),(e=>{e.editorCommands.addCommands({mceAddUndoLevel:()=>{e.undoManager.add()},mceEndUndoLevel:()=>{e.undoManager.add()},Undo:()=>{e.undoManager.undo()},Redo:()=>{e.undoManager.redo()}})})(e),(e=>{e.editorCommands.addCommands({mceSelectNodeDepth:(t,o,n)=>{let r=0;e.dom.getParent(e.selection.getNode(),t=>!Wr(t)||r++!==n||(e.selection.select(t),!1),e.getBody())},mceSelectNode:(t,o,n)=>{e.selection.select(n)},selectAll:()=>{const t=e.dom.getParent(e.selection.getStart(),di);if(t){const o=e.dom.createRng();o.selectNodeContents(t),e.selection.setRng(o)}}})})(e),(e=>{e.editorCommands.addCommands({mceCleanup:()=>{const t=e.selection.getBookmark();e.setContent(e.getContent()),e.selection.moveToBookmark(t)},insertImage:(t,o,n)=>{$B(e,e.dom.createHTML("img",{src:n}))},insertHorizontalRule:()=>{e.execCommand("mceInsertContent",!1,"<hr>")},insertText:(t,o,n)=>{$B(e,e.dom.encode(n))},insertHTML:(t,o,n)=>{$B(e,n)},mceInsertContent:(t,o,n)=>{$B(e,n)},mceSetContent:(t,o,n)=>{e.setContent(n)},mceReplaceContent:(t,o,n)=>{e.execCommand("mceInsertContent",!1,n.replace(/\{\$selection\}/g,e.selection.getContent({format:"text"})))},mceNewDocument:()=>{e.setContent(Wd(e))}})})(e),(e=>{const t=(t,o,n)=>{if(e.mode.isReadOnly())return;const r=m(n)?{href:n}:n,i=e.dom.getParent(e.selection.getNode(),"a");p(r)&&m(r.href)&&(r.href=r.href.replace(/ /g,"%20"),i&&r.href||e.formatter.remove("link"),r.href&&e.formatter.apply("link",r,i))};e.editorCommands.addCommands({unlink:()=>{if(e.selection.isEditable()){if(e.selection.isCollapsed()){const t=e.dom.getParent(e.selection.getStart(),"a");return void(t&&e.dom.remove(t,!0))}e.formatter.remove("link")}},mceInsertLink:t,createLink:t})})(e),(e=>{e.editorCommands.addCommands({Indent:()=>{(e=>{_S(e,"indent")})(e)},Outdent:()=>{xS(e)}}),e.editorCommands.addCommands({Outdent:()=>bS(e)},"state")})(e),(e=>{e.editorCommands.addCommands({InsertNewBlockBefore:()=>{(e=>{eR(e,!0)})(e)},InsertNewBlockAfter:()=>{(e=>{eR(e,!1)})(e)}})})(e),(e=>{e.editorCommands.addCommands({insertParagraph:()=>{QO(BO,e)},mceInsertNewLine:(t,o,n)=>{eA(e,n)},InsertLineBreak:(t,o,n)=>{QO(FO,e)}})})(e),(e=>{(e=>{const t=(t,o)=>{e.formatter.toggle(t,o),e.nodeChanged()};e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>{t(e)},"ForeColor,HiliteColor":(e,o,n)=>{t(e,{value:n})},BackColor:(e,o,n)=>{t("hilitecolor",{value:n})},FontName:(t,o,n)=>{((e,t)=>{const o=JB(e,t);e.formatter.toggle("fontname",{value:QB(o)}),e.nodeChanged()})(e,n)},FontSize:(t,o,n)=>{((e,t)=>{e.formatter.toggle("fontsize",{value:JB(e,t)}),e.nodeChanged()})(e,n)},LineHeight:(t,o,n)=>{((e,t)=>{e.formatter.toggle("lineheight",{value:String(t)}),e.nodeChanged()})(e,n)},Lang:(e,o,n)=>{var r;t(e,{value:n.code,customValue:null!==(r=n.customCode)&&void 0!==r?r:null})},RemoveFormat:t=>{e.formatter.remove(t)},mceBlockQuote:()=>{t("blockquote")},FormatBlock:(e,o,n)=>{t(m(n)?n:"p")},mceToggleFormat:(e,o,n)=>{t(n)}})})(e),(e=>{const t=t=>e.formatter.match(t);e.editorCommands.addCommands({"Bold,Italic,Underline,Strikethrough,Superscript,Subscript":e=>t(e),mceBlockQuote:()=>t("blockquote")},"state"),e.editorCommands.addQueryValueHandler("FontName",()=>(e=>KB(e,t=>YB(e.getBody(),t.dom)).getOr(""))(e)),e.editorCommands.addQueryValueHandler("FontSize",()=>(e=>KB(e,t=>GB(e.getBody(),t.dom)).getOr(""))(e)),e.editorCommands.addQueryValueHandler("LineHeight",()=>(e=>KB(e,t=>{const o=mo(e.getBody()),n=kr(t,e=>Ln(e,"line-height"),B(_o,o));return n.getOrThunk(()=>{const e=parseFloat(Pn(t,"line-height")),o=parseFloat(Pn(t,"font-size"));return String(e/o)})}).getOr(""))(e))})(e)})(e),(e=>{e.editorCommands.addCommands({mceRemoveNode:(t,o,n)=>{const r=null!=n?n:e.selection.getNode();if(r!==e.getBody()){const t=e.selection.getBookmark();e.dom.remove(r,!0),e.selection.moveToBookmark(t)}},mcePrint:()=>{e.getWin().print()},mceFocus:(t,o,n)=>{((e,t)=>{e.removed||(t?xp(e):(e=>{const t=e.selection,o=e.getBody();let n=t.getRng();e.quirks.refreshContentEditable();const r=e=>{ip(e).each(t=>{e.selection.setRng(t),n=t})};!wp(e)&&e.hasEditableRoot()&&r(e);const i=((e,t)=>e.dom.getParent(t,t=>"true"===e.dom.getContentEditable(t)))(e,t.getNode());if(i&&e.dom.isChildOf(i,o))return((e,t)=>null!==e.dom.getParent(t,t=>"false"===e.dom.getContentEditable(t)))(e,i)||yp(o),yp(i),e.hasEditableRoot()||r(e),bp(e,n),void xp(e);e.inline||(no.browser.isOpera()||yp(o),e.getWin().focus()),(no.browser.isFirefox()||e.inline)&&(yp(o),bp(e,n)),xp(e)})(e))})(e,!0===n)},mceToggleVisualAid:()=>{e.hasVisual=!e.hasVisual,e.addVisual()}})})(e)},oR=["toggleview"],nR=e=>Z(oR,e.toLowerCase());class rR{constructor(e){this.commands={state:{},exec:{},value:{}},this.editor=e}execCommand(e,t=!1,o,n){const r=this.editor,i=e.toLowerCase(),s=null==n?void 0:n.skip_focus;if(r.removed)return!1;if("mcefocus"!==i&&(/^(mceAddUndoLevel|mceEndUndoLevel)$/i.test(i)||s?(e=>{ip(e).each(t=>e.selection.setRng(t))})(r):r.focus()),r.dispatch("BeforeExecCommand",{command:e,ui:t,value:o}).isDefaultPrevented())return!1;const a=this.commands.exec[i];return!!x(a)&&(a(i,t,o),r.dispatch("ExecCommand",{command:e,ui:t,value:o}),!0)}queryCommandState(e){if(!nR(e)&&this.editor.quirks.isHidden()||this.editor.removed)return!1;const t=e.toLowerCase(),o=this.commands.state[t];return!!x(o)&&o(t)}queryCommandValue(e){if(!nR(e)&&this.editor.quirks.isHidden()||this.editor.removed)return"";const t=e.toLowerCase(),o=this.commands.value[t];return x(o)?o(t):""}addCommands(e,t="exec"){const o=this.commands;fe(e,(e,n)=>{W(n.toLowerCase().split(","),n=>{o[t][n]=e})})}addCommand(e,t,o){const n=e.toLowerCase();this.commands.exec[n]=(e,n,r)=>t.call(null!=o?o:this.editor,n,r)}queryCommandSupported(e){const t=e.toLowerCase();return!!this.commands.exec[t]}addQueryStateHandler(e,t,o){this.commands.state[e.toLowerCase()]=()=>t.call(null!=o?o:this.editor)}addQueryValueHandler(e,t,o){this.commands.value[e.toLowerCase()]=()=>t.call(null!=o?o:this.editor)}}const iR=ao.makeMap("focus blur focusin focusout click dblclick mousedown mouseup mousemove mouseover beforepaste paste cut copy selectionchange mouseout mouseenter mouseleave wheel keydown keypress keyup input beforeinput contextmenu dragstart dragend dragover draggesture dragdrop drop drag submit compositionstart compositionend compositionupdate touchstart touchmove touchend touchcancel"," ");class sR{static isNative(e){return!!iR[e.toLowerCase()]}constructor(e){this.bindings={},this.settings=e||{},this.scope=this.settings.scope||this,this.toggleEvent=this.settings.toggleEvent||P}fire(e,t){return this.dispatch(e,t)}dispatch(e,t){const o=e.toLowerCase(),n=Us(o,null!=t?t:{},this.scope);this.settings.beforeFire&&this.settings.beforeFire(n);const r=this.bindings[o];if(r)for(let e=0,t=r.length;e<t;e++){const t=r[e];if(!t.removed){if(t.once&&this.off(o,t.func),n.isImmediatePropagationStopped())return n;if(!1===t.func.call(this.scope,n))return n.preventDefault(),n}}return n}on(e,t,o,n){if(!1===t&&(t=P),t){const r={func:t,removed:!1};n&&ao.extend(r,n);const i=e.toLowerCase().split(" ");let s=i.length;for(;s--;){const e=i[s];let t=this.bindings[e];t||(t=[],this.toggleEvent(e,!0)),t=o?[r,...t]:[...t,r],this.bindings[e]=t}}return this}off(e,t){if(e){const o=e.toLowerCase().split(" ");let n=o.length;for(;n--;){const r=o[n];let i=this.bindings[r];if(!r)return fe(this.bindings,(e,t)=>{this.toggleEvent(t,!1),delete this.bindings[t]}),this;if(i){if(t){const e=G(i,e=>e.func===t);i=e.fail,this.bindings[r]=i,W(e.pass,e=>{e.removed=!0})}else i.length=0;i.length||(this.toggleEvent(e,!1),delete this.bindings[r])}}}else fe(this.bindings,(e,t)=>{this.toggleEvent(t,!1)}),this.bindings={};return this}once(e,t,o){return this.on(e,t,o,{once:!0})}has(e){e=e.toLowerCase();const t=this.bindings[e];return!(!t||0===t.length)}}const aR=e=>(e._eventDispatcher||(e._eventDispatcher=new sR({scope:e,toggleEvent:(t,o)=>{sR.isNative(t)&&e.toggleNativeEvent&&e.toggleNativeEvent(t,o)}})),e._eventDispatcher),lR={fire(e,t,o){return console.warn('The "fire" event api has been deprecated and will be removed in TinyMCE 9. Use "dispatch" instead.',(new Error).stack),this.dispatch(e,t,o)},dispatch(e,t,o){const n=this;if(n.removed&&"remove"!==e&&"detach"!==e)return Us(e.toLowerCase(),null!=t?t:{},n);const r=aR(n).dispatch(e,t);if(!1!==o&&n.parent){let t=n.parent();for(;t&&!r.isPropagationStopped();)t.dispatch(e,r,!1),t=t.parent?t.parent():void 0}return r},on(e,t,o){return aR(this).on(e,t,o)},off(e,t){return aR(this).off(e,t)},once(e,t){return aR(this).once(e,t)},hasEventListeners(e){return aR(this).has(e)}},cR=ra.DOM;let dR;const uR=(e,t)=>{if("selectionchange"===t)return e.getDoc();if(!e.inline&&/^(?:mouse|touch|click|contextmenu|drop|dragover|dragend)/.test(t))return e.getDoc().documentElement;const o=ad(e);return o?(e.eventRoot||(e.eventRoot=cR.select(o)[0]),e.eventRoot):e.getBody()},hR=(e,t,o)=>{(e=>!e.hidden&&!Cx(e))(e)?e.dispatch(t,o):Cx(e)&&((e,t)=>{if((e=>"click"===e.type)(t)&&!Cp.metaKeyPressed(t)){const o=mo(t.target);((e,t)=>sr(t,"a",t=>_o(t,mo(e.getBody()))).bind(e=>bn(e,"href")))(e,o).each(o=>{if(t.preventDefault(),/^#/.test(o)){const t=e.dom.select(`${o},[name="${qe(o,"#")}"]`);t.length&&e.selection.scrollIntoView(t[0],!0)}else window.open(o,"_blank","rel=noopener noreferrer,menubar=yes,toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes")})}else(e=>Z(Ex,e.type))(t)&&e.dispatch(t.type,t)})(e,o)},mR=(e,t)=>{if(e.delegates||(e.delegates={}),e.delegates[t]||e.removed)return;const o=uR(e,t);if(ad(e)){if(dR||(dR={},e.editorManager.on("removeEditor",()=>{e.editorManager.activeEditor||dR&&(fe(dR,(t,o)=>{e.dom.unbind(uR(e,o))}),dR=null)})),dR[t])return;const n=o=>{const n=o.target,r=e.editorManager.get();let i=r.length;for(;i--;){const e=r[i].getBody();(e===n||cR.isChildOf(n,e))&&hR(r[i],t,o)}};dR[t]=n,cR.bind(o,t,n)}else{const n=o=>{hR(e,t,o)};cR.bind(o,t,n),e.delegates[t]=n}},pR={...lR,bindPendingEventDelegates(){const e=this;ao.each(e._pendingNativeEvents,t=>{mR(e,t)})},toggleNativeEvent(e,t){const o=this;"focus"!==e&&"blur"!==e&&(o.removed||(t?o.initialized?mR(o,e):o._pendingNativeEvents?o._pendingNativeEvents.push(e):o._pendingNativeEvents=[e]:o.initialized&&o.delegates&&(o.dom.unbind(uR(o,e),e,o.delegates[e]),delete o.delegates[e])))},unbindAllNativeEvents(){const e=this,t=e.getBody(),o=e.dom;e.delegates&&(fe(e.delegates,(t,o)=>{e.dom.unbind(uR(e,o),o,t)}),delete e.delegates),!e.inline&&t&&o&&(t.onload=null,o.unbind(e.getWin()),o.unbind(e.getDoc())),o&&(o.unbind(t),o.unbind(e.getContainer()))}},gR=e=>m(e)?{value:e.split(/[ ,]/),valid:!0}:k(e,m)?{value:e,valid:!0}:{valid:!1,message:"The value must be a string[] or a comma/space separated string."},fR=(e,t)=>e+(ot(t.message)?"":`. ${t.message}`),vR=e=>e.valid,bR=(e,t,o="")=>{const n=t(e);return b(n)?n?{value:e,valid:!0}:{valid:!1,message:o}:n},yR=e=>e.readonly,wR=["design","readonly"],_R=(e,t,o,n)=>{const r=o[t.get()],i=o[n];try{i.activate()}catch(e){return void console.error(`problem while activating editor mode ${n}:`,e)}r.deactivate(),r.editorReadOnly!==i.editorReadOnly&&((e,t)=>{const o=mo(e.getBody());t?(e.readonly=!0,e.hasEditableRoot()&&(o.dom.contentEditable="true"),_x(e)):(e.readonly=!1,xx(e))})(e,i.editorReadOnly),t.set(n),((e,t)=>{e.dispatch("SwitchMode",{mode:t})})(e,n)},xR=e=>{const t=Oe("design"),o=Oe({design:{activate:S,deactivate:S,editorReadOnly:!1},readonly:{activate:S,deactivate:S,editorReadOnly:!0}});return(e=>{const t=t=>{yR(e)&&(e=>$(e,e=>"characterData"===e.type||"childList"===e.type))(t)&&(e=>{const t=e.undoManager.add();_(t)&&(e.undoManager.undo(),e.undoManager.reset())})(e)},o=new MutationObserver(t);e.on("beforeinput paste cut dragend dragover draggesture dragdrop drop drag",t=>{yR(e)&&t.preventDefault()}),e.on("BeforeExecCommand",t=>{"Undo"!==t.command&&"Redo"!==t.command||!yR(e)||t.preventDefault()}),e.on("compositionstart",()=>{yR(e)&&o.observe(e.getBody(),{characterData:!0,childList:!0,subtree:!0})}),e.on("compositionend",()=>{if(yR(e)){const e=o.takeRecords();t(e)}o.disconnect()})})(e),(e=>{(e=>{e.serializer?Tx(e):e.on("PreInit",()=>{Tx(e)})})(e),(e=>{e.on("ShowCaret ObjectSelected",t=>{Cx(e)&&t.preventDefault()}),e.on("DisabledStateChange",t=>{t.isDefaultPrevented()||Sx(e,t.state)})})(e)})(e),{isReadOnly:()=>yR(e),set:n=>((e,t,o,n)=>{if(!(n===o.get()||e.initialized&&Cx(e))){if(!Se(t,n))throw new Error(`Editor mode '${n}' is invalid`);e.initialized?_R(e,o,t,n):e.on("init",()=>_R(e,o,t,n))}})(e,o.get(),t,n),get:()=>t.get(),register:(e,t)=>{o.set(((e,t,o)=>{if(Z(wR,t))throw new Error(`Cannot override default mode ${t}`);return{...e,[t]:{...o,deactivate:()=>{try{o.deactivate()}catch(e){console.error(`problem while deactivating editor mode ${t}:`,e)}}}}})(o.get(),e,t))}}},CR=ao.each,kR=ao.explode,SR={f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},TR=ao.makeMap("alt,ctrl,shift,meta,access"),ER=e=>{const t={},o=no.os.isMacOS()||no.os.isiOS();CR(kR(e.toLowerCase(),"+"),e=>{(e=>e in TR)(e)?t[e]=!0:/^[0-9]{2,}$/.test(e)?t.keyCode=parseInt(e,10):(t.charCode=e.charCodeAt(0),t.keyCode=SR[e]||e.toUpperCase().charCodeAt(0))});const n=[t.keyCode];let r;for(r in TR)t[r]?n.push(r):t[r]=!1;return t.id=n.join(","),t.access&&(t.alt=!0,o?t.ctrl=!0:t.shift=!0),t.meta&&(o?t.meta=!0:(t.ctrl=!0,t.meta=!1)),t};class OR{constructor(e){this.shortcuts={},this.pendingPatterns=[],this.editor=e;const t=this;e.on("keyup keypress keydown",e=>{!t.hasModifier(e)&&!t.isFunctionKey(e)||e.isDefaultPrevented()||(CR(t.shortcuts,o=>{t.matchShortcut(e,o)&&(t.pendingPatterns=o.subpatterns.slice(0),"keydown"===e.type&&t.executeShortcutAction(o))}),t.matchShortcut(e,t.pendingPatterns[0])&&(1===t.pendingPatterns.length&&"keydown"===e.type&&t.executeShortcutAction(t.pendingPatterns[0]),t.pendingPatterns.shift()))})}add(e,t,o,n){const r=this,i=r.normalizeCommandFunc(o);return CR(kR(ao.trim(e)),e=>{const o=r.createShortcut(e,t,i,n);r.shortcuts[o.id]=o}),!0}remove(e){const t=this.createShortcut(e);return!!this.shortcuts[t.id]&&(delete this.shortcuts[t.id],!0)}normalizeCommandFunc(e){const t=this,o=e;return"string"==typeof o?()=>{t.editor.execCommand(o,!1,null)}:ao.isArray(o)?()=>{t.editor.execCommand(o[0],o[1],o[2])}:o}createShortcut(e,t,o,n){const r=ao.map(kR(e,">"),ER);return r[r.length-1]=ao.extend(r[r.length-1],{func:o,scope:n||this.editor}),ao.extend(r[0],{desc:this.editor.translate(t),subpatterns:r.slice(1)})}hasModifier(e){return e.altKey||e.ctrlKey||e.metaKey}isFunctionKey(e){return"keydown"===e.type&&e.keyCode>=112&&e.keyCode<=123}matchShortcut(e,t){return!!t&&t.ctrl===e.ctrlKey&&t.meta===e.metaKey&&t.alt===e.altKey&&t.shift===e.shiftKey&&!!(e.keyCode===t.keyCode||e.charCode&&e.charCode===t.charCode)&&(e.preventDefault(),!0)}executeShortcutAction(e){return e.func?e.func.call(e.scope):null}}const AR=()=>{const e=(()=>{const e={},t={},o={},n={},r={},i={},s={},a={},l={},c=(e,t)=>(o,n)=>{e[o.toLowerCase()]={...n,type:t}};return{addButton:c(e,"button"),addGroupToolbarButton:c(e,"grouptoolbarbutton"),addToggleButton:c(e,"togglebutton"),addMenuButton:c(e,"menubutton"),addSplitButton:c(e,"splitbutton"),addMenuItem:c(t,"menuitem"),addNestedMenuItem:c(t,"nestedmenuitem"),addToggleMenuItem:c(t,"togglemenuitem"),addAutocompleter:c(o,"autocompleter"),addContextMenu:c(r,"contextmenu"),addContextToolbar:c(i,"contexttoolbar"),addContextForm:(d=i,(e,t)=>{d[e.toLowerCase()]={type:"contextform",...t}}),addSidebar:c(a,"sidebar"),addView:c(l,"views"),addIcon:(e,t)=>n[e.toLowerCase()]=t,addContext:(e,t)=>s[e.toLowerCase()]=t,getAll:()=>({buttons:e,menuItems:t,icons:n,popups:o,contextMenus:r,contextToolbars:i,sidebars:a,views:l,contexts:s})};var d})();return{addAutocompleter:e.addAutocompleter,addButton:e.addButton,addContextForm:e.addContextForm,addContextMenu:e.addContextMenu,addContextToolbar:e.addContextToolbar,addIcon:e.addIcon,addMenuButton:e.addMenuButton,addMenuItem:e.addMenuItem,addNestedMenuItem:e.addNestedMenuItem,addSidebar:e.addSidebar,addSplitButton:e.addSplitButton,addToggleButton:e.addToggleButton,addGroupToolbarButton:e.addGroupToolbarButton,addToggleMenuItem:e.addToggleMenuItem,addView:e.addView,addContext:e.addContext,getAll:e.getAll}},MR=ra.DOM,BR=ao.extend,RR=ao.each;class NR{constructor(e,t,o){this.plugins={},this.contentCSS=[],this.contentStyles=[],this.loadedCSS={},this.isNotDirty=!1,this.composing=!1,this.destroyed=!1,this.hasHiddenInput=!1,this.iframeElement=null,this.initialized=!1,this.readonly=!1,this.removed=!1,this.startContent="",this._pendingNativeEvents=[],this._skinLoaded=!1,this._editableRoot=!0,this.editorManager=o,this.documentBaseUrl=o.documentBaseURL,BR(this,pR);const n=this;this.id=e,this.hidden=!1;const r=((e,t)=>{const o=Le(t);return HB(VB||DB,VB,o,e,o)})(o.defaultOptions,t);this.options=((e,t,o=t)=>{const n={},r={},i=(e,t,o)=>{const n=bR(t,o);return vR(n)?(r[e]=n.value,!0):(console.warn(fR(`Invalid value passed for the ${e} option`,n)),!1)},s=e=>Se(n,e);return{register:(e,o)=>{const s=(e=>m(e.processor))(o)?(e=>{const t=(()=>{switch(e){case"array":return f;case"boolean":return b;case"function":return x;case"number":return C;case"object":return p;case"string":return m;case"string[]":return gR;case"object[]":return e=>k(e,p);case"regexp":return e=>h(e,RegExp);default:return I}})();return o=>bR(o,t,`The value must be a ${e}.`)})(o.processor):o.processor,a=((e,t,o)=>{if(!y(t)){const n=bR(t,o);if(vR(n))return n.value;console.error(fR(`Invalid default value passed for the "${e}" option`,n))}})(e,o.default,s);n[e]={...o,default:a,processor:s},ke(r,e).orThunk(()=>ke(t,e)).each(t=>i(e,t,s))},isRegistered:s,get:e=>ke(r,e).orThunk(()=>ke(n,e).map(e=>e.default)).getOrUndefined(),set:(e,t)=>{if(s(e)){const o=n[e];return o.immutable?(console.error(`"${e}" is an immutable option and cannot be updated`),!1):i(e,t,o.processor)}return console.warn(`"${e}" is not a registered option. Ensure the option has been registered before setting a value.`),!1},unset:e=>{const t=s(e);return t&&delete r[e],t},isSet:e=>Se(r,e),debug:()=>{try{console.log(JSON.parse(JSON.stringify(o,(e,t)=>b(t)||C(t)||m(t)||v(t)||f(t)||g(t)?t:Object.prototype.toString.call(t))))}catch(e){console.error(e)}}}})(0,r,t),(e=>{const t=e.options.register;t("id",{processor:"string",default:e.id}),t("selector",{processor:"string"}),t("target",{processor:"object"}),t("suffix",{processor:"string"}),t("cache_suffix",{processor:"string"}),t("base_url",{processor:"string"}),t("referrer_policy",{processor:"string",default:""}),t("language_load",{processor:"boolean",default:!0}),t("inline",{processor:"boolean",default:!1}),t("iframe_attrs",{processor:"object",default:{}}),t("doctype",{processor:"string",default:"<!DOCTYPE html>"}),t("document_base_url",{processor:"string",default:e.documentBaseUrl}),t("body_id",{processor:Cc(e,"tinymce"),default:"tinymce"}),t("body_class",{processor:Cc(e),default:""}),t("content_security_policy",{processor:"string",default:""}),t("br_in_pre",{processor:"boolean",default:!0}),t("forced_root_block",{processor:e=>{const t=m(e)&&tt(e);return t?{value:e,valid:t}:{valid:!1,message:"Must be a non-empty string."}},default:"p"}),t("forced_root_block_attrs",{processor:"object",default:{}}),t("newline_behavior",{processor:e=>{const t=Z(["block","linebreak","invert","default"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: block, linebreak, invert or default."}},default:"default"}),t("br_newline_selector",{processor:"string",default:".mce-toc h2,figcaption,caption"}),t("no_newline_selector",{processor:"string",default:""}),t("keep_styles",{processor:"boolean",default:!0}),t("end_container_on_empty_block",{processor:e=>b(e)||m(e)?{valid:!0,value:e}:{valid:!1,message:"Must be boolean or a string"},default:"blockquote"}),t("font_size_style_values",{processor:"string",default:"xx-small,x-small,small,medium,large,x-large,xx-large"}),t("font_size_legacy_values",{processor:"string",default:"xx-small,small,medium,large,x-large,xx-large,300%"}),t("font_size_classes",{processor:"string",default:""}),t("automatic_uploads",{processor:"boolean",default:!0}),t("images_reuse_filename",{processor:"boolean",default:!1}),t("images_replace_blob_uris",{processor:"boolean",default:!0}),t("icons",{processor:"string",default:""}),t("icons_url",{processor:"string",default:""}),t("images_upload_url",{processor:"string",default:""}),t("images_upload_base_path",{processor:"string",default:""}),t("images_upload_credentials",{processor:"boolean",default:!1}),t("images_upload_handler",{processor:"function"}),t("language",{processor:"string",default:"en"}),t("language_url",{processor:"string",default:""}),t("entity_encoding",{processor:"string",default:"named"}),t("indent",{processor:"boolean",default:!0}),t("indent_before",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_after",{processor:"string",default:"p,h1,h2,h3,h4,h5,h6,blockquote,div,title,style,pre,script,td,th,ul,ol,li,dl,dt,dd,area,table,thead,tfoot,tbody,tr,section,details,summary,article,hgroup,aside,figure,figcaption,option,optgroup,datalist"}),t("indent_use_margin",{processor:"boolean",default:!1}),t("indentation",{processor:"string",default:"40px"}),t("content_css",{processor:e=>{const t=!1===e||m(e)||k(e,m);return t?m(e)?{value:j(e.split(","),Je),valid:t}:f(e)?{value:e,valid:t}:!1===e?{value:[],valid:t}:{value:e,valid:t}:{valid:!1,message:"Must be false, a string or an array of strings."}},default:yd(e)?[]:["default"]}),t("content_style",{processor:"string"}),t("content_css_cors",{processor:"boolean",default:!1}),t("font_css",{processor:e=>{const t=m(e)||k(e,m);return t?{value:f(e)?e:j(e.split(","),Je),valid:t}:{valid:!1,message:"Must be a string or an array of strings."}},default:[]}),t("extended_mathml_attributes",{processor:"string[]"}),t("extended_mathml_elements",{processor:"string[]"}),t("inline_boundaries",{processor:"boolean",default:!0}),t("inline_boundaries_selector",{processor:"string",default:"a[href],code,span.mce-annotation"}),t("object_resizing",{processor:e=>{const t=b(e)||m(e);return t?!1===e||vc.isiPhone()||vc.isiPad()?{value:"",valid:t}:{value:!0===e?"table,img,figure.image,div,video,iframe":e,valid:t}:{valid:!1,message:"Must be boolean or a string"}},default:!bc}),t("resize_img_proportional",{processor:"boolean",default:!0}),t("event_root",{processor:"string"}),t("service_message",{processor:"string"}),t("onboarding",{processor:"boolean",default:!0}),t("tiny_cloud_entry_url",{processor:"string"}),t("theme",{processor:e=>!1===e||m(e)||x(e),default:"silver"}),t("theme_url",{processor:"string"}),t("formats",{processor:"object"}),t("format_empty_lines",{processor:"boolean",default:!1}),t("format_noneditable_selector",{processor:"string",default:""}),t("preview_styles",{processor:e=>{const t=!1===e||m(e);return t?{value:!1===e?"":e,valid:t}:{valid:!1,message:"Must be false or a string"}},default:"font-family font-size font-weight font-style text-decoration text-transform color background-color border border-radius outline text-shadow"}),t("custom_ui_selector",{processor:"string",default:""}),t("hidden_input",{processor:"boolean",default:!0}),t("submit_patch",{processor:"boolean",default:!0}),t("encoding",{processor:"string"}),t("add_form_submit_trigger",{processor:"boolean",default:!0}),t("add_unload_trigger",{processor:"boolean",default:!0}),t("custom_undo_redo_levels",{processor:"number",default:0}),t("disable_nodechange",{processor:"boolean",default:!1}),t("disabled",{processor:t=>b(t)?(e.initialized&&bu(e)!==t&&Promise.resolve().then(()=>{((e,t)=>{e.dispatch("DisabledStateChange",{state:t})})(e,t)}),{valid:!0,value:t}):{valid:!1,message:"The value must be a boolean."},default:!1}),t("readonly",{processor:"boolean",default:!1}),t("editable_root",{processor:"boolean",default:!0}),t("plugins",{processor:"string[]",default:[]}),t("external_plugins",{processor:"object"}),t("forced_plugins",{processor:"string[]"}),t("model",{processor:"string",default:e.hasPlugin("rtc")?"plugin":"dom"}),t("model_url",{processor:"string"}),t("block_unsupported_drop",{processor:"boolean",default:!0}),t("visual",{processor:"boolean",default:!0}),t("visual_table_class",{processor:"string",default:"mce-item-table"}),t("visual_anchor_class",{processor:"string",default:"mce-item-anchor"}),t("iframe_aria_text",{processor:"string",default:"Rich Text Area".concat(e.hasPlugin("help")?". Press ALT-0 for help.":"")}),t("setup",{processor:"function"}),t("init_instance_callback",{processor:"function"}),t("url_converter",{processor:"function",default:e.convertURL}),t("url_converter_scope",{processor:"object",default:e}),t("urlconverter_callback",{processor:"function"}),t("allow_conditional_comments",{processor:"boolean",default:!1}),t("allow_html_data_urls",{processor:"boolean",default:!1}),t("allow_svg_data_urls",{processor:"boolean"}),t("allow_html_in_named_anchor",{processor:"boolean",default:!1}),t("allow_html_in_comments",{processor:"boolean",default:!0}),t("allow_script_urls",{processor:"boolean",default:!1}),t("allow_unsafe_link_target",{processor:"boolean",default:!1}),t("allow_mathml_annotation_encodings",{processor:e=>{const t=k(e,m);return t?{value:e,valid:t}:{valid:!1,message:"Must be an array of strings."}},default:[]}),t("convert_fonts_to_spans",{processor:"boolean",default:!0,deprecated:!0}),t("fix_list_elements",{processor:"boolean",default:!1}),t("preserve_cdata",{processor:"boolean",default:!1}),t("remove_trailing_brs",{processor:"boolean",default:!0}),t("pad_empty_with_br",{processor:"boolean",default:!1}),t("inline_styles",{processor:"boolean",default:!0,deprecated:!0}),t("element_format",{processor:"string",default:"html"}),t("entities",{processor:"string"}),t("schema",{processor:"string",default:"html5"}),t("convert_urls",{processor:"boolean",default:!0}),t("relative_urls",{processor:"boolean",default:!0}),t("remove_script_host",{processor:"boolean",default:!0}),t("custom_elements",{processor:xc}),t("extended_valid_elements",{processor:"string"}),t("invalid_elements",{processor:"string"}),t("invalid_styles",{processor:xc}),t("valid_children",{processor:"string"}),t("valid_classes",{processor:xc}),t("valid_elements",{processor:"string"}),t("valid_styles",{processor:xc}),t("verify_html",{processor:"boolean",default:!0}),t("auto_focus",{processor:e=>m(e)||!0===e}),t("browser_spellcheck",{processor:"boolean",default:!1}),t("protect",{processor:"array"}),t("images_file_types",{processor:"string",default:"jpeg,jpg,jpe,jfi,jif,jfif,png,gif,bmp,webp"}),t("deprecation_warnings",{processor:"boolean",default:!0}),t("a11y_advanced_options",{processor:"boolean",default:!1}),t("api_key",{processor:"string"}),t("license_key",{processor:"string"}),t("paste_block_drop",{processor:"boolean",default:!1}),t("paste_data_images",{processor:"boolean",default:!0}),t("paste_preprocess",{processor:"function"}),t("paste_postprocess",{processor:"function"}),t("paste_webkit_styles",{processor:"string",default:"none"}),t("paste_remove_styles_if_webkit",{processor:"boolean",default:!0}),t("paste_merge_formats",{processor:"boolean",default:!0}),t("smart_paste",{processor:"boolean",default:!0}),t("paste_as_text",{processor:"boolean",default:!1}),t("paste_tab_spaces",{processor:"number",default:4}),t("text_patterns",{processor:e=>k(e,p)||!1===e?{value:cc(!1===e?[]:e),valid:!0}:{valid:!1,message:"Must be an array of objects or false."},default:[{start:"*",end:"*",format:"italic"},{start:"**",end:"**",format:"bold"},{start:"#",format:"h1",trigger:"space"},{start:"##",format:"h2",trigger:"space"},{start:"###",format:"h3",trigger:"space"},{start:"####",format:"h4",trigger:"space"},{start:"#####",format:"h5",trigger:"space"},{start:"######",format:"h6",trigger:"space"},{start:"1.",cmd:"InsertOrderedList",trigger:"space"},{start:"*",cmd:"InsertUnorderedList",trigger:"space"},{start:"-",cmd:"InsertUnorderedList",trigger:"space"},{start:">",cmd:"mceBlockQuote",trigger:"space"},{start:"---",cmd:"InsertHorizontalRule",trigger:"space"}]}),t("text_patterns_lookup",{processor:e=>{return x(e)?{value:(t=e,e=>{const o=t(e);return cc(o)}),valid:!0}:{valid:!1,message:"Must be a single function"};var t},default:e=>[]}),t("noneditable_class",{processor:"string",default:"mceNonEditable"}),t("editable_class",{processor:"string",default:"mceEditable"}),t("noneditable_regexp",{processor:e=>k(e,wc)?{value:e,valid:!0}:wc(e)?{value:[e],valid:!0}:{valid:!1,message:"Must be a RegExp or an array of RegExp."},default:[]}),t("table_tab_navigation",{processor:"boolean",default:!0}),t("highlight_on_focus",{processor:"boolean",default:!0}),t("xss_sanitization",{processor:"boolean",default:!0}),t("details_initial_state",{processor:e=>{const t=Z(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("details_serialized_state",{processor:e=>{const t=Z(["inherited","collapsed","expanded"],e);return t?{value:e,valid:t}:{valid:!1,message:"Must be one of: inherited, collapsed, or expanded."}},default:"inherited"}),t("init_content_sync",{processor:"boolean",default:!1}),t("newdocument_content",{processor:"string",default:""}),t("sandbox_iframes",{processor:"boolean",default:!0}),t("sandbox_iframes_exclusions",{processor:"string[]",default:["youtube.com","youtu.be","vimeo.com","player.vimeo.com","dailymotion.com","embed.music.apple.com","open.spotify.com","giphy.com","dai.ly","codepen.io"]}),t("convert_unsafe_embeds",{processor:"boolean",default:!0}),e.on("ScriptsLoaded",()=>{t("directionality",{processor:"string",default:da.isRtl()?"rtl":void 0}),t("placeholder",{processor:"string",default:yc.getAttrib(e.getElement(),"placeholder")})})})(n);const i=this.options.get;i("deprecation_warnings")&&((e,t)=>{((e,t)=>{const o=G_(e),n=K_(t),r=n.length>0,i=o.length>0,s="mobile"===t.theme;if(r||i||s){const e="\n- ",t=s?`\n\nThemes:${e}mobile`:"",a=r?`\n\nPlugins:${e}${n.join(e)}`:"",l=i?`\n\nOptions:${e}${o.join(e)}`:"";console.warn("The following deprecated features are currently enabled and have been removed in TinyMCE 7.0. These features will no longer work and should be removed from the TinyMCE configuration. See https://www.tiny.cloud/docs/tinymce/7/migration-from-6x/ for more information."+t+a+l)}})(e,t),((e,t)=>{const o=Y_(e),n=J_(t),r=n.length>0,i=o.length>0;if(r||i){const e="\n- ",t=r?`\n\nPlugins:${e}${n.map(Q_).join(e)}`:"",s=i?`\n\nOptions:${e}${o.join(e)}`:"";console.warn("The following deprecated features are currently enabled but will be removed soon."+t+s)}})(e,t)})(t,r);const s=i("suffix");s&&(o.suffix=s),this.suffix=o.suffix;const a=i("base_url");a&&o._setBaseUrl(a),this.baseUri=o.baseURI;const l=Gc(n);l&&(sa.ScriptLoader._setReferrerPolicy(l),ra.DOM.styleSheetLoader._setReferrerPolicy(l));const c=Od(n);_(c)&&ra.DOM.styleSheetLoader._setContentCssCors(c),ua.languageLoad=i("language_load"),ua.baseURL=o.baseURL,this.setDirty(!1),this.documentBaseURI=new Dw(Tc(n),{base_uri:this.baseUri}),this.baseURI=this.baseUri,this.inline=yd(n),this.hasVisual=Rd(n),this.shortcuts=new OR(this),this.editorCommands=new rR(this),tR(this);const d=i("cache_suffix");d&&(no.cacheSuffix=d.replace(/^[\?\&]+/,"")),this.ui={registry:AR(),styleSheetLoader:void 0,show:S,hide:S,setEnabled:S,isEnabled:I},this.mode=xR(n),o.dispatch("SetupEditor",{editor:this});const u=Pd(n);x(u)&&u.call(n,n)}render(){(e=>{const t=e.id;da.setCode(Yc(e));const o=()=>{AB.unbind(window,"ready",o),e.render()};if(!Gs.Event.domLoaded)return void AB.bind(window,"ready",o);if(!e.getElement())return;const n=mo(e.getElement()),r=_n(n);e.on("remove",()=>{q(n.dom.attributes,e=>wn(n,e.name)),fn(n,r)}),e.ui.styleSheetLoader=((e,t)=>Yi.forElement(e,{contentCssCors:Od(t),referrerPolicy:Gc(t)}))(n,e),yd(e)?e.inline=!0:(e.orgVisibility=e.getElement().style.visibility,e.getElement().style.visibility="hidden");const i=e.getElement().form||AB.getParent(t,"form");i&&(e.formElement=i,wd(e)&&!ei(e.getElement())&&(AB.insertAfter(AB.create("input",{type:"hidden",name:t}),t),e.hasHiddenInput=!0),e.formEventDelegate=t=>{e.dispatch(t.type,t)},AB.bind(i,"submit reset",e.formEventDelegate),e.on("reset",()=>{e.resetContent()}),!_d(e)||i.submit.nodeType||i.submit.length||i._mceOldSubmit||(i._mceOldSubmit=i.submit,i.submit=()=>(e.editorManager.triggerSave(),e.setDirty(!1),i._mceOldSubmit(i)))),e.windowManager=mx(e),e.notificationManager=dx(e),(e=>"xml"===e.options.get("encoding"))(e)&&e.on("GetContent",e=>{e.save&&(e.content=AB.encode(e.content))}),xd(e)&&e.on("submit",()=>{e.initialized&&e.save()}),Cd(e)&&(e._beforeUnload=()=>{!e.initialized||e.destroyed||e.isHidden()||e.save({format:"raw",no_events:!0,set_dirty:!1})},e.editorManager.on("BeforeUnload",e._beforeUnload)),e.editorManager.add(e),RB(e,e.suffix)})(this)}focus(e){this.execCommand("mceFocus",!1,e)}hasFocus(){return wp(this)}translate(e){return da.translate(e)}getParam(e,t,o){const n=this.options;return n.isRegistered(e)||(_(o)?n.register(e,{processor:o,default:t}):n.register(e,{processor:I,default:t})),n.isSet(e)||y(t)?n.get(e):t}hasPlugin(e,t){return!(!Z(Ad(this),e)||t&&void 0===ux.get(e))}nodeChanged(e){this._nodeChangeDispatcher.nodeChanged(e)}addCommand(e,t,o){this.editorCommands.addCommand(e,t,o)}addQueryStateHandler(e,t,o){this.editorCommands.addQueryStateHandler(e,t,o)}addQueryValueHandler(e,t,o){this.editorCommands.addQueryValueHandler(e,t,o)}addShortcut(e,t,o,n){this.shortcuts.add(e,t,o,n)}execCommand(e,t,o,n){return this.editorCommands.execCommand(e,t,o,n)}queryCommandState(e){return this.editorCommands.queryCommandState(e)}queryCommandValue(e){return this.editorCommands.queryCommandValue(e)}queryCommandSupported(e){return this.editorCommands.queryCommandSupported(e)}show(){const e=this;e.hidden&&(e.hidden=!1,e.inline?e.getBody().contentEditable="true":(MR.show(e.getContainer()),MR.hide(e.id)),e.load(),e.dispatch("show"))}hide(){const e=this;e.hidden||(e.save(),e.inline?(e.getBody().contentEditable="false",e===e.editorManager.focusedEditor&&(e.editorManager.focusedEditor=null)):(MR.hide(e.getContainer()),MR.setStyle(e.id,"display",e.orgDisplay)),e.hidden=!0,e.dispatch("hide"))}isHidden(){return this.hidden}setProgressState(e,t){this.dispatch("ProgressState",{state:e,time:t})}load(e={}){const t=this,o=t.getElement();if(t.removed)return"";if(o){const n={...e,load:!0},r=ei(o)?o.value:o.innerHTML,i=t.setContent(r,n);return n.no_events||t.dispatch("LoadContent",{...n,element:o}),i}return""}save(e={}){const t=this;let o=t.getElement();if(!o||!t.initialized||t.removed)return"";const n={...e,save:!0,element:o};let r=t.getContent(n);const i={...n,content:r};if(i.no_events||t.dispatch("SaveContent",i),"raw"===i.format&&t.dispatch("RawSaveContent",i),r=i.content,ei(o))o.value=r;else{!e.is_removing&&t.inline||(o.innerHTML=r);const n=MR.getParent(t.id,"form");n&&RR(n.elements,e=>e.name!==t.id||(e.value=r,!1))}return i.element=n.element=o=null,!1!==i.set_dirty&&t.setDirty(!1),r}setContent(e,t){return U_(this,e,t)}getContent(e){return((e,t={})=>{const o=((e,t)=>({...e,format:t,get:!0,getInner:!0}))(t,t.format?t.format:"html");return Qw(e,o).fold(A,t=>{const o=((e,t)=>B_(e).editor.getContent(t))(e,t);return e_(e,o,t)})})(this,e)}insertContent(e,t){t&&(e=BR({content:e},t)),this.execCommand("mceInsertContent",!1,e)}resetContent(e){void 0===e?U_(this,this.startContent,{format:"raw"}):U_(this,e),this.undoManager.reset(),this.setDirty(!1),this.nodeChanged()}isDirty(){return!this.isNotDirty}setDirty(e){const t=!this.isNotDirty;this.isNotDirty=!e,e&&e!==t&&this.dispatch("dirty")}getContainer(){const e=this;return e.container||(e.container=e.editorContainer||MR.get(e.id+"_parent")),e.container}getContentAreaContainer(){return this.contentAreaContainer}getElement(){return this.targetElm||(this.targetElm=MR.get(this.id)),this.targetElm}getWin(){const e=this;if(!e.contentWindow){const t=e.iframeElement;t&&(e.contentWindow=t.contentWindow)}return e.contentWindow}getDoc(){const e=this;if(!e.contentDocument){const t=e.getWin();t&&(e.contentDocument=t.document)}return e.contentDocument}getBody(){var e,t;const o=this.getDoc();return null!==(t=null!==(e=this.bodyElement)&&void 0!==e?e:null==o?void 0:o.body)&&void 0!==t?t:null}convertURL(e,t,o){const n=this,r=n.options.get,i=Ld(n);if(x(i))return i.call(n,e,o,!0,t);if(!r("convert_urls")||"link"===o||p(o)&&"LINK"===o.nodeName||0===e.indexOf("file:")||0===e.length)return e;const s=new Dw(e);return"http"!==s.protocol&&"https"!==s.protocol&&""!==s.protocol?e:r("relative_urls")?n.documentBaseURI.toRelative(e):e=n.documentBaseURI.toAbsolute(e,r("remove_script_host"))}addVisual(e){((e,t)=>{((e,t)=>{R_(e).editor.addVisual(t)})(e,t)})(this,e)}setEditableRoot(e){((e,t)=>{e._editableRoot!==t&&(e._editableRoot=t,Cx(e)||(e.getBody().contentEditable=String(e.hasEditableRoot()),e.nodeChanged()),((e,t)=>{e.dispatch("EditableRootStateChange",{state:t})})(e,t))})(this,e)}hasEditableRoot(){return this._editableRoot}remove(){(e=>{if(!e.removed){const{_selectionOverrides:t,editorUpload:o}=e,n=e.getBody(),r=e.getElement();n&&e.save({is_removing:!0}),e.removed=!0,e.unbindAllNativeEvents(),e.hasHiddenInput&&_(null==r?void 0:r.nextSibling)&&ex.remove(r.nextSibling),(e=>{e.dispatch("remove")})(e),e.editorManager.remove(e),!e.inline&&n&&(e=>{ex.setStyle(e.id,"display",e.orgDisplay)})(e),(e=>{e.dispatch("detach")})(e),ex.remove(e.getContainer()),tx(t),tx(o),e.destroy()}})(this)}destroy(e){((e,t)=>{const{selection:o,dom:n}=e;e.destroyed||(t||e.removed?(t||(e.editorManager.off("beforeunload",e._beforeUnload),e.theme&&e.theme.destroy&&e.theme.destroy(),tx(o),tx(n)),(e=>{const t=e.formElement;t&&(t._mceOldSubmit&&(t.submit=t._mceOldSubmit,delete t._mceOldSubmit),ex.unbind(t,"submit reset",e.formEventDelegate))})(e),(e=>{const t=e;t.contentAreaContainer=t.formElement=t.container=t.editorContainer=null,t.bodyElement=t.contentDocument=t.contentWindow=null,t.iframeElement=t.targetElm=null;const o=e.selection;if(o){const e=o.dom;t.selection=o.win=o.dom=e.doc=null}})(e),e.destroyed=!0):e.remove())})(this,e)}uploadImages(){return this.editorUpload.uploadImages()}_scanForImages(){return this.editorUpload.scanForImages()}}const VR=ra.DOM,DR=ao.each;let PR,IR=!1,LR=[];const FR=e=>{const t=e.type;DR(ZR.get(),o=>{switch(t){case"scroll":o.dispatch("ScrollWindow",e);break;case"resize":o.dispatch("ResizeWindow",e)}})},zR=e=>{if(e!==IR){const t=ra.DOM;e?(t.bind(window,"resize",FR),t.bind(window,"scroll",FR)):(t.unbind(window,"resize",FR),t.unbind(window,"scroll",FR)),IR=e}},HR=e=>{const t=LR;return LR=Y(LR,t=>e!==t),ZR.activeEditor===e&&(ZR.activeEditor=LR.length>0?LR[0]:null),ZR.focusedEditor===e&&(ZR.focusedEditor=null),t.length!==LR.length},UR="CSS1Compat"!==document.compatMode,ZR={...lR,baseURI:null,baseURL:null,defaultOptions:{},documentBaseURL:null,suffix:null,majorVersion:"7",minorVersion:"9.3",releaseDate:"2026-05-19",i18n:da,activeEditor:null,focusedEditor:null,setup(){const e=this;let t="",o="",n=Dw.getDocumentBaseUrl(document.location);/^[^:]+:\/\/\/?[^\/]+\//.test(n)&&(n=n.replace(/[\?#].*$/,"").replace(/[\/\\][^\/]+$/,""),/[\/\\]$/.test(n)||(n+="/"));const r=window.mailpoetTinymce||window.mailpoetTinyMCEPreInit;if(r)t=r.base||r.baseURL,o=r.suffix;else{const e=document.getElementsByTagName("script");for(let n=0;n<e.length;n++){const r=e[n].src||"";if(""===r)continue;const i=r.substring(r.lastIndexOf("/"));if(/tinymce(\.full|\.jquery|)(\.min|\.dev|)\.js/.test(r)){-1!==i.indexOf(".min")&&(o=".min"),t=r.substring(0,r.lastIndexOf("/"));break}}if(!t&&document.currentScript){const e=document.currentScript.src;-1!==e.indexOf(".min")&&(o=".min"),t=e.substring(0,e.lastIndexOf("/"))}}var i;e.baseURL=new Dw(n).toAbsolute(t),e.documentBaseURL=n,e.baseURI=new Dw(e.baseURL),e.suffix=o,(i=e).on("AddEditor",B(fp,i)),i.on("RemoveEditor",B(vp,i))},overrideDefaults(e){const t=e.base_url;t&&this._setBaseUrl(t);const o=e.suffix;o&&(this.suffix=o),this.defaultOptions=e;const n=e.plugin_base_urls;void 0!==n&&fe(n,(e,t)=>{ua.PluginManager.urls[t]=e})},init(e){const t=this;let o;const n=ao.makeMap("area base basefont br col frame hr img input isindex link meta param embed source wbr track colgroup option table tbody tfoot thead tr th td script noscript style textarea video audio iframe object menu"," ");let r=e=>{o=e};const i=()=>{let o=0;const s=[];let a;VR.unbind(window,"ready",i),(()=>{const o=e.onpageload;o&&o.apply(t,[])})(),a=me((e=>no.browser.isIE()||no.browser.isEdge()?(bx("TinyMCE does not support the browser you are using. For a list of supported browsers please see: https://www.tiny.cloud/docs/tinymce/7/support/#supportedwebbrowsers"),[]):UR?(bx("Failed to initialize the editor as the document is not in standards mode. TinyMCE requires standards mode."),[]):m(e.selector)?VR.select(e.selector):_(e.target)?[e.target]:[])(e)),ao.each(a,e=>{var o;(o=t.get(e.id))&&o.initialized&&!(o.getContainer()||o.getBody()).parentNode&&(HR(o),o.unbindAllNativeEvents(),o.destroy(!0),o.removed=!0)}),a=ao.grep(a,e=>!t.get(e.id)),0===a.length?r([]):DR(a,i=>{((e,t)=>e.inline&&t.tagName.toLowerCase()in n)(e,i)?bx("Could not initialize inline editor on invalid inline target element",i):((e,n,i)=>{const l=new NR(e,n,t);s.push(l),l.on("init",()=>{++o===a.length&&r(s)}),l.targetElm=l.targetElm||i,l.render()})((e=>{let t=e.id;return t||(t=ke(e,"name").filter(e=>!VR.get(e)).getOrThunk(VR.uniqueId),e.setAttribute("id",t)),t})(i),e,i)})};return VR.bind(window,"ready",i),new Promise(e=>{o?e(o):r=t=>{e(t)}})},get(e){return 0===arguments.length?LR.slice(0):m(e)?Q(LR,t=>t.id===e).getOr(null):C(e)&&LR[e]?LR[e]:null},add(e){const t=this,o=t.get(e.id);return o===e||(null===o&&LR.push(e),zR(!0),t.activeEditor=e,t.dispatch("AddEditor",{editor:e}),PR||(PR=e=>{const o=t.dispatch("BeforeUnload");if(o.returnValue)return e.preventDefault(),e.returnValue=o.returnValue,o.returnValue},window.addEventListener("beforeunload",PR))),e},createEditor(e,t){return this.add(new NR(e,t,this))},remove(e){const t=this;let o;if(e){if(!m(e))return o=e,v(t.get(o.id))?null:(HR(o)&&t.dispatch("RemoveEditor",{editor:o}),0===LR.length&&window.removeEventListener("beforeunload",PR),o.remove(),zR(LR.length>0),o);DR(VR.select(e),e=>{o=t.get(e.id),o&&t.remove(o)})}else for(let e=LR.length-1;e>=0;e--)t.remove(LR[e])},execCommand(e,t,o){var n;const r=this,i=p(o)?null!==(n=o.id)&&void 0!==n?n:o.index:o;switch(e){case"mceAddEditor":if(!r.get(i)){const e=o.options;new NR(i,e,r).render()}return!0;case"mceRemoveEditor":{const e=r.get(i);return e&&e.remove(),!0}case"mceToggleEditor":{const e=r.get(i);return e?(e.isHidden()?e.show():e.hide(),!0):(r.execCommand("mceAddEditor",!1,o),!0)}}return!!r.activeEditor&&r.activeEditor.execCommand(e,t,o)},triggerSave:()=>{DR(LR,e=>{e.save()})},addI18n:(e,t)=>{da.add(e,t)},translate:e=>da.translate(e),setActive(e){const t=this.activeEditor;this.activeEditor!==e&&(t&&t.dispatch("deactivate",{relatedTarget:e}),e.dispatch("activate",{relatedTarget:t})),this.activeEditor=e},_setBaseUrl(e){this.baseURL=new Dw(this.documentBaseURL).toAbsolute(e.replace(/\/+$/,"")),this.baseURI=new Dw(this.baseURL)}};ZR.setup();const $R=(()=>{const e=je();return{FakeClipboardItem:e=>({items:e,types:pe(e),getType:t=>ke(e,t).getOrUndefined()}),write:t=>{e.set(t)},read:()=>e.get().getOrUndefined(),clear:e.clear}})(),jR=Math.min,WR=Math.max,qR=Math.round,GR=(e,t,o)=>{let n=t.x,r=t.y;const i=e.w,s=e.h,a=t.w,l=t.h,c=(o||"").split("");return"b"===c[0]&&(r+=l),"r"===c[1]&&(n+=a),"c"===c[0]&&(r+=qR(l/2)),"c"===c[1]&&(n+=qR(a/2)),"b"===c[3]&&(r-=s),"r"===c[4]&&(n-=i),"c"===c[3]&&(r-=qR(s/2)),"c"===c[4]&&(n-=qR(i/2)),YR(n,r,i,s)},YR=(e,t,o,n)=>({x:e,y:t,w:o,h:n}),XR={inflate:(e,t,o)=>YR(e.x-t,e.y-o,e.w+2*t,e.h+2*o),relativePosition:GR,findBestRelativePosition:(e,t,o,n)=>{for(let r=0;r<n.length;r++){const i=GR(e,t,n[r]);if(i.x>=o.x&&i.x+i.w<=o.w+o.x&&i.y>=o.y&&i.y+i.h<=o.h+o.y)return n[r]}return null},intersect:(e,t)=>{const o=WR(e.x,t.x),n=WR(e.y,t.y),r=jR(e.x+e.w,t.x+t.w),i=jR(e.y+e.h,t.y+t.h);return r-o<0||i-n<0?null:YR(o,n,r-o,i-n)},clamp:(e,t,o)=>{let n=e.x,r=e.y,i=e.x+e.w,s=e.y+e.h;const a=t.x+t.w,l=t.y+t.h,c=WR(0,t.x-n),d=WR(0,t.y-r),u=WR(0,i-a),h=WR(0,s-l);return n+=c,r+=d,o&&(i+=c,s+=d,n-=u,r-=h),i-=u,s-=h,YR(n,r,i-n,s-r)},create:YR,fromClientRect:e=>YR(e.left,e.top,e.width,e.height)},KR=(()=>{const e={},t={},o={};return{load:(o,n)=>{const r=`Script at URL "${n}" failed to load`,i=`Script at URL "${n}" did not call \`mailpoetTinymce.Resource.add('${o}', data)\` within 1 second`;if(void 0!==e[o])return e[o];{const s=new Promise((e,s)=>{const a=((e,t,o=1e3)=>{let n=!1,r=null;const i=e=>(...t)=>{n||(n=!0,null!==r&&(window.clearTimeout(r),r=null),e.apply(null,t))},s=i(e),a=i(t);return{start:(...e)=>{n||null!==r||(r=window.setTimeout(()=>a.apply(null,e),o))},resolve:s,reject:a}})(e,s);t[o]=a.resolve,sa.ScriptLoader.loadScript(n).then(()=>a.start(i),()=>a.reject(r))});return e[o]=s,s}},add:(n,r)=>{void 0!==t[n]&&(t[n](r),delete t[n]),e[n]=Promise.resolve(r),o[n]=r},has:e=>e in o,get:e=>o[e],unload:t=>{delete e[t],delete o[t]}}})();let JR;try{const e="__storage_test__";JR=window.localStorage,JR.setItem(e,e),JR.removeItem(e)}catch(e){JR=(()=>{let e={},t=[];const o={getItem:t=>e[t]||null,setItem:(o,n)=>{t.push(o),e[o]=String(n)},key:e=>t[e],removeItem:o=>{t=t.filter(e=>e===o),delete e[o]},clear:()=>{t=[],e={}},length:0};return Object.defineProperty(o,"length",{get:()=>t.length,configurable:!1,enumerable:!1}),o})()}const QR={geom:{Rect:XR},util:{Delay:ap,Tools:ao,VK:Cp,URI:Dw,EventDispatcher:sR,Observable:lR,I18n:da,LocalStorage:JR,ImageUploader:e=>{const t=Bx(),o=Dx(e,t);return{upload:(t,n=!0)=>o.upload(t,n?Vx(e):void 0)}}},dom:{EventUtils:Gs,TreeWalker:Fr,TextSeeker:ka,DOMUtils:ra,ScriptLoader:sa,RangeUtils:zp,Serializer:H_,StyleSheetLoader:Gi,ControlSelection:Op,BookmarkManager:Xm,Selection:L_,Event:Gs.Event},html:{Styles:Fs,Entities:hs,Node:mg,Schema:As,DomParser:Xw,Writer:Bg,Serializer:Rg},Env:no,AddOnManager:ua,Annotator:Ym,Formatter:qx,UndoManager:Yx,EditorCommands:rR,WindowManager:mx,NotificationManager:dx,EditorObservable:pR,Shortcuts:OR,Editor:NR,FocusManager:sp,EditorManager:ZR,DOM:ra.DOM,ScriptLoader:sa.ScriptLoader,PluginManager:ux,ThemeManager:hx,ModelManager:nx,IconManager:ox,Resource:KR,FakeClipboard:$R,trim:ao.trim,isArray:ao.isArray,is:ao.is,toArray:ao.toArray,makeMap:ao.makeMap,each:ao.each,map:ao.map,grep:ao.grep,inArray:ao.inArray,extend:ao.extend,walk:ao.walk,resolve:ao.resolve,explode:ao.explode,_addCacheSuffix:ao._addCacheSuffix},eN=ao.extend(ZR,QR);var tN;tN=eN,window.mailpoetTinymce=tN,window.mailpoetTinyMCE=tN,(t=>{try{e.exports=t}catch(e){}})(eN)}()},67711(){(function(){var e,t;e=this.jQuery||window.jQuery,t=e(window),e.fn.stick_in_parent=function(o){var n,r,i,s,a,l,c,d,u,h,m,p,g;for(null==o&&(o={}),g=o.sticky_class,l=o.inner_scrolling,p=o.recalc_every,m=o.parent,u=o.offset_top,d=o.spacer,i=o.bottoming,null==u&&(u=0),null==m&&(m=void 0),null==l&&(l=!0),null==g&&(g="is_stuck"),n=e(document),null==i&&(i=!0),h=function(e){var t,o;return window.getComputedStyle?(e[0],t=window.getComputedStyle(e[0]),o=parseFloat(t.getPropertyValue("width"))+parseFloat(t.getPropertyValue("margin-left"))+parseFloat(t.getPropertyValue("margin-right")),"border-box"!==t.getPropertyValue("box-sizing")&&(o+=parseFloat(t.getPropertyValue("border-left-width"))+parseFloat(t.getPropertyValue("border-right-width"))+parseFloat(t.getPropertyValue("padding-left"))+parseFloat(t.getPropertyValue("padding-right"))),o):e.outerWidth(!0)},s=function(o,r,s,a,c,f,v,b){var y,w,_,x,C,k,S,T,E,O,A,M;if(!o.data("sticky_kit")){if(o.data("sticky_kit",!0),C=n.height(),S=o.parent(),null!=m&&(S=S.closest(m)),!S.length)throw"failed to find stick parent";return _=!1,y=!1,(A=null!=d?d&&o.closest(d):e("<div />"))&&A.css("position",o.css("position")),(T=function(){var e,t,i;if(!b)return C=n.height(),e=parseInt(S.css("border-top-width"),10),t=parseInt(S.css("padding-top"),10),r=parseInt(S.css("padding-bottom"),10),s=S.offset().top+e+t,a=S.height(),_&&(_=!1,y=!1,null==d&&(o.insertAfter(A),A.detach()),o.css({position:"",top:"",width:"",bottom:""}).removeClass(g),i=!0),c=o.offset().top-(parseInt(o.css("margin-top"),10)||0)-u,f=o.outerHeight(!0),v=o.css("float"),A&&A.css({width:h(o),height:f,display:o.css("display"),"vertical-align":o.css("vertical-align"),float:v}),i?M():void 0})(),x=void 0,k=u,O=p,M=function(){var e,h,m,w,E,M;if(!b)return m=!1,null!=O&&(O-=1)<=0&&(O=p,T(),m=!0),m||n.height()===C||(T(),m=!0),w=t.scrollTop(),null!=x&&(h=w-x),x=w,_?(i&&(E=w+f+k>a+s,y&&!E&&(y=!1,o.css({position:"fixed",bottom:"",top:k}).trigger("sticky_kit:unbottom"))),w<c&&(_=!1,k=u,null==d&&("left"!==v&&"right"!==v||o.insertAfter(A),A.detach()),e={position:"",width:"",top:""},o.css(e).removeClass(g).trigger("sticky_kit:unstick")),l&&(M=t.height(),f+u>M&&(y||(k-=h,k=Math.max(M-f,k),k=Math.min(u,k),_&&o.css({top:k+"px"}))))):w>c&&(_=!0,(e={position:"fixed",top:k}).width="border-box"===o.css("box-sizing")?o.outerWidth()+"px":o.width()+"px",o.css(e).addClass(g),null==d&&(o.after(A),"left"!==v&&"right"!==v||A.append(o)),o.trigger("sticky_kit:stick")),_&&i&&(null==E&&(E=w+f+k>a+s),!y&&E)?(y=!0,"static"===S.css("position")&&S.css({position:"relative"}),o.css({position:"absolute",bottom:r,top:"auto"}).trigger("sticky_kit:bottom")):void 0},E=function(){return T(),M()},w=function(){if(b=!0,t.off("touchmove",M),t.off("scroll",M),t.off("resize",E),e(document.body).off("sticky_kit:recalc",E),o.off("sticky_kit:detach",w),o.removeData("sticky_kit"),o.css({position:"",bottom:"",top:"",width:""}),S.position("position",""),_)return null==d&&("left"!==v&&"right"!==v||o.insertAfter(A),A.remove()),o.removeClass(g)},t.on("touchmove",M),t.on("scroll",M),t.on("resize",E),e(document.body).on("sticky_kit:recalc",E),o.on("sticky_kit:detach",w),setTimeout(M,0)}},a=0,c=this.length;a<c;a++)r=this[a],s(e(r));return this}}).call(this)},41669(e){"use strict";e.exports=jQuery}},e=>{e.O(0,[223],()=>e(e.s=85532)),e.O()}]);