84 lines
210 KiB
JavaScript
84 lines
210 KiB
JavaScript
import{_ as Oe,a1 as Zt,f as Ne,c as De,r as Re,h as Pe,o as Fe}from"./app-front-32dad050.js";var He=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Ct(){}Object.assign(Ct,{default:Ct,register:Ct,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(s){const t=(this.document||this.ownerDocument).querySelectorAll(s);let e=t.length;for(;--e>=0&&t.item(e)!==this;);return e>-1});Element.prototype.closest||(Element.prototype.closest=function(s){let t=this;if(!document.documentElement.contains(t))return null;do{if(t.matches(s))return t;t=t.parentElement||t.parentNode}while(t!==null);return null});Element.prototype.prepend||(Element.prototype.prepend=function(s){const t=document.createDocumentFragment();Array.isArray(s)||(s=[s]),s.forEach(e=>{const o=e instanceof Node;t.appendChild(o?e:document.createTextNode(e))}),this.insertBefore(t,this.firstChild)});Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(s){s=arguments.length===0?!0:!!s;const t=this.parentNode,e=window.getComputedStyle(t,null),o=parseInt(e.getPropertyValue("border-top-width")),i=parseInt(e.getPropertyValue("border-left-width")),n=this.offsetTop-t.offsetTop<t.scrollTop,r=this.offsetTop-t.offsetTop+this.clientHeight-o>t.scrollTop+t.clientHeight,a=this.offsetLeft-t.offsetLeft<t.scrollLeft,l=this.offsetLeft-t.offsetLeft+this.clientWidth-i>t.scrollLeft+t.clientWidth,c=n&&!r;(n||r)&&s&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-o+this.clientHeight/2),(a||l)&&s&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-i+this.clientWidth/2),(n||r||a||l)&&!s&&this.scrollIntoView(c)});window.requestIdleCallback=window.requestIdleCallback||function(s){const t=Date.now();return setTimeout(function(){s({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-t))}})},1)};window.cancelIdleCallback=window.cancelIdleCallback||function(s){clearTimeout(s)};let je=(s=21)=>crypto.getRandomValues(new Uint8Array(s)).reduce((t,e)=>(e&=63,e<36?t+=e.toString(36):e<62?t+=(e-26).toString(36).toUpperCase():e>62?t+="-":t+="_",t),"");var se=(s=>(s.VERBOSE="VERBOSE",s.INFO="INFO",s.WARN="WARN",s.ERROR="ERROR",s))(se||{});const E={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},ze={LEFT:0,WHEEL:1,RIGHT:2,BACKWARD:3,FORWARD:4};function mt(s,t,e="log",o,i="color: inherit"){if(!("console"in window)||!window.console[e])return;const n=["info","log","warn","error"].includes(e),r=[];switch(mt.logLevel){case"ERROR":if(e!=="error")return;break;case"WARN":if(!["error","warn"].includes(e))return;break;case"INFO":if(!n||s)return;break}o&&r.push(o);const a="Editor.js 2.28.0",l=`line-height: 1em;
|
||
color: #006FEA;
|
||
display: inline-block;
|
||
font-size: 11px;
|
||
line-height: 1em;
|
||
background-color: #fff;
|
||
padding: 4px 9px;
|
||
border-radius: 30px;
|
||
border: 1px solid rgba(56, 138, 229, 0.16);
|
||
margin: 4px 5px 4px 0;`;s&&(n?(r.unshift(l,i),t=`%c${a}%c ${t}`):t=`( ${a} )${t}`);try{n?o?console[e](`${t} %o`,...r):console[e](t,...r):console[e](t)}catch{}}mt.logLevel="VERBOSE";function Ue(s){mt.logLevel=s}const _=mt.bind(window,!1),K=mt.bind(window,!0);function ot(s){return Object.prototype.toString.call(s).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function R(s){return ot(s)==="function"||ot(s)==="asyncfunction"}function z(s){return ot(s)==="object"}function J(s){return ot(s)==="string"}function $e(s){return ot(s)==="boolean"}function Gt(s){return ot(s)==="number"}function Jt(s){return ot(s)==="undefined"}function V(s){return s?Object.keys(s).length===0&&s.constructor===Object:!0}function re(s){return s>47&&s<58||s===32||s===13||s===229||s>64&&s<91||s>95&&s<112||s>185&&s<193||s>218&&s<223}async function We(s,t=()=>{},e=()=>{}){async function o(i,n,r){try{await i.function(i.data),await n(Jt(i.data)?{}:i.data)}catch{r(Jt(i.data)?{}:i.data)}}return s.reduce(async(i,n)=>(await i,o(n,t,e)),Promise.resolve())}function ae(s){return Array.prototype.slice.call(s)}function rt(s,t){return function(){const e=this,o=arguments;window.setTimeout(()=>s.apply(e,o),t)}}function Ye(s){return s.name.split(".").pop()}function Ke(s){return/^[-\w]+\/([-+\w]+|\*)$/.test(s)}function Xe(s,t,e){let o;return(...i)=>{const n=this,r=()=>{o=null,e||s.apply(n,i)},a=e&&!o;window.clearTimeout(o),o=window.setTimeout(r,t),a&&s.apply(n,i)}}function St(s,t,e=void 0){let o,i,n,r=null,a=0;e||(e={});const l=function(){a=e.leading===!1?0:Date.now(),r=null,n=s.apply(o,i),r||(o=i=null)};return function(){const c=Date.now();!a&&e.leading===!1&&(a=c);const p=t-(c-a);return o=this,i=arguments,p<=0||p>t?(r&&(clearTimeout(r),r=null),a=c,n=s.apply(o,i),r||(o=i=null)):!r&&e.trailing!==!1&&(r=setTimeout(l,p)),n}}function Ve(){const s={win:!1,mac:!1,x11:!1,linux:!1},t=Object.keys(s).find(e=>window.navigator.appVersion.toLowerCase().indexOf(e)!==-1);return t&&(s[t]=!0),s}function at(s){return s[0].toUpperCase()+s.slice(1)}function It(s,...t){if(!t.length)return s;const e=t.shift();if(z(s)&&z(e))for(const o in e)z(e[o])?(s[o]||Object.assign(s,{[o]:{}}),It(s[o],e[o])):Object.assign(s,{[o]:e[o]});return It(s,...t)}function Rt(s){const t=Ve();return s=s.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," + "),t.mac?s=s.replace(/ctrl|cmd/gi,"⌘").replace(/alt/gi,"⌥"):s=s.replace(/cmd/gi,"Ctrl").replace(/windows/gi,"WIN"),s}function qe(s){try{return new URL(s).href}catch{}return s.substring(0,2)==="//"?window.location.protocol+s:window.location.origin+s}function Ze(){return je(10)}function Ge(s){window.open(s,"_blank")}function Je(s=""){return`${s}${Math.floor(Math.random()*1e8).toString(16)}`}function Mt(s,t,e){const o=`«${t}» is deprecated and will be removed in the next major release. Please use the «${e}» instead.`;s&&K(o,"warn")}function ct(s,t,e){const o=e.value?"value":"get",i=e[o],n=`#${t}Cache`;if(e[o]=function(...r){return this[n]===void 0&&(this[n]=i.apply(this,...r)),this[n]},o==="get"&&e.set){const r=e.set;e.set=function(a){delete s[n],r.apply(this,a)}}return e}const le=650;function et(){return window.matchMedia(`(max-width: ${le}px)`).matches}const Qt=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 Qe(s,t){const e=Array.isArray(s)||z(s),o=Array.isArray(t)||z(t);return e||o?JSON.stringify(s)===JSON.stringify(t):s===t}class d{static isSingleTag(t){return t.tagName&&["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"].includes(t.tagName)}static isLineBreakTag(t){return t&&t.tagName&&["BR","WBR"].includes(t.tagName)}static make(t,e=null,o={}){const i=document.createElement(t);Array.isArray(e)?i.classList.add(...e):e&&i.classList.add(e);for(const n in o)Object.prototype.hasOwnProperty.call(o,n)&&(i[n]=o[n]);return i}static text(t){return document.createTextNode(t)}static append(t,e){Array.isArray(e)?e.forEach(o=>t.appendChild(o)):t.appendChild(e)}static prepend(t,e){Array.isArray(e)?(e=e.reverse(),e.forEach(o=>t.prepend(o))):t.prepend(e)}static swap(t,e){const o=document.createElement("div"),i=t.parentNode;i.insertBefore(o,t),i.insertBefore(t,e),i.insertBefore(e,o),i.removeChild(o)}static find(t=document,e){return t.querySelector(e)}static get(t){return document.getElementById(t)}static findAll(t=document,e){return t.querySelectorAll(e)}static get allInputsSelector(){return"[contenteditable=true], textarea, input:not([type]), "+["text","password","email","number","search","tel","url"].map(t=>`input[type="${t}"]`).join(", ")}static findAllInputs(t){return ae(t.querySelectorAll(d.allInputsSelector)).reduce((e,o)=>d.isNativeInput(o)||d.containsOnlyInlineElements(o)?[...e,o]:[...e,...d.getDeepestBlockElements(o)],[])}static getDeepestNode(t,e=!1){const o=e?"lastChild":"firstChild",i=e?"previousSibling":"nextSibling";if(t&&t.nodeType===Node.ELEMENT_NODE&&t[o]){let n=t[o];if(d.isSingleTag(n)&&!d.isNativeInput(n)&&!d.isLineBreakTag(n))if(n[i])n=n[i];else if(n.parentNode[i])n=n.parentNode[i];else return n.parentNode;return this.getDeepestNode(n,e)}return t}static isElement(t){return Gt(t)?!1:t&&t.nodeType&&t.nodeType===Node.ELEMENT_NODE}static isFragment(t){return Gt(t)?!1:t&&t.nodeType&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}static isContentEditable(t){return t.contentEditable==="true"}static isNativeInput(t){const e=["INPUT","TEXTAREA"];return t&&t.tagName?e.includes(t.tagName):!1}static canSetCaret(t){let e=!0;if(d.isNativeInput(t))switch(t.type){case"file":case"checkbox":case"radio":case"hidden":case"submit":case"button":case"image":case"reset":e=!1;break}else e=d.isContentEditable(t);return e}static isNodeEmpty(t){let e;return this.isSingleTag(t)&&!this.isLineBreakTag(t)?!1:(this.isElement(t)&&this.isNativeInput(t)?e=t.value:e=t.textContent.replace("",""),e.trim().length===0)}static isLeaf(t){return t?t.childNodes.length===0:!1}static isEmpty(t){t.normalize();const e=[t];for(;e.length>0;)if(t=e.shift(),!!t){if(this.isLeaf(t)&&!this.isNodeEmpty(t))return!1;t.childNodes&&e.push(...Array.from(t.childNodes))}return!0}static isHTMLString(t){const e=d.make("div");return e.innerHTML=t,e.childElementCount>0}static getContentLength(t){return d.isNativeInput(t)?t.value.length:t.nodeType===Node.TEXT_NODE?t.length:t.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(t){let e;J(t)?(e=document.createElement("div"),e.innerHTML=t):e=t;const o=i=>!d.blockElements.includes(i.tagName.toLowerCase())&&Array.from(i.children).every(o);return Array.from(e.children).every(o)}static getDeepestBlockElements(t){return d.containsOnlyInlineElements(t)?[t]:Array.from(t.children).reduce((e,o)=>[...e,...d.getDeepestBlockElements(o)],[])}static getHolder(t){return J(t)?document.getElementById(t):t}static isAnchor(t){return t.tagName.toLowerCase()==="a"}static offset(t){const e=t.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop,n=e.top+i,r=e.left+o;return{top:n,left:r,bottom:n+e.height,right:r+e.width}}}const to={blockTunes:{toggler:{"Click to tune":"","or drag to move":""}},inlineToolbar:{converter:{"Convert to":""}},toolbar:{toolbox:{Add:""}},popover:{Filter:"","Nothing found":""}},eo={Text:"",Link:"",Bold:"",Italic:""},oo={link:{"Add a link":""},stub:{"The block can not be displayed correctly.":""}},io={delete:{Delete:"","Click to delete":""},moveUp:{"Move up":""},moveDown:{"Move down":""}},ce={ui:to,toolNames:eo,tools:oo,blockTunes:io},it=class{static ui(s,t){return it._t(s,t)}static t(s,t){return it._t(s,t)}static setDictionary(s){it.currentDictionary=s}static _t(s,t){const e=it.getNamespace(s);return!e||!e[t]?t:e[t]}static getNamespace(s){return s.split(".").reduce((t,e)=>!t||!Object.keys(t).length?{}:t[e],it.currentDictionary)}};let $=it;$.currentDictionary=ce;class de extends Error{}class wt{constructor(){this.subscribers={}}on(t,e){t in this.subscribers||(this.subscribers[t]=[]),this.subscribers[t].push(e)}once(t,e){t in this.subscribers||(this.subscribers[t]=[]);const o=i=>{const n=e(i),r=this.subscribers[t].indexOf(o);return r!==-1&&this.subscribers[t].splice(r,1),n};this.subscribers[t].push(o)}emit(t,e){V(this.subscribers)||!this.subscribers[t]||this.subscribers[t].reduce((o,i)=>{const n=i(o);return n!==void 0?n:o},e)}off(t,e){if(this.subscribers[t]===void 0){console.warn(`EventDispatcher .off(): there is no subscribers for event "${t.toString()}". Probably, .off() called before .on()`);return}for(let o=0;o<this.subscribers[t].length;o++)if(this.subscribers[t][o]===e){delete this.subscribers[t][o];break}}destroy(){this.subscribers={}}}function tt(s){Object.setPrototypeOf(this,{get id(){return s.id},get name(){return s.name},get config(){return s.config},get holder(){return s.holder},get isEmpty(){return s.isEmpty},get selected(){return s.selected},set stretched(t){s.stretched=t},get stretched(){return s.stretched},call(t,e){return s.call(t,e)},save(){return s.save()},validate(t){return s.validate(t)},dispatchChange(){s.dispatchChange()}})}class Pt{constructor(){this.allListeners=[]}on(t,e,o,i=!1){const n=Je("l"),r={id:n,element:t,eventType:e,handler:o,options:i};if(!this.findOne(t,e,o))return this.allListeners.push(r),t.addEventListener(e,o,i),n}off(t,e,o,i){const n=this.findAll(t,e,o);n.forEach((r,a)=>{const l=this.allListeners.indexOf(n[a]);l>-1&&(this.allListeners.splice(l,1),r.element.removeEventListener(r.eventType,r.handler,r.options))})}offById(t){const e=this.findById(t);e&&e.element.removeEventListener(e.eventType,e.handler,e.options)}findOne(t,e,o){const i=this.findAll(t,e,o);return i.length>0?i[0]:null}findAll(t,e,o){let i;const n=t?this.findByEventTarget(t):[];return t&&e&&o?i=n.filter(r=>r.eventType===e&&r.handler===o):t&&e?i=n.filter(r=>r.eventType===e):i=n,i}removeAll(){this.allListeners.map(t=>{t.element.removeEventListener(t.eventType,t.handler,t.options)}),this.allListeners=[]}destroy(){this.removeAll()}findByEventTarget(t){return this.allListeners.filter(e=>{if(e.element===t)return e})}findByType(t){return this.allListeners.filter(e=>{if(e.eventType===t)return e})}findByHandler(t){return this.allListeners.filter(e=>{if(e.handler===t)return e})}findById(t){return this.allListeners.find(e=>e.id===t)}}class T{constructor({config:t,eventsDispatcher:e}){if(this.nodes={},this.listeners=new Pt,this.readOnlyMutableListeners={on:(o,i,n,r=!1)=>{this.mutableListenerIds.push(this.listeners.on(o,i,n,r))},clearAll:()=>{for(const o of this.mutableListenerIds)this.listeners.offById(o);this.mutableListenerIds=[]}},this.mutableListenerIds=[],new.target===T)throw new TypeError("Constructors for abstract class Module are not allowed.");this.config=t,this.eventsDispatcher=e}set state(t){this.Editor=t}removeAllNodes(){for(const t in this.nodes){const e=this.nodes[t];e instanceof HTMLElement&&e.remove()}}get isRtl(){return this.config.i18n.direction==="rtl"}}class b{constructor(){this.instance=null,this.selection=null,this.savedSelectionRange=null,this.isFakeBackgroundEnabled=!1,this.commandBackground="backColor",this.commandRemoveFormat="removeFormat"}static get CSS(){return{editorWrapper:"codex-editor",editorZone:"codex-editor__redactor"}}static get anchorNode(){const t=window.getSelection();return t?t.anchorNode:null}static get anchorElement(){const t=window.getSelection();if(!t)return null;const e=t.anchorNode;return e?d.isElement(e)?e:e.parentElement:null}static get anchorOffset(){const t=window.getSelection();return t?t.anchorOffset:null}static get isCollapsed(){const t=window.getSelection();return t?t.isCollapsed:null}static get isAtEditor(){return this.isSelectionAtEditor(b.get())}static isSelectionAtEditor(t){if(!t)return!1;let e=t.anchorNode||t.focusNode;e&&e.nodeType===Node.TEXT_NODE&&(e=e.parentNode);let o=null;return e&&e instanceof Element&&(o=e.closest(`.${b.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static isRangeAtEditor(t){if(!t)return;let e=t.startContainer;e&&e.nodeType===Node.TEXT_NODE&&(e=e.parentNode);let o=null;return e&&e instanceof Element&&(o=e.closest(`.${b.CSS.editorZone}`)),o?o.nodeType===Node.ELEMENT_NODE:!1}static get isSelectionExists(){return!!b.get().anchorNode}static get range(){return this.getRangeFromSelection(this.get())}static getRangeFromSelection(t){return t&&t.rangeCount?t.getRangeAt(0):null}static get rect(){let t=document.selection,e,o={x:0,y:0,width:0,height:0};if(t&&t.type!=="Control")return t=t,e=t.createRange(),o.x=e.boundingLeft,o.y=e.boundingTop,o.width=e.boundingWidth,o.height=e.boundingHeight,o;if(!window.getSelection)return _("Method window.getSelection is not supported","warn"),o;if(t=window.getSelection(),t.rangeCount===null||isNaN(t.rangeCount))return _("Method SelectionUtils.rangeCount is not supported","warn"),o;if(t.rangeCount===0)return o;if(e=t.getRangeAt(0).cloneRange(),e.getBoundingClientRect&&(o=e.getBoundingClientRect()),o.x===0&&o.y===0){const i=document.createElement("span");if(i.getBoundingClientRect){i.appendChild(document.createTextNode("")),e.insertNode(i),o=i.getBoundingClientRect();const n=i.parentNode;n.removeChild(i),n.normalize()}}return o}static get text(){return window.getSelection?window.getSelection().toString():""}static get(){return window.getSelection()}static setCursor(t,e=0){const o=document.createRange(),i=window.getSelection();return d.isNativeInput(t)?d.canSetCaret(t)?(t.focus(),t.selectionStart=t.selectionEnd=e,t.getBoundingClientRect()):void 0:(o.setStart(t,e),o.setEnd(t,e),i.removeAllRanges(),i.addRange(o),o.getBoundingClientRect())}static isRangeInsideContainer(t){const e=b.range;return e===null?!1:t.contains(e.startContainer)}static addFakeCursor(){const t=b.range;if(t===null)return;const e=d.make("span","codex-editor__fake-cursor");e.dataset.mutationFree="true",t.collapse(),t.insertNode(e)}static isFakeCursorInsideContainer(t){return d.find(t,".codex-editor__fake-cursor")!==null}static removeFakeCursor(t=document.body){const e=d.find(t,".codex-editor__fake-cursor");e&&e.remove()}removeFakeBackground(){this.isFakeBackgroundEnabled&&(this.isFakeBackgroundEnabled=!1,document.execCommand(this.commandRemoveFormat))}setFakeBackground(){document.execCommand(this.commandBackground,!1,"#a8d6ff"),this.isFakeBackgroundEnabled=!0}save(){this.savedSelectionRange=b.range}restore(){if(!this.savedSelectionRange)return;const t=window.getSelection();t.removeAllRanges(),t.addRange(this.savedSelectionRange)}clearSaved(){this.savedSelectionRange=null}collapseToEnd(){const t=window.getSelection(),e=document.createRange();e.selectNodeContents(t.focusNode),e.collapse(!1),t.removeAllRanges(),t.addRange(e)}findParentTag(t,e,o=10){const i=window.getSelection();let n=null;return!i||!i.anchorNode||!i.focusNode?null:([i.anchorNode,i.focusNode].forEach(r=>{let a=o;for(;a>0&&r.parentNode&&!(r.tagName===t&&(n=r,e&&r.classList&&!r.classList.contains(e)&&(n=null),n));)r=r.parentNode,a--}),n)}expandToTag(t){const e=window.getSelection();e.removeAllRanges();const o=document.createRange();o.selectNodeContents(t),e.addRange(o)}}function no(s,t){const{type:e,target:o,addedNodes:i,removedNodes:n}=s;if(o===t)return!0;if(["characterData","attributes"].includes(e)){const l=o.nodeType===Node.TEXT_NODE?o.parentNode:o;return t.contains(l)}const r=Array.from(i).some(l=>t.contains(l)),a=Array.from(n).some(l=>t.contains(l));return r||a}const _t="redactor dom changed",he="block changed",pe="fake cursor is about to be toggled",ue="fake cursor have been set";function te(s,t){return s.mergeable&&s.name===t.name}function so(s,t){const e=t==null?void 0:t.export;return R(e)?e(s):J(e)?s[e]:(e!==void 0&&_("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 ro(s,t){const e=t==null?void 0:t.import;return R(e)?e(s):J(e)?{[e]:s}:(e!==void 0&&_("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 q=(s=>(s.APPEND_CALLBACK="appendCallback",s.RENDERED="rendered",s.MOVED="moved",s.UPDATED="updated",s.REMOVED="removed",s.ON_PASTE="onPaste",s))(q||{});class F extends wt{constructor({id:t=Ze(),data:e,tool:o,api:i,readOnly:n,tunesData:r},a){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=(l=void 0)=>{const c=l===void 0,p=l instanceof InputEvent;!c&&!p&&this.detectToolRootChange(l);let h;c||p?h=!0:h=!(l.length>0&&l.every(f=>{const{addedNodes:k,removedNodes:u,target:C}=f;return[...Array.from(k),...Array.from(u),C].some(L=>d.isElement(L)?L.dataset.mutationFree==="true":!1)})),h&&(this.dropInputsCache(),this.updateCurrentInput(),this.call("updated"),this.emit("didMutated",this))},this.name=o.name,this.id=t,this.settings=o.settings,this.config=o.settings.config||{},this.api=i,this.editorEventBus=a||null,this.blockAPI=new tt(this),this.tool=o,this.toolInstance=o.create(e,this.blockAPI,n),this.tunes=o.tunes,this.composeTunes(r),this.holder=this.compose(),window.requestIdleCallback(()=>{this.watchBlockMutations(),this.addInputEvents()})}static get CSS(){return{wrapper:"ce-block",wrapperStretched:"ce-block--stretched",content:"ce-block__content",focused:"ce-block--focused",selected:"ce-block--selected",dropTarget:"ce-block--drop-target"}}get inputs(){if(this.cachedInputs.length!==0)return this.cachedInputs;const t=d.findAllInputs(this.holder);return this.inputIndex>t.length-1&&(this.inputIndex=t.length-1),this.cachedInputs=t,t}get currentInput(){return this.inputs[this.inputIndex]}set currentInput(t){const e=this.inputs.findIndex(o=>o===t||o.contains(t));e!==-1&&(this.inputIndex=e)}get firstInput(){return this.inputs[0]}get lastInput(){const t=this.inputs;return t[t.length-1]}get nextInput(){return this.inputs[this.inputIndex+1]}get previousInput(){return this.inputs[this.inputIndex-1]}get data(){return this.save().then(t=>t&&!V(t.data)?t.data:{})}get sanitize(){return this.tool.sanitizeConfig}get mergeable(){return R(this.toolInstance.merge)}get isEmpty(){const t=d.isEmpty(this.pluginsContent),e=!this.hasMedia;return t&&e}get hasMedia(){const t=["img","iframe","video","audio","source","input","textarea","twitterwidget"];return!!this.holder.querySelector(t.join(","))}set focused(t){this.holder.classList.toggle(F.CSS.focused,t)}get focused(){return this.holder.classList.contains(F.CSS.focused)}set selected(t){var e,o;this.holder.classList.toggle(F.CSS.selected,t);const i=t===!0&&b.isRangeInsideContainer(this.holder),n=t===!1&&b.isFakeCursorInsideContainer(this.holder);(i||n)&&((e=this.editorEventBus)==null||e.emit(pe,{state:t}),i?b.addFakeCursor():b.removeFakeCursor(this.holder),(o=this.editorEventBus)==null||o.emit(ue,{state:t}))}get selected(){return this.holder.classList.contains(F.CSS.selected)}set stretched(t){this.holder.classList.toggle(F.CSS.wrapperStretched,t)}get stretched(){return this.holder.classList.contains(F.CSS.wrapperStretched)}set dropTarget(t){this.holder.classList.toggle(F.CSS.dropTarget,t)}get pluginsContent(){return this.toolRenderedElement}call(t,e){if(R(this.toolInstance[t])){t==="appendCallback"&&_("`appendCallback` hook is deprecated and will be removed in the next major release. Use `rendered` hook instead","warn");try{this.toolInstance[t].call(this.toolInstance,e)}catch(o){_(`Error during '${t}' call: ${o.message}`,"error")}}}async mergeWith(t){await this.toolInstance.merge(t)}async save(){const t=await this.toolInstance.save(this.pluginsContent),e=this.unavailableTunesData;[...this.tunesInstances.entries(),...this.defaultTunesInstances.entries()].forEach(([n,r])=>{if(R(r.save))try{e[n]=r.save()}catch(a){_(`Tune ${r.constructor.name} save method throws an Error %o`,"warn",a)}});const o=window.performance.now();let i;return Promise.resolve(t).then(n=>(i=window.performance.now(),{id:this.id,tool:this.name,data:n,tunes:e,time:i-o})).catch(n=>{_(`Saving process for ${this.name} tool failed due to the ${n}`,"log","red")})}async validate(t){let e=!0;return this.toolInstance.validate instanceof Function&&(e=await this.toolInstance.validate(t)),e}getTunes(){const t=document.createElement("div"),e=[],o=typeof this.toolInstance.renderSettings=="function"?this.toolInstance.renderSettings():[],i=[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].map(n=>n.render());return[o,i].flat().forEach(n=>{d.isElement(n)?t.appendChild(n):Array.isArray(n)?e.push(...n):e.push(n)}),[e,t]}updateCurrentInput(){this.currentInput=d.isNativeInput(document.activeElement)||!b.anchorNode?document.activeElement:b.anchorNode}dispatchChange(){this.didMutated()}destroy(){this.unwatchBlockMutations(),this.removeInputEvents(),super.destroy(),R(this.toolInstance.destroy)&&this.toolInstance.destroy()}async getActiveToolboxEntry(){const t=this.tool.toolbox;if(t.length===1)return Promise.resolve(this.tool.toolbox[0]);const e=await this.data;return t.find(o=>Object.entries(o.data).some(([i,n])=>e[i]&&Qe(e[i],n)))}async exportDataAsString(){const t=await this.data;return so(t,this.tool.conversionConfig)}compose(){const t=d.make("div",F.CSS.wrapper),e=d.make("div",F.CSS.content),o=this.toolInstance.render();t.dataset.id=this.id,this.toolRenderedElement=o,e.appendChild(this.toolRenderedElement);let i=e;return[...this.tunesInstances.values(),...this.defaultTunesInstances.values()].forEach(n=>{if(R(n.wrap))try{i=n.wrap(i)}catch(r){_(`Tune ${n.constructor.name} wrap method throws an Error %o`,"warn",r)}}),t.appendChild(i),t}composeTunes(t){Array.from(this.tunes.values()).forEach(e=>{(e.isInternal?this.defaultTunesInstances:this.tunesInstances).set(e.name,e.create(t[e.name],this.blockAPI))}),Object.entries(t).forEach(([e,o])=>{this.tunesInstances.has(e)||(this.unavailableTunesData[e]=o)})}addInputEvents(){this.inputs.forEach(t=>{t.addEventListener("focus",this.handleFocus),d.isNativeInput(t)&&t.addEventListener("input",this.didMutated)})}removeInputEvents(){this.inputs.forEach(t=>{t.removeEventListener("focus",this.handleFocus),d.isNativeInput(t)&&t.removeEventListener("input",this.didMutated)})}watchBlockMutations(){var t;this.redactorDomChangedCallback=e=>{const{mutations:o}=e;o.some(i=>no(i,this.toolRenderedElement))&&this.didMutated(o)},(t=this.editorEventBus)==null||t.on(_t,this.redactorDomChangedCallback)}unwatchBlockMutations(){var t;(t=this.editorEventBus)==null||t.off(_t,this.redactorDomChangedCallback)}detectToolRootChange(t){t.forEach(e=>{if(Array.from(e.removedNodes).includes(this.toolRenderedElement)){const o=e.addedNodes[e.addedNodes.length-1];this.toolRenderedElement=o}})}dropInputsCache(){this.cachedInputs=[]}}class ao extends T{constructor(){super(...arguments),this.insert=(t=this.config.defaultBlock,e={},o={},i,n,r,a)=>{const l=this.Editor.BlockManager.insert({id:a,tool:t,data:e,index:i,needToFocus:n,replace:r});return new tt(l)},this.composeBlockData=async t=>{const e=this.Editor.Tools.blockTools.get(t);return new F({tool:e,api:this.Editor.API,readOnly:!0,data:{},tunesData:{}}).data},this.update=async(t,e)=>{const{BlockManager:o}=this.Editor,i=o.getBlockById(t);if(i===void 0)throw new Error(`Block with id "${t}" not found`);const n=await o.update(i,e);return new tt(n)},this.convert=(t,e,o)=>{var i,n;const{BlockManager:r,Tools:a}=this.Editor,l=r.getBlockById(t);if(!l)throw new Error(`Block with id "${t}" not found`);const c=a.blockTools.get(l.name),p=a.blockTools.get(e);if(!p)throw new Error(`Block Tool with type "${e}" not found`);const h=((i=c==null?void 0:c.conversionConfig)==null?void 0:i.export)!==void 0,f=((n=p.conversionConfig)==null?void 0:n.import)!==void 0;if(h&&f)r.convert(l,e,o);else{const k=[h?!1:at(l.name),f?!1:at(e)].filter(Boolean).join(" and ");throw new Error(`Conversion from "${l.name}" to "${e}" is not possible. ${k} tool(s) should provide a "conversionConfig"`)}},this.insertMany=(t,e=this.Editor.BlockManager.blocks.length-1)=>{this.validateIndex(e);const o=t.map(({id:i,type:n,data:r})=>this.Editor.BlockManager.composeBlock({id:i,tool:n||this.config.defaultBlock,data:r}));return this.Editor.BlockManager.insertMany(o,e),o.map(i=>new tt(i))}}get methods(){return{clear:()=>this.clear(),render:t=>this.render(t),renderFromHTML:t=>this.renderFromHTML(t),delete:t=>this.delete(t),swap:(t,e)=>this.swap(t,e),move:(t,e)=>this.move(t,e),getBlockByIndex:t=>this.getBlockByIndex(t),getById:t=>this.getById(t),getCurrentBlockIndex:()=>this.getCurrentBlockIndex(),getBlockIndex:t=>this.getBlockIndex(t),getBlocksCount:()=>this.getBlocksCount(),stretchBlock:(t,e=!0)=>this.stretchBlock(t,e),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(t){const e=this.Editor.BlockManager.getBlockById(t);if(!e){K("There is no block with id `"+t+"`","warn");return}return this.Editor.BlockManager.getBlockIndex(e)}getBlockByIndex(t){const e=this.Editor.BlockManager.getBlockByIndex(t);if(e===void 0){K("There is no block at index `"+t+"`","warn");return}return new tt(e)}getById(t){const e=this.Editor.BlockManager.getBlockById(t);return e===void 0?(K("There is no block with id `"+t+"`","warn"),null):new tt(e)}swap(t,e){_("`blocks.swap()` method is deprecated and will be removed in the next major release. Use `block.move()` method instead","info"),this.Editor.BlockManager.swap(t,e)}move(t,e){this.Editor.BlockManager.move(t,e)}delete(t=this.Editor.BlockManager.currentBlockIndex){try{const e=this.Editor.BlockManager.getBlockByIndex(t);this.Editor.BlockManager.removeBlock(e)}catch(e){K(e,"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(t){if(t===void 0||t.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(t.blocks),this.Editor.ModificationsObserver.enable()}renderFromHTML(t){return this.Editor.BlockManager.clear(),this.Editor.Paste.processText(t,!0)}stretchBlock(t,e=!0){Mt(!0,"blocks.stretchBlock()","BlockAPI");const o=this.Editor.BlockManager.getBlockByIndex(t);o&&(o.stretched=e)}insertNewBlock(){_("Method blocks.insertNewBlock() is deprecated and it will be removed in the next major release. Use blocks.insert() instead.","warn"),this.insert()}validateIndex(t){if(typeof t!="number")throw new Error("Index should be a number");if(t<0)throw new Error("Index should be greater than or equal to 0");if(t===null)throw new Error("Index should be greater than or equal to 0")}}class lo extends T{constructor(){super(...arguments),this.setToFirstBlock=(t=this.Editor.Caret.positions.DEFAULT,e=0)=>this.Editor.BlockManager.firstBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.firstBlock,t,e),!0):!1,this.setToLastBlock=(t=this.Editor.Caret.positions.DEFAULT,e=0)=>this.Editor.BlockManager.lastBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.lastBlock,t,e),!0):!1,this.setToPreviousBlock=(t=this.Editor.Caret.positions.DEFAULT,e=0)=>this.Editor.BlockManager.previousBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.previousBlock,t,e),!0):!1,this.setToNextBlock=(t=this.Editor.Caret.positions.DEFAULT,e=0)=>this.Editor.BlockManager.nextBlock?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.nextBlock,t,e),!0):!1,this.setToBlock=(t,e=this.Editor.Caret.positions.DEFAULT,o=0)=>this.Editor.BlockManager.blocks[t]?(this.Editor.Caret.setToBlock(this.Editor.BlockManager.blocks[t],e,o),!0):!1,this.focus=(t=!1)=>t?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 co extends T{get methods(){return{emit:(t,e)=>this.emit(t,e),off:(t,e)=>this.off(t,e),on:(t,e)=>this.on(t,e)}}on(t,e){this.eventsDispatcher.on(t,e)}emit(t,e){this.eventsDispatcher.emit(t,e)}off(t,e){this.eventsDispatcher.off(t,e)}}class Ft extends T{static getNamespace(t){return t.isTune()?`blockTunes.${t.name}`:`tools.${t.name}`}get methods(){return{t:()=>{K("I18n.t() method can be accessed only from Tools","warn")}}}getMethodsForTool(t){return Object.assign(this.methods,{t:e=>$.t(Ft.getNamespace(t),e)})}}class ho extends T{get methods(){return{blocks:this.Editor.BlocksAPI.methods,caret:this.Editor.CaretAPI.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(t){return Object.assign(this.methods,{i18n:this.Editor.I18nAPI.getMethodsForTool(t)})}}class po extends T{get methods(){return{close:()=>this.close(),open:()=>this.open()}}open(){this.Editor.InlineToolbar.tryToShow()}close(){this.Editor.InlineToolbar.close()}}class uo extends T{get methods(){return{on:(t,e,o,i)=>this.on(t,e,o,i),off:(t,e,o,i)=>this.off(t,e,o,i),offById:t=>this.offById(t)}}on(t,e,o,i){return this.listeners.on(t,e,o,i)}off(t,e,o,i){this.listeners.off(t,e,o,i)}offById(t){this.listeners.offById(t)}}var At={},fo={get exports(){return At},set exports(s){At=s}};(function(s,t){(function(e,o){s.exports=o()})(window,function(){return function(e){var o={};function i(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=o,i.d=function(n,r,a){i.o(n,r)||Object.defineProperty(n,r,{enumerable:!0,get:a})},i.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,r){if(1&r&&(n=i(n)),8&r||4&r&&typeof n=="object"&&n&&n.__esModule)return n;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:n}),2&r&&typeof n!="string")for(var l in n)i.d(a,l,(function(c){return n[c]}).bind(null,l));return a},i.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(r,"a",r),r},i.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},i.p="/",i(i.s=0)}([function(e,o,i){i(1),e.exports=function(){var n=i(6),r="cdx-notify--bounce-in",a=null;return{show:function(l){if(l.message){(function(){if(a)return!0;a=n.getWrapper(),document.body.appendChild(a)})();var c=null,p=l.time||8e3;switch(l.type){case"confirm":c=n.confirm(l);break;case"prompt":c=n.prompt(l);break;default:c=n.alert(l),window.setTimeout(function(){c.remove()},p)}a.appendChild(c),c.classList.add(r)}}}}()},function(e,o,i){var n=i(2);typeof n=="string"&&(n=[[e.i,n,""]]);var r={hmr:!0,transform:void 0,insertInto:void 0};i(4)(n,r),n.locals&&(e.exports=n.locals)},function(e,o,i){(e.exports=i(3)(!1)).push([e.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(e,o){e.exports=function(i){var n=[];return n.toString=function(){return this.map(function(r){var a=function(l,c){var p=l[1]||"",h=l[3];if(!h)return p;if(c&&typeof btoa=="function"){var f=(u=h,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(u))))+" */"),k=h.sources.map(function(C){return"/*# sourceURL="+h.sourceRoot+C+" */"});return[p].concat(k).concat([f]).join(`
|
||
`)}var u;return[p].join(`
|
||
`)}(r,i);return r[2]?"@media "+r[2]+"{"+a+"}":a}).join("")},n.i=function(r,a){typeof r=="string"&&(r=[[null,r,""]]);for(var l={},c=0;c<this.length;c++){var p=this[c][0];typeof p=="number"&&(l[p]=!0)}for(c=0;c<r.length;c++){var h=r[c];typeof h[0]=="number"&&l[h[0]]||(a&&!h[2]?h[2]=a:a&&(h[2]="("+h[2]+") and ("+a+")"),n.push(h))}},n}},function(e,o,i){var n,r,a={},l=(n=function(){return window&&document&&document.all&&!window.atob},function(){return r===void 0&&(r=n.apply(this,arguments)),r}),c=function(m){var g={};return function(y){if(typeof y=="function")return y();if(g[y]===void 0){var B=(function(A){return document.querySelector(A)}).call(this,y);if(window.HTMLIFrameElement&&B instanceof window.HTMLIFrameElement)try{B=B.contentDocument.head}catch{B=null}g[y]=B}return g[y]}}(),p=null,h=0,f=[],k=i(5);function u(m,g){for(var y=0;y<m.length;y++){var B=m[y],A=a[B.id];if(A){A.refs++;for(var S=0;S<A.parts.length;S++)A.parts[S](B.parts[S]);for(;S<B.parts.length;S++)A.parts.push(v(B.parts[S],g))}else{var H=[];for(S=0;S<B.parts.length;S++)H.push(v(B.parts[S],g));a[B.id]={id:B.id,refs:1,parts:H}}}}function C(m,g){for(var y=[],B={},A=0;A<m.length;A++){var S=m[A],H=g.base?S[0]+g.base:S[0],M={css:S[1],media:S[2],sourceMap:S[3]};B[H]?B[H].parts.push(M):y.push(B[H]={id:H,parts:[M]})}return y}function L(m,g){var y=c(m.insertInto);if(!y)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var B=f[f.length-1];if(m.insertAt==="top")B?B.nextSibling?y.insertBefore(g,B.nextSibling):y.appendChild(g):y.insertBefore(g,y.firstChild),f.push(g);else if(m.insertAt==="bottom")y.appendChild(g);else{if(typeof m.insertAt!="object"||!m.insertAt.before)throw new Error(`[Style Loader]
|
||
|
||
Invalid value for parameter 'insertAt' ('options.insertAt') found.
|
||
Must be 'top', 'bottom', or Object.
|
||
(https://github.com/webpack-contrib/style-loader#insertat)
|
||
`);var A=c(m.insertInto+" "+m.insertAt.before);y.insertBefore(g,A)}}function N(m){if(m.parentNode===null)return!1;m.parentNode.removeChild(m);var g=f.indexOf(m);g>=0&&f.splice(g,1)}function D(m){var g=document.createElement("style");return m.attrs.type===void 0&&(m.attrs.type="text/css"),w(g,m.attrs),L(m,g),g}function w(m,g){Object.keys(g).forEach(function(y){m.setAttribute(y,g[y])})}function v(m,g){var y,B,A,S;if(g.transform&&m.css){if(!(S=g.transform(m.css)))return function(){};m.css=S}if(g.singleton){var H=h++;y=p||(p=D(g)),B=O.bind(null,y,H,!1),A=O.bind(null,y,H,!0)}else m.sourceMap&&typeof URL=="function"&&typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function"&&typeof Blob=="function"&&typeof btoa=="function"?(y=function(M){var W=document.createElement("link");return M.attrs.type===void 0&&(M.attrs.type="text/css"),M.attrs.rel="stylesheet",w(W,M.attrs),L(M,W),W}(g),B=(function(M,W,dt){var Q=dt.css,Et=dt.sourceMap,Ae=W.convertToAbsoluteUrls===void 0&&Et;(W.convertToAbsoluteUrls||Ae)&&(Q=k(Q)),Et&&(Q+=`
|
||
/*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(Et))))+" */");var Le=new Blob([Q],{type:"text/css"}),qt=M.href;M.href=URL.createObjectURL(Le),qt&&URL.revokeObjectURL(qt)}).bind(null,y,g),A=function(){N(y),y.href&&URL.revokeObjectURL(y.href)}):(y=D(g),B=(function(M,W){var dt=W.css,Q=W.media;if(Q&&M.setAttribute("media",Q),M.styleSheet)M.styleSheet.cssText=dt;else{for(;M.firstChild;)M.removeChild(M.firstChild);M.appendChild(document.createTextNode(dt))}}).bind(null,y),A=function(){N(y)});return B(m),function(M){if(M){if(M.css===m.css&&M.media===m.media&&M.sourceMap===m.sourceMap)return;B(m=M)}else A()}}e.exports=function(m,g){if(typeof DEBUG<"u"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(g=g||{}).attrs=typeof g.attrs=="object"?g.attrs:{},g.singleton||typeof g.singleton=="boolean"||(g.singleton=l()),g.insertInto||(g.insertInto="head"),g.insertAt||(g.insertAt="bottom");var y=C(m,g);return u(y,g),function(B){for(var A=[],S=0;S<y.length;S++){var H=y[S];(M=a[H.id]).refs--,A.push(M)}for(B&&u(C(B,g),g),S=0;S<A.length;S++){var M;if((M=A[S]).refs===0){for(var W=0;W<M.parts.length;W++)M.parts[W]();delete a[M.id]}}}};var x,I=(x=[],function(m,g){return x[m]=g,x.filter(Boolean).join(`
|
||
`)});function O(m,g,y,B){var A=y?"":B.css;if(m.styleSheet)m.styleSheet.cssText=I(g,A);else{var S=document.createTextNode(A),H=m.childNodes;H[g]&&m.removeChild(H[g]),H.length?m.insertBefore(S,H[g]):m.appendChild(S)}}},function(e,o){e.exports=function(i){var n=typeof window<"u"&&window.location;if(!n)throw new Error("fixUrls requires window.location");if(!i||typeof i!="string")return i;var r=n.protocol+"//"+n.host,a=r+n.pathname.replace(/\/[^\/]*$/,"/");return i.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,c){var p,h=c.trim().replace(/^"(.*)"$/,function(f,k){return k}).replace(/^'(.*)'$/,function(f,k){return k});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(h)?l:(p=h.indexOf("//")===0?h:h.indexOf("/")===0?r+h:a+h.replace(/^\.\//,""),"url("+JSON.stringify(p)+")")})}},function(e,o,i){var n,r,a,l,c,p,h,f,k;e.exports=(n="cdx-notifies",r="cdx-notify",a="cdx-notify__cross",l="cdx-notify__button--confirm",c="cdx-notify__button--cancel",p="cdx-notify__input",h="cdx-notify__button",f="cdx-notify__btns-wrapper",{alert:k=function(u){var C=document.createElement("DIV"),L=document.createElement("DIV"),N=u.message,D=u.style;return C.classList.add(r),D&&C.classList.add(r+"--"+D),C.innerHTML=N,L.classList.add(a),L.addEventListener("click",C.remove.bind(C)),C.appendChild(L),C},confirm:function(u){var C=k(u),L=document.createElement("div"),N=document.createElement("button"),D=document.createElement("button"),w=C.querySelector("."+a),v=u.cancelHandler,x=u.okHandler;return L.classList.add(f),N.innerHTML=u.okText||"Confirm",D.innerHTML=u.cancelText||"Cancel",N.classList.add(h),D.classList.add(h),N.classList.add(l),D.classList.add(c),v&&typeof v=="function"&&(D.addEventListener("click",v),w.addEventListener("click",v)),x&&typeof x=="function"&&N.addEventListener("click",x),N.addEventListener("click",C.remove.bind(C)),D.addEventListener("click",C.remove.bind(C)),L.appendChild(N),L.appendChild(D),C.appendChild(L),C},prompt:function(u){var C=k(u),L=document.createElement("div"),N=document.createElement("button"),D=document.createElement("input"),w=C.querySelector("."+a),v=u.cancelHandler,x=u.okHandler;return L.classList.add(f),N.innerHTML=u.okText||"Ok",N.classList.add(h),N.classList.add(l),D.classList.add(p),u.placeholder&&D.setAttribute("placeholder",u.placeholder),u.default&&(D.value=u.default),u.inputType&&(D.type=u.inputType),v&&typeof v=="function"&&w.addEventListener("click",v),x&&typeof x=="function"&&N.addEventListener("click",function(){x(D.value)}),N.addEventListener("click",C.remove.bind(C)),L.appendChild(D),L.appendChild(N),C.appendChild(L),C},getWrapper:function(){var u=document.createElement("DIV");return u.classList.add(n),u}})}])})})(fo);const go=xt(At);class mo{show(t){go.show(t)}}class bo extends T{constructor({config:t,eventsDispatcher:e}){super({config:t,eventsDispatcher:e}),this.notifier=new mo}get methods(){return{show:t=>this.show(t)}}show(t){return this.notifier.show(t)}}class ko extends T{get methods(){const t=()=>this.isEnabled;return{toggle:e=>this.toggle(e),get isEnabled(){return t()}}}toggle(t){return this.Editor.ReadOnly.toggle(t)}get isEnabled(){return this.Editor.ReadOnly.isEnabled}}var Lt={},vo={get exports(){return Lt},set exports(s){Lt=s}};(function(s,t){(function(e,o){s.exports=o()})(He,function(){function e(h){var f=h.tags,k=Object.keys(f),u=k.map(function(C){return typeof f[C]}).every(function(C){return C==="object"||C==="boolean"||C==="function"});if(!u)throw new Error("The configuration was invalid");this.config=h}var o=["P","LI","TD","TH","DIV","H1","H2","H3","H4","H5","H6","PRE"];function i(h){return o.indexOf(h.nodeName)!==-1}var n=["A","B","STRONG","I","EM","SUB","SUP","U","STRIKE"];function r(h){return n.indexOf(h.nodeName)!==-1}e.prototype.clean=function(h){const f=document.implementation.createHTMLDocument(),k=f.createElement("div");return k.innerHTML=h,this._sanitize(f,k),k.innerHTML},e.prototype._sanitize=function(h,f){var k=a(h,f),u=k.firstChild();if(u)do{if(u.nodeType===Node.TEXT_NODE)if(u.data.trim()===""&&(u.previousElementSibling&&i(u.previousElementSibling)||u.nextElementSibling&&i(u.nextElementSibling))){f.removeChild(u),this._sanitize(h,f);break}else continue;if(u.nodeType===Node.COMMENT_NODE){f.removeChild(u),this._sanitize(h,f);break}var C=r(u),L;C&&(L=Array.prototype.some.call(u.childNodes,i));var N=!!f.parentNode,D=i(f)&&i(u)&&N,w=u.nodeName.toLowerCase(),v=l(this.config,w,u),x=C&&L;if(x||c(u,v)||!this.config.keepNestedBlockElements&&D){if(!(u.nodeName==="SCRIPT"||u.nodeName==="STYLE"))for(;u.childNodes.length>0;)f.insertBefore(u.childNodes[0],u);f.removeChild(u),this._sanitize(h,f);break}for(var I=0;I<u.attributes.length;I+=1){var O=u.attributes[I];p(O,v,u)&&(u.removeAttribute(O.name),I=I-1)}this._sanitize(h,u)}while(u=k.nextSibling())};function a(h,f){return h.createTreeWalker(f,NodeFilter.SHOW_TEXT|NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT,null,!1)}function l(h,f,k){return typeof h.tags[f]=="function"?h.tags[f](k):h.tags[f]}function c(h,f){return typeof f>"u"?!0:typeof f=="boolean"?!f:!1}function p(h,f,k){var u=h.name.toLowerCase();return f===!0?!1:typeof f[u]=="function"?!f[u](h.value,k):typeof f[u]>"u"||f[u]===!1?!0:typeof f[u]=="string"?f[u]!==h.value:!1}return e})})(vo);const xo=Lt;function fe(s,t){return s.map(e=>{const o=R(t)?t(e.tool):t;return V(o)||(e.data=Ht(e.data,o)),e})}function Z(s,t={}){const e={tags:t};return new xo(e).clean(s)}function Ht(s,t){return Array.isArray(s)?wo(s,t):z(s)?yo(s,t):J(s)?Eo(s,t):s}function wo(s,t){return s.map(e=>Ht(e,t))}function yo(s,t){const e={};for(const o in s){if(!Object.prototype.hasOwnProperty.call(s,o))continue;const i=s[o],n=Co(t[o])?t[o]:t;e[o]=Ht(i,n)}return e}function Eo(s,t){return z(t)?Z(s,t):t===!1?Z(s,{}):s}function Co(s){return z(s)||$e(s)||R(s)}class Bo extends T{get methods(){return{clean:(t,e)=>this.clean(t,e)}}clean(t,e){return Z(t,e)}}class To extends T{get methods(){return{save:()=>this.save()}}save(){const t="Editor's content can not be saved in read-only mode";return this.Editor.ReadOnly.isEnabled?(K(t,"warn"),Promise.reject(new Error(t))):this.Editor.Saver.save()}}class So extends T{get methods(){return{findParentTag:(t,e)=>this.findParentTag(t,e),expandToTag:t=>this.expandToTag(t)}}findParentTag(t,e){return new b().findParentTag(t,e)}expandToTag(t){new b().expandToTag(t)}}class Io extends T{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 Mo extends T{get methods(){return{close:()=>this.close(),open:()=>this.open(),toggleBlockSettings:t=>this.toggleBlockSettings(t),toggleToolbox:t=>this.toggleToolbox(t)}}open(){this.Editor.Toolbar.moveAndOpen()}close(){this.Editor.Toolbar.close()}toggleBlockSettings(t){if(this.Editor.BlockManager.currentBlockIndex===-1){K("Could't toggle the Toolbar because there is no block selected ","warn");return}t??!this.Editor.BlockSettings.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.BlockSettings.open()):this.Editor.BlockSettings.close()}toggleToolbox(t){if(this.Editor.BlockManager.currentBlockIndex===-1){K("Could't toggle the Toolbox because there is no block selected ","warn");return}t??!this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()):this.Editor.Toolbar.toolbox.close()}}var Ot={},_o={get exports(){return Ot},set exports(s){Ot=s}};/*!
|
||
* CodeX.Tooltips
|
||
*
|
||
* @version 1.0.5
|
||
*
|
||
* @licence MIT
|
||
* @author CodeX <https://codex.so>
|
||
*
|
||
*
|
||
*/(function(s,t){(function(e,o){s.exports=o()})(window,function(){return function(e){var o={};function i(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=o,i.d=function(n,r,a){i.o(n,r)||Object.defineProperty(n,r,{enumerable:!0,get:a})},i.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,r){if(1&r&&(n=i(n)),8&r||4&r&&typeof n=="object"&&n&&n.__esModule)return n;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:n}),2&r&&typeof n!="string")for(var l in n)i.d(a,l,(function(c){return n[c]}).bind(null,l));return a},i.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(r,"a",r),r},i.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},i.p="",i(i.s=0)}([function(e,o,i){e.exports=i(1)},function(e,o,i){i.r(o),i.d(o,"default",function(){return n});class n{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(a,l,c){this.nodes.wrapper||this.prepare(),this.hidingTimeout&&clearTimeout(this.hidingTimeout);const p=Object.assign({placement:"bottom",marginTop:0,marginLeft:0,marginRight:0,marginBottom:0,delay:70,hidingDelay:0},c);if(p.hidingDelay&&(this.hidingDelay=p.hidingDelay),this.nodes.content.innerHTML="",typeof l=="string")this.nodes.content.appendChild(document.createTextNode(l));else{if(!(l instanceof Node))throw Error("[CodeX Tooltip] Wrong type of «content» passed. It should be an instance of Node or String. But "+typeof l+" given.");this.nodes.content.appendChild(l)}switch(this.nodes.wrapper.classList.remove(...Object.values(this.CSS.placement)),p.placement){case"top":this.placeTop(a,p);break;case"left":this.placeLeft(a,p);break;case"right":this.placeRight(a,p);break;case"bottom":default:this.placeBottom(a,p)}p&&p.delay?this.showingTimeout=setTimeout(()=>{this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0},p.delay):(this.nodes.wrapper.classList.add(this.CSS.tooltipShown),this.showed=!0)}hide(a=!1){if(this.hidingDelay&&!a)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(a,l,c){a.addEventListener("mouseenter",()=>{this.show(a,l,c)}),a.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 a="codex-tooltips-style";if(document.getElementById(a))return;const l=i(2),c=this.make("style",null,{textContent:l.toString(),id:a});this.prepend(document.head,c)}placeBottom(a,l){const c=a.getBoundingClientRect(),p=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,h=c.bottom+window.pageYOffset+this.offsetTop+l.marginTop;this.applyPlacement("bottom",p,h)}placeTop(a,l){const c=a.getBoundingClientRect(),p=c.left+a.clientWidth/2-this.nodes.wrapper.offsetWidth/2,h=c.top+window.pageYOffset-this.nodes.wrapper.clientHeight-this.offsetTop;this.applyPlacement("top",p,h)}placeLeft(a,l){const c=a.getBoundingClientRect(),p=c.left-this.nodes.wrapper.offsetWidth-this.offsetLeft-l.marginLeft,h=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("left",p,h)}placeRight(a,l){const c=a.getBoundingClientRect(),p=c.right+this.offsetRight+l.marginRight,h=c.top+window.pageYOffset+a.clientHeight/2-this.nodes.wrapper.offsetHeight/2;this.applyPlacement("right",p,h)}applyPlacement(a,l,c){this.nodes.wrapper.classList.add(this.CSS.placement[a]),this.nodes.wrapper.style.left=l+"px",this.nodes.wrapper.style.top=c+"px"}make(a,l=null,c={}){const p=document.createElement(a);Array.isArray(l)?p.classList.add(...l):l&&p.classList.add(l);for(const h in c)c.hasOwnProperty(h)&&(p[h]=c[h]);return p}append(a,l){Array.isArray(l)?l.forEach(c=>a.appendChild(c)):a.appendChild(l)}prepend(a,l){Array.isArray(l)?(l=l.reverse()).forEach(c=>a.prepend(c)):a.prepend(l)}}},function(e,o){e.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})})(_o);const Ao=xt(Ot);class jt{constructor(){this.lib=new Ao}destroy(){this.lib.destroy()}show(t,e,o){this.lib.show(t,e,o)}hide(t=!1){this.lib.hide(t)}onHover(t,e,o){this.lib.onHover(t,e,o)}}class Lo extends T{constructor({config:t,eventsDispatcher:e}){super({config:t,eventsDispatcher:e}),this.tooltip=new jt}destroy(){this.tooltip.destroy()}get methods(){return{show:(t,e,o)=>this.show(t,e,o),hide:()=>this.hide(),onHover:(t,e,o)=>this.onHover(t,e,o)}}show(t,e,o){this.tooltip.show(t,e,o)}hide(){this.tooltip.hide()}onHover(t,e,o){this.tooltip.onHover(t,e,o)}}class Oo extends T{get methods(){return{nodes:this.editorNodes}}get editorNodes(){return{wrapper:this.Editor.UI.nodes.wrapper,redactor:this.Editor.UI.nodes.redactor}}}function ge(s,t){const e={};return Object.entries(s).forEach(([o,i])=>{if(z(i)){const n=t?`${t}.${o}`:o;Object.values(i).every(r=>J(r))?e[o]=n:e[o]=ge(i,n);return}e[o]=i}),e}const X=ge(ce);function No(s,t){const e={};return Object.keys(s).forEach(o=>{const i=t[o];i!==void 0?e[i]=s[o]:e[o]=s[o]}),e}const Do='<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>',me='<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>',Ro='<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>',Po='<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>',Fo='<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>',Ho='<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>',ee='<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>',jo='<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>',zo='<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>',Uo='<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>',$o='<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>',Wo='<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>';class P{constructor(t){this.nodes={root:null,icon:null},this.confirmationState=null,this.removeSpecialFocusBehavior=()=>{this.nodes.root.classList.remove(P.CSS.noFocus)},this.removeSpecialHoverBehavior=()=>{this.nodes.root.classList.remove(P.CSS.noHover)},this.onErrorAnimationEnd=()=>{this.nodes.icon.classList.remove(P.CSS.wobbleAnimation),this.nodes.icon.removeEventListener("animationend",this.onErrorAnimationEnd)},this.params=t,this.nodes.root=this.make(t)}get isDisabled(){return this.params.isDisabled}get toggle(){return this.params.toggle}get title(){return this.params.title}get closeOnActivate(){return this.params.closeOnActivate}get isConfirmationStateEnabled(){return this.confirmationState!==null}get isFocused(){return this.nodes.root.classList.contains(P.CSS.focused)}static get CSS(){return{container:"ce-popover-item",title:"ce-popover-item__title",secondaryTitle:"ce-popover-item__secondary-title",icon:"ce-popover-item__icon",active:"ce-popover-item--active",disabled:"ce-popover-item--disabled",focused:"ce-popover-item--focused",hidden:"ce-popover-item--hidden",confirmationState:"ce-popover-item--confirmation",noHover:"ce-popover-item--no-hover",noFocus:"ce-popover-item--no-focus",wobbleAnimation:"wobble"}}getElement(){return this.nodes.root}handleClick(){if(this.isConfirmationStateEnabled){this.activateOrEnableConfirmationMode(this.confirmationState);return}this.activateOrEnableConfirmationMode(this.params)}toggleActive(t){this.nodes.root.classList.toggle(P.CSS.active,t)}toggleHidden(t){this.nodes.root.classList.toggle(P.CSS.hidden,t)}reset(){this.isConfirmationStateEnabled&&this.disableConfirmationMode()}onFocus(){this.disableSpecialHoverAndFocusBehavior()}make(t){const e=d.make("div",P.CSS.container);return t.name&&(e.dataset.itemName=t.name),this.nodes.icon=d.make("div",P.CSS.icon,{innerHTML:t.icon||Fo}),e.appendChild(this.nodes.icon),e.appendChild(d.make("div",P.CSS.title,{innerHTML:t.title||""})),t.secondaryLabel&&e.appendChild(d.make("div",P.CSS.secondaryTitle,{textContent:t.secondaryLabel})),t.isActive&&e.classList.add(P.CSS.active),t.isDisabled&&e.classList.add(P.CSS.disabled),e}enableConfirmationMode(t){const e={...this.params,...t,confirmation:t.confirmation},o=this.make(e);this.nodes.root.innerHTML=o.innerHTML,this.nodes.root.classList.add(P.CSS.confirmationState),this.confirmationState=t,this.enableSpecialHoverAndFocusBehavior()}disableConfirmationMode(){const t=this.make(this.params);this.nodes.root.innerHTML=t.innerHTML,this.nodes.root.classList.remove(P.CSS.confirmationState),this.confirmationState=null,this.disableSpecialHoverAndFocusBehavior()}enableSpecialHoverAndFocusBehavior(){this.nodes.root.classList.add(P.CSS.noHover),this.nodes.root.classList.add(P.CSS.noFocus),this.nodes.root.addEventListener("mouseleave",this.removeSpecialHoverBehavior,{once:!0})}disableSpecialHoverAndFocusBehavior(){this.removeSpecialFocusBehavior(),this.removeSpecialHoverBehavior(),this.nodes.root.removeEventListener("mouseleave",this.removeSpecialHoverBehavior)}activateOrEnableConfirmationMode(t){if(t.confirmation===void 0)try{t.onActivate(t),this.disableConfirmationMode()}catch{this.animateError()}else this.enableConfirmationMode(t.confirmation)}animateError(){this.nodes.icon.classList.contains(P.CSS.wobbleAnimation)||(this.nodes.icon.classList.add(P.CSS.wobbleAnimation),this.nodes.icon.addEventListener("animationend",this.onErrorAnimationEnd))}}const ht=class{constructor(s,t){this.cursor=-1,this.items=[],this.items=s||[],this.focusedCssClass=t}get currentItem(){return this.cursor===-1?null:this.items[this.cursor]}setCursor(s){s<this.items.length&&s>=-1&&(this.dropCursor(),this.cursor=s,this.items[this.cursor].classList.add(this.focusedCssClass))}setItems(s){this.items=s}next(){this.cursor=this.leafNodesAndReturnIndex(ht.directions.RIGHT)}previous(){this.cursor=this.leafNodesAndReturnIndex(ht.directions.LEFT)}dropCursor(){this.cursor!==-1&&(this.items[this.cursor].classList.remove(this.focusedCssClass),this.cursor=-1)}leafNodesAndReturnIndex(s){if(this.items.length===0)return this.cursor;let t=this.cursor;return t===-1?t=s===ht.directions.RIGHT?-1:0:this.items[t].classList.remove(this.focusedCssClass),s===ht.directions.RIGHT?t=(t+1)%this.items.length:t=(this.items.length+t-1)%this.items.length,d.canSetCaret(this.items[t])&&rt(()=>b.setCursor(this.items[t]),50)(),this.items[t].classList.add(this.focusedCssClass),t}};let nt=ht;nt.directions={RIGHT:"right",LEFT:"left"};class G{constructor(t){this.iterator=null,this.activated=!1,this.flipCallbacks=[],this.onKeyDown=e=>{if(this.isEventReadyForHandling(e))switch(G.usedKeys.includes(e.keyCode)&&e.preventDefault(),e.keyCode){case E.TAB:this.handleTabPress(e);break;case E.LEFT:case E.UP:this.flipLeft();break;case E.RIGHT:case E.DOWN:this.flipRight();break;case E.ENTER:this.handleEnterPress(e);break}},this.iterator=new nt(t.items,t.focusedItemClass),this.activateCallback=t.activateCallback,this.allowedKeys=t.allowedKeys||G.usedKeys}get isActivated(){return this.activated}static get usedKeys(){return[E.TAB,E.LEFT,E.RIGHT,E.ENTER,E.UP,E.DOWN]}activate(t,e){this.activated=!0,t&&this.iterator.setItems(t),e!==void 0&&this.iterator.setCursor(e),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(t){this.flipCallbacks.push(t)}removeOnFlip(t){this.flipCallbacks=this.flipCallbacks.filter(e=>e!==t)}dropCursor(){this.iterator.dropCursor()}isEventReadyForHandling(t){return this.activated&&this.allowedKeys.includes(t.keyCode)}handleTabPress(t){switch(t.shiftKey?nt.directions.LEFT:nt.directions.RIGHT){case nt.directions.RIGHT:this.flipRight();break;case nt.directions.LEFT:this.flipLeft();break}}handleEnterPress(t){this.activated&&(this.iterator.currentItem&&(t.stopPropagation(),t.preventDefault(),this.iterator.currentItem.click()),R(this.activateCallback)&&this.activateCallback(this.iterator.currentItem))}flipCallback(){this.iterator.currentItem&&this.iterator.currentItem.scrollIntoViewIfNeeded(),this.flipCallbacks.forEach(t=>t())}}class ut{static get CSS(){return{wrapper:"cdx-search-field",icon:"cdx-search-field__icon",input:"cdx-search-field__input"}}constructor({items:t,onSearch:e,placeholder:o}){this.listeners=new Pt,this.items=t,this.onSearch=e,this.render(o)}getElement(){return this.wrapper}focus(){this.input.focus()}clear(){this.input.value="",this.searchQuery="",this.onSearch("",this.foundItems)}destroy(){this.listeners.removeAll()}render(t){this.wrapper=d.make("div",ut.CSS.wrapper);const e=d.make("div",ut.CSS.icon,{innerHTML:Uo});this.input=d.make("input",ut.CSS.input,{placeholder:t}),this.wrapper.appendChild(e),this.wrapper.appendChild(this.input),this.listeners.on(this.input,"input",()=>{this.searchQuery=this.input.value,this.onSearch(this.searchQuery,this.foundItems)})}get foundItems(){return this.items.filter(t=>this.checkItem(t))}checkItem(t){var e;const o=((e=t.title)==null?void 0:e.toLowerCase())||"",i=this.searchQuery.toLowerCase();return o.includes(i)}}const pt=class{lock(){Qt?this.lockHard():document.body.classList.add(pt.CSS.scrollLocked)}unlock(){Qt?this.unlockHard():document.body.classList.remove(pt.CSS.scrollLocked)}lockHard(){this.scrollPosition=window.pageYOffset,document.documentElement.style.setProperty("--window-scroll-offset",`${this.scrollPosition}px`),document.body.classList.add(pt.CSS.scrollLockedHard)}unlockHard(){document.body.classList.remove(pt.CSS.scrollLockedHard),this.scrollPosition!==null&&window.scrollTo(0,this.scrollPosition),this.scrollPosition=null}};let be=pt;be.CSS={scrollLocked:"ce-scroll-locked",scrollLockedHard:"ce-scroll-locked--hard"};var Yo=Object.defineProperty,Ko=Object.getOwnPropertyDescriptor,Xo=(s,t,e,o)=>{for(var i=o>1?void 0:o?Ko(t,e):t,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(o?r(t,e,i):r(i))||i);return o&&i&&Yo(t,e,i),i},gt=(s=>(s.Close="close",s))(gt||{});const j=class extends wt{constructor(s){super(),this.scopeElement=document.body,this.listeners=new Pt,this.scrollLocker=new be,this.nodes={wrapper:null,popover:null,nothingFoundMessage:null,customContent:null,items:null,overlay:null},this.messages={nothingFound:"Nothing found",search:"Search"},this.onFlip=()=>{this.items.find(t=>t.isFocused).onFocus()},this.items=s.items.map(t=>new P(t)),s.scopeElement!==void 0&&(this.scopeElement=s.scopeElement),s.messages&&(this.messages={...this.messages,...s.messages}),s.customContentFlippableItems&&(this.customContentFlippableItems=s.customContentFlippableItems),this.make(),s.customContent&&this.addCustomContent(s.customContent),s.searchable&&this.addSearch(),this.initializeFlipper()}static get CSS(){return{popover:"ce-popover",popoverOpenTop:"ce-popover--open-top",popoverOpened:"ce-popover--opened",search:"ce-popover__search",nothingFoundMessage:"ce-popover__nothing-found-message",nothingFoundMessageDisplayed:"ce-popover__nothing-found-message--displayed",customContent:"ce-popover__custom-content",customContentHidden:"ce-popover__custom-content--hidden",items:"ce-popover__items",overlay:"ce-popover__overlay",overlayHidden:"ce-popover__overlay--hidden"}}getElement(){return this.nodes.wrapper}hasFocus(){return this.flipper.hasFocus()}show(){this.shouldOpenBottom||(this.nodes.popover.style.setProperty("--popover-height",this.height+"px"),this.nodes.popover.classList.add(j.CSS.popoverOpenTop)),this.nodes.overlay.classList.remove(j.CSS.overlayHidden),this.nodes.popover.classList.add(j.CSS.popoverOpened),this.flipper.activate(this.flippableElements),this.search!==void 0&&setTimeout(()=>{this.search.focus()},100),et()&&this.scrollLocker.lock()}hide(){this.nodes.popover.classList.remove(j.CSS.popoverOpened),this.nodes.popover.classList.remove(j.CSS.popoverOpenTop),this.nodes.overlay.classList.add(j.CSS.overlayHidden),this.flipper.deactivate(),this.items.forEach(s=>s.reset()),this.search!==void 0&&this.search.clear(),et()&&this.scrollLocker.unlock(),this.emit("close")}destroy(){this.flipper.deactivate(),this.listeners.removeAll(),et()&&this.scrollLocker.unlock()}make(){this.nodes.popover=d.make("div",[j.CSS.popover]),this.nodes.nothingFoundMessage=d.make("div",[j.CSS.nothingFoundMessage],{textContent:this.messages.nothingFound}),this.nodes.popover.appendChild(this.nodes.nothingFoundMessage),this.nodes.items=d.make("div",[j.CSS.items]),this.items.forEach(s=>{this.nodes.items.appendChild(s.getElement())}),this.nodes.popover.appendChild(this.nodes.items),this.listeners.on(this.nodes.popover,"click",s=>{const t=this.getTargetItem(s);t!==void 0&&this.handleItemClick(t)}),this.nodes.wrapper=d.make("div"),this.nodes.overlay=d.make("div",[j.CSS.overlay,j.CSS.overlayHidden]),this.listeners.on(this.nodes.overlay,"click",()=>{this.hide()}),this.nodes.wrapper.appendChild(this.nodes.overlay),this.nodes.wrapper.appendChild(this.nodes.popover)}addSearch(){this.search=new ut({items:this.items,placeholder:this.messages.search,onSearch:(t,e)=>{this.items.forEach(i=>{const n=!e.includes(i);i.toggleHidden(n)}),this.toggleNothingFoundMessage(e.length===0),this.toggleCustomContent(t!=="");const o=t===""?this.flippableElements:e.map(i=>i.getElement());this.flipper.isActivated&&(this.flipper.deactivate(),this.flipper.activate(o))}});const s=this.search.getElement();s.classList.add(j.CSS.search),this.nodes.popover.insertBefore(s,this.nodes.popover.firstChild)}addCustomContent(s){this.nodes.customContent=s,this.nodes.customContent.classList.add(j.CSS.customContent),this.nodes.popover.insertBefore(s,this.nodes.popover.firstChild)}getTargetItem(s){return this.items.find(t=>s.composedPath().includes(t.getElement()))}handleItemClick(s){s.isDisabled||(this.items.filter(t=>t!==s).forEach(t=>t.reset()),s.handleClick(),this.toggleItemActivenessIfNeeded(s),s.closeOnActivate&&this.hide())}initializeFlipper(){this.flipper=new G({items:this.flippableElements,focusedItemClass:P.CSS.focused,allowedKeys:[E.TAB,E.UP,E.DOWN,E.ENTER]}),this.flipper.onFlip(this.onFlip)}get flippableElements(){const s=this.items.map(t=>t.getElement());return(this.customContentFlippableItems||[]).concat(s)}get height(){let s=0;if(this.nodes.popover===null)return s;const t=this.nodes.popover.cloneNode(!0);return t.style.visibility="hidden",t.style.position="absolute",t.style.top="-1000px",t.classList.add(j.CSS.popoverOpened),document.body.appendChild(t),s=t.offsetHeight,t.remove(),s}get shouldOpenBottom(){const s=this.nodes.popover.getBoundingClientRect(),t=this.scopeElement.getBoundingClientRect(),e=this.height,o=s.top+e,i=s.top-e,n=Math.min(window.innerHeight,t.bottom);return i<t.top||o<=n}toggleNothingFoundMessage(s){this.nodes.nothingFoundMessage.classList.toggle(j.CSS.nothingFoundMessageDisplayed,s)}toggleCustomContent(s){var t;(t=this.nodes.customContent)==null||t.classList.toggle(j.CSS.customContentHidden,s)}toggleItemActivenessIfNeeded(s){if(s.toggle===!0&&s.toggleActive(),typeof s.toggle=="string"){const t=this.items.filter(e=>e.toggle===s.toggle);if(t.length===1){s.toggleActive();return}t.forEach(e=>{e.toggleActive(e===s)})}}};let zt=j;Xo([ct],zt.prototype,"height",1);class Vo extends T{constructor(){super(...arguments),this.opened=!1,this.selection=new b,this.onPopoverClose=()=>{this.close()}}get events(){return{opened:"block-settings-opened",closed:"block-settings-closed"}}get CSS(){return{settings:"ce-settings"}}get flipper(){var t;return(t=this.popover)==null?void 0:t.flipper}make(){this.nodes.wrapper=d.make("div",[this.CSS.settings])}destroy(){this.removeAllNodes()}open(t=this.Editor.BlockManager.currentBlock){this.opened=!0,this.selection.save(),t.selected=!0,this.Editor.BlockSelection.clearCache();const[e,o]=t.getTunes();this.eventsDispatcher.emit(this.events.opened),this.popover=new zt({searchable:!0,items:e.map(i=>this.resolveTuneAliases(i)),customContent:o,customContentFlippableItems:this.getControls(o),scopeElement:this.Editor.API.methods.ui.nodes.redactor,messages:{nothingFound:$.ui(X.ui.popover,"Nothing found"),search:$.ui(X.ui.popover,"Filter")}}),this.popover.on(gt.Close,this.onPopoverClose),this.nodes.wrapper.append(this.popover.getElement()),this.popover.show()}getElement(){return this.nodes.wrapper}close(){this.opened=!1,b.isAtEditor||this.selection.restore(),this.selection.clearSaved(),!this.Editor.CrossBlockSelection.isCrossBlockSelectionStarted&&this.Editor.BlockManager.currentBlock&&(this.Editor.BlockManager.currentBlock.selected=!1),this.eventsDispatcher.emit(this.events.closed),this.popover&&(this.popover.off(gt.Close,this.onPopoverClose),this.popover.destroy(),this.popover.getElement().remove(),this.popover=null)}getControls(t){const{StylesAPI:e}=this.Editor,o=t.querySelectorAll(`.${e.classes.settingsButton}, ${d.allInputsSelector}`);return Array.from(o)}resolveTuneAliases(t){const e=No(t,{label:"title"});return t.confirmation&&(e.confirmation=this.resolveTuneAliases(t.confirmation)),e}}class Y extends T{constructor(){super(...arguments),this.opened=!1,this.tools=[],this.flipper=null,this.togglingCallback=null}static get CSS(){return{conversionToolbarWrapper:"ce-conversion-toolbar",conversionToolbarShowed:"ce-conversion-toolbar--showed",conversionToolbarTools:"ce-conversion-toolbar__tools",conversionToolbarLabel:"ce-conversion-toolbar__label",conversionTool:"ce-conversion-tool",conversionToolHidden:"ce-conversion-tool--hidden",conversionToolIcon:"ce-conversion-tool__icon",conversionToolSecondaryLabel:"ce-conversion-tool__secondary-label",conversionToolFocused:"ce-conversion-tool--focused",conversionToolActive:"ce-conversion-tool--active"}}make(){this.nodes.wrapper=d.make("div",[Y.CSS.conversionToolbarWrapper,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.tools=d.make("div",Y.CSS.conversionToolbarTools);const t=d.make("div",Y.CSS.conversionToolbarLabel,{textContent:$.ui(X.ui.inlineToolbar.converter,"Convert to")});return this.addTools(),this.enableFlipper(),d.append(this.nodes.wrapper,t),d.append(this.nodes.wrapper,this.nodes.tools),this.nodes.wrapper}destroy(){this.flipper&&(this.flipper.deactivate(),this.flipper=null),this.removeAllNodes()}toggle(t){this.opened?this.close():this.open(),R(t)&&(this.togglingCallback=t)}open(){this.filterTools(),this.opened=!0,this.nodes.wrapper.classList.add(Y.CSS.conversionToolbarShowed),window.requestAnimationFrame(()=>{this.flipper.activate(this.tools.map(t=>t.button).filter(t=>!t.classList.contains(Y.CSS.conversionToolHidden))),this.flipper.focusFirst(),R(this.togglingCallback)&&this.togglingCallback(!0)})}close(){this.opened=!1,this.flipper.deactivate(),this.nodes.wrapper.classList.remove(Y.CSS.conversionToolbarShowed),R(this.togglingCallback)&&this.togglingCallback(!1)}hasTools(){return this.tools.length===1?this.tools[0].name!==this.config.defaultBlock:!0}async replaceWithBlock(t,e){const{BlockManager:o,BlockSelection:i,InlineToolbar:n,Caret:r}=this.Editor;o.convert(this.Editor.BlockManager.currentBlock,t,e),i.clearSelection(),this.close(),n.close(),window.requestAnimationFrame(()=>{r.setToBlock(this.Editor.BlockManager.currentBlock,r.positions.END)})}addTools(){const t=this.Editor.Tools.blockTools;Array.from(t.entries()).forEach(([e,o])=>{var i;const n=o.conversionConfig;!n||!n.import||(i=o.toolbox)==null||i.forEach(r=>this.addToolIfValid(e,r))})}addToolIfValid(t,e){V(e)||!e.icon||this.addTool(t,e)}addTool(t,e){var o;const i=d.make("div",[Y.CSS.conversionTool]),n=d.make("div",[Y.CSS.conversionToolIcon]);i.dataset.tool=t,n.innerHTML=e.icon,d.append(i,n),d.append(i,d.text($.t(X.toolNames,e.title||at(t))));const r=(o=this.Editor.Tools.blockTools.get(t))==null?void 0:o.shortcut;if(r){const a=d.make("span",Y.CSS.conversionToolSecondaryLabel,{innerText:Rt(r)});d.append(i,a)}d.append(this.nodes.tools,i),this.tools.push({name:t,button:i,toolboxItem:e}),this.listeners.on(i,"click",async()=>{await this.replaceWithBlock(t,e.data)})}async filterTools(){const{currentBlock:t}=this.Editor.BlockManager,e=await t.getActiveToolboxEntry();function o(i,n){return i.icon===n.icon&&i.title===n.title}this.tools.forEach(i=>{let n=!1;if(e){const r=o(e,i.toolboxItem);n=i.button.dataset.tool===t.name&&r}i.button.hidden=n,i.button.classList.toggle(Y.CSS.conversionToolHidden,n)})}enableFlipper(){this.flipper=new G({focusedItemClass:Y.CSS.conversionToolFocused})}}var Nt={},qo={get exports(){return Nt},set exports(s){Nt=s}};/*!
|
||
* Library for handling keyboard shortcuts
|
||
* @copyright CodeX (https://codex.so)
|
||
* @license MIT
|
||
* @author CodeX (https://codex.so)
|
||
* @version 1.2.0
|
||
*/(function(s,t){(function(e,o){s.exports=o()})(window,function(){return function(e){var o={};function i(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=o,i.d=function(n,r,a){i.o(n,r)||Object.defineProperty(n,r,{enumerable:!0,get:a})},i.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,r){if(1&r&&(n=i(n)),8&r||4&r&&typeof n=="object"&&n&&n.__esModule)return n;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:n}),2&r&&typeof n!="string")for(var l in n)i.d(a,l,(function(c){return n[c]}).bind(null,l));return a},i.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(r,"a",r),r},i.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},i.p="",i(i.s=0)}([function(e,o,i){function n(l,c){for(var p=0;p<c.length;p++){var h=c[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}function r(l,c,p){return c&&n(l.prototype,c),p&&n(l,p),l}i.r(o);var a=function(){function l(c){var p=this;(function(h,f){if(!(h instanceof f))throw new TypeError("Cannot call a class as a function")})(this,l),this.commands={},this.keys={},this.name=c.name,this.parseShortcutName(c.name),this.element=c.on,this.callback=c.callback,this.executeShortcut=function(h){p.execute(h)},this.element.addEventListener("keydown",this.executeShortcut,!1)}return r(l,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}}}]),r(l,[{key:"parseShortcutName",value:function(c){c=c.split("+");for(var p=0;p<c.length;p++){c[p]=c[p].toUpperCase();var h=!1;for(var f in l.supportedCommands)if(l.supportedCommands[f].includes(c[p])){h=this.commands[f]=!0;break}h||(this.keys[c[p]]=!0)}for(var k in l.supportedCommands)this.commands[k]||(this.commands[k]=!1)}},{key:"execute",value:function(c){var p,h={CMD:c.ctrlKey||c.metaKey,SHIFT:c.shiftKey,ALT:c.altKey},f=!0;for(p in this.commands)this.commands[p]!==h[p]&&(f=!1);var k,u=!0;for(k in this.keys)u=u&&c.keyCode===l.keyCodes[k];f&&u&&this.callback(c)}},{key:"remove",value:function(){this.element.removeEventListener("keydown",this.executeShortcut)}}]),l}();o.default=a}]).default})})(qo);const Zo=xt(Nt);class Go{constructor(){this.registeredShortcuts=new Map}add(t){if(this.findShortcut(t.on,t.name))throw Error(`Shortcut ${t.name} is already registered for ${t.on}. Please remove it before add a new handler.`);const e=new Zo({name:t.name,on:t.on,callback:t.handler}),o=this.registeredShortcuts.get(t.on)||[];this.registeredShortcuts.set(t.on,[...o,e])}remove(t,e){const o=this.findShortcut(t,e);if(!o)return;o.remove();const i=this.registeredShortcuts.get(t);this.registeredShortcuts.set(t,i.filter(n=>n!==o))}findShortcut(t,e){return(this.registeredShortcuts.get(t)||[]).find(({name:o})=>o===e)}}const lt=new Go;var Jo=Object.defineProperty,Qo=Object.getOwnPropertyDescriptor,ke=(s,t,e,o)=>{for(var i=o>1?void 0:o?Qo(t,e):t,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(o?r(t,e,i):r(i))||i);return o&&i&&Jo(t,e,i),i},bt=(s=>(s.Opened="toolbox-opened",s.Closed="toolbox-closed",s.BlockAdded="toolbox-block-added",s))(bt||{});const ve=class extends wt{constructor({api:s,tools:t,i18nLabels:e}){super(),this.opened=!1,this.nodes={toolbox:null},this.onPopoverClose=()=>{this.opened=!1,this.emit("toolbox-closed")},this.api=s,this.tools=t,this.i18nLabels=e}get isEmpty(){return this.toolsToBeDisplayed.length===0}static get CSS(){return{toolbox:"ce-toolbox"}}make(){return this.popover=new zt({scopeElement:this.api.ui.nodes.redactor,searchable:!0,messages:{nothingFound:this.i18nLabels.nothingFound,search:this.i18nLabels.filter},items:this.toolboxItemsToBeDisplayed}),this.popover.on(gt.Close,this.onPopoverClose),this.enableShortcuts(),this.nodes.toolbox=this.popover.getElement(),this.nodes.toolbox.classList.add(ve.CSS.toolbox),this.nodes.toolbox}hasFocus(){var s;return(s=this.popover)==null?void 0:s.hasFocus()}destroy(){var s;super.destroy(),this.nodes&&this.nodes.toolbox&&(this.nodes.toolbox.remove(),this.nodes.toolbox=null),this.removeAllShortcuts(),(s=this.popover)==null||s.off(gt.Close,this.onPopoverClose)}toolButtonActivated(s,t){this.insertNewBlock(s,t)}open(){var s;this.isEmpty||((s=this.popover)==null||s.show(),this.opened=!0,this.emit("toolbox-opened"))}close(){var s;(s=this.popover)==null||s.hide(),this.opened=!1,this.emit("toolbox-closed")}toggle(){this.opened?this.close():this.open()}get toolsToBeDisplayed(){const s=[];return this.tools.forEach(t=>{t.toolbox&&s.push(t)}),s}get toolboxItemsToBeDisplayed(){const s=(t,e)=>({icon:t.icon,title:$.t(X.toolNames,t.title||at(e.name)),name:e.name,onActivate:()=>{this.toolButtonActivated(e.name,t.data)},secondaryLabel:e.shortcut?Rt(e.shortcut):""});return this.toolsToBeDisplayed.reduce((t,e)=>(Array.isArray(e.toolbox)?e.toolbox.forEach(o=>{t.push(s(o,e))}):e.toolbox!==void 0&&t.push(s(e.toolbox,e)),t),[])}enableShortcuts(){this.toolsToBeDisplayed.forEach(s=>{const t=s.shortcut;t&&this.enableShortcutForTool(s.name,t)})}enableShortcutForTool(s,t){lt.add({name:t,on:this.api.ui.nodes.redactor,handler:e=>{e.preventDefault();const o=this.api.blocks.getCurrentBlockIndex(),i=this.api.blocks.getBlockByIndex(o);if(i)try{this.api.blocks.convert(i.id,s),window.requestAnimationFrame(()=>{this.api.caret.setToBlock(o,"end")});return}catch{}this.insertNewBlock(s)}})}removeAllShortcuts(){this.toolsToBeDisplayed.forEach(s=>{const t=s.shortcut;t&<.remove(this.api.ui.nodes.redactor,t)})}async insertNewBlock(s,t){const e=this.api.blocks.getCurrentBlockIndex(),o=this.api.blocks.getBlockByIndex(e);if(!o)return;const i=o.isEmpty?e:e+1;let n;if(t){const a=await this.api.blocks.composeBlockData(s);n=Object.assign(a,t)}const r=this.api.blocks.insert(s,n,void 0,i,void 0,o.isEmpty);r.call(q.APPEND_CALLBACK),this.api.caret.setToBlock(i),this.emit("toolbox-block-added",{block:r}),this.api.toolbar.close()}};let Ut=ve;ke([ct],Ut.prototype,"toolsToBeDisplayed",1);ke([ct],Ut.prototype,"toolboxItemsToBeDisplayed",1);const xe="block hovered";class ti extends T{constructor({config:t,eventsDispatcher:e}){super({config:t,eventsDispatcher:e}),this.toolboxInstance=null,this.tooltip=new jt}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 t;return{opened:(t=this.toolboxInstance)==null?void 0:t.opened,close:()=>{var e;(e=this.toolboxInstance)==null||e.close()},open:()=>{if(this.toolboxInstance===null){_("toolbox.open() called before initialization is finished","warn");return}this.Editor.BlockManager.currentBlock=this.hoveredBlock,this.toolboxInstance.open()},toggle:()=>{if(this.toolboxInstance===null){_("toolbox.toggle() called before initialization is finished","warn");return}this.toolboxInstance.toggle()},hasFocus:()=>{var e;return(e=this.toolboxInstance)==null?void 0:e.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(t){t?(this.destroy(),this.Editor.BlockSettings.destroy(),this.disableModuleBindings()):window.requestIdleCallback(()=>{this.drawUI(),this.enableModuleBindings()},{timeout:2e3})}moveAndOpen(t=this.Editor.BlockManager.currentBlock){if(this.toolboxInstance===null){_("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(),!t)return;this.hoveredBlock=t;const e=t.holder,{isMobile:o}=this.Editor.UI,i=t.pluginsContent,n=window.getComputedStyle(i),r=parseInt(n.paddingTop,10),a=e.offsetHeight;let l;o?l=e.offsetTop+a:l=e.offsetTop+r,this.nodes.wrapper.style.top=`${Math.floor(l)}px`,this.Editor.BlockManager.blocks.length===1&&t.isEmpty?this.blockTunesToggler.hide():this.blockTunesToggler.show(),this.open()}close(){var t;this.Editor.ReadOnly.isEnabled||(this.nodes.wrapper.classList.remove(this.CSS.toolbarOpened),this.blockActions.hide(),(t=this.toolboxInstance)==null||t.close(),this.Editor.BlockSettings.close())}open(t=!0){rt(()=>{this.nodes.wrapper.classList.add(this.CSS.toolbarOpened),t?this.blockActions.show():this.blockActions.hide()},50)()}make(){this.nodes.wrapper=d.make("div",this.CSS.toolbar),["content","actions"].forEach(e=>{this.nodes[e]=d.make("div",this.CSS[e])}),d.append(this.nodes.wrapper,this.nodes.content),d.append(this.nodes.content,this.nodes.actions),this.nodes.plusButton=d.make("div",this.CSS.plusButton,{innerHTML:zo}),d.append(this.nodes.actions,this.nodes.plusButton),this.readOnlyMutableListeners.on(this.nodes.plusButton,"click",()=>{this.tooltip.hide(!0),this.plusButtonClicked()},!1);const t=d.make("div");t.appendChild(document.createTextNode($.ui(X.ui.toolbar.toolbox,"Add"))),t.appendChild(d.make("div",this.CSS.plusButtonShortcut,{textContent:"⇥ Tab"})),this.tooltip.onHover(this.nodes.plusButton,t,{hidingDelay:400}),this.nodes.settingsToggler=d.make("span",this.CSS.settingsToggler,{innerHTML:jo}),d.append(this.nodes.actions,this.nodes.settingsToggler),this.tooltip.onHover(this.nodes.settingsToggler,$.ui(X.ui.blockTunes.toggler,"Click to tune"),{hidingDelay:400}),d.append(this.nodes.actions,this.makeToolbox()),d.append(this.nodes.actions,this.Editor.BlockSettings.getElement()),d.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper)}makeToolbox(){return this.toolboxInstance=new Ut({api:this.Editor.API.methods,tools:this.Editor.Tools.blockTools,i18nLabels:{filter:$.ui(X.ui.popover,"Filter"),nothingFound:$.ui(X.ui.popover,"Nothing found")}}),this.toolboxInstance.on(bt.Opened,()=>{this.Editor.UI.nodes.wrapper.classList.add(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(bt.Closed,()=>{this.Editor.UI.nodes.wrapper.classList.remove(this.CSS.openedToolboxHolderModifier)}),this.toolboxInstance.on(bt.BlockAdded,({block:t})=>{const{BlockManager:e,Caret:o}=this.Editor,i=e.getBlockById(t.id);i.inputs.length===0&&(i===e.lastBlock?(e.insertAtEnd(),o.setToBlock(e.lastBlock)):o.setToBlock(e.nextBlock))}),this.toolboxInstance.make()}plusButtonClicked(){var t;this.Editor.BlockManager.currentBlock=this.hoveredBlock,(t=this.toolboxInstance)==null||t.toggle()}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.settingsToggler,"mousedown",t=>{var e;t.stopPropagation(),this.settingsTogglerClicked(),(e=this.toolboxInstance)!=null&&e.opened&&this.toolboxInstance.close(),this.tooltip.hide(!0)},!0),et()||this.eventsDispatcher.on(xe,t=>{var e;this.Editor.BlockSettings.opened||(e=this.toolboxInstance)!=null&&e.opened||this.moveAndOpen(t.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(),this.tooltip.destroy()}}var yt=(s=>(s[s.Block=0]="Block",s[s.Inline=1]="Inline",s[s.Tune=2]="Tune",s))(yt||{}),kt=(s=>(s.Shortcut="shortcut",s.Toolbox="toolbox",s.EnabledInlineTools="inlineToolbar",s.EnabledBlockTunes="tunes",s.Config="config",s))(kt||{}),we=(s=>(s.Shortcut="shortcut",s.SanitizeConfig="sanitize",s))(we||{}),st=(s=>(s.IsEnabledLineBreaks="enableLineBreaks",s.Toolbox="toolbox",s.ConversionConfig="conversionConfig",s.IsReadOnlySupported="isReadOnlySupported",s.PasteConfig="pasteConfig",s))(st||{}),$t=(s=>(s.IsInline="isInline",s.Title="title",s))($t||{}),ye=(s=>(s.IsTune="isTune",s))(ye||{});class Wt{constructor({name:t,constructable:e,config:o,api:i,isDefault:n,isInternal:r=!1,defaultPlaceholder:a}){this.api=i,this.name=t,this.constructable=e,this.config=o,this.isDefault=n,this.isInternal=r,this.defaultPlaceholder=a}get settings(){const t=this.config.config||{};return this.isDefault&&!("placeholder"in t)&&this.defaultPlaceholder&&(t.placeholder=this.defaultPlaceholder),t}reset(){if(R(this.constructable.reset))return this.constructable.reset()}prepare(){if(R(this.constructable.prepare))return this.constructable.prepare({toolName:this.name,config:this.settings})}get shortcut(){const t=this.constructable.shortcut;return this.config.shortcut||t}get sanitizeConfig(){return this.constructable.sanitize||{}}isInline(){return this.type===1}isBlock(){return this.type===0}isTune(){return this.type===2}}class ei extends T{constructor({config:t,eventsDispatcher:e}){super({config:t,eventsDispatcher:e}),this.CSS={inlineToolbar:"ce-inline-toolbar",inlineToolbarShowed:"ce-inline-toolbar--showed",inlineToolbarLeftOriented:"ce-inline-toolbar--left-oriented",inlineToolbarRightOriented:"ce-inline-toolbar--right-oriented",inlineToolbarShortcut:"ce-inline-toolbar__shortcut",buttonsWrapper:"ce-inline-toolbar__buttons",actionsWrapper:"ce-inline-toolbar__actions",inlineToolButton:"ce-inline-tool",inputField:"cdx-input",focusedButton:"ce-inline-tool--focused",conversionToggler:"ce-inline-toolbar__dropdown",conversionTogglerArrow:"ce-inline-toolbar__dropdown-arrow",conversionTogglerHidden:"ce-inline-toolbar__dropdown--hidden",conversionTogglerContent:"ce-inline-toolbar__dropdown-content",togglerAndButtonsWrapper:"ce-inline-toolbar__toggler-and-button-wrapper"},this.opened=!1,this.toolbarVerticalMargin=et()?20:6,this.buttonsList=null,this.width=0,this.flipper=null,this.tooltip=new jt}toggleReadOnly(t){t?(this.destroy(),this.Editor.ConversionToolbar.destroy()):window.requestIdleCallback(()=>{this.make()},{timeout:2e3})}tryToShow(t=!1,e=!0){if(!this.allowedToShow()){t&&this.close();return}this.move(),this.open(e),this.Editor.Toolbar.close()}move(){const t=b.rect,e=this.Editor.UI.nodes.wrapper.getBoundingClientRect(),o={x:t.x-e.left,y:t.y+t.height-e.top+this.toolbarVerticalMargin};t.width&&(o.x+=Math.floor(t.width/2));const i=o.x-this.width/2,n=o.x+this.width/2;this.nodes.wrapper.classList.toggle(this.CSS.inlineToolbarLeftOriented,i<this.Editor.UI.contentRect.left),this.nodes.wrapper.classList.toggle(this.CSS.inlineToolbarRightOriented,n>this.Editor.UI.contentRect.right),this.nodes.wrapper.style.left=Math.floor(o.x)+"px",this.nodes.wrapper.style.top=Math.floor(o.y)+"px"}close(){this.opened&&(this.Editor.ReadOnly.isEnabled||(this.nodes.wrapper.classList.remove(this.CSS.inlineToolbarShowed),Array.from(this.toolsInstances.entries()).forEach(([t,e])=>{const o=this.getToolShortcut(t);o&<.remove(this.Editor.UI.nodes.redactor,o),R(e.clear)&&e.clear()}),this.opened=!1,this.flipper.deactivate(),this.Editor.ConversionToolbar.close()))}open(t=!0){if(this.opened)return;this.addToolsFiltered(),this.nodes.wrapper.classList.add(this.CSS.inlineToolbarShowed),this.buttonsList=this.nodes.buttons.querySelectorAll(`.${this.CSS.inlineToolButton}`),this.opened=!0,t&&this.Editor.ConversionToolbar.hasTools()?this.setConversionTogglerContent():this.nodes.conversionToggler.hidden=!0;let e=Array.from(this.buttonsList);e.unshift(this.nodes.conversionToggler),e=e.filter(o=>!o.hidden),this.flipper.activate(e)}containsNode(t){return this.nodes.wrapper.contains(t)}destroy(){this.flipper&&(this.flipper.deactivate(),this.flipper=null),this.removeAllNodes(),this.tooltip.destroy()}make(){this.nodes.wrapper=d.make("div",[this.CSS.inlineToolbar,...this.isRtl?[this.Editor.UI.CSS.editorRtlFix]:[]]),this.nodes.togglerAndButtonsWrapper=d.make("div",this.CSS.togglerAndButtonsWrapper),this.nodes.buttons=d.make("div",this.CSS.buttonsWrapper),this.nodes.actions=d.make("div",this.CSS.actionsWrapper),this.listeners.on(this.nodes.wrapper,"mousedown",t=>{t.target.closest(`.${this.CSS.actionsWrapper}`)||t.preventDefault()}),d.append(this.nodes.wrapper,[this.nodes.togglerAndButtonsWrapper,this.nodes.actions]),d.append(this.Editor.UI.nodes.wrapper,this.nodes.wrapper),this.addConversionToggler(),d.append(this.nodes.togglerAndButtonsWrapper,this.nodes.buttons),this.prepareConversionToolbar(),window.requestAnimationFrame(()=>{this.recalculateWidth()}),this.enableFlipper()}allowedToShow(){const t=["IMG","INPUT"],e=b.get(),o=b.text;if(!e||!e.anchorNode||e.isCollapsed||o.length<1)return!1;const i=d.isElement(e.anchorNode)?e.anchorNode:e.anchorNode.parentElement;if(e&&t.includes(i.tagName)||i.closest('[contenteditable="true"]')===null)return!1;const n=this.Editor.BlockManager.getBlock(e.anchorNode);return n?n.tool.inlineTools.size!==0:!1}recalculateWidth(){this.width=this.nodes.wrapper.offsetWidth}addConversionToggler(){this.nodes.conversionToggler=d.make("div",this.CSS.conversionToggler),this.nodes.conversionTogglerContent=d.make("div",this.CSS.conversionTogglerContent);const t=d.make("div",this.CSS.conversionTogglerArrow,{innerHTML:me});this.nodes.conversionToggler.appendChild(this.nodes.conversionTogglerContent),this.nodes.conversionToggler.appendChild(t),this.nodes.togglerAndButtonsWrapper.appendChild(this.nodes.conversionToggler),this.listeners.on(this.nodes.conversionToggler,"click",()=>{this.Editor.ConversionToolbar.toggle(e=>{!e&&this.opened?this.flipper.activate():this.opened&&this.flipper.deactivate()})}),et()===!1&&this.tooltip.onHover(this.nodes.conversionToggler,$.ui(X.ui.inlineToolbar.converter,"Convert to"),{placement:"top",hidingDelay:100})}async setConversionTogglerContent(){const{BlockManager:t}=this.Editor,{currentBlock:e}=t,o=e.name,i=e.tool.conversionConfig,n=i&&i.export;this.nodes.conversionToggler.hidden=!n,this.nodes.conversionToggler.classList.toggle(this.CSS.conversionTogglerHidden,!n);const r=await e.getActiveToolboxEntry()||{};this.nodes.conversionTogglerContent.innerHTML=r.icon||r.title||at(o)}prepareConversionToolbar(){const t=this.Editor.ConversionToolbar.make();d.append(this.nodes.wrapper,t)}addToolsFiltered(){const t=b.get(),e=this.Editor.BlockManager.getBlock(t.anchorNode);this.nodes.buttons.innerHTML="",this.nodes.actions.innerHTML="",this.toolsInstances=new Map,Array.from(e.tool.inlineTools.values()).forEach(o=>{this.addTool(o)}),this.recalculateWidth()}addTool(t){const e=t.create(),o=e.render();if(!o){_("Render method must return an instance of Node","warn",t.name);return}if(o.dataset.tool=t.name,this.nodes.buttons.appendChild(o),this.toolsInstances.set(t.name,e),R(e.renderActions)){const a=e.renderActions();this.nodes.actions.appendChild(a)}this.listeners.on(o,"click",a=>{this.toolClicked(e),a.preventDefault()});const i=this.getToolShortcut(t.name);if(i)try{this.enableShortcuts(e,i)}catch{}const n=d.make("div"),r=$.t(X.toolNames,t.title||at(t.name));n.appendChild(d.text(r)),i&&n.appendChild(d.make("div",this.CSS.inlineToolbarShortcut,{textContent:Rt(i)})),et()===!1&&this.tooltip.onHover(o,n,{placement:"top",hidingDelay:100}),e.checkState(b.get())}getToolShortcut(t){const{Tools:e}=this.Editor,o=e.inlineTools.get(t),i=e.internal.inlineTools;return Array.from(i.keys()).includes(t)?this.inlineTools[t][we.Shortcut]:o.shortcut}enableShortcuts(t,e){lt.add({name:e,handler:o=>{const{currentBlock:i}=this.Editor.BlockManager;i&&i.tool.enabledInlineTools&&(o.preventDefault(),this.toolClicked(t))},on:this.Editor.UI.nodes.redactor})}toolClicked(t){const e=b.range;t.surround(e),this.checkToolsState(),t.renderActions!==void 0&&this.flipper.deactivate()}checkToolsState(){this.toolsInstances.forEach(t=>{t.checkState(b.get())})}get inlineTools(){const t={};return Array.from(this.Editor.Tools.inlineTools.entries()).forEach(([e,o])=>{t[e]=o.create()}),t}enableFlipper(){this.flipper=new G({focusedItemClass:this.CSS.focusedButton,allowedKeys:[E.ENTER,E.TAB]})}}class oi extends T{keydown(t){switch(this.beforeKeydownProcessing(t),t.keyCode){case E.BACKSPACE:this.backspace(t);break;case E.DELETE:this.delete(t);break;case E.ENTER:this.enter(t);break;case E.DOWN:case E.RIGHT:this.arrowRightAndDown(t);break;case E.UP:case E.LEFT:this.arrowLeftAndUp(t);break;case E.TAB:this.tabPressed(t);break}}beforeKeydownProcessing(t){this.needToolbarClosing(t)&&re(t.keyCode)&&(this.Editor.Toolbar.close(),this.Editor.ConversionToolbar.close(),t.ctrlKey||t.metaKey||t.altKey||t.shiftKey||(this.Editor.BlockManager.clearFocused(),this.Editor.BlockSelection.clearSelection(t)))}keyup(t){t.shiftKey||this.Editor.UI.checkEmptiness()}tabPressed(t){this.Editor.BlockSelection.clearSelection(t);const{BlockManager:e,InlineToolbar:o,ConversionToolbar:i}=this.Editor,n=e.currentBlock;if(!n)return;const r=n.isEmpty,a=n.tool.isDefault&&r,l=!r&&i.opened,c=!r&&!b.isCollapsed&&o.opened;a?this.activateToolbox():!l&&!c&&this.activateBlockSettings()}dragOver(t){const e=this.Editor.BlockManager.getBlockByChildNode(t.target);e.dropTarget=!0}dragLeave(t){const e=this.Editor.BlockManager.getBlockByChildNode(t.target);e.dropTarget=!1}handleCommandC(t){const{BlockSelection:e}=this.Editor;e.anyBlockSelected&&e.copySelectedBlocks(t)}handleCommandX(t){const{BlockSelection:e,BlockManager:o,Caret:i}=this.Editor;e.anyBlockSelected&&e.copySelectedBlocks(t).then(()=>{const n=o.removeSelectedBlocks(),r=o.insertDefaultBlockAtIndex(n,!0);i.setToBlock(r,i.positions.START),e.clearSelection(t)})}enter(t){const{BlockManager:e,UI:o}=this.Editor;if(e.currentBlock.tool.isLineBreaksEnabled||o.someToolbarOpened&&o.someFlipperButtonFocused||t.shiftKey)return;let i=this.Editor.BlockManager.currentBlock;this.Editor.Caret.isAtStart&&!this.Editor.BlockManager.currentBlock.hasMedia?this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex):this.Editor.Caret.isAtEnd?i=this.Editor.BlockManager.insertDefaultBlockAtIndex(this.Editor.BlockManager.currentBlockIndex+1):i=this.Editor.BlockManager.split(),this.Editor.Caret.setToBlock(i),this.Editor.Toolbar.moveAndOpen(i),t.preventDefault()}backspace(t){const{BlockManager:e,Caret:o}=this.Editor,{currentBlock:i,previousBlock:n}=e;if(!(!b.isCollapsed||!o.isAtStart)){if(t.preventDefault(),this.Editor.Toolbar.close(),i.currentInput!==i.firstInput){o.navigatePrevious();return}if(n!==null){if(n.isEmpty){e.removeBlock(n);return}if(i.isEmpty){e.removeBlock(i);const r=e.currentBlock;o.setToBlock(r,o.positions.END);return}te(i,n)?this.mergeBlocks(n,i):o.setToBlock(n,o.positions.END)}}}delete(t){const{BlockManager:e,Caret:o}=this.Editor,{currentBlock:i,nextBlock:n}=e;if(!(!b.isCollapsed||!o.isAtEnd)){if(t.preventDefault(),this.Editor.Toolbar.close(),i.currentInput!==i.lastInput){o.navigateNext();return}if(n!==null){if(n.isEmpty){e.removeBlock(n);return}if(i.isEmpty){e.removeBlock(i),o.setToBlock(n,o.positions.START);return}te(i,n)?this.mergeBlocks(i,n):o.setToBlock(n,o.positions.START)}}}mergeBlocks(t,e){const{BlockManager:o,Caret:i,Toolbar:n}=this.Editor;i.createShadow(t.pluginsContent),o.mergeBlocks(t,e).then(()=>{window.requestAnimationFrame(()=>{i.restoreCaret(t.pluginsContent),t.pluginsContent.normalize(),n.close()})})}arrowRightAndDown(t){const e=G.usedKeys.includes(t.keyCode)&&(!t.shiftKey||t.keyCode===E.TAB);if(this.Editor.UI.someToolbarOpened&&e)return;this.Editor.BlockManager.clearFocused(),this.Editor.Toolbar.close();const o=this.Editor.Caret.isAtEnd||this.Editor.BlockSelection.anyBlockSelected;if(t.shiftKey&&t.keyCode===E.DOWN&&o){this.Editor.CrossBlockSelection.toggleBlockSelectedState();return}(t.keyCode===E.DOWN||t.keyCode===E.RIGHT&&!this.isRtl?this.Editor.Caret.navigateNext():this.Editor.Caret.navigatePrevious())?t.preventDefault():rt(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(t)}arrowLeftAndUp(t){if(this.Editor.UI.someToolbarOpened){if(G.usedKeys.includes(t.keyCode)&&(!t.shiftKey||t.keyCode===E.TAB))return;this.Editor.UI.closeAllToolbars()}this.Editor.BlockManager.clearFocused(),this.Editor.Toolbar.close();const e=this.Editor.Caret.isAtStart||this.Editor.BlockSelection.anyBlockSelected;if(t.shiftKey&&t.keyCode===E.UP&&e){this.Editor.CrossBlockSelection.toggleBlockSelectedState(!1);return}(t.keyCode===E.UP||t.keyCode===E.LEFT&&!this.isRtl?this.Editor.Caret.navigatePrevious():this.Editor.Caret.navigateNext())?t.preventDefault():rt(()=>{this.Editor.BlockManager.currentBlock&&this.Editor.BlockManager.currentBlock.updateCurrentInput()},20)(),this.Editor.BlockSelection.clearSelection(t)}needToolbarClosing(t){const e=t.keyCode===E.ENTER&&this.Editor.Toolbar.toolbox.opened,o=t.keyCode===E.ENTER&&this.Editor.BlockSettings.opened,i=t.keyCode===E.ENTER&&this.Editor.InlineToolbar.opened,n=t.keyCode===E.ENTER&&this.Editor.ConversionToolbar.opened,r=t.keyCode===E.TAB;return!(t.shiftKey||r||e||o||i||n)}activateToolbox(){this.Editor.Toolbar.opened||this.Editor.Toolbar.moveAndOpen(),this.Editor.Toolbar.toolbox.open()}activateBlockSettings(){this.Editor.Toolbar.opened||(this.Editor.BlockManager.currentBlock.focused=!0,this.Editor.Toolbar.moveAndOpen()),this.Editor.BlockSettings.opened||this.Editor.BlockSettings.open()}}class Bt{constructor(t){this.blocks=[],this.workingArea=t}get length(){return this.blocks.length}get array(){return this.blocks}get nodes(){return ae(this.workingArea.children)}static set(t,e,o){return isNaN(Number(e))?(Reflect.set(t,e,o),!0):(t.insert(+e,o),!0)}static get(t,e){return isNaN(Number(e))?Reflect.get(t,e):t.get(+e)}push(t){this.blocks.push(t),this.insertToDOM(t)}swap(t,e){const o=this.blocks[e];d.swap(this.blocks[t].holder,o.holder),this.blocks[e]=this.blocks[t],this.blocks[t]=o}move(t,e){const o=this.blocks.splice(e,1)[0],i=t-1,n=Math.max(0,i),r=this.blocks[n];t>0?this.insertToDOM(o,"afterend",r):this.insertToDOM(o,"beforebegin",r),this.blocks.splice(t,0,o);const a=this.composeBlockEvent("move",{fromIndex:e,toIndex:t});o.call(q.MOVED,a)}insert(t,e,o=!1){if(!this.length){this.push(e);return}t>this.length&&(t=this.length),o&&(this.blocks[t].holder.remove(),this.blocks[t].call(q.REMOVED));const i=o?1:0;if(this.blocks.splice(t,i,e),t>0){const n=this.blocks[t-1];this.insertToDOM(e,"afterend",n)}else{const n=this.blocks[t+1];n?this.insertToDOM(e,"beforebegin",n):this.insertToDOM(e)}}replace(t,e){if(this.blocks[t]===void 0)throw Error("Incorrect index");this.blocks[t].holder.replaceWith(e.holder),this.blocks[t]=e}insertMany(t,e){const o=new DocumentFragment;for(const i of t)o.appendChild(i.holder);if(this.length>0){if(e>0){const i=Math.min(e-1,this.length-1);this.blocks[i].holder.after(o)}else e===0&&this.workingArea.prepend(o);this.blocks.splice(e,0,...t)}else this.blocks.push(...t),this.workingArea.appendChild(o);t.forEach(i=>i.call(q.RENDERED))}remove(t){isNaN(t)&&(t=this.length-1),this.blocks[t].holder.remove(),this.blocks[t].call(q.REMOVED),this.blocks.splice(t,1)}removeAll(){this.workingArea.innerHTML="",this.blocks.forEach(t=>t.call(q.REMOVED)),this.blocks.length=0}insertAfter(t,e){const o=this.blocks.indexOf(t);this.insert(o+1,e)}get(t){return this.blocks[t]}indexOf(t){return this.blocks.indexOf(t)}insertToDOM(t,e,o){e?o.holder.insertAdjacentElement(e,t.holder):this.workingArea.appendChild(t.holder),t.call(q.RENDERED)}composeBlockEvent(t,e){return new CustomEvent(t,{detail:e})}}const oe="block-removed",ie="block-added",ii="block-moved",ne="block-changed";class ni{constructor(){this.completed=Promise.resolve()}add(t){return new Promise((e,o)=>{this.completed=this.completed.then(t).then(e).catch(o)})}}class si extends T{constructor(){super(...arguments),this._currentBlockIndex=-1,this._blocks=null}get currentBlockIndex(){return this._currentBlockIndex}set currentBlockIndex(t){this._currentBlockIndex=t}get firstBlock(){return this._blocks[0]}get lastBlock(){return this._blocks[this._blocks.length-1]}get currentBlock(){return this._blocks[this.currentBlockIndex]}set currentBlock(t){this.currentBlockIndex=this.getBlockIndex(t)}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(t=>!!t.inputs.length)}get previousContentfulBlock(){return this.blocks.slice(0,this.currentBlockIndex).reverse().find(t=>!!t.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(t=>t.isEmpty)}prepare(){const t=new Bt(this.Editor.UI.nodes.redactor);this._blocks=new Proxy(t,{set:Bt.set,get:Bt.get}),this.listeners.on(document,"copy",e=>this.Editor.BlockEvents.handleCommandC(e))}toggleReadOnly(t){t?this.disableModuleBindings():this.enableModuleBindings()}composeBlock({tool:t,data:e={},id:o=void 0,tunes:i={}}){const n=this.Editor.ReadOnly.isEnabled,r=this.Editor.Tools.blockTools.get(t),a=new F({id:o,data:e,tool:r,api:this.Editor.API,readOnly:n,tunesData:i},this.eventsDispatcher);return n||window.requestIdleCallback(()=>{this.bindBlockEvents(a)},{timeout:2e3}),a}insert({id:t=void 0,tool:e=this.config.defaultBlock,data:o={},index:i,needToFocus:n=!0,replace:r=!1,tunes:a={}}={}){let l=i;l===void 0&&(l=this.currentBlockIndex+(r?0:1));const c=this.composeBlock({id:t,tool:e,data:o,tunes:a});return r&&this.blockDidMutated(oe,this.getBlockByIndex(l),{index:l}),this._blocks.insert(l,c,r),this.blockDidMutated(ie,c,{index:l}),n?this.currentBlockIndex=l:l<=this.currentBlockIndex&&this.currentBlockIndex++,c}insertMany(t,e=0){this._blocks.insertMany(t,e)}async update(t,e){const o=await t.data,i=this.composeBlock({id:t.id,tool:t.name,data:Object.assign({},o,e),tunes:t.tunes}),n=this.getBlockIndex(t);return this._blocks.replace(n,i),this.blockDidMutated(ne,i,{index:n}),i}replace(t,e,o){const i=this.getBlockIndex(t);this.insert({tool:e,data:o,index:i,replace:!0})}paste(t,e,o=!1){const i=this.insert({tool:t,replace:o});try{i.call(q.ON_PASTE,e)}catch(n){_(`${t}: onPaste callback call is failed`,"error",n)}return i}insertDefaultBlockAtIndex(t,e=!1){const o=this.composeBlock({tool:this.config.defaultBlock});return this._blocks[t]=o,this.blockDidMutated(ie,o,{index:t}),e?this.currentBlockIndex=t:t<=this.currentBlockIndex&&this.currentBlockIndex++,o}insertAtEnd(){return this.currentBlockIndex=this.blocks.length-1,this.insert()}async mergeBlocks(t,e){const o=await e.data;V(o)||await t.mergeWith(o),this.removeBlock(e),this.currentBlockIndex=this._blocks.indexOf(t)}removeBlock(t,e=!0){return new Promise(o=>{const i=this._blocks.indexOf(t);if(!this.validateIndex(i))throw new Error("Can't find a Block to remove");t.destroy(),this._blocks.remove(i),this.blockDidMutated(oe,t,{index:i}),this.currentBlockIndex>=i&&this.currentBlockIndex--,this.blocks.length?i===0&&(this.currentBlockIndex=0):(this.currentBlockIndex=-1,e&&this.insert()),o()})}removeSelectedBlocks(){let t;for(let e=this.blocks.length-1;e>=0;e--)this.blocks[e].selected&&(this.removeBlock(this.blocks[e]),t=e);return t}removeAllBlocks(){for(let t=this.blocks.length-1;t>=0;t--)this._blocks.remove(t);this.currentBlockIndex=-1,this.insert(),this.currentBlock.firstInput.focus()}split(){const t=this.Editor.Caret.extractFragmentFromCaretPosition(),e=d.make("div");e.appendChild(t);const o={text:d.isEmpty(e)?"":e.innerHTML};return this.insert({data:o})}getBlockByIndex(t){return t===-1&&(t=this._blocks.length-1),this._blocks[t]}getBlockIndex(t){return this._blocks.indexOf(t)}getBlockById(t){return this._blocks.array.find(e=>e.id===t)}getBlock(t){d.isElement(t)||(t=t.parentNode);const e=this._blocks.nodes,o=t.closest(`.${F.CSS.wrapper}`),i=e.indexOf(o);if(i>=0)return this._blocks[i]}highlightCurrentNode(){this.clearFocused(),this.currentBlock.focused=!0}clearFocused(){this.blocks.forEach(t=>{t.focused=!1})}setCurrentBlockByChildNode(t){d.isElement(t)||(t=t.parentNode);const e=t.closest(`.${F.CSS.wrapper}`);if(!e)return;const o=e.closest(`.${this.Editor.UI.CSS.editorWrapper}`);if(o!=null&&o.isEqualNode(this.Editor.UI.nodes.wrapper))return this.currentBlockIndex=this._blocks.nodes.indexOf(e),this.currentBlock.updateCurrentInput(),this.currentBlock}getBlockByChildNode(t){d.isElement(t)||(t=t.parentNode);const e=t.closest(`.${F.CSS.wrapper}`);return this.blocks.find(o=>o.holder===e)}swap(t,e){this._blocks.swap(t,e),this.currentBlockIndex=e}move(t,e=this.currentBlockIndex){if(isNaN(t)||isNaN(e)){_("Warning during 'move' call: incorrect indices provided.","warn");return}if(!this.validateIndex(t)||!this.validateIndex(e)){_("Warning during 'move' call: indices cannot be lower than 0 or greater than the amount of blocks.","warn");return}this._blocks.move(t,e),this.currentBlockIndex=t,this.blockDidMutated(ii,this.currentBlock,{fromIndex:e,toIndex:t})}async convert(t,e,o){if(!await t.save())throw new Error("Could not convert Block. Failed to extract original Block data.");const i=this.Editor.Tools.blockTools.get(e);if(!i)throw new Error(`Could not convert Block. Tool «${e}» not found.`);const n=await t.exportDataAsString(),r=Z(n,i.sanitizeConfig);let a=ro(r,i.conversionConfig);o&&(a=Object.assign(a,o)),this.replace(t,i.name,a)}dropPointer(){this.currentBlockIndex=-1,this.clearFocused()}async clear(t=!1){const e=new ni;this.blocks.forEach(o=>{e.add(async()=>{await this.removeBlock(o,!1)})}),await e.completed,this.dropPointer(),t&&this.insert(),this.Editor.UI.checkEmptiness()}async destroy(){await Promise.all(this.blocks.map(t=>t.destroy()))}bindBlockEvents(t){const{BlockEvents:e}=this.Editor;this.readOnlyMutableListeners.on(t.holder,"keydown",o=>{e.keydown(o)}),this.readOnlyMutableListeners.on(t.holder,"keyup",o=>{e.keyup(o)}),this.readOnlyMutableListeners.on(t.holder,"dragover",o=>{e.dragOver(o)}),this.readOnlyMutableListeners.on(t.holder,"dragleave",o=>{e.dragLeave(o)}),t.on("didMutated",o=>this.blockDidMutated(ne,o,{index:this.getBlockIndex(o)}))}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}enableModuleBindings(){this.readOnlyMutableListeners.on(document,"cut",t=>this.Editor.BlockEvents.handleCommandX(t)),this.blocks.forEach(t=>{this.bindBlockEvents(t)})}validateIndex(t){return!(t<0||t>=this._blocks.length)}blockDidMutated(t,e,o){const i=new CustomEvent(t,{detail:{target:new tt(e),...o}});return this.eventsDispatcher.emit(he,{event:i}),e}}class ri extends T{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:t}=this.Editor;return t.blocks.every(e=>e.selected===!0)}set allBlocksSelected(t){const{BlockManager:e}=this.Editor;e.blocks.forEach(o=>{o.selected=t}),this.clearCache()}get anyBlockSelected(){const{BlockManager:t}=this.Editor;return this.anyBlockSelectedCache===null&&(this.anyBlockSelectedCache=t.blocks.some(e=>e.selected===!0)),this.anyBlockSelectedCache}get selectedBlocks(){return this.Editor.BlockManager.blocks.filter(t=>t.selected)}prepare(){this.selection=new b,lt.add({name:"CMD+A",handler:t=>{const{BlockManager:e,ReadOnly:o}=this.Editor;if(o.isEnabled){t.preventDefault(),this.selectAllBlocks();return}e.currentBlock&&this.handleCommandA(t)},on:this.Editor.UI.nodes.redactor})}toggleReadOnly(){b.get().removeAllRanges(),this.allBlocksSelected=!1}unSelectBlockByIndex(t){const{BlockManager:e}=this.Editor;let o;isNaN(t)?o=e.currentBlock:o=e.getBlockByIndex(t),o.selected=!1,this.clearCache()}clearSelection(t,e=!1){const{BlockManager:o,Caret:i,RectangleSelection:n}=this.Editor;this.needToSelectAll=!1,this.nativeInputSelected=!1,this.readyToBlockSelection=!1;const r=t&&t instanceof KeyboardEvent,a=r&&re(t.keyCode);if(this.anyBlockSelected&&r&&a&&!b.isSelectionExists){const l=o.removeSelectedBlocks();o.insertDefaultBlockAtIndex(l,!0),i.setToBlock(o.currentBlock),rt(()=>{const c=t.key;i.insertContentAtCaretPosition(c.length>1?"":c)},20)()}if(this.Editor.CrossBlockSelection.clear(t),!this.anyBlockSelected||n.isRectActivated()){this.Editor.RectangleSelection.clearSelection();return}e&&this.selection.restore(),this.allBlocksSelected=!1}copySelectedBlocks(t){t.preventDefault();const e=d.make("div");this.selectedBlocks.forEach(n=>{const r=Z(n.holder.innerHTML,this.sanitizerConfig),a=d.make("p");a.innerHTML=r,e.appendChild(a)});const o=Array.from(e.childNodes).map(n=>n.textContent).join(`
|
||
|
||
`),i=e.innerHTML;return t.clipboardData.setData("text/plain",o),t.clipboardData.setData("text/html",i),Promise.all(this.selectedBlocks.map(n=>n.save())).then(n=>{try{t.clipboardData.setData(this.Editor.Paste.MIME_TYPE,JSON.stringify(n))}catch{}})}selectBlockByIndex(t){const{BlockManager:e}=this.Editor;e.clearFocused();let o;isNaN(t)?o=e.currentBlock:o=e.getBlockByIndex(t),this.selection.save(),b.get().removeAllRanges(),o.selected=!0,this.clearCache(),this.Editor.InlineToolbar.close()}clearCache(){this.anyBlockSelectedCache=null}destroy(){lt.remove(this.Editor.UI.nodes.redactor,"CMD+A")}handleCommandA(t){if(this.Editor.RectangleSelection.clearSelection(),d.isNativeInput(t.target)&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}const e=this.Editor.BlockManager.getBlock(t.target).inputs;if(e.length>1&&!this.readyToBlockSelection){this.readyToBlockSelection=!0;return}if(e.length===1&&!this.needToSelectAll){this.needToSelectAll=!0;return}this.needToSelectAll?(t.preventDefault(),this.selectAllBlocks(),this.needToSelectAll=!1,this.readyToBlockSelection=!1,this.Editor.ConversionToolbar.close()):this.readyToBlockSelection&&(t.preventDefault(),this.selectBlockByIndex(),this.needToSelectAll=!0)}selectAllBlocks(){this.selection.save(),b.get().removeAllRanges(),this.allBlocksSelected=!0,this.Editor.InlineToolbar.close()}}class vt extends T{get positions(){return{START:"start",END:"end",DEFAULT:"default"}}static get CSS(){return{shadowCaret:"cdx-shadow-caret"}}get isAtStart(){const t=b.get(),e=d.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput);let o=t.focusNode;if(d.isNativeInput(e))return e.selectionEnd===0;if(!t.anchorNode)return!1;let i=o.textContent.search(/\S/);i===-1&&(i=0);let n=t.focusOffset;return o.nodeType!==Node.TEXT_NODE&&o.childNodes.length&&(o.childNodes[n]?(o=o.childNodes[n],n=0):(o=o.childNodes[n-1],n=o.textContent.length)),(d.isLineBreakTag(e)||d.isEmpty(e))&&this.getHigherLevelSiblings(o,"left").every(r=>{const a=d.isLineBreakTag(r),l=r.children.length===1&&d.isLineBreakTag(r.children[0]),c=a||l;return d.isEmpty(r)&&!c})&&n===i?!0:e===null||o===e&&n<=i}get isAtEnd(){const t=b.get();let e=t.focusNode;const o=d.getDeepestNode(this.Editor.BlockManager.currentBlock.currentInput,!0);if(d.isNativeInput(o))return o.selectionEnd===o.value.length;if(!t.focusNode)return!1;let i=t.focusOffset;if(e.nodeType!==Node.TEXT_NODE&&e.childNodes.length&&(e.childNodes[i-1]?(e=e.childNodes[i-1],i=e.textContent.length):(e=e.childNodes[0],i=0)),d.isLineBreakTag(o)||d.isEmpty(o)){const r=this.getHigherLevelSiblings(e,"right");if(r.every((a,l)=>l===r.length-1&&d.isLineBreakTag(a)||d.isEmpty(a)&&!d.isLineBreakTag(a))&&i===e.textContent.length)return!0}const n=o.textContent.replace(/\s+$/,"");return e===o&&i>=n.length}setToBlock(t,e=this.positions.DEFAULT,o=0){const{BlockManager:i}=this.Editor;let n;switch(e){case this.positions.START:n=t.firstInput;break;case this.positions.END:n=t.lastInput;break;default:n=t.currentInput}if(!n)return;const r=d.getDeepestNode(n,e===this.positions.END),a=d.getContentLength(r);switch(!0){case e===this.positions.START:o=0;break;case e===this.positions.END:case o>a:o=a;break}rt(()=>{this.set(r,o)},20)(),i.setCurrentBlockByChildNode(t.holder),i.currentBlock.currentInput=n}setToInput(t,e=this.positions.DEFAULT,o=0){const{currentBlock:i}=this.Editor.BlockManager,n=d.getDeepestNode(t);switch(e){case this.positions.START:this.set(n,0);break;case this.positions.END:this.set(n,d.getContentLength(n));break;default:o&&this.set(n,o)}i.currentInput=t}set(t,e=0){const{top:o,bottom:i}=b.setCursor(t,e),{innerHeight:n}=window;o<0&&window.scrollBy(0,o),i>n&&window.scrollBy(0,i-n)}setToTheLastBlock(){const t=this.Editor.BlockManager.lastBlock;if(t)if(t.tool.isDefault&&t.isEmpty)this.setToBlock(t);else{const e=this.Editor.BlockManager.insertAtEnd();this.setToBlock(e)}}extractFragmentFromCaretPosition(){const t=b.get();if(t.rangeCount){const e=t.getRangeAt(0),o=this.Editor.BlockManager.currentBlock.currentInput;if(e.deleteContents(),o)if(d.isNativeInput(o)){const i=o,n=document.createDocumentFragment(),r=i.value.substring(0,i.selectionStart),a=i.value.substring(i.selectionStart);return n.textContent=a,i.value=r,n}else{const i=e.cloneRange();return i.selectNodeContents(o),i.setStart(e.endContainer,e.endOffset),i.extractContents()}}}navigateNext(){const{BlockManager:t}=this.Editor,{currentBlock:e,nextContentfulBlock:o}=t,{nextInput:i}=e,n=this.isAtEnd;let r=o;if(!r&&!i){if(e.tool.isDefault||!n)return!1;r=t.insertAtEnd()}return n?(i?this.setToInput(i,this.positions.START):this.setToBlock(r,this.positions.START),!0):!1}navigatePrevious(){const{currentBlock:t,previousContentfulBlock:e}=this.Editor.BlockManager;if(!t)return!1;const{previousInput:o}=t;return!e&&!o?!1:this.isAtStart?(o?this.setToInput(o,this.positions.END):this.setToBlock(e,this.positions.END),!0):!1}createShadow(t){const e=document.createElement("span");e.classList.add(vt.CSS.shadowCaret),t.insertAdjacentElement("beforeend",e)}restoreCaret(t){const e=t.querySelector(`.${vt.CSS.shadowCaret}`);if(!e)return;new b().expandToTag(e);const o=document.createRange();o.selectNode(e),o.extractContents()}insertContentAtCaretPosition(t){const e=document.createDocumentFragment(),o=document.createElement("div"),i=b.get(),n=b.range;o.innerHTML=t,Array.from(o.childNodes).forEach(c=>e.appendChild(c)),e.childNodes.length===0&&e.appendChild(new Text);const r=e.lastChild;n.deleteContents(),n.insertNode(e);const a=document.createRange(),l=r.nodeType===Node.TEXT_NODE?r:r.firstChild;l!==null&&l.textContent!==null&&a.setStart(l,l.textContent.length),i.removeAllRanges(),i.addRange(a)}getHigherLevelSiblings(t,e){let o=t;const i=[];for(;o.parentNode&&o.parentNode.contentEditable!=="true";)o=o.parentNode;const n=e==="left"?"previousSibling":"nextSibling";for(;o[n];)o=o[n],i.push(o);return i}}class ai extends T{constructor(){super(...arguments),this.onMouseUp=()=>{this.listeners.off(document,"mouseover",this.onMouseOver),this.listeners.off(document,"mouseup",this.onMouseUp)},this.onMouseOver=t=>{const{BlockManager:e,BlockSelection:o}=this.Editor,i=e.getBlockByChildNode(t.relatedTarget)||this.lastSelectedBlock,n=e.getBlockByChildNode(t.target);if(!(!i||!n)&&n!==i){if(i===this.firstSelectedBlock){b.get().removeAllRanges(),i.selected=!0,n.selected=!0,o.clearCache();return}if(n===this.firstSelectedBlock){i.selected=!1,n.selected=!1,o.clearCache();return}this.Editor.InlineToolbar.close(),this.toggleBlocksSelectedState(i,n),this.lastSelectedBlock=n}}}async prepare(){this.listeners.on(document,"mousedown",t=>{this.enableCrossBlockSelection(t)})}watchSelection(t){if(t.button!==ze.LEFT)return;const{BlockManager:e}=this.Editor;this.firstSelectedBlock=e.getBlock(t.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}toggleBlockSelectedState(t=!0){const{BlockManager:e,BlockSelection:o}=this.Editor;this.lastSelectedBlock||(this.lastSelectedBlock=this.firstSelectedBlock=e.currentBlock),this.firstSelectedBlock===this.lastSelectedBlock&&(this.firstSelectedBlock.selected=!0,o.clearCache(),b.get().removeAllRanges());const i=e.blocks.indexOf(this.lastSelectedBlock)+(t?1:-1),n=e.blocks[i];n&&(this.lastSelectedBlock.selected!==n.selected?(n.selected=!0,o.clearCache()):(this.lastSelectedBlock.selected=!1,o.clearCache()),this.lastSelectedBlock=n,this.Editor.InlineToolbar.close(),n.holder.scrollIntoView({block:"nearest"}))}clear(t){const{BlockManager:e,BlockSelection:o,Caret:i}=this.Editor,n=e.blocks.indexOf(this.firstSelectedBlock),r=e.blocks.indexOf(this.lastSelectedBlock);if(o.anyBlockSelected&&n>-1&&r>-1)if(t&&t instanceof KeyboardEvent)switch(t.keyCode){case E.DOWN:case E.RIGHT:i.setToBlock(e.blocks[Math.max(n,r)],i.positions.END);break;case E.UP:case E.LEFT:i.setToBlock(e.blocks[Math.min(n,r)],i.positions.START);break;default:i.setToBlock(e.blocks[Math.max(n,r)],i.positions.END)}else i.setToBlock(e.blocks[Math.max(n,r)],i.positions.END);this.firstSelectedBlock=this.lastSelectedBlock=null}enableCrossBlockSelection(t){const{UI:e}=this.Editor;b.isCollapsed||this.Editor.BlockSelection.clearSelection(t),e.nodes.redactor.contains(t.target)?this.watchSelection(t):this.Editor.BlockSelection.clearSelection(t)}toggleBlocksSelectedState(t,e){const{BlockManager:o,BlockSelection:i}=this.Editor,n=o.blocks.indexOf(t),r=o.blocks.indexOf(e),a=t.selected!==e.selected;for(let l=Math.min(n,r);l<=Math.max(n,r);l++){const c=o.blocks[l];c!==this.firstSelectedBlock&&c!==(a?t:e)&&(o.blocks[l].selected=!o.blocks[l].selected,i.clearCache())}}}class li extends T{constructor(){super(...arguments),this.isStartedAtEditor=!1}toggleReadOnly(t){t?this.disableModuleBindings():this.enableModuleBindings()}enableModuleBindings(){const{UI:t}=this.Editor;this.readOnlyMutableListeners.on(t.nodes.holder,"drop",async e=>{await this.processDrop(e)},!0),this.readOnlyMutableListeners.on(t.nodes.holder,"dragstart",()=>{this.processDragStart()}),this.readOnlyMutableListeners.on(t.nodes.holder,"dragover",e=>{this.processDragOver(e)},!0)}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}async processDrop(t){const{BlockManager:e,Caret:o,Paste:i}=this.Editor;t.preventDefault(),e.blocks.forEach(r=>{r.dropTarget=!1}),b.isAtEditor&&!b.isCollapsed&&this.isStartedAtEditor&&document.execCommand("delete"),this.isStartedAtEditor=!1;const n=e.setCurrentBlockByChildNode(t.target);if(n)this.Editor.Caret.setToBlock(n,o.positions.END);else{const r=e.setCurrentBlockByChildNode(e.lastBlock.holder);this.Editor.Caret.setToBlock(r,o.positions.END)}await i.processDataTransfer(t.dataTransfer,!0)}processDragStart(){b.isAtEditor&&!b.isCollapsed&&(this.isStartedAtEditor=!0),this.Editor.InlineToolbar.close()}processDragOver(t){t.preventDefault()}}class ci extends T{constructor({config:t,eventsDispatcher:e}){super({config:t,eventsDispatcher:e}),this.disabled=!1,this.batchingTimeout=null,this.batchingOnChangeQueue=new Map,this.batchTime=400,this.mutationObserver=new MutationObserver(o=>{this.redactorChanged(o)}),this.eventsDispatcher.on(he,o=>{this.particularBlockChanged(o.event)}),this.eventsDispatcher.on(pe,()=>{this.disable()}),this.eventsDispatcher.on(ue,()=>{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(t){this.disabled||!R(this.config.onChange)||(this.batchingOnChangeQueue.set(`block:${t.detail.target.id}:event:${t.type}`,t),this.batchingTimeout&&clearTimeout(this.batchingTimeout),this.batchingTimeout=setTimeout(()=>{let e;this.batchingOnChangeQueue.size===1?e=this.batchingOnChangeQueue.values().next().value:e=Array.from(this.batchingOnChangeQueue.values()),this.config.onChange&&this.config.onChange(this.Editor.API.methods,e),this.batchingOnChangeQueue.clear()},this.batchTime))}redactorChanged(t){this.eventsDispatcher.emit(_t,{mutations:t})}}const Ee=class extends T{constructor(){super(...arguments),this.MIME_TYPE="application/x-editor-js",this.toolsTags={},this.tagsByTool={},this.toolsPatterns=[],this.toolsFiles={},this.exceptionList=[],this.processTool=s=>{try{const t=s.create({},{},!1);if(s.pasteConfig===!1){this.exceptionList.push(s.name);return}if(!R(t.onPaste))return;this.getTagsConfig(s),this.getFilesConfig(s),this.getPatternsConfig(s)}catch(t){_(`Paste handling for «${s.name}» Tool hasn't been set up because of the error`,"warn",t)}},this.handlePasteEvent=async s=>{const{BlockManager:t,Toolbar:e}=this.Editor,o=t.setCurrentBlockByChildNode(s.target);!o||this.isNativeBehaviour(s.target)&&!s.clipboardData.types.includes("Files")||o&&this.exceptionList.includes(o.name)||(s.preventDefault(),this.processDataTransfer(s.clipboardData),t.clearFocused(),e.close())}}async prepare(){this.processTools()}toggleReadOnly(s){s?this.unsetCallback():this.setCallback()}async processDataTransfer(s,t=!1){const{Tools:e}=this.Editor,o=s.types;if((o.includes?o.includes("Files"):o.contains("Files"))&&!V(this.toolsFiles)){await this.processFiles(s.files);return}const i=s.getData(this.MIME_TYPE),n=s.getData("text/plain");let r=s.getData("text/html");if(i)try{this.insertEditorJSData(JSON.parse(i));return}catch{}t&&n.trim()&&r.trim()&&(r="<p>"+(r.trim()?r:n)+"</p>");const a=Object.keys(this.toolsTags).reduce((p,h)=>(p[h.toLowerCase()]=this.toolsTags[h].sanitizationConfig??{},p),{}),l=Object.assign({},a,e.getAllInlineToolsSanitizeConfig(),{br:{}}),c=Z(r,l);!c.trim()||c.trim()===n||!d.isHTMLString(c)?await this.processText(n):await this.processText(c,!0)}async processText(s,t=!1){const{Caret:e,BlockManager:o}=this.Editor,i=t?this.processHTML(s):this.processPlain(s);if(!i.length)return;if(i.length===1){i[0].isBlock?this.processSingleBlock(i.pop()):this.processInlinePaste(i.pop());return}const n=o.currentBlock&&o.currentBlock.tool.isDefault&&o.currentBlock.isEmpty;i.map(async(r,a)=>this.insertBlock(r,a===0&&n)),o.currentBlock&&e.setToBlock(o.currentBlock,e.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 s=this.Editor.Tools.blockTools;Array.from(s.values()).forEach(this.processTool)}collectTagNames(s){return J(s)?[s]:z(s)?Object.keys(s):[]}getTagsConfig(s){if(s.pasteConfig===!1)return;const t=s.pasteConfig.tags||[],e=[];t.forEach(o=>{const i=this.collectTagNames(o);e.push(...i),i.forEach(n=>{if(Object.prototype.hasOwnProperty.call(this.toolsTags,n)){_(`Paste handler for «${s.name}» Tool on «${n}» tag is skipped because it is already used by «${this.toolsTags[n].tool.name}» Tool.`,"warn");return}const r=z(o)?o[n]:null;this.toolsTags[n.toUpperCase()]={tool:s,sanitizationConfig:r}})}),this.tagsByTool[s.name]=e.map(o=>o.toUpperCase())}getFilesConfig(s){if(s.pasteConfig===!1)return;const{files:t={}}=s.pasteConfig;let{extensions:e,mimeTypes:o}=t;!e&&!o||(e&&!Array.isArray(e)&&(_(`«extensions» property of the onDrop config for «${s.name}» Tool should be an array`),e=[]),o&&!Array.isArray(o)&&(_(`«mimeTypes» property of the onDrop config for «${s.name}» Tool should be an array`),o=[]),o&&(o=o.filter(i=>Ke(i)?!0:(_(`MIME type value «${i}» for the «${s.name}» Tool is not a valid MIME type`,"warn"),!1))),this.toolsFiles[s.name]={extensions:e||[],mimeTypes:o||[]})}getPatternsConfig(s){s.pasteConfig===!1||!s.pasteConfig.patterns||V(s.pasteConfig.patterns)||Object.entries(s.pasteConfig.patterns).forEach(([t,e])=>{e instanceof RegExp||_(`Pattern ${e} for «${s.name}» Tool is skipped because it should be a Regexp instance.`,"warn"),this.toolsPatterns.push({key:t,pattern:e,tool:s})})}isNativeBehaviour(s){return d.isNativeInput(s)}async processFiles(s){const{BlockManager:t}=this.Editor;let e;e=await Promise.all(Array.from(s).map(i=>this.processFile(i))),e=e.filter(i=>!!i);const o=t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty;e.forEach((i,n)=>{t.paste(i.type,i.event,n===0&&o)})}async processFile(s){const t=Ye(s),e=Object.entries(this.toolsFiles).find(([i,{mimeTypes:n,extensions:r}])=>{const[a,l]=s.type.split("/"),c=r.find(h=>h.toLowerCase()===t.toLowerCase()),p=n.find(h=>{const[f,k]=h.split("/");return f===a&&(k===l||k==="*")});return!!c||!!p});if(!e)return;const[o]=e;return{event:this.composePasteEvent("file",{file:s}),type:o}}processHTML(s){const{Tools:t}=this.Editor,e=d.make("DIV");return e.innerHTML=s,this.getNodes(e).map(o=>{let i,n=t.defaultTool,r=!1;switch(o.nodeType){case Node.DOCUMENT_FRAGMENT_NODE:i=d.make("div"),i.appendChild(o);break;case Node.ELEMENT_NODE:i=o,r=!0,this.toolsTags[i.tagName]&&(n=this.toolsTags[i.tagName].tool);break}const{tags:a}=n.pasteConfig||{tags:[]},l=a.reduce((h,f)=>(this.collectTagNames(f).forEach(k=>{const u=z(f)?f[k]:null;h[k.toLowerCase()]=u||{}}),h),{}),c=Object.assign({},l,n.baseSanitizeConfig);if(i.tagName.toLowerCase()==="table"){const h=Z(i.outerHTML,c);i=d.make("div",void 0,{innerHTML:h}).firstChild}else i.innerHTML=Z(i.innerHTML,c);const p=this.composePasteEvent("tag",{data:i});return{content:i,isBlock:r,tool:n.name,event:p}}).filter(o=>{const i=d.isEmpty(o.content),n=d.isSingleTag(o.content);return!i||n})}processPlain(s){const{defaultBlock:t}=this.config;if(!s)return[];const e=t;return s.split(/\r?\n/).filter(o=>o.trim()).map(o=>{const i=d.make("div");i.textContent=o;const n=this.composePasteEvent("tag",{data:i});return{content:i,tool:e,isBlock:!1,event:n}})}async processSingleBlock(s){const{Caret:t,BlockManager:e}=this.Editor,{currentBlock:o}=e;if(!o||s.tool!==o.name||!d.containsOnlyInlineElements(s.content.innerHTML)){this.insertBlock(s,(o==null?void 0:o.tool.isDefault)&&o.isEmpty);return}t.insertContentAtCaretPosition(s.content.innerHTML)}async processInlinePaste(s){const{BlockManager:t,Caret:e}=this.Editor,{content:o}=s;if(t.currentBlock&&t.currentBlock.tool.isDefault&&o.textContent.length<Ee.PATTERN_PROCESSING_MAX_LENGTH){const i=await this.processPattern(o.textContent);if(i){const n=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty,r=t.paste(i.tool,i.event,n);e.setToBlock(r,e.positions.END);return}}if(t.currentBlock&&t.currentBlock.currentInput){const i=t.currentBlock.tool.baseSanitizeConfig;document.execCommand("insertHTML",!1,Z(o.innerHTML,i))}else this.insertBlock(s)}async processPattern(s){const t=this.toolsPatterns.find(e=>{const o=e.pattern.exec(s);return o?s===o.shift():!1});return t?{event:this.composePasteEvent("pattern",{key:t.key,data:s}),tool:t.tool.name}:void 0}insertBlock(s,t=!1){const{BlockManager:e,Caret:o}=this.Editor,{currentBlock:i}=e;let n;if(t&&i&&i.isEmpty){n=e.paste(s.tool,s.event,!0),o.setToBlock(n,o.positions.END);return}n=e.paste(s.tool,s.event),o.setToBlock(n,o.positions.END)}insertEditorJSData(s){const{BlockManager:t,Caret:e,Tools:o}=this.Editor;fe(s,i=>o.blockTools.get(i).sanitizeConfig).forEach(({tool:i,data:n},r)=>{let a=!1;r===0&&(a=t.currentBlock&&t.currentBlock.tool.isDefault&&t.currentBlock.isEmpty);const l=t.insert({tool:i,data:n,replace:a});e.setToBlock(l,e.positions.END)})}processElementNode(s,t,e){const o=Object.keys(this.toolsTags),i=s,{tool:n}=this.toolsTags[i.tagName]||{},r=this.tagsByTool[n==null?void 0:n.name]||[],a=o.includes(i.tagName),l=d.blockElements.includes(i.tagName.toLowerCase()),c=Array.from(i.children).some(({tagName:h})=>o.includes(h)&&!r.includes(h)),p=Array.from(i.children).some(({tagName:h})=>d.blockElements.includes(h.toLowerCase()));if(!l&&!a&&!c)return e.appendChild(i),[...t,e];if(a&&!c||l&&!p&&!c)return[...t,e,i]}getNodes(s){const t=Array.from(s.childNodes);let e;const o=(i,n)=>{if(d.isEmpty(n)&&!d.isSingleTag(n))return i;const r=i[i.length-1];let a=new DocumentFragment;switch(r&&d.isFragment(r)&&(a=i.pop()),n.nodeType){case Node.ELEMENT_NODE:if(e=this.processElementNode(n,i,a),e)return e;break;case Node.TEXT_NODE:return a.appendChild(n),[...i,a];default:return[...i,a]}return[...i,...Array.from(n.childNodes).reduce(o,[])]};return t.reduce(o,[])}composePasteEvent(s,t){return new CustomEvent(s,{detail:t})}};let Ce=Ee;Ce.PATTERN_PROCESSING_MAX_LENGTH=450;class di extends T{constructor(){super(...arguments),this.toolsDontSupportReadOnly=[],this.readOnlyEnabled=!1}get isEnabled(){return this.readOnlyEnabled}async prepare(){const{Tools:t}=this.Editor,{blockTools:e}=t,o=[];Array.from(e.entries()).forEach(([i,n])=>{n.isReadOnlySupported||o.push(i)}),this.toolsDontSupportReadOnly=o,this.config.readOnly&&o.length>0&&this.throwCriticalError(),this.toggle(this.config.readOnly)}async toggle(t=!this.readOnlyEnabled){t&&this.toolsDontSupportReadOnly.length>0&&this.throwCriticalError();const e=this.readOnlyEnabled;this.readOnlyEnabled=t;for(const i in this.Editor)this.Editor[i].toggleReadOnly&&this.Editor[i].toggleReadOnly(t);if(e===t)return this.readOnlyEnabled;const o=await this.Editor.Saver.save();return await this.Editor.BlockManager.clear(),await this.Editor.Renderer.render(o.blocks),this.readOnlyEnabled}throwCriticalError(){throw new de(`To enable read-only mode all connected tools should support it. Tools ${this.toolsDontSupportReadOnly.join(", ")} don't support read-only mode.`)}}class ft extends T{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(t,e){const o=document.elementFromPoint(t-window.pageXOffset,e-window.pageYOffset);o.closest(`.${this.Editor.Toolbar.CSS.toolbar}`)||(this.Editor.BlockSelection.allBlocksSelected=!1,this.clearSelection(),this.stackOfSelected=[]);const i=[`.${F.CSS.content}`,`.${this.Editor.Toolbar.CSS.toolbar}`,`.${this.Editor.InlineToolbar.CSS.inlineToolbar}`],n=o.closest("."+this.Editor.UI.CSS.editorWrapper),r=i.some(a=>!!o.closest(a));!n||r||(this.mousedown=!0,this.startX=t,this.startY=e)}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:t}=this.genHTML();this.listeners.on(t,"mousedown",e=>{this.processMouseDown(e)},!1),this.listeners.on(document.body,"mousemove",St(e=>{this.processMouseMove(e)},10),{passive:!0}),this.listeners.on(document.body,"mouseleave",()=>{this.processMouseLeave()}),this.listeners.on(window,"scroll",St(e=>{this.processScroll(e)},10),{passive:!0}),this.listeners.on(document.body,"mouseup",()=>{this.processMouseUp()},!1)}processMouseDown(t){t.button===this.MAIN_MOUSE_BUTTON&&(t.target.closest(d.allInputsSelector)!==null||this.startSelection(t.pageX,t.pageY))}processMouseMove(t){this.changingRectangle(t),this.scrollByZones(t.clientY)}processMouseLeave(){this.clearSelection(),this.endSelection()}processScroll(t){this.changingRectangle(t)}processMouseUp(){this.clearSelection(),this.endSelection()}scrollByZones(t){if(this.inScrollZone=null,t<=this.HEIGHT_OF_SCROLL_ZONE&&(this.inScrollZone=this.TOP_SCROLL_ZONE),document.documentElement.clientHeight-t<=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:t}=this.Editor,e=t.nodes.holder.querySelector("."+t.CSS.editorWrapper),o=d.make("div",ft.CSS.overlay,{}),i=d.make("div",ft.CSS.overlayContainer,{}),n=d.make("div",ft.CSS.rect,{});return i.appendChild(n),o.appendChild(i),e.appendChild(o),this.overlayRectangle=n,{container:e,overlay:o}}scrollVertical(t){if(!(this.inScrollZone&&this.mousedown))return;const e=window.pageYOffset;window.scrollBy(0,t),this.mouseY+=window.pageYOffset-e,setTimeout(()=>{this.scrollVertical(t)},0)}changingRectangle(t){if(!this.mousedown)return;t.pageY!==void 0&&(this.mouseX=t.pageX,this.mouseY=t.pageY);const{rightPos:e,leftPos:o,index:i}=this.genInfoForMouseSelection(),n=this.startX>e&&this.mouseX>e,r=this.startX<o&&this.mouseX<o;this.rectCrossesBlocks=!(n||r),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(),b.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 t=this.Editor.BlockManager.getBlockByIndex(this.stackOfSelected[0]).selected;if(this.rectCrossesBlocks&&!t)for(const e of this.stackOfSelected)this.Editor.BlockSelection.selectBlockByIndex(e);if(!this.rectCrossesBlocks&&t)for(const e of this.stackOfSelected)this.Editor.BlockSelection.unSelectBlockByIndex(e)}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 t=document.body.offsetWidth/2,e=this.mouseY-window.pageYOffset,o=document.elementFromPoint(t,e),i=this.Editor.BlockManager.getBlockByChildNode(o);let n;i!==void 0&&(n=this.Editor.BlockManager.blocks.findIndex(p=>p.holder===i.holder));const r=this.Editor.BlockManager.lastBlock.holder.querySelector("."+F.CSS.content),a=Number.parseInt(window.getComputedStyle(r).width,10)/2,l=t-a,c=t+a;return{index:n,leftPos:l,rightPos:c}}addBlockInSelection(t){this.rectCrossesBlocks&&this.Editor.BlockSelection.selectBlockByIndex(t),this.stackOfSelected.push(t)}trySelectNextBlock(t){const e=this.stackOfSelected[this.stackOfSelected.length-1]===t,o=this.stackOfSelected.length,i=1,n=-1,r=0;if(e)return;const a=this.stackOfSelected[o-1]-this.stackOfSelected[o-2]>0;let l=r;o>1&&(l=a?i:n);const c=t>this.stackOfSelected[o-1]&&l===i,p=t<this.stackOfSelected[o-1]&&l===n,h=!(c||p||l===r);if(!h&&(t>this.stackOfSelected[o-1]||this.stackOfSelected[o-1]===void 0)){let u=this.stackOfSelected[o-1]+1||t;for(u;u<=t;u++)this.addBlockInSelection(u);return}if(!h&&t<this.stackOfSelected[o-1]){for(let u=this.stackOfSelected[o-1]-1;u>=t;u--)this.addBlockInSelection(u);return}if(!h)return;let f=o-1,k;for(t>this.stackOfSelected[o-1]?k=()=>t>this.stackOfSelected[f]:k=()=>t<this.stackOfSelected[f];k();)this.rectCrossesBlocks&&this.Editor.BlockSelection.unSelectBlockByIndex(this.stackOfSelected[f]),this.stackOfSelected.pop(),f--}}class hi extends T{async render(t){return new Promise(e=>{const{Tools:o,BlockManager:i}=this.Editor,n=t.map(({type:r,data:a,tunes:l,id:c})=>{o.available.has(r)===!1&&(K(`Tool «${r}» is not found. Check 'tools' property at the Editor.js config.`,"warn"),a=this.composeStubDataForTool(r,a,c),r=o.stubTool);let p;try{p=i.composeBlock({id:c,tool:r,data:a,tunes:l})}catch(h){_(`Block «${r}» skipped because of plugins error`,"error",{data:a,error:h}),a=this.composeStubDataForTool(r,a,c),r=o.stubTool,p=i.composeBlock({id:c,tool:r,data:a,tunes:l})}return p});i.insertMany(n),window.requestIdleCallback(()=>{e()},{timeout:2e3})})}composeStubDataForTool(t,e,o){const{Tools:i}=this.Editor;let n=t;if(i.unavailable.has(t)){const r=i.unavailable.get(t).toolbox;r!==void 0&&r[0].title!==void 0&&(n=r[0].title)}return{savedData:{id:o,type:t,data:e},title:n}}}class pi extends T{async save(){const{BlockManager:t,Tools:e}=this.Editor,o=t.blocks,i=[];try{o.forEach(a=>{i.push(this.getSavedData(a))});const n=await Promise.all(i),r=await fe(n,a=>e.blockTools.get(a).sanitizeConfig);return this.makeOutput(r)}catch(n){K("Saving failed due to the Error %o","error",n)}}async getSavedData(t){const e=await t.save(),o=e&&await t.validate(e.data);return{...e,isValid:o}}makeOutput(t){const e=[];return t.forEach(({id:o,tool:i,data:n,tunes:r,isValid:a})=>{if(!a){_(`Block «${i}» skipped because saved data is invalid`);return}if(i===this.Editor.Tools.stubTool){e.push(n);return}const l={id:o,type:i,data:n,...!V(r)&&{tunes:r}};e.push(l)}),{time:+new Date,blocks:e,version:"2.28.0"}}}var Dt={},ui={get exports(){return Dt},set exports(s){Dt=s}};(function(s,t){(function(e,o){s.exports=o()})(window,function(){return function(e){var o={};function i(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=o,i.d=function(n,r,a){i.o(n,r)||Object.defineProperty(n,r,{enumerable:!0,get:a})},i.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},i.t=function(n,r){if(1&r&&(n=i(n)),8&r||4&r&&typeof n=="object"&&n&&n.__esModule)return n;var a=Object.create(null);if(i.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:n}),2&r&&typeof n!="string")for(var l in n)i.d(a,l,(function(c){return n[c]}).bind(null,l));return a},i.n=function(n){var r=n&&n.__esModule?function(){return n.default}:function(){return n};return i.d(r,"a",r),r},i.o=function(n,r){return Object.prototype.hasOwnProperty.call(n,r)},i.p="/",i(i.s=4)}([function(e,o,i){var n=i(1),r=i(2);typeof(r=r.__esModule?r.default:r)=="string"&&(r=[[e.i,r,""]]);var a={insert:"head",singleton:!1};n(r,a),e.exports=r.locals||{}},function(e,o,i){var n,r=function(){return n===void 0&&(n=!!(window&&document&&document.all&&!window.atob)),n},a=function(){var w={};return function(v){if(w[v]===void 0){var x=document.querySelector(v);if(window.HTMLIFrameElement&&x instanceof window.HTMLIFrameElement)try{x=x.contentDocument.head}catch{x=null}w[v]=x}return w[v]}}(),l=[];function c(w){for(var v=-1,x=0;x<l.length;x++)if(l[x].identifier===w){v=x;break}return v}function p(w,v){for(var x={},I=[],O=0;O<w.length;O++){var m=w[O],g=v.base?m[0]+v.base:m[0],y=x[g]||0,B="".concat(g," ").concat(y);x[g]=y+1;var A=c(B),S={css:m[1],media:m[2],sourceMap:m[3]};A!==-1?(l[A].references++,l[A].updater(S)):l.push({identifier:B,updater:D(S,v),references:1}),I.push(B)}return I}function h(w){var v=document.createElement("style"),x=w.attributes||{};if(x.nonce===void 0){var I=i.nc;I&&(x.nonce=I)}if(Object.keys(x).forEach(function(m){v.setAttribute(m,x[m])}),typeof w.insert=="function")w.insert(v);else{var O=a(w.insert||"head");if(!O)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");O.appendChild(v)}return v}var f,k=(f=[],function(w,v){return f[w]=v,f.filter(Boolean).join(`
|
||
`)});function u(w,v,x,I){var O=x?"":I.media?"@media ".concat(I.media," {").concat(I.css,"}"):I.css;if(w.styleSheet)w.styleSheet.cssText=k(v,O);else{var m=document.createTextNode(O),g=w.childNodes;g[v]&&w.removeChild(g[v]),g.length?w.insertBefore(m,g[v]):w.appendChild(m)}}function C(w,v,x){var I=x.css,O=x.media,m=x.sourceMap;if(O?w.setAttribute("media",O):w.removeAttribute("media"),m&&btoa&&(I+=`
|
||
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(m))))," */")),w.styleSheet)w.styleSheet.cssText=I;else{for(;w.firstChild;)w.removeChild(w.firstChild);w.appendChild(document.createTextNode(I))}}var L=null,N=0;function D(w,v){var x,I,O;if(v.singleton){var m=N++;x=L||(L=h(v)),I=u.bind(null,x,m,!1),O=u.bind(null,x,m,!0)}else x=h(v),I=C.bind(null,x,v),O=function(){(function(g){if(g.parentNode===null)return!1;g.parentNode.removeChild(g)})(x)};return I(w),function(g){if(g){if(g.css===w.css&&g.media===w.media&&g.sourceMap===w.sourceMap)return;I(w=g)}else O()}}e.exports=function(w,v){(v=v||{}).singleton||typeof v.singleton=="boolean"||(v.singleton=r());var x=p(w=w||[],v);return function(I){if(I=I||[],Object.prototype.toString.call(I)==="[object Array]"){for(var O=0;O<x.length;O++){var m=c(x[O]);l[m].references--}for(var g=p(I,v),y=0;y<x.length;y++){var B=c(x[y]);l[B].references===0&&(l[B].updater(),l.splice(B,1))}x=g}}}},function(e,o,i){(o=i(3)(!1)).push([e.i,`.ce-paragraph {
|
||
line-height: 1.6em;
|
||
outline: none;
|
||
}
|
||
|
||
.ce-paragraph[data-placeholder]:empty::before{
|
||
content: attr(data-placeholder);
|
||
color: #707684;
|
||
font-weight: normal;
|
||
opacity: 0;
|
||
}
|
||
|
||
/** Show placeholder at the first paragraph if Editor is empty */
|
||
.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty::before {
|
||
opacity: 1;
|
||
}
|
||
|
||
.codex-editor--toolbox-opened .ce-block:first-child .ce-paragraph[data-placeholder]:empty::before,
|
||
.codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty:focus::before {
|
||
opacity: 0;
|
||
}
|
||
|
||
.ce-paragraph p:first-of-type{
|
||
margin-top: 0;
|
||
}
|
||
|
||
.ce-paragraph p:last-of-type{
|
||
margin-bottom: 0;
|
||
}
|
||
`,""]),e.exports=o},function(e,o,i){e.exports=function(n){var r=[];return r.toString=function(){return this.map(function(a){var l=function(c,p){var h=c[1]||"",f=c[3];if(!f)return h;if(p&&typeof btoa=="function"){var k=(C=f,L=btoa(unescape(encodeURIComponent(JSON.stringify(C)))),N="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(L),"/*# ".concat(N," */")),u=f.sources.map(function(D){return"/*# sourceURL=".concat(f.sourceRoot||"").concat(D," */")});return[h].concat(u).concat([k]).join(`
|
||
`)}var C,L,N;return[h].join(`
|
||
`)}(a,n);return a[2]?"@media ".concat(a[2]," {").concat(l,"}"):l}).join("")},r.i=function(a,l,c){typeof a=="string"&&(a=[[null,a,""]]);var p={};if(c)for(var h=0;h<this.length;h++){var f=this[h][0];f!=null&&(p[f]=!0)}for(var k=0;k<a.length;k++){var u=[].concat(a[k]);c&&p[u[0]]||(l&&(u[2]?u[2]="".concat(l," and ").concat(u[2]):u[2]=l),r.push(u))}},r}},function(e,o,i){i.r(o),i.d(o,"default",function(){return a}),i(0);function n(l,c){for(var p=0;p<c.length;p++){var h=c[p];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}function r(l,c,p){return c&&n(l.prototype,c),p&&n(l,p),l}/**
|
||
* Base Paragraph Block for the Editor.js.
|
||
* Represents a regular text block
|
||
*
|
||
* @author CodeX (team@codex.so)
|
||
* @copyright CodeX 2018
|
||
* @license The MIT License (MIT)
|
||
*/var a=function(){function l(c){var p=c.data,h=c.config,f=c.api,k=c.readOnly;(function(u,C){if(!(u instanceof C))throw new TypeError("Cannot call a class as a function")})(this,l),this.api=f,this.readOnly=k,this._CSS={block:this.api.styles.block,wrapper:"ce-paragraph"},this.readOnly||(this.onKeyUp=this.onKeyUp.bind(this)),this._placeholder=h.placeholder?h.placeholder:l.DEFAULT_PLACEHOLDER,this._data={},this._element=null,this._preserveBlank=h.preserveBlank!==void 0&&h.preserveBlank,this.data=p}return r(l,null,[{key:"DEFAULT_PLACEHOLDER",get:function(){return""}}]),r(l,[{key:"onKeyUp",value:function(c){c.code!=="Backspace"&&c.code!=="Delete"||this._element.textContent===""&&(this._element.innerHTML="")}},{key:"drawView",value:function(){var c=document.createElement("DIV");return c.classList.add(this._CSS.wrapper,this._CSS.block),c.contentEditable=!1,c.dataset.placeholder=this.api.i18n.t(this._placeholder),this.readOnly||(c.contentEditable=!0,c.addEventListener("keyup",this.onKeyUp)),c}},{key:"render",value:function(){return this._element===null&&(this._element=this.drawView()),this.hydrate(),this._element}},{key:"merge",value:function(c){var p={text:this.data.text+c.text};this.data=p}},{key:"validate",value:function(c){return!(c.text.trim()===""&&!this._preserveBlank)}},{key:"save",value:function(c){return{text:c.innerHTML}}},{key:"onPaste",value:function(c){var p={text:c.detail.data.innerHTML};this.data=p}},{key:"hydrate",value:function(){var c=this;window.requestAnimationFrame(function(){c._element.innerHTML=c._data.text||""})}},{key:"data",get:function(){if(this._element!==null){var c=this._element.innerHTML;this._data.text=c}return this._data},set:function(c){this._data=c||{},this._element!==null&&this.hydrate()}}],[{key:"conversionConfig",get:function(){return{export:"text",import:"text"}}},{key:"sanitize",get:function(){return{text:{br:!0}}}},{key:"isReadOnlySupported",get:function(){return!0}},{key:"pasteConfig",get:function(){return{tags:["P"]}}},{key:"toolbox",get:function(){return{icon:'<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>',title:"Text"}}}]),l}()}]).default})})(ui);const fi=xt(Dt);class Yt{constructor(){this.commandName="bold",this.CSS={button:"ce-inline-tool",buttonActive:"ce-inline-tool--active",buttonModifier:"ce-inline-tool--bold"},this.nodes={button:void 0}}static get sanitize(){return{b:{}}}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=Do,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const t=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,t),t}get shortcut(){return"CMD+B"}}Yt.isInline=!0;Yt.title="Bold";class Kt{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=Ho,this.nodes.button}surround(){document.execCommand(this.commandName)}checkState(){const t=document.queryCommandState(this.commandName);return this.nodes.button.classList.toggle(this.CSS.buttonActive,t),t}get shortcut(){return"CMD+I"}}Kt.isInline=!0;Kt.title="Italic";class Xt{constructor({api:t}){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=t.toolbar,this.inlineToolbar=t.inlineToolbar,this.notifier=t.notifier,this.i18n=t.i18n,this.selection=new b}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=ee,this.nodes.button}renderActions(){return this.nodes.input=document.createElement("input"),this.nodes.input.placeholder=this.i18n.t("Add a link"),this.nodes.input.classList.add(this.CSS.input),this.nodes.input.addEventListener("keydown",t=>{t.keyCode===this.ENTER_KEY&&this.enterPressed(t)}),this.nodes.input}surround(t){if(t){this.inputOpened?(this.selection.restore(),this.selection.removeFakeBackground()):(this.selection.setFakeBackground(),this.selection.save());const e=this.selection.findParentTag("A");if(e){this.selection.expandToTag(e),this.unlink(),this.closeActions(),this.checkState(),this.toolbar.close();return}}this.toggleActions()}checkState(){const t=this.selection.findParentTag("A");if(t){this.nodes.button.innerHTML=$o,this.nodes.button.classList.add(this.CSS.buttonUnlink),this.nodes.button.classList.add(this.CSS.buttonActive),this.openActions();const e=t.getAttribute("href");this.nodes.input.value=e!=="null"?e:"",this.selection.save()}else this.nodes.button.innerHTML=ee,this.nodes.button.classList.remove(this.CSS.buttonUnlink),this.nodes.button.classList.remove(this.CSS.buttonActive);return!!t}clear(){this.closeActions()}get shortcut(){return"CMD+K"}toggleActions(){this.inputOpened?this.closeActions(!1):this.openActions(!0)}openActions(t=!1){this.nodes.input.classList.add(this.CSS.inputShowed),t&&this.nodes.input.focus(),this.inputOpened=!0}closeActions(t=!0){if(this.selection.isFakeBackgroundEnabled){const e=new b;e.save(),this.selection.restore(),this.selection.removeFakeBackground(),e.restore()}this.nodes.input.classList.remove(this.CSS.inputShowed),this.nodes.input.value="",t&&this.selection.clearSaved(),this.inputOpened=!1}enterPressed(t){let e=this.nodes.input.value||"";if(!e.trim()){this.selection.restore(),this.unlink(),t.preventDefault(),this.closeActions();return}if(!this.validateURL(e)){this.notifier.show({message:"Pasted link is not valid.",style:"error"}),_("Incorrect Link pasted","warn",e);return}e=this.prepareLink(e),this.selection.restore(),this.selection.removeFakeBackground(),this.insertLink(e),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),this.selection.collapseToEnd(),this.inlineToolbar.close()}validateURL(t){return!/\s/.test(t)}prepareLink(t){return t=t.trim(),t=this.addProtocol(t),t}addProtocol(t){if(/^(\w+):(\/\/)?/.test(t))return t;const e=/^\/[^/\s]/.test(t),o=t.substring(0,1)==="#",i=/^\/\/[^/\s]/.test(t);return!e&&!o&&!i&&(t="http://"+t),t}insertLink(t){const e=this.selection.findParentTag("A");e&&this.selection.expandToTag(e),document.execCommand(this.commandLink,!1,t)}unlink(){document.execCommand(this.commandUnlink)}}Xt.isInline=!0;Xt.title="Link";class Be{constructor({data:t,api:e}){this.CSS={wrapper:"ce-stub",info:"ce-stub__info",title:"ce-stub__title",subtitle:"ce-stub__subtitle"},this.api=e,this.title=t.title||this.api.i18n.t("Error"),this.subtitle=this.api.i18n.t("The block can not be displayed correctly."),this.savedData=t.savedData,this.wrapper=this.make()}render(){return this.wrapper}save(){return this.savedData}make(){const t=d.make("div",this.CSS.wrapper),e=Wo,o=d.make("div",this.CSS.info),i=d.make("div",this.CSS.title,{textContent:this.title}),n=d.make("div",this.CSS.subtitle,{textContent:this.subtitle});return t.innerHTML=e,o.appendChild(i),o.appendChild(n),t.appendChild(o),t}}Be.isReadOnlySupported=!0;class gi extends Wt{constructor(){super(...arguments),this.type=yt.Inline}get title(){return this.constructable[$t.Title]}create(){return new this.constructable({api:this.api.getMethodsForTool(this),config:this.settings})}}class mi extends Wt{constructor(){super(...arguments),this.type=yt.Tune}create(t,e){return new this.constructable({api:this.api.getMethodsForTool(this),config:this.settings,block:e,data:t})}}class U extends Map{get blockTools(){const t=Array.from(this.entries()).filter(([,e])=>e.isBlock());return new U(t)}get inlineTools(){const t=Array.from(this.entries()).filter(([,e])=>e.isInline());return new U(t)}get blockTunes(){const t=Array.from(this.entries()).filter(([,e])=>e.isTune());return new U(t)}get internalTools(){const t=Array.from(this.entries()).filter(([,e])=>e.isInternal);return new U(t)}get externalTools(){const t=Array.from(this.entries()).filter(([,e])=>!e.isInternal);return new U(t)}}var bi=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Te=(s,t,e,o)=>{for(var i=o>1?void 0:o?ki(t,e):t,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(o?r(t,e,i):r(i))||i);return o&&i&&bi(t,e,i),i};class Vt extends Wt{constructor(){super(...arguments),this.type=yt.Block,this.inlineTools=new U,this.tunes=new U}create(t,e,o){return new this.constructable({data:t,block:e,readOnly:o,api:this.api.getMethodsForTool(this),config:this.settings})}get isReadOnlySupported(){return this.constructable[st.IsReadOnlySupported]===!0}get isLineBreaksEnabled(){return this.constructable[st.IsEnabledLineBreaks]}get toolbox(){const t=this.constructable[st.Toolbox],e=this.config[kt.Toolbox];if(!V(t)&&e!==!1)return e?Array.isArray(t)?Array.isArray(e)?e.map((o,i)=>{const n=t[i];return n?{...n,...o}:o}):[e]:Array.isArray(e)?e:[{...t,...e}]:Array.isArray(t)?t:[t]}get conversionConfig(){return this.constructable[st.ConversionConfig]}get enabledInlineTools(){return this.config[kt.EnabledInlineTools]||!1}get enabledBlockTunes(){return this.config[kt.EnabledBlockTunes]}get pasteConfig(){return this.constructable[st.PasteConfig]??{}}get sanitizeConfig(){const t=super.sanitizeConfig,e=this.baseSanitizeConfig;if(V(t))return e;const o={};for(const i in t)if(Object.prototype.hasOwnProperty.call(t,i)){const n=t[i];z(n)?o[i]=Object.assign({},e,n):o[i]=n}return o}get baseSanitizeConfig(){const t={};return Array.from(this.inlineTools.values()).forEach(e=>Object.assign(t,e.sanitizeConfig)),Array.from(this.tunes.values()).forEach(e=>Object.assign(t,e.sanitizeConfig)),t}}Te([ct],Vt.prototype,"sanitizeConfig",1);Te([ct],Vt.prototype,"baseSanitizeConfig",1);class vi{constructor(t,e,o){this.api=o,this.config=t,this.editorConfig=e}get(t){const{class:e,isInternal:o=!1,...i}=this.config[t],n=this.getConstructor(e);return new n({name:t,constructable:e,config:i,api:this.api,isDefault:t===this.editorConfig.defaultBlock,defaultPlaceholder:this.editorConfig.placeholder,isInternal:o})}getConstructor(t){switch(!0){case t[$t.IsInline]:return gi;case t[ye.IsTune]:return mi;default:return Vt}}}class Se{constructor({api:t}){this.CSS={animation:"wobble"},this.api=t}render(){return{icon:me,title:this.api.i18n.t("Move down"),onActivate:()=>this.handleClick(),name:"move-down"}}handleClick(){const t=this.api.blocks.getCurrentBlockIndex(),e=this.api.blocks.getBlockByIndex(t+1);if(!e)throw new Error("Unable to move Block down since it is already the last");const o=e.holder,i=o.getBoundingClientRect();let n=Math.abs(window.innerHeight-o.offsetHeight);i.top<window.innerHeight&&(n=window.scrollY+o.offsetHeight),window.scrollTo(0,n),this.api.blocks.move(t+1),this.api.toolbar.toggleBlockSettings(!0)}}Se.isTune=!0;class Ie{constructor({api:t}){this.api=t}render(){return{icon:Po,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()}}Ie.isTune=!0;class Me{constructor({api:t}){this.CSS={animation:"wobble"},this.api=t}render(){return{icon:Ro,title:this.api.i18n.t("Move up"),onActivate:()=>this.handleClick(),name:"move-up"}}handleClick(){const t=this.api.blocks.getCurrentBlockIndex(),e=this.api.blocks.getBlockByIndex(t),o=this.api.blocks.getBlockByIndex(t-1);if(t===0||!e||!o)throw new Error("Unable to move Block up since it is already the first");const i=e.holder,n=o.holder,r=i.getBoundingClientRect(),a=n.getBoundingClientRect();let l;a.top>0?l=Math.abs(r.top)-Math.abs(a.top):l=Math.abs(r.top)+a.height,window.scrollBy(0,-1*l),this.api.blocks.move(t-1),this.api.toolbar.toggleBlockSettings(!0)}}Me.isTune=!0;var xi=Object.defineProperty,wi=Object.getOwnPropertyDescriptor,yi=(s,t,e,o)=>{for(var i=o>1?void 0:o?wi(t,e):t,n=s.length-1,r;n>=0;n--)(r=s[n])&&(i=(o?r(t,e,i):r(i))||i);return o&&i&&xi(t,e,i),i};class _e extends T{constructor(){super(...arguments),this.stubTool="stub",this.toolsAvailable=new U,this.toolsUnavailable=new U}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=It({},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 t=this.prepareConfig();this.factory=new vi(t,this.config,this.Editor.API);const e=this.getListOfPrepareFunctions(t);if(e.length===0)return Promise.resolve();await We(e,o=>{this.toolPrepareMethodSuccess(o)},o=>{this.toolPrepareMethodFallback(o)}),this.prepareBlockTools()}getAllInlineToolsSanitizeConfig(){const t={};return Array.from(this.inlineTools.values()).forEach(e=>{Object.assign(t,e.sanitizeConfig)}),t}destroy(){Object.values(this.available).forEach(async t=>{R(t.reset)&&await t.reset()})}get internalTools(){return{bold:{class:Yt,isInternal:!0},italic:{class:Kt,isInternal:!0},link:{class:Xt,isInternal:!0},paragraph:{class:fi,inlineToolbar:!0,isInternal:!0},stub:{class:Be,isInternal:!0},moveUp:{class:Me,isInternal:!0},delete:{class:Ie,isInternal:!0},moveDown:{class:Se,isInternal:!0}}}toolPrepareMethodSuccess(t){const e=this.factory.get(t.toolName);if(e.isInline()){const o=["render","surround","checkState"].filter(i=>!e.create()[i]);if(o.length){_(`Incorrect Inline Tool: ${e.name}. Some of required methods is not implemented %o`,"warn",o),this.toolsUnavailable.set(e.name,e);return}}this.toolsAvailable.set(e.name,e)}toolPrepareMethodFallback(t){this.toolsUnavailable.set(t.toolName,this.factory.get(t.toolName))}getListOfPrepareFunctions(t){const e=[];return Object.entries(t).forEach(([o,i])=>{e.push({function:R(i.class.prepare)?i.class.prepare:()=>{},data:{toolName:o,config:i.config}})}),e}prepareBlockTools(){Array.from(this.blockTools.values()).forEach(t=>{this.assignInlineToolsToBlockTool(t),this.assignBlockTunesToBlockTool(t)})}assignInlineToolsToBlockTool(t){if(this.config.inlineToolbar!==!1){if(t.enabledInlineTools===!0){t.inlineTools=new U(Array.isArray(this.config.inlineToolbar)?this.config.inlineToolbar.map(e=>[e,this.inlineTools.get(e)]):Array.from(this.inlineTools.entries()));return}Array.isArray(t.enabledInlineTools)&&(t.inlineTools=new U(t.enabledInlineTools.map(e=>[e,this.inlineTools.get(e)])))}}assignBlockTunesToBlockTool(t){if(t.enabledBlockTunes!==!1){if(Array.isArray(t.enabledBlockTunes)){const e=new U(t.enabledBlockTunes.map(o=>[o,this.blockTunes.get(o)]));t.tunes=new U([...e,...this.blockTunes.internalTools]);return}if(Array.isArray(this.config.tunes)){const e=new U(this.config.tunes.map(o=>[o,this.blockTunes.get(o)]));t.tunes=new U([...e,...this.blockTunes.internalTools]);return}t.tunes=this.blockTunes.internalTools}}validateTools(){for(const t in this.config.tools)if(Object.prototype.hasOwnProperty.call(this.config.tools,t)){if(t in this.internalTools)return;const e=this.config.tools[t];if(!R(e)&&!R(e.class))throw Error(`Tool «${t}» must be a constructor function or an object with function in the «class» property`)}}prepareConfig(){const t={};for(const e in this.config.tools)z(this.config.tools[e])?t[e]=this.config.tools[e]:t[e]={class:this.config.tools[e]};return t}}yi([ct],_e.prototype,"getAllInlineToolsSanitizeConfig",1);const Ei=`: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:0px;left:0px;right:0px;bottom:0px;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;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;-webkit-transform:translateX(-50%) translateY(8px) scale(.94);transform:translate(-50%) translateY(8px) scale(.94);opacity:0;visibility:hidden;-webkit-transition:opacity .25s ease,-webkit-transform .15s ease;transition:opacity .25s ease,-webkit-transform .15s ease;transition:transform .15s ease,opacity .25s ease;transition:transform .15s ease,opacity .25s ease,-webkit-transform .15s ease;will-change:transform,opacity;top:0;left:0;z-index:3}.ce-inline-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-inline-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-inline-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:translateX(-50%);transform:translate(-50%)}.ce-inline-toolbar--left-oriented{-webkit-transform:translateX(-23px) translateY(8px) scale(.94);transform:translate(-23px) translateY(8px) scale(.94)}.ce-inline-toolbar--left-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-23px);transform:translate(-23px)}.ce-inline-toolbar--right-oriented{-webkit-transform:translateX(-100%) translateY(8px) scale(.94);transform:translate(-100%) translateY(8px) scale(.94);margin-left:23px}.ce-inline-toolbar--right-oriented.ce-inline-toolbar--showed{-webkit-transform:translateX(-100%);transform:translate(-100%)}.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{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;padding:6px 1px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;border-radius:0;line-height:normal}.ce-inline-tool svg{width:20px;height:20px}@media (max-width: 650px){.ce-inline-tool svg{width:28px;height:28px}}@media (hover: hover){.ce-inline-tool:hover{background-color:#eff2f5}}.ce-inline-tool--active{color:#388ae5}.ce-inline-tool--focused{background:rgba(34,186,255,.08)!important}.ce-inline-tool--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.ce-inline-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.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{outline:none;border:0;border-radius:0 0 4px 4px;margin:0;font-size:13px;padding:10px;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;display:none;font-weight:500;border-top:1px solid rgba(201,201,204,.48);-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-conversion-toolbar{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;opacity:0;visibility:hidden;will-change:transform,opacity;-webkit-transition:opacity .1s ease,-webkit-transform .1s ease;transition:opacity .1s ease,-webkit-transform .1s ease;transition:transform .1s ease,opacity .1s ease;transition:transform .1s ease,opacity .1s ease,-webkit-transform .1s ease;-webkit-transform:translateY(-8px);transform:translateY(-8px);left:-1px;width:190px;margin-top:5px;-webkit-box-sizing:content-box;box-sizing:content-box}.ce-conversion-toolbar--left-oriented:before{left:15px;margin-left:0}.ce-conversion-toolbar--right-oriented:before{left:auto;right:15px;margin-left:0}.ce-conversion-toolbar--showed{opacity:1;visibility:visible;-webkit-transform:none;transform:none}.ce-conversion-toolbar [hidden]{display:none!important}.ce-conversion-toolbar__buttons{display:-webkit-box;display:-ms-flexbox;display:flex}.ce-conversion-toolbar__label{color:#707684;font-size:11px;font-weight:500;letter-spacing:.33px;padding:10px 10px 5px;text-transform:uppercase}.ce-conversion-tool{display:-webkit-box;display:-ms-flexbox;display:flex;padding:5px 10px;font-size:14px;line-height:20px;font-weight:500;cursor:pointer;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.ce-conversion-tool--hidden{display:none}.ce-conversion-tool--focused{background:rgba(34,186,255,.08)!important}.ce-conversion-tool--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.ce-conversion-tool--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-conversion-tool:hover{background:#eff2f5}.ce-conversion-tool__icon{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex;width:26px;height:26px;-webkit-box-shadow:0 0 0 1px rgba(201,201,204,.48);box-shadow:0 0 0 1px #c9c9cc7a;border-radius:5px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;background:#fff;-webkit-box-sizing:content-box;box-sizing:content-box;-ms-flex-negative:0;flex-shrink:0;margin-right:10px}.ce-conversion-tool__icon svg{width:20px;height:20px}@media (max-width: 650px){.ce-conversion-tool__icon{width:36px;height:36px;border-radius:8px}.ce-conversion-tool__icon svg{width:28px;height:28px}}.ce-conversion-tool--last{margin-right:0!important}.ce-conversion-tool--active{color:#388ae5!important}.ce-conversion-tool--active{-webkit-animation:bounceIn .75s 1;animation:bounceIn .75s 1;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.ce-conversion-tool__secondary-label{color:#707684;font-size:12px;margin-left:auto;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;margin-bottom:-2px;opacity:.6}@media (max-width: 650px){.ce-conversion-tool__secondary-label{display:none}}.ce-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;padding:6px 1px;border-radius:3px;cursor:pointer;border:0;outline:none;background-color:transparent;vertical-align:bottom;color:inherit;margin:0;line-height:32px}.ce-settings__button svg{width:20px;height:20px}@media (max-width: 650px){.ce-settings__button svg{width:28px;height:28px}}@media (hover: hover){.ce-settings__button:hover{background-color:#eff2f5}}.ce-settings__button--active{color:#388ae5}.ce-settings__button--focused{background:rgba(34,186,255,.08)!important}.ce-settings__button--focused{-webkit-box-shadow:inset 0 0 0px 1px rgba(7,161,227,.08);box-shadow:inset 0 0 0 1px #07a1e314}.ce-settings__button--focused-animated{-webkit-animation-name:buttonClicked;animation-name:buttonClicked;-webkit-animation-duration:.25s;animation-duration:.25s}.ce-settings__button:not(:nth-child(3n+3)){margin-right:3px}.ce-settings__button:nth-child(n+4){margin-top:3px}.ce-settings__button--disabled{cursor:not-allowed!important}.ce-settings__button--disabled{opacity:.3}.ce-settings__button--selected{color:#388ae5}@media (min-width: 651px){.codex-editor--narrow .ce-settings .ce-popover{right:0;left:auto;left:initial}}@-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}@media (min-width: 651px){.codex-editor--narrow .ce-block--focused{margin-right:-50px;padding-right:50px}}@-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;padding:6px 1px;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 svg{width:20px;height:20px}@media (max-width: 650px){.cdx-settings-button svg{width:28px;height:28px}}@media (hover: hover){.cdx-settings-button:hover{background-color:#eff2f5}}.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{width:36px;height:36px;border-radius:8px}}.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:0px;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:rgba(232,232,235,.49);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: #e8e8eb;--color-shadow: rgba(13,20,33,.13);--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: #eff2f5;--color-background-item-confirm: #E24A4A;--color-background-item-confirm-hover: #CE4343;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:0 3px 15px -3px var(--color-shadow);box-shadow:0 3px 15px -3px var(--color-shadow);position:absolute;left:0;top:calc(100% + var(--offset-from-target));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{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{-webkit-animation:panelShowingMobile .25s ease;animation:panelShowingMobile .25s ease}}.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}.ce-popover--open-top{top:calc(-1 * (var(--offset-from-target) + var(--popover-height)))}@media (max-width: 650px){.ce-popover{--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 .ce-popover__search{display:none}}.ce-popover__search,.ce-popover__custom-content:not(:empty){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__custom-content:not(:empty){padding:4px}@media (min-width: 651px){.ce-popover__custom-content:not(:empty){padding:0}}.ce-popover__custom-content--hidden{display:none}.ce-popover-item{--border-radius: 6px;--icon-size: 20px;--icon-size-mobile: 28px;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:3px;color:var(--color-text-primary);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}@media (max-width: 650px){.ce-popover-item{padding:4px}}.ce-popover-item:not(:last-of-type){margin-bottom:1px}.ce-popover-item__icon{border-radius:5px;width:26px;height:26px;-webkit-box-shadow:0 0 0 1px var(--color-border-icon);box-shadow:0 0 0 1px var(--color-border-icon);background:#fff;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:10px}.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:var(--icon-size-mobile);height:var(--icon-size-mobile)}}.ce-popover-item__title{font-size:14px;line-height:20px;font-weight:500;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}@media (max-width: 650px){.ce-popover-item__title{font-size:16px}}.ce-popover-item__secondary-title{color:var(--color-text-secondary);font-size:12px;margin-left:auto;white-space:nowrap;letter-spacing:-.1em;padding-right:5px;margin-bottom:-2px;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--active .ce-popover-item__icon{-webkit-box-shadow:none;box-shadow:none}.ce-popover-item--disabled{color:var(--color-text-secondary);cursor:default;pointer-events:none}.ce-popover-item--disabled .ce-popover-item__icon{-webkit-box-shadow:0 0 0 1px var(--color-border-icon-disabled);box-shadow:0 0 0 1px var(--color-border-icon-disabled)}.ce-popover-item--focused:not(.ce-popover-item--no-focus){background:var(--color-background-item-focus)!important}.ce-popover-item--focused:not(.ce-popover-item--no-focus){-webkit-box-shadow:inset 0 0 0px 1px var(--color-shadow-item-focus);box-shadow:inset 0 0 0 1px var(--color-shadow-item-focus)}.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:hover .ce-popover-item__icon{-webkit-box-shadow:none;box-shadow:none}}.ce-popover-item--confirmation{background:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__icon{color:var(--color-background-item-confirm)}.ce-popover-item--confirmation .ce-popover-item__title{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}.ce-popover-item--confirmation .ce-popover-item__icon,.ce-popover-item--active .ce-popover-item__icon,.ce-popover-item--focused .ce-popover-item__icon{-webkit-box-shadow:none;box-shadow:none}@-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)}}
|
||
`;class Ci extends T{constructor(){super(...arguments),this.isMobile=!1,this.contentRectCache=void 0,this.resizeDebouncer=Xe(()=>{this.windowResize()},200)}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)return this.contentRectCache;const t=this.nodes.wrapper.querySelector(`.${F.CSS.content}`);return t?(this.contentRectCache=t.getBoundingClientRect(),this.contentRectCache):{width:650,left:0,right:0}}async prepare(){this.checkIsMobile(),this.make(),this.loadStyles()}toggleReadOnly(t){t?this.disableModuleBindings():this.enableModuleBindings()}checkEmptiness(){const{BlockManager:t}=this.Editor;this.nodes.wrapper.classList.toggle(this.CSS.editorEmpty,t.isEditorEmpty)}get someToolbarOpened(){const{Toolbar:t,BlockSettings:e,InlineToolbar:o,ConversionToolbar:i}=this.Editor;return e.opened||o.opened||i.opened||t.toolbox.opened}get someFlipperButtonFocused(){return this.Editor.Toolbar.toolbox.hasFocus()?!0:Object.entries(this.Editor).filter(([t,e])=>e.flipper instanceof G).some(([t,e])=>e.flipper.hasFocus())}destroy(){this.nodes.holder.innerHTML=""}closeAllToolbars(){const{Toolbar:t,BlockSettings:e,InlineToolbar:o,ConversionToolbar:i}=this.Editor;e.close(),o.close(),i.close(),t.toolbox.close()}checkIsMobile(){this.isMobile=window.innerWidth<le}make(){this.nodes.holder=d.getHolder(this.config.holder),this.nodes.wrapper=d.make("div",[this.CSS.editorWrapper,...this.isRtl?[this.CSS.editorRtlFix]:[]]),this.nodes.redactor=d.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)}loadStyles(){const t="editor-js-styles";if(d.get(t))return;const e=d.make("style",null,{id:t,textContent:Ei.toString()});d.prepend(document.head,e)}enableModuleBindings(){this.readOnlyMutableListeners.on(this.nodes.redactor,"click",t=>{this.redactorClicked(t)},!1),this.readOnlyMutableListeners.on(this.nodes.redactor,"mousedown",t=>{this.documentTouched(t)},!0),this.readOnlyMutableListeners.on(this.nodes.redactor,"touchstart",t=>{this.documentTouched(t)},!0),this.readOnlyMutableListeners.on(document,"keydown",t=>{this.documentKeydown(t)},!0),this.readOnlyMutableListeners.on(document,"mousedown",t=>{this.documentClicked(t)},!0),this.readOnlyMutableListeners.on(document,"selectionchange",()=>{this.selectionChanged()},!0),this.readOnlyMutableListeners.on(window,"resize",()=>{this.resizeDebouncer()},{passive:!0}),this.watchBlockHoveredEvents()}watchBlockHoveredEvents(){let t;this.readOnlyMutableListeners.on(this.nodes.redactor,"mousemove",St(e=>{const o=e.target.closest(".ce-block");this.Editor.BlockSelection.anyBlockSelected||o&&t!==o&&(t=o,this.eventsDispatcher.emit(xe,{block:this.Editor.BlockManager.getBlockByChildNode(o)}))},20),{passive:!0})}disableModuleBindings(){this.readOnlyMutableListeners.clearAll()}windowResize(){this.contentRectCache=null,this.checkIsMobile()}documentKeydown(t){switch(t.keyCode){case E.ENTER:this.enterPressed(t);break;case E.BACKSPACE:case E.DELETE:this.backspacePressed(t);break;case E.ESC:this.escapePressed(t);break;default:this.defaultBehaviour(t);break}}defaultBehaviour(t){const{currentBlock:e}=this.Editor.BlockManager,o=t.target.closest(`.${this.CSS.editorWrapper}`),i=t.altKey||t.ctrlKey||t.metaKey||t.shiftKey;if(e!==void 0&&o===null){this.Editor.BlockEvents.keydown(t);return}o||e&&i||(this.Editor.BlockManager.dropPointer(),this.Editor.Toolbar.close())}backspacePressed(t){const{BlockManager:e,BlockSelection:o,Caret:i}=this.Editor;if(o.anyBlockSelected&&!b.isSelectionExists){const n=e.removeSelectedBlocks();i.setToBlock(e.insertDefaultBlockAtIndex(n,!0),i.positions.START),o.clearSelection(t),t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()}}escapePressed(t){this.Editor.BlockSelection.clearSelection(t),this.Editor.Toolbar.toolbox.opened?(this.Editor.Toolbar.toolbox.close(),this.Editor.Caret.setToBlock(this.Editor.BlockManager.currentBlock)):this.Editor.BlockSettings.opened?this.Editor.BlockSettings.close():this.Editor.ConversionToolbar.opened?this.Editor.ConversionToolbar.close():this.Editor.InlineToolbar.opened?this.Editor.InlineToolbar.close():this.Editor.Toolbar.close()}enterPressed(t){const{BlockManager:e,BlockSelection:o}=this.Editor,i=e.currentBlockIndex>=0;if(o.anyBlockSelected&&!b.isSelectionExists){o.clearSelection(t),t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation();return}if(!this.someToolbarOpened&&i&&t.target.tagName==="BODY"){const n=this.Editor.BlockManager.insert();this.Editor.Caret.setToBlock(n),this.Editor.BlockManager.highlightCurrentNode(),this.Editor.Toolbar.moveAndOpen(n)}this.Editor.BlockSelection.clearSelection(t)}documentClicked(t){if(!t.isTrusted)return;const e=t.target;this.nodes.holder.contains(e)||b.isAtEditor||(this.Editor.BlockManager.dropPointer(),this.Editor.Toolbar.close());const o=this.Editor.BlockSettings.nodes.wrapper.contains(e),i=this.Editor.Toolbar.nodes.settingsToggler.contains(e),n=o||i;if(this.Editor.BlockSettings.opened&&!n){this.Editor.BlockSettings.close();const r=this.Editor.BlockManager.getBlockByChildNode(e);this.Editor.Toolbar.moveAndOpen(r)}this.Editor.BlockSelection.clearSelection(t)}documentTouched(t){let e=t.target;if(e===this.nodes.redactor){const o=t instanceof MouseEvent?t.clientX:t.touches[0].clientX,i=t instanceof MouseEvent?t.clientY:t.touches[0].clientY;e=document.elementFromPoint(o,i)}try{this.Editor.BlockManager.setCurrentBlockByChildNode(e),this.Editor.BlockManager.highlightCurrentNode()}catch{this.Editor.RectangleSelection.isRectActivated()||this.Editor.Caret.setToTheLastBlock()}this.Editor.Toolbar.moveAndOpen()}redactorClicked(t){const{BlockSelection:e}=this.Editor;if(!b.isCollapsed)return;const o=()=>{t.stopImmediatePropagation(),t.stopPropagation()},i=t.target,n=t.metaKey||t.ctrlKey;if(d.isAnchor(i)&&n){o();const c=i.getAttribute("href"),p=qe(c);Ge(p);return}const r=this.Editor.BlockManager.getBlockByIndex(-1),a=d.offset(r.holder).bottom,l=t.pageY;if(t.target instanceof Element&&t.target.isEqualNode(this.nodes.redactor)&&!e.anyBlockSelected&&a<l){o();const{BlockManager:c,Caret:p,Toolbar:h}=this.Editor;(!c.lastBlock.tool.isDefault||!c.lastBlock.isEmpty)&&c.insertAtEnd(),p.setToTheLastBlock(),h.moveAndOpen(c.lastBlock)}}selectionChanged(){const{CrossBlockSelection:t,BlockSelection:e}=this.Editor,o=b.anchorElement;if(t.isCrossBlockSelectionStarted&&e.anyBlockSelected&&b.get().removeAllRanges(),!o){b.range||this.Editor.InlineToolbar.close();return}const i=o.closest(`.${F.CSS.content}`)===null;if(i&&(this.Editor.InlineToolbar.containsNode(o)||this.Editor.InlineToolbar.close(),o.dataset.inlineToolbar!=="true"))return;this.Editor.BlockManager.currentBlock||this.Editor.BlockManager.setCurrentBlockByChildNode(o);const n=i!==!0;this.Editor.InlineToolbar.tryToShow(!0,n)}}const Bi={BlocksAPI:ao,CaretAPI:lo,EventsAPI:co,I18nAPI:Ft,API:ho,InlineToolbarAPI:po,ListenersAPI:uo,NotifierAPI:bo,ReadOnlyAPI:ko,SanitizerAPI:Bo,SaverAPI:To,SelectionAPI:So,StylesAPI:Io,ToolbarAPI:Mo,TooltipAPI:Lo,UiAPI:Oo,BlockSettings:Vo,ConversionToolbar:Y,Toolbar:ti,InlineToolbar:ei,BlockEvents:oi,BlockManager:si,BlockSelection:ri,Caret:vt,CrossBlockSelection:ai,DragNDrop:li,ModificationsObserver:ci,Paste:Ce,ReadOnly:di,RectangleSelection:ft,Renderer:hi,Saver:pi,Tools:_e,UI:Ci};class Ti{constructor(t){this.moduleInstances={},this.eventsDispatcher=new wt;let e,o;this.isReady=new Promise((i,n)=>{e=i,o=n}),Promise.resolve().then(async()=>{this.configuration=t,this.validate(),this.init(),await this.start(),await this.render();const{BlockManager:i,Caret:n,UI:r,ModificationsObserver:a}=this.moduleInstances;r.checkEmptiness(),a.enable(),this.configuration.autofocus&&(n.setToBlock(i.blocks[0],n.positions.START),i.highlightCurrentNode()),e()}).catch(i=>{_(`Editor.js is not ready because of ${i}`,"error"),o(i)})}set configuration(t){var e,o;z(t)?this.config={...t}:this.config={holder:t},Mt(!!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=se.VERBOSE),Ue(this.config.logLevel),Mt(!!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,(V(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,(e=this.config.i18n)!=null&&e.messages&&$.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:t,holder:e}=this.config;if(t&&e)throw Error("«holderId» and «holder» param can't assign at the same time.");if(J(e)&&!d.get(e))throw Error(`element with ID «${e}» is missing. Pass correct holder's ID.`);if(e&&z(e)&&!d.isElement(e))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((t,e)=>t.then(async()=>{try{await this.moduleInstances[e].prepare()}catch(o){if(o instanceof de)throw new Error(o.message);_(`Module ${e} was skipped because of %o`,"warn",o)}}),Promise.resolve())}render(){return this.moduleInstances.Renderer.render(this.config.data.blocks)}constructModules(){Object.entries(Bi).forEach(([t,e])=>{try{this.moduleInstances[t]=new e({config:this.configuration,eventsDispatcher:this.eventsDispatcher})}catch(o){_("[constructModules]",`Module ${t} skipped because`,"error",o)}})}configureModules(){for(const t in this.moduleInstances)Object.prototype.hasOwnProperty.call(this.moduleInstances,t)&&(this.moduleInstances[t].state=this.getModulesDiff(t))}getModulesDiff(t){const e={};for(const o in this.moduleInstances)o!==t&&(e[o]=this.moduleInstances[o]);return e}}/**
|
||
* Editor.js
|
||
*
|
||
* @license Apache-2.0
|
||
* @see Editor.js <https://editorjs.io>
|
||
* @author CodeX Team <https://codex.so>
|
||
*/class Si{static get version(){return"2.28.0"}constructor(t){let e=()=>{};z(t)&&R(t.onReady)&&(e=t.onReady);const o=new Ti(t);this.isReady=o.isReady.then(()=>{this.exportAPI(o),e()})}exportAPI(t){const e=["configuration"],o=()=>{Object.values(t.moduleInstances).forEach(i=>{R(i.destroy)&&i.destroy(),i.listeners.removeAll()}),t=null;for(const i in this)Object.prototype.hasOwnProperty.call(this,i)&&delete this[i];Object.setPrototypeOf(this,null)};e.forEach(i=>{this[i]=t[i]}),this.destroy=o,Object.setPrototypeOf(this,t.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,n])=>{Object.entries(n).forEach(([r,a])=>{this[a]=t.moduleInstances.API.methods[i][r]})})}}const Tt={header:Zt(()=>import("./bundle-72871e75.js").then(s=>s.b),["assets/bundle-72871e75.js","assets/app-front-32dad050.js","assets/app-front-935fc652.css"]),list:Zt(()=>import("./bundle-c20bcf97.js").then(s=>s.b),["assets/bundle-c20bcf97.js","assets/app-front-32dad050.js","assets/app-front-935fc652.css"])},Ii=Ne({name:"vue-editor-js",props:{holder:{type:String,default:()=>"vue-editor-js",require:!0},config:{type:Object,default:()=>({}),require:!0},initialized:{type:Function,default:()=>{}}},setup:(s,t)=>{const e=Re({editor:null});function o(r){i(),e.editor=new Si({holder:r.holder||"vue-editor-js",...r.config,onChange:(a,l)=>{n()}}),r.initialized(e.editor)}function i(){e.editor&&(e.editor.destroy(),e.editor=null)}function n(){console.log("saveEditor"),e.editor&&e.editor.save().then(r=>{console.log(r),t.emit("saved",r)})}return Pe(r=>o(s)),{props:s,state:e}},methods:{useTools(s,t){const e=Object.keys(Tt),o={...s.customTools};return e.every(i=>!s[i])?(e.forEach(i=>o[i]={class:Tt[i]}),Object.keys(t).forEach(i=>{o[i]!==void 0&&o[i]!==null&&(o[i].config=t[i])}),o):(e.forEach(i=>{const n=s[i];if(n&&(o[i]={class:Tt[i]},typeof n=="object")){const r=Object.assign({},s[i]);delete r.class,o[i]=Object.assign(o[i],r)}}),Object.keys(t).forEach(i=>{o[i]!==void 0&&o[i]!==null&&(o[i].config=t[i])}),o)}}}),Mi=["id"];function _i(s,t,e,o,i,n){return Fe(),De("div",{id:s.holder},null,8,Mi)}const Li=Oe(Ii,[["render",_i]]);export{Tt as PLUGINS,Li as default};
|