"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("@babel/runtime/helpers/taggedTemplateLiteral")),n=String.raw,o=function(e){return n(t||(t=r.default(["<p>","</p>"])),e)},a=function(e,t){return t.reduce((function(e,t){return e.replaceAll("[".concat(t.key,"]"),"".concat(t.label))}),e)},c=function(e){return e.replace(/<[^>]+>/g,"")},l=function(e,t){return t.reduce((function(e,t){return e.replaceAll(t.label,"[".concat(t.key,"]"))}),e)};exports.convertEditorValueToString=function(e,t){var r=c(e);return l(r,t)},exports.convertHtmlToString=c,exports.convertStringToEditorValue=function(e,t){var r=a(e,t);return o(r)},exports.convertStringToHtml=o,exports.getCaret=function(e){var t=0,r=window.getSelection();if(0===r.rangeCount)return t;var n=r.getRangeAt(0),o=n.cloneRange();return o.selectNodeContents(e),o.setEnd(n.endContainer,n.endOffset),t=o.toString().length},exports.getUpdatedHtmlValue=function(e){var t=c(e);return[o(t||""),!t]},exports.replaceStringToLabel=a,exports.replaceStringToValue=l,exports.setCaret=function(e,t){if(e.childNodes[0]){var r=window.getSelection(),n=document.createRange(),o=e.childNodes[0].childNodes[0]||e.childNodes[0];n.setStart(o,t),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}};
//# sourceMappingURL=utils.js.map
