import{Q as d}from"./quill-Rz6pzzkC.js";/* empty css                   */import"./datatables-Bo82YvhT.js";const c=[["bold","italic","underline"],[{list:"ordered"},{list:"bullet"}],["blockquote"],["link","image"],["clean"]];function m(e,n){const t=document.getElementById(e.textarea);if(!t)return;const i=document.createElement("div");i.className="ticket-quill-editor",t.style.display="none",t.parentNode.insertBefore(i,t);const o=new d(i,{theme:"snow",modules:{toolbar:c},placeholder:n||t.getAttribute("placeholder")||""});t.value.trim()!==""&&o.setText(t.value);const l=()=>{const a=o.getText().trim()===""?"":o.root.innerHTML;t.value=a};o.on("text-change",l),l();const r=e.form?document.getElementById(e.form):t.closest("form");r&&(u(r),r.addEventListener("submit",()=>{l(),s(r,"markdown")}))}function u(e){if(e.querySelector('input[name="content_format"]'))return;const n=document.createElement("input");n.type="hidden",n.name="content_format",n.value="markdown",e.appendChild(n)}function s(e,n){const t=e.querySelector('input[name="content_format"]');t&&(t.value=n)}document.addEventListener("DOMContentLoaded",()=>{const e=window.storeTicketEditor;!e||!Array.isArray(e.editors)||e.editors.forEach(n=>m(n,e.placeholder))});
