mokelay-editor 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,112 @@
1
+ function ba(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-hint--align-start{text-align:left}.ce-hint--align-center{text-align:center}.ce-hint__description{opacity:.6;margin-top:3px}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var Et=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jt(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function wa(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function o(){return this instanceof o?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(o){var i=Object.getOwnPropertyDescriptor(n,o);Object.defineProperty(t,o,i.get?i:{enumerable:!0,get:function(){return n[o]}})}),t}function Co(){}Object.assign(Co,{default:Co,register:Co,revert:function(){},__esModule:!0});Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(n){const e=(this.document||this.ownerDocument).querySelectorAll(n);let t=e.length;for(;--t>=0&&e.item(t)!==this;);return t>-1});Element.prototype.closest||(Element.prototype.closest=function(n){let e=this;if(!document.documentElement.contains(e))return null;do{if(e.matches(n))return e;e=e.parentElement||e.parentNode}while(e!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(n){const e=document.createDocumentFragment();Array.isArray(n)||(n=[n]),n.forEach(t=>{const o=t instanceof Node;e.appendChild(o?t:document.createTextNode(t))}),this.insertBefore(e,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(n){n=arguments.length===0?!0:!!n;const e=this.parentNode,t=window.getComputedStyle(e,null),o=parseInt(t.getPropertyValue("border-top-width")),i=parseInt(t.getPropertyValue("border-left-width")),s=this.offsetTop-e.offsetTop<e.scrollTop,l=this.offsetTop-e.offsetTop+this.clientHeight-o>e.scrollTop+e.clientHeight,d=this.offsetLeft-e.offsetLeft<e.scrollLeft,u=this.offsetLeft-e.offsetLeft+this.clientWidth-i>e.scrollLeft+e.clientWidth,p=s&&!l;(s||l)&&n&&(e.scrollTop=this.offsetTop-e.offsetTop-e.clientHeight/2-o+this.clientHeight/2),(d||u)&&n&&(e.scrollLeft=this.offsetLeft-e.offsetLeft-e.clientWidth/2-i+this.clientWidth/2),(s||l||d||u)&&!n&&this.scrollIntoView(p)});window.requestIdleCallback=window.requestIdleCallback||function(n){const e=Date.now();return setTimeout(function(){n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-e))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(n){clearTimeout(n)};let va=(n=21)=>crypto.getRandomValues(new Uint8Array(n)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var Ui=(n=>(n.VERBOSE="VERBOSE",n.INFO="INFO",n.WARN="WARN",n.ERROR="ERROR",n))(Ui||{});const _={BACKSPACE:8,TAB:9,ENTER:13,ESC:27,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46},ka={LEFT:0};function St(n,e,t="log",o,i="color: inherit"){if(!("console"in window)||!window.console[t])return;const s=["info","log","warn","error"].includes(t),l=[];switch(St.logLevel){case"ERROR":if(t!=="error")return;break;case"WARN":if(!["error","warn"].includes(t))return;break;case"INFO":if(!s||n)return;break}o&&l.push(o);const d="Editor.js 2.31.6";n&&(s?(l.unshift(`line-height: 1em;
2
+ color: #006FEA;
3
+ display: inline-block;
4
+ font-size: 11px;
5
+ line-height: 1em;
6
+ background-color: #fff;
7
+ padding: 4px 9px;
8
+ border-radius: 30px;
9
+ border: 1px solid rgba(56, 138, 229, 0.16);
10
+ margin: 4px 5px 4px 0;`,i),e=`%c${d}%c ${e}`):e=`( ${d} )${e}`);try{s?o?console[t](`${e} %o`,...l):console[t](e,...l):console[t](e)}catch{}}St.logLevel="VERBOSE";function ya(n){St.logLevel=n}const q=St.bind(window,!1),Ce=St.bind(window,!0);function Ke(n){return Object.prototype.toString.call(n).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function G(n){return Ke(n)==="function"||Ke(n)==="asyncfunction"}function le(n){return Ke(n)==="object"}function Pe(n){return Ke(n)==="string"}function xa(n){return Ke(n)==="boolean"}function xi(n){return Ke(n)==="number"}function Ci(n){return Ke(n)==="undefined"}function Ee(n){return n?Object.keys(n).length===0&&n.constructor===Object:!0}function $i(n){return n>47&&n<58||n===32||n===13||n===229||n>64&&n<91||n>95&&n<112||n>185&&n<193||n>218&&n<223}async function Ca(n,e=()=>{},t=()=>{}){async function o(i,s,l){try{await i.function(i.data),await s(Ci(i.data)?{}:i.data)}catch{l(Ci(i.data)?{}:i.data)}}return n.reduce(async(i,s)=>(await i,o(s,e,t)),Promise.resolve())}function qi(n){return Array.prototype.slice.call(n)}function qt(n,e){return function(){const t=this,o=arguments;window.setTimeout(()=>n.apply(t,o),e)}}function Ea(n){return n.name.split(".").pop()}function Ta(n){return/^[-\w]+\/([-+\w]+|\*)$/.test(n)}function Ei(n,e,t){let o;return(...i)=>{const s=this,l=()=>{o=null,n.apply(s,i)};window.clearTimeout(o),o=window.setTimeout(l,e)}}function Lo(n,e,t=void 0){let o,i,s,l=null,d=0;t||(t={});const u=function(){d=t.leading===!1?0:Date.now(),l=null,s=n.apply(o,i),l||(o=i=null)};return function(){const p=Date.now();!d&&t.leading===!1&&(d=p);const f=e-(p-d);return o=this,i=arguments,f<=0||f>e?(l&&(clearTimeout(l),l=null),d=p,s=n.apply(o,i),l||(o=i=null)):!l&&t.trailing!==!1&&(l=setTimeout(u,f)),s}}function Ba(){const n={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(n).find(t=>window.navigator.appVersion.toLowerCase().indexOf(t)!==-1);return e&&(n[e]=!0),n}function Wt(n){return n[0].toUpperCase()+n.slice(1)}function _o(n,...e){if(!e.length)return n;const t=e.shift();if(le(n)&&le(t))for(const o in t)le(t[o])?(n[o]||Object.assign(n,{[o]:{}}),_o(n[o],t[o])):Object.assign(n,{[o]:t[o]});return _o(n,...e)}function Fo(n){const e=Ba();return n=n.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi," + "),e.mac?n=n.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):n=n.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),n}function Sa(n){try{return new URL(n).href}catch{}return n.substring(0,2)==="//"?window.location.protocol+n:window.location.origin+n}function Oa(){return va(10)}function Ia(n){window.open(n,"_blank")}function Aa(n=""){return`${n}${Math.floor(Math.random()*1e8).toString(16)}`}function Po(n,e,t){const o=`«${e}» is deprecated and will be removed in the next major release. Please use the «${t}» instead.`;n&&Ce(o,"warn")}function ct(n,e,t){const o=t.value?"value":"get",i=t[o],s=`#${e}Cache`;if(t[o]=function(...l){return this[s]===void 0&&(this[s]=i.apply(this,...l)),this[s]},o==="get"&&t.set){const l=t.set;t.set=function(d){delete n[s],l.apply(this,d)}}return t}const Wi=650;function dt(){return window.matchMedia(`(max-width: ${Wi}px)`).matches}const No=typeof window<"u"&&window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function Ma(n,e){const t=Array.isArray(n)||le(n),o=Array.isArray(e)||le(e);return t||o?JSON.stringify(n)===JSON.stringify(e):n===e}class v{static isSingleTag(e){return e.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(e.tagName)}static isLineBreakTag(e){return e&&e.tagName&&["BR","WBR"].includes(e.tagName)}static make(e,t=null,o={}){const i=document.createElement(e);if(Array.isArray(t)){const s=t.filter(l=>l!==void 0);i.classList.add(...s)}else t&&i.classList.add(t);for(const s in o)Object.prototype.hasOwnProperty.call(o,s)&&(i[s]=o[s]);return i}static text(e){return document.createTextNode(e)}static append(e,t){Array.isArray(t)?t.forEach(o=>e.appendChild(o)):e.appendChild(t)}static prepend(e,t){Array.isArray(t)?(t=t.reverse(),t.forEach(o=>e.prepend(o))):e.prepend(t)}static swap(e,t){const o=document.createElement("div"),i=e.parentNode;i.insertBefore(o,e),i.insertBefore(e,t),i.insertBefore(t,o),i.removeChild(o)}static find(e=document,t){return e.querySelector(t)}static get(e){return document.getElementById(e)}static findAll(e=document,t){return e.querySelectorAll(t)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(e=>`input[type="${e}"]`).join(", ")}static findAllInputs(e){return qi(e.querySelectorAll(v.allInputsSelector)).reduce((t,o)=>v.isNativeInput(o)||v.containsOnlyInlineElements(o)?[...t,o]:[...t,...v.getDeepestBlockElements(o)],[])}static getDeepestNode(e,t=!1){const o=t?"lastChild":"firstChild",i=t?"previousSibling":"nextSibling";if(e&&e.nodeType===Node.ELEMENT_NODE&&e[o]){let s=e[o];if(v.isSingleTag(s)&&!v.isNativeInput(s)&&!v.isLineBreakTag(s))if(s[i])s=s[i];else if(s.parentNode[i])s=s.parentNode[i];else return s.parentNode;return this.getDeepestNode(s,t)}return e}static isElement(e){return xi(e)?!1:e&&e.nodeType&&e.nodeType===Node.ELEMENT_NODE}static isFragment(e){return xi(e)?!1:e&&e.nodeType&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(e){return e.contentEditable==="true"}static isNativeInput(e){const t=["INPUT","TEXTAREA"];return e&&e.tagName?t.includes(e.tagName):!1}static canSetCaret(e){let t=!0;if(v.isNativeInput(e))switch(e.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":t=!1;break}else t=v.isContentEditable(e);return t}static isNodeEmpty(e,t){let o;return this.isSingleTag(e)&&!this.isLineBreakTag(e)?!1:(this.isElement(e)&&this.isNativeInput(e)?o=e.value:o=e.textContent.replace("​",""),t&&(o=o.replace(new RegExp(t,"g"),"")),o.length===0)}static isLeaf(e){return e?e.childNodes.length===0:!1}static isEmpty(e,t){const o=[e];for(;o.length>0;)if(e=o.shift(),!!e){if(this.isLeaf(e)&&!this.isNodeEmpty(e,t))return!1;e.childNodes&&o.push(...Array.from(e.childNodes))}return!0}static isHTMLString(e){const t=v.make("div");return t.innerHTML=e,t.childElementCount>0}static getContentLength(e){return v.isNativeInput(e)?e.value.length:e.nodeType===Node.TEXT_NODE?e.length:e.textContent.length}static get blockElements(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}static containsOnlyInlineElements(e){let t;Pe(e)?(t=document.createElement("div"),t.innerHTML=e):t=e;const o=i=>!v.blockElements.includes(i.tagName.toLowerCase())&&Array.from(i.children).every(o);return Array.from(t.children).every(o)}static getDeepestBlockElements(e){return v.containsOnlyInlineElements(e)?[e]:Array.from(e.children).reduce((t,o)=>[...t,...v.getDeepestBlockElements(o)],[])}static getHolder(e){return Pe(e)?document.getElementById(e):e}static isAnchor(e){return e.tagName.toLowerCase()==="a"}static getClosestAnchor(e){return e.closest("a")}static offset(e){const t=e.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop,s=t.top+i,l=t.left+o;return{top:s,left:l,bottom:s+t.height,right:l+t.width}}static getNodeByOffset(e,t){let o=0,i=null;const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null);let l=s.nextNode();for(;l;){const p=l.textContent,f=p===null?0:p.length;if(i=l,o+f>=t)break;o+=f,l=s.nextNode()}if(!i)return{node:null,offset:0};const d=i.textContent;if(d===null||d.length===0)return{node:null,offset:0};const u=Math.min(t-o,d.length);return{node:i,offset:u}}}function La(n){return!/[^\t\n\r ]/.test(n)}function _a(n){const e=window.getComputedStyle(n),t=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||t*1.2,i=parseFloat(e.paddingTop),s=parseFloat(e.borderTopWidth),l=parseFloat(e.marginTop),d=t*.8,u=(o-t)/2;return l+s+i+u+d}function Yi(n){n.dataset.empty=v.isEmpty(n)?"true":"false"}const Pa={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":"","Convert to":""}},Na={Text:"",Link:"",Bold:"",Italic:""},Ra={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},Da={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},Vi={ui:Pa,toolNames:Na,tools:Ra,blockTunes:Da},Ki=class st{static ui(e,t){return st._t(e,t)}static t(e,t){return st._t(e,t)}static setDictionary(e){st.currentDictionary=e}static _t(e,t){const o=st.getNamespace(e);return!o||!o[t]?t:o[t]}static getNamespace(e){return e.split(".").reduce((t,o)=>!t||!Object.keys(t).length?{}:t[o],st.currentDictionary)}};Ki.currentDictionary=Vi;let fe=Ki;class Xi extends Error{}class Ot{constructor(){this.subscribers={}}on(e,t){e in this.subscribers||(this.subscribers[e]=[]),this.subscribers[e].push(t)}once(e,t){e in this.subscribers||(this.subscribers[e]=[]);const o=i=>{const s=t(i),l=this.subscribers[e].indexOf(o);return l!==-1&&this.subscribers[e].splice(l,1),s};this.subscribers[e].push(o)}emit(e,t){Ee(this.subscribers)||!this.subscribers[e]||this.subscribers[e].reduce((o,i)=>{const s=i(o);return s!==void 0?s:o},t)}off(e,t){if(this.subscribers[e]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${e.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[e].length;o++)if(this.subscribers[e][o]===t){delete this.subscribers[e][o];break}}destroy(){this.subscribers={}}}function Me(n){Object.setPrototypeOf(this,{get id(){return n.id},get name(){return n.name},get config(){return n.config},get holder(){return n.holder},get isEmpty(){return n.isEmpty},get selected(){return n.selected},set stretched(e){n.stretched=e},get stretched(){return n.stretched},get focusable(){return n.focusable},call(e,t){return n.call(e,t)},save(){return n.save()},validate(e){return n.validate(e)},dispatchChange(){n.dispatchChange()},getActiveToolboxEntry(){return n.getActiveToolboxEntry()}})}class It{constructor(){this.allListeners=[]}on(e,t,o,i=!1){const s=Aa("l"),l={id:s,element:e,eventType:t,handler:o,options:i};if(!this.findOne(e,t,o))return this.allListeners.push(l),e.addEventListener(t,o,i),s}off(e,t,o,i){const s=this.findAll(e,t,o);s.forEach((l,d)=>{const u=this.allListeners.indexOf(s[d]);u>-1&&(this.allListeners.splice(u,1),l.element.removeEventListener(l.eventType,l.handler,l.options))})}offById(e){const t=this.findById(e);t&&t.element.removeEventListener(t.eventType,t.handler,t.options)}findOne(e,t,o){const i=this.findAll(e,t,o);return i.length>0?i[0]:null}findAll(e,t,o){let i;const s=e?this.findByEventTarget(e):[];return e&&t&&o?i=s.filter(l=>l.eventType===t&&l.handler===o):e&&t?i=s.filter(l=>l.eventType===t):i=s,i}removeAll(){this.allListeners.map(e=>{e.element.removeEventListener(e.eventType,e.handler,e.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(e){return this.allListeners.filter(t=>{if(t.element===e)return t})}findByType(e){return this.allListeners.filter(t=>{if(t.eventType===e)return t})}findByHandler(e){return this.allListeners.filter(t=>{if(t.handler===e)return t})}findById(e){return this.allListeners.find(t=>t.id===e)}}let U=class Zi{constructor({config:e,eventsDispatcher:t}){if(this.nodes={},this.listeners=new It,this.readOnlyMutableListeners={on:(o,i,s,l=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,i,s,l))},clearAll:()=>{for(const o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===Zi)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=e,this.eventsDispatcher=t}set state(e){this.Editor=e}removeAllNodes(){for(const e in this.nodes){const t=this.nodes[e];t instanceof HTMLElement&&t.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}},M=class De{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){const e=window.getSelection();return e?e.anchorNode:null}static get anchorElement(){const e=window.getSelection();if(!e)return null;const t=e.anchorNode;return t?v.isElement(t)?t:t.parentElement:null}static get anchorOffset(){const e=window.getSelection();return e?e.anchorOffset:null}static get isCollapsed(){const e=window.getSelection();return e?e.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(De.get())}static isSelectionAtEditor(e){if(!e)return!1;let t=e.anchorNode||e.focusNode;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${De.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(e){if(!e)return;let t=e.startContainer;t&&t.nodeType===Node.TEXT_NODE&&(t=t.parentNode);let o=null;return t&&t instanceof Element&&(o=t.closest(`.${De.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!De.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(e){return e&&e.rangeCount?e.getRangeAt(0):null}static get rect(){let e=document.selection,t,o={x:0,y:0,width:0,height:0};if(e&&e.type!=="Control")return e=e,t=e.createRange(),o.x=t.boundingLeft,o.y=t.boundingTop,o.width=t.boundingWidth,o.height=t.boundingHeight,o;if(!window.getSelection)return q("Method window.getSelection is not supported","warn"),o;if(e=window.getSelection(),e.rangeCount===null||isNaN(e.rangeCount))return q("Method SelectionUtils.rangeCount is not supported","warn"),o;if(e.rangeCount===0)return o;if(t=e.getRangeAt(0).cloneRange(),t.getBoundingClientRect&&(o=t.getBoundingClientRect()),o.x===0&&o.y===0){const i=document.createElement("span");if(i.getBoundingClientRect){i.appendChild(document.createTextNode("​")),t.insertNode(i),o=i.getBoundingClientRect();const s=i.parentNode;s.removeChild(i),s.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(e,t=0){const o=document.createRange(),i=window.getSelection();return v.isNativeInput(e)?v.canSetCaret(e)?(e.focus(),e.selectionStart=e.selectionEnd=t,e.getBoundingClientRect()):void 0:(o.setStart(e,t),o.setEnd(e,t),i.removeAllRanges(),i.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(e){const t=De.range;return t===null?!1:e.contains(t.startContainer)}static addFakeCursor(){const e=De.range;if(e===null)return;const t=v.make("span","codex-editor__fake-cursor");t.dataset.mutationFree="true",e.collapse(),e.insertNode(t)}static isFakeCursorInsideContainer(e){return v.find(e,".codex-editor__fake-cursor")!==null}static removeFakeCursor(e=document.body){const t=v.find(e,".codex-editor__fake-cursor");t&&t.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(document.execCommand(this.commandBackground,!1,"transparent"),this.isFakeBackgroundEnabled=!1)}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=De.range}restore(){if(!this.savedSelectionRange)return;const e=window.getSelection();e.removeAllRanges(),e.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){const e=window.getSelection(),t=document.createRange();t.selectNodeContents(e.focusNode),t.collapse(!1),e.removeAllRanges(),e.addRange(t)}findParentTag(e,t,o=10){const i=window.getSelection();let s=null;return!i||!i.anchorNode||!i.focusNode?null:([i.anchorNode,i.focusNode].forEach(l=>{let d=o;for(;d>0&&l.parentNode&&!(l.tagName===e&&(s=l,t&&l.classList&&!l.classList.contains(t)&&(s=null),s));)l=l.parentNode,d--}),s)}expandToTag(e){const t=window.getSelection();t.removeAllRanges();const o=document.createRange();o.selectNodeContents(e),t.addRange(o)}};function ja(n,e){const{type:t,target:o,addedNodes:i,removedNodes:s}=n;return n.type==="attributes"&&n.attributeName==="data-empty"?!1:!!(e.contains(o)||t==="childList"&&(Array.from(i).some(l=>l===e)||Array.from(s).some(l=>l===e)))}const Ro="redactor dom changed",Gi="block changed",Ji="fake cursor is about to be toggled",Qi="fake cursor have been set",Tt="editor mobile layout toggled";function Do(n,e){if(!n.conversionConfig)return!1;const t=n.conversionConfig[e];return G(t)||Pe(t)}function Yt(n,e){return Do(n.tool,e)}function es(n,e){return Object.entries(n).some(([t,o])=>e[t]&&Ma(e[t],o))}async function ts(n,e){const t=(await n.save()).data,o=e.find(i=>i.name===n.name);return o!==void 0&&!Do(o,"export")?[]:e.reduce((i,s)=>{if(!Do(s,"import")||s.toolbox===void 0)return i;const l=s.toolbox.filter(d=>{if(Ee(d)||d.icon===void 0)return!1;if(d.data!==void 0){if(es(d.data,t))return!1}else if(s.name===n.name)return!1;return!0});return i.push({...s,toolbox:l}),i},[])}function Ti(n,e){return n.mergeable?n.name===e.name?!0:Yt(e,"export")&&Yt(n,"import"):!1}function Ha(n,e){const t=e==null?void 0:e.export;return G(t)?t(n):Pe(t)?n[t]:(t!==void 0&&q("Conversion «export» property must be a string or function. String means key of saved data object to export. Function should export processed string to export."),"")}function Bi(n,e,t){const o=e==null?void 0:e.import;return G(o)?o(n,t):Pe(o)?{[o]:n}:(o!==void 0&&q("Conversion «import» property must be a string or function. String means key of tool data to import. Function accepts a imported string and return composed tool data."),{})}var Z=(n=>(n.Default="default",n.Separator="separator",n.Html="html",n))(Z||{}),Le=(n=>(n.APPEND_CALLBACK="appendCallback",n.RENDERED="rendered",n.MOVED="moved",n.UPDATED="updated",n.REMOVED="removed",n.ON_PASTE="onPaste",n))(Le||{});let _e=class je extends Ot{constructor({id:e=Oa(),data:t,tool:o,readOnly:i,tunesData:s},l){super(),this.cachedInputs=[],this.toolRenderedElement=null,this.tunesInstances=new Map,this.defaultTunesInstances=new Map,this.unavailableTunesData={},this.inputIndex=0,this.editorEventBus=null,this.handleFocus=()=>{this.dropInputsCache(),this.updateCurrentInput()},this.didMutated=(d=void 0)=>{const u=d===void 0,p=d instanceof InputEvent;!u&&!p&&this.detectToolRootChange(d);let f;u||p?f=!0:f=!(d.length>0&&d.every(g=>{const{addedNodes:w,removedNodes:y,target:k}=g;return[...Array.from(w),...Array.from(y),k].some(T=>(v.isElement(T)||(T=T.parentElement),T&&T.closest('[data-mutation-free="true"]')!==null))})),f&&(this.dropInputsCache(),this.updateCurrentInput(),this.toggleInputsEmptyMark(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=e,this.settings=o.settings,this.config=o.settings.config||{},this.editorEventBus=l||null,this.blockAPI=new Me(this),this.tool=o,this.toolInstance=o.create(t,this.blockAPI,i),this.tunes=o.tunes,this.composeTunes(s),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents(),this.toggleInputsEmptyMark()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;const e=v.findAllInputs(this.holder);return this.inputIndex>e.length-1&&(this.inputIndex=e.length-1),this.cachedInputs=e,e}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(e){const t=this.inputs.findIndex(o=>o===e||o.contains(e));t!==-1&&(this.inputIndex=t)}get firstInput(){return this.inputs[0]}get lastInput(){const e=this.inputs;return e[e.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(e=>e&&!Ee(e.data)?e.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return G(this.toolInstance.merge)}get focusable(){return this.inputs.length!==0}get isEmpty(){const e=v.isEmpty(this.pluginsContent,"/"),t=!this.hasMedia;return e&&t}get hasMedia(){const e=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(e.join(","))}set selected(e){var t,o;this.holder.classList.toggle(je.CSS.selected,e);const i=e===!0&&M.isRangeInsideContainer(this.holder),s=e===!1&&M.isFakeCursorInsideContainer(this.holder);(i||s)&&((t=this.editorEventBus)==null||t.emit(Ji,{state:e}),i?M.addFakeCursor():M.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(Qi,{state:e}))}get selected(){return this.holder.classList.contains(je.CSS.selected)}set stretched(e){this.holder.classList.toggle(je.CSS.wrapperStretched,e)}get stretched(){return this.holder.classList.contains(je.CSS.wrapperStretched)}set dropTarget(e){this.holder.classList.toggle(je.CSS.dropTarget,e)}get pluginsContent(){return this.toolRenderedElement}call(e,t){if(G(this.toolInstance[e])){e==="appendCallback"&&q("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[e].call(this.toolInstance,t)}catch(o){q(`Error during '${e}' call: ${o.message}`,"error")}}}async mergeWith(e){await this.toolInstance.merge(e)}async save(){const e=await this.toolInstance.save(this.pluginsContent),t=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([s,l])=>{if(G(l.save))try{t[s]=l.save()}catch(d){q(`Tune ${l.constructor.name} save method throws an Error %o`,"warn",d)}});const o=window.performance.now();let i;return Promise.resolve(e).then(s=>(i=window.performance.now(),{id:this.id,tool:this.name,data:s,tunes:t,time:i-o})).catch(s=>{q(`Saving process for ${this.name} tool failed due to the ${s}`,"log","red")})}async validate(e){let t=!0;return this.toolInstance.validate instanceof Function&&(t=await this.toolInstance.validate(e)),t}getTunes(){const e=[],t=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[];return v.isElement(o)?e.push({type:Z.Html,element:o}):Array.isArray(o)?e.push(...o):e.push(o),[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(i=>i.render()).forEach(i=>{v.isElement(i)?t.push({type:Z.Html,element:i}):Array.isArray(i)?t.push(...i):t.push(i)}),{toolTunes:e,commonTunes:t}}updateCurrentInput(){this.currentInput=v.isNativeInput(document.activeElement)||!M.anchorNode?document.activeElement:M.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),G(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){const e=this.tool.toolbox;if(e.length===1)return Promise.resolve(this.tool.toolbox[0]);const t=await this.data,o=e;return o==null?void 0:o.find(i=>es(i.data,t))}async exportDataAsString(){const e=await this.data;return Ha(e,this.tool.conversionConfig)}compose(){const e=v.make("div",je.CSS.wrapper),t=v.make("div",je.CSS.content),o=this.toolInstance.render();e.dataset.id=this.id,this.toolRenderedElement=o,t.appendChild(this.toolRenderedElement);let i=t;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(s=>{if(G(s.wrap))try{i=s.wrap(i)}catch(l){q(`Tune ${s.constructor.name} wrap method throws an Error %o`,"warn",l)}}),e.appendChild(i),e}composeTunes(e){Array.from(this.tunes.values()).forEach(t=>{(t.isInternal?this.defaultTunesInstances:this.tunesInstances).set(t.name,t.create(e[t.name],this.blockAPI))}),Object.entries(e).forEach(([t,o])=>{this.tunesInstances.has(t)||(this.unavailableTunesData[t]=o)})}addInputEvents(){this.inputs.forEach(e=>{e.addEventListener("focus",this.handleFocus),v.isNativeInput(e)&&e.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(e=>{e.removeEventListener("focus",this.handleFocus),v.isNativeInput(e)&&e.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var e;this.redactorDomChangedCallback=t=>{const{mutations:o}=t;o.some(i=>ja(i,this.toolRenderedElement))&&this.didMutated(o)},(e=this.editorEventBus)==null||e.on(Ro,this.redactorDomChangedCallback)}unwatchBlockMutations(){var e;(e=this.editorEventBus)==null||e.off(Ro,this.redactorDomChangedCallback)}detectToolRootChange(e){e.forEach(t=>{if(Array.from(t.removedNodes).includes(this.toolRenderedElement)){const o=t.addedNodes[t.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}toggleInputsEmptyMark(){this.inputs.forEach(Yi)}};class Fa extends U{constructor(){super(...arguments),this.insert=(e=this.config.defaultBlock,t={},o={},i,s,l,d)=>{const u=this.Editor.BlockManager.insert({id:d,tool:e,data:t,index:i,needToFocus:s,replace:l});return new Me(u)},this.composeBlockData=async e=>{const t=this.Editor.Tools.blockTools.get(e);return new _e({tool:t,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(e,t,o)=>{const{BlockManager:i}=this.Editor,s=i.getBlockById(e);if(s===void 0)throw new Error(`Block with id "${e}" not found`);const l=await i.update(s,t,o);return new Me(l)},this.convert=async(e,t,o)=>{var i,s;const{BlockManager:l,Tools:d}=this.Editor,u=l.getBlockById(e);if(!u)throw new Error(`Block with id "${e}" not found`);const p=d.blockTools.get(u.name),f=d.blockTools.get(t);if(!f)throw new Error(`Block Tool with type "${t}" not found`);const g=((i=p==null?void 0:p.conversionConfig)==null?void 0:i.export)!==void 0,w=((s=f.conversionConfig)==null?void 0:s.import)!==void 0;if(g&&w){const y=await l.convert(u,t,o);return new Me(y)}else{const y=[g?!1:Wt(u.name),w?!1:Wt(t)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${u.name}" to "${t}" is not possible. ${y} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(e,t=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(t);const o=e.map(({id:i,type:s,data:l})=>this.Editor.BlockManager.composeBlock({id:i,tool:s||this.config.defaultBlock,data:l}));return this.Editor.BlockManager.insertMany(o,t),o.map(i=>new Me(i))}}get methods(){return{clear:()=>this.clear(),render:e=>this.render(e),renderFromHTML:e=>this.renderFromHTML(e),delete:e=>this.delete(e),swap:(e,t)=>this.swap(e,t),move:(e,t)=>this.move(e,t),getBlockByIndex:e=>this.getBlockByIndex(e),getById:e=>this.getById(e),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:e=>this.getBlockIndex(e),getBlocksCount:()=>this.getBlocksCount(),getBlockByElement:e=>this.getBlockByElement(e),stretchBlock:(e,t=!0)=>this.stretchBlock(e,t),insertNewBlock:()=>this.insertNewBlock(),insert:this.insert,insertMany:this.insertMany,update:this.update,composeBlockData:this.composeBlockData,convert:this.convert}}getBlocksCount(){return this.Editor.BlockManager.blocks.length}getCurrentBlockIndex(){return this.Editor.BlockManager.currentBlockIndex}getBlockIndex(e){const t=this.Editor.BlockManager.getBlockById(e);if(!t){Ce("There is no block with id `"+e+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(t)}getBlockByIndex(e){const t=this.Editor.BlockManager.getBlockByIndex(e);if(t===void 0){Ce("There is no block at index `"+e+"`","warn");return}return new Me(t)}getById(e){const t=this.Editor.BlockManager.getBlockById(e);return t===void 0?(Ce("There is no block with id `"+e+"`","warn"),null):new Me(t)}getBlockByElement(e){const t=this.Editor.BlockManager.getBlock(e);if(t===void 0){Ce("There is no block corresponding to element `"+e+"`","warn");return}return new Me(t)}swap(e,t){q("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(e,t)}move(e,t){this.Editor.BlockManager.move(e,t)}delete(e=this.Editor.BlockManager.currentBlockIndex){try{const t=this.Editor.BlockManager.getBlockByIndex(e);this.Editor.BlockManager.removeBlock(t)}catch(t){Ce(t,"warn");return}this.Editor.BlockManager.blocks.length===0&&this.Editor.BlockManager.insert(),this.Editor.BlockManager.currentBlock&&this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END),this.Editor.Toolbar.close()}async clear(){await this.Editor.BlockManager.clear(!0),this.Editor.InlineToolbar.close()}async render(e){if(e===void 0||e.blocks===void 0)throw new Error("Incorrect data passed to the render() method");this.Editor.ModificationsObserver.disable(),await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(e.blocks),this.Editor.ModificationsObserver.enable()}async renderFromHTML(e){return await this.Editor.BlockManager.clear(),this.Editor.Paste.processText(e,!0)}stretchBlock(e,t=!0){Po(!0,"blocks.stretchBlock()","BlockAPI");const o=this.Editor.BlockManager.getBlockByIndex(e);o&&(o.stretched=t)}insertNewBlock(){q("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(e){if(typeof e!="number")throw new Error("Index should be a number");if(e<0)throw new Error("Index should be greater than or equal to 0");if(e===null)throw new Error("Index should be greater than or equal to 0")}}function za(n,e){return typeof n=="number"?e.BlockManager.getBlockByIndex(n):typeof n=="string"?e.BlockManager.getBlockById(n):e.BlockManager.getBlockById(n.id)}class Ua extends U{constructor(){super(...arguments),this.setToFirstBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,e,t),!0):!1,this.setToLastBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,e,t),!0):!1,this.setToPreviousBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,e,t),!0):!1,this.setToNextBlock=(e=this.Editor.Caret.positions.DEFAULT,t=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,e,t),!0):!1,this.setToBlock=(e,t=this.Editor.Caret.positions.DEFAULT,o=0)=>{const i=za(e,this.Editor);return i===void 0?!1:(this.Editor.Caret.setToBlock(i,t,o),!0)},this.focus=(e=!1)=>e?this.setToLastBlock(this.Editor.Caret.positions.END):this.setToFirstBlock(this.Editor.Caret.positions.START)}get methods(){return{setToFirstBlock:this.setToFirstBlock,setToLastBlock:this.setToLastBlock,setToPreviousBlock:this.setToPreviousBlock,setToNextBlock:this.setToNextBlock,setToBlock:this.setToBlock,focus:this.focus}}}class $a extends U{get methods(){return{emit:(e,t)=>this.emit(e,t),off:(e,t)=>this.off(e,t),on:(e,t)=>this.on(e,t)}}on(e,t){this.eventsDispatcher.on(e,t)}emit(e,t){this.eventsDispatcher.emit(e,t)}off(e,t){this.eventsDispatcher.off(e,t)}}class zo extends U{static getNamespace(e,t){return t?`blockTunes.${e}`:`tools.${e}`}get methods(){return{t:()=>{Ce("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(e,t){return Object.assign(this.methods,{t:o=>fe.t(zo.getNamespace(e,t),o)})}}class qa extends U{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.methods,tools:this.Editor.ToolsAPI.methods,events:this.Editor.EventsAPI.methods,listeners:this.Editor.ListenersAPI.methods,notifier:this.Editor.NotifierAPI.methods,sanitizer:this.Editor.SanitizerAPI.methods,saver:this.Editor.SaverAPI.methods,selection:this.Editor.SelectionAPI.methods,styles:this.Editor.StylesAPI.classes,toolbar:this.Editor.ToolbarAPI.methods,inlineToolbar:this.Editor.InlineToolbarAPI.methods,tooltip:this.Editor.TooltipAPI.methods,i18n:this.Editor.I18nAPI.methods,readOnly:this.Editor.ReadOnlyAPI.methods,ui:this.Editor.UiAPI.methods}}getMethodsForTool(e,t){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(e,t)})}}class Wa extends U{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}}class Ya extends U{get methods(){return{on:(e,t,o,i)=>this.on(e,t,o,i),off:(e,t,o,i)=>this.off(e,t,o,i),offById:e=>this.offById(e)}}on(e,t,o,i){return this.listeners.on(e,t,o,i)}off(e,t,o,i){this.listeners.off(e,t,o,i)}offById(e){this.listeners.offById(e)}}var os={exports:{}};(function(n,e){(function(t,o){n.exports=o()})(window,function(){return(function(t){var o={};function i(s){if(o[s])return o[s].exports;var l=o[s]={i:s,l:!1,exports:{}};return t[s].call(l.exports,l,l.exports,i),l.l=!0,l.exports}return i.m=t,i.c=o,i.d=function(s,l,d){i.o(s,l)||Object.defineProperty(s,l,{enumerable:!0,get:d})},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,l){if(1&l&&(s=i(s)),8&l||4&l&&typeof s=="object"&&s&&s.__esModule)return s;var d=Object.create(null);if(i.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:s}),2&l&&typeof s!="string")for(var u in s)i.d(d,u,(function(p){return s[p]}).bind(null,u));return d},i.n=function(s){var l=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(l,"a",l),l},i.o=function(s,l){return Object.prototype.hasOwnProperty.call(s,l)},i.p="/",i(i.s=0)})([function(t,o,i){i(1),t.exports=(function(){var s=i(6),l="cdx-notify--bounce-in",d=null;return{show:function(u){if(u.message){(function(){if(d)return!0;d=s.getWrapper(),document.body.appendChild(d)})();var p=null,f=u.time||8e3;switch(u.type){case"confirm":p=s.confirm(u);break;case"prompt":p=s.prompt(u);break;default:p=s.alert(u),window.setTimeout(function(){p.remove()},f)}d.appendChild(p),p.classList.add(l)}}}})()},function(t,o,i){var s=i(2);typeof s=="string"&&(s=[[t.i,s,""]]);var l={hmr:!0,transform:void 0,insertInto:void 0};i(4)(s,l),s.locals&&(t.exports=s.locals)},function(t,o,i){(t.exports=i(3)(!1)).push([t.i,`.cdx-notify--error{background:#fffbfb!important}.cdx-notify--error::before{background:#fb5d5d!important}.cdx-notify__input{max-width:130px;padding:5px 10px;background:#f7f7f7;border:0;border-radius:3px;font-size:13px;color:#656b7c;outline:0}.cdx-notify__input:-ms-input-placeholder{color:#656b7c}.cdx-notify__input::placeholder{color:#656b7c}.cdx-notify__input:focus:-ms-input-placeholder{color:rgba(101,107,124,.3)}.cdx-notify__input:focus::placeholder{color:rgba(101,107,124,.3)}.cdx-notify__button{border:none;border-radius:3px;font-size:13px;padding:5px 10px;cursor:pointer}.cdx-notify__button:last-child{margin-left:10px}.cdx-notify__button--cancel{background:#f2f5f7;box-shadow:0 2px 1px 0 rgba(16,19,29,0);color:#656b7c}.cdx-notify__button--cancel:hover{background:#eee}.cdx-notify__button--confirm{background:#34c992;box-shadow:0 1px 1px 0 rgba(18,49,35,.05);color:#fff}.cdx-notify__button--confirm:hover{background:#33b082}.cdx-notify__btns-wrapper{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;margin-top:5px}.cdx-notify__cross{position:absolute;top:5px;right:5px;width:10px;height:10px;padding:5px;opacity:.54;cursor:pointer}.cdx-notify__cross::after,.cdx-notify__cross::before{content:'';position:absolute;left:9px;top:5px;height:12px;width:2px;background:#575d67}.cdx-notify__cross::before{transform:rotate(-45deg)}.cdx-notify__cross::after{transform:rotate(45deg)}.cdx-notify__cross:hover{opacity:1}.cdx-notifies{position:fixed;z-index:2;bottom:20px;left:20px;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen,Ubuntu,Cantarell,"Fira Sans","Droid Sans","Helvetica Neue",sans-serif}.cdx-notify{position:relative;width:220px;margin-top:15px;padding:13px 16px;background:#fff;box-shadow:0 11px 17px 0 rgba(23,32,61,.13);border-radius:5px;font-size:14px;line-height:1.4em;word-wrap:break-word}.cdx-notify::before{content:'';position:absolute;display:block;top:0;left:0;width:3px;height:calc(100% - 6px);margin:3px;border-radius:5px;background:0 0}@keyframes bounceIn{0%{opacity:0;transform:scale(.3)}50%{opacity:1;transform:scale(1.05)}70%{transform:scale(.9)}100%{transform:scale(1)}}.cdx-notify--bounce-in{animation-name:bounceIn;animation-duration:.6s;animation-iteration-count:1}.cdx-notify--success{background:#fafffe!important}.cdx-notify--success::before{background:#41ffb1!important}`,""])},function(t,o){t.exports=function(i){var s=[];return s.toString=function(){return this.map(function(l){var d=(function(u,p){var f=u[1]||"",g=u[3];if(!g)return f;if(p&&typeof btoa=="function"){var w=(k=g,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(k))))+" */"),y=g.sources.map(function(T){return"/*# sourceURL="+g.sourceRoot+T+" */"});return[f].concat(y).concat([w]).join(`
11
+ `)}var k;return[f].join(`
12
+ `)})(l,i);return l[2]?"@media "+l[2]+"{"+d+"}":d}).join("")},s.i=function(l,d){typeof l=="string"&&(l=[[null,l,""]]);for(var u={},p=0;p<this.length;p++){var f=this[p][0];typeof f=="number"&&(u[f]=!0)}for(p=0;p<l.length;p++){var g=l[p];typeof g[0]=="number"&&u[g[0]]||(d&&!g[2]?g[2]=d:d&&(g[2]="("+g[2]+") and ("+d+")"),s.push(g))}},s}},function(t,o,i){var s,l,d={},u=(s=function(){return window&&document&&document.all&&!window.atob},function(){return l===void 0&&(l=s.apply(this,arguments)),l}),p=(function(I){var B={};return function(L){if(typeof L=="function")return L();if(B[L]===void 0){var H=(function($){return document.querySelector($)}).call(this,L);if(window.HTMLIFrameElement&&H instanceof window.HTMLIFrameElement)try{H=H.contentDocument.head}catch{H=null}B[L]=H}return B[L]}})(),f=null,g=0,w=[],y=i(5);function k(I,B){for(var L=0;L<I.length;L++){var H=I[L],$=d[H.id];if($){$.refs++;for(var m=0;m<$.parts.length;m++)$.parts[m](H.parts[m]);for(;m<H.parts.length;m++)$.parts.push(K(H.parts[m],B))}else{var Y=[];for(m=0;m<H.parts.length;m++)Y.push(K(H.parts[m],B));d[H.id]={id:H.id,refs:1,parts:Y}}}}function T(I,B){for(var L=[],H={},$=0;$<I.length;$++){var m=I[$],Y=B.base?m[0]+B.base:m[0],O={css:m[1],media:m[2],sourceMap:m[3]};H[Y]?H[Y].parts.push(O):L.push(H[Y]={id:Y,parts:[O]})}return L}function P(I,B){var L=p(I.insertInto);if(!L)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var H=w[w.length-1];if(I.insertAt==="top")H?H.nextSibling?L.insertBefore(B,H.nextSibling):L.appendChild(B):L.insertBefore(B,L.firstChild),w.push(B);else if(I.insertAt==="bottom")L.appendChild(B);else{if(typeof I.insertAt!="object"||!I.insertAt.before)throw new Error(`[Style Loader]
13
+
14
+ Invalid value for parameter 'insertAt' ('options.insertAt') found.
15
+ Must be 'top', 'bottom', or Object.
16
+ (https://github.com/webpack-contrib/style-loader#insertat)
17
+ `);var $=p(I.insertInto+" "+I.insertAt.before);L.insertBefore(B,$)}}function j(I){if(I.parentNode===null)return!1;I.parentNode.removeChild(I);var B=w.indexOf(I);B>=0&&w.splice(B,1)}function S(I){var B=document.createElement("style");return I.attrs.type===void 0&&(I.attrs.type="text/css"),J(B,I.attrs),P(I,B),B}function J(I,B){Object.keys(B).forEach(function(L){I.setAttribute(L,B[L])})}function K(I,B){var L,H,$,m;if(B.transform&&I.css){if(!(m=B.transform(I.css)))return function(){};I.css=m}if(B.singleton){var Y=g++;L=f||(f=S(B)),H=ye.bind(null,L,Y,!1),$=ye.bind(null,L,Y,!0)}else I.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(L=(function(O){var oe=document.createElement("link");return O.attrs.type===void 0&&(O.attrs.type="text/css"),O.attrs.rel="stylesheet",J(oe,O.attrs),P(O,oe),oe})(B),H=(function(O,oe,V){var C=V.css,X=V.sourceMap,ie=oe.convertToAbsoluteUrls===void 0&&X;(oe.convertToAbsoluteUrls||ie)&&(C=y(C)),X&&(C+=`
18
+ /*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(X))))+" */");var W=new Blob([C],{type:"text/css"}),ee=O.href;O.href=URL.createObjectURL(W),ee&&URL.revokeObjectURL(ee)}).bind(null,L,B),$=function(){j(L),L.href&&URL.revokeObjectURL(L.href)}):(L=S(B),H=(function(O,oe){var V=oe.css,C=oe.media;if(C&&O.setAttribute("media",C),O.styleSheet)O.styleSheet.cssText=V;else{for(;O.firstChild;)O.removeChild(O.firstChild);O.appendChild(document.createTextNode(V))}}).bind(null,L),$=function(){j(L)});return H(I),function(O){if(O){if(O.css===I.css&&O.media===I.media&&O.sourceMap===I.sourceMap)return;H(I=O)}else $()}}t.exports=function(I,B){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(B=B||{}).attrs=typeof B.attrs=="object"?B.attrs:{},B.singleton||typeof B.singleton=="boolean"||(B.singleton=u()),B.insertInto||(B.insertInto="head"),B.insertAt||(B.insertAt="bottom");var L=T(I,B);return k(L,B),function(H){for(var $=[],m=0;m<L.length;m++){var Y=L[m];(O=d[Y.id]).refs--,$.push(O)}for(H&&k(T(H,B),B),m=0;m<$.length;m++){var O;if((O=$[m]).refs===0){for(var oe=0;oe<O.parts.length;oe++)O.parts[oe]();delete d[O.id]}}}};var Q,ce=(Q=[],function(I,B){return Q[I]=B,Q.filter(Boolean).join(`
19
+ `)});function ye(I,B,L,H){var $=L?"":H.css;if(I.styleSheet)I.styleSheet.cssText=ce(B,$);else{var m=document.createTextNode($),Y=I.childNodes;Y[B]&&I.removeChild(Y[B]),Y.length?I.insertBefore(m,Y[B]):I.appendChild(m)}}},function(t,o){t.exports=function(i){var s=typeof window<"u"&&window.location;if(!s)throw new Error("fixUrls requires window.location");if(!i||typeof i!="string")return i;var l=s.protocol+"//"+s.host,d=l+s.pathname.replace(/\/[^\/]*$/,"/");return i.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(u,p){var f,g=p.trim().replace(/^"(.*)"$/,function(w,y){return y}).replace(/^'(.*)'$/,function(w,y){return y});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(g)?u:(f=g.indexOf("//")===0?g:g.indexOf("/")===0?l+g:d+g.replace(/^\.\//,""),"url("+JSON.stringify(f)+")")})}},function(t,o,i){var s,l,d,u,p,f,g,w,y;t.exports=(s="cdx-notifies",l="cdx-notify",d="cdx-notify__cross",u="cdx-notify__button--confirm",p="cdx-notify__button--cancel",f="cdx-notify__input",g="cdx-notify__button",w="cdx-notify__btns-wrapper",{alert:y=function(k){var T=document.createElement("DIV"),P=document.createElement("DIV"),j=k.message,S=k.style;return T.classList.add(l),S&&T.classList.add(l+"--"+S),T.innerHTML=j,P.classList.add(d),P.addEventListener("click",T.remove.bind(T)),T.appendChild(P),T},confirm:function(k){var T=y(k),P=document.createElement("div"),j=document.createElement("button"),S=document.createElement("button"),J=T.querySelector("."+d),K=k.cancelHandler,Q=k.okHandler;return P.classList.add(w),j.innerHTML=k.okText||"Confirm",S.innerHTML=k.cancelText||"Cancel",j.classList.add(g),S.classList.add(g),j.classList.add(u),S.classList.add(p),K&&typeof K=="function"&&(S.addEventListener("click",K),J.addEventListener("click",K)),Q&&typeof Q=="function"&&j.addEventListener("click",Q),j.addEventListener("click",T.remove.bind(T)),S.addEventListener("click",T.remove.bind(T)),P.appendChild(j),P.appendChild(S),T.appendChild(P),T},prompt:function(k){var T=y(k),P=document.createElement("div"),j=document.createElement("button"),S=document.createElement("input"),J=T.querySelector("."+d),K=k.cancelHandler,Q=k.okHandler;return P.classList.add(w),j.innerHTML=k.okText||"Ok",j.classList.add(g),j.classList.add(u),S.classList.add(f),k.placeholder&&S.setAttribute("placeholder",k.placeholder),k.default&&(S.value=k.default),k.inputType&&(S.type=k.inputType),K&&typeof K=="function"&&J.addEventListener("click",K),Q&&typeof Q=="function"&&j.addEventListener("click",function(){Q(S.value)}),j.addEventListener("click",T.remove.bind(T)),P.appendChild(S),P.appendChild(j),T.appendChild(P),T},getWrapper:function(){var k=document.createElement("DIV");return k.classList.add(s),k}})}])})})(os);var Va=os.exports;const Ka=Jt(Va);class Xa{show(e){Ka.show(e)}}class Za extends U{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.notifier=new Xa}get methods(){return{show:e=>this.show(e)}}show(e){return this.notifier.show(e)}}class Ga extends U{get methods(){const e=()=>this.isEnabled;return{toggle:t=>this.toggle(t),get isEnabled(){return e()}}}toggle(e){return this.Editor.ReadOnly.toggle(e)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}}var ns={exports:{}};(function(n,e){(function(t,o){n.exports=o()})(Et,function(){function t(g){var w=g.tags,y=Object.keys(w),k=y.map(function(T){return typeof w[T]}).every(function(T){return T==="object"||T==="boolean"||T==="function"});if(!k)throw new Error("The configuration was invalid");this.config=g}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function i(g){return o.indexOf(g.nodeName)!==-1}var s=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function l(g){return s.indexOf(g.nodeName)!==-1}t.prototype.clean=function(g){const w=document.implementation.createHTMLDocument(),y=w.createElement("div");return y.innerHTML=g,this._sanitize(w,y),y.innerHTML},t.prototype._sanitize=function(g,w){var y=d(g,w),k=y.firstChild();if(k)do{if(k.nodeType===Node.TEXT_NODE)if(k.data.trim()===""&&(k.previousElementSibling&&i(k.previousElementSibling)||k.nextElementSibling&&i(k.nextElementSibling))){w.removeChild(k),this._sanitize(g,w);break}else continue;if(k.nodeType===Node.COMMENT_NODE){w.removeChild(k),this._sanitize(g,w);break}var T=l(k),P;T&&(P=Array.prototype.some.call(k.childNodes,i));var j=!!w.parentNode,S=i(w)&&i(k)&&j,J=k.nodeName.toLowerCase(),K=u(this.config,J,k),Q=T&&P;if(Q||p(k,K)||!this.config.keepNestedBlockElements&&S){if(!(k.nodeName==="SCRIPT"||k.nodeName==="STYLE"))for(;k.childNodes.length>0;)w.insertBefore(k.childNodes[0],k);w.removeChild(k),this._sanitize(g,w);break}for(var ce=0;ce<k.attributes.length;ce+=1){var ye=k.attributes[ce];f(ye,K,k)&&(k.removeAttribute(ye.name),ce=ce-1)}this._sanitize(g,k)}while(k=y.nextSibling())};function d(g,w){return g.createTreeWalker(w,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function u(g,w,y){return typeof g.tags[w]=="function"?g.tags[w](y):g.tags[w]}function p(g,w){return typeof w>"u"?!0:typeof w=="boolean"?!w:!1}function f(g,w,y){var k=g.name.toLowerCase();return w===!0?!1:typeof w[k]=="function"?!w[k](g.value,y):typeof w[k]>"u"||w[k]===!1?!0:typeof w[k]=="string"?w[k]!==g.value:!1}return t})})(ns);var Ja=ns.exports;const Qa=Jt(Ja);function Uo(n,e){return n.map(t=>{const o=G(e)?e(t.tool):e;return Ee(o)||(t.data=$o(t.data,o)),t})}function Oe(n,e={}){const t={tags:e};return new Qa(t).clean(n)}function $o(n,e){return Array.isArray(n)?el(n,e):le(n)?tl(n,e):Pe(n)?ol(n,e):n}function el(n,e){return n.map(t=>$o(t,e))}function tl(n,e){const t={};for(const o in n){if(!Object.prototype.hasOwnProperty.call(n,o))continue;const i=n[o],s=nl(e[o])?e[o]:e;t[o]=$o(i,s)}return t}function ol(n,e){return le(e)?Oe(n,e):e===!1?Oe(n,{}):n}function nl(n){return le(n)||xa(n)||G(n)}class il extends U{get methods(){return{clean:(e,t)=>this.clean(e,t)}}clean(e,t){return Oe(e,t)}}class sl extends U{get methods(){return{save:()=>this.save()}}save(){const e="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(Ce(e,"warn"),Promise.reject(new Error(e))):this.Editor.Saver.save()}}class rl extends U{constructor(){super(...arguments),this.selectionUtils=new M}get methods(){return{findParentTag:(e,t)=>this.findParentTag(e,t),expandToTag:e=>this.expandToTag(e),save:()=>this.selectionUtils.save(),restore:()=>this.selectionUtils.restore(),setFakeBackground:()=>this.selectionUtils.setFakeBackground(),removeFakeBackground:()=>this.selectionUtils.removeFakeBackground()}}findParentTag(e,t){return this.selectionUtils.findParentTag(e,t)}expandToTag(e){this.selectionUtils.expandToTag(e)}}class al extends U{get methods(){return{getBlockTools:()=>Array.from(this.Editor.Tools.blockTools.values())}}}class ll extends U{get classes(){return{block:"cdx-block",inlineToolButton:"ce-inline-tool",inlineToolButtonActive:"ce-inline-tool--active",input:"cdx-input",loader:"cdx-loader",button:"cdx-button",settingsButton:"cdx-settings-button",settingsButtonActive:"cdx-settings-button--active"}}}class cl extends U{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:e=>this.toggleBlockSettings(e),toggleToolbox:e=>this.toggleToolbox(e)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(e){if(this.Editor.BlockManager.currentBlockIndex===-1){Ce("Could't toggle the Toolbar because there is no block selected ","warn");return}e??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(e){if(this.Editor.BlockManager.currentBlockIndex===-1){Ce("Could't toggle the Toolbox because there is no block selected ","warn");return}e??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}}var is={exports:{}};/*!
20
+ * CodeX.Tooltips
21
+ *
22
+ * @version 1.0.5
23
+ *
24
+ * @licence MIT
25
+ * @author CodeX <https://codex.so>
26
+ *
27
+ *
28
+ */(function(n,e){(function(t,o){n.exports=o()})(window,function(){return(function(t){var o={};function i(s){if(o[s])return o[s].exports;var l=o[s]={i:s,l:!1,exports:{}};return t[s].call(l.exports,l,l.exports,i),l.l=!0,l.exports}return i.m=t,i.c=o,i.d=function(s,l,d){i.o(s,l)||Object.defineProperty(s,l,{enumerable:!0,get:d})},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,l){if(1&l&&(s=i(s)),8&l||4&l&&typeof s=="object"&&s&&s.__esModule)return s;var d=Object.create(null);if(i.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:s}),2&l&&typeof s!="string")for(var u in s)i.d(d,u,(function(p){return s[p]}).bind(null,u));return d},i.n=function(s){var l=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(l,"a",l),l},i.o=function(s,l){return Object.prototype.hasOwnProperty.call(s,l)},i.p="",i(i.s=0)})([function(t,o,i){t.exports=i(1)},function(t,o,i){i.r(o),i.d(o,"default",function(){return s});class s{constructor(){this.nodes={wrapper:null,content:null},this.showed=!1,this.offsetTop=10,this.offsetLeft=10,this.offsetRight=10,this.hidingDelay=0,this.handleWindowScroll=()=>{this.showed&&this.hide(!0)},this.loadStyles(),this.prepare(),window.addEventListener("scroll",this.handleWindowScroll,{passive:!0})}get CSS(){return{tooltip:"ct",tooltipContent:"ct__content",tooltipShown:"ct--shown",placement:{left:"ct--left",bottom:"ct--bottom",right:"ct--right",top:"ct--top"}}}show(d,u,p){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);const f=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},p);if(f.hidingDelay&&(this.hidingDelay=f.hidingDelay),this.nodes.content.innerHTML="",typeof u=="string")this.nodes.content.appendChild(document.createTextNode(u));else{if(!(u instanceof Node))throw Error("[CodeX Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof u+" given.");this.nodes.content.appendChild(u)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),f.placement){case"top":this.placeTop(d,f);break;case"left":this.placeLeft(d,f);break;case"right":this.placeRight(d,f);break;case"bottom":default:this.placeBottom(d,f)}f&&f.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},f.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(d=!1){if(this.hidingDelay&&!d)return this.hidingTimeout&&clearTimeout(this.hidingTimeout),void(this.hidingTimeout=setTimeout(()=>{this.hide(!0)},this.hidingDelay));this.nodes.wrapper.classList.remove(this.CSS.tooltipShown),this.showed=!1,this.showingTimeout&&clearTimeout(this.showingTimeout)}onHover(d,u,p){d.addEventListener("mouseenter",()=>{this.show(d,u,p)}),d.addEventListener("mouseleave",()=>{this.hide()})}destroy(){this.nodes.wrapper.remove(),window.removeEventListener("scroll",this.handleWindowScroll)}prepare(){this.nodes.wrapper=this.make("div",this.CSS.tooltip),this.nodes.content=this.make("div",this.CSS.tooltipContent),this.append(this.nodes.wrapper,this.nodes.content),this.append(document.body,this.nodes.wrapper)}loadStyles(){const d="codex-tooltips-style";if(document.getElementById(d))return;const u=i(2),p=this.make("style",null,{textContent:u.toString(),id:d});this.prepend(document.head,p)}placeBottom(d,u){const p=d.getBoundingClientRect(),f=p.left+d.clientWidth/2-this.nodes.wrapper.offsetWidth/2,g=p.bottom+window.pageYOffset+this.offsetTop+u.marginTop;this.applyPlacement("bottom",f,g)}placeTop(d,u){const p=d.getBoundingClientRect(),f=p.left+d.clientWidth/2-this.nodes.wrapper.offsetWidth/2,g=p.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",f,g)}placeLeft(d,u){const p=d.getBoundingClientRect(),f=p.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-u.marginLeft,g=p.top+window.pageYOffset+d.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",f,g)}placeRight(d,u){const p=d.getBoundingClientRect(),f=p.right+this.offsetRight+u.marginRight,g=p.top+window.pageYOffset+d.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",f,g)}applyPlacement(d,u,p){this.nodes.wrapper.classList.add(this.CSS.placement[d]),this.nodes.wrapper.style.left=u+"px",this.nodes.wrapper.style.top=p+"px"}make(d,u=null,p={}){const f=document.createElement(d);Array.isArray(u)?f.classList.add(...u):u&&f.classList.add(u);for(const g in p)p.hasOwnProperty(g)&&(f[g]=p[g]);return f}append(d,u){Array.isArray(u)?u.forEach(p=>d.appendChild(p)):d.appendChild(u)}prepend(d,u){Array.isArray(u)?(u=u.reverse()).forEach(p=>d.prepend(p)):d.prepend(u)}}},function(t,o){t.exports=`.ct{z-index:999;opacity:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none;-webkit-transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1);transition:opacity 50ms ease-in,transform 70ms cubic-bezier(.215,.61,.355,1),-webkit-transform 70ms cubic-bezier(.215,.61,.355,1);will-change:opacity,top,left;-webkit-box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);box-shadow:0 8px 12px 0 rgba(29,32,43,.17),0 4px 5px -3px rgba(5,6,12,.49);border-radius:9px}.ct,.ct:before{position:absolute;top:0;left:0}.ct:before{content:"";bottom:0;right:0;background-color:#1d202b;z-index:-1;border-radius:4px}@supports(-webkit-mask-box-image:url("")){.ct:before{border-radius:0;-webkit-mask-box-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M10.71 0h2.58c3.02 0 4.64.42 6.1 1.2a8.18 8.18 0 013.4 3.4C23.6 6.07 24 7.7 24 10.71v2.58c0 3.02-.42 4.64-1.2 6.1a8.18 8.18 0 01-3.4 3.4c-1.47.8-3.1 1.21-6.11 1.21H10.7c-3.02 0-4.64-.42-6.1-1.2a8.18 8.18 0 01-3.4-3.4C.4 17.93 0 16.3 0 13.29V10.7c0-3.02.42-4.64 1.2-6.1a8.18 8.18 0 013.4-3.4C6.07.4 7.7 0 10.71 0z"/></svg>') 48% 41% 37.9% 53.3%}}@media (--mobile){.ct{display:none}}.ct__content{padding:6px 10px;color:#cdd1e0;font-size:12px;text-align:center;letter-spacing:.02em;line-height:1em}.ct:after{content:"";width:8px;height:8px;position:absolute;background-color:#1d202b;z-index:-1}.ct--bottom{-webkit-transform:translateY(5px);transform:translateY(5px)}.ct--bottom:after{top:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--top{-webkit-transform:translateY(-5px);transform:translateY(-5px)}.ct--top:after{top:auto;bottom:-3px;left:50%;-webkit-transform:translateX(-50%) rotate(-45deg);transform:translateX(-50%) rotate(-45deg)}.ct--left{-webkit-transform:translateX(-5px);transform:translateX(-5px)}.ct--left:after{top:50%;left:auto;right:0;-webkit-transform:translate(41.6%,-50%) rotate(-45deg);transform:translate(41.6%,-50%) rotate(-45deg)}.ct--right{-webkit-transform:translateX(5px);transform:translateX(5px)}.ct--right:after{top:50%;left:0;-webkit-transform:translate(-41.6%,-50%) rotate(-45deg);transform:translate(-41.6%,-50%) rotate(-45deg)}.ct--shown{opacity:1;-webkit-transform:none;transform:none}`}]).default})})(is);var dl=is.exports;const ul=Jt(dl);let Be=null;function qo(){Be||(Be=new ul)}function hl(n,e,t){qo(),Be==null||Be.show(n,e,t)}function Vt(n=!1){qo(),Be==null||Be.hide(n)}function Kt(n,e,t){qo(),Be==null||Be.onHover(n,e,t)}function pl(){Be==null||Be.destroy(),Be=null}class fl extends U{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t})}get methods(){return{show:(e,t,o)=>this.show(e,t,o),hide:()=>this.hide(),onHover:(e,t,o)=>this.onHover(e,t,o)}}show(e,t,o){hl(e,t,o)}hide(){Vt()}onHover(e,t,o){Kt(e,t,o)}}class gl extends U{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}}function ss(n,e){const t={};return Object.entries(n).forEach(([o,i])=>{if(le(i)){const s=e?`${e}.${o}`:o;Object.values(i).every(l=>Pe(l))?t[o]=s:t[o]=ss(i,s);return}t[o]=i}),t}const ke=ss(Vi);function ml(n,e){const t={};return Object.keys(n).forEach(o=>{const i=e[o];i!==void 0?t[i]=n[o]:t[o]=n[o]}),t}const rs=class yt{constructor(e,t){this.cursor=-1,this.items=[],this.items=e||[],this.focusedCssClass=t}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(e){e<this.items.length&&e>=-1&&(this.dropCursor(),this.cursor=e,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(e){this.items=e}next(){this.cursor=this.leafNodesAndReturnIndex(yt.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(yt.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(e){if(this.items.length===0)return this.cursor;let t=this.cursor;return t===-1?t=e===yt.directions.RIGHT?-1:0:this.items[t].classList.remove(this.focusedCssClass),e===yt.directions.RIGHT?t=(t+1)%this.items.length:t=(this.items.length+t-1)%this.items.length,v.canSetCaret(this.items[t])&&qt(()=>M.setCursor(this.items[t]),50)(),this.items[t].classList.add(this.focusedCssClass),t}};rs.directions={RIGHT:"right",LEFT:"left"};let wt=rs;class Xe{constructor(e){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=t=>{if(!(!this.isEventReadyForHandling(t)||t.shiftKey===!0))switch(Xe.usedKeys.includes(t.keyCode)&&t.preventDefault(),t.keyCode){case _.TAB:this.handleTabPress(t);break;case _.LEFT:case _.UP:this.flipLeft();break;case _.RIGHT:case _.DOWN:this.flipRight();break;case _.ENTER:this.handleEnterPress(t);break}},this.iterator=new wt(e.items,e.focusedItemClass),this.activateCallback=e.activateCallback,this.allowedKeys=e.allowedKeys||Xe.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[_.TAB,_.LEFT,_.RIGHT,_.ENTER,_.UP,_.DOWN]}activate(e,t){this.activated=!0,e&&this.iterator.setItems(e),t!==void 0&&this.iterator.setCursor(t),document.addEventListener("keydown",this.onKeyDown,!0)}deactivate(){this.activated=!1,this.dropCursor(),document.removeEventListener("keydown",this.onKeyDown)}focusFirst(){this.dropCursor(),this.flipRight()}flipLeft(){this.iterator.previous(),this.flipCallback()}flipRight(){this.iterator.next(),this.flipCallback()}hasFocus(){return!!this.iterator.currentItem}onFlip(e){this.flipCallbacks.push(e)}removeOnFlip(e){this.flipCallbacks=this.flipCallbacks.filter(t=>t!==e)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(e){return this.activated&&this.allowedKeys.includes(e.keyCode)}handleTabPress(e){switch(e.shiftKey?wt.directions.LEFT:wt.directions.RIGHT){case wt.directions.RIGHT:this.flipRight();break;case wt.directions.LEFT:this.flipLeft();break}}handleEnterPress(e){this.activated&&(this.iterator.currentItem&&(e.stopPropagation(),e.preventDefault(),this.iterator.currentItem.click()),G(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(e=>e())}}const bl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9 12L9 7.1C9 7.04477 9.04477 7 9.1 7H10.4C11.5 7 14 7.1 14 9.5C14 9.5 14 12 11 12M9 12V16.8C9 16.9105 9.08954 17 9.2 17H12.5C14 17 15 16 15 14.5C15 11.7046 11 12 11 12M9 12H11"/></svg>',wl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 10L11.8586 14.8586C11.9367 14.9367 12.0633 14.9367 12.1414 14.8586L17 10"/></svg>',vl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.5 17.5L9.64142 12.6414C9.56331 12.5633 9.56331 12.4367 9.64142 12.3586L14.5 7.5"/></svg>',kl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M9.58284 17.5L14.4414 12.6414C14.5195 12.5633 14.5195 12.4367 14.4414 12.3586L9.58284 7.5"/></svg>',yl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7 15L11.8586 10.1414C11.9367 10.0633 12.0633 10.0633 12.1414 10.1414L17 15"/></svg>',xl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',Cl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2"/></svg>',El='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M13.34 10C12.4223 12.7337 11 17 11 17"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.21 7H14.2"/></svg>',Si='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M7.69998 12.6L7.67896 12.62C6.53993 13.7048 6.52012 15.5155 7.63516 16.625V16.625C8.72293 17.7073 10.4799 17.7102 11.5712 16.6314L13.0263 15.193C14.0703 14.1609 14.2141 12.525 13.3662 11.3266L13.22 11.12"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16.22 11.12L16.3564 10.9805C17.2895 10.0265 17.3478 8.5207 16.4914 7.49733V7.49733C15.5691 6.39509 13.9269 6.25143 12.8271 7.17675L11.3901 8.38588C10.0935 9.47674 9.95706 11.4241 11.0888 12.6852L11.12 12.72"/></svg>',Tl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 7.29999H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 7.29999H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.30999 12H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 12H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.40999 16.7H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 16.7H14.59"/></svg>',Bl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',as='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M11.5 17.5L5 11M5 11V15.5M5 11H9.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12.5 6.5L19 13M19 13V8.5M19 13H14.5"/></svg>',Sl='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><circle cx="10.5" cy="10.5" r="5.5" stroke="currentColor" stroke-width="2"/><line x1="15.4142" x2="19" y1="15" y2="18.5858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',Ol='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M15.7795 11.5C15.7795 11.5 16.053 11.1962 16.5497 10.6722C17.4442 9.72856 17.4701 8.2475 16.5781 7.30145V7.30145C15.6482 6.31522 14.0873 6.29227 13.1288 7.25073L11.8796 8.49999"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8.24517 12.3883C8.24517 12.3883 7.97171 12.6922 7.47504 13.2161C6.58051 14.1598 6.55467 15.6408 7.44666 16.5869V16.5869C8.37653 17.5731 9.93744 17.5961 10.8959 16.6376L12.1452 15.3883"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M17.7802 15.1032L16.597 14.9422C16.0109 14.8624 15.4841 15.3059 15.4627 15.8969L15.4199 17.0818"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6.39064 9.03238L7.58432 9.06668C8.17551 9.08366 8.6522 8.58665 8.61056 7.99669L8.5271 6.81397"/><line x1="12.1142" x2="11.7" y1="12.2" y2="11.7858" stroke="currentColor" stroke-linecap="round" stroke-width="2"/></svg>',Il='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><line x1="12" x2="12" y1="9" y2="12" stroke="currentColor" stroke-linecap="round" stroke-width="2"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 15.02V15.01"/></svg>',Al="__",Ml="--";function ze(n){return(e,t)=>[[n,e].filter(o=>!!o).join(Al),t].filter(o=>!!o).join(Ml)}const vt=ze("ce-hint"),kt={root:vt(),alignedStart:vt(null,"align-left"),alignedCenter:vt(null,"align-center"),title:vt("title"),description:vt("description")};class Ll{constructor(e){this.nodes={root:v.make("div",[kt.root,e.alignment==="center"?kt.alignedCenter:kt.alignedStart]),title:v.make("div",kt.title,{textContent:e.title})},this.nodes.root.appendChild(this.nodes.title),e.description!==void 0&&(this.nodes.description=v.make("div",kt.description,{textContent:e.description}),this.nodes.root.appendChild(this.nodes.description))}getElement(){return this.nodes.root}}class Wo{constructor(e){this.params=e}get name(){if(this.params!==void 0&&"name"in this.params)return this.params.name}destroy(){Vt()}onChildrenOpen(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onOpen)=="function"&&this.params.children.onOpen()}onChildrenClose(){var e;this.params!==void 0&&"children"in this.params&&typeof((e=this.params.children)==null?void 0:e.onClose)=="function"&&this.params.children.onClose()}handleClick(){var e,t;this.params!==void 0&&"onActivate"in this.params&&((t=(e=this.params).onActivate)==null||t.call(e,this.params))}addHint(e,t){const o=new Ll(t);Kt(e,o.getElement(),{placement:t.position,hidingDelay:100})}get children(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.items)!==void 0?this.params.children.items:[]}get hasChildren(){return this.children.length>0}get isChildrenOpen(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.isOpen)===!0}get isChildrenFlippable(){var e;return!(this.params===void 0||!("children"in this.params)||((e=this.params.children)==null?void 0:e.isFlippable)===!1)}get isChildrenSearchable(){var e;return this.params!==void 0&&"children"in this.params&&((e=this.params.children)==null?void 0:e.searchable)===!0}get closeOnActivate(){return this.params!==void 0&&"closeOnActivate"in this.params&&this.params.closeOnActivate}get isActive(){return this.params===void 0||!("isActive"in this.params)?!1:typeof this.params.isActive=="function"?this.params.isActive():this.params.isActive===!0}}const we=ze("ce-popover-item"),te={container:we(),active:we(null,"active"),disabled:we(null,"disabled"),focused:we(null,"focused"),hidden:we(null,"hidden"),confirmationState:we(null,"confirmation"),noHover:we(null,"no-hover"),noFocus:we(null,"no-focus"),title:we("title"),secondaryTitle:we("secondary-title"),icon:we("icon"),iconTool:we("icon","tool"),iconChevronRight:we("icon","chevron-right"),wobbleAnimation:ze("wobble")()};class Ye extends Wo{constructor(e,t){super(e),this.params=e,this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(te.noFocus)},this.removeSpecialHoverBehavior=()=>{var o;(o=this.nodes.root)==null||o.classList.remove(te.noHover)},this.onErrorAnimationEnd=()=>{var o,i;(o=this.nodes.icon)==null||o.classList.remove(te.wobbleAnimation),(i=this.nodes.icon)==null||i.removeEventListener("animationend",this.onErrorAnimationEnd)},this.nodes.root=this.make(e,t)}get isDisabled(){return this.params.isDisabled===!0}get toggle(){return this.params.toggle}get title(){return this.params.title}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root===null?!1:this.nodes.root.classList.contains(te.focused)}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled&&this.confirmationState!==null){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(e){var t;(t=this.nodes.root)==null||t.classList.toggle(te.active,e)}toggleHidden(e){var t;(t=this.nodes.root)==null||t.classList.toggle(te.hidden,e)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(e,t){var o,i;const s=(t==null?void 0:t.wrapperTag)||"div",l=v.make(s,te.container,{type:s==="button"?"button":void 0});return e.name&&(l.dataset.itemName=e.name),this.nodes.icon=v.make("div",[te.icon,te.iconTool],{innerHTML:e.icon||Cl}),l.appendChild(this.nodes.icon),e.title!==void 0&&l.appendChild(v.make("div",te.title,{innerHTML:e.title||""})),e.secondaryLabel&&l.appendChild(v.make("div",te.secondaryTitle,{textContent:e.secondaryLabel})),this.hasChildren&&l.appendChild(v.make("div",[te.icon,te.iconChevronRight],{innerHTML:kl})),this.isActive&&l.classList.add(te.active),e.isDisabled&&l.classList.add(te.disabled),e.hint!==void 0&&((o=t==null?void 0:t.hint)==null?void 0:o.enabled)!==!1&&this.addHint(l,{...e.hint,position:((i=t==null?void 0:t.hint)==null?void 0:i.position)||"right"}),l}enableConfirmationMode(e){if(this.nodes.root===null)return;const t={...this.params,...e,confirmation:"confirmation"in e?e.confirmation:void 0},o=this.make(t);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(te.confirmationState),this.confirmationState=e,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){if(this.nodes.root===null)return;const e=this.make(this.params);this.nodes.root.innerHTML=e.innerHTML,this.nodes.root.classList.remove(te.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){var e,t,o;(e=this.nodes.root)==null||e.classList.add(te.noHover),(t=this.nodes.root)==null||t.classList.add(te.noFocus),(o=this.nodes.root)==null||o.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){var e;this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),(e=this.nodes.root)==null||e.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(e){var t;if(!("confirmation"in e)||e.confirmation===void 0)try{(t=e.onActivate)==null||t.call(e,e),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(e.confirmation)}animateError(){var e,t,o;(e=this.nodes.icon)!=null&&e.classList.contains(te.wobbleAnimation)||((t=this.nodes.icon)==null||t.classList.add(te.wobbleAnimation),(o=this.nodes.icon)==null||o.addEventListener("animationend",this.onErrorAnimationEnd))}}const Eo=ze("ce-popover-item-separator"),To={container:Eo(),line:Eo("line"),hidden:Eo(null,"hidden")};class ls extends Wo{constructor(){super(),this.nodes={root:v.make("div",To.container),line:v.make("div",To.line)},this.nodes.root.appendChild(this.nodes.line)}getElement(){return this.nodes.root}toggleHidden(e){var t;(t=this.nodes.root)==null||t.classList.toggle(To.hidden,e)}}var Ie=(n=>(n.Closed="closed",n.ClosedOnActivate="closed-on-activate",n))(Ie||{});const pe=ze("ce-popover"),ne={popover:pe(),popoverContainer:pe("container"),popoverOpenTop:pe(null,"open-top"),popoverOpenLeft:pe(null,"open-left"),popoverOpened:pe(null,"opened"),search:pe("search"),nothingFoundMessage:pe("nothing-found-message"),nothingFoundMessageDisplayed:pe("nothing-found-message","displayed"),items:pe("items"),overlay:pe("overlay"),overlayHidden:pe("overlay","hidden"),popoverNested:pe(null,"nested"),getPopoverNestedClass:n=>pe(null,`nested-level-${n.toString()}`),popoverInline:pe(null,"inline"),popoverHeader:pe("header")};var at=(n=>(n.NestingLevel="--nesting-level",n.PopoverHeight="--popover-height",n.InlinePopoverWidth="--inline-popover-width",n.TriggerItemLeft="--trigger-item-left",n.TriggerItemTop="--trigger-item-top",n))(at||{});const Oi=ze("ce-popover-item-html"),Ii={root:Oi(),hidden:Oi(null,"hidden")};class Bt extends Wo{constructor(e,t){var o,i;super(e),this.nodes={root:v.make("div",Ii.root)},this.nodes.root.appendChild(e.element),e.name&&(this.nodes.root.dataset.itemName=e.name),e.hint!==void 0&&((o=t==null?void 0:t.hint)==null?void 0:o.enabled)!==!1&&this.addHint(this.nodes.root,{...e.hint,position:((i=t==null?void 0:t.hint)==null?void 0:i.position)||"right"})}getElement(){return this.nodes.root}toggleHidden(e){var t;(t=this.nodes.root)==null||t.classList.toggle(Ii.hidden,e)}getControls(){const e=this.nodes.root.querySelectorAll(`button, ${v.allInputsSelector}`);return Array.from(e)}}class cs extends Ot{constructor(e,t={}){super(),this.params=e,this.itemsRenderParams=t,this.listeners=new It,this.messages={nothingFound:"Nothing found",search:"Search"},this.items=this.buildItems(e.items),e.messages&&(this.messages={...this.messages,...e.messages}),this.nodes={},this.nodes.popoverContainer=v.make("div",[ne.popoverContainer]),this.nodes.nothingFoundMessage=v.make("div",[ne.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popoverContainer.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=v.make("div",[ne.items]),this.items.forEach(o=>{const i=o.getElement();i!==null&&this.nodes.items.appendChild(i)}),this.nodes.popoverContainer.appendChild(this.nodes.items),this.listeners.on(this.nodes.popoverContainer,"click",o=>this.handleClick(o)),this.nodes.popover=v.make("div",[ne.popover,this.params.class]),this.nodes.popover.appendChild(this.nodes.popoverContainer)}get itemsDefault(){return this.items.filter(e=>e instanceof Ye)}getElement(){return this.nodes.popover}show(){this.nodes.popover.classList.add(ne.popoverOpened),this.search!==void 0&&this.search.focus()}hide(){this.nodes.popover.classList.remove(ne.popoverOpened),this.nodes.popover.classList.remove(ne.popoverOpenTop),this.itemsDefault.forEach(e=>e.reset()),this.search!==void 0&&this.search.clear(),this.emit(Ie.Closed)}destroy(){var e;this.items.forEach(t=>t.destroy()),this.nodes.popover.remove(),this.listeners.removeAll(),(e=this.search)==null||e.destroy()}activateItemByName(e){const t=this.items.find(o=>o.name===e);this.handleItemClick(t)}buildItems(e){return e.map(t=>{switch(t.type){case Z.Separator:return new ls;case Z.Html:return new Bt(t,this.itemsRenderParams[Z.Html]);default:return new Ye(t,this.itemsRenderParams[Z.Default])}})}getTargetItem(e){return this.items.filter(t=>t instanceof Ye||t instanceof Bt).find(t=>{const o=t.getElement();return o===null?!1:e.composedPath().includes(o)})}handleItemClick(e){if(!("isDisabled"in e&&e.isDisabled)){if(e.hasChildren){this.showNestedItems(e),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick();return}this.itemsDefault.filter(t=>t!==e).forEach(t=>t.reset()),"handleClick"in e&&typeof e.handleClick=="function"&&e.handleClick(),this.toggleItemActivenessIfNeeded(e),e.closeOnActivate&&(this.hide(),this.emit(Ie.ClosedOnActivate))}}handleClick(e){const t=this.getTargetItem(e);t!==void 0&&this.handleItemClick(t)}toggleItemActivenessIfNeeded(e){if(e instanceof Ye&&(e.toggle===!0&&e.toggleActive(),typeof e.toggle=="string")){const t=this.itemsDefault.filter(o=>o.toggle===e.toggle);if(t.length===1){e.toggleActive();return}t.forEach(o=>{o.toggleActive(o===e)})}}}var Xt=(n=>(n.Search="search",n))(Xt||{});const Bo=ze("cdx-search-field"),So={wrapper:Bo(),icon:Bo("icon"),input:Bo("input")};class _l extends Ot{constructor({items:e,placeholder:t}){super(),this.listeners=new It,this.items=e,this.wrapper=v.make("div",So.wrapper);const o=v.make("div",So.icon,{innerHTML:Sl});this.input=v.make("input",So.input,{placeholder:t,tabIndex:-1}),this.wrapper.appendChild(o),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.emit(Xt.Search,{query:this.searchQuery,items:this.foundItems})})}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.emit(Xt.Search,{query:"",items:this.foundItems})}destroy(){this.listeners.removeAll()}get foundItems(){return this.items.filter(e=>this.checkItem(e))}checkItem(e){var t,o;const i=((t=e.title)==null?void 0:t.toLowerCase())||"",s=(o=this.searchQuery)==null?void 0:o.toLowerCase();return s!==void 0?i.includes(s):!1}}var Pl=Object.defineProperty,Nl=Object.getOwnPropertyDescriptor,Rl=(n,e,t,o)=>{for(var i=Nl(e,t),s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=l(e,t,i)||i);return i&&Pl(e,t,i),i};const ds=class us extends cs{constructor(e,t){super(e,t),this.nestingLevel=0,this.nestedPopoverTriggerItem=null,this.previouslyHoveredItem=null,this.scopeElement=document.body,this.hide=()=>{var o;super.hide(),this.destroyNestedPopoverIfExists(),(o=this.flipper)==null||o.deactivate(),this.previouslyHoveredItem=null},this.onFlip=()=>{const o=this.itemsDefault.find(i=>i.isFocused);o==null||o.onFocus()},this.onSearch=o=>{var i;const s=o.query==="",l=o.items.length===0;this.items.forEach(u=>{let p=!1;u instanceof Ye?p=!o.items.includes(u):(u instanceof ls||u instanceof Bt)&&(p=l||!s),u.toggleHidden(p)}),this.toggleNothingFoundMessage(l);const d=o.query===""?this.flippableElements:o.items.map(u=>u.getElement());(i=this.flipper)!=null&&i.isActivated&&(this.flipper.deactivate(),this.flipper.activate(d))},e.nestingLevel!==void 0&&(this.nestingLevel=e.nestingLevel),this.nestingLevel>0&&this.nodes.popover.classList.add(ne.popoverNested),e.scopeElement!==void 0&&(this.scopeElement=e.scopeElement),this.nodes.popoverContainer!==null&&this.listeners.on(this.nodes.popoverContainer,"mouseover",o=>this.handleHover(o)),e.searchable&&this.addSearch(),e.flippable!==!1&&(this.flipper=new Xe({items:this.flippableElements,focusedItemClass:te.focused,allowedKeys:[_.TAB,_.UP,_.DOWN,_.ENTER]}),this.flipper.onFlip(this.onFlip))}hasFocus(){return this.flipper===void 0?!1:this.flipper.hasFocus()}get scrollTop(){return this.nodes.items===null?0:this.nodes.items.scrollTop}get offsetTop(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetTop}show(){var e;this.nodes.popover.style.setProperty(at.PopoverHeight,this.size.height+"px"),this.shouldOpenBottom||this.nodes.popover.classList.add(ne.popoverOpenTop),this.shouldOpenRight||this.nodes.popover.classList.add(ne.popoverOpenLeft),super.show(),(e=this.flipper)==null||e.activate(this.flippableElements)}destroy(){this.hide(),super.destroy()}showNestedItems(e){this.nestedPopover!==null&&this.nestedPopover!==void 0||(this.nestedPopoverTriggerItem=e,this.showNestedPopoverForItem(e))}handleHover(e){const t=this.getTargetItem(e);t!==void 0&&this.previouslyHoveredItem!==t&&(this.destroyNestedPopoverIfExists(),this.previouslyHoveredItem=t,t.hasChildren&&this.showNestedPopoverForItem(t))}setTriggerItemPosition(e,t){const o=t.getElement(),i=(o?o.offsetTop:0)-this.scrollTop,s=this.offsetTop+i;e.style.setProperty(at.TriggerItemTop,s+"px")}destroyNestedPopoverIfExists(){var e,t;this.nestedPopover===void 0||this.nestedPopover===null||(this.nestedPopover.off(Ie.ClosedOnActivate,this.hide),this.nestedPopover.hide(),this.nestedPopover.destroy(),this.nestedPopover.getElement().remove(),this.nestedPopover=null,(e=this.flipper)==null||e.activate(this.flippableElements),(t=this.nestedPopoverTriggerItem)==null||t.onChildrenClose())}showNestedPopoverForItem(e){var t;this.nestedPopover=new us({searchable:e.isChildrenSearchable,items:e.children,nestingLevel:this.nestingLevel+1,flippable:e.isChildrenFlippable,messages:this.messages}),e.onChildrenOpen(),this.nestedPopover.on(Ie.ClosedOnActivate,this.hide);const o=this.nestedPopover.getElement();return this.nodes.popover.appendChild(o),this.setTriggerItemPosition(o,e),o.style.setProperty(at.NestingLevel,this.nestedPopover.nestingLevel.toString()),this.nestedPopover.show(),(t=this.flipper)==null||t.deactivate(),this.nestedPopover}get shouldOpenBottom(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popoverContainer.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.height,i=e.top+o,s=e.top-o,l=Math.min(window.innerHeight,t.bottom);return s<t.top||i<=l}get shouldOpenRight(){if(this.nodes.popover===void 0||this.nodes.popover===null)return!1;const e=this.nodes.popover.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),o=this.size.width,i=e.right+o,s=e.left-o,l=Math.min(window.innerWidth,t.right);return s<t.left||i<=l}get size(){var e;const t={height:0,width:0};if(this.nodes.popover===null)return t;const o=this.nodes.popover.cloneNode(!0);o.style.visibility="hidden",o.style.position="absolute",o.style.top="-1000px",o.classList.add(ne.popoverOpened),(e=o.querySelector("."+ne.popoverNested))==null||e.remove(),document.body.appendChild(o);const i=o.querySelector("."+ne.popoverContainer);return t.height=i.offsetHeight,t.width=i.offsetWidth,o.remove(),t}get flippableElements(){return this.items.map(e=>{if(e instanceof Ye)return e.getElement();if(e instanceof Bt)return e.getControls()}).flat().filter(e=>e!=null)}addSearch(){this.search=new _l({items:this.itemsDefault,placeholder:this.messages.search}),this.search.on(Xt.Search,this.onSearch);const e=this.search.getElement();e.classList.add(ne.search),this.nodes.popoverContainer.insertBefore(e,this.nodes.popoverContainer.firstChild)}toggleNothingFoundMessage(e){this.nodes.nothingFoundMessage.classList.toggle(ne.nothingFoundMessageDisplayed,e)}};Rl([ct],ds.prototype,"size");let Yo=ds;class Dl extends Yo{constructor(e){const t=!dt();super({...e,class:ne.popoverInline},{[Z.Default]:{wrapperTag:"button",hint:{position:"top",alignment:"center",enabled:t}},[Z.Html]:{hint:{position:"top",alignment:"center",enabled:t}}}),this.items.forEach(o=>{!(o instanceof Ye)&&!(o instanceof Bt)||o.hasChildren&&o.isChildrenOpen&&this.showNestedItems(o)})}get offsetLeft(){return this.nodes.popoverContainer===null?0:this.nodes.popoverContainer.offsetLeft}show(){this.nestingLevel===0&&this.nodes.popover.style.setProperty(at.InlinePopoverWidth,this.size.width+"px"),super.show()}handleHover(){}setTriggerItemPosition(e,t){const o=t.getElement(),i=o?o.offsetLeft:0,s=this.offsetLeft+i;e.style.setProperty(at.TriggerItemLeft,s+"px")}showNestedItems(e){if(this.nestedPopoverTriggerItem===e){this.destroyNestedPopoverIfExists(),this.nestedPopoverTriggerItem=null;return}super.showNestedItems(e)}showNestedPopoverForItem(e){const t=super.showNestedPopoverForItem(e);return t.getElement().classList.add(ne.getPopoverNestedClass(t.nestingLevel)),t}handleItemClick(e){var t;e!==this.nestedPopoverTriggerItem&&((t=this.nestedPopoverTriggerItem)==null||t.handleClick(),super.destroyNestedPopoverIfExists()),super.handleItemClick(e)}}const hs=class xt{constructor(){this.scrollPosition=null}lock(){No?this.lockHard():document.body.classList.add(xt.CSS.scrollLocked)}unlock(){No?this.unlockHard():document.body.classList.remove(xt.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(xt.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(xt.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};hs.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};let jl=hs;const Oo=ze("ce-popover-header"),Io={root:Oo(),text:Oo("text"),backButton:Oo("back-button")};class Hl{constructor({text:e,onBackButtonClick:t}){this.listeners=new It,this.text=e,this.onBackButtonClick=t,this.nodes={root:v.make("div",[Io.root]),backButton:v.make("button",[Io.backButton]),text:v.make("div",[Io.text])},this.nodes.backButton.innerHTML=vl,this.nodes.root.appendChild(this.nodes.backButton),this.listeners.on(this.nodes.backButton,"click",this.onBackButtonClick),this.nodes.text.innerText=this.text,this.nodes.root.appendChild(this.nodes.text)}getElement(){return this.nodes.root}destroy(){this.nodes.root.remove(),this.listeners.destroy()}}class Fl{constructor(){this.history=[]}push(e){this.history.push(e)}pop(){return this.history.pop()}get currentTitle(){return this.history.length===0?"":this.history[this.history.length-1].title}get currentItems(){return this.history.length===0?[]:this.history[this.history.length-1].items}reset(){for(;this.history.length>1;)this.pop()}}class ps extends cs{constructor(e){super(e,{[Z.Default]:{hint:{enabled:!1}},[Z.Html]:{hint:{enabled:!1}}}),this.scrollLocker=new jl,this.history=new Fl,this.isHidden=!0,this.nodes.overlay=v.make("div",[ne.overlay,ne.overlayHidden]),this.nodes.popover.insertBefore(this.nodes.overlay,this.nodes.popover.firstChild),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.history.push({items:e.items})}show(){this.nodes.overlay.classList.remove(ne.overlayHidden),super.show(),this.scrollLocker.lock(),this.isHidden=!1}hide(){this.isHidden||(super.hide(),this.nodes.overlay.classList.add(ne.overlayHidden),this.scrollLocker.unlock(),this.history.reset(),this.isHidden=!0)}destroy(){super.destroy(),this.scrollLocker.unlock()}showNestedItems(e){this.updateItemsAndHeader(e.children,e.title),this.history.push({title:e.title,items:e.children})}updateItemsAndHeader(e,t){if(this.header!==null&&this.header!==void 0&&(this.header.destroy(),this.header=null),t!==void 0){this.header=new Hl({text:t,onBackButtonClick:()=>{this.history.pop(),this.updateItemsAndHeader(this.history.currentItems,this.history.currentTitle)}});const o=this.header.getElement();o!==null&&this.nodes.popoverContainer.insertBefore(o,this.nodes.popoverContainer.firstChild)}this.items.forEach(o=>{var i;return(i=o.getElement())==null?void 0:i.remove()}),this.items=this.buildItems(e),this.items.forEach(o=>{var i;const s=o.getElement();s!==null&&((i=this.nodes.items)==null||i.appendChild(s))})}}class zl extends U{constructor(){super(...arguments),this.opened=!1,this.hasMobileLayoutToggleListener=!1,this.selection=new M,this.popover=null,this.close=()=>{this.opened&&(this.opened=!1,M.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&this.Editor.BlockSelection.unselectBlock(this.Editor.BlockManager.currentBlock),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(Ie.Closed,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null))},this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var e;if(this.popover!==null)return"flipper"in this.popover?(e=this.popover)==null?void 0:e.flipper:void 0}make(){this.nodes.wrapper=v.make("div",[this.CSS.settings]),this.eventsDispatcher.on(Tt,this.close),this.hasMobileLayoutToggleListener=!0}destroy(){this.removeAllNodes(),this.listeners.destroy(),this.hasMobileLayoutToggleListener&&(this.eventsDispatcher.off(Tt,this.close),this.hasMobileLayoutToggleListener=!1)}async open(e=this.Editor.BlockManager.currentBlock){var t;this.opened=!0,this.selection.save(),this.Editor.BlockSelection.selectBlock(e),this.Editor.BlockSelection.clearCache();const{toolTunes:o,commonTunes:i}=e.getTunes();this.eventsDispatcher.emit(this.events.opened);const s=dt()?ps:Yo;this.popover=new s({searchable:!0,items:await this.getTunesItems(e,i,o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:fe.ui(ke.ui.popover,"Nothing found"),search:fe.ui(ke.ui.popover,"Filter")}}),this.popover.on(Ie.Closed,this.onPopoverClose),(t=this.nodes.wrapper)==null||t.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}async getTunesItems(e,t,o){const i=[];o!==void 0&&o.length>0&&(i.push(...o),i.push({type:Z.Separator}));const s=Array.from(this.Editor.Tools.blockTools.values()),l=(await ts(e,s)).reduce((d,u)=>(u.toolbox.forEach(p=>{d.push({icon:p.icon,title:fe.t(ke.toolNames,p.title),name:u.name,closeOnActivate:!0,onActivate:async()=>{const{BlockManager:f,Caret:g,Toolbar:w}=this.Editor,y=await f.convert(e,u.name,p.data);w.close(),g.setToBlock(y,g.positions.END)}})}),d),[]);return l.length>0&&(i.push({icon:as,name:"convert-to",title:fe.ui(ke.ui.popover,"Convert to"),children:{searchable:!0,items:l}}),i.push({type:Z.Separator})),i.push(...t),i.map(d=>this.resolveTuneAliases(d))}resolveTuneAliases(e){if(e.type===Z.Separator||e.type===Z.Html)return e;const t=ml(e,{label:"title"});return e.confirmation&&(t.confirmation=this.resolveTuneAliases(e.confirmation)),t}}var fs={exports:{}};/*!
29
+ * Library for handling keyboard shortcuts
30
+ * @copyright CodeX (https://codex.so)
31
+ * @license MIT
32
+ * @author CodeX (https://codex.so)
33
+ * @version 1.2.0
34
+ */(function(n,e){(function(t,o){n.exports=o()})(window,function(){return(function(t){var o={};function i(s){if(o[s])return o[s].exports;var l=o[s]={i:s,l:!1,exports:{}};return t[s].call(l.exports,l,l.exports,i),l.l=!0,l.exports}return i.m=t,i.c=o,i.d=function(s,l,d){i.o(s,l)||Object.defineProperty(s,l,{enumerable:!0,get:d})},i.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},i.t=function(s,l){if(1&l&&(s=i(s)),8&l||4&l&&typeof s=="object"&&s&&s.__esModule)return s;var d=Object.create(null);if(i.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:s}),2&l&&typeof s!="string")for(var u in s)i.d(d,u,(function(p){return s[p]}).bind(null,u));return d},i.n=function(s){var l=s&&s.__esModule?function(){return s.default}:function(){return s};return i.d(l,"a",l),l},i.o=function(s,l){return Object.prototype.hasOwnProperty.call(s,l)},i.p="",i(i.s=0)})([function(t,o,i){function s(u,p){for(var f=0;f<p.length;f++){var g=p[f];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(u,g.key,g)}}function l(u,p,f){return p&&s(u.prototype,p),f&&s(u,f),u}i.r(o);var d=(function(){function u(p){var f=this;(function(g,w){if(!(g instanceof w))throw new TypeError("Cannot call a class as a function")})(this,u),this.commands={},this.keys={},this.name=p.name,this.parseShortcutName(p.name),this.element=p.on,this.callback=p.callback,this.executeShortcut=function(g){f.execute(g)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return l(u,null,[{key:"supportedCommands",get:function(){return{SHIFT:["SHIFT"],CMD:["CMD","CONTROL","COMMAND","WINDOWS","CTRL"],ALT:["ALT","OPTION"]}}},{key:"keyCodes",get:function(){return{0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,BACKSPACE:8,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DELETE:46,".":190}}}]),l(u,[{key:"parseShortcutName",value:function(p){p=p.split("+");for(var f=0;f<p.length;f++){p[f]=p[f].toUpperCase();var g=!1;for(var w in u.supportedCommands)if(u.supportedCommands[w].includes(p[f])){g=this.commands[w]=!0;break}g||(this.keys[p[f]]=!0)}for(var y in u.supportedCommands)this.commands[y]||(this.commands[y]=!1)}},{key:"execute",value:function(p){var f,g={CMD:p.ctrlKey||p.metaKey,SHIFT:p.shiftKey,ALT:p.altKey},w=!0;for(f in this.commands)this.commands[f]!==g[f]&&(w=!1);var y,k=!0;for(y in this.keys)k=k&&p.keyCode===u.keyCodes[y];w&&k&&this.callback(p)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),u})();o.default=d}]).default})})(fs);var Ul=fs.exports;const $l=Jt(Ul);class ql{constructor(){this.registeredShortcuts=new Map}add(e){if(this.findShortcut(e.on,e.name))throw Error(`Shortcut ${e.name} is already registered for ${e.on}. Please remove it before add a new handler.`);const t=new $l({name:e.name,on:e.on,callback:e.handler}),o=this.registeredShortcuts.get(e.on)||[];this.registeredShortcuts.set(e.on,[...o,t])}remove(e,t){const o=this.findShortcut(e,t);if(!o)return;o.remove();const i=this.registeredShortcuts.get(e).filter(s=>s!==o);if(i.length===0){this.registeredShortcuts.delete(e);return}this.registeredShortcuts.set(e,i)}findShortcut(e,t){return(this.registeredShortcuts.get(e)||[]).find(({name:o})=>o===t)}}const lt=new ql;var Wl=Object.defineProperty,Yl=Object.getOwnPropertyDescriptor,gs=(n,e,t,o)=>{for(var i=Yl(e,t),s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=l(e,t,i)||i);return i&&Wl(e,t,i),i},Ht=(n=>(n.Opened="toolbox-opened",n.Closed="toolbox-closed",n.BlockAdded="toolbox-block-added",n))(Ht||{});const Vo=class ms extends Ot{constructor({api:e,tools:t,i18nLabels:o}){super(),this.opened=!1,this.listeners=new It,this.popover=null,this.handleMobileLayoutToggle=()=>{this.destroyPopover(),this.initPopover()},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=e,this.tools=t,this.i18nLabels=o,this.enableShortcuts(),this.nodes={toolbox:v.make("div",ms.CSS.toolbox)},this.initPopover(),this.api.events.on(Tt,this.handleMobileLayoutToggle)}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}getElement(){return this.nodes.toolbox}hasFocus(){if(this.popover!==null)return"hasFocus"in this.popover?this.popover.hasFocus():void 0}destroy(){var e;super.destroy(),this.nodes&&this.nodes.toolbox&&this.nodes.toolbox.remove(),this.removeAllShortcuts(),(e=this.popover)==null||e.off(Ie.Closed,this.onPopoverClose),this.listeners.destroy(),this.api.events.off(Tt,this.handleMobileLayoutToggle)}toolButtonActivated(e,t){this.insertNewBlock(e,t)}open(){var e;this.isEmpty||((e=this.popover)==null||e.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var e;(e=this.popover)==null||e.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}initPopover(){var e;const t=dt()?ps:Yo;this.popover=new t({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(Ie.Closed,this.onPopoverClose),(e=this.nodes.toolbox)==null||e.append(this.popover.getElement())}destroyPopover(){this.popover!==null&&(this.popover.hide(),this.popover.off(Ie.Closed,this.onPopoverClose),this.popover.destroy(),this.popover=null),this.nodes.toolbox!==null&&(this.nodes.toolbox.innerHTML="")}get toolsToBeDisplayed(){const e=[];return this.tools.forEach(t=>{t.toolbox&&e.push(t)}),e}get toolboxItemsToBeDisplayed(){const e=(t,o,i=!0)=>({icon:t.icon,title:fe.t(ke.toolNames,t.title||Wt(o.name)),name:o.name,onActivate:()=>{this.toolButtonActivated(o.name,t.data)},secondaryLabel:o.shortcut&&i?Fo(o.shortcut):""});return this.toolsToBeDisplayed.reduce((t,o)=>(Array.isArray(o.toolbox)?o.toolbox.forEach((i,s)=>{t.push(e(i,o,s===0))}):o.toolbox!==void 0&&t.push(e(o.toolbox,o)),t),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&this.enableShortcutForTool(e.name,t)})}enableShortcutForTool(e,t){lt.add({name:t,on:this.api.ui.nodes.redactor,handler:async o=>{o.preventDefault();const i=this.api.blocks.getCurrentBlockIndex(),s=this.api.blocks.getBlockByIndex(i);if(s)try{const l=await this.api.blocks.convert(s.id,e);this.api.caret.setToBlock(l,"end");return}catch{}this.insertNewBlock(e)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(e=>{const t=e.shortcut;t&&lt.remove(this.api.ui.nodes.redactor,t)})}async insertNewBlock(e,t){const o=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(o);if(!i)return;const s=i.isEmpty?o:o+1;let l;if(t){const u=await this.api.blocks.composeBlockData(e);l=Object.assign(u,t)}const d=this.api.blocks.insert(e,l,void 0,s,void 0,i.isEmpty);d.call(Le.APPEND_CALLBACK),this.api.caret.setToBlock(s),this.emit("toolbox-block-added",{block:d}),this.api.toolbar.close()}};gs([ct],Vo.prototype,"toolsToBeDisplayed");gs([ct],Vo.prototype,"toolboxItemsToBeDisplayed");let Vl=Vo;const bs="block hovered";async function Kl(n,e){const t=navigator.keyboard;if(!t)return e;try{return(await t.getLayoutMap()).get(n)||e}catch(o){return console.error(o),e}}class Xl extends U{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.toolboxInstance=null}get CSS(){return{toolbar:"ce-toolbar",content:"ce-toolbar__content",actions:"ce-toolbar__actions",actionsOpened:"ce-toolbar__actions--opened",toolbarOpened:"ce-toolbar--opened",openedToolboxHolderModifier:"codex-editor--toolbox-opened",plusButton:"ce-toolbar__plus",plusButtonShortcut:"ce-toolbar__plus-shortcut",settingsToggler:"ce-toolbar__settings-btn",settingsTogglerHidden:"ce-toolbar__settings-btn--hidden"}}get opened(){return this.nodes.wrapper.classList.contains(this.CSS.toolbarOpened)}get toolbox(){var e;return{opened:(e=this.toolboxInstance)==null?void 0:e.opened,close:()=>{var t;(t=this.toolboxInstance)==null||t.close()},open:()=>{if(this.toolboxInstance===null){q("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){q("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var t;return(t=this.toolboxInstance)==null?void 0:t.hasFocus()}}}get blockActions(){return{hide:()=>{this.nodes.actions.classList.remove(this.CSS.actionsOpened)},show:()=>{this.nodes.actions.classList.add(this.CSS.actionsOpened)}}}get blockTunesToggler(){return{hide:()=>this.nodes.settingsToggler.classList.add(this.CSS.settingsTogglerHidden),show:()=>this.nodes.settingsToggler.classList.remove(this.CSS.settingsTogglerHidden)}}toggleReadOnly(e){e?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(e=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){q("Can't open Toolbar since Editor initialization is not finished yet","warn");return}if(this.toolboxInstance.opened&&this.toolboxInstance.close(),this.Editor.BlockSettings.opened&&this.Editor.BlockSettings.close(),!e)return;this.hoveredBlock=e;const t=e.holder,{isMobile:o}=this.Editor.UI;let i;const s=20,l=e.firstInput,d=t.getBoundingClientRect(),u=l!==void 0?l.getBoundingClientRect():null,p=u!==null?u.top-d.top:null,f=p!==null?p>s:void 0;if(o)i=t.offsetTop+t.offsetHeight;else if(l===void 0||f){const g=parseInt(window.getComputedStyle(e.pluginsContent).paddingTop);i=t.offsetTop+g}else{const g=_a(l),w=parseInt(window.getComputedStyle(this.nodes.plusButton).height,10);i=t.offsetTop+g-w+8+p}this.nodes.wrapper.style.top=`${Math.floor(i)}px`,this.Editor.BlockManager.blocks.length===1&&e.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var e,t;this.Editor.ReadOnly.isEnabled||((e=this.nodes.wrapper)==null||e.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(t=this.toolboxInstance)==null||t.close(),this.Editor.BlockSettings.close(),this.reset())}reset(){this.nodes.wrapper.style.top="unset"}open(e=!0){this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),e?this.blockActions.show():this.blockActions.hide()}async make(){this.nodes.wrapper=v.make("div",this.CSS.toolbar),["content","actions"].forEach(s=>{this.nodes[s]=v.make("div",this.CSS[s])}),v.append(this.nodes.wrapper,this.nodes.content),v.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=v.make("div",this.CSS.plusButton,{innerHTML:Bl}),v.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{Vt(!0),this.plusButtonClicked()},!1);const e=v.make("div");e.appendChild(document.createTextNode(fe.ui(ke.ui.toolbar.toolbox,"Add"))),e.appendChild(v.make("div",this.CSS.plusButtonShortcut,{textContent:"/"})),Kt(this.nodes.plusButton,e,{hidingDelay:400}),this.nodes.settingsToggler=v.make("span",this.CSS.settingsToggler,{innerHTML:Tl}),v.append(this.nodes.actions,this.nodes.settingsToggler);const t=v.make("div"),o=v.text(fe.ui(ke.ui.blockTunes.toggler,"Click to tune")),i=await Kl("Slash","/");t.appendChild(o),t.appendChild(v.make("div",this.CSS.plusButtonShortcut,{textContent:Fo(`CMD + ${i}`)})),Kt(this.nodes.settingsToggler,t,{hidingDelay:400}),v.append(this.nodes.actions,this.makeToolbox()),v.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),v.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new Vl({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:fe.ui(ke.ui.popover,"Filter"),nothingFound:fe.ui(ke.ui.popover,"Nothing found")}}),this.toolboxInstance.on(Ht.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(Ht.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(Ht.BlockAdded,({block:e})=>{const{BlockManager:t,Caret:o}=this.Editor,i=t.getBlockById(e.id);i.inputs.length===0&&(i===t.lastBlock?(t.insertAtEnd(),o.setToBlock(t.lastBlock)):o.setToBlock(t.nextBlock))}),this.toolboxInstance.getElement()}plusButtonClicked(){var e;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(e=this.toolboxInstance)==null||e.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",e=>{var t;e.stopPropagation(),this.settingsTogglerClicked(),(t=this.toolboxInstance)!=null&&t.opened&&this.toolboxInstance.close(),Vt(!0)},!0),dt()||this.eventsDispatcher.on(bs,e=>{var t;this.Editor.BlockSettings.opened||(t=this.toolboxInstance)!=null&&t.opened||this.moveAndOpen(e.block)})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}settingsTogglerClicked(){this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.BlockSettings.open(this.hoveredBlock)}drawUI(){this.Editor.BlockSettings.make(),this.make()}destroy(){this.removeAllNodes(),this.toolboxInstance&&this.toolboxInstance.destroy()}}var Ve=(n=>(n[n.Block=0]="Block",n[n.Inline=1]="Inline",n[n.Tune=2]="Tune",n))(Ve||{}),Ft=(n=>(n.Shortcut="shortcut",n.Toolbox="toolbox",n.EnabledInlineTools="inlineToolbar",n.EnabledBlockTunes="tunes",n.Config="config",n))(Ft||{}),ws=(n=>(n.Shortcut="shortcut",n.SanitizeConfig="sanitize",n))(ws||{}),rt=(n=>(n.IsEnabledLineBreaks="enableLineBreaks",n.Toolbox="toolbox",n.ConversionConfig="conversionConfig",n.IsReadOnlySupported="isReadOnlySupported",n.PasteConfig="pasteConfig",n))(rt||{}),Zt=(n=>(n.IsInline="isInline",n.Title="title",n.IsReadOnlySupported="isReadOnlySupported",n))(Zt||{}),jo=(n=>(n.IsTune="isTune",n))(jo||{});class Ko{constructor({name:e,constructable:t,config:o,api:i,isDefault:s,isInternal:l=!1,defaultPlaceholder:d}){this.api=i,this.name=e,this.constructable=t,this.config=o,this.isDefault=s,this.isInternal=l,this.defaultPlaceholder=d}get settings(){const e=this.config.config||{};return this.isDefault&&!("placeholder"in e)&&this.defaultPlaceholder&&(e.placeholder=this.defaultPlaceholder),e}reset(){if(G(this.constructable.reset))return this.constructable.reset()}prepare(){if(G(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){const e=this.constructable.shortcut;return this.config.shortcut||e}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===Ve.Inline}isBlock(){return this.type===Ve.Block}isTune(){return this.type===Ve.Tune}}class Zl extends U{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.CSS={inlineToolbar:"ce-inline-toolbar"},this.opened=!1,this.popover=null,this.toolbarVerticalMargin=dt()?20:6,this.tools=new Map,window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}async tryToShow(e=!1){e&&this.close(),this.allowedToShow()&&(await this.open(),this.Editor.Toolbar.close())}close(){var e,t;if(this.opened){for(const[o,i]of this.tools){const s=this.getToolShortcut(o.name);s!==void 0&&lt.remove(this.Editor.UI.nodes.redactor,s),G(i.clear)&&i.clear()}this.tools=new Map,this.reset(),this.opened=!1,(e=this.popover)==null||e.hide(),(t=this.popover)==null||t.destroy(),this.popover=null}}containsNode(e){return this.nodes.wrapper===void 0?!1:this.nodes.wrapper.contains(e)}destroy(){var e;this.removeAllNodes(),(e=this.popover)==null||e.destroy(),this.popover=null}make(){this.nodes.wrapper=v.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),v.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}async open(){var e;if(this.opened)return;this.opened=!0,this.popover!==null&&this.popover.destroy(),this.createToolsInstances();const t=await this.getPopoverItems();this.popover=new Dl({items:t,scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:fe.ui(ke.ui.popover,"Nothing found"),search:fe.ui(ke.ui.popover,"Filter")}}),this.move(this.popover.size.width),(e=this.nodes.wrapper)==null||e.append(this.popover.getElement()),this.popover.show()}move(e){const t=M.rect,o=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),i={x:t.x-o.x,y:t.y+t.height-o.top+this.toolbarVerticalMargin};i.x+e+o.x>this.Editor.UI.contentRect.right&&(i.x=this.Editor.UI.contentRect.right-e-o.x),this.nodes.wrapper.style.left=Math.floor(i.x)+"px",this.nodes.wrapper.style.top=Math.floor(i.y)+"px"}reset(){this.nodes.wrapper.style.left="0",this.nodes.wrapper.style.top="0"}allowedToShow(){const e=["IMG","INPUT"],t=M.get(),o=M.text;if(!t||!t.anchorNode||t.isCollapsed||o.length<1)return!1;const i=v.isElement(t.anchorNode)?t.anchorNode:t.anchorNode.parentElement;if(i===null||t!==null&&e.includes(i.tagName))return!1;const s=this.Editor.BlockManager.getBlock(t.anchorNode);return!s||this.getTools().some(l=>s.tool.inlineTools.has(l.name))===!1?!1:i.closest("[contenteditable]")!==null}getTools(){const e=this.Editor.BlockManager.currentBlock;return e?Array.from(e.tool.inlineTools.values()).filter(t=>!(this.Editor.ReadOnly.isEnabled&&t.isReadOnlySupported!==!0)):[]}createToolsInstances(){this.tools=new Map,this.getTools().forEach(e=>{const t=e.create();this.tools.set(e,t)})}async getPopoverItems(){const e=[];let t=0;for(const[o,i]of this.tools){const s=await i.render(),l=this.getToolShortcut(o.name);if(l!==void 0)try{this.enableShortcuts(o.name,l)}catch{}const d=l!==void 0?Fo(l):void 0,u=fe.t(ke.toolNames,o.title||Wt(o.name));[s].flat().forEach(p=>{var f,g;const w={name:o.name,onActivate:()=>{this.toolClicked(i)},hint:{title:u,description:d}};if(v.isElement(p)){const y={...w,element:p,type:Z.Html};if(G(i.renderActions)){const k=i.renderActions();y.children={isOpen:(f=i.checkState)==null?void 0:f.call(i,M.get()),isFlippable:!1,items:[{type:Z.Html,element:k}]}}else(g=i.checkState)==null||g.call(i,M.get());e.push(y)}else if(p.type===Z.Html)e.push({...w,...p,type:Z.Html});else if(p.type===Z.Separator)e.push({type:Z.Separator});else{const y={...w,...p,type:Z.Default};"children"in y&&t!==0&&e.push({type:Z.Separator}),e.push(y),"children"in y&&t<this.tools.size-1&&e.push({type:Z.Separator})}}),t++}return e}getToolShortcut(e){const{Tools:t}=this.Editor,o=t.inlineTools.get(e),i=t.internal.inlineTools;return Array.from(i.keys()).includes(e)?this.inlineTools[e][ws.Shortcut]:o==null?void 0:o.shortcut}enableShortcuts(e,t){lt.add({name:t,handler:o=>{var i;const{currentBlock:s}=this.Editor.BlockManager;s&&s.tool.enabledInlineTools&&(o.preventDefault(),(i=this.popover)==null||i.activateItemByName(e))},on:document})}toolClicked(e){var t;const o=M.range;(t=e.surround)==null||t.call(e,o),this.checkToolsState()}checkToolsState(){var e;(e=this.tools)==null||e.forEach(t=>{var o;(o=t.checkState)==null||o.call(t,M.get())})}get inlineTools(){const e={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([t,o])=>{e[t]=o.create()}),e}}function vs(){const n=window.getSelection();if(n===null)return[null,0];let e=n.focusNode,t=n.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[t]?(e=e.childNodes[t],t=0):(e=e.childNodes[t-1],t=e.textContent.length)),[e,t])}function ks(n,e,t,o){const i=document.createRange();o==="left"?(i.setStart(n,0),i.setEnd(e,t)):(i.setStart(e,t),i.setEnd(n,n.childNodes.length));const s=i.cloneContents(),l=document.createElement("div");l.appendChild(s);const d=l.textContent||"";return La(d)}function zt(n){const e=v.getDeepestNode(n);if(e===null||v.isEmpty(n))return!0;if(v.isNativeInput(e))return e.selectionEnd===0;if(v.isEmpty(n))return!0;const[t,o]=vs();return t===null?!1:ks(n,t,o,"left")}function Ut(n){const e=v.getDeepestNode(n,!0);if(e===null)return!0;if(v.isNativeInput(e))return e.selectionEnd===e.value.length;const[t,o]=vs();return t===null?!1:ks(n,t,o,"right")}var ys={},Xo={},Qt={},Ze={},Zo={},Go={};Object.defineProperty(Go,"__esModule",{value:!0});Go.allInputsSelector=Gl;function Gl(){var n=["text","password","email","number","search","tel","url"];return"[contenteditable=true], textarea, input:not([type]), "+n.map(function(e){return'input[type="'.concat(e,'"]')}).join(", ")}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.allInputsSelector=void 0;var e=Go;Object.defineProperty(n,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}})})(Zo);var Ge={},Jo={};Object.defineProperty(Jo,"__esModule",{value:!0});Jo.isNativeInput=Jl;function Jl(n){var e=["INPUT","TEXTAREA"];return n&&n.tagName?e.includes(n.tagName):!1}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNativeInput=void 0;var e=Jo;Object.defineProperty(n,"isNativeInput",{enumerable:!0,get:function(){return e.isNativeInput}})})(Ge);var xs={},Qo={};Object.defineProperty(Qo,"__esModule",{value:!0});Qo.append=Ql;function Ql(n,e){Array.isArray(e)?e.forEach(function(t){n.appendChild(t)}):n.appendChild(e)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.append=void 0;var e=Qo;Object.defineProperty(n,"append",{enumerable:!0,get:function(){return e.append}})})(xs);var en={},tn={};Object.defineProperty(tn,"__esModule",{value:!0});tn.blockElements=ec;function ec(){return["address","article","aside","blockquote","canvas","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","li","main","nav","noscript","ol","output","p","pre","ruby","section","table","tbody","thead","tr","tfoot","ul","video"]}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.blockElements=void 0;var e=tn;Object.defineProperty(n,"blockElements",{enumerable:!0,get:function(){return e.blockElements}})})(en);var Cs={},on={};Object.defineProperty(on,"__esModule",{value:!0});on.calculateBaseline=tc;function tc(n){var e=window.getComputedStyle(n),t=parseFloat(e.fontSize),o=parseFloat(e.lineHeight)||t*1.2,i=parseFloat(e.paddingTop),s=parseFloat(e.borderTopWidth),l=parseFloat(e.marginTop),d=t*.8,u=(o-t)/2,p=l+s+i+u+d;return p}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.calculateBaseline=void 0;var e=on;Object.defineProperty(n,"calculateBaseline",{enumerable:!0,get:function(){return e.calculateBaseline}})})(Cs);var Es={},nn={},sn={},rn={};Object.defineProperty(rn,"__esModule",{value:!0});rn.isContentEditable=oc;function oc(n){return n.contentEditable==="true"}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isContentEditable=void 0;var e=rn;Object.defineProperty(n,"isContentEditable",{enumerable:!0,get:function(){return e.isContentEditable}})})(sn);Object.defineProperty(nn,"__esModule",{value:!0});nn.canSetCaret=sc;var nc=Ge,ic=sn;function sc(n){var e=!0;if((0,nc.isNativeInput)(n))switch(n.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=(0,ic.isContentEditable)(n);return e}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.canSetCaret=void 0;var e=nn;Object.defineProperty(n,"canSetCaret",{enumerable:!0,get:function(){return e.canSetCaret}})})(Es);var eo={},an={};function rc(n,e,t){const o=t.value!==void 0?"value":"get",i=t[o],s=`#${e}Cache`;if(t[o]=function(...l){return this[s]===void 0&&(this[s]=i.apply(this,l)),this[s]},o==="get"&&t.set){const l=t.set;t.set=function(d){delete n[s],l.apply(this,d)}}return t}function Ts(){const n={win:!1,mac:!1,x11:!1,linux:!1},e=Object.keys(n).find(t=>window.navigator.appVersion.toLowerCase().indexOf(t)!==-1);return e!==void 0&&(n[e]=!0),n}function ln(n){return n!=null&&n!==""&&(typeof n!="object"||Object.keys(n).length>0)}function ac(n){return!ln(n)}const lc=()=>typeof window<"u"&&window.navigator!==null&&ln(window.navigator.platform)&&(/iP(ad|hone|od)/.test(window.navigator.platform)||window.navigator.platform==="MacIntel"&&window.navigator.maxTouchPoints>1);function cc(n){const e=Ts();return n=n.replace(/shift/gi,"⇧").replace(/backspace/gi,"⌫").replace(/enter/gi,"⏎").replace(/up/gi,"↑").replace(/left/gi,"→").replace(/down/gi,"↓").replace(/right/gi,"←").replace(/escape/gi,"⎋").replace(/insert/gi,"Ins").replace(/delete/gi,"␡").replace(/\+/gi,"+"),e.mac?n=n.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):n=n.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),n}function dc(n){return n[0].toUpperCase()+n.slice(1)}function uc(n){const e=document.createElement("div");e.style.position="absolute",e.style.left="-999px",e.style.bottom="-999px",e.innerHTML=n,document.body.appendChild(e);const t=window.getSelection(),o=document.createRange();if(o.selectNode(e),t===null)throw new Error("Cannot copy text to clipboard");t.removeAllRanges(),t.addRange(o),document.execCommand("copy"),document.body.removeChild(e)}function hc(n,e,t){let o;return(...i)=>{const s=this,l=()=>{o=void 0,t!==!0&&n.apply(s,i)},d=t===!0&&o!==void 0;window.clearTimeout(o),o=window.setTimeout(l,e),d&&n.apply(s,i)}}function Fe(n){return Object.prototype.toString.call(n).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function pc(n){return Fe(n)==="boolean"}function Bs(n){return Fe(n)==="function"||Fe(n)==="asyncfunction"}function fc(n){return Bs(n)&&/^\s*class\s+/.test(n.toString())}function gc(n){return Fe(n)==="number"}function $t(n){return Fe(n)==="object"}function mc(n){return Promise.resolve(n)===n}function bc(n){return Fe(n)==="string"}function wc(n){return Fe(n)==="undefined"}function Ho(n,...e){if(!e.length)return n;const t=e.shift();if($t(n)&&$t(t))for(const o in t)$t(t[o])?(n[o]===void 0&&Object.assign(n,{[o]:{}}),Ho(n[o],t[o])):Object.assign(n,{[o]:t[o]});return Ho(n,...e)}function vc(n,e,t){const o=`«${e}» is deprecated and will be removed in the next major release. Please use the «${t}» instead.`;n&&console.warn(o)}function kc(n){try{return new URL(n).href}catch{}return n.substring(0,2)==="//"?window.location.protocol+n:window.location.origin+n}function yc(n){return n>47&&n<58||n===32||n===13||n===229||n>64&&n<91||n>95&&n<112||n>185&&n<193||n>218&&n<223}const xc={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,LEFT:37,UP:38,DOWN:40,RIGHT:39,DELETE:46,META:91,SLASH:191},Cc={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};let Ec=class{constructor(){this.completed=Promise.resolve()}add(n){return new Promise((e,t)=>{this.completed=this.completed.then(n).then(e).catch(t)})}};function Tc(n,e,t=void 0){let o,i,s,l=null,d=0;t||(t={});const u=function(){d=t.leading===!1?0:Date.now(),l=null,s=n.apply(o,i),l===null&&(o=i=null)};return function(){const p=Date.now();!d&&t.leading===!1&&(d=p);const f=e-(p-d);return o=this,i=arguments,f<=0||f>e?(l&&(clearTimeout(l),l=null),d=p,s=n.apply(o,i),l===null&&(o=i=null)):!l&&t.trailing!==!1&&(l=setTimeout(u,f)),s}}const Bc=Object.freeze(Object.defineProperty({__proto__:null,PromiseQueue:Ec,beautifyShortcut:cc,cacheable:rc,capitalize:dc,copyTextToClipboard:uc,debounce:hc,deepMerge:Ho,deprecationAssert:vc,getUserOS:Ts,getValidUrl:kc,isBoolean:pc,isClass:fc,isEmpty:ac,isFunction:Bs,isIosDevice:lc,isNumber:gc,isObject:$t,isPrintableKey:yc,isPromise:mc,isString:bc,isUndefined:wc,keyCodes:xc,mouseButtons:Cc,notEmpty:ln,throttle:Tc,typeOf:Fe},Symbol.toStringTag,{value:"Module"})),cn=wa(Bc);Object.defineProperty(an,"__esModule",{value:!0});an.containsOnlyInlineElements=Ic;var Sc=cn,Oc=en;function Ic(n){var e;(0,Sc.isString)(n)?(e=document.createElement("div"),e.innerHTML=n):e=n;var t=function(o){return!(0,Oc.blockElements)().includes(o.tagName.toLowerCase())&&Array.from(o.children).every(t)};return Array.from(e.children).every(t)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.containsOnlyInlineElements=void 0;var e=an;Object.defineProperty(n,"containsOnlyInlineElements",{enumerable:!0,get:function(){return e.containsOnlyInlineElements}})})(eo);var Ss={},dn={},to={},un={};Object.defineProperty(un,"__esModule",{value:!0});un.make=Ac;function Ac(n,e,t){var o;e===void 0&&(e=null),t===void 0&&(t={});var i=document.createElement(n);if(Array.isArray(e)){var s=e.filter(function(d){return d!==void 0});(o=i.classList).add.apply(o,s)}else e!==null&&i.classList.add(e);for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&(i[l]=t[l]);return i}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.make=void 0;var e=un;Object.defineProperty(n,"make",{enumerable:!0,get:function(){return e.make}})})(to);Object.defineProperty(dn,"__esModule",{value:!0});dn.fragmentToString=Lc;var Mc=to;function Lc(n){var e=(0,Mc.make)("div");return e.appendChild(n),e.innerHTML}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.fragmentToString=void 0;var e=dn;Object.defineProperty(n,"fragmentToString",{enumerable:!0,get:function(){return e.fragmentToString}})})(Ss);var Os={},hn={};Object.defineProperty(hn,"__esModule",{value:!0});hn.getContentLength=Pc;var _c=Ge;function Pc(n){var e,t;return(0,_c.isNativeInput)(n)?n.value.length:n.nodeType===Node.TEXT_NODE?n.length:(t=(e=n.textContent)===null||e===void 0?void 0:e.length)!==null&&t!==void 0?t:0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getContentLength=void 0;var e=hn;Object.defineProperty(n,"getContentLength",{enumerable:!0,get:function(){return e.getContentLength}})})(Os);var pn={},fn={},Ai=Et&&Et.__spreadArray||function(n,e,t){if(t||arguments.length===2)for(var o=0,i=e.length,s;o<i;o++)(s||!(o in e))&&(s||(s=Array.prototype.slice.call(e,0,o)),s[o]=e[o]);return n.concat(s||Array.prototype.slice.call(e))};Object.defineProperty(fn,"__esModule",{value:!0});fn.getDeepestBlockElements=Is;var Nc=eo;function Is(n){return(0,Nc.containsOnlyInlineElements)(n)?[n]:Array.from(n.children).reduce(function(e,t){return Ai(Ai([],e,!0),Is(t),!0)},[])}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getDeepestBlockElements=void 0;var e=fn;Object.defineProperty(n,"getDeepestBlockElements",{enumerable:!0,get:function(){return e.getDeepestBlockElements}})})(pn);var As={},gn={},oo={},mn={};Object.defineProperty(mn,"__esModule",{value:!0});mn.isLineBreakTag=Rc;function Rc(n){return["BR","WBR"].includes(n.tagName)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isLineBreakTag=void 0;var e=mn;Object.defineProperty(n,"isLineBreakTag",{enumerable:!0,get:function(){return e.isLineBreakTag}})})(oo);var no={},bn={};Object.defineProperty(bn,"__esModule",{value:!0});bn.isSingleTag=Dc;function Dc(n){return["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(n.tagName)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isSingleTag=void 0;var e=bn;Object.defineProperty(n,"isSingleTag",{enumerable:!0,get:function(){return e.isSingleTag}})})(no);Object.defineProperty(gn,"__esModule",{value:!0});gn.getDeepestNode=Ms;var jc=Ge,Hc=oo,Fc=no;function Ms(n,e){e===void 0&&(e=!1);var t=e?"lastChild":"firstChild",o=e?"previousSibling":"nextSibling";if(n.nodeType===Node.ELEMENT_NODE&&n[t]){var i=n[t];if((0,Fc.isSingleTag)(i)&&!(0,jc.isNativeInput)(i)&&!(0,Hc.isLineBreakTag)(i))if(i[o])i=i[o];else if(i.parentNode!==null&&i.parentNode[o])i=i.parentNode[o];else return i.parentNode;return Ms(i,e)}return n}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getDeepestNode=void 0;var e=gn;Object.defineProperty(n,"getDeepestNode",{enumerable:!0,get:function(){return e.getDeepestNode}})})(As);var Ls={},wn={},Dt=Et&&Et.__spreadArray||function(n,e,t){if(t||arguments.length===2)for(var o=0,i=e.length,s;o<i;o++)(s||!(o in e))&&(s||(s=Array.prototype.slice.call(e,0,o)),s[o]=e[o]);return n.concat(s||Array.prototype.slice.call(e))};Object.defineProperty(wn,"__esModule",{value:!0});wn.findAllInputs=Wc;var zc=eo,Uc=pn,$c=Zo,qc=Ge;function Wc(n){return Array.from(n.querySelectorAll((0,$c.allInputsSelector)())).reduce(function(e,t){return(0,qc.isNativeInput)(t)||(0,zc.containsOnlyInlineElements)(t)?Dt(Dt([],e,!0),[t],!1):Dt(Dt([],e,!0),(0,Uc.getDeepestBlockElements)(t),!0)},[])}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.findAllInputs=void 0;var e=wn;Object.defineProperty(n,"findAllInputs",{enumerable:!0,get:function(){return e.findAllInputs}})})(Ls);var _s={},vn={};Object.defineProperty(vn,"__esModule",{value:!0});vn.isCollapsedWhitespaces=Yc;function Yc(n){return!/[^\t\n\r ]/.test(n)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isCollapsedWhitespaces=void 0;var e=vn;Object.defineProperty(n,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return e.isCollapsedWhitespaces}})})(_s);var kn={},yn={};Object.defineProperty(yn,"__esModule",{value:!0});yn.isElement=Kc;var Vc=cn;function Kc(n){return(0,Vc.isNumber)(n)?!1:!!n&&!!n.nodeType&&n.nodeType===Node.ELEMENT_NODE}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isElement=void 0;var e=yn;Object.defineProperty(n,"isElement",{enumerable:!0,get:function(){return e.isElement}})})(kn);var Ps={},xn={},Cn={},En={};Object.defineProperty(En,"__esModule",{value:!0});En.isLeaf=Xc;function Xc(n){return n===null?!1:n.childNodes.length===0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isLeaf=void 0;var e=En;Object.defineProperty(n,"isLeaf",{enumerable:!0,get:function(){return e.isLeaf}})})(Cn);var Tn={},Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.isNodeEmpty=ed;var Zc=oo,Gc=kn,Jc=Ge,Qc=no;function ed(n,e){var t="";return(0,Qc.isSingleTag)(n)&&!(0,Zc.isLineBreakTag)(n)?!1:((0,Gc.isElement)(n)&&(0,Jc.isNativeInput)(n)?t=n.value:n.textContent!==null&&(t=n.textContent.replace("​","")),e!==void 0&&(t=t.replace(new RegExp(e,"g"),"")),t.trim().length===0)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isNodeEmpty=void 0;var e=Bn;Object.defineProperty(n,"isNodeEmpty",{enumerable:!0,get:function(){return e.isNodeEmpty}})})(Tn);Object.defineProperty(xn,"__esModule",{value:!0});xn.isEmpty=nd;var td=Cn,od=Tn;function nd(n,e){n.normalize();for(var t=[n];t.length>0;){var o=t.shift();if(o){if(n=o,(0,td.isLeaf)(n)&&!(0,od.isNodeEmpty)(n,e))return!1;t.push.apply(t,Array.from(n.childNodes))}}return!0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isEmpty=void 0;var e=xn;Object.defineProperty(n,"isEmpty",{enumerable:!0,get:function(){return e.isEmpty}})})(Ps);var Ns={},Sn={};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.isFragment=sd;var id=cn;function sd(n){return(0,id.isNumber)(n)?!1:!!n&&!!n.nodeType&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isFragment=void 0;var e=Sn;Object.defineProperty(n,"isFragment",{enumerable:!0,get:function(){return e.isFragment}})})(Ns);var Rs={},On={};Object.defineProperty(On,"__esModule",{value:!0});On.isHTMLString=ad;var rd=to;function ad(n){var e=(0,rd.make)("div");return e.innerHTML=n,e.childElementCount>0}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isHTMLString=void 0;var e=On;Object.defineProperty(n,"isHTMLString",{enumerable:!0,get:function(){return e.isHTMLString}})})(Rs);var Ds={},In={};Object.defineProperty(In,"__esModule",{value:!0});In.offset=ld;function ld(n){var e=n.getBoundingClientRect(),t=window.pageXOffset||document.documentElement.scrollLeft,o=window.pageYOffset||document.documentElement.scrollTop,i=e.top+o,s=e.left+t;return{top:i,left:s,bottom:i+e.height,right:s+e.width}}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.offset=void 0;var e=In;Object.defineProperty(n,"offset",{enumerable:!0,get:function(){return e.offset}})})(Ds);var js={},An={};Object.defineProperty(An,"__esModule",{value:!0});An.prepend=cd;function cd(n,e){Array.isArray(e)?(e=e.reverse(),e.forEach(function(t){return n.prepend(t)})):n.prepend(e)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.prepend=void 0;var e=An;Object.defineProperty(n,"prepend",{enumerable:!0,get:function(){return e.prepend}})})(js);(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.prepend=n.offset=n.make=n.isLineBreakTag=n.isSingleTag=n.isNodeEmpty=n.isLeaf=n.isHTMLString=n.isFragment=n.isEmpty=n.isElement=n.isContentEditable=n.isCollapsedWhitespaces=n.findAllInputs=n.isNativeInput=n.allInputsSelector=n.getDeepestNode=n.getDeepestBlockElements=n.getContentLength=n.fragmentToString=n.containsOnlyInlineElements=n.canSetCaret=n.calculateBaseline=n.blockElements=n.append=void 0;var e=Zo;Object.defineProperty(n,"allInputsSelector",{enumerable:!0,get:function(){return e.allInputsSelector}});var t=Ge;Object.defineProperty(n,"isNativeInput",{enumerable:!0,get:function(){return t.isNativeInput}});var o=xs;Object.defineProperty(n,"append",{enumerable:!0,get:function(){return o.append}});var i=en;Object.defineProperty(n,"blockElements",{enumerable:!0,get:function(){return i.blockElements}});var s=Cs;Object.defineProperty(n,"calculateBaseline",{enumerable:!0,get:function(){return s.calculateBaseline}});var l=Es;Object.defineProperty(n,"canSetCaret",{enumerable:!0,get:function(){return l.canSetCaret}});var d=eo;Object.defineProperty(n,"containsOnlyInlineElements",{enumerable:!0,get:function(){return d.containsOnlyInlineElements}});var u=Ss;Object.defineProperty(n,"fragmentToString",{enumerable:!0,get:function(){return u.fragmentToString}});var p=Os;Object.defineProperty(n,"getContentLength",{enumerable:!0,get:function(){return p.getContentLength}});var f=pn;Object.defineProperty(n,"getDeepestBlockElements",{enumerable:!0,get:function(){return f.getDeepestBlockElements}});var g=As;Object.defineProperty(n,"getDeepestNode",{enumerable:!0,get:function(){return g.getDeepestNode}});var w=Ls;Object.defineProperty(n,"findAllInputs",{enumerable:!0,get:function(){return w.findAllInputs}});var y=_s;Object.defineProperty(n,"isCollapsedWhitespaces",{enumerable:!0,get:function(){return y.isCollapsedWhitespaces}});var k=sn;Object.defineProperty(n,"isContentEditable",{enumerable:!0,get:function(){return k.isContentEditable}});var T=kn;Object.defineProperty(n,"isElement",{enumerable:!0,get:function(){return T.isElement}});var P=Ps;Object.defineProperty(n,"isEmpty",{enumerable:!0,get:function(){return P.isEmpty}});var j=Ns;Object.defineProperty(n,"isFragment",{enumerable:!0,get:function(){return j.isFragment}});var S=Rs;Object.defineProperty(n,"isHTMLString",{enumerable:!0,get:function(){return S.isHTMLString}});var J=Cn;Object.defineProperty(n,"isLeaf",{enumerable:!0,get:function(){return J.isLeaf}});var K=Tn;Object.defineProperty(n,"isNodeEmpty",{enumerable:!0,get:function(){return K.isNodeEmpty}});var Q=oo;Object.defineProperty(n,"isLineBreakTag",{enumerable:!0,get:function(){return Q.isLineBreakTag}});var ce=no;Object.defineProperty(n,"isSingleTag",{enumerable:!0,get:function(){return ce.isSingleTag}});var ye=to;Object.defineProperty(n,"make",{enumerable:!0,get:function(){return ye.make}});var I=Ds;Object.defineProperty(n,"offset",{enumerable:!0,get:function(){return I.offset}});var B=js;Object.defineProperty(n,"prepend",{enumerable:!0,get:function(){return B.prepend}})})(Ze);var io={};Object.defineProperty(io,"__esModule",{value:!0});io.getContenteditableSlice=ud;var dd=Ze;function ud(n,e,t,o,i){var s;i===void 0&&(i=!1);var l=document.createRange();if(o==="left"?(l.setStart(n,0),l.setEnd(e,t)):(l.setStart(e,t),l.setEnd(n,n.childNodes.length)),i===!0){var d=l.extractContents();return(0,dd.fragmentToString)(d)}var u=l.cloneContents(),p=document.createElement("div");p.appendChild(u);var f=(s=p.textContent)!==null&&s!==void 0?s:"";return f}Object.defineProperty(Qt,"__esModule",{value:!0});Qt.checkContenteditableSliceForEmptiness=fd;var hd=Ze,pd=io;function fd(n,e,t,o){var i=(0,pd.getContenteditableSlice)(n,e,t,o);return(0,hd.isCollapsedWhitespaces)(i)}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.checkContenteditableSliceForEmptiness=void 0;var e=Qt;Object.defineProperty(n,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}})})(Xo);var Hs={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getContenteditableSlice=void 0;var e=io;Object.defineProperty(n,"getContenteditableSlice",{enumerable:!0,get:function(){return e.getContenteditableSlice}})})(Hs);var Fs={},Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.focus=md;var gd=Ze;function md(n,e){var t,o;if(e===void 0&&(e=!0),(0,gd.isNativeInput)(n)){n.focus();var i=e?0:n.value.length;n.setSelectionRange(i,i)}else{var s=document.createRange(),l=window.getSelection();if(!l)return;var d=function(w){var y=document.createTextNode("");w.appendChild(y),s.setStart(y,0),s.setEnd(y,0)},u=function(w){return w!=null},p=n.childNodes,f=e?p[0]:p[p.length-1];if(u(f)){for(;u(f)&&f.nodeType!==Node.TEXT_NODE;)f=e?f.firstChild:f.lastChild;if(u(f)&&f.nodeType===Node.TEXT_NODE){var g=(o=(t=f.textContent)===null||t===void 0?void 0:t.length)!==null&&o!==void 0?o:0,i=e?0:g;s.setStart(f,i),s.setEnd(f,i)}else d(n)}else d(n);l.removeAllRanges(),l.addRange(s)}}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.focus=void 0;var e=Mn;Object.defineProperty(n,"focus",{enumerable:!0,get:function(){return e.focus}})})(Fs);var Ln={},so={};Object.defineProperty(so,"__esModule",{value:!0});so.getCaretNodeAndOffset=bd;function bd(){var n=window.getSelection();if(n===null)return[null,0];var e=n.focusNode,t=n.focusOffset;return e===null?[null,0]:(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length>0&&(e.childNodes[t]!==void 0?(e=e.childNodes[t],t=0):(e=e.childNodes[t-1],e.textContent!==null&&(t=e.textContent.length))),[e,t])}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getCaretNodeAndOffset=void 0;var e=so;Object.defineProperty(n,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return e.getCaretNodeAndOffset}})})(Ln);var zs={},ro={};Object.defineProperty(ro,"__esModule",{value:!0});ro.getRange=wd;function wd(){var n=window.getSelection();return n&&n.rangeCount?n.getRangeAt(0):null}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.getRange=void 0;var e=ro;Object.defineProperty(n,"getRange",{enumerable:!0,get:function(){return e.getRange}})})(zs);var Us={},_n={};Object.defineProperty(_n,"__esModule",{value:!0});_n.isCaretAtEndOfInput=yd;var Mi=Ze,vd=Ln,kd=Xo;function yd(n){var e=(0,Mi.getDeepestNode)(n,!0);if(e===null)return!0;if((0,Mi.isNativeInput)(e))return e.selectionEnd===e.value.length;var t=(0,vd.getCaretNodeAndOffset)(),o=t[0],i=t[1];return o===null?!1:(0,kd.checkContenteditableSliceForEmptiness)(n,o,i,"right")}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isCaretAtEndOfInput=void 0;var e=_n;Object.defineProperty(n,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return e.isCaretAtEndOfInput}})})(Us);var $s={},Pn={};Object.defineProperty(Pn,"__esModule",{value:!0});Pn.isCaretAtStartOfInput=Ed;var jt=Ze,xd=so,Cd=Qt;function Ed(n){var e=(0,jt.getDeepestNode)(n);if(e===null||(0,jt.isEmpty)(n))return!0;if((0,jt.isNativeInput)(e))return e.selectionEnd===0;if((0,jt.isEmpty)(n))return!0;var t=(0,xd.getCaretNodeAndOffset)(),o=t[0],i=t[1];return o===null?!1:(0,Cd.checkContenteditableSliceForEmptiness)(n,o,i,"left")}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.isCaretAtStartOfInput=void 0;var e=Pn;Object.defineProperty(n,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return e.isCaretAtStartOfInput}})})($s);var qs={},Nn={};Object.defineProperty(Nn,"__esModule",{value:!0});Nn.save=Sd;var Td=Ze,Bd=ro;function Sd(){var n=(0,Bd.getRange)(),e=(0,Td.make)("span");if(e.id="cursor",e.hidden=!0,!!n)return n.insertNode(e),function(){var t=window.getSelection();t&&(n.setStartAfter(e),n.setEndAfter(e),t.removeAllRanges(),t.addRange(n),setTimeout(function(){e.remove()},150))}}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.save=void 0;var e=Nn;Object.defineProperty(n,"save",{enumerable:!0,get:function(){return e.save}})})(qs);(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.save=n.isCaretAtStartOfInput=n.isCaretAtEndOfInput=n.getRange=n.getCaretNodeAndOffset=n.focus=n.getContenteditableSlice=n.checkContenteditableSliceForEmptiness=void 0;var e=Xo;Object.defineProperty(n,"checkContenteditableSliceForEmptiness",{enumerable:!0,get:function(){return e.checkContenteditableSliceForEmptiness}});var t=Hs;Object.defineProperty(n,"getContenteditableSlice",{enumerable:!0,get:function(){return t.getContenteditableSlice}});var o=Fs;Object.defineProperty(n,"focus",{enumerable:!0,get:function(){return o.focus}});var i=Ln;Object.defineProperty(n,"getCaretNodeAndOffset",{enumerable:!0,get:function(){return i.getCaretNodeAndOffset}});var s=zs;Object.defineProperty(n,"getRange",{enumerable:!0,get:function(){return s.getRange}});var l=Us;Object.defineProperty(n,"isCaretAtEndOfInput",{enumerable:!0,get:function(){return l.isCaretAtEndOfInput}});var d=$s;Object.defineProperty(n,"isCaretAtStartOfInput",{enumerable:!0,get:function(){return d.isCaretAtStartOfInput}});var u=qs;Object.defineProperty(n,"save",{enumerable:!0,get:function(){return u.save}})})(ys);class Od extends U{keydown(e){switch(this.beforeKeydownProcessing(e),e.keyCode){case _.BACKSPACE:this.backspace(e);break;case _.DELETE:this.delete(e);break;case _.ENTER:this.enter(e);break;case _.DOWN:case _.RIGHT:this.arrowRightAndDown(e);break;case _.UP:case _.LEFT:this.arrowLeftAndUp(e);break;case _.TAB:this.tabPressed(e);break}e.key==="/"&&!e.ctrlKey&&!e.metaKey&&this.slashPressed(e),e.code==="Slash"&&(e.ctrlKey||e.metaKey)&&(e.preventDefault(),this.commandSlashPressed())}beforeKeydownProcessing(e){this.needToolbarClosing(e)&&$i(e.keyCode)&&(this.Editor.Toolbar.close(),e.ctrlKey||e.metaKey||e.altKey||e.shiftKey||this.Editor.BlockSelection.clearSelection(e))}keyup(e){e.shiftKey||this.Editor.UI.checkEmptiness()}dragOver(e){const t=this.Editor.BlockManager.getBlockByChildNode(e.target);t.dropTarget=!0}dragLeave(e){const t=this.Editor.BlockManager.getBlockByChildNode(e.target);t.dropTarget=!1}handleCommandC(e){const{BlockSelection:t}=this.Editor;t.anyBlockSelected&&t.copySelectedBlocks(e)}handleCommandX(e){const{BlockSelection:t,BlockManager:o,Caret:i}=this.Editor;t.anyBlockSelected&&t.copySelectedBlocks(e).then(()=>{const s=o.removeSelectedBlocks(),l=o.insertDefaultBlockAtIndex(s,!0);i.setToBlock(l,i.positions.START),t.clearSelection(e)})}tabPressed(e){const{InlineToolbar:t,Caret:o}=this.Editor;t.opened||(e.shiftKey?o.navigatePrevious(!0):o.navigateNext(!0))&&e.preventDefault()}commandSlashPressed(){this.Editor.BlockSelection.selectedBlocks.length>1||this.activateBlockSettings()}slashPressed(e){!this.Editor.UI.nodes.wrapper.contains(e.target)||!this.Editor.BlockManager.currentBlock.isEmpty||(e.preventDefault(),this.Editor.Caret.insertContentAtCaretPosition("/"),this.activateToolbox())}enter(e){const{BlockManager:t,UI:o}=this.Editor,i=t.currentBlock;if(i===void 0||i.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||e.shiftKey&&!No)return;let s=i;i.currentInput!==void 0&&zt(i.currentInput)&&!i.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):i.currentInput&&Ut(i.currentInput)?s=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):s=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(s),this.Editor.Toolbar.moveAndOpen(s),e.preventDefault()}backspace(e){const{BlockManager:t,Caret:o}=this.Editor,{currentBlock:i,previousBlock:s}=t;if(!(i===void 0||!M.isCollapsed||!i.currentInput||!zt(i.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),i.currentInput!==i.firstInput){o.navigatePrevious();return}if(s!==null){if(s.isEmpty){t.removeBlock(s);return}if(i.isEmpty){t.removeBlock(i);const l=t.currentBlock;o.setToBlock(l,o.positions.END);return}Ti(s,i)?this.mergeBlocks(s,i):o.setToBlock(s,o.positions.END)}}}delete(e){const{BlockManager:t,Caret:o}=this.Editor,{currentBlock:i,nextBlock:s}=t;if(!(!M.isCollapsed||!Ut(i.currentInput))){if(e.preventDefault(),this.Editor.Toolbar.close(),i.currentInput!==i.lastInput){o.navigateNext();return}if(s!==null){if(s.isEmpty){t.removeBlock(s);return}if(i.isEmpty){t.removeBlock(i),o.setToBlock(s,o.positions.START);return}Ti(i,s)?this.mergeBlocks(i,s):o.setToBlock(s,o.positions.START)}}}mergeBlocks(e,t){const{BlockManager:o,Toolbar:i}=this.Editor;e.lastInput!==void 0&&(ys.focus(e.lastInput,!1),o.mergeBlocks(e,t).then(()=>{i.close()}))}arrowRightAndDown(e){const t=Xe.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===_.TAB);if(this.Editor.UI.someToolbarOpened&&t)return;this.Editor.Toolbar.close();const{currentBlock:o}=this.Editor.BlockManager,i=((o==null?void 0:o.currentInput)!==void 0?Ut(o.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===_.DOWN&&i){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}if(e.keyCode===_.DOWN||e.keyCode===_.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious()){e.preventDefault();return}qt(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}arrowLeftAndUp(e){if(this.Editor.UI.someToolbarOpened){if(Xe.usedKeys.includes(e.keyCode)&&(!e.shiftKey||e.keyCode===_.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.Toolbar.close();const{currentBlock:t}=this.Editor.BlockManager,o=((t==null?void 0:t.currentInput)!==void 0?zt(t.currentInput):void 0)||this.Editor.BlockSelection.anyBlockSelected;if(e.shiftKey&&e.keyCode===_.UP&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}if(e.keyCode===_.UP||e.keyCode===_.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext()){e.preventDefault();return}qt(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(e)}needToolbarClosing(e){const t=e.keyCode===_.ENTER&&this.Editor.Toolbar.toolbox.opened,o=e.keyCode===_.ENTER&&this.Editor.BlockSettings.opened,i=e.keyCode===_.ENTER&&this.Editor.InlineToolbar.opened,s=e.keyCode===_.TAB;return!(e.shiftKey||s||t||o||i)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}}class Ao{constructor(e){this.blocks=[],this.workingArea=e}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return qi(this.workingArea.children)}static set(e,t,o){return isNaN(Number(t))?(Reflect.set(e,t,o),!0):(e.insert(+t,o),!0)}static get(e,t){return isNaN(Number(t))?Reflect.get(e,t):e.get(+t)}push(e){this.blocks.push(e),this.insertToDOM(e)}swap(e,t){const o=this.blocks[t];v.swap(this.blocks[e].holder,o.holder),this.blocks[t]=this.blocks[e],this.blocks[e]=o}move(e,t){const o=this.blocks.splice(t,1)[0],i=e-1,s=Math.max(0,i),l=this.blocks[s];e>0?this.insertToDOM(o,"afterend",l):this.insertToDOM(o,"beforebegin",l),this.blocks.splice(e,0,o);const d=this.composeBlockEvent("move",{fromIndex:t,toIndex:e});o.call(Le.MOVED,d)}insert(e,t,o=!1){if(!this.length){this.push(t);return}e>this.length&&(e=this.length),o&&(this.blocks[e].holder.remove(),this.blocks[e].call(Le.REMOVED));const i=o?1:0;if(this.blocks.splice(e,i,t),e>0){const s=this.blocks[e-1];this.insertToDOM(t,"afterend",s)}else{const s=this.blocks[e+1];s?this.insertToDOM(t,"beforebegin",s):this.insertToDOM(t)}}replace(e,t){if(this.blocks[e]===void 0)throw Error("Incorrect index");this.blocks[e].holder.replaceWith(t.holder),this.blocks[e]=t}insertMany(e,t){const o=new DocumentFragment;for(const i of e)o.appendChild(i.holder);if(this.length>0){if(t>0){const i=Math.min(t-1,this.length-1);this.blocks[i].holder.after(o)}else t===0&&this.workingArea.prepend(o);this.blocks.splice(t,0,...e)}else this.blocks.push(...e),this.workingArea.appendChild(o);e.forEach(i=>i.call(Le.RENDERED))}remove(e){isNaN(e)&&(e=this.length-1),this.blocks[e].holder.remove(),this.blocks[e].call(Le.REMOVED),this.blocks.splice(e,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(e=>e.call(Le.REMOVED)),this.blocks.length=0}insertAfter(e,t){const o=this.blocks.indexOf(e);this.insert(o+1,t)}get(e){return this.blocks[e]}indexOf(e){return this.blocks.indexOf(e)}insertToDOM(e,t,o){t?o.holder.insertAdjacentElement(t,e.holder):this.workingArea.appendChild(e.holder),e.call(Le.RENDERED)}composeBlockEvent(e,t){return new CustomEvent(e,{detail:t})}}const Li="block-removed",_i="block-added",Id="block-moved",Pi="block-changed";class Ad{constructor(){this.completed=Promise.resolve()}add(e){return new Promise((t,o)=>{this.completed=this.completed.then(e).then(t).catch(o)})}}class Md extends U{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(e){this._currentBlockIndex=e}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(e){this.currentBlockIndex=this.getBlockIndex(e)}get nextBlock(){return this.currentBlockIndex===this._blocks.length-1?null:this._blocks[this.currentBlockIndex+1]}get nextContentfulBlock(){return this.blocks.slice(this.currentBlockIndex+1).find(e=>!!e.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(e=>!!e.inputs.length)}get previousBlock(){return this.currentBlockIndex===0?null:this._blocks[this.currentBlockIndex-1]}get blocks(){return this._blocks.array}get isEditorEmpty(){return this.blocks.every(e=>e.isEmpty)}prepare(){const e=new Ao(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(e,{set:Ao.set,get:Ao.get}),this.listeners.on(document,"copy",t=>this.Editor.BlockEvents.handleCommandC(t))}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:e,data:t={},id:o=void 0,tunes:i={}}){const s=this.Editor.ReadOnly.isEnabled,l=this.Editor.Tools.blockTools.get(e),d=new _e({id:o,data:t,tool:l,api:this.Editor.API,readOnly:s,tunesData:i},this.eventsDispatcher);return s||window.requestIdleCallback(()=>{this.bindBlockEvents(d)},{timeout:2e3}),d}insert({id:e=void 0,tool:t=this.config.defaultBlock,data:o={},index:i,needToFocus:s=!0,replace:l=!1,tunes:d={}}={}){let u=i;u===void 0&&(u=this.currentBlockIndex+(l?0:1));const p=this.composeBlock({id:e,tool:t,data:o,tunes:d});return l&&this.blockDidMutated(Li,this.getBlockByIndex(u),{index:u}),this._blocks.insert(u,p,l),this.blockDidMutated(_i,p,{index:u}),s?this.currentBlockIndex=u:u<=this.currentBlockIndex&&this.currentBlockIndex++,p}insertMany(e,t=0){this._blocks.insertMany(e,t)}async update(e,t,o){if(!t&&!o)return e;const i=await e.data,s=this.composeBlock({id:e.id,tool:e.name,data:Object.assign({},i,t??{}),tunes:o??e.tunes}),l=this.getBlockIndex(e);return this._blocks.replace(l,s),this.blockDidMutated(Pi,s,{index:l}),s}replace(e,t,o){const i=this.getBlockIndex(e);return this.insert({tool:t,data:o,index:i,replace:!0})}paste(e,t,o=!1){const i=this.insert({tool:e,replace:o});try{window.requestIdleCallback(()=>{i.call(Le.ON_PASTE,t)})}catch(s){q(`${e}: onPaste callback call is failed`,"error",s)}return i}insertDefaultBlockAtIndex(e,t=!1){const o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[e]=o,this.blockDidMutated(_i,o,{index:e}),t?this.currentBlockIndex=e:e<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(e,t){let o;if(e.name===t.name&&e.mergeable){const i=await t.data;if(Ee(i)){console.error("Could not merge Block. Failed to extract original Block data.");return}const[s]=Uo([i],e.tool.sanitizeConfig);o=s}else if(e.mergeable&&Yt(t,"export")&&Yt(e,"import")){const i=await t.exportDataAsString(),s=Oe(i,e.tool.sanitizeConfig);o=Bi(s,e.tool.conversionConfig)}o!==void 0&&(await e.mergeWith(o),this.removeBlock(t),this.currentBlockIndex=this._blocks.indexOf(e))}removeBlock(e,t=!0){return new Promise(o=>{const i=this._blocks.indexOf(e);if(!this.validateIndex(i))throw new Error("Can't find a Block to remove");this._blocks.remove(i),e.destroy(),this.blockDidMutated(Li,e,{index:i}),this.currentBlockIndex>=i&&this.currentBlockIndex--,this.blocks.length?i===0&&(this.currentBlockIndex=0):(this.unsetCurrentBlock(),t&&this.insert()),o()})}removeSelectedBlocks(){let e;for(let t=this.blocks.length-1;t>=0;t--)this.blocks[t].selected&&(this.removeBlock(this.blocks[t]),e=t);return e}removeAllBlocks(){for(let e=this.blocks.length-1;e>=0;e--)this._blocks.remove(e);this.unsetCurrentBlock(),this.insert(),this.currentBlock.firstInput.focus()}split(){const e=this.Editor.Caret.extractFragmentFromCaretPosition(),t=v.make("div");t.appendChild(e);const o={text:v.isEmpty(t)?"":t.innerHTML};return this.insert({data:o})}getBlockByIndex(e){return e===-1&&(e=this._blocks.length-1),this._blocks[e]}getBlockIndex(e){return this._blocks.indexOf(e)}getBlockById(e){return this._blocks.array.find(t=>t.id===e)}getBlock(e){v.isElement(e)||(e=e.parentNode);const t=this._blocks.nodes,o=e.closest(`.${_e.CSS.wrapper}`),i=t.indexOf(o);if(i>=0)return this._blocks[i]}setCurrentBlockByChildNode(e){v.isElement(e)||(e=e.parentNode);const t=e.closest(`.${_e.CSS.wrapper}`);if(!t)return;const o=t.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(t),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(e){if(!e||!(e instanceof Node))return;v.isElement(e)||(e=e.parentNode);const t=e.closest(`.${_e.CSS.wrapper}`);return this.blocks.find(o=>o.holder===t)}swap(e,t){this._blocks.swap(e,t),this.currentBlockIndex=t}move(e,t=this.currentBlockIndex){if(isNaN(e)||isNaN(t)){q("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(e)||!this.validateIndex(t)){q("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(e,t),this.currentBlockIndex=e,this.blockDidMutated(Id,this.currentBlock,{fromIndex:t,toIndex:e})}async convert(e,t,o){if(!await e.save())throw new Error("Could not convert Block. Failed to extract original Block data.");const i=this.Editor.Tools.blockTools.get(t);if(!i)throw new Error(`Could not convert Block. Tool «${t}» not found.`);const s=await e.exportDataAsString(),l=Oe(s,i.sanitizeConfig);let d=Bi(l,i.conversionConfig,i.settings);return o&&(d=Object.assign(d,o)),this.replace(e,i.name,d)}unsetCurrentBlock(){this.currentBlockIndex=-1}async clear(e=!1){const t=new Ad;[...this.blocks].forEach(o=>{t.add(async()=>{await this.removeBlock(o,!1)})}),await t.completed,this.unsetCurrentBlock(),e&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(e=>e.destroy()))}bindBlockEvents(e){const{BlockEvents:t}=this.Editor;this.readOnlyMutableListeners.on(e.holder,"keydown",o=>{t.keydown(o)}),this.readOnlyMutableListeners.on(e.holder,"keyup",o=>{t.keyup(o)}),this.readOnlyMutableListeners.on(e.holder,"dragover",o=>{t.dragOver(o)}),this.readOnlyMutableListeners.on(e.holder,"dragleave",o=>{t.dragLeave(o)}),e.on("didMutated",o=>this.blockDidMutated(Pi,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",e=>this.Editor.BlockEvents.handleCommandX(e)),this.blocks.forEach(e=>{this.bindBlockEvents(e)})}validateIndex(e){return!(e<0||e>=this._blocks.length)}blockDidMutated(e,t,o){const i=new CustomEvent(e,{detail:{target:new Me(t),...o}});return this.eventsDispatcher.emit(Gi,{event:i}),t}}class Ld extends U{constructor(){super(...arguments),this.anyBlockSelectedCache=null,this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1}get sanitizerConfig(){return{p:{},h1:{},h2:{},h3:{},h4:{},h5:{},h6:{},ol:{},ul:{},li:{},br:!0,img:{src:!0,width:!0,height:!0},a:{href:!0},b:{},i:{},u:{}}}get allBlocksSelected(){const{BlockManager:e}=this.Editor;return e.blocks.every(t=>t.selected===!0)}set allBlocksSelected(e){const{BlockManager:t}=this.Editor;t.blocks.forEach(o=>{o.selected=e}),this.clearCache()}get anyBlockSelected(){const{BlockManager:e}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=e.blocks.some(t=>t.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(e=>e.selected)}prepare(){this.selection=new M,lt.add({name:"CMD+A",handler:e=>{const{BlockManager:t,ReadOnly:o}=this.Editor;if(o.isEnabled){e.preventDefault(),this.selectAllBlocks();return}t.currentBlock&&this.handleCommandA(e)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){M.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(e){const{BlockManager:t}=this.Editor;let o;isNaN(e)?o=t.currentBlock:o=t.getBlockByIndex(e),o.selected=!1,this.clearCache()}clearSelection(e,t=!1){const{BlockManager:o,Caret:i,RectangleSelection:s}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;const l=e&&e instanceof KeyboardEvent,d=l&&$i(e.keyCode);if(this.anyBlockSelected&&l&&d&&!M.isSelectionExists){const u=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(u,!0),i.setToBlock(o.currentBlock),qt(()=>{const p=e.key;i.insertContentAtCaretPosition(p.length>1?"":p)},20)()}if(this.Editor.CrossBlockSelection.clear(e),!this.anyBlockSelected||s.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}t&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(e){e.preventDefault();const t=v.make("div");this.selectedBlocks.forEach(s=>{const l=Oe(s.holder.innerHTML,this.sanitizerConfig),d=v.make("p");d.innerHTML=l,t.appendChild(d)});const o=Array.from(t.childNodes).map(s=>s.textContent).join(`
35
+
36
+ `),i=t.innerHTML;return e.clipboardData.setData("text/plain",o),e.clipboardData.setData("text/html",i),Promise.all(this.selectedBlocks.map(s=>s.save())).then(s=>{try{e.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(s))}catch{}})}selectBlockByIndex(e){const{BlockManager:t}=this.Editor,o=t.getBlockByIndex(e);o!==void 0&&this.selectBlock(o)}selectBlock(e){this.selection.save(),M.get().removeAllRanges(),e.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}unselectBlock(e){e.selected=!1,this.clearCache()}clearCache(){this.anyBlockSelectedCache=null}destroy(){lt.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(e){if(this.Editor.RectangleSelection.clearSelection(),v.isNativeInput(e.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const t=this.Editor.BlockManager.getBlock(e.target),o=t.inputs;if(o.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(o.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(e.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1):this.readyToBlockSelection&&(e.preventDefault(),this.selectBlock(t),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),M.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}}class Gt extends U{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}setToBlock(e,t=this.positions.DEFAULT,o=0){var i;const{BlockManager:s,BlockSelection:l}=this.Editor;if(l.clearSelection(),!e.focusable){(i=window.getSelection())==null||i.removeAllRanges(),l.selectBlock(e),s.currentBlock=e;return}let d;switch(t){case this.positions.START:d=e.firstInput;break;case this.positions.END:d=e.lastInput;break;default:d=e.currentInput}if(!d)return;let u,p=o;if(t===this.positions.START)u=v.getDeepestNode(d,!1),p=0;else if(t===this.positions.END)u=v.getDeepestNode(d,!0),p=v.getContentLength(u);else{const{node:f,offset:g}=v.getNodeByOffset(d,o);f?(u=f,p=g):(u=v.getDeepestNode(d,!1),p=0)}this.set(u,p),s.setCurrentBlockByChildNode(e.holder),s.currentBlock.currentInput=d}setToInput(e,t=this.positions.DEFAULT,o=0){const{currentBlock:i}=this.Editor.BlockManager,s=v.getDeepestNode(e);switch(t){case this.positions.START:this.set(s,0);break;case this.positions.END:this.set(s,v.getContentLength(s));break;default:o&&this.set(s,o)}i.currentInput=e}set(e,t=0){const{top:o,bottom:i}=M.setCursor(e,t),{innerHeight:s}=window;o<0?window.scrollBy(0,o-30):i>s&&window.scrollBy(0,i-s+30)}setToTheLastBlock(){const e=this.Editor.BlockManager.lastBlock;if(e)if(e.tool.isDefault&&e.isEmpty)this.setToBlock(e);else{const t=this.Editor.BlockManager.insertAtEnd();this.setToBlock(t)}}extractFragmentFromCaretPosition(){const e=M.get();if(e.rangeCount){const t=e.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(t.deleteContents(),o)if(v.isNativeInput(o)){const i=o,s=document.createDocumentFragment(),l=i.value.substring(0,i.selectionStart),d=i.value.substring(i.selectionStart);return s.textContent=d,i.value=l,s}else{const i=t.cloneRange();return i.selectNodeContents(o),i.setStart(t.endContainer,t.endOffset),i.extractContents()}}}navigateNext(e=!1){const{BlockManager:t}=this.Editor,{currentBlock:o,nextBlock:i}=t;if(o===void 0)return!1;const{nextInput:s,currentInput:l}=o,d=l!==void 0?Ut(l):void 0;let u=i;const p=e||d||!o.focusable;if(s&&p)return this.setToInput(s,this.positions.START),!0;if(u===null){if(o.tool.isDefault||!p)return!1;u=t.insertAtEnd()}return p?(this.setToBlock(u,this.positions.START),!0):!1}navigatePrevious(e=!1){const{currentBlock:t,previousBlock:o}=this.Editor.BlockManager;if(!t)return!1;const{previousInput:i,currentInput:s}=t,l=s!==void 0?zt(s):void 0,d=e||l||!t.focusable;return i&&d?(this.setToInput(i,this.positions.END),!0):o!==null&&d?(this.setToBlock(o,this.positions.END),!0):!1}createShadow(e){const t=document.createElement("span");t.classList.add(Gt.CSS.shadowCaret),e.insertAdjacentElement("beforeend",t)}restoreCaret(e){const t=e.querySelector(`.${Gt.CSS.shadowCaret}`);if(!t)return;new M().expandToTag(t);const o=document.createRange();o.selectNode(t),o.extractContents()}insertContentAtCaretPosition(e){const t=document.createDocumentFragment(),o=document.createElement("div"),i=M.get(),s=M.range;o.innerHTML=e,Array.from(o.childNodes).forEach(p=>t.appendChild(p)),t.childNodes.length===0&&t.appendChild(new Text);const l=t.lastChild;s.deleteContents(),s.insertNode(t);const d=document.createRange(),u=l.nodeType===Node.TEXT_NODE?l:l.firstChild;u!==null&&u.textContent!==null&&d.setStart(u,u.textContent.length),i.removeAllRanges(),i.addRange(d)}}class _d extends U{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=e=>{const{BlockManager:t,BlockSelection:o}=this.Editor;if(e.relatedTarget===null&&e.target===null)return;const i=t.getBlockByChildNode(e.relatedTarget)||this.lastSelectedBlock,s=t.getBlockByChildNode(e.target);if(!(!i||!s)&&s!==i){if(i===this.firstSelectedBlock){M.get().removeAllRanges(),i.selected=!0,s.selected=!0,o.clearCache();return}if(s===this.firstSelectedBlock){i.selected=!1,s.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(i,s),this.lastSelectedBlock=s}}}async prepare(){this.listeners.on(document,"mousedown",e=>{this.enableCrossBlockSelection(e)})}watchSelection(e){if(e.button!==ka.LEFT)return;const{BlockManager:t}=this.Editor;this.firstSelectedBlock=t.getBlock(e.target),this.lastSelectedBlock=this.firstSelectedBlock,this.listeners.on(document,"mouseover",this.onMouseOver),this.listeners.on(document,"mouseup",this.onMouseUp)}get isCrossBlockSelectionStarted(){return!!this.firstSelectedBlock&&!!this.lastSelectedBlock&&this.firstSelectedBlock!==this.lastSelectedBlock}toggleBlockSelectedState(e=!0){const{BlockManager:t,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=t.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),M.get().removeAllRanges());const i=t.blocks.indexOf(this.lastSelectedBlock)+(e?1:-1),s=t.blocks[i];s&&(this.lastSelectedBlock.selected!==s.selected?(s.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=s,this.Editor.InlineToolbar.close(),s.holder.scrollIntoView({block:"nearest"}))}clear(e){const{BlockManager:t,BlockSelection:o,Caret:i}=this.Editor,s=t.blocks.indexOf(this.firstSelectedBlock),l=t.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&s>-1&&l>-1&&e&&e instanceof KeyboardEvent)switch(e.keyCode){case _.DOWN:case _.RIGHT:i.setToBlock(t.blocks[Math.max(s,l)],i.positions.END);break;case _.UP:case _.LEFT:i.setToBlock(t.blocks[Math.min(s,l)],i.positions.START);break;default:i.setToBlock(t.blocks[Math.max(s,l)],i.positions.END)}this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(e){const{UI:t}=this.Editor;M.isCollapsed||this.Editor.BlockSelection.clearSelection(e),t.nodes.redactor.contains(e.target)?this.watchSelection(e):this.Editor.BlockSelection.clearSelection(e)}toggleBlocksSelectedState(e,t){const{BlockManager:o,BlockSelection:i}=this.Editor,s=o.blocks.indexOf(e),l=o.blocks.indexOf(t),d=e.selected!==t.selected;for(let u=Math.min(s,l);u<=Math.max(s,l);u++){const p=o.blocks[u];p!==this.firstSelectedBlock&&p!==(d?e:t)&&(o.blocks[u].selected=!o.blocks[u].selected,i.clearCache())}}}class Pd extends U{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(e){e?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){const{UI:e}=this.Editor;this.readOnlyMutableListeners.on(e.nodes.holder,"drop",async t=>{await this.processDrop(t)},!0),this.readOnlyMutableListeners.on(e.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(e.nodes.holder,"dragover",t=>{this.processDragOver(t)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(e){const{BlockManager:t,Paste:o,Caret:i}=this.Editor;e.preventDefault(),t.blocks.forEach(l=>{l.dropTarget=!1}),M.isAtEditor&&!M.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;const s=t.setCurrentBlockByChildNode(e.target);if(s)this.Editor.Caret.setToBlock(s,i.positions.END);else{const l=t.setCurrentBlockByChildNode(t.lastBlock.holder);this.Editor.Caret.setToBlock(l,i.positions.END)}await o.processDataTransfer(e.dataTransfer,!0)}processDragStart(){M.isAtEditor&&!M.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(e){e.preventDefault()}}const Nd=180,Rd=400;class Dd extends U{constructor({config:e,eventsDispatcher:t}){super({config:e,eventsDispatcher:t}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=Rd,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(Gi,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(Ji,()=>{this.disable()}),this.eventsDispatcher.on(Qi,()=>{this.enable()})}enable(){this.mutationObserver.observe(this.Editor.UI.nodes.redactor,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),this.disabled=!1}disable(){this.mutationObserver.disconnect(),this.disabled=!0}particularBlockChanged(e){this.disabled||!G(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${e.detail.target.id}:event:${e.type}`,e),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let t;this.batchingOnChangeQueue.size===1?t=this.batchingOnChangeQueue.values().next().value:t=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,t),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(e){this.eventsDispatcher.emit(Ro,{mutations:e})}}const Ws=class Ys extends U{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=e=>{try{const t=e.create({},{},!1);if(e.pasteConfig===!1){this.exceptionList.push(e.name);return}if(!G(t.onPaste))return;this.getTagsConfig(e),this.getFilesConfig(e),this.getPatternsConfig(e)}catch(t){q(`Paste handling for «${e.name}» Tool hasn't been set up because of the error`,"warn",t)}},this.handlePasteEvent=async e=>{const{BlockManager:t,Toolbar:o}=this.Editor,i=t.setCurrentBlockByChildNode(e.target);!i||this.isNativeBehaviour(e.target)&&!e.clipboardData.types.includes("Files")||i&&this.exceptionList.includes(i.name)||(e.preventDefault(),this.processDataTransfer(e.clipboardData),o.close())}}async prepare(){this.processTools()}toggleReadOnly(e){e?this.unsetCallback():this.setCallback()}async processDataTransfer(e,t=!1){const{Tools:o}=this.Editor,i=e.types;if((i.includes?i.includes("Files"):i.contains("Files"))&&!Ee(this.toolsFiles)){await this.processFiles(e.files);return}const s=e.getData(this.MIME_TYPE),l=e.getData("text/plain");let d=e.getData("text/html");if(s)try{this.insertEditorJSData(JSON.parse(s));return}catch{}t&&l.trim()&&d.trim()&&(d="<p>"+(d.trim()?d:l)+"</p>");const u=Object.keys(this.toolsTags).reduce((g,w)=>(g[w.toLowerCase()]=this.toolsTags[w].sanitizationConfig??{},g),{}),p=Object.assign({},u,o.getAllInlineToolsSanitizeConfig(),{br:{}}),f=Oe(d,p);!f.trim()||f.trim()===l||!v.isHTMLString(f)?await this.processText(l):await this.processText(f,!0)}async processText(e,t=!1){const{Caret:o,BlockManager:i}=this.Editor,s=t?this.processHTML(e):this.processPlain(e);if(!s.length)return;if(s.length===1){s[0].isBlock?this.processSingleBlock(s.pop()):this.processInlinePaste(s.pop());return}const l=i.currentBlock&&i.currentBlock.tool.isDefault&&i.currentBlock.isEmpty;s.map(async(d,u)=>this.insertBlock(d,u===0&&l)),i.currentBlock&&o.setToBlock(i.currentBlock,o.positions.END)}setCallback(){this.listeners.on(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}unsetCallback(){this.listeners.off(this.Editor.UI.nodes.holder,"paste",this.handlePasteEvent)}processTools(){const e=this.Editor.Tools.blockTools;Array.from(e.values()).forEach(this.processTool)}collectTagNames(e){return Pe(e)?[e]:le(e)?Object.keys(e):[]}getTagsConfig(e){if(e.pasteConfig===!1)return;const t=e.pasteConfig.tags||[],o=[];t.forEach(i=>{const s=this.collectTagNames(i);o.push(...s),s.forEach(l=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,l)){q(`Paste handler for «${e.name}» Tool on «${l}» tag is skipped because it is already used by «${this.toolsTags[l].tool.name}» Tool.`,"warn");return}const d=le(i)?i[l]:null;this.toolsTags[l.toUpperCase()]={tool:e,sanitizationConfig:d}})}),this.tagsByTool[e.name]=o.map(i=>i.toUpperCase())}getFilesConfig(e){if(e.pasteConfig===!1)return;const{files:t={}}=e.pasteConfig;let{extensions:o,mimeTypes:i}=t;!o&&!i||(o&&!Array.isArray(o)&&(q(`«extensions» property of the onDrop config for «${e.name}» Tool should be an array`),o=[]),i&&!Array.isArray(i)&&(q(`«mimeTypes» property of the onDrop config for «${e.name}» Tool should be an array`),i=[]),i&&(i=i.filter(s=>Ta(s)?!0:(q(`MIME type value «${s}» for the «${e.name}» Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[e.name]={extensions:o||[],mimeTypes:i||[]})}getPatternsConfig(e){e.pasteConfig===!1||!e.pasteConfig.patterns||Ee(e.pasteConfig.patterns)||Object.entries(e.pasteConfig.patterns).forEach(([t,o])=>{o instanceof RegExp||q(`Pattern ${o} for «${e.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:t,pattern:o,tool:e})})}isNativeBehaviour(e){return v.isNativeInput(e)}async processFiles(e){const{BlockManager:t}=this.Editor;let o;o=await Promise.all(Array.from(e).map(s=>this.processFile(s))),o=o.filter(s=>!!s);const i=t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty;o.forEach((s,l)=>{t.paste(s.type,s.event,l===0&&i)})}async processFile(e){const t=Ea(e),o=Object.entries(this.toolsFiles).find(([s,{mimeTypes:l,extensions:d}])=>{const[u,p]=e.type.split("/"),f=d.find(w=>w.toLowerCase()===t.toLowerCase()),g=l.find(w=>{const[y,k]=w.split("/");return y===u&&(k===p||k==="*")});return!!f||!!g});if(!o)return;const[i]=o;return{event:this.composePasteEvent("file",{file:e}),type:i}}processHTML(e){const{Tools:t}=this.Editor,o=v.make("DIV");return o.innerHTML=e,this.getNodes(o).map(i=>{let s,l=t.defaultTool,d=!1;switch(i.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:s=v.make("div"),s.appendChild(i);break;case Node.ELEMENT_NODE:s=i,d=!0,this.toolsTags[s.tagName]&&(l=this.toolsTags[s.tagName].tool);break}const{tags:u}=l.pasteConfig||{tags:[]},p=u.reduce((w,y)=>(this.collectTagNames(y).forEach(k=>{const T=le(y)?y[k]:null;w[k.toLowerCase()]=T||{}}),w),{}),f=Object.assign({},p,l.baseSanitizeConfig);if(s.tagName.toLowerCase()==="table"){const w=Oe(s.outerHTML,f);s=v.make("div",void 0,{innerHTML:w}).firstChild}else s.innerHTML=Oe(s.innerHTML,f);const g=this.composePasteEvent("tag",{data:s});return{content:s,isBlock:d,tool:l.name,event:g}}).filter(i=>{const s=v.isEmpty(i.content),l=v.isSingleTag(i.content);return!s||l})}processPlain(e){const{defaultBlock:t}=this.config;if(!e)return[];const o=t;return e.split(/\r?\n/).filter(i=>i.trim()).map(i=>{const s=v.make("div");s.textContent=i;const l=this.composePasteEvent("tag",{data:s});return{content:s,tool:o,isBlock:!1,event:l}})}async processSingleBlock(e){const{Caret:t,BlockManager:o}=this.Editor,{currentBlock:i}=o;if(!i||e.tool!==i.name||!v.containsOnlyInlineElements(e.content.innerHTML)){this.insertBlock(e,(i==null?void 0:i.tool.isDefault)&&i.isEmpty);return}t.insertContentAtCaretPosition(e.content.innerHTML)}async processInlinePaste(e){const{BlockManager:t,Caret:o}=this.Editor,{content:i}=e;if(t.currentBlock&&t.currentBlock.tool.isDefault&&i.textContent.length<Ys.PATTERN_PROCESSING_MAX_LENGTH){const s=await this.processPattern(i.textContent);if(s){const l=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty,d=t.paste(s.tool,s.event,l);o.setToBlock(d,o.positions.END);return}}if(t.currentBlock&&t.currentBlock.currentInput){const s=t.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,Oe(i.innerHTML,s))}else this.insertBlock(e)}async processPattern(e){const t=this.toolsPatterns.find(o=>{const i=o.pattern.exec(e);return i?e===i.shift():!1});return t?{event:this.composePasteEvent("pattern",{key:t.key,data:e}),tool:t.tool.name}:void 0}insertBlock(e,t=!1){const{BlockManager:o,Caret:i}=this.Editor,{currentBlock:s}=o;let l;if(t&&s&&s.isEmpty){l=o.paste(e.tool,e.event,!0),i.setToBlock(l,i.positions.END);return}l=o.paste(e.tool,e.event),i.setToBlock(l,i.positions.END)}insertEditorJSData(e){const{BlockManager:t,Caret:o,Tools:i}=this.Editor;Uo(e,s=>i.blockTools.get(s).sanitizeConfig).forEach(({tool:s,data:l},d)=>{let u=!1;d===0&&(u=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty);const p=t.insert({tool:s,data:l,replace:u});o.setToBlock(p,o.positions.END)})}processElementNode(e,t,o){const i=Object.keys(this.toolsTags),s=e,{tool:l}=this.toolsTags[s.tagName]||{},d=this.tagsByTool[l==null?void 0:l.name]||[],u=i.includes(s.tagName),p=v.blockElements.includes(s.tagName.toLowerCase()),f=Array.from(s.children).some(({tagName:w})=>i.includes(w)&&!d.includes(w)),g=Array.from(s.children).some(({tagName:w})=>v.blockElements.includes(w.toLowerCase()));if(!p&&!u&&!f)return o.appendChild(s),[...t,o];if(u&&!f||p&&!g&&!f)return[...t,o,s]}getNodes(e){const t=Array.from(e.childNodes);let o;const i=(s,l)=>{if(v.isEmpty(l)&&!v.isSingleTag(l))return s;const d=s[s.length-1];let u=new DocumentFragment;switch(d&&v.isFragment(d)&&(u=s.pop()),l.nodeType){case Node.ELEMENT_NODE:if(o=this.processElementNode(l,s,u),o)return o;break;case Node.TEXT_NODE:return u.appendChild(l),[...s,u];default:return[...s,u]}return[...s,...Array.from(l.childNodes).reduce(i,[])]};return t.reduce(i,[])}composePasteEvent(e,t){return new CustomEvent(e,{detail:t})}};Ws.PATTERN_PROCESSING_MAX_LENGTH=450;let jd=Ws;class Hd extends U{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:e}=this.Editor,{blockTools:t}=e,o=[];Array.from(t.entries()).forEach(([i,s])=>{s.isReadOnlySupported||o.push(i)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly,!0)}async toggle(e=!this.readOnlyEnabled,t=!1){e&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const o=this.readOnlyEnabled;this.readOnlyEnabled=e;for(const s in this.Editor)this.Editor[s].toggleReadOnly&&this.Editor[s].toggleReadOnly(e);if(o===e)return this.readOnlyEnabled;if(t)return this.readOnlyEnabled;this.Editor.ModificationsObserver.disable();const i=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(i.blocks),this.Editor.ModificationsObserver.enable(),this.readOnlyEnabled}throwCriticalError(){throw new Xi(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}class Ct extends U{constructor(){super(...arguments),this.isRectSelectionActivated=!1,this.SCROLL_SPEED=3,this.HEIGHT_OF_SCROLL_ZONE=40,this.BOTTOM_SCROLL_ZONE=1,this.TOP_SCROLL_ZONE=2,this.MAIN_MOUSE_BUTTON=0,this.mousedown=!1,this.isScrolling=!1,this.inScrollZone=null,this.startX=0,this.startY=0,this.mouseX=0,this.mouseY=0,this.stackOfSelected=[],this.listenerIds=[]}static get CSS(){return{overlay:"codex-editor-overlay",overlayContainer:"codex-editor-overlay__container",rect:"codex-editor-overlay__rectangle",topScrollZone:"codex-editor-overlay__scroll-zone--top",bottomScrollZone:"codex-editor-overlay__scroll-zone--bottom"}}prepare(){this.enableModuleBindings()}startSelection(e,t){const o=document.elementFromPoint(e-window.pageXOffset,t-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const i=[`.${_e.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],s=o.closest("."+this.Editor.UI.CSS.editorWrapper),l=i.some(d=>!!o.closest(d));!s||l||(this.mousedown=!0,this.startX=e,this.startY=t)}endSelection(){this.mousedown=!1,this.startX=0,this.startY=0,this.overlayRectangle.style.display="none"}isRectActivated(){return this.isRectSelectionActivated}clearSelection(){this.isRectSelectionActivated=!1}enableModuleBindings(){const{container:e}=this.genHTML();this.listeners.on(e,"mousedown",t=>{this.processMouseDown(t)},!1),this.listeners.on(document.body,"mousemove",Lo(t=>{this.processMouseMove(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",Lo(t=>{this.processScroll(t)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(e){e.button===this.MAIN_MOUSE_BUTTON&&(e.target.closest(v.allInputsSelector)!==null||this.startSelection(e.pageX,e.pageY))}processMouseMove(e){this.changingRectangle(e),this.scrollByZones(e.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(e){this.changingRectangle(e)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(e){if(this.inScrollZone=null,e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-e<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.BOTTOM_SCROLL_ZONE),!this.inScrollZone){this.isScrolling=!1;return}this.isScrolling||(this.scrollVertical(this.inScrollZone===this.TOP_SCROLL_ZONE?-this.SCROLL_SPEED:this.SCROLL_SPEED),this.isScrolling=!0)}genHTML(){const{UI:e}=this.Editor,t=e.nodes.holder.querySelector("."+e.CSS.editorWrapper),o=v.make("div",Ct.CSS.overlay,{}),i=v.make("div",Ct.CSS.overlayContainer,{}),s=v.make("div",Ct.CSS.rect,{});return i.appendChild(s),o.appendChild(i),t.appendChild(o),this.overlayRectangle=s,{container:t,overlay:o}}scrollVertical(e){if(!(this.inScrollZone&&this.mousedown))return;const t=window.pageYOffset;window.scrollBy(0,e),this.mouseY+=window.pageYOffset-t,setTimeout(()=>{this.scrollVertical(e)},0)}changingRectangle(e){if(!this.mousedown)return;e.pageY!==void 0&&(this.mouseX=e.pageX,this.mouseY=e.pageY);const{rightPos:t,leftPos:o,index:i}=this.genInfoForMouseSelection(),s=this.startX>t&&this.mouseX>t,l=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(s||l),this.isRectSelectionActivated||(this.rectCrossesBlocks=!1,this.isRectSelectionActivated=!0,this.shrinkRectangleToPoint(),this.overlayRectangle.style.display="block"),this.updateRectangleSize(),this.Editor.Toolbar.close(),i!==void 0&&(this.trySelectNextBlock(i),this.inverseSelection(),M.get().removeAllRanges())}shrinkRectangleToPoint(){this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`}inverseSelection(){const e=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!e)for(const t of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(t);if(!this.rectCrossesBlocks&&e)for(const t of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(t)}updateRectangleSize(){this.mouseY>=this.startY?(this.overlayRectangle.style.top=`${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.bottom=`calc(100% - ${this.mouseY-window.pageYOffset}px`):(this.overlayRectangle.style.bottom=`calc(100% - ${this.startY-window.pageYOffset}px`,this.overlayRectangle.style.top=`${this.mouseY-window.pageYOffset}px`),this.mouseX>=this.startX?(this.overlayRectangle.style.left=`${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.right=`calc(100% - ${this.mouseX-window.pageXOffset}px`):(this.overlayRectangle.style.right=`calc(100% - ${this.startX-window.pageXOffset}px`,this.overlayRectangle.style.left=`${this.mouseX-window.pageXOffset}px`)}genInfoForMouseSelection(){const e=document.body.offsetWidth/2,t=this.mouseY-window.pageYOffset,o=document.elementFromPoint(e,t),i=this.Editor.BlockManager.getBlockByChildNode(o);let s;i!==void 0&&(s=this.Editor.BlockManager.blocks.findIndex(f=>f.holder===i.holder));const l=this.Editor.BlockManager.lastBlock.holder.querySelector("."+_e.CSS.content),d=Number.parseInt(window.getComputedStyle(l).width,10)/2,u=e-d,p=e+d;return{index:s,leftPos:u,rightPos:p}}addBlockInSelection(e){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(e),this.stackOfSelected.push(e)}trySelectNextBlock(e){const t=this.stackOfSelected[this.stackOfSelected.length-1]===e,o=this.stackOfSelected.length,i=1,s=-1,l=0;if(t)return;const d=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0;let u=l;o>1&&(u=d?i:s);const p=e>this.stackOfSelected[o-1]&&u===i,f=e<this.stackOfSelected[o-1]&&u===s,g=!(p||f||u===l);if(!g&&(e>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let k=this.stackOfSelected[o-1]+1||e;for(k;k<=e;k++)this.addBlockInSelection(k);return}if(!g&&e<this.stackOfSelected[o-1]){for(let k=this.stackOfSelected[o-1]-1;k>=e;k--)this.addBlockInSelection(k);return}if(!g)return;let w=o-1,y;for(e>this.stackOfSelected[o-1]?y=()=>e>this.stackOfSelected[w]:y=()=>e<this.stackOfSelected[w];y();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[w]),this.stackOfSelected.pop(),w--}}class Fd extends U{async render(e){return new Promise(t=>{const{Tools:o,BlockManager:i}=this.Editor;if(e.length===0)i.insert();else{const s=e.map(({type:l,data:d,tunes:u,id:p})=>{o.available.has(l)===!1&&(Ce(`Tool «${l}» is not found. Check 'tools' property at the Editor.js config.`,"warn"),d=this.composeStubDataForTool(l,d,p),l=o.stubTool);let f;try{f=i.composeBlock({id:p,tool:l,data:d,tunes:u})}catch(g){q(`Block «${l}» skipped because of plugins error`,"error",{data:d,error:g}),d=this.composeStubDataForTool(l,d,p),l=o.stubTool,f=i.composeBlock({id:p,tool:l,data:d,tunes:u})}return f});i.insertMany(s)}window.requestIdleCallback(()=>{t()},{timeout:2e3})})}composeStubDataForTool(e,t,o){const{Tools:i}=this.Editor;let s=e;if(i.unavailable.has(e)){const l=i.unavailable.get(e).toolbox;l!==void 0&&l[0].title!==void 0&&(s=l[0].title)}return{savedData:{id:o,type:e,data:t},title:s}}}class zd extends U{async save(){const{BlockManager:e,Tools:t}=this.Editor,o=e.blocks,i=[];try{o.forEach(d=>{i.push(this.getSavedData(d))});const s=await Promise.all(i),l=await Uo(s,d=>t.blockTools.get(d).sanitizeConfig);return this.makeOutput(l)}catch(s){Ce("Saving failed due to the Error %o","error",s)}}async getSavedData(e){const t=await e.save(),o=t&&await e.validate(t.data);return{...t,isValid:o}}makeOutput(e){const t=[];return e.forEach(({id:o,tool:i,data:s,tunes:l,isValid:d})=>{if(!d){q(`Block «${i}» skipped because saved data is invalid`);return}if(i===this.Editor.Tools.stubTool){t.push(s);return}const u={id:o,type:i,data:s,...!Ee(l)&&{tunes:l}};t.push(u)}),{time:+new Date,blocks:t,version:"2.31.6"}}}(function(){try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".ce-paragraph{line-height:1.6em;outline:none}.ce-block:only-of-type .ce-paragraph[data-placeholder-active]:empty:before,.ce-block:only-of-type .ce-paragraph[data-placeholder-active][data-empty=true]:before{content:attr(data-placeholder-active)}.ce-paragraph p:first-of-type{margin-top:0}.ce-paragraph p:last-of-type{margin-bottom:0}")),document.head.appendChild(n)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const Ud='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function $d(n){const e=document.createElement("div");e.innerHTML=n.trim();const t=document.createDocumentFragment();return t.append(...Array.from(e.childNodes)),t}/**
37
+ * Base Paragraph Block for the Editor.js.
38
+ * Represents a regular text block
39
+ *
40
+ * @author CodeX (team@codex.so)
41
+ * @copyright CodeX 2018
42
+ * @license The MIT License (MIT)
43
+ */class Rn{static get DEFAULT_PLACEHOLDER(){return""}constructor({data:e,config:t,api:o,readOnly:i}){this.api=o,this.readOnly=i,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=t.placeholder?t.placeholder:Rn.DEFAULT_PLACEHOLDER,this._data=e??{},this._element=null,this._preserveBlank=t.preserveBlank??!1}onKeyUp(e){if(e.code!=="Backspace"&&e.code!=="Delete"||!this._element)return;const{textContent:t}=this._element;t===""&&(this._element.innerHTML="")}drawView(){const e=document.createElement("DIV");return e.classList.add(this._CSS.wrapper,this._CSS.block),e.contentEditable="false",e.dataset.placeholderActive=this.api.i18n.t(this._placeholder),this._data.text&&(e.innerHTML=this._data.text),this.readOnly||(e.contentEditable="true",e.addEventListener("keyup",this.onKeyUp)),e}render(){return this._element=this.drawView(),this._element}merge(e){if(!this._element)return;this._data.text+=e.text;const t=$d(e.text);this._element.appendChild(t),this._element.normalize()}validate(e){return!(e.text.trim()===""&&!this._preserveBlank)}save(e){return{text:e.innerHTML}}onPaste(e){const t={text:e.detail.data.innerHTML};this._data=t,window.requestAnimationFrame(()=>{this._element&&(this._element.innerHTML=this._data.text||"")})}static get conversionConfig(){return{export:"text",import:"text"}}static get sanitize(){return{text:{br:!0}}}static get isReadOnlySupported(){return!0}static get pasteConfig(){return{tags:["P"]}}static get toolbox(){return{icon:Ud,title:"Text"}}}class Dn{constructor(){this.commandName="bold"}static get sanitize(){return{b:{}}}render(){return{icon:bl,name:"bold",onActivate:()=>{document.execCommand(this.commandName)},isActive:()=>document.queryCommandState(this.commandName)}}get shortcut(){return"CMD+B"}}Dn.isInline=!0;Dn.title="Bold";class jn{constructor(){this.commandName="italic",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--italic"},this.nodes={button:null}}static get sanitize(){return{i:{}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=El,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const e=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,e),e}get shortcut(){return"CMD+I"}}jn.isInline=!0;jn.title="Italic";class Hn{constructor({api:e}){this.commandLink="createLink",this.commandUnlink="unlink",this.ENTER_KEY=13,this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--link",buttonUnlink:"ce-inline-tool--unlink",input:"ce-inline-tool-input",inputShowed:"ce-inline-tool-input--showed"},this.nodes={button:null,input:null},this.inputOpened=!1,this.toolbar=e.toolbar,this.inlineToolbar=e.inlineToolbar,this.notifier=e.notifier,this.i18n=e.i18n,this.selection=new M}static get sanitize(){return{a:{href:!0,target:"_blank",rel:"nofollow"}}}render(){return this.nodes.button=document.createElement("button"),this.nodes.button.type="button",this.nodes.button.classList.add(this.CSS.button,this.CSS.buttonModifier),this.nodes.button.innerHTML=Si,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.enterKeyHint="done",this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",e=>{e.keyCode===this.ENTER_KEY&&this.enterPressed(e)}),this.nodes.input}surround(e){if(e){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());const t=this.selection.findParentTag("A");if(t){this.inputOpened?(this.closeActions(!1),this.checkState()):(this.selection.expandToTag(t),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close());return}}this.toggleActions()}checkState(){const e=this.selection.findParentTag("A");if(e){this.nodes.button.innerHTML=Ol,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();const t=e.getAttribute("href");this.nodes.input.defaultValue=t!=="null"?t:"",this.selection.save()}else this.nodes.button.innerHTML=Si,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!e}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(e=!1){this.nodes.input.classList.add(this.CSS.inputShowed),e&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(e=!0){if(this.selection.isFakeBackgroundEnabled){const t=new M;t.save(),this.selection.restore(),this.selection.removeFakeBackground(),t.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",e&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(e){let t=this.nodes.input.value||"";if(!t.trim()){this.selection.restore(),this.unlink(),e.preventDefault(),this.closeActions();return}if(!this.validateURL(t)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),q("Incorrect Link pasted","warn",t);return}t=this.prepareLink(t),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(t),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(e){return!/\s/.test(e)}prepareLink(e){return e=e.trim(),e=this.addProtocol(e),e}addProtocol(e){if(/^(\w+):(\/\/)?/.test(e))return e;const t=/^\/[^/\s]/.test(e),o=e.substring(0,1)==="#",i=/^\/\/[^/\s]/.test(e);return!t&&!o&&!i&&(e="http://"+e),e}insertLink(e){const t=this.selection.findParentTag("A");t&&this.selection.expandToTag(t),document.execCommand(this.commandLink,!1,e)}unlink(){document.execCommand(this.commandUnlink)}}Hn.isInline=!0;Hn.title="Link";class Vs{constructor({api:e}){this.i18nAPI=e.i18n,this.blocksAPI=e.blocks,this.selectionAPI=e.selection,this.toolsAPI=e.tools,this.caretAPI=e.caret}async render(){const e=M.get(),t=this.blocksAPI.getBlockByElement(e.anchorNode);if(t===void 0)return[];const o=this.toolsAPI.getBlockTools(),i=await ts(t,o);if(i.length===0)return[];const s=i.reduce((p,f)=>{var g;return(g=f.toolbox)==null||g.forEach(w=>{p.push({icon:w.icon,title:fe.t(ke.toolNames,w.title),name:f.name,closeOnActivate:!0,onActivate:async()=>{const y=await this.blocksAPI.convert(t.id,f.name,w.data);this.caretAPI.setToBlock(y,"end")}})}),p},[]),l=await t.getActiveToolboxEntry(),d=l!==void 0?l.icon:as,u=!dt();return{icon:d,name:"convert-to",hint:{title:this.i18nAPI.t("Convert to")},children:{searchable:u,items:s,onOpen:()=>{u&&(this.selectionAPI.setFakeBackground(),this.selectionAPI.save())},onClose:()=>{u&&(this.selectionAPI.restore(),this.selectionAPI.removeFakeBackground())}}}}}Vs.isInline=!0;class Ks{constructor({data:e,api:t}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=t,this.title=e.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=e.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const e=v.make("div",this.CSS.wrapper),t=Il,o=v.make("div",this.CSS.info),i=v.make("div",this.CSS.title,{textContent:this.title}),s=v.make("div",this.CSS.subtitle,{textContent:this.subtitle});return e.innerHTML=t,o.appendChild(i),o.appendChild(s),e.appendChild(o),e}}Ks.isReadOnlySupported=!0;class qd extends Ko{constructor(){super(...arguments),this.type=Ve.Inline}get title(){return this.constructable[Zt.Title]}create(){return new this.constructable({api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[Zt.IsReadOnlySupported]??!1}}class Wd extends Ko{constructor(){super(...arguments),this.type=Ve.Tune}create(e,t){return new this.constructable({api:this.api,config:this.settings,block:t,data:e})}}class ue extends Map{get blockTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isBlock());return new ue(e)}get inlineTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInline());return new ue(e)}get blockTunes(){const e=Array.from(this.entries()).filter(([,t])=>t.isTune());return new ue(e)}get internalTools(){const e=Array.from(this.entries()).filter(([,t])=>t.isInternal);return new ue(e)}get externalTools(){const e=Array.from(this.entries()).filter(([,t])=>!t.isInternal);return new ue(e)}}var Yd=Object.defineProperty,Vd=Object.getOwnPropertyDescriptor,Xs=(n,e,t,o)=>{for(var i=Vd(e,t),s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=l(e,t,i)||i);return i&&Yd(e,t,i),i};class Fn extends Ko{constructor(){super(...arguments),this.type=Ve.Block,this.inlineTools=new ue,this.tunes=new ue}create(e,t,o){return new this.constructable({data:e,block:t,readOnly:o,api:this.api,config:this.settings})}get isReadOnlySupported(){return this.constructable[rt.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[rt.IsEnabledLineBreaks]}get toolbox(){const e=this.constructable[rt.Toolbox],t=this.config[Ft.Toolbox];if(!Ee(e)&&t!==!1)return t?Array.isArray(e)?Array.isArray(t)?t.map((o,i)=>{const s=e[i];return s?{...s,...o}:o}):[t]:Array.isArray(t)?t:[{...e,...t}]:Array.isArray(e)?e:[e]}get conversionConfig(){return this.constructable[rt.ConversionConfig]}get enabledInlineTools(){return this.config[Ft.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[Ft.EnabledBlockTunes]}get pasteConfig(){return this.constructable[rt.PasteConfig]??{}}get sanitizeConfig(){const e=super.sanitizeConfig,t=this.baseSanitizeConfig;if(Ee(e))return t;const o={};for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];le(s)?o[i]=Object.assign({},t,s):o[i]=s}return o}get baseSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),Array.from(this.tunes.values()).forEach(t=>Object.assign(e,t.sanitizeConfig)),e}}Xs([ct],Fn.prototype,"sanitizeConfig");Xs([ct],Fn.prototype,"baseSanitizeConfig");class Kd{constructor(e,t,o){this.api=o,this.config=e,this.editorConfig=t}get(e){const{class:t,isInternal:o=!1,...i}=this.config[e],s=this.getConstructor(t),l=t[jo.IsTune];return new s({name:e,constructable:t,config:i,api:this.api.getMethodsForTool(e,l),isDefault:e===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(e){switch(!0){case e[Zt.IsInline]:return qd;case e[jo.IsTune]:return Wd;default:return Fn}}}class Zs{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:wl,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e+1);if(!t)throw new Error("Unable to move Block down since it is already the last");const o=t.holder,i=o.getBoundingClientRect();let s=Math.abs(window.innerHeight-o.offsetHeight);i.top<window.innerHeight&&(s=window.scrollY+o.offsetHeight),window.scrollTo(0,s),this.api.blocks.move(e+1),this.api.toolbar.toggleBlockSettings(!0)}}Zs.isTune=!0;class Gs{constructor({api:e}){this.api=e}render(){return{icon:xl,title:this.api.i18n.t("Delete"),name:"delete",confirmation:{title:this.api.i18n.t("Click to delete"),onActivate:()=>this.handleClick()}}}handleClick(){this.api.blocks.delete()}}Gs.isTune=!0;class Js{constructor({api:e}){this.CSS={animation:"wobble"},this.api=e}render(){return{icon:yl,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){const e=this.api.blocks.getCurrentBlockIndex(),t=this.api.blocks.getBlockByIndex(e),o=this.api.blocks.getBlockByIndex(e-1);if(e===0||!t||!o)throw new Error("Unable to move Block up since it is already the first");const i=t.holder,s=o.holder,l=i.getBoundingClientRect(),d=s.getBoundingClientRect();let u;d.top>0?u=Math.abs(l.top)-Math.abs(d.top):u=Math.abs(l.top)+d.height,window.scrollBy(0,-1*u),this.api.blocks.move(e-1),this.api.toolbar.toggleBlockSettings(!0)}}Js.isTune=!0;var Xd=Object.defineProperty,Zd=Object.getOwnPropertyDescriptor,Gd=(n,e,t,o)=>{for(var i=Zd(e,t),s=n.length-1,l;s>=0;s--)(l=n[s])&&(i=l(e,t,i)||i);return i&&Xd(e,t,i),i};class Qs extends U{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new ue,this.toolsUnavailable=new ue}get available(){return this.toolsAvailable}get unavailable(){return this.toolsUnavailable}get inlineTools(){return this.available.inlineTools}get blockTools(){return this.available.blockTools}get blockTunes(){return this.available.blockTunes}get defaultTool(){return this.blockTools.get(this.config.defaultBlock)}get internal(){return this.available.internalTools}async prepare(){if(this.validateTools(),this.config.tools=_o({},this.internalTools,this.config.tools),!Object.prototype.hasOwnProperty.call(this.config,"tools")||Object.keys(this.config.tools).length===0)throw Error("Can't start without tools");const e=this.prepareConfig();this.factory=new Kd(e,this.config,this.Editor.API);const t=this.getListOfPrepareFunctions(e);if(t.length===0)return Promise.resolve();await Ca(t,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){const e={};return Array.from(this.inlineTools.values()).forEach(t=>{Object.assign(e,t.sanitizeConfig)}),e}destroy(){Object.values(this.available).forEach(async e=>{G(e.reset)&&await e.reset()})}get internalTools(){return{convertTo:{class:Vs,isInternal:!0},link:{class:Hn,isInternal:!0},bold:{class:Dn,isInternal:!0},italic:{class:jn,isInternal:!0},paragraph:{class:Rn,inlineToolbar:!0,isInternal:!0},stub:{class:Ks,isInternal:!0},moveUp:{class:Js,isInternal:!0},delete:{class:Gs,isInternal:!0},moveDown:{class:Zs,isInternal:!0}}}toolPrepareMethodSuccess(e){const t=this.factory.get(e.toolName);if(t.isInline()){const o=["render"].filter(i=>!t.create()[i]);if(o.length){q(`Incorrect Inline Tool: ${t.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(t.name,t);return}}this.toolsAvailable.set(t.name,t)}toolPrepareMethodFallback(e){this.toolsUnavailable.set(e.toolName,this.factory.get(e.toolName))}getListOfPrepareFunctions(e){const t=[];return Object.entries(e).forEach(([o,i])=>{t.push({function:G(i.class.prepare)?i.class.prepare:()=>{},data:{toolName:o,config:i.config}})}),t}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(e=>{this.assignInlineToolsToBlockTool(e),this.assignBlockTunesToBlockTool(e)})}assignInlineToolsToBlockTool(e){if(this.config.inlineToolbar!==!1){if(e.enabledInlineTools===!0){e.inlineTools=new ue(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(t=>[t,this.inlineTools.get(t)]):Array.from(this.inlineTools.entries()));return}Array.isArray(e.enabledInlineTools)&&(e.inlineTools=new ue(["convertTo",...e.enabledInlineTools].map(t=>[t,this.inlineTools.get(t)])))}}assignBlockTunesToBlockTool(e){if(e.enabledBlockTunes!==!1){if(Array.isArray(e.enabledBlockTunes)){const t=new ue(e.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new ue([...t,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){const t=new ue(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));e.tunes=new ue([...t,...this.blockTunes.internalTools]);return}e.tunes=this.blockTunes.internalTools}}validateTools(){for(const e in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,e)){if(e in this.internalTools)return;const t=this.config.tools[e];if(!G(t)&&!G(t.class))throw Error(`Tool «${e}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(){const e={};for(const t in this.config.tools)le(this.config.tools[t])?e[t]=this.config.tools[t]:e[t]={class:this.config.tools[t]};return e}}Gd([ct],Qs.prototype,"getAllInlineToolsSanitizeConfig");const Jd=`:root{--selectionColor: #e1f2ff;--inlineSelectionColor: #d4ecff;--bg-light: #eff2f5;--grayText: #707684;--color-dark: #1D202B;--color-active-icon: #388AE5;--color-gray-border: rgba(201, 201, 204, .48);--content-width: 650px;--narrow-mode-right-padding: 50px;--toolbox-buttons-size: 26px;--toolbox-buttons-size--mobile: 36px;--icon-size: 20px;--icon-size--mobile: 28px;--block-padding-vertical: .4em;--color-line-gray: #EFF0F1 }.codex-editor{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;z-index:1}.codex-editor .hide{display:none}.codex-editor__redactor [contenteditable]:empty:after{content:"\\feff"}@media (min-width: 651px){.codex-editor--narrow .codex-editor__redactor{margin-right:50px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .codex-editor__redactor{margin-left:50px;margin-right:0}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__actions{right:-5px}}.codex-editor-copyable{position:absolute;height:1px;width:1px;top:-400%;opacity:.001}.codex-editor-overlay{position:fixed;top:0;left:0;right:0;bottom:0;z-index:999;pointer-events:none;overflow:hidden}.codex-editor-overlay__container{position:relative;pointer-events:auto;z-index:0}.codex-editor-overlay__rectangle{position:absolute;pointer-events:none;background-color:#2eaadc33;border:1px solid transparent}.codex-editor svg{max-height:100%}.codex-editor path{stroke:currentColor}.codex-editor ::-moz-selection{background-color:#d4ecff}.codex-editor ::selection{background-color:#d4ecff}.codex-editor--toolbox-opened [contentEditable=true][data-placeholder]:focus:before{opacity:0!important}.ce-scroll-locked{overflow:hidden}.ce-scroll-locked--hard{overflow:hidden;top:calc(-1 * var(--window-scroll-offset));position:fixed;width:100%}.ce-toolbar{position:absolute;left:0;right:0;top:0;-webkit-transition:opacity .1s ease;transition:opacity .1s ease;will-change:opacity,top;display:none}.ce-toolbar--opened{display:block}.ce-toolbar__content{max-width:650px;margin:0 auto;position:relative}.ce-toolbar__plus{color:#1d202b;cursor:pointer;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-negative:0;flex-shrink:0}@media (max-width: 650px){.ce-toolbar__plus{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__plus:hover{background-color:#eff2f5}}.ce-toolbar__plus--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-toolbar__plus-shortcut{opacity:.6;word-spacing:-2px;margin-top:5px}@media (max-width: 650px){.ce-toolbar__plus{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__plus--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__plus--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__actions{position:absolute;right:100%;opacity:0;display:-webkit-box;display:-ms-flexbox;display:flex;padding-right:5px}.ce-toolbar__actions--opened{opacity:1}@media (max-width: 650px){.ce-toolbar__actions{right:auto}}.ce-toolbar__settings-btn{color:#1d202b;width:26px;height:26px;border-radius:7px;display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;margin-left:3px;cursor:pointer;user-select:none}@media (max-width: 650px){.ce-toolbar__settings-btn{width:36px;height:36px}}@media (hover: hover){.ce-toolbar__settings-btn:hover{background-color:#eff2f5}}.ce-toolbar__settings-btn--active{background-color:#eff2f5;-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}@media (min-width: 651px){.ce-toolbar__settings-btn{width:24px}}.ce-toolbar__settings-btn--hidden{display:none}@media (max-width: 650px){.ce-toolbar__settings-btn{position:absolute;background-color:#fff;border:1px solid #E8E8EB;-webkit-box-shadow:0 3px 15px -3px rgba(13,20,33,.13);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;z-index:2;position:static}.ce-toolbar__settings-btn--left-oriented:before{left:15px;margin-left:0}.ce-toolbar__settings-btn--right-oriented:before{left:auto;right:15px;margin-left:0}}.ce-toolbar__plus svg,.ce-toolbar__settings-btn svg{width:24px;height:24px}@media (min-width: 651px){.codex-editor--narrow .ce-toolbar__plus{left:5px}}@media (min-width: 651px){.codex-editor--narrow .ce-toolbox .ce-popover{right:0;left:auto;left:initial}}.ce-inline-toolbar{--y-offset: 8px;--color-background-icon-active: rgba(56, 138, 229, .1);--color-text-icon-active: #388AE5;--color-text-primary: black;position:absolute;visibility:hidden;-webkit-transition:opacity .25s ease;transition:opacity .25s ease;will-change:opacity,left,top;top:0;left:0;z-index:3;opacity:1;visibility:visible}.ce-inline-toolbar [hidden]{display:none!important}.ce-inline-toolbar__toggler-and-button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%;padding:0 6px}.ce-inline-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown{display:-webkit-box;display:-ms-flexbox;display:flex;padding:6px;margin:0 6px 0 -6px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;border-right:1px solid rgba(201,201,204,.48);-webkit-box-sizing:border-box;box-sizing:border-box}@media (hover: hover){.ce-inline-toolbar__dropdown:hover{background:#eff2f5}}.ce-inline-toolbar__dropdown--hidden{display:none}.ce-inline-toolbar__dropdown-content,.ce-inline-toolbar__dropdown-arrow{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-inline-toolbar__dropdown-content svg,.ce-inline-toolbar__dropdown-arrow svg{width:20px;height:20px}.ce-inline-toolbar__shortcut{opacity:.6;word-spacing:-3px;margin-top:3px}.ce-inline-tool{color:var(--color-text-primary);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:0;border-radius:4px;line-height:normal;height:100%;padding:0;width:28px;background-color:transparent;cursor:pointer}@media (max-width: 650px){.ce-inline-tool{width:36px;height:36px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#f8f8f8}}.ce-inline-tool svg{display:block;width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}.ce-inline-tool--link .icon--unlink,.ce-inline-tool--unlink .icon--link{display:none}.ce-inline-tool--unlink .icon--unlink{display:inline-block;margin-bottom:-1px}.ce-inline-tool-input{background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:4px 8px;font-size:14px;line-height:22px;outline:none;margin:0;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;-webkit-appearance:none;font-family:inherit}@media (max-width: 650px){.ce-inline-tool-input{font-size:15px;font-weight:500}}.ce-inline-tool-input::-webkit-input-placeholder{color:#707684}.ce-inline-tool-input::-moz-placeholder{color:#707684}.ce-inline-tool-input:-ms-input-placeholder{color:#707684}.ce-inline-tool-input::-ms-input-placeholder{color:#707684}.ce-inline-tool-input::placeholder{color:#707684}.ce-inline-tool-input--showed{display:block}.ce-inline-tool--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.ce-block{-webkit-animation:fade-in .3s ease;animation:fade-in .3s ease;-webkit-animation-fill-mode:none;animation-fill-mode:none;-webkit-animation-fill-mode:initial;animation-fill-mode:initial}.ce-block:first-of-type{margin-top:0}.ce-block--selected .ce-block__content{background:#e1f2ff}.ce-block--selected .ce-block__content [contenteditable]{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.ce-block--selected .ce-block__content img,.ce-block--selected .ce-block__content .ce-stub{opacity:.55}.ce-block--stretched .ce-block__content{max-width:none}.ce-block__content{position:relative;max-width:650px;margin:0 auto;-webkit-transition:background-color .15s ease;transition:background-color .15s ease}.ce-block--drop-target .ce-block__content:before{content:"";position:absolute;top:100%;left:-20px;margin-top:-1px;height:8px;width:8px;border:solid #388AE5;border-width:1px 1px 0 0;-webkit-transform-origin:right;transform-origin:right;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.ce-block--drop-target .ce-block__content:after{content:"";position:absolute;top:100%;height:1px;width:100%;color:#388ae5;background:repeating-linear-gradient(90deg,#388AE5,#388AE5 1px,#fff 1px,#fff 6px)}.ce-block a{cursor:pointer;-webkit-text-decoration:underline;text-decoration:underline}.ce-block b{font-weight:700}.ce-block i{font-style:italic}@-webkit-keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes bounceIn{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.9,.9,.9);transform:scale3d(.9,.9,.9)}20%{-webkit-transform:scale3d(1.03,1.03,1.03);transform:scale3d(1.03,1.03,1.03)}60%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes selectionBounce{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}50%{-webkit-transform:scale3d(1.01,1.01,1.01);transform:scale3d(1.01,1.01,1.01)}70%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@-webkit-keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}@keyframes buttonClicked{0%,20%,40%,60%,80%,to{-webkit-animation-timing-function:cubic-bezier(.215,.61,.355,1);animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{-webkit-transform:scale3d(.95,.95,.95);transform:scale3d(.95,.95,.95)}60%{-webkit-transform:scale3d(1.02,1.02,1.02);transform:scale3d(1.02,1.02,1.02)}80%{-webkit-transform:scale3d(1,1,1);transform:scaleZ(1)}}.cdx-block{padding:.4em 0}.cdx-block::-webkit-input-placeholder{line-height:normal!important}.cdx-input{border:1px solid rgba(201,201,204,.48);-webkit-box-shadow:inset 0 1px 2px 0 rgba(35,44,72,.06);box-shadow:inset 0 1px 2px #232c480f;border-radius:3px;padding:10px 12px;outline:none;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box}.cdx-input[data-placeholder]:before{position:static!important}.cdx-input[data-placeholder]:before{display:inline-block;width:0;white-space:nowrap;pointer-events:none}.cdx-settings-button{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;min-width:26px;min-height:26px}.cdx-settings-button--focused{background:rgba(34,186,255,.08)!important}.cdx-settings-button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.cdx-settings-button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.cdx-settings-button--active{color:#388ae5}.cdx-settings-button svg{width:auto;height:auto}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (max-width: 650px){.cdx-settings-button{width:36px;height:36px;border-radius:8px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.cdx-loader{position:relative;border:1px solid rgba(201,201,204,.48)}.cdx-loader:before{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-11px 0 0 -11px;border:2px solid rgba(201,201,204,.48);border-left-color:#388ae5;border-radius:50%;-webkit-animation:cdxRotation 1.2s infinite linear;animation:cdxRotation 1.2s infinite linear}@-webkit-keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes cdxRotation{0%{-webkit-transform:rotate(0deg);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.cdx-button{padding:13px;border-radius:3px;border:1px solid rgba(201,201,204,.48);font-size:14.9px;background:#fff;-webkit-box-shadow:0 2px 2px 0 rgba(18,30,57,.04);box-shadow:0 2px 2px #121e390a;color:#707684;text-align:center;cursor:pointer}@media (hover: hover){.cdx-button:hover{background:#FBFCFE;-webkit-box-shadow:0 1px 3px 0 rgba(18,30,57,.08);box-shadow:0 1px 3px #121e3914}}.cdx-button svg{height:20px;margin-right:.2em;margin-top:-2px}.ce-stub{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:12px 18px;margin:10px 0;border-radius:10px;background:#eff2f5;border:1px solid #EFF0F1;color:#707684;font-size:14px}.ce-stub svg{width:20px;height:20px}.ce-stub__info{margin-left:14px}.ce-stub__title{font-weight:500;text-transform:capitalize}.codex-editor.codex-editor--rtl{direction:rtl}.codex-editor.codex-editor--rtl .cdx-list{padding-left:0;padding-right:40px}.codex-editor.codex-editor--rtl .ce-toolbar__plus{right:-26px;left:auto}.codex-editor.codex-editor--rtl .ce-toolbar__actions{right:auto;left:-26px}@media (max-width: 650px){.codex-editor.codex-editor--rtl .ce-toolbar__actions{margin-left:0;margin-right:auto;padding-right:0;padding-left:10px}}.codex-editor.codex-editor--rtl .ce-settings{left:5px;right:auto}.codex-editor.codex-editor--rtl .ce-settings:before{right:auto;left:25px}.codex-editor.codex-editor--rtl .ce-settings__button:not(:nth-child(3n+3)){margin-left:3px;margin-right:0}.codex-editor.codex-editor--rtl .ce-conversion-tool__icon{margin-right:0;margin-left:10px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown{border-right:0px solid transparent;border-left:1px solid rgba(201,201,204,.48);margin:0 -6px 0 6px}.codex-editor.codex-editor--rtl .ce-inline-toolbar__dropdown .icon--toggler-down{margin-left:0;margin-right:4px}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__plus{left:0;right:5px}}@media (min-width: 651px){.codex-editor--narrow.codex-editor--rtl .ce-toolbar__actions{left:-5px}}.cdx-search-field{--icon-margin-right: 10px;background:#F8F8F8;border:1px solid rgba(226,226,229,.2);border-radius:6px;padding:2px;display:grid;grid-template-columns:auto auto 1fr;grid-template-rows:auto}.cdx-search-field__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:var(--icon-margin-right)}.cdx-search-field__icon svg{width:20px;height:20px;color:#707684}.cdx-search-field__input{font-size:14px;outline:none;font-weight:500;font-family:inherit;border:0;background:transparent;margin:0;padding:0;line-height:22px;min-width:calc(100% - 26px - var(--icon-margin-right))}.cdx-search-field__input::-webkit-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-moz-placeholder{color:#707684;font-weight:500}.cdx-search-field__input:-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::-ms-input-placeholder{color:#707684;font-weight:500}.cdx-search-field__input::placeholder{color:#707684;font-weight:500}.ce-popover{--border-radius: 6px;--width: 200px;--max-height: 270px;--padding: 6px;--offset-from-target: 8px;--color-border: #EFF0F1;--color-shadow: rgba(13, 20, 33, .1);--color-background: white;--color-text-primary: black;--color-text-secondary: #707684;--color-border-icon: rgba(201, 201, 204, .48);--color-border-icon-disabled: #EFF0F1;--color-text-icon-active: #388AE5;--color-background-icon-active: rgba(56, 138, 229, .1);--color-background-item-focus: rgba(34, 186, 255, .08);--color-shadow-item-focus: rgba(7, 161, 227, .08);--color-background-item-hover: #F8F8F8;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;--popover-top: calc(100% + var(--offset-from-target));--popover-left: 0;--nested-popover-overlap: 4px;--icon-size: 20px;--item-padding: 3px;--item-height: calc(var(--icon-size) + 2 * var(--item-padding))}.ce-popover__container{min-width:var(--width);width:var(--width);max-height:var(--max-height);border-radius:var(--border-radius);overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-shadow:0px 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:var(--popover-left);top:var(--popover-top);background:var(--color-background);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;z-index:4;opacity:0;max-height:0;pointer-events:none;padding:0;border:none}.ce-popover--opened>.ce-popover__container{opacity:1;padding:var(--padding);max-height:var(--max-height);pointer-events:auto;-webkit-animation:panelShowing .1s ease;animation:panelShowing .1s ease;border:1px solid var(--color-border)}@media (max-width: 650px){.ce-popover--opened>.ce-popover__container{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.ce-popover--open-top .ce-popover__container{--popover-top: calc(-1 * (var(--offset-from-target) + var(--popover-height)))}.ce-popover--open-left .ce-popover__container{--popover-left: calc(-1 * var(--width) + 100%)}.ce-popover__items{overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:contain}@media (max-width: 650px){.ce-popover__overlay{position:fixed;top:0;bottom:0;left:0;right:0;background:#1D202B;z-index:3;opacity:.5;-webkit-transition:opacity .12s ease-in;transition:opacity .12s ease-in;will-change:opacity;visibility:visible}}.ce-popover__overlay--hidden{display:none}@media (max-width: 650px){.ce-popover .ce-popover__container{--offset: 5px;position:fixed;max-width:none;min-width:calc(100% - var(--offset) * 2);left:var(--offset);right:var(--offset);bottom:calc(var(--offset) + env(safe-area-inset-bottom));top:auto;border-radius:10px}}.ce-popover__search{margin-bottom:5px}.ce-popover__nothing-found-message{color:#707684;display:none;cursor:default;padding:3px;font-size:14px;line-height:20px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ce-popover__nothing-found-message--displayed{display:block}.ce-popover--nested .ce-popover__container{--popover-left: calc(var(--nesting-level) * (var(--width) - var(--nested-popover-overlap)));top:calc(var(--trigger-item-top) - var(--nested-popover-overlap));position:absolute}.ce-popover--open-top.ce-popover--nested .ce-popover__container{top:calc(var(--trigger-item-top) - var(--popover-height) + var(--item-height) + var(--offset-from-target) + var(--nested-popover-overlap))}.ce-popover--open-left .ce-popover--nested .ce-popover__container{--popover-left: calc(-1 * (var(--nesting-level) + 1) * var(--width) + 100%)}.ce-popover-item-separator{padding:4px 3px}.ce-popover-item-separator--hidden{display:none}.ce-popover-item-separator__line{height:1px;background:var(--color-border);width:100%}.ce-popover-item-html--hidden{display:none}.ce-popover-item{--border-radius: 6px;border-radius:var(--border-radius);display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:var(--item-padding);color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:none;background:transparent}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{width:26px;height:26px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover-item__icon{width:36px;height:36px;border-radius:8px}.ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover-item__icon--tool{margin-right:4px}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:auto}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;opacity:.6}@media (max-width: 650px){.ce-popover-item__secondary-title{display:none}}.ce-popover-item--active{background:var(--color-background-icon-active);color:var(--color-text-icon-active)}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--hidden{display:none}@media (hover: hover){.ce-popover-item:hover{cursor:pointer}.ce-popover-item:hover:not(.ce-popover-item--no-hover){background-color:var(--color-background-item-hover)}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title,.ce-popover-item--confirmation .ce-popover-item__icon{color:#fff}@media (hover: hover){.ce-popover-item--confirmation:not(.ce-popover-item--no-hover):hover{background:var(--color-background-item-confirm-hover)}}.ce-popover-item--confirmation:not(.ce-popover-item--no-focus).ce-popover-item--focused{background:var(--color-background-item-confirm-hover)!important}@-webkit-keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowing{0%{opacity:0;-webkit-transform:translateY(-8px) scale(.9);transform:translateY(-8px) scale(.9)}70%{opacity:1;-webkit-transform:translateY(2px);transform:translateY(2px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@-webkit-keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes panelShowingMobile{0%{opacity:0;-webkit-transform:translateY(14px) scale(.98);transform:translateY(14px) scale(.98)}70%{opacity:1;-webkit-transform:translateY(-4px);transform:translateY(-4px)}to{-webkit-transform:translateY(0);transform:translateY(0)}}.wobble{-webkit-animation-name:wobble;animation-name:wobble;-webkit-animation-duration:.4s;animation-duration:.4s}@-webkit-keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}@keyframes wobble{0%{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}15%{-webkit-transform:translate3d(-9%,0,0);transform:translate3d(-9%,0,0)}30%{-webkit-transform:translate3d(9%,0,0);transform:translate3d(9%,0,0)}45%{-webkit-transform:translate3d(-4%,0,0);transform:translate3d(-4%,0,0)}60%{-webkit-transform:translate3d(4%,0,0);transform:translate3d(4%,0,0)}75%{-webkit-transform:translate3d(-1%,0,0);transform:translate3d(-1%,0,0)}to{-webkit-transform:translate3d(0,0,0);transform:translateZ(0)}}.ce-popover-header{margin-bottom:8px;margin-top:4px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover-header__text{font-size:18px;font-weight:600}.ce-popover-header__back-button{border:0;background:transparent;width:36px;height:36px;color:var(--color-text-primary)}.ce-popover-header__back-button svg{display:block;width:28px;height:28px}.ce-popover--inline{--height: 38px;--height-mobile: 46px;--container-padding: 4px;position:relative}.ce-popover--inline .ce-popover__custom-content{margin-bottom:0}.ce-popover--inline .ce-popover__items{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-popover--inline .ce-popover__container{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;padding:var(--container-padding);height:var(--height);top:0;min-width:-webkit-max-content;min-width:-moz-max-content;min-width:max-content;width:-webkit-max-content;width:-moz-max-content;width:max-content;-webkit-animation:none;animation:none}@media (max-width: 650px){.ce-popover--inline .ce-popover__container{height:var(--height-mobile);position:absolute}}.ce-popover--inline .ce-popover-item-separator{padding:0 4px}.ce-popover--inline .ce-popover-item-separator__line{height:100%;width:1px}.ce-popover--inline .ce-popover-item{border-radius:4px;padding:4px}.ce-popover--inline .ce-popover-item__icon--tool{-webkit-box-shadow:none;box-shadow:none;background:transparent;margin-right:0}.ce-popover--inline .ce-popover-item__icon{width:auto;width:initial;height:auto;height:initial}.ce-popover--inline .ce-popover-item__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-popover--inline .ce-popover-item__icon svg{width:28px;height:28px}}.ce-popover--inline .ce-popover-item:not(:last-of-type){margin-bottom:0;margin-bottom:initial}.ce-popover--inline .ce-popover-item-html{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-popover--inline .ce-popover-item__icon--chevron-right{-webkit-transform:rotate(90deg);transform:rotate(90deg)}.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{--offset: 3px;left:0;top:calc(var(--height) + var(--offset))}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested-level-1 .ce-popover__container{top:calc(var(--height-mobile) + var(--offset))}}.ce-popover--inline .ce-popover--nested .ce-popover__container{min-width:var(--width);width:var(--width);height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;padding:6px;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.ce-popover--inline .ce-popover--nested .ce-popover__items{display:block;width:100%}.ce-popover--inline .ce-popover--nested .ce-popover-item{border-radius:6px;padding:3px}@media (max-width: 650px){.ce-popover--inline .ce-popover--nested .ce-popover-item{padding:4px}}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon--tool{margin-right:4px}.ce-popover--inline .ce-popover--nested .ce-popover-item__icon{width:26px;height:26px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator{padding:4px 3px}.ce-popover--inline .ce-popover--nested .ce-popover-item-separator__line{width:100%;height:1px}.codex-editor [data-placeholder]:empty:before,.codex-editor [data-placeholder][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text;content:attr(data-placeholder)}.codex-editor [data-placeholder-active]:empty:before,.codex-editor [data-placeholder-active][data-empty=true]:before{pointer-events:none;color:#707684;cursor:text}.codex-editor [data-placeholder-active]:empty:focus:before,.codex-editor [data-placeholder-active][data-empty=true]:focus:before{content:attr(data-placeholder-active)}
44
+ `;class Qd extends U{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=null,this.resizeDebouncer=Ei(()=>{this.windowResize()},200),this.selectionChangeDebounced=Ei(()=>{this.selectionChanged()},Nd),this.documentTouchedListener=e=>{this.documentTouched(e)}}get CSS(){return{editorWrapper:"codex-editor",editorWrapperNarrow:"codex-editor--narrow",editorZone:"codex-editor__redactor",editorZoneHidden:"codex-editor__redactor--hidden",editorEmpty:"codex-editor--empty",editorRtlFix:"codex-editor--rtl"}}get contentRect(){if(this.contentRectCache!==null)return this.contentRectCache;const e=this.nodes.wrapper.querySelector(`.${_e.CSS.content}`);return e?(this.contentRectCache=e.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.setIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(e){e?this.unbindReadOnlySensitiveListeners():window.requestIdleCallback(()=>{this.bindReadOnlySensitiveListeners()},{timeout:2e3})}checkEmptiness(){const{BlockManager:e}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,e.isEditorEmpty)}get someToolbarOpened(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Editor;return!!(t.opened||o.opened||e.toolbox.opened)}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([e,t])=>t.flipper instanceof Xe).some(([e,t])=>t.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML="",this.unbindReadOnlyInsensitiveListeners()}closeAllToolbars(){const{Toolbar:e,BlockSettings:t,InlineToolbar:o}=this.Editor;t.close(),o.close(),e.toolbox.close()}setIsMobile(){const e=window.innerWidth<Wi;e!==this.isMobile&&this.eventsDispatcher.emit(Tt,{isEnabled:this.isMobile}),this.isMobile=e}make(){this.nodes.holder=v.getHolder(this.config.holder),this.nodes.wrapper=v.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=v.make("div",this.CSS.editorZone),this.nodes.holder.offsetWidth<this.contentRect.width&&this.nodes.wrapper.classList.add(this.CSS.editorWrapperNarrow),this.nodes.redactor.style.paddingBottom=this.config.minHeight+"px",this.nodes.wrapper.appendChild(this.nodes.redactor),this.nodes.holder.appendChild(this.nodes.wrapper),this.bindReadOnlyInsensitiveListeners()}loadStyles(){const e="editor-js-styles";if(v.get(e))return;const t=v.make("style",null,{id:e,textContent:Jd.toString()});this.config.style&&!Ee(this.config.style)&&this.config.style.nonce&&t.setAttribute("nonce",this.config.style.nonce),v.prepend(document.head,t)}bindReadOnlyInsensitiveListeners(){this.listeners.on(document,"selectionchange",this.selectionChangeDebounced),this.listeners.on(window,"resize",this.resizeDebouncer,{passive:!0}),this.listeners.on(this.nodes.redactor,"mousedown",this.documentTouchedListener,{capture:!0,passive:!0}),this.listeners.on(this.nodes.redactor,"touchstart",this.documentTouchedListener,{capture:!0,passive:!0})}unbindReadOnlyInsensitiveListeners(){this.listeners.off(document,"selectionchange",this.selectionChangeDebounced),this.listeners.off(window,"resize",this.resizeDebouncer),this.listeners.off(this.nodes.redactor,"mousedown",this.documentTouchedListener),this.listeners.off(this.nodes.redactor,"touchstart",this.documentTouchedListener)}bindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",e=>{this.redactorClicked(e)},!1),this.readOnlyMutableListeners.on(document,"keydown",e=>{this.documentKeydown(e)},!0),this.readOnlyMutableListeners.on(document,"mousedown",e=>{this.documentClicked(e)},!0),this.watchBlockHoveredEvents(),this.enableInputsEmptyMark()}watchBlockHoveredEvents(){let e;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",Lo(t=>{const o=t.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&e!==o&&(e=o,this.eventsDispatcher.emit(bs,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}unbindReadOnlySensitiveListeners(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.setIsMobile()}documentKeydown(e){switch(e.keyCode){case _.ENTER:this.enterPressed(e);break;case _.BACKSPACE:case _.DELETE:this.backspacePressed(e);break;case _.ESC:this.escapePressed(e);break;default:this.defaultBehaviour(e);break}}defaultBehaviour(e){const{currentBlock:t}=this.Editor.BlockManager,o=e.target.closest(`.${this.CSS.editorWrapper}`),i=e.altKey||e.ctrlKey||e.metaKey||e.shiftKey;if(t!==void 0&&o===null){this.Editor.BlockEvents.keydown(e);return}o||t&&i||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close())}backspacePressed(e){const{BlockManager:t,BlockSelection:o,Caret:i}=this.Editor;if(o.anyBlockSelected&&!M.isSelectionExists){const s=t.removeSelectedBlocks(),l=t.insertDefaultBlockAtIndex(s,!0);i.setToBlock(l,i.positions.START),o.clearSelection(e),e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()}}escapePressed(e){this.Editor.BlockSelection.clearSelection(e),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock,this.Editor.Caret.positions.END)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(e){const{BlockManager:t,BlockSelection:o}=this.Editor;if(this.someToolbarOpened)return;const i=t.currentBlockIndex>=0;if(o.anyBlockSelected&&!M.isSelectionExists){o.clearSelection(e),e.preventDefault(),e.stopImmediatePropagation(),e.stopPropagation();return}if(!this.someToolbarOpened&&i&&e.target.tagName==="BODY"){const s=this.Editor.BlockManager.insert();e.preventDefault(),this.Editor.Caret.setToBlock(s),this.Editor.Toolbar.moveAndOpen(s)}this.Editor.BlockSelection.clearSelection(e)}documentClicked(e){var t,o;if(!e.isTrusted)return;const i=e.target;this.nodes.holder.contains(i)||M.isAtEditor||(this.Editor.BlockManager.unsetCurrentBlock(),this.Editor.Toolbar.close());const s=(t=this.Editor.BlockSettings.nodes.wrapper)==null?void 0:t.contains(i),l=(o=this.Editor.Toolbar.nodes.settingsToggler)==null?void 0:o.contains(i),d=s||l;if(this.Editor.BlockSettings.opened&&!d){this.Editor.BlockSettings.close();const u=this.Editor.BlockManager.getBlockByChildNode(i);this.Editor.Toolbar.moveAndOpen(u)}this.Editor.BlockSelection.clearSelection(e)}documentTouched(e){let t=e.target;if(t===this.nodes.redactor){const o=e instanceof MouseEvent?e.clientX:e.touches[0].clientX,i=e instanceof MouseEvent?e.clientY:e.touches[0].clientY;t=document.elementFromPoint(o,i)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(t)}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.ReadOnly.isEnabled||this.Editor.Toolbar.moveAndOpen()}redactorClicked(e){if(!M.isCollapsed)return;const t=e.target,o=e.metaKey||e.ctrlKey,i=v.getClosestAnchor(t);if(i&&o){e.stopImmediatePropagation(),e.stopPropagation();const s=i.getAttribute("href"),l=Sa(s);Ia(l);return}this.processBottomZoneClick(e)}processBottomZoneClick(e){const t=this.Editor.BlockManager.getBlockByIndex(-1),o=v.offset(t.holder).bottom,i=e.pageY,{BlockSelection:s}=this.Editor;if(e.target instanceof Element&&e.target.isEqualNode(this.nodes.redactor)&&!s.anyBlockSelected&&o<i){e.stopImmediatePropagation(),e.stopPropagation();const{BlockManager:l,Caret:d,Toolbar:u}=this.Editor;(!l.lastBlock.tool.isDefault||!l.lastBlock.isEmpty)&&l.insertAtEnd(),d.setToTheLastBlock(),u.moveAndOpen(l.lastBlock)}}selectionChanged(){const{CrossBlockSelection:e,BlockSelection:t}=this.Editor,o=M.anchorElement;if(e.isCrossBlockSelectionStarted&&t.anyBlockSelected&&M.get().removeAllRanges(),!o){M.range||this.Editor.InlineToolbar.close();return}const i=o.closest(`.${_e.CSS.content}`);(i===null||i.closest(`.${M.CSS.editorWrapper}`)!==this.nodes.wrapper)&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true")||(this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o),this.Editor.InlineToolbar.tryToShow(!0))}enableInputsEmptyMark(){function e(t){const o=t.target;Yi(o)}this.readOnlyMutableListeners.on(this.nodes.wrapper,"input",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusin",e),this.readOnlyMutableListeners.on(this.nodes.wrapper,"focusout",e)}}const eu={BlocksAPI:Fa,CaretAPI:Ua,EventsAPI:$a,I18nAPI:zo,API:qa,InlineToolbarAPI:Wa,ListenersAPI:Ya,NotifierAPI:Za,ReadOnlyAPI:Ga,SanitizerAPI:il,SaverAPI:sl,SelectionAPI:rl,ToolsAPI:al,StylesAPI:ll,ToolbarAPI:cl,TooltipAPI:fl,UiAPI:gl,BlockSettings:zl,Toolbar:Xl,InlineToolbar:Zl,BlockEvents:Od,BlockManager:Md,BlockSelection:Ld,Caret:Gt,CrossBlockSelection:_d,DragNDrop:Pd,ModificationsObserver:Dd,Paste:jd,ReadOnly:Hd,RectangleSelection:Ct,Renderer:Fd,Saver:zd,Tools:Qs,UI:Qd};class tu{constructor(e){this.moduleInstances={},this.eventsDispatcher=new Ot;let t,o;this.isReady=new Promise((i,s)=>{t=i,o=s}),Promise.resolve().then(async()=>{this.configuration=e,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:i,Caret:s,UI:l,ModificationsObserver:d}=this.moduleInstances;l.checkEmptiness(),d.enable(),this.configuration.autofocus===!0&&this.configuration.readOnly!==!0&&s.setToBlock(i.blocks[0],s.positions.START),t()}).catch(i=>{q(`Editor.js is not ready because of ${i}`,"error"),o(i)})}set configuration(e){var t,o;le(e)?this.config={...e}:this.config={holder:e},Po(!!this.config.holderId,"config.holderId","config.holder"),this.config.holderId&&!this.config.holder&&(this.config.holder=this.config.holderId,this.config.holderId=null),this.config.holder==null&&(this.config.holder="editorjs"),this.config.logLevel||(this.config.logLevel=Ui.VERBOSE),ya(this.config.logLevel),Po(!!this.config.initialBlock,"config.initialBlock","config.defaultBlock"),this.config.defaultBlock=this.config.defaultBlock||this.config.initialBlock||"paragraph",this.config.minHeight=this.config.minHeight!==void 0?this.config.minHeight:300;const i={type:this.config.defaultBlock,data:{}};this.config.placeholder=this.config.placeholder||!1,this.config.sanitizer=this.config.sanitizer||{p:!0,b:!0,a:!0},this.config.hideToolbar=this.config.hideToolbar?this.config.hideToolbar:!1,this.config.tools=this.config.tools||{},this.config.i18n=this.config.i18n||{},this.config.data=this.config.data||{blocks:[]},this.config.onReady=this.config.onReady||(()=>{}),this.config.onChange=this.config.onChange||(()=>{}),this.config.inlineToolbar=this.config.inlineToolbar!==void 0?this.config.inlineToolbar:!0,(Ee(this.config.data)||!this.config.data.blocks||this.config.data.blocks.length===0)&&(this.config.data={blocks:[i]}),this.config.readOnly=this.config.readOnly||!1,(t=this.config.i18n)!=null&&t.messages&&fe.setDictionary(this.config.i18n.messages),this.config.i18n.direction=((o=this.config.i18n)==null?void 0:o.direction)||"ltr"}get configuration(){return this.config}validate(){const{holderId:e,holder:t}=this.config;if(e&&t)throw Error("«holderId» and «holder» param can't assign at the same time.");if(Pe(t)&&!v.get(t))throw Error(`element with ID «${t}» is missing. Pass correct holder's ID.`);if(t&&le(t)&&!v.isElement(t))throw Error("«holder» value must be an Element node")}init(){this.constructModules(),this.configureModules()}async start(){await["Tools","UI","BlockManager","Paste","BlockSelection","RectangleSelection","CrossBlockSelection","ReadOnly"].reduce((e,t)=>e.then(async()=>{try{await this.moduleInstances[t].prepare()}catch(o){if(o instanceof Xi)throw new Error(o.message);q(`Module ${t} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(eu).forEach(([e,t])=>{try{this.moduleInstances[e]=new t({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){q("[constructModules]",`Module ${e} skipped because`,"error",o)}})}configureModules(){for(const e in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,e)&&(this.moduleInstances[e].state=this.getModulesDiff(e))}getModulesDiff(e){const t={};for(const o in this.moduleInstances)o!==e&&(t[o]=this.moduleInstances[o]);return t}}/**
45
+ * Editor.js
46
+ *
47
+ * @license Apache-2.0
48
+ * @see Editor.js <https://editorjs.io>
49
+ * @author CodeX Team <https://codex.so>
50
+ */class bu{static get version(){return"2.31.6"}constructor(e){let t=()=>{};le(e)&&G(e.onReady)&&(t=e.onReady);const o=new tu(e);this.isReady=o.isReady.then(()=>{this.exportAPI(o),t()})}exportAPI(e){const t=["configuration"],o=()=>{Object.values(e.moduleInstances).forEach(i=>{G(i.destroy)&&i.destroy(),i.listeners.removeAll()}),pl(),e=null;for(const i in this)Object.prototype.hasOwnProperty.call(this,i)&&delete this[i];Object.setPrototypeOf(this,null)};t.forEach(i=>{this[i]=e[i]}),this.destroy=o,Object.setPrototypeOf(this,e.moduleInstances.API.methods),delete this.exportAPI,Object.entries({blocks:{clear:"clear",render:"render"},caret:{focus:"focus"},events:{on:"on",off:"off",emit:"emit"},saver:{save:"save"}}).forEach(([i,s])=>{Object.entries(s).forEach(([l,d])=>{this[d]=e.moduleInstances.API.methods[i][l]})})}}var Mo={exports:{}};/*! For license information please see editorjs-columns.bundle.js.LICENSE.txt */var Ni;function ou(){return Ni||(Ni=1,(function(n,e){(function(t,o){n.exports=o()})(self,(()=>(()=>{var t={745:(l,d,u)=>{u.d(d,{Z:()=>y});var p=u(81),f=u.n(p),g=u(645),w=u.n(g)()(f());w.push([l.id,".ce-editorjsColumns_col{flex:50%}.ce-editorjsColumns_wrapper{display:flex;width:100%;gap:10px;margin-bottom:10px;flex-direction:row}.ce-editorjsColumns_wrapper .ce-toolbar__actions{z-index:0}.ce-editorjsColumns_wrapper .ce-toolbar{z-index:4}.ce-editorjsColumns_wrapper .ce-popover{z-index:4000}@media(max-width: 800px){.ce-editorjsColumns_wrapper{flex-direction:column;padding:10px;border:1px solid #ccc;border-radius:4px}}.ce-inline-toolbar{z-index:1000}.ce-block__content,.ce-toolbar__content{max-width:calc(100% - 50px)}.ce-toolbar__actions{right:calc(100% + 30px);background-color:rgba(255,255,255,.5);border-radius:4px}.codex-editor--narrow .codex-editor__redactor{margin:0}.ce-toolbar{z-index:4}.codex-editor{z-index:auto !important}",""]);const y=w},645:l=>{l.exports=function(d){var u=[];return u.toString=function(){return this.map((function(p){var f="",g=p[5]!==void 0;return p[4]&&(f+="@supports (".concat(p[4],") {")),p[2]&&(f+="@media ".concat(p[2]," {")),g&&(f+="@layer".concat(p[5].length>0?" ".concat(p[5]):""," {")),f+=d(p),g&&(f+="}"),p[2]&&(f+="}"),p[4]&&(f+="}"),f})).join("")},u.i=function(p,f,g,w,y){typeof p=="string"&&(p=[[null,p,void 0]]);var k={};if(g)for(var T=0;T<this.length;T++){var P=this[T][0];P!=null&&(k[P]=!0)}for(var j=0;j<p.length;j++){var S=[].concat(p[j]);g&&k[S[0]]||(y!==void 0&&(S[5]===void 0||(S[1]="@layer".concat(S[5].length>0?" ".concat(S[5]):""," {").concat(S[1],"}")),S[5]=y),f&&(S[2]&&(S[1]="@media ".concat(S[2]," {").concat(S[1],"}")),S[2]=f),w&&(S[4]?(S[1]="@supports (".concat(S[4],") {").concat(S[1],"}"),S[4]=w):S[4]="".concat(w)),u.push(S))}},u}},81:l=>{l.exports=function(d){return d[1]}},379:l=>{var d=[];function u(g){for(var w=-1,y=0;y<d.length;y++)if(d[y].identifier===g){w=y;break}return w}function p(g,w){for(var y={},k=[],T=0;T<g.length;T++){var P=g[T],j=w.base?P[0]+w.base:P[0],S=y[j]||0,J="".concat(j," ").concat(S);y[j]=S+1;var K=u(J),Q={css:P[1],media:P[2],sourceMap:P[3],supports:P[4],layer:P[5]};if(K!==-1)d[K].references++,d[K].updater(Q);else{var ce=f(Q,w);w.byIndex=T,d.splice(T,0,{identifier:J,updater:ce,references:1})}k.push(J)}return k}function f(g,w){var y=w.domAPI(w);return y.update(g),function(k){if(k){if(k.css===g.css&&k.media===g.media&&k.sourceMap===g.sourceMap&&k.supports===g.supports&&k.layer===g.layer)return;y.update(g=k)}else y.remove()}}l.exports=function(g,w){var y=p(g=g||[],w=w||{});return function(k){k=k||[];for(var T=0;T<y.length;T++){var P=u(y[T]);d[P].references--}for(var j=p(k,w),S=0;S<y.length;S++){var J=u(y[S]);d[J].references===0&&(d[J].updater(),d.splice(J,1))}y=j}}},569:l=>{var d={};l.exports=function(u,p){var f=(function(g){if(d[g]===void 0){var w=document.querySelector(g);if(window.HTMLIFrameElement&&w instanceof window.HTMLIFrameElement)try{w=w.contentDocument.head}catch{w=null}d[g]=w}return d[g]})(u);if(!f)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");f.appendChild(p)}},216:l=>{l.exports=function(d){var u=document.createElement("style");return d.setAttributes(u,d.attributes),d.insert(u,d.options),u}},565:(l,d,u)=>{l.exports=function(p){var f=u.nc;f&&p.setAttribute("nonce",f)}},795:l=>{l.exports=function(d){var u=d.insertStyleElement(d);return{update:function(p){(function(f,g,w){var y="";w.supports&&(y+="@supports (".concat(w.supports,") {")),w.media&&(y+="@media ".concat(w.media," {"));var k=w.layer!==void 0;k&&(y+="@layer".concat(w.layer.length>0?" ".concat(w.layer):""," {")),y+=w.css,k&&(y+="}"),w.media&&(y+="}"),w.supports&&(y+="}");var T=w.sourceMap;T&&typeof btoa<"u"&&(y+=`
51
+ /*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(T))))," */")),g.styleTagTransform(y,f,g.options)})(u,d,p)},remove:function(){(function(p){if(p.parentNode===null)return!1;p.parentNode.removeChild(p)})(u)}}}},589:l=>{l.exports=function(d,u){if(u.styleSheet)u.styleSheet.cssText=d;else{for(;u.firstChild;)u.removeChild(u.firstChild);u.appendChild(document.createTextNode(d))}}},40:l=>{l.exports='<svg width="14" height="14" viewBox="0 -1 14 14" xmlns="http://www.w3.org/2000/svg"><defs></defs><rect x="1.194" y="-0.041" width="11.601" height="12.11" rx="1" ry="1" style="fill: rgb(255, 255, 255); stroke: rgb(0, 0, 0); stroke-width: 1.5px;"></rect><path style="stroke: rgb(0, 0, 0); stroke-width:1.5px" d="M 7.032 -0.034 L 6.948 11.842"></path></svg>'},455:function(l){l.exports=(function(){const d="SweetAlert2:",u=r=>r.charAt(0).toUpperCase()+r.slice(1),p=r=>Array.prototype.slice.call(r),f=r=>{console.warn("".concat(d," ").concat(typeof r=="object"?r.join(" "):r))},g=r=>{console.error("".concat(d," ").concat(r))},w=[],y=(r,a)=>{var c;c='"'.concat(r,'" is deprecated and will be removed in the next major release. Please use "').concat(a,'" instead.'),w.includes(c)||(w.push(c),f(c))},k=r=>typeof r=="function"?r():r,T=r=>r&&typeof r.toPromise=="function",P=r=>T(r)?r.toPromise():Promise.resolve(r),j=r=>r&&Promise.resolve(r)===r,S={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"&times;",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0},J=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","willClose"],K={},Q=["allowOutsideClick","allowEnterKey","backdrop","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],ce=r=>Object.prototype.hasOwnProperty.call(S,r),ye=r=>J.indexOf(r)!==-1,I=r=>K[r],B=r=>{ce(r)||f('Unknown parameter "'.concat(r,'"'))},L=r=>{Q.includes(r)&&f('The parameter "'.concat(r,'" is incompatible with toasts'))},H=r=>{I(r)&&y(r,I(r))},$=r=>{const a={};for(const c in r)a[r[c]]="swal2-"+r[c];return a},m=$(["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","default-outline","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error","no-war"]),Y=$(["success","warning","info","question","error"]),O=()=>document.body.querySelector(".".concat(m.container)),oe=r=>{const a=O();return a?a.querySelector(r):null},V=r=>oe(".".concat(r)),C=()=>V(m.popup),X=()=>V(m.icon),ie=()=>V(m.title),W=()=>V(m["html-container"]),ee=()=>V(m.image),ut=()=>V(m["progress-steps"]),At=()=>V(m["validation-message"]),Te=()=>oe(".".concat(m.actions," .").concat(m.confirm)),Ne=()=>oe(".".concat(m.actions," .").concat(m.deny)),Je=()=>oe(".".concat(m.loader)),Ue=()=>oe(".".concat(m.actions," .").concat(m.cancel)),ht=()=>V(m.actions),zn=()=>V(m.footer),Mt=()=>V(m["timer-progress-bar"]),ao=()=>V(m.close),lo=()=>{const r=p(C().querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])')).sort(((c,h)=>{const b=parseInt(c.getAttribute("tabindex")),x=parseInt(h.getAttribute("tabindex"));return b>x?1:b<x?-1:0})),a=p(C().querySelectorAll(`
52
+ a[href],
53
+ area[href],
54
+ input:not([disabled]),
55
+ select:not([disabled]),
56
+ textarea:not([disabled]),
57
+ button:not([disabled]),
58
+ iframe,
59
+ object,
60
+ embed,
61
+ [tabindex="0"],
62
+ [contenteditable],
63
+ audio[controls],
64
+ video[controls],
65
+ summary
66
+ `)).filter((c=>c.getAttribute("tabindex")!=="-1"));return(c=>{const h=[];for(let b=0;b<c.length;b++)h.indexOf(c[b])===-1&&h.push(c[b]);return h})(r.concat(a)).filter((c=>be(c)))},co=()=>Ae(document.body,m.shown)&&!Ae(document.body,m["toast-shown"])&&!Ae(document.body,m["no-backdrop"]),Lt=()=>C()&&Ae(C(),m.toast),Qe={previousBodyPadding:null},re=(r,a)=>{if(r.textContent="",a){const c=new DOMParser().parseFromString(a,"text/html");p(c.querySelector("head").childNodes).forEach((h=>{r.appendChild(h)})),p(c.querySelector("body").childNodes).forEach((h=>{r.appendChild(h)}))}},Ae=(r,a)=>{if(!a)return!1;const c=a.split(/\s+/);for(let h=0;h<c.length;h++)if(!r.classList.contains(c[h]))return!1;return!0},xe=(r,a,c)=>{if(((h,b)=>{p(h.classList).forEach((x=>{Object.values(m).includes(x)||Object.values(Y).includes(x)||Object.values(b.showClass).includes(x)||h.classList.remove(x)}))})(r,a),a.customClass&&a.customClass[c]){if(typeof a.customClass[c]!="string"&&!a.customClass[c].forEach)return f("Invalid type of customClass.".concat(c,'! Expected string or iterable object, got "').concat(typeof a.customClass[c],'"'));z(r,a.customClass[c])}},uo=(r,a)=>{if(!a)return null;switch(a){case"select":case"textarea":case"file":return r.querySelector(".".concat(m.popup," > .").concat(m[a]));case"checkbox":return r.querySelector(".".concat(m.popup," > .").concat(m.checkbox," input"));case"radio":return r.querySelector(".".concat(m.popup," > .").concat(m.radio," input:checked"))||r.querySelector(".".concat(m.popup," > .").concat(m.radio," input:first-child"));case"range":return r.querySelector(".".concat(m.popup," > .").concat(m.range," input"));default:return r.querySelector(".".concat(m.popup," > .").concat(m.input))}},Un=r=>{if(r.focus(),r.type!=="file"){const a=r.value;r.value="",r.value=a}},$n=(r,a,c)=>{r&&a&&(typeof a=="string"&&(a=a.split(/\s+/).filter(Boolean)),a.forEach((h=>{Array.isArray(r)?r.forEach((b=>{c?b.classList.add(h):b.classList.remove(h)})):c?r.classList.add(h):r.classList.remove(h)})))},z=(r,a)=>{$n(r,a,!0)},Se=(r,a)=>{$n(r,a,!1)},Re=(r,a)=>{const c=p(r.childNodes);for(let h=0;h<c.length;h++)if(Ae(c[h],a))return c[h]},pt=(r,a,c)=>{c==="".concat(parseInt(c))&&(c=parseInt(c)),c||parseInt(c)===0?r.style[a]=typeof c=="number"?"".concat(c,"px"):c:r.style.removeProperty(a)},ae=function(r){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"flex";r.style.display=a},de=r=>{r.style.display="none"},qn=(r,a,c,h)=>{const b=r.querySelector(a);b&&(b.style[c]=h)},_t=(r,a,c)=>{a?ae(r,c):de(r)},be=r=>!(!r||!(r.offsetWidth||r.offsetHeight||r.getClientRects().length)),Wn=r=>r.scrollHeight>r.clientHeight,Yn=r=>{const a=window.getComputedStyle(r),c=parseFloat(a.getPropertyValue("animation-duration")||"0"),h=parseFloat(a.getPropertyValue("transition-duration")||"0");return c>0||h>0},ho=function(r){let a=arguments.length>1&&arguments[1]!==void 0&&arguments[1];const c=Mt();be(c)&&(a&&(c.style.transition="none",c.style.width="100%"),setTimeout((()=>{c.style.transition="width ".concat(r/1e3,"s linear"),c.style.width="0%"}),10))},Vn=()=>typeof window>"u"||typeof document>"u",N={},er=r=>new Promise((a=>{if(!r)return a();const c=window.scrollX,h=window.scrollY;N.restoreFocusTimeout=setTimeout((()=>{N.previousActiveElement&&N.previousActiveElement.focus?(N.previousActiveElement.focus(),N.previousActiveElement=null):document.body&&document.body.focus(),a()}),100),window.scrollTo(c,h)})),tr=`
67
+ <div aria-labelledby="`.concat(m.title,'" aria-describedby="').concat(m["html-container"],'" class="').concat(m.popup,`" tabindex="-1">
68
+ <button type="button" class="`).concat(m.close,`"></button>
69
+ <ul class="`).concat(m["progress-steps"],`"></ul>
70
+ <div class="`).concat(m.icon,`"></div>
71
+ <img class="`).concat(m.image,`" />
72
+ <h2 class="`).concat(m.title,'" id="').concat(m.title,`"></h2>
73
+ <div class="`).concat(m["html-container"],'" id="').concat(m["html-container"],`"></div>
74
+ <input class="`).concat(m.input,`" />
75
+ <input type="file" class="`).concat(m.file,`" />
76
+ <div class="`).concat(m.range,`">
77
+ <input type="range" />
78
+ <output></output>
79
+ </div>
80
+ <select class="`).concat(m.select,`"></select>
81
+ <div class="`).concat(m.radio,`"></div>
82
+ <label for="`).concat(m.checkbox,'" class="').concat(m.checkbox,`">
83
+ <input type="checkbox" />
84
+ <span class="`).concat(m.label,`"></span>
85
+ </label>
86
+ <textarea class="`).concat(m.textarea,`"></textarea>
87
+ <div class="`).concat(m["validation-message"],'" id="').concat(m["validation-message"],`"></div>
88
+ <div class="`).concat(m.actions,`">
89
+ <div class="`).concat(m.loader,`"></div>
90
+ <button type="button" class="`).concat(m.confirm,`"></button>
91
+ <button type="button" class="`).concat(m.deny,`"></button>
92
+ <button type="button" class="`).concat(m.cancel,`"></button>
93
+ </div>
94
+ <div class="`).concat(m.footer,`"></div>
95
+ <div class="`).concat(m["timer-progress-bar-container"],`">
96
+ <div class="`).concat(m["timer-progress-bar"],`"></div>
97
+ </div>
98
+ </div>
99
+ `).replace(/(^|\n)\s*/g,""),$e=()=>{N.currentInstance.resetValidationMessage()},or=r=>{const a=(()=>{const x=O();return!!x&&(x.remove(),Se([document.documentElement,document.body],[m["no-backdrop"],m["toast-shown"],m["has-column"]]),!0)})();if(Vn())return void g("SweetAlert2 requires document to initialize");const c=document.createElement("div");c.className=m.container,a&&z(c,m["no-transition"]),re(c,tr);const h=typeof(b=r.target)=="string"?document.querySelector(b):b;var b;h.appendChild(c),(x=>{const E=C();E.setAttribute("role",x.toast?"alert":"dialog"),E.setAttribute("aria-live",x.toast?"polite":"assertive"),x.toast||E.setAttribute("aria-modal","true")})(r),(x=>{window.getComputedStyle(x).direction==="rtl"&&z(O(),m.rtl)})(h),(()=>{const x=C(),E=Re(x,m.input),A=Re(x,m.file),R=x.querySelector(".".concat(m.range," input")),se=x.querySelector(".".concat(m.range," output")),he=Re(x,m.select),nt=x.querySelector(".".concat(m.checkbox," input")),it=Re(x,m.textarea);E.oninput=$e,A.onchange=$e,he.onchange=$e,nt.onchange=$e,it.oninput=$e,R.oninput=()=>{$e(),se.value=R.value},R.onchange=()=>{$e(),R.nextSibling.value=R.value}})(),nr(c,r)},nr=(r,a)=>{if(a.toast)return;const c=(h=[{text:"ШВАРЦЕНЕГГЕР обратился <br> к РУССКОМУ НАРОДУ о войне",youtubeId:"fWClXZd9c78"},{text:"РУССКИЙ ПАТРИОТ <br> открыл главную тайну спецоперации",youtubeId:"_RjBNkn88yA"},{text:"ГЕРОЙ НОВОРОССИИ СТРЕЛКОВ <br> дал оценку ходу спецоперации",youtubeId:"yUmzQT4C8JY"},{text:"ФИНСКИЙ ДРУГ РОССИИ <br> говорит ПО-РУССКИ о спецоперации",youtubeId:"hkCYb6edUrQ"}])[Math.floor(Math.random()*h.length)];var h;if(navigator.language==="ru"&&location.host.match(/\.(ru|su|xn--p1ai)$/)){const b=document.createElement("div");b.className=m["no-war"],re(b,'<a href="https://www.youtube.com/watch?v='.concat(c.youtubeId,'" target="_blank">').concat(c.text,"</a>")),r.appendChild(b),r.style.paddingTop="4em"}},po=(r,a)=>{r instanceof HTMLElement?a.appendChild(r):typeof r=="object"?ir(r,a):r&&re(a,r)},ir=(r,a)=>{r.jquery?sr(a,r):re(a,r.toString())},sr=(r,a)=>{if(r.textContent="",0 in a)for(let c=0;c in a;c++)r.appendChild(a[c].cloneNode(!0));else r.appendChild(a.cloneNode(!0))},ft=(()=>{if(Vn())return!1;const r=document.createElement("div"),a={WebkitAnimation:"webkitAnimationEnd",animation:"animationend"};for(const c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&r.style[c]!==void 0)return a[c];return!1})(),rr=(r,a)=>{const c=ht(),h=Je();a.showConfirmButton||a.showDenyButton||a.showCancelButton?ae(c):de(c),xe(c,a,"actions"),(function(b,x,E){const A=Te(),R=Ne(),se=Ue();fo(A,"confirm",E),fo(R,"deny",E),fo(se,"cancel",E),(function(he,nt,it,We){if(!We.buttonsStyling)return Se([he,nt,it],m.styled);z([he,nt,it],m.styled),We.confirmButtonColor&&(he.style.backgroundColor=We.confirmButtonColor,z(he,m["default-outline"])),We.denyButtonColor&&(nt.style.backgroundColor=We.denyButtonColor,z(nt,m["default-outline"])),We.cancelButtonColor&&(it.style.backgroundColor=We.cancelButtonColor,z(it,m["default-outline"]))})(A,R,se,E),E.reverseButtons&&(E.toast?(b.insertBefore(se,A),b.insertBefore(R,A)):(b.insertBefore(se,x),b.insertBefore(R,x),b.insertBefore(A,x)))})(c,h,a),re(h,a.loaderHtml),xe(h,a,"loader")};function fo(r,a,c){_t(r,c["show".concat(u(a),"Button")],"inline-block"),re(r,c["".concat(a,"ButtonText")]),r.setAttribute("aria-label",c["".concat(a,"ButtonAriaLabel")]),r.className=m[a],xe(r,c,"".concat(a,"Button")),z(r,c["".concat(a,"ButtonClass")])}const ar=(r,a)=>{const c=O();c&&((function(h,b){typeof b=="string"?h.style.background=b:b||z([document.documentElement,document.body],m["no-backdrop"])})(c,a.backdrop),(function(h,b){b in m?z(h,m[b]):(f('The "position" parameter is not valid, defaulting to "center"'),z(h,m.center))})(c,a.position),(function(h,b){if(b&&typeof b=="string"){const x="grow-".concat(b);x in m&&z(h,m[x])}})(c,a.grow),xe(c,a,"container"))};var D={awaitingPromise:new WeakMap,promise:new WeakMap,innerParams:new WeakMap,domCache:new WeakMap};const lr=["input","file","range","select","radio","checkbox","textarea"],cr=r=>{if(!ge[r.input])return g('Unexpected type of input! Expected "text", "email", "password", "number", "tel", "select", "radio", "checkbox", "textarea", "file" or "url", got "'.concat(r.input,'"'));const a=Kn(r.input),c=ge[r.input](a,r);ae(c),setTimeout((()=>{Un(c)}))},dr=(r,a)=>{const c=uo(C(),r);if(c){(h=>{for(let b=0;b<h.attributes.length;b++){const x=h.attributes[b].name;["type","value","style"].includes(x)||h.removeAttribute(x)}})(c);for(const h in a)c.setAttribute(h,a[h])}},ur=r=>{const a=Kn(r.input);r.customClass&&z(a,r.customClass.input)},go=(r,a)=>{r.placeholder&&!a.inputPlaceholder||(r.placeholder=a.inputPlaceholder)},gt=(r,a,c)=>{if(c.inputLabel){r.id=m.input;const h=document.createElement("label"),b=m["input-label"];h.setAttribute("for",r.id),h.className=b,z(h,c.customClass.inputLabel),h.innerText=c.inputLabel,a.insertAdjacentElement("beforebegin",h)}},Kn=r=>{const a=m[r]?m[r]:m.input;return Re(C(),a)},ge={},Xn=(r,a)=>{["string","number"].includes(typeof a.inputValue)?r.value="".concat(a.inputValue):j(a.inputValue)||f('Unexpected type of inputValue! Expected "string", "number" or "Promise", got "'.concat(typeof a.inputValue,'"'))};ge.text=ge.email=ge.password=ge.number=ge.tel=ge.url=(r,a)=>(Xn(r,a),gt(r,r,a),go(r,a),r.type=a.input,r),ge.file=(r,a)=>(gt(r,r,a),go(r,a),r),ge.range=(r,a)=>{const c=r.querySelector("input"),h=r.querySelector("output");return c.value=a.inputValue,c.type=a.input,h.value=a.inputValue,gt(c,r,a),r},ge.select=(r,a)=>{if(r.textContent="",a.inputPlaceholder){const c=document.createElement("option");re(c,a.inputPlaceholder),c.value="",c.disabled=!0,c.selected=!0,r.appendChild(c)}return gt(r,r,a),r},ge.radio=r=>(r.textContent="",r),ge.checkbox=(r,a)=>{const c=uo(C(),"checkbox");c.value="1",c.id=m.checkbox,c.checked=!!a.inputValue;const h=r.querySelector("span");return re(h,a.inputPlaceholder),r},ge.textarea=(r,a)=>(Xn(r,a),go(r,a),gt(r,r,a),setTimeout((()=>{if("MutationObserver"in window){const c=parseInt(window.getComputedStyle(C()).width);new MutationObserver((()=>{const h=r.offsetWidth+(b=r,parseInt(window.getComputedStyle(b).marginLeft)+parseInt(window.getComputedStyle(b).marginRight));var b;C().style.width=h>c?"".concat(h,"px"):null})).observe(r,{attributes:!0,attributeFilter:["style"]})}})),r);const hr=(r,a)=>{const c=W();xe(c,a,"htmlContainer"),a.html?(po(a.html,c),ae(c,"block")):a.text?(c.textContent=a.text,ae(c,"block")):de(c),((h,b)=>{const x=C(),E=D.innerParams.get(h),A=!E||b.input!==E.input;lr.forEach((R=>{const se=m[R],he=Re(x,se);dr(R,b.inputAttributes),he.className=se,A&&de(he)})),b.input&&(A&&cr(b),ur(b))})(r,a)},Zn=(r,a)=>{for(const c in Y)a.icon!==c&&Se(r,Y[c]);z(r,Y[a.icon]),fr(r,a),pr(),xe(r,a,"icon")},pr=()=>{const r=C(),a=window.getComputedStyle(r).getPropertyValue("background-color"),c=r.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let h=0;h<c.length;h++)c[h].style.backgroundColor=a},Gn=(r,a)=>{r.textContent="",a.iconHtml?re(r,Jn(a.iconHtml)):a.icon==="success"?re(r,`
100
+ <div class="swal2-success-circular-line-left"></div>
101
+ <span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>
102
+ <div class="swal2-success-ring"></div> <div class="swal2-success-fix"></div>
103
+ <div class="swal2-success-circular-line-right"></div>
104
+ `):a.icon==="error"?re(r,`
105
+ <span class="swal2-x-mark">
106
+ <span class="swal2-x-mark-line-left"></span>
107
+ <span class="swal2-x-mark-line-right"></span>
108
+ </span>
109
+ `):re(r,Jn({question:"?",warning:"!",info:"i"}[a.icon]))},fr=(r,a)=>{if(a.iconColor){r.style.color=a.iconColor,r.style.borderColor=a.iconColor;for(const c of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])qn(r,c,"backgroundColor",a.iconColor);qn(r,".swal2-success-ring","borderColor",a.iconColor)}},Jn=r=>'<div class="'.concat(m["icon-content"],'">').concat(r,"</div>"),gr=(r,a)=>{const c=ut();if(!a.progressSteps||a.progressSteps.length===0)return de(c);ae(c),c.textContent="",a.currentProgressStep>=a.progressSteps.length&&f("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),a.progressSteps.forEach(((h,b)=>{const x=(E=>{const A=document.createElement("li");return z(A,m["progress-step"]),re(A,E),A})(h);if(c.appendChild(x),b===a.currentProgressStep&&z(x,m["active-progress-step"]),b!==a.progressSteps.length-1){const E=(A=>{const R=document.createElement("li");return z(R,m["progress-step-line"]),A.progressStepsDistance&&(R.style.width=A.progressStepsDistance),R})(a);c.appendChild(E)}}))},mr=(r,a)=>{r.className="".concat(m.popup," ").concat(be(r)?a.showClass.popup:""),a.toast?(z([document.documentElement,document.body],m["toast-shown"]),z(r,m.toast)):z(r,m.modal),xe(r,a,"popup"),typeof a.customClass=="string"&&z(r,a.customClass),a.icon&&z(r,m["icon-".concat(a.icon)])},Qn=(r,a)=>{((c,h)=>{const b=O(),x=C();h.toast?(pt(b,"width",h.width),x.style.width="100%",x.insertBefore(Je(),X())):pt(x,"width",h.width),pt(x,"padding",h.padding),h.color&&(x.style.color=h.color),h.background&&(x.style.background=h.background),de(At()),mr(x,h)})(0,a),ar(0,a),gr(0,a),((c,h)=>{const b=D.innerParams.get(c),x=X();b&&h.icon===b.icon?(Gn(x,h),Zn(x,h)):h.icon||h.iconHtml?h.icon&&Object.keys(Y).indexOf(h.icon)===-1?(g('Unknown icon! Expected "success", "error", "warning", "info" or "question", got "'.concat(h.icon,'"')),de(x)):(ae(x),Gn(x,h),Zn(x,h),z(x,h.showClass.icon)):de(x)})(r,a),((c,h)=>{const b=ee();if(!h.imageUrl)return de(b);ae(b,""),b.setAttribute("src",h.imageUrl),b.setAttribute("alt",h.imageAlt),pt(b,"width",h.imageWidth),pt(b,"height",h.imageHeight),b.className=m.image,xe(b,h,"image")})(0,a),((c,h)=>{const b=ie();_t(b,h.title||h.titleText,"block"),h.title&&po(h.title,b),h.titleText&&(b.innerText=h.titleText),xe(b,h,"title")})(0,a),((c,h)=>{const b=ao();re(b,h.closeButtonHtml),xe(b,h,"closeButton"),_t(b,h.showCloseButton),b.setAttribute("aria-label",h.closeButtonAriaLabel)})(0,a),hr(r,a),rr(0,a),((c,h)=>{const b=zn();_t(b,h.footer),h.footer&&po(h.footer,b),xe(b,h,"footer")})(0,a),typeof a.didRender=="function"&&a.didRender(C())},et=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),ei=()=>{p(document.body.children).forEach((r=>{r.hasAttribute("data-previous-aria-hidden")?(r.setAttribute("aria-hidden",r.getAttribute("data-previous-aria-hidden")),r.removeAttribute("data-previous-aria-hidden")):r.removeAttribute("aria-hidden")}))},ti=["swal-title","swal-html","swal-footer"],br=r=>{const a={};return p(r.querySelectorAll("swal-param")).forEach((c=>{qe(c,["name","value"]);const h=c.getAttribute("name"),b=c.getAttribute("value");typeof S[h]=="boolean"&&b==="false"&&(a[h]=!1),typeof S[h]=="object"&&(a[h]=JSON.parse(b))})),a},wr=r=>{const a={};return p(r.querySelectorAll("swal-button")).forEach((c=>{qe(c,["type","color","aria-label"]);const h=c.getAttribute("type");a["".concat(h,"ButtonText")]=c.innerHTML,a["show".concat(u(h),"Button")]=!0,c.hasAttribute("color")&&(a["".concat(h,"ButtonColor")]=c.getAttribute("color")),c.hasAttribute("aria-label")&&(a["".concat(h,"ButtonAriaLabel")]=c.getAttribute("aria-label"))})),a},vr=r=>{const a={},c=r.querySelector("swal-image");return c&&(qe(c,["src","width","height","alt"]),c.hasAttribute("src")&&(a.imageUrl=c.getAttribute("src")),c.hasAttribute("width")&&(a.imageWidth=c.getAttribute("width")),c.hasAttribute("height")&&(a.imageHeight=c.getAttribute("height")),c.hasAttribute("alt")&&(a.imageAlt=c.getAttribute("alt"))),a},kr=r=>{const a={},c=r.querySelector("swal-icon");return c&&(qe(c,["type","color"]),c.hasAttribute("type")&&(a.icon=c.getAttribute("type")),c.hasAttribute("color")&&(a.iconColor=c.getAttribute("color")),a.iconHtml=c.innerHTML),a},yr=r=>{const a={},c=r.querySelector("swal-input");c&&(qe(c,["type","label","placeholder","value"]),a.input=c.getAttribute("type")||"text",c.hasAttribute("label")&&(a.inputLabel=c.getAttribute("label")),c.hasAttribute("placeholder")&&(a.inputPlaceholder=c.getAttribute("placeholder")),c.hasAttribute("value")&&(a.inputValue=c.getAttribute("value")));const h=r.querySelectorAll("swal-input-option");return h.length&&(a.inputOptions={},p(h).forEach((b=>{qe(b,["value"]);const x=b.getAttribute("value"),E=b.innerHTML;a.inputOptions[x]=E}))),a},xr=(r,a)=>{const c={};for(const h in a){const b=a[h],x=r.querySelector(b);x&&(qe(x,[]),c[b.replace(/^swal-/,"")]=x.innerHTML.trim())}return c},Cr=r=>{const a=ti.concat(["swal-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);p(r.children).forEach((c=>{const h=c.tagName.toLowerCase();a.indexOf(h)===-1&&f("Unrecognized element <".concat(h,">"))}))},qe=(r,a)=>{p(r.attributes).forEach((c=>{a.indexOf(c.name)===-1&&f(['Unrecognized attribute "'.concat(c.name,'" on <').concat(r.tagName.toLowerCase(),">."),"".concat(a.length?"Allowed attributes are: ".concat(a.join(", ")):"To set the value, use HTML within the element.")])}))};var oi={email:(r,a)=>/^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]{2,24}$/.test(r)?Promise.resolve():Promise.resolve(a||"Invalid email address"),url:(r,a)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(r)?Promise.resolve():Promise.resolve(a||"Invalid URL")};function Er(r){(function(a){a.inputValidator||Object.keys(oi).forEach((c=>{a.input===c&&(a.inputValidator=oi[c])}))})(r),r.showLoaderOnConfirm&&!r.preConfirm&&f(`showLoaderOnConfirm is set to true, but preConfirm is not defined.
110
+ showLoaderOnConfirm should be used together with preConfirm, see usage example:
111
+ https://sweetalert2.github.io/#ajax-request`),(function(a){(!a.target||typeof a.target=="string"&&!document.querySelector(a.target)||typeof a.target!="string"&&!a.target.appendChild)&&(f('Target parameter is not valid, defaulting to "body"'),a.target="body")})(r),typeof r.title=="string"&&(r.title=r.title.split(`
112
+ `).join("<br />")),or(r)}class Tr{constructor(a,c){this.callback=a,this.remaining=c,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date().getTime()-this.started.getTime()),this.remaining}increase(a){const c=this.running;return c&&this.stop(),this.remaining+=a,c&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const Br=()=>{Qe.previousBodyPadding===null&&document.body.scrollHeight>window.innerHeight&&(Qe.previousBodyPadding=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight="".concat(Qe.previousBodyPadding+(()=>{const r=document.createElement("div");r.className=m["scrollbar-measure"],document.body.appendChild(r);const a=r.getBoundingClientRect().width-r.clientWidth;return document.body.removeChild(r),a})(),"px"))},Sr=()=>{const r=navigator.userAgent,a=!!r.match(/iPad/i)||!!r.match(/iPhone/i),c=!!r.match(/WebKit/i);a&&c&&!r.match(/CriOS/i)&&C().scrollHeight>window.innerHeight-44&&(O().style.paddingBottom="".concat(44,"px"))},Or=()=>{const r=O();let a;r.ontouchstart=c=>{a=Ir(c)},r.ontouchmove=c=>{a&&(c.preventDefault(),c.stopPropagation())}},Ir=r=>{const a=r.target,c=O();return!(Ar(r)||Mr(r)||a!==c&&(Wn(c)||a.tagName==="INPUT"||a.tagName==="TEXTAREA"||Wn(W())&&W().contains(a)))},Ar=r=>r.touches&&r.touches.length&&r.touches[0].touchType==="stylus",Mr=r=>r.touches&&r.touches.length>1,Lr=r=>{const a=O(),c=C();typeof r.willOpen=="function"&&r.willOpen(c);const h=window.getComputedStyle(document.body).overflowY;Nr(a,c,r),setTimeout((()=>{_r(a,c)}),10),co()&&(Pr(a,r.scrollbarPadding,h),p(document.body.children).forEach((b=>{b===O()||b.contains(O())||(b.hasAttribute("aria-hidden")&&b.setAttribute("data-previous-aria-hidden",b.getAttribute("aria-hidden")),b.setAttribute("aria-hidden","true"))}))),Lt()||N.previousActiveElement||(N.previousActiveElement=document.activeElement),typeof r.didOpen=="function"&&setTimeout((()=>r.didOpen(c))),Se(a,m["no-transition"])},ni=r=>{const a=C();if(r.target!==a)return;const c=O();a.removeEventListener(ft,ni),c.style.overflowY="auto"},_r=(r,a)=>{ft&&Yn(a)?(r.style.overflowY="hidden",a.addEventListener(ft,ni)):r.style.overflowY="auto"},Pr=(r,a,c)=>{(()=>{if((/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!Ae(document.body,m.iosfix)){const h=document.body.scrollTop;document.body.style.top="".concat(-1*h,"px"),z(document.body,m.iosfix),Or(),Sr()}})(),a&&c!=="hidden"&&Br(),setTimeout((()=>{r.scrollTop=0}))},Nr=(r,a,c)=>{z(r,c.showClass.backdrop),a.style.setProperty("opacity","0","important"),ae(a,"grid"),setTimeout((()=>{z(a,c.showClass.popup),a.style.removeProperty("opacity")}),10),z([document.documentElement,document.body],m.shown),c.heightAuto&&c.backdrop&&!c.toast&&z([document.documentElement,document.body],m["height-auto"])},tt=r=>{let a=C();a||new Rt,a=C();const c=Je();Lt()?de(X()):Rr(a,r),ae(c),a.setAttribute("data-loading",!0),a.setAttribute("aria-busy",!0),a.focus()},Rr=(r,a)=>{const c=ht(),h=Je();!a&&be(Te())&&(a=Te()),ae(c),a&&(de(a),h.setAttribute("data-button-to-replace",a.className)),h.parentNode.insertBefore(h,a),z([r,c],m.loading)},Dr=r=>r.checked?1:0,jr=r=>r.checked?r.value:null,Hr=r=>r.files.length?r.getAttribute("multiple")!==null?r.files:r.files[0]:null,Fr=(r,a)=>{const c=C(),h=b=>Ur[a.input](c,mo(b),a);T(a.inputOptions)||j(a.inputOptions)?(tt(Te()),P(a.inputOptions).then((b=>{r.hideLoading(),h(b)}))):typeof a.inputOptions=="object"?h(a.inputOptions):g("Unexpected type of inputOptions! Expected object, Map or Promise, got ".concat(typeof a.inputOptions))},zr=(r,a)=>{const c=r.getInput();de(c),P(a.inputValue).then((h=>{c.value=a.input==="number"?parseFloat(h)||0:"".concat(h),ae(c),c.focus(),r.hideLoading()})).catch((h=>{g("Error in inputValue promise: ".concat(h)),c.value="",ae(c),c.focus(),r.hideLoading()}))},Ur={select:(r,a,c)=>{const h=Re(r,m.select),b=(x,E,A)=>{const R=document.createElement("option");R.value=A,re(R,E),R.selected=ii(A,c.inputValue),x.appendChild(R)};a.forEach((x=>{const E=x[0],A=x[1];if(Array.isArray(A)){const R=document.createElement("optgroup");R.label=E,R.disabled=!1,h.appendChild(R),A.forEach((se=>b(R,se[1],se[0])))}else b(h,A,E)})),h.focus()},radio:(r,a,c)=>{const h=Re(r,m.radio);a.forEach((x=>{const E=x[0],A=x[1],R=document.createElement("input"),se=document.createElement("label");R.type="radio",R.name=m.radio,R.value=E,ii(E,c.inputValue)&&(R.checked=!0);const he=document.createElement("span");re(he,A),he.className=m.label,se.appendChild(R),se.appendChild(he),h.appendChild(se)}));const b=h.querySelectorAll("input");b.length&&b[0].focus()}},mo=r=>{const a=[];return typeof Map<"u"&&r instanceof Map?r.forEach(((c,h)=>{let b=c;typeof b=="object"&&(b=mo(b)),a.push([h,b])})):Object.keys(r).forEach((c=>{let h=r[c];typeof h=="object"&&(h=mo(h)),a.push([c,h])})),a},ii=(r,a)=>a&&a.toString()===r.toString();function si(){const r=D.innerParams.get(this);if(!r)return;const a=D.domCache.get(this);de(a.loader),Lt()?r.icon&&ae(X()):$r(a),Se([a.popup,a.actions],m.loading),a.popup.removeAttribute("aria-busy"),a.popup.removeAttribute("data-loading"),a.confirmButton.disabled=!1,a.denyButton.disabled=!1,a.cancelButton.disabled=!1}const $r=r=>{const a=r.popup.getElementsByClassName(r.loader.getAttribute("data-button-to-replace"));a.length?ae(a[0],"inline-block"):!be(Te())&&!be(Ne())&&!be(Ue())&&de(r.actions)};var mt={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const ri=()=>Te()&&Te().click(),ai=r=>{r.keydownTarget&&r.keydownHandlerAdded&&(r.keydownTarget.removeEventListener("keydown",r.keydownHandler,{capture:r.keydownListenerCapture}),r.keydownHandlerAdded=!1)},bo=(r,a,c)=>{const h=lo();if(h.length)return(a+=c)===h.length?a=0:a===-1&&(a=h.length-1),h[a].focus();C().focus()},li=["ArrowRight","ArrowDown"],qr=["ArrowLeft","ArrowUp"],Wr=(r,a,c)=>{const h=D.innerParams.get(r);h&&(a.isComposing||a.keyCode===229||(h.stopKeydownPropagation&&a.stopPropagation(),a.key==="Enter"?Yr(r,a,h):a.key==="Tab"?Vr(a):[...li,...qr].includes(a.key)?Kr(a.key):a.key==="Escape"&&Xr(a,h,c)))},Yr=(r,a,c)=>{if(k(c.allowEnterKey)&&a.target&&r.getInput()&&a.target.outerHTML===r.getInput().outerHTML){if(["textarea","file"].includes(c.input))return;ri(),a.preventDefault()}},Vr=(r,a)=>{const c=r.target,h=lo();let b=-1;for(let x=0;x<h.length;x++)if(c===h[x]){b=x;break}r.shiftKey?bo(0,b,-1):bo(0,b,1),r.stopPropagation(),r.preventDefault()},Kr=r=>{if(![Te(),Ne(),Ue()].includes(document.activeElement))return;const a=li.includes(r)?"nextElementSibling":"previousElementSibling";let c=document.activeElement;for(let h=0;h<ht().children.length;h++){if(c=c[a],!c)return;if(be(c)&&c instanceof HTMLButtonElement)break}c instanceof HTMLButtonElement&&c.focus()},Xr=(r,a,c)=>{k(a.allowEscapeKey)&&(r.preventDefault(),c(et.esc))};function ci(r,a,c,h){Lt()?di(r,h):(er(c).then((()=>di(r,h))),ai(N)),/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?(a.setAttribute("style","display:none !important"),a.removeAttribute("class"),a.innerHTML=""):a.remove(),co()&&(Qe.previousBodyPadding!==null&&(document.body.style.paddingRight="".concat(Qe.previousBodyPadding,"px"),Qe.previousBodyPadding=null),(()=>{if(Ae(document.body,m.iosfix)){const b=parseInt(document.body.style.top,10);Se(document.body,m.iosfix),document.body.style.top="",document.body.scrollTop=-1*b}})(),ei()),Se([document.documentElement,document.body],[m.shown,m["height-auto"],m["no-backdrop"],m["toast-shown"]])}function Pt(r){r=Gr(r);const a=mt.swalPromiseResolve.get(this),c=Zr(this);this.isAwaitingPromise()?r.isDismissed||(bt(this),a(r)):c&&a(r)}const Zr=r=>{const a=C();if(!a)return!1;const c=D.innerParams.get(r);if(!c||Ae(a,c.hideClass.popup))return!1;Se(a,c.showClass.popup),z(a,c.hideClass.popup);const h=O();return Se(h,c.showClass.backdrop),z(h,c.hideClass.backdrop),Jr(r,a,c),!0},bt=r=>{r.isAwaitingPromise()&&(D.awaitingPromise.delete(r),D.innerParams.get(r)||r._destroy())},Gr=r=>r===void 0?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},r),Jr=(r,a,c)=>{const h=O(),b=ft&&Yn(a);typeof c.willClose=="function"&&c.willClose(a),b?Qr(r,a,h,c.returnFocus,c.didClose):ci(r,h,c.returnFocus,c.didClose)},Qr=(r,a,c,h,b)=>{N.swalCloseEventFinishedCallback=ci.bind(null,r,c,h,b),a.addEventListener(ft,(function(x){x.target===a&&(N.swalCloseEventFinishedCallback(),delete N.swalCloseEventFinishedCallback)}))},di=(r,a)=>{setTimeout((()=>{typeof a=="function"&&a.bind(r.params)(),r._destroy()}))};function ui(r,a,c){const h=D.domCache.get(r);a.forEach((b=>{h[b].disabled=c}))}function hi(r,a){if(!r)return!1;if(r.type==="radio"){const c=r.parentNode.parentNode.querySelectorAll("input");for(let h=0;h<c.length;h++)c[h].disabled=a}else r.disabled=a}const ea=r=>{const a={};return Object.keys(r).forEach((c=>{ye(c)?a[c]=r[c]:f("Invalid parameter to update: ".concat(c))})),a},ta=r=>{pi(r),delete r.params,delete N.keydownHandler,delete N.keydownTarget,delete N.currentInstance},pi=r=>{r.isAwaitingPromise()?(wo(D,r),D.awaitingPromise.set(r,!0)):(wo(mt,r),wo(D,r))},wo=(r,a)=>{for(const c in r)r[c].delete(a)};var fi=Object.freeze({hideLoading:si,disableLoading:si,getInput:function(r){const a=D.innerParams.get(r||this),c=D.domCache.get(r||this);return c?uo(c.popup,a.input):null},close:Pt,isAwaitingPromise:function(){return!!D.awaitingPromise.get(this)},rejectPromise:function(r){const a=mt.swalPromiseReject.get(this);bt(this),a&&a(r)},handleAwaitingPromise:bt,closePopup:Pt,closeModal:Pt,closeToast:Pt,enableButtons:function(){ui(this,["confirmButton","denyButton","cancelButton"],!1)},disableButtons:function(){ui(this,["confirmButton","denyButton","cancelButton"],!0)},enableInput:function(){return hi(this.getInput(),!1)},disableInput:function(){return hi(this.getInput(),!0)},showValidationMessage:function(r){const a=D.domCache.get(this),c=D.innerParams.get(this);re(a.validationMessage,r),a.validationMessage.className=m["validation-message"],c.customClass&&c.customClass.validationMessage&&z(a.validationMessage,c.customClass.validationMessage),ae(a.validationMessage);const h=this.getInput();h&&(h.setAttribute("aria-invalid",!0),h.setAttribute("aria-describedby",m["validation-message"]),Un(h),z(h,m.inputerror))},resetValidationMessage:function(){const r=D.domCache.get(this);r.validationMessage&&de(r.validationMessage);const a=this.getInput();a&&(a.removeAttribute("aria-invalid"),a.removeAttribute("aria-describedby"),Se(a,m.inputerror))},getProgressSteps:function(){return D.domCache.get(this).progressSteps},update:function(r){const a=C(),c=D.innerParams.get(this);if(!a||Ae(a,c.hideClass.popup))return f("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");const h=ea(r),b=Object.assign({},c,h);Qn(this,b),D.innerParams.set(this,b),Object.defineProperties(this,{params:{value:Object.assign({},this.params,r),writable:!1,enumerable:!0}})},_destroy:function(){const r=D.domCache.get(this),a=D.innerParams.get(this);a?(r.popup&&N.swalCloseEventFinishedCallback&&(N.swalCloseEventFinishedCallback(),delete N.swalCloseEventFinishedCallback),N.deferDisposalTimer&&(clearTimeout(N.deferDisposalTimer),delete N.deferDisposalTimer),typeof a.didDestroy=="function"&&a.didDestroy(),ta(this)):pi(this)}});const gi=(r,a)=>{const c=D.innerParams.get(r);if(!c.input)return g('The "input" parameter is needed to be set when using returnInputValueOn'.concat(u(a)));const h=((b,x)=>{const E=b.getInput();if(!E)return null;switch(x.input){case"checkbox":return Dr(E);case"radio":return jr(E);case"file":return Hr(E);default:return x.inputAutoTrim?E.value.trim():E.value}})(r,c);c.inputValidator?oa(r,h,a):r.getInput().checkValidity()?a==="deny"?vo(r,h):ko(r,h):(r.enableButtons(),r.showValidationMessage(c.validationMessage))},oa=(r,a,c)=>{const h=D.innerParams.get(r);r.disableInput(),Promise.resolve().then((()=>P(h.inputValidator(a,h.validationMessage)))).then((b=>{r.enableButtons(),r.enableInput(),b?r.showValidationMessage(b):c==="deny"?vo(r,a):ko(r,a)}))},vo=(r,a)=>{const c=D.innerParams.get(r||void 0);c.showLoaderOnDeny&&tt(Ne()),c.preDeny?(D.awaitingPromise.set(r||void 0,!0),Promise.resolve().then((()=>P(c.preDeny(a,c.validationMessage)))).then((h=>{h===!1?(r.hideLoading(),bt(r)):r.closePopup({isDenied:!0,value:h===void 0?a:h})})).catch((h=>bi(r||void 0,h)))):r.closePopup({isDenied:!0,value:a})},mi=(r,a)=>{r.closePopup({isConfirmed:!0,value:a})},bi=(r,a)=>{r.rejectPromise(a)},ko=(r,a)=>{const c=D.innerParams.get(r||void 0);c.showLoaderOnConfirm&&tt(),c.preConfirm?(r.resetValidationMessage(),D.awaitingPromise.set(r||void 0,!0),Promise.resolve().then((()=>P(c.preConfirm(a,c.validationMessage)))).then((h=>{be(At())||h===!1?(r.hideLoading(),bt(r)):mi(r,h===void 0?a:h)})).catch((h=>bi(r||void 0,h)))):mi(r,a)},na=(r,a,c)=>{a.popup.onclick=()=>{const h=D.innerParams.get(r);h&&(ia(h)||h.timer||h.input)||c(et.close)}},ia=r=>r.showConfirmButton||r.showDenyButton||r.showCancelButton||r.showCloseButton;let Nt=!1;const sa=r=>{r.popup.onmousedown=()=>{r.container.onmouseup=function(a){r.container.onmouseup=void 0,a.target===r.container&&(Nt=!0)}}},ra=r=>{r.container.onmousedown=()=>{r.popup.onmouseup=function(a){r.popup.onmouseup=void 0,(a.target===r.popup||r.popup.contains(a.target))&&(Nt=!0)}}},aa=(r,a,c)=>{a.container.onclick=h=>{const b=D.innerParams.get(r);Nt?Nt=!1:h.target===a.container&&k(b.allowOutsideClick)&&c(et.backdrop)}},wi=r=>r instanceof Element||(a=>typeof a=="object"&&a.jquery)(r),vi=()=>{if(N.timeout)return(()=>{const r=Mt(),a=parseInt(window.getComputedStyle(r).width);r.style.removeProperty("transition"),r.style.width="100%";const c=a/parseInt(window.getComputedStyle(r).width)*100;r.style.removeProperty("transition"),r.style.width="".concat(c,"%")})(),N.timeout.stop()},ki=()=>{if(N.timeout){const r=N.timeout.start();return ho(r),r}};let yi=!1;const yo={},la=r=>{for(let a=r.target;a&&a!==document;a=a.parentNode)for(const c in yo){const h=a.getAttribute(c);if(h)return void yo[c].fire({template:h})}};var ca=Object.freeze({isValidParameter:ce,isUpdatableParameter:ye,isDeprecatedParameter:I,argsToParams:r=>{const a={};return typeof r[0]!="object"||wi(r[0])?["title","html","icon"].forEach(((c,h)=>{const b=r[h];typeof b=="string"||wi(b)?a[c]=b:b!==void 0&&g("Unexpected type of ".concat(c,'! Expected "string" or "Element", got ').concat(typeof b))})):Object.assign(a,r[0]),a},isVisible:()=>be(C()),clickConfirm:ri,clickDeny:()=>Ne()&&Ne().click(),clickCancel:()=>Ue()&&Ue().click(),getContainer:O,getPopup:C,getTitle:ie,getHtmlContainer:W,getImage:ee,getIcon:X,getInputLabel:()=>V(m["input-label"]),getCloseButton:ao,getActions:ht,getConfirmButton:Te,getDenyButton:Ne,getCancelButton:Ue,getLoader:Je,getFooter:zn,getTimerProgressBar:Mt,getFocusableElements:lo,getValidationMessage:At,isLoading:()=>C().hasAttribute("data-loading"),fire:function(){const r=this;for(var a=arguments.length,c=new Array(a),h=0;h<a;h++)c[h]=arguments[h];return new r(...c)},mixin:function(r){return class extends this{_main(a,c){return super._main(a,Object.assign({},r,c))}}},showLoading:tt,enableLoading:tt,getTimerLeft:()=>N.timeout&&N.timeout.getTimerLeft(),stopTimer:vi,resumeTimer:ki,toggleTimer:()=>{const r=N.timeout;return r&&(r.running?vi():ki())},increaseTimer:r=>{if(N.timeout){const a=N.timeout.increase(r);return ho(a,!0),a}},isTimerRunning:()=>N.timeout&&N.timeout.isRunning(),bindClickHandler:function(){yo[arguments.length>0&&arguments[0]!==void 0?arguments[0]:"data-swal-template"]=this,yi||(document.body.addEventListener("click",la),yi=!0)}});let xo;class ot{constructor(){if(typeof window>"u")return;xo=this;for(var a=arguments.length,c=new Array(a),h=0;h<a;h++)c[h]=arguments[h];const b=Object.freeze(this.constructor.argsToParams(c));Object.defineProperties(this,{params:{value:b,writable:!1,enumerable:!0,configurable:!0}});const x=this._main(this.params);D.promise.set(this,x)}_main(a){let c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};(x=>{!x.backdrop&&x.allowOutsideClick&&f('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`');for(const E in x)B(E),x.toast&&L(E),H(E)})(Object.assign({},c,a)),N.currentInstance&&(N.currentInstance._destroy(),co()&&ei()),N.currentInstance=this;const h=ua(a,c);Er(h),Object.freeze(h),N.timeout&&(N.timeout.stop(),delete N.timeout),clearTimeout(N.restoreFocusTimeout);const b=ha(this);return Qn(this,h),D.innerParams.set(this,h),da(this,b,h)}then(a){return D.promise.get(this).then(a)}finally(a){return D.promise.get(this).finally(a)}}const da=(r,a,c)=>new Promise(((h,b)=>{const x=E=>{r.closePopup({isDismissed:!0,dismiss:E})};mt.swalPromiseResolve.set(r,h),mt.swalPromiseReject.set(r,b),a.confirmButton.onclick=()=>(E=>{const A=D.innerParams.get(E);E.disableButtons(),A.input?gi(E,"confirm"):ko(E,!0)})(r),a.denyButton.onclick=()=>(E=>{const A=D.innerParams.get(E);E.disableButtons(),A.returnInputValueOnDeny?gi(E,"deny"):vo(E,!1)})(r),a.cancelButton.onclick=()=>((E,A)=>{E.disableButtons(),A(et.cancel)})(r,x),a.closeButton.onclick=()=>x(et.close),((E,A,R)=>{D.innerParams.get(E).toast?na(E,A,R):(sa(A),ra(A),aa(E,A,R))})(r,a,x),((E,A,R,se)=>{ai(A),R.toast||(A.keydownHandler=he=>Wr(E,he,se),A.keydownTarget=R.keydownListenerCapture?window:C(),A.keydownListenerCapture=R.keydownListenerCapture,A.keydownTarget.addEventListener("keydown",A.keydownHandler,{capture:A.keydownListenerCapture}),A.keydownHandlerAdded=!0)})(r,N,c,x),((E,A)=>{A.input==="select"||A.input==="radio"?Fr(E,A):["text","email","number","tel","textarea"].includes(A.input)&&(T(A.inputValue)||j(A.inputValue))&&(tt(Te()),zr(E,A))})(r,c),Lr(c),pa(N,c,x),fa(a,c),setTimeout((()=>{a.container.scrollTop=0}))})),ua=(r,a)=>{const c=(b=>{const x=typeof b.template=="string"?document.querySelector(b.template):b.template;if(!x)return{};const E=x.content;return Cr(E),Object.assign(br(E),wr(E),vr(E),kr(E),yr(E),xr(E,ti))})(r),h=Object.assign({},S,a,c,r);return h.showClass=Object.assign({},S.showClass,h.showClass),h.hideClass=Object.assign({},S.hideClass,h.hideClass),h},ha=r=>{const a={popup:C(),container:O(),actions:ht(),confirmButton:Te(),denyButton:Ne(),cancelButton:Ue(),loader:Je(),closeButton:ao(),validationMessage:At(),progressSteps:ut()};return D.domCache.set(r,a),a},pa=(r,a,c)=>{const h=Mt();de(h),a.timer&&(r.timeout=new Tr((()=>{c("timer"),delete r.timeout}),a.timer),a.timerProgressBar&&(ae(h),xe(h,a,"timerProgressBar"),setTimeout((()=>{r.timeout&&r.timeout.running&&ho(a.timer)}))))},fa=(r,a)=>{if(!a.toast)return k(a.allowEnterKey)?void(ga(r,a)||bo(0,-1,1)):ma()},ga=(r,a)=>a.focusDeny&&be(r.denyButton)?(r.denyButton.focus(),!0):a.focusCancel&&be(r.cancelButton)?(r.cancelButton.focus(),!0):!(!a.focusConfirm||!be(r.confirmButton)||(r.confirmButton.focus(),0)),ma=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};Object.assign(ot.prototype,fi),Object.assign(ot,ca),Object.keys(fi).forEach((r=>{ot[r]=function(){if(xo)return xo[r](...arguments)}})),ot.DismissReason=et,ot.version="11.4.10";const Rt=ot;return Rt.default=Rt,Rt})(),this!==void 0&&this.Sweetalert2&&(this.swal=this.sweetAlert=this.Swal=this.SweetAlert=this.Sweetalert2),typeof document<"u"&&(function(d,u){var p=d.createElement("style");if(d.getElementsByTagName("head")[0].appendChild(p),p.styleSheet)p.styleSheet.disabled||(p.styleSheet.cssText=u);else try{p.innerHTML=u}catch{p.innerText=u}})(document,'.swal2-popup.swal2-toast{box-sizing:border-box;grid-column:1/4!important;grid-row:1/4!important;grid-template-columns:1fr 99fr 1fr;padding:1em;overflow-y:hidden;background:#fff;box-shadow:0 0 1px hsla(0deg,0%,0%,.075),0 1px 2px hsla(0deg,0%,0%,.075),1px 2px 4px hsla(0deg,0%,0%,.075),1px 3px 8px hsla(0deg,0%,0%,.075),2px 4px 16px hsla(0deg,0%,0%,.075);pointer-events:all}.swal2-popup.swal2-toast>*{grid-column:2}.swal2-popup.swal2-toast .swal2-title{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-loading{justify-content:center}.swal2-popup.swal2-toast .swal2-input{height:2em;margin:.5em;font-size:1em}.swal2-popup.swal2-toast .swal2-validation-message{font-size:1em}.swal2-popup.swal2-toast .swal2-footer{margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-popup.swal2-toast .swal2-close{grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-popup.swal2-toast .swal2-html-container{margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-popup.swal2-toast .swal2-html-container:empty{padding:0}.swal2-popup.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-popup.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:700}.swal2-popup.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-popup.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-popup.swal2-toast .swal2-actions{justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-popup.swal2-toast .swal2-styled{margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-popup.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;transform:rotate(45deg);border-radius:50%}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.8em;left:-.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-popup.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-popup.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-popup.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-toast-animate-success-line-tip .75s;animation:swal2-toast-animate-success-line-tip .75s}.swal2-popup.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-toast-animate-success-line-long .75s;animation:swal2-toast-animate-success-line-long .75s}.swal2-popup.swal2-toast.swal2-show{-webkit-animation:swal2-toast-show .5s;animation:swal2-toast-show .5s}.swal2-popup.swal2-toast.swal2-hide{-webkit-animation:swal2-toast-hide .1s forwards;animation:swal2-toast-hide .1s forwards}.swal2-container{display:grid;position:fixed;z-index:1060;top:0;right:0;bottom:0;left:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto) minmax(-webkit-min-content,auto);grid-template-rows:minmax(min-content,auto) minmax(min-content,auto) minmax(min-content,auto);height:100%;padding:.625em;overflow-x:hidden;transition:background-color .1s;-webkit-overflow-scrolling:touch}.swal2-container.swal2-backdrop-show,.swal2-container.swal2-noanimation{background:rgba(0,0,0,.4)}.swal2-container.swal2-backdrop-hide{background:0 0!important}.swal2-container.swal2-bottom-start,.swal2-container.swal2-center-start,.swal2-container.swal2-top-start{grid-template-columns:minmax(0,1fr) auto auto}.swal2-container.swal2-bottom,.swal2-container.swal2-center,.swal2-container.swal2-top{grid-template-columns:auto minmax(0,1fr) auto}.swal2-container.swal2-bottom-end,.swal2-container.swal2-center-end,.swal2-container.swal2-top-end{grid-template-columns:auto auto minmax(0,1fr)}.swal2-container.swal2-top-start>.swal2-popup{align-self:start}.swal2-container.swal2-top>.swal2-popup{grid-column:2;align-self:start;justify-self:center}.swal2-container.swal2-top-end>.swal2-popup,.swal2-container.swal2-top-right>.swal2-popup{grid-column:3;align-self:start;justify-self:end}.swal2-container.swal2-center-left>.swal2-popup,.swal2-container.swal2-center-start>.swal2-popup{grid-row:2;align-self:center}.swal2-container.swal2-center>.swal2-popup{grid-column:2;grid-row:2;align-self:center;justify-self:center}.swal2-container.swal2-center-end>.swal2-popup,.swal2-container.swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;align-self:center;justify-self:end}.swal2-container.swal2-bottom-left>.swal2-popup,.swal2-container.swal2-bottom-start>.swal2-popup{grid-column:1;grid-row:3;align-self:end}.swal2-container.swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;justify-self:center;align-self:end}.swal2-container.swal2-bottom-end>.swal2-popup,.swal2-container.swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;align-self:end;justify-self:end}.swal2-container.swal2-grow-fullscreen>.swal2-popup,.swal2-container.swal2-grow-row>.swal2-popup{grid-column:1/4;width:100%}.swal2-container.swal2-grow-column>.swal2-popup,.swal2-container.swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}.swal2-container.swal2-no-transition{transition:none!important}.swal2-popup{display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0,100%);width:32em;max-width:100%;padding:0 0 1.25em;border:none;border-radius:5px;background:#fff;color:#545454;font-family:inherit;font-size:1rem}.swal2-popup:focus{outline:0}.swal2-popup.swal2-loading{overflow-y:hidden}.swal2-title{position:relative;max-width:100%;margin:0;padding:.8em 1em 0;color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;word-wrap:break-word}.swal2-actions{display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:center;width:auto;margin:1.25em auto 0;padding:0}.swal2-actions:not(.swal2-loading) .swal2-styled[disabled]{opacity:.4}.swal2-actions:not(.swal2-loading) .swal2-styled:hover{background-image:linear-gradient(rgba(0,0,0,.1),rgba(0,0,0,.1))}.swal2-actions:not(.swal2-loading) .swal2-styled:active{background-image:linear-gradient(rgba(0,0,0,.2),rgba(0,0,0,.2))}.swal2-loader{display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;-webkit-animation:swal2-rotate-loading 1.5s linear 0s infinite normal;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 transparent #2778c4 transparent}.swal2-styled{margin:.3125em;padding:.625em 1.1em;transition:box-shadow .1s;box-shadow:0 0 0 3px transparent;font-weight:500}.swal2-styled:not([disabled]){cursor:pointer}.swal2-styled.swal2-confirm{border:0;border-radius:.25em;background:initial;background-color:#7066e0;color:#fff;font-size:1em}.swal2-styled.swal2-confirm:focus{box-shadow:0 0 0 3px rgba(112,102,224,.5)}.swal2-styled.swal2-deny{border:0;border-radius:.25em;background:initial;background-color:#dc3741;color:#fff;font-size:1em}.swal2-styled.swal2-deny:focus{box-shadow:0 0 0 3px rgba(220,55,65,.5)}.swal2-styled.swal2-cancel{border:0;border-radius:.25em;background:initial;background-color:#6e7881;color:#fff;font-size:1em}.swal2-styled.swal2-cancel:focus{box-shadow:0 0 0 3px rgba(110,120,129,.5)}.swal2-styled.swal2-default-outline:focus{box-shadow:0 0 0 3px rgba(100,150,200,.5)}.swal2-styled:focus{outline:0}.swal2-styled::-moz-focus-inner{border:0}.swal2-footer{justify-content:center;margin:1em 0 0;padding:1em 1em 0;border-top:1px solid #eee;color:inherit;font-size:1em}.swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto!important;overflow:hidden;border-bottom-right-radius:5px;border-bottom-left-radius:5px}.swal2-timer-progress-bar{width:100%;height:.25em;background:rgba(0,0,0,.2)}.swal2-image{max-width:100%;margin:2em auto 1em}.swal2-close{z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:color .1s,box-shadow .1s;border:none;border-radius:5px;background:0 0;color:#ccc;font-family:serif;font-family:monospace;font-size:2.5em;cursor:pointer;justify-self:end}.swal2-close:hover{transform:none;background:0 0;color:#f27474}.swal2-close:focus{outline:0;box-shadow:inset 0 0 0 3px rgba(100,150,200,.5)}.swal2-close::-moz-focus-inner{border:0}.swal2-html-container{z-index:1;justify-content:center;margin:1em 1.6em .3em;padding:0;overflow:auto;color:inherit;font-size:1.125em;font-weight:400;line-height:normal;text-align:center;word-wrap:break-word;word-break:break-word}.swal2-checkbox,.swal2-file,.swal2-input,.swal2-radio,.swal2-select,.swal2-textarea{margin:1em 2em 3px}.swal2-file,.swal2-input,.swal2-textarea{box-sizing:border-box;width:auto;transition:border-color .1s,box-shadow .1s;border:1px solid #d9d9d9;border-radius:.1875em;background:inherit;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px transparent;color:inherit;font-size:1.125em}.swal2-file.swal2-inputerror,.swal2-input.swal2-inputerror,.swal2-textarea.swal2-inputerror{border-color:#f27474!important;box-shadow:0 0 2px #f27474!important}.swal2-file:focus,.swal2-input:focus,.swal2-textarea:focus{border:1px solid #b4dbed;outline:0;box-shadow:inset 0 1px 1px rgba(0,0,0,.06),0 0 0 3px rgba(100,150,200,.5)}.swal2-file::-moz-placeholder,.swal2-input::-moz-placeholder,.swal2-textarea::-moz-placeholder{color:#ccc}.swal2-file:-ms-input-placeholder,.swal2-input:-ms-input-placeholder,.swal2-textarea:-ms-input-placeholder{color:#ccc}.swal2-file::placeholder,.swal2-input::placeholder,.swal2-textarea::placeholder{color:#ccc}.swal2-range{margin:1em 2em 3px;background:#fff}.swal2-range input{width:80%}.swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}.swal2-range input,.swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}.swal2-input{height:2.625em;padding:0 .75em}.swal2-file{width:75%;margin-right:auto;margin-left:auto;background:inherit;font-size:1.125em}.swal2-textarea{height:6.75em;padding:.75em}.swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:inherit;color:inherit;font-size:1.125em}.swal2-checkbox,.swal2-radio{align-items:center;justify-content:center;background:#fff;color:inherit}.swal2-checkbox label,.swal2-radio label{margin:0 .6em;font-size:1.125em}.swal2-checkbox input,.swal2-radio input{flex-shrink:0;margin:0 .4em}.swal2-input-label{display:flex;justify-content:center;margin:1em auto 0}.swal2-validation-message{align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:#f0f0f0;color:#666;font-size:1em;font-weight:300}.swal2-validation-message::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}.swal2-icon{position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;border:.25em solid transparent;border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}.swal2-icon.swal2-error{border-color:#f27474;color:#f27474}.swal2-icon.swal2-error .swal2-x-mark{position:relative;flex-grow:1}.swal2-icon.swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}.swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}.swal2-icon.swal2-error.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-error.swal2-icon-show .swal2-x-mark{-webkit-animation:swal2-animate-error-x-mark .5s;animation:swal2-animate-error-x-mark .5s}.swal2-icon.swal2-warning{border-color:#facea8;color:#f8bb86}.swal2-icon.swal2-warning.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-warning.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .5s;animation:swal2-animate-i-mark .5s}.swal2-icon.swal2-info{border-color:#9de0f6;color:#3fc3ee}.swal2-icon.swal2-info.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-info.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-i-mark .8s;animation:swal2-animate-i-mark .8s}.swal2-icon.swal2-question{border-color:#c9dae1;color:#87adbd}.swal2-icon.swal2-question.swal2-icon-show{-webkit-animation:swal2-animate-error-icon .5s;animation:swal2-animate-error-icon .5s}.swal2-icon.swal2-question.swal2-icon-show .swal2-icon-content{-webkit-animation:swal2-animate-question-mark .8s;animation:swal2-animate-question-mark .8s}.swal2-icon.swal2-success{border-color:#a5dc86;color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;transform:rotate(45deg);border-radius:50%}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=left]{top:-.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}.swal2-icon.swal2-success [class^=swal2-success-circular-line][class$=right]{top:-.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}.swal2-icon.swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-.25em;left:-.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}.swal2-icon.swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}.swal2-icon.swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}.swal2-icon.swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}.swal2-icon.swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-tip{-webkit-animation:swal2-animate-success-line-tip .75s;animation:swal2-animate-success-line-tip .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-line-long{-webkit-animation:swal2-animate-success-line-long .75s;animation:swal2-animate-success-line-long .75s}.swal2-icon.swal2-success.swal2-icon-show .swal2-success-circular-line-right{-webkit-animation:swal2-rotate-success-circular-line 4.25s ease-in;animation:swal2-rotate-success-circular-line 4.25s ease-in}.swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:inherit;font-weight:600}.swal2-progress-steps li{display:inline-block;position:relative}.swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:#add8e6;color:#fff}.swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:#add8e6}.swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}[class^=swal2]{-webkit-tap-highlight-color:transparent}.swal2-show{-webkit-animation:swal2-show .3s;animation:swal2-show .3s}.swal2-hide{-webkit-animation:swal2-hide .15s forwards;animation:swal2-hide .15s forwards}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}.swal2-no-war{display:flex;position:fixed;z-index:1061;top:0;left:0;align-items:center;justify-content:center;width:100%;height:3.375em;background:#20232a;color:#fff;text-align:center}.swal2-no-war a{color:#61dafb;text-decoration:none}.swal2-no-war a:hover{text-decoration:underline}@-webkit-keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@keyframes swal2-toast-show{0%{transform:translateY(-.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0)}}@-webkit-keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@-webkit-keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@-webkit-keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}@-webkit-keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@keyframes swal2-show{0%{transform:scale(.7)}45%{transform:scale(1.05)}80%{transform:scale(.95)}100%{transform:scale(1)}}@-webkit-keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@keyframes swal2-hide{0%{transform:scale(1);opacity:1}100%{transform:scale(.5);opacity:0}}@-webkit-keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@-webkit-keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@-webkit-keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@-webkit-keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(.4);opacity:0}50%{margin-top:1.625em;transform:scale(.4);opacity:0}80%{margin-top:-.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@-webkit-keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0);opacity:1}}@-webkit-keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@keyframes swal2-rotate-loading{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}@-webkit-keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@-webkit-keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto!important}body.swal2-no-backdrop .swal2-container{background-color:transparent!important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px rgba(0,0,0,.4)}@media print{body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown){overflow-y:scroll!important}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop):not(.swal2-toast-shown) .swal2-container{position:static!important}}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:transparent;pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{top:0;right:auto;bottom:auto;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{top:0;right:0;bottom:auto;left:auto}body.swal2-toast-shown .swal2-container.swal2-top-left,body.swal2-toast-shown .swal2-container.swal2-top-start{top:0;right:auto;bottom:auto;left:0}body.swal2-toast-shown .swal2-container.swal2-center-left,body.swal2-toast-shown .swal2-container.swal2-center-start{top:50%;right:auto;bottom:auto;left:0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{top:50%;right:auto;bottom:auto;left:50%;transform:translate(-50%,-50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{top:50%;right:0;bottom:auto;left:auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-left,body.swal2-toast-shown .swal2-container.swal2-bottom-start{top:auto;right:auto;bottom:0;left:0}body.swal2-toast-shown .swal2-container.swal2-bottom{top:auto;right:auto;bottom:0;left:50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{top:auto;right:0;bottom:0;left:auto}')}},o={};function i(l){var d=o[l];if(d!==void 0)return d.exports;var u=o[l]={id:l,exports:{}};return t[l].call(u.exports,u,u.exports,i),u.exports}i.n=l=>{var d=l&&l.__esModule?()=>l.default:()=>l;return i.d(d,{a:d}),d},i.d=(l,d)=>{for(var u in d)i.o(d,u)&&!i.o(l,u)&&Object.defineProperty(l,u,{enumerable:!0,get:d[u]})},i.o=(l,d)=>Object.prototype.hasOwnProperty.call(l,d),i.nc=void 0;var s={};return(()=>{var l;i.d(s,{default:()=>oe});var d=new Uint8Array(16);function u(){if(!l&&!(l=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return l(d)}const p=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,f=function(V){return typeof V=="string"&&p.test(V)};for(var g=[],w=0;w<256;++w)g.push((w+256).toString(16).substr(1));const y=function(V,C,X){var ie=(V=V||{}).random||(V.rng||u)();return ie[6]=15&ie[6]|64,ie[8]=63&ie[8]|128,(function(W){var ee=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,ut=(g[W[ee+0]]+g[W[ee+1]]+g[W[ee+2]]+g[W[ee+3]]+"-"+g[W[ee+4]]+g[W[ee+5]]+"-"+g[W[ee+6]]+g[W[ee+7]]+"-"+g[W[ee+8]]+g[W[ee+9]]+"-"+g[W[ee+10]]+g[W[ee+11]]+g[W[ee+12]]+g[W[ee+13]]+g[W[ee+14]]+g[W[ee+15]]).toLowerCase();if(!f(ut))throw TypeError("Stringified UUID is invalid");return ut})(ie)};var k=i(455),T=i.n(k),P=i(40),j=i.n(P),S=i(379),J=i.n(S),K=i(795),Q=i.n(K),ce=i(569),ye=i.n(ce),I=i(565),B=i.n(I),L=i(216),H=i.n(L),$=i(589),m=i.n($),Y=i(745),O={};O.styleTagTransform=m(),O.setAttributes=B(),O.insert=ye().bind(null,"head"),O.domAPI=Q(),O.insertStyleElement=H(),J()(Y.Z,O),Y.Z&&Y.Z.locals&&Y.Z.locals;class oe{static get enableLineBreaks(){return!0}constructor({data:C,config:X,api:ie,readOnly:W}){this.api=ie,this.readOnly=W,this.config=X||{},this._CSS={block:this.api.styles.block,wrapper:"ce-EditorJsColumns"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._data={},this.editors={},this.colWrapper=void 0,this.editors.cols=[],this.data=C,Array.isArray(this.data.cols)?this.editors.numberOfColumns=this.data.cols.length:(this.data.cols=[],this.editors.numberOfColumns=2)}static get isReadOnlySupported(){return!0}onKeyUp(C){C.code==="Backspace"||C.code}get CSS(){return{settingsButton:this.api.styles.settingsButton,settingsButtonActive:this.api.styles.settingsButtonActive}}renderSettings(){return[{icon:"2",label:"2 Columns",onActivate:()=>{this._updateCols(2)}},{icon:"3",label:"3 Columns",onActivate:()=>{this._updateCols(3)}},{icon:"R",label:"Roll Colls",onActivate:()=>{this._rollCols()}}]}_rollCols(){this.data.cols.unshift(this.data.cols.pop()),this.editors.cols.unshift(this.editors.cols.pop()),this._rerender()}async _updateCols(C){C==2&&this.editors.numberOfColumns==3&&(await T().fire({title:"Are you sure?",text:"This will delete Column 3!",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, delete it!"})).isConfirmed&&(this.editors.numberOfColumns=2,this.data.cols.pop(),this.editors.cols.pop(),this._rerender()),C==3&&(this.editors.numberOfColumns=3,this._rerender())}async _rerender(){await this.save();for(let C=0;C<this.editors.cols.length;C++)this.editors.cols[C].destroy();this.editors.cols=[],this.colWrapper.innerHTML="";for(let C=0;C<this.editors.numberOfColumns;C++){let X=document.createElement("div");X.classList.add("ce-editorjsColumns_col"),X.classList.add("editorjs_col_"+C);let ie=y();X.id=ie,this.colWrapper.appendChild(X);let W=new this.config.EditorJsLibrary({defaultBlock:"paragraph",holder:ie,tools:this.config.tools,data:this.data.cols[C],readOnly:this.readOnly,minHeight:50});this.editors.cols.push(W)}}render(){this.colWrapper=document.createElement("div"),this.colWrapper.classList.add("ce-editorjsColumns_wrapper"),this.colWrapper.addEventListener("paste",(C=>{C.stopPropagation()}),!0),this.colWrapper.addEventListener("keydown",(C=>{C.key==="Enter"&&(C.preventDefault(),C.stopImmediatePropagation(),C.stopPropagation()),C.key==="Tab"&&(C.preventDefault(),C.stopImmediatePropagation(),C.stopPropagation())}));for(let C=0;C<this.editors.cols.length;C++)this.editors.cols[C].destroy();this.editors.cols=[];for(let C=0;C<this.editors.numberOfColumns;C++){let X=document.createElement("div");X.classList.add("ce-editorjsColumns_col"),X.classList.add("editorjs_col_"+C);let ie=y();X.id=ie,this.colWrapper.appendChild(X);let W=new this.config.EditorJsLibrary({defaultBlock:"paragraph",holder:ie,tools:this.config.tools,data:this.data.cols[C],readOnly:this.readOnly,minHeight:50});this.editors.cols.push(W)}return this.colWrapper}async save(){if(!this.readOnly)for(let C=0;C<this.editors.cols.length;C++){let X=await this.editors.cols[C].save();this.data.cols[C]=X}return this.data}static get toolbox(){return{icon:j(),title:"Columns"}}}})(),s.default})()))})(Mo)),Mo.exports}var nu=ou();const wu=ba(nu);(function(){var n;try{if(typeof document<"u"){var e=document.createElement("style");e.nonce=(n=document.head.querySelector("meta[property=csp-nonce]"))==null?void 0:n.content,e.appendChild(document.createTextNode('.tc-wrap{--color-background:#f9f9fb;--color-text-secondary:#7b7e89;--color-border:#e8e8eb;--cell-size:34px;--toolbox-icon-size:18px;--toolbox-padding:6px;--toolbox-aiming-field-size:calc(var(--toolbox-icon-size) + var(--toolbox-padding)*2);border-left:0;position:relative;height:100%;width:100%;margin-top:var(--toolbox-icon-size);box-sizing:border-box;display:grid;grid-template-columns:calc(100% - var(--cell-size)) var(--cell-size);z-index:0}.tc-wrap--readonly{grid-template-columns:100% var(--cell-size)}.tc-wrap svg{vertical-align:top}@media print{.tc-wrap{border-left-color:var(--color-border);border-left-style:solid;border-left-width:1px;grid-template-columns:100% var(--cell-size)}}@media print{.tc-wrap .tc-row:after{display:none}}.tc-table{position:relative;width:100%;height:100%;display:grid;font-size:14px;border-top:1px solid var(--color-border);line-height:1.4}.tc-table:after{width:calc(var(--cell-size));height:100%;left:calc(var(--cell-size)*-1);top:0}.tc-table:after,.tc-table:before{position:absolute;content:""}.tc-table:before{width:100%;height:var(--toolbox-aiming-field-size);top:calc(var(--toolbox-aiming-field-size)*-1);left:0}.tc-table--heading .tc-row:first-child{font-weight:600;border-bottom:2px solid var(--color-border);position:sticky;top:0;z-index:2;background:var(--color-background)}.tc-table--heading .tc-row:first-child [contenteditable]:empty:before{content:attr(heading);color:var(--color-text-secondary)}.tc-table--heading .tc-row:first-child:after{bottom:-2px;border-bottom:2px solid var(--color-border)}.tc-add-column,.tc-add-row{display:flex;color:var(--color-text-secondary)}@media print{.tc-add{display:none}}.tc-add-column{display:grid;border-top:1px solid var(--color-border);grid-template-columns:var(--cell-size);grid-auto-rows:var(--cell-size);place-items:center}.tc-add-column svg{padding:5px;position:sticky;top:0;background-color:var(--color-background)}.tc-add-column--disabled{visibility:hidden}@media print{.tc-add-column{display:none}}.tc-add-row{height:var(--cell-size);align-items:center;padding-left:4px;position:relative}.tc-add-row--disabled{display:none}.tc-add-row:before{content:"";position:absolute;right:calc(var(--cell-size)*-1);width:var(--cell-size);height:100%}@media print{.tc-add-row{display:none}}.tc-add-column,.tc-add-row{transition:0s;cursor:pointer;will-change:background-color}.tc-add-column:hover,.tc-add-row:hover{transition:background-color .1s ease;background-color:var(--color-background)}.tc-add-row{margin-top:1px}.tc-add-row:hover:before{transition:.1s;background-color:var(--color-background)}.tc-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(10px,1fr));position:relative;border-bottom:1px solid var(--color-border)}.tc-row:after{content:"";pointer-events:none;position:absolute;width:var(--cell-size);height:100%;bottom:-1px;right:calc(var(--cell-size)*-1);border-bottom:1px solid var(--color-border)}.tc-row--selected{background:var(--color-background)}.tc-row--selected:after{background:var(--color-background)}.tc-cell{border-right:1px solid var(--color-border);padding:6px 12px;overflow:hidden;outline:none;line-break:normal}.tc-cell--selected{background:var(--color-background)}.tc-wrap--readonly .tc-row:after{display:none}.tc-toolbox{--toolbox-padding:6px;--popover-margin:30px;--toggler-click-zone-size:30px;--toggler-dots-color:#7b7e89;--toggler-dots-color-hovered:#1d202b;position:absolute;cursor:pointer;z-index:1;opacity:0;transition:opacity .1s;will-change:left,opacity}.tc-toolbox--column{top:calc(var(--toggler-click-zone-size)*-1);transform:translate(calc(var(--toggler-click-zone-size)*-1/2));will-change:left,opacity}.tc-toolbox--row{left:calc(var(--popover-margin)*-1);transform:translateY(calc(var(--toggler-click-zone-size)*-1/2));margin-top:-1px;will-change:top,opacity}.tc-toolbox--showed{opacity:1}.tc-toolbox .tc-popover{position:absolute;top:0;left:var(--popover-margin)}.tc-toolbox__toggler{display:flex;align-items:center;justify-content:center;width:var(--toggler-click-zone-size);height:var(--toggler-click-zone-size);color:var(--toggler-dots-color);opacity:0;transition:opacity .15s ease;will-change:opacity}.tc-toolbox__toggler:hover{color:var(--toggler-dots-color-hovered)}.tc-toolbox__toggler svg{fill:currentColor}.tc-wrap:hover .tc-toolbox__toggler{opacity:1}.tc-settings .cdx-settings-button{width:50%;margin:0}.tc-popover{--color-border:#eaeaea;--color-background:#fff;--color-background-hover:rgba(232,232,235,.49);--color-background-confirm:#e24a4a;--color-background-confirm-hover:#d54040;--color-text-confirm:#fff;background:var(--color-background);border:1px solid var(--color-border);box-shadow:0 3px 15px -3px #0d142121;border-radius:6px;padding:6px;display:none;will-change:opacity,transform}.tc-popover--opened{display:block;animation:menuShowing .1s cubic-bezier(.215,.61,.355,1) forwards}.tc-popover__item{display:flex;align-items:center;padding:2px 14px 2px 2px;border-radius:5px;cursor:pointer;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;user-select:none}.tc-popover__item:hover{background:var(--color-background-hover)}.tc-popover__item:not(:last-of-type){margin-bottom:2px}.tc-popover__item-icon{display:inline-flex;width:26px;height:26px;align-items:center;justify-content:center;background:var(--color-background);border-radius:5px;border:1px solid var(--color-border);margin-right:8px}.tc-popover__item-label{line-height:22px;font-size:14px;font-weight:500}.tc-popover__item--confirm{background:var(--color-background-confirm);color:var(--color-text-confirm)}.tc-popover__item--confirm:hover{background-color:var(--color-background-confirm-hover)}.tc-popover__item--confirm .tc-popover__item-icon{background:var(--color-background-confirm);border-color:#0000001a}.tc-popover__item--confirm .tc-popover__item-icon svg{transition:transform .2s ease-in;transform:rotate(90deg) scale(1.2)}.tc-popover__item--hidden{display:none}@keyframes menuShowing{0%{opacity:0;transform:translateY(-8px) scale(.9)}70%{opacity:1;transform:translateY(2px)}to{transform:translateY(0)}}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();function ve(n,e,t={}){const o=document.createElement(n);Array.isArray(e)?o.classList.add(...e):e&&o.classList.add(e);for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(o[i]=t[i]);return o}function Ri(n){const e=n.getBoundingClientRect();return{y1:Math.floor(e.top+window.pageYOffset),x1:Math.floor(e.left+window.pageXOffset),x2:Math.floor(e.right+window.pageXOffset),y2:Math.floor(e.bottom+window.pageYOffset)}}function Di(n,e){const t=Ri(n),o=Ri(e);return{fromTopBorder:o.y1-t.y1,fromLeftBorder:o.x1-t.x1,fromRightBorder:t.x2-o.x2,fromBottomBorder:t.y2-o.y2}}function iu(n,e){const t=n.getBoundingClientRect(),{width:o,height:i,x:s,y:l}=t,{clientX:d,clientY:u}=e;return{width:o,height:i,x:d-s,y:u-l}}function ji(n,e){return e.parentNode.insertBefore(n,e)}function Hi(n,e=!0){const t=document.createRange(),o=window.getSelection();t.selectNodeContents(n),t.collapse(e),o.removeAllRanges(),o.addRange(t)}class me{constructor({items:e}){this.items=e,this.wrapper=void 0,this.itemEls=[]}static get CSS(){return{popover:"tc-popover",popoverOpened:"tc-popover--opened",item:"tc-popover__item",itemHidden:"tc-popover__item--hidden",itemConfirmState:"tc-popover__item--confirm",itemIcon:"tc-popover__item-icon",itemLabel:"tc-popover__item-label"}}render(){return this.wrapper=ve("div",me.CSS.popover),this.items.forEach((e,t)=>{const o=ve("div",me.CSS.item),i=ve("div",me.CSS.itemIcon,{innerHTML:e.icon}),s=ve("div",me.CSS.itemLabel,{textContent:e.label});o.dataset.index=t,o.appendChild(i),o.appendChild(s),this.wrapper.appendChild(o),this.itemEls.push(o)}),this.wrapper.addEventListener("click",e=>{this.popoverClicked(e)}),this.wrapper}popoverClicked(e){const t=e.target.closest(`.${me.CSS.item}`);if(!t)return;const o=t.dataset.index,i=this.items[o];if(i.confirmationRequired&&!this.hasConfirmationState(t)){this.setConfirmationState(t);return}i.onClick()}setConfirmationState(e){e.classList.add(me.CSS.itemConfirmState)}clearConfirmationState(e){e.classList.remove(me.CSS.itemConfirmState)}hasConfirmationState(e){return e.classList.contains(me.CSS.itemConfirmState)}get opened(){return this.wrapper.classList.contains(me.CSS.popoverOpened)}open(){this.items.forEach((e,t)=>{typeof e.hideIf=="function"&&this.itemEls[t].classList.toggle(me.CSS.itemHidden,e.hideIf())}),this.wrapper.classList.add(me.CSS.popoverOpened)}close(){this.wrapper.classList.remove(me.CSS.popoverOpened),this.itemEls.forEach(e=>{this.clearConfirmationState(e)})}}const su='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L10 12M10 12L7 15M10 12H4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L14 12M14 12L17 15M14 12H20"/></svg>',Fi='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 8L12 12M12 12L16 16M12 12L16 8M12 12L8 16"/></svg>',ru='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 9.16666L18.2167 12.5M18.2167 12.5L14.8833 15.8333M18.2167 12.5H10.05C9.16594 12.5 8.31809 12.1488 7.69297 11.5237C7.06785 10.8986 6.71666 10.0507 6.71666 9.16666"/></svg>',au='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.9167 14.9167L11.5833 18.25M11.5833 18.25L8.25 14.9167M11.5833 18.25L11.5833 10.0833C11.5833 9.19928 11.9345 8.35143 12.5596 7.72631C13.1848 7.10119 14.0326 6.75 14.9167 6.75"/></svg>',lu='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.13333 14.9167L12.4667 18.25M12.4667 18.25L15.8 14.9167M12.4667 18.25L12.4667 10.0833C12.4667 9.19928 12.1155 8.35143 11.4904 7.72631C10.8652 7.10119 10.0174 6.75 9.13333 6.75"/></svg>',cu='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.8833 15.8333L18.2167 12.5M18.2167 12.5L14.8833 9.16667M18.2167 12.5L10.05 12.5C9.16595 12.5 8.31811 12.8512 7.69299 13.4763C7.06787 14.1014 6.71667 14.9493 6.71667 15.8333"/></svg>',du='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.41 9.66H9.4"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 9.66H14.59"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M9.31 14.36H9.3"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2.6" d="M14.6 14.36H14.59"/></svg>',zi='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M12 7V12M12 17V12M17 12H12M12 12H7"/></svg>',uu='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',hu='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',pu='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M14 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><path stroke="currentColor" stroke-width="2" d="M5 14H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>',fu='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-width="2" d="M10 5V18.5"/><path stroke="currentColor" stroke-width="2" d="M5 10H19"/><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/></svg>';class He{constructor({api:e,items:t,onOpen:o,onClose:i,cssModifier:s=""}){this.api=e,this.items=t,this.onOpen=o,this.onClose=i,this.cssModifier=s,this.popover=null,this.wrapper=this.createToolbox()}static get CSS(){return{toolbox:"tc-toolbox",toolboxShowed:"tc-toolbox--showed",toggler:"tc-toolbox__toggler"}}get element(){return this.wrapper}createToolbox(){const e=ve("div",[He.CSS.toolbox,this.cssModifier?`${He.CSS.toolbox}--${this.cssModifier}`:""]);e.dataset.mutationFree="true";const t=this.createPopover(),o=this.createToggler();return e.appendChild(o),e.appendChild(t),e}createToggler(){const e=ve("div",He.CSS.toggler,{innerHTML:du});return e.addEventListener("click",()=>{this.togglerClicked()}),e}createPopover(){return this.popover=new me({items:this.items}),this.popover.render()}togglerClicked(){this.popover.opened?(this.popover.close(),this.onClose()):(this.popover.open(),this.onOpen())}show(e){const t=e();Object.entries(t).forEach(([o,i])=>{this.wrapper.style[o]=i}),this.wrapper.classList.add(He.CSS.toolboxShowed)}hide(){this.popover.close(),this.wrapper.classList.remove(He.CSS.toolboxShowed)}}function gu(n,e){let t=0;return function(...o){const i=new Date().getTime();if(!(i-t<n))return t=i,e(...o)}}const F={wrapper:"tc-wrap",wrapperReadOnly:"tc-wrap--readonly",table:"tc-table",row:"tc-row",withHeadings:"tc-table--heading",rowSelected:"tc-row--selected",cell:"tc-cell",cellSelected:"tc-cell--selected",addRow:"tc-add-row",addRowDisabled:"tc-add-row--disabled",addColumn:"tc-add-column",addColumnDisabled:"tc-add-column--disabled"};class mu{constructor(e,t,o,i){this.readOnly=e,this.api=t,this.data=o,this.config=i,this.wrapper=null,this.table=null,this.toolboxColumn=this.createColumnToolbox(),this.toolboxRow=this.createRowToolbox(),this.createTableWrapper(),this.hoveredRow=0,this.hoveredColumn=0,this.selectedRow=0,this.selectedColumn=0,this.tunes={withHeadings:!1},this.resize(),this.fill(),this.focusedCell={row:0,column:0},this.documentClicked=s=>{const l=s.target.closest(`.${F.table}`)!==null,d=s.target.closest(`.${F.wrapper}`)===null;(l||d)&&this.hideToolboxes();const u=s.target.closest(`.${F.addRow}`),p=s.target.closest(`.${F.addColumn}`);u&&u.parentNode===this.wrapper?(this.addRow(void 0,!0),this.hideToolboxes()):p&&p.parentNode===this.wrapper&&(this.addColumn(void 0,!0),this.hideToolboxes())},this.readOnly||this.bindEvents()}getWrapper(){return this.wrapper}bindEvents(){document.addEventListener("click",this.documentClicked),this.table.addEventListener("mousemove",gu(150,e=>this.onMouseMoveInTable(e)),{passive:!0}),this.table.onkeypress=e=>this.onKeyPressListener(e),this.table.addEventListener("keydown",e=>this.onKeyDownListener(e)),this.table.addEventListener("focusin",e=>this.focusInTableListener(e))}createColumnToolbox(){return new He({api:this.api,cssModifier:"column",items:[{label:this.api.i18n.t("Add column to left"),icon:au,hideIf:()=>this.numberOfColumns===this.config.maxcols,onClick:()=>{this.addColumn(this.selectedColumn,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add column to right"),icon:lu,hideIf:()=>this.numberOfColumns===this.config.maxcols,onClick:()=>{this.addColumn(this.selectedColumn+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete column"),icon:Fi,hideIf:()=>this.numberOfColumns===1,confirmationRequired:!0,onClick:()=>{this.deleteColumn(this.selectedColumn),this.hideToolboxes()}}],onOpen:()=>{this.selectColumn(this.hoveredColumn),this.hideRowToolbox()},onClose:()=>{this.unselectColumn()}})}createRowToolbox(){return new He({api:this.api,cssModifier:"row",items:[{label:this.api.i18n.t("Add row above"),icon:cu,hideIf:()=>this.numberOfRows===this.config.maxrows,onClick:()=>{this.addRow(this.selectedRow,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Add row below"),icon:ru,hideIf:()=>this.numberOfRows===this.config.maxrows,onClick:()=>{this.addRow(this.selectedRow+1,!0),this.hideToolboxes()}},{label:this.api.i18n.t("Delete row"),icon:Fi,hideIf:()=>this.numberOfRows===1,confirmationRequired:!0,onClick:()=>{this.deleteRow(this.selectedRow),this.hideToolboxes()}}],onOpen:()=>{this.selectRow(this.hoveredRow),this.hideColumnToolbox()},onClose:()=>{this.unselectRow()}})}moveCursorToNextRow(){this.focusedCell.row!==this.numberOfRows?(this.focusedCell.row+=1,this.focusCell(this.focusedCell)):(this.addRow(),this.focusedCell.row+=1,this.focusCell(this.focusedCell),this.updateToolboxesPosition(0,0))}getCell(e,t){return this.table.querySelectorAll(`.${F.row}:nth-child(${e}) .${F.cell}`)[t-1]}getRow(e){return this.table.querySelector(`.${F.row}:nth-child(${e})`)}getRowByCell(e){return e.parentElement}getRowFirstCell(e){return e.querySelector(`.${F.cell}:first-child`)}setCellContent(e,t,o){const i=this.getCell(e,t);i.innerHTML=o}addColumn(e=-1,t=!1){var o;let i=this.numberOfColumns;if(this.config&&this.config.maxcols&&this.numberOfColumns>=this.config.maxcols)return;for(let l=1;l<=this.numberOfRows;l++){let d;const u=this.createCell();if(e>0&&e<=i?(d=this.getCell(l,e),ji(u,d)):d=this.getRow(l).appendChild(u),l===1){const p=this.getCell(l,e>0?e:i+1);p&&t&&Hi(p)}}const s=this.wrapper.querySelector(`.${F.addColumn}`);(o=this.config)!=null&&o.maxcols&&this.numberOfColumns>this.config.maxcols-1&&s&&s.classList.add(F.addColumnDisabled),this.addHeadingAttrToFirstRow()}addRow(e=-1,t=!1){let o,i=ve("div",F.row);this.tunes.withHeadings&&this.removeHeadingAttrFromFirstRow();let s=this.numberOfColumns;if(this.config&&this.config.maxrows&&this.numberOfRows>=this.config.maxrows&&d)return;if(e>0&&e<=this.numberOfRows){let u=this.getRow(e);o=ji(i,u)}else o=this.table.appendChild(i);this.fillRow(o,s),this.tunes.withHeadings&&this.addHeadingAttrToFirstRow();const l=this.getRowFirstCell(o);l&&t&&Hi(l);const d=this.wrapper.querySelector(`.${F.addRow}`);return this.config&&this.config.maxrows&&this.numberOfRows>=this.config.maxrows&&d&&d.classList.add(F.addRowDisabled),o}deleteColumn(e){for(let o=1;o<=this.numberOfRows;o++){const i=this.getCell(o,e);if(!i)return;i.remove()}const t=this.wrapper.querySelector(`.${F.addColumn}`);t&&t.classList.remove(F.addColumnDisabled)}deleteRow(e){this.getRow(e).remove();const t=this.wrapper.querySelector(`.${F.addRow}`);t&&t.classList.remove(F.addRowDisabled),this.addHeadingAttrToFirstRow()}createTableWrapper(){if(this.wrapper=ve("div",F.wrapper),this.table=ve("div",F.table),this.readOnly&&this.wrapper.classList.add(F.wrapperReadOnly),this.wrapper.appendChild(this.toolboxRow.element),this.wrapper.appendChild(this.toolboxColumn.element),this.wrapper.appendChild(this.table),!this.readOnly){const e=ve("div",F.addColumn,{innerHTML:zi}),t=ve("div",F.addRow,{innerHTML:zi});this.wrapper.appendChild(e),this.wrapper.appendChild(t)}}computeInitialSize(){const e=this.data&&this.data.content,t=Array.isArray(e),o=t?e.length:!1,i=t?e.length:void 0,s=o?e[0].length:void 0,l=Number.parseInt(this.config&&this.config.rows),d=Number.parseInt(this.config&&this.config.cols),u=!isNaN(l)&&l>0?l:void 0,p=!isNaN(d)&&d>0?d:void 0;return{rows:i||u||2,cols:s||p||2}}resize(){const{rows:e,cols:t}=this.computeInitialSize();for(let o=0;o<e;o++)this.addRow();for(let o=0;o<t;o++)this.addColumn()}fill(){const e=this.data;if(e&&e.content)for(let t=0;t<e.content.length;t++)for(let o=0;o<e.content[t].length;o++)this.setCellContent(t+1,o+1,e.content[t][o])}fillRow(e,t){for(let o=1;o<=t;o++){const i=this.createCell();e.appendChild(i)}}createCell(){return ve("div",F.cell,{contentEditable:!this.readOnly})}get numberOfRows(){return this.table.childElementCount}get numberOfColumns(){return this.numberOfRows?this.table.querySelectorAll(`.${F.row}:first-child .${F.cell}`).length:0}get isColumnMenuShowing(){return this.selectedColumn!==0}get isRowMenuShowing(){return this.selectedRow!==0}onMouseMoveInTable(e){const{row:t,column:o}=this.getHoveredCell(e);this.hoveredColumn=o,this.hoveredRow=t,this.updateToolboxesPosition()}onKeyPressListener(e){if(e.key==="Enter"){if(e.shiftKey)return!0;this.moveCursorToNextRow()}return e.key!=="Enter"}onKeyDownListener(e){e.key==="Tab"&&e.stopPropagation()}focusInTableListener(e){const t=e.target,o=this.getRowByCell(t);this.focusedCell={row:Array.from(this.table.querySelectorAll(`.${F.row}`)).indexOf(o)+1,column:Array.from(o.querySelectorAll(`.${F.cell}`)).indexOf(t)+1}}hideToolboxes(){this.hideRowToolbox(),this.hideColumnToolbox(),this.updateToolboxesPosition()}hideRowToolbox(){this.unselectRow(),this.toolboxRow.hide()}hideColumnToolbox(){this.unselectColumn(),this.toolboxColumn.hide()}focusCell(){this.focusedCellElem.focus()}get focusedCellElem(){const{row:e,column:t}=this.focusedCell;return this.getCell(e,t)}updateToolboxesPosition(e=this.hoveredRow,t=this.hoveredColumn){this.isColumnMenuShowing||t>0&&t<=this.numberOfColumns&&this.toolboxColumn.show(()=>({left:`calc((100% - var(--cell-size)) / (${this.numberOfColumns} * 2) * (1 + (${t} - 1) * 2))`})),this.isRowMenuShowing||e>0&&e<=this.numberOfRows&&this.toolboxRow.show(()=>{const o=this.getRow(e),{fromTopBorder:i}=Di(this.table,o),{height:s}=o.getBoundingClientRect();return{top:`${Math.ceil(i+s/2)}px`}})}setHeadingsSetting(e){this.tunes.withHeadings=e,e?(this.table.classList.add(F.withHeadings),this.addHeadingAttrToFirstRow()):(this.table.classList.remove(F.withHeadings),this.removeHeadingAttrFromFirstRow())}addHeadingAttrToFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.setAttribute("heading",this.api.i18n.t("Heading"))}}removeHeadingAttrFromFirstRow(){for(let e=1;e<=this.numberOfColumns;e++){let t=this.getCell(1,e);t&&t.removeAttribute("heading")}}selectRow(e){const t=this.getRow(e);t&&(this.selectedRow=e,t.classList.add(F.rowSelected))}unselectRow(){if(this.selectedRow<=0)return;const e=this.table.querySelector(`.${F.rowSelected}`);e&&e.classList.remove(F.rowSelected),this.selectedRow=0}selectColumn(e){for(let t=1;t<=this.numberOfRows;t++){const o=this.getCell(t,e);o&&o.classList.add(F.cellSelected)}this.selectedColumn=e}unselectColumn(){if(this.selectedColumn<=0)return;let e=this.table.querySelectorAll(`.${F.cellSelected}`);Array.from(e).forEach(t=>{t.classList.remove(F.cellSelected)}),this.selectedColumn=0}getHoveredCell(e){let t=this.hoveredRow,o=this.hoveredColumn;const{width:i,height:s,x:l,y:d}=iu(this.table,e);return l>=0&&(o=this.binSearch(this.numberOfColumns,u=>this.getCell(1,u),({fromLeftBorder:u})=>l<u,({fromRightBorder:u})=>l>i-u)),d>=0&&(t=this.binSearch(this.numberOfRows,u=>this.getCell(u,1),({fromTopBorder:u})=>d<u,({fromBottomBorder:u})=>d>s-u)),{row:t||this.hoveredRow,column:o||this.hoveredColumn}}binSearch(e,t,o,i){let s=0,l=e+1,d=0,u;for(;s<l-1&&d<10;){u=Math.ceil((s+l)/2);const p=t(u),f=Di(this.table,p);if(o(f))l=u;else if(i(f))s=u;else break;d++}return u}getData(){const e=[];for(let t=1;t<=this.numberOfRows;t++){const o=this.table.querySelector(`.${F.row}:nth-child(${t})`),i=Array.from(o.querySelectorAll(`.${F.cell}`));i.every(s=>!s.textContent.trim())||e.push(i.map(s=>s.innerHTML))}return e}destroy(){document.removeEventListener("click",this.documentClicked)}}class vu{static get isReadOnlySupported(){return!0}static get enableLineBreaks(){return!0}constructor({data:e,config:t,api:o,readOnly:i,block:s}){this.api=o,this.readOnly=i,this.config=t,this.data={withHeadings:this.getConfig("withHeadings",!1,e),stretched:this.getConfig("stretched",!1,e),content:e&&e.content?e.content:[]},this.table=null,this.block=s}static get toolbox(){return{icon:fu,title:"Table"}}render(){return this.table=new mu(this.readOnly,this.api,this.data,this.config),this.container=ve("div",this.api.styles.block),this.container.appendChild(this.table.getWrapper()),this.table.setHeadingsSetting(this.data.withHeadings),this.container}renderSettings(){return[{label:this.api.i18n.t("With headings"),icon:hu,isActive:this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!0,this.table.setHeadingsSetting(this.data.withHeadings)}},{label:this.api.i18n.t("Without headings"),icon:pu,isActive:!this.data.withHeadings,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.withHeadings=!1,this.table.setHeadingsSetting(this.data.withHeadings)}},{label:this.data.stretched?this.api.i18n.t("Collapse"):this.api.i18n.t("Stretch"),icon:this.data.stretched?su:uu,closeOnActivate:!0,toggle:!0,onActivate:()=>{this.data.stretched=!this.data.stretched,this.block.stretched=this.data.stretched}}]}save(){const e=this.table.getData();return{withHeadings:this.data.withHeadings,stretched:this.data.stretched,content:e}}destroy(){this.table.destroy()}getConfig(e,t=void 0,o=void 0){const i=this.data||o;return i?i[e]?i[e]:t:this.config&&this.config[e]?this.config[e]:t}static get pasteConfig(){return{tags:["TABLE","TR","TH","TD"]}}onPaste(e){const t=e.detail.data,o=t.querySelector(":scope > thead, tr:first-of-type th"),i=Array.from(t.querySelectorAll("tr")).map(s=>Array.from(s.querySelectorAll("th, td")).map(l=>l.innerHTML));this.data={withHeadings:o!==null,content:i},this.table.wrapper&&this.table.wrapper.replaceWith(this.render())}}export{bu as A,wu as E,vu as F,ba as g};