text: ((t,e)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var n in s)("object"==typeof exports?exports:t)[n]=s[n]}})(self,(function(){return function(){"use strict";var t={d(e,s){for(var n in s)t.o(s,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:s[n]})},o(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{VDomRender:()=>ye});var s={};function n(t,e,s,n){var i,o=arguments.length,r=3>o?e:null===n?n=Object.getOwnPropertyDescriptor(e,s):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,n);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(3>o?i(r):o>3?i(e,s,r):i(e,s))||r);return o>3&&r&&Object.defineProperty(e,s,r),r}function i(t){return"function"==typeof t}function o(t){return t&&"function"==typeof t.then}function r(t){return"string"==typeof t}function a(t){return null==t}function l(t,e){if(!r(t)||!t.length)return null;const s=t.split(".");let n=e;try{for(const t of s){if(a(n[t]))return null;n=n[t]}}catch(t){return null}return a(n)?null:n}t.r(s),t.d(s,{required:()=>Ht,url:()=>$t});const c={beforeInit:"beforeInit",ready:"ready",beforeDestruct:"beforeDestruct",destructed:"destructed"};function h(t){return Array.isArray(t)}const u="\ufeff",d=/^(ARTICLE|SCRIPT|STYLE|OBJECT|FOOTER|HEADER|NAV|SECTION|IFRAME|JODIT|JODIT-MEDIA|PRE|DIV|P|LI|UL|OL|H[1-6]|BLOCKQUOTE|TR|TD|TH|TBODY|THEAD|TABLE|BODY|HTML|FIGCAPTION|FIGURE|DT|DD|DL|DFN|FORM)$/i,p=["img","br","video","iframe","script","input","textarea","hr","link","jodit","jodit-media"],f=(RegExp(`^${p.join("|")}$`,"i"),"undefined"!=typeof navigator&&(-1!==navigator.userAgent.indexOf("MSIE")||navigator),"jodit-selection_marker"),m=("undefined"!=typeof window&&window,(()=>{if("undefined"==typeof document)return"";const t=document.currentScript,e=t=>t.replace(/\/[^/]+.js$/,"/");if(t)return e(t.src);const s=document.querySelectorAll("script[src]");s&&s.length?e(s[s.length-1].src):window})(),"data-jodit-temp");class g{constructor(){this._items=new Map}normalizeName(t){return P(t).toLowerCase()}items(t){const e=[];return this._items.forEach(((t,s)=>{e.push([s,t])})),e.filter((([e])=>!t||t.includes(e)))}add(t,e){this._items.set(this.normalizeName(t),e)}get(t){return this._items.get(this.normalizeName(t))}remove(t){this._items.delete(this.normalizeName(t))}init(t){const e=t.o.extraPlugins.map((t=>r(t)?{name:t}:t)),s=S(t.o.disablePlugins).map((t=>this.normalizeName(t))),n=[],i={},a=[],l={},c=([e,o])=>{var r;if(s.includes(e)||n.includes(e)||i[e])return;const c=null===(r=o)||void 0===r?void 0:r.requires;if(c&&h(c)&&this.hasDisabledRequires(s,c))return;const u=g.makePluginInstance(t,o);u&&(this.initOrWait(t,e,u,n,i),a.push(u),l[e]=u)};return d=()=>{t.isInDestruct||(this.items(t.o.safeMode?t.o.safePluginsList.concat(e.map((t=>t.name))):null).forEach(c),this.addListenerOnBeforeDestruct(t,a),t.__plugins=l)},o(u=this.loadExtras(t,e))?u.finally(d):d();var u,d}hasDisabledRequires(t,e){return!(!(null==e?void 0:e.length)||!t.some((t=>e.includes(t))))}static makePluginInstance(t,e){try{return i(e)?new e(t):e}catch(t){}return null}initOrWait(t,e,s,n,o){const r=(e,s)=>{if(!a(r=s)&&i(r.init)){const i=s.requires;if((null==i?void 0:i.length)&&!i.every((t=>n.includes(t))))return o[e]=s,!1;try{s.init(t)}catch(t){}n.push(e)}else n.push(e);var r;return s.hasStyle&&g.loadStyle(t,e),!0};r(e,s),Object.keys(o).forEach((t=>{const e=o[t];e&&r(t,e)&&(o[t]=void 0,delete o[t])}))}addListenerOnBeforeDestruct(t,e){t.e.on("beforeDestruct",(()=>{e.forEach((e=>{var s;!a(s=e)&&i(s.destruct)&&e.destruct(t)})),e.length=0,delete t.__plugins}))}load(t,e){return Promise.all(e.map((e=>{const s=e.url||g.getFullUrl(t,e.name,!0);return bt(t,s).then((t=>({v:t,status:"fulfilled"})),(t=>({e:t,status:"rejected"})))})))}static async loadStyle(t,e){const s=g.getFullUrl(t,e,!1);if(!this.styles.has(s))return this.styles.add(s),Ct(t,s)}static getFullUrl(t,e,s){return e=P(e),t.basePath+"plugins/"+e+"/"+e+"."+(s?"js":"css")}loadExtras(t,e){if(e&&e.length)try{const s=e.filter((t=>!this._items.has(this.normalizeName(t.name))));if(s.length)return this.load(t,s)}catch(t){}}}g.styles=new Set;const v="JoditEventDefaultNamespace";class b{constructor(){this.__store={}}get(t,e){if(void 0!==this.__store[e])return this.__store[e][t]}indexOf(t,e,s){const n=this.get(t,e);if(n)for(let t=0;n.length>t;t+=1)if(n[t].originalCallback===s)return t;return!1}namespaces(t=!1){const e=Object.keys(this.__store);return t?e.filter((t=>t!==v)):e}events(t){return this.__store[t]?Object.keys(this.__store[t]):[]}set(t,e,s,n=!1){void 0===this.__store[e]&&(this.__store[e]={}),void 0===this.__store[e][t]&&(this.__store[e][t]=[]),n?this.__store[e][t].unshift(s):this.__store[e][t].push(s)}clear(){this.__store={}}}function C(t){return new TypeError(t)}const y=t=>i(t.className)?t.className():NaN;function E(t){class e extends t{constructor(...t){super(...t);const s=Object.getPrototypeOf(this)===e.prototype,n=y(this)===y(e.prototype);(s||n)&&this.setStatus("ready")}}return e.prototype.constructor=t,e}function w(t,e=!1,s="debounce"){return(n,o)=>{if(!i(n[o]))throw C("Handler must be a Function");n.hookStatus(c.ready,(n=>{const r=ut(n)?n:n.jodit,a=i(t)?t(n):t;n[o]=r.async[s](n[o].bind(n),dt(a)||ft(a)?a:r.defaultTimeout,e)}))}}function N(t){return(e,s)=>{if(!i(e[s]))throw C("Handler must be a Function");e.hookStatus(t,(t=>{e[s].call(t)}))}}function S(t){return r(t)?t.split(/[,\s]+/):t}function j(t,e){let s;do{s=Object.getOwnPropertyDescriptor(t,e),t=Object.getPrototypeOf(t)}while(!s&&t);return s}function x(t,e){return(s,n)=>{if(!i(s[n]))throw C("Handler must be a Function");const o=o=>{const r=(t,...e)=>{if(!o.isInDestruct)return o[n](t,...e)};S(t).forEach((t=>{if(/:/.test(t)){const[s,n]=t.split(":"),a=ut(o)?o:o.jodit;return s.length&&(e=o.get(s)),i(e)&&(e=e(o)),a.events.on(e||o,n,r),e||a.events.on(n,r),void a.hookStatus("beforeDestruct",(()=>{a.events.off(e||o,n,r).off(n,r)}))}const n=t.split("."),[a]=n,l=n.slice(1);let c=o[a];ft(c)&&R(c).on("change."+l.join("."),r);const h=j(s,a);Object.defineProperty(o,a,{configurable:!0,set(t){const e=c;e!==t&&(c=t,h&&h.set&&h.set.call(o,t),ft(c)&&(c=R(c),c.on("change."+l.join("."),r)),r(a,e,c))},get(){return h&&h.get?h.get.call(o):c}})}))};i(s.hookStatus)?s.hookStatus(c.ready,o):o(s)}}function I(t){return I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?t=>typeof t:t=>t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t,I(t)}function T(t,e,s){var n=s.value;if("function"!=typeof n)throw new TypeError("@boundMethod decorator can only be applied to methods not: ".concat(I(n)));var i=!1;return{configurable:!0,get(){if(i||this===t.prototype||this.hasOwnProperty(e)||"function"!=typeof n)return n;var s=n.bind(this);return i=!0,Object.defineProperty(this,e,{configurable:!0,get:()=>s,set(t){n=t,delete this[e]}}),i=!1,s},set(t){n=t}}}function k(t){var e;return"undefined"!=typeof Reflect&&"function"==typeof Reflect.ownKeys?e=Reflect.ownKeys(t.prototype):(e=Object.getOwnPropertyNames(t.prototype),"function"==typeof Object.getOwnPropertySymbols&&(e=e.concat(Object.getOwnPropertySymbols(t.prototype)))),e.forEach((e=>{if("constructor"!==e){var s=Object.getOwnPropertyDescriptor(t.prototype,e);"function"==typeof s.value&&Object.defineProperty(t.prototype,e,T(t,e,s))}})),t}function O(){return 1===arguments.length?k.apply(void 0,arguments):T.apply(void 0,arguments)}const _=Symbol("observable-object");function F(t){return void 0!==t[_]}function R(t){if(F(t))return t;const e={},s={},n=(e,i)=>h(e)?(e.map((t=>n(t,i))),t):(s[e]||(s[e]=[]),s[e].push(i),t),i=(n,...o)=>{if(h(n))n.map((t=>i(t,...o)));else try{!e[n]&&s[n]&&(e[n]=!0,s[n].forEach((e=>e.call(t,...o))))}finally{e[n]=!1}},o=(e,s=[])=>{const r={};F(e)||(Object.defineProperty(e,_,{enumerable:!1,value:!0}),Object.keys(e).forEach((n=>{const a=n,l=s.concat(a).filter((t=>t.length));r[a]=e[a];const c=j(e,a);Object.defineProperty(e,a,{set(e){var s;const n=r[a];if(r[a]!==e){i(["beforeChange","beforeChange."+l.join(".")],a,e),ft(e)&&o(e,l),c&&c.set?c.set.call(t,e):r[a]=e;const h=[];i(["change",...l.reduce(((t,e)=>(h.push(e),t.push("change."+h.join(".")),t)),[])],l.join("."),n,(null===(s=e)||void 0===s?void 0:s.valueOf)?e.valueOf():e)}},get:()=>c&&c.get?c.get.call(t):r[a],enumerable:!0,configurable:!0}),ft(r[a])&&o(r[a],l)})),Object.defineProperty(t,"on",{value:n}))};return o(t),t}const M=new Map,L=t=>{var e;if(i(t.className))return t.className();const s=(null===(e=t.constructor)||void 0===e?void 0:e.originalConstructor)||t.constructor;if(M.has(s))return M.get(s);if(s.name)return s.name;const n=(""+s).match(/^\s*function\s*(\S*)\s*\(/);return n?n[1]:""},D=t=>t.replace(/([-_])(.)/g,((t,e,s)=>s.toUpperCase())),P=t=>t.replace(/([A-Z])([A-Z])([a-z])/g,"$1-$2$3").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase();function A(t){return t.replace(/[\s\n\t\r\uFEFF\u200b]+$/g,"").replace(/^[\s\n\t\r\uFEFF\u200b]+/g,"")}class B{constructor(){this.namespace="",this.safeMode=!1,this.safePluginsList=["about","enter","backspace"],this.license="",this.preset="custom",this.presets={inline:{inline:!0,toolbar:!1,toolbarInline:!0,toolbarInlineForSelection:!0,showXPathInStatusbar:!1,showCharsCounter:!1,showWordsCounter:!1,showPlaceholder:!1}},this.ownerDocument="undefined"!=typeof document?document:null,this.ownerWindow="undefined"!=typeof window?window:null,this.shadowRoot=null,this.styleValues={},this.zIndex=0,this.readonly=!1,this.disabled=!1,this.activeButtonsInReadOnly=["source","fullsize","print","about","dots","selectall"],this.toolbarButtonSize="middle",this.allowTabNavigation=!1,this.inline=!1,this.theme="default",this.saveModeInStorage=!1,this.spellcheck=!0,this.editorCssClass=!1,this.style=!1,this.triggerChangeEvent=!0,this.direction="",this.language="auto",this.debugLanguage=!1,this.i18n=!1,this.tabIndex=-1,this.toolbar=!0,this.statusbar=!0,this.showTooltip=!0,this.showTooltipDelay=1e3,this.useNativeTooltip=!1,this.enter="p",this.enterBlock="br"!==this.enter?this.enter:"p",this.defaultMode=1,this.useSplitMode=!1,this.colors={greyscale:["#000000","#434343","#666666","#999999","#B7B7B7","#CCCCCC","#D9D9D9","#EFEFEF","#F3F3F3","#FFFFFF"],palette:["#980000","#FF0000","#FF9900","#FFFF00","#00F0F0","#00FFFF","#4A86E8","#0000FF","#9900FF","#FF00FF"],full:["#E6B8AF","#F4CCCC","#FCE5CD","#FFF2CC","#D9EAD3","#D0E0E3","#C9DAF8","#CFE2F3","#D9D2E9","#EAD1DC","#DD7E6B","#EA9999","#F9CB9C","#FFE599","#B6D7A8","#A2C4C9","#A4C2F4","#9FC5E8","#B4A7D6","#D5A6BD","#CC4125","#E06666","#F6B26B","#FFD966","#93C47D","#76A5AF","#6D9EEB","#6FA8DC","#8E7CC3","#C27BA0","#A61C00","#CC0000","#E69138","#F1C232","#6AA84F","#45818E","#3C78D8","#3D85C6","#674EA7","#A64D79","#85200C","#990000","#B45F06","#BF9000","#38761D","#134F5C","#1155CC","#0B5394","#351C75","#733554","#5B0F00","#660000","#783F04","#7F6000","#274E13","#0C343D","#1C4587","#073763","#20124D","#4C1130"]},this.colorPickerDefaultTab="background",this.imageDefaultWidth=300,this.removeButtons=[],this.disablePlugins=[],this.extraPlugins=[],this.extraButtons=[],this.extraIcons={},this.createAttributes={},this.sizeLG=900,this.sizeMD=700,this.sizeSM=400,this.buttons=[{group:"font-style",buttons:[]},{group:"list",buttons:[]},{group:"font",buttons:[]},"---",{group:"script",buttons:[]},{group:"media",buttons:[]},"\n",{group:"state",buttons:[]},{group:"clipboard",buttons:[]},{group:"insert",buttons:[]},{group:"indent",buttons:[]},{group:"color",buttons:[]},{group:"form",buttons:[]},"---",{group:"history",buttons:[]},{group:"search",buttons:[]},{group:"source",buttons:[]},{group:"other",buttons:[]},{group:"info",buttons:[]}],this.buttonsMD=["bold","italic","|","ul","ol","eraser","|","font","fontsize","---","image","table","|","link","\n","brush","paragraph","align","|","hr","copyformat","fullsize","---","undo","redo","|","dots"],this.buttonsSM=["bold","italic","|","ul","ol","eraser","|","fontsize","brush","paragraph","---","image","table","\n","link","|","align","|","undo","redo","|","copyformat","fullsize","---","dots"],this.buttonsXS=["bold","brush","paragraph","eraser","|","fontsize","---","image","\n","align","undo","redo","|","link","table","---","dots"],this.events={},this.textIcons=!1,this.showBrowserColorPicker=!0}static get defaultOptions(){return B.__defaultOptions||(B.__defaultOptions=new B),B.__defaultOptions}}B.prototype.controls={};let z=1;const V=new Set;new g;const H={},$=new WeakMap;function U(t,e,s="div",n=!1){const i=e?L(e.prototype):"jodit-utils",o=$.get(t)||{},r=i+s,a=ut(t)?t:t.j;if(!o[r]){let e=a.c,l=ht(t)&&t.o.shadowRoot?t.o.shadowRoot:t.od.body;if(n&&ht(t)&&t.od!==t.ed){e=t.createInside;const n="style"===s?t.ed.head:t.ed.body;l=ht(t)&&t.o.shadowRoot?t.o.shadowRoot:n}const c=e.element(s,{className:`jodit jodit-${P(i)}-container jodit-box`});c.classList.add("jodit_theme_"+(a.o.theme||"default")),l.appendChild(c),o[r]=c,t.hookStatus("beforeDestruct",(()=>{ct.safeRemove(c),delete o[r],Object.keys(o).length&&$.delete(t)})),$.set(t,o)}return o[r].classList.remove("jodit_theme_default","jodit_theme_dark"),o[r].classList.add("jodit_theme_"+(a.o.theme||"default")),o[r]}const W=new class{constructor(t){this.mutedEvents=new Set,this.__key="__JoditEventEmitterNamespaces",this.doc=document,this.prepareEvent=t=>{t.cancelBubble||(t.type.match(/^touch/)&&t.changedTouches&&t.changedTouches.length&&["clientX","clientY","pageX","pageY"].forEach((e=>{Object.defineProperty(t,e,{value:t.changedTouches[0][e],configurable:!0,enumerable:!0})})),t.originalEvent||(t.originalEvent=t),"paste"===t.type&&void 0===t.clipboardData&&this.doc.defaultView.clipboardData&&Object.defineProperty(t,"clipboardData",{get:()=>this.doc.defaultView.clipboardData,configurable:!0,enumerable:!0}))},this.currents=[],this.__stopped=[],this.isDestructed=!1,t&&(this.doc=t),this.__key+=(new Date).getTime()}mute(t){return this.mutedEvents.add(null!=t?t:"*"),this}isMuted(t){return!(!t||!this.mutedEvents.has(t))||this.mutedEvents.has("*")}unmute(t){return this.mutedEvents.delete(null!=t?t:"*"),this}eachEvent(t,e){t.split(/[\s,]+/).forEach((t=>{const s=t.split(".");e.call(this,s[0],s[1]||v)}))}getStore(t){if(!t)throw C("Need subject");if(void 0===t[this.__key]){const e=new b;Object.defineProperty(t,this.__key,{enumerable:!1,configurable:!0,value:e})}return t[this.__key]}clearStore(t){void 0!==t[this.__key]&&delete t[this.__key]}triggerNativeEvent(t,e){const s=this.doc.createEvent("HTMLEvents");"string"==typeof e?s.initEvent(e,!0,!0):(s.initEvent(e.type,e.bubbles,e.cancelable),["screenX","screenY","clientX","clientY","target","srcElement","currentTarget","timeStamp","which","keyCode"].forEach((t=>{Object.defineProperty(s,t,{value:e[t],enumerable:!0})})),Object.defineProperty(s,"originalEvent",{value:e,enumerable:!0})),t.dispatchEvent(s)}get current(){return this.currents[this.currents.length-1]}on(t,e,s,n=!1){const o=r(t)?this:t,a=r(e)?e:t;let l=s;void 0===l&&i(e)&&(l=e);const c=this.getStore(o);if(!r(a)||""===a)throw C("Need events names");if(!i(l))throw C("Need event handler");if(h(o))return o.forEach((t=>{this.on(t,a,l,n)})),this;const u=i(o.addEventListener),d=this;let p=function(t,...e){if(!d.isMuted(t))return l&&l.call(this,...e)};return u&&(p=function(t){if(!d.isMuted(t.type))return d.prepareEvent(t),l&&!1===l.call(this,t)?(t.preventDefault(),t.stopImmediatePropagation(),!1):void 0}),this.eachEvent(a,((t,e)=>{if(""===t)throw C("Need event name");if(!1===c.indexOf(t,e,l)&&(c.set(t,e,{event:t,originalCallback:l,syntheticCallback:p},n),u)){const e=!!["touchstart","touchend","scroll","mousewheel","mousemove","touchmove"].includes(t)&&{passive:!0};o.addEventListener(t,p,e)}})),this}one(t,e,s,n=!1){const o=r(t)?this:t,a=r(e)?e:t;let l=s;void 0===l&&i(e)&&(l=e);const c=(...t)=>(this.off(o,a,c),l(...t));return this.on(o,a,c,n),this}off(t,e,s){const n=r(t)?this:t,o=r(e)?e:t,a=this.getStore(n);let l=s;if(!r(o)||!o)return a.namespaces().forEach((t=>{this.off(n,"."+t)})),this.clearStore(n),this;void 0===l&&i(e)&&(l=e);const c=i(n.removeEventListener),h=t=>{c&&n.removeEventListener(t.event,t.syntheticCallback,!1)},u=(t,e)=>{if(""!==t){const s=a.get(t,e);if(s&&s.length)if(i(l)){const n=a.indexOf(t,e,l);!1!==n&&(h(s[n]),s.splice(n,1))}else s.forEach(h),s.length=0}else a.events(e).forEach((t=>{""!==t&&u(t,e)}))};return this.eachEvent(o,((t,e)=>{e===v?a.namespaces().forEach((e=>{u(t,e)})):u(t,e)})),this}stopPropagation(t,e){const s=r(t)?this:t,n=r(t)?t:e;if("string"!=typeof n)throw C("Need event names");const i=this.getStore(s);this.eachEvent(n,((t,e)=>{const n=i.get(t,e);n&&this.__stopped.push(n),e===v&&i.namespaces(!0).forEach((e=>this.stopPropagation(s,t+"."+e)))}))}removeStop(t){if(t){const e=this.__stopped.indexOf(t);-1!==e&&this.__stopped.splice(0,e+1)}}isStopped(t){return void 0!==t&&-1!==this.__stopped.indexOf(t)}fire(t,e,...s){let n,o;const a=r(t)?this:t,l=r(t)?t:e,c=r(t)?[e,...s]:s,h=i(a.dispatchEvent);if(!h&&!r(l))throw C("Need events names");const u=this.getStore(a);return!r(l)&&h?this.triggerNativeEvent(a,e):this.eachEvent(l,((t,e)=>{if(h)this.triggerNativeEvent(a,t);else{const s=u.get(t,e);if(s)try{[...s].every((e=>!this.isStopped(s)&&(this.currents.push(t),o=e.syntheticCallback.call(a,t,...c),this.currents.pop(),void 0!==o&&(n=o),!0)))}finally{this.removeStop(s)}e!==v||h||u.namespaces().filter((t=>t!==e)).forEach((e=>{const s=this.fire.call(this,a,t+"."+e,...c);void 0!==s&&(n=s)}))}})),n}destruct(){this.isDestructed&&(this.isDestructed=!0,this.off(this),this.getStore(this).clear(),delete this[this.__key])}};function q(t,e,s,n,i=!1){const{style:o,className:a}=t.options;return o&&(r(l=o)||h(l)?l.length:ft(l)?Object.keys(l).length:0)>0&&Object.keys(o).forEach((r=>{if(""!==e.style.getPropertyValue(P(r))||null!=o[r]){if(((t,e,s)=>{const n=t.create.element(e.tagName.toLowerCase());n.style.cssText=e.style.cssText,(t=>{var e;if(void 0!==ce(t,"shadowRoot"))return ce(t,"shadowRoot");const s=U(t),n=document.createElement("iframe");jt(n,{width:0,height:0,position:"absolute",border:0}),n.src="about:blank",s.appendChild(n);const i=null===(e=n.contentWindow)||void 0===e?void 0:e.document,o=i?i.body:t.od.body;return ce(t,"shadowRoot",o),o})(t).appendChild(n);const i=jt(n,s);return ct.safeRemove(n),i})(s,e,r)===St(r,o[r]))return!i&&jt(e,r,null),void(n=((t,e,s)=>(ue(e,"style")||(ue(e,"style",null),e.tagName.toLowerCase()===t.defaultTag&&(ct.unwrap(e),s=nt)),s))(t,e,n=ot));n=it,!i&&jt(e,r,o[r])}})),a&&(e.classList.contains(a)?(e.classList.remove(a),n=ot):(e.classList.add(a),n=it)),n;var l}class G{constructor(t){this.jodit=t,t.e.on("removeMarkers",(()=>{this.removeMarkers()}))}get j(){return this.jodit}errorNode(t){if(!ct.isNode(t))throw C("Parameter node must be instance of Node")}get area(){return this.j.editor}get win(){return this.j.ew}get doc(){return this.j.ed}get sel(){return this.j.o.shadowRoot&&i(this.j.o.shadowRoot.getSelection)?this.j.o.shadowRoot.getSelection():this.win.getSelection()}get range(){const t=this.sel;return t&&t.rangeCount?t.getRangeAt(0):this.createRange()}createRange(t=!1){const e=this.doc.createRange();return t&&this.selectRange(e),e}remove(){const t=this.sel,e=this.current();if(t&&e)for(let e=0;t.rangeCount>e;e+=1)t.getRangeAt(e).deleteContents(),t.getRangeAt(e).collapse(!0)}clear(){var t,e;(null===(t=this.sel)||void 0===t?void 0:t.rangeCount)&&(null===(e=this.sel)||void 0===e||e.removeAllRanges())}removeNode(t){if(!ct.isOrContains(this.j.editor,t,!0))throw C("Selection.removeNode can remove only editor's children");ct.safeRemove(t),this.j.e.fire("afterRemoveNode",t)}insertCursorAtPoint(t,e){this.removeMarkers();try{const s=this.createRange();return(()=>{if(this.doc.caretPositionFromPoint){const n=this.doc.caretPositionFromPoint(t,e);if(n)return void s.setStart(n.offsetNode,n.offset)}if(this.doc.caretRangeFromPoint){const n=this.doc.caretRangeFromPoint(t,e);s.setStart(n.startContainer,n.startOffset)}})(),s.collapse(!0),this.selectRange(s),!0}catch(t){}return!1}static isMarker(t){return ct.isNode(t)&&ct.isTag(t,"span")&&t.hasAttribute("data-"+f)}get hasMarkers(){return!!this.markers.length}get markers(){return ee("span[data-"+f+"]",this.area)}removeMarkers(){this.markers.forEach(ct.safeRemove)}marker(t=!1,e){let s=null;e&&(s=e.cloneRange(),s.collapse(t));const n=this.j.createInside.span();return n.id=f+"_"+Number(new Date)+"_"+(Math.random()+"").slice(2),n.style.lineHeight="0",n.style.display="none",n.setAttribute("data-"+f,t?"start":"end"),n.appendChild(this.j.createInside.text(u)),s&&ct.isOrContains(this.area,t?s.startContainer:s.endContainer)&&s.insertNode(n),n}restore(){let t=!1;const e=t=>`span[data-${f}=${t?"start":"end"}]`,s=this.area.querySelector(e(!0)),n=this.area.querySelector(e(!1));if(s){if(t=this.createRange(),n)t.setStartAfter(s),ct.safeRemove(s),t.setEndBefore(n),ct.safeRemove(n);else{const e=s.previousSibling;ct.isText(e)?t.setStart(e,e.nodeValue?e.nodeValue.length:0):t.setStartBefore(s),ct.safeRemove(s),t.collapse(!0)}t&&this.selectRange(t)}}save(t=!1){if(this.hasMarkers)return[];const e=this.sel;if(!e||!e.rangeCount)return[];const s=[],n=e.rangeCount,i=[];for(let t=0;n>t;t+=1)if(i[t]=e.getRangeAt(t),i[t].collapsed){const e=this.marker(!0,i[t]);s[t]={startId:e.id,collapsed:!0,startMarker:e.outerHTML}}else{const e=this.marker(!0,i[t]),n=this.marker(!1,i[t]);s[t]={startId:e.id,endId:n.id,collapsed:!1,startMarker:e.outerHTML,endMarker:n.outerHTML}}if(!t){e.removeAllRanges();for(let t=n-1;t>=0;--t){const n=this.doc.getElementById(s[t].startId);if(n)if(s[t].collapsed)i[t].setStartAfter(n),i[t].collapse(!0);else if(i[t].setStartBefore(n),s[t].endId){const e=this.doc.getElementById(s[t].endId);e&&i[t].setEndAfter(e)}try{e.addRange(i[t].cloneRange())}catch(t){}}}return s}focus(t={preventScroll:!0}){var e,s;if(!this.isFocused()){const n=ne(this.j.container),i=null==n?void 0:n.scrollTop;this.j.iframe&&"complete"===this.doc.readyState&&this.j.iframe.focus(t),this.win.focus(),this.area.focus(t),i&&(null==n?void 0:n.scrollTo)&&n.scrollTo(0,i);const o=this.sel,r=(null==o?void 0:o.rangeCount)?null==o?void 0:o.getRangeAt(0):null;if(!r||!ct.isOrContains(this.area,r.startContainer)){const t=this.createRange();t.setStart(this.area,0),t.collapse(!0),this.selectRange(t,!1)}return this.j.editorIsActive||null===(s=null===(e=this.j)||void 0===e?void 0:e.events)||void 0===s||s.fire("focus"),!0}return!1}isCollapsed(){const t=this.sel;for(let e=0;t&&t.rangeCount>e;e+=1)if(!t.getRangeAt(e).collapsed)return!1;return!0}isFocused(){return this.doc.hasFocus&&this.doc.hasFocus()&&this.area===this.doc.activeElement}current(t=!0){if(1===this.j.getRealMode()){const e=this.sel;if(!e||0===e.rangeCount)return null;const s=e.getRangeAt(0);let n=s.startContainer,i=!1;const o=t=>i?t.lastChild:t.firstChild;if(ct.isTag(n,"br")&&e.isCollapsed)return n;if(!ct.isText(n)){if(n=s.startContainer.childNodes[s.startOffset],n||(n=s.startContainer.childNodes[s.startOffset-1],i=!0),n&&e.isCollapsed&&!ct.isText(n))if(!i&&ct.isText(n.previousSibling))n=n.previousSibling;else if(t){let t=o(n);for(;t;){if(t&&ct.isText(t)){n=t;break}t=o(t)}}if(n&&!e.isCollapsed&&!ct.isText(n)){let t=n,e=n;do{t=t.firstChild,e=e.lastChild}while(t&&e&&!ct.isText(t));t===e&&t&&ct.isText(t)&&(n=t)}}if(n&&ct.isOrContains(this.area,n))return n}return null}insertNode(t,e=!0,s=!0){var n;this.errorNode(t),this.j.e.fire("safeHTML",t),!this.isFocused()&&this.j.isEditorMode()&&(this.focus(),this.restore());const i=this.sel;if(this.isCollapsed()||this.j.execCommand("Delete"),i&&i.rangeCount){const e=i.getRangeAt(0);ct.isOrContains(this.area,e.commonAncestorContainer)?ct.isTag(e.startContainer,p)&&e.collapsed?null===(n=e.startContainer.parentNode)||void 0===n||n.insertBefore(t,e.startContainer):(e.deleteContents(),e.insertNode(t)):this.area.appendChild(t)}else this.area.appendChild(t);e&&(t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.lastChild&&this.setCursorAfter(t.lastChild):this.setCursorAfter(t)),s&&this.j.events&&this.j.e.fire("synchro"),this.j.events&&this.j.e.fire("afterInsertNode",t)}insertHTML(t){if(""===t)return;const e=this.j.createInside.div(),s=this.j.createInside.fragment();let n;if(!this.isFocused()&&this.j.isEditorMode()&&(this.focus(),this.restore()),ct.isNode(t)?e.appendChild(t):e.innerHTML=""+t,(this.j.isEditorMode()||!1!==this.j.e.fire("insertHTML",e.innerHTML))&&(n=e.lastChild,n)){for(;e.firstChild;)n=e.firstChild,s.appendChild(e.firstChild);this.insertNode(s,!1,!1),n?this.setCursorAfter(n):this.setCursorIn(s),this.j.e&&this.j.e.fire("synchro")}}insertImage(t,e=null,s=null){const n=r(t)?this.j.createInside.element("img"):t;if(r(t)&&n.setAttribute("src",t),null!=s){let t=""+s;t&&"auto"!==t&&0>(t+"").indexOf("px")&&0>(t+"").indexOf("%")&&(t+="px"),he(this.j.o.resizer.forImageChangeAttributes?ue:jt,n,"width",t)}e&&"object"==typeof e&&jt(n,e);const i=()=>{(n.offsetHeight>n.naturalHeight||n.offsetWidth>n.naturalWidth)&&(n.style.width="",n.style.height=""),n.removeEventListener("load",i)};this.j.e.on(n,"load",i),n.complete&&i(),this.insertNode(n),this.j.e.fire("afterInsertImage",n)}eachSelection(t){var e;const s=this.sel;if(s&&s.rangeCount){const n=s.getRangeAt(0);let i=n.commonAncestorContainer;ct.isHTMLElement(i)||(i=i.parentElement);const o=[],r=n.startOffset,a=i.childNodes.length,l=a>r?r:a-1;let c=n.startContainer===this.area?i.childNodes[l]:n.startContainer,h=n.endContainer===this.area?i.childNodes[n.endOffset-1]:n.endContainer;ct.isText(c)&&c===n.startContainer&&n.startOffset===(null===(e=c.nodeValue)||void 0===e?void 0:e.length)&&c.nextSibling&&(c=c.nextSibling),ct.isText(h)&&h===n.endContainer&&0===n.endOffset&&h.previousSibling&&(h=h.previousSibling);const d=t=>{!t||t===i||ct.isEmptyTextNode(t)||G.isMarker(t)||o.push(t)};d(c),c!==h&&ct.find(c,(t=>(d(t),t===h||t&&t.contains&&t.contains(h))),i,!0,!1);const p=e=>{if(ct.isOrContains(this.j.editor,e,!0)){if(e.nodeName.match(/^(UL|OL)$/))return fe(e.childNodes).forEach(p);if(ct.isTag(e,"li"))if(e.firstChild)e=e.firstChild;else{const t=this.j.createInside.text(u);e.appendChild(t),e=t}t(e)}};0===o.length&&ct.isEmptyTextNode(c)&&o.push(c),0===o.length&&c.firstChild&&o.push(c.firstChild),o.forEach(p)}}cursorInTheEdge(t,e){var s,n;const i=!t,o=null===(s=this.sel)||void 0===s?void 0:s.getRangeAt(0),r=this.current(!1);if(!o||!r||!ct.isOrContains(e,r,!0))return null;const a=t?o.startContainer:o.endContainer,l=t?o.startOffset:o.endOffset,c=t=>t&&!ct.isTag(t,"br")&&!ct.isEmptyTextNode(t);if(ct.isText(a)){const e=(null===(n=a.nodeValue)||void 0===n?void 0:n.length)?a.nodeValue:"";if(i&&e.replace(/[\uFEFF]+$/g,"").length>l)return!1;const s=/^[\uFEFF]+/g.exec(e);if(t&&(s&&l>s[0].length||!s&&l>0))return!1}else{const t=fe(a.childNodes);if(i){if(t.slice(l).some(c))return!1}else if(t.slice(0,l).some(c))return!1}return!he(t?ct.prev:ct.next,r,c,e)}cursorOnTheLeft(t){return this.cursorInTheEdge(!0,t)}cursorOnTheRight(t){return this.cursorInTheEdge(!1,t)}setCursorAfter(t){return this.setCursorNearWith(t,!1)}setCursorBefore(t){return this.setCursorNearWith(t,!0)}setCursorNearWith(t,e){var s,n;if(this.errorNode(t),!ct.up(t,(t=>t===this.area||t&&t.parentNode===this.area),this.area))throw C("Node element must be in editor");const i=this.createRange();let o=null;return ct.isText(t)?e?i.setStart(t,0):i.setEnd(t,null!==(n=null===(s=t.nodeValue)||void 0===s?void 0:s.length)&&void 0!==n?n:0):(o=this.j.createInside.text(u),e?i.setStartBefore(t):i.setEndAfter(t),i.collapse(e),i.insertNode(o),i.selectNode(o)),i.collapse(e),this.selectRange(i),o}setCursorIn(t,e=!1){if(this.errorNode(t),!ct.up(t,(t=>t===this.area||t&&t.parentNode===this.area),this.area))throw C("Node element must be in editor");const s=this.createRange();let n=t,i=t;do{if(ct.isText(n))break;i=n,n=e?n.firstChild:n.lastChild}while(n);if(!n){const t=this.j.createInside.text(u);/^(img|br|input)$/i.test(i.nodeName)?n=i:(i.appendChild(t),i=t)}return s.selectNodeContents(n||i),s.collapse(e),this.selectRange(s),i}selectRange(t,e=!0){const s=this.sel;e&&!this.isFocused()&&this.focus(),s&&(s.removeAllRanges(),s.addRange(t)),this.j.e.fire("changeSelection")}select(t,e=!1){if(this.errorNode(t),!ct.up(t,(t=>t===this.area||t&&t.parentNode===this.area),this.area))throw C("Node element must be in editor");const s=this.createRange();s[e?"selectNodeContents":"selectNode"](t),this.selectRange(s)}get html(){const t=this.sel;if(t&&t.rangeCount>0){const e=t.getRangeAt(0).cloneContents(),s=this.j.createInside.div();return s.appendChild(e),s.innerHTML}return""}*wrapInTagGen(){if(this.isCollapsed()){const t=this.jodit.createInside.element("font",u);this.insertNode(t,!1,!1);const[e]=this.markers;return e?t.appendChild(e):(this.setCursorIn(t),this.save()),yield t,void ct.unwrap(t)}if(ee("*[style*=font-size]",this.area).forEach((t=>ue(t,"data-font-size",""+t.style.fontSize))),this.isCollapsed()){const t=this.j.createInside.element("font");ue(t,"size",7),this.insertNode(t,!1,!1)}else this.j.nativeExecCommand("fontsize",!1,"7");ee("*[data-font-size]",this.area).forEach((t=>{const e=ue(t,"data-font-size");e&&(t.style.fontSize=e,ue(t,"data-font-size",null))}));const t=ee('font[size="7"]',this.area);for(const e of t){const{firstChild:t,lastChild:s}=e;t&&t===s&&G.isMarker(t)||(t&&G.isMarker(t)&&ct.before(e,t),s&&G.isMarker(s)&&ct.after(e,s),yield e),ct.unwrap(e)}}wrapInTag(t){const e=[];for(const s of this.wrapInTagGen())try{if(s.firstChild&&s.firstChild===s.lastChild&&G.isMarker(s.firstChild))continue;i(t)?t(s):e.push(ct.replace(s,t,this.j.createInside))}finally{const t=s.parentNode;t&&(ct.unwrap(s),ct.isEmpty(t)&&ct.unwrap(t))}return e}applyStyle(t,e={}){new lt({style:t,element:e.element,className:e.className,defaultTag:e.defaultTag}).apply(this.j)}splitSelection(t){if(!this.isCollapsed())return null;const e=this.createRange(),s=this.range;e.setStartBefore(t);const n=this.cursorOnTheRight(t),i=this.cursorOnTheLeft(t),o=this.j.createInside.element("br"),r=this.j.createInside.text(u),a=r.cloneNode();try{if(n||i){s.insertNode(o);const t=(t,e)=>{let s=e(t);for(;s;){const t=e(s);if(!s||!ct.isTag(s,"br")&&!ct.isEmptyTextNode(s))break;ct.safeRemove(s),s=t}};t(o,(t=>t.nextSibling)),t(o,(t=>t.previousSibling)),ct.after(o,a),ct.before(o,r),n?(e.setEndBefore(o),s.setEndBefore(o)):(e.setEndAfter(o),s.setEndAfter(o))}else e.setEnd(s.startContainer,s.startOffset);const l=e.extractContents();if(t.parentNode)try{if(t.parentNode.insertBefore(l,t),n&&(null==o?void 0:o.parentNode)){const t=this.createRange();t.setStartBefore(o),this.selectRange(t)}}catch(t){}const c=t=>{var e,s,n;(null===(e=null==t?void 0:t.parentNode)||void 0===e?void 0:e.firstChild)===(null===(s=null==t?void 0:t.parentNode)||void 0===s?void 0:s.lastChild)&&(null===(n=null==t?void 0:t.parentNode)||void 0===n||n.appendChild(o.cloneNode()))};c(r),c(a)}finally{ct.safeRemove(r),ct.safeRemove(a)}return t.previousElementSibling}}function Z(t,e,s){const n=s.s.createRange(),i=G.isMarker(e.previousSibling)?e.previousSibling:e;n.setStartBefore(t),n.setEndBefore(i),X(t,n,!0);const o=G.isMarker(e.nextSibling)?e.nextSibling:e;n.setStartAfter(o),n.setEndAfter(t),X(t,n,!1)}function X(t,e,s){const n=e.extractContents();n.textContent&&A(n.textContent).length||!n.firstChild||ct.unwrap(n.firstChild),t.parentNode&&he(s?ct.before:ct.after,t,n)}n([O],G.prototype,"createRange",null),n([O],G.prototype,"focus",null),n([O],G.prototype,"setCursorAfter",null),n([O],G.prototype,"setCursorBefore",null),n([O],G.prototype,"setCursorIn",null);class J{constructor(t,e){this.state=t,this.transitions=e,this.subState="",this.silent=!0}setState(t,e){this.state=t,null!=e&&(this.subState=e)}getState(){return this.state}getSubState(){return this.subState}disableSilent(){this.silent=!1}dispatch(t,...e){const s=this.transitions[this.state][t];if(s)return s.call(this,...e);if(!this.silent)throw Error("invalid action: "+this.state+"."+t)}}function Y(t){return!(!t||ct.isEmptyTextNode(t)||ct.isTemporary(t))}function K(t,e,s){if(!e)return!1;const{element:n,elementIsDefault:i,options:o}=t,r=!(!o.style||!((t,e)=>!(ct.isTag(t,"font")||!ct.isHTMLElement(t)||!Object.keys(e).every((s=>{const n=jt(t,s,!0);return!a(n)&&""!==n&&!a(e[s])&&(""+St(s,e[s])).toLowerCase()===(""+n).toLowerCase()}))))(e,o.style)),l=e.nodeName.toLowerCase()===n||ct.isTag(e,["ul","ol"])&&t.elementIsList;return!!((!i||!s)&&l||r&&Y(e))||!(l||s||!i||!ct.isInlineBlock(e))}function Q(t,e){const{element:s,options:n}=t;if(!e||!Y(e))return!1;const i=e.nodeName.toLowerCase()===s,o=!(!n.style||!((t,e)=>!(ct.isTag(t,"font")||!ct.isHTMLElement(t)||!Object.keys(e).every((e=>!a(jt(t,e,!0))))))(e,n.style));return i&&o}function tt(t,e,s){const{parentNode:n}=e;return n===s||!ct.isHTMLElement(n)||ct.next(e,Y,n)||ct.prev(e,Y,n)?null:t.isElementCommit&&t.elementIsBlock&&!ct.isBlock(n)?tt(t,n,s):!K(t,n,!1)||ct.isBlock(n)&&!t.elementIsBlock?null:n}function et(t,e){const{s,editor:n}=t,i=new J("start",{start:{start(){s.save(),Nt(n.firstChild),this.setState("generator")}},generator:{initGenerator(){return t.s.wrapInTagGen()},nextFont(t){const e=t.next();if(e.done)this.setState("end");else if(!((t,e)=>!!ct.closest(t,["style","script"],e))(e.value,n)&&!ct.isEmptyContent(e.value))return this.setState("check"),e.value}},check:{work(s){let n=tt(e,s,t.editor)||((t,e)=>{let{firstChild:s}=e;for(;s&&!Y(s);)if(s=s.nextSibling,!s)return null;return s&&!ct.next(s,Y,e)&&K(t,s,!1)?s:null})(e,s);return n?(this.setState("wholeElement"),n):(n=ct.closest(s,(t=>K(e,t,!0)),t.editor),n&&(e.elementIsBlock||Z(n,s,t)),e.elementIsList&&ct.isTag(n,["ul","ol"])?(this.setState("orderList"),s):n?(this.setState("wholeElement"),n):((t,e)=>{const s=[],n=[];let i;const o=t.options.style;if(e.firstChild){const r=ct.eachGen(e);let a=r.next();for(;!a.done;){const e=a.value;K(t,e,!0)?(void 0===i&&(i=!0),s.push(e)):o&&Q(t,e)?(void 0===i&&(i=!1),n.push((()=>{jt(e,Object.keys(o).reduce(((t,e)=>(t[e]=null,t)),{})),ue(e,"style")||ue(e,"style",null),e.nodeName.toLowerCase()===t.element&&s.push(e)}))):ct.isEmptyTextNode(e)||void 0===i&&(i=!1),a=r.next()}}return n.forEach((t=>t())),s.forEach(ct.unwrap),!!i})(e,s)?(this.setState("endProcess"),null):(this.setState("wrap"),s))}},wholeElement:{toggleStyles(s){let n=rt;var i,o;o=s,n=((i=e).elementIsBlock||ct.isTag(o,i.element)&&!i.elementIsDefault)&&(ct.unwrap(o),1)?nt:q(e,s,t,n),this.setState("generator",n)}},orderList:{toggleStyles(s){let n=rt;const i=ct.closest(s,"li",t.editor);i&&ct.closest(s,["ul","ol"],t.editor)?(n=((t,e,s,n)=>{if(!e)return n;const i=e.parentElement;return i?i.tagName.toLowerCase()!==t.element?(q(t,ct.replace(i,t.element,s.createInside),s,n),at):q(t,e.parentElement,s,rt,!0)===it?q(t,e.parentElement,s,n):(Z(i,e,s),ct.unwrap(e.parentElement),ct.replace(e,s.o.enter,s.createInside),n):n})(e,i,t,n),this.setState(n!==at&&n!==nt&&n!==it?"generator":"endWhile")):this.setState("generator")}},wrap:{toggleStyles(s){if("unwrap"!==this.getSubState()){const n=((t,e,s)=>{const n=((t,e,s)=>{if(t.elementIsBlock){const t=ct.up(e,(t=>ct.isBlock(t)&&!ct.isTag(t,["td","th","tr","tbody","table","li","ul","ol"])),s.editor);if(t)return t}return t.elementIsBlock?((t,e,s,n)=>{const i=s.editor,o=s.createInside,r=(t,e="previousSibling")=>{let n=t,o=t;for(;o&&!ct.isTag(o,s.o.enter)&&(n=o,o=o[e]?o[e]:o.parentNode&&!ct.isBlock(o.parentNode)&&o.parentNode!==i?o.parentNode:null,!ct.isBlock(o)););return n},a=r(e),l=r(e,"nextSibling"),c=n();c.setStartBefore(a),c.setEndAfter(l);const h=c.extractContents(),u=o.element(t.element);return u.appendChild(h),c.insertNode(u),t.elementIsBlock&&ct.isEmpty(u)&&!ct.isTag(u.firstElementChild,"br")&&u.appendChild(o.element("br")),u})(t,e,s,s.s.createRange):(ue(e,"size",null),e)})(t,e,s);return t.elementIsList?((t,e,s)=>{const n=ct.replace(e,"li",s.createInside);let i=n.previousElementSibling||n.nextElementSibling;return ct.isTag(i,["ul","ol"])||(i=s.createInside.element(t.element),ct.before(n,i)),n.previousElementSibling===i?ct.append(i,n):ct.prepend(i,n),i})(t,n,s):ct.replace(n,t.element,s.createInside,!0)})(e,s,t);q(e,n,t,st)}this.setState("generator")}},endWhile:{nextFont(t){t.next().done&&this.setState("end")}},endProcess:{toggleStyles(){this.setState("generator")}},end:{finalize(){s.restore()}}});i.dispatch("start");const o=i.dispatch("initGenerator");for(;"end"!==i.getState();){const t=i.dispatch("nextFont",o);if(t){const e=i.dispatch("work",t);i.dispatch("toggleStyles",e)}}i.dispatch("finalize",o)}const st="wrap",nt="unwrap",it="change",ot="unset",rt="initial",at="replace";class lt{constructor(t){this.options=t}get elementIsList(){return!(!this.options.element||!["ul","ol"].includes(this.options.element))}get element(){return this.options.element||this.defaultTag}get elementIsBlock(){return!(!this.options.element||!d.test(this.options.element))}get isElementCommit(){return!(!this.options.element||this.options.element===this.options.defaultTag)}get defaultTag(){return this.options.defaultTag?this.options.defaultTag:this.elementIsBlock?"p":"span"}get elementIsDefault(){return this.element===this.defaultTag}apply(t){et(t,this)}}class ct{static detach(t){for(;t.firstChild;)t.removeChild(t.firstChild)}static wrapInline(t,e,s){let n,i=t,o=t;s.s.save();let a=!1;do{a=!1,n=i.previousSibling,n&&!ct.isBlock(n)&&(a=!0,i=n)}while(a);do{a=!1,n=o.nextSibling,n&&!ct.isBlock(n)&&(a=!0,o=n)}while(a);const l=r(e)?s.createInside.element(e):e;i.parentNode&&i.parentNode.insertBefore(l,i);let c=i;for(;c&&(c=i.nextSibling,l.appendChild(i),i!==o&&c);)i=c;return s.s.restore(),l}static wrap(t,e,s){const n=r(e)?s.element(e):e;if(!t.parentNode)throw C("Element should be in DOM");return t.parentNode.insertBefore(n,t),n.appendChild(t),n}static unwrap(t){const e=t.parentNode;if(e){for(;t.firstChild;)e.insertBefore(t.firstChild,t);ct.safeRemove(t)}}static between(t,e,s){let n=t;for(;n&&n!==e&&(t===n||!s(n));){let t=n.firstChild||n.nextSibling;if(!t){for(;n&&!n.nextSibling;)n=n.parentNode;t=null==n?void 0:n.nextSibling}n=t}}static replace(t,e,s,n=!1,i=!1){var o;r(o=e)&&/<([A-Za-z][A-Za-z0-9]*)\b[^>]*>(.*?)<\/\1>/m.test(o.replace(/[\r\n]/g,""))&&(e=s.fromHTML(e));const a=r(e)?s.element(e):e;if(!i)for(;t.firstChild;)a.appendChild(t.firstChild);return n&&fe(t.attributes).forEach((t=>{a.setAttribute(t.name,t.value)})),t.parentNode&&t.parentNode.replaceChild(a,t),a}static isEmptyTextNode(t){return ct.isText(t)&&(!t.nodeValue||0===t.nodeValue.replace(/[\uFEFF]/g,"").trim().length)}static isEmptyContent(t){return ct.each(t,(t=>ct.isEmptyTextNode(t)))}static isContentEditable(t,e){return ct.isNode(t)&&!ct.closest(t,(t=>ct.isElement(t)&&"false"===t.getAttribute("contenteditable")),e)}static isEmpty(t,e=/^(img|svg|canvas|input|textarea|form)$/){return!t||(ct.isText(t)?null==t.nodeValue||0===A(t.nodeValue).length:!e.test(t.nodeName.toLowerCase())&&ct.each(t,(t=>{if(ct.isText(t)&&null!=t.nodeValue&&0!==A(t.nodeValue).length||ct.isElement(t)&&e.test(t.nodeName.toLowerCase()))return!1})))}static isNode(t){if(!t)return!1;const e=l("ownerDocument.defaultView",t);return!("object"!=typeof e||!e||"function"!=typeof e.Node&&"object"!=typeof e.Node)&&t instanceof e.Node}static isCell(t){return ct.isNode(t)&&/^(td|th)$/i.test(t.nodeName)}static isImage(t){return ct.isNode(t)&&/^(img|svg|picture|canvas)$/i.test(t.nodeName)}static isBlock(t){return!a(t)&&"object"==typeof t&&ct.isNode(t)&&d.test(t.nodeName)}static isText(t){return!(!t||t.nodeType!==Node.TEXT_NODE)}static isElement(t){var e;return!!ct.isNode(t)&&!(!(null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView)||t.nodeType!==Node.ELEMENT_NODE)}static isHTMLElement(t){var e;if(!ct.isNode(t))return!1;const s=null===(e=t.ownerDocument)||void 0===e?void 0:e.defaultView;return!!(s&&t instanceof s.HTMLElement)}static isInlineBlock(t){return ct.isElement(t)&&!/^(BR|HR)$/i.test(t.tagName)&&-1!==["inline","inline-block"].indexOf(""+jt(t,"display"))}static canSplitBlock(t){return!a(t)&&ct.isHTMLElement(t)&&ct.isBlock(t)&&!/^(TD|TH|CAPTION|FORM)$/.test(t.nodeName)&&void 0!==t.style&&!/^(fixed|absolute)/i.test(t.style.position)}static last(t,e){let s=null==t?void 0:t.lastChild;if(!s)return null;do{if(e(s))return s;let n=s.lastChild;if(n||(n=s.previousSibling),!n&&s.parentNode!==t){do{s=s.parentNode}while(s&&!(null==s?void 0:s.previousSibling)&&s.parentNode!==t);n=null==s?void 0:s.previousSibling}s=n}while(s);return null}static prev(t,e,s,n=!0){return ct.find(t,e,s,!1,n)}static next(t,e,s,n=!0){return ct.find(t,e,s,!0,n)}static prevWithClass(t,e){return ct.prev(t,(t=>ct.isElement(t)&&t.classList.contains(e)),t.parentNode)}static nextWithClass(t,e){return ct.next(t,(t=>ct.isElement(t)&&t.classList.contains(e)),t.parentNode)}static find(t,e,s,n=!0,i=!0){const o=this.nextGen(t,s,n,i);let r=o.next();for(;!r.done;){if(e(r.value))return r.value;r=o.next()}return null}static*nextGen(t,e,s=!0,n=!0){const i=[];let o=t;do{let e=s?o.nextSibling:o.previousSibling;for(;e;)i.unshift(e),e=s?e.nextSibling:e.previousSibling;yield*this.runInStack(t,i,s,n),o=o.parentNode}while(o!==e);return null}static each(t,e,s=!0){const n=this.eachGen(t,s);let i=n.next();for(;!i.done;){if(!1===e(i.value))return!1;i=n.next()}return!0}static eachGen(t,e=!0){return this.runInStack(t,[t],e)}static*runInStack(t,e,s,n=!0){for(;e.length;){const i=e.pop();if(t!==i&&(yield i),n){let t=s?i.lastChild:i.firstChild;for(;t;)e.push(t),t=s?t.previousSibling:t.nextSibling}}}static findWithCurrent(t,e,s,n="nextSibling",i="firstChild"){let o=t;do{if(e(o))return o||null;if(i&&o&&o[i]){const t=ct.findWithCurrent(o[i],e,o,n,i);if(t)return t}for(;o&&!o[n]&&o!==s;)o=o.parentNode;o&&o[n]&&o!==s&&(o=o[n])}while(o&&o!==s);return null}static findSibling(t,e=!0,s=(t=>!ct.isEmptyTextNode(t))){const n=t=>e?t.previousSibling:t.nextSibling;let i=n(t);for(;i&&!s(i);)i=n(i);return i&&s(i)?i:null}static up(t,e,s,n=!1){let i=t;if(!i)return null;do{if(e(i))return i;if(i===s||!i.parentNode)break;i=i.parentNode}while(i&&i!==s);return i===s&&n&&e(i)?i:null}static closest(t,e,s){let n;return n=i(e)?e:h(e)?t=>t&&e.includes(t.nodeName.toLowerCase()):t=>t&&e===t.nodeName.toLowerCase(),ct.up(t,n,s)}static furthest(t,e,s){let n=null,i=null==t?void 0:t.parentElement;for(;i&&i!==s&&e(i);)n=i,i=null==i?void 0:i.parentElement;return n}static appendChildFirst(t,e){const s=t.firstChild;s?s!==e&&t.insertBefore(e,s):t.appendChild(e)}static after(t,e){const{parentNode:s}=t;s&&(s.lastChild===t?s.appendChild(e):s.insertBefore(e,t.nextSibling))}static before(t,e){const{parentNode:s}=t;s&&s.insertBefore(e,t)}static prepend(t,e){t.insertBefore(e,t.firstChild)}static append(t,e){h(e)?e.forEach((e=>{this.append(t,e)})):t.appendChild(e)}static moveContent(t,e,s=!1){const n=(t.ownerDocument||document).createDocumentFragment();fe(t.childNodes).forEach((t=>{n.appendChild(t)})),s&&e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}static all(t,e,s=!1){let n=t.childNodes?fe(t.childNodes):[];return e(t)?t:(s&&(n=n.reverse()),n.forEach((t=>{ct.all(t,e,s)})),null)}static isOrContains(t,e,s=!1){return t===e?!s:!!(e&&t&&this.up(e,(e=>e===t),t,!0))}static safeRemove(t){t&&t.parentNode&&t.parentNode.removeChild(t)}static hide(t){t&&(ce(t,"__old_display",t.style.display),t.style.display="none")}static show(t){if(!t)return;const e=ce(t,"__old_display");"none"===t.style.display&&(t.style.display=e||"")}static isTag(t,e){const s=xt(e).map(String);for(let e=0;s.length>e;e+=1)if(this.isElement(t)&&t.tagName.toLowerCase()===s[e].toLowerCase())return!0;return!1}static markTemporary(t,e){return e&&ue(t,e),ue(t,m,!0),t}static isTemporary(t){return!!ct.isElement(t)&&(G.isMarker(t)||"true"===ue(t,m))}static replaceTemporaryFromString(t){return t.replace(/<([a-z]+)[^>]+data-jodit-temp[^>]+>(.+?)<\/\1>/gi,"$2")}static temporaryList(t){return ee(`[${m}]`,t)}}function ht(t){return!!(t&&t instanceof Object&&i(t.constructor)&&("undefined"!=typeof Jodit&&t instanceof Jodit||t.isJodit))}function ut(t){return!!(t&&t instanceof Object&&i(t.constructor)&&(t instanceof H.View||t.isView))}function dt(t){return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function pt(t){if(r(t)){if(!t.match(/^([+-])?[0-9]+(\.?)([0-9]+)?(e[0-9]+)?$/))return!1;t=parseFloat(t)}return"number"==typeof t&&!isNaN(t)&&isFinite(t)}function ft(t){return!(!t||"object"!=typeof t||t.nodeType||(t=>null!=t&&t===t.window)(t)||t.constructor&&!{}.hasOwnProperty.call(t.constructor.prototype,"isPrototypeOf"))}const mt=t=>("file:"===window.location.protocol&&/^\/\//.test(t)&&(t="https:"+t),t),gt=new Map,vt=t=>async(e,s)=>{if(gt.has(s))return gt.get(s);const n=t(e,s);return gt.set(s,n),n},bt=vt(((t,e)=>new Promise(((s,n)=>{const{element:o}=((t,e,s)=>{const n=t.c.element("script");return n.type="text/javascript",n.async=!0,i(s)&&!t.isInDestruct&&t.e.on(n,"load",s),n.src||(n.src=mt(e)),t.od.body.appendChild(n),{callback:s,element:n}})(t,e,s);!t.isInDestruct&&t.e.on(o,"error",n)})))),Ct=vt(((t,e)=>new Promise(((s,n)=>{const i=t.c.element("link");i.rel="stylesheet",i.media="all",i.crossOrigin="anonymous",!t.isInDestruct&&t.e.on(i,"load",(()=>s(i))).on(i,"error",n),i.href=mt(e),t.o.shadowRoot?t.o.shadowRoot.appendChild(i):t.od.body.appendChild(i)}))));function yt(t){return t&&t.isAtom}function Et(t,e,s=0){if(Object.getPrototypeOf(t)!==Object.prototype)return t;const n=B.defaultOptions;if(r(t.preset)){if(void 0!==n.presets[t.preset]){const e=n.presets[t.preset];Object.keys(e).forEach((s=>{a(t[s])&&(t[s]=e[s])}))}delete t.preset}const i={};return Object.keys(t).forEach((n=>{const o=t[n],r=e?e[n]:null;i[n]=ft(o)&&ft(r)&&!yt(o)?Et(o,r,s+1):0!==s&&h(o)&&!yt(o)&&h(r)?[...o,...r.slice(o.length)]:o})),Object.setPrototypeOf(i,e),i}function wt(t){return pe(t,!1).reduce(((e,s)=>(e[s]=t[s],e)),{})}const Nt=t=>{if(t){if(ct.isText(t)&&null!=t.nodeValue&&t.parentNode)for(;ct.isText(t.nextSibling);)null!=t.nextSibling.nodeValue&&(t.nodeValue+=t.nextSibling.nodeValue),t.nodeValue=t.nodeValue.replace(/[\uFEFF]/g,""),ct.safeRemove(t.nextSibling);else Nt(t.firstChild);Nt(t.nextSibling)}};function St(t,e){if("font-weight"===P(t)){switch((""+e).toLowerCase()){case"700":case"bold":return 700;case"400":case"normal":return 400;case"900":case"heavy":return 900}return pt(e)?Number(e):e}return/color/i.test(t)&&/^rgb/i.test(""+e)&&(t=>{if("rgba(0, 0, 0, 0)"===t||""===t)return!1;if(!t)return"#000000";if("#"===t.substr(0,1))return t;const e=/([\s\n\t\r]*?)rgb\((\d+), (\d+), (\d+)\)/.exec(t)||/([\s\n\t\r]*?)rgba\((\d+), (\d+), (\d+), ([\d.]+)\)/.exec(t);if(!e)return"#000000";const s=parseInt(e[2],10),n=parseInt(e[3],10);let i=(parseInt(e[4],10)|n<<8|s<<16).toString(16).toUpperCase();for(;6>i.length;)i="0"+i;return e[1]+"#"+i})(""+e)||e}function jt(t,e,s,n=!1){const i=/^(left|top|bottom|right|width|min|max|height|margin|padding|fontsize|font-size)/i;if("boolean"==typeof s&&(n=s,s=void 0),ft(e)||void 0!==s){const n=(t,e,s)=>{!a(s)&&i.test(e)&&pt(""+s)&&(s=parseInt(""+s,10)+"px"),void 0===s||null!=s&&jt(t,e,!0)===St(e,s)||(t.style[e]=s)};if(ft(e)){const s=Object.keys(e);for(let i=0;s.length>i;i+=1)n(t,D(s[i]),e[s[i]])}else n(t,D(e),s);return""}const o=P(e),r=t.ownerDocument||document,l=!!r&&(r.defaultView||r.parentWindow),c=t.style[e];let h="";return void 0!==c&&""!==c?h=c:l&&!n&&(h=l.getComputedStyle(t).getPropertyValue(o)),i.test(e)&&/^[-+]?[0-9.]+px$/.test(""+h)&&(h=parseInt(""+h,10)),St(e,h)}const xt=t=>h(t)?t:[t];class It{static getElm(t){return this.container.querySelector("."+this.getFullElName(t))}static getElms(t){return fe(this.container.querySelectorAll("."+this.getFullElName(t)))}}class Tt{static setMod(t,e,s){if(t=t.toLowerCase(),this.mods[t]===e)return;const n=`${this.componentName}_${t}`,i=(s||this.container).classList;fe(i).forEach((t=>{0===t.indexOf(n)&&i.remove(t)})),!a(e)&&""!==e&&i.add(`${n}_${(""+e).toLowerCase()}`),this.mods[t]=e}static getMod(t){var e;return null!==(e=this.mods[t])&&void 0!==e?e:null}}class kt{static getIcon(t){return/<svg/i.test(t)?t:kt.icons[t]||kt.icons[t.replace(/-/g,"_")]||kt.icons[t.replace(/_/g,"-")]||kt.icons[t.toLowerCase()]}static exists(t){return void 0!==this.getIcon(t)}static get(t,e="<span></span>"){return this.getIcon(t)||e}static set(t,e){return this.icons[t.replace("_","-")]=e,this}static makeIcon(t,e){var s;let n;if(e){const i=e.name.replace(/[^a-zA-Z0-9]/g,"_");if(e.iconURL)n=t.c.span(),jt(n,"backgroundImage","url("+e.iconURL.replace("{basePath}",(null==t?void 0:t.basePath)||"")+")");else{const o=t.e.fire("getIcon",e.name,e,i)||kt.get(e.name,"")||(null===(s=t.o.extraIcons)||void 0===s?void 0:s[e.name]);o&&(n=t.c.fromHTML(o.trim()),/^<svg/i.test(e.name)||n.classList.add("jodit-icon_"+i))}}return n&&(n.classList.add("jodit-icon"),n.style.fill=e.fill),n}}kt.icons={};class Ot extends ae{constructor(t,e){super(t),this.name="",this.__parentElement=null,this.mods={},this.container=this.createContainer(e),Object.defineProperty(this.container,"component",{value:this,configurable:!0})}get parentElement(){return this.__parentElement}set parentElement(t){this.__parentElement=t,t&&t.hookStatus("beforeDestruct",(()=>this.destruct())),this.updateParentElement(this)}bubble(t){let e=this.parentElement;for(;e;)t(e),e=e.parentElement;return this}updateParentElement(t){var e;return null===(e=this.__parentElement)||void 0===e||e.updateParentElement(t),this}get(t,e){return super.get(t,e)||this.getElm(t)}closest(t){const e="object"==typeof t?e=>e===t:e=>e instanceof t;let s=this.__parentElement;for(;s;){if(e(s))return s;s=!s.parentElement&&s.container.parentElement?Ot.closestElement(s.container.parentElement,Ot):s.parentElement}return null}static closestElement(t,e){const s=ct.up(t,(t=>{if(t){const{component:s}=t;return s&&s instanceof e}return!1}));return s?null==s?void 0:s.component:null}setMod(t,e,s=this.container){return Tt.setMod.call(this,t,e,s),this}getMod(t){return Tt.getMod.call(this,t)}getElm(t){return It.getElm.call(this,t)}getElms(t){return It.getElms.call(this,t)}update(){}appendTo(t){return t.appendChild(this.container),this}clearName(t){return t.replace(/[^a-zA-Z0-9]/g,"_")}render(t){return this.j.c.div(this.componentName)}createContainer(t){const e=this.render(t);if(r(e)){const t=this.j.c.fromHTML(e.replace(/\*([^*]+?)\*/g,((t,e)=>kt.get(e)||"")).replace(/&__/g,this.componentName+"__").replace(/~([^~]+?)~/g,((t,e)=>this.i18n(e))));return t.classList.add(this.componentName),t}return e}destruct(){return ct.safeRemove(this.container),this.parentElement=null,super.destruct()}}let _t=class extends Ot{constructor(t,e){super(t),this.isButton=!0,this.state={size:"middle",type:"button",name:"",value:"",variant:"initial",disabled:!1,activated:!1,icon:{name:"empty",fill:"",iconURL:""},tooltip:"",text:"",tabIndex:void 0},this.actionHandlers=[],this.updateSize(),this.onChangeSize(),this.onChangeStatus(),e&&this.hookStatus(c.ready,(()=>{this.setState(e)}))}className(){return"UIButton"}setState(t){return Object.assign(this.state,t),this}onChangeSize(){this.setMod("size",this.state.size)}onChangeType(){ue(this.container,"type",this.state.type)}updateSize(){const t=this.closest(At);t&&(this.state.size=t.buttonSize)}onChangeStatus(){this.setMod("variant",this.state.variant)}onChangeText(){this.text.textContent=this.jodit.i18n(this.state.text)}onChangeTextSetMode(){this.setMod("text-icons",!!this.state.text.trim().length)}onChangeDisabled(){ue(this.container,"disabled",this.state.disabled||null)}onChangeActivated(){ue(this.container,"aria-pressed",this.state.activated)}onChangeName(){this.container.classList.add(`${this.componentName}_${this.clearName(this.state.name)}`),this.name=this.state.name,ue(this.container,"data-ref",this.state.name),ue(this.container,"ref",this.state.name)}onChangeTooltip(){this.get("j.o.useNativeTooltip")&&ue(this.container,"title",this.state.tooltip),ue(this.container,"aria-label",this.state.tooltip)}onChangeTabIndex(){ue(this.container,"tabindex",this.state.tabIndex)}onChangeIcon(){const t=this.get("j.o.textIcons");if(!0===t||i(t)&&t(this.state.name))return;ct.detach(this.icon);const e=kt.makeIcon(this.j,this.state.icon);e&&this.icon.appendChild(e)}focus(){this.container.focus()}isFocused(){const{activeElement:t}=this.od;return!(!t||!ct.isOrContains(this.container,t))}createContainer(){const t=this.componentName,e=this.j.c.element("button",{class:t,type:"button",role:"button",ariaPressed:!1});return this.icon=this.j.c.span(t+"__icon"),this.text=this.j.c.span(t+"__text"),e.appendChild(this.icon),e.appendChild(this.text),this.j.e.on(e,"click",this.onActionFire),e}destruct(){return this.j.e.off(this.container),super.destruct()}onAction(t){return this.actionHandlers.push(t),this}onActionFire(t){t.buffer={actionTrigger:this},this.actionHandlers.forEach((e=>e.call(this,t)))}};var Ft;n([x("state.size")],_t.prototype,"onChangeSize",null),n([x("state.type")],_t.prototype,"onChangeType",null),n([x("parentElement")],_t.prototype,"updateSize",null),n([x("state.variant")],_t.prototype,"onChangeStatus",null),n([x("state.text")],_t.prototype,"onChangeText",null),n([x("state.text")],_t.prototype,"onChangeTextSetMode",null),n([x("state.disabled")],_t.prototype,"onChangeDisabled",null),n([x("state.activated")],_t.prototype,"onChangeActivated",null),n([x("state.name")],_t.prototype,"onChangeName",null),n([x("state.tooltip")],_t.prototype,"onChangeTooltip",null),n([x("state.tabIndex")],_t.prototype,"onChangeTabIndex",null),n([x("state.icon")],_t.prototype,"onChangeIcon",null),n([O],_t.prototype,"onActionFire",null),_t=n([E],_t);let Rt=Ft=class extends Ot{constructor(t,e,s){super(t,s),this.options=s,this.syncMod=!1,this.elements=[],this.buttonSize="middle",null==e||e.forEach((t=>t&&this.append(t))),(null==s?void 0:s.name)&&(this.name=s.name)}className(){return"UIGroup"}get allChildren(){const t=[],e=[...this.elements];for(;e.length;){const s=e.shift();h(s)?e.push(...s):s instanceof Ft?e.push(...s.elements):s&&t.push(s)}return t}update(){this.elements.forEach((t=>t.update())),this.setMod("size",this.buttonSize)}append(t,e){return h(t)?(t.forEach((t=>this.append(t,e))),this):(this.elements.push(t),t.name&&t.container.classList.add(this.getFullElName(t.name)),e?this.getElm(e).appendChild(t.container):this.appendChildToContainer(t.container),t.parentElement=this,t.update(),this)}setMod(t,e){return this.syncMod&&this.elements.forEach((s=>s.setMod(t,e))),super.setMod(t,e)}appendChildToContainer(t){this.container.appendChild(t)}remove(t){const e=this.elements.indexOf(t);return-1!==e&&(this.elements.splice(e,1),ct.safeRemove(t.container),t.parentElement=null),this}clear(){return this.elements.forEach((t=>t.destruct())),this.elements.length=0,this}destruct(){return this.clear(),super.destruct()}};function Mt(t,e){let s;return e||(e=B.defaultOptions.controls),r(t)?s=((t,e)=>{let[s,n]=t.split(/\./),i=e;return null!=n?void 0!==e[s]&&(i=e[s]):n=s,i[n]?{name:n,...wt(i[n])}:void 0})(t,e)||{name:t,command:t,tooltip:t}:(s={name:"empty",...wt(t)},void 0!==e[s.name]&&(s={...wt(e[s.name]),...wt(s)})),s}function Lt(t,e){return(h(t)?t:pe(t,!1).map((e=>Et({name:e},t[e]||{})))).map((t=>Mt(t,e||B.defaultOptions.controls)))}n([x("buttonSize")],Rt.prototype,"update",null),Rt=Ft=n([E],Rt);let Dt=class extends Ot{className(){return"UISeparator"}};Dt=n([E],Dt);let Pt=class extends Ot{className(){return"UISpacer"}};Pt=n([E],Pt);let At=class extends Rt{constructor(t){super(t),this.mode="horizontal",this.removeButtons=[],this.onChangeMode()}className(){return"UIList"}onChangeMode(){this.setMod("mode",this.mode)}makeGroup(){return new Rt(this.jodit)}get buttons(){return this.allChildren.filter((t=>t instanceof _t))}getButtonsNames(){return this.buttons.map((t=>t instanceof _t&&t.state.name||"")).filter((t=>""!==t))}setRemoveButtons(t){return this.removeButtons=t||[],this}build(t,e=null){t=S(t),this.clear();let s,n=!1,i=this.makeGroup();this.append(i),i.setMod("line",!0);const o=t=>{let o=null;switch(t.name){case"\n":i=this.makeGroup(),i.setMod("line",!0),s=this.makeGroup(),i.append(s),this.append(i);break;case"|":n||(n=!0,o=new Dt(this.j));break;case"---":{s.setMod("before-spacer",!0);const t=new Pt(this.j);i.append(t),s=this.makeGroup(),i.append(s),n=!1;break}default:n=!1,o=this.makeButton(t,e)}o&&(s||(s=this.makeGroup(),i.append(s)),s.append(o))},r=t=>!this.removeButtons.includes(t.name);return t.forEach((t=>{if((t=>h(t.buttons))(t)){const e=t.buttons.filter((t=>t));e.length&&(s=this.makeGroup(),s.setMod("separated",!0).setMod("group",t.group),i.append(s),Lt(e,this.j.o.controls).filter(r).forEach(o))}else{s||(s=this.makeGroup(),i.append(s));const e=Mt(t,this.j.o.controls);r(e)&&o(e)}})),this.update(),this}makeButton(t,e){return new _t(this.j)}};n([x("mode")],At.prototype,"onChangeMode",null),At=n([E],At);let Bt=class extends Rt{constructor(t,e={radio:!0}){var s,n;super(t,null===(s=e.options)||void 0===s?void 0:s.map((e=>{const s=new _t(t,{text:e.text,value:e.value,variant:"primary"});return s.onAction((()=>{this.select(e.value)})),s})),e),this.options=e,this.select(null!==(n=e.value)&&void 0!==n?n:0)}className(){return"UIButtonGroup"}render(t){return`<div>\n\t\t\t<div class="&__label">~${t.label}~</div>\n\t\t\t<div class="&__options"></div>\n\t\t</div>`}appendChildToContainer(t){this.getElm("options").appendChild(t)}select(t){var e,s;this.elements.forEach(((e,s)=>{s===t||e.state.value===t?e.state.activated=!0:this.options.radio&&(e.state.activated=!1)}));const n=this.elements.filter((t=>t.state.activated)).map((t=>({text:t.state.text,value:t.state.value})));this.jodit.e.fire(this,"select",n),null===(s=(e=this.options).onChange)||void 0===s||s.call(e,n)}};Bt=n([E],Bt);class zt extends Ot{constructor(t,e=!0){super(t),this.smart=e,this.isOpened=!1,this.strategy="leftBottom",this.viewBound=()=>({left:0,top:0,width:this.ow.innerWidth,height:this.ow.innerHeight}),this.childrenPopups=new Set,ue(this.container,"role","popup")}className(){return"Popup"}updateParentElement(t){return t!==this&&t instanceof zt&&(this.childrenPopups.forEach((e=>{!t.closest(e)&&e.isOpened&&e.close()})),this.childrenPopups.has(t)||this.j.e.on(t,"beforeClose",(()=>{this.childrenPopups.delete(t)})),this.childrenPopups.add(t)),super.updateParentElement(t)}setContent(t){ct.detach(this.container);const e=this.j.c.div(this.componentName+"__content");let s;return t instanceof Ot?(s=t.container,t.parentElement=this):s=r(t)?this.j.c.fromHTML(t):t,e.appendChild(s),this.container.appendChild(e),this.updatePosition(),this}open(t,e=!1){var s,n;ue(n=this.container,"data-editor_id",(s=this.jodit).id),!n.component&&Object.defineProperty(n,"jodit",{value:s}),this.calculateZIndex(),this.isOpened=!0,this.addGlobalListeners(),this.targetBound=e?this.getKeepBound(t):t;const i=U(this.jodit,zt);return i!==this.container.parentElement&&i.appendChild(this.container),this.updatePosition(),this.j.e.fire(this,"afterOpen"),this}calculateZIndex(){if(this.container.style.zIndex)return;const t=t=>{const e=t.container.style.zIndex||t.o.zIndex;return!!e&&(this.setZIndex(1+parseInt(""+e,10)),!0)};if(t(this.j))return;let e=this.parentElement;for(;e;){if(t(e.j))return;if(e.container.style.zIndex)return void this.setZIndex(1+parseInt(""+e.container.style.zIndex,10));if(!e.parentElement&&e.container.parentElement){const t=Ot.closestElement(e.container.parentElement,Ot);if(t){e=t;continue}}e=e.parentElement}}getKeepBound(t){const e=t(),s=this.od.elementFromPoint(e.left,e.top);if(!s)return t;const n=ct.isHTMLElement(s)?s:s.parentElement,i=ie(n,this.j);return()=>{const e=t(),s=ie(n,this.j);return{...e,top:e.top+(s.top-i.top),left:e.left+(s.left-i.left)}}}updatePosition(){if(!this.isOpened)return this;const[t,e]=this.calculatePosition(this.targetBound(),this.viewBound(),ie(this.container,this.j));return this.setMod("strategy",e),jt(this.container,{left:t.left,top:t.top}),this.childrenPopups.forEach((t=>t.updatePosition())),this}throttleUpdatePosition(){this.updatePosition()}calculatePosition(t,e,s,n=this.strategy){const i={left:t.left,right:t.left-(s.width-t.width)},o={bottom:t.top+t.height,top:t.top-s.height},r=Object.keys(i).reduce(((t,e)=>t.concat(Object.keys(o).map((t=>{return`${e}${s=t,s.length?s[0].toUpperCase()+s.substr(1):""}`;var s})))),[]),a=t=>{const[e,n]=P(t).split("-");return{left:i[e],top:o[n],width:s.width,height:s.height}},l=t=>{let e=null;return e=zt.boxInView(a(n),t)?n:r.find((e=>{if(zt.boxInView(a(e),t))return e}))||null,e};let c=l(ie(this.j.container,this.j));return c&&zt.boxInView(a(c),e)||(c=l(e)||c||n),[a(c),c]}static boxInView(t,e){return!(-2>t.top-e.top||-2>t.left-e.left||-2>e.top+e.height-(t.top+t.height)||-2>e.left+e.width-(t.left+t.width))}close(){return this.isOpened?(this.isOpened=!1,this.childrenPopups.forEach((t=>t.close())),this.j.e.fire(this,"beforeClose"),this.j.e.fire("beforePopupClose",this),this.removeGlobalListeners(),ct.safeRemove(this.container),this):this}closeOnOutsideClick(t){if(!this.isOpened)return;const e=i(t.composedPath)&&t.composedPath()[0]||t.target;if(!e)return void this.close();const s=Ot.closestElement(e,zt);s&&(this===s||s.closest(this))||this.close()}addGlobalListeners(){const t=this.throttleUpdatePosition,e=this.ow;W.on("closeAllPopups",this.close),this.smart&&this.j.e.on("escape",this.close).on("mousedown touchstart",this.closeOnOutsideClick).on(e,"mousedown touchstart",this.closeOnOutsideClick),this.j.e.on("closeAllPopups",this.close).on("resize",t).on(this.container,"scroll mousewheel",t).on(e,"scroll",t).on(e,"resize",t),ct.up(this.j.container,(e=>{e&&this.j.e.on(e,"scroll mousewheel",t)}))}removeGlobalListeners(){const t=this.throttleUpdatePosition,e=this.ow;W.off("closeAllPopups",this.close),this.smart&&this.j.e.off("escape",this.close).off("mousedown touchstart",this.closeOnOutsideClick).off(e,"mousedown touchstart",this.closeOnOutsideClick),this.j.e.off("closeAllPopups",this.close).off("resize",t).off(this.container,"scroll mousewheel",t).off(e,"scroll",t).off(e,"resize",t),ct.up(this.j.container,(e=>{e&&this.j.e.off(e,"scroll mousewheel",t)}))}setZIndex(t){this.container.style.zIndex=""+t}destruct(){return this.close(),super.destruct()}}n([O],zt.prototype,"updatePosition",null),n([((t,e=!1)=>w(10,e,"throttle"))(),O],zt.prototype,"throttleUpdatePosition",null),n([O],zt.prototype,"close",null),n([O],zt.prototype,"closeOnOutsideClick",null);let Vt=class extends Rt{constructor(...t){var e,s;super(...t),(null===(e=this.options)||void 0===e?void 0:e.className)&&this.container.classList.add(null===(s=this.options)||void 0===s?void 0:s.className)}className(){return"UIForm"}submit(){this.j.e.fire(this.container,"submit")}validate(){const t=this.allChildren.filter((t=>t instanceof qt));for(const e of t)if(!e.validate())return!1;const e=this.allChildren.filter((t=>t instanceof Kt));for(const t of e)if(!t.validate())return!1;return!0}onSubmit(t){this.j.e.on(this.container,"submit",(()=>{const e=this.allChildren.filter((t=>t instanceof qt));return!!this.validate()&&(t(e.reduce(((t,e)=>(t[e.state.name]=e.value,t)),{})),!1)}))}createContainer(){const t=this.j.c.element("form");return t.classList.add(this.componentName),ue(t,"dir",this.j.o.direction||"auto"),t}};Vt=n([E],Vt);const Ht=t=>!!A(t.value).length||(t.error="Please fill out this field",!1),$t=t=>!!(t=>{if(t.includes(" "))return!1;if("undefined"!=typeof URL)try{const e=new URL(t);return["https:","http:","ftp:","file:","rtmp:"].includes(e.protocol)}catch(t){return!1}const e=document.createElement("a");return e.href=t,!!e.hostname})(A(t.value))||(t.error="Please enter a web address",!1),Ut=t=>!!A(t.value).length||(t.error="Please fill out this field",!1);var Wt;let qt=Wt=class extends Ot{constructor(t,e){super(t,e),this.label=this.j.c.span(this.getFullElName("label")),this.icon=this.j.c.span(this.getFullElName("icon")),this.clearButton=this.j.c.span(this.getFullElName("clear"),kt.get("cancel")),this.state={...Wt.defaultState},this.__errorBox=this.j.c.span(this.getFullElName("error")),this.validators=new Set([]),void 0!==(null==e?void 0:e.value)&&(e.value=""+e.value),Object.assign(this.state,e),void 0!==this.state.clearButton&&(this.j.e.on(this.clearButton,"click",(t=>{t.preventDefault(),this.nativeInput.value="",this.j.e.fire(this.nativeInput,"input"),this.focus()})).on(this.nativeInput,"input",(()=>{this.state.clearButton=!!this.value.length})),this.state.clearButton=!!this.value.length),this.j.e.on(this.nativeInput,"focus blur",(()=>{this.onChangeFocus()})).on(this.nativeInput,"input change",this.onChangeValue),this.onChangeState(),this.onChangeClassName(),this.onChangeStateValue()}className(){return"UIInput"}onChangeClear(){this.state.clearButton?ct.after(this.nativeInput,this.clearButton):ct.safeRemove(this.clearButton)}onChangeClassName(t,e){e&&this.container.classList.remove(e),this.state.className&&this.container.classList.add(this.state.className)}onChangeState(){this.name=this.state.name;const t=this.nativeInput,{name:e,icon:s,type:n,ref:i,required:o,placeholder:r,autocomplete:a,label:l}=this.state;ue(t,"name",e),ue(t,"type",n),ue(t,"data-ref",i||e),ue(t,"ref",i||e),ue(t,"required",o||null),ue(t,"autocomplete",a?null:"off"),ue(t,"placeholder",r?this.j.i18n(r):""),s&&kt.exists(s)?(ct.before(t,this.icon),this.icon.innerHTML=kt.get(s)):ct.safeRemove(this.icon),l?(ct.before(this.wrapper,this.label),this.label.innerText=this.j.i18n(l)):ct.safeRemove(this.label),this.updateValidators()}updateValidators(){var t;this.validators.clear(),this.state.required&&this.validators.add(Ht),null===(t=this.state.validators)||void 0===t||t.forEach((t=>{const e=s[t];e&&this.validators.add(e)}))}set error(t){this.setMod("has-error",!!t),t?(this.__errorBox.innerText=this.j.i18n(t,this.j.i18n(this.state.label||"")),this.container.appendChild(this.__errorBox)):ct.safeRemove(this.__errorBox)}get value(){return this.nativeInput.value}set value(t){this.value!==t&&(this.nativeInput.value=t,this.onChangeValue())}onChangeStateValue(){const t=""+this.state.value;t!==this.value&&(this.value=t)}onChangeValue(){var t,e;const{value:s}=this;this.state.value!==s&&(this.state.value=s,this.j.e.fire(this,"change",s),null===(e=(t=this.state).onChange)||void 0===e||e.call(t,s))}validate(){return this.error="",fe(this.validators).every((t=>t(this)))}createContainer(t){const e=super.createContainer();this.wrapper=this.j.c.div(this.getFullElName("wrapper")),this.nativeInput||(this.nativeInput=this.createNativeInput());const{nativeInput:s}=this;return s.classList.add(this.getFullElName("input")),this.wrapper.appendChild(s),e.appendChild(this.wrapper),ue(s,"dir",this.j.o.direction||"auto"),e}createNativeInput(t){return this.j.create.element("input")}focus(){this.nativeInput.focus()}get isFocused(){return this.nativeInput===this.j.od.activeElement}onChangeFocus(){this.setMod("focused",this.isFocused)}};var Gt;qt.defaultState={className:"",autocomplete:!0,name:"",value:"",icon:"",label:"",ref:"",type:"text",placeholder:"",required:!1,validators:[]},n([x("state.clearButton")],qt.prototype,"onChangeClear",null),n([x("state.className")],qt.prototype,"onChangeClassName",null),n([x(["state.name","state.type","state.label","state.placeholder","state.autocomplete","state.icon"]),w()],qt.prototype,"onChangeState",null),n([x("state.value")],qt.prototype,"onChangeStateValue",null),n([O],qt.prototype,"onChangeValue",null),qt=Wt=n([E],qt);let Zt=Gt=class extends qt{constructor(t,e){super(t,e),this.state={...Gt.defaultState},Object.assign(this.state,e),!1===this.state.resizable&&(this.nativeInput.style.resize="none")}className(){return"UITextArea"}createContainer(t){return this.nativeInput=this.j.create.element("textarea"),super.createContainer(t)}};var Xt;Zt.defaultState={...qt.defaultState,size:5,resizable:!0},Zt=Gt=n([E],Zt);let Jt=Xt=class extends qt{constructor(t,e){super(t,{...e,type:"checkbox"}),this.state={...Xt.defaultState},Object.assign(this.state,e)}className(){return"UICheckbox"}render(){return this.j.c.element("label",{className:this.componentName})}onChangeChecked(){this.value=""+this.state.checked,this.nativeInput.checked=this.state.checked,this.setMod("checked",this.state.checked)}onChangeNativeCheckBox(){this.state.checked=this.nativeInput.checked}onChangeSwitch(){this.setMod("switch",this.state.switch);let t=this.getElm("switch-slider");this.state.switch?(t||(t=this.j.c.div(this.getFullElName("switch-slider"))),ct.after(this.nativeInput,t)):ct.safeRemove(t)}};var Yt;Jt.defaultState={...qt.defaultState,checked:!1,switch:!1},n([x("state.checked"),N("ready")],Jt.prototype,"onChangeChecked",null),n([x("nativeInput:change")],Jt.prototype,"onChangeNativeCheckBox",null),n([x("state.switch"),N("ready")],Jt.prototype,"onChangeSwitch",null),Jt=Xt=n([E],Jt);let Kt=Yt=class extends qt{constructor(t,e){super(t,e),this.state={...Yt.defaultState},Object.assign(this.state,e)}className(){return"UISelect"}createContainer(t){var e;const s=super.createContainer(t),{j:n}=this,{nativeInput:i}=this,o=()=>n.create.element("option");if(void 0!==t.placeholder){const e=o();e.value="",e.text=n.i18n(t.placeholder),i.add(e)}return null===(e=t.options)||void 0===e||e.forEach((t=>{const e=o();e.value=""+t.value,e.text=n.i18n(t.text),i.add(e)})),t.size&&t.size>0&&ue(i,"size",t.size),t.multiple&&ue(i,"multiple",""),s}createNativeInput(){return this.j.create.element("select")}updateValidators(){super.updateValidators(),this.state.required&&(this.validators.delete(Ht),this.validators.add(Ut))}};Kt.defaultState={...qt.defaultState,options:[],size:1,multiple:!1},Kt=Yt=n([E],Kt);let Qt=class extends qt{constructor(t,e){super(t,{type:"file",...e}),this.state={...qt.defaultState,type:"file",onlyImages:!0}}className(){return"UIFileInput"}createContainer(t){this.button=new _t(this.j,{icon:{name:"plus"}});const{container:e}=this.button;this.nativeInput||(this.nativeInput=this.createNativeInput(t));const{nativeInput:s}=this;return s.classList.add(this.getFullElName("input")),e.classList.add(this.componentName),e.appendChild(s),e}createNativeInput(t){return this.j.create.fromHTML(`<input\n\t\t\ttype="file"\n\t\t\taccept="${t.onlyImages?"image/*":"*"}"\n\t\t\ttabindex="-1"\n\t\t\tdir="auto"\n\t\t\tmultiple=""\n\t\t/>`)}};Qt=n([E],Qt);let te=class extends Rt{constructor(t,e,s={align:"left"}){super(t,e),this.options=s,this.setMod("align",this.options.align||"left"),this.setMod("width",this.options.width||""),this.options.mod&&this.setMod(this.options.mod,!0),this.options.className&&this.container.classList.add(this.options.className),ue(this.container,"data-ref",s.ref),ue(this.container,"ref",s.ref)}className(){return"UIBlock"}};function ee(t,e){let s;return s=e.querySelectorAll(t),[].slice.call(s)}function se(t){window.clearTimeout(t)}function ne(t){if(!t)return null;const e=ct.isHTMLElement(t),s=e&&jt(t,"overflowY");return e&&"visible"!==s&&"hidden"!==s&&t.scrollHeight>=t.clientHeight?t:ne(t.parentNode)||document.scrollingElement||document.body}function ie(t,e,s=!1){const n=t.getBoundingClientRect();let i=n.left,o=n.top;if(ht(e)&&e.iframe&&!s){const{left:t,top:s}=ie(e.iframe,e,!0);i+=t,o+=s}return{left:Math.round(i),top:Math.round(o),width:Math.round(t.offsetWidth),height:Math.round(t.offsetHeight)}}te=n([E],te);const oe=new Map;class re{constructor(){this.ownerWindow=window,this.__componentStatus=c.beforeInit,this.uid="jodit-uid-"+(()=>{function t(){return z+=10*(Math.random()+1),Math.round(z).toString(16)}let e=t();for(;V.has(e);)e=t();return V.add(e),e})()}get componentName(){return this.__componentName||(this.__componentName="jodit-"+P((i(this.className)?this.className():"")||L(this))),this.__componentName}getFullElName(t,e,s){const n=[this.componentName];return t&&(t=t.replace(/[^a-z0-9-]/gi,"-"),n.push("__"+t)),e&&(n.push("_",e),n.push("_",a(s)?"true":""+s)),n.join("")}get ownerDocument(){return this.ow.document}get od(){return this.ownerDocument}get ow(){return this.ownerWindow}get(t,e){return l(t,e||this)}get isReady(){return this.componentStatus===c.ready}get isDestructed(){return this.componentStatus===c.destructed}get isInDestruct(){return c.beforeDestruct===this.componentStatus||c.destructed===this.componentStatus}bindDestruct(t){return t.hookStatus(c.beforeDestruct,(()=>!this.isInDestruct&&this.destruct())),this}destruct(){this.setStatus(c.destructed),oe.get(this)&&oe.delete(this)}get componentStatus(){return this.__componentStatus}set componentStatus(t){this.setStatus(t)}setStatus(t){return this.setStatusComponent(t,this)}setStatusComponent(t,e){if(t===this.__componentStatus)return;const s=Object.getPrototypeOf(this);s&&i(s.setStatusComponent)&&s.setStatusComponent(t,e);const n=oe.get(this),o=null==n?void 0:n[t];o&&o.length&&o.forEach((t=>t(e))),e===this&&(this.__componentStatus=t)}hookStatus(t,e){let s=oe.get(this);s||(s={},oe.set(this,s)),s[t]||(s[t]=[]),s[t].push(e)}}re.STATUSES=c;class ae extends re{constructor(t){super(),this.setParentView(t)}get defaultTimeout(){return this.j.defaultTimeout}get j(){return this.jodit}i18n(t,...e){return this.j.i18n(t,...e)}setParentView(t){return this.jodit=t,t.components.add(this),this}destruct(){return this.j.components.delete(this),super.destruct()}}const le=new WeakMap,ce=(t,e,s)=>{let n=le.get(t);if(!n){n={},le.set(t,n);let e=null;t instanceof ae&&(e=t.j.e),ut(t)&&(e=t.e),e&&e.on("beforeDestruct",(()=>{le.delete(t)}))}return void 0===s?n[e]:(n[e]=s,s)};function he(t,...e){return t(...e)}function ue(t,e,s){if(!t||!i(t.getAttribute))return null;if(!r(e))return Object.keys(e).forEach((s=>{const n=e[s];ft(n)&&"style"===s?jt(t,n):("className"===s&&(s="class"),ue(t,s,n))})),null;let n=(t=>t.replace(/([A-Z])([A-Z])([a-z])/g,"$1-$2$3").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())(e);if(/^-/.test(n)){const e=ue(t,"data"+n);if(e)return e;n=n.substr(1)}if(void 0!==s){if(null!=s)return t.setAttribute(n,""+s),""+s;t.hasAttribute(n)&&t.removeAttribute(n)}return t.getAttribute(n)}const de={},pe=(t,e=!0)=>{if(e)return Object.keys(t);const s=[];for(const e in t)s.push(e);return s},fe=(...t)=>{var e,s;return((s=Array.from)&&"function"===(typeof s).toLowerCase()&&(s===Function.prototype||/^\s*function\s*(\b[a-z$_][a-z0-9$_]*\b)*\s*\((|([a-z$_][a-z0-9$_]*)(\s*,[a-z$_][a-z0-9$_]*)*)\)\s*{\s*\[native code]\s*}\s*$/i.test(s+""))?Array.from:null!==(e=(t=>{var e,s;if(!(t in de)){const s=document.createElement("iframe");try{if(s.src="about:blank",document.body.appendChild(s),!s.contentWindow)return null;const n=l(t,s.contentWindow),o=l("Array",s.contentWindow);i(n)&&(de[t]=n.bind(o))}catch(t){}finally{null===(e=s.parentNode)||void 0===e||e.removeChild(s)}}return null!==(s=de[t])&&void 0!==s?s:null})("Array.from"))&&void 0!==e?e:Array.from).apply(Array,t)};function me(t){var e,s;const n={};if("SCRIPT"===t.nodeName&&(n.textContent=null!==(e=t.textContent)&&void 0!==e?e:""),t.nodeType===Node.TEXT_NODE&&(n.nodeValue=null!==(s=t.nodeValue)&&void 0!==s?s:""),ct.isElement(t))for(let e=0;t.attributes.length>e;e+=1){const s=t.attributes.item(e);s&&(n[s.name]=s.value)}return n}function ge(t,e=!0){var s;return t.nodeType===Node.TEXT_NODE?{type:"TEXT_ELEMENT",props:{children:[],nodeValue:null!==(s=t.nodeValue)&&void 0!==s?s:""}}:{type:t.nodeName.toLowerCase(),props:{children:fe(t.childNodes).map((t=>ge(t,e))),...me(t)}}}class ve{constructor(){var t,e,s,n;this.timers=new Map,this.promisesRejections=new Set,this.requestsIdle=new Set,this.requestIdleCallbackNative=null!==(e=null===(t=window.requestIdleCallback)||void 0===t?void 0:t.bind(window))&&void 0!==e?e:t=>{const e=Date.now();return this.setTimeout((()=>{t({didTimeout:!1,timeRemaining:()=>Math.max(0,50-(Date.now()-e))})}),1)},this.cancelIdleCallbackNative=null!==(n=null===(s=window.cancelIdleCallback)||void 0===s?void 0:s.bind(window))&&void 0!==n?n:t=>{this.clearTimeout(t)},this.isDestructed=!1}delay(t){return this.promise((e=>this.setTimeout(e,t)))}setTimeout(t,e,...s){if(this.isDestructed)return 0;let n={};dt(e)||(n=e,e=n.timeout||0),n.label&&this.clearLabel(n.label);const i=((t,e,...s)=>e?window.setTimeout(t,e,...s):(t.call(null,...s),0))(t,e,...s);return this.timers.set(n.label||i,i),i}clearLabel(t){t&&this.timers.has(t)&&(se(this.timers.get(t)),this.timers.delete(t))}clearTimeout(t){if(r(t))return this.clearLabel(t);se(t),this.timers.delete(t)}debounce(t,e,s=!1){let n=0,r=!1;const a=[],l=(...e)=>{if(!r){n=0;const s=t(...e);if(r=!0,a.length){const t=()=>{a.forEach((t=>t())),a.length=0};o(s)?s.finally(t):t()}}},c=(...o)=>{r=!1,e?(!n&&s&&l(...o),se(n),n=this.setTimeout((()=>l(...o)),i(e)?e():e),this.timers.set(t,n)):l(...o)};return ft(e)&&e.promisify?(...t)=>{const e=this.promise((t=>{a.push(t)}));return c(...t),e}:c}throttle(t,e,s=!1){let n,o,r,a=null;return(...s)=>{n=!0,r=s,e?a||(o=()=>{n?(t(...r),n=!1,a=this.setTimeout(o,i(e)?e():e),this.timers.set(o,a)):a=null},o()):t(...r)}}promise(t){let e=()=>{};const s=new Promise(((s,n)=>(this.promisesRejections.add(n),e=n,t(s,n))));return s.finally((()=>{this.promisesRejections.delete(e)})),s.rejectCallback=e,s}promiseState(t){if(t.status)return t.status;if(!Promise.race)return new Promise((e=>{t.then((t=>(e("fulfilled"),t)),(t=>{throw e("rejected"),t})),this.setTimeout((()=>{e("pending")}),100)}));const e={};return Promise.race([t,e]).then((t=>t===e?"pending":"fulfilled"),(()=>"rejected"))}requestIdleCallback(t){const e=this.requestIdleCallbackNative(t);return this.requestsIdle.add(e),e}requestIdlePromise(){return this.promise((t=>{const e=this.requestIdleCallback((()=>t(e)))}))}cancelIdleCallback(t){return this.requestsIdle.delete(t),this.cancelIdleCallbackNative(t)}clear(){this.requestsIdle.forEach((t=>{this.cancelIdleCallback(t)})),this.timers.forEach((t=>{se(this.timers.get(t))})),this.timers.clear(),this.promisesRejections.forEach((t=>{t()})),this.promisesRejections.clear()}destruct(){this.clear(),this.isDestructed=!0}}const be=t=>"children"!==t,Ce=(t,e,s)=>{var n;Object.keys(e).filter(be).filter((n=s,t=>!(t in n))).forEach((e=>{t[e]=""})),Object.keys(s).filter(be).filter(((t,e)=>s=>t[s]!==e[s])(e,s)).forEach((e=>{t[e]=s[e]}))};let ye=class{constructor(){this.async=new ve,this.nextUnitOfWork=void 0,this.currentRoot=void 0,this.wipRoot=void 0,this.deletions=[],this.async.requestIdleCallback(this.workLoop)}commitRoot(){var t;this.deletions.forEach(this.commitWork),this.deletions.length=0,this.commitWork(null===(t=this.wipRoot)||void 0===t?void 0:t.child),this.currentRoot=this.wipRoot,this.wipRoot=void 0}commitWork(t){var e,s;if(!t)return;let n=t.parent;for(;!(null==n?void 0:n.dom);)n=null==n?void 0:n.parent;const i=n.dom;"PLACEMENT"===t.effectTag&&null!=t.dom?i.appendChild(t.dom):"UPDATE"===t.effectTag&&null!=t.dom?Ce(t.dom,null!==(s=null===(e=t.alternate)||void 0===e?void 0:e.props)&&void 0!==s?s:{},t.props):"DELETION"===t.effectTag&&this.commitDeletion(t,i),this.commitWork(null==t?void 0:t.child),this.commitWork(null==t?void 0:t.sibling)}commitDeletion(t,e){(null==t?void 0:t.dom)?e.removeChild(t.dom):this.commitDeletion(null==t?void 0:t.child,e)}render(t,e){var s;this.wipRoot={type:"div",dom:e,props:{children:[t]},alternate:null!==(s=this.currentRoot)&&void 0!==s?s:void 0},this.deletions=[],this.nextUnitOfWork=this.wipRoot}workLoop(t){let e=!1;for(;this.nextUnitOfWork&&!e;)this.nextUnitOfWork=this.performUnitOfWork(this.nextUnitOfWork),e=1>t.timeRemaining();!this.nextUnitOfWork&&this.wipRoot&&this.commitRoot(),this.async.requestIdleCallback(this.workLoop)}performUnitOfWork(t){if(this.__updateHostComponent(t),t.child)return t.child;let e=t;for(;e;){if(e.sibling)return e.sibling;e=e.parent}}__updateHostComponent(t){t.dom||(t.dom=(t=>{const e="TEXT_ELEMENT"===t.type?document.createTextNode(""):document.createElement(t.type);return Ce(e,{},t.props),e})(t)),this.__reconcileChildren(t,t.props.children)}__reconcileChildren(t,e){let s,n=0,i=t.alternate&&t.alternate.child;for(;e.length>n||i;){const o=e[n];let r;const a=i&&o&&o.type===i.type;a&&i&&(r={type:i.type,props:o.props,dom:i.dom,parent:t,alternate:i,effectTag:"UPDATE"}),o&&!a&&(r={type:o.type,props:o.props,dom:null,parent:t,alternate:void 0,effectTag:"PLACEMENT"}),i&&!a&&(i.effectTag="DELETION",this.deletions.push(i)),i&&(i=i.sibling),0===n&&t?t.child=r:o&&s&&(s.sibling=r),s=r,n++}}htmlToVDom(t){const e=document.createElement("div");return e.innerHTML=t,ge(e.children.length>1||!e.firstChild?e:e.firstChild)}};return ye=n([O],ye),e}()}));