UNPKG

smart-webcomponents-angular

Version:

[![Price](https://img.shields.io/badge/price-COMMERCIAL-0098f7.svg)](https://jqwidgets.com/license/)

6 lines (4 loc) โ€ข 79.9 kB
/* Smart UI v23.1.19 (2025-06-17) Copyright (c) 2011-2024 jQWidgets. License: https://htmlelements.com/license/ */ // (()=>{Smart("smart-text-area",class extends Smart.Input{static get properties(){return{users:{value:[],type:"array",reflectToAttribute:!1},resize:{value:"none",type:"string"},richText:{value:!1,type:"boolean"},enableHTMLEncode:{value:!0,type:"boolean"},minWidth:{value:0,type:"number"},minHeight:{value:0,type:"number"},toolbarOnFocus:{value:!1,type:"boolean"},dataSource:{value:[],type:"array",reflectToAttribute:!1},uploadSettings:{value:{url:{value:"",type:"string",reflectToAttribute:!1},removeUrl:{value:"",type:"string",reflectToAttribute:!1},existsUrl:{value:"",type:"string",reflectToAttribute:!1},name:{value:"userfile[]",type:"string",reflectToAttribute:!1},uploadMaxCount:{value:5,type:"number",reflectToAttribute:!1},uploadMaxSize:{value:2097152,type:"number",reflectToAttribute:!1},data:{value:null,type:"object",reflectToAttribute:!1},onUploadStarted:{value:null,type:"any",reflectToAttribute:!1},onUploadCompleted:{value:null,type:"any",reflectToAttribute:!1},onUploadRemove:{value:null,type:"any",reflectToAttribute:!1},onUploadError:{value:null,type:"any",reflectToAttribute:!1},onChange:{value:null,type:"any",reflectToAttribute:!1},onProgress:{value:null,type:"any",reflectToAttribute:!1},onAbort:{value:null,type:"any",reflectToAttribute:!1},onError:{value:null,type:"any",reflectToAttribute:!1},onSetHeaders:{value:null,type:"any",reflectToAttribute:!1}},reflectToAttribute:!1,type:"object"},toolbarItems:{value:["bold","italic","underline","strikethrough","fontsize","fontname","fontcolor","backgroundcolor","alignment","orderedlist","unorderedlist","checklist","hyperlink","image","tableheader","undo","redo","clearformat"],reflectToAttribute:!1,type:"array"},emojis:{value:[{value:"๐Ÿ˜„",listValue:"๐Ÿ˜„ smile"},{value:"๐Ÿ˜†",listValue:"๐Ÿ˜† laughing"},{value:"๐Ÿ˜Š",listValue:"๐Ÿ˜Š blush"},{value:"๐Ÿ˜ƒ",listValue:"๐Ÿ˜ƒ smiley"},{value:"๐Ÿ˜",listValue:"๐Ÿ˜ smirk"},{value:"๐Ÿ˜",listValue:"๐Ÿ˜ heart_eyes"},{value:"๐Ÿ˜˜",listValue:"๐Ÿ˜˜ kissing_heart"},{value:"๐Ÿ˜š",listValue:"๐Ÿ˜š kissing_closed_eyes"},{value:"๐Ÿ˜ณ",listValue:"๐Ÿ˜ณ flushed"},{value:"๐Ÿ˜Œ",listValue:"๐Ÿ˜Œ relieved"},{value:"๐Ÿ˜†",listValue:"๐Ÿ˜† satisfied"},{value:"๐Ÿ˜",listValue:"๐Ÿ˜ grin"},{value:"๐Ÿ˜‰",listValue:"๐Ÿ˜‰ wink"},{value:"๐Ÿ˜€",listValue:"๐Ÿ˜€ grinning"},{value:"๐Ÿ˜—",listValue:"๐Ÿ˜— kissing"},{value:"๐Ÿ˜™",listValue:"๐Ÿ˜™ kissing_smiling_eyes"},{value:"๐Ÿ˜›",listValue:"๐Ÿ˜› stuck_out_tongue"},{value:"๐Ÿ˜ด",listValue:"๐Ÿ˜ด sleeping"},{value:"๐Ÿ˜Ÿ",listValue:"๐Ÿ˜Ÿ worried"},{value:"๐Ÿ˜ฆ",listValue:"๐Ÿ˜ฆ frowning"},{value:"๐Ÿ˜ง",listValue:"๐Ÿ˜ง anguished"},{value:"๐Ÿ˜ฎ",listValue:"๐Ÿ˜ฎ open_mouth"},{value:"๐Ÿ˜ฌ",listValue:"๐Ÿ˜ฌ grimacing"},{value:"๐Ÿ˜•",listValue:"๐Ÿ˜• confused"},{value:"๐Ÿ˜ฏ",listValue:"๐Ÿ˜ฏ hushed"},{value:"๐Ÿ˜‘",listValue:"๐Ÿ˜‘ expressionless"},{value:"๐Ÿ˜’",listValue:"๐Ÿ˜’ unamused"},{value:"๐Ÿ˜…",listValue:"๐Ÿ˜… sweat_smile"},{value:"๐Ÿ˜“",listValue:"๐Ÿ˜“ sweat"},{value:"๐Ÿ˜ฅ",listValue:"๐Ÿ˜ฅ disappointed_relieved"},{value:"๐Ÿ˜ฉ",listValue:"๐Ÿ˜ฉ weary"},{value:"๐Ÿ˜”",listValue:"๐Ÿ˜” pensive"},{value:"๐Ÿ˜ž",listValue:"๐Ÿ˜ž disappointed"},{value:"๐Ÿ˜–",listValue:"๐Ÿ˜– confounded"},{value:"๐Ÿ˜จ",listValue:"๐Ÿ˜จ fearful"},{value:"๐Ÿ˜ฐ",listValue:"๐Ÿ˜ฐ cold_sweat"},{value:"๐Ÿ˜ฃ",listValue:"๐Ÿ˜ฃ persevere"},{value:"๐Ÿ˜ข",listValue:"๐Ÿ˜ข cry"},{value:"๐Ÿ˜ญ",listValue:"๐Ÿ˜ญ sob"},{value:"๐Ÿ˜‚",listValue:"๐Ÿ˜‚ joy"},{value:"๐Ÿ˜ฒ",listValue:"๐Ÿ˜ฒ astonished"},{value:"๐Ÿ˜ฑ",listValue:"๐Ÿ˜ฑ scream"},{value:"๐Ÿ˜ซ",listValue:"๐Ÿ˜ซ tired_face"},{value:"๐Ÿ˜ ",listValue:"๐Ÿ˜  angry"},{value:"๐Ÿ˜ก",listValue:"๐Ÿ˜ก rage"},{value:"๐Ÿ˜ค",listValue:"๐Ÿ˜ค triumph"},{value:"๐Ÿ˜ช",listValue:"๐Ÿ˜ช sleepy"},{value:"๐Ÿ˜‹",listValue:"๐Ÿ˜‹ yum"},{value:"๐Ÿ˜ท",listValue:"๐Ÿ˜ท mask"},{value:"๐Ÿ˜Ž",listValue:"๐Ÿ˜Ž sunglasses"},{value:"๐Ÿ˜ต",listValue:"๐Ÿ˜ต dizzy_face"},{value:"๐Ÿ‘ฟ",listValue:"๐Ÿ‘ฟ imp"},{value:"๐Ÿ˜ˆ",listValue:"๐Ÿ˜ˆ smiling_imp"},{value:"๐Ÿ˜",listValue:"๐Ÿ˜ neutral_face"},{value:"๐Ÿ˜ถ",listValue:"๐Ÿ˜ถ no_mouth"},{value:"๐Ÿ˜‡",listValue:"๐Ÿ˜‡ innocent"},{value:"๐Ÿ‘ฝ",listValue:"๐Ÿ‘ฝ alien"},{value:"๐Ÿ’›",listValue:"๐Ÿ’› yellow_heart"},{value:"๐Ÿ’™",listValue:"๐Ÿ’™ blue_heart"},{value:"๐Ÿ’œ",listValue:"๐Ÿ’œ purple_heart"},{value:"โค๏ธ",listValue:"โค๏ธ heart"},{value:"๐Ÿ’š",listValue:"๐Ÿ’š green_heart"},{value:"๐Ÿ’”",listValue:"๐Ÿ’” broken_heart"},{value:"๐Ÿ’“",listValue:"๐Ÿ’“ heartbeat"},{value:"๐Ÿ’—",listValue:"๐Ÿ’— heartpulse"},{value:"๐Ÿ’•",listValue:"๐Ÿ’• two_hearts"},{value:"๐Ÿ’ž",listValue:"๐Ÿ’ž revolving_hearts"},{value:"๐Ÿ’˜",listValue:"๐Ÿ’˜ cupid"},{value:"๐Ÿ’–",listValue:"๐Ÿ’– sparkling_heart"},{value:"โœจ",listValue:"โœจ sparkles"},{value:"โญ",listValue:"โญ star"},{value:"๐ŸŒŸ",listValue:"๐ŸŒŸ star2"},{value:"๐Ÿ’ซ",listValue:"๐Ÿ’ซ dizzy"},{value:"๐Ÿ’ฅ",listValue:"๐Ÿ’ฅ boom"},{value:"๐Ÿ’ฅ",listValue:"๐Ÿ’ฅ collision"},{value:"๐Ÿ’ข",listValue:"๐Ÿ’ข anger"},{value:"โ—",listValue:"โ— exclamation"},{value:"โ“",listValue:"โ“ question"},{value:"๐Ÿ’ค",listValue:"๐Ÿ’ค zzz"},{value:"๐Ÿ’จ",listValue:"๐Ÿ’จ dash"},{value:"๐Ÿ’ฆ",listValue:"๐Ÿ’ฆ sweat_drops"},{value:"๐ŸŽถ",listValue:"๐ŸŽถ notes"},{value:"๐ŸŽต",listValue:"๐ŸŽต musical_note"},{value:"๐Ÿ”ฅ",listValue:"๐Ÿ”ฅ fire"},{value:"๐Ÿ’ฉ",listValue:"๐Ÿ’ฉ hankey"},{value:"๐Ÿ’ฉ",listValue:"๐Ÿ’ฉ poop"},{value:"๐Ÿ’ฉ",listValue:"๐Ÿ’ฉ shit"},{value:"๐Ÿ‘",listValue:"๐Ÿ‘ +1"},{value:"๐Ÿ‘",listValue:"๐Ÿ‘ thumbsup"},{value:"๐Ÿ‘Ž",listValue:"๐Ÿ‘Ž +1"},{value:"๐Ÿ‘Ž",listValue:"๐Ÿ‘Ž thumbsdown"},{value:"๐Ÿ‘Œ",listValue:"๐Ÿ‘Œ ok_hand"},{value:"๐Ÿ‘Š",listValue:"๐Ÿ‘Š facepunch"},{value:"โœŠ",listValue:"โœŠ fist"},{value:"โœŒ๏ธ",listValue:"โœŒ๏ธ v"},{value:"๐Ÿ‘‹",listValue:"๐Ÿ‘‹ wave"},{value:"โœ‹",listValue:"โœ‹ raised_hand"},{value:"๐Ÿ‘",listValue:"๐Ÿ‘ open_hands"},{value:"โ˜๏ธ",listValue:"โ˜๏ธ point_up"},{value:"๐Ÿ‘‡",listValue:"๐Ÿ‘‡ point_down"},{value:"๐Ÿ‘ˆ",listValue:"๐Ÿ‘ˆ point_left"},{value:"๐Ÿ‘‰",listValue:"๐Ÿ‘‰ point_right"},{value:"๐Ÿ™Œ",listValue:"๐Ÿ™Œ raised_hands"},{value:"๐Ÿ™",listValue:"๐Ÿ™ pray"},{value:"๐Ÿ‘†",listValue:"๐Ÿ‘† point_up_2"},{value:"๐Ÿ‘",listValue:"๐Ÿ‘ clap"},{value:"๐Ÿ’ช",listValue:"๐Ÿ’ช muscle"},{value:"๐Ÿค˜",listValue:"๐Ÿค˜ metal"},{value:"๐Ÿ–•",listValue:"๐Ÿ–• fu"},{value:"๐Ÿšถ",listValue:"๐Ÿšถ walking"},{value:"๐Ÿƒ",listValue:"๐Ÿƒ runner"},{value:"๐Ÿƒ",listValue:"๐Ÿƒ running"},{value:"๐Ÿ‘ซ",listValue:"๐Ÿ‘ซ couple"},{value:"๐Ÿ‘ช",listValue:"๐Ÿ‘ช family"},{value:"๐Ÿ‘ฌ",listValue:"๐Ÿ‘ฌ two_men_holding_hands"},{value:"๐Ÿ‘ญ",listValue:"๐Ÿ‘ญ two_women_holding_hands"},{value:"๐Ÿ’ƒ",listValue:"๐Ÿ’ƒ dancer"},{value:"๐Ÿ‘ฏ",listValue:"๐Ÿ‘ฏ dancers"},{value:"๐Ÿ™†โ€โ™€๏ธ",listValue:"๐Ÿ™†โ€โ™€๏ธ ok_woman"},{value:"๐Ÿ™…",listValue:"๐Ÿ™… no_good"},{value:"๐Ÿ’",listValue:"๐Ÿ’ information_desk_person"},{value:"๐Ÿ™‹",listValue:"๐Ÿ™‹ raising_hand"},{value:"๐Ÿ‘ฐโ€โ™€๏ธ",listValue:"๐Ÿ‘ฐโ€โ™€๏ธ bride_with_veil"},{value:"๐Ÿ™‡",listValue:"๐Ÿ™‡ bow"},{value:"๐Ÿ’",listValue:"๐Ÿ’ couplekiss"},{value:"๐Ÿ’‘",listValue:"๐Ÿ’‘ couple_with_heart"},{value:"๐Ÿ’†",listValue:"๐Ÿ’† massage"},{value:"๐Ÿ’‡",listValue:"๐Ÿ’‡ haircut"},{value:"๐Ÿ’…",listValue:"๐Ÿ’… nail_care"},{value:"๐Ÿ‘ฆ",listValue:"๐Ÿ‘ฆ boy"},{value:"๐Ÿ‘ง",listValue:"๐Ÿ‘ง girl"},{value:"๐Ÿ‘ฉ",listValue:"๐Ÿ‘ฉ woman"},{value:"๐Ÿ‘จ",listValue:"๐Ÿ‘จ man"},{value:"๐Ÿ‘ถ",listValue:"๐Ÿ‘ถ baby"},{value:"๐Ÿ‘ต",listValue:"๐Ÿ‘ต older_woman"},{value:"๐Ÿ‘ด",listValue:"๐Ÿ‘ด older_man"},{value:"๐Ÿ‘ฒ",listValue:"๐Ÿ‘ฒ man_with_gua_pi_mao"},{value:"๐Ÿ‘ณโ€โ™‚๏ธ",listValue:"๐Ÿ‘ณโ€โ™‚๏ธ man_with_turban"},{value:"๐Ÿ‘ท",listValue:"๐Ÿ‘ท construction_worker"},{value:"๐Ÿ‘ฎ",listValue:"๐Ÿ‘ฎ cop"},{value:"๐Ÿ‘ผ",listValue:"๐Ÿ‘ผ angel"},{value:"๐Ÿ‘ธ",listValue:"๐Ÿ‘ธ princess"},{value:"๐Ÿ˜บ",listValue:"๐Ÿ˜บ smiley_cat"},{value:"๐Ÿ˜ธ",listValue:"๐Ÿ˜ธ smile_cat"},{value:"๐Ÿ˜ป",listValue:"๐Ÿ˜ป heart_eyes_cat"},{value:"๐Ÿ˜ฝ",listValue:"๐Ÿ˜ฝ kissing_cat"},{value:"๐Ÿ˜ผ",listValue:"๐Ÿ˜ผ smirk_cat"},{value:"๐Ÿ™€",listValue:"๐Ÿ™€ scream_cat"},{value:"๐Ÿ˜ฟ",listValue:"๐Ÿ˜ฟ crying_cat_face"},{value:"๐Ÿ˜น",listValue:"๐Ÿ˜น joy_cat"},{value:"๐Ÿ˜พ",listValue:"๐Ÿ˜พ pouting_cat"},{value:"๐Ÿ‘น",listValue:"๐Ÿ‘น japanese_ogre"},{value:"๐Ÿ‘บ",listValue:"๐Ÿ‘บ japanese_goblin"},{value:"๐Ÿ™ˆ",listValue:"๐Ÿ™ˆ see_no_evil"},{value:"๐Ÿ™‰",listValue:"๐Ÿ™‰ hear_no_evil"},{value:"๐Ÿ™Š",listValue:"๐Ÿ™Š speak_no_evil"},{value:"๐Ÿ’‚โ€โ™‚๏ธ",listValue:"๐Ÿ’‚โ€โ™‚๏ธ guardsman"},{value:"๐Ÿ’€",listValue:"๐Ÿ’€ skull"},{value:"๐Ÿพ",listValue:"๐Ÿพ feet"},{value:"๐Ÿ‘„",listValue:"๐Ÿ‘„ lips"},{value:"๐Ÿ’‹",listValue:"๐Ÿ’‹ kiss"},{value:"๐Ÿ’ง",listValue:"๐Ÿ’ง droplet"},{value:"๐Ÿ‘‚",listValue:"๐Ÿ‘‚ ear"},{value:"๐Ÿ‘€",listValue:"๐Ÿ‘€ eyes"},{value:"๐Ÿ‘ƒ",listValue:"๐Ÿ‘ƒ nose"},{value:"๐Ÿ‘…",listValue:"๐Ÿ‘… tongue"},{value:"๐Ÿ””",listValue:"๐Ÿ”” bell"},{value:"๐Ÿ”•",listValue:"๐Ÿ”• no_bell"},{value:"๐ŸŽ‹",listValue:"๐ŸŽ‹ tanabata_tree"},{value:"๐ŸŽ‰",listValue:"๐ŸŽ‰ tada"},{value:"๐ŸŽŠ",listValue:"๐ŸŽŠ confetti_ball"},{value:"๐Ÿ”ฎ",listValue:"๐Ÿ”ฎ crystal_ball"},{value:"โ™ป๏ธ",listValue:"โ™ป๏ธ recycle"},{value:"๐Ÿ”š",listValue:"๐Ÿ”š end"},{value:"๐Ÿ”›",listValue:"๐Ÿ”› on"},{value:"๐Ÿ”œ",listValue:"๐Ÿ”œ soon"}],type:"array",reflectToAttribute:!1}}}template(){return'<div id="inputContainer" role="presentation"><textarea class="smart-input" id=\'input\' readonly=\'[[readonly]]\' placeholder=\'[[placeholder]]\' name=\'[[name]]\' value=\'{{value::keyup}}\' disabled=\'[[disabled]]\' aria-label="[[placeholder]]"></textarea><div id="editor"></div><span class="smart-hidden smart-hint" inner-h-t-m-l="[[hint]]" id="span"></span><div id="dropDownButton" tabindex=-1 class="smart-drop-down-button" role="button" aria-label="Toggle popup"><div id="arrow" class="arrow" aria-hidden="true"></div></div></div>'}_blurHandler(){const e=this;e.richText?e.removeAttribute("focus"):super._blurHandler()}_focusHandler(){const e=this;e.richText&&(e.$.editor.component.focus(),setTimeout((()=>{const t=e.$.editor.value;e.$.editor.selectionStart=t.length}))),super._focusHandler()}setHTML(e){const t=this;if(t.richText)return t.$.editor.value=e;this.value=e.replaceAll("<","&lt;").replaceAll(">","&gt;")}getHTML(){const e=this;return e.richText?e.$.editor?e.$.editor.component.getHTML():"":e.value}propertyChangedHandler(e,t,o){const a=this;"value"===e&&a.richText&&(a.$.editor.value=o),"richText"===e&&a.render(),"users"===e?(delete a._initMenu,a._mentionMenu&&(a._mentionPlugin&&a._mentionPlugin.destroy(),a._mentionMenu.remove(),a._initUsersMention()),a._renderMentionTrigger()):"resize"===e&&(a.richText?a.$.editor.querySelector(".smart-editor-editable").style.resize=o:a.$.input.style.resize=o,a._mentionTrigger&&("none"!==a.resize?a._mentionTrigger.style.right="10px":a._mentionTrigger.style.right="5px"))}detached(){const e=this;delete e._initMenu,e._mentionMenu&&e._mentionMenu.remove()}findMatches(){const e=this.$.input.value.split("").concat([" "]),t=[];let o="";for(let a in e){let i=e[a],n=e[a-1]||" ",l=[" ","\\n"].indexOf(n)>-1||10===n.charCodeAt(0);("@"===i&&l||o.length)&&" "!==i&&(o+=i),o.length&&" "===i&&(t.push({word:o,index:Math.max(a-o.length,0)}),o="")}return t}getMentions(){const e=this,t=this.findMatches(),o=[];return t.forEach((t=>{e.users.forEach((e=>{const a=t.word.replace("@","");e.name===a&&o.push(e)}))})),o}_initUsersMention(){const e=this;if(e._initMenu)return;if(e.richText)return;e._initMenu=!0;const t=document.createElement("div");t.id=e.id+"_mention_menu",t.classList.add("smart-text-area-mention-menu","smart-hidden"),e._mentionMenu=t,document.body.appendChild(t),e._mentionPlugin=new Smart.Mention(e.richText?e.$.editor.querySelector(".smart-editor-editable"):e.$.input,t,(t=>""===t?e.users:e.users.filter((e=>e.name.startsWith(t)))),((e,t)=>e?`${t}${e.name} `:""),((e,t,o)=>{const a=document.createElement("div");return a.setAttribute("role","option"),a.className="smart-text-area-mention-menu-item",o&&(a.classList.add("selected"),a.setAttribute("aria-selected","")),a.textContent=e.name,a.onpointerdown=e=>{e.preventDefault(),t()},a}))}cleanWordHTML(e){let t=document.createElement("div");t.innerHTML=e;["o:p","w:","v:","xml"].forEach((e=>{let o=t.getElementsByTagName(e);for(;o.length>0;)o[0].remove()})),t.querySelectorAll("b").forEach((e=>e.outerHTML=e.outerHTML.replace("<b","<strong").replace("</b>","</strong>"))),t.querySelectorAll("i").forEach((e=>e.outerHTML=e.outerHTML.replace("<i","<em").replace("</i>","</em>"))),t.querySelectorAll("*[style]").forEach((e=>{const t=["color","background-color","font-weight","font-style"],o=e.getAttribute("style");if(o){let a="";o.split(";").forEach((e=>{let[o,i]=e.split(":");o=o&&o.trim(),i=i&&i.trim(),t.includes(o)&&(a+=`${o}: ${i}; `)})),a.trim()?e.setAttribute("style",a.trim()):e.removeAttribute("style")}})),t.innerHTML=t.innerHTML.replace(/(\r?\n|\r)/g,"<br>"),t.innerHTML=t.innerHTML.replace(/(<p>(\s|&nbsp;)*<\/p>\s*){2,}/g,"<p></p>"),t.innerHTML=t.innerHTML.replace(/([^\S\r\n]|&nbsp;){2,}/g," "),t.innerHTML=t.innerHTML.replace(/>\s+</g,"><"),t.innerHTML=t.innerHTML.replaceAll("ยท",""),t.innerHTML=t.innerHTML.replaceAll('class="MsoNormal"',""),t.innerHTML=t.innerHTML.replace(/<!--.*?-->/gs,""),["div","span"].forEach((e=>{let o=t.getElementsByTagName(e);Array.from(o).forEach((e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}))})),t.querySelectorAll("p, div, span").forEach((e=>{e.textContent.trim()||e.querySelector("img")||e.querySelector("a")||e.remove()}));let o=t.innerHTML;return o.replace(/[\u2018\u2019]/g,"'").replace(/[\u201C\u201D]/g,'"').replace(/\u2013/g,"-").replace(/\u2014/g,"--").replace(/\u2026/g,"...").replace(/\u00A0/g," ").replace(/\uFEFF/g,"").replace(/[\u200B-\u200D]/g,"").replace(/[\u202A-\u202E]/g,""),o}_handlePaste(e,t){const o=this,a=navigator.clipboard,i=a.read?"read":"readText",n=()=>{a[i]&&a[i]().then((a=>{if(Array.isArray(a)&&a.length){const i=a[0];let n=i.types.indexOf("text/html")>-1?"text/html":"text/plain";i.getType(n).then((a=>{a.text().then((a=>{(a.indexOf("<div>")>=0||a.indexOf("<span>")>=0||a.indexOf("<p>")>=0)&&(n="text/html"),o._handleTextPaste(a,e,n,t)}))}))}else if("string"==typeof a){let i="text/plain";(a.indexOf("<div>")>=0||a.indexOf("<span>")>=0||a.indexOf("<p>")>=0)&&(i="text/html"),o._handleTextPaste(a,e,i,t)}}))};if(navigator.permissions&&navigator.permissions.query&&!o._isFireFox)try{navigator.permissions.query({name:"clipboard-read"}).then((e=>{("granted"===e.state||"prompt"===e.state&&a[i])&&n()}))}catch(e){o.error(o.localize("permissionsRequired",{elementType:o.nodeName.toLowerCase(),actionName:"paste"}))}else if(a[i])return void n();e.getRootNode().execCommand("paste")}_handleTextPaste(e,t,o,a){const i=this;e=e.replace(/<!--StartFragment-->|<!--EndFragment-->/gi,"");let n;if(!o){const t=document.createElement("div");t.innerHTML=e,e=t.innerText}const l=e.toLocaleLowerCase();if(n=document.createElement("span"),e=i.cleanWordHTML(e),n.innerHTML=e,l.indexOf("<video")>-1||l.indexOf("<iframe")>-1||l.indexOf("smart-editor-image-caption")>-1){const e=n.querySelectorAll("video, iframe"),t=n.querySelector(".smart-editor-image-caption"),o=e.length>0;let a=document.createDocumentFragment();for(let t=0,o=e.length;t<o;t+=1)a.appendChild(e[t]);if(t&&(t.removeAttribute("style"),a.appendChild(t)),o||t){const e=document.createElement("span");n.classList.add("smart-editor-image-container"),o&&n.classList.add("smart-editor-video-container"),n.setAttribute("contenteditable",!1),a.childElementCount&&(n.innerHTML="",n.appendChild(a)),e.appendChild(n),n=e}}const r=a._getSelectionRange(),[s,d]=[window,document];if(r instanceof s.Range){if(r.deleteContents(),n.childNodes.length)for(;n.lastChild;)r.insertNode(n.lastChild);else r.insertNode(n);r.collapse()}else d.execCommand("paste")}_initRichText(e,t,o){const a=this,i=a,n={};if(!e)return;o||(o={undo:"Undo",redo:"Redo",bold:"Bold",italic:"Italic",underline:"Underline",striketrhough:"Strikethrough",fontname:"Font Name",fontsize:"Font Size",alignment:"Alignment",unorderedlist:"Bulleted list",orderedlist:"Numbered list",checklist:"Checklist",paragraph:"Paragraph",format:"Format",image:"Image",h1:"Large Heading",h2:"Medium Heading",h3:"Small Heading",link:"Create link",code:"Code",openLink:"Ctrl + Click to go to link: ",clearformat:"Clear format",backgroundcolor:"Background Color",fontcolor:"Font Color",okButton:"Ok",cancelButton:"Cancel"});const l=`\n <div class="smart-container">\n <div class="smart-editor-toolbar"> \n <div style="height: auto;" class="smart-editor-toolbar-items-primary">\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.bold}" command="bold" item-name="bold"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.italic}" command="italic" item-name="italic"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.underline}" command="underline" item-name="underline"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.striketrhough}" command="strikethrough" item-name="strikethrough"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center smart-arrow-down" item-value="Roboto" item-type="drop-down" item-name="fontname" tooltip="${o.fontname}"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center smart-arrow-down" item-value="14" item-type="drop-down" item-name="fontsize" tooltip="${o.fontsize}"></div>\n <div style="--item-value: var(--smart-primary);" class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="color-input" tooltip="${o.fontcolor}" command="fontcolor" item-name="fontcolor"><span item-name="fontcolor" class="smart-editor-item-action-button"></span></div>\n <div style="--item-value: var(--smart-secondary);" class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="color-input" tooltip="${o.backgroundcolor}" command="backgroundcolor" item-name="backgroundcolor"><span item-name="backgroundcolor" class="smart-editor-item-action-button"></span></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center smart-arrow-down" item-type="button" item-value="left" item-name="alignment" command="justify" tooltip="${o.alignment}"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.unorderedlist}" command="insertUnorderedList" item-name="unorderedlist"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.orderedlist}" command="insertOrderedList" item-name="orderedlist"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.checklist}" command="insertUnorderedList" item-name="checklist"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.link}" command="hyperlink" item-name="hyperlink"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.image}" command="image" item-name="image"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center smart-arrow-down" item-type="button" item-name="tableheader" tooltip="${o.format}"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.undo}" command="undo" item-name="undo"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.redo}" command="redo" item-name="redo"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.clearformat}" command="removeformat" item-name="clearformat"></div>\n </div>\n </div>\n <div class="smart-editor-content-container">\n <div class="smart-editor-editable" contenteditable="true"></div>\n </div>\n </div>\n `,r=e;r.className="smart-editor smart-rich-textarea",r.style.borderLeftWidth=r.style.borderTopWidth=r.style.borderRightWidth=r.style.borderBottomWidth="0px",r.innerHTML=l;const s=r.querySelector(".smart-editor-editable");s.style.resize=a.resize,r.addEventListener("drop",(t=>{if(t.dataTransfer.items){let o=0;const i=5,n=["image/apng","image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/svg+xml","image/tiff","image/webp","image/x-icon","video/x-msvideo","text/csv","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-fontobject","image/gif","application/json","text/plain","application/xml","application/zip","application/gzip","application/pdf","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/x-7z-compressed","application/vnd.rar","application/rtf","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/x-zip-compressed","audio/mpeg","video/mp4","video/mpeg","video/x-msvideo","video/quicktime"];for(let l=0;l<t.dataTransfer.items.length;l++)if("file"===t.dataTransfer.items[l].kind){const r=t.dataTransfer.items[l].getAsFile();if(n.indexOf(r.type)>=0&&(o++,o<=i&&null!==r)){let o=new FileReader;return o.onload=function(t){if(s.getRootNode().execCommand("insertHTML",!1,`<img id="targetImage" src="${t.target.result}"/>`),a.uploadSettings.uploadUrl){const t=s.getRootNode().querySelector("#targetImage");t&&(t.id=""),m(t,r,(o=>{t&&o&&o.length&&(t.src=o[0].medium||o[0].value,t.classList.remove("smart-hidden"),e.imgArray||(e.imgArray=[]),e.imgArrayId||(e.imgArrayId=[]),e.imgArray.push(t.src),e.imgArrayId[t.src]=o[0])}))}},o.readAsDataURL(r),void t.preventDefault()}}}})),r.addEventListener("paste",(t=>{const o=t.clipboardData;if(o&&o.types.length){t.preventDefault();let o=(t.clipboardData||t.originalEvent.clipboardData).items,i=null;for(let e=0;e<o.length;e++)0===o[e].type.indexOf("image")&&(i=o[e].getAsFile());if(null!==i){let t=new FileReader;return t.onload=function(t){if(s.getRootNode().execCommand("insertHTML",!1,`<img id="targetImage" src="${t.target.result}"/>`),a.uploadSettings.uploadUrl){const t=s.getRootNode().querySelector("#targetImage");t&&(t.id=""),m(t,i,(o=>{t&&o&&o.length&&(t.src=o[0].medium||o[0].value,t.classList.remove("smart-hidden"),e.imgArray||(e.imgArray=[]),e.imgArrayId||(e.imgArrayId=[]),e.imgArray.push(t.src),e.imgArrayId[t.src]=o[0])}))}},void t.readAsDataURL(i)}}this._handlePaste(s,n),t.preventDefault()})),a.style.minHeight=a.minHeight+"px",s.style.minHeight=a.minHeight+"px",s.style.minWidth=a.minWidth+"px",e.style.minHeight=a.minHeight+"px",e.style.minWidth=a.minWidth+"px";const d=r.querySelectorAll(".smart-editor-toolbar-item");for(let e=0;e<d.length;e++){const t=d[e],o=t.getAttribute("item-name");-1===a.toolbarItems.indexOf(o)&&t.classList.add("smart-hidden")}if(n.textarea=t,n.tools=[],n.toolbar=r.querySelector(".smart-editor-toolbar"),a.toolbarOnFocus){n.toolbar.id=a.id+"_toolbar";const e=document.createElement("div");e.classList.add("smart-editor"),e.classList.add("smart-editor-toolbar-float"),e.setAttribute("focus",""),e.appendChild(n.toolbar),r.querySelector(".smart-container").setAttribute("toolbar-on-focus",""),a.appendChild(e)}n.contentContainer=r.querySelector(".smart-editor-content-container");const u=document.createElement("div");u.className="smart-editor-tooltip",u.setAttribute("tooltip-position","bottom"),document.body.appendChild(u),n.tooltip=document.querySelector(".smart-editor-tooltip");new ResizeObserver((()=>{if("none"!==a.resize){if(a.style.width=parseInt(s.offsetWidth)+2+"px",a.toolbarOnFocus)return void(a.style.height=parseInt(s.offsetHeight)+2+"px");a.style.height=parseInt(s.offsetHeight)+n.toolbar.offsetHeight+2+"px"}})).observe(s);const c=[],m=(e,t,o)=>{const a=this;if(!e)return;const i=new FormData,n=a.uploadSettings.url;let l=!1;const r=t,s=t.type,d=a.uploadSettings.data;d&&""!==d&&("string"==typeof d?i.append("postData",d):i.append("postData",JSON.stringify(d))),i.append("fileType",s),i.append(a.uploadSettings.name,t),l=!0;let u=new XMLHttpRequest;u.open("POST",n),a.uploadSettings.onSetHeaders&&"function"==typeof a.uploadSettings.onSetHeaders&&a.uploadSettings.onSetHeaders(u,r),a.uploadSettings.onUploadStarted&&a.uploadSettings.onUploadStarted({files:[t],status:u.status}),u.upload.onprogress=function(e){a.uploadSettings.onProgress&&a.uploadSettings.onProgress(e)},u.onabort=function(e){a.uploadSettings.onAbort&&a.uploadSettings.onAbort(e)},u.onerror=function(e){a.uploadSettings.onError&&a.uploadSettings.onError(e)},u.onload=function(){let e=!1;if(u.response&&("string"==typeof u.response?(e=u.response,e.indexOf("[{")>=0&&(e=JSON.parse(u.response))):e=JSON.parse(u.response)),u.status>=200&&u.status<=299){const i=(e,t)=>{if(e.response&&e.response.response&&"success"!==e.response.response)return null;let o=!1;u.fileURL&&(o=u.file_url);let a={};e&&e.file_url?o=e.file_url:e&&e[0]&&e[0].file_url&&(o=e[0].file_url);let i=!1;e&&e.file_url_small?i=e.file_url_small:e&&e[0]&&e[0].file_url_small&&(i=e[0].file_url_small);let n=!1;e&&e.file_url_medium?n=e.file_url_medium:e&&e[0]&&e[0].file_url_medium&&(n=e[0].file_url_medium);let l=!1;return e&&e.file_url_large?l=e.file_url_large:e&&e[0]&&e[0].file_url_large&&(l=e[0].file_url_large),o&&(a.value=o),i&&(a.small=i),n&&(a.medium=n),l&&(a.large=l),a.label=t,a},n=[t];for(let t=0;t<n.length;t++){const o=n[t].name?[]:n[t].split("/"),l="url"===s?o[o.length-1]:n[t].name;a.uploadSettings.url;const r=i((e.files||e[0]&&e[0].files||[e[0]])[t],l);r&&c.push(r)}o(c,e)}else o(c,e)},u.onreadystatechange=function(){},u.send(i)};d.forEach((t=>{const l=t.getAttribute("item-name");n.tools[l]={element:t,type:"button"},t.onmouseenter=e=>{setTimeout((()=>{const t=e.target.getAttribute("tooltip"),o=e.target.getBoundingClientRect(),i=(n.toolbar.getBoundingClientRect(),e=>e?e.offsetTop+i(e.offsetParent):0),l=e=>e?e.offsetLeft+l(e.offsetParent):0,r=(s=e.target,{left:l(s),top:i(s)});var s;n.tooltip.style.top=5+r.top+o.height+"px",n.tooltip.setAttribute("hover-tooltip",t),n.tooltip.classList.add("open"),n.tooltip.style.left=r.left+o.width/2-n.tooltip.offsetWidth/2+"px",a._tooltipTimer&&clearTimeout(a._tooltipTimer),a._tooltipTimer=setTimeout((()=>{n.tooltip.classList.remove("open")}),1e3)}),150)},t.onmouseleave=()=>{n.tooltip.classList.remove("open")},t.onpointerup=e=>(e.preventDefault(),e.stopPropagation(),!1),t.onpointerdown=t=>{const l=t.target.getAttribute("item-name"),s=(t.target.getAttribute("item-value"),t.target.getAttribute("command")),d=t.target.getAttribute("command-value"),u=r.querySelector(".smart-editor-editable"),c=e=>{if(!e||"tableheader"===e){const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="tableheader"]'):r.querySelector('[item-name="tableheader"]');e._popup&&(e._popup.remove(),delete e._popup)}if(!e||"alignment"===e){const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="alignment"]'):r.querySelector('[item-name="alignment"]');e._popup&&(e._popup.remove(),delete e._popup)}if(!e||"fontsize"===e){const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="fontsize"]'):r.querySelector('[item-name="alignment"]');e._popup&&(e._popup.remove(),delete e._popup)}if(!e||"fontname"===e){const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="fontname"]'):r.querySelector('[item-name="alignment"]');e._popup&&(e._popup.remove(),delete e._popup)}if(!e||"fontcolor"===e){const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="fontcolor"]'):r.querySelector('[item-name="fontcolor"]');e._popup&&(e._popup.remove(),delete e._popup)}if(!e||"backgroundcolor"===e){const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="backgroundcolor"]'):r.querySelector('[item-name="backgroundcolor"]');e._popup&&(e._popup.remove(),delete e._popup)}};if("tableheader"!==l)if("fontcolor"!==l&&"backgroundcolor"!==l)if("alignment"!==l)if("fontsize"!==l)if("fontname"!==l){switch(c(),t.target.hasAttribute("checked")?t.target.removeAttribute("checked"):t.target.setAttribute("checked",""),l){case"bold":case"italic":case"underline":case"strikethrough":case"unorderedlist":case"checklist":case"orderedlist":case"undo":case"redo":u.getRootNode().execCommand(s,!1,null);break;case"removeformat":case"clearformat":u.getRootNode().execCommand("removeformat",!1,null);break;case"image":{const t=document.createElement("input");t.type="file",t.accept="image/jpeg, image/png, image/gif",t.hidden=!0,document.body.appendChild(t);n._getSelectionRange();u.getRootNode().execCommand("insertHTML",!1,'<img style="max-width: 100%;" class="smart-hidden" id="targetImage"/>'),t.click(),t.onchange=()=>{const o=u.getRootNode().getElementById("targetImage"),i=t.files[0];o.id="",o.classList.add("smart-hidden");const n=new FileReader;n.addEventListener("load",(function(){o.src=n.result,o.classList.remove("smart-hidden")})),i&&n.readAsDataURL(i),a.uploadSettings.uploadUrl&&m(o,i,(t=>{t&&t.length&&(o.src=t[0].medium||t[0].value,o.classList.remove("smart-hidden"),e.imgArray||(e.imgArray=[]),e.imgArrayId||(e.imgArrayId=[]),e.imgArray.push(o.src),e.imgArrayId[o.src]=t[0])}))};break}case"hyperlink":{if(i._activeAnchorMenu)return t.preventDefault(),void t.stopPropagation();const e=n._getSelectionRange();let l,r=e.startContainer;r&&"a"!==r.nodeName.toLowerCase()&&(r=r.parentElement);let s=!1;if(r&&"a"===r.nodeName.toLowerCase()?(l=r.textContent,s=!0):l=e.toString(),s){if(void 0!==l){const e=h(a.id+"_anchor",l,r);i._activeAnchorMenu=e;const t=f(document),s=t.getRange();e.onselectitem=(e,a,i)=>{if(u.focus(),t.selectRange(s),e=(e=e.replace("https://","")).replace("http://",""),i)return r.remove(),void u.getRootNode().execCommand("insertHTML",!1,a);r.innerHTML=a,r.href="https://"+e.trim()+'"',r.title=o.openLink+"https://"+e.trim(),setTimeout((()=>{let e=n._getSelectionRange().startContainer;e&&"a"!==e.nodeName.toLowerCase()&&(e=e.parentElement),e&&"a"===e.nodeName.toLowerCase()&&(e.onmouseenter=t=>{t.ctrlKey&&e.classList.add("ctrl")},e.onmousemove=t=>{t.ctrlKey&&e.classList.add("ctrl")},e.onmouseleave=()=>{e.classList.remove("ctrl")})}),50)}}}else if(void 0!==l){const e=h(a.id+"_anchor",l);i._activeAnchorMenu=e;const t=f(document),r=t.getRange();e.onselectitem=(e,a)=>{u.focus(),t.selectRange(r),e=(e=e.replace("https://","")).replace("http://",""),u.getRootNode().execCommand("insertHTML",!1,'<a title="'+o.openLink+"https://"+e.trim()+'" href="https://'+e.trim()+'">'+a+"</a>"),setTimeout((()=>{let e=n._getSelectionRange().startContainer;e&&"a"!==e.nodeName.toLowerCase()&&(e=e.parentElement),e&&"a"===e.nodeName.toLowerCase()&&(e.onmouseenter=t=>{t.ctrlKey&&e.classList.add("ctrl")},e.onmousemove=t=>{t.ctrlKey&&e.classList.add("ctrl")},e.onmouseleave=()=>{e.classList.remove("ctrl")})}),50)}}break}case"h1":case"h2":case"h3":case"p":case"pre":case"justify":case"formats":u.getRootNode().execCommand(s,!1,d)}if("checklist"===l){const e=window.getSelection();if(e.focusNode){const t=e.focusNode.parentElement.closest("ul");t&&t.setAttribute("checklist","")}}t.preventDefault(),t.stopPropagation()}else{t.preventDefault(),t.stopPropagation(),c("fontcolor"),c("backgroundcolor"),c("tableheader"),c("alignment"),c("fontsize");const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="fontname"]'):r.querySelector('[item-name="fontname"]');if(e._popup)e._popup.remove(),delete e._popup;else{e._popup=document.createElement("div");const t=e._popup;document.body.appendChild(t),t.style.position="absolute",t.style.height="auto",t.style.width="auto",t.style.paddingLeft=t.style.paddingLeft=t.style.paddingRight=t.style.paddingBottom=t.style.paddingTop="5px",t.style.background="var(--smart-background)",t.style.borderStyle="solid",t.style.borderWidth="1px",t.style.borderColor="var(--smart-border)",t.style.boxShadow="var(--smart-elevation-8)",t.style.zIndex=99999;const o=e.getBoundingClientRect();t.style.top=o.bottom+"px",t.style.left=o.left+"px",t.innerHTML='\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'Roboto\'" command="fontname" command-value="roboto" item-name="fontname" item-value="roboto">Roboto</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'Segoe UI\'" command="fontname" command-value="segoeUi" item-name="fontname" item-value="segoeUi">Segoe UI</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'Arial\'" command="fontname" command-value="arial" item-name="fontname" item-value="arial">Arial</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'georgia\'" command="fontname" command-value="georgia" item-name="fontname" item-value="georgia">Georgia</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'impact\'" command="fontname" command-value="impact" item-name="fontname" item-value="impact">Impact</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'tahoma\'" command="fontname" command-value="tahoma" item-name="fontname" item-value="tahoma">Tahoma</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'timesNewRoman\'" command="fontname" command-value="timesNewRoman" item-name="timesNewRoman" item-value="timesNewRoman">Times New Roman</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-family: \'verdana\'" command="fontname" command-value="verdana" item-name="fontname" item-value="verdana">Verdana</div>\n ',t.querySelectorAll(".smart-button").forEach((t=>{t.onpointerup=t=>(t.preventDefault(),t.stopPropagation(),e._popup.remove(),delete e._popup,!1),t.onpointerdown=e=>{e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("command"),o=e.target.getAttribute("command-value");r.querySelector(".smart-editor-editable").getRootNode().execCommand(t,!1,o)}}))}}else{t.preventDefault(),t.stopPropagation(),c("fontcolor"),c("backgroundcolor"),c("tableheader"),c("alignment"),c("fontname");const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="fontsize"]'):r.querySelector('[item-name="fontsize"]');if(e._popup)e._popup.remove(),delete e._popup;else{e._popup=document.createElement("div");const t=e._popup;document.body.appendChild(t),t.style.position="absolute",t.style.height="auto",t.style.width="50px",t.style.paddingLeft=t.style.paddingLeft=t.style.paddingRight=t.style.paddingBottom=t.style.paddingTop="5px",t.style.background="var(--smart-background)",t.style.borderStyle="solid",t.style.borderWidth="1px",t.style.borderColor="var(--smart-border)",t.style.boxShadow="var(--smart-elevation-8)",t.style.zIndex=99999;const o=e.getBoundingClientRect();t.style.top=o.bottom+"px",t.style.left=o.left+"px",t.innerHTML='\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 8;" command="fontSize" command-value="8" item-name="8" item-value="8">8</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 10;" command="fontSize" command-value="10" item-name="10" item-value="10">10</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 12;" command="fontSize" command-value="12" item-name="12" item-value="12">12</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 14;" command="fontSize" command-value="14" item-name="14" item-value="14">14</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 16;" command="fontSize" command-value="16" item-name="16" item-value="16">16</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 18;" command="fontSize" command-value="18" item-name="18" item-value="18">18</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 24;" command="fontSize" command-value="24" item-name="24" item-value="24">24</div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" style="padding-left: 5px; padding-right: 5px; justify-content: flex-start; font-size: 36;" command="fontSize" command-value="36" item-name="36" item-value="36">36</div>\n ',t.querySelectorAll(".smart-button").forEach((t=>{t.onpointerup=t=>(t.preventDefault(),t.stopPropagation(),e._popup.remove(),delete e._popup,!1),t.onpointerdown=e=>{e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("command"),o=e.target.getAttribute("command-value");r.querySelector(".smart-editor-editable").getRootNode().execCommand(t,!1,3),function(){const e=n._getSelectionRange();if(e.commonAncestorContainer.closest){const t=e.commonAncestorContainer.querySelectorAll("font[size]");for(let e=0,a=t.length;e<a;e+=1){const a=t[e];a.removeAttribute("size"),a.style.fontSize=o+"px"}}else{const e=window.getSelection().focusNode;if(!e)return;const t=e.closest?e.closest(".smart-editor-editable font"):e.parentElement;"font"===t.nodeName.toLowerCase()&&(t.removeAttribute("size"),t.style.fontSize=o+"px")}}()}}))}}else{t.preventDefault(),t.stopPropagation(),c("fontcolor"),c("backgroundcolor"),c("tableheader"),c("fontsize"),c("fontname");const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="alignment"]'):r.querySelector('[item-name="alignment"]');if(e._popup)e._popup.remove(),delete e._popup;else{e._popup=document.createElement("div");const t=e._popup;document.body.appendChild(t),t.style.position="absolute",t.style.height="auto",t.style.width="30px",t.style.background="var(--smart-background)",t.style.borderStyle="solid",t.style.borderWidth="1px",t.style.borderColor="var(--smart-border)",t.style.boxShadow="var(--smart-elevation-8)",t.style.zIndex=99999;const a=e.getBoundingClientRect();t.style.top=a.bottom+"px",t.style.left=a.left+"px",t.innerHTML=`\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.alignLeft}" command="justify" command-value="Left" item-name="alignment" item-value="left"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.alignCenter}" command="justify" command-value="Center" item-name="alignment" item-value="center"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.alignRight}" command="justify" command-value="Right" item-name="alignment" item-value="right"></div>\n <div class="smart-button smart-editor-toolbar-item smart-editor-toolbar-item-center" item-type="button" tooltip="${o.alignJustify}" command="justify" command-value="Full" item-name="alignment" item-value="justify"></div>\n `,t.querySelectorAll(".smart-button").forEach((t=>{t.onpointerup=t=>(t.preventDefault(),t.stopPropagation(),e._popup.remove(),delete e._popup,!1),t.onpointerdown=e=>{e.preventDefault(),e.stopPropagation();const t=e.target.getAttribute("command"),o=e.target.getAttribute("command-value");r.querySelector(".smart-editor-editable").getRootNode().execCommand(t+o,!1,null)}}))}}else{t.preventDefault(),t.stopPropagation(),c();const e=a.toolbarOnFocus?document.querySelector("#"+a.id+'_toolbar [item-name="'+l+'"]'):r.querySelector('[item-name="'+l+'"]');if(e._popup)e._popup.remove(),delete e._popup;else{e._popup=document.createElement("div");const t=e._popup;document.body.appendChild(t),t.style.position="absolute",t.style.height="auto",t.style.width="auto",t.style.background="var(--smart-background)",t.style.borderStyle="solid",t.style.borderWidth="1px",t.style.borderColor="var(--smart-border)",t.style.boxShadow="var(--smart-elevation-8)",t.style.zIndex=99999;const o=e.getBoundingClientRect();t.style.top=o.bottom+"px",t.style.left=o.left+"px",t.innerHTML="<style>\n \n.smart-editor-color-picker table {\n margin: 0;\n padding: 4px 4px 4px;\n empty-cells: show;\n border-collapse: separate;\n}\n\n.smart-editor-color-picker td {\n border-collapse: separate;\n border: 1px solid transparent;\n cursor: pointer;\n margin: 0;\n position: relative;\n}\n\n.smart-editor-color-picker td:hover {\n border: 1px solid #000;\n}\n\n.smart-editor-color-picker-selected-cell {\n outline: 1px solid #000;\n}\n\n.smart-editor-color-picker td div {\n width: 16px;\n height: 16px;\n}\n </style>",t.innerHTML+='<div tool-name="'+l+'" class="smart-editor-color-picker"><div role="grid"><table class="smart-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (0, 0, 0)"><div title="RGB (0, 0, 0)" style="background-color: rgb(0, 0, 0);"></div></td><td aria-label="RGB (68, 68, 68)"><div title="RGB (68, 68, 68)" style="background-color: rgb(68, 68, 68);"></div></td><td aria-label="RGB (102, 102, 102)"><div title="RGB (102, 102, 102)" style="background-color: rgb(102, 102, 102);"></div></td><td aria-label="RGB (153, 153, 153)"><div title="RGB (153, 153, 153)" style="background-color: rgb(153, 153, 153);"></div></td><td aria-label="RGB (204, 204, 204)"><div title="RGB (204, 204, 204)" style="background-color: rgb(204, 204, 204);"></div></td><td aria-label="RGB (238, 238, 238)"><div title="RGB (238, 238, 238)" style="background-color: rgb(238, 238, 238);"></div></td><td aria-label="RGB (243, 243, 243)"><div title="RGB (243, 243, 243)" style="background-color: rgb(243, 243, 243);"></div></td><td aria-label="RGB (255, 255, 255)"><div title="RGB (255, 255, 255)" style="background-color: rgb(255, 255, 255);"></div></td></tr></tbody></table></div><div role="grid"><table class="smart-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (255, 0, 0)"><div title="RGB (255, 0, 0)" style="background-color: rgb(255, 0, 0);"></div></td><td aria-label="RGB (255, 153, 0)"><div title="RGB (255, 153, 0)" style="background-color: rgb(255, 153, 0);"></div></td><td aria-label="RGB (255, 255, 0)"><div title="RGB (255, 255, 0)" style="background-color: rgb(255, 255, 0);"></div></td><td aria-label="RGB (0, 255, 0)"><div title="RGB (0, 255, 0)" style="background-color: rgb(0, 255, 0);"></div></td><td aria-label="RGB (0, 255, 255)"><div title="RGB (0, 255, 255)" style="background-color: rgb(0, 255, 255);"></div></td><td aria-label="RGB (0, 0, 255)"><div title="RGB (0, 0, 255)" style="background-color: rgb(0, 0, 255);"></div></td><td aria-label="RGB (153, 0, 255)"><div title="RGB (153, 0, 255)" style="background-color: rgb(153, 0, 255);"></div></td><td aria-label="RGB (255, 0, 255)"><div title="RGB (255, 0, 255)" style="background-color: rgb(255, 0, 255);"></div></td></tr></tbody></table></div><div role="grid"><table class="smart-editor-color-picker-table" cellspacing="0" cellpadding="0"><tbody><tr><td aria-label="RGB (244, 204, 204)"><div title="RGB (244, 204, 204)" style="background-color: rgb(244, 204, 204);"></div></td><td aria-label="RGB (252, 229, 205)"><div title="RGB (252, 229, 205)" style="background-color: rgb(252, 229, 205);"></div></td><td aria-label="RGB (255, 242, 204)"><div title="RGB (255, 242, 204)" style="background-color: rgb(255, 242, 204);"></div></td><td aria-label="RGB (217, 234, 211)"><div title="RGB (217, 234, 211)" style="background-color: rgb(217, 234, 211);"></div></td><td aria-label="RGB (208, 224, 227)"><div title="RGB (208, 224, 227)" style="background-color: rgb(208, 224, 227);"></div></td><td aria-label="RGB (207, 226, 243)"><div title="RGB (207, 226, 243)" style="background-color: rgb(207, 226, 243);"></div></td><td aria-label="RGB (217, 210, 233)"><div title="RGB (217, 210, 233)" style="background-color: rgb(217, 210, 233);"></div></td><td aria-label="RGB (234, 209, 220)"><div title="RGB (234, 209, 220)" style="background-color: rgb(234, 209, 220);"></div></td></tr><tr><td id="T-Kw-Jn88" aria-label="RGB (234, 153, 153)"><div title="RGB (234, 153, 153)" style="background-color: rgb(234, 153, 153);"></div></td><td aria-label="RGB (249, 203, 156)"><div title="RGB (249, 203, 156)" style="background-color: rgb(249, 203, 156);"></div></td><td aria-label="RGB (255, 229, 153)"><div title="RGB (255, 229, 153)" style="background-color: rgb(255, 229, 153);"></div></td><td aria-label="RGB (182, 215, 168)"><div title="RGB (182, 215, 168)" style="background-color: rgb(182, 215, 168);"></div></td><td aria-label="RGB (162, 196, 201)"><div title="RGB (162, 196, 201)" style="background-color: rgb(162, 196, 201);"></div></td><td aria-label="RGB (159, 197, 232)"><div title="RGB (159, 197, 232)" style="background-color: rgb(159, 197, 232);"></div></td><td aria-label="RGB (180, 167, 214)"><div title="RGB (180, 167, 214)" style="background-color: rgb(180, 167, 214);"></div></td><td aria-label="RGB (213, 166, 189)"><div title="RGB (213, 166, 189)" style="background-color: rgb(213, 166, 189);"></div></td></tr><tr><td aria-label="RGB (224, 102, 102)"><div title="RGB (224, 102, 102)" style="background-color: rgb(224, 102, 102);"></div></td><td aria-label="RGB (246, 178, 107)"><div title="RGB (246, 178, 107)" style="background-color: rgb(246, 178, 107);"></div></td><td aria-label="RGB (255, 217, 102)"><div title="RGB (255, 217, 102)" style="background-color: rgb(255, 217, 102);"></div></td><td aria-label="RGB (147, 196, 125)"><div title="RGB (147, 196, 125)" style="background-color: rgb(147, 196, 125);"></div></td><td aria-label="RGB (118, 165, 175)"><div title="RGB (118, 165, 175)" style="background-color: rgb(118, 165, 175);"></div></td><td aria-label="RGB (111, 168, 220)"><div title="RGB (111, 168, 220)" style="background-color: rgb(111, 168, 220);"></div></td><td aria-label="RGB (142, 124, 195)"><div title="RGB (142, 124, 195)" style="background-color: rgb(142, 124, 195);"></div></td><td aria-label="RGB (194, 123, 160)"><div title="RGB (194, 123, 160)" style="background-color: rgb(194, 123, 160);"></div></td></tr><tr><td id="T-Kw-Jn104" aria-label="RGB (204, 0, 0)"><div title="RGB (204, 0, 0)" style="background-color: rgb(204, 0, 0);"></div></td><td aria-label="RGB (230, 145, 56)"><div title="RGB (230, 145, 56)" style="background-color: rgb(230, 145, 56);"></div></td><td aria-label="RGB (241, 194, 50)"><div title="RGB (241, 194, 50)" style="background-color: rgb(241, 194, 50);"></div></td><td aria-label="RGB (106, 168, 79)"><div title="RGB (106, 168, 79)" style="background-color: rgb(106, 168, 79);"></div></td><td aria-label="RGB (69, 129, 142)"><div title="RGB (69, 129, 142)" style="background-color: rgb(69, 129, 142);"></div></td><td aria-label="RGB (61, 133, 198)"><div title="RGB (61, 133, 198)" style="background-color: rgb(61, 133, 198);"></div></td><td aria-label="RGB (103, 78, 167)"><div title="RGB (103, 78, 167)" style="background-color: rgb(103, 78, 167);"></div></td><td aria-label="RGB (166, 77, 121)"><div title="RGB (166, 77, 121)" style="background-color: rgb(166, 77, 121);"></div></td></tr><tr><td aria-label="RGB (153, 0, 0)"><div title="RGB (153, 0, 0)" style="background-color: rgb(153, 0, 0);"></div></td><td aria-label="RGB (180, 95, 6)"><div title="RGB (180, 95, 6)" style="background-color: rgb(180, 95, 6);"></div></td><td aria-label="RGB (191, 144, 0)"><div title="RGB (191, 144, 0)" style="background-color: rgb(191, 144, 0);"></div></td><td aria-label="RGB (56, 118, 29)"><div title="RGB (56, 118, 29)" style="background-color: rgb(56, 118, 29);"></div></td><td aria-label="RGB (19, 79, 92)"><div title="RGB (19, 79, 92)" style="background-color: rgb(19, 79, 92);"></div></td><td aria-label="RGB (11, 83, 148)"><div title="RGB (11, 83, 148)" style="background-color: rgb(11, 83, 148);"></div></td><td aria-label="RGB (53, 28, 117)"><div title="RGB (53, 28, 117)" style="background-color: rgb(53, 28, 117);"></div></td><td aria-label="RGB (116, 27, 71)"><div title="RGB (116, 27, 71)" styl