gzkx-package 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";var e=Object.defineProperty,t=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),i=require("antd"),s=require("axios"),o=require("lodash"),l=require("dayjs"),a=require("pinyin-pro");var c="undefined"!=typeof document?document.currentScript:null;function u(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const h=u(r),d="currentUserId",f=(e,t)=>{if(t)return`user_${t}_${e}`;const n=localStorage.getItem(d);return n?`user_${n}_${e}`:e},p={setCurrentUserId:e=>{localStorage.setItem(d,e)},getCurrentUserId:()=>localStorage.getItem(d),getToken:()=>localStorage.getItem(f("token")),setToken:e=>{localStorage.setItem(f("token"),e)},getRefreshToken:()=>localStorage.getItem(f("refreshToken")),setRefreshToken:e=>{localStorage.setItem(f("refreshToken"),e)},removeToken:()=>{const e=p.getCurrentUserId();e&&(localStorage.removeItem(f("token",e)),localStorage.removeItem(f("userInfo",e)),localStorage.removeItem(f("refreshToken",e)))},isLoggedIn:()=>!!localStorage.getItem(f("token")),getUserInfo:()=>{const e=localStorage.getItem(f("userInfo"));return e?JSON.parse(e):null},setUserInfo:e=>{(null==e?void 0:e.userId)&&p.setCurrentUserId(e.userId),localStorage.setItem(f("userInfo"),JSON.stringify(e))},setOrgList:e=>{localStorage.setItem(f("orgList"),JSON.stringify(e))},getOrgList:()=>localStorage.getItem(f("orgList")),setFunctionAuth:e=>{localStorage.setItem(f("functionAuth"),JSON.stringify(e))},getFunctionAuth:()=>JSON.parse(localStorage.getItem(f("functionAuth"))||"[]"),setAppInfo:e=>{localStorage.setItem(f("appInfo"),JSON.stringify(e))},getAppInfo:()=>JSON.parse(localStorage.getItem(f("appInfo"))||"[]"),setOrgInfo:e=>{localStorage.setItem(f("orgInfo"),JSON.stringify(e))},getOrgInfo:()=>JSON.parse(localStorage.getItem(f("orgInfo"))||"{}"),setDeptInfo:e=>{localStorage.setItem(f("deptInfo"),JSON.stringify(e))},getDeptInfo:()=>JSON.parse(localStorage.getItem(f("deptInfo"))||"{}"),setMenu:e=>{localStorage.setItem(f("menu"),JSON.stringify(e))},getMenu:()=>JSON.parse(localStorage.getItem(f("menu"))||"[]"),setLoginConfig:e=>{localStorage.setItem("loginConfig",JSON.stringify(e))},getLoginConfig:()=>{const e=localStorage.getItem("loginConfig");return e?JSON.parse(e):null},setFavicon:e=>{try{if(!e){const t=p.getLoginConfig();e=null==t?void 0:t.loginIcon}if(!e)return;document.querySelectorAll('link[rel*="icon"]').forEach(e=>e.remove());const t=document.createElement("link");t.rel="icon",t.type="image/png",t.href=`data:image/png;base64,${e}`,document.head.appendChild(t)}catch(t){}},setWebTitle:e=>{try{if(!e){const t=p.getLoginConfig();e=null==t?void 0:t.webTitle}e&&(document.title=e)}catch(t){}},clearAuth:()=>{const e=p.getCurrentUserId();e&&(localStorage.removeItem(f("token",e)),localStorage.removeItem(f("userInfo",e)),localStorage.removeItem(f("refreshToken",e)),localStorage.removeItem(f("orgList",e)),localStorage.removeItem(f("functionAuth",e)),localStorage.removeItem(f("appInfo",e)),localStorage.removeItem(f("orgInfo",e)),localStorage.removeItem(f("deptInfo",e)),localStorage.removeItem(f("menu",e)),localStorage.removeItem(f("menu-storage",e)),localStorage.removeItem(d)),localStorage.removeItem("loginConfig")}},m=("undefined"==typeof document?require("url").pathToFileURL(__filename).href:c&&"SCRIPT"===c.tagName.toUpperCase()&&c.src||new URL("index.cjs",document.baseURI).href,"/api"),g=Number(void 0!=={url:"undefined"==typeof document?require("url").pathToFileURL(__filename).href:c&&"SCRIPT"===c.tagName.toUpperCase()&&c.src||new URL("index.cjs",document.baseURI).href}?"15000":1e4);"undefined"==typeof document?require("url").pathToFileURL(__filename).href:c&&"SCRIPT"===c.tagName.toUpperCase()&&c.src||new URL("index.cjs",document.baseURI).href;let b=!1,v=[];const y=e=>{v.forEach(t=>t(e)),v=[]},x=["/image/generateValidateCode","/sso/doLogin","/sso/refreshToken"],w=[],N=()=>{w.forEach(e=>{e.cancel("请求被取消:token已过期")}),w.length=0},E=s.create({baseURL:m,timeout:g,headers:{"Content-Type":"application/json"}}),A=async()=>{try{const e=await s.post(`${m}/account/sso/refreshToken`,{refreshToken:p.getRefreshToken()},{headers:{"Content-Type":"application/json"}});return e.data&&"object"==typeof e.data?e.data:e}catch(e){throw e}};function k(e,t,n){return E.post(e,t,n)}function S(e,t){return k(t,e)}function C(e,t){return function(e,t,n){return E.get(e,{params:t,...n})}(t,e)}E.interceptors.request.use(e=>{if(!x.some(t=>{var n;return null==(n=e.url)?void 0:n.includes(t)})){const t=p.getToken();if(!p.getRefreshToken())return i.Modal.confirm({title:"登录提示",content:"您还未登录,请先登录后再进行操作",okText:"前往登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("请先登录"));e.headers.Authorization=`Bearer ${t}`,e.headers.accessToken=`${t}`}const t=s.CancelToken.source();return e.cancelToken=t.token,w.push(t),e},e=>Promise.reject(e)),E.interceptors.response.use(async e=>{const{data:t,config:n}=e,r=w.findIndex(e=>e.token===n.cancelToken);if(r>-1&&w.splice(r,1),"blob"===n.responseType)return e;if(200===t.code)return t;if(461===t.code)return p.clearAuth(),N(),i.Modal.confirm({title:"登录已过期",content:"您的登录状态已过期,请重新登录后继续操作",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("登录已过期"));if(401!==t.code)return i.Modal.confirm({title:"操作提示",content:t.msg||`请求失败,错误码:${t.code}`,okText:"确定",cancelButtonProps:{style:{display:"none"}},onOk:()=>{}}),t;N();try{const e=await A();if(200===e.code){const t=e.data.accessToken;return p.setToken(t),y(t),n.headers.Authorization=`Bearer ${t}`,n.headers.accessToken=t,E(n)}return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("刷新token失败"))}catch(s){return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(s)}finally{b=!1}},async e=>{if(s.isCancel(e))return Promise.reject(e);if(e.response){const{status:n,config:r}=e.response;if(401===n&&!x.some(e=>{var t;return null==(t=r.url)?void 0:t.includes(e)})){if(b)return new Promise(e=>{var t;t=t=>{r.headers.Authorization=`Bearer ${t}`,r.headers.accessToken=t,e(E(r))},v.push(t)});b=!0;try{const e=await A();if(200===e.code){const t=e.data.accessToken;return p.setToken(t),y(t),r.headers.Authorization=`Bearer ${t}`,r.headers.accessToken=t,E(r)}return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("刷新token失败"))}catch(t){return p.clearAuth(),i.Modal.confirm({title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",cancelText:"取消",onOk:()=>{window.location.href="/login"}}),Promise.reject(t)}finally{b=!1}}}else e.request&&i.Modal.confirm({title:"网络异常",content:"请求超时或网络不可用,请检查您的网络连接后重试",okText:"确定",cancelText:"取消",onOk:()=>{}});return Promise.reject(e)});const j="_smartSelectDropdown_srnp9_2",_=({dataSource:e,treeData:t,width:s="100%",dropdownWidth:o,multiple:l=!1,placeholder:a="请选择",allowClear:c=!0,disabled:u=!1,fieldNames:h,selectProps:d,treeSelectProps:f,value:p,onChange:m,className:g,...b})=>{const v=e||t||[],{maxTagCount:y,maxTagPlaceholder:x,showSearch:w,filterOption:N,filterTreeNode:E,treeCheckable:A,treeDefaultExpandAll:k,treeDefaultExpandedKeys:S,treeNodeFilterProp:C,..._}=b,q=r.useMemo(()=>{if(!v||!Array.isArray(v)||0===v.length)return 0;if(!v.some(e=>(e=>{const t=e[(null==h?void 0:h.children)||"children"];return Array.isArray(t)&&t.length>0})(e)))return 1;const e=(t,n=1)=>{let r=n;for(const i of t){const t=i[(null==h?void 0:h.children)||"children"];if(Array.isArray(t)&&t.length>0){const i=e(t,n+1);r=Math.max(r,i)}}return r};return e(v)},[v,h])<=1,O=r.useMemo(()=>{if(!q||!v)return[];const e=(null==h?void 0:h.label)||"label",t=(null==h?void 0:h.value)||"value";return v.map(n=>{const r={label:n[e]||n.title||n.label,value:n[t]||n.key||n.value};return Object.keys(n).forEach(e=>{["label","value"].includes(e)||(r[e]=n[e])}),r})},[v,q,h]),T=r.useMemo(()=>{if(q||!v)return[];const e=(null==h?void 0:h.label)||"label",t=(null==h?void 0:h.value)||"value",n=(null==h?void 0:h.children)||"children",r=i=>{const s={title:i[e]||i.title||i.label,value:i[t]||i.key||i.value,key:i.key||i[t]||i.value};return Object.keys(i).forEach(e=>{["title","value","key","children"].includes(e)||(s[e]=i[e])}),i[n]&&Array.isArray(i[n])&&i[n].length>0&&(s.children=i[n].map(r)),s};return v.map(r)},[v,q,h]),L=r.useRef(`smart-select-${Math.random().toString(36).substr(2,9)}`),I=r.useMemo(()=>{const e=[j];return o&&e.push(`smart-select-${L.current}`),e.join(" ")},[o]);if(r.useEffect(()=>{if(!o)return;const e="number"==typeof o?`${o}px`:o,t=`smart-select-${L.current}`,n=`smart-select-style-${L.current}`,r=document.getElementById(n);r&&r.remove();const i=document.createElement("style");i.id=n,i.textContent=`\n\t\t\t.${t} {\n\t\t\t\tmin-width: ${e} !important;\n\t\t\t\twidth: ${e} !important;\n\t\t\t}\n\t\t`,document.head.appendChild(i);const s=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{if(1===t.nodeType){const n=t;(n.classList.contains("ant-select-dropdown")||n.classList.contains("ant-select-tree-dropdown"))&&I.split(" ").some(e=>n.classList.contains(e))&&(n.style.minWidth=e,n.style.width=e,setTimeout(()=>{const t=Array.from(document.querySelectorAll(".ant-select, .ant-select-selector"));let r=null,i=1/0;if(t.forEach(e=>{const t=e.getBoundingClientRect(),s=n.getBoundingClientRect(),o=Math.abs(t.bottom-s.top);o<i&&o<50&&(i=o,r=e)}),r){const t=r.getBoundingClientRect(),i=parseFloat(e),s=t.right-i,o=Math.max(0,s);n.style.left=`${o}px`,n.style.right="auto",n.style.transform="none"}else{const t=n.getBoundingClientRect(),r=parseFloat(e),i=window.innerWidth;if(t.right>i){const e=Math.max(0,i-r);n.style.left=`${e}px`,n.style.right="auto",n.style.transform="none"}}},10))}})})});return s.observe(document.body,{childList:!0,subtree:!1}),()=>{s.disconnect();const e=document.getElementById(n);e&&e.remove()}},[o,I]),q){const e=void 0!==N?N:E,t=r.useMemo(()=>e&&!0!==e?(t,n)=>{const r={...n,name:(null==n?void 0:n.name)||(null==n?void 0:n.label),code:(null==n?void 0:n.code)||(null==n?void 0:n.code),label:(null==n?void 0:n.label)||(null==n?void 0:n.name),title:(null==n?void 0:n.label)||(null==n?void 0:n.title)||(null==n?void 0:n.name)};return e(t,r)}:e,[e]),o={...d,...void 0!==t&&{filterOption:t},...void 0!==w&&{showSearch:w},..._};return n.jsx(i.Select,{className:g,style:{width:s},options:O,placeholder:a,allowClear:c,disabled:u,mode:l?"multiple":void 0,value:p,onChange:m,popupClassName:I,dropdownMatchSelectWidth:!1,...o})}const R=void 0!==E?E:N,M=r.useMemo(()=>R&&!0!==R?(e,t)=>{const n={...t,name:(null==t?void 0:t.name)||(null==t?void 0:t.title),code:(null==t?void 0:t.code)||(null==t?void 0:t.code),title:(null==t?void 0:t.title)||(null==t?void 0:t.name),label:(null==t?void 0:t.title)||(null==t?void 0:t.label)||(null==t?void 0:t.name)};return R(e,n)}:R,[R]),B=r.useMemo(()=>{if(!R||!0===R)return C||"title"},[R,C]),D={...f,...void 0!==y&&{maxTagCount:y},...x&&{maxTagPlaceholder:x},...void 0!==w&&{showSearch:w},...void 0!==M&&{filterTreeNode:M},...B&&{treeNodeFilterProp:B},...void 0!==A&&{treeCheckable:A},...void 0!==k&&{treeDefaultExpandAll:k},...S&&{treeDefaultExpandedKeys:S},..._};return n.jsx(i.TreeSelect,{className:g,style:{width:s},treeData:T,placeholder:a,allowClear:c,disabled:u,multiple:l,value:p,onChange:m,popupClassName:I,dropdownMatchSelectWidth:!1,...D})},{RangePicker:q}=i.DatePicker,O=r.forwardRef(({config:e,onFinish:t,onReset:s,onSearch:o,initialValues:l,OtherButton:a,layout:c="horizontal",labelCol:u={span:5},wrapperCol:h={span:19},submitButtonText:d="搜索",resetButtonText:f="重置",hideResetButton:m=!1,isReset:g=!1,onSearchFormChange:b,...v},y)=>{var x;const[w]=i.Form.useForm();r.useImperativeHandle(y,()=>({setFieldsValue:e=>{w.setFieldsValue(e)},getFieldsValue:()=>w.getFieldsValue()}));const N=null==(x=p.getOrgInfo())?void 0:x.orgId,[E,A]=r.useState(N),k=r.useMemo(()=>e.some(e=>"deptSelect"===e.type),[e]),C=r.useMemo(()=>e.some(e=>"orgSelect"===e.type),[e]);r.useEffect(()=>{k&&I()},[E,k]),r.useEffect(()=>{C&&R()},[C]);const[j,O]=r.useState([]),[T,L]=r.useState([]),I=async e=>{const t=e||E,n=await S({orgId:t,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");200===n.code&&O((null==n?void 0:n.data)||[])},R=async()=>{const e=await S({loginOrgId:N,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&L((null==e?void 0:e.data)||[])},M=e=>{const{type:t,name:r,placeholder:s,options:o,rules:l,...a}=e;switch(e.initialValue&&w.setFieldsValue({[r]:e.initialValue}),t){case"input":return n.jsx(i.Input,{placeholder:s||`请输入${e.label}`,...a});case"password":return n.jsx(i.Input.Password,{placeholder:s||`请输入${e.label}`,...a});case"select":return n.jsx(_,{allowClear:!0,placeholder:s||`请选择${e.label}`,dataSource:o,...a});case"radio":return n.jsx(i.Radio.Group,{...a,children:null==o?void 0:o.map(e=>n.jsx(i.Radio,{value:e.value,children:e.label},e.value))});case"rangePicker":return n.jsx(q,{style:{width:"100%"},...a});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%"},placeholder:s||`请选择${e.label}`,...a});case"treeSelect":return n.jsx(_,{style:{width:"100%"},placeholder:s||`请选择${e.label}`,treeData:e.options,...a});case"deptSelect":return n.jsx(_,{allowClear:!0,style:{width:"100%"},placeholder:s||`请选择${e.label}`,dataSource:j,...a,fieldNames:{label:"name",value:"id"}});case"orgSelect":return n.jsx(_,{allowClear:!0,style:{width:"100%"},placeholder:s||`请选择${e.label}`,dataSource:T,...a,fieldNames:{label:"name",value:"id"}});default:return n.jsx(i.Input,{placeholder:s,...a})}};return n.jsx(i.Form,{form:w,layout:c,labelCol:"horizontal"===c?u:void 0,wrapperCol:"horizontal"===c?h:void 0,onFinish:t,initialValues:l,onFieldsChange:t=>{const n=t[0].name[0],r=t[0].value,i=e.find(e=>e.name===n);if(b&&b(n,r),"orgSelect"===(null==i?void 0:i.type)){A(r);const t={};e.forEach(e=>{"deptSelect"===e.type&&(t[e.name]="")});const n=i.connect;n&&(t[n]=""),Object.keys(t).length>0&&w.setFieldsValue(t),I(r)}},...v,children:n.jsxs(i.Row,{gutter:24,children:[" ",e.map(e=>n.jsxs(i.Col,{span:e.colSpan||6,children:[" ",n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,labelCol:{span:e.labelCol||5},wrapperCol:{span:e.wrapperCol||19},children:M(e)})]},e.name)),n.jsx(i.Col,{span:2,children:n.jsxs(i.Form.Item,{children:[" ",n.jsxs(i.Space,{children:[e.length>0&&n.jsx(i.Button,{type:"primary",htmlType:"submit",onClick:()=>(()=>{const t={...w.getFieldsValue()};e.forEach(e=>{var n;"radio"===e.type&&void 0!==t[e.name]&&(null==(n=e.options)?void 0:n.some(e=>"number"==typeof e.value))&&"string"==typeof t[e.name]&&/^-?\d+$/.test(t[e.name])&&(t[e.name]=parseInt(t[e.name],10))}),o&&o(t)})(),children:d}),!m&&g&&n.jsx(i.Button,{onClick:()=>(w.resetFields(),void(s&&s(w))),children:f})]})]})}),n.jsx(i.Col,{flex:1,style:{display:"flex",justifyContent:"flex-end"},children:n.jsxs(i.Form.Item,{children:[" ",a&&"function"==typeof a?a(w):a]})})]})})});var T=r.createContext({});function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},L.apply(null,arguments)}function I(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function R(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,s,o,l=[],a=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(a=(r=s.call(n)).done)&&(l.push(r.value),l.length!==t);a=!0);}catch(u){c=!0,i=u}finally{try{if(!a&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return I(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?I(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function B(e){var t=function(e,t){if("object"!=M(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=M(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==M(t)?t:t+""}function D(e,t,n){return(t=B(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function F(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $,z,V={exports:{}};
1
+ "use strict";var e=Object.defineProperty,t=(t,n,r)=>((t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r)(t,"symbol"!=typeof n?n+"":n,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("react"),i=require("antd"),s=require("axios"),o=require("lodash"),l=require("dayjs"),a=require("pinyin-pro");function c(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const n in e)if("default"!==n){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}return t.default=e,Object.freeze(t)}const u=c(r),h="currentUserId",d=(e,t)=>{if(t)return`user_${t}_${e}`;const n=localStorage.getItem(h);return n?`user_${n}_${e}`:e},f={setCurrentUserId:e=>{localStorage.setItem(h,e)},getCurrentUserId:()=>localStorage.getItem(h),getToken:()=>localStorage.getItem(d("token")),setToken:e=>{localStorage.setItem(d("token"),e)},getRefreshToken:()=>localStorage.getItem(d("refreshToken")),setRefreshToken:e=>{localStorage.setItem(d("refreshToken"),e)},removeToken:()=>{const e=f.getCurrentUserId();e&&(localStorage.removeItem(d("token",e)),localStorage.removeItem(d("userInfo",e)),localStorage.removeItem(d("refreshToken",e)))},isLoggedIn:()=>!!localStorage.getItem(d("token")),getUserInfo:()=>{const e=localStorage.getItem(d("userInfo"));return e?JSON.parse(e):null},setUserInfo:e=>{(null==e?void 0:e.userId)&&f.setCurrentUserId(e.userId),localStorage.setItem(d("userInfo"),JSON.stringify(e))},setOrgList:e=>{localStorage.setItem(d("orgList"),JSON.stringify(e))},getOrgList:()=>localStorage.getItem(d("orgList")),setFunctionAuth:e=>{localStorage.setItem(d("functionAuth"),JSON.stringify(e))},getFunctionAuth:()=>JSON.parse(localStorage.getItem(d("functionAuth"))||"[]"),setAppInfo:e=>{localStorage.setItem(d("appInfo"),JSON.stringify(e))},getAppInfo:()=>JSON.parse(localStorage.getItem(d("appInfo"))||"[]"),setOrgInfo:e=>{localStorage.setItem(d("orgInfo"),JSON.stringify(e))},getOrgInfo:()=>JSON.parse(localStorage.getItem(d("orgInfo"))||"{}"),setDeptInfo:e=>{localStorage.setItem(d("deptInfo"),JSON.stringify(e))},getDeptInfo:()=>JSON.parse(localStorage.getItem(d("deptInfo"))||"{}"),setMenu:e=>{localStorage.setItem(d("menu"),JSON.stringify(e))},getMenu:()=>JSON.parse(localStorage.getItem(d("menu"))||"[]"),setLoginConfig:e=>{localStorage.setItem("loginConfig",JSON.stringify(e))},getLoginConfig:()=>{const e=localStorage.getItem("loginConfig");return e?JSON.parse(e):null},setFavicon:e=>{try{if(!e){const t=f.getLoginConfig();e=null==t?void 0:t.loginIcon}if(!e)return;document.querySelectorAll('link[rel*="icon"]').forEach(e=>e.remove());const t=document.createElement("link");t.rel="icon",t.type="image/png",t.href=`data:image/png;base64,${e}`,document.head.appendChild(t)}catch(t){}},setWebTitle:e=>{try{if(!e){const t=f.getLoginConfig();e=null==t?void 0:t.webTitle}e&&(document.title=e)}catch(t){}},clearAuth:()=>{const e=f.getCurrentUserId();e&&(localStorage.removeItem(d("token",e)),localStorage.removeItem(d("userInfo",e)),localStorage.removeItem(d("refreshToken",e)),localStorage.removeItem(d("orgList",e)),localStorage.removeItem(d("functionAuth",e)),localStorage.removeItem(d("appInfo",e)),localStorage.removeItem(d("orgInfo",e)),localStorage.removeItem(d("deptInfo",e)),localStorage.removeItem(d("menu",e)),localStorage.removeItem(d("menu-storage",e)),localStorage.removeItem(h)),localStorage.removeItem("loginConfig")}};function p(){return S("/account/sso/refreshToken",{refreshToken:f.getRefreshToken()})}const m=Number("15000");let g=!1,b=[],v={notLoggedIn:!1,tokenExpired:!1,businessError:!1,networkError:!1,httpError:!1};const y=e=>{b.forEach(t=>t(e)),b=[]},x=(e,t)=>{v[e]||(v[e]=!0,i.Modal.error({title:t.title,content:t.content,okText:t.okText||"确定",onOk:()=>{var n;v[e]=!1,null==(n=t.onOk)||n.call(t)},onCancel:()=>{v[e]=!1}}))},w={400:"请求参数错误",401:"未授权,请重新登录",403:"拒绝访问",404:"请求的资源不存在",500:"服务器内部错误",502:"网关错误",503:"服务不可用",504:"网关超时"},N=["/image/generateValidateCode","/sso/doLogin","/sso/refreshToken"],E=[],k=()=>{E.forEach(e=>{e.cancel("请求被取消:token已过期")}),E.length=0},A=s.create({baseURL:"/api",timeout:m,headers:{"Content-Type":"application/json"}});function S(e,t,n){return A.post(e,t,n)}function C(e,t){return S(t,e)}function j(e,t){return function(e,t,n){return A.get(e,{params:t,...n})}(t,e)}A.interceptors.request.use(e=>{if(!N.some(t=>{var n;return null==(n=e.url)?void 0:n.includes(t)})){const t=f.getToken();if(!f.getRefreshToken())return x("notLoggedIn",{title:"登录提示",content:"您还未登录,请先登录后再进行操作",okText:"前往登录",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("请先登录"));e.headers.Authorization=`Bearer ${t}`,e.headers.accessToken=`${t}`}const t=s.CancelToken.source();return e.cancelToken=t.token,E.push(t),e},e=>Promise.reject(e)),A.interceptors.response.use(async e=>{const{data:t,config:n}=e,r=E.findIndex(e=>e.token===n.cancelToken);if(r>-1&&E.splice(r,1),"blob"===n.responseType)return e;if(200===t.code)return t;if(461===t.code)return f.clearAuth(),k(),x("tokenExpired",{title:"登录已过期",content:"您的登录状态已过期,请重新登录后继续操作",okText:"重新登录",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("登录已过期"));if(401!==t.code)return x("businessError",{title:"操作提示",content:t.msg||`请求失败,错误码:${t.code}`,okText:"确定",showCancel:!1}),t;k();try{const e=await p();if(200===e.code){const t=e.data.accessToken;return f.setToken(t),y(t),n.headers.Authorization=`Bearer ${t}`,n.headers.accessToken=t,A(n)}return f.clearAuth(),x("tokenExpired",{title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("刷新token失败"))}catch(i){return f.clearAuth(),x("tokenExpired",{title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",onOk:()=>{window.location.href="/login"}}),Promise.reject(i)}finally{g=!1}},async e=>{var t;if(e.config){const t=E.findIndex(t=>t.token===e.config.cancelToken);t>-1&&E.splice(t,1)}if(s.isCancel(e)&&e.message&&!e.message.includes("timeout"))return Promise.reject(e);if(e.response){const{status:t,config:r}=e.response;if(401!==t||N.some(e=>{var t;return null==(t=r.url)?void 0:t.includes(e)})){x("httpError",{title:"请求失败",content:w[t]||`服务器错误 (${t})`,okText:"确定",showCancel:!1})}else{if(g)return new Promise(e=>{var t;t=t=>{r.headers.Authorization=`Bearer ${t}`,r.headers.accessToken=t,e(A(r))},b.push(t)});g=!0;try{const e=await p();if(200===e.code){const t=e.data.accessToken;return f.setToken(t),y(t),r.headers.Authorization=`Bearer ${t}`,r.headers.accessToken=t,A(r)}return f.clearAuth(),x("tokenExpired",{title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",onOk:()=>{window.location.href="/login"}}),Promise.reject(new Error("刷新token失败"))}catch(n){return f.clearAuth(),x("tokenExpired",{title:"登录失效",content:"登录状态已失效,请重新登录",okText:"重新登录",onOk:()=>{window.location.href="/login"}}),Promise.reject(n)}finally{g=!1}}}else e.request?x("networkError",{title:"网络异常",content:"请求超时或网络不可用,请检查您的网络连接后重试",okText:"确定"}):("ECONNABORTED"===e.code||(null==(t=e.message)?void 0:t.includes("timeout")))&&x("networkError",{title:"请求超时",content:"网络请求超时,请检查您的网络连接后重试",okText:"确定"});return Promise.reject(e)});const q="_smartSelectDropdown_srnp9_2",_=({dataSource:e,treeData:t,width:s="100%",dropdownWidth:o,multiple:l=!1,placeholder:a="请选择",allowClear:c=!0,disabled:u=!1,fieldNames:h,selectProps:d,treeSelectProps:f,value:p,onChange:m,className:g,...b})=>{const v=e||t||[],{maxTagCount:y,maxTagPlaceholder:x,showSearch:w,filterOption:N,filterTreeNode:E,treeCheckable:k,treeDefaultExpandAll:A,treeDefaultExpandedKeys:S,treeNodeFilterProp:C,...j}=b,_=r.useMemo(()=>{if(!v||!Array.isArray(v)||0===v.length)return 0;if(!v.some(e=>(e=>{const t=e[(null==h?void 0:h.children)||"children"];return Array.isArray(t)&&t.length>0})(e)))return 1;const e=(t,n=1)=>{let r=n;for(const i of t){const t=i[(null==h?void 0:h.children)||"children"];if(Array.isArray(t)&&t.length>0){const i=e(t,n+1);r=Math.max(r,i)}}return r};return e(v)},[v,h])<=1,O=r.useMemo(()=>{if(!_||!v)return[];const e=(null==h?void 0:h.label)||"label",t=(null==h?void 0:h.value)||"value";return v.map(n=>{const r={label:n[e]||n.title||n.label,value:n[t]||n.key||n.value};return Object.keys(n).forEach(e=>{["label","value"].includes(e)||(r[e]=n[e])}),r})},[v,_,h]),T=r.useMemo(()=>{if(_||!v)return[];const e=(null==h?void 0:h.label)||"label",t=(null==h?void 0:h.value)||"value",n=(null==h?void 0:h.children)||"children",r=i=>{const s={title:i[e]||i.title||i.label,value:i[t]||i.key||i.value,key:i.key||i[t]||i.value};return Object.keys(i).forEach(e=>{["title","value","key","children"].includes(e)||(s[e]=i[e])}),i[n]&&Array.isArray(i[n])&&i[n].length>0&&(s.children=i[n].map(r)),s};return v.map(r)},[v,_,h]),L=r.useRef(`smart-select-${Math.random().toString(36).substr(2,9)}`),I=r.useMemo(()=>{const e=[q];return o&&e.push(`smart-select-${L.current}`),e.join(" ")},[o]);if(r.useEffect(()=>{if(!o)return;const e="number"==typeof o?`${o}px`:o,t=`smart-select-${L.current}`,n=`smart-select-style-${L.current}`,r=document.getElementById(n);r&&r.remove();const i=document.createElement("style");i.id=n,i.textContent=`\n\t\t\t.${t} {\n\t\t\t\tmin-width: ${e} !important;\n\t\t\t\twidth: ${e} !important;\n\t\t\t}\n\t\t`,document.head.appendChild(i);const s=new MutationObserver(t=>{t.forEach(t=>{t.addedNodes.forEach(t=>{if(1===t.nodeType){const n=t;(n.classList.contains("ant-select-dropdown")||n.classList.contains("ant-select-tree-dropdown"))&&I.split(" ").some(e=>n.classList.contains(e))&&(n.style.minWidth=e,n.style.width=e,setTimeout(()=>{const t=Array.from(document.querySelectorAll(".ant-select, .ant-select-selector"));let r=null,i=1/0;if(t.forEach(e=>{const t=e.getBoundingClientRect(),s=n.getBoundingClientRect(),o=Math.abs(t.bottom-s.top);o<i&&o<50&&(i=o,r=e)}),r){const t=r.getBoundingClientRect(),i=parseFloat(e),s=t.right-i,o=Math.max(0,s);n.style.left=`${o}px`,n.style.right="auto",n.style.transform="none"}else{const t=n.getBoundingClientRect(),r=parseFloat(e),i=window.innerWidth;if(t.right>i){const e=Math.max(0,i-r);n.style.left=`${e}px`,n.style.right="auto",n.style.transform="none"}}},10))}})})});return s.observe(document.body,{childList:!0,subtree:!1}),()=>{s.disconnect();const e=document.getElementById(n);e&&e.remove()}},[o,I]),_){const e=void 0!==N?N:E,t=r.useMemo(()=>e&&!0!==e?(t,n)=>{const r={...n,name:(null==n?void 0:n.name)||(null==n?void 0:n.label),code:(null==n?void 0:n.code)||(null==n?void 0:n.code),label:(null==n?void 0:n.label)||(null==n?void 0:n.name),title:(null==n?void 0:n.label)||(null==n?void 0:n.title)||(null==n?void 0:n.name)};return e(t,r)}:e,[e]),o={...d,...void 0!==t&&{filterOption:t},...void 0!==w&&{showSearch:w},...j};return n.jsx(i.Select,{className:g,style:{width:s},options:O,placeholder:a,allowClear:c,disabled:u,mode:l?"multiple":void 0,value:p,onChange:m,popupClassName:I,dropdownMatchSelectWidth:!1,...o})}const R=void 0!==E?E:N,M=r.useMemo(()=>R&&!0!==R?(e,t)=>{const n={...t,name:(null==t?void 0:t.name)||(null==t?void 0:t.title),code:(null==t?void 0:t.code)||(null==t?void 0:t.code),title:(null==t?void 0:t.title)||(null==t?void 0:t.name),label:(null==t?void 0:t.title)||(null==t?void 0:t.label)||(null==t?void 0:t.name)};return R(e,n)}:R,[R]),B=r.useMemo(()=>{if(!R||!0===R)return C||"title"},[R,C]),D={...f,...void 0!==y&&{maxTagCount:y},...x&&{maxTagPlaceholder:x},...void 0!==w&&{showSearch:w},...void 0!==M&&{filterTreeNode:M},...B&&{treeNodeFilterProp:B},...void 0!==k&&{treeCheckable:k},...void 0!==A&&{treeDefaultExpandAll:A},...S&&{treeDefaultExpandedKeys:S},...j};return n.jsx(i.TreeSelect,{className:g,style:{width:s},treeData:T,placeholder:a,allowClear:c,disabled:u,multiple:l,value:p,onChange:m,popupClassName:I,dropdownMatchSelectWidth:!1,...D})},{RangePicker:O}=i.DatePicker,T=r.forwardRef(({config:e,onFinish:t,onReset:s,onSearch:o,initialValues:l,OtherButton:a,layout:c="horizontal",labelCol:u={span:5},wrapperCol:h={span:19},submitButtonText:d="搜索",resetButtonText:p="重置",hideResetButton:m=!1,isReset:g=!1,onSearchFormChange:b,...v},y)=>{var x;const[w]=i.Form.useForm(),N=r.useRef(!1);r.useEffect(()=>{if(!N.current&&e&&e.length>0){const t={};e.forEach(e=>{const n=void 0!==e.initialValue?e.initialValue:e.defaultValue;void 0!==n&&(t[e.name]=n)}),Object.keys(t).length>0&&w.setFieldsValue({...t,...l}),N.current=!0}},[e,l,w]),r.useImperativeHandle(y,()=>({setFieldsValue:e=>{w.setFieldsValue(e)},getFieldsValue:()=>w.getFieldsValue()}));const E=null==(x=f.getOrgInfo())?void 0:x.orgId;r.useMemo(()=>e.some(e=>"deptSelect"===e.type),[e]);const k=r.useMemo(()=>e.some(e=>"orgSelect"===e.type),[e]);r.useEffect(()=>{k&&T()},[k]);const[A,S]=r.useState([]),[j,q]=r.useState([]),T=async()=>{const e=await C({loginOrgId:E,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&q((null==e?void 0:e.data)||[])},L=e=>{const{type:t,name:r,placeholder:s,options:o,rules:l,...a}=e;switch(t){case"input":return n.jsx(i.Input,{placeholder:s||`请输入${e.label}`,...a});case"password":return n.jsx(i.Input.Password,{placeholder:s||`请输入${e.label}`,...a});case"select":return n.jsx(_,{allowClear:!0,placeholder:s||`请选择${e.label}`,dataSource:o,...a});case"radio":return n.jsx(i.Radio.Group,{...a,children:null==o?void 0:o.map(e=>n.jsx(i.Radio,{value:e.value,children:e.label},e.value))});case"rangePicker":return n.jsx(O,{style:{width:"100%"},...a});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%"},placeholder:s||`请选择${e.label}`,...a});case"treeSelect":return n.jsx(_,{style:{width:"100%"},placeholder:s||`请选择${e.label}`,treeData:e.options,...a});case"deptSelect":return n.jsx(_,{allowClear:!0,style:{width:"100%"},placeholder:s||`请选择${e.label}`,dataSource:A,...a,fieldNames:{label:"name",value:"id"}});case"orgSelect":return n.jsx(_,{allowClear:!0,style:{width:"100%"},placeholder:s||`请选择${e.label}`,dataSource:j,...a,fieldNames:{label:"name",value:"id"}});default:return n.jsx(i.Input,{placeholder:s,...a})}};return n.jsx(i.Form,{form:w,layout:c,labelCol:"horizontal"===c?u:void 0,wrapperCol:"horizontal"===c?h:void 0,onFinish:t,initialValues:l,onFieldsChange:t=>{const n=t[0].name[0],r=t[0].value,i=e.find(e=>e.name===n);if(b&&b(n,r),"orgSelect"===(null==i?void 0:i.type)){const t={};e.forEach(e=>{"deptSelect"===e.type&&(t[e.name]="")});const n=i.connect;n&&(t[n]=""),Object.keys(t).length>0&&w.setFieldsValue(t),r&&(async e=>{const t=e,n=await C({orgId:t,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");200===n.code&&S((null==n?void 0:n.data)||[])})(r)}},...v,style:{marginBottom:20},children:n.jsxs(i.Row,{gutter:[24,10],children:[" ",e.map(e=>n.jsxs(i.Col,{span:e.colSpan||6,children:[" ",n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,labelCol:{span:e.labelCol||5},wrapperCol:{span:e.wrapperCol||19},style:{marginBottom:5},children:L(e)})]},e.name)),n.jsx(i.Col,{span:2,children:n.jsxs(i.Form.Item,{style:{marginBottom:5},children:[" ",n.jsxs(i.Space,{children:[e.length>0&&n.jsx(i.Button,{type:"primary",htmlType:"submit",onClick:()=>(()=>{const t={...w.getFieldsValue()};e.forEach(e=>{var n;"radio"===e.type&&void 0!==t[e.name]&&(null==(n=e.options)?void 0:n.some(e=>"number"==typeof e.value))&&"string"==typeof t[e.name]&&/^-?\d+$/.test(t[e.name])&&(t[e.name]=parseInt(t[e.name],10))}),o&&o(t)})(),children:d}),!m&&g&&n.jsx(i.Button,{onClick:()=>(w.resetFields(),void(s&&s(w))),children:p})]})]})}),n.jsx(i.Col,{flex:1,style:{display:"flex",justifyContent:"flex-end"},children:n.jsxs(i.Form.Item,{style:{marginBottom:5},children:[" ",a&&"function"==typeof a?a(w):a]})})]})})});var L=r.createContext({});function I(){return I=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},I.apply(null,arguments)}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,s,o,l=[],a=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(a=(r=s.call(n)).done)&&(l.push(r.value),l.length!==t);a=!0);}catch(u){c=!0,i=u}finally{try{if(!a&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(c)throw i}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return R(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?R(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(e){return(B="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function D(e){var t=function(e,t){if("object"!=B(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=B(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==B(t)?t:t+""}function P(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e,t){if(null==e)return{};var n,r,i=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var U="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z,V,H={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
5
  http://jedwatson.github.io/classnames
6
- */const H=F(($||($=1,z=V,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var i=arguments[t];i&&(e=r(e,n(i)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var i="";for(var s in n)e.call(n,s)&&n[s]&&(i=r(i,s));return i}function r(e,t){return t?e?e+" "+t:e+t:e}z.exports?(t.default=t,z.exports=t):window.classNames=t}()),V.exports)),K=Math.round;function W(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const Z=(e,t,n)=>0===n?e:e/100;function G(e,t){const n=t||255;return e>n?n:e<0?0:e}class Y{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(D(this,"isValid",!0),D(this,"r",0),D(this,"g",0),D(this,"b",0),D(this,"a",1),D(this,"_h",void 0),D(this,"_s",void 0),D(this,"_l",void 0),D(this,"_v",void 0),D(this,"_max",void 0),D(this,"_min",void 0),D(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof Y)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=G(e.r),this.g=G(e.g),this.b=G(e.b),this.a="number"==typeof e.a?G(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:K(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,i=e=>(n[e]-this[e])*r+this[e],s={r:K(i("r")),g:K(i("g")),b:K(i("b")),a:K(100*i("a"))/100};return this._c(s)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>K((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=K(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=K(100*this.getSaturation()),n=K(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=G(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=K(255*n);this.r=e,this.g=e,this.b=e}let i=0,s=0,o=0;const l=e/60,a=(1-Math.abs(2*n-1))*t,c=a*(1-Math.abs(l%2-1));l>=0&&l<1?(i=a,s=c):l>=1&&l<2?(i=c,s=a):l>=2&&l<3?(s=a,o=c):l>=3&&l<4?(s=c,o=a):l>=4&&l<5?(i=c,o=a):l>=5&&l<6&&(i=a,o=c);const u=n-a/2;this.r=K(255*(i+u)),this.g=K(255*(s+u)),this.b=K(255*(o+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const i=K(255*n);if(this.r=i,this.g=i,this.b=i,t<=0)return;const s=e/60,o=Math.floor(s),l=s-o,a=K(n*(1-t)*255),c=K(n*(1-t*l)*255),u=K(n*(1-t*(1-l))*255);switch(o){case 0:this.g=u,this.b=a;break;case 1:this.r=c,this.b=a;break;case 2:this.r=a,this.b=u;break;case 3:this.r=a,this.g=c;break;case 4:this.r=u,this.g=a;break;default:this.g=a,this.b=c}}fromHsvString(e){const t=W(e,Z);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=W(e,Z);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=W(e,(e,t)=>t.includes("%")?K(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var J=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function X(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function Q(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function ee(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var te=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function ne(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ne(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ne(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}te.primary=te[5];var ie="data-rc-order",se="data-rc-priority",oe=new Map;function le(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function ae(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function ce(e){return Array.from((oe.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function ue(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,i=t.priority,s=void 0===i?0:i,o=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(ie,o),l&&s&&a.setAttribute(se,"".concat(s)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=e;var c=ae(t),u=c.firstChild;if(r){if(l){var h=(t.styles||ce(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(ie)))return!1;var t=Number(e.getAttribute(se)||0);return s>=t});if(h.length)return c.insertBefore(a,h[h.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function he(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=ae(n),i=ce(r),s=re(re({},n),{},{styles:i});!function(e,t){var n=oe.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=ue("",t),i=r.parentNode;oe.set(e,i),e.removeChild(r)}}(r,s);var o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ae(t);return(t.styles||ce(n)).find(function(n){return n.getAttribute(le(t))===e})}(t,s);if(o){var l,a,c;if(null!==(l=s.csp)&&void 0!==l&&l.nonce&&o.nonce!==(null===(a=s.csp)||void 0===a?void 0:a.nonce))o.nonce=null===(c=s.csp)||void 0===c?void 0:c.nonce;return o.innerHTML!==e&&(o.innerHTML=e),o}var u=ue(e,s);return u.setAttribute(le(s),t),u}function de(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function fe(e){return function(e){return de(e)instanceof ShadowRoot}(e)?de(e):null}var pe={},me=[];function ge(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)me.reduce(function(e,t){return t(null!=e?e:"","warning")},t)}function be(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)me.reduce(function(e,t){return t(null!=e?e:"","note")},t)}function ve(e,t,n){t||pe[n]||(e(!1,n),pe[n]=!0)}function ye(e,t){ve(ge,e,t)}function xe(e){return"object"===M(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===M(e.icon)||"function"==typeof e.icon)}function we(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,i=e[n];if("class"===n)t.className=i,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=i;return t},{})}function Ne(e,t,n){return n?r.createElement(e.tag,re(re({key:t},we(e.attrs)),n),(e.children||[]).map(function(n,r){return Ne(n,"".concat(t,"-").concat(e.tag,"-").concat(r))})):r.createElement(e.tag,re({key:t},we(e.attrs)),(e.children||[]).map(function(n,r){return Ne(n,"".concat(t,"-").concat(e.tag,"-").concat(r))}))}function Ee(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new Y(e),i=r.toHsv(),s=5;s>0;s-=1){var o=new Y({h:X(i,s,!0),s:Q(i,s,!0),v:ee(i,s,!0)});n.push(o)}n.push(r);for(var l=1;l<=4;l+=1){var a=new Y({h:X(i,l),s:Q(i,l),v:ee(i,l)});n.push(a)}return"dark"===t.theme?J.map(function(e){var r=e.index,i=e.amount;return new Y(t.backgroundColor||"#141414").mix(n[r],i).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function Ae(e){return e?Array.isArray(e)?e:[e]:[]}ye.preMessage=function(e){me.push(e)},ye.resetWarned=function(){pe={}},ye.noteOnce=function(e,t){ve(be,e,t)};var ke=["icon","className","onClick","style","primaryColor","secondaryColor"],Se={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var Ce=function(e){var t,n,i,s,o,l,a,c,u=e.icon,d=e.className,f=e.onClick,p=e.style,m=e.primaryColor,g=e.secondaryColor,b=P(e,ke),v=h.useRef(),y=Se;if(m&&(y={primaryColor:m,secondaryColor:g||Ee(m)}),t=v,n=r.useContext(T),i=n.csp,s=n.prefixCls,o=n.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",s&&(l=l.replace(/anticon/g,s)),o&&(l="@layer ".concat(o," {\n").concat(l,"\n}")),r.useEffect(function(){var e=fe(t.current);he(l,"@ant-design-icons",{prepend:!o,csp:i,attachTo:e})},[]),a=xe(u),c="icon should be icon definiton, but got ".concat(u),ye(a,"[@ant-design/icons] ".concat(c)),!xe(u))return null;var x=u;return x&&"function"==typeof x.icon&&(x=re(re({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),Ne(x.icon,"svg-".concat(x.name),re(re({className:d,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},b),{},{ref:v}))};function je(e){var t=R(Ae(e),2),n=t[0],r=t[1];return Ce.setTwoToneColors({primaryColor:n,secondaryColor:r})}Ce.displayName="IconReact",Ce.getTwoToneColors=function(){return re({},Se)},Ce.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;Se.primaryColor=t,Se.secondaryColor=n||Ee(t),Se.calculated=!!n};var _e=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];je(te.primary);var qe=h.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,s=e.rotate,o=e.tabIndex,l=e.onClick,a=e.twoToneColor,c=P(e,_e),u=h.useContext(T),d=u.prefixCls,f=void 0===d?"anticon":d,p=u.rootClassName,m=H(p,f,D(D({},"".concat(f,"-").concat(r.name),!!r.name),"".concat(f,"-spin"),!!i||"loading"===r.name),n),g=o;void 0===g&&l&&(g=-1);var b=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,v=R(Ae(a),2),y=v[0],x=v[1];return h.createElement("span",L({role:"img","aria-label":r.name},c,{ref:t,tabIndex:g,onClick:l,className:m}),h.createElement(Ce,{icon:r,primaryColor:y,secondaryColor:x,style:b}))});qe.displayName="AntdIcon",qe.getTwoToneColor=function(){var e=Ce.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},qe.setTwoToneColor=je;var Oe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},Te=function(e,t){return h.createElement(qe,L({},e,{ref:t,icon:Oe}))},Le=h.forwardRef(Te);"production"!==process.env.NODE_ENV&&(Le.displayName="DownOutlined");var Ie={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},Re=function(e,t){return h.createElement(qe,L({},e,{ref:t,icon:Ie}))},Me=h.forwardRef(Re);"production"!==process.env.NODE_ENV&&(Me.displayName="PlusOutlined");var Be={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},De=function(e,t){return h.createElement(qe,L({},e,{ref:t,icon:Be}))},Pe=h.forwardRef(De);"production"!==process.env.NODE_ENV&&(Pe.displayName="RightOutlined");var Ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},Fe=function(e,t){return h.createElement(qe,L({},e,{ref:t,icon:Ue}))},$e=h.forwardRef(Fe);"production"!==process.env.NODE_ENV&&($e.displayName="SettingOutlined");var ze={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},Ve=function(e,t){return h.createElement(qe,L({},e,{ref:t,icon:ze}))},He=h.forwardRef(Ve);"production"!==process.env.NODE_ENV&&(He.displayName="UploadOutlined");const{Option:Ke}=i.Select,We=({columns:e,dataSource:t,pagination:s,tableId:l,size:a="middle",onRowClick:c,page:u,showTableConfig:h=!0,...d})=>{const[f,m]=r.useState([]),[g,b]=r.useState([]),[v,y]=r.useState(!1),[x,w]=r.useState([]),[N,E]=r.useState([]),[A,S]=r.useState([]),[C]=i.Form.useForm(),[j,_]=r.useState([]),q=p.getUserInfo(),O=r.useRef(void 0),T=r.useRef(void 0),L=r.useMemo(()=>(null==e?void 0:e.map(e=>e.dataIndex||e.key).join(","))||"",[e]),I=r.useCallback(async()=>{var t,n,r;const i=(null==e?void 0:e.map((e,t)=>({key:e.key||e.dataIndex||`col-${t}`,title:e.title,dataIndex:e.dataIndex,displayTitle:"string"==typeof e.title?e.title:`列 ${t+1}`,headerAlignment:e.align||"left",contentAlignment:e.align||"left",dataFormat:"字符串",width:e.width||100,enabled:!0,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:t+1,render:e.render,fixed:e.fixed,originalColumn:{...e}})))||[];if(E(i),e.length>1)try{if(l){const o=await(s={userId:q.userId,tableId:l||""},k("/platform/business/common/getTableConfigByUser",s));if(null==(t=null==o?void 0:o.data)?void 0:t.content){const t=null==(r=JSON.parse(null==(n=null==o?void 0:o.data)?void 0:n.content))?void 0:r.map(t=>{var n;const r=null==(n=e.find(e=>e.key===t.key))?void 0:n.render;return{...t,render:r,originalColumn:{...t.originalColumn,render:r}}});w(t),S(t)}else w(i),S(i)}else w(i),S(i)}catch(o){w(i),S(i)}else w(i),S(i);var s},[e,l,q.userId]),R=r.useMemo(()=>o.debounce(I,100),[I]);r.useEffect(()=>{(O.current!==l||T.current!==L)&&(O.current=l,T.current=L,R())},[l,L,R]),r.useEffect(()=>{const e=x.filter(e=>e.enabled).sort((e,t)=>e.sort-t.sort).map(e=>({...e.originalColumn,key:e.key,title:e.displayTitle,dataIndex:e.dataIndex,align:e.contentAlignment,width:Number(e.width)})),t=[...h?[{title:n.jsxs(i.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(i.Tooltip,{title:"表格配置",children:n.jsx($e,{onClick:()=>y(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(e,t,r)=>n.jsx(n.Fragment,{children:n.jsx(n.Fragment,{children:e||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+r+1||r+1})})}]:[],...e].map(e=>{const t=e.render;return{...e,render:(s,o,l)=>t?t(s,o,l):"object"!=typeof s||""===s||r.isValidElement(s)?n.jsx(i.Tooltip,{title:String(s),children:n.jsx("div",{style:{display:"block",width:e.width,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s?String(s):""})}):""}});m(t)},[x,h,u]),r.useEffect(()=>{const e=null==t?void 0:t.map((e,t)=>({...e,parentId:(null==e?void 0:e.parentId)||null,id:(null==e?void 0:e.id)||t+1,INDEX:(null==e?void 0:e.INDEX)||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+t+1||t+1}));_(null==e?void 0:e.map(e=>e.id)),b(e)},[t]);const M=r.useRef(null),B=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(e,t)=>n.jsx(i.Input,{size:"small",defaultValue:e,onBlur:e=>D(t.key,"displayTitle",e.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>D(t.key,"headerAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"内容对齐",dataIndex:"contentAlignment",key:"contentAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>D(t.key,"contentAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"数据格式",dataIndex:"dataFormat",key:"dataFormat",render:(e,t)=>n.jsxs(i.Select,{size:"small",defaultValue:e,style:{width:80},onChange:e=>D(t.key,"dataFormat",e),children:[n.jsx(Ke,{value:"字符串",children:"字符串"}),n.jsx(Ke,{value:"数字",children:"数字"}),n.jsx(Ke,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>D(t.key,"width",e.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>D(t.key,"enabled",e)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>D(t.key,"allowSorting",e)})},{title:"排序",dataIndex:"sort",key:"sort",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>D(t.key,"sort",e.target.value)})}],D=(e,t,n)=>{S(r=>r.map(r=>r.key===e?{...r,[t]:n}:r))},P=async()=>{try{const t=await(e={tableId:l||"",userId:null==q?void 0:q.userId,content:JSON.stringify(A)},k("/platform/business/common/saveUserTableConfig",e));w(A),200===(null==t?void 0:t.code)&&(i.message.success("保存成功"),R())}catch(t){}var e},U=()=>{y(!1)},F=(e,t=!1)=>{_(t?j.filter(t=>t!==(null==e?void 0:e.id)):[...j,null==e?void 0:e.id])};return n.jsxs(n.Fragment,{children:[n.jsx(i.Table,{columns:f,dataSource:g,bordered:!0,rowKey:"id",pagination:s,size:"small",onRow:e=>({onClick:t=>{c&&c(e,t)}}),expandable:{expandedRowKeys:j,expandIcon:({expanded:e,onExpand:t,record:r})=>{var i;if((null==(i=null==r?void 0:r.children)?void 0:i.length)>0){const i={fontSize:"14px",color:"rgba(0, 0, 0, 0.45)",cursor:"pointer",position:"absolute",left:"18px",top:"10px"};return e?n.jsx(Le,{onClick:e=>{t(r,e),F(r,!0)},style:i}):n.jsx(Pe,{onClick:e=>{t(r,e),F(r,!1)},style:i})}return null}},...d}),n.jsx(i.Modal,{title:"表格设置",visible:v,footer:[n.jsx(i.Button,{onClick:async()=>{var e;200===(await(e={userId:q.userId,tableId:l||""},k("/platform/business/common/restoreDefaultTableConfig",e))).code&&(w(N),S(N),y(!1),i.message.success("重置成功"))},children:"重置"},"reset"),n.jsx(i.Button,{onClick:U,children:"取消"},"cancel"),n.jsx(i.Button,{type:"primary",onClick:()=>{y(!1),P()},children:"保存"},"submit")],onCancel:U,width:1e3,destroyOnClose:!0,maskClosable:!1,children:n.jsx(i.Spin,{spinning:!1,children:n.jsx(i.Form,{form:C,component:!1,children:n.jsx(i.Table,{ref:M,columns:B,dataSource:A.filter(e=>!e.isBuiltIn),rowKey:"key",size:"small",pagination:!1,bordered:!0})})})})]})},Ze=({label:e,id:t,value:s,onChange:o,disabled:l=!1})=>{const[a,c]=r.useState([]),[u,h]=r.useState(void 0),[d,f]=r.useState(!1),[p,m]=r.useState(void 0),[g,b]=r.useState(void 0),[v,y]=r.useState(void 0),[x,w]=r.useState(void 0),[N,E]=r.useState([]),[A,k]=r.useState(void 0),[C,j]=r.useState(!1),[_,q]=r.useState([]),[O,T]=r.useState(void 0),[L,I]=r.useState(!1),[R,M]=r.useState([]),[B,D]=r.useState(void 0),[P,U]=r.useState(!1),[F,$]=r.useState(""),[z,V]=r.useState({}),H=r.useCallback(e=>{o&&o(e)},[o]),K=r.useCallback(async(e,t)=>{switch(e){case 1:f(!0);break;case 2:j(!0);break;case 3:I(!0);break;case 4:U(!0)}try{const n=await S({level:e,parent:t.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(e=>({value:e.code,label:e.name})):[]}catch(n){return[]}finally{switch(e){case 1:f(!1);break;case 2:j(!1);break;case 3:I(!1);break;case 4:U(!1)}}},[]);r.useEffect(()=>{s&&V(s),K(1,"0").then(e=>{c(e),z&&(h(s.addProvinceCode),m(s.addProvince))})},[]),r.useEffect(()=>{z&&(k(z.addCityCode),T(z.addCountyCode),D(z.addStreetCode),b(z.addCity),y(z.addCounty),w(z.addStreet),$(z.address))},[z]),r.useEffect(()=>{u?K(2,u).then(e=>{E(e),z&&(k(z.addCityCode),b(z.addCity))}):(b(void 0),y(void 0),w(void 0),m(void 0),$(""),k(void 0),E([]),T(void 0),q([]),D(void 0),M([]))},[u,K]),r.useEffect(()=>{A?K(3,A).then(e=>{q(e),z&&(T(z.addCountyCode),y(z.addCounty))}):(T(void 0),q([]),D(void 0),M([]),$(""))},[A,K,null==s?void 0:s[0],null==s?void 0:s[1],null==s?void 0:s[2]]),r.useEffect(()=>{O?K(4,O).then(e=>{M(e),z&&(D(z.addStreetCode),w(z.addStreet),$(z.address))}):(D(void 0),M([]),$(""))},[O,K,null==s?void 0:s[0],null==s?void 0:s[1],null==s?void 0:s[2],null==s?void 0:s[3]]),r.useEffect(()=>{H({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:A,addCounty:v,addCountyCode:O,addStreet:x,addStreetCode:B,address:F})},[p,g,v,u,A,O,B,x,F,H]);return n.jsxs("div",{children:[" ",n.jsxs(i.Space,{wrap:!0,id:t,children:[" ",n.jsx(i.Select,{style:{minWidth:100},options:a,value:u,onChange:e=>{var t;e===u&&void 0!==e||(h(e),m(null==(t=a.find(t=>t.value===e))?void 0:t.label))},placeholder:"请选择省",loading:d,disabled:l,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:N,value:A,onChange:e=>{var t;e===A&&void 0!==e||(b(null==(t=N.find(t=>t.value===e))?void 0:t.label),k(e))},placeholder:"请选择市",loading:C,disabled:l||!u||d,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:_,value:O,onChange:e=>{var t;e===O&&void 0!==e||(T(e),y(null==(t=_.find(t=>t.value===e))?void 0:t.label))},placeholder:"请选择区/县",loading:L,disabled:l||!A||C,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:R,value:B,onChange:e=>{var t;e===B&&void 0!==e||(D(e),w(null==(t=R.find(t=>t.value===e))?void 0:t.label))},placeholder:"请选择乡/镇",loading:P,disabled:l||!O||L,allowClear:!0}),n.jsx(i.Input,{placeholder:"请输入详细地址",disabled:l||!O,value:F,onChange:e=>$(e.target.value)})]})]})},Ge=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,key:a,disabled:c=!1})=>{const[u,h]=r.useState(!1),[d,f]=r.useState(""),[p,m]=r.useState(""),[g,b]=r.useState([]);r.useEffect(()=>{b(e?[{uid:"-1",name:"image.png",status:"done",url:e}]:[])},[e]);const v=r.useCallback(e=>{t&&t(e)},[t]),y=n.jsxs("div",{children:[n.jsx(Me,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:g,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),f(e.url||e.preview),h(!0),m(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n,r;if(b(t),"done"===e.status){const r=null==(n=e.response)?void 0:n.data;r?(i.message.success(`${e.name} 文件上传成功`),null==v||v(r)):(i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),b(t.filter(t=>t.uid!==e.uid)))}else"removed"===e.status?(i.message.success(`${e.name} 文件已移除`),null==v||v(void 0)):"error"===e.status&&(i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),null==v||v(void 0))},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e;if(r instanceof File&&r.size>8388608)return i.message.error("文件大小不能超过 8MB"),void(null==n||n(new Error("文件大小不能超过 8MB")));const o=new FormData;o.append("file",r);try{const e=await(l=o,a={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&s({percent:e.loaded/e.total*100})}},k("/platform/general/upload",l,a));e&&e.data?(null==v||v(e.data),t(e,r)):n(new Error("上传成功但响应中缺少图片URL"),e)}catch(c){n(c)}var l,a},maxCount:l,disabled:c,onRemove:e=>!0,children:g.length>=(l||1)?null:y},a),n.jsx(i.Modal,{visible:u,title:p,footer:null,onCancel:()=>h(!1),children:n.jsx("img",{alt:"example",style:{width:"100%"},src:d})})]})};var Ye="object"==typeof global&&global&&global.Object===Object&&global,Je="object"==typeof self&&self&&self.Object===Object&&self,Xe=Ye||Je||Function("return this")(),Qe=Xe.Symbol,et=Object.prototype,tt=et.hasOwnProperty,nt=et.toString,rt=Qe?Qe.toStringTag:void 0;var it=Object.prototype.toString;var st=Qe?Qe.toStringTag:void 0;function ot(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":st&&st in Object(e)?function(e){var t=tt.call(e,rt),n=e[rt];try{e[rt]=void 0;var r=!0}catch(s){}var i=nt.call(e);return r&&(t?e[rt]=n:delete e[rt]),i}(e):function(e){return it.call(e)}(e)}function lt(e){return null!=e&&"object"==typeof e}var at=Array.isArray;function ct(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ut(e){return e}function ht(e){if(!ct(e))return!1;var t=ot(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var dt,ft=Xe["__core-js_shared__"],pt=(dt=/[^.]+$/.exec(ft&&ft.keys&&ft.keys.IE_PROTO||""))?"Symbol(src)_1."+dt:"";var mt=Function.prototype.toString;function gt(e){if(null!=e){try{return mt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var bt=/^\[object .+?Constructor\]$/,vt=Function.prototype,yt=Object.prototype,xt=vt.toString,wt=yt.hasOwnProperty,Nt=RegExp("^"+xt.call(wt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Et(e){return!(!ct(e)||(t=e,pt&&pt in t))&&(ht(e)?Nt:bt).test(gt(e));var t}function At(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Et(n)?n:void 0}var kt=At(Xe,"WeakMap"),St=Object.create,Ct=function(){function e(){}return function(t){if(!ct(t))return{};if(St)return St(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var jt=Date.now;var _t,qt,Ot,Tt=function(){try{var e=At(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Lt=Tt?function(e,t){return Tt(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:ut,It=(_t=Lt,qt=0,Ot=0,function(){var e=jt(),t=16-(e-Ot);if(Ot=e,t>0){if(++qt>=800)return arguments[0]}else qt=0;return _t.apply(void 0,arguments)});var Rt=/^(?:0|[1-9]\d*)$/;function Mt(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Rt.test(e))&&e>-1&&e%1==0&&e<t}function Bt(e,t,n){"__proto__"==t&&Tt?Tt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Dt(e,t){return e===t||e!=e&&t!=t}var Pt=Object.prototype.hasOwnProperty;function Ut(e,t,n){var r=e[t];Pt.call(e,t)&&Dt(r,n)&&(void 0!==n||t in e)||Bt(e,t,n)}var Ft=Math.max;function $t(e,t){return It(function(e,t,n){return t=Ft(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=Ft(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,l)}}(e,t,ut),e+"")}function zt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Vt(e){return null!=e&&zt(e.length)&&!ht(e)}var Ht=Object.prototype;function Kt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ht)}function Wt(e){return lt(e)&&"[object Arguments]"==ot(e)}var Zt=Object.prototype,Gt=Zt.hasOwnProperty,Yt=Zt.propertyIsEnumerable,Jt=Wt(function(){return arguments}())?Wt:function(e){return lt(e)&&Gt.call(e,"callee")&&!Yt.call(e,"callee")};var Xt="object"==typeof exports&&exports&&!exports.nodeType&&exports,Qt=Xt&&"object"==typeof module&&module&&!module.nodeType&&module,en=Qt&&Qt.exports===Xt?Xe.Buffer:void 0,tn=(en?en.isBuffer:void 0)||function(){return!1},nn={};function rn(e){return function(t){return e(t)}}nn["[object Float32Array]"]=nn["[object Float64Array]"]=nn["[object Int8Array]"]=nn["[object Int16Array]"]=nn["[object Int32Array]"]=nn["[object Uint8Array]"]=nn["[object Uint8ClampedArray]"]=nn["[object Uint16Array]"]=nn["[object Uint32Array]"]=!0,nn["[object Arguments]"]=nn["[object Array]"]=nn["[object ArrayBuffer]"]=nn["[object Boolean]"]=nn["[object DataView]"]=nn["[object Date]"]=nn["[object Error]"]=nn["[object Function]"]=nn["[object Map]"]=nn["[object Number]"]=nn["[object Object]"]=nn["[object RegExp]"]=nn["[object Set]"]=nn["[object String]"]=nn["[object WeakMap]"]=!1;var sn="object"==typeof exports&&exports&&!exports.nodeType&&exports,on=sn&&"object"==typeof module&&module&&!module.nodeType&&module,ln=on&&on.exports===sn&&Ye.process,an=function(){try{var e=on&&on.require&&on.require("util").types;return e||ln&&ln.binding&&ln.binding("util")}catch(t){}}(),cn=an&&an.isTypedArray,un=cn?rn(cn):function(e){return lt(e)&&zt(e.length)&&!!nn[ot(e)]},hn=Object.prototype.hasOwnProperty;function dn(e,t){var n=at(e),r=!n&&Jt(e),i=!n&&!r&&tn(e),s=!n&&!r&&!i&&un(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!t&&!hn.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Mt(c,a))||l.push(c);return l}function fn(e,t){return function(n){return e(t(n))}}var pn=fn(Object.keys,Object),mn=Object.prototype.hasOwnProperty;function gn(e){return Vt(e)?dn(e):function(e){if(!Kt(e))return pn(e);var t=[];for(var n in Object(e))mn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var bn=Object.prototype.hasOwnProperty;function vn(e){if(!ct(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Kt(e),n=[];for(var r in e)("constructor"!=r||!t&&bn.call(e,r))&&n.push(r);return n}function yn(e){return Vt(e)?dn(e,!0):vn(e)}var xn=At(Object,"create");var wn=Object.prototype.hasOwnProperty;var Nn=Object.prototype.hasOwnProperty;function En(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function An(e,t){for(var n=e.length;n--;)if(Dt(e[n][0],t))return n;return-1}En.prototype.clear=function(){this.__data__=xn?xn(null):{},this.size=0},En.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},En.prototype.get=function(e){var t=this.__data__;if(xn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return wn.call(t,e)?t[e]:void 0},En.prototype.has=function(e){var t=this.__data__;return xn?void 0!==t[e]:Nn.call(t,e)},En.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=xn&&void 0===t?"__lodash_hash_undefined__":t,this};var kn=Array.prototype.splice;function Sn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Sn.prototype.clear=function(){this.__data__=[],this.size=0},Sn.prototype.delete=function(e){var t=this.__data__,n=An(t,e);return!(n<0)&&(n==t.length-1?t.pop():kn.call(t,n,1),--this.size,!0)},Sn.prototype.get=function(e){var t=this.__data__,n=An(t,e);return n<0?void 0:t[n][1]},Sn.prototype.has=function(e){return An(this.__data__,e)>-1},Sn.prototype.set=function(e,t){var n=this.__data__,r=An(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var Cn=At(Xe,"Map");function jn(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function _n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}_n.prototype.clear=function(){this.size=0,this.__data__={hash:new En,map:new(Cn||Sn),string:new En}},_n.prototype.delete=function(e){var t=jn(this,e).delete(e);return this.size-=t?1:0,t},_n.prototype.get=function(e){return jn(this,e).get(e)},_n.prototype.has=function(e){return jn(this,e).has(e)},_n.prototype.set=function(e,t){var n=jn(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var qn=fn(Object.getPrototypeOf,Object),On=Function.prototype,Tn=Object.prototype,Ln=On.toString,In=Tn.hasOwnProperty,Rn=Ln.call(Object);function Mn(e){var t=this.__data__=new Sn(e);this.size=t.size}Mn.prototype.clear=function(){this.__data__=new Sn,this.size=0},Mn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Mn.prototype.get=function(e){return this.__data__.get(e)},Mn.prototype.has=function(e){return this.__data__.has(e)},Mn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Sn){var r=n.__data__;if(!Cn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new _n(r)}return n.set(e,t),this.size=n.size,this};var Bn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Dn=Bn&&"object"==typeof module&&module&&!module.nodeType&&module,Pn=Dn&&Dn.exports===Bn?Xe.Buffer:void 0,Un=Pn?Pn.allocUnsafe:void 0;function Fn(e,t){if(t)return e.slice();var n=e.length,r=Un?Un(n):new e.constructor(n);return e.copy(r),r}var $n=Object.prototype.propertyIsEnumerable,zn=Object.getOwnPropertySymbols,Vn=zn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(zn(e),function(t){return $n.call(e,t)}))}:function(){return[]};function Hn(e){return function(e,t,n){var r=t(e);return at(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,gn,Vn)}var Kn=At(Xe,"DataView"),Wn=At(Xe,"Promise"),Zn=At(Xe,"Set"),Gn="[object Map]",Yn="[object Promise]",Jn="[object Set]",Xn="[object WeakMap]",Qn="[object DataView]",er=gt(Kn),tr=gt(Cn),nr=gt(Wn),rr=gt(Zn),ir=gt(kt),sr=ot;(Kn&&sr(new Kn(new ArrayBuffer(1)))!=Qn||Cn&&sr(new Cn)!=Gn||Wn&&sr(Wn.resolve())!=Yn||Zn&&sr(new Zn)!=Jn||kt&&sr(new kt)!=Xn)&&(sr=function(e){var t=ot(e),n="[object Object]"==t?e.constructor:void 0,r=n?gt(n):"";if(r)switch(r){case er:return Qn;case tr:return Gn;case nr:return Yn;case rr:return Jn;case ir:return Xn}return t});var or=Object.prototype.hasOwnProperty;var lr=Xe.Uint8Array;function ar(e){var t=new e.constructor(e.byteLength);return new lr(t).set(new lr(e)),t}var cr=/\w*$/;var ur=Qe?Qe.prototype:void 0,hr=ur?ur.valueOf:void 0;function dr(e,t){var n=t?ar(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function fr(e,t,n){var r,i,s,o,l,a=e.constructor;switch(t){case"[object ArrayBuffer]":return ar(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return l=ar((o=e).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return dr(e,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(s=new(i=e).constructor(i.source,cr.exec(i))).lastIndex=i.lastIndex,s;case"[object Symbol]":return r=e,hr?Object(hr.call(r)):{}}}function pr(e){return"function"!=typeof e.constructor||Kt(e)?{}:Ct(qn(e))}var mr=an&&an.isMap,gr=mr?rn(mr):function(e){return lt(e)&&"[object Map]"==sr(e)};var br=an&&an.isSet,vr=br?rn(br):function(e){return lt(e)&&"[object Set]"==sr(e)},yr="[object Arguments]",xr="[object Function]",wr="[object Object]",Nr={};function Er(e,t,n,r,i,s){var o,l=1&t;if(void 0!==o)return o;if(!ct(e))return e;var a=at(e);if(a)o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&or.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=sr(e),u=c==xr||"[object GeneratorFunction]"==c;if(tn(e))return Fn(e,l);if(c==wr||c==yr||u&&!i)o=u?{}:pr(e);else{if(!Nr[c])return i?e:{};o=fr(e,c,l)}}s||(s=new Mn);var h=s.get(e);if(h)return h;s.set(e,o),vr(e)?e.forEach(function(r){o.add(Er(r,t,n,r,e,s))}):gr(e)&&e.forEach(function(r,i){o.set(i,Er(r,t,n,i,e,s))});var d=a?void 0:Hn(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(d||e,function(r,i){d&&(r=e[i=r]),Ut(o,i,Er(r,t,n,i,e,s))}),o}Nr[yr]=Nr["[object Array]"]=Nr["[object ArrayBuffer]"]=Nr["[object DataView]"]=Nr["[object Boolean]"]=Nr["[object Date]"]=Nr["[object Float32Array]"]=Nr["[object Float64Array]"]=Nr["[object Int8Array]"]=Nr["[object Int16Array]"]=Nr["[object Int32Array]"]=Nr["[object Map]"]=Nr["[object Number]"]=Nr[wr]=Nr["[object RegExp]"]=Nr["[object Set]"]=Nr["[object String]"]=Nr["[object Symbol]"]=Nr["[object Uint8Array]"]=Nr["[object Uint8ClampedArray]"]=Nr["[object Uint16Array]"]=Nr["[object Uint32Array]"]=!0,Nr["[object Error]"]=Nr[xr]=Nr["[object WeakMap]"]=!1;function Ar(e){return Er(e,5)}function kr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new _n;++t<n;)this.add(e[t])}function Sr(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}kr.prototype.add=kr.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},kr.prototype.has=function(e){return this.__data__.has(e)};function Cr(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e),u=s.get(t);if(c&&u)return c==t&&u==e;var h=-1,d=!0,f=2&n?new kr:void 0;for(s.set(e,t),s.set(t,e);++h<l;){var p=e[h],m=t[h];if(r)var g=o?r(m,p,h,t,e,s):r(p,m,h,e,t,s);if(void 0!==g){if(g)continue;d=!1;break}if(f){if(!Sr(t,function(e,t){if(o=t,!f.has(o)&&(p===e||i(p,e,n,r,s)))return f.push(t);var o})){d=!1;break}}else if(p!==m&&!i(p,m,n,r,s)){d=!1;break}}return s.delete(e),s.delete(t),d}function jr(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function _r(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var qr=Qe?Qe.prototype:void 0,Or=qr?qr.valueOf:void 0;var Tr=Object.prototype.hasOwnProperty;var Lr="[object Arguments]",Ir="[object Array]",Rr="[object Object]",Mr=Object.prototype.hasOwnProperty;function Br(e,t,n,r,i,s){var o=at(e),l=at(t),a=o?Ir:sr(e),c=l?Ir:sr(t),u=(a=a==Lr?Rr:a)==Rr,h=(c=c==Lr?Rr:c)==Rr,d=a==c;if(d&&tn(e)){if(!tn(t))return!1;o=!0,u=!1}if(d&&!u)return s||(s=new Mn),o||un(e)?Cr(e,t,n,r,i,s):function(e,t,n,r,i,s,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new lr(e),new lr(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Dt(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=jr;case"[object Set]":var a=1&r;if(l||(l=_r),e.size!=t.size&&!a)return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var u=Cr(l(e),l(t),r,i,s,o);return o.delete(e),u;case"[object Symbol]":if(Or)return Or.call(e)==Or.call(t)}return!1}(e,t,a,n,r,i,s);if(!(1&n)){var f=u&&Mr.call(e,"__wrapped__"),p=h&&Mr.call(t,"__wrapped__");if(f||p){var m=f?e.value():e,g=p?t.value():t;return s||(s=new Mn),i(m,g,n,r,s)}}return!!d&&(s||(s=new Mn),function(e,t,n,r,i,s){var o=1&n,l=Hn(e),a=l.length;if(a!=Hn(t).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in t:Tr.call(t,u)))return!1}var h=s.get(e),d=s.get(t);if(h&&d)return h==t&&d==e;var f=!0;s.set(e,t),s.set(t,e);for(var p=o;++c<a;){var m=e[u=l[c]],g=t[u];if(r)var b=o?r(g,m,u,t,e,s):r(m,g,u,e,t,s);if(!(void 0===b?m===g||i(m,g,n,r,s):b)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(f=!1)}return s.delete(e),s.delete(t),f}(e,t,n,r,i,s))}function Dr(e,t,n,r,i){return e===t||(null==e||null==t||!lt(e)&&!lt(t)?e!=e&&t!=t:Br(e,t,n,r,Dr,i))}var Pr=function(e,t,n){for(var r=-1,i=Object(e),s=n(e),o=s.length;o--;){var l=s[++r];if(!1===t(i[l],l,i))break}return e};function Ur(e,t,n){(void 0!==n&&!Dt(e[t],n)||void 0===n&&!(t in e))&&Bt(e,t,n)}function Fr(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function $r(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i],l=void 0;void 0===l&&(l=e[o]),r?Bt(n,o,l):Ut(n,o,l)}return n}(e,yn(e))}function zr(e,t,n,r,i,s,o){var l=Fr(e,n),a=Fr(t,n),c=o.get(a);if(c)Ur(e,n,c);else{var u,h=s?s(l,a,n+"",e,t,o):void 0,d=void 0===h;if(d){var f=at(a),p=!f&&tn(a),m=!f&&!p&&un(a);h=a,f||p||m?at(l)?h=l:lt(u=l)&&Vt(u)?h=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(l):p?(d=!1,h=Fn(a,!0)):m?(d=!1,h=dr(a,!0)):h=[]:function(e){if(!lt(e)||"[object Object]"!=ot(e))return!1;var t=qn(e);if(null===t)return!0;var n=In.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ln.call(n)==Rn}(a)||Jt(a)?(h=l,Jt(l)?h=$r(l):ct(l)&&!ht(l)||(h=pr(a))):d=!1}d&&(o.set(a,h),i(h,a,r,s,o),o.delete(a)),Ur(e,n,h)}}function Vr(e,t,n,r,i){e!==t&&Pr(t,function(s,o){if(i||(i=new Mn),ct(s))zr(e,t,o,n,Vr,r,i);else{var l=r?r(Fr(e,o),s,o+"",e,t,i):void 0;void 0===l&&(l=s),Ur(e,o,l)}},yn)}function Hr(e,t){return Dr(e,t)}var Kr,Wr=(Kr=function(e,t,n){Vr(e,t,n)},$t(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,s=r>2?t[2]:void 0;for(i=Kr.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(e,t,n){if(!ct(n))return!1;var r=typeof t;return!!("number"==r?Vt(n)&&Mt(t,n.length):"string"==r&&t in n)&&Dt(n[t],e)}(t[0],t[1],s)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var o=t[n];o&&Kr(e,o,n,i)}return e})),Zr=(e=>(e[e.TYPE=3]="TYPE",e[e.LEVEL=12]="LEVEL",e[e.ATTRIBUTE=13]="ATTRIBUTE",e[e.BLOT=14]="BLOT",e[e.INLINE=7]="INLINE",e[e.BLOCK=11]="BLOCK",e[e.BLOCK_BLOT=10]="BLOCK_BLOT",e[e.INLINE_BLOT=6]="INLINE_BLOT",e[e.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",e[e.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",e[e.ANY=15]="ANY",e))(Zr||{});class Gr{constructor(e,t,n={}){this.attrName=e,this.keyName=t;const r=Zr.TYPE&Zr.ATTRIBUTE;this.scope=null!=n.scope?n.scope&Zr.LEVEL|r:Zr.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(e){return Array.from(e.attributes).map(e=>e.name)}add(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)}canAdd(e,t){return null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1)}remove(e){e.removeAttribute(this.keyName)}value(e){const t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""}}class Yr extends Error{constructor(e){super(e="[Parchment] "+e),this.message=e,this.name=this.constructor.name}}const Jr=class e{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(e,t=!1){if(null==e)return null;if(this.blots.has(e))return this.blots.get(e)||null;if(t){let n=null;try{n=e.parentNode}catch{return null}return this.find(n,t)}return null}create(t,n,r){const i=this.query(n);if(null==i)throw new Yr(`Unable to create ${n} blot`);const s=i,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:s.create(r),l=new s(t,o,r);return e.blots.set(l.domNode,l),l}find(t,n=!1){return e.find(t,n)}query(e,t=Zr.ANY){let n;return"string"==typeof e?n=this.types[e]||this.attributes[e]:e instanceof Text||e.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof e?e&Zr.LEVEL&Zr.BLOCK?n=this.types.block:e&Zr.LEVEL&Zr.INLINE&&(n=this.types.inline):e instanceof Element&&((e.getAttribute("class")||"").split(/\s+/).some(e=>(n=this.classes[e],!!n)),n=n||this.tags[e.tagName]),null==n?null:"scope"in n&&t&Zr.LEVEL&n.scope&&t&Zr.TYPE&n.scope?n:null}register(...e){return e.map(e=>{const t="blotName"in e,n="attrName"in e;if(!t&&!n)throw new Yr("Invalid definition");if(t&&"abstract"===e.blotName)throw new Yr("Cannot register abstract class");const r=t?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?"string"==typeof e.keyName&&(this.attributes[e.keyName]=e):t&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(e=>e.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(t=>{(null==this.tags[t]||null==e.className)&&(this.tags[t]=e)}))),e})}};Jr.blots=new WeakMap;let Xr=Jr;function Qr(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(e=>0===e.indexOf(`${t}-`))}const ei=class extends Gr{static keys(e){return(e.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(`${this.keyName}-${t}`),!0)}remove(e){Qr(e,this.keyName).forEach(t=>{e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")}value(e){const t=(Qr(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""}};function ti(e){const t=e.split("-"),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("");return t[0]+n}const ni=class extends Gr{static keys(e){return(e.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(e,t){return!!this.canAdd(e,t)&&(e.style[ti(this.keyName)]=t,!0)}remove(e){e.style[ti(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")}value(e){const t=e.style[ti(this.keyName)];return this.canAdd(e,t)?t:""}};const ri=class{constructor(e){this.attributes={},this.domNode=e,this.build()}attribute(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])}build(){this.attributes={};const e=Xr.find(this.domNode);if(null==e)return;const t=Gr.keys(this.domNode),n=ei.keys(this.domNode),r=ni.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{const n=e.scroll.query(t,Zr.ATTRIBUTE);n instanceof Gr&&(this.attributes[n.attrName]=n)})}copy(e){Object.keys(this.attributes).forEach(t=>{const n=this.attributes[t].value(this.domNode);e.format(t,n)})}move(e){this.copy(e),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((e,t)=>(e[t]=this.attributes[t].value(this.domNode),e),{})}},ii=class{constructor(e,t){this.scroll=e,this.domNode=t,Xr.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(null==this.tagName)throw new Yr("Blot definition missing tagName");let t,n;return Array.isArray(this.tagName)?("string"==typeof e?(n=e.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof e&&(n=e),t="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t}get statics(){return this.constructor}attach(){}clone(){const e=this.domNode.cloneNode(!1);return this.scroll.create(e)}detach(){null!=this.parent&&this.parent.removeChild(this),Xr.blots.delete(this.domNode)}deleteAt(e,t){this.isolate(e,t).remove()}formatAt(e,t,n,r){const i=this.isolate(e,t);if(null!=this.scroll.query(n,Zr.BLOT)&&r)i.wrap(n,r);else if(null!=this.scroll.query(n,Zr.ATTRIBUTE)){const e=this.scroll.create(this.statics.scope);i.wrap(e),e.format(n,r)}}insertAt(e,t,n){const r=null==n?this.scroll.create("text",t):this.scroll.create(t,n),i=this.split(e);this.parent.insertBefore(r,i||void 0)}isolate(e,t){const n=this.split(e);if(null==n)throw new Error("Attempt to isolate at end");return n.split(t),n}length(){return 1}offset(e=this.parent){return null==this.parent||this===e?0:this.parent.children.offset(this)+this.parent.offset(e)}optimize(e){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(e,t){return 0===e?this:this.next}update(e,t){}wrap(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Yr(`Cannot wrap ${e}`);return n.appendChild(this),n}};ii.blotName="abstract";let si=ii;const oi=class extends si{static value(e){return!0}index(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1}position(e,t){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};oi.scope=Zr.INLINE_BLOT;const li=oi;class ai{constructor(){this.head=null,this.tail=null,this.length=0}append(...e){if(this.insertBefore(e[0],null),e.length>1){const t=e.slice(1);this.append(...t)}}at(e){const t=this.iterator();let n=t();for(;n&&e>0;)e-=1,n=t();return n}contains(e){const t=this.iterator();let n=t();for(;n;){if(n===e)return!0;n=t()}return!1}indexOf(e){const t=this.iterator();let n=t(),r=0;for(;n;){if(n===e)return r;r+=1,n=t()}return-1}insertBefore(e,t){null!=e&&(this.remove(e),e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)}offset(e){let t=0,n=this.head;for(;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return-1}remove(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)}iterator(e=this.head){return()=>{const t=e;return null!=e&&(e=e.next),t}}find(e,t=!1){const n=this.iterator();let r=n();for(;r;){const i=r.length();if(e<i||t&&e===i&&(null==r.next||0!==r.next.length()))return[r,e];e-=i,r=n()}return[null,0]}forEach(e){const t=this.iterator();let n=t();for(;n;)e(n),n=t()}forEachAt(e,t,n){if(t<=0)return;const[r,i]=this.find(e);let s=e-i;const o=this.iterator(r);let l=o();for(;l&&s<e+t;){const r=l.length();e>s?n(l,e-s,Math.min(t,s+r-e)):n(l,0,Math.min(r,e+t-s)),s+=r,l=o()}}map(e){return this.reduce((t,n)=>(t.push(e(n)),t),[])}reduce(e,t){const n=this.iterator();let r=n();for(;r;)t=e(t,r),r=n();return t}}function ci(e,t){const n=t.find(e);if(n)return n;try{return t.create(e)}catch{const n=t.create(Zr.INLINE);return Array.from(e.childNodes).forEach(e=>{n.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(n.domNode,e),n.attach(),n}}const ui=class e extends si{constructor(e,t){super(e,t),this.uiNode=null,this.build()}appendChild(e){this.insertBefore(e)}attach(){super.attach(),this.children.forEach(e=>{e.attach()})}attachUI(t){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=t,e.uiClass&&this.uiNode.classList.add(e.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new ai,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{const t=ci(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(t){if(t instanceof Yr)return;throw t}})}deleteAt(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,(e,t,n)=>{e.deleteAt(t,n)})}descendant(t,n=0){const[r,i]=this.children.find(n);return null==t.blotName&&t(r)||null!=t.blotName&&r instanceof t?[r,i]:r instanceof e?r.descendant(t,i):[null,-1]}descendants(t,n=0,r=Number.MAX_VALUE){let i=[],s=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&i.push(n),n instanceof e&&(i=i.concat(n.descendants(t,r,s))),s-=o}),i}detach(){this.children.forEach(e=>{e.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(n=>{t||this.statics.allowedChildren.some(e=>n instanceof e)||(n.statics.scope===Zr.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),t=!0):n instanceof e?n.unwrap():n.remove())})}formatAt(e,t,n,r){this.children.forEachAt(e,t,(e,t,i)=>{e.formatAt(t,i,n,r)})}insertAt(e,t,n){const[r,i]=this.children.find(e);if(r)r.insertAt(i,t,n);else{const e=null==n?this.scroll.create("text",t):this.scroll.create(t,n);this.appendChild(e)}}insertBefore(e,t){null!=e.parent&&e.parent.children.remove(e);let n=null;this.children.insertBefore(e,t||null),e.parent=this,null!=t&&(n=t.domNode),(this.domNode.parentNode!==e.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(e.domNode,n),e.attach()}length(){return this.children.reduce((e,t)=>e+t.length(),0)}moveChildren(e,t){this.children.forEach(n=>{e.insertBefore(n,t)})}optimize(e){if(super.optimize(e),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,n=!1){const[r,i]=this.children.find(t,n),s=[[this,t]];return r instanceof e?s.concat(r.path(i,n)):(null!=r&&s.push([r,i]),s)}removeChild(e){this.children.remove(e)}replaceWith(t,n){const r="string"==typeof t?this.scroll.create(t,n):t;return r instanceof e&&this.moveChildren(r),super.replaceWith(r)}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(e,this.length(),(e,r,i)=>{const s=e.split(r,t);null!=s&&n.appendChild(s)}),n}splitAfter(e){const t=this.clone();for(;null!=e.next;)t.appendChild(e.next);return this.parent&&this.parent.insertBefore(t,this.next||void 0),t}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(e,t){const n=[],r=[];e.forEach(e=>{e.target===this.domNode&&"childList"===e.type&&(n.push(...e.addedNodes),r.push(...e.removedNodes))}),r.forEach(e=>{if(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const t=this.scroll.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===this.domNode)&&t.detach()}),n.filter(e=>e.parentNode===this.domNode&&e!==this.uiNode).sort((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(e=>{let t=null;null!=e.nextSibling&&(t=this.scroll.find(e.nextSibling));const n=ci(e,this.scroll);(n.next!==t||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};ui.uiClass="";const hi=ui;const di=class e extends hi{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ri(this.domNode)}format(t,n){if(t!==this.statics.blotName||n){const e=this.scroll.query(t,Zr.INLINE);if(null==e)return;e instanceof Gr?this.attributes.attribute(e,n):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n)}else this.children.forEach(t=>{t instanceof e||(t=t.wrap(e.blotName,!0)),this.attributes.copy(t)}),this.unwrap()}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.formats()[n]||this.scroll.query(n,Zr.ATTRIBUTE)?this.isolate(e,t).format(n,r):super.formatAt(e,t,n,r)}optimize(t){super.optimize(t);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof e&&r.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}wrap(t,n){const r=super.wrap(t,n);return r instanceof e&&this.attributes.move(r),r}};di.allowedChildren=[di,li],di.blotName="inline",di.scope=Zr.INLINE_BLOT,di.tagName="SPAN";const fi=di,pi=class e extends hi{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ri(this.domNode)}format(t,n){const r=this.scroll.query(t,Zr.BLOCK);null!=r&&(r instanceof Gr?this.attributes.attribute(r,n):t!==this.statics.blotName||n?n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n):this.replaceWith(e.blotName))}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.scroll.query(n,Zr.BLOCK)?this.format(n,r):super.formatAt(e,t,n,r)}insertAt(e,t,n){if(null==n||null!=this.scroll.query(t,Zr.INLINE))super.insertAt(e,t,n);else{const r=this.split(e);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const e=this.scroll.create(t,n);r.parent.insertBefore(e,r)}}}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}};pi.blotName="block",pi.scope=Zr.BLOCK_BLOT,pi.tagName="P",pi.allowedChildren=[fi,pi,li];const mi=pi,gi=class extends hi{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(e,t){super.deleteAt(e,t),this.enforceAllowedChildren()}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.enforceAllowedChildren()}insertAt(e,t,n){super.insertAt(e,t,n),this.enforceAllowedChildren()}optimize(e){super.optimize(e),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};gi.blotName="container",gi.scope=Zr.BLOCK_BLOT;const bi=gi;const vi=class extends li{static formats(e,t){}format(e,t){super.formatAt(0,this.length(),e,t)}formatAt(e,t,n,r){0===e&&t===this.length()?this.format(n,r):super.formatAt(e,t,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},yi={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},xi=class extends hi{constructor(e,t){super(null,t),this.registry=e,this.scroll=this,this.build(),this.observer=new MutationObserver(e=>{this.update(e)}),this.observer.observe(this.domNode,yi),this.attach()}create(e,t){return this.registry.create(this,e,t)}find(e,t=!1){const n=this.registry.find(e,t);return n?n.scroll===this?n:t?this.find(n.scroll.domNode.parentNode,!0):null:null}query(e,t=Zr.ANY){return this.registry.query(e,t)}register(...e){return this.registry.register(...e)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(e,t){this.update(),0===e&&t===this.length()?this.children.forEach(e=>{e.remove()}):super.deleteAt(e,t)}formatAt(e,t,n,r){this.update(),super.formatAt(e,t,n,r)}insertAt(e,t,n){this.update(),super.insertAt(e,t,n)}optimize(e=[],t={}){super.optimize(t);const n=t.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)e.push(r.pop());const i=(e,t=!0)=>{null==e||e===this||null!=e.domNode.parentNode&&(n.has(e.domNode)||n.set(e.domNode,[]),t&&i(e.parent))},s=e=>{n.has(e.domNode)&&(e instanceof hi&&e.children.forEach(s),n.delete(e.domNode),e.optimize(t))};let o=e;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(e=>{const t=this.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(i(this.find(e.previousSibling,!1)),Array.from(e.addedNodes).forEach(e=>{const t=this.find(e,!1);i(t,!1),t instanceof hi&&t.children.forEach(e=>{i(e,!1)})})):"attributes"===e.type&&i(t.prev)),i(t))}),this.children.forEach(s),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)e.push(r.pop())}}update(e,t={}){e=e||this.observer.takeRecords();const n=new WeakMap;e.map(e=>{const t=this.find(e.target,!0);return null==t?null:n.has(t.domNode)?(n.get(t.domNode).push(e),null):(n.set(t.domNode,[e]),t)}).forEach(e=>{null!=e&&e!==this&&n.has(e.domNode)&&e.update(n.get(e.domNode)||[],t)}),t.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),t),this.optimize(e,t)}};xi.blotName="scroll",xi.defaultChild=mi,xi.allowedChildren=[mi,bi],xi.scope=Zr.BLOCK_BLOT,xi.tagName="DIV";const wi=xi,Ni=class e extends li{static create(e){return document.createTextNode(e)}static value(e){return e.data}constructor(e,t){super(e,t),this.text=this.statics.value(this.domNode)}deleteAt(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)}index(e,t){return this.domNode===e?t:-1}insertAt(e,t,n){null==n?(this.text=this.text.slice(0,e)+t+this.text.slice(e),this.domNode.data=this.text):super.insertAt(e,t,n)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(e,t=!1){return[this.domNode,e]}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(e,t){e.some(e=>"characterData"===e.type&&e.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};Ni.blotName="text",Ni.scope=Zr.INLINE_BLOT;const Ei=Ni,Ai=Object.freeze(Object.defineProperty({__proto__:null,Attributor:Gr,AttributorStore:ri,BlockBlot:mi,ClassAttributor:ei,ContainerBlot:bi,EmbedBlot:vi,InlineBlot:fi,LeafBlot:li,ParentBlot:hi,Registry:Xr,Scope:Zr,ScrollBlot:wi,StyleAttributor:ni,TextBlot:Ei},Symbol.toStringTag,{value:"Module"}));var ki,Si,Ci={exports:{}};function ji(){if(Si)return ki;Si=1;var e=-1;function t(d,f,p,m,b){if(d===f)return d?[[0,d]]:[];if(null!=p){var v=function(e,t,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,i="number"==typeof n?null:n.newRange,s=e.length,o=t.length;if(0===r.length&&(null===i||0===i.length)){var l=r.index,a=e.slice(0,l),c=e.slice(l),u=i?i.index:null,h=l+o-s;if((null===u||u===h)&&!(h<0||h>o)){var d=t.slice(0,h);if((m=t.slice(h))===c){var f=Math.min(l,h);if((v=a.slice(0,f))===(x=d.slice(0,f)))return g(v,a.slice(f),d.slice(f),c)}}if(null===u||u===l){var p=l,m=(d=t.slice(0,p),t.slice(p));if(d===a){var b=Math.min(s-p,o-p);if((y=c.slice(c.length-b))===(w=m.slice(m.length-b)))return g(a,c.slice(0,c.length-b),m.slice(0,m.length-b),y)}}}if(r.length>0&&i&&0===i.length){var v=e.slice(0,r.index),y=e.slice(r.index+r.length);if(!(o<(f=v.length)+(b=y.length))){var x=t.slice(0,f),w=t.slice(o-b);if(v===x&&y===w)return g(v,e.slice(f,s-b),t.slice(f,o-b),y)}}return null}(d,f,p);if(v)return v}var y=r(d,f),x=d.substring(0,y);y=s(d=d.substring(y),f=f.substring(y));var w=d.substring(d.length-y),N=function(i,o){var l;if(!i)return[[1,o]];if(!o)return[[e,i]];var a=i.length>o.length?i:o,c=i.length>o.length?o:i,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],i.length>o.length&&(l[0][0]=l[2][0]=e),l;if(1===c.length)return[[e,i],[1,o]];var h=function(e,t){var n=e.length>t.length?e:t,i=e.length>t.length?t:e;if(n.length<4||2*i.length<n.length)return null;function o(e,t,n){for(var i,o,l,a,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,h="";-1!==(u=t.indexOf(c,u+1));){var d=r(e.substring(n),t.substring(u)),f=s(e.substring(0,n),t.substring(0,u));h.length<f+d&&(h=t.substring(u-f,u)+t.substring(u,u+d),i=e.substring(0,n-f),o=e.substring(n+d),l=t.substring(0,u-f),a=t.substring(u+d))}return 2*h.length>=e.length?[i,o,l,a,h]:null}var l,a,c,u,h,d=o(n,i,Math.ceil(n.length/4)),f=o(n,i,Math.ceil(n.length/2));if(!d&&!f)return null;l=f?d&&d[4].length>f[4].length?d:f:d;e.length>t.length?(a=l[0],c=l[1],u=l[2],h=l[3]):(u=l[0],h=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,h,p]}(i,o);if(h){var d=h[0],f=h[1],p=h[2],m=h[3],g=h[4],b=t(d,p),v=t(f,m);return b.concat([[0,g]],v)}return function(t,r){for(var i=t.length,s=r.length,o=Math.ceil((i+s)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),h=0;h<a;h++)c[h]=-1,u[h]=-1;c[l+1]=0,u[l+1]=0;for(var d=i-s,f=d%2!=0,p=0,m=0,g=0,b=0,v=0;v<o;v++){for(var y=-v+p;y<=v-m;y+=2){for(var x=l+y,w=(S=y===-v||y!==v&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-y;S<i&&w<s&&t.charAt(S)===r.charAt(w);)S++,w++;if(c[x]=S,S>i)m+=2;else if(w>s)p+=2;else if(f){if((A=l+d-y)>=0&&A<a&&-1!==u[A])if(S>=(E=i-u[A]))return n(t,r,S,w)}}for(var N=-v+g;N<=v-b;N+=2){for(var E,A=l+N,k=(E=N===-v||N!==v&&u[A-1]<u[A+1]?u[A+1]:u[A-1]+1)-N;E<i&&k<s&&t.charAt(i-E-1)===r.charAt(s-k-1);)E++,k++;if(u[A]=E,E>i)b+=2;else if(k>s)g+=2;else if(!f){if((x=l+d-N)>=0&&x<a&&-1!==c[x]){var S;w=l+(S=c[x])-x;if(S>=(E=i-E))return n(t,r,S,w)}}}}return[[e,t],[1,r]]}(i,o)}(d=d.substring(0,d.length-y),f=f.substring(0,f.length-y));return x&&N.unshift([0,x]),w&&N.push([0,w]),h(N,b),m&&function(t){var n=!1,r=[],d=0,f=null,p=0,m=0,g=0,b=0,v=0;for(;p<t.length;)0==t[p][0]?(r[d++]=p,m=b,g=v,b=0,v=0,f=t[p][1]):(1==t[p][0]?b+=t[p][1].length:v+=t[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(b,v)&&(t.splice(r[d-1],0,[e,f]),t[r[d-1]+1][0]=1,d--,p=--d>0?r[d-1]:-1,m=0,g=0,b=0,v=0,f=null,n=!0)),p++;n&&h(t);(function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(o),s=r.match(o),h=i&&n.match(l),d=s&&r.match(l),f=h&&n.match(a),p=d&&r.match(a),m=f&&e.match(c),g=p&&t.match(u);return m||g?5:f||p?4:i&&!h&&d?3:h||d?2:i||s?1:0}var n=1;for(;n<e.length-1;){if(0==e[n-1][0]&&0==e[n+1][0]){var r=e[n-1][1],i=e[n][1],h=e[n+1][1],d=s(r,i);if(d){var f=i.substring(i.length-d);r=r.substring(0,r.length-d),i=f+i.substring(0,i.length-d),h=f+h}for(var p=r,m=i,g=h,b=t(r,i)+t(i,h);i.charAt(0)===h.charAt(0);){r+=i.charAt(0),i=i.substring(1)+h.charAt(0),h=h.substring(1);var v=t(r,i)+t(i,h);v>=b&&(b=v,p=r,m=i,g=h)}e[n-1][1]!=p&&(p?e[n-1][1]=p:(e.splice(n-1,1),n--),e[n][1]=m,g?e[n+1][1]=g:(e.splice(n+1,1),n--))}n++}})(t),p=1;for(;p<t.length;){if(t[p-1][0]==e&&1==t[p][0]){var y=t[p-1][1],x=t[p][1],w=i(y,x),N=i(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(t.splice(p,0,[0,x.substring(0,w)]),t[p-1][1]=y.substring(0,y.length-w),t[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(t.splice(p,0,[0,y.substring(0,N)]),t[p-1][0]=1,t[p-1][1]=x.substring(0,x.length-N),t[p+1][0]=e,t[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(e,n,r,i){var s=e.substring(0,r),o=n.substring(0,i),l=e.substring(r),a=n.substring(i),c=t(s,o),u=t(l,a);return c.concat(u)}function r(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(s,i)==t.substring(s,i)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return d(e.charCodeAt(i-1))&&i--,i}function i(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var s=0,o=1;;){var l=e.substring(i-o),a=t.indexOf(l);if(-1==a)return s;o+=a,0!=a&&e.substring(i-o)!=t.substring(0,o)||(s=o,o++)}}function s(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(e.length-i,e.length-s)==t.substring(t.length-i,t.length-s)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return f(e.charCodeAt(e.length-i))&&i--,i}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,c=/\n\r?\n$/,u=/^\r?\n\r?\n/;function h(t,n){t.push([0,""]);for(var i,o=0,l=0,a=0,c="",u="";o<t.length;)if(o<t.length-1&&!t[o][1])t.splice(o,1);else switch(t[o][0]){case 1:a++,u+=t[o][1],o++;break;case e:l++,c+=t[o][1],o++;break;case 0:var d=o-a-l-1;if(n){if(d>=0&&m(t[d][1])){var f=t[d][1].slice(-1);if(t[d][1]=t[d][1].slice(0,-1),c=f+c,u=f+u,!t[d][1]){t.splice(d,1),o--;var g=d-1;t[g]&&1===t[g][0]&&(a++,u=t[g][1]+u,g--),t[g]&&t[g][0]===e&&(l++,c=t[g][1]+c,g--),d=g}}if(p(t[o][1])){f=t[o][1].charAt(0);t[o][1]=t[o][1].slice(1),c+=f,u+=f}}if(o<t.length-1&&!t[o][1]){t.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(i=r(u,c))&&(d>=0?t[d][1]+=u.substring(0,i):(t.splice(0,0,[0,u.substring(0,i)]),o++),u=u.substring(i),c=c.substring(i)),0!==(i=s(u,c))&&(t[o][1]=u.substring(u.length-i)+t[o][1],u=u.substring(0,u.length-i),c=c.substring(0,c.length-i)));var b=a+l;0===c.length&&0===u.length?(t.splice(o-b,b),o-=b):0===c.length?(t.splice(o-b,b,[1,u]),o=o-b+1):0===u.length?(t.splice(o-b,b,[e,c]),o=o-b+1):(t.splice(o-b,b,[e,c],[1,u]),o=o-b+2)}0!==o&&0===t[o-1][0]?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,l=0,c="",u=""}""===t[t.length-1][1]&&t.pop();var v=!1;for(o=1;o<t.length-1;)0===t[o-1][0]&&0===t[o+1][0]&&(t[o][1].substring(t[o][1].length-t[o-1][1].length)===t[o-1][1]?(t[o][1]=t[o-1][1]+t[o][1].substring(0,t[o][1].length-t[o-1][1].length),t[o+1][1]=t[o-1][1]+t[o+1][1],t.splice(o-1,1),v=!0):t[o][1].substring(0,t[o+1][1].length)==t[o+1][1]&&(t[o-1][1]+=t[o+1][1],t[o][1]=t[o][1].substring(t[o+1][1].length)+t[o+1][1],t.splice(o+1,1),v=!0)),o++;v&&h(t,n)}function d(e){return e>=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function p(e){return f(e.charCodeAt(0))}function m(e){return d(e.charCodeAt(e.length-1))}function g(t,n,r,i){return m(t)||p(i)?null:function(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}([[0,t],[e,n],[1,r],[0,i]])}function b(e,n,r,i){return t(e,n,r,i,!0)}return b.INSERT=1,b.DELETE=e,b.EQUAL=0,ki=b}var _i,qi={exports:{}};function Oi(){return _i||(_i=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Boolean]",o="[object Date]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",u="[object Number]",h="[object Object]",d="[object Promise]",f="[object RegExp]",p="[object Set]",m="[object String]",g="[object Symbol]",b="[object WeakMap]",v="[object ArrayBuffer]",y="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",N="[object Int8Array]",E="[object Int16Array]",A="[object Int32Array]",k="[object Uint8Array]",S="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",_=/\w*$/,q=/^\[object .+?Constructor\]$/,O=/^(?:0|[1-9]\d*)$/,T={};T[i]=T["[object Array]"]=T[v]=T[y]=T[s]=T[o]=T[x]=T[w]=T[N]=T[E]=T[A]=T[c]=T[u]=T[h]=T[f]=T[p]=T[m]=T[g]=T[k]=T[S]=T[C]=T[j]=!0,T["[object Error]"]=T[l]=T[b]=!1;var L="object"==typeof U&&U&&U.Object===Object&&U,I="object"==typeof self&&self&&self.Object===Object&&self,R=L||I||Function("return this")(),M=t&&!t.nodeType&&t,B=M&&e&&!e.nodeType&&e,D=B&&B.exports===M;function P(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function $(e,t,n,r){for(var i=-1,s=e?e.length:0;++i<s;)n=t(n,e[i],i,e);return n}function z(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function V(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function H(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var W=Array.prototype,Z=Function.prototype,G=Object.prototype,Y=R["__core-js_shared__"],J=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),X=Z.toString,Q=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=D?R.Buffer:void 0,re=R.Symbol,ie=R.Uint8Array,se=H(Object.getPrototypeOf,Object),oe=Object.create,le=G.propertyIsEnumerable,ae=W.splice,ce=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,he=H(Object.keys,Object),de=Be(R,"DataView"),fe=Be(R,"Map"),pe=Be(R,"Promise"),me=Be(R,"Set"),ge=Be(R,"WeakMap"),be=Be(Object,"create"),ve=$e(de),ye=$e(fe),xe=$e(pe),we=$e(me),Ne=$e(ge),Ee=re?re.prototype:void 0,Ae=Ee?Ee.valueOf:void 0;function ke(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new Se(e)}function _e(e,t){var n=Ve(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&He(e)}(e)&&Q.call(e,"callee")&&(!le.call(e,"callee")||ee.call(e)==i)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,s=!!r;for(var o in e)!Q.call(e,o)||s&&("length"==o||Ue(o,r))||n.push(o);return n}function qe(e,t,n){var r=e[t];Q.call(e,t)&&ze(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Oe(e,t){for(var n=e.length;n--;)if(ze(e[n][0],t))return n;return-1}function Te(e,t,n,r,d,b,q){var O;if(r&&(O=b?r(e,d,b,q):r(e)),void 0!==O)return O;if(!Ze(e))return e;var L=Ve(e);if(L){if(O=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,O)}else{var I=Pe(e),R=I==l||I==a;if(Ke(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(I==h||I==i||R&&!b){if(z(e))return b?e:{};if(O=function(e){return"function"!=typeof e.constructor||Fe(e)?{}:(t=se(e),Ze(t)?oe(t):{});var t}(R?{}:e),!t)return function(e,t){return Re(e,De(e),t)}(e,function(e,t){return e&&Re(t,Ge(t),e)}(O,e))}else{if(!T[I])return b?e:{};O=function(e,t,n,r){var i=e.constructor;switch(t){case v:return Ie(e);case s:case o:return new i(+e);case y:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case x:case w:case N:case E:case A:case k:case S:case C:case j:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(V(e),!0):V(e);return $(r,P,new e.constructor)}(e,r,n);case u:case m:return new i(e);case f:return function(e){var t=new e.constructor(e.source,_.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(K(e),!0):K(e);return $(r,F,new e.constructor)}(e,r,n);case g:return l=e,Ae?Object(Ae.call(l)):{}}var l}(e,I,Te,t)}}q||(q=new je);var M=q.get(e);if(M)return M;if(q.set(e,O),!L)var B=n?function(e){return function(e,t,n){var r=t(e);return Ve(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,Ge,De)}(e):Ge(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(B||e,function(i,s){B&&(i=e[s=i]),qe(O,s,Te(i,t,n,r,s,e,q))}),O}function Le(e){return!(!Ze(e)||function(e){return!!J&&J in e}(e))&&(We(e)||z(e)?te:q).test($e(e))}function Ie(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Re(e,t,n,r){n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i];qe(n,o,e[o])}return n}function Me(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Be(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}ke.prototype.clear=function(){this.__data__=be?be(null):{}},ke.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},ke.prototype.get=function(e){var t=this.__data__;if(be){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},ke.prototype.has=function(e){var t=this.__data__;return be?void 0!==t[e]:Q.call(t,e)},ke.prototype.set=function(e,t){return this.__data__[e]=be&&void 0===t?n:t,this},Se.prototype.clear=function(){this.__data__=[]},Se.prototype.delete=function(e){var t=this.__data__,n=Oe(t,e);return!(n<0)&&(n==t.length-1?t.pop():ae.call(t,n,1),!0)},Se.prototype.get=function(e){var t=this.__data__,n=Oe(t,e);return n<0?void 0:t[n][1]},Se.prototype.has=function(e){return Oe(this.__data__,e)>-1},Se.prototype.set=function(e,t){var n=this.__data__,r=Oe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ce.prototype.clear=function(){this.__data__={hash:new ke,map:new(fe||Se),string:new ke}},Ce.prototype.delete=function(e){return Me(this,e).delete(e)},Ce.prototype.get=function(e){return Me(this,e).get(e)},Ce.prototype.has=function(e){return Me(this,e).has(e)},Ce.prototype.set=function(e,t){return Me(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new Se},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Se){var r=n.__data__;if(!fe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ce(r)}return n.set(e,t),this};var De=ce?H(ce,Object):function(){return[]},Pe=function(e){return ee.call(e)};function Ue(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||O.test(e))&&e>-1&&e%1==0&&e<t}function Fe(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function $e(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function ze(e,t){return e===t||e!=e&&t!=t}(de&&Pe(new de(new ArrayBuffer(1)))!=y||fe&&Pe(new fe)!=c||pe&&Pe(pe.resolve())!=d||me&&Pe(new me)!=p||ge&&Pe(new ge)!=b)&&(Pe=function(e){var t=ee.call(e),n=t==h?e.constructor:void 0,r=n?$e(n):void 0;if(r)switch(r){case ve:return y;case ye:return c;case xe:return d;case we:return p;case Ne:return b}return t});var Ve=Array.isArray;function He(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!We(e)}var Ke=ue||function(){return!1};function We(e){var t=Ze(e)?ee.call(e):"";return t==l||t==a}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return He(e)?_e(e):function(e){if(!Fe(e))return he(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Te(e,!0,!0)}}(qi,qi.exports)),qi.exports}var Ti,Li={exports:{}};function Ii(){return Ti||(Ti=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",u="[object Map]",h="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",b="[object Symbol]",v="[object WeakMap]",y="[object ArrayBuffer]",x="[object DataView]",w=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[i]=E[s]=E[y]=E[o]=E[x]=E[l]=E[a]=E[c]=E[u]=E[h]=E[d]=E[p]=E[m]=E[g]=E[v]=!1;var A="object"==typeof U&&U&&U.Object===Object&&U,k="object"==typeof self&&self&&self.Object===Object&&self,S=A||k||Function("return this")(),C=t&&!t.nodeType&&t,j=C&&e&&!e.nodeType&&e,_=j&&j.exports===C,q=_&&A.process,O=function(){try{return q&&q.binding&&q.binding("util")}catch(e){}}(),T=O&&O.isTypedArray;function L(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function I(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function R(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,P=S["__core-js_shared__"],F=B.toString,$=D.hasOwnProperty,z=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),V=D.toString,H=RegExp("^"+F.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),K=_?S.Buffer:void 0,W=S.Symbol,Z=S.Uint8Array,G=D.propertyIsEnumerable,Y=M.splice,J=W?W.toStringTag:void 0,X=Object.getOwnPropertySymbols,Q=K?K.isBuffer:void 0,ee=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),te=_e(S,"DataView"),ne=_e(S,"Map"),re=_e(S,"Promise"),ie=_e(S,"Set"),se=_e(S,"WeakMap"),oe=_e(Object,"create"),le=Le(te),ae=Le(ne),ce=Le(re),ue=Le(ie),he=Le(se),de=W?W.prototype:void 0,fe=de?de.valueOf:void 0;function pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function be(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ge;++t<n;)this.add(e[t])}function ve(e){var t=this.__data__=new me(e);this.size=t.size}function ye(e,t){var n=Me(e),r=!n&&Re(e),i=!n&&!r&&Be(e),s=!n&&!r&&!i&&$e(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!$.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Te(c,a))||l.push(c);return l}function xe(e,t){for(var n=e.length;n--;)if(Ie(e[n][0],t))return n;return-1}function we(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?function(e){var t=$.call(e,J),n=e[J];try{e[J]=void 0;var r=!0}catch(s){}var i=V.call(e);r&&(t?e[J]=n:delete e[J]);return i}(e):function(e){return V.call(e)}(e)}function Ne(e){return Fe(e)&&we(e)==i}function Ee(e,t,n,r,c){return e===t||(null==e||null==t||!Fe(e)&&!Fe(t)?e!=e&&t!=t:function(e,t,n,r,c,f){var v=Me(e),w=Me(t),N=v?s:Oe(e),E=w?s:Oe(t),A=(N=N==i?d:N)==d,k=(E=E==i?d:E)==d,S=N==E;if(S&&Be(e)){if(!Be(t))return!1;v=!0,A=!1}if(S&&!A)return f||(f=new ve),v||$e(e)?Se(e,t,n,r,c,f):function(e,t,n,r,i,s,c){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!s(new Z(e),new Z(t)));case o:case l:case h:return Ie(+e,+t);case a:return e.name==t.name&&e.message==t.message;case p:case g:return e==t+"";case u:var d=I;case m:var f=1&r;if(d||(d=R),e.size!=t.size&&!f)return!1;var v=c.get(e);if(v)return v==t;r|=2,c.set(e,t);var w=Se(d(e),d(t),r,i,s,c);return c.delete(e),w;case b:if(fe)return fe.call(e)==fe.call(t)}return!1}(e,t,N,n,r,c,f);if(!(1&n)){var C=A&&$.call(e,"__wrapped__"),j=k&&$.call(t,"__wrapped__");if(C||j){var _=C?e.value():e,q=j?t.value():t;return f||(f=new ve),c(_,q,n,r,f)}}if(!S)return!1;return f||(f=new ve),function(e,t,n,r,i,s){var o=1&n,l=Ce(e),a=l.length,c=Ce(t),u=c.length;if(a!=u&&!o)return!1;var h=a;for(;h--;){var d=l[h];if(!(o?d in t:$.call(t,d)))return!1}var f=s.get(e);if(f&&s.get(t))return f==t;var p=!0;s.set(e,t),s.set(t,e);var m=o;for(;++h<a;){var g=e[d=l[h]],b=t[d];if(r)var v=o?r(b,g,d,t,e,s):r(g,b,d,e,t,s);if(!(void 0===v?g===b||i(g,b,n,r,s):v)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){var y=e.constructor,x=t.constructor;y==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,n,r,c,f)}(e,t,n,r,Ee,c))}function Ae(e){return!(!Ue(e)||function(e){return!!z&&z in e}(e))&&(De(e)?H:w).test(Le(e))}function ke(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||D,t!==r)return ee(e);var t,n,r,i=[];for(var s in Object(e))$.call(e,s)&&"constructor"!=s&&i.push(s);return i}function Se(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var u=-1,h=!0,d=2&n?new be:void 0;for(s.set(e,t),s.set(t,e);++u<l;){var f=e[u],p=t[u];if(r)var m=o?r(p,f,u,t,e,s):r(f,p,u,e,t,s);if(void 0!==m){if(m)continue;h=!1;break}if(d){if(!L(t,function(e,t){if(o=t,!d.has(o)&&(f===e||i(f,e,n,r,s)))return d.push(t);var o})){h=!1;break}}else if(f!==p&&!i(f,p,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Ce(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,ze,qe)}function je(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function _e(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Ae(n)?n:void 0}pe.prototype.clear=function(){this.__data__=oe?oe(null):{},this.size=0},pe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pe.prototype.get=function(e){var t=this.__data__;if(oe){var r=t[e];return r===n?void 0:r}return $.call(t,e)?t[e]:void 0},pe.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:$.call(t,e)},pe.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oe&&void 0===t?n:t,this},me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=xe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Y.call(t,n,1),--this.size,!0)},me.prototype.get=function(e){var t=this.__data__,n=xe(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return xe(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,r=xe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ge.prototype.clear=function(){this.size=0,this.__data__={hash:new pe,map:new(ne||me),string:new pe}},ge.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},ge.prototype.get=function(e){return je(this,e).get(e)},ge.prototype.has=function(e){return je(this,e).has(e)},ge.prototype.set=function(e,t){var n=je(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},be.prototype.add=be.prototype.push=function(e){return this.__data__.set(e,n),this},be.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.clear=function(){this.__data__=new me,this.size=0},ve.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ve.prototype.get=function(e){return this.__data__.get(e)},ve.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.set=function(e,t){var n=this.__data__;if(n instanceof me){var r=n.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ge(r)}return n.set(e,t),this.size=n.size,this};var qe=X?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(X(e),function(t){return G.call(e,t)}))}:function(){return[]},Oe=we;function Te(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function Le(e){if(null!=e){try{return F.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ie(e,t){return e===t||e!=e&&t!=t}(te&&Oe(new te(new ArrayBuffer(1)))!=x||ne&&Oe(new ne)!=u||re&&Oe(re.resolve())!=f||ie&&Oe(new ie)!=m||se&&Oe(new se)!=v)&&(Oe=function(e){var t=we(e),n=t==d?e.constructor:void 0,r=n?Le(n):"";if(r)switch(r){case le:return x;case ae:return u;case ce:return f;case ue:return m;case he:return v}return t});var Re=Ne(function(){return arguments}())?Ne:function(e){return Fe(e)&&$.call(e,"callee")&&!G.call(e,"callee")},Me=Array.isArray;var Be=Q||function(){return!1};function De(e){if(!Ue(e))return!1;var t=we(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Ue(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Fe(e){return null!=e&&"object"==typeof e}var $e=T?function(e){return function(t){return e(t)}}(T):function(e){return Fe(e)&&Pe(e.length)&&!!E[we(e)]};function ze(e){return null!=(t=e)&&Pe(t.length)&&!De(t)?ye(e):ke(e);var t}e.exports=function(e,t){return Ee(e,t)}}(Li,Li.exports)),Li.exports}var Ri,Mi={};var Bi,Di={};function Pi(){return Bi||(Bi=1,Object.defineProperty(Di,"__esModule",{value:!0}),(e||(e={})).length=function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"object"==typeof e.retain&&null!==e.retain?1:"string"==typeof e.insert?e.insert.length:1},Di.default=e),Di;var e}var Ui,Fi,$i={};var zi=(Fi||(Fi=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const n=ji(),r=Oi(),i=Ii(),s=function(){if(Ri)return Mi;Ri=1,Object.defineProperty(Mi,"__esModule",{value:!0});const e=Oi(),t=Ii();var n,r;return(r=n||(n={})).compose=function(t={},n={},r=!1){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});let i=e(n);r||(i=Object.keys(i).reduce((e,t)=>(null!=i[t]&&(e[t]=i[t]),e),{}));for(const e in t)void 0!==t[e]&&void 0===n[e]&&(i[e]=t[e]);return Object.keys(i).length>0?i:void 0},r.diff=function(e={},n={}){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});const r=Object.keys(e).concat(Object.keys(n)).reduce((r,i)=>(t(e[i],n[i])||(r[i]=void 0===n[i]?null:n[i]),r),{});return Object.keys(r).length>0?r:void 0},r.invert=function(e={},t={}){e=e||{};const n=Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0!==e[r]&&(n[r]=t[r]),n),{});return Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0===t[r]&&(n[r]=null),n),n)},r.transform=function(e,t,n=!1){if("object"!=typeof e)return t;if("object"!=typeof t)return;if(!n)return t;const r=Object.keys(t).reduce((n,r)=>(void 0===e[r]&&(n[r]=t[r]),n),{});return Object.keys(r).length>0?r:void 0},Mi.default=n,Mi}();t.AttributeMap=s.default;const o=Pi();t.Op=o.default;const l=function(){if(Ui)return $i;Ui=1,Object.defineProperty($i,"__esModule",{value:!0});const e=Pi();return $i.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const n=this.ops[this.index];if(n){const r=this.offset,i=e.default.length(n);if(t>=i-r?(t=i-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof n.delete)return{delete:t};{const e={};return n.attributes&&(e.attributes=n.attributes),"number"==typeof n.retain?e.retain=t:"object"==typeof n.retain&&null!==n.retain?e.retain=n.retain:"string"==typeof n.insert?e.insert=n.insert.substr(r,t):e.insert=n.insert,e}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?e.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const e=this.ops[this.index];return e?"number"==typeof e.delete?"delete":"number"==typeof e.retain||"object"==typeof e.retain&&null!==e.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}return[]}},$i}();t.OpIterator=l.default;const a=String.fromCharCode(0),c=(e,t)=>{if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);const n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]};class u{constructor(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){const t=this.handlers[e];if(!t)throw new Error(`no handlers for embed type "${e}"`);return t}insert(e,t){const n={};return"string"==typeof e&&0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if("number"==typeof e&&e<=0)return this;const n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=r(e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,n=this.ops[t-1],"object"!=typeof n))return this.ops.unshift(e),this;if(i(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){const e=this.ops[this.ops.length-1];return e&&"number"==typeof e.retain&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){const t=[],n=[];return this.forEach(r=>{(e(r)?t:n).push(r)}),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}changeLength(){return this.reduce((e,t)=>t.insert?e+o.default.length(t):t.delete?e-t.delete:e,0)}length(){return this.reduce((e,t)=>e+o.default.length(t),0)}slice(e=0,t=1/0){const n=[],r=new l.default(this.ops);let i=0;for(;i<t&&r.hasNext();){let s;i<e?s=r.next(e-i):(s=r.next(t-i),n.push(s)),i+=o.default.length(s)}return new u(n)}compose(e){const t=new l.default(this.ops),n=new l.default(e.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let e=o.retain;for(;"insert"===t.peekType()&&t.peekLength()<=e;)e-=t.peekLength(),r.push(t.next());o.retain-e>0&&n.next(o.retain-e)}const a=new u(r);for(;t.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===t.peekType())a.push(t.next());else{const e=Math.min(t.peekLength(),n.peekLength()),r=t.next(e),o=n.next(e);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?e:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const e=null==r.retain?"insert":"retain",[t,n,i]=c(r[e],o.retain),s=u.getHandler(t);l[e]={[t]:s.compose(n,i,"retain"===e)}}const h=s.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(h&&(l.attributes=h),a.push(l),!n.hasNext()&&i(a.ops[a.ops.length-1],l)){const e=new u(t.rest());return a.concat(e).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(e){const t=new u(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t}diff(e,t){if(this.ops===e.ops)return new u;const r=[this,e].map(t=>t.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],t,!0),h=new l.default(this.ops),d=new l.default(e.ops);return c.forEach(e=>{let t=e[1].length;for(;t>0;){let r=0;switch(e[0]){case n.INSERT:r=Math.min(d.peekLength(),t),o.push(d.next(r));break;case n.DELETE:r=Math.min(t,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),d.peekLength(),t);const e=h.next(r),l=d.next(r);i(e.insert,l.insert)?o.retain(r,s.default.diff(e.attributes,l.attributes)):o.push(l).delete(r)}t-=r}}),o.chop()}eachLine(e,t="\n"){const n=new l.default(this.ops);let r=new u,i=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const s=n.peek(),l=o.default.length(s)-n.peekLength(),a="string"==typeof s.insert?s.insert.indexOf(t,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===e(r,n.next(1).attributes||{},i))return;i+=1,r=new u}}r.length()>0&&e(r,{},i)}invert(e){const t=new u;return this.reduce((n,r)=>{if(r.insert)t.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return t.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const i=r.delete||r.retain;return e.slice(n,n+i).forEach(e=>{r.delete?t.push(e):r.retain&&r.attributes&&t.retain(o.default.length(e),s.default.invert(r.attributes,e.attributes))}),n+i}if("object"==typeof r.retain&&null!==r.retain){const i=e.slice(n,n+1),o=new l.default(i.ops).next(),[a,h,d]=c(r.retain,o.insert),f=u.getHandler(a);return t.retain({[a]:f.invert(h,d)},s.default.invert(r.attributes,o.attributes)),n+1}}return n},0),t.chop()}transform(e,t=!1){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);const n=e,r=new l.default(this.ops),i=new l.default(n.ops),a=new u;for(;r.hasNext()||i.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===i.peekType())if("insert"===i.peekType())a.push(i.next());else{const e=Math.min(r.peekLength(),i.peekLength()),n=r.next(e),o=i.next(e);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,i=o.retain;let l="object"==typeof i&&null!==i?i:e;if("object"==typeof r&&null!==r&&"object"==typeof i&&null!==i){const e=Object.keys(r)[0];if(e===Object.keys(i)[0]){const n=u.getHandler(e);n&&(l={[e]:n.transform(r[e],i[e],t)})}}a.retain(l,s.default.transform(n.attributes,o.attributes,t))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(e,t=!1){t=!!t;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=e;){const i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(r<e||!t)&&(e+=i),r+=i):e-=Math.min(i,e-r)}return e}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=s.default,u.handlers={},t.default=u,e.exports=u,e.exports.default=u}(Ci,Ci.exports)),Ci.exports);const Vi=F(zi);class Hi extends vi{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}Hi.blotName="break",Hi.tagName="BR";let Ki=class extends Ei{};const Wi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Zi(e){return e.replace(/[&<>"']/g,e=>Wi[e])}const Gi=class e extends fi{static compare(t,n){const r=e.order.indexOf(t),i=e.order.indexOf(n);return r>=0||i>=0?r-i:t===n?0:t<n?-1:1}formatAt(t,n,r,i){if(e.compare(this.statics.blotName,r)<0&&this.scroll.query(r,Zr.BLOT)){const e=this.isolate(t,n);i&&e.wrap(r,i)}else super.formatAt(t,n,r,i)}optimize(t){if(super.optimize(t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};t(Gi,"allowedChildren",[Gi,Hi,vi,Ki]),t(Gi,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let Yi=Gi;class Ji extends mi{constructor(){super(...arguments),t(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=Qi(this)),this.cache.delta}deleteAt(e,t){super.deleteAt(e,t),this.cache={}}formatAt(e,t,n,r){t<=0||(this.scroll.query(n,Zr.BLOCK)?e+t===this.length()&&this.format(n,r):super.formatAt(e,Math.min(t,this.length()-e-1),n,r),this.cache={})}insertAt(e,t,n){if(null!=n)return super.insertAt(e,t,n),void(this.cache={});if(0===t.length)return;const r=t.split("\n"),i=r.shift();i.length>0&&(e<this.length()-1||null==this.children.tail?super.insertAt(Math.min(e,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});let s=this;r.reduce((e,t)=>(s=s.split(e,!0),s.insertAt(0,t),t.length),e+i.length)}insertBefore(e,t){const{head:n}=this.children;super.insertBefore(e,t),n instanceof Hi&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(e,t){super.moveChildren(e,t),this.cache={}}optimize(e){super.optimize(e),this.cache={}}path(e){return super.path(e,!0)}removeChild(e){super.removeChild(e),this.cache={}}split(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t&&(0===e||e>=this.length()-1)){const t=this.clone();return 0===e?(this.parent.insertBefore(t,this),this):(this.parent.insertBefore(t,this.next),t)}const n=super.split(e,t);return this.cache={},n}}Ji.blotName="block",Ji.tagName="P",Ji.defaultChild=Hi,Ji.allowedChildren=[Hi,Yi,vi,Ki];class Xi extends vi{attach(){super.attach(),this.attributes=new ri(this.domNode)}delta(){return(new Vi).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(e,t){const n=this.scroll.query(e,Zr.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}formatAt(e,t,n,r){this.format(n,r)}insertAt(e,t,n){if(null!=n)return void super.insertAt(e,t,n);const r=t.split("\n"),i=r.pop(),s=r.map(e=>{const t=this.scroll.create(Ji.blotName);return t.insertAt(0,e),t}),o=this.split(e);s.forEach(e=>{this.parent.insertBefore(e,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}}function Qi(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.descendants(li).reduce((e,n)=>0===n.length()?e:e.insert(n.value(),es(n,{},t)),new Vi).insert("\n",es(e))}function es(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==e?t:("formats"in e&&"function"==typeof e.formats&&(t={...t,...e.formats()},n&&delete t["code-token"]),null==e.parent||"scroll"===e.parent.statics.blotName||e.parent.statics.scope!==e.statics.scope?t:es(e.parent,t,n))}Xi.scope=Zr.BLOCK_BLOT;const ts=class e extends vi{static value(){}constructor(t,n,r){super(t,n),this.selection=r,this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,n){if(0!==this.savedLength)return void super.format(t,n);let r=this,i=0;for(;null!=r&&r.statics.scope!==Zr.BLOCK_BLOT;)i+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=e.CONTENTS.length,r.optimize(),r.formatAt(i,e.CONTENTS.length,t,n),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const n=this.prev instanceof Ki?this.prev:null,r=n?n.length():0,i=this.next instanceof Ki?this.next:null,s=i?i.text:"",{textNode:o}=this,l=o.data.split(e.CONTENTS).join("");let a;if(o.data=e.CONTENTS,n)a=n,(l||i)&&(n.insertAt(n.length(),l+s),i&&i.remove());else if(i)a=i,i.insertAt(0,l);else{const e=document.createTextNode(l);a=this.scroll.create(e),this.parent.insertBefore(a,this)}if(this.remove(),t){const e=(e,t)=>n&&e===n.domNode?t:e===o?r+t-1:i&&e===i.domNode?r+l.length+t:null,s=e(t.start.node,t.start.offset),c=e(t.end.node,t.end.offset);if(null!==s&&null!==c)return{startNode:a.domNode,startOffset:s,endNode:a.domNode,endOffset:c}}return null}update(e,t){if(e.some(e=>"characterData"===e.type&&e.target===this.textNode)){const e=this.restore();e&&(t.range=e)}}optimize(t){super.optimize(t);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=e.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};t(ts,"blotName","cursor"),t(ts,"className","ql-cursor"),t(ts,"tagName","span"),t(ts,"CONTENTS","\ufeff");let ns=ts;var rs,is={exports:{}};var ss=(rs||(rs=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new i(r,s||e,o),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],l]:e._events[a].push(l):(e._events[a]=l,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i<s;i++)o[i]=r[i].fn;return o},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,i,s,o){var l=n?n+e:e;if(!this._events[l])return!1;var a,c,u=this._events[l],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,s),!0;case 6:return u.fn.call(u.context,t,r,i,s,o),!0}for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,i);break;default:if(!a)for(d=1,a=new Array(h-1);d<h;d++)a[d-1]=arguments[d];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var l=this._events[s];if(l.fn)l.fn!==t||i&&!l.once||r&&l.context!==r||o(this,s);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==t||i&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}(is)),is.exports);const os=F(ss),ls=new WeakMap,as=["error","warn","log","info"];let cs="warn";function us(e){if(cs&&as.indexOf(e)<=as.indexOf(cs))for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r]}function hs(e){return as.reduce((t,n)=>(t[n]=us.bind(console,n,e),t),{})}hs.level=e=>{cs=e},us.level=hs.level;const ds=hs("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(e=>{document.addEventListener(e,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(e=>{const n=ls.get(e);n&&n.emitter&&n.emitter.handleDOM(...t)})})});class fs extends os{constructor(){super(),this.domListeners={},this.on("error",ds.error)}emit(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return ds.log.call(ds,...t),super.emit(...t)}handleDOM(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.domListeners[e.type]||[]).forEach(t=>{let{node:r,handler:i}=t;(e.target===r||r.contains(e.target))&&i(e,...n)})}listenDOM(e,t,n){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:n})}}t(fs,"events",{EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"}),t(fs,"sources",{API:"api",SILENT:"silent",USER:"user"});const ps=hs("quill:selection");class ms{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=e,this.length=t}}class gs{constructor(e,t){this.emitter=t,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new ms(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{this.mouseDown||this.composing||setTimeout(this.update.bind(this,fs.sources.USER),1)}),this.emitter.on(fs.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const e=this.getNativeRange();null!=e&&e.start.node!==this.cursor.textNode&&this.emitter.once(fs.events.SCROLL_UPDATE,(t,n)=>{try{this.root.contains(e.start.node)&&this.root.contains(e.end.node)&&this.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset);const r=n.some(e=>"characterData"===e.type||"childList"===e.type||"attributes"===e.type&&e.target===this.root);this.update(r?fs.sources.SILENT:t)}catch(r){}})}),this.emitter.on(fs.events.SCROLL_OPTIMIZE,(e,t)=>{if(t.range){const{startNode:e,startOffset:n,endNode:r,endOffset:i}=t.range;this.setNativeRange(e,n,r,i),this.update(fs.sources.SILENT)}}),this.update(fs.sources.SILENT)}handleComposition(){this.emitter.on(fs.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(fs.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const e=this.cursor.restore();if(!e)return;setTimeout(()=>{this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(fs.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(e,t){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(e,Zr.BLOCK)){if(n.start.node!==this.cursor.textNode){const e=this.scroll.find(n.start.node,!1);if(null==e)return;if(e instanceof li){const t=e.split(n.start.offset);e.parent.insertBefore(this.cursor,t)}else e.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;e=Math.min(e,n-1),t=Math.min(e+t,n-1)-e;let[i,s]=this.scroll.leaf(e);if(null==i)return null;if(t>0&&s===i.length()){const[t]=this.scroll.leaf(e+1);if(t){const[n]=this.scroll.line(e),[r]=this.scroll.line(e+1);n===r&&(i=t,s=0)}}[r,s]=i.position(s,!0);const o=document.createRange();if(t>0)return o.setStart(r,s),[i,s]=this.scroll.leaf(e+t),null==i?null:([r,s]=i.position(s,!0),o.setEnd(r,s),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;s<r.data.length?(o.setStart(r,s),o.setEnd(r,s+1)):(o.setStart(r,s-1),o.setEnd(r,s),a="right"),l=o.getBoundingClientRect()}else{if(!(i.domNode instanceof Element))return null;l=i.domNode.getBoundingClientRect(),s>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const e=document.getSelection();if(null==e||e.rangeCount<=0)return null;const t=e.getRangeAt(0);if(null==t)return null;const n=this.normalizeNative(t);return ps.info("getNativeRange",n),n}getRange(){const e=this.scroll.domNode;if("isConnected"in e&&!e.isConnected)return[null,null];const t=this.getNativeRange();if(null==t)return[null,null];return[this.normalizedToRange(t),t]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&bs(this.root,document.activeElement)}normalizedToRange(e){const t=[[e.start.node,e.start.offset]];e.native.collapsed||t.push([e.end.node,e.end.offset]);const n=t.map(e=>{const[t,n]=e,r=this.scroll.find(t,!0),i=r.offset(this.scroll);return 0===n?i:r instanceof li?i+r.index(t,n):i+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),i=Math.min(r,...n);return new ms(i,r-i)}normalizeNative(e){if(!bs(this.root,e.startContainer)||!e.collapsed&&!bs(this.root,e.endContainer))return null;const t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(e=>{let{node:t,offset:n}=e;for(;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else{if(t.childNodes.length!==n)break;t=t.lastChild,n=t instanceof Text?t.data.length:t.childNodes.length>0?t.childNodes.length:t.childNodes.length+1}e.node=t,e.offset=n}),t}rangeToNative(e){const t=this.scroll.length(),n=(e,n)=>{e=Math.min(t-1,e);const[r,i]=this.scroll.leaf(e);return r?r.position(i,n):[null,-1]};return[...n(e.index,!1),...n(e.index+e.length,!0)]}setNativeRange(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(ps.info("setNativeRange",e,t,n,r),null!=e&&(null==this.root.parentNode||null==e.parentNode||null==n.parentNode))return;const s=document.getSelection();if(null!=s)if(null!=e){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e instanceof Element&&"BR"===e.tagName&&(t=Array.from(e.parentNode.childNodes).indexOf(e),e=e.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const i=document.createRange();i.setStart(e,t),i.setEnd(n,r),s.removeAllRanges(),s.addRange(i)}}else s.removeAllRanges(),this.root.blur()}setRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fs.sources.API;if("string"==typeof t&&(n=t,t=!1),ps.info("setRange",e),null!=e){const n=this.rangeToNative(e);this.setNativeRange(...n,t)}else this.setNativeRange(null);this.update(n)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fs.sources.USER;const t=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Hr(t,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const e=this.cursor.restore();e&&this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}const n=[fs.events.SELECTION_CHANGE,Ar(this.lastRange),Ar(t),e];this.emitter.emit(fs.events.EDITOR_CHANGE,...n),e!==fs.sources.SILENT&&this.emitter.emit(...n)}}}function bs(e,t){try{t.parentNode}catch(n){return!1}return e.contains(t)}const vs=/^[ -~]*$/;class ys{constructor(e){this.scroll=e,this.delta=this.getDelta()}applyDelta(e){this.scroll.update();let t=this.scroll.length();this.scroll.batchStart();const n=As(e),r=new Vi;return function(e){const t=[];return e.forEach(e=>{if("string"==typeof e.insert){e.insert.split("\n").forEach((n,r)=>{r&&t.push({insert:"\n",attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})})}else t.push(e)}),t}(n.ops.slice()).reduce((e,n)=>{const i=zi.Op.length(n);let s=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(i),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(t<=e||!!this.scroll.descendant(Xi,e)[0]),this.scroll.insertAt(e,r);const[i,o]=this.scroll.line(e);let a=Wr({},es(i));if(i instanceof Ji){const[e]=i.descendant(li,o);e&&(a=Wr(a,es(e)))}s=zi.AttributeMap.diff(a,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;const i=null!=this.scroll.query(r,Zr.INLINE);if(i)(t<=e||this.scroll.descendant(Xi,e)[0])&&(l=!0);else if(e>0){const[t,n]=this.scroll.descendant(li,e-1);if(t instanceof Ki){"\n"!==t.value()[n]&&(o=!0)}else t instanceof vi&&t.statics.scope===Zr.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),i){const[t]=this.scroll.descendant(li,e);if(t){const e=Wr({},es(t));s=zi.AttributeMap.diff(e,s)||{}}}}t+=i}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const t=Object.keys(n.retain)[0];if(null==t)return e;this.scroll.updateEmbedAt(e,t,n.retain[t])}Object.keys(s).forEach(t=>{this.scroll.formatAt(e,i,t,s[t])});const a=o?1:0,c=l?1:0;return t+=a+c,r.retain(a),r.delete(c),e+i+a+c},0),r.reduce((e,t)=>"number"==typeof t.delete?(this.scroll.deleteAt(e,t.delete),e):e+zi.Op.length(t),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(e,t){return this.scroll.deleteAt(e,t),this.update((new Vi).retain(e).delete(t))}formatLine(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(e,Math.max(t,1)).forEach(e=>{e.format(r,n[r])})}),this.scroll.optimize();const r=(new Vi).retain(e).retain(t,Ar(n));return this.update(r)}formatText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t,r,n[r])});const r=(new Vi).retain(e).retain(t,Ar(n));return this.update(r)}getContents(e,t){return this.delta.slice(e,e+t)}getDelta(){return this.scroll.lines().reduce((e,t)=>e.concat(t.delta()),new Vi)}getFormat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(e=>{const[t]=e;t instanceof Ji?n.push(t):t instanceof li&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(li,e,t));const[i,s]=[n,r].map(e=>{const t=e.shift();if(null==t)return{};let n=es(t);for(;Object.keys(n).length>0;){const t=e.shift();if(null==t)return n;n=Ns(es(t),n)}return n});return{...i,...s}}getHTML(e,t){const[n,r]=this.scroll.line(e);if(n){const i=n.length();return!(n.length()>=r+t)||0===r&&t===i?ws(this.scroll,e,t,!0):ws(n,r,t,!0)}return""}getText(e,t){return this.getContents(e,t).filter(e=>"string"==typeof e.insert).map(e=>e.insert).join("")}insertContents(e,t){const n=As(t),r=(new Vi).retain(e).concat(n);return this.scroll.insertContents(e,n),this.update(r)}insertEmbed(e,t,n){return this.scroll.insertAt(e,t,n),this.update((new Vi).retain(e).insert({[t]:n}))}insertText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t.length,r,n[r])}),this.update((new Vi).retain(e).insert(t,Ar(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const e=this.scroll.children.head;if((null==e?void 0:e.statics.blotName)!==Ji.blotName)return!1;const t=e;return!(t.children.length>1)&&t.children.head instanceof Hi}removeFormat(e,t){const n=this.getText(e,t),[r,i]=this.scroll.line(e+t);let s=0,o=new Vi;null!=r&&(s=r.length()-i,o=r.delta().slice(i,i+s-1).insert("\n"));const l=this.getContents(e,t+s).diff((new Vi).insert(n).concat(o)),a=(new Vi).retain(e).concat(l);return this.applyDelta(a)}update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(vs)&&this.scroll.find(t[0].target)){const i=this.scroll.find(t[0].target),s=es(i),o=i.offset(this.scroll),l=t[0].oldValue.replace(ns.CONTENTS,""),a=(new Vi).insert(l),c=(new Vi).insert(i.value()),u=n&&{oldRange:ks(n.oldRange,-o),newRange:ks(n.newRange,-o)};e=(new Vi).retain(o).concat(a.diff(c,u)).reduce((e,t)=>t.insert?e.insert(t.insert,s):e.push(t),new Vi),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&Hr(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}function xs(e,t,n){if(0===e.length){const[e]=Es(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${xs([],t-1,n)}`}const[{child:r,offset:i,length:s,indent:o,type:l},...a]=e,[c,u]=Es(l);if(o>t)return n.push(l),o===t+1?`<${c}><li${u}>${ws(r,i,s)}${xs(a,o,n)}`:`<${c}><li>${xs(e,t+1,n)}`;const h=n[n.length-1];if(o===t&&l===h)return`</li><li${u}>${ws(r,i,s)}${xs(a,o,n)}`;const[d]=Es(n.pop());return`</li></${d}>${xs(e,t-1,n)}`}function ws(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in e&&"function"==typeof e.html)return e.html(t,n);if(e instanceof Ki){return Zi(e.value().slice(t,t+n)).replaceAll(" ","&nbsp;")}if(e instanceof hi){if("list-container"===e.statics.blotName){const r=[];return e.children.forEachAt(t,n,(e,t,n)=>{const i="formats"in e&&"function"==typeof e.formats?e.formats():{};r.push({child:e,offset:t,length:n,indent:i.indent||0,type:i.list})}),xs(r,-1,[])}const i=[];if(e.children.forEachAt(t,n,(e,t,n)=>{i.push(ws(e,t,n))}),r||"list"===e.statics.blotName)return i.join("");const{outerHTML:s,innerHTML:o}=e.domNode,[l,a]=s.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${i.join("")}<${a}`:`${l}>${i.join("")}<${a}`}return e.domNode instanceof Element?e.domNode.outerHTML:""}function Ns(e,t){return Object.keys(t).reduce((n,r)=>{if(null==e[r])return n;const i=t[r];return i===e[r]?n[r]=i:Array.isArray(i)?i.indexOf(e[r])<0?n[r]=i.concat([e[r]]):n[r]=i:n[r]=[i,e[r]],n},{})}function Es(e){const t="ordered"===e?"ol":"ul";switch(e){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function As(e){return e.reduce((e,t)=>{if("string"==typeof t.insert){const n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new Vi)}function ks(e,t){let{index:n,length:r}=e;return new ms(n+t,r)}class Ss{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=e,this.options=t}}t(Ss,"DEFAULTS",{});const Cs="\ufeff";class js extends vi{constructor(e,t){super(e,t),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(e=>{this.contentNode.appendChild(e)}),this.leftGuard=document.createTextNode(Cs),this.rightGuard=document.createTextNode(Cs),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(e,t){return e===this.leftGuard?0:e===this.rightGuard?1:super.index(e,t)}restore(e){let t,n=null;const r=e.data.split(Cs).join("");if(e===this.leftGuard)if(this.prev instanceof Ki){const e=this.prev.length();this.prev.insertAt(e,r),n={startNode:this.prev.domNode,startOffset:e+r.length}}else t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this),n={startNode:t,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof Ki?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this.next),n={startNode:t,startOffset:r.length}));return e.data=Cs,n}update(e,t){e.forEach(e=>{if("characterData"===e.type&&(e.target===this.leftGuard||e.target===this.rightGuard)){const n=this.restore(e.target);n&&(t.range=n)}})}}class _s{constructor(e,n){t(this,"isComposing",!1),this.scroll=e,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",e=>{this.isComposing||this.handleCompositionStart(e)}),this.scroll.domNode.addEventListener("compositionend",e=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(e)})})}handleCompositionStart(e){const t=e.target instanceof Node?this.scroll.find(e.target,!0):null;!t||t instanceof js||(this.emitter.emit(fs.events.COMPOSITION_BEFORE_START,e),this.scroll.batchStart(),this.emitter.emit(fs.events.COMPOSITION_START,e),this.isComposing=!0)}handleCompositionEnd(e){this.emitter.emit(fs.events.COMPOSITION_BEFORE_END,e),this.scroll.batchEnd(),this.emitter.emit(fs.events.COMPOSITION_END,e),this.isComposing=!1}}const qs=class{constructor(e,n){t(this,"modules",{}),this.quill=e,this.options=n}init(){Object.keys(this.options.modules).forEach(e=>{null==this.modules[e]&&this.addModule(e)})}addModule(e){const t=this.quill.constructor.import(`modules/${e}`);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}};t(qs,"DEFAULTS",{modules:{}}),t(qs,"themes",{default:qs});let Os=qs;const Ts=e=>e.parentElement||e.getRootNode().host||null,Ls=e=>{const t=e.getBoundingClientRect(),n="offsetWidth"in e&&Math.abs(t.width)/e.offsetWidth||1,r="offsetHeight"in e&&Math.abs(t.height)/e.offsetHeight||1;return{top:t.top,right:t.left+e.clientWidth*n,bottom:t.top+e.clientHeight*r,left:t.left}},Is=e=>{const t=parseInt(e,10);return Number.isNaN(t)?0:t},Rs=(e,t,n,r,i,s)=>e<n&&t>r?0:e<n?-(n-e+i):t>r?t-e>r-n?e+i-n:t-r+s:0,Ms=["block","break","cursor","inline","scroll","text"],Bs=hs("quill"),Ds=new Xr;hi.uiClass="ql-ui";const Ps=class e{static debug(e){!0===e&&(e="log"),hs.level(e)}static find(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return ls.get(e)||Ds.find(e,t)}static import(e){return null==this.imports[e]&&Bs.error(`Cannot import ${e}. Are you sure it was registered?`),this.imports[e]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const e=arguments.length<=0?void 0:arguments[0],t=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in e?e.attrName:e.blotName;"string"==typeof n?this.register(`formats/${n}`,e,t):Object.keys(e).forEach(n=>{this.register(n,e[n],t)})}else{const e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[e]||n||Bs.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&t&&"boolean"!=typeof t&&"abstract"!==t.blotName&&Ds.register(t),"function"==typeof t.register&&t.register(Ds)}}constructor(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(e,t){const n=Fs(e);if(!n)throw new Error("Invalid Quill container");const r=!t.theme||t.theme===Us.DEFAULTS.theme,i=r?Os:Us.import(`themes/${t.theme}`);if(!i)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:s,...o}=Us.DEFAULTS,{modules:l,...a}=i.DEFAULTS;let c=$s(t.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Wr({},$s(s),$s(l),c),h={...o,...zs(a),...zs(t)};let d=t.registry;d?t.formats&&Bs.warn('Ignoring "formats" option because "registry" is specified'):d=t.formats?((e,t,n)=>{const r=new Xr;return Ms.forEach(e=>{const n=t.query(e);n&&r.register(n)}),e.forEach(e=>{let i=t.query(e);i||n.error(`Cannot register "${e}" specified in "formats" config. Are you sure it was registered?`);let s=0;for(;i;)if(r.register(i),i="blotName"in i?i.requiredContainer??null:null,s+=1,s>100){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r})(t.formats,h.registry,Bs):h.registry;return{...h,registry:d,container:n,theme:i,modules:Object.entries(u).reduce((e,t)=>{let[n,r]=t;if(!r)return e;const i=Us.import(`modules/${n}`);return null==i?(Bs.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:Wr({},i.DEFAULTS||{},r)}},{}),bounds:Fs(h.bounds)}}(t,n),this.container=this.options.container,null==this.container)return void Bs.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",ls.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new fs;const i=wi.blotName,s=this.options.registry.query(i);if(!s||!("blotName"in s))throw new Error(`Cannot initialize Quill without "${i}" blot`);if(this.scroll=new s(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new ys(this.scroll),this.selection=new gs(this.scroll,this.emitter),this.composition=new _s(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(fs.events.EDITOR_CHANGE,e=>{e===fs.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(fs.events.SCROLL_UPDATE,(e,t)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;Vs.call(this,()=>this.editor.update(null,t,i),e)}),this.emitter.on(fs.events.SCROLL_EMBED_UPDATE,(t,n)=>{const r=this.selection.lastRange,[i]=this.selection.getRange(),s=r&&i?{oldRange:r,newRange:i}:void 0;Vs.call(this,()=>{const e=(new Vi).retain(t.offset(this)).retain({[t.statics.blotName]:n});return this.editor.update(e,[],s)},e.sources.USER)}),r){const e=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(e)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){const t=e;(e=document.createElement("div")).classList.add(t)}return this.container.insertBefore(e,t),e}blur(){this.selection.setRange(null)}deleteText(e,t,n){return[e,t,,n]=Hs(e,t,n),Vs.call(this,()=>this.editor.deleteText(e,t),n,e,-1*t)}disable(){this.enable(!1)}editReadOnly(e){this.allowReadOnlyEdits=!0;const t=e();return this.allowReadOnlyEdits=!1,t}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}focus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),e.preventScroll||this.scrollSelectionIntoView()}format(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fs.sources.API;return Vs.call(this,()=>{const n=this.getSelection(!0);let r=new Vi;if(null==n)return r;if(this.scroll.query(e,Zr.BLOCK))r=this.editor.formatLine(n.index,n.length,{[e]:t});else{if(0===n.length)return this.selection.format(e,t),r;r=this.editor.formatText(n.index,n.length,{[e]:t})}return this.setSelection(n,fs.sources.SILENT),r},n)}formatLine(e,t,n,r,i){let s;return[e,t,s,i]=Hs(e,t,n,r,i),Vs.call(this,()=>this.editor.formatLine(e,t,s),i,e,0)}formatText(e,t,n,r,i){let s;return[e,t,s,i]=Hs(e,t,n,r,i),Vs.call(this,()=>this.editor.formatText(e,t,s),i,e,0)}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length),!n)return null;const r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}getContents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e;return[e,t]=Hs(e,t),this.editor.getContents(e,t)}getFormat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}getIndex(e){return e.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(e){return this.scroll.leaf(e)}getLine(e){return this.scroll.line(e)}getLines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}getModule(e){return this.theme.modules[e]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Hs(e,t),this.editor.getHTML(e,t)}getText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Hs(e,t),this.editor.getText(e,t)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return Vs.call(this,()=>this.editor.insertEmbed(t,n,r),i,t)}insertText(e,t,n,r,i){let s;return[e,,s,i]=Hs(e,0,n,r,i),Vs.call(this,()=>this.editor.insertText(e,t,s),i,e,t.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(e,t,n){return[e,t,,n]=Hs(e,t,n),Vs.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){((e,t)=>{var n,r,i;const s=e.ownerDocument;let o=t,l=e;for(;l;){const e=l===s.body,t=e?{top:0,right:(null==(n=window.visualViewport)?void 0:n.width)??s.documentElement.clientWidth,bottom:(null==(r=window.visualViewport)?void 0:r.height)??s.documentElement.clientHeight,left:0}:Ls(l),a=getComputedStyle(l),c=Rs(o.left,o.right,t.left,t.right,Is(a.scrollPaddingLeft),Is(a.scrollPaddingRight)),u=Rs(o.top,o.bottom,t.top,t.bottom,Is(a.scrollPaddingTop),Is(a.scrollPaddingBottom));if(c||u)if(e)null==(i=s.defaultView)||i.scrollBy(c,u);else{const{scrollLeft:e,scrollTop:t}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-e,r=l.scrollTop-t;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=e||"fixed"===a.position?null:Ts(l)}})(this.root,e)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const e=this.selection.lastRange,t=e&&this.selection.getBounds(e.index,e.length);t&&this.scrollRectIntoView(t)}setContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fs.sources.API;return Vs.call(this,()=>{e=new Vi(e);const t=this.getLength(),n=this.editor.deleteText(0,t),r=this.editor.insertContents(0,e),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)},t)}setSelection(t,n,r){null==t?this.selection.setRange(null,n||e.sources.API):([t,n,,r]=Hs(t,n,r),this.selection.setRange(new ms(Math.max(0,t),n),r),r!==fs.sources.SILENT&&this.scrollSelectionIntoView())}setText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fs.sources.API;const n=(new Vi).insert(e);return this.setContents(n,t)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fs.sources.USER;const t=this.scroll.update(e);return this.selection.update(e),t}updateContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fs.sources.API;return Vs.call(this,()=>(e=new Vi(e),this.editor.applyDelta(e)),t,!0)}};t(Ps,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Ds,theme:"default"}),t(Ps,"events",fs.events),t(Ps,"sources",fs.sources),t(Ps,"version","2.0.3"),t(Ps,"imports",{delta:Vi,parchment:Ai,"core/module":Ss,"core/theme":Os});let Us=Ps;function Fs(e){return"string"==typeof e?document.querySelector(e):e}function $s(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:!0===r?{}:r}},{})}function zs(e){return Object.fromEntries(Object.entries(e).filter(e=>void 0!==e[1]))}function Vs(e,t,n,r){if(!this.isEnabled()&&t===fs.sources.USER&&!this.allowReadOnlyEdits)return new Vi;let i=null==n?null:this.getSelection();const s=this.editor.delta,o=e();if(null!=i&&(!0===n&&(n=i.index),null==r?i=Ks(i,o,t):0!==r&&(i=Ks(i,n,r,t)),this.setSelection(i,fs.sources.SILENT)),o.length()>0){const e=[fs.events.TEXT_CHANGE,o,s,t];this.emitter.emit(fs.events.EDITOR_CHANGE,...e),t!==fs.sources.SILENT&&this.emitter.emit(...e)}return o}function Hs(e,t,n,r,i){let s={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(i=r,r=n,n=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(i=r,r=n,n=t,t=0),"object"==typeof n?(s=n,i=r):"string"==typeof n&&(null!=r?s[n]=r:i=n),[e,t,s,i=i||fs.sources.API]}function Ks(e,t,n,r){const i="number"==typeof n?n:0;if(null==e)return null;let s,o;return t&&"function"==typeof t.transformPosition?[s,o]=[e.index,e.index+e.length].map(e=>t.transformPosition(e,r!==fs.sources.USER)):[s,o]=[e.index,e.index+e.length].map(e=>e<t||e===t&&r===fs.sources.USER?e:i>=0?e+i:Math.max(t,e+i)),new ms(s,o-s)}class Ws extends bi{}function Zs(e){return e instanceof Ji||e instanceof Xi}function Gs(e){return"function"==typeof e.updateContent}class Ys extends wi{constructor(e,t,n){let{emitter:r}=n;super(e,t),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",e=>this.handleDragStart(e))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const e=this.batch;this.batch=!1,this.update(e)}emitMount(e){this.emitter.emit(fs.events.SCROLL_BLOT_MOUNT,e)}emitUnmount(e){this.emitter.emit(fs.events.SCROLL_BLOT_UNMOUNT,e)}emitEmbedUpdate(e,t){this.emitter.emit(fs.events.SCROLL_EMBED_UPDATE,e,t)}deleteAt(e,t){const[n,r]=this.line(e),[i]=this.line(e+t);if(super.deleteAt(e,t),null!=i&&n!==i&&r>0){if(n instanceof Xi||i instanceof Xi)return void this.optimize();const e=i.children.head instanceof Hi?null:i.children.head;n.moveChildren(i,e),n.remove()}this.optimize()}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e?"true":"false")}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.optimize()}insertAt(e,t,n){if(e>=this.length())if(null==n||null==this.scroll.query(t,Zr.BLOCK)){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e),null==n&&t.endsWith("\n")?e.insertAt(0,t.slice(0,-1),n):e.insertAt(0,t,n)}else{const e=this.scroll.create(t,n);this.appendChild(e)}else super.insertAt(e,t,n);this.optimize()}insertBefore(e,t){if(e.statics.scope===Zr.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(e),super.insertBefore(n,t)}else super.insertBefore(e,t)}insertContents(e,t){const n=this.deltaToRenderBlocks(t.concat((new Vi).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const i=n.shift();if(i){const t="block"===i.type&&(0===i.delta.length()||!this.descendant(Xi,e)[0]&&e<this.length()),n="block"===i.type?i.delta:(new Vi).insert({[i.key]:i.value});Js(this,e,n);const r="block"===i.type?1:0,s=e+n.length()+r;t&&this.insertAt(s-1,"\n");const o=es(this.line(e)[0]),l=zi.AttributeMap.diff(o,i.attributes)||{};Object.keys(l).forEach(e=>{this.formatAt(s-1,1,e,l[e])}),e=s}let[s,o]=this.children.find(e);if(n.length&&(s&&(s=s.split(o),o=0),n.forEach(e=>{if("block"===e.type){Js(this.createBlock(e.attributes,s||void 0),0,e.delta)}else{const t=this.create(e.key,e.value);this.insertBefore(t,s||void 0),Object.keys(e.attributes).forEach(n=>{t.format(n,e.attributes[n])})}})),"block"===r.type&&r.delta.length()){Js(this,s?s.offset(s.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(e){const t=this.path(e).pop();if(!t)return[null,-1];const[n,r]=t;return n instanceof li?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(Zs,e)}lines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(e,t,r)=>{let i=[],s=r;return e.children.forEachAt(t,r,(e,t,r)=>{Zs(e)?i.push(e):e instanceof bi&&(i=i.concat(n(e,t,s))),s-=r}),i};return n(this,e,t)}optimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(e,t),e.length>0&&this.emitter.emit(fs.events.SCROLL_OPTIMIZE,e,t))}path(e){return super.path(e).slice(1)}remove(){}update(e){if(this.batch)return void(Array.isArray(e)&&(this.batch=this.batch.concat(e)));let t=fs.sources.USER;"string"==typeof e&&(t=e),Array.isArray(e)||(e=this.observer.takeRecords()),(e=e.filter(e=>{let{target:t}=e;const n=this.find(t,!0);return n&&!Gs(n)})).length>0&&this.emitter.emit(fs.events.SCROLL_BEFORE_UPDATE,t,e),super.update(e.concat([])),e.length>0&&this.emitter.emit(fs.events.SCROLL_UPDATE,t,e)}updateEmbedAt(e,t,n){const[r]=this.descendant(e=>e instanceof Xi,e);r&&r.statics.blotName===t&&Gs(r)&&r.updateContent(n)}handleDragStart(e){e.preventDefault()}deltaToRenderBlocks(e){const t=[];let n=new Vi;return e.forEach(e=>{const r=null==e?void 0:e.insert;if(r)if("string"==typeof r){const i=r.split("\n");i.slice(0,-1).forEach(r=>{n.insert(r,e.attributes),t.push({type:"block",delta:n,attributes:e.attributes??{}}),n=new Vi});const s=i[i.length-1];s&&n.insert(s,e.attributes)}else{const i=Object.keys(r)[0];if(!i)return;this.query(i,Zr.INLINE)?n.push(e):(n.length()&&t.push({type:"block",delta:n,attributes:{}}),n=new Vi,t.push({type:"blockEmbed",key:i,value:r[i],attributes:e.attributes??{}}))}}),n.length()&&t.push({type:"block",delta:n,attributes:{}}),t}createBlock(e,t){let n;const r={};Object.entries(e).forEach(e=>{let[t,i]=e;null!=this.query(t,Zr.BLOCK&Zr.BLOT)?n=t:r[t]=i});const i=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(i,t||void 0);const s=i.length();return Object.entries(r).forEach(e=>{let[t,n]=e;i.formatAt(0,s,t,n)}),i}}function Js(e,t,n){n.reduce((t,n)=>{const r=zi.Op.length(n);let i=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;e.insertAt(t,r);const[s]=e.descendant(li,t),o=es(s);i=zi.AttributeMap.diff(o,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;e.insertAt(t,r,n.insert[r]);if(null!=e.scroll.query(r,Zr.INLINE)){const[n]=e.descendant(li,t),r=es(n);i=zi.AttributeMap.diff(r,i)||{}}}return Object.keys(i).forEach(n=>{e.formatAt(t,r,n,i[n])}),t+r},t)}t(Ys,"blotName","scroll"),t(Ys,"className","ql-editor"),t(Ys,"tagName","DIV"),t(Ys,"defaultChild",Ji),t(Ys,"allowedChildren",[Ji,Xi,Ws]);const Xs={scope:Zr.BLOCK,whitelist:["right","center","justify"]},Qs=new Gr("align","align",Xs),eo=new ei("align","ql-align",Xs),to=new ni("align","text-align",Xs);class no extends ni{value(e){let t=super.value(e);if(!t.startsWith("rgb("))return t;t=t.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${t.split(",").map(e=>`00${parseInt(e,10).toString(16)}`.slice(-2)).join("")}`}}const ro=new ei("color","ql-color",{scope:Zr.INLINE}),io=new no("color","color",{scope:Zr.INLINE}),so=new ei("background","ql-bg",{scope:Zr.INLINE}),oo=new no("background","background-color",{scope:Zr.INLINE});class lo extends Ws{static create(e){const t=super.create(e);return t.setAttribute("spellcheck","false"),t}code(e,t){return this.children.map(e=>e.length()<=1?"":e.domNode.innerText).join("\n").slice(e,e+t)}html(e,t){return`<pre>\n${Zi(this.code(e,t))}\n</pre>`}}class ao extends Ji{static register(){Us.register(lo)}}t(ao,"TAB"," ");class co extends Yi{}co.blotName="code",co.tagName="CODE",ao.blotName="code-block",ao.className="ql-code-block",ao.tagName="DIV",lo.blotName="code-block-container",lo.className="ql-code-block-container",lo.tagName="DIV",lo.allowedChildren=[ao],ao.allowedChildren=[Ki,Hi,ns],ao.requiredContainer=lo;const uo={scope:Zr.BLOCK,whitelist:["rtl"]},ho=new Gr("direction","dir",uo),fo=new ei("direction","ql-direction",uo),po=new ni("direction","direction",uo),mo={scope:Zr.INLINE,whitelist:["serif","monospace"]},go=new ei("font","ql-font",mo);const bo=new class extends ni{value(e){return super.value(e).replace(/["']/g,"")}}("font","font-family",mo),vo=new ei("size","ql-size",{scope:Zr.INLINE,whitelist:["small","large","huge"]}),yo=new ni("size","font-size",{scope:Zr.INLINE,whitelist:["10px","18px","32px"]}),xo=hs("quill:keyboard"),wo=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class No extends Ss{static match(e,t){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!t[n]!==e[n]&&null!==t[n])&&(t.key===e.key||t.key===e.which)}constructor(e,t){super(e,t),this.bindings={},Object.keys(this.options.bindings).forEach(e=>{this.options.bindings[e]&&this.addBinding(this.options.bindings[e])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(e){if("string"==typeof e||"number"==typeof e)e={key:e};else{if("object"!=typeof e)return null;e=Ar(e)}e.shortKey&&(e[wo]=e.shortKey,delete e.shortKey);return e}(e);if(null==r)return void xo.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(e=>{const i={...r,key:e,...t,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)})}listen(){this.quill.root.addEventListener("keydown",e=>{if(e.defaultPrevented||e.isComposing)return;if(229===e.keyCode&&("Enter"===e.key||"Backspace"===e.key))return;const t=(this.bindings[e.key]||[]).concat(this.bindings[e.which]||[]).filter(t=>No.match(e,t));if(0===t.length)return;const n=Us.find(e.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[i,s]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof Ei?o.value().slice(0,l):"",h=a instanceof Ei?a.value().slice(c):"",d={collapsed:0===r.length,empty:0===r.length&&i.length()<=1,format:this.quill.getFormat(r),line:i,offset:s,prefix:u,suffix:h,event:e};t.some(e=>{if(null!=e.collapsed&&e.collapsed!==d.collapsed)return!1;if(null!=e.empty&&e.empty!==d.empty)return!1;if(null!=e.offset&&e.offset!==d.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(e=>null==d.format[e]))return!1}else if("object"==typeof e.format&&!Object.keys(e.format).every(t=>!0===e.format[t]?null!=d.format[t]:!1===e.format[t]?null==d.format[t]:Hr(e.format[t],d.format[t])))return!1;return!(null!=e.prefix&&!e.prefix.test(d.prefix))&&(!(null!=e.suffix&&!e.suffix.test(d.suffix))&&!0!==e.handler.call(this,r,d,e))})&&e.preventDefault()})}handleBackspace(e,t){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;if(0===e.index||this.quill.getLength()<=1)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Vi).retain(e.index-n).delete(n);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(t){if(!("block"===t.statics.blotName&&t.length()<=1)){const t=i.formats(),n=this.quill.getFormat(e.index-1,1);if(r=zi.AttributeMap.diff(t,n)||{},Object.keys(r).length>0){const t=(new Vi).retain(e.index+i.length()-2).retain(1,r);s=s.compose(t)}}}}this.quill.updateContents(s,Us.sources.USER),this.quill.focus()}handleDelete(e,t){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(e.index>=this.quill.getLength()-n)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Vi).retain(e.index).delete(n);if(t.offset>=i.length()-1){const[t]=this.quill.getLine(e.index+1);if(t){const n=i.formats(),o=this.quill.getFormat(e.index,1);r=zi.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(s=s.retain(t.length()-1).retain(1,r))}}this.quill.updateContents(s,Us.sources.USER),this.quill.focus()}handleDeleteRange(e){jo({range:e,quill:this.quill}),this.quill.focus()}handleEnter(e,t){const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,Zr.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{}),r=(new Vi).retain(e.index).delete(e.length).insert("\n",n);this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(e.index+1,Us.sources.SILENT),this.quill.focus()}}const Eo={bindings:{bold:So("bold"),italic:So("italic"),underline:So("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","+1",Us.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","-1",Us.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(e,t){null!=t.format.indent?this.quill.format("indent","-1",Us.sources.USER):null!=t.format.list&&this.quill.format("list",!1,Us.sources.USER)}},"indent code-block":Ao(!0),"outdent code-block":Ao(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(e){this.quill.deleteText(e.index-1,1,Us.sources.USER)}},tab:{key:"Tab",handler(e,t){if(t.format.table)return!0;this.quill.history.cutoff();const n=(new Vi).retain(e.index).delete(e.length).insert("\t");return this.quill.updateContents(n,Us.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,Us.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,Us.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(e,t){const n={list:!1};t.format.indent&&(n.indent=!1),this.quill.formatLine(e.index,e.length,n,Us.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(e){const[t,n]=this.quill.getLine(e.index),r={...t.formats(),list:"checked"},i=(new Vi).retain(e.index).insert("\n",r).retain(t.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,Us.sources.USER),this.quill.setSelection(e.index+1,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(e,t){const[n,r]=this.quill.getLine(e.index),i=(new Vi).retain(e.index).insert("\n",t.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,Us.sources.USER),this.quill.setSelection(e.index+1,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(e){const t=this.quill.getModule("table");if(t){const[n,r,i,s]=t.getTable(e),o=function(e,t,n,r){if(null==t.prev&&null==t.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==t.prev)return-1;if(null==t.next)return 1;return null}(0,r,i,s);if(null==o)return;let l=n.offset();if(o<0){const t=(new Vi).retain(l).insert("\n");this.quill.updateContents(t,Us.sources.USER),this.quill.setSelection(e.index+1,e.length,Us.sources.SILENT)}else if(o>0){l+=n.length();const e=(new Vi).retain(l).insert("\n");this.quill.updateContents(e,Us.sources.USER),this.quill.setSelection(l,Us.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(e,t){const{event:n,line:r}=t,i=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(i-1,Us.sources.USER):this.quill.setSelection(i+r.length(),Us.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(e,t){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=t.prefix,[r,i]=this.quill.getLine(e.index);if(i>n)return!0;let s;switch(t.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(e.index," ",Us.sources.USER),this.quill.history.cutoff();const o=(new Vi).retain(e.index-i).delete(n+1).retain(r.length()-2-i).retain(1,{list:s});return this.quill.updateContents(o,Us.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,Us.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(e){const[t,n]=this.quill.getLine(e.index);let r=2,i=t;for(;null!=i&&i.length()<=1&&i.formats()["code-block"];)if(i=i.prev,r-=1,r<=0){const r=(new Vi).retain(e.index+t.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(e.index-1,Us.sources.SILENT),!1}return!0}},"embed left":ko("ArrowLeft",!1),"embed left shift":ko("ArrowLeft",!0),"embed right":ko("ArrowRight",!1),"embed right shift":ko("ArrowRight",!0),"table down":Co(!1),"table up":Co(!0)}};function Ao(e){return{key:"Tab",shiftKey:!e,format:{"code-block":!0},handler(t,n){let{event:r}=n;const i=this.quill.scroll.query("code-block"),{TAB:s}=i;if(0===t.length&&!r.shiftKey)return this.quill.insertText(t.index,s,Us.sources.USER),void this.quill.setSelection(t.index+s.length,Us.sources.SILENT);const o=0===t.length?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:l,length:a}=t;o.forEach((t,n)=>{e?(t.insertAt(0,s),0===n?l+=s.length:a+=s.length):t.domNode.textContent.startsWith(s)&&(t.deleteAt(0,s.length),0===n?l-=s.length:a-=s.length)}),this.quill.update(Us.sources.USER),this.quill.setSelection(l,a,Us.sources.SILENT)}}}function ko(e,t){const n="ArrowLeft"===e?"prefix":"suffix";return{key:e,shiftKey:t,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===e&&(r+=n.length+1);const[i]=this.quill.getLeaf(r);return!(i instanceof vi)||("ArrowLeft"===e?t?this.quill.setSelection(n.index-1,n.length+1,Us.sources.USER):this.quill.setSelection(n.index-1,Us.sources.USER):t?this.quill.setSelection(n.index,n.length+1,Us.sources.USER):this.quill.setSelection(n.index+n.length+1,Us.sources.USER),!1)}}}function So(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],Us.sources.USER)}}}function Co(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,n){const r=e?"prev":"next",i=n.line,s=i.parent[r];if(null!=s){if("table-row"===s.statics.blotName){let e=s.children.head,t=i;for(;null!=t.prev;)t=t.prev,e=e.next;const r=e.offset(this.quill.scroll)+Math.min(n.offset,e.length()-1);this.quill.setSelection(r,0,Us.sources.USER)}}else{const t=i.table()[r];null!=t&&(e?this.quill.setSelection(t.offset(this.quill.scroll)+t.length()-1,0,Us.sources.USER):this.quill.setSelection(t.offset(this.quill.scroll),0,Us.sources.USER))}return!1}}}function jo(e){let{quill:t,range:n}=e;const r=t.getLines(n);let i={};if(r.length>1){const e=r[0].formats(),t=r[r.length-1].formats();i=zi.AttributeMap.diff(t,e)||{}}t.deleteText(n,Us.sources.USER),Object.keys(i).length>0&&t.formatLine(n.index,1,i,Us.sources.USER),t.setSelection(n.index,Us.sources.SILENT)}No.DEFAULTS=Eo;const _o=/font-weight:\s*normal/,qo=["P","OL","UL"],Oo=e=>e&&qo.includes(e.tagName);const To=/\bmso-list:[^;]*ignore/i,Lo=/\bmso-list:[^;]*\bl(\d+)/i,Io=/\bmso-list:[^;]*\blevel(\d+)/i,Ro=e=>{var t,n;const r=Array.from(e.querySelectorAll("[style*=mso-list]")),i=[],s=[];r.forEach(e=>{(e.getAttribute("style")||"").match(To)?i.push(e):s.push(e)}),i.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)});const o=e.documentElement.innerHTML,l=s.map(e=>((e,t)=>{const n=e.getAttribute("style"),r=null==n?void 0:n.match(Lo);if(!r)return null;const i=Number(r[1]),s=null==n?void 0:n.match(Io),o=s?Number(s[1]):1,l=new RegExp(`@list l${i}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=t.match(l);return{id:i,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:e}})(e,o)).filter(e=>e);for(;l.length;){const e=[];let r=l.shift();for(;r;)e.push(r),r=l.length&&(null==(t=l[0])?void 0:t.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const i=document.createElement("ul");e.forEach(e=>{const t=document.createElement("li");t.setAttribute("data-list",e.type),e.indent>1&&t.setAttribute("class","ql-indent-"+(e.indent-1)),t.innerHTML=e.element.innerHTML,i.appendChild(t)});const s=null==(n=e[0])?void 0:n.element,{parentNode:o}=s??{};s&&(null==o||o.replaceChild(i,s)),e.slice(1).forEach(e=>{let{element:t}=e;null==o||o.removeChild(t)})}};const Mo=[function(e){"urn:schemas-microsoft-com:office:word"===e.documentElement.getAttribute("xmlns:w")&&Ro(e)},function(e){e.querySelector('[id^="docs-internal-guid-"]')&&((e=>{Array.from(e.querySelectorAll('b[style*="font-weight"]')).filter(e=>{var t;return null==(t=e.getAttribute("style"))?void 0:t.match(_o)}).forEach(t=>{var n;const r=e.createDocumentFragment();r.append(...t.childNodes),null==(n=t.parentNode)||n.replaceChild(r,t)})})(e),(e=>{Array.from(e.querySelectorAll("br")).filter(e=>Oo(e.previousElementSibling)&&Oo(e.nextElementSibling)).forEach(e=>{var t;null==(t=e.parentNode)||t.removeChild(e)})})(e))}],Bo=hs("quill:clipboard"),Do=[[Node.TEXT_NODE,function(e,t,n){var r;let i=e.data;if("O:P"===(null==(r=e.parentElement)?void 0:r.tagName))return t.insert(i.trim());if(!Ko(e)){if(0===i.trim().length&&i.includes("\n")&&!function(e,t){return e.previousElementSibling&&e.nextElementSibling&&!Vo(e.previousElementSibling,t)&&!Vo(e.nextElementSibling,t)}(e,n))return t;i=i.replace(/[^\S\u00a0]/g," "),i=i.replace(/ {2,}/g," "),(null==e.previousSibling&&null!=e.parentElement&&Vo(e.parentElement,n)||e.previousSibling instanceof Element&&Vo(e.previousSibling,n))&&(i=i.replace(/^ /,"")),(null==e.nextSibling&&null!=e.parentElement&&Vo(e.parentElement,n)||e.nextSibling instanceof Element&&Vo(e.nextSibling,n))&&(i=i.replace(/ $/,"")),i=i.replaceAll(" "," ")}return t.insert(i)}],[Node.TEXT_NODE,Go],["br",function(e,t){zo(t,"\n")||t.insert("\n");return t}],[Node.ELEMENT_NODE,Go],[Node.ELEMENT_NODE,function(e,t,n){const r=n.query(e);if(null==r)return t;if(r.prototype instanceof vi){const t={},i=r.value(e);if(null!=i)return t[r.blotName]=i,(new Vi).insert(t,r.formats(e,n))}else if(r.prototype instanceof mi&&!zo(t,"\n")&&t.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return $o(t,r.blotName,r.formats(e,n),n);return t}],[Node.ELEMENT_NODE,function(e,t,n){const r=Gr.keys(e),i=ei.keys(e),s=ni.keys(e),o={};return r.concat(i).concat(s).forEach(t=>{let r=n.query(t,Zr.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(e),o[r.attrName])||(r=Po[t],null==r||r.attrName!==t&&r.keyName!==t||(o[r.attrName]=r.value(e)||void 0),r=Uo[t],null==r||r.attrName!==t&&r.keyName!==t||(r=Uo[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,i]=t;return $o(e,r,i,n)},t)}],[Node.ELEMENT_NODE,function(e,t,n){var r;const i={},s=e.style||{};"italic"===s.fontStyle&&(i.italic=!0);"underline"===s.textDecoration&&(i.underline=!0);"line-through"===s.textDecoration&&(i.strike=!0);((null==(r=s.fontWeight)?void 0:r.startsWith("bold"))||parseInt(s.fontWeight,10)>=700)&&(i.bold=!0);if(t=Object.entries(i).reduce((e,t)=>{let[r,i]=t;return $o(e,r,i,n)},t),parseFloat(s.textIndent||0)>0)return(new Vi).insert("\t").concat(t);return t}],["li",function(e,t,n){const r=n.query(e);if(null==r||"list"!==r.blotName||!zo(t,"\n"))return t;let i=-1,s=e.parentNode;for(;null!=s;)["OL","UL"].includes(s.tagName)&&(i+=1),s=s.parentNode;return i<=0?t:t.reduce((e,t)=>t.insert?t.attributes&&"number"==typeof t.attributes.indent?e.push(t):e.insert(t.insert,{indent:i,...t.attributes||{}}):e,new Vi)}],["ol, ul",function(e,t,n){const r=e;let i="OL"===r.tagName?"ordered":"bullet";const s=r.getAttribute("data-checked");s&&(i="true"===s?"checked":"unchecked");return $o(t,"list",i,n)}],["pre",function(e,t,n){const r=n.query("code-block"),i=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(e,n);return $o(t,"code-block",i,n)}],["tr",function(e,t,n){var r,i;const s="TABLE"===(null==(r=e.parentElement)?void 0:r.tagName)?e.parentElement:null==(i=e.parentElement)?void 0:i.parentElement;if(null!=s){return $o(t,"table",Array.from(s.querySelectorAll("tr")).indexOf(e)+1,n)}return t}],["b",Zo("bold")],["i",Zo("italic")],["strike",Zo("strike")],["style",function(){return new Vi}]],Po=[Qs,ho].reduce((e,t)=>(e[t.keyName]=t,e),{}),Uo=[to,oo,io,po,bo,yo].reduce((e,t)=>(e[t.keyName]=t,e),{});class Fo extends Ss{constructor(e,t){super(e,t),this.quill.root.addEventListener("copy",e=>this.onCaptureCopy(e,!1)),this.quill.root.addEventListener("cut",e=>this.onCaptureCopy(e,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Do.concat(this.options.matchers??[]).forEach(e=>{let[t,n]=e;this.addMatcher(t,n)})}addMatcher(e,t){this.matchers.push([e,t])}convert(e){let{html:t,text:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[ao.blotName])return(new Vi).insert(n||"",{[ao.blotName]:r[ao.blotName]});if(!t)return(new Vi).insert(n||"",r);const i=this.convertHTML(t);return zo(i,"\n")&&(null==i.ops[i.ops.length-1].attributes||r.table)?i.compose((new Vi).retain(i.length()-1).delete(1)):i}normalizeHTML(e){(e=>{e.documentElement&&Mo.forEach(t=>{t(e)})})(e)}convertHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");this.normalizeHTML(t);const n=t.body,r=new WeakMap,[i,s]=this.prepareMatching(n,r);return Wo(this.quill.scroll,n,i,s,r)}dangerouslyPasteHTML(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Us.sources.API;if("string"==typeof e){const n=this.convert({html:e,text:""});this.quill.setContents(n,t),this.quill.setSelection(0,Us.sources.SILENT)}else{const r=this.convert({html:t,text:""});this.quill.updateContents((new Vi).retain(e).concat(r),n),this.quill.setSelection(e+r.length(),Us.sources.SILENT)}}onCaptureCopy(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.defaultPrevented)return;e.preventDefault();const[i]=this.quill.selection.getRange();if(null==i)return;const{html:s,text:o}=this.onCopy(i,r);null==(t=e.clipboardData)||t.setData("text/plain",o),null==(n=e.clipboardData)||n.setData("text/html",s),r&&jo({range:i,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>"#"!==e[0]).join("\n")}onCapturePaste(e){var t,n,r,i,s;if(e.defaultPrevented||!this.quill.isEnabled())return;e.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(t=e.clipboardData)?void 0:t.getData("text/html");let a=null==(n=e.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const t=null==(r=e.clipboardData)?void 0:r.getData("text/uri-list");t&&(a=this.normalizeURIList(t))}const c=Array.from((null==(i=e.clipboardData)?void 0:i.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const e=(new DOMParser).parseFromString(l,"text/html");if(1===e.body.childElementCount&&"IMG"===(null==(s=e.body.firstElementChild)?void 0:s.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(e){const t=this.quill.getText(e);return{html:this.quill.getSemanticHTML(e),text:t}}onPaste(e,t){let{text:n,html:r}=t;const i=this.quill.getFormat(e.index),s=this.convert({text:n,html:r},i);Bo.log("onPaste",s,{text:n,html:r});const o=(new Vi).retain(e.index).delete(e.length).concat(s);this.quill.updateContents(o,Us.sources.USER),this.quill.setSelection(o.length()-e.length,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(e,t){const n=[],r=[];return this.matchers.forEach(i=>{const[s,o]=i;switch(s){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(e.querySelectorAll(s)).forEach(e=>{if(t.has(e)){const n=t.get(e);null==n||n.push(o)}else t.set(e,[o])})}}),[n,r]}}function $o(e,t,n,r){return r.query(t)?e.reduce((e,r)=>{if(!r.insert)return e;if(r.attributes&&r.attributes[t])return e.push(r);const i=n?{[t]:n}:{};return e.insert(r.insert,{...i,...r.attributes})},new Vi):e}function zo(e,t){let n="";for(let r=e.ops.length-1;r>=0&&n.length<t.length;--r){const t=e.ops[r];if("string"!=typeof t.insert)break;n=t.insert+n}return n.slice(-1*t.length)===t}function Vo(e,t){if(!(e instanceof Element))return!1;const n=t.query(e);return!(n&&n.prototype instanceof vi)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(e.tagName.toLowerCase())}t(Fo,"DEFAULTS",{matchers:[]});const Ho=new WeakMap;function Ko(e){return null!=e&&(Ho.has(e)||("PRE"===e.tagName?Ho.set(e,!0):Ho.set(e,Ko(e.parentNode))),Ho.get(e))}function Wo(e,t,n,r,i){return t.nodeType===t.TEXT_NODE?r.reduce((n,r)=>r(t,n,e),new Vi):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((s,o)=>{let l=Wo(e,o,n,r,i);return o.nodeType===t.ELEMENT_NODE&&(l=n.reduce((t,n)=>n(o,t,e),l),l=(i.get(o)||[]).reduce((t,n)=>n(o,t,e),l)),s.concat(l)},new Vi):new Vi}function Zo(e){return(t,n,r)=>$o(n,e,!0,r)}function Go(e,t,n){if(!zo(t,"\n")){if(Vo(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert("\n");if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;null!=r;){if(Vo(r,n))return t.insert("\n");const e=n.query(r);if(e&&e.prototype instanceof Xi)return t.insert("\n");r=r.firstChild}}}return t}class Yo extends Ss{constructor(e,n){super(e,n),t(this,"lastRecorded",0),t(this,"ignoreChange",!1),t(this,"stack",{undo:[],redo:[]}),t(this,"currentRange",null),this.quill.on(Us.events.EDITOR_CHANGE,(e,t,n,r)=>{e===Us.events.SELECTION_CHANGE?t&&r!==Us.sources.SILENT&&(this.currentRange=t):e===Us.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==Us.sources.USER?this.transform(t):this.record(t,n)),this.currentRange=Xo(this.currentRange,t))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",e=>{"historyUndo"===e.inputType?(this.undo(),e.preventDefault()):"historyRedo"===e.inputType&&(this.redo(),e.preventDefault())})}change(e,t){if(0===this.stack[e].length)return;const n=this.stack[e].pop();if(!n)return;const r=this.quill.getContents(),i=n.delta.invert(r);this.stack[t].push({delta:i,range:Xo(n.range,i)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,Us.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,t){if(0===e.ops.length)return;this.stack.redo=[];let n=e.invert(t),r=this.currentRange;const i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){const e=this.stack.undo.pop();e&&(n=n.compose(e.delta),r=e.range)}else this.lastRecorded=i;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){Jo(this.stack.undo,e),Jo(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,Us.sources.USER);else{const t=function(e,t){const n=t.reduce((e,t)=>e+(t.delete||0),0);let r=t.length()-n;(function(e,t){const n=t.ops[t.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(t=>null!=e.query(t,Zr.BLOCK));return!1})(e,t)&&(r-=1);return r}(this.quill.scroll,e.delta);this.quill.setSelection(t,Us.sources.USER)}}}function Jo(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){const t=e[r];e[r]={delta:n.transform(t.delta,!0),range:t.range&&Xo(t.range,n)},n=t.delta.transform(n),0===e[r].delta.length()&&e.splice(r,1)}}function Xo(e,t){if(!e)return e;const n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}t(Yo,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class Qo extends Ss{constructor(e,t){super(e,t),e.root.addEventListener("drop",t=>{var n;t.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(t.clientX,t.clientY);else if(document.caretPositionFromPoint){const e=document.caretPositionFromPoint(t.clientX,t.clientY);r=document.createRange(),r.setStart(e.offsetNode,e.offset),r.setEnd(e.offsetNode,e.offset)}const i=r&&e.selection.normalizeNative(r);if(i){const r=e.selection.normalizedToRange(i);(null==(n=t.dataTransfer)?void 0:n.files)&&this.upload(r,t.dataTransfer.files)}})}upload(e,t){const n=[];Array.from(t).forEach(e=>{var t;e&&(null==(t=this.options.mimetypes)?void 0:t.includes(e.type))&&n.push(e)}),n.length>0&&this.options.handler.call(this,e,n)}}Qo.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(e,t){if(!this.quill.scroll.query("image"))return;const n=t.map(e=>new Promise(t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));Promise.all(n).then(t=>{const n=t.reduce((e,t)=>e.insert({image:t}),(new Vi).retain(e.index).delete(e.length));this.quill.updateContents(n,fs.sources.USER),this.quill.setSelection(e.index+t.length,fs.sources.SILENT)})}};const el=["insertText","insertReplacementText"];const tl=/Mac/i.test(navigator.platform);Us.register({"blots/block":Ji,"blots/block/embed":Xi,"blots/break":Hi,"blots/container":Ws,"blots/cursor":ns,"blots/embed":js,"blots/inline":Yi,"blots/scroll":Ys,"blots/text":Ki,"modules/clipboard":Fo,"modules/history":Yo,"modules/keyboard":No,"modules/uploader":Qo,"modules/input":class extends Ss{constructor(e,t){super(e,t),e.root.addEventListener("beforeinput",e=>{this.handleBeforeInput(e)}),/Android/i.test(navigator.userAgent)||e.on(Us.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(e){jo({range:e,quill:this.quill})}replaceText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===e.length)return!1;if(t){const n=this.quill.getFormat(e.index,1);this.deleteRange(e),this.quill.updateContents((new Vi).retain(e.index).insert(t,n),Us.sources.USER)}else this.deleteRange(e);return this.quill.setSelection(e.index+t.length,0,Us.sources.SILENT),!0}handleBeforeInput(e){if(this.quill.composition.isComposing||e.defaultPrevented||!el.includes(e.inputType))return;const t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||!0===t.collapsed)return;const n=function(e){var t;if("string"==typeof e.data)return e.data;if(null==(t=e.dataTransfer)?void 0:t.types.includes("text/plain"))return e.dataTransfer.getData("text/plain");return null}(e);if(null==n)return;const r=this.quill.selection.normalizeNative(t),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&e.preventDefault()}handleCompositionStart(){const e=this.quill.getSelection();e&&this.replaceText(e)}},"modules/uiNode":class extends Ss{constructor(e,n){super(e,n),t(this,"isListening",!1),t(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,t){let{line:n,event:r}=t;if(!(n instanceof hi&&n.uiNode))return!0;const i="rtl"===getComputedStyle(n.domNode).direction;return!!(i&&"ArrowRight"!==r.key||!i&&"ArrowLeft"!==r.key)||(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),Us.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&(e=>"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key||"Home"===e.key||!(!tl||"a"!==e.key||!0!==e.ctrlKey))(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const t=e.getRangeAt(0);if(!0!==t.collapsed||0!==t.startOffset)return;const n=this.quill.scroll.find(t.startContainer);if(!(n instanceof hi&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}}});const nl=new class extends ei{add(e,t){let n=0;if("+1"===t||"-1"===t){const r=this.value(e)||0;n="+1"===t?r+1:r-1}else"number"==typeof t&&(n=t);return 0===n?(this.remove(e),!0):super.add(e,n.toString())}canAdd(e,t){return super.canAdd(e,t)||super.canAdd(e,parseInt(t,10))}value(e){return parseInt(super.value(e),10)||void 0}}("indent","ql-indent",{scope:Zr.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class rl extends Ji{}t(rl,"blotName","blockquote"),t(rl,"tagName","blockquote");class il extends Ji{static formats(e){return this.tagName.indexOf(e.tagName)+1}}t(il,"blotName","header"),t(il,"tagName",["H1","H2","H3","H4","H5","H6"]);class sl extends Ws{}sl.blotName="list-container",sl.tagName="OL";class ol extends Ji{static create(e){const t=super.create();return t.setAttribute("data-list",e),t}static formats(e){return e.getAttribute("data-list")||void 0}static register(){Us.register(sl)}constructor(e,t){super(e,t);const n=t.ownerDocument.createElement("span"),r=n=>{if(!e.isEnabled())return;const r=this.statics.formats(t,e);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-list",t):super.format(e,t)}}ol.blotName="list",ol.tagName="LI",sl.allowedChildren=[ol],ol.requiredContainer=sl;class ll extends Yi{static create(){return super.create()}static formats(){return!0}optimize(e){super.optimize(e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}t(ll,"blotName","bold"),t(ll,"tagName",["STRONG","B"]);class al extends ll{}t(al,"blotName","italic"),t(al,"tagName",["EM","I"]);class cl extends Yi{static create(e){const t=super.create(e);return t.setAttribute("href",this.sanitize(e)),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t}static formats(e){return e.getAttribute("href")}static sanitize(e){return ul(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("href",this.constructor.sanitize(t)):super.format(e,t)}}function ul(e,t){const n=document.createElement("a");n.href=e;const r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}t(cl,"blotName","link"),t(cl,"tagName","A"),t(cl,"SANITIZED_URL","about:blank"),t(cl,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class hl extends Yi{static create(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):super.create(e)}static formats(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}t(hl,"blotName","script"),t(hl,"tagName",["SUB","SUP"]);class dl extends ll{}t(dl,"blotName","strike"),t(dl,"tagName",["S","STRIKE"]);class fl extends Yi{}t(fl,"blotName","underline"),t(fl,"tagName","U");class pl extends js{static create(e){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const t=super.create(e);return"string"==typeof e&&(window.katex.render(e,t,{throwOnError:!1,errorColor:"#f00"}),t.setAttribute("data-value",e)),t}static value(e){return e.getAttribute("data-value")}html(){const{formula:e}=this.value();return`<span>${e}</span>`}}t(pl,"blotName","formula"),t(pl,"className","ql-formula"),t(pl,"tagName","SPAN");const ml=["alt","height","width"];class gl extends vi{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("src",this.sanitize(e)),t}static formats(e){return ml.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static match(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}static sanitize(e){return ul(e,["http","https","data"])?e:"//:0"}static value(e){return e.getAttribute("src")}format(e,t){ml.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}t(gl,"blotName","image"),t(gl,"tagName","IMG");const bl=["height","width"];class vl extends Xi{static create(e){const t=super.create(e);return t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen","true"),t.setAttribute("src",this.sanitize(e)),t}static formats(e){return bl.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return cl.sanitize(e)}static value(e){return e.getAttribute("src")}format(e,t){bl.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}html(){const{video:e}=this.value();return`<a href="${e}">${e}</a>`}}t(vl,"blotName","video"),t(vl,"className","ql-video"),t(vl,"tagName","IFRAME");const yl=new ei("code-token","hljs",{scope:Zr.INLINE});class xl extends Yi{static formats(e,t){for(;null!=e&&e!==t.domNode;){if(e.classList&&e.classList.contains(ao.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),yl.add(this.domNode,n)}format(e,t){e!==xl.blotName?super.format(e,t):t?yl.add(this.domNode,t):(yl.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),yl.value(this.domNode)||this.unwrap()}}xl.blotName="code-token",xl.className="ql-token";class wl extends ao{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("data-language",e),t}static formats(e){return e.getAttribute("data-language")||"plain"}static register(){}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-language",t):super.format(e,t)}replaceWith(e,t){return this.formatAt(0,this.length(),xl.blotName,!1),super.replaceWith(e,t)}}class Nl extends lo{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===wl.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===wl.blotName&&(this.forceNext=!0),super.formatAt(e,t,n,r)}highlight(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).map(e=>e.textContent).join("\n")}\n`,r=wl.formats(this.children.head.domNode);if(t||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const t=this.children.reduce((e,t)=>e.concat(Qi(t,!1)),new Vi),i=e(n,r);t.diff(i).reduce((e,t)=>{let{retain:n,attributes:r}=t;return n?(r&&Object.keys(r).forEach(t=>{[wl.blotName,xl.blotName].includes(t)&&this.formatAt(e,n,t,r[t])}),e+n):e},0)}this.cachedText=n,this.forceNext=!1}}html(e,t){const[n]=this.children.find(e);return`<pre data-language="${n?wl.formats(n.domNode):"plain"}">\n${Zi(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const e=wl.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}Nl.allowedChildren=[wl],wl.requiredContainer=Nl,wl.allowedChildren=[xl,ns,Ki,Hi];class El extends Ss{static register(){Us.register(xl,!0),Us.register(wl,!0),Us.register(Nl,!0)}constructor(e,t){if(super(e,t),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((e,t)=>{let{key:n}=t;return e[n]=!0,e},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(Us.events.SCROLL_BLOT_MOUNT,e=>{if(!(e instanceof Nl))return;const t=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(e=>{let{key:n,label:r}=e;const i=t.ownerDocument.createElement("option");i.textContent=r,i.setAttribute("value",n),t.appendChild(i)}),t.addEventListener("change",()=>{e.format(wl.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),null==e.uiNode&&(e.attachUI(t),e.children.head&&(t.value=wl.formats(e.children.head.domNode)))})}initTimer(){let e=null;this.quill.on(Us.events.SCROLL_OPTIMIZE,()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.highlight(),e=null},this.options.interval)})}highlight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(Us.sources.USER);const n=this.quill.getSelection();(null==e?this.quill.scroll.descendants(Nl):[e]).forEach(e=>{e.highlight(this.highlightBlot,t)}),this.quill.update(Us.sources.SILENT),null!=n&&this.quill.setSelection(n,Us.sources.SILENT)}highlightBlot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(t=this.languages[t]?t:"plain","plain"===t)return Zi(e).split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[ao.blotName]:t}),e.insert(n)),new Vi);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(ao.className),n.innerHTML=((e,t,n)=>{if("string"==typeof e.versionString){const r=e.versionString.split(".")[0];if(parseInt(r,10)>=11)return e.highlight(n,{language:t}).value}return e.highlight(t,n).value})(this.options.hljs,t,e),Wo(this.quill.scroll,n,[(e,t)=>{const n=yl.value(e);return n?t.compose((new Vi).retain(t.length(),{[xl.blotName]:n})):t}],[(e,n)=>e.data.split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[ao.blotName]:t}),e.insert(n)),n)],new WeakMap)}}El.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};const Al=class e extends Ji{static create(e){const t=super.create();return e?t.setAttribute("data-row",e):t.setAttribute("data-row",_l()),t}static formats(e){if(e.hasAttribute("data-row"))return e.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,n){t===e.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(t,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};t(Al,"blotName","table"),t(Al,"tagName","TD");let kl=Al;class Sl extends Ws{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return e.table===t.table&&e.table===n.table&&e.table===r.table}return!1}optimize(e){super.optimize(e),this.children.forEach(e=>{if(null==e.next)return;const t=e.formats(),n=e.next.formats();if(t.table!==n.table){const t=this.splitAfter(e);t&&t.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}t(Sl,"blotName","table-row"),t(Sl,"tagName","TR");class Cl extends Ws{}t(Cl,"blotName","table-body"),t(Cl,"tagName","TBODY");class jl extends Ws{balanceCells(){const e=this.descendants(Sl),t=e.reduce((e,t)=>Math.max(t.children.length,e),0);e.forEach(e=>{new Array(t-e.children.length).fill(0).forEach(()=>{let t;null!=e.children.head&&(t=kl.formats(e.children.head.domNode));const n=this.scroll.create(kl.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){const[t]=this.descendant(Cl);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e);null!=n&&n.remove()})}insertColumn(e){const[t]=this.descendant(Cl);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e),r=kl.formats(t.children.head.domNode),i=this.scroll.create(kl.blotName,r);t.insertBefore(i,n)})}insertRow(e){const[t]=this.descendant(Cl);if(null==t||null==t.children.head)return;const n=_l(),r=this.scroll.create(Sl.blotName);t.children.head.children.forEach(()=>{const e=this.scroll.create(kl.blotName,n);r.appendChild(e)});const i=t.children.at(e);t.insertBefore(r,i)}rows(){const e=this.children.head;return null==e?[]:e.children.map(e=>e)}}function _l(){return`row-${Math.random().toString(36).slice(2,6)}`}t(jl,"blotName","table-container"),t(jl,"tagName","TABLE"),jl.allowedChildren=[Cl],Cl.requiredContainer=jl,Cl.allowedChildren=[Sl],Sl.requiredContainer=Cl,Sl.allowedChildren=[kl],kl.requiredContainer=Sl;const ql=hs("quill:toolbar");class Ol extends Ss{constructor(e,t){var n,r;if(super(e,t),Array.isArray(this.options.container)){const t=document.createElement("div");t.setAttribute("role","toolbar"),function(e,t){Array.isArray(t[0])||(t=[t]);t.forEach(t=>{const n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(e=>{if("string"==typeof e)Tl(n,e);else{const t=Object.keys(e)[0],r=e[t];Array.isArray(r)?function(e,t,n){const r=document.createElement("select");r.classList.add(`ql-${t}`),n.forEach(e=>{const t=document.createElement("option");!1!==e?t.setAttribute("value",String(e)):t.setAttribute("selected","selected"),r.appendChild(t)}),e.appendChild(r)}(n,t,r):Tl(n,t,r)}}),e.appendChild(n)})}(t,this.options.container),null==(r=null==(n=e.container)?void 0:n.parentNode)||r.insertBefore(t,e.container),this.container=t}else"string"==typeof this.options.container?this.container=document.querySelector(this.options.container):this.container=this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(e=>{var t;const n=null==(t=this.options.handlers)?void 0:t[e];n&&this.addHandler(e,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(e=>{this.attach(e)}),this.quill.on(Us.events.EDITOR_CHANGE,()=>{const[e]=this.quill.selection.getRange();this.update(e)})):ql.error("Container required for toolbar",this.options)}addHandler(e,t){this.handlers[e]=t}attach(e){let t=Array.from(e.classList).find(e=>0===e.indexOf("ql-"));if(!t)return;if(t=t.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[t]&&null==this.quill.scroll.query(t))return void ql.warn("ignoring attaching to nonexistent format",t,e);const n="SELECT"===e.tagName?"change":"click";e.addEventListener(n,n=>{let r;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;const t=e.options[e.selectedIndex];r=!t.hasAttribute("selected")&&(t.value||!1)}else r=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),n.preventDefault();this.quill.focus();const[i]=this.quill.selection.getRange();if(null!=this.handlers[t])this.handlers[t].call(this,r);else if(this.quill.scroll.query(t).prototype instanceof vi){if(r=prompt(`Enter ${t}`),!r)return;this.quill.updateContents((new Vi).retain(i.index).delete(i.length).insert({[t]:r}),Us.sources.USER)}else this.quill.format(t,r,Us.sources.USER);this.update(i)}),this.controls.push([t,e])}update(e){const t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(n=>{const[r,i]=n;if("SELECT"===i.tagName){let n=null;if(null==e)n=null;else if(null==t[r])n=i.querySelector("option[selected]");else if(!Array.isArray(t[r])){let e=t[r];"string"==typeof e&&(e=e.replace(/"/g,'\\"')),n=i.querySelector(`option[value="${e}"]`)}null==n?(i.value="",i.selectedIndex=-1):n.selected=!0}else if(null==e)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const e=t[r],n=e===i.getAttribute("value")||null!=e&&e.toString()===i.getAttribute("value")||null==e&&!i.getAttribute("value");i.classList.toggle("ql-active",n),i.setAttribute("aria-pressed",n.toString())}else{const e=null!=t[r];i.classList.toggle("ql-active",e),i.setAttribute("aria-pressed",e.toString())}})}}function Tl(e,t,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${t}: ${n}`)):r.setAttribute("aria-label",t),e.appendChild(r)}Ol.DEFAULTS={},Ol.DEFAULTS={container:null,handlers:{clean(){const e=this.quill.getSelection();if(null!=e)if(0===e.length){const e=this.quill.getFormat();Object.keys(e).forEach(e=>{null!=this.quill.scroll.query(e,Zr.INLINE)&&this.quill.format(e,!1,Us.sources.USER)})}else this.quill.removeFormat(e.index,e.length,Us.sources.USER)},direction(e){const{align:t}=this.quill.getFormat();"rtl"===e&&null==t?this.quill.format("align","right",Us.sources.USER):e||"right"!==t||this.quill.format("align",!1,Us.sources.USER),this.quill.format("direction",e,Us.sources.USER)},indent(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0,10);if("+1"===e||"-1"===e){let t="+1"===e?1:-1;"rtl"===n.direction&&(t*=-1),this.quill.format("indent",r+t,Us.sources.USER)}},link(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,Us.sources.USER)},list(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,Us.sources.USER):this.quill.format("list","unchecked",Us.sources.USER):this.quill.format("list",e,Us.sources.USER)}}};const Ll='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',Il={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:Ll,"code-block":Ll,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let Rl=0;function Ml(e,t){e.setAttribute(t,`${!("true"===e.getAttribute(t))}`)}class Bl{constructor(e){this.select=e,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),Ml(this.label,"aria-expanded"),Ml(this.options,"aria-hidden")}buildItem(e){const t=document.createElement("span");t.tabIndex="0",t.setAttribute("role","button"),t.classList.add("ql-picker-item");const n=e.getAttribute("value");return n&&t.setAttribute("data-value",n),e.textContent&&t.setAttribute("data-label",e.textContent),t.addEventListener("click",()=>{this.selectItem(t,!0)}),t.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.selectItem(t,!0),e.preventDefault();break;case"Escape":this.escape(),e.preventDefault()}}),t}buildLabel(){const e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}buildOptions(){const e=document.createElement("span");e.classList.add("ql-picker-options"),e.setAttribute("aria-hidden","true"),e.tabIndex="-1",e.id=`ql-picker-options-${Rl}`,Rl+=1,this.label.setAttribute("aria-controls",e.id),this.options=e,Array.from(this.select.options).forEach(t=>{const n=this.buildItem(t);e.appendChild(n),!0===t.selected&&this.selectItem(n)}),this.container.appendChild(e)}buildPicker(){Array.from(this.select.attributes).forEach(e=>{this.container.setAttribute(e.name,e.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=Array.from(e.parentNode.children).indexOf(e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let e;if(this.select.selectedIndex>-1){const t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);const t=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",t)}}class Dl extends Bl{constructor(e,t){super(e),this.label.innerHTML=t,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(e=>{e.classList.add("ql-primary")})}buildItem(e){const t=super.buildItem(e);return t.style.backgroundColor=e.getAttribute("value")||"",t}selectItem(e,t){super.selectItem(e,t);const n=this.label.querySelector(".ql-color-label"),r=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Pl extends Bl{constructor(e,t){super(e),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(e=>{e.innerHTML=t[e.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(e,t){super.selectItem(e,t);const n=e||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class Ul{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(e=>{const{overflowY:t}=getComputedStyle(e,null);return"visible"!==t&&"clip"!==t})(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=-1*this.quill.root.scrollTop+"px"}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(e){const t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=`${t}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect();let s=0;if(i.right>r.right&&(s=r.right-i.right,this.root.style.left=`${t+s}px`),i.left<r.left&&(s=r.left-i.left,this.root.style.left=`${t+s}px`),i.bottom>r.bottom){const t=i.bottom-i.top,r=e.bottom-e.top+t;this.root.style.top=n-r+"px",this.root.classList.add("ql-flip")}return s}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const Fl=[!1,"center","right","justify"],$l=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],zl=[!1,"serif","monospace"],Vl=["1","2","3",!1],Hl=["small",!1,"large","huge"];class Kl extends Os{constructor(e,t){super(e,t);const n=t=>{document.body.contains(e.root)?(null==this.tooltip||this.tooltip.root.contains(t.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(e=>{e.container.contains(t.target)||e.close()})):document.body.removeEventListener("click",n)};e.emitter.listenDOM("click",document.body,n)}addModule(e){const t=super.addModule(e);return"toolbar"===e&&this.extendToolbar(t),t}buildButtons(e,t){Array.from(e).forEach(e=>{(e.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=t[n]))if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{const r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}buildPickers(e,t){this.pickers=Array.from(e).map(e=>{if(e.classList.contains("ql-align")&&(null==e.querySelector("option")&&Zl(e,Fl),"object"==typeof t.align))return new Pl(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){const n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&Zl(e,$l,"background"===n?"#ffffff":"#000000"),new Dl(e,t[n])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?Zl(e,zl):e.classList.contains("ql-header")?Zl(e,Vl):e.classList.contains("ql-size")&&Zl(e,Hl)),new Bl(e)});this.quill.on(fs.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}}Kl.DEFAULTS=Wr({},Os.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let e=this.container.querySelector("input.ql-image[type=file]");null==e&&(e=document.createElement("input"),e.setAttribute("type","file"),e.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),e.classList.add("ql-image"),e.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,e.files),e.value=""}),this.container.appendChild(e)),e.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Wl extends Ul{constructor(e,t){super(e,t),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",e=>{"Enter"===e.key?(this.save(),e.preventDefault()):"Escape"===e.key&&(this.cancel(),e.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${e}`)||""),this.root.setAttribute("data-mode",e)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:e}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:t}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,fs.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,fs.sources.USER)),this.quill.root.scrollTop=t;break}case"video":e=function(e){let t=e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(t)return`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`;if(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`;return e}(e);case"formula":{if(!e)break;const t=this.quill.getSelection(!0);if(null!=t){const n=t.index+t.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,fs.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",fs.sources.USER),this.quill.setSelection(n+2,fs.sources.USER)}break}}this.textbox.value="",this.hide()}}function Zl(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(t=>{const r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(t)),e.appendChild(r)})}const Gl=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Yl extends Wl{constructor(e,t){super(e,t),this.quill.on(fs.events.EDITOR_CHANGE,(e,t,n,r)=>{if(e===fs.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&r===fs.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const e=this.quill.getLines(t.index,t.length);if(1===e.length){const e=this.quill.getBounds(t);null!=e&&this.position(e)}else{const n=e[e.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,t.index+t.length-r),s=this.quill.getBounds(new ms(r,i));null!=s&&this.position(s)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(fs.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const e=this.quill.getSelection();if(null!=e){const t=this.quill.getBounds(e);null!=t&&this.position(t)}},1)})}cancel(){this.show()}position(e){const t=super.position(e),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==t&&(n.style.marginLeft=-1*t-n.offsetWidth/2+"px"),t}}t(Yl,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class Jl extends Kl{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=Gl),super(e,t),this.quill.container.classList.add("ql-bubble")}extendToolbar(e){this.tooltip=new Yl(this.quill,this.options.bounds),null!=e.container&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll("button"),Il),this.buildPickers(e.container.querySelectorAll("select"),Il))}}Jl.DEFAULTS=Wr({},Kl.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1,Us.sources.USER)}}}}});const Xl=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class Ql extends Wl{constructor(){super(...arguments),t(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",e=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),e.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",e=>{if(null!=this.linkRange){const e=this.linkRange;this.restoreFocus(),this.quill.formatText(e,"link",!1,fs.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(fs.events.SELECTION_CHANGE,(e,t,n)=>{if(null!=e){if(0===e.length&&n===fs.sources.USER){const[t,n]=this.quill.scroll.descendant(cl,e.index);if(null!=t){this.linkRange=new ms(e.index-n,t.length());const r=cl.formats(t.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const i=this.quill.getBounds(this.linkRange);return void(null!=i&&this.position(i))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}t(Ql,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class ea extends Kl{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=Xl),super(e,t),this.quill.container.classList.add("ql-snow")}extendToolbar(e){null!=e.container&&(e.container.classList.add("ql-snow"),this.buildButtons(e.container.querySelectorAll("button"),Il),this.buildPickers(e.container.querySelectorAll("select"),Il),this.tooltip=new Ql(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(t,n)=>{e.handlers.link.call(e,!n.format.link)}))}}ea.DEFAULTS=Wr({},Kl.DEFAULTS,{modules:{toolbar:{handlers:{link(e){if(e){const e=this.quill.getSelection();if(null==e||0===e.length)return;let t=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(t)&&0!==t.indexOf("mailto:")&&(t=`mailto:${t}`);const{tooltip:n}=this.quill.theme;n.edit("link",t)}else this.quill.format("link",!1,Us.sources.USER)}}}}}),Us.register({"attributors/attribute/direction":ho,"attributors/class/align":eo,"attributors/class/background":so,"attributors/class/color":ro,"attributors/class/direction":fo,"attributors/class/font":go,"attributors/class/size":vo,"attributors/style/align":to,"attributors/style/background":oo,"attributors/style/color":io,"attributors/style/direction":po,"attributors/style/font":bo,"attributors/style/size":yo},!0),Us.register({"formats/align":eo,"formats/direction":fo,"formats/indent":nl,"formats/background":oo,"formats/color":io,"formats/font":go,"formats/size":vo,"formats/blockquote":rl,"formats/code-block":ao,"formats/header":il,"formats/list":ol,"formats/bold":ll,"formats/code":co,"formats/italic":al,"formats/link":cl,"formats/script":hl,"formats/strike":dl,"formats/underline":fl,"formats/formula":pl,"formats/image":gl,"formats/video":vl,"modules/syntax":El,"modules/table":class extends Ss{static register(){Us.register(kl),Us.register(Sl),Us.register(Cl),Us.register(jl)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(jl).forEach(e=>{e.balanceCells()})}deleteColumn(){const[e,,t]=this.getTable();null!=t&&(e.deleteColumn(t.cellOffset()),this.quill.update(Us.sources.USER))}deleteRow(){const[,e]=this.getTable();null!=e&&(e.remove(),this.quill.update(Us.sources.USER))}deleteTable(){const[e]=this.getTable();if(null==e)return;const t=e.offset();e.remove(),this.quill.update(Us.sources.USER),this.quill.setSelection(t,Us.sources.SILENT)}getTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==e)return[null,null,null,-1];const[t,n]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==kl.blotName)return[null,null,null,-1];const r=t.parent;return[r.parent.parent,r,t,n]}insertColumn(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=i.cellOffset();n.insertColumn(s+e),this.quill.update(Us.sources.USER);let o=r.rowOffset();0===e&&(o+=1),this.quill.setSelection(t.index+o,t.length,Us.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=r.rowOffset();n.insertRow(s+e),this.quill.update(Us.sources.USER),e>0?this.quill.setSelection(t,Us.sources.SILENT):this.quill.setSelection(t.index+r.children.length,t.length,Us.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(e,t){const n=this.quill.getSelection();if(null==n)return;const r=new Array(e).fill(0).reduce(e=>{const n=new Array(t).fill("\n").join("");return e.insert(n,{table:_l()})},(new Vi).retain(n.index));this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(n.index,Us.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(Us.events.SCROLL_OPTIMIZE,e=>{e.some(e=>!!["TD","TR","TBODY","TABLE"].includes(e.target.tagName)&&(this.quill.once(Us.events.TEXT_CHANGE,(e,t,n)=>{n===Us.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":Ol,"themes/bubble":Jl,"themes/snow":ea,"ui/icons":Il,"ui/picker":Bl,"ui/icon-picker":Pl,"ui/color-picker":Dl,"ui/tooltip":Ul},!0);const ta=({value:e,onChange:t,placeholder:i,style:s})=>{const o=r.useRef(null),l=r.useRef(null);return r.useEffect(()=>{if(o.current&&!l.current){l.current=new Us(o.current,{theme:"snow",modules:{toolbar:[[{header:[1,2,!1]}],["bold","italic","underline"],["link","image"]]},placeholder:i});const e=l.current;e.on("text-change",(n,r,i)=>{if("user"===i){const n=e.root.innerHTML;null==t||t("<p><br></p>"===n?"":n)}})}},[i]),r.useEffect(()=>{const t=l.current;if(t&&e!==t.root.innerHTML){const n=0===t.getText().trim().length;!e&&n||t.clipboard.dangerouslyPasteHTML(e||"")}},[e]),n.jsx("div",{ref:o,style:{minHeight:"200px",...s}})},na="_fileUploadWrapper_byo9w_1",ra=({value:e,onChange:t,accept:o=".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar",listType:l="text",maxCount:a=1,key:c,disabled:u=!1,maxSize:h=1e3,buttonText:d="上传文件"})=>{const[f,m]=r.useState(!1),[g,b]=r.useState(""),[v,y]=r.useState(""),[x,w]=r.useState("none"),[N,E]=r.useState([]),[A,k]=r.useState(!1),S=e=>{try{const n=e.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(t){}return r||"未知文件"}catch(n){return"未知文件"}},C=e=>e?Array.isArray(e)?e.filter(Boolean):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const t=C(e);return JSON.stringify(t)},[e]),_=r.useRef(N);r.useEffect(()=>{_.current=N},[N]),r.useEffect(()=>{if(A)return void k(!1);const t=C(e),n=_.current.filter(e=>"done"===e.status).map(e=>e.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(t))if(t.length>0){const e=t.map((e,t)=>({uid:`-${t+1}`,name:S(e),status:"done",url:e}));E(e)}else E([])},[j,A]);const q=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:na,children:[n.jsx(i.Upload,{accept:o,listType:l,fileList:N,onPreview:async e=>{const t=e.url||e.preview,n=e.name||"",r=(e=>{const t=e.substring(e.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(t)?"image":[".txt",".json",".xml",".log"].includes(t)?"text":"none"})(n);y(n),w(r),"image"===r?(e.url||e.preview||!e.originFileObj||(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),b(e.url||e.preview),m(!0)):t?window.open(t,"_blank"):i.message.info("文件预览不可用")},onChange:({file:e,fileList:t})=>{var n,r;if(k(!0),"done"===e.status){if(null==(n=e.response)?void 0:n.data){i.message.success(`${e.name} 文件上传成功`);const n=t.map(t=>{var n;return t.uid===e.uid&&(null==(n=t.response)?void 0:n.data)?{...t,url:t.response.data,name:t.name}:t});E(n);const r=n.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(r[0]||void 0):null==q||q(r.length>0?r:void 0)}else i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),E(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 文件已移除`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(void 0):null==q||q(n.length>0?n:void 0)}else if("error"===e.status){i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==q||q(n[0]||void 0):null==q||q(n.length>0?n:void 0)}else E(t)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:o,onProgress:l}=e,a=1024*h*1024;if(o instanceof File&&o.size>a)return i.message.error(`文件大小不能超过 ${h}MB`),void r(new Error(`文件大小不能超过 ${h}MB`));const c=new FormData;c.append("file",o);const u=null==(t=null==p?void 0:p.getOrgInfo())?void 0:t.orgId;u&&c.append("orgId",u.toString());try{const e=await(async(e,t)=>{const n=p.getToken();try{return(await s.post("/api/sterilization-service/common/uploadFile",e,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==t?void 0:t.headers},onUploadProgress:null==t?void 0:t.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&l({percent:e.loaded/e.total*100})}});e&&e.data?n(e,o):r(new Error("上传成功但响应中缺少文件URL"),e)}catch(d){r(d)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:e=>!0,children:N.length>=(a||1)?null:n.jsx(i.Button,{icon:n.jsx(He,{}),disabled:u,type:"primary",children:d})},c),n.jsxs(i.Modal,{visible:f,title:v,footer:null,onCancel:()=>{m(!1),b(""),w("none")},width:"image"===x?800:600,children:["image"===x&&n.jsx("img",{alt:"预览",style:{width:"100%"},src:g}),"text"===x&&n.jsx("pre",{style:{maxHeight:"500px",overflow:"auto",whiteSpace:"pre-wrap"},children:g})]})]})},ia="_treeselectEllipsis_e4t0j_1",sa="_addonAfterSelect_e4t0j_19",oa="_customDisabled_e4t0j_23",la=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}),aa=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,maxSize:a=5,disabled:c=!1,...u})=>{const[h,d]=r.useState(!1),[f,p]=r.useState(""),[m,g]=r.useState(""),[b,v]=r.useState([]),y=e=>e?e.startsWith("data:")?e:`data:image/png;base64,${e}`:"",x=e=>e?e.includes(",")?e.split(",")[1]:e:"";r.useEffect(()=>{if(e&&Array.isArray(e)&&e.length>0){const t=e.map((e,t)=>{let n="",r="";if("string"==typeof e)r=x(e),n=y(e);else if(Array.isArray(e)&&e.length>0&&"number"==typeof e[0]){const t=(e=>{try{const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return`data:image/png;base64,${btoa(n)}`}catch(t){return""}})(e);r=x(t),n=t}return{uid:`-${t}`,name:`image-${t}.png`,status:"done",url:n,thumbUrl:n,response:{data:r,url:n}}});v(t)}else v([])},[e]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{children:[n.jsx(Me,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:b,onPreview:async e=>{let t=e.url;if(t||e.preview||!e.originFileObj?!t&&e.preview&&(t=e.preview):(e.preview=await la(e.originFileObj),t=e.preview),!t)return void i.message.error("无法预览图片:未找到图片数据");p(t),d(!0);const n=e.name||"预览图片";g(n)},onChange:async({file:e,fileList:t})=>{var n,r,s;const o=e=>{var t,n;return(null==(t=e.response)?void 0:t.data)&&"string"==typeof e.response.data?x(e.response.data):(null==(n=e.response)?void 0:n.url)&&"string"==typeof e.response.url?x(e.response.url):e.url&&"string"==typeof e.url?x(e.url):e.preview&&"string"==typeof e.preview?x(e.preview):null};if("done"===e.status){const s=(null==(n=e.response)?void 0:n.data)||(null==(r=e.response)?void 0:r.url)||e.url||e.preview;if(s&&"string"==typeof s){i.message.success(`${e.name} 处理成功`);const n=y(s),r=t.map(t=>t.uid===e.uid?{...t,url:n,thumbUrl:n,response:{...e.response,data:x(s),url:n}}:t);v(r);const l=r.filter(e=>"done"===e.status).map(o).filter(Boolean);w(l.length>0?l:void 0)}else i.message.error(`${e.name} 处理失败:无法获取图片数据`),v(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 已移除`),v(t);const n=t.filter(e=>"done"===e.status).map(o).filter(Boolean);w(n.length>0?n:void 0)}else"error"===e.status?(i.message.error(`${e.name} 处理失败: ${(null==(s=e.error)?void 0:s.message)||"未知错误"}`),v(t)):v(t)},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e,o=1024*a*1024;if(r instanceof File&&r.size>o)return i.message.error(`图片大小不能超过 ${a}MB`),void(null==n||n(new Error(`图片大小不能超过 ${a}MB`)));try{s({percent:0});const e=await la(r),n=x(e);s({percent:100});t({data:n,url:e,preview:e},r)}catch(l){i.message.error((null==l?void 0:l.message)||"图片处理失败"),n(l)}},beforeUpload:e=>{const t=1024*a*1024;if(e.size>t)return i.message.error(`图片大小不能超过 ${a}MB`),i.Upload.LIST_IGNORE;return!!e.type.startsWith("image/")||(i.message.error("只能上传图片文件"),i.Upload.LIST_IGNORE)},maxCount:l,disabled:c,...u,children:l&&b.length>=l?null:N}),n.jsx(i.Modal,{open:h,title:m,footer:null,onCancel:()=>d(!1),width:800,children:n.jsx("img",{alt:"preview",style:{width:"100%"},src:f})})]})},{TextArea:ca}=i.Input,ua=r.forwardRef((e,t)=>{var s;const{visible:c,mode:u,config:h,initialValues:d,onOk:f,onCancel:m,title:g,loading:b=!1,oneditFormChange:v,modalProps:y={},CustomModalFooter:x,tab:w=!1,validateConfig:N}=e,[E]=i.Form.useForm(),A="view"==u;r.useImperativeHandle(t,()=>({setFieldsValue:e=>{E.setFieldsValue(e)},getFieldsValue:()=>E.getFieldsValue()})),r.useEffect(()=>{if(c)if(E.resetFields(),"edit"!==u&&"view"!==u||!d){const e=[];w?h.forEach(t=>{t.children.forEach(t=>{var n,r;e.push({...t,defaultValue:t.defaultValue||(null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value)||t.defaultValue})})}):h.forEach(t=>{e.push({...t,defaultValue:t.defaultValue||t.defaultValue})}),(null==e?void 0:e.length)>0&&(null==e||e.forEach(e=>{E.setFieldsValue({[null==e?void 0:e.name]:null==e?void 0:e.defaultValue})})),I(E.getFieldValue("useOrgId")||T)}else if(w){const e={...d},t=[];h.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=l(n);else if("rangePicker"===t.type&&n)Array.isArray(n)&&(e[t.name]=n.map(e=>l(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else{const e={...d};h.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=l(n);else if("rangePicker"===t.type&&n)Array.isArray(n)&&(e[t.name]=n.map(e=>l(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else E.resetFields()},[c,u,d,E]),r.useEffect(()=>{if(c)if("edit"!==u&&"view"!==u||!d)I(E.getFieldValue("useOrgId")||T);else if(w){const e={...d},t=[];h.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{"datePicker"===t.type&&e[t.name]?e[t.name]=l(e[t.name]):"rangePicker"===t.type&&e[t.name]?Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>l(e))):"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else{const e={...d};h.forEach(t=>{"datePicker"===t.type&&e[t.name]?e[t.name]=l(e[t.name]):"rangePicker"===t.type&&e[t.name]?Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>l(e))):"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else E.resetFields()},[h]);const k=r.useCallback(e=>{if(w){for(const t of h)if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n.label}}else{const t=h.find(t=>t.name===e);if(t)return t.label}return e},[h,w]),j=r.useCallback((e,t)=>{const n=[];let r="";const i=new Set;return t&&Array.isArray(t)&&t.length>0&&(t.forEach(t=>{const s=e.filter(e=>t.includes(e.field)&&!i.has(e.field));if(s.length>1){const e=s.map(e=>k(e.field)).join("、")+"同时重复";s.forEach(t=>{n.push({name:t.field,errors:[e]}),i.add(t.field)}),r||(r=e)}else if(1===s.length){const e=s[0],t=k(e.field)+"重复";n.push({name:e.field,errors:[t]}),i.add(e.field),r||(r=t)}}),e.forEach(e=>{if(!i.has(e.field)){const t=k(e.field)+"重复";n.push({name:e.field,errors:[t]}),r||(r=t)}})),{errorFields:n,errorMessage:r||"验证失败"}},[k]),q=r.useMemo(()=>{if(!(null==N?void 0:N.realtime))return()=>{};const e=N.realtimeDelay||500;return o.debounce((e,t)=>{(async(e,t)=>{if(!N||!N.realtime)return;const{validateApi:n,validateFields:r,validateMethod:i="POST",validateParams:s,validateMessage:o="验证失败",union:l=!0,group:a}=N,c=t&&r.includes(t)?[t]:r,u=(null==d?void 0:d.id)||(null==d?void 0:d.ID)||null;let h;if(s)h=s(e);else{const t={};c.forEach(n=>{void 0!==e[n]&&null!==e[n]&&""!==e[n]&&(t[n]=e[n])}),h={field:c,value:t,id:u,union:l?1:0,group:a}}const f="GET"===i?await C(h,n):await S(h,n);if(200===f.code&&Array.isArray(f.data)){const e=f.data.filter(e=>!0===e.value);if(f.data.forEach(e=>{!1===e.value&&E.setFields([{name:e.field,errors:[]}])}),e.length>0){let t=[];if(a&&Array.isArray(a)&&a.length>0){const n=j(e,a);t=n.errorFields}else if(l&&e.length>1){const n=e.map(e=>k(e.field)).join("、")+"同时重复";e.forEach(e=>{t.push({name:e.field,errors:[n]})})}else e.forEach(e=>{const n=k(e.field);t.push({name:e.field,errors:[n+"重复"]})});t.length>0&&E.setFields(t)}}})(e,t).catch(()=>{})},e)},[N]),O=(e,t)=>{if("name"==t.name&&!(null==E?void 0:E.getFieldValue("pyCode"))){const t=(n=e.target.value,a.pinyin(n,{pattern:"first",type:"array",nonZh:"consecutive"}).join("").toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""));E.setFieldsValue({pyCode:t})}var n},T=null==(s=p.getOrgInfo())?void 0:s.orgId,[L,I]=r.useState(T),R=r.useMemo(()=>h.some(e=>w&&e.children?e.children.some(e=>"deptSelect"===e.type):"deptSelect"===e.type),[h,w]),M=r.useMemo(()=>h.some(e=>w&&e.children?e.children.some(e=>"orgSelect"===e.type):"orgSelect"===e.type),[h,w]);r.useEffect(()=>{R&&F()},[L,R]),r.useEffect(()=>{M&&$()},[M]);const[B,D]=r.useState([]),[P,U]=r.useState([]),F=async()=>{const e=await S({orgId:L,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===e.code){const t=[{name:"通用",id:-1},...e.data||[]];D(t||[])}},$=async()=>{const e=await S({loginOrgId:T,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&U((null==e?void 0:e.data)||[])},z=e=>{if("view"!==u)return;const t=E.getFieldValue(e);if(null==t||""===t)return void i.message.warning("没有内容可复制");let n="";if("object"==typeof t)if(l.isDayjs(t))n=t.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(t))n=t.map(e=>l.isDayjs(e)?e.format("YYYY-MM-DD HH:mm:ss"):String(e)).join(", ");else if(t.addProvince){const e=[t.addProvince,t.addCity,t.addCounty,t.addStreet,t.address].filter(Boolean);n=e.join("-")}else n=JSON.stringify(t);else n=String(t);navigator.clipboard.writeText(n).then(()=>{i.message.success("已复制到剪贴板")}).catch(()=>{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),i.message.success("已复制到剪贴板")}catch(t){}document.body.removeChild(e)})},V=e=>{var t,r,s,o;const{type:l,name:a,placeholder:c,options:u,rules:h,...d}=e,f=A?"":c||`请输入${e.label}`,p=A?"":c||`请选择${e.label}`;switch(l){case"input":return n.jsx(i.Input,{placeholder:f,...d,readOnly:A||d.readOnly,onDoubleClick:()=>z(a),onBlur:t=>O(t,e)});case"inputoption":return n.jsx(i.Input,{placeholder:f,...d,readOnly:A||d.readOnly,onDoubleClick:()=>z(a),addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(r=null==(t=e.options)?void 0:t[0])?void 0:r.value,children:n.jsx(_,{disabled:A,options:e.options,allowClear:!A})})});case"inputnumberoption":return n.jsx(i.InputNumber,{className:sa,placeholder:f,addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(o=null==(s=e.options)?void 0:s[0])?void 0:o.value,children:n.jsx(_,{disabled:A,options:e.options,allowClear:!A})}),...d});case"password":return n.jsx(i.Input.Password,{placeholder:f,...d,readOnly:A||d.readOnly,onDoubleClick:()=>z(a)});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%"},placeholder:p,...d,disabled:A||d.disabled,allowClear:!A});case"InputNumber":return n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:f,...d,readOnly:A||d.readOnly,onDoubleClick:()=>z(a)});case"Radio":return n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(i.Radio.Group,{style:{pointerEvents:A?"none":"auto",...d.style},disabled:A||d.disabled,options:u,...d})});case"treeSelect":{const t=!!e.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(_,{className:ia,allowClear:!A,style:{width:"100%"},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...d,disabled:A||d.disabled})})})}case"select":{const t=!!e.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(_,{className:ia,allowClear:!A,style:{width:"100%"},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...d,disabled:A||d.disabled})})})}case"upload":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ge,{value:e.value,...d},`upload_${e.name}`)})});case"file":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ra,{...d})})});case"textarea":return n.jsx(ca,{rows:4,placeholder:f,...d,readOnly:A||d.readOnly,onDoubleClick:()=>z(a)});case"area":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ze,{...d})})});case"richText":const{style:l,...c}=d;return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ta,{style:l})})});case"doubleValue":return n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx(i.Form.Item,{name:e.firstLabel||"first",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:e.firstPlaceholder||`请输入${e.firstLabel||"最小值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:e.separator||"至"}),n.jsx(i.Form.Item,{name:e.secondLabel||"second",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:e.secondPlaceholder||`请输入${e.secondLabel||"最大值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:e.lastUnit})]});case"deptSelect":return n.jsx(_,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:B,disabled:A||d.disabled,...d});case"orgSelect":return n.jsx(_,{onChange:e=>{I(e)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:P,disabled:A||d.disabled,...d});case"uploadByte":return n.jsx("div",{style:{pointerEvents:A?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(aa,{disabled:A||d.disabled,...d})})});default:return n.jsx(i.Input,{placeholder:f,...d,readOnly:A||d.readOnly,onDoubleClick:()=>z(a)})}},H=g||("add"===u?"新增":"edit"===u?"编辑":"查看");return n.jsx(i.Modal,{title:H,open:c,onOk:async()=>{try{const e=await E.validateFields();N&&await(async e=>{var t,n,r,i,s,o;if(!N)return;const{validateApi:l,validateFields:a,validateMethod:c="POST",validateParams:u,validateMessage:h="验证失败",union:f=!1,group:p=[]}=N,m=(null==d?void 0:d.id)||(null==d?void 0:d.ID)||null;if(u){const r=u(e),i="GET"===c?await C(r,l):await S(r,l);if(200!==i.code){const e=i.msg||h;throw new Error(e)}if(Array.isArray(i.data)){const e=i.data.filter(e=>!0===e.value);if(e.length>0){const t=e.map(e=>({name:e.field,errors:[h]}));throw E.setFields(t),new Error(h)}}else if(!1===i.data||!1===(null==(t=i.data)?void 0:t.valid)){const e=(null==(n=i.data)?void 0:n.message)||i.msg||h;throw new Error(e)}return}if(p&&p.length>0){const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0,group:p},s="GET"===c?await C(n,l):await S(n,l);if(200!==s.code){const e=s.msg||h;throw new Error(e)}if(Array.isArray(s.data)){const e=s.data.filter(e=>!0===e.value);if(e.length>0){const{errorFields:t,errorMessage:n}=j(e,p);throw E.setFields(t),new Error(n)}}else if(!1===s.data||!1===(null==(r=s.data)?void 0:r.valid)){const e=(null==(i=s.data)?void 0:i.message)||s.msg||h;throw new Error(e)}}else{const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0},r="GET"===c?await C(n,l):await S(n,l);if(200!==r.code){const e=r.msg||h;throw new Error(e)}if(Array.isArray(r.data)){const e=r.data.filter(e=>!0===e.value);if(e.length>0){let t=[],n=h;if(p&&Array.isArray(p)&&p.length>0){const r=j(e,p);t=r.errorFields,n=r.errorMessage}else if(f&&e.length>1){const r=e.map(e=>k(e.field));n=r.join("、")+"同时重复",t=e.map(e=>({name:e.field,errors:[n]}))}else t=e.map(e=>{const t=k(e.field);return{name:e.field,errors:[t+"重复"]}}),1===e.length&&(n=k(e[0].field)+"重复");throw E.setFields(t),new Error(n)}}else if(!1===r.data||!1===(null==(s=r.data)?void 0:s.valid)){const e=(null==(o=r.data)?void 0:o.message)||r.msg||h;throw new Error(e)}}})(e);const t={...e},n=[];w?h.forEach(e=>{e.children&&n.push(...e.children)}):n.push(...h),n.forEach(e=>{var n,r;if(void 0===e.defaultValue||void 0!==t[e.name]&&null!==t[e.name]||(t[e.name]=e.defaultValue),"datePicker"===e.type&&t[e.name]?l.isDayjs(t[e.name])&&(t[e.name]=t[e.name].toISOString()):"rangePicker"===e.type&&t[e.name]&&Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(e=>l.isDayjs(e)?e.toISOString():e)),"select"===e.type&&e.labelName){const r=null==(n=e.options)?void 0:n.find(n=>n[e.fieldNames.value]===t[e.name]),i=e.fieldNames.label,s=r?r[i]:void 0;t[e.labelName]=s}if("treeSelect"===e.type&&e.multiple&&(t[e.name]=null==(r=t[e.name])?void 0:r.join(",")),"Radio"===e.type&&e.options&&void 0!==t[e.name]&&null!==t[e.name]){const n=e.options.find(n=>n.value==t[e.name]);n&&"number"==typeof n.value&&(t[e.name]=Number(t[e.name]))}}),await f(t)}catch(e){(null==e?void 0:e.message)&&(i.message.error(e.message),(null==e?void 0:e.errorFields)&&E.setFields(e.errorFields))}},onCancel:m,width:y.width||800,confirmLoading:b,destroyOnClose:!0,maskClosable:!1,footer:(e,{OkBtn:t,CancelBtn:r})=>n.jsxs(n.Fragment,{children:[x&&x(E.getFieldsValue()),n.jsx(r,{}),n.jsx(t,{})]}),...y,children:n.jsx(i.Form,{form:E,name:`modal_form_${u}`,layout:"vertical",onValuesChange:(e,t)=>{if(v&&v(e,t),null==N?void 0:N.realtime){const n=Object.keys(e)[0];q(t,n)}},children:w?n.jsx(i.Tabs,{children:h.map(e=>{var t;return n.jsx(i.Tabs.TabPane,{tab:e.label,children:n.jsx(i.Row,{gutter:24,justify:"start",children:null==(t=null==e?void 0:e.children)?void 0:t.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?oa:"",children:V(e)},e.name)},e.name))})},e.label)})}):n.jsx(i.Row,{gutter:24,justify:"start",children:h.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:A||e.disabled?oa:"",children:V(e)},e.name)},e.name))})})})}),ha="_container_18q8s_1",da="_searchForm_18q8s_9",fa="_tableContainer_18q8s_15",pa="_pagination_18q8s_44",ma="_selectedRow_18q8s_63",ga=r.forwardRef(({searchFormConfig:e,addFormConfig:t,tableColumns:s,URL:l,editText:a,viewText:c,delText:u,CustomOperations:h,classjson:d,postParams:f,proplist:p,topHeight:m,isnopage:g,PropOtherButton:b,CustomModalFooter:v,editdclickback:y,oneditFormChange:x,onSearchFormChange:w,addisdisabled:N={isdisabled:!1,message:""},tableHeight:E=150,limit:A={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:k,onRowClick:C,onDelete:j,tableId:_,isaddtab:q=!1,validateConfig:T,tableConfig:L,...I},R)=>{r.useImperativeHandle(R,()=>({getList:async()=>le(),setFieldsValue:e=>{var t;null==(t=ee.current)||t.setFieldsValue(e)},getFieldsValue:()=>{var e;return null==(e=ee.current)?void 0:e.getFieldsValue()},reload:()=>{le()},setCurrentRecord:e=>{W(e)},getSearchFieldsValue:()=>{var e;return null==(e=oe.current)?void 0:e.getFieldsValue()},setSearchFieldsValue:e=>{var t;null==(t=oe.current)||t.setFieldsValue(e)}}));const[M,B]=r.useState(!1),[D,P]=r.useState([]),[U,F]=r.useState({current:1,pageSize:50,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}),[$,z]=r.useState(!1),[V,H]=r.useState("add"),[K,W]=r.useState(null),[Z,G]=r.useState([]),[Y,J]=r.useState([]),[X,Q]=r.useState([]),ee=r.useRef(null),te=r.useRef(f),ne=r.useRef(U),re=r.useRef(null),[ie,se]=r.useState(0),oe=r.useRef(null);r.useEffect(()=>{te.current=f},[f]),r.useEffect(()=>{ne.current=U},[U]),r.useEffect(()=>{$||W(null)},[$]);const le=o.debounce(async e=>{var t,n;if(!(null==l?void 0:l.search))return;const r=oe.current.getFieldsValue();for(const o in r)if(o.includes("/")){const e=o.split("/")[0],t=o.split("/")[1],n=r[o];r[e]=n&&n.length>0?r[o][0].format("YYYY-MM-DD"):null,r[t]=n&&n.length>0?r[o][1].format("YYYY-MM-DD"):null}else r[o]=r[o];const i={...null==(t=te.current)?void 0:t.searchParams,...e,pageNum:ne.current.current,pageSize:ne.current.pageSize,...r};g&&delete i.pageNum,g&&delete i.pageSize,B(!0);try{const e=await S(i,l.search);if(200===e.code){const t=(null==(n=null==e?void 0:e.data)?void 0:n.list)||(null==e?void 0:e.data),r=t.map(e=>(e.hasOwnProperty("addCountyCode")&&(e.alladdress={...e}),e)).map(e=>(e.alladdress={...e},e));P(r||[]),F(t=>{var n,r;return{...t,current:null==(n=null==e?void 0:e.data)?void 0:n.pageNum,total:null==(r=null==e?void 0:e.data)?void 0:r.total}})}else P([]),F(e=>({...e,total:0,current:1}))}catch(s){P([]),F(e=>({...e,total:0,current:1}))}finally{B(!1)}},100);r.useEffect(()=>{(null==l?void 0:l.search)&&le()},[U.current,U.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(re.current&&X.length>0){const e=re.current.offsetHeight;se(e)}},[X]);const ae=r.useRef(null);r.useEffect(()=>{const e={title:"操作",key:"action",align:"center",width:k||150,fixed:"right",render:(e,t)=>n.jsx(n.Fragment,{children:n.jsxs(i.Space,{size:"small",ref:ae,children:["function"==typeof h?h(t):h,l.edit&&A.editLimit&&n.jsx("a",{onClick:()=>ue(t),children:a||"编辑"}),(l.view||l.edit)&&A.addLimit&&n.jsx("a",{onClick:()=>he(t),children:c||"查看"}),l.delete&&A.delLimit&&n.jsx("a",{onClick:()=>de(t),style:{color:"#f5222d"},children:u||"删除"})]})})},t=l.edit||l.delete||l.view||h,r=[...s],o=t?[...r,e]:r;J(o)},[]),r.useEffect(()=>{e&&Q(e)},[e]),r.useEffect(()=>{t&&G(t)},[t]);const ce=()=>{W(null),H("add"),z(!0),y&&y()},ue=e=>{W(e),H("edit"),z(!0),y&&y(e)},he=e=>{W(e),H("view"),z(!0)},de=async e=>{l.delete&&i.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{B(!0);if(200===(await S({id:e.id,...null==f?void 0:f.delParams},l.delete)).code){j&&j(e),i.message.success(`${u||"删除"}成功`);const t=U.current,n=U.pageSize,r=U.total-1;r>0&&(t-1)*n>=r&&t>1?(F(e=>({...e,current:e.current-1})),setTimeout(()=>{le()},0)):le()}}catch(t){}finally{B(!1)}}})},fe=window.parent!==window.self,pe={"--table-height":fe?`calc(100vh - ${ie}px - ${E}px + 63px)`:`calc(100vh - ${ie}px - ${E}px)`,height:fe?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:ha,style:pe,children:[X.length>0||!m?n.jsx("div",{className:da,ref:re,children:n.jsx(O,{config:X,onSearch:()=>{F(e=>({...e,current:1})),le()},onReset:()=>{F(e=>({...e,current:1})),le()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:b||(()=>l.add&&A.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(i.Tooltip,{title:N.isdisabled?N.message:"",children:n.jsx(i.Button,{type:"primary",onClick:ce,disabled:N.isdisabled,children:"新建"})})})),ref:oe,onSearchFormChange:(e,t)=>{w&&w(e,t)}})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:fa,style:{height:`calc(100% - ${ie}px-35px)`},children:[n.jsx(We,{page:U,virtual:g,tableId:_,scroll:{x:"1200px",y:"calc(100vh - 300px)"},onRowClick:C&&C,rowClassName:e=>e.id===(null==K?void 0:K.id)?ma:"",columns:Y,dataSource:p||D,loading:M,pagination:!1,onChange:e=>{F(t=>({...t,current:e.current,pageSize:e.pageSize}))},rowKey:"id",...L,...I}),!g&&n.jsx("div",{className:pa,children:n.jsx(i.Pagination,{size:"small",onChange:(e,t)=>{F(n=>({...n,current:e,pageSize:t}))},...U,showQuickJumper:!1})})]}),n.jsx(ua,{validateConfig:T,CustomModalFooter:v,ref:ee,oneditFormChange:x,visible:$,mode:V,config:"view"===V?Z.map(e=>({...e,disabled:!0})):Z,initialValues:K,onOk:async e=>{if(e.alladdress&&(e={...e,...e.alladdress}),"view"!==V){B(!0);try{let t;t="add"==V?await S({...e,...null==f?void 0:f.addParams},l.add):await S({id:null==K?void 0:K.id,...e,...null==f?void 0:f.editParams},l.edit),200==t.code&&(i.message.success(("add"===V?"添加":"更新")+"成功"),z(!1),le())}catch(t){}finally{B(!1)}}else z(!1)},onCancel:()=>z(!1),title:(()=>{switch(V){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:M,tab:q,modalProps:"view"===V?{footer:[n.jsx(i.Button,{onClick:()=>z(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),ba=r.memo(ga);exports.CommonPage=ba,exports.CustomAdd=ua,exports.CustomForm=O,exports.CustomTable=We,exports.NomalSelect=_;
6
+ */const K=$((z||(z=1,V=H,function(){var e={}.hasOwnProperty;function t(){for(var e="",t=0;t<arguments.length;t++){var i=arguments[t];i&&(e=r(e,n(i)))}return e}function n(n){if("string"==typeof n||"number"==typeof n)return n;if("object"!=typeof n)return"";if(Array.isArray(n))return t.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var i="";for(var s in n)e.call(n,s)&&n[s]&&(i=r(i,s));return i}function r(e,t){return t?e?e+" "+t:e+t:e}V.exports?(t.default=t,V.exports=t):window.classNames=t}()),H.exports)),W=Math.round;function Z(e,t){const n=e.replace(/^[^(]*\((.*)/,"$1").replace(/\).*/,"").match(/\d*\.?\d+%?/g)||[],r=n.map(e=>parseFloat(e));for(let i=0;i<3;i+=1)r[i]=t(r[i]||0,n[i]||"",i);return n[3]?r[3]=n[3].includes("%")?r[3]/100:r[3]:r[3]=1,r}const G=(e,t,n)=>0===n?e:e/100;function Y(e,t){const n=t||255;return e>n?n:e<0?0:e}class J{constructor(e){function t(t){return t[0]in e&&t[1]in e&&t[2]in e}if(P(this,"isValid",!0),P(this,"r",0),P(this,"g",0),P(this,"b",0),P(this,"a",1),P(this,"_h",void 0),P(this,"_s",void 0),P(this,"_l",void 0),P(this,"_v",void 0),P(this,"_max",void 0),P(this,"_min",void 0),P(this,"_brightness",void 0),e)if("string"==typeof e){let t=function(e){return n.startsWith(e)};const n=e.trim();/^#?[A-F\d]{3,8}$/i.test(n)?this.fromHexString(n):t("rgb")?this.fromRgbString(n):t("hsl")?this.fromHslString(n):(t("hsv")||t("hsb"))&&this.fromHsvString(n)}else if(e instanceof J)this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this._h=e._h,this._s=e._s,this._l=e._l,this._v=e._v;else if(t("rgb"))this.r=Y(e.r),this.g=Y(e.g),this.b=Y(e.b),this.a="number"==typeof e.a?Y(e.a,1):1;else if(t("hsl"))this.fromHsl(e);else{if(!t("hsv"))throw new Error("@ant-design/fast-color: unsupported input "+JSON.stringify(e));this.fromHsv(e)}else;}setR(e){return this._sc("r",e)}setG(e){return this._sc("g",e)}setB(e){return this._sc("b",e)}setA(e){return this._sc("a",e,1)}setHue(e){const t=this.toHsv();return t.h=e,this._c(t)}getLuminance(){function e(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}return.2126*e(this.r)+.7152*e(this.g)+.0722*e(this.b)}getHue(){if(void 0===this._h){const e=this.getMax()-this.getMin();this._h=0===e?0:W(60*(this.r===this.getMax()?(this.g-this.b)/e+(this.g<this.b?6:0):this.g===this.getMax()?(this.b-this.r)/e+2:(this.r-this.g)/e+4))}return this._h}getSaturation(){if(void 0===this._s){const e=this.getMax()-this.getMin();this._s=0===e?0:e/this.getMax()}return this._s}getLightness(){return void 0===this._l&&(this._l=(this.getMax()+this.getMin())/510),this._l}getValue(){return void 0===this._v&&(this._v=this.getMax()/255),this._v}getBrightness(){return void 0===this._brightness&&(this._brightness=(299*this.r+587*this.g+114*this.b)/1e3),this._brightness}darken(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()-e/100;return r<0&&(r=0),this._c({h:t,s:n,l:r,a:this.a})}lighten(e=10){const t=this.getHue(),n=this.getSaturation();let r=this.getLightness()+e/100;return r>1&&(r=1),this._c({h:t,s:n,l:r,a:this.a})}mix(e,t=50){const n=this._c(e),r=t/100,i=e=>(n[e]-this[e])*r+this[e],s={r:W(i("r")),g:W(i("g")),b:W(i("b")),a:W(100*i("a"))/100};return this._c(s)}tint(e=10){return this.mix({r:255,g:255,b:255,a:1},e)}shade(e=10){return this.mix({r:0,g:0,b:0,a:1},e)}onBackground(e){const t=this._c(e),n=this.a+t.a*(1-this.a),r=e=>W((this[e]*this.a+t[e]*t.a*(1-this.a))/n);return this._c({r:r("r"),g:r("g"),b:r("b"),a:n})}isDark(){return this.getBrightness()<128}isLight(){return this.getBrightness()>=128}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}clone(){return this._c(this)}toHexString(){let e="#";const t=(this.r||0).toString(16);e+=2===t.length?t:"0"+t;const n=(this.g||0).toString(16);e+=2===n.length?n:"0"+n;const r=(this.b||0).toString(16);if(e+=2===r.length?r:"0"+r,"number"==typeof this.a&&this.a>=0&&this.a<1){const t=W(255*this.a).toString(16);e+=2===t.length?t:"0"+t}return e}toHsl(){return{h:this.getHue(),s:this.getSaturation(),l:this.getLightness(),a:this.a}}toHslString(){const e=this.getHue(),t=W(100*this.getSaturation()),n=W(100*this.getLightness());return 1!==this.a?`hsla(${e},${t}%,${n}%,${this.a})`:`hsl(${e},${t}%,${n}%)`}toHsv(){return{h:this.getHue(),s:this.getSaturation(),v:this.getValue(),a:this.a}}toRgb(){return{r:this.r,g:this.g,b:this.b,a:this.a}}toRgbString(){return 1!==this.a?`rgba(${this.r},${this.g},${this.b},${this.a})`:`rgb(${this.r},${this.g},${this.b})`}toString(){return this.toRgbString()}_sc(e,t,n){const r=this.clone();return r[e]=Y(t,n),r}_c(e){return new this.constructor(e)}getMax(){return void 0===this._max&&(this._max=Math.max(this.r,this.g,this.b)),this._max}getMin(){return void 0===this._min&&(this._min=Math.min(this.r,this.g,this.b)),this._min}fromHexString(e){const t=e.replace("#","");function n(e,n){return parseInt(t[e]+t[n||e],16)}t.length<6?(this.r=n(0),this.g=n(1),this.b=n(2),this.a=t[3]?n(3)/255:1):(this.r=n(0,1),this.g=n(2,3),this.b=n(4,5),this.a=t[6]?n(6,7)/255:1)}fromHsl({h:e,s:t,l:n,a:r}){if(this._h=e%360,this._s=t,this._l=n,this.a="number"==typeof r?r:1,t<=0){const e=W(255*n);this.r=e,this.g=e,this.b=e}let i=0,s=0,o=0;const l=e/60,a=(1-Math.abs(2*n-1))*t,c=a*(1-Math.abs(l%2-1));l>=0&&l<1?(i=a,s=c):l>=1&&l<2?(i=c,s=a):l>=2&&l<3?(s=a,o=c):l>=3&&l<4?(s=c,o=a):l>=4&&l<5?(i=c,o=a):l>=5&&l<6&&(i=a,o=c);const u=n-a/2;this.r=W(255*(i+u)),this.g=W(255*(s+u)),this.b=W(255*(o+u))}fromHsv({h:e,s:t,v:n,a:r}){this._h=e%360,this._s=t,this._v=n,this.a="number"==typeof r?r:1;const i=W(255*n);if(this.r=i,this.g=i,this.b=i,t<=0)return;const s=e/60,o=Math.floor(s),l=s-o,a=W(n*(1-t)*255),c=W(n*(1-t*l)*255),u=W(n*(1-t*(1-l))*255);switch(o){case 0:this.g=u,this.b=a;break;case 1:this.r=c,this.b=a;break;case 2:this.r=a,this.b=u;break;case 3:this.r=a,this.g=c;break;case 4:this.r=u,this.g=a;break;default:this.g=a,this.b=c}}fromHsvString(e){const t=Z(e,G);this.fromHsv({h:t[0],s:t[1],v:t[2],a:t[3]})}fromHslString(e){const t=Z(e,G);this.fromHsl({h:t[0],s:t[1],l:t[2],a:t[3]})}fromRgbString(e){const t=Z(e,(e,t)=>t.includes("%")?W(e/100*255):e);this.r=t[0],this.g=t[1],this.b=t[2],this.a=t[3]}}var X=[{index:7,amount:15},{index:6,amount:25},{index:5,amount:30},{index:5,amount:45},{index:5,amount:65},{index:5,amount:85},{index:4,amount:90},{index:3,amount:95},{index:2,amount:97},{index:1,amount:98}];function Q(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-2*t:Math.round(e.h)+2*t:n?Math.round(e.h)+2*t:Math.round(e.h)-2*t)<0?r+=360:r>=360&&(r-=360),r}function ee(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-.16*t:4===t?e.s+.16:e.s+.05*t)>1&&(r=1),n&&5===t&&r>.1&&(r=.1),r<.06&&(r=.06),Math.round(100*r)/100);var r}function te(e,t,n){var r;return r=n?e.v+.05*t:e.v-.15*t,r=Math.max(0,Math.min(1,r)),Math.round(100*r)/100}var ne=["#e6f4ff","#bae0ff","#91caff","#69b1ff","#4096ff","#1677ff","#0958d9","#003eb3","#002c8c","#001d66"];function re(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ie(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?re(Object(n),!0).forEach(function(t){P(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):re(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}ne.primary=ne[5];var se="data-rc-order",oe="data-rc-priority",le=new Map;function ae(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).mark;return e?e.startsWith("data-")?e:"data-".concat(e):"rc-util-key"}function ce(e){return e.attachTo?e.attachTo:document.querySelector("head")||document.body}function ue(e){return Array.from((le.get(e)||e).children).filter(function(e){return"STYLE"===e.tagName})}function he(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("undefined"==typeof window||!window.document||!window.document.createElement)return null;var n=t.csp,r=t.prepend,i=t.priority,s=void 0===i?0:i,o=function(e){return"queue"===e?"prependQueue":e?"prepend":"append"}(r),l="prependQueue"===o,a=document.createElement("style");a.setAttribute(se,o),l&&s&&a.setAttribute(oe,"".concat(s)),null!=n&&n.nonce&&(a.nonce=null==n?void 0:n.nonce),a.innerHTML=e;var c=ce(t),u=c.firstChild;if(r){if(l){var h=(t.styles||ue(c)).filter(function(e){if(!["prepend","prependQueue"].includes(e.getAttribute(se)))return!1;var t=Number(e.getAttribute(oe)||0);return s>=t});if(h.length)return c.insertBefore(a,h[h.length-1].nextSibling),a}c.insertBefore(a,u)}else c.appendChild(a);return a}function de(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=ce(n),i=ue(r),s=ie(ie({},n),{},{styles:i});!function(e,t){var n=le.get(e);if(!n||!function(e,t){if(!e)return!1;if(e.contains)return e.contains(t);for(var n=t;n;){if(n===e)return!0;n=n.parentNode}return!1}(document,n)){var r=he("",t),i=r.parentNode;le.set(e,i),e.removeChild(r)}}(r,s);var o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ce(t);return(t.styles||ue(n)).find(function(n){return n.getAttribute(ae(t))===e})}(t,s);if(o){var l,a,c;if(null!==(l=s.csp)&&void 0!==l&&l.nonce&&o.nonce!==(null===(a=s.csp)||void 0===a?void 0:a.nonce))o.nonce=null===(c=s.csp)||void 0===c?void 0:c.nonce;return o.innerHTML!==e&&(o.innerHTML=e),o}var u=he(e,s);return u.setAttribute(ae(s),t),u}function fe(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}function pe(e){return function(e){return fe(e)instanceof ShadowRoot}(e)?fe(e):null}var me={},ge=[];function be(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)ge.reduce(function(e,t){return t(null!=e?e:"","warning")},t)}function ve(e,t){if("production"!==process.env.NODE_ENV&&!e&&void 0!==console)ge.reduce(function(e,t){return t(null!=e?e:"","note")},t)}function ye(e,t,n){t||me[n]||(e(!1,n),me[n]=!0)}function xe(e,t){ye(be,e,t)}function we(e){return"object"===B(e)&&"string"==typeof e.name&&"string"==typeof e.theme&&("object"===B(e.icon)||"function"==typeof e.icon)}function Ne(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.keys(e).reduce(function(t,n){var r,i=e[n];if("class"===n)t.className=i,delete t.class;else delete t[n],t[(r=n,r.replace(/-(.)/g,function(e,t){return t.toUpperCase()}))]=i;return t},{})}function Ee(e,t,n){return n?r.createElement(e.tag,ie(ie({key:t},Ne(e.attrs)),n),(e.children||[]).map(function(n,r){return Ee(n,"".concat(t,"-").concat(e.tag,"-").concat(r))})):r.createElement(e.tag,ie({key:t},Ne(e.attrs)),(e.children||[]).map(function(n,r){return Ee(n,"".concat(t,"-").concat(e.tag,"-").concat(r))}))}function ke(e){return function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=new J(e),i=r.toHsv(),s=5;s>0;s-=1){var o=new J({h:Q(i,s,!0),s:ee(i,s,!0),v:te(i,s,!0)});n.push(o)}n.push(r);for(var l=1;l<=4;l+=1){var a=new J({h:Q(i,l),s:ee(i,l),v:te(i,l)});n.push(a)}return"dark"===t.theme?X.map(function(e){var r=e.index,i=e.amount;return new J(t.backgroundColor||"#141414").mix(n[r],i).toHexString()}):n.map(function(e){return e.toHexString()})}(e)[0]}function Ae(e){return e?Array.isArray(e)?e:[e]:[]}xe.preMessage=function(e){ge.push(e)},xe.resetWarned=function(){me={}},xe.noteOnce=function(e,t){ye(ve,e,t)};var Se=["icon","className","onClick","style","primaryColor","secondaryColor"],Ce={primaryColor:"#333",secondaryColor:"#E6E6E6",calculated:!1};var je=function(e){var t,n,i,s,o,l,a,c,h=e.icon,d=e.className,f=e.onClick,p=e.style,m=e.primaryColor,g=e.secondaryColor,b=F(e,Se),v=u.useRef(),y=Ce;if(m&&(y={primaryColor:m,secondaryColor:g||ke(m)}),t=v,n=r.useContext(L),i=n.csp,s=n.prefixCls,o=n.layer,l="\n.anticon {\n display: inline-flex;\n align-items: center;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n",s&&(l=l.replace(/anticon/g,s)),o&&(l="@layer ".concat(o," {\n").concat(l,"\n}")),r.useEffect(function(){var e=pe(t.current);de(l,"@ant-design-icons",{prepend:!o,csp:i,attachTo:e})},[]),a=we(h),c="icon should be icon definiton, but got ".concat(h),xe(a,"[@ant-design/icons] ".concat(c)),!we(h))return null;var x=h;return x&&"function"==typeof x.icon&&(x=ie(ie({},x),{},{icon:x.icon(y.primaryColor,y.secondaryColor)})),Ee(x.icon,"svg-".concat(x.name),ie(ie({className:d,onClick:f,style:p,"data-icon":x.name,width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true"},b),{},{ref:v}))};function qe(e){var t=M(Ae(e),2),n=t[0],r=t[1];return je.setTwoToneColors({primaryColor:n,secondaryColor:r})}je.displayName="IconReact",je.getTwoToneColors=function(){return ie({},Ce)},je.setTwoToneColors=function(e){var t=e.primaryColor,n=e.secondaryColor;Ce.primaryColor=t,Ce.secondaryColor=n||ke(t),Ce.calculated=!!n};var _e=["className","icon","spin","rotate","tabIndex","onClick","twoToneColor"];qe(ne.primary);var Oe=u.forwardRef(function(e,t){var n=e.className,r=e.icon,i=e.spin,s=e.rotate,o=e.tabIndex,l=e.onClick,a=e.twoToneColor,c=F(e,_e),h=u.useContext(L),d=h.prefixCls,f=void 0===d?"anticon":d,p=h.rootClassName,m=K(p,f,P(P({},"".concat(f,"-").concat(r.name),!!r.name),"".concat(f,"-spin"),!!i||"loading"===r.name),n),g=o;void 0===g&&l&&(g=-1);var b=s?{msTransform:"rotate(".concat(s,"deg)"),transform:"rotate(".concat(s,"deg)")}:void 0,v=M(Ae(a),2),y=v[0],x=v[1];return u.createElement("span",I({role:"img","aria-label":r.name},c,{ref:t,tabIndex:g,onClick:l,className:m}),u.createElement(je,{icon:r,primaryColor:y,secondaryColor:x,style:b}))});Oe.displayName="AntdIcon",Oe.getTwoToneColor=function(){var e=je.getTwoToneColors();return e.calculated?[e.primaryColor,e.secondaryColor]:e.primaryColor},Oe.setTwoToneColor=qe;var Te={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"}}]},name:"down",theme:"outlined"},Le=function(e,t){return u.createElement(Oe,I({},e,{ref:t,icon:Te}))},Ie=u.forwardRef(Le);"production"!==process.env.NODE_ENV&&(Ie.displayName="DownOutlined");var Re={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8z"}},{tag:"path",attrs:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8z"}}]},name:"plus",theme:"outlined"},Me=function(e,t){return u.createElement(Oe,I({},e,{ref:t,icon:Re}))},Be=u.forwardRef(Me);"production"!==process.env.NODE_ENV&&(Be.displayName="PlusOutlined");var De={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"}}]},name:"right",theme:"outlined"},Pe=function(e,t){return u.createElement(Oe,I({},e,{ref:t,icon:De}))},Fe=u.forwardRef(Pe);"production"!==process.env.NODE_ENV&&(Fe.displayName="RightOutlined");var Ue={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"}}]},name:"setting",theme:"outlined"},$e=function(e,t){return u.createElement(Oe,I({},e,{ref:t,icon:Ue}))},ze=u.forwardRef($e);"production"!==process.env.NODE_ENV&&(ze.displayName="SettingOutlined");var Ve={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M400 317.7h73.9V656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V317.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 163a8 8 0 00-12.6 0l-112 141.7c-4.1 5.3-.4 13 6.3 13zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"upload",theme:"outlined"},He=function(e,t){return u.createElement(Oe,I({},e,{ref:t,icon:Ve}))},Ke=u.forwardRef(He);"production"!==process.env.NODE_ENV&&(Ke.displayName="UploadOutlined");const{Option:We}=i.Select,Ze=({columns:e,dataSource:t,pagination:s,tableId:l,size:a="middle",onRowClick:c,page:u,showTableConfig:h=!0,...d})=>{const[p,m]=r.useState([]),[g,b]=r.useState([]),[v,y]=r.useState(!1),[x,w]=r.useState([]),[N,E]=r.useState([]),[k,A]=r.useState([]),[C]=i.Form.useForm(),[j,q]=r.useState([]),_=f.getUserInfo(),O=r.useRef(void 0),T=r.useRef(void 0),L=r.useMemo(()=>(null==e?void 0:e.map(e=>e.dataIndex||e.key).join(","))||"",[e]),I=r.useCallback(async()=>{var t,n,r;const i=(null==e?void 0:e.map((e,t)=>({key:e.key||e.dataIndex||`col-${t}`,title:e.title,dataIndex:e.dataIndex,displayTitle:"string"==typeof e.title?e.title:`列 ${t+1}`,headerAlignment:e.align||"left",contentAlignment:e.align||"left",dataFormat:"字符串",width:e.width||100,enabled:!0,calculateTotal:!1,isBuiltIn:!1,allowSorting:!1,sort:t+1,render:e.render,fixed:e.fixed,originalColumn:{...e}})))||[];if(E(i),e.length>1)try{if(l){const o=await(s={userId:_.userId,tableId:l||""},S("/platform/business/common/getTableConfigByUser",s));if(null==(t=null==o?void 0:o.data)?void 0:t.content){const t=null==(r=JSON.parse(null==(n=null==o?void 0:o.data)?void 0:n.content))?void 0:r.map(t=>{var n;const r=null==(n=e.find(e=>e.key===t.key))?void 0:n.render;return{...t,render:r,originalColumn:{...t.originalColumn,render:r}}});w(t),A(t)}else w(i),A(i)}else w(i),A(i)}catch(o){w(i),A(i)}else w(i),A(i);var s},[e,l,_.userId]),R=r.useMemo(()=>o.debounce(I,100),[I]);r.useEffect(()=>{(O.current!==l||T.current!==L)&&(O.current=l,T.current=L,R())},[l,L,R]),r.useEffect(()=>{const e=x.filter(e=>e.enabled).sort((e,t)=>e.sort-t.sort).map(e=>({...e.originalColumn,key:e.key,title:e.displayTitle,dataIndex:e.dataIndex,align:e.contentAlignment,width:Number(e.width)})),t=[...h?[{title:n.jsxs(i.Space,{size:"small",children:[n.jsx("span",{children:"序号"}),n.jsx(i.Tooltip,{title:"表格配置",children:n.jsx(ze,{onClick:()=>y(!0),style:{cursor:"pointer"}})})]}),dataIndex:"INDEX",key:"INDEX",width:80,align:"center",isBuiltIn:!0,fixed:"left",render:(e,t,r)=>n.jsx(n.Fragment,{children:n.jsx(n.Fragment,{children:e||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+r+1||r+1})})}]:[],...e].map(e=>{const t=e.render;return{...e,render:(s,o,l)=>t?t(s,o,l):"object"!=typeof s||""===s||r.isValidElement(s)?n.jsx(i.Tooltip,{title:String(s),children:n.jsx("div",{style:{display:"block",width:e.width,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s?String(s):""})}):""}});m(t)},[x,h,u]),r.useEffect(()=>{const e=null==t?void 0:t.map((e,t)=>({...e,parentId:(null==e?void 0:e.parentId)||null,id:(null==e?void 0:e.id)||t+1,INDEX:(null==e?void 0:e.INDEX)||((null==u?void 0:u.current)-1)*(null==u?void 0:u.pageSize)+t+1||t+1}));q(null==e?void 0:e.map(e=>e.id)),b(e)},[t]);const M=r.useRef(null),B=[{title:"显示名称",dataIndex:"displayTitle",key:"displayTitle",render:(e,t)=>n.jsx(i.Input,{size:"small",defaultValue:e,onBlur:e=>D(t.key,"displayTitle",e.target.value)})},{title:"表头对齐",dataIndex:"headerAlignment",key:"headerAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>D(t.key,"headerAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"内容对齐",dataIndex:"contentAlignment",key:"contentAlignment",align:"center",render:(e,t)=>n.jsxs(i.Radio.Group,{size:"small",defaultValue:e,onChange:e=>D(t.key,"contentAlignment",e.target.value),children:[n.jsx(i.Radio.Button,{value:"left",children:"左"}),n.jsx(i.Radio.Button,{value:"center",children:"中"}),n.jsx(i.Radio.Button,{value:"right",children:"右"})]})},{title:"数据格式",dataIndex:"dataFormat",key:"dataFormat",render:(e,t)=>n.jsxs(i.Select,{size:"small",defaultValue:e,style:{width:80},onChange:e=>D(t.key,"dataFormat",e),children:[n.jsx(We,{value:"字符串",children:"字符串"}),n.jsx(We,{value:"数字",children:"数字"}),n.jsx(We,{value:"日期",children:"日期"})]})},{title:"宽度",dataIndex:"width",key:"width",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>D(t.key,"width",e.target.value)})},{title:"是否启用",dataIndex:"enabled",key:"enabled",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>D(t.key,"enabled",e)})},{title:"允许排序",dataIndex:"allowSorting",key:"allowSorting",align:"center",render:(e,t)=>n.jsx(i.Switch,{size:"small",defaultValue:e,onChange:e=>D(t.key,"allowSorting",e)})},{title:"排序",dataIndex:"sort",key:"sort",render:(e,t)=>n.jsx(i.InputNumber,{size:"small",defaultValue:e,style:{width:60},onBlur:e=>D(t.key,"sort",e.target.value)})}],D=(e,t,n)=>{A(r=>r.map(r=>r.key===e?{...r,[t]:n}:r))},P=async()=>{try{const t=await(e={tableId:l||"",userId:null==_?void 0:_.userId,content:JSON.stringify(k)},S("/platform/business/common/saveUserTableConfig",e));w(k),200===(null==t?void 0:t.code)&&(i.message.success("保存成功"),R())}catch(t){}var e},F=()=>{y(!1)},U=(e,t=!1)=>{q(t?j.filter(t=>t!==(null==e?void 0:e.id)):[...j,null==e?void 0:e.id])};return n.jsxs(n.Fragment,{children:[n.jsx(i.Table,{columns:p,dataSource:g,bordered:!0,rowKey:"id",pagination:s,size:"small",onRow:e=>({onClick:t=>{c&&c(e,t)}}),expandable:{expandedRowKeys:j,expandIcon:({expanded:e,onExpand:t,record:r})=>{var i;if((null==(i=null==r?void 0:r.children)?void 0:i.length)>0){const i={fontSize:"14px",color:"rgba(0, 0, 0, 0.45)",cursor:"pointer",position:"absolute",left:"18px",top:"10px"};return e?n.jsx(Ie,{onClick:e=>{t(r,e),U(r,!0)},style:i}):n.jsx(Fe,{onClick:e=>{t(r,e),U(r,!1)},style:i})}return null}},...d}),n.jsx(i.Modal,{title:"表格设置",visible:v,footer:[n.jsx(i.Button,{onClick:async()=>{var e;200===(await(e={userId:_.userId,tableId:l||""},S("/platform/business/common/restoreDefaultTableConfig",e))).code&&(w(N),A(N),y(!1),i.message.success("重置成功"))},children:"重置"},"reset"),n.jsx(i.Button,{onClick:F,children:"取消"},"cancel"),n.jsx(i.Button,{type:"primary",onClick:()=>{y(!1),P()},children:"保存"},"submit")],onCancel:F,width:1e3,destroyOnClose:!0,maskClosable:!1,children:n.jsx(i.Spin,{spinning:!1,children:n.jsx(i.Form,{form:C,component:!1,children:n.jsx(i.Table,{ref:M,columns:B,dataSource:k.filter(e=>!e.isBuiltIn),rowKey:"key",size:"small",pagination:!1,bordered:!0})})})})]})},Ge=({label:e,id:t,value:s,onChange:o,disabled:l=!1})=>{const[a,c]=r.useState([]),[u,h]=r.useState(void 0),[d,f]=r.useState(!1),[p,m]=r.useState(void 0),[g,b]=r.useState(void 0),[v,y]=r.useState(void 0),[x,w]=r.useState(void 0),[N,E]=r.useState([]),[k,A]=r.useState(void 0),[S,j]=r.useState(!1),[q,_]=r.useState([]),[O,T]=r.useState(void 0),[L,I]=r.useState(!1),[R,M]=r.useState([]),[B,D]=r.useState(void 0),[P,F]=r.useState(!1),[U,$]=r.useState(""),[z,V]=r.useState({}),H=r.useRef(!1),K=r.useRef(!1),W=r.useCallback(e=>{o&&o(e)},[o]),Z=r.useCallback(async(e,t)=>{switch(e){case 1:f(!0);break;case 2:j(!0);break;case 3:I(!0);break;case 4:F(!0)}try{const n=await C({level:e,parent:t.toString()},"/platform/business/common/getAreaByLevel");return 200===n.code&&Array.isArray(n.data)?n.data.map(e=>({value:e.code,label:e.name})):[]}catch(n){return[]}finally{switch(e){case 1:f(!1);break;case 2:j(!1);break;case 3:I(!1);break;case 4:F(!1)}}},[]);r.useEffect(()=>{Z(1,"0").then(e=>{c(e)})},[Z]),r.useEffect(()=>{s&&!H.current&&(H.current=!0,V(s),h(s.addProvinceCode),m(s.addProvince),s.addProvinceCode&&Z(2,s.addProvinceCode).then(e=>{E(e),A(s.addCityCode),b(s.addCity),s.addCityCode&&Z(3,s.addCityCode).then(e=>{_(e),T(s.addCountyCode),y(s.addCounty),s.addCountyCode&&Z(4,s.addCountyCode).then(e=>{M(e),D(s.addStreetCode),w(s.addStreet),$(s.address||"")})})}))},[s,Z]),r.useEffect(()=>{u?Z(2,u).then(e=>{E(e)}):(b(void 0),y(void 0),w(void 0),m(void 0),$(""),A(void 0),E([]),T(void 0),_([]),D(void 0),M([]))},[u,Z]),r.useEffect(()=>{k?Z(3,k).then(e=>{_(e)}):(T(void 0),_([]),D(void 0),M([]),$(""))},[k,Z]),r.useEffect(()=>{O?Z(4,O).then(e=>{M(e)}):(D(void 0),M([]),$(""))},[O,Z]),r.useEffect(()=>{H.current&&(K.current=!0,W({addProvince:p,addProvinceCode:u,addCity:g,addCityCode:k,addCounty:v,addCountyCode:O,addStreet:x,addStreetCode:B,address:U}),setTimeout(()=>{K.current=!1},0))},[p,g,v,u,k,O,B,x,U,W]);return n.jsxs("div",{children:[" ",n.jsxs(i.Space,{wrap:!0,id:t,children:[" ",n.jsx(i.Select,{style:{minWidth:100},options:a,value:u,onChange:e=>{var t;e===u&&void 0!==e||(h(e),m(null==(t=a.find(t=>t.value===e))?void 0:t.label),A(void 0),b(void 0),E([]),T(void 0),y(void 0),_([]),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择省",loading:d,disabled:l,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:N,value:k,onChange:e=>{var t;e===k&&void 0!==e||(A(e),b(null==(t=N.find(t=>t.value===e))?void 0:t.label),T(void 0),y(void 0),_([]),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择市",loading:S,disabled:l||!u||d,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:q,value:O,onChange:e=>{var t;e===O&&void 0!==e||(T(e),y(null==(t=q.find(t=>t.value===e))?void 0:t.label),D(void 0),w(void 0),M([]),$(""))},placeholder:"请选择区/县",loading:L,disabled:l||!k||S,allowClear:!0}),n.jsx(i.Select,{style:{minWidth:100},options:R,value:B,onChange:e=>{var t;e===B&&void 0!==e||(D(e),w(null==(t=R.find(t=>t.value===e))?void 0:t.label),$(""))},placeholder:"请选择乡/镇",loading:P,disabled:l||!O||L,allowClear:!0}),n.jsx(i.Input,{placeholder:"请输入详细地址",disabled:l||!O,value:U,onChange:e=>$(e.target.value)})]})]})},Ye=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,key:a,disabled:c=!1})=>{const[u,h]=r.useState(!1),[d,f]=r.useState(""),[p,m]=r.useState(""),[g,b]=r.useState([]);r.useEffect(()=>{b(e?[{uid:"-1",name:"image.png",status:"done",url:e}]:[])},[e]);const v=r.useCallback(e=>{t&&t(e)},[t]),y=n.jsxs("div",{children:[n.jsx(Be,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:g,onPreview:async e=>{e.url||e.preview||e.originFileObj&&(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),f(e.url||e.preview),h(!0),m(e.name||e.url.substring(e.url.lastIndexOf("/")+1))},onChange:({file:e,fileList:t})=>{var n,r;if(b(t),"done"===e.status){const r=null==(n=e.response)?void 0:n.data;r?(i.message.success(`${e.name} 文件上传成功`),null==v||v(r)):(i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),b(t.filter(t=>t.uid!==e.uid)))}else"removed"===e.status?(i.message.success(`${e.name} 文件已移除`),null==v||v(void 0)):"error"===e.status&&(i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),null==v||v(void 0))},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e;if(r instanceof File&&r.size>8388608)return i.message.error("文件大小不能超过 8MB"),void(null==n||n(new Error("文件大小不能超过 8MB")));const o=new FormData;o.append("file",r);try{const e=await(l=o,a={headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&s({percent:e.loaded/e.total*100})}},S("/platform/general/upload",l,a));e&&e.data?(null==v||v(e.data),t(e,r)):n(new Error("上传成功但响应中缺少图片URL"),e)}catch(c){n(c)}var l,a},maxCount:l,disabled:c,onRemove:e=>!0,children:g.length>=(l||1)?null:y},a),n.jsx(i.Modal,{visible:u,title:p,footer:null,onCancel:()=>h(!1),children:n.jsx("img",{alt:"example",style:{width:"100%"},src:d})})]})};var Je="object"==typeof global&&global&&global.Object===Object&&global,Xe="object"==typeof self&&self&&self.Object===Object&&self,Qe=Je||Xe||Function("return this")(),et=Qe.Symbol,tt=Object.prototype,nt=tt.hasOwnProperty,rt=tt.toString,it=et?et.toStringTag:void 0;var st=Object.prototype.toString;var ot=et?et.toStringTag:void 0;function lt(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ot&&ot in Object(e)?function(e){var t=nt.call(e,it),n=e[it];try{e[it]=void 0;var r=!0}catch(s){}var i=rt.call(e);return r&&(t?e[it]=n:delete e[it]),i}(e):function(e){return st.call(e)}(e)}function at(e){return null!=e&&"object"==typeof e}var ct=Array.isArray;function ut(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ht(e){return e}function dt(e){if(!ut(e))return!1;var t=lt(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var ft,pt=Qe["__core-js_shared__"],mt=(ft=/[^.]+$/.exec(pt&&pt.keys&&pt.keys.IE_PROTO||""))?"Symbol(src)_1."+ft:"";var gt=Function.prototype.toString;function bt(e){if(null!=e){try{return gt.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var vt=/^\[object .+?Constructor\]$/,yt=Function.prototype,xt=Object.prototype,wt=yt.toString,Nt=xt.hasOwnProperty,Et=RegExp("^"+wt.call(Nt).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kt(e){return!(!ut(e)||(t=e,mt&&mt in t))&&(dt(e)?Et:vt).test(bt(e));var t}function At(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return kt(n)?n:void 0}var St=At(Qe,"WeakMap"),Ct=Object.create,jt=function(){function e(){}return function(t){if(!ut(t))return{};if(Ct)return Ct(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();var qt=Date.now;var _t,Ot,Tt,Lt=function(){try{var e=At(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),It=Lt?function(e,t){return Lt(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:ht,Rt=(_t=It,Ot=0,Tt=0,function(){var e=qt(),t=16-(e-Tt);if(Tt=e,t>0){if(++Ot>=800)return arguments[0]}else Ot=0;return _t.apply(void 0,arguments)});var Mt=/^(?:0|[1-9]\d*)$/;function Bt(e,t){var n=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==n||"symbol"!=n&&Mt.test(e))&&e>-1&&e%1==0&&e<t}function Dt(e,t,n){"__proto__"==t&&Lt?Lt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Pt(e,t){return e===t||e!=e&&t!=t}var Ft=Object.prototype.hasOwnProperty;function Ut(e,t,n){var r=e[t];Ft.call(e,t)&&Pt(r,n)&&(void 0!==n||t in e)||Dt(e,t,n)}var $t=Math.max;function zt(e,t){return Rt(function(e,t,n){return t=$t(void 0===t?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=$t(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var l=Array(t+1);++i<t;)l[i]=r[i];return l[t]=n(o),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,l)}}(e,t,ht),e+"")}function Vt(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ht(e){return null!=e&&Vt(e.length)&&!dt(e)}var Kt=Object.prototype;function Wt(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Kt)}function Zt(e){return at(e)&&"[object Arguments]"==lt(e)}var Gt=Object.prototype,Yt=Gt.hasOwnProperty,Jt=Gt.propertyIsEnumerable,Xt=Zt(function(){return arguments}())?Zt:function(e){return at(e)&&Yt.call(e,"callee")&&!Jt.call(e,"callee")};var Qt="object"==typeof exports&&exports&&!exports.nodeType&&exports,en=Qt&&"object"==typeof module&&module&&!module.nodeType&&module,tn=en&&en.exports===Qt?Qe.Buffer:void 0,nn=(tn?tn.isBuffer:void 0)||function(){return!1},rn={};function sn(e){return function(t){return e(t)}}rn["[object Float32Array]"]=rn["[object Float64Array]"]=rn["[object Int8Array]"]=rn["[object Int16Array]"]=rn["[object Int32Array]"]=rn["[object Uint8Array]"]=rn["[object Uint8ClampedArray]"]=rn["[object Uint16Array]"]=rn["[object Uint32Array]"]=!0,rn["[object Arguments]"]=rn["[object Array]"]=rn["[object ArrayBuffer]"]=rn["[object Boolean]"]=rn["[object DataView]"]=rn["[object Date]"]=rn["[object Error]"]=rn["[object Function]"]=rn["[object Map]"]=rn["[object Number]"]=rn["[object Object]"]=rn["[object RegExp]"]=rn["[object Set]"]=rn["[object String]"]=rn["[object WeakMap]"]=!1;var on="object"==typeof exports&&exports&&!exports.nodeType&&exports,ln=on&&"object"==typeof module&&module&&!module.nodeType&&module,an=ln&&ln.exports===on&&Je.process,cn=function(){try{var e=ln&&ln.require&&ln.require("util").types;return e||an&&an.binding&&an.binding("util")}catch(t){}}(),un=cn&&cn.isTypedArray,hn=un?sn(un):function(e){return at(e)&&Vt(e.length)&&!!rn[lt(e)]},dn=Object.prototype.hasOwnProperty;function fn(e,t){var n=ct(e),r=!n&&Xt(e),i=!n&&!r&&nn(e),s=!n&&!r&&!i&&hn(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!t&&!dn.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Bt(c,a))||l.push(c);return l}function pn(e,t){return function(n){return e(t(n))}}var mn=pn(Object.keys,Object),gn=Object.prototype.hasOwnProperty;function bn(e){return Ht(e)?fn(e):function(e){if(!Wt(e))return mn(e);var t=[];for(var n in Object(e))gn.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var vn=Object.prototype.hasOwnProperty;function yn(e){if(!ut(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Wt(e),n=[];for(var r in e)("constructor"!=r||!t&&vn.call(e,r))&&n.push(r);return n}function xn(e){return Ht(e)?fn(e,!0):yn(e)}var wn=At(Object,"create");var Nn=Object.prototype.hasOwnProperty;var En=Object.prototype.hasOwnProperty;function kn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function An(e,t){for(var n=e.length;n--;)if(Pt(e[n][0],t))return n;return-1}kn.prototype.clear=function(){this.__data__=wn?wn(null):{},this.size=0},kn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},kn.prototype.get=function(e){var t=this.__data__;if(wn){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Nn.call(t,e)?t[e]:void 0},kn.prototype.has=function(e){var t=this.__data__;return wn?void 0!==t[e]:En.call(t,e)},kn.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=wn&&void 0===t?"__lodash_hash_undefined__":t,this};var Sn=Array.prototype.splice;function Cn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Cn.prototype.clear=function(){this.__data__=[],this.size=0},Cn.prototype.delete=function(e){var t=this.__data__,n=An(t,e);return!(n<0)&&(n==t.length-1?t.pop():Sn.call(t,n,1),--this.size,!0)},Cn.prototype.get=function(e){var t=this.__data__,n=An(t,e);return n<0?void 0:t[n][1]},Cn.prototype.has=function(e){return An(this.__data__,e)>-1},Cn.prototype.set=function(e,t){var n=this.__data__,r=An(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var jn=At(Qe,"Map");function qn(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function _n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}_n.prototype.clear=function(){this.size=0,this.__data__={hash:new kn,map:new(jn||Cn),string:new kn}},_n.prototype.delete=function(e){var t=qn(this,e).delete(e);return this.size-=t?1:0,t},_n.prototype.get=function(e){return qn(this,e).get(e)},_n.prototype.has=function(e){return qn(this,e).has(e)},_n.prototype.set=function(e,t){var n=qn(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this};var On=pn(Object.getPrototypeOf,Object),Tn=Function.prototype,Ln=Object.prototype,In=Tn.toString,Rn=Ln.hasOwnProperty,Mn=In.call(Object);function Bn(e){var t=this.__data__=new Cn(e);this.size=t.size}Bn.prototype.clear=function(){this.__data__=new Cn,this.size=0},Bn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Bn.prototype.get=function(e){return this.__data__.get(e)},Bn.prototype.has=function(e){return this.__data__.has(e)},Bn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Cn){var r=n.__data__;if(!jn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new _n(r)}return n.set(e,t),this.size=n.size,this};var Dn="object"==typeof exports&&exports&&!exports.nodeType&&exports,Pn=Dn&&"object"==typeof module&&module&&!module.nodeType&&module,Fn=Pn&&Pn.exports===Dn?Qe.Buffer:void 0,Un=Fn?Fn.allocUnsafe:void 0;function $n(e,t){if(t)return e.slice();var n=e.length,r=Un?Un(n):new e.constructor(n);return e.copy(r),r}var zn=Object.prototype.propertyIsEnumerable,Vn=Object.getOwnPropertySymbols,Hn=Vn?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(Vn(e),function(t){return zn.call(e,t)}))}:function(){return[]};function Kn(e){return function(e,t,n){var r=t(e);return ct(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,bn,Hn)}var Wn=At(Qe,"DataView"),Zn=At(Qe,"Promise"),Gn=At(Qe,"Set"),Yn="[object Map]",Jn="[object Promise]",Xn="[object Set]",Qn="[object WeakMap]",er="[object DataView]",tr=bt(Wn),nr=bt(jn),rr=bt(Zn),ir=bt(Gn),sr=bt(St),or=lt;(Wn&&or(new Wn(new ArrayBuffer(1)))!=er||jn&&or(new jn)!=Yn||Zn&&or(Zn.resolve())!=Jn||Gn&&or(new Gn)!=Xn||St&&or(new St)!=Qn)&&(or=function(e){var t=lt(e),n="[object Object]"==t?e.constructor:void 0,r=n?bt(n):"";if(r)switch(r){case tr:return er;case nr:return Yn;case rr:return Jn;case ir:return Xn;case sr:return Qn}return t});var lr=Object.prototype.hasOwnProperty;var ar=Qe.Uint8Array;function cr(e){var t=new e.constructor(e.byteLength);return new ar(t).set(new ar(e)),t}var ur=/\w*$/;var hr=et?et.prototype:void 0,dr=hr?hr.valueOf:void 0;function fr(e,t){var n=t?cr(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function pr(e,t,n){var r,i,s,o,l,a=e.constructor;switch(t){case"[object ArrayBuffer]":return cr(e);case"[object Boolean]":case"[object Date]":return new a(+e);case"[object DataView]":return l=cr((o=e).buffer),new o.constructor(l,o.byteOffset,o.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return fr(e,n);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(e);case"[object RegExp]":return(s=new(i=e).constructor(i.source,ur.exec(i))).lastIndex=i.lastIndex,s;case"[object Symbol]":return r=e,dr?Object(dr.call(r)):{}}}function mr(e){return"function"!=typeof e.constructor||Wt(e)?{}:jt(On(e))}var gr=cn&&cn.isMap,br=gr?sn(gr):function(e){return at(e)&&"[object Map]"==or(e)};var vr=cn&&cn.isSet,yr=vr?sn(vr):function(e){return at(e)&&"[object Set]"==or(e)},xr="[object Arguments]",wr="[object Function]",Nr="[object Object]",Er={};function kr(e,t,n,r,i,s){var o,l=1&t;if(void 0!==o)return o;if(!ut(e))return e;var a=ct(e);if(a)o=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&lr.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e);else{var c=or(e),u=c==wr||"[object GeneratorFunction]"==c;if(nn(e))return $n(e,l);if(c==Nr||c==xr||u&&!i)o=u?{}:mr(e);else{if(!Er[c])return i?e:{};o=pr(e,c,l)}}s||(s=new Bn);var h=s.get(e);if(h)return h;s.set(e,o),yr(e)?e.forEach(function(r){o.add(kr(r,t,n,r,e,s))}):br(e)&&e.forEach(function(r,i){o.set(i,kr(r,t,n,i,e,s))});var d=a?void 0:Kn(e);return function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););}(d||e,function(r,i){d&&(r=e[i=r]),Ut(o,i,kr(r,t,n,i,e,s))}),o}Er[xr]=Er["[object Array]"]=Er["[object ArrayBuffer]"]=Er["[object DataView]"]=Er["[object Boolean]"]=Er["[object Date]"]=Er["[object Float32Array]"]=Er["[object Float64Array]"]=Er["[object Int8Array]"]=Er["[object Int16Array]"]=Er["[object Int32Array]"]=Er["[object Map]"]=Er["[object Number]"]=Er[Nr]=Er["[object RegExp]"]=Er["[object Set]"]=Er["[object String]"]=Er["[object Symbol]"]=Er["[object Uint8Array]"]=Er["[object Uint8ClampedArray]"]=Er["[object Uint16Array]"]=Er["[object Uint32Array]"]=!0,Er["[object Error]"]=Er[wr]=Er["[object WeakMap]"]=!1;function Ar(e){return kr(e,5)}function Sr(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new _n;++t<n;)this.add(e[t])}function Cr(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}Sr.prototype.add=Sr.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Sr.prototype.has=function(e){return this.__data__.has(e)};function jr(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e),u=s.get(t);if(c&&u)return c==t&&u==e;var h=-1,d=!0,f=2&n?new Sr:void 0;for(s.set(e,t),s.set(t,e);++h<l;){var p=e[h],m=t[h];if(r)var g=o?r(m,p,h,t,e,s):r(p,m,h,e,t,s);if(void 0!==g){if(g)continue;d=!1;break}if(f){if(!Cr(t,function(e,t){if(o=t,!f.has(o)&&(p===e||i(p,e,n,r,s)))return f.push(t);var o})){d=!1;break}}else if(p!==m&&!i(p,m,n,r,s)){d=!1;break}}return s.delete(e),s.delete(t),d}function qr(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function _r(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var Or=et?et.prototype:void 0,Tr=Or?Or.valueOf:void 0;var Lr=Object.prototype.hasOwnProperty;var Ir="[object Arguments]",Rr="[object Array]",Mr="[object Object]",Br=Object.prototype.hasOwnProperty;function Dr(e,t,n,r,i,s){var o=ct(e),l=ct(t),a=o?Rr:or(e),c=l?Rr:or(t),u=(a=a==Ir?Mr:a)==Mr,h=(c=c==Ir?Mr:c)==Mr,d=a==c;if(d&&nn(e)){if(!nn(t))return!1;o=!0,u=!1}if(d&&!u)return s||(s=new Bn),o||hn(e)?jr(e,t,n,r,i,s):function(e,t,n,r,i,s,o){switch(n){case"[object DataView]":if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=t.byteLength||!s(new ar(e),new ar(t)));case"[object Boolean]":case"[object Date]":case"[object Number]":return Pt(+e,+t);case"[object Error]":return e.name==t.name&&e.message==t.message;case"[object RegExp]":case"[object String]":return e==t+"";case"[object Map]":var l=qr;case"[object Set]":var a=1&r;if(l||(l=_r),e.size!=t.size&&!a)return!1;var c=o.get(e);if(c)return c==t;r|=2,o.set(e,t);var u=jr(l(e),l(t),r,i,s,o);return o.delete(e),u;case"[object Symbol]":if(Tr)return Tr.call(e)==Tr.call(t)}return!1}(e,t,a,n,r,i,s);if(!(1&n)){var f=u&&Br.call(e,"__wrapped__"),p=h&&Br.call(t,"__wrapped__");if(f||p){var m=f?e.value():e,g=p?t.value():t;return s||(s=new Bn),i(m,g,n,r,s)}}return!!d&&(s||(s=new Bn),function(e,t,n,r,i,s){var o=1&n,l=Kn(e),a=l.length;if(a!=Kn(t).length&&!o)return!1;for(var c=a;c--;){var u=l[c];if(!(o?u in t:Lr.call(t,u)))return!1}var h=s.get(e),d=s.get(t);if(h&&d)return h==t&&d==e;var f=!0;s.set(e,t),s.set(t,e);for(var p=o;++c<a;){var m=e[u=l[c]],g=t[u];if(r)var b=o?r(g,m,u,t,e,s):r(m,g,u,e,t,s);if(!(void 0===b?m===g||i(m,g,n,r,s):b)){f=!1;break}p||(p="constructor"==u)}if(f&&!p){var v=e.constructor,y=t.constructor;v==y||!("constructor"in e)||!("constructor"in t)||"function"==typeof v&&v instanceof v&&"function"==typeof y&&y instanceof y||(f=!1)}return s.delete(e),s.delete(t),f}(e,t,n,r,i,s))}function Pr(e,t,n,r,i){return e===t||(null==e||null==t||!at(e)&&!at(t)?e!=e&&t!=t:Dr(e,t,n,r,Pr,i))}var Fr=function(e,t,n){for(var r=-1,i=Object(e),s=n(e),o=s.length;o--;){var l=s[++r];if(!1===t(i[l],l,i))break}return e};function Ur(e,t,n){(void 0!==n&&!Pt(e[t],n)||void 0===n&&!(t in e))&&Dt(e,t,n)}function $r(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}function zr(e){return function(e,t,n){var r=!n;n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i],l=void 0;void 0===l&&(l=e[o]),r?Dt(n,o,l):Ut(n,o,l)}return n}(e,xn(e))}function Vr(e,t,n,r,i,s,o){var l=$r(e,n),a=$r(t,n),c=o.get(a);if(c)Ur(e,n,c);else{var u,h=s?s(l,a,n+"",e,t,o):void 0,d=void 0===h;if(d){var f=ct(a),p=!f&&nn(a),m=!f&&!p&&hn(a);h=a,f||p||m?ct(l)?h=l:at(u=l)&&Ht(u)?h=function(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}(l):p?(d=!1,h=$n(a,!0)):m?(d=!1,h=fr(a,!0)):h=[]:function(e){if(!at(e)||"[object Object]"!=lt(e))return!1;var t=On(e);if(null===t)return!0;var n=Rn.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&In.call(n)==Mn}(a)||Xt(a)?(h=l,Xt(l)?h=zr(l):ut(l)&&!dt(l)||(h=mr(a))):d=!1}d&&(o.set(a,h),i(h,a,r,s,o),o.delete(a)),Ur(e,n,h)}}function Hr(e,t,n,r,i){e!==t&&Fr(t,function(s,o){if(i||(i=new Bn),ut(s))Vr(e,t,o,n,Hr,r,i);else{var l=r?r($r(e,o),s,o+"",e,t,i):void 0;void 0===l&&(l=s),Ur(e,o,l)}},xn)}function Kr(e,t){return Pr(e,t)}var Wr,Zr=(Wr=function(e,t,n){Hr(e,t,n)},zt(function(e,t){var n=-1,r=t.length,i=r>1?t[r-1]:void 0,s=r>2?t[2]:void 0;for(i=Wr.length>3&&"function"==typeof i?(r--,i):void 0,s&&function(e,t,n){if(!ut(n))return!1;var r=typeof t;return!!("number"==r?Ht(n)&&Bt(t,n.length):"string"==r&&t in n)&&Pt(n[t],e)}(t[0],t[1],s)&&(i=r<3?void 0:i,r=1),e=Object(e);++n<r;){var o=t[n];o&&Wr(e,o,n,i)}return e})),Gr=(e=>(e[e.TYPE=3]="TYPE",e[e.LEVEL=12]="LEVEL",e[e.ATTRIBUTE=13]="ATTRIBUTE",e[e.BLOT=14]="BLOT",e[e.INLINE=7]="INLINE",e[e.BLOCK=11]="BLOCK",e[e.BLOCK_BLOT=10]="BLOCK_BLOT",e[e.INLINE_BLOT=6]="INLINE_BLOT",e[e.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",e[e.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",e[e.ANY=15]="ANY",e))(Gr||{});class Yr{constructor(e,t,n={}){this.attrName=e,this.keyName=t;const r=Gr.TYPE&Gr.ATTRIBUTE;this.scope=null!=n.scope?n.scope&Gr.LEVEL|r:Gr.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}static keys(e){return Array.from(e.attributes).map(e=>e.name)}add(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)}canAdd(e,t){return null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1)}remove(e){e.removeAttribute(this.keyName)}value(e){const t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""}}class Jr extends Error{constructor(e){super(e="[Parchment] "+e),this.message=e,this.name=this.constructor.name}}const Xr=class e{constructor(){this.attributes={},this.classes={},this.tags={},this.types={}}static find(e,t=!1){if(null==e)return null;if(this.blots.has(e))return this.blots.get(e)||null;if(t){let n=null;try{n=e.parentNode}catch{return null}return this.find(n,t)}return null}create(t,n,r){const i=this.query(n);if(null==i)throw new Jr(`Unable to create ${n} blot`);const s=i,o=n instanceof Node||n.nodeType===Node.TEXT_NODE?n:s.create(r),l=new s(t,o,r);return e.blots.set(l.domNode,l),l}find(t,n=!1){return e.find(t,n)}query(e,t=Gr.ANY){let n;return"string"==typeof e?n=this.types[e]||this.attributes[e]:e instanceof Text||e.nodeType===Node.TEXT_NODE?n=this.types.text:"number"==typeof e?e&Gr.LEVEL&Gr.BLOCK?n=this.types.block:e&Gr.LEVEL&Gr.INLINE&&(n=this.types.inline):e instanceof Element&&((e.getAttribute("class")||"").split(/\s+/).some(e=>(n=this.classes[e],!!n)),n=n||this.tags[e.tagName]),null==n?null:"scope"in n&&t&Gr.LEVEL&n.scope&&t&Gr.TYPE&n.scope?n:null}register(...e){return e.map(e=>{const t="blotName"in e,n="attrName"in e;if(!t&&!n)throw new Jr("Invalid definition");if(t&&"abstract"===e.blotName)throw new Jr("Cannot register abstract class");const r=t?e.blotName:n?e.attrName:void 0;return this.types[r]=e,n?"string"==typeof e.keyName&&(this.attributes[e.keyName]=e):t&&(e.className&&(this.classes[e.className]=e),e.tagName&&(Array.isArray(e.tagName)?e.tagName=e.tagName.map(e=>e.toUpperCase()):e.tagName=e.tagName.toUpperCase(),(Array.isArray(e.tagName)?e.tagName:[e.tagName]).forEach(t=>{(null==this.tags[t]||null==e.className)&&(this.tags[t]=e)}))),e})}};Xr.blots=new WeakMap;let Qr=Xr;function ei(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(e=>0===e.indexOf(`${t}-`))}const ti=class extends Yr{static keys(e){return(e.getAttribute("class")||"").split(/\s+/).map(e=>e.split("-").slice(0,-1).join("-"))}add(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(`${this.keyName}-${t}`),!0)}remove(e){ei(e,this.keyName).forEach(t=>{e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")}value(e){const t=(ei(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""}};function ni(e){const t=e.split("-"),n=t.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("");return t[0]+n}const ri=class extends Yr{static keys(e){return(e.getAttribute("style")||"").split(";").map(e=>e.split(":")[0].trim())}add(e,t){return!!this.canAdd(e,t)&&(e.style[ni(this.keyName)]=t,!0)}remove(e){e.style[ni(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")}value(e){const t=e.style[ni(this.keyName)];return this.canAdd(e,t)?t:""}};const ii=class{constructor(e){this.attributes={},this.domNode=e,this.build()}attribute(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])}build(){this.attributes={};const e=Qr.find(this.domNode);if(null==e)return;const t=Yr.keys(this.domNode),n=ti.keys(this.domNode),r=ri.keys(this.domNode);t.concat(n).concat(r).forEach(t=>{const n=e.scroll.query(t,Gr.ATTRIBUTE);n instanceof Yr&&(this.attributes[n.attrName]=n)})}copy(e){Object.keys(this.attributes).forEach(t=>{const n=this.attributes[t].value(this.domNode);e.format(t,n)})}move(e){this.copy(e),Object.keys(this.attributes).forEach(e=>{this.attributes[e].remove(this.domNode)}),this.attributes={}}values(){return Object.keys(this.attributes).reduce((e,t)=>(e[t]=this.attributes[t].value(this.domNode),e),{})}},si=class{constructor(e,t){this.scroll=e,this.domNode=t,Qr.blots.set(t,this),this.prev=null,this.next=null}static create(e){if(null==this.tagName)throw new Jr("Blot definition missing tagName");let t,n;return Array.isArray(this.tagName)?("string"==typeof e?(n=e.toUpperCase(),parseInt(n,10).toString()===n&&(n=parseInt(n,10))):"number"==typeof e&&(n=e),t="number"==typeof n?document.createElement(this.tagName[n-1]):n&&this.tagName.indexOf(n)>-1?document.createElement(n):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t}get statics(){return this.constructor}attach(){}clone(){const e=this.domNode.cloneNode(!1);return this.scroll.create(e)}detach(){null!=this.parent&&this.parent.removeChild(this),Qr.blots.delete(this.domNode)}deleteAt(e,t){this.isolate(e,t).remove()}formatAt(e,t,n,r){const i=this.isolate(e,t);if(null!=this.scroll.query(n,Gr.BLOT)&&r)i.wrap(n,r);else if(null!=this.scroll.query(n,Gr.ATTRIBUTE)){const e=this.scroll.create(this.statics.scope);i.wrap(e),e.format(n,r)}}insertAt(e,t,n){const r=null==n?this.scroll.create("text",t):this.scroll.create(t,n),i=this.split(e);this.parent.insertBefore(r,i||void 0)}isolate(e,t){const n=this.split(e);if(null==n)throw new Error("Attempt to isolate at end");return n.split(t),n}length(){return 1}offset(e=this.parent){return null==this.parent||this===e?0:this.parent.children.offset(this)+this.parent.offset(e)}optimize(e){this.statics.requiredContainer&&!(this.parent instanceof this.statics.requiredContainer)&&this.wrap(this.statics.requiredContainer.blotName)}remove(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()}replaceWith(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;return null!=this.parent&&(this.parent.insertBefore(n,this.next||void 0),this.remove()),n}split(e,t){return 0===e?this:this.next}update(e,t){}wrap(e,t){const n="string"==typeof e?this.scroll.create(e,t):e;if(null!=this.parent&&this.parent.insertBefore(n,this.next||void 0),"function"!=typeof n.appendChild)throw new Jr(`Cannot wrap ${e}`);return n.appendChild(this),n}};si.blotName="abstract";let oi=si;const li=class extends oi{static value(e){return!0}index(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1}position(e,t){let n=Array.from(this.parent.domNode.childNodes).indexOf(this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]}value(){return{[this.statics.blotName]:this.statics.value(this.domNode)||!0}}};li.scope=Gr.INLINE_BLOT;const ai=li;class ci{constructor(){this.head=null,this.tail=null,this.length=0}append(...e){if(this.insertBefore(e[0],null),e.length>1){const t=e.slice(1);this.append(...t)}}at(e){const t=this.iterator();let n=t();for(;n&&e>0;)e-=1,n=t();return n}contains(e){const t=this.iterator();let n=t();for(;n;){if(n===e)return!0;n=t()}return!1}indexOf(e){const t=this.iterator();let n=t(),r=0;for(;n;){if(n===e)return r;r+=1,n=t()}return-1}insertBefore(e,t){null!=e&&(this.remove(e),e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)}offset(e){let t=0,n=this.head;for(;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return-1}remove(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)}iterator(e=this.head){return()=>{const t=e;return null!=e&&(e=e.next),t}}find(e,t=!1){const n=this.iterator();let r=n();for(;r;){const i=r.length();if(e<i||t&&e===i&&(null==r.next||0!==r.next.length()))return[r,e];e-=i,r=n()}return[null,0]}forEach(e){const t=this.iterator();let n=t();for(;n;)e(n),n=t()}forEachAt(e,t,n){if(t<=0)return;const[r,i]=this.find(e);let s=e-i;const o=this.iterator(r);let l=o();for(;l&&s<e+t;){const r=l.length();e>s?n(l,e-s,Math.min(t,s+r-e)):n(l,0,Math.min(r,e+t-s)),s+=r,l=o()}}map(e){return this.reduce((t,n)=>(t.push(e(n)),t),[])}reduce(e,t){const n=this.iterator();let r=n();for(;r;)t=e(t,r),r=n();return t}}function ui(e,t){const n=t.find(e);if(n)return n;try{return t.create(e)}catch{const n=t.create(Gr.INLINE);return Array.from(e.childNodes).forEach(e=>{n.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(n.domNode,e),n.attach(),n}}const hi=class e extends oi{constructor(e,t){super(e,t),this.uiNode=null,this.build()}appendChild(e){this.insertBefore(e)}attach(){super.attach(),this.children.forEach(e=>{e.attach()})}attachUI(t){null!=this.uiNode&&this.uiNode.remove(),this.uiNode=t,e.uiClass&&this.uiNode.classList.add(e.uiClass),this.uiNode.setAttribute("contenteditable","false"),this.domNode.insertBefore(this.uiNode,this.domNode.firstChild)}build(){this.children=new ci,Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).reverse().forEach(e=>{try{const t=ui(e,this.scroll);this.insertBefore(t,this.children.head||void 0)}catch(t){if(t instanceof Jr)return;throw t}})}deleteAt(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,(e,t,n)=>{e.deleteAt(t,n)})}descendant(t,n=0){const[r,i]=this.children.find(n);return null==t.blotName&&t(r)||null!=t.blotName&&r instanceof t?[r,i]:r instanceof e?r.descendant(t,i):[null,-1]}descendants(t,n=0,r=Number.MAX_VALUE){let i=[],s=r;return this.children.forEachAt(n,r,(n,r,o)=>{(null==t.blotName&&t(n)||null!=t.blotName&&n instanceof t)&&i.push(n),n instanceof e&&(i=i.concat(n.descendants(t,r,s))),s-=o}),i}detach(){this.children.forEach(e=>{e.detach()}),super.detach()}enforceAllowedChildren(){let t=!1;this.children.forEach(n=>{t||this.statics.allowedChildren.some(e=>n instanceof e)||(n.statics.scope===Gr.BLOCK_BLOT?(null!=n.next&&this.splitAfter(n),null!=n.prev&&this.splitAfter(n.prev),n.parent.unwrap(),t=!0):n instanceof e?n.unwrap():n.remove())})}formatAt(e,t,n,r){this.children.forEachAt(e,t,(e,t,i)=>{e.formatAt(t,i,n,r)})}insertAt(e,t,n){const[r,i]=this.children.find(e);if(r)r.insertAt(i,t,n);else{const e=null==n?this.scroll.create("text",t):this.scroll.create(t,n);this.appendChild(e)}}insertBefore(e,t){null!=e.parent&&e.parent.children.remove(e);let n=null;this.children.insertBefore(e,t||null),e.parent=this,null!=t&&(n=t.domNode),(this.domNode.parentNode!==e.domNode||this.domNode.nextSibling!==n)&&this.domNode.insertBefore(e.domNode,n),e.attach()}length(){return this.children.reduce((e,t)=>e+t.length(),0)}moveChildren(e,t){this.children.forEach(n=>{e.insertBefore(n,t)})}optimize(e){if(super.optimize(e),this.enforceAllowedChildren(),null!=this.uiNode&&this.uiNode!==this.domNode.firstChild&&this.domNode.insertBefore(this.uiNode,this.domNode.firstChild),0===this.children.length)if(null!=this.statics.defaultChild){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e)}else this.remove()}path(t,n=!1){const[r,i]=this.children.find(t,n),s=[[this,t]];return r instanceof e?s.concat(r.path(i,n)):(null!=r&&s.push([r,i]),s)}removeChild(e){this.children.remove(e)}replaceWith(t,n){const r="string"==typeof t?this.scroll.create(t,n):t;return r instanceof e&&this.moveChildren(r),super.replaceWith(r)}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.clone();return this.parent&&this.parent.insertBefore(n,this.next||void 0),this.children.forEachAt(e,this.length(),(e,r,i)=>{const s=e.split(r,t);null!=s&&n.appendChild(s)}),n}splitAfter(e){const t=this.clone();for(;null!=e.next;)t.appendChild(e.next);return this.parent&&this.parent.insertBefore(t,this.next||void 0),t}unwrap(){this.parent&&this.moveChildren(this.parent,this.next||void 0),this.remove()}update(e,t){const n=[],r=[];e.forEach(e=>{e.target===this.domNode&&"childList"===e.type&&(n.push(...e.addedNodes),r.push(...e.removedNodes))}),r.forEach(e=>{if(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)return;const t=this.scroll.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===this.domNode)&&t.detach()}),n.filter(e=>e.parentNode===this.domNode&&e!==this.uiNode).sort((e,t)=>e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1).forEach(e=>{let t=null;null!=e.nextSibling&&(t=this.scroll.find(e.nextSibling));const n=ui(e,this.scroll);(n.next!==t||null==n.next)&&(null!=n.parent&&n.parent.removeChild(this),this.insertBefore(n,t||void 0))}),this.enforceAllowedChildren()}};hi.uiClass="";const di=hi;const fi=class e extends di{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ii(this.domNode)}format(t,n){if(t!==this.statics.blotName||n){const e=this.scroll.query(t,Gr.INLINE);if(null==e)return;e instanceof Yr?this.attributes.attribute(e,n):n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n)}else this.children.forEach(t=>{t instanceof e||(t=t.wrap(e.blotName,!0)),this.attributes.copy(t)}),this.unwrap()}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.formats()[n]||this.scroll.query(n,Gr.ATTRIBUTE)?this.isolate(e,t).format(n,r):super.formatAt(e,t,n,r)}optimize(t){super.optimize(t);const n=this.formats();if(0===Object.keys(n).length)return this.unwrap();const r=this.next;r instanceof e&&r.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}(n,r.formats())&&(r.moveChildren(this),r.remove())}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}wrap(t,n){const r=super.wrap(t,n);return r instanceof e&&this.attributes.move(r),r}};fi.allowedChildren=[fi,ai],fi.blotName="inline",fi.scope=Gr.INLINE_BLOT,fi.tagName="SPAN";const pi=fi,mi=class e extends di{static create(e){return super.create(e)}static formats(t,n){const r=n.query(e.blotName);if(null==r||t.tagName!==r.tagName){if("string"==typeof this.tagName)return!0;if(Array.isArray(this.tagName))return t.tagName.toLowerCase()}}constructor(e,t){super(e,t),this.attributes=new ii(this.domNode)}format(t,n){const r=this.scroll.query(t,Gr.BLOCK);null!=r&&(r instanceof Yr?this.attributes.attribute(r,n):t!==this.statics.blotName||n?n&&(t!==this.statics.blotName||this.formats()[t]!==n)&&this.replaceWith(t,n):this.replaceWith(e.blotName))}formats(){const e=this.attributes.values(),t=this.statics.formats(this.domNode,this.scroll);return null!=t&&(e[this.statics.blotName]=t),e}formatAt(e,t,n,r){null!=this.scroll.query(n,Gr.BLOCK)?this.format(n,r):super.formatAt(e,t,n,r)}insertAt(e,t,n){if(null==n||null!=this.scroll.query(t,Gr.INLINE))super.insertAt(e,t,n);else{const r=this.split(e);if(null==r)throw new Error("Attempt to insertAt after block boundaries");{const e=this.scroll.create(t,n);r.parent.insertBefore(e,r)}}}replaceWith(e,t){const n=super.replaceWith(e,t);return this.attributes.copy(n),n}update(e,t){super.update(e,t),e.some(e=>e.target===this.domNode&&"attributes"===e.type)&&this.attributes.build()}};mi.blotName="block",mi.scope=Gr.BLOCK_BLOT,mi.tagName="P",mi.allowedChildren=[pi,mi,ai];const gi=mi,bi=class extends di{checkMerge(){return null!==this.next&&this.next.statics.blotName===this.statics.blotName}deleteAt(e,t){super.deleteAt(e,t),this.enforceAllowedChildren()}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.enforceAllowedChildren()}insertAt(e,t,n){super.insertAt(e,t,n),this.enforceAllowedChildren()}optimize(e){super.optimize(e),this.children.length>0&&null!=this.next&&this.checkMerge()&&(this.next.moveChildren(this),this.next.remove())}};bi.blotName="container",bi.scope=Gr.BLOCK_BLOT;const vi=bi;const yi=class extends ai{static formats(e,t){}format(e,t){super.formatAt(0,this.length(),e,t)}formatAt(e,t,n,r){0===e&&t===this.length()?this.format(n,r):super.formatAt(e,t,n,r)}formats(){return this.statics.formats(this.domNode,this.scroll)}},xi={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0},wi=class extends di{constructor(e,t){super(null,t),this.registry=e,this.scroll=this,this.build(),this.observer=new MutationObserver(e=>{this.update(e)}),this.observer.observe(this.domNode,xi),this.attach()}create(e,t){return this.registry.create(this,e,t)}find(e,t=!1){const n=this.registry.find(e,t);return n?n.scroll===this?n:t?this.find(n.scroll.domNode.parentNode,!0):null:null}query(e,t=Gr.ANY){return this.registry.query(e,t)}register(...e){return this.registry.register(...e)}build(){null!=this.scroll&&super.build()}detach(){super.detach(),this.observer.disconnect()}deleteAt(e,t){this.update(),0===e&&t===this.length()?this.children.forEach(e=>{e.remove()}):super.deleteAt(e,t)}formatAt(e,t,n,r){this.update(),super.formatAt(e,t,n,r)}insertAt(e,t,n){this.update(),super.insertAt(e,t,n)}optimize(e=[],t={}){super.optimize(t);const n=t.mutationsMap||new WeakMap;let r=Array.from(this.observer.takeRecords());for(;r.length>0;)e.push(r.pop());const i=(e,t=!0)=>{null==e||e===this||null!=e.domNode.parentNode&&(n.has(e.domNode)||n.set(e.domNode,[]),t&&i(e.parent))},s=e=>{n.has(e.domNode)&&(e instanceof di&&e.children.forEach(s),n.delete(e.domNode),e.optimize(t))};let o=e;for(let l=0;o.length>0;l+=1){if(l>=100)throw new Error("[Parchment] Maximum optimize iterations reached");for(o.forEach(e=>{const t=this.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(i(this.find(e.previousSibling,!1)),Array.from(e.addedNodes).forEach(e=>{const t=this.find(e,!1);i(t,!1),t instanceof di&&t.children.forEach(e=>{i(e,!1)})})):"attributes"===e.type&&i(t.prev)),i(t))}),this.children.forEach(s),o=Array.from(this.observer.takeRecords()),r=o.slice();r.length>0;)e.push(r.pop())}}update(e,t={}){e=e||this.observer.takeRecords();const n=new WeakMap;e.map(e=>{const t=this.find(e.target,!0);return null==t?null:n.has(t.domNode)?(n.get(t.domNode).push(e),null):(n.set(t.domNode,[e]),t)}).forEach(e=>{null!=e&&e!==this&&n.has(e.domNode)&&e.update(n.get(e.domNode)||[],t)}),t.mutationsMap=n,n.has(this.domNode)&&super.update(n.get(this.domNode),t),this.optimize(e,t)}};wi.blotName="scroll",wi.defaultChild=gi,wi.allowedChildren=[gi,vi],wi.scope=Gr.BLOCK_BLOT,wi.tagName="DIV";const Ni=wi,Ei=class e extends ai{static create(e){return document.createTextNode(e)}static value(e){return e.data}constructor(e,t){super(e,t),this.text=this.statics.value(this.domNode)}deleteAt(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)}index(e,t){return this.domNode===e?t:-1}insertAt(e,t,n){null==n?(this.text=this.text.slice(0,e)+t+this.text.slice(e),this.domNode.data=this.text):super.insertAt(e,t,n)}length(){return this.text.length}optimize(t){super.optimize(t),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof e&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())}position(e,t=!1){return[this.domNode,e]}split(e,t=!1){if(!t){if(0===e)return this;if(e===this.length())return this.next}const n=this.scroll.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next||void 0),this.text=this.statics.value(this.domNode),n}update(e,t){e.some(e=>"characterData"===e.type&&e.target===this.domNode)&&(this.text=this.statics.value(this.domNode))}value(){return this.text}};Ei.blotName="text",Ei.scope=Gr.INLINE_BLOT;const ki=Ei,Ai=Object.freeze(Object.defineProperty({__proto__:null,Attributor:Yr,AttributorStore:ii,BlockBlot:gi,ClassAttributor:ti,ContainerBlot:vi,EmbedBlot:yi,InlineBlot:pi,LeafBlot:ai,ParentBlot:di,Registry:Qr,Scope:Gr,ScrollBlot:Ni,StyleAttributor:ri,TextBlot:ki},Symbol.toStringTag,{value:"Module"}));var Si,Ci,ji={exports:{}};function qi(){if(Ci)return Si;Ci=1;var e=-1;function t(d,f,p,m,b){if(d===f)return d?[[0,d]]:[];if(null!=p){var v=function(e,t,n){var r="number"==typeof n?{index:n,length:0}:n.oldRange,i="number"==typeof n?null:n.newRange,s=e.length,o=t.length;if(0===r.length&&(null===i||0===i.length)){var l=r.index,a=e.slice(0,l),c=e.slice(l),u=i?i.index:null,h=l+o-s;if((null===u||u===h)&&!(h<0||h>o)){var d=t.slice(0,h);if((m=t.slice(h))===c){var f=Math.min(l,h);if((v=a.slice(0,f))===(x=d.slice(0,f)))return g(v,a.slice(f),d.slice(f),c)}}if(null===u||u===l){var p=l,m=(d=t.slice(0,p),t.slice(p));if(d===a){var b=Math.min(s-p,o-p);if((y=c.slice(c.length-b))===(w=m.slice(m.length-b)))return g(a,c.slice(0,c.length-b),m.slice(0,m.length-b),y)}}}if(r.length>0&&i&&0===i.length){var v=e.slice(0,r.index),y=e.slice(r.index+r.length);if(!(o<(f=v.length)+(b=y.length))){var x=t.slice(0,f),w=t.slice(o-b);if(v===x&&y===w)return g(v,e.slice(f,s-b),t.slice(f,o-b),y)}}return null}(d,f,p);if(v)return v}var y=r(d,f),x=d.substring(0,y);y=s(d=d.substring(y),f=f.substring(y));var w=d.substring(d.length-y),N=function(i,o){var l;if(!i)return[[1,o]];if(!o)return[[e,i]];var a=i.length>o.length?i:o,c=i.length>o.length?o:i,u=a.indexOf(c);if(-1!==u)return l=[[1,a.substring(0,u)],[0,c],[1,a.substring(u+c.length)]],i.length>o.length&&(l[0][0]=l[2][0]=e),l;if(1===c.length)return[[e,i],[1,o]];var h=function(e,t){var n=e.length>t.length?e:t,i=e.length>t.length?t:e;if(n.length<4||2*i.length<n.length)return null;function o(e,t,n){for(var i,o,l,a,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,h="";-1!==(u=t.indexOf(c,u+1));){var d=r(e.substring(n),t.substring(u)),f=s(e.substring(0,n),t.substring(0,u));h.length<f+d&&(h=t.substring(u-f,u)+t.substring(u,u+d),i=e.substring(0,n-f),o=e.substring(n+d),l=t.substring(0,u-f),a=t.substring(u+d))}return 2*h.length>=e.length?[i,o,l,a,h]:null}var l,a,c,u,h,d=o(n,i,Math.ceil(n.length/4)),f=o(n,i,Math.ceil(n.length/2));if(!d&&!f)return null;l=f?d&&d[4].length>f[4].length?d:f:d;e.length>t.length?(a=l[0],c=l[1],u=l[2],h=l[3]):(u=l[0],h=l[1],a=l[2],c=l[3]);var p=l[4];return[a,c,u,h,p]}(i,o);if(h){var d=h[0],f=h[1],p=h[2],m=h[3],g=h[4],b=t(d,p),v=t(f,m);return b.concat([[0,g]],v)}return function(t,r){for(var i=t.length,s=r.length,o=Math.ceil((i+s)/2),l=o,a=2*o,c=new Array(a),u=new Array(a),h=0;h<a;h++)c[h]=-1,u[h]=-1;c[l+1]=0,u[l+1]=0;for(var d=i-s,f=d%2!=0,p=0,m=0,g=0,b=0,v=0;v<o;v++){for(var y=-v+p;y<=v-m;y+=2){for(var x=l+y,w=(S=y===-v||y!==v&&c[x-1]<c[x+1]?c[x+1]:c[x-1]+1)-y;S<i&&w<s&&t.charAt(S)===r.charAt(w);)S++,w++;if(c[x]=S,S>i)m+=2;else if(w>s)p+=2;else if(f){if((k=l+d-y)>=0&&k<a&&-1!==u[k])if(S>=(E=i-u[k]))return n(t,r,S,w)}}for(var N=-v+g;N<=v-b;N+=2){for(var E,k=l+N,A=(E=N===-v||N!==v&&u[k-1]<u[k+1]?u[k+1]:u[k-1]+1)-N;E<i&&A<s&&t.charAt(i-E-1)===r.charAt(s-A-1);)E++,A++;if(u[k]=E,E>i)b+=2;else if(A>s)g+=2;else if(!f){if((x=l+d-N)>=0&&x<a&&-1!==c[x]){var S;w=l+(S=c[x])-x;if(S>=(E=i-E))return n(t,r,S,w)}}}}return[[e,t],[1,r]]}(i,o)}(d=d.substring(0,d.length-y),f=f.substring(0,f.length-y));return x&&N.unshift([0,x]),w&&N.push([0,w]),h(N,b),m&&function(t){var n=!1,r=[],d=0,f=null,p=0,m=0,g=0,b=0,v=0;for(;p<t.length;)0==t[p][0]?(r[d++]=p,m=b,g=v,b=0,v=0,f=t[p][1]):(1==t[p][0]?b+=t[p][1].length:v+=t[p][1].length,f&&f.length<=Math.max(m,g)&&f.length<=Math.max(b,v)&&(t.splice(r[d-1],0,[e,f]),t[r[d-1]+1][0]=1,d--,p=--d>0?r[d-1]:-1,m=0,g=0,b=0,v=0,f=null,n=!0)),p++;n&&h(t);(function(e){function t(e,t){if(!e||!t)return 6;var n=e.charAt(e.length-1),r=t.charAt(0),i=n.match(o),s=r.match(o),h=i&&n.match(l),d=s&&r.match(l),f=h&&n.match(a),p=d&&r.match(a),m=f&&e.match(c),g=p&&t.match(u);return m||g?5:f||p?4:i&&!h&&d?3:h||d?2:i||s?1:0}var n=1;for(;n<e.length-1;){if(0==e[n-1][0]&&0==e[n+1][0]){var r=e[n-1][1],i=e[n][1],h=e[n+1][1],d=s(r,i);if(d){var f=i.substring(i.length-d);r=r.substring(0,r.length-d),i=f+i.substring(0,i.length-d),h=f+h}for(var p=r,m=i,g=h,b=t(r,i)+t(i,h);i.charAt(0)===h.charAt(0);){r+=i.charAt(0),i=i.substring(1)+h.charAt(0),h=h.substring(1);var v=t(r,i)+t(i,h);v>=b&&(b=v,p=r,m=i,g=h)}e[n-1][1]!=p&&(p?e[n-1][1]=p:(e.splice(n-1,1),n--),e[n][1]=m,g?e[n+1][1]=g:(e.splice(n+1,1),n--))}n++}})(t),p=1;for(;p<t.length;){if(t[p-1][0]==e&&1==t[p][0]){var y=t[p-1][1],x=t[p][1],w=i(y,x),N=i(x,y);w>=N?(w>=y.length/2||w>=x.length/2)&&(t.splice(p,0,[0,x.substring(0,w)]),t[p-1][1]=y.substring(0,y.length-w),t[p+1][1]=x.substring(w),p++):(N>=y.length/2||N>=x.length/2)&&(t.splice(p,0,[0,y.substring(0,N)]),t[p-1][0]=1,t[p-1][1]=x.substring(0,x.length-N),t[p+1][0]=e,t[p+1][1]=y.substring(N),p++),p++}p++}}(N),N}function n(e,n,r,i){var s=e.substring(0,r),o=n.substring(0,i),l=e.substring(r),a=n.substring(i),c=t(s,o),u=t(l,a);return c.concat(u)}function r(e,t){if(!e||!t||e.charAt(0)!==t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(s,i)==t.substring(s,i)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return d(e.charCodeAt(i-1))&&i--,i}function i(e,t){var n=e.length,r=t.length;if(0==n||0==r)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var s=0,o=1;;){var l=e.substring(i-o),a=t.indexOf(l);if(-1==a)return s;o+=a,0!=a&&e.substring(i-o)!=t.substring(0,o)||(s=o,o++)}}function s(e,t){if(!e||!t||e.slice(-1)!==t.slice(-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,s=0;n<i;)e.substring(e.length-i,e.length-s)==t.substring(t.length-i,t.length-s)?s=n=i:r=i,i=Math.floor((r-n)/2+n);return f(e.charCodeAt(e.length-i))&&i--,i}var o=/[^a-zA-Z0-9]/,l=/\s/,a=/[\r\n]/,c=/\n\r?\n$/,u=/^\r?\n\r?\n/;function h(t,n){t.push([0,""]);for(var i,o=0,l=0,a=0,c="",u="";o<t.length;)if(o<t.length-1&&!t[o][1])t.splice(o,1);else switch(t[o][0]){case 1:a++,u+=t[o][1],o++;break;case e:l++,c+=t[o][1],o++;break;case 0:var d=o-a-l-1;if(n){if(d>=0&&m(t[d][1])){var f=t[d][1].slice(-1);if(t[d][1]=t[d][1].slice(0,-1),c=f+c,u=f+u,!t[d][1]){t.splice(d,1),o--;var g=d-1;t[g]&&1===t[g][0]&&(a++,u=t[g][1]+u,g--),t[g]&&t[g][0]===e&&(l++,c=t[g][1]+c,g--),d=g}}if(p(t[o][1])){f=t[o][1].charAt(0);t[o][1]=t[o][1].slice(1),c+=f,u+=f}}if(o<t.length-1&&!t[o][1]){t.splice(o,1);break}if(c.length>0||u.length>0){c.length>0&&u.length>0&&(0!==(i=r(u,c))&&(d>=0?t[d][1]+=u.substring(0,i):(t.splice(0,0,[0,u.substring(0,i)]),o++),u=u.substring(i),c=c.substring(i)),0!==(i=s(u,c))&&(t[o][1]=u.substring(u.length-i)+t[o][1],u=u.substring(0,u.length-i),c=c.substring(0,c.length-i)));var b=a+l;0===c.length&&0===u.length?(t.splice(o-b,b),o-=b):0===c.length?(t.splice(o-b,b,[1,u]),o=o-b+1):0===u.length?(t.splice(o-b,b,[e,c]),o=o-b+1):(t.splice(o-b,b,[e,c],[1,u]),o=o-b+2)}0!==o&&0===t[o-1][0]?(t[o-1][1]+=t[o][1],t.splice(o,1)):o++,a=0,l=0,c="",u=""}""===t[t.length-1][1]&&t.pop();var v=!1;for(o=1;o<t.length-1;)0===t[o-1][0]&&0===t[o+1][0]&&(t[o][1].substring(t[o][1].length-t[o-1][1].length)===t[o-1][1]?(t[o][1]=t[o-1][1]+t[o][1].substring(0,t[o][1].length-t[o-1][1].length),t[o+1][1]=t[o-1][1]+t[o+1][1],t.splice(o-1,1),v=!0):t[o][1].substring(0,t[o+1][1].length)==t[o+1][1]&&(t[o-1][1]+=t[o+1][1],t[o][1]=t[o][1].substring(t[o+1][1].length)+t[o+1][1],t.splice(o+1,1),v=!0)),o++;v&&h(t,n)}function d(e){return e>=55296&&e<=56319}function f(e){return e>=56320&&e<=57343}function p(e){return f(e.charCodeAt(0))}function m(e){return d(e.charCodeAt(e.length-1))}function g(t,n,r,i){return m(t)||p(i)?null:function(e){for(var t=[],n=0;n<e.length;n++)e[n][1].length>0&&t.push(e[n]);return t}([[0,t],[e,n],[1,r],[0,i]])}function b(e,n,r,i){return t(e,n,r,i,!0)}return b.INSERT=1,b.DELETE=e,b.EQUAL=0,Si=b}var _i,Oi={exports:{}};function Ti(){return _i||(_i=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Boolean]",o="[object Date]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",u="[object Number]",h="[object Object]",d="[object Promise]",f="[object RegExp]",p="[object Set]",m="[object String]",g="[object Symbol]",b="[object WeakMap]",v="[object ArrayBuffer]",y="[object DataView]",x="[object Float32Array]",w="[object Float64Array]",N="[object Int8Array]",E="[object Int16Array]",k="[object Int32Array]",A="[object Uint8Array]",S="[object Uint8ClampedArray]",C="[object Uint16Array]",j="[object Uint32Array]",q=/\w*$/,_=/^\[object .+?Constructor\]$/,O=/^(?:0|[1-9]\d*)$/,T={};T[i]=T["[object Array]"]=T[v]=T[y]=T[s]=T[o]=T[x]=T[w]=T[N]=T[E]=T[k]=T[c]=T[u]=T[h]=T[f]=T[p]=T[m]=T[g]=T[A]=T[S]=T[C]=T[j]=!0,T["[object Error]"]=T[l]=T[b]=!1;var L="object"==typeof U&&U&&U.Object===Object&&U,I="object"==typeof self&&self&&self.Object===Object&&self,R=L||I||Function("return this")(),M=t&&!t.nodeType&&t,B=M&&e&&!e.nodeType&&e,D=B&&B.exports===M;function P(e,t){return e.set(t[0],t[1]),e}function F(e,t){return e.add(t),e}function $(e,t,n,r){for(var i=-1,s=e?e.length:0;++i<s;)n=t(n,e[i],i,e);return n}function z(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(n){}return t}function V(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function H(e,t){return function(n){return e(t(n))}}function K(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var W=Array.prototype,Z=Function.prototype,G=Object.prototype,Y=R["__core-js_shared__"],J=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),X=Z.toString,Q=G.hasOwnProperty,ee=G.toString,te=RegExp("^"+X.call(Q).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ne=D?R.Buffer:void 0,re=R.Symbol,ie=R.Uint8Array,se=H(Object.getPrototypeOf,Object),oe=Object.create,le=G.propertyIsEnumerable,ae=W.splice,ce=Object.getOwnPropertySymbols,ue=ne?ne.isBuffer:void 0,he=H(Object.keys,Object),de=Be(R,"DataView"),fe=Be(R,"Map"),pe=Be(R,"Promise"),me=Be(R,"Set"),ge=Be(R,"WeakMap"),be=Be(Object,"create"),ve=$e(de),ye=$e(fe),xe=$e(pe),we=$e(me),Ne=$e(ge),Ee=re?re.prototype:void 0,ke=Ee?Ee.valueOf:void 0;function Ae(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Se(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ce(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function je(e){this.__data__=new Se(e)}function qe(e,t){var n=Ve(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&He(e)}(e)&&Q.call(e,"callee")&&(!le.call(e,"callee")||ee.call(e)==i)}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,s=!!r;for(var o in e)!Q.call(e,o)||s&&("length"==o||Fe(o,r))||n.push(o);return n}function _e(e,t,n){var r=e[t];Q.call(e,t)&&ze(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function Oe(e,t){for(var n=e.length;n--;)if(ze(e[n][0],t))return n;return-1}function Te(e,t,n,r,d,b,_){var O;if(r&&(O=b?r(e,d,b,_):r(e)),void 0!==O)return O;if(!Ze(e))return e;var L=Ve(e);if(L){if(O=function(e){var t=e.length,n=e.constructor(t);t&&"string"==typeof e[0]&&Q.call(e,"index")&&(n.index=e.index,n.input=e.input);return n}(e),!t)return function(e,t){var n=-1,r=e.length;t||(t=Array(r));for(;++n<r;)t[n]=e[n];return t}(e,O)}else{var I=Pe(e),R=I==l||I==a;if(Ke(e))return function(e,t){if(t)return e.slice();var n=new e.constructor(e.length);return e.copy(n),n}(e,t);if(I==h||I==i||R&&!b){if(z(e))return b?e:{};if(O=function(e){return"function"!=typeof e.constructor||Ue(e)?{}:(t=se(e),Ze(t)?oe(t):{});var t}(R?{}:e),!t)return function(e,t){return Re(e,De(e),t)}(e,function(e,t){return e&&Re(t,Ge(t),e)}(O,e))}else{if(!T[I])return b?e:{};O=function(e,t,n,r){var i=e.constructor;switch(t){case v:return Ie(e);case s:case o:return new i(+e);case y:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,r);case x:case w:case N:case E:case k:case A:case S:case C:case j:return function(e,t){var n=t?Ie(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}(e,r);case c:return function(e,t,n){var r=t?n(V(e),!0):V(e);return $(r,P,new e.constructor)}(e,r,n);case u:case m:return new i(e);case f:return function(e){var t=new e.constructor(e.source,q.exec(e));return t.lastIndex=e.lastIndex,t}(e);case p:return function(e,t,n){var r=t?n(K(e),!0):K(e);return $(r,F,new e.constructor)}(e,r,n);case g:return l=e,ke?Object(ke.call(l)):{}}var l}(e,I,Te,t)}}_||(_=new je);var M=_.get(e);if(M)return M;if(_.set(e,O),!L)var B=n?function(e){return function(e,t,n){var r=t(e);return Ve(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,Ge,De)}(e):Ge(e);return function(e,t){for(var n=-1,r=e?e.length:0;++n<r&&!1!==t(e[n],n,e););}(B||e,function(i,s){B&&(i=e[s=i]),_e(O,s,Te(i,t,n,r,s,e,_))}),O}function Le(e){return!(!Ze(e)||function(e){return!!J&&J in e}(e))&&(We(e)||z(e)?te:_).test($e(e))}function Ie(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Re(e,t,n,r){n||(n={});for(var i=-1,s=t.length;++i<s;){var o=t[i];_e(n,o,e[o])}return n}function Me(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function Be(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}Ae.prototype.clear=function(){this.__data__=be?be(null):{}},Ae.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ae.prototype.get=function(e){var t=this.__data__;if(be){var r=t[e];return r===n?void 0:r}return Q.call(t,e)?t[e]:void 0},Ae.prototype.has=function(e){var t=this.__data__;return be?void 0!==t[e]:Q.call(t,e)},Ae.prototype.set=function(e,t){return this.__data__[e]=be&&void 0===t?n:t,this},Se.prototype.clear=function(){this.__data__=[]},Se.prototype.delete=function(e){var t=this.__data__,n=Oe(t,e);return!(n<0)&&(n==t.length-1?t.pop():ae.call(t,n,1),!0)},Se.prototype.get=function(e){var t=this.__data__,n=Oe(t,e);return n<0?void 0:t[n][1]},Se.prototype.has=function(e){return Oe(this.__data__,e)>-1},Se.prototype.set=function(e,t){var n=this.__data__,r=Oe(n,e);return r<0?n.push([e,t]):n[r][1]=t,this},Ce.prototype.clear=function(){this.__data__={hash:new Ae,map:new(fe||Se),string:new Ae}},Ce.prototype.delete=function(e){return Me(this,e).delete(e)},Ce.prototype.get=function(e){return Me(this,e).get(e)},Ce.prototype.has=function(e){return Me(this,e).has(e)},Ce.prototype.set=function(e,t){return Me(this,e).set(e,t),this},je.prototype.clear=function(){this.__data__=new Se},je.prototype.delete=function(e){return this.__data__.delete(e)},je.prototype.get=function(e){return this.__data__.get(e)},je.prototype.has=function(e){return this.__data__.has(e)},je.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Se){var r=n.__data__;if(!fe||r.length<199)return r.push([e,t]),this;n=this.__data__=new Ce(r)}return n.set(e,t),this};var De=ce?H(ce,Object):function(){return[]},Pe=function(e){return ee.call(e)};function Fe(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||O.test(e))&&e>-1&&e%1==0&&e<t}function Ue(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||G)}function $e(e){if(null!=e){try{return X.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function ze(e,t){return e===t||e!=e&&t!=t}(de&&Pe(new de(new ArrayBuffer(1)))!=y||fe&&Pe(new fe)!=c||pe&&Pe(pe.resolve())!=d||me&&Pe(new me)!=p||ge&&Pe(new ge)!=b)&&(Pe=function(e){var t=ee.call(e),n=t==h?e.constructor:void 0,r=n?$e(n):void 0;if(r)switch(r){case ve:return y;case ye:return c;case xe:return d;case we:return p;case Ne:return b}return t});var Ve=Array.isArray;function He(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!We(e)}var Ke=ue||function(){return!1};function We(e){var t=Ze(e)?ee.call(e):"";return t==l||t==a}function Ze(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Ge(e){return He(e)?qe(e):function(e){if(!Ue(e))return he(e);var t=[];for(var n in Object(e))Q.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}e.exports=function(e){return Te(e,!0,!0)}}(Oi,Oi.exports)),Oi.exports}var Li,Ii={exports:{}};function Ri(){return Li||(Li=1,function(e,t){var n="__lodash_hash_undefined__",r=9007199254740991,i="[object Arguments]",s="[object Array]",o="[object Boolean]",l="[object Date]",a="[object Error]",c="[object Function]",u="[object Map]",h="[object Number]",d="[object Object]",f="[object Promise]",p="[object RegExp]",m="[object Set]",g="[object String]",b="[object Symbol]",v="[object WeakMap]",y="[object ArrayBuffer]",x="[object DataView]",w=/^\[object .+?Constructor\]$/,N=/^(?:0|[1-9]\d*)$/,E={};E["[object Float32Array]"]=E["[object Float64Array]"]=E["[object Int8Array]"]=E["[object Int16Array]"]=E["[object Int32Array]"]=E["[object Uint8Array]"]=E["[object Uint8ClampedArray]"]=E["[object Uint16Array]"]=E["[object Uint32Array]"]=!0,E[i]=E[s]=E[y]=E[o]=E[x]=E[l]=E[a]=E[c]=E[u]=E[h]=E[d]=E[p]=E[m]=E[g]=E[v]=!1;var k="object"==typeof U&&U&&U.Object===Object&&U,A="object"==typeof self&&self&&self.Object===Object&&self,S=k||A||Function("return this")(),C=t&&!t.nodeType&&t,j=C&&e&&!e.nodeType&&e,q=j&&j.exports===C,_=q&&k.process,O=function(){try{return _&&_.binding&&_.binding("util")}catch(e){}}(),T=O&&O.isTypedArray;function L(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function I(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function R(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var M=Array.prototype,B=Function.prototype,D=Object.prototype,P=S["__core-js_shared__"],F=B.toString,$=D.hasOwnProperty,z=function(){var e=/[^.]+$/.exec(P&&P.keys&&P.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),V=D.toString,H=RegExp("^"+F.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),K=q?S.Buffer:void 0,W=S.Symbol,Z=S.Uint8Array,G=D.propertyIsEnumerable,Y=M.splice,J=W?W.toStringTag:void 0,X=Object.getOwnPropertySymbols,Q=K?K.isBuffer:void 0,ee=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),te=qe(S,"DataView"),ne=qe(S,"Map"),re=qe(S,"Promise"),ie=qe(S,"Set"),se=qe(S,"WeakMap"),oe=qe(Object,"create"),le=Le(te),ae=Le(ne),ce=Le(re),ue=Le(ie),he=Le(se),de=W?W.prototype:void 0,fe=de?de.valueOf:void 0;function pe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function me(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ge(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function be(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new ge;++t<n;)this.add(e[t])}function ve(e){var t=this.__data__=new me(e);this.size=t.size}function ye(e,t){var n=Me(e),r=!n&&Re(e),i=!n&&!r&&Be(e),s=!n&&!r&&!i&&$e(e),o=n||r||i||s,l=o?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],a=l.length;for(var c in e)!$.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Te(c,a))||l.push(c);return l}function xe(e,t){for(var n=e.length;n--;)if(Ie(e[n][0],t))return n;return-1}function we(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":J&&J in Object(e)?function(e){var t=$.call(e,J),n=e[J];try{e[J]=void 0;var r=!0}catch(s){}var i=V.call(e);r&&(t?e[J]=n:delete e[J]);return i}(e):function(e){return V.call(e)}(e)}function Ne(e){return Ue(e)&&we(e)==i}function Ee(e,t,n,r,c){return e===t||(null==e||null==t||!Ue(e)&&!Ue(t)?e!=e&&t!=t:function(e,t,n,r,c,f){var v=Me(e),w=Me(t),N=v?s:Oe(e),E=w?s:Oe(t),k=(N=N==i?d:N)==d,A=(E=E==i?d:E)==d,S=N==E;if(S&&Be(e)){if(!Be(t))return!1;v=!0,k=!1}if(S&&!k)return f||(f=new ve),v||$e(e)?Se(e,t,n,r,c,f):function(e,t,n,r,i,s,c){switch(n){case x:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!s(new Z(e),new Z(t)));case o:case l:case h:return Ie(+e,+t);case a:return e.name==t.name&&e.message==t.message;case p:case g:return e==t+"";case u:var d=I;case m:var f=1&r;if(d||(d=R),e.size!=t.size&&!f)return!1;var v=c.get(e);if(v)return v==t;r|=2,c.set(e,t);var w=Se(d(e),d(t),r,i,s,c);return c.delete(e),w;case b:if(fe)return fe.call(e)==fe.call(t)}return!1}(e,t,N,n,r,c,f);if(!(1&n)){var C=k&&$.call(e,"__wrapped__"),j=A&&$.call(t,"__wrapped__");if(C||j){var q=C?e.value():e,_=j?t.value():t;return f||(f=new ve),c(q,_,n,r,f)}}if(!S)return!1;return f||(f=new ve),function(e,t,n,r,i,s){var o=1&n,l=Ce(e),a=l.length,c=Ce(t),u=c.length;if(a!=u&&!o)return!1;var h=a;for(;h--;){var d=l[h];if(!(o?d in t:$.call(t,d)))return!1}var f=s.get(e);if(f&&s.get(t))return f==t;var p=!0;s.set(e,t),s.set(t,e);var m=o;for(;++h<a;){var g=e[d=l[h]],b=t[d];if(r)var v=o?r(b,g,d,t,e,s):r(g,b,d,e,t,s);if(!(void 0===v?g===b||i(g,b,n,r,s):v)){p=!1;break}m||(m="constructor"==d)}if(p&&!m){var y=e.constructor,x=t.constructor;y==x||!("constructor"in e)||!("constructor"in t)||"function"==typeof y&&y instanceof y&&"function"==typeof x&&x instanceof x||(p=!1)}return s.delete(e),s.delete(t),p}(e,t,n,r,c,f)}(e,t,n,r,Ee,c))}function ke(e){return!(!Fe(e)||function(e){return!!z&&z in e}(e))&&(De(e)?H:w).test(Le(e))}function Ae(e){if(n=(t=e)&&t.constructor,r="function"==typeof n&&n.prototype||D,t!==r)return ee(e);var t,n,r,i=[];for(var s in Object(e))$.call(e,s)&&"constructor"!=s&&i.push(s);return i}function Se(e,t,n,r,i,s){var o=1&n,l=e.length,a=t.length;if(l!=a&&!(o&&a>l))return!1;var c=s.get(e);if(c&&s.get(t))return c==t;var u=-1,h=!0,d=2&n?new be:void 0;for(s.set(e,t),s.set(t,e);++u<l;){var f=e[u],p=t[u];if(r)var m=o?r(p,f,u,t,e,s):r(f,p,u,e,t,s);if(void 0!==m){if(m)continue;h=!1;break}if(d){if(!L(t,function(e,t){if(o=t,!d.has(o)&&(f===e||i(f,e,n,r,s)))return d.push(t);var o})){h=!1;break}}else if(f!==p&&!i(f,p,n,r,s)){h=!1;break}}return s.delete(e),s.delete(t),h}function Ce(e){return function(e,t,n){var r=t(e);return Me(e)?r:function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}(r,n(e))}(e,ze,_e)}function je(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function qe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return ke(n)?n:void 0}pe.prototype.clear=function(){this.__data__=oe?oe(null):{},this.size=0},pe.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},pe.prototype.get=function(e){var t=this.__data__;if(oe){var r=t[e];return r===n?void 0:r}return $.call(t,e)?t[e]:void 0},pe.prototype.has=function(e){var t=this.__data__;return oe?void 0!==t[e]:$.call(t,e)},pe.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=oe&&void 0===t?n:t,this},me.prototype.clear=function(){this.__data__=[],this.size=0},me.prototype.delete=function(e){var t=this.__data__,n=xe(t,e);return!(n<0)&&(n==t.length-1?t.pop():Y.call(t,n,1),--this.size,!0)},me.prototype.get=function(e){var t=this.__data__,n=xe(t,e);return n<0?void 0:t[n][1]},me.prototype.has=function(e){return xe(this.__data__,e)>-1},me.prototype.set=function(e,t){var n=this.__data__,r=xe(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},ge.prototype.clear=function(){this.size=0,this.__data__={hash:new pe,map:new(ne||me),string:new pe}},ge.prototype.delete=function(e){var t=je(this,e).delete(e);return this.size-=t?1:0,t},ge.prototype.get=function(e){return je(this,e).get(e)},ge.prototype.has=function(e){return je(this,e).has(e)},ge.prototype.set=function(e,t){var n=je(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},be.prototype.add=be.prototype.push=function(e){return this.__data__.set(e,n),this},be.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.clear=function(){this.__data__=new me,this.size=0},ve.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},ve.prototype.get=function(e){return this.__data__.get(e)},ve.prototype.has=function(e){return this.__data__.has(e)},ve.prototype.set=function(e,t){var n=this.__data__;if(n instanceof me){var r=n.__data__;if(!ne||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ge(r)}return n.set(e,t),this.size=n.size,this};var _e=X?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}(X(e),function(t){return G.call(e,t)}))}:function(){return[]},Oe=we;function Te(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||N.test(e))&&e>-1&&e%1==0&&e<t}function Le(e){if(null!=e){try{return F.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ie(e,t){return e===t||e!=e&&t!=t}(te&&Oe(new te(new ArrayBuffer(1)))!=x||ne&&Oe(new ne)!=u||re&&Oe(re.resolve())!=f||ie&&Oe(new ie)!=m||se&&Oe(new se)!=v)&&(Oe=function(e){var t=we(e),n=t==d?e.constructor:void 0,r=n?Le(n):"";if(r)switch(r){case le:return x;case ae:return u;case ce:return f;case ue:return m;case he:return v}return t});var Re=Ne(function(){return arguments}())?Ne:function(e){return Ue(e)&&$.call(e,"callee")&&!G.call(e,"callee")},Me=Array.isArray;var Be=Q||function(){return!1};function De(e){if(!Fe(e))return!1;var t=we(e);return t==c||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Pe(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}function Fe(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ue(e){return null!=e&&"object"==typeof e}var $e=T?function(e){return function(t){return e(t)}}(T):function(e){return Ue(e)&&Pe(e.length)&&!!E[we(e)]};function ze(e){return null!=(t=e)&&Pe(t.length)&&!De(t)?ye(e):Ae(e);var t}e.exports=function(e,t){return Ee(e,t)}}(Ii,Ii.exports)),Ii.exports}var Mi,Bi={};var Di,Pi={};function Fi(){return Di||(Di=1,Object.defineProperty(Pi,"__esModule",{value:!0}),(e||(e={})).length=function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"object"==typeof e.retain&&null!==e.retain?1:"string"==typeof e.insert?e.insert.length:1},Pi.default=e),Pi;var e}var Ui,$i,zi={};var Vi=($i||($i=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AttributeMap=t.OpIterator=t.Op=void 0;const n=qi(),r=Ti(),i=Ri(),s=function(){if(Mi)return Bi;Mi=1,Object.defineProperty(Bi,"__esModule",{value:!0});const e=Ti(),t=Ri();var n,r;return(r=n||(n={})).compose=function(t={},n={},r=!1){"object"!=typeof t&&(t={}),"object"!=typeof n&&(n={});let i=e(n);r||(i=Object.keys(i).reduce((e,t)=>(null!=i[t]&&(e[t]=i[t]),e),{}));for(const e in t)void 0!==t[e]&&void 0===n[e]&&(i[e]=t[e]);return Object.keys(i).length>0?i:void 0},r.diff=function(e={},n={}){"object"!=typeof e&&(e={}),"object"!=typeof n&&(n={});const r=Object.keys(e).concat(Object.keys(n)).reduce((r,i)=>(t(e[i],n[i])||(r[i]=void 0===n[i]?null:n[i]),r),{});return Object.keys(r).length>0?r:void 0},r.invert=function(e={},t={}){e=e||{};const n=Object.keys(t).reduce((n,r)=>(t[r]!==e[r]&&void 0!==e[r]&&(n[r]=t[r]),n),{});return Object.keys(e).reduce((n,r)=>(e[r]!==t[r]&&void 0===t[r]&&(n[r]=null),n),n)},r.transform=function(e,t,n=!1){if("object"!=typeof e)return t;if("object"!=typeof t)return;if(!n)return t;const r=Object.keys(t).reduce((n,r)=>(void 0===e[r]&&(n[r]=t[r]),n),{});return Object.keys(r).length>0?r:void 0},Bi.default=n,Bi}();t.AttributeMap=s.default;const o=Fi();t.Op=o.default;const l=function(){if(Ui)return zi;Ui=1,Object.defineProperty(zi,"__esModule",{value:!0});const e=Fi();return zi.default=class{constructor(e){this.ops=e,this.index=0,this.offset=0}hasNext(){return this.peekLength()<1/0}next(t){t||(t=1/0);const n=this.ops[this.index];if(n){const r=this.offset,i=e.default.length(n);if(t>=i-r?(t=i-r,this.index+=1,this.offset=0):this.offset+=t,"number"==typeof n.delete)return{delete:t};{const e={};return n.attributes&&(e.attributes=n.attributes),"number"==typeof n.retain?e.retain=t:"object"==typeof n.retain&&null!==n.retain?e.retain=n.retain:"string"==typeof n.insert?e.insert=n.insert.substr(r,t):e.insert=n.insert,e}}return{retain:1/0}}peek(){return this.ops[this.index]}peekLength(){return this.ops[this.index]?e.default.length(this.ops[this.index])-this.offset:1/0}peekType(){const e=this.ops[this.index];return e?"number"==typeof e.delete?"delete":"number"==typeof e.retain||"object"==typeof e.retain&&null!==e.retain?"retain":"insert":"retain"}rest(){if(this.hasNext()){if(0===this.offset)return this.ops.slice(this.index);{const e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)}}return[]}},zi}();t.OpIterator=l.default;const a=String.fromCharCode(0),c=(e,t)=>{if("object"!=typeof e||null===e)throw new Error("cannot retain a "+typeof e);if("object"!=typeof t||null===t)throw new Error("cannot retain a "+typeof t);const n=Object.keys(e)[0];if(!n||n!==Object.keys(t)[0])throw new Error(`embed types not matched: ${n} != ${Object.keys(t)[0]}`);return[n,e[n],t[n]]};class u{constructor(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]}static registerEmbed(e,t){this.handlers[e]=t}static unregisterEmbed(e){delete this.handlers[e]}static getHandler(e){const t=this.handlers[e];if(!t)throw new Error(`no handlers for embed type "${e}"`);return t}insert(e,t){const n={};return"string"==typeof e&&0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))}delete(e){return e<=0?this:this.push({delete:e})}retain(e,t){if("number"==typeof e&&e<=0)return this;const n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)}push(e){let t=this.ops.length,n=this.ops[t-1];if(e=r(e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,n=this.ops[t-1],"object"!=typeof n))return this.ops.unshift(e),this;if(i(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this}chop(){const e=this.ops[this.ops.length-1];return e&&"number"==typeof e.retain&&!e.attributes&&this.ops.pop(),this}filter(e){return this.ops.filter(e)}forEach(e){this.ops.forEach(e)}map(e){return this.ops.map(e)}partition(e){const t=[],n=[];return this.forEach(r=>{(e(r)?t:n).push(r)}),[t,n]}reduce(e,t){return this.ops.reduce(e,t)}changeLength(){return this.reduce((e,t)=>t.insert?e+o.default.length(t):t.delete?e-t.delete:e,0)}length(){return this.reduce((e,t)=>e+o.default.length(t),0)}slice(e=0,t=1/0){const n=[],r=new l.default(this.ops);let i=0;for(;i<t&&r.hasNext();){let s;i<e?s=r.next(e-i):(s=r.next(t-i),n.push(s)),i+=o.default.length(s)}return new u(n)}compose(e){const t=new l.default(this.ops),n=new l.default(e.ops),r=[],o=n.peek();if(null!=o&&"number"==typeof o.retain&&null==o.attributes){let e=o.retain;for(;"insert"===t.peekType()&&t.peekLength()<=e;)e-=t.peekLength(),r.push(t.next());o.retain-e>0&&n.next(o.retain-e)}const a=new u(r);for(;t.hasNext()||n.hasNext();)if("insert"===n.peekType())a.push(n.next());else if("delete"===t.peekType())a.push(t.next());else{const e=Math.min(t.peekLength(),n.peekLength()),r=t.next(e),o=n.next(e);if(o.retain){const l={};if("number"==typeof r.retain)l.retain="number"==typeof o.retain?e:o.retain;else if("number"==typeof o.retain)null==r.retain?l.insert=r.insert:l.retain=r.retain;else{const e=null==r.retain?"insert":"retain",[t,n,i]=c(r[e],o.retain),s=u.getHandler(t);l[e]={[t]:s.compose(n,i,"retain"===e)}}const h=s.default.compose(r.attributes,o.attributes,"number"==typeof r.retain);if(h&&(l.attributes=h),a.push(l),!n.hasNext()&&i(a.ops[a.ops.length-1],l)){const e=new u(t.rest());return a.concat(e).chop()}}else"number"==typeof o.delete&&("number"==typeof r.retain||"object"==typeof r.retain&&null!==r.retain)&&a.push(o)}return a.chop()}concat(e){const t=new u(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t}diff(e,t){if(this.ops===e.ops)return new u;const r=[this,e].map(t=>t.map(n=>{if(null!=n.insert)return"string"==typeof n.insert?n.insert:a;throw new Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")),o=new u,c=n(r[0],r[1],t,!0),h=new l.default(this.ops),d=new l.default(e.ops);return c.forEach(e=>{let t=e[1].length;for(;t>0;){let r=0;switch(e[0]){case n.INSERT:r=Math.min(d.peekLength(),t),o.push(d.next(r));break;case n.DELETE:r=Math.min(t,h.peekLength()),h.next(r),o.delete(r);break;case n.EQUAL:r=Math.min(h.peekLength(),d.peekLength(),t);const e=h.next(r),l=d.next(r);i(e.insert,l.insert)?o.retain(r,s.default.diff(e.attributes,l.attributes)):o.push(l).delete(r)}t-=r}}),o.chop()}eachLine(e,t="\n"){const n=new l.default(this.ops);let r=new u,i=0;for(;n.hasNext();){if("insert"!==n.peekType())return;const s=n.peek(),l=o.default.length(s)-n.peekLength(),a="string"==typeof s.insert?s.insert.indexOf(t,l)-l:-1;if(a<0)r.push(n.next());else if(a>0)r.push(n.next(a));else{if(!1===e(r,n.next(1).attributes||{},i))return;i+=1,r=new u}}r.length()>0&&e(r,{},i)}invert(e){const t=new u;return this.reduce((n,r)=>{if(r.insert)t.delete(o.default.length(r));else{if("number"==typeof r.retain&&null==r.attributes)return t.retain(r.retain),n+r.retain;if(r.delete||"number"==typeof r.retain){const i=r.delete||r.retain;return e.slice(n,n+i).forEach(e=>{r.delete?t.push(e):r.retain&&r.attributes&&t.retain(o.default.length(e),s.default.invert(r.attributes,e.attributes))}),n+i}if("object"==typeof r.retain&&null!==r.retain){const i=e.slice(n,n+1),o=new l.default(i.ops).next(),[a,h,d]=c(r.retain,o.insert),f=u.getHandler(a);return t.retain({[a]:f.invert(h,d)},s.default.invert(r.attributes,o.attributes)),n+1}}return n},0),t.chop()}transform(e,t=!1){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);const n=e,r=new l.default(this.ops),i=new l.default(n.ops),a=new u;for(;r.hasNext()||i.hasNext();)if("insert"!==r.peekType()||!t&&"insert"===i.peekType())if("insert"===i.peekType())a.push(i.next());else{const e=Math.min(r.peekLength(),i.peekLength()),n=r.next(e),o=i.next(e);if(n.delete)continue;if(o.delete)a.push(o);else{const r=n.retain,i=o.retain;let l="object"==typeof i&&null!==i?i:e;if("object"==typeof r&&null!==r&&"object"==typeof i&&null!==i){const e=Object.keys(r)[0];if(e===Object.keys(i)[0]){const n=u.getHandler(e);n&&(l={[e]:n.transform(r[e],i[e],t)})}}a.retain(l,s.default.transform(n.attributes,o.attributes,t))}}else a.retain(o.default.length(r.next()));return a.chop()}transformPosition(e,t=!1){t=!!t;const n=new l.default(this.ops);let r=0;for(;n.hasNext()&&r<=e;){const i=n.peekLength(),s=n.peekType();n.next(),"delete"!==s?("insert"===s&&(r<e||!t)&&(e+=i),r+=i):e-=Math.min(i,e-r)}return e}}u.Op=o.default,u.OpIterator=l.default,u.AttributeMap=s.default,u.handlers={},t.default=u,e.exports=u,e.exports.default=u}(ji,ji.exports)),ji.exports);const Hi=$(Vi);class Ki extends yi{static value(){}optimize(){(this.prev||this.next)&&this.remove()}length(){return 0}value(){return""}}Ki.blotName="break",Ki.tagName="BR";let Wi=class extends ki{};const Zi={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Gi(e){return e.replace(/[&<>"']/g,e=>Zi[e])}const Yi=class e extends pi{static compare(t,n){const r=e.order.indexOf(t),i=e.order.indexOf(n);return r>=0||i>=0?r-i:t===n?0:t<n?-1:1}formatAt(t,n,r,i){if(e.compare(this.statics.blotName,r)<0&&this.scroll.query(r,Gr.BLOT)){const e=this.isolate(t,n);i&&e.wrap(r,i)}else super.formatAt(t,n,r,i)}optimize(t){if(super.optimize(t),this.parent instanceof e&&e.compare(this.statics.blotName,this.parent.statics.blotName)>0){const e=this.parent.isolate(this.offset(),this.length());this.moveChildren(e),e.wrap(this)}}};t(Yi,"allowedChildren",[Yi,Ki,yi,Wi]),t(Yi,"order",["cursor","inline","link","underline","strike","italic","bold","script","code"]);let Ji=Yi;class Xi extends gi{constructor(){super(...arguments),t(this,"cache",{})}delta(){return null==this.cache.delta&&(this.cache.delta=es(this)),this.cache.delta}deleteAt(e,t){super.deleteAt(e,t),this.cache={}}formatAt(e,t,n,r){t<=0||(this.scroll.query(n,Gr.BLOCK)?e+t===this.length()&&this.format(n,r):super.formatAt(e,Math.min(t,this.length()-e-1),n,r),this.cache={})}insertAt(e,t,n){if(null!=n)return super.insertAt(e,t,n),void(this.cache={});if(0===t.length)return;const r=t.split("\n"),i=r.shift();i.length>0&&(e<this.length()-1||null==this.children.tail?super.insertAt(Math.min(e,this.length()-1),i):this.children.tail.insertAt(this.children.tail.length(),i),this.cache={});let s=this;r.reduce((e,t)=>(s=s.split(e,!0),s.insertAt(0,t),t.length),e+i.length)}insertBefore(e,t){const{head:n}=this.children;super.insertBefore(e,t),n instanceof Ki&&n.remove(),this.cache={}}length(){return null==this.cache.length&&(this.cache.length=super.length()+1),this.cache.length}moveChildren(e,t){super.moveChildren(e,t),this.cache={}}optimize(e){super.optimize(e),this.cache={}}path(e){return super.path(e,!0)}removeChild(e){super.removeChild(e),this.cache={}}split(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t&&(0===e||e>=this.length()-1)){const t=this.clone();return 0===e?(this.parent.insertBefore(t,this),this):(this.parent.insertBefore(t,this.next),t)}const n=super.split(e,t);return this.cache={},n}}Xi.blotName="block",Xi.tagName="P",Xi.defaultChild=Ki,Xi.allowedChildren=[Ki,Ji,yi,Wi];class Qi extends yi{attach(){super.attach(),this.attributes=new ii(this.domNode)}delta(){return(new Hi).insert(this.value(),{...this.formats(),...this.attributes.values()})}format(e,t){const n=this.scroll.query(e,Gr.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}formatAt(e,t,n,r){this.format(n,r)}insertAt(e,t,n){if(null!=n)return void super.insertAt(e,t,n);const r=t.split("\n"),i=r.pop(),s=r.map(e=>{const t=this.scroll.create(Xi.blotName);return t.insertAt(0,e),t}),o=this.split(e);s.forEach(e=>{this.parent.insertBefore(e,o)}),i&&this.parent.insertBefore(this.scroll.create("text",i),o)}}function es(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e.descendants(ai).reduce((e,n)=>0===n.length()?e:e.insert(n.value(),ts(n,{},t)),new Hi).insert("\n",ts(e))}function ts(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return null==e?t:("formats"in e&&"function"==typeof e.formats&&(t={...t,...e.formats()},n&&delete t["code-token"]),null==e.parent||"scroll"===e.parent.statics.blotName||e.parent.statics.scope!==e.statics.scope?t:ts(e.parent,t,n))}Qi.scope=Gr.BLOCK_BLOT;const ns=class e extends yi{static value(){}constructor(t,n,r){super(t,n),this.selection=r,this.textNode=document.createTextNode(e.CONTENTS),this.domNode.appendChild(this.textNode),this.savedLength=0}detach(){null!=this.parent&&this.parent.removeChild(this)}format(t,n){if(0!==this.savedLength)return void super.format(t,n);let r=this,i=0;for(;null!=r&&r.statics.scope!==Gr.BLOCK_BLOT;)i+=r.offset(r.parent),r=r.parent;null!=r&&(this.savedLength=e.CONTENTS.length,r.optimize(),r.formatAt(i,e.CONTENTS.length,t,n),this.savedLength=0)}index(e,t){return e===this.textNode?0:super.index(e,t)}length(){return this.savedLength}position(){return[this.textNode,this.textNode.data.length]}remove(){super.remove(),this.parent=null}restore(){if(this.selection.composing||null==this.parent)return null;const t=this.selection.getNativeRange();for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);const n=this.prev instanceof Wi?this.prev:null,r=n?n.length():0,i=this.next instanceof Wi?this.next:null,s=i?i.text:"",{textNode:o}=this,l=o.data.split(e.CONTENTS).join("");let a;if(o.data=e.CONTENTS,n)a=n,(l||i)&&(n.insertAt(n.length(),l+s),i&&i.remove());else if(i)a=i,i.insertAt(0,l);else{const e=document.createTextNode(l);a=this.scroll.create(e),this.parent.insertBefore(a,this)}if(this.remove(),t){const e=(e,t)=>n&&e===n.domNode?t:e===o?r+t-1:i&&e===i.domNode?r+l.length+t:null,s=e(t.start.node,t.start.offset),c=e(t.end.node,t.end.offset);if(null!==s&&null!==c)return{startNode:a.domNode,startOffset:s,endNode:a.domNode,endOffset:c}}return null}update(e,t){if(e.some(e=>"characterData"===e.type&&e.target===this.textNode)){const e=this.restore();e&&(t.range=e)}}optimize(t){super.optimize(t);let{parent:n}=this;for(;n;){if("A"===n.domNode.tagName){this.savedLength=e.CONTENTS.length,n.isolate(this.offset(n),this.length()).unwrap(),this.savedLength=0;break}n=n.parent}}value(){return""}};t(ns,"blotName","cursor"),t(ns,"className","ql-cursor"),t(ns,"tagName","span"),t(ns,"CONTENTS","\ufeff");let rs=ns;var is,ss={exports:{}};var os=(is||(is=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function s(e,t,r,s,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var l=new i(r,s||e,o),a=n?n+t:t;return e._events[a]?e._events[a].fn?e._events[a]=[e._events[a],l]:e._events[a].push(l):(e._events[a]=l,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function l(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),l.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},l.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,s=r.length,o=new Array(s);i<s;i++)o[i]=r[i].fn;return o},l.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},l.prototype.emit=function(e,t,r,i,s,o){var l=n?n+e:e;if(!this._events[l])return!1;var a,c,u=this._events[l],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,s),!0;case 6:return u.fn.call(u.context,t,r,i,s,o),!0}for(c=1,a=new Array(h-1);c<h;c++)a[c-1]=arguments[c];u.fn.apply(u.context,a)}else{var d,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),h){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,r);break;case 4:u[c].fn.call(u[c].context,t,r,i);break;default:if(!a)for(d=1,a=new Array(h-1);d<h;d++)a[d-1]=arguments[d];u[c].fn.apply(u[c].context,a)}}return!0},l.prototype.on=function(e,t,n){return s(this,e,t,n,!1)},l.prototype.once=function(e,t,n){return s(this,e,t,n,!0)},l.prototype.removeListener=function(e,t,r,i){var s=n?n+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var l=this._events[s];if(l.fn)l.fn!==t||i&&!l.once||r&&l.context!==r||o(this,s);else{for(var a=0,c=[],u=l.length;a<u;a++)(l[a].fn!==t||i&&!l[a].once||r&&l[a].context!==r)&&c.push(l[a]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},l.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,e.exports=l}(ss)),ss.exports);const ls=$(os),as=new WeakMap,cs=["error","warn","log","info"];let us="warn";function hs(e){if(us&&cs.indexOf(e)<=cs.indexOf(us))for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r]}function ds(e){return cs.reduce((t,n)=>(t[n]=hs.bind(console,n,e),t),{})}ds.level=e=>{us=e},hs.level=ds.level;const fs=ds("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(e=>{document.addEventListener(e,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];Array.from(document.querySelectorAll(".ql-container")).forEach(e=>{const n=as.get(e);n&&n.emitter&&n.emitter.handleDOM(...t)})})});class ps extends ls{constructor(){super(),this.domListeners={},this.on("error",fs.error)}emit(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return fs.log.call(fs,...t),super.emit(...t)}handleDOM(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.domListeners[e.type]||[]).forEach(t=>{let{node:r,handler:i}=t;(e.target===r||r.contains(e.target))&&i(e,...n)})}listenDOM(e,t,n){this.domListeners[e]||(this.domListeners[e]=[]),this.domListeners[e].push({node:t,handler:n})}}t(ps,"events",{EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_BLOT_MOUNT:"scroll-blot-mount",SCROLL_BLOT_UNMOUNT:"scroll-blot-unmount",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SCROLL_EMBED_UPDATE:"scroll-embed-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change",COMPOSITION_BEFORE_START:"composition-before-start",COMPOSITION_START:"composition-start",COMPOSITION_BEFORE_END:"composition-before-end",COMPOSITION_END:"composition-end"}),t(ps,"sources",{API:"api",SILENT:"silent",USER:"user"});const ms=ds("quill:selection");class gs{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.index=e,this.length=t}}class bs{constructor(e,t){this.emitter=t,this.scroll=e,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=this.scroll.create("cursor",this),this.savedRange=new gs(0,0),this.lastRange=this.savedRange,this.lastNative=null,this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,()=>{this.mouseDown||this.composing||setTimeout(this.update.bind(this,ps.sources.USER),1)}),this.emitter.on(ps.events.SCROLL_BEFORE_UPDATE,()=>{if(!this.hasFocus())return;const e=this.getNativeRange();null!=e&&e.start.node!==this.cursor.textNode&&this.emitter.once(ps.events.SCROLL_UPDATE,(t,n)=>{try{this.root.contains(e.start.node)&&this.root.contains(e.end.node)&&this.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset);const r=n.some(e=>"characterData"===e.type||"childList"===e.type||"attributes"===e.type&&e.target===this.root);this.update(r?ps.sources.SILENT:t)}catch(r){}})}),this.emitter.on(ps.events.SCROLL_OPTIMIZE,(e,t)=>{if(t.range){const{startNode:e,startOffset:n,endNode:r,endOffset:i}=t.range;this.setNativeRange(e,n,r,i),this.update(ps.sources.SILENT)}}),this.update(ps.sources.SILENT)}handleComposition(){this.emitter.on(ps.events.COMPOSITION_BEFORE_START,()=>{this.composing=!0}),this.emitter.on(ps.events.COMPOSITION_END,()=>{if(this.composing=!1,this.cursor.parent){const e=this.cursor.restore();if(!e)return;setTimeout(()=>{this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)},1)}})}handleDragging(){this.emitter.listenDOM("mousedown",document.body,()=>{this.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,()=>{this.mouseDown=!1,this.update(ps.sources.USER)})}focus(){this.hasFocus()||(this.root.focus({preventScroll:!0}),this.setRange(this.savedRange))}format(e,t){this.scroll.update();const n=this.getNativeRange();if(null!=n&&n.native.collapsed&&!this.scroll.query(e,Gr.BLOCK)){if(n.start.node!==this.cursor.textNode){const e=this.scroll.find(n.start.node,!1);if(null==e)return;if(e instanceof ai){const t=e.split(n.start.offset);e.parent.insertBefore(this.cursor,t)}else e.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.scroll.length();let r;e=Math.min(e,n-1),t=Math.min(e+t,n-1)-e;let[i,s]=this.scroll.leaf(e);if(null==i)return null;if(t>0&&s===i.length()){const[t]=this.scroll.leaf(e+1);if(t){const[n]=this.scroll.line(e),[r]=this.scroll.line(e+1);n===r&&(i=t,s=0)}}[r,s]=i.position(s,!0);const o=document.createRange();if(t>0)return o.setStart(r,s),[i,s]=this.scroll.leaf(e+t),null==i?null:([r,s]=i.position(s,!0),o.setEnd(r,s),o.getBoundingClientRect());let l,a="left";if(r instanceof Text){if(!r.data.length)return null;s<r.data.length?(o.setStart(r,s),o.setEnd(r,s+1)):(o.setStart(r,s-1),o.setEnd(r,s),a="right"),l=o.getBoundingClientRect()}else{if(!(i.domNode instanceof Element))return null;l=i.domNode.getBoundingClientRect(),s>0&&(a="right")}return{bottom:l.top+l.height,height:l.height,left:l[a],right:l[a],top:l.top,width:0}}getNativeRange(){const e=document.getSelection();if(null==e||e.rangeCount<=0)return null;const t=e.getRangeAt(0);if(null==t)return null;const n=this.normalizeNative(t);return ms.info("getNativeRange",n),n}getRange(){const e=this.scroll.domNode;if("isConnected"in e&&!e.isConnected)return[null,null];const t=this.getNativeRange();if(null==t)return[null,null];return[this.normalizedToRange(t),t]}hasFocus(){return document.activeElement===this.root||null!=document.activeElement&&vs(this.root,document.activeElement)}normalizedToRange(e){const t=[[e.start.node,e.start.offset]];e.native.collapsed||t.push([e.end.node,e.end.offset]);const n=t.map(e=>{const[t,n]=e,r=this.scroll.find(t,!0),i=r.offset(this.scroll);return 0===n?i:r instanceof ai?i+r.index(t,n):i+r.length()}),r=Math.min(Math.max(...n),this.scroll.length()-1),i=Math.min(r,...n);return new gs(i,r-i)}normalizeNative(e){if(!vs(this.root,e.startContainer)||!e.collapsed&&!vs(this.root,e.endContainer))return null;const t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(e=>{let{node:t,offset:n}=e;for(;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else{if(t.childNodes.length!==n)break;t=t.lastChild,n=t instanceof Text?t.data.length:t.childNodes.length>0?t.childNodes.length:t.childNodes.length+1}e.node=t,e.offset=n}),t}rangeToNative(e){const t=this.scroll.length(),n=(e,n)=>{e=Math.min(t-1,e);const[r,i]=this.scroll.leaf(e);return r?r.position(i,n):[null,-1]};return[...n(e.index,!1),...n(e.index+e.length,!0)]}setNativeRange(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(ms.info("setNativeRange",e,t,n,r),null!=e&&(null==this.root.parentNode||null==e.parentNode||null==n.parentNode))return;const s=document.getSelection();if(null!=s)if(null!=e){this.hasFocus()||this.root.focus({preventScroll:!0});const{native:o}=this.getNativeRange()||{};if(null==o||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){e instanceof Element&&"BR"===e.tagName&&(t=Array.from(e.parentNode.childNodes).indexOf(e),e=e.parentNode),n instanceof Element&&"BR"===n.tagName&&(r=Array.from(n.parentNode.childNodes).indexOf(n),n=n.parentNode);const i=document.createRange();i.setStart(e,t),i.setEnd(n,r),s.removeAllRanges(),s.addRange(i)}}else s.removeAllRanges(),this.root.blur()}setRange(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ps.sources.API;if("string"==typeof t&&(n=t,t=!1),ms.info("setRange",e),null!=e){const n=this.rangeToNative(e);this.setNativeRange(...n,t)}else this.setNativeRange(null);this.update(n)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ps.sources.USER;const t=this.lastRange,[n,r]=this.getRange();if(this.lastRange=n,this.lastNative=r,null!=this.lastRange&&(this.savedRange=this.lastRange),!Kr(t,this.lastRange)){if(!this.composing&&null!=r&&r.native.collapsed&&r.start.node!==this.cursor.textNode){const e=this.cursor.restore();e&&this.setNativeRange(e.startNode,e.startOffset,e.endNode,e.endOffset)}const n=[ps.events.SELECTION_CHANGE,Ar(this.lastRange),Ar(t),e];this.emitter.emit(ps.events.EDITOR_CHANGE,...n),e!==ps.sources.SILENT&&this.emitter.emit(...n)}}}function vs(e,t){try{t.parentNode}catch(n){return!1}return e.contains(t)}const ys=/^[ -~]*$/;class xs{constructor(e){this.scroll=e,this.delta=this.getDelta()}applyDelta(e){this.scroll.update();let t=this.scroll.length();this.scroll.batchStart();const n=As(e),r=new Hi;return function(e){const t=[];return e.forEach(e=>{if("string"==typeof e.insert){e.insert.split("\n").forEach((n,r)=>{r&&t.push({insert:"\n",attributes:e.attributes}),n&&t.push({insert:n,attributes:e.attributes})})}else t.push(e)}),t}(n.ops.slice()).reduce((e,n)=>{const i=Vi.Op.length(n);let s=n.attributes||{},o=!1,l=!1;if(null!=n.insert){if(r.retain(i),"string"==typeof n.insert){const r=n.insert;l=!r.endsWith("\n")&&(t<=e||!!this.scroll.descendant(Qi,e)[0]),this.scroll.insertAt(e,r);const[i,o]=this.scroll.line(e);let a=Zr({},ts(i));if(i instanceof Xi){const[e]=i.descendant(ai,o);e&&(a=Zr(a,ts(e)))}s=Vi.AttributeMap.diff(a,s)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return e;const i=null!=this.scroll.query(r,Gr.INLINE);if(i)(t<=e||this.scroll.descendant(Qi,e)[0])&&(l=!0);else if(e>0){const[t,n]=this.scroll.descendant(ai,e-1);if(t instanceof Wi){"\n"!==t.value()[n]&&(o=!0)}else t instanceof yi&&t.statics.scope===Gr.INLINE_BLOT&&(o=!0)}if(this.scroll.insertAt(e,r,n.insert[r]),i){const[t]=this.scroll.descendant(ai,e);if(t){const e=Zr({},ts(t));s=Vi.AttributeMap.diff(e,s)||{}}}}t+=i}else if(r.push(n),null!==n.retain&&"object"==typeof n.retain){const t=Object.keys(n.retain)[0];if(null==t)return e;this.scroll.updateEmbedAt(e,t,n.retain[t])}Object.keys(s).forEach(t=>{this.scroll.formatAt(e,i,t,s[t])});const a=o?1:0,c=l?1:0;return t+=a+c,r.retain(a),r.delete(c),e+i+a+c},0),r.reduce((e,t)=>"number"==typeof t.delete?(this.scroll.deleteAt(e,t.delete),e):e+Vi.Op.length(t),0),this.scroll.batchEnd(),this.scroll.optimize(),this.update(n)}deleteText(e,t){return this.scroll.deleteAt(e,t),this.update((new Hi).retain(e).delete(t))}formatLine(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.scroll.update(),Object.keys(n).forEach(r=>{this.scroll.lines(e,Math.max(t,1)).forEach(e=>{e.format(r,n[r])})}),this.scroll.optimize();const r=(new Hi).retain(e).retain(t,Ar(n));return this.update(r)}formatText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t,r,n[r])});const r=(new Hi).retain(e).retain(t,Ar(n));return this.update(r)}getContents(e,t){return this.delta.slice(e,e+t)}getDelta(){return this.scroll.lines().reduce((e,t)=>e.concat(t.delta()),new Hi)}getFormat(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(e=>{const[t]=e;t instanceof Xi?n.push(t):t instanceof ai&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(ai,e,t));const[i,s]=[n,r].map(e=>{const t=e.shift();if(null==t)return{};let n=ts(t);for(;Object.keys(n).length>0;){const t=e.shift();if(null==t)return n;n=Es(ts(t),n)}return n});return{...i,...s}}getHTML(e,t){const[n,r]=this.scroll.line(e);if(n){const i=n.length();return!(n.length()>=r+t)||0===r&&t===i?Ns(this.scroll,e,t,!0):Ns(n,r,t,!0)}return""}getText(e,t){return this.getContents(e,t).filter(e=>"string"==typeof e.insert).map(e=>e.insert).join("")}insertContents(e,t){const n=As(t),r=(new Hi).retain(e).concat(n);return this.scroll.insertContents(e,n),this.update(r)}insertEmbed(e,t,n){return this.scroll.insertAt(e,t,n),this.update((new Hi).retain(e).insert({[t]:n}))}insertText(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(n).forEach(r=>{this.scroll.formatAt(e,t.length,r,n[r])}),this.update((new Hi).retain(e).insert(t,Ar(n)))}isBlank(){if(0===this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;const e=this.scroll.children.head;if((null==e?void 0:e.statics.blotName)!==Xi.blotName)return!1;const t=e;return!(t.children.length>1)&&t.children.head instanceof Ki}removeFormat(e,t){const n=this.getText(e,t),[r,i]=this.scroll.line(e+t);let s=0,o=new Hi;null!=r&&(s=r.length()-i,o=r.delta().slice(i,i+s-1).insert("\n"));const l=this.getContents(e,t+s).diff((new Hi).insert(n).concat(o)),a=(new Hi).retain(e).concat(l);return this.applyDelta(a)}update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;const r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(ys)&&this.scroll.find(t[0].target)){const i=this.scroll.find(t[0].target),s=ts(i),o=i.offset(this.scroll),l=t[0].oldValue.replace(rs.CONTENTS,""),a=(new Hi).insert(l),c=(new Hi).insert(i.value()),u=n&&{oldRange:Ss(n.oldRange,-o),newRange:Ss(n.newRange,-o)};e=(new Hi).retain(o).concat(a.diff(c,u)).reduce((e,t)=>t.insert?e.insert(t.insert,s):e.push(t),new Hi),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&Kr(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}function ws(e,t,n){if(0===e.length){const[e]=ks(n.pop());return t<=0?`</li></${e}>`:`</li></${e}>${ws([],t-1,n)}`}const[{child:r,offset:i,length:s,indent:o,type:l},...a]=e,[c,u]=ks(l);if(o>t)return n.push(l),o===t+1?`<${c}><li${u}>${Ns(r,i,s)}${ws(a,o,n)}`:`<${c}><li>${ws(e,t+1,n)}`;const h=n[n.length-1];if(o===t&&l===h)return`</li><li${u}>${Ns(r,i,s)}${ws(a,o,n)}`;const[d]=ks(n.pop());return`</li></${d}>${ws(e,t-1,n)}`}function Ns(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("html"in e&&"function"==typeof e.html)return e.html(t,n);if(e instanceof Wi){return Gi(e.value().slice(t,t+n)).replaceAll(" ","&nbsp;")}if(e instanceof di){if("list-container"===e.statics.blotName){const r=[];return e.children.forEachAt(t,n,(e,t,n)=>{const i="formats"in e&&"function"==typeof e.formats?e.formats():{};r.push({child:e,offset:t,length:n,indent:i.indent||0,type:i.list})}),ws(r,-1,[])}const i=[];if(e.children.forEachAt(t,n,(e,t,n)=>{i.push(Ns(e,t,n))}),r||"list"===e.statics.blotName)return i.join("");const{outerHTML:s,innerHTML:o}=e.domNode,[l,a]=s.split(`>${o}<`);return"<table"===l?`<table style="border: 1px solid #000;">${i.join("")}<${a}`:`${l}>${i.join("")}<${a}`}return e.domNode instanceof Element?e.domNode.outerHTML:""}function Es(e,t){return Object.keys(t).reduce((n,r)=>{if(null==e[r])return n;const i=t[r];return i===e[r]?n[r]=i:Array.isArray(i)?i.indexOf(e[r])<0?n[r]=i.concat([e[r]]):n[r]=i:n[r]=[i,e[r]],n},{})}function ks(e){const t="ordered"===e?"ol":"ul";switch(e){case"checked":return[t,' data-list="checked"'];case"unchecked":return[t,' data-list="unchecked"'];default:return[t,""]}}function As(e){return e.reduce((e,t)=>{if("string"==typeof t.insert){const n=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(n,t.attributes)}return e.push(t)},new Hi)}function Ss(e,t){let{index:n,length:r}=e;return new gs(n+t,r)}class Cs{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.quill=e,this.options=t}}t(Cs,"DEFAULTS",{});const js="\ufeff";class qs extends yi{constructor(e,t){super(e,t),this.contentNode=document.createElement("span"),this.contentNode.setAttribute("contenteditable","false"),Array.from(this.domNode.childNodes).forEach(e=>{this.contentNode.appendChild(e)}),this.leftGuard=document.createTextNode(js),this.rightGuard=document.createTextNode(js),this.domNode.appendChild(this.leftGuard),this.domNode.appendChild(this.contentNode),this.domNode.appendChild(this.rightGuard)}index(e,t){return e===this.leftGuard?0:e===this.rightGuard?1:super.index(e,t)}restore(e){let t,n=null;const r=e.data.split(js).join("");if(e===this.leftGuard)if(this.prev instanceof Wi){const e=this.prev.length();this.prev.insertAt(e,r),n={startNode:this.prev.domNode,startOffset:e+r.length}}else t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this),n={startNode:t,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof Wi?(this.next.insertAt(0,r),n={startNode:this.next.domNode,startOffset:r.length}):(t=document.createTextNode(r),this.parent.insertBefore(this.scroll.create(t),this.next),n={startNode:t,startOffset:r.length}));return e.data=js,n}update(e,t){e.forEach(e=>{if("characterData"===e.type&&(e.target===this.leftGuard||e.target===this.rightGuard)){const n=this.restore(e.target);n&&(t.range=n)}})}}class _s{constructor(e,n){t(this,"isComposing",!1),this.scroll=e,this.emitter=n,this.setupListeners()}setupListeners(){this.scroll.domNode.addEventListener("compositionstart",e=>{this.isComposing||this.handleCompositionStart(e)}),this.scroll.domNode.addEventListener("compositionend",e=>{this.isComposing&&queueMicrotask(()=>{this.handleCompositionEnd(e)})})}handleCompositionStart(e){const t=e.target instanceof Node?this.scroll.find(e.target,!0):null;!t||t instanceof qs||(this.emitter.emit(ps.events.COMPOSITION_BEFORE_START,e),this.scroll.batchStart(),this.emitter.emit(ps.events.COMPOSITION_START,e),this.isComposing=!0)}handleCompositionEnd(e){this.emitter.emit(ps.events.COMPOSITION_BEFORE_END,e),this.scroll.batchEnd(),this.emitter.emit(ps.events.COMPOSITION_END,e),this.isComposing=!1}}const Os=class{constructor(e,n){t(this,"modules",{}),this.quill=e,this.options=n}init(){Object.keys(this.options.modules).forEach(e=>{null==this.modules[e]&&this.addModule(e)})}addModule(e){const t=this.quill.constructor.import(`modules/${e}`);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}};t(Os,"DEFAULTS",{modules:{}}),t(Os,"themes",{default:Os});let Ts=Os;const Ls=e=>e.parentElement||e.getRootNode().host||null,Is=e=>{const t=e.getBoundingClientRect(),n="offsetWidth"in e&&Math.abs(t.width)/e.offsetWidth||1,r="offsetHeight"in e&&Math.abs(t.height)/e.offsetHeight||1;return{top:t.top,right:t.left+e.clientWidth*n,bottom:t.top+e.clientHeight*r,left:t.left}},Rs=e=>{const t=parseInt(e,10);return Number.isNaN(t)?0:t},Ms=(e,t,n,r,i,s)=>e<n&&t>r?0:e<n?-(n-e+i):t>r?t-e>r-n?e+i-n:t-r+s:0,Bs=["block","break","cursor","inline","scroll","text"],Ds=ds("quill"),Ps=new Qr;di.uiClass="ql-ui";const Fs=class e{static debug(e){!0===e&&(e="log"),ds.level(e)}static find(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return as.get(e)||Ps.find(e,t)}static import(e){return null==this.imports[e]&&Ds.error(`Cannot import ${e}. Are you sure it was registered?`),this.imports[e]}static register(){if("string"!=typeof(arguments.length<=0?void 0:arguments[0])){const e=arguments.length<=0?void 0:arguments[0],t=!!(arguments.length<=1?void 0:arguments[1]),n="attrName"in e?e.attrName:e.blotName;"string"==typeof n?this.register(`formats/${n}`,e,t):Object.keys(e).forEach(n=>{this.register(n,e[n],t)})}else{const e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=!!(arguments.length<=2?void 0:arguments[2]);null==this.imports[e]||n||Ds.warn(`Overwriting ${e} with`,t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&t&&"boolean"!=typeof t&&"abstract"!==t.blotName&&Ps.register(t),"function"==typeof t.register&&t.register(Ps)}}constructor(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.options=function(e,t){const n=$s(e);if(!n)throw new Error("Invalid Quill container");const r=!t.theme||t.theme===Us.DEFAULTS.theme,i=r?Ts:Us.import(`themes/${t.theme}`);if(!i)throw new Error(`Invalid theme ${t.theme}. Did you register it?`);const{modules:s,...o}=Us.DEFAULTS,{modules:l,...a}=i.DEFAULTS;let c=zs(t.modules);null!=c&&c.toolbar&&c.toolbar.constructor!==Object&&(c={...c,toolbar:{container:c.toolbar}});const u=Zr({},zs(s),zs(l),c),h={...o,...Vs(a),...Vs(t)};let d=t.registry;d?t.formats&&Ds.warn('Ignoring "formats" option because "registry" is specified'):d=t.formats?((e,t,n)=>{const r=new Qr;return Bs.forEach(e=>{const n=t.query(e);n&&r.register(n)}),e.forEach(e=>{let i=t.query(e);i||n.error(`Cannot register "${e}" specified in "formats" config. Are you sure it was registered?`);let s=0;for(;i;)if(r.register(i),i="blotName"in i?i.requiredContainer??null:null,s+=1,s>100){n.error(`Cycle detected in registering blot requiredContainer: "${e}"`);break}}),r})(t.formats,h.registry,Ds):h.registry;return{...h,registry:d,container:n,theme:i,modules:Object.entries(u).reduce((e,t)=>{let[n,r]=t;if(!r)return e;const i=Us.import(`modules/${n}`);return null==i?(Ds.error(`Cannot load ${n} module. Are you sure you registered it?`),e):{...e,[n]:Zr({},i.DEFAULTS||{},r)}},{}),bounds:$s(h.bounds)}}(t,n),this.container=this.options.container,null==this.container)return void Ds.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);const r=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",as.set(this.container,this),this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.emitter=new ps;const i=Ni.blotName,s=this.options.registry.query(i);if(!s||!("blotName"in s))throw new Error(`Cannot initialize Quill without "${i}" blot`);if(this.scroll=new s(this.options.registry,this.root,{emitter:this.emitter}),this.editor=new xs(this.scroll),this.selection=new bs(this.scroll,this.emitter),this.composition=new _s(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.uploader=this.theme.addModule("uploader"),this.theme.addModule("input"),this.theme.addModule("uiNode"),this.theme.init(),this.emitter.on(ps.events.EDITOR_CHANGE,e=>{e===ps.events.TEXT_CHANGE&&this.root.classList.toggle("ql-blank",this.editor.isBlank())}),this.emitter.on(ps.events.SCROLL_UPDATE,(e,t)=>{const n=this.selection.lastRange,[r]=this.selection.getRange(),i=n&&r?{oldRange:n,newRange:r}:void 0;Hs.call(this,()=>this.editor.update(null,t,i),e)}),this.emitter.on(ps.events.SCROLL_EMBED_UPDATE,(t,n)=>{const r=this.selection.lastRange,[i]=this.selection.getRange(),s=r&&i?{oldRange:r,newRange:i}:void 0;Hs.call(this,()=>{const e=(new Hi).retain(t.offset(this)).retain({[t.statics.blotName]:n});return this.editor.update(e,[],s)},e.sources.USER)}),r){const e=this.clipboard.convert({html:`${r}<p><br></p>`,text:"\n"});this.setContents(e)}this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable(),this.allowReadOnlyEdits=!1}addContainer(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){const t=e;(e=document.createElement("div")).classList.add(t)}return this.container.insertBefore(e,t),e}blur(){this.selection.setRange(null)}deleteText(e,t,n){return[e,t,,n]=Ks(e,t,n),Hs.call(this,()=>this.editor.deleteText(e,t),n,e,-1*t)}disable(){this.enable(!1)}editReadOnly(e){this.allowReadOnlyEdits=!0;const t=e();return this.allowReadOnlyEdits=!1,t}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}focus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.selection.focus(),e.preventScroll||this.scrollSelectionIntoView()}format(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:ps.sources.API;return Hs.call(this,()=>{const n=this.getSelection(!0);let r=new Hi;if(null==n)return r;if(this.scroll.query(e,Gr.BLOCK))r=this.editor.formatLine(n.index,n.length,{[e]:t});else{if(0===n.length)return this.selection.format(e,t),r;r=this.editor.formatText(n.index,n.length,{[e]:t})}return this.setSelection(n,ps.sources.SILENT),r},n)}formatLine(e,t,n,r,i){let s;return[e,t,s,i]=Ks(e,t,n,r,i),Hs.call(this,()=>this.editor.formatLine(e,t,s),i,e,0)}formatText(e,t,n,r,i){let s;return[e,t,s,i]=Ks(e,t,n,r,i),Hs.call(this,()=>this.editor.formatText(e,t,s),i,e,0)}getBounds(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=null;if(n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length),!n)return null;const r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}getContents(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e;return[e,t]=Ks(e,t),this.editor.getContents(e,t)}getFormat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}getIndex(e){return e.offset(this.scroll)}getLength(){return this.scroll.length()}getLeaf(e){return this.scroll.leaf(e)}getLine(e){return this.scroll.line(e)}getLines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}getModule(e){return this.theme.modules[e]}getSelection(){return arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.focus(),this.update(),this.selection.getRange()[0]}getSemanticHTML(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Ks(e,t),this.editor.getHTML(e,t)}getText(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1?arguments[1]:void 0;return"number"==typeof e&&(t=t??this.getLength()-e),[e,t]=Ks(e,t),this.editor.getText(e,t)}hasFocus(){return this.selection.hasFocus()}insertEmbed(t,n,r){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return Hs.call(this,()=>this.editor.insertEmbed(t,n,r),i,t)}insertText(e,t,n,r,i){let s;return[e,,s,i]=Ks(e,0,n,r,i),Hs.call(this,()=>this.editor.insertText(e,t,s),i,e,t.length)}isEnabled(){return this.scroll.isEnabled()}off(){return this.emitter.off(...arguments)}on(){return this.emitter.on(...arguments)}once(){return this.emitter.once(...arguments)}removeFormat(e,t,n){return[e,t,,n]=Ks(e,t,n),Hs.call(this,()=>this.editor.removeFormat(e,t),n,e)}scrollRectIntoView(e){((e,t)=>{var n,r,i;const s=e.ownerDocument;let o=t,l=e;for(;l;){const e=l===s.body,t=e?{top:0,right:(null==(n=window.visualViewport)?void 0:n.width)??s.documentElement.clientWidth,bottom:(null==(r=window.visualViewport)?void 0:r.height)??s.documentElement.clientHeight,left:0}:Is(l),a=getComputedStyle(l),c=Ms(o.left,o.right,t.left,t.right,Rs(a.scrollPaddingLeft),Rs(a.scrollPaddingRight)),u=Ms(o.top,o.bottom,t.top,t.bottom,Rs(a.scrollPaddingTop),Rs(a.scrollPaddingBottom));if(c||u)if(e)null==(i=s.defaultView)||i.scrollBy(c,u);else{const{scrollLeft:e,scrollTop:t}=l;u&&(l.scrollTop+=u),c&&(l.scrollLeft+=c);const n=l.scrollLeft-e,r=l.scrollTop-t;o={left:o.left-n,top:o.top-r,right:o.right-n,bottom:o.bottom-r}}l=e||"fixed"===a.position?null:Ls(l)}})(this.root,e)}scrollIntoView(){this.scrollSelectionIntoView()}scrollSelectionIntoView(){const e=this.selection.lastRange,t=e&&this.selection.getBounds(e.index,e.length);t&&this.scrollRectIntoView(t)}setContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ps.sources.API;return Hs.call(this,()=>{e=new Hi(e);const t=this.getLength(),n=this.editor.deleteText(0,t),r=this.editor.insertContents(0,e),i=this.editor.deleteText(this.getLength()-1,1);return n.compose(r).compose(i)},t)}setSelection(t,n,r){null==t?this.selection.setRange(null,n||e.sources.API):([t,n,,r]=Ks(t,n,r),this.selection.setRange(new gs(Math.max(0,t),n),r),r!==ps.sources.SILENT&&this.scrollSelectionIntoView())}setText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ps.sources.API;const n=(new Hi).insert(e);return this.setContents(n,t)}update(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ps.sources.USER;const t=this.scroll.update(e);return this.selection.update(e),t}updateContents(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ps.sources.API;return Hs.call(this,()=>(e=new Hi(e),this.editor.applyDelta(e)),t,!0)}};t(Fs,"DEFAULTS",{bounds:null,modules:{clipboard:!0,keyboard:!0,history:!0,uploader:!0},placeholder:"",readOnly:!1,registry:Ps,theme:"default"}),t(Fs,"events",ps.events),t(Fs,"sources",ps.sources),t(Fs,"version","2.0.3"),t(Fs,"imports",{delta:Hi,parchment:Ai,"core/module":Cs,"core/theme":Ts});let Us=Fs;function $s(e){return"string"==typeof e?document.querySelector(e):e}function zs(e){return Object.entries(e??{}).reduce((e,t)=>{let[n,r]=t;return{...e,[n]:!0===r?{}:r}},{})}function Vs(e){return Object.fromEntries(Object.entries(e).filter(e=>void 0!==e[1]))}function Hs(e,t,n,r){if(!this.isEnabled()&&t===ps.sources.USER&&!this.allowReadOnlyEdits)return new Hi;let i=null==n?null:this.getSelection();const s=this.editor.delta,o=e();if(null!=i&&(!0===n&&(n=i.index),null==r?i=Ws(i,o,t):0!==r&&(i=Ws(i,n,r,t)),this.setSelection(i,ps.sources.SILENT)),o.length()>0){const e=[ps.events.TEXT_CHANGE,o,s,t];this.emitter.emit(ps.events.EDITOR_CHANGE,...e),t!==ps.sources.SILENT&&this.emitter.emit(...e)}return o}function Ks(e,t,n,r,i){let s={};return"number"==typeof e.index&&"number"==typeof e.length?"number"!=typeof t?(i=r,r=n,n=t,t=e.length,e=e.index):(t=e.length,e=e.index):"number"!=typeof t&&(i=r,r=n,n=t,t=0),"object"==typeof n?(s=n,i=r):"string"==typeof n&&(null!=r?s[n]=r:i=n),[e,t,s,i=i||ps.sources.API]}function Ws(e,t,n,r){const i="number"==typeof n?n:0;if(null==e)return null;let s,o;return t&&"function"==typeof t.transformPosition?[s,o]=[e.index,e.index+e.length].map(e=>t.transformPosition(e,r!==ps.sources.USER)):[s,o]=[e.index,e.index+e.length].map(e=>e<t||e===t&&r===ps.sources.USER?e:i>=0?e+i:Math.max(t,e+i)),new gs(s,o-s)}class Zs extends vi{}function Gs(e){return e instanceof Xi||e instanceof Qi}function Ys(e){return"function"==typeof e.updateContent}class Js extends Ni{constructor(e,t,n){let{emitter:r}=n;super(e,t),this.emitter=r,this.batch=!1,this.optimize(),this.enable(),this.domNode.addEventListener("dragstart",e=>this.handleDragStart(e))}batchStart(){Array.isArray(this.batch)||(this.batch=[])}batchEnd(){if(!this.batch)return;const e=this.batch;this.batch=!1,this.update(e)}emitMount(e){this.emitter.emit(ps.events.SCROLL_BLOT_MOUNT,e)}emitUnmount(e){this.emitter.emit(ps.events.SCROLL_BLOT_UNMOUNT,e)}emitEmbedUpdate(e,t){this.emitter.emit(ps.events.SCROLL_EMBED_UPDATE,e,t)}deleteAt(e,t){const[n,r]=this.line(e),[i]=this.line(e+t);if(super.deleteAt(e,t),null!=i&&n!==i&&r>0){if(n instanceof Qi||i instanceof Qi)return void this.optimize();const e=i.children.head instanceof Ki?null:i.children.head;n.moveChildren(i,e),n.remove()}this.optimize()}enable(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.domNode.setAttribute("contenteditable",e?"true":"false")}formatAt(e,t,n,r){super.formatAt(e,t,n,r),this.optimize()}insertAt(e,t,n){if(e>=this.length())if(null==n||null==this.scroll.query(t,Gr.BLOCK)){const e=this.scroll.create(this.statics.defaultChild.blotName);this.appendChild(e),null==n&&t.endsWith("\n")?e.insertAt(0,t.slice(0,-1),n):e.insertAt(0,t,n)}else{const e=this.scroll.create(t,n);this.appendChild(e)}else super.insertAt(e,t,n);this.optimize()}insertBefore(e,t){if(e.statics.scope===Gr.INLINE_BLOT){const n=this.scroll.create(this.statics.defaultChild.blotName);n.appendChild(e),super.insertBefore(n,t)}else super.insertBefore(e,t)}insertContents(e,t){const n=this.deltaToRenderBlocks(t.concat((new Hi).insert("\n"))),r=n.pop();if(null==r)return;this.batchStart();const i=n.shift();if(i){const t="block"===i.type&&(0===i.delta.length()||!this.descendant(Qi,e)[0]&&e<this.length()),n="block"===i.type?i.delta:(new Hi).insert({[i.key]:i.value});Xs(this,e,n);const r="block"===i.type?1:0,s=e+n.length()+r;t&&this.insertAt(s-1,"\n");const o=ts(this.line(e)[0]),l=Vi.AttributeMap.diff(o,i.attributes)||{};Object.keys(l).forEach(e=>{this.formatAt(s-1,1,e,l[e])}),e=s}let[s,o]=this.children.find(e);if(n.length&&(s&&(s=s.split(o),o=0),n.forEach(e=>{if("block"===e.type){Xs(this.createBlock(e.attributes,s||void 0),0,e.delta)}else{const t=this.create(e.key,e.value);this.insertBefore(t,s||void 0),Object.keys(e.attributes).forEach(n=>{t.format(n,e.attributes[n])})}})),"block"===r.type&&r.delta.length()){Xs(this,s?s.offset(s.scroll)+o:this.length(),r.delta)}this.batchEnd(),this.optimize()}isEnabled(){return"true"===this.domNode.getAttribute("contenteditable")}leaf(e){const t=this.path(e).pop();if(!t)return[null,-1];const[n,r]=t;return n instanceof ai?[n,r]:[null,-1]}line(e){return e===this.length()?this.line(e-1):this.descendant(Gs,e)}lines(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;const n=(e,t,r)=>{let i=[],s=r;return e.children.forEachAt(t,r,(e,t,r)=>{Gs(e)?i.push(e):e instanceof vi&&(i=i.concat(n(e,t,s))),s-=r}),i};return n(this,e,t)}optimize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.batch||(super.optimize(e,t),e.length>0&&this.emitter.emit(ps.events.SCROLL_OPTIMIZE,e,t))}path(e){return super.path(e).slice(1)}remove(){}update(e){if(this.batch)return void(Array.isArray(e)&&(this.batch=this.batch.concat(e)));let t=ps.sources.USER;"string"==typeof e&&(t=e),Array.isArray(e)||(e=this.observer.takeRecords()),(e=e.filter(e=>{let{target:t}=e;const n=this.find(t,!0);return n&&!Ys(n)})).length>0&&this.emitter.emit(ps.events.SCROLL_BEFORE_UPDATE,t,e),super.update(e.concat([])),e.length>0&&this.emitter.emit(ps.events.SCROLL_UPDATE,t,e)}updateEmbedAt(e,t,n){const[r]=this.descendant(e=>e instanceof Qi,e);r&&r.statics.blotName===t&&Ys(r)&&r.updateContent(n)}handleDragStart(e){e.preventDefault()}deltaToRenderBlocks(e){const t=[];let n=new Hi;return e.forEach(e=>{const r=null==e?void 0:e.insert;if(r)if("string"==typeof r){const i=r.split("\n");i.slice(0,-1).forEach(r=>{n.insert(r,e.attributes),t.push({type:"block",delta:n,attributes:e.attributes??{}}),n=new Hi});const s=i[i.length-1];s&&n.insert(s,e.attributes)}else{const i=Object.keys(r)[0];if(!i)return;this.query(i,Gr.INLINE)?n.push(e):(n.length()&&t.push({type:"block",delta:n,attributes:{}}),n=new Hi,t.push({type:"blockEmbed",key:i,value:r[i],attributes:e.attributes??{}}))}}),n.length()&&t.push({type:"block",delta:n,attributes:{}}),t}createBlock(e,t){let n;const r={};Object.entries(e).forEach(e=>{let[t,i]=e;null!=this.query(t,Gr.BLOCK&Gr.BLOT)?n=t:r[t]=i});const i=this.create(n||this.statics.defaultChild.blotName,n?e[n]:void 0);this.insertBefore(i,t||void 0);const s=i.length();return Object.entries(r).forEach(e=>{let[t,n]=e;i.formatAt(0,s,t,n)}),i}}function Xs(e,t,n){n.reduce((t,n)=>{const r=Vi.Op.length(n);let i=n.attributes||{};if(null!=n.insert)if("string"==typeof n.insert){const r=n.insert;e.insertAt(t,r);const[s]=e.descendant(ai,t),o=ts(s);i=Vi.AttributeMap.diff(o,i)||{}}else if("object"==typeof n.insert){const r=Object.keys(n.insert)[0];if(null==r)return t;e.insertAt(t,r,n.insert[r]);if(null!=e.scroll.query(r,Gr.INLINE)){const[n]=e.descendant(ai,t),r=ts(n);i=Vi.AttributeMap.diff(r,i)||{}}}return Object.keys(i).forEach(n=>{e.formatAt(t,r,n,i[n])}),t+r},t)}t(Js,"blotName","scroll"),t(Js,"className","ql-editor"),t(Js,"tagName","DIV"),t(Js,"defaultChild",Xi),t(Js,"allowedChildren",[Xi,Qi,Zs]);const Qs={scope:Gr.BLOCK,whitelist:["right","center","justify"]},eo=new Yr("align","align",Qs),to=new ti("align","ql-align",Qs),no=new ri("align","text-align",Qs);class ro extends ri{value(e){let t=super.value(e);if(!t.startsWith("rgb("))return t;t=t.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"");return`#${t.split(",").map(e=>`00${parseInt(e,10).toString(16)}`.slice(-2)).join("")}`}}const io=new ti("color","ql-color",{scope:Gr.INLINE}),so=new ro("color","color",{scope:Gr.INLINE}),oo=new ti("background","ql-bg",{scope:Gr.INLINE}),lo=new ro("background","background-color",{scope:Gr.INLINE});class ao extends Zs{static create(e){const t=super.create(e);return t.setAttribute("spellcheck","false"),t}code(e,t){return this.children.map(e=>e.length()<=1?"":e.domNode.innerText).join("\n").slice(e,e+t)}html(e,t){return`<pre>\n${Gi(this.code(e,t))}\n</pre>`}}class co extends Xi{static register(){Us.register(ao)}}t(co,"TAB"," ");class uo extends Ji{}uo.blotName="code",uo.tagName="CODE",co.blotName="code-block",co.className="ql-code-block",co.tagName="DIV",ao.blotName="code-block-container",ao.className="ql-code-block-container",ao.tagName="DIV",ao.allowedChildren=[co],co.allowedChildren=[Wi,Ki,rs],co.requiredContainer=ao;const ho={scope:Gr.BLOCK,whitelist:["rtl"]},fo=new Yr("direction","dir",ho),po=new ti("direction","ql-direction",ho),mo=new ri("direction","direction",ho),go={scope:Gr.INLINE,whitelist:["serif","monospace"]},bo=new ti("font","ql-font",go);const vo=new class extends ri{value(e){return super.value(e).replace(/["']/g,"")}}("font","font-family",go),yo=new ti("size","ql-size",{scope:Gr.INLINE,whitelist:["small","large","huge"]}),xo=new ri("size","font-size",{scope:Gr.INLINE,whitelist:["10px","18px","32px"]}),wo=ds("quill:keyboard"),No=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey";class Eo extends Cs{static match(e,t){return!["altKey","ctrlKey","metaKey","shiftKey"].some(n=>!!t[n]!==e[n]&&null!==t[n])&&(t.key===e.key||t.key===e.which)}constructor(e,t){super(e,t),this.bindings={},Object.keys(this.options.bindings).forEach(e=>{this.options.bindings[e]&&this.addBinding(this.options.bindings[e])}),this.addBinding({key:"Enter",shiftKey:null},this.handleEnter),this.addBinding({key:"Enter",metaKey:null,ctrlKey:null,altKey:null},()=>{}),/Firefox/i.test(navigator.userAgent)?(this.addBinding({key:"Backspace"},{collapsed:!0},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0},this.handleDelete)):(this.addBinding({key:"Backspace"},{collapsed:!0,prefix:/^.?$/},this.handleBackspace),this.addBinding({key:"Delete"},{collapsed:!0,suffix:/^.?$/},this.handleDelete)),this.addBinding({key:"Backspace"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Delete"},{collapsed:!1},this.handleDeleteRange),this.addBinding({key:"Backspace",altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},this.handleBackspace),this.listen()}addBinding(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=function(e){if("string"==typeof e||"number"==typeof e)e={key:e};else{if("object"!=typeof e)return null;e=Ar(e)}e.shortKey&&(e[No]=e.shortKey,delete e.shortKey);return e}(e);if(null==r)return void wo.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n});(Array.isArray(r.key)?r.key:[r.key]).forEach(e=>{const i={...r,key:e,...t,...n};this.bindings[i.key]=this.bindings[i.key]||[],this.bindings[i.key].push(i)})}listen(){this.quill.root.addEventListener("keydown",e=>{if(e.defaultPrevented||e.isComposing)return;if(229===e.keyCode&&("Enter"===e.key||"Backspace"===e.key))return;const t=(this.bindings[e.key]||[]).concat(this.bindings[e.which]||[]).filter(t=>Eo.match(e,t));if(0===t.length)return;const n=Us.find(e.target,!0);if(n&&n.scroll!==this.quill.scroll)return;const r=this.quill.getSelection();if(null==r||!this.quill.hasFocus())return;const[i,s]=this.quill.getLine(r.index),[o,l]=this.quill.getLeaf(r.index),[a,c]=0===r.length?[o,l]:this.quill.getLeaf(r.index+r.length),u=o instanceof ki?o.value().slice(0,l):"",h=a instanceof ki?a.value().slice(c):"",d={collapsed:0===r.length,empty:0===r.length&&i.length()<=1,format:this.quill.getFormat(r),line:i,offset:s,prefix:u,suffix:h,event:e};t.some(e=>{if(null!=e.collapsed&&e.collapsed!==d.collapsed)return!1;if(null!=e.empty&&e.empty!==d.empty)return!1;if(null!=e.offset&&e.offset!==d.offset)return!1;if(Array.isArray(e.format)){if(e.format.every(e=>null==d.format[e]))return!1}else if("object"==typeof e.format&&!Object.keys(e.format).every(t=>!0===e.format[t]?null!=d.format[t]:!1===e.format[t]?null==d.format[t]:Kr(e.format[t],d.format[t])))return!1;return!(null!=e.prefix&&!e.prefix.test(d.prefix))&&(!(null!=e.suffix&&!e.suffix.test(d.suffix))&&!0!==e.handler.call(this,r,d,e))})&&e.preventDefault()})}handleBackspace(e,t){const n=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;if(0===e.index||this.quill.getLength()<=1)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Hi).retain(e.index-n).delete(n);if(0===t.offset){const[t]=this.quill.getLine(e.index-1);if(t){if(!("block"===t.statics.blotName&&t.length()<=1)){const t=i.formats(),n=this.quill.getFormat(e.index-1,1);if(r=Vi.AttributeMap.diff(t,n)||{},Object.keys(r).length>0){const t=(new Hi).retain(e.index+i.length()-2).retain(1,r);s=s.compose(t)}}}}this.quill.updateContents(s,Us.sources.USER),this.quill.focus()}handleDelete(e,t){const n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(e.index>=this.quill.getLength()-n)return;let r={};const[i]=this.quill.getLine(e.index);let s=(new Hi).retain(e.index).delete(n);if(t.offset>=i.length()-1){const[t]=this.quill.getLine(e.index+1);if(t){const n=i.formats(),o=this.quill.getFormat(e.index,1);r=Vi.AttributeMap.diff(n,o)||{},Object.keys(r).length>0&&(s=s.retain(t.length()-1).retain(1,r))}}this.quill.updateContents(s,Us.sources.USER),this.quill.focus()}handleDeleteRange(e){qo({range:e,quill:this.quill}),this.quill.focus()}handleEnter(e,t){const n=Object.keys(t.format).reduce((e,n)=>(this.quill.scroll.query(n,Gr.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e),{}),r=(new Hi).retain(e.index).delete(e.length).insert("\n",n);this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(e.index+1,Us.sources.SILENT),this.quill.focus()}}const ko={bindings:{bold:Co("bold"),italic:Co("italic"),underline:Co("underline"),indent:{key:"Tab",format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","+1",Us.sources.USER),!1)}},outdent:{key:"Tab",shiftKey:!0,format:["blockquote","indent","list"],handler(e,t){return!(!t.collapsed||0===t.offset)||(this.quill.format("indent","-1",Us.sources.USER),!1)}},"outdent backspace":{key:"Backspace",collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler(e,t){null!=t.format.indent?this.quill.format("indent","-1",Us.sources.USER):null!=t.format.list&&this.quill.format("list",!1,Us.sources.USER)}},"indent code-block":Ao(!0),"outdent code-block":Ao(!1),"remove tab":{key:"Tab",shiftKey:!0,collapsed:!0,prefix:/\t$/,handler(e){this.quill.deleteText(e.index-1,1,Us.sources.USER)}},tab:{key:"Tab",handler(e,t){if(t.format.table)return!0;this.quill.history.cutoff();const n=(new Hi).retain(e.index).delete(e.length).insert("\t");return this.quill.updateContents(n,Us.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,Us.sources.SILENT),!1}},"blockquote empty enter":{key:"Enter",collapsed:!0,format:["blockquote"],empty:!0,handler(){this.quill.format("blockquote",!1,Us.sources.USER)}},"list empty enter":{key:"Enter",collapsed:!0,format:["list"],empty:!0,handler(e,t){const n={list:!1};t.format.indent&&(n.indent=!1),this.quill.formatLine(e.index,e.length,n,Us.sources.USER)}},"checklist enter":{key:"Enter",collapsed:!0,format:{list:"checked"},handler(e){const[t,n]=this.quill.getLine(e.index),r={...t.formats(),list:"checked"},i=(new Hi).retain(e.index).insert("\n",r).retain(t.length()-n-1).retain(1,{list:"unchecked"});this.quill.updateContents(i,Us.sources.USER),this.quill.setSelection(e.index+1,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}},"header enter":{key:"Enter",collapsed:!0,format:["header"],suffix:/^$/,handler(e,t){const[n,r]=this.quill.getLine(e.index),i=(new Hi).retain(e.index).insert("\n",t.format).retain(n.length()-r-1).retain(1,{header:null});this.quill.updateContents(i,Us.sources.USER),this.quill.setSelection(e.index+1,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}},"table backspace":{key:"Backspace",format:["table"],collapsed:!0,offset:0,handler(){}},"table delete":{key:"Delete",format:["table"],collapsed:!0,suffix:/^$/,handler(){}},"table enter":{key:"Enter",shiftKey:null,format:["table"],handler(e){const t=this.quill.getModule("table");if(t){const[n,r,i,s]=t.getTable(e),o=function(e,t,n,r){if(null==t.prev&&null==t.next)return null==n.prev&&null==n.next?0===r?-1:1:null==n.prev?-1:1;if(null==t.prev)return-1;if(null==t.next)return 1;return null}(0,r,i,s);if(null==o)return;let l=n.offset();if(o<0){const t=(new Hi).retain(l).insert("\n");this.quill.updateContents(t,Us.sources.USER),this.quill.setSelection(e.index+1,e.length,Us.sources.SILENT)}else if(o>0){l+=n.length();const e=(new Hi).retain(l).insert("\n");this.quill.updateContents(e,Us.sources.USER),this.quill.setSelection(l,Us.sources.USER)}}}},"table tab":{key:"Tab",shiftKey:null,format:["table"],handler(e,t){const{event:n,line:r}=t,i=r.offset(this.quill.scroll);n.shiftKey?this.quill.setSelection(i-1,Us.sources.USER):this.quill.setSelection(i+r.length(),Us.sources.USER)}},"list autofill":{key:" ",shiftKey:null,collapsed:!0,format:{"code-block":!1,blockquote:!1,table:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler(e,t){if(null==this.quill.scroll.query("list"))return!0;const{length:n}=t.prefix,[r,i]=this.quill.getLine(e.index);if(i>n)return!0;let s;switch(t.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(e.index," ",Us.sources.USER),this.quill.history.cutoff();const o=(new Hi).retain(e.index-i).delete(n+1).retain(r.length()-2-i).retain(1,{list:s});return this.quill.updateContents(o,Us.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,Us.sources.SILENT),!1}},"code exit":{key:"Enter",collapsed:!0,format:["code-block"],prefix:/^$/,suffix:/^\s*$/,handler(e){const[t,n]=this.quill.getLine(e.index);let r=2,i=t;for(;null!=i&&i.length()<=1&&i.formats()["code-block"];)if(i=i.prev,r-=1,r<=0){const r=(new Hi).retain(e.index+t.length()-n-2).retain(1,{"code-block":null}).delete(1);return this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(e.index-1,Us.sources.SILENT),!1}return!0}},"embed left":So("ArrowLeft",!1),"embed left shift":So("ArrowLeft",!0),"embed right":So("ArrowRight",!1),"embed right shift":So("ArrowRight",!0),"table down":jo(!1),"table up":jo(!0)}};function Ao(e){return{key:"Tab",shiftKey:!e,format:{"code-block":!0},handler(t,n){let{event:r}=n;const i=this.quill.scroll.query("code-block"),{TAB:s}=i;if(0===t.length&&!r.shiftKey)return this.quill.insertText(t.index,s,Us.sources.USER),void this.quill.setSelection(t.index+s.length,Us.sources.SILENT);const o=0===t.length?this.quill.getLines(t.index,1):this.quill.getLines(t);let{index:l,length:a}=t;o.forEach((t,n)=>{e?(t.insertAt(0,s),0===n?l+=s.length:a+=s.length):t.domNode.textContent.startsWith(s)&&(t.deleteAt(0,s.length),0===n?l-=s.length:a-=s.length)}),this.quill.update(Us.sources.USER),this.quill.setSelection(l,a,Us.sources.SILENT)}}}function So(e,t){const n="ArrowLeft"===e?"prefix":"suffix";return{key:e,shiftKey:t,altKey:null,[n]:/^$/,handler(n){let{index:r}=n;"ArrowRight"===e&&(r+=n.length+1);const[i]=this.quill.getLeaf(r);return!(i instanceof yi)||("ArrowLeft"===e?t?this.quill.setSelection(n.index-1,n.length+1,Us.sources.USER):this.quill.setSelection(n.index-1,Us.sources.USER):t?this.quill.setSelection(n.index,n.length+1,Us.sources.USER):this.quill.setSelection(n.index+n.length+1,Us.sources.USER),!1)}}}function Co(e){return{key:e[0],shortKey:!0,handler(t,n){this.quill.format(e,!n.format[e],Us.sources.USER)}}}function jo(e){return{key:e?"ArrowUp":"ArrowDown",collapsed:!0,format:["table"],handler(t,n){const r=e?"prev":"next",i=n.line,s=i.parent[r];if(null!=s){if("table-row"===s.statics.blotName){let e=s.children.head,t=i;for(;null!=t.prev;)t=t.prev,e=e.next;const r=e.offset(this.quill.scroll)+Math.min(n.offset,e.length()-1);this.quill.setSelection(r,0,Us.sources.USER)}}else{const t=i.table()[r];null!=t&&(e?this.quill.setSelection(t.offset(this.quill.scroll)+t.length()-1,0,Us.sources.USER):this.quill.setSelection(t.offset(this.quill.scroll),0,Us.sources.USER))}return!1}}}function qo(e){let{quill:t,range:n}=e;const r=t.getLines(n);let i={};if(r.length>1){const e=r[0].formats(),t=r[r.length-1].formats();i=Vi.AttributeMap.diff(t,e)||{}}t.deleteText(n,Us.sources.USER),Object.keys(i).length>0&&t.formatLine(n.index,1,i,Us.sources.USER),t.setSelection(n.index,Us.sources.SILENT)}Eo.DEFAULTS=ko;const _o=/font-weight:\s*normal/,Oo=["P","OL","UL"],To=e=>e&&Oo.includes(e.tagName);const Lo=/\bmso-list:[^;]*ignore/i,Io=/\bmso-list:[^;]*\bl(\d+)/i,Ro=/\bmso-list:[^;]*\blevel(\d+)/i,Mo=e=>{var t,n;const r=Array.from(e.querySelectorAll("[style*=mso-list]")),i=[],s=[];r.forEach(e=>{(e.getAttribute("style")||"").match(Lo)?i.push(e):s.push(e)}),i.forEach(e=>{var t;return null==(t=e.parentNode)?void 0:t.removeChild(e)});const o=e.documentElement.innerHTML,l=s.map(e=>((e,t)=>{const n=e.getAttribute("style"),r=null==n?void 0:n.match(Io);if(!r)return null;const i=Number(r[1]),s=null==n?void 0:n.match(Ro),o=s?Number(s[1]):1,l=new RegExp(`@list l${i}:level${o}\\s*\\{[^\\}]*mso-level-number-format:\\s*([\\w-]+)`,"i"),a=t.match(l);return{id:i,indent:o,type:a&&"bullet"===a[1]?"bullet":"ordered",element:e}})(e,o)).filter(e=>e);for(;l.length;){const e=[];let r=l.shift();for(;r;)e.push(r),r=l.length&&(null==(t=l[0])?void 0:t.element)===r.element.nextElementSibling&&l[0].id===r.id?l.shift():null;const i=document.createElement("ul");e.forEach(e=>{const t=document.createElement("li");t.setAttribute("data-list",e.type),e.indent>1&&t.setAttribute("class","ql-indent-"+(e.indent-1)),t.innerHTML=e.element.innerHTML,i.appendChild(t)});const s=null==(n=e[0])?void 0:n.element,{parentNode:o}=s??{};s&&(null==o||o.replaceChild(i,s)),e.slice(1).forEach(e=>{let{element:t}=e;null==o||o.removeChild(t)})}};const Bo=[function(e){"urn:schemas-microsoft-com:office:word"===e.documentElement.getAttribute("xmlns:w")&&Mo(e)},function(e){e.querySelector('[id^="docs-internal-guid-"]')&&((e=>{Array.from(e.querySelectorAll('b[style*="font-weight"]')).filter(e=>{var t;return null==(t=e.getAttribute("style"))?void 0:t.match(_o)}).forEach(t=>{var n;const r=e.createDocumentFragment();r.append(...t.childNodes),null==(n=t.parentNode)||n.replaceChild(r,t)})})(e),(e=>{Array.from(e.querySelectorAll("br")).filter(e=>To(e.previousElementSibling)&&To(e.nextElementSibling)).forEach(e=>{var t;null==(t=e.parentNode)||t.removeChild(e)})})(e))}],Do=ds("quill:clipboard"),Po=[[Node.TEXT_NODE,function(e,t,n){var r;let i=e.data;if("O:P"===(null==(r=e.parentElement)?void 0:r.tagName))return t.insert(i.trim());if(!Wo(e)){if(0===i.trim().length&&i.includes("\n")&&!function(e,t){return e.previousElementSibling&&e.nextElementSibling&&!Ho(e.previousElementSibling,t)&&!Ho(e.nextElementSibling,t)}(e,n))return t;i=i.replace(/[^\S\u00a0]/g," "),i=i.replace(/ {2,}/g," "),(null==e.previousSibling&&null!=e.parentElement&&Ho(e.parentElement,n)||e.previousSibling instanceof Element&&Ho(e.previousSibling,n))&&(i=i.replace(/^ /,"")),(null==e.nextSibling&&null!=e.parentElement&&Ho(e.parentElement,n)||e.nextSibling instanceof Element&&Ho(e.nextSibling,n))&&(i=i.replace(/ $/,"")),i=i.replaceAll(" "," ")}return t.insert(i)}],[Node.TEXT_NODE,Yo],["br",function(e,t){Vo(t,"\n")||t.insert("\n");return t}],[Node.ELEMENT_NODE,Yo],[Node.ELEMENT_NODE,function(e,t,n){const r=n.query(e);if(null==r)return t;if(r.prototype instanceof yi){const t={},i=r.value(e);if(null!=i)return t[r.blotName]=i,(new Hi).insert(t,r.formats(e,n))}else if(r.prototype instanceof gi&&!Vo(t,"\n")&&t.insert("\n"),"blotName"in r&&"formats"in r&&"function"==typeof r.formats)return zo(t,r.blotName,r.formats(e,n),n);return t}],[Node.ELEMENT_NODE,function(e,t,n){const r=Yr.keys(e),i=ti.keys(e),s=ri.keys(e),o={};return r.concat(i).concat(s).forEach(t=>{let r=n.query(t,Gr.ATTRIBUTE);null!=r&&(o[r.attrName]=r.value(e),o[r.attrName])||(r=Fo[t],null==r||r.attrName!==t&&r.keyName!==t||(o[r.attrName]=r.value(e)||void 0),r=Uo[t],null==r||r.attrName!==t&&r.keyName!==t||(r=Uo[t],o[r.attrName]=r.value(e)||void 0))}),Object.entries(o).reduce((e,t)=>{let[r,i]=t;return zo(e,r,i,n)},t)}],[Node.ELEMENT_NODE,function(e,t,n){var r;const i={},s=e.style||{};"italic"===s.fontStyle&&(i.italic=!0);"underline"===s.textDecoration&&(i.underline=!0);"line-through"===s.textDecoration&&(i.strike=!0);((null==(r=s.fontWeight)?void 0:r.startsWith("bold"))||parseInt(s.fontWeight,10)>=700)&&(i.bold=!0);if(t=Object.entries(i).reduce((e,t)=>{let[r,i]=t;return zo(e,r,i,n)},t),parseFloat(s.textIndent||0)>0)return(new Hi).insert("\t").concat(t);return t}],["li",function(e,t,n){const r=n.query(e);if(null==r||"list"!==r.blotName||!Vo(t,"\n"))return t;let i=-1,s=e.parentNode;for(;null!=s;)["OL","UL"].includes(s.tagName)&&(i+=1),s=s.parentNode;return i<=0?t:t.reduce((e,t)=>t.insert?t.attributes&&"number"==typeof t.attributes.indent?e.push(t):e.insert(t.insert,{indent:i,...t.attributes||{}}):e,new Hi)}],["ol, ul",function(e,t,n){const r=e;let i="OL"===r.tagName?"ordered":"bullet";const s=r.getAttribute("data-checked");s&&(i="true"===s?"checked":"unchecked");return zo(t,"list",i,n)}],["pre",function(e,t,n){const r=n.query("code-block"),i=!r||!("formats"in r)||"function"!=typeof r.formats||r.formats(e,n);return zo(t,"code-block",i,n)}],["tr",function(e,t,n){var r,i;const s="TABLE"===(null==(r=e.parentElement)?void 0:r.tagName)?e.parentElement:null==(i=e.parentElement)?void 0:i.parentElement;if(null!=s){return zo(t,"table",Array.from(s.querySelectorAll("tr")).indexOf(e)+1,n)}return t}],["b",Go("bold")],["i",Go("italic")],["strike",Go("strike")],["style",function(){return new Hi}]],Fo=[eo,fo].reduce((e,t)=>(e[t.keyName]=t,e),{}),Uo=[no,lo,so,mo,vo,xo].reduce((e,t)=>(e[t.keyName]=t,e),{});class $o extends Cs{constructor(e,t){super(e,t),this.quill.root.addEventListener("copy",e=>this.onCaptureCopy(e,!1)),this.quill.root.addEventListener("cut",e=>this.onCaptureCopy(e,!0)),this.quill.root.addEventListener("paste",this.onCapturePaste.bind(this)),this.matchers=[],Po.concat(this.options.matchers??[]).forEach(e=>{let[t,n]=e;this.addMatcher(t,n)})}addMatcher(e,t){this.matchers.push([e,t])}convert(e){let{html:t,text:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r[co.blotName])return(new Hi).insert(n||"",{[co.blotName]:r[co.blotName]});if(!t)return(new Hi).insert(n||"",r);const i=this.convertHTML(t);return Vo(i,"\n")&&(null==i.ops[i.ops.length-1].attributes||r.table)?i.compose((new Hi).retain(i.length()-1).delete(1)):i}normalizeHTML(e){(e=>{e.documentElement&&Bo.forEach(t=>{t(e)})})(e)}convertHTML(e){const t=(new DOMParser).parseFromString(e,"text/html");this.normalizeHTML(t);const n=t.body,r=new WeakMap,[i,s]=this.prepareMatching(n,r);return Zo(this.quill.scroll,n,i,s,r)}dangerouslyPasteHTML(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Us.sources.API;if("string"==typeof e){const n=this.convert({html:e,text:""});this.quill.setContents(n,t),this.quill.setSelection(0,Us.sources.SILENT)}else{const r=this.convert({html:t,text:""});this.quill.updateContents((new Hi).retain(e).concat(r),n),this.quill.setSelection(e+r.length(),Us.sources.SILENT)}}onCaptureCopy(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.defaultPrevented)return;e.preventDefault();const[i]=this.quill.selection.getRange();if(null==i)return;const{html:s,text:o}=this.onCopy(i,r);null==(t=e.clipboardData)||t.setData("text/plain",o),null==(n=e.clipboardData)||n.setData("text/html",s),r&&qo({range:i,quill:this.quill})}normalizeURIList(e){return e.split(/\r?\n/).filter(e=>"#"!==e[0]).join("\n")}onCapturePaste(e){var t,n,r,i,s;if(e.defaultPrevented||!this.quill.isEnabled())return;e.preventDefault();const o=this.quill.getSelection(!0);if(null==o)return;const l=null==(t=e.clipboardData)?void 0:t.getData("text/html");let a=null==(n=e.clipboardData)?void 0:n.getData("text/plain");if(!l&&!a){const t=null==(r=e.clipboardData)?void 0:r.getData("text/uri-list");t&&(a=this.normalizeURIList(t))}const c=Array.from((null==(i=e.clipboardData)?void 0:i.files)||[]);if(!l&&c.length>0)this.quill.uploader.upload(o,c);else{if(l&&c.length>0){const e=(new DOMParser).parseFromString(l,"text/html");if(1===e.body.childElementCount&&"IMG"===(null==(s=e.body.firstElementChild)?void 0:s.tagName))return void this.quill.uploader.upload(o,c)}this.onPaste(o,{html:l,text:a})}}onCopy(e){const t=this.quill.getText(e);return{html:this.quill.getSemanticHTML(e),text:t}}onPaste(e,t){let{text:n,html:r}=t;const i=this.quill.getFormat(e.index),s=this.convert({text:n,html:r},i);Do.log("onPaste",s,{text:n,html:r});const o=(new Hi).retain(e.index).delete(e.length).concat(s);this.quill.updateContents(o,Us.sources.USER),this.quill.setSelection(o.length()-e.length,Us.sources.SILENT),this.quill.scrollSelectionIntoView()}prepareMatching(e,t){const n=[],r=[];return this.matchers.forEach(i=>{const[s,o]=i;switch(s){case Node.TEXT_NODE:r.push(o);break;case Node.ELEMENT_NODE:n.push(o);break;default:Array.from(e.querySelectorAll(s)).forEach(e=>{if(t.has(e)){const n=t.get(e);null==n||n.push(o)}else t.set(e,[o])})}}),[n,r]}}function zo(e,t,n,r){return r.query(t)?e.reduce((e,r)=>{if(!r.insert)return e;if(r.attributes&&r.attributes[t])return e.push(r);const i=n?{[t]:n}:{};return e.insert(r.insert,{...i,...r.attributes})},new Hi):e}function Vo(e,t){let n="";for(let r=e.ops.length-1;r>=0&&n.length<t.length;--r){const t=e.ops[r];if("string"!=typeof t.insert)break;n=t.insert+n}return n.slice(-1*t.length)===t}function Ho(e,t){if(!(e instanceof Element))return!1;const n=t.query(e);return!(n&&n.prototype instanceof yi)&&["address","article","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","iframe","li","main","nav","ol","output","p","pre","section","table","td","tr","ul","video"].includes(e.tagName.toLowerCase())}t($o,"DEFAULTS",{matchers:[]});const Ko=new WeakMap;function Wo(e){return null!=e&&(Ko.has(e)||("PRE"===e.tagName?Ko.set(e,!0):Ko.set(e,Wo(e.parentNode))),Ko.get(e))}function Zo(e,t,n,r,i){return t.nodeType===t.TEXT_NODE?r.reduce((n,r)=>r(t,n,e),new Hi):t.nodeType===t.ELEMENT_NODE?Array.from(t.childNodes||[]).reduce((s,o)=>{let l=Zo(e,o,n,r,i);return o.nodeType===t.ELEMENT_NODE&&(l=n.reduce((t,n)=>n(o,t,e),l),l=(i.get(o)||[]).reduce((t,n)=>n(o,t,e),l)),s.concat(l)},new Hi):new Hi}function Go(e){return(t,n,r)=>zo(n,e,!0,r)}function Yo(e,t,n){if(!Vo(t,"\n")){if(Ho(e,n)&&(e.childNodes.length>0||e instanceof HTMLParagraphElement))return t.insert("\n");if(t.length()>0&&e.nextSibling){let r=e.nextSibling;for(;null!=r;){if(Ho(r,n))return t.insert("\n");const e=n.query(r);if(e&&e.prototype instanceof Qi)return t.insert("\n");r=r.firstChild}}}return t}class Jo extends Cs{constructor(e,n){super(e,n),t(this,"lastRecorded",0),t(this,"ignoreChange",!1),t(this,"stack",{undo:[],redo:[]}),t(this,"currentRange",null),this.quill.on(Us.events.EDITOR_CHANGE,(e,t,n,r)=>{e===Us.events.SELECTION_CHANGE?t&&r!==Us.sources.SILENT&&(this.currentRange=t):e===Us.events.TEXT_CHANGE&&(this.ignoreChange||(this.options.userOnly&&r!==Us.sources.USER?this.transform(t):this.record(t,n)),this.currentRange=Qo(this.currentRange,t))}),this.quill.keyboard.addBinding({key:"z",shortKey:!0},this.undo.bind(this)),this.quill.keyboard.addBinding({key:["z","Z"],shortKey:!0,shiftKey:!0},this.redo.bind(this)),/Win/i.test(navigator.platform)&&this.quill.keyboard.addBinding({key:"y",shortKey:!0},this.redo.bind(this)),this.quill.root.addEventListener("beforeinput",e=>{"historyUndo"===e.inputType?(this.undo(),e.preventDefault()):"historyRedo"===e.inputType&&(this.redo(),e.preventDefault())})}change(e,t){if(0===this.stack[e].length)return;const n=this.stack[e].pop();if(!n)return;const r=this.quill.getContents(),i=n.delta.invert(r);this.stack[t].push({delta:i,range:Qo(n.range,i)}),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n.delta,Us.sources.USER),this.ignoreChange=!1,this.restoreSelection(n)}clear(){this.stack={undo:[],redo:[]}}cutoff(){this.lastRecorded=0}record(e,t){if(0===e.ops.length)return;this.stack.redo=[];let n=e.invert(t),r=this.currentRange;const i=Date.now();if(this.lastRecorded+this.options.delay>i&&this.stack.undo.length>0){const e=this.stack.undo.pop();e&&(n=n.compose(e.delta),r=e.range)}else this.lastRecorded=i;0!==n.length()&&(this.stack.undo.push({delta:n,range:r}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift())}redo(){this.change("redo","undo")}transform(e){Xo(this.stack.undo,e),Xo(this.stack.redo,e)}undo(){this.change("undo","redo")}restoreSelection(e){if(e.range)this.quill.setSelection(e.range,Us.sources.USER);else{const t=function(e,t){const n=t.reduce((e,t)=>e+(t.delete||0),0);let r=t.length()-n;(function(e,t){const n=t.ops[t.ops.length-1];if(null==n)return!1;if(null!=n.insert)return"string"==typeof n.insert&&n.insert.endsWith("\n");if(null!=n.attributes)return Object.keys(n.attributes).some(t=>null!=e.query(t,Gr.BLOCK));return!1})(e,t)&&(r-=1);return r}(this.quill.scroll,e.delta);this.quill.setSelection(t,Us.sources.USER)}}}function Xo(e,t){let n=t;for(let r=e.length-1;r>=0;r-=1){const t=e[r];e[r]={delta:n.transform(t.delta,!0),range:t.range&&Qo(t.range,n)},n=t.delta.transform(n),0===e[r].delta.length()&&e.splice(r,1)}}function Qo(e,t){if(!e)return e;const n=t.transformPosition(e.index);return{index:n,length:t.transformPosition(e.index+e.length)-n}}t(Jo,"DEFAULTS",{delay:1e3,maxStack:100,userOnly:!1});class el extends Cs{constructor(e,t){super(e,t),e.root.addEventListener("drop",t=>{var n;t.preventDefault();let r=null;if(document.caretRangeFromPoint)r=document.caretRangeFromPoint(t.clientX,t.clientY);else if(document.caretPositionFromPoint){const e=document.caretPositionFromPoint(t.clientX,t.clientY);r=document.createRange(),r.setStart(e.offsetNode,e.offset),r.setEnd(e.offsetNode,e.offset)}const i=r&&e.selection.normalizeNative(r);if(i){const r=e.selection.normalizedToRange(i);(null==(n=t.dataTransfer)?void 0:n.files)&&this.upload(r,t.dataTransfer.files)}})}upload(e,t){const n=[];Array.from(t).forEach(e=>{var t;e&&(null==(t=this.options.mimetypes)?void 0:t.includes(e.type))&&n.push(e)}),n.length>0&&this.options.handler.call(this,e,n)}}el.DEFAULTS={mimetypes:["image/png","image/jpeg"],handler(e,t){if(!this.quill.scroll.query("image"))return;const n=t.map(e=>new Promise(t=>{const n=new FileReader;n.onload=()=>{t(n.result)},n.readAsDataURL(e)}));Promise.all(n).then(t=>{const n=t.reduce((e,t)=>e.insert({image:t}),(new Hi).retain(e.index).delete(e.length));this.quill.updateContents(n,ps.sources.USER),this.quill.setSelection(e.index+t.length,ps.sources.SILENT)})}};const tl=["insertText","insertReplacementText"];const nl=/Mac/i.test(navigator.platform);Us.register({"blots/block":Xi,"blots/block/embed":Qi,"blots/break":Ki,"blots/container":Zs,"blots/cursor":rs,"blots/embed":qs,"blots/inline":Ji,"blots/scroll":Js,"blots/text":Wi,"modules/clipboard":$o,"modules/history":Jo,"modules/keyboard":Eo,"modules/uploader":el,"modules/input":class extends Cs{constructor(e,t){super(e,t),e.root.addEventListener("beforeinput",e=>{this.handleBeforeInput(e)}),/Android/i.test(navigator.userAgent)||e.on(Us.events.COMPOSITION_BEFORE_START,()=>{this.handleCompositionStart()})}deleteRange(e){qo({range:e,quill:this.quill})}replaceText(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(0===e.length)return!1;if(t){const n=this.quill.getFormat(e.index,1);this.deleteRange(e),this.quill.updateContents((new Hi).retain(e.index).insert(t,n),Us.sources.USER)}else this.deleteRange(e);return this.quill.setSelection(e.index+t.length,0,Us.sources.SILENT),!0}handleBeforeInput(e){if(this.quill.composition.isComposing||e.defaultPrevented||!tl.includes(e.inputType))return;const t=e.getTargetRanges?e.getTargetRanges()[0]:null;if(!t||!0===t.collapsed)return;const n=function(e){var t;if("string"==typeof e.data)return e.data;if(null==(t=e.dataTransfer)?void 0:t.types.includes("text/plain"))return e.dataTransfer.getData("text/plain");return null}(e);if(null==n)return;const r=this.quill.selection.normalizeNative(t),i=r?this.quill.selection.normalizedToRange(r):null;i&&this.replaceText(i,n)&&e.preventDefault()}handleCompositionStart(){const e=this.quill.getSelection();e&&this.replaceText(e)}},"modules/uiNode":class extends Cs{constructor(e,n){super(e,n),t(this,"isListening",!1),t(this,"selectionChangeDeadline",0),this.handleArrowKeys(),this.handleNavigationShortcuts()}handleArrowKeys(){this.quill.keyboard.addBinding({key:["ArrowLeft","ArrowRight"],offset:0,shiftKey:null,handler(e,t){let{line:n,event:r}=t;if(!(n instanceof di&&n.uiNode))return!0;const i="rtl"===getComputedStyle(n.domNode).direction;return!!(i&&"ArrowRight"!==r.key||!i&&"ArrowLeft"!==r.key)||(this.quill.setSelection(e.index-1,e.length+(r.shiftKey?1:0),Us.sources.USER),!1)}})}handleNavigationShortcuts(){this.quill.root.addEventListener("keydown",e=>{!e.defaultPrevented&&(e=>"ArrowLeft"===e.key||"ArrowRight"===e.key||"ArrowUp"===e.key||"ArrowDown"===e.key||"Home"===e.key||!(!nl||"a"!==e.key||!0!==e.ctrlKey))(e)&&this.ensureListeningToSelectionChange()})}ensureListeningToSelectionChange(){if(this.selectionChangeDeadline=Date.now()+100,this.isListening)return;this.isListening=!0;document.addEventListener("selectionchange",()=>{this.isListening=!1,Date.now()<=this.selectionChangeDeadline&&this.handleSelectionChange()},{once:!0})}handleSelectionChange(){const e=document.getSelection();if(!e)return;const t=e.getRangeAt(0);if(!0!==t.collapsed||0!==t.startOffset)return;const n=this.quill.scroll.find(t.startContainer);if(!(n instanceof di&&n.uiNode))return;const r=document.createRange();r.setStartAfter(n.uiNode),r.setEndAfter(n.uiNode),e.removeAllRanges(),e.addRange(r)}}});const rl=new class extends ti{add(e,t){let n=0;if("+1"===t||"-1"===t){const r=this.value(e)||0;n="+1"===t?r+1:r-1}else"number"==typeof t&&(n=t);return 0===n?(this.remove(e),!0):super.add(e,n.toString())}canAdd(e,t){return super.canAdd(e,t)||super.canAdd(e,parseInt(t,10))}value(e){return parseInt(super.value(e),10)||void 0}}("indent","ql-indent",{scope:Gr.BLOCK,whitelist:[1,2,3,4,5,6,7,8]});class il extends Xi{}t(il,"blotName","blockquote"),t(il,"tagName","blockquote");class sl extends Xi{static formats(e){return this.tagName.indexOf(e.tagName)+1}}t(sl,"blotName","header"),t(sl,"tagName",["H1","H2","H3","H4","H5","H6"]);class ol extends Zs{}ol.blotName="list-container",ol.tagName="OL";class ll extends Xi{static create(e){const t=super.create();return t.setAttribute("data-list",e),t}static formats(e){return e.getAttribute("data-list")||void 0}static register(){Us.register(ol)}constructor(e,t){super(e,t);const n=t.ownerDocument.createElement("span"),r=n=>{if(!e.isEnabled())return;const r=this.statics.formats(t,e);"checked"===r?(this.format("list","unchecked"),n.preventDefault()):"unchecked"===r&&(this.format("list","checked"),n.preventDefault())};n.addEventListener("mousedown",r),n.addEventListener("touchstart",r),this.attachUI(n)}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-list",t):super.format(e,t)}}ll.blotName="list",ll.tagName="LI",ol.allowedChildren=[ll],ll.requiredContainer=ol;class al extends Ji{static create(){return super.create()}static formats(){return!0}optimize(e){super.optimize(e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}t(al,"blotName","bold"),t(al,"tagName",["STRONG","B"]);class cl extends al{}t(cl,"blotName","italic"),t(cl,"tagName",["EM","I"]);class ul extends Ji{static create(e){const t=super.create(e);return t.setAttribute("href",this.sanitize(e)),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t}static formats(e){return e.getAttribute("href")}static sanitize(e){return hl(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("href",this.constructor.sanitize(t)):super.format(e,t)}}function hl(e,t){const n=document.createElement("a");n.href=e;const r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}t(ul,"blotName","link"),t(ul,"tagName","A"),t(ul,"SANITIZED_URL","about:blank"),t(ul,"PROTOCOL_WHITELIST",["http","https","mailto","tel","sms"]);class dl extends Ji{static create(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):super.create(e)}static formats(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}t(dl,"blotName","script"),t(dl,"tagName",["SUB","SUP"]);class fl extends al{}t(fl,"blotName","strike"),t(fl,"tagName",["S","STRIKE"]);class pl extends Ji{}t(pl,"blotName","underline"),t(pl,"tagName","U");class ml extends qs{static create(e){if(null==window.katex)throw new Error("Formula module requires KaTeX.");const t=super.create(e);return"string"==typeof e&&(window.katex.render(e,t,{throwOnError:!1,errorColor:"#f00"}),t.setAttribute("data-value",e)),t}static value(e){return e.getAttribute("data-value")}html(){const{formula:e}=this.value();return`<span>${e}</span>`}}t(ml,"blotName","formula"),t(ml,"className","ql-formula"),t(ml,"tagName","SPAN");const gl=["alt","height","width"];class bl extends yi{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("src",this.sanitize(e)),t}static formats(e){return gl.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static match(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}static sanitize(e){return hl(e,["http","https","data"])?e:"//:0"}static value(e){return e.getAttribute("src")}format(e,t){gl.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}t(bl,"blotName","image"),t(bl,"tagName","IMG");const vl=["height","width"];class yl extends Qi{static create(e){const t=super.create(e);return t.setAttribute("frameborder","0"),t.setAttribute("allowfullscreen","true"),t.setAttribute("src",this.sanitize(e)),t}static formats(e){return vl.reduce((t,n)=>(e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t),{})}static sanitize(e){return ul.sanitize(e)}static value(e){return e.getAttribute("src")}format(e,t){vl.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}html(){const{video:e}=this.value();return`<a href="${e}">${e}</a>`}}t(yl,"blotName","video"),t(yl,"className","ql-video"),t(yl,"tagName","IFRAME");const xl=new ti("code-token","hljs",{scope:Gr.INLINE});class wl extends Ji{static formats(e,t){for(;null!=e&&e!==t.domNode;){if(e.classList&&e.classList.contains(co.className))return super.formats(e,t);e=e.parentNode}}constructor(e,t,n){super(e,t,n),xl.add(this.domNode,n)}format(e,t){e!==wl.blotName?super.format(e,t):t?xl.add(this.domNode,t):(xl.remove(this.domNode),this.domNode.classList.remove(this.statics.className))}optimize(){super.optimize(...arguments),xl.value(this.domNode)||this.unwrap()}}wl.blotName="code-token",wl.className="ql-token";class Nl extends co{static create(e){const t=super.create(e);return"string"==typeof e&&t.setAttribute("data-language",e),t}static formats(e){return e.getAttribute("data-language")||"plain"}static register(){}format(e,t){e===this.statics.blotName&&t?this.domNode.setAttribute("data-language",t):super.format(e,t)}replaceWith(e,t){return this.formatAt(0,this.length(),wl.blotName,!1),super.replaceWith(e,t)}}class El extends ao{attach(){super.attach(),this.forceNext=!1,this.scroll.emitMount(this)}format(e,t){e===Nl.blotName&&(this.forceNext=!0,this.children.forEach(n=>{n.format(e,t)}))}formatAt(e,t,n,r){n===Nl.blotName&&(this.forceNext=!0),super.formatAt(e,t,n,r)}highlight(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null==this.children.head)return;const n=`${Array.from(this.domNode.childNodes).filter(e=>e!==this.uiNode).map(e=>e.textContent).join("\n")}\n`,r=Nl.formats(this.children.head.domNode);if(t||this.forceNext||this.cachedText!==n){if(n.trim().length>0||null==this.cachedText){const t=this.children.reduce((e,t)=>e.concat(es(t,!1)),new Hi),i=e(n,r);t.diff(i).reduce((e,t)=>{let{retain:n,attributes:r}=t;return n?(r&&Object.keys(r).forEach(t=>{[Nl.blotName,wl.blotName].includes(t)&&this.formatAt(e,n,t,r[t])}),e+n):e},0)}this.cachedText=n,this.forceNext=!1}}html(e,t){const[n]=this.children.find(e);return`<pre data-language="${n?Nl.formats(n.domNode):"plain"}">\n${Gi(this.code(e,t))}\n</pre>`}optimize(e){if(super.optimize(e),null!=this.parent&&null!=this.children.head&&null!=this.uiNode){const e=Nl.formats(this.children.head.domNode);e!==this.uiNode.value&&(this.uiNode.value=e)}}}El.allowedChildren=[Nl],Nl.requiredContainer=El,Nl.allowedChildren=[wl,rs,Wi,Ki];class kl extends Cs{static register(){Us.register(wl,!0),Us.register(Nl,!0),Us.register(El,!0)}constructor(e,t){if(super(e,t),null==this.options.hljs)throw new Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");this.languages=this.options.languages.reduce((e,t)=>{let{key:n}=t;return e[n]=!0,e},{}),this.highlightBlot=this.highlightBlot.bind(this),this.initListener(),this.initTimer()}initListener(){this.quill.on(Us.events.SCROLL_BLOT_MOUNT,e=>{if(!(e instanceof El))return;const t=this.quill.root.ownerDocument.createElement("select");this.options.languages.forEach(e=>{let{key:n,label:r}=e;const i=t.ownerDocument.createElement("option");i.textContent=r,i.setAttribute("value",n),t.appendChild(i)}),t.addEventListener("change",()=>{e.format(Nl.blotName,t.value),this.quill.root.focus(),this.highlight(e,!0)}),null==e.uiNode&&(e.attachUI(t),e.children.head&&(t.value=Nl.formats(e.children.head.domNode)))})}initTimer(){let e=null;this.quill.on(Us.events.SCROLL_OPTIMIZE,()=>{e&&clearTimeout(e),e=setTimeout(()=>{this.highlight(),e=null},this.options.interval)})}highlight(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.quill.selection.composing)return;this.quill.update(Us.sources.USER);const n=this.quill.getSelection();(null==e?this.quill.scroll.descendants(El):[e]).forEach(e=>{e.highlight(this.highlightBlot,t)}),this.quill.update(Us.sources.SILENT),null!=n&&this.quill.setSelection(n,Us.sources.SILENT)}highlightBlot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"plain";if(t=this.languages[t]?t:"plain","plain"===t)return Gi(e).split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[co.blotName]:t}),e.insert(n)),new Hi);const n=this.quill.root.ownerDocument.createElement("div");return n.classList.add(co.className),n.innerHTML=((e,t,n)=>{if("string"==typeof e.versionString){const r=e.versionString.split(".")[0];if(parseInt(r,10)>=11)return e.highlight(n,{language:t}).value}return e.highlight(t,n).value})(this.options.hljs,t,e),Zo(this.quill.scroll,n,[(e,t)=>{const n=xl.value(e);return n?t.compose((new Hi).retain(t.length(),{[wl.blotName]:n})):t}],[(e,n)=>e.data.split("\n").reduce((e,n,r)=>(0!==r&&e.insert("\n",{[co.blotName]:t}),e.insert(n)),n)],new WeakMap)}}kl.DEFAULTS={hljs:window.hljs,interval:1e3,languages:[{key:"plain",label:"Plain"},{key:"bash",label:"Bash"},{key:"cpp",label:"C++"},{key:"cs",label:"C#"},{key:"css",label:"CSS"},{key:"diff",label:"Diff"},{key:"xml",label:"HTML/XML"},{key:"java",label:"Java"},{key:"javascript",label:"JavaScript"},{key:"markdown",label:"Markdown"},{key:"php",label:"PHP"},{key:"python",label:"Python"},{key:"ruby",label:"Ruby"},{key:"sql",label:"SQL"}]};const Al=class e extends Xi{static create(e){const t=super.create();return e?t.setAttribute("data-row",e):t.setAttribute("data-row",_l()),t}static formats(e){if(e.hasAttribute("data-row"))return e.getAttribute("data-row")}cellOffset(){return this.parent?this.parent.children.indexOf(this):-1}format(t,n){t===e.blotName&&n?this.domNode.setAttribute("data-row",n):super.format(t,n)}row(){return this.parent}rowOffset(){return this.row()?this.row().rowOffset():-1}table(){return this.row()&&this.row().table()}};t(Al,"blotName","table"),t(Al,"tagName","TD");let Sl=Al;class Cl extends Zs{checkMerge(){if(super.checkMerge()&&null!=this.next.children.head){const e=this.children.head.formats(),t=this.children.tail.formats(),n=this.next.children.head.formats(),r=this.next.children.tail.formats();return e.table===t.table&&e.table===n.table&&e.table===r.table}return!1}optimize(e){super.optimize(e),this.children.forEach(e=>{if(null==e.next)return;const t=e.formats(),n=e.next.formats();if(t.table!==n.table){const t=this.splitAfter(e);t&&t.optimize(),this.prev&&this.prev.optimize()}})}rowOffset(){return this.parent?this.parent.children.indexOf(this):-1}table(){return this.parent&&this.parent.parent}}t(Cl,"blotName","table-row"),t(Cl,"tagName","TR");class jl extends Zs{}t(jl,"blotName","table-body"),t(jl,"tagName","TBODY");class ql extends Zs{balanceCells(){const e=this.descendants(Cl),t=e.reduce((e,t)=>Math.max(t.children.length,e),0);e.forEach(e=>{new Array(t-e.children.length).fill(0).forEach(()=>{let t;null!=e.children.head&&(t=Sl.formats(e.children.head.domNode));const n=this.scroll.create(Sl.blotName,t);e.appendChild(n),n.optimize()})})}cells(e){return this.rows().map(t=>t.children.at(e))}deleteColumn(e){const[t]=this.descendant(jl);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e);null!=n&&n.remove()})}insertColumn(e){const[t]=this.descendant(jl);null!=t&&null!=t.children.head&&t.children.forEach(t=>{const n=t.children.at(e),r=Sl.formats(t.children.head.domNode),i=this.scroll.create(Sl.blotName,r);t.insertBefore(i,n)})}insertRow(e){const[t]=this.descendant(jl);if(null==t||null==t.children.head)return;const n=_l(),r=this.scroll.create(Cl.blotName);t.children.head.children.forEach(()=>{const e=this.scroll.create(Sl.blotName,n);r.appendChild(e)});const i=t.children.at(e);t.insertBefore(r,i)}rows(){const e=this.children.head;return null==e?[]:e.children.map(e=>e)}}function _l(){return`row-${Math.random().toString(36).slice(2,6)}`}t(ql,"blotName","table-container"),t(ql,"tagName","TABLE"),ql.allowedChildren=[jl],jl.requiredContainer=ql,jl.allowedChildren=[Cl],Cl.requiredContainer=jl,Cl.allowedChildren=[Sl],Sl.requiredContainer=Cl;const Ol=ds("quill:toolbar");class Tl extends Cs{constructor(e,t){var n,r;if(super(e,t),Array.isArray(this.options.container)){const t=document.createElement("div");t.setAttribute("role","toolbar"),function(e,t){Array.isArray(t[0])||(t=[t]);t.forEach(t=>{const n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(e=>{if("string"==typeof e)Ll(n,e);else{const t=Object.keys(e)[0],r=e[t];Array.isArray(r)?function(e,t,n){const r=document.createElement("select");r.classList.add(`ql-${t}`),n.forEach(e=>{const t=document.createElement("option");!1!==e?t.setAttribute("value",String(e)):t.setAttribute("selected","selected"),r.appendChild(t)}),e.appendChild(r)}(n,t,r):Ll(n,t,r)}}),e.appendChild(n)})}(t,this.options.container),null==(r=null==(n=e.container)?void 0:n.parentNode)||r.insertBefore(t,e.container),this.container=t}else"string"==typeof this.options.container?this.container=document.querySelector(this.options.container):this.container=this.options.container;this.container instanceof HTMLElement?(this.container.classList.add("ql-toolbar"),this.controls=[],this.handlers={},this.options.handlers&&Object.keys(this.options.handlers).forEach(e=>{var t;const n=null==(t=this.options.handlers)?void 0:t[e];n&&this.addHandler(e,n)}),Array.from(this.container.querySelectorAll("button, select")).forEach(e=>{this.attach(e)}),this.quill.on(Us.events.EDITOR_CHANGE,()=>{const[e]=this.quill.selection.getRange();this.update(e)})):Ol.error("Container required for toolbar",this.options)}addHandler(e,t){this.handlers[e]=t}attach(e){let t=Array.from(e.classList).find(e=>0===e.indexOf("ql-"));if(!t)return;if(t=t.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[t]&&null==this.quill.scroll.query(t))return void Ol.warn("ignoring attaching to nonexistent format",t,e);const n="SELECT"===e.tagName?"change":"click";e.addEventListener(n,n=>{let r;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;const t=e.options[e.selectedIndex];r=!t.hasAttribute("selected")&&(t.value||!1)}else r=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),n.preventDefault();this.quill.focus();const[i]=this.quill.selection.getRange();if(null!=this.handlers[t])this.handlers[t].call(this,r);else if(this.quill.scroll.query(t).prototype instanceof yi){if(r=prompt(`Enter ${t}`),!r)return;this.quill.updateContents((new Hi).retain(i.index).delete(i.length).insert({[t]:r}),Us.sources.USER)}else this.quill.format(t,r,Us.sources.USER);this.update(i)}),this.controls.push([t,e])}update(e){const t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(n=>{const[r,i]=n;if("SELECT"===i.tagName){let n=null;if(null==e)n=null;else if(null==t[r])n=i.querySelector("option[selected]");else if(!Array.isArray(t[r])){let e=t[r];"string"==typeof e&&(e=e.replace(/"/g,'\\"')),n=i.querySelector(`option[value="${e}"]`)}null==n?(i.value="",i.selectedIndex=-1):n.selected=!0}else if(null==e)i.classList.remove("ql-active"),i.setAttribute("aria-pressed","false");else if(i.hasAttribute("value")){const e=t[r],n=e===i.getAttribute("value")||null!=e&&e.toString()===i.getAttribute("value")||null==e&&!i.getAttribute("value");i.classList.toggle("ql-active",n),i.setAttribute("aria-pressed",n.toString())}else{const e=null!=t[r];i.classList.toggle("ql-active",e),i.setAttribute("aria-pressed",e.toString())}})}}function Ll(e,t,n){const r=document.createElement("button");r.setAttribute("type","button"),r.classList.add(`ql-${t}`),r.setAttribute("aria-pressed","false"),null!=n?(r.value=n,r.setAttribute("aria-label",`${t}: ${n}`)):r.setAttribute("aria-label",t),e.appendChild(r)}Tl.DEFAULTS={},Tl.DEFAULTS={container:null,handlers:{clean(){const e=this.quill.getSelection();if(null!=e)if(0===e.length){const e=this.quill.getFormat();Object.keys(e).forEach(e=>{null!=this.quill.scroll.query(e,Gr.INLINE)&&this.quill.format(e,!1,Us.sources.USER)})}else this.quill.removeFormat(e.index,e.length,Us.sources.USER)},direction(e){const{align:t}=this.quill.getFormat();"rtl"===e&&null==t?this.quill.format("align","right",Us.sources.USER):e||"right"!==t||this.quill.format("align",!1,Us.sources.USER),this.quill.format("direction",e,Us.sources.USER)},indent(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0,10);if("+1"===e||"-1"===e){let t="+1"===e?1:-1;"rtl"===n.direction&&(t*=-1),this.quill.format("indent",r+t,Us.sources.USER)}},link(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,Us.sources.USER)},list(e){const t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,Us.sources.USER):this.quill.format("list","unchecked",Us.sources.USER):this.quill.format("list",e,Us.sources.USER)}}};const Il='<svg viewbox="0 0 18 18"><polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"/><polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"/><line class="ql-stroke" x1="10" x2="8" y1="5" y2="13"/></svg>',Rl={align:{"":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="13" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="9" y1="4" y2="4"/></svg>',center:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="14" x2="4" y1="14" y2="14"/><line class="ql-stroke" x1="12" x2="6" y1="4" y2="4"/></svg>',right:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="5" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="9" y1="4" y2="4"/></svg>',justify:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="15" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="15" x2="3" y1="14" y2="14"/><line class="ql-stroke" x1="15" x2="3" y1="4" y2="4"/></svg>'},background:'<svg viewbox="0 0 18 18"><g class="ql-fill ql-color-label"><polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"/><rect height="1" width="1" x="4" y="4"/><polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"/><rect height="1" width="1" x="2" y="6"/><rect height="1" width="1" x="3" y="5"/><rect height="1" width="1" x="4" y="7"/><polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"/><rect height="1" width="1" x="2" y="12"/><rect height="1" width="1" x="2" y="9"/><rect height="1" width="1" x="2" y="15"/><polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"/><rect height="1" width="1" x="3" y="8"/><path d="M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z"/><path d="M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z"/><path d="M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z"/><rect height="1" width="1" x="12" y="2"/><rect height="1" width="1" x="11" y="3"/><path d="M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z"/><rect height="1" width="1" x="2" y="3"/><rect height="1" width="1" x="6" y="2"/><rect height="1" width="1" x="3" y="2"/><rect height="1" width="1" x="5" y="3"/><rect height="1" width="1" x="9" y="2"/><rect height="1" width="1" x="15" y="14"/><polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"/><rect height="1" width="1" x="13" y="7"/><rect height="1" width="1" x="15" y="5"/><rect height="1" width="1" x="14" y="6"/><rect height="1" width="1" x="15" y="8"/><rect height="1" width="1" x="14" y="9"/><path d="M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z"/><rect height="1" width="1" x="14" y="3"/><polygon points="12 6.868 12 6 11.62 6 12 6.868"/><rect height="1" width="1" x="15" y="2"/><rect height="1" width="1" x="12" y="5"/><rect height="1" width="1" x="13" y="4"/><polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"/><rect height="1" width="1" x="9" y="14"/><rect height="1" width="1" x="8" y="15"/><path d="M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z"/><rect height="1" width="1" x="5" y="15"/><path d="M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z"/><rect height="1" width="1" x="11" y="15"/><path d="M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z"/><rect height="1" width="1" x="14" y="15"/><rect height="1" width="1" x="15" y="11"/></g><polyline class="ql-stroke" points="5.5 13 9 5 12.5 13"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="11" y2="11"/></svg>',blockquote:'<svg viewbox="0 0 18 18"><rect class="ql-fill ql-stroke" height="3" width="3" x="4" y="5"/><rect class="ql-fill ql-stroke" height="3" width="3" x="11" y="5"/><path class="ql-even ql-fill ql-stroke" d="M7,8c0,4.031-3,5-3,5"/><path class="ql-even ql-fill ql-stroke" d="M14,8c0,4.031-3,5-3,5"/></svg>',bold:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"/><path class="ql-stroke" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"/></svg>',clean:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="5" x2="13" y1="3" y2="3"/><line class="ql-stroke" x1="6" x2="9.35" y1="12" y2="3"/><line class="ql-stroke" x1="11" x2="15" y1="11" y2="15"/><line class="ql-stroke" x1="15" x2="11" y1="11" y2="15"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="7" x="2" y="14"/></svg>',code:Il,"code-block":Il,color:'<svg viewbox="0 0 18 18"><line class="ql-color-label ql-stroke ql-transparent" x1="3" x2="15" y1="15" y2="15"/><polyline class="ql-stroke" points="5.5 11 9 3 12.5 11"/><line class="ql-stroke" x1="11.63" x2="6.38" y1="9" y2="9"/></svg>',direction:{"":'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"/><line class="ql-stroke ql-fill" x1="15" x2="11" y1="4" y2="4"/><path class="ql-fill" d="M11,3a3,3,0,0,0,0,6h1V3H11Z"/><rect class="ql-fill" height="11" width="1" x="11" y="4"/><rect class="ql-fill" height="11" width="1" x="13" y="4"/></svg>',rtl:'<svg viewbox="0 0 18 18"><polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"/><line class="ql-stroke ql-fill" x1="9" x2="5" y1="4" y2="4"/><path class="ql-fill" d="M5,3A3,3,0,0,0,5,9H6V3H5Z"/><rect class="ql-fill" height="11" width="1" x="5" y="4"/><rect class="ql-fill" height="11" width="1" x="7" y="4"/></svg>'},formula:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z"/><rect class="ql-fill" height="1.6" rx="0.8" ry="0.8" width="5" x="5.15" y="6.2"/><path class="ql-fill" d="M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z"/></svg>',header:{1:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"/></svg>',2:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',3:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',4:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm7.05371,7.96582v.38477c0,.39648-.165.60547-.46191.60547h-.47314v1.29785a.54085.54085,0,0,1-.605.60547h-.69336a.54085.54085,0,0,1-.605-.60547V12.95605H11.333a.5412.5412,0,0,1-.60547-.60547v-.15332a1.199,1.199,0,0,1,.22021-.748l2.56348-4.05957a.7819.7819,0,0,1,.72607-.39648h1.27637a.54085.54085,0,0,1,.605.60547v3.7627h.33008A.54055.54055,0,0,1,17.05371,11.96582ZM14.28125,8.7207h-.022a4.18969,4.18969,0,0,1-.38525.81348l-1.188,1.80469v.02246h1.5293V9.60059A7.04058,7.04058,0,0,1,14.28125,8.7207Z"/></svg>',5:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M16.74023,12.18555a2.75131,2.75131,0,0,1-2.91553,2.80566,3.908,3.908,0,0,1-2.25537-.68164.54809.54809,0,0,1-.13184-.8252L11.73438,13c.209-.34082.48389-.36328.8252-.1543a2.23757,2.23757,0,0,0,1.1001.33008,1.01827,1.01827,0,0,0,1.1001-.96777c0-.61621-.53906-.97949-1.25439-.97949a2.15554,2.15554,0,0,0-.64893.09961,1.15209,1.15209,0,0,1-.814.01074l-.12109-.04395a.64116.64116,0,0,1-.45117-.71484l.231-3.00391a.56666.56666,0,0,1,.62744-.583H15.541a.54085.54085,0,0,1,.605.60547v.43945a.54085.54085,0,0,1-.605.60547H13.41748l-.04395.72559a1.29306,1.29306,0,0,1-.04395.30859h.022a2.39776,2.39776,0,0,1,.57227-.07715A2.53266,2.53266,0,0,1,16.74023,12.18555ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"/></svg>',6:'<svg viewBox="0 0 18 18"><path class="ql-fill" d="M14.51758,9.64453a1.85627,1.85627,0,0,0-1.24316.38477H13.252a1.73532,1.73532,0,0,1,1.72754-1.4082,2.66491,2.66491,0,0,1,.5498.06641c.35254.05469.57227.01074.70508-.40723l.16406-.5166a.53393.53393,0,0,0-.373-.75977,4.83723,4.83723,0,0,0-1.17773-.14258c-2.43164,0-3.7627,2.17773-3.7627,4.43359,0,2.47559,1.60645,3.69629,3.19043,3.69629A2.70585,2.70585,0,0,0,16.96,12.19727,2.43861,2.43861,0,0,0,14.51758,9.64453Zm-.23047,3.58691c-.67187,0-1.22168-.81445-1.22168-1.45215,0-.47363.30762-.583.72559-.583.96875,0,1.27734.59375,1.27734,1.12207A.82182.82182,0,0,1,14.28711,13.23145ZM10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Z"/></svg>'},italic:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="13" y1="4" y2="4"/><line class="ql-stroke" x1="5" x2="11" y1="14" y2="14"/><line class="ql-stroke" x1="8" x2="10" y1="14" y2="4"/></svg>',image:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="10" width="12" x="3" y="4"/><circle class="ql-fill" cx="6" cy="7" r="1"/><polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"/></svg>',indent:{"+1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"/></svg>',"-1":'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="3" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="5 7 5 11 3 9 5 7"/></svg>'},link:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="11" y1="7" y2="11"/><path class="ql-even ql-stroke" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"/><path class="ql-even ql-stroke" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"/></svg>',list:{bullet:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="6" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="6" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="6" x2="15" y1="14" y2="14"/><line class="ql-stroke" x1="3" x2="3" y1="4" y2="4"/><line class="ql-stroke" x1="3" x2="3" y1="9" y2="9"/><line class="ql-stroke" x1="3" x2="3" y1="14" y2="14"/></svg>',check:'<svg class="" viewbox="0 0 18 18"><line class="ql-stroke" x1="9" x2="15" y1="4" y2="4"/><polyline class="ql-stroke" points="3 4 4 5 6 3"/><line class="ql-stroke" x1="9" x2="15" y1="14" y2="14"/><polyline class="ql-stroke" points="3 14 4 15 6 13"/><line class="ql-stroke" x1="9" x2="15" y1="9" y2="9"/><polyline class="ql-stroke" points="3 9 4 10 6 8"/></svg>',ordered:'<svg viewbox="0 0 18 18"><line class="ql-stroke" x1="7" x2="15" y1="4" y2="4"/><line class="ql-stroke" x1="7" x2="15" y1="9" y2="9"/><line class="ql-stroke" x1="7" x2="15" y1="14" y2="14"/><line class="ql-stroke ql-thin" x1="2.5" x2="4.5" y1="5.5" y2="5.5"/><path class="ql-fill" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"/><path class="ql-stroke ql-thin" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"/><path class="ql-stroke ql-thin" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"/></svg>'},script:{sub:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z"/><path class="ql-fill" d="M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z"/></svg>',super:'<svg viewbox="0 0 18 18"><path class="ql-fill" d="M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z"/><path class="ql-fill" d="M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z"/></svg>'},strike:'<svg viewbox="0 0 18 18"><line class="ql-stroke ql-thin" x1="15.5" x2="2.5" y1="8.5" y2="9.5"/><path class="ql-fill" d="M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z"/><path class="ql-fill" d="M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z"/></svg>',table:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="2" width="3" x="5" y="5"/><rect class="ql-fill" height="2" width="4" x="9" y="5"/><g class="ql-fill ql-transparent"><rect height="2" width="3" x="5" y="8"/><rect height="2" width="4" x="9" y="8"/><rect height="2" width="3" x="5" y="11"/><rect height="2" width="4" x="9" y="11"/></g></svg>',underline:'<svg viewbox="0 0 18 18"><path class="ql-stroke" d="M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3"/><rect class="ql-fill" height="1" rx="0.5" ry="0.5" width="12" x="3" y="15"/></svg>',video:'<svg viewbox="0 0 18 18"><rect class="ql-stroke" height="12" width="12" x="3" y="3"/><rect class="ql-fill" height="12" width="1" x="5" y="3"/><rect class="ql-fill" height="12" width="1" x="12" y="3"/><rect class="ql-fill" height="2" width="8" x="5" y="8"/><rect class="ql-fill" height="1" width="3" x="3" y="5"/><rect class="ql-fill" height="1" width="3" x="3" y="7"/><rect class="ql-fill" height="1" width="3" x="3" y="10"/><rect class="ql-fill" height="1" width="3" x="3" y="12"/><rect class="ql-fill" height="1" width="3" x="12" y="5"/><rect class="ql-fill" height="1" width="3" x="12" y="7"/><rect class="ql-fill" height="1" width="3" x="12" y="10"/><rect class="ql-fill" height="1" width="3" x="12" y="12"/></svg>'};let Ml=0;function Bl(e,t){e.setAttribute(t,`${!("true"===e.getAttribute(t))}`)}class Dl{constructor(e){this.select=e,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",()=>{this.togglePicker()}),this.label.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.togglePicker();break;case"Escape":this.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}togglePicker(){this.container.classList.toggle("ql-expanded"),Bl(this.label,"aria-expanded"),Bl(this.options,"aria-hidden")}buildItem(e){const t=document.createElement("span");t.tabIndex="0",t.setAttribute("role","button"),t.classList.add("ql-picker-item");const n=e.getAttribute("value");return n&&t.setAttribute("data-value",n),e.textContent&&t.setAttribute("data-label",e.textContent),t.addEventListener("click",()=>{this.selectItem(t,!0)}),t.addEventListener("keydown",e=>{switch(e.key){case"Enter":this.selectItem(t,!0),e.preventDefault();break;case"Escape":this.escape(),e.preventDefault()}}),t}buildLabel(){const e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML='<svg viewbox="0 0 18 18"><polygon class="ql-stroke" points="7 11 9 13 11 11 7 11"/><polygon class="ql-stroke" points="7 7 9 5 11 7 7 7"/></svg>',e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}buildOptions(){const e=document.createElement("span");e.classList.add("ql-picker-options"),e.setAttribute("aria-hidden","true"),e.tabIndex="-1",e.id=`ql-picker-options-${Ml}`,Ml+=1,this.label.setAttribute("aria-controls",e.id),this.options=e,Array.from(this.select.options).forEach(t=>{const n=this.buildItem(t);e.appendChild(n),!0===t.selected&&this.selectItem(n)}),this.container.appendChild(e)}buildPicker(){Array.from(this.select.attributes).forEach(e=>{this.container.setAttribute(e.name,e.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}escape(){this.close(),setTimeout(()=>this.label.focus(),1)}close(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}selectItem(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.container.querySelector(".ql-selected");e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=Array.from(e.parentNode.children).indexOf(e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t&&(this.select.dispatchEvent(new Event("change")),this.close())))}update(){let e;if(this.select.selectedIndex>-1){const t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);const t=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",t)}}class Pl extends Dl{constructor(e,t){super(e),this.label.innerHTML=t,this.container.classList.add("ql-color-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).slice(0,7).forEach(e=>{e.classList.add("ql-primary")})}buildItem(e){const t=super.buildItem(e);return t.style.backgroundColor=e.getAttribute("value")||"",t}selectItem(e,t){super.selectItem(e,t);const n=this.label.querySelector(".ql-color-label"),r=e&&e.getAttribute("data-value")||"";n&&("line"===n.tagName?n.style.stroke=r:n.style.fill=r)}}class Fl extends Dl{constructor(e,t){super(e),this.container.classList.add("ql-icon-picker"),Array.from(this.container.querySelectorAll(".ql-picker-item")).forEach(e=>{e.innerHTML=t[e.getAttribute("data-value")||""]}),this.defaultItem=this.container.querySelector(".ql-selected"),this.selectItem(this.defaultItem)}selectItem(e,t){super.selectItem(e,t);const n=e||this.defaultItem;if(null!=n){if(this.label.innerHTML===n.innerHTML)return;this.label.innerHTML=n.innerHTML}}}class Ul{constructor(e,t){this.quill=e,this.boundsContainer=t||document.body,this.root=e.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,(e=>{const{overflowY:t}=getComputedStyle(e,null);return"visible"!==t&&"clip"!==t})(this.quill.root)&&this.quill.root.addEventListener("scroll",()=>{this.root.style.marginTop=-1*this.quill.root.scrollTop+"px"}),this.hide()}hide(){this.root.classList.add("ql-hidden")}position(e){const t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=`${t}px`,this.root.style.top=`${n}px`,this.root.classList.remove("ql-flip");const r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect();let s=0;if(i.right>r.right&&(s=r.right-i.right,this.root.style.left=`${t+s}px`),i.left<r.left&&(s=r.left-i.left,this.root.style.left=`${t+s}px`),i.bottom>r.bottom){const t=i.bottom-i.top,r=e.bottom-e.top+t;this.root.style.top=n-r+"px",this.root.classList.add("ql-flip")}return s}show(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}const $l=[!1,"center","right","justify"],zl=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],Vl=[!1,"serif","monospace"],Hl=["1","2","3",!1],Kl=["small",!1,"large","huge"];class Wl extends Ts{constructor(e,t){super(e,t);const n=t=>{document.body.contains(e.root)?(null==this.tooltip||this.tooltip.root.contains(t.target)||document.activeElement===this.tooltip.textbox||this.quill.hasFocus()||this.tooltip.hide(),null!=this.pickers&&this.pickers.forEach(e=>{e.container.contains(t.target)||e.close()})):document.body.removeEventListener("click",n)};e.emitter.listenDOM("click",document.body,n)}addModule(e){const t=super.addModule(e);return"toolbar"===e&&this.extendToolbar(t),t}buildButtons(e,t){Array.from(e).forEach(e=>{(e.getAttribute("class")||"").split(/\s+/).forEach(n=>{if(n.startsWith("ql-")&&(n=n.slice(3),null!=t[n]))if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{const r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}buildPickers(e,t){this.pickers=Array.from(e).map(e=>{if(e.classList.contains("ql-align")&&(null==e.querySelector("option")&&Gl(e,$l),"object"==typeof t.align))return new Fl(e,t.align);if(e.classList.contains("ql-background")||e.classList.contains("ql-color")){const n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&Gl(e,zl,"background"===n?"#ffffff":"#000000"),new Pl(e,t[n])}return null==e.querySelector("option")&&(e.classList.contains("ql-font")?Gl(e,Vl):e.classList.contains("ql-header")?Gl(e,Hl):e.classList.contains("ql-size")&&Gl(e,Kl)),new Dl(e)});this.quill.on(ps.events.EDITOR_CHANGE,()=>{this.pickers.forEach(e=>{e.update()})})}}Wl.DEFAULTS=Zr({},Ts.DEFAULTS,{modules:{toolbar:{handlers:{formula(){this.quill.theme.tooltip.edit("formula")},image(){let e=this.container.querySelector("input.ql-image[type=file]");null==e&&(e=document.createElement("input"),e.setAttribute("type","file"),e.setAttribute("accept",this.quill.uploader.options.mimetypes.join(", ")),e.classList.add("ql-image"),e.addEventListener("change",()=>{const t=this.quill.getSelection(!0);this.quill.uploader.upload(t,e.files),e.value=""}),this.container.appendChild(e)),e.click()},video(){this.quill.theme.tooltip.edit("video")}}}}});class Zl extends Ul{constructor(e,t){super(e,t),this.textbox=this.root.querySelector('input[type="text"]'),this.listen()}listen(){this.textbox.addEventListener("keydown",e=>{"Enter"===e.key?(this.save(),e.preventDefault()):"Escape"===e.key&&(this.cancel(),e.preventDefault())})}cancel(){this.hide(),this.restoreFocus()}edit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null==this.textbox)return;null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value="");const n=this.quill.getBounds(this.quill.selection.savedRange);null!=n&&this.position(n),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute(`data-${e}`)||""),this.root.setAttribute("data-mode",e)}restoreFocus(){this.quill.focus({preventScroll:!0})}save(){let{value:e}=this.textbox;switch(this.root.getAttribute("data-mode")){case"link":{const{scrollTop:t}=this.quill.root;this.linkRange?(this.quill.formatText(this.linkRange,"link",e,ps.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",e,ps.sources.USER)),this.quill.root.scrollTop=t;break}case"video":e=function(e){let t=e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);if(t)return`${t[1]||"https"}://www.youtube.com/embed/${t[2]}?showinfo=0`;if(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))return`${t[1]||"https"}://player.vimeo.com/video/${t[2]}/`;return e}(e);case"formula":{if(!e)break;const t=this.quill.getSelection(!0);if(null!=t){const n=t.index+t.length;this.quill.insertEmbed(n,this.root.getAttribute("data-mode"),e,ps.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(n+1," ",ps.sources.USER),this.quill.setSelection(n+2,ps.sources.USER)}break}}this.textbox.value="",this.hide()}}function Gl(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(t=>{const r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",String(t)),e.appendChild(r)})}const Yl=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]];class Jl extends Zl{constructor(e,t){super(e,t),this.quill.on(ps.events.EDITOR_CHANGE,(e,t,n,r)=>{if(e===ps.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&r===ps.sources.USER){this.show(),this.root.style.left="0px",this.root.style.width="",this.root.style.width=`${this.root.offsetWidth}px`;const e=this.quill.getLines(t.index,t.length);if(1===e.length){const e=this.quill.getBounds(t);null!=e&&this.position(e)}else{const n=e[e.length-1],r=this.quill.getIndex(n),i=Math.min(n.length()-1,t.index+t.length-r),s=this.quill.getBounds(new gs(r,i));null!=s&&this.position(s)}}else document.activeElement!==this.textbox&&this.quill.hasFocus()&&this.hide()})}listen(){super.listen(),this.root.querySelector(".ql-close").addEventListener("click",()=>{this.root.classList.remove("ql-editing")}),this.quill.on(ps.events.SCROLL_OPTIMIZE,()=>{setTimeout(()=>{if(this.root.classList.contains("ql-hidden"))return;const e=this.quill.getSelection();if(null!=e){const t=this.quill.getBounds(e);null!=t&&this.position(t)}},1)})}cancel(){this.show()}position(e){const t=super.position(e),n=this.root.querySelector(".ql-tooltip-arrow");return n.style.marginLeft="",0!==t&&(n.style.marginLeft=-1*t-n.offsetWidth/2+"px"),t}}t(Jl,"TEMPLATE",['<span class="ql-tooltip-arrow"></span>','<div class="ql-tooltip-editor">','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-close"></a>',"</div>"].join(""));class Xl extends Wl{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=Yl),super(e,t),this.quill.container.classList.add("ql-bubble")}extendToolbar(e){this.tooltip=new Jl(this.quill,this.options.bounds),null!=e.container&&(this.tooltip.root.appendChild(e.container),this.buildButtons(e.container.querySelectorAll("button"),Rl),this.buildPickers(e.container.querySelectorAll("select"),Rl))}}Xl.DEFAULTS=Zr({},Wl.DEFAULTS,{modules:{toolbar:{handlers:{link(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1,Us.sources.USER)}}}}});const Ql=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]];class ea extends Zl{constructor(){super(...arguments),t(this,"preview",this.root.querySelector("a.ql-preview"))}listen(){super.listen(),this.root.querySelector("a.ql-action").addEventListener("click",e=>{this.root.classList.contains("ql-editing")?this.save():this.edit("link",this.preview.textContent),e.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",e=>{if(null!=this.linkRange){const e=this.linkRange;this.restoreFocus(),this.quill.formatText(e,"link",!1,ps.sources.USER),delete this.linkRange}e.preventDefault(),this.hide()}),this.quill.on(ps.events.SELECTION_CHANGE,(e,t,n)=>{if(null!=e){if(0===e.length&&n===ps.sources.USER){const[t,n]=this.quill.scroll.descendant(ul,e.index);if(null!=t){this.linkRange=new gs(e.index-n,t.length());const r=ul.formats(t.domNode);this.preview.textContent=r,this.preview.setAttribute("href",r),this.show();const i=this.quill.getBounds(this.linkRange);return void(null!=i&&this.position(i))}}else delete this.linkRange;this.hide()}})}show(){super.show(),this.root.removeAttribute("data-mode")}}t(ea,"TEMPLATE",['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>','<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">','<a class="ql-action"></a>','<a class="ql-remove"></a>'].join(""));class ta extends Wl{constructor(e,t){null!=t.modules.toolbar&&null==t.modules.toolbar.container&&(t.modules.toolbar.container=Ql),super(e,t),this.quill.container.classList.add("ql-snow")}extendToolbar(e){null!=e.container&&(e.container.classList.add("ql-snow"),this.buildButtons(e.container.querySelectorAll("button"),Rl),this.buildPickers(e.container.querySelectorAll("select"),Rl),this.tooltip=new ea(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"k",shortKey:!0},(t,n)=>{e.handlers.link.call(e,!n.format.link)}))}}ta.DEFAULTS=Zr({},Wl.DEFAULTS,{modules:{toolbar:{handlers:{link(e){if(e){const e=this.quill.getSelection();if(null==e||0===e.length)return;let t=this.quill.getText(e);/^\S+@\S+\.\S+$/.test(t)&&0!==t.indexOf("mailto:")&&(t=`mailto:${t}`);const{tooltip:n}=this.quill.theme;n.edit("link",t)}else this.quill.format("link",!1,Us.sources.USER)}}}}}),Us.register({"attributors/attribute/direction":fo,"attributors/class/align":to,"attributors/class/background":oo,"attributors/class/color":io,"attributors/class/direction":po,"attributors/class/font":bo,"attributors/class/size":yo,"attributors/style/align":no,"attributors/style/background":lo,"attributors/style/color":so,"attributors/style/direction":mo,"attributors/style/font":vo,"attributors/style/size":xo},!0),Us.register({"formats/align":to,"formats/direction":po,"formats/indent":rl,"formats/background":lo,"formats/color":so,"formats/font":bo,"formats/size":yo,"formats/blockquote":il,"formats/code-block":co,"formats/header":sl,"formats/list":ll,"formats/bold":al,"formats/code":uo,"formats/italic":cl,"formats/link":ul,"formats/script":dl,"formats/strike":fl,"formats/underline":pl,"formats/formula":ml,"formats/image":bl,"formats/video":yl,"modules/syntax":kl,"modules/table":class extends Cs{static register(){Us.register(Sl),Us.register(Cl),Us.register(jl),Us.register(ql)}constructor(){super(...arguments),this.listenBalanceCells()}balanceTables(){this.quill.scroll.descendants(ql).forEach(e=>{e.balanceCells()})}deleteColumn(){const[e,,t]=this.getTable();null!=t&&(e.deleteColumn(t.cellOffset()),this.quill.update(Us.sources.USER))}deleteRow(){const[,e]=this.getTable();null!=e&&(e.remove(),this.quill.update(Us.sources.USER))}deleteTable(){const[e]=this.getTable();if(null==e)return;const t=e.offset();e.remove(),this.quill.update(Us.sources.USER),this.quill.setSelection(t,Us.sources.SILENT)}getTable(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.quill.getSelection();if(null==e)return[null,null,null,-1];const[t,n]=this.quill.getLine(e.index);if(null==t||t.statics.blotName!==Sl.blotName)return[null,null,null,-1];const r=t.parent;return[r.parent.parent,r,t,n]}insertColumn(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=i.cellOffset();n.insertColumn(s+e),this.quill.update(Us.sources.USER);let o=r.rowOffset();0===e&&(o+=1),this.quill.setSelection(t.index+o,t.length,Us.sources.SILENT)}insertColumnLeft(){this.insertColumn(0)}insertColumnRight(){this.insertColumn(1)}insertRow(e){const t=this.quill.getSelection();if(!t)return;const[n,r,i]=this.getTable(t);if(null==i)return;const s=r.rowOffset();n.insertRow(s+e),this.quill.update(Us.sources.USER),e>0?this.quill.setSelection(t,Us.sources.SILENT):this.quill.setSelection(t.index+r.children.length,t.length,Us.sources.SILENT)}insertRowAbove(){this.insertRow(0)}insertRowBelow(){this.insertRow(1)}insertTable(e,t){const n=this.quill.getSelection();if(null==n)return;const r=new Array(e).fill(0).reduce(e=>{const n=new Array(t).fill("\n").join("");return e.insert(n,{table:_l()})},(new Hi).retain(n.index));this.quill.updateContents(r,Us.sources.USER),this.quill.setSelection(n.index,Us.sources.SILENT),this.balanceTables()}listenBalanceCells(){this.quill.on(Us.events.SCROLL_OPTIMIZE,e=>{e.some(e=>!!["TD","TR","TBODY","TABLE"].includes(e.target.tagName)&&(this.quill.once(Us.events.TEXT_CHANGE,(e,t,n)=>{n===Us.sources.USER&&this.balanceTables()}),!0))})}},"modules/toolbar":Tl,"themes/bubble":Xl,"themes/snow":ta,"ui/icons":Rl,"ui/picker":Dl,"ui/icon-picker":Fl,"ui/color-picker":Pl,"ui/tooltip":Ul},!0);const na=({value:e,onChange:t,placeholder:i,style:s})=>{const o=r.useRef(null),l=r.useRef(null);return r.useEffect(()=>{if(o.current&&!l.current){l.current=new Us(o.current,{theme:"snow",modules:{toolbar:[[{header:[1,2,!1]}],["bold","italic","underline"],["link","image"]]},placeholder:i});const e=l.current;e.on("text-change",(n,r,i)=>{if("user"===i){const n=e.root.innerHTML;null==t||t("<p><br></p>"===n?"":n)}})}},[i]),r.useEffect(()=>{const t=l.current;if(t&&e!==t.root.innerHTML){const n=0===t.getText().trim().length;!e&&n||t.clipboard.dangerouslyPasteHTML(e||"")}},[e]),n.jsx("div",{ref:o,style:{minHeight:"200px",...s}})},ra="_fileUploadWrapper_byo9w_1",ia=({value:e,onChange:t,accept:o=".pdf,.doc,.docx,.xls,.xlsx,.txt,.zip,.rar",listType:l="text",maxCount:a=1,key:c,disabled:u=!1,maxSize:h=1e3,buttonText:d="上传文件"})=>{const[p,m]=r.useState(!1),[g,b]=r.useState(""),[v,y]=r.useState(""),[x,w]=r.useState("none"),[N,E]=r.useState([]),[k,A]=r.useState(!1),S=e=>{try{const n=e.split("/");let r=n[n.length-1];r.includes("?")&&(r=r.split("?")[0]);try{r=decodeURIComponent(r)}catch(t){}return r||"未知文件"}catch(n){return"未知文件"}},C=e=>e?Array.isArray(e)?e.filter(Boolean):"string"==typeof e?e.split(",").map(e=>e.trim()).filter(Boolean):[]:[],j=r.useMemo(()=>{const t=C(e);return JSON.stringify(t)},[e]),q=r.useRef(N);r.useEffect(()=>{q.current=N},[N]),r.useEffect(()=>{if(k)return void A(!1);const t=C(e),n=q.current.filter(e=>"done"===e.status).map(e=>e.url).filter(Boolean);if(JSON.stringify(n)!==JSON.stringify(t))if(t.length>0){const e=t.map((e,t)=>({uid:`-${t+1}`,name:S(e),status:"done",url:e}));E(e)}else E([])},[j,k]);const _=r.useCallback(e=>{t&&t(e)},[t]);return n.jsxs("div",{className:ra,children:[n.jsx(i.Upload,{accept:o,listType:l,fileList:N,onPreview:async e=>{const t=e.url||e.preview,n=e.name||"",r=(e=>{const t=e.substring(e.lastIndexOf(".")).toLowerCase();return[".jpg",".jpeg",".png",".gif",".bmp",".webp"].includes(t)?"image":[".txt",".json",".xml",".log"].includes(t)?"text":"none"})(n);y(n),w(r),"image"===r?(e.url||e.preview||!e.originFileObj||(e.preview=await(e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}))(e.originFileObj)),b(e.url||e.preview),m(!0)):t?window.open(t,"_blank"):i.message.info("文件预览不可用")},onChange:({file:e,fileList:t})=>{var n,r;if(A(!0),"done"===e.status){if(null==(n=e.response)?void 0:n.data){i.message.success(`${e.name} 文件上传成功`);const n=t.map(t=>{var n;return t.uid===e.uid&&(null==(n=t.response)?void 0:n.data)?{...t,url:t.response.data,name:t.name}:t});E(n);const r=n.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==_||_(r[0]||void 0):null==_||_(r.length>0?r:void 0)}else i.message.error(`${e.name} 文件上传成功,但未获取到 URL。`),E(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 文件已移除`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==_||_(void 0):null==_||_(n.length>0?n:void 0)}else if("error"===e.status){i.message.error(`${e.name} 文件上传失败: ${(null==(r=e.error)?void 0:r.message)||"未知错误"}`),E(t);const n=t.filter(e=>"done"===e.status).map(e=>{var t;return(null==(t=e.response)?void 0:t.data)||e.url}).filter(Boolean);1===a?null==_||_(n[0]||void 0):null==_||_(n.length>0?n:void 0)}else E(t)},customRequest:async e=>{var t;const{onSuccess:n,onError:r,file:o,onProgress:l}=e,a=1024*h*1024;if(o instanceof File&&o.size>a)return i.message.error(`文件大小不能超过 ${h}MB`),void r(new Error(`文件大小不能超过 ${h}MB`));const c=new FormData;c.append("file",o);const u=null==(t=null==f?void 0:f.getOrgInfo())?void 0:t.orgId;u&&c.append("orgId",u.toString());try{const e=await(async(e,t)=>{const n=f.getToken();try{return(await s.post("/api/sterilization-service/common/uploadFile",e,{timeout:12e4,headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${n}`,accessToken:n,...null==t?void 0:t.headers},onUploadProgress:null==t?void 0:t.onUploadProgress})).data}catch(r){if("ECONNABORTED"===r.code)throw new Error("上传超时,请检查网络连接或文件大小");throw r}})(c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:e=>{e.total&&l({percent:e.loaded/e.total*100})}});e&&e.data?n(e,o):r(new Error("上传成功但响应中缺少文件URL"),e)}catch(d){r(d)}},maxCount:a,disabled:u,showUploadList:{showDownloadIcon:!0,showRemoveIcon:!u},onRemove:e=>!0,children:N.length>=(a||1)?null:n.jsx(i.Button,{icon:n.jsx(Ke,{}),disabled:u,type:"primary",children:d})},c),n.jsxs(i.Modal,{visible:p,title:v,footer:null,onCancel:()=>{m(!1),b(""),w("none")},width:"image"===x?800:600,children:["image"===x&&n.jsx("img",{alt:"预览",style:{width:"100%"},src:g}),"text"===x&&n.jsx("pre",{style:{maxHeight:"500px",overflow:"auto",whiteSpace:"pre-wrap"},children:g})]})]})},sa="_treeselectEllipsis_e4t0j_1",oa="_addonAfterSelect_e4t0j_19",la="_customDisabled_e4t0j_23",aa=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)}),ca=({value:e,onChange:t,accept:s="image/*",listType:o="picture-card",maxCount:l=1,maxSize:a=5,disabled:c=!1,...u})=>{const[h,d]=r.useState(!1),[f,p]=r.useState(""),[m,g]=r.useState(""),[b,v]=r.useState([]),y=e=>e?e.startsWith("data:")?e:`data:image/png;base64,${e}`:"",x=e=>e?e.includes(",")?e.split(",")[1]:e:"";r.useEffect(()=>{if(e&&Array.isArray(e)&&e.length>0){const t=e.map((e,t)=>{let n="",r="";if("string"==typeof e)r=x(e),n=y(e);else if(Array.isArray(e)&&e.length>0&&"number"==typeof e[0]){const t=(e=>{try{const t=new Uint8Array(e);let n="";for(let e=0;e<t.length;e++)n+=String.fromCharCode(t[e]);return`data:image/png;base64,${btoa(n)}`}catch(t){return""}})(e);r=x(t),n=t}return{uid:`-${t}`,name:`image-${t}.png`,status:"done",url:n,thumbUrl:n,response:{data:r,url:n}}});v(t)}else v([])},[e]);const w=r.useCallback(e=>{t&&t(e)},[t]),N=n.jsxs("div",{children:[n.jsx(Be,{}),n.jsx("div",{style:{marginTop:8},children:"上传"})]});return n.jsxs(n.Fragment,{children:[n.jsx(i.Upload,{accept:s,listType:o,fileList:b,onPreview:async e=>{let t=e.url;if(t||e.preview||!e.originFileObj?!t&&e.preview&&(t=e.preview):(e.preview=await aa(e.originFileObj),t=e.preview),!t)return void i.message.error("无法预览图片:未找到图片数据");p(t),d(!0);const n=e.name||"预览图片";g(n)},onChange:async({file:e,fileList:t})=>{var n,r,s;const o=e=>{var t,n;return(null==(t=e.response)?void 0:t.data)&&"string"==typeof e.response.data?x(e.response.data):(null==(n=e.response)?void 0:n.url)&&"string"==typeof e.response.url?x(e.response.url):e.url&&"string"==typeof e.url?x(e.url):e.preview&&"string"==typeof e.preview?x(e.preview):null};if("done"===e.status){const s=(null==(n=e.response)?void 0:n.data)||(null==(r=e.response)?void 0:r.url)||e.url||e.preview;if(s&&"string"==typeof s){i.message.success(`${e.name} 处理成功`);const n=y(s),r=t.map(t=>t.uid===e.uid?{...t,url:n,thumbUrl:n,response:{...e.response,data:x(s),url:n}}:t);v(r);const l=r.filter(e=>"done"===e.status).map(o).filter(Boolean);w(l.length>0?l:void 0)}else i.message.error(`${e.name} 处理失败:无法获取图片数据`),v(t.filter(t=>t.uid!==e.uid))}else if("removed"===e.status){i.message.success(`${e.name} 已移除`),v(t);const n=t.filter(e=>"done"===e.status).map(o).filter(Boolean);w(n.length>0?n:void 0)}else"error"===e.status?(i.message.error(`${e.name} 处理失败: ${(null==(s=e.error)?void 0:s.message)||"未知错误"}`),v(t)):v(t)},customRequest:async e=>{const{onSuccess:t,onError:n,file:r,onProgress:s}=e,o=1024*a*1024;if(r instanceof File&&r.size>o)return i.message.error(`图片大小不能超过 ${a}MB`),void(null==n||n(new Error(`图片大小不能超过 ${a}MB`)));try{s({percent:0});const e=await aa(r),n=x(e);s({percent:100});t({data:n,url:e,preview:e},r)}catch(l){i.message.error((null==l?void 0:l.message)||"图片处理失败"),n(l)}},beforeUpload:e=>{const t=1024*a*1024;if(e.size>t)return i.message.error(`图片大小不能超过 ${a}MB`),i.Upload.LIST_IGNORE;return!!e.type.startsWith("image/")||(i.message.error("只能上传图片文件"),i.Upload.LIST_IGNORE)},maxCount:l,disabled:c,...u,children:l&&b.length>=l?null:N}),n.jsx(i.Modal,{open:h,title:m,footer:null,onCancel:()=>d(!1),width:800,children:n.jsx("img",{alt:"preview",style:{width:"100%"},src:f})})]})},{TextArea:ua}=i.Input,ha=r.forwardRef((e,t)=>{var s;const{visible:c,mode:u,config:h,initialValues:d,onOk:p,onCancel:m,title:g,loading:b=!1,oneditFormChange:v,modalProps:y={},CustomModalFooter:x,tab:w=!1,validateConfig:N}=e,[E]=i.Form.useForm(),k="view"==u;r.useImperativeHandle(t,()=>({setFieldsValue:e=>{E.setFieldsValue(e)},getFieldsValue:()=>E.getFieldsValue()})),r.useEffect(()=>{if(c)if(E.resetFields(),"edit"!==u&&"view"!==u||!d){const e=[];w?h.forEach(t=>{t.children.forEach(t=>{var n,r;e.push({...t,defaultValue:t.defaultValue||(null==(r=null==(n=t.options)?void 0:n[0])?void 0:r.value)||t.defaultValue})})}):h.forEach(t=>{e.push({...t,defaultValue:t.defaultValue||t.defaultValue})}),(null==e?void 0:e.length)>0&&(null==e||e.forEach(e=>{E.setFieldsValue({[null==e?void 0:e.name]:null==e?void 0:e.defaultValue})})),I(E.getFieldValue("useOrgId")||T)}else if(w){const e={...d},t=[];h.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=l(n);else if("rangePicker"===t.type&&n)Array.isArray(n)&&(e[t.name]=n.map(e=>l(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else{const e={...d};h.forEach(t=>{const n=e[t.name];if("datePicker"===t.type&&n)e[t.name]=l(n);else if("rangePicker"===t.type&&n)Array.isArray(n)&&(e[t.name]=n.map(e=>l(e)));else if("treeSelect"===t.type&&t.multiple&&n)"string"==typeof n&&(e[t.name]=n.split(","));else if("Radio"===t.type&&t.options&&(0===n||1===n||"0"===n||"1"===n||n)){const r=t.options.find(e=>e.value==n);r&&(e[t.name]=r.value)}}),E.setFieldsValue(e)}else E.resetFields()},[c,u,d,E]),r.useEffect(()=>{if(c)if("edit"!==u&&"view"!==u||!d)I(E.getFieldValue("useOrgId")||T);else if(w){const e={...d},t=[];h.forEach(e=>{e.children.forEach(e=>{var n,r;t.push({...e,defaultValue:e.defaultValue||(null==(r=null==(n=e.options)?void 0:n[0])?void 0:r.value)||e.defaultValue})})}),t.forEach(t=>{"datePicker"===t.type&&e[t.name]?e[t.name]=l(e[t.name]):"rangePicker"===t.type&&e[t.name]?Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>l(e))):"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else{const e={...d};h.forEach(t=>{"datePicker"===t.type&&e[t.name]?e[t.name]=l(e[t.name]):"rangePicker"===t.type&&e[t.name]?Array.isArray(e[t.name])&&(e[t.name]=e[t.name].map(e=>l(e))):"treeSelect"===t.type&&t.multiple&&e[t.name]&&"string"==typeof e[t.name]&&(e[t.name]=e[t.name].split(","))})}else E.resetFields()},[h]);const A=r.useCallback(e=>{if(w){for(const t of h)if(t.children){const n=t.children.find(t=>t.name===e);if(n)return n.label}}else{const t=h.find(t=>t.name===e);if(t)return t.label}return e},[h,w]),S=r.useCallback((e,t)=>{const n=[];let r="";const i=new Set;return t&&Array.isArray(t)&&t.length>0&&(t.forEach(t=>{const s=e.filter(e=>t.includes(e.field)&&!i.has(e.field));if(s.length>1){const e=s.map(e=>A(e.field)).join("、")+"同时重复";s.forEach(t=>{n.push({name:t.field,errors:[e]}),i.add(t.field)}),r||(r=e)}else if(1===s.length){const e=s[0],t=A(e.field)+"重复";n.push({name:e.field,errors:[t]}),i.add(e.field),r||(r=t)}}),e.forEach(e=>{if(!i.has(e.field)){const t=A(e.field)+"重复";n.push({name:e.field,errors:[t]}),r||(r=t)}})),{errorFields:n,errorMessage:r||"验证失败"}},[A]),q=r.useMemo(()=>{if(!(null==N?void 0:N.realtime))return()=>{};const e=N.realtimeDelay||500;return o.debounce((e,t)=>{(async(e,t)=>{if(!N||!N.realtime)return;const{validateApi:n,validateFields:r,validateMethod:i="POST",validateParams:s,validateMessage:o="验证失败",union:l=!0,group:a}=N,c=t&&r.includes(t)?[t]:r,u=(null==d?void 0:d.id)||(null==d?void 0:d.ID)||null;let h;if(s)h=s(e);else{const t={};c.forEach(n=>{void 0!==e[n]&&null!==e[n]&&""!==e[n]&&(t[n]=e[n])}),h={field:c,value:t,id:u,union:l?1:0,group:a}}const f="GET"===i?await j(h,n):await C(h,n);if(200===f.code&&Array.isArray(f.data)){const e=f.data.filter(e=>!0===e.value);if(f.data.forEach(e=>{!1===e.value&&E.setFields([{name:e.field,errors:[]}])}),e.length>0){let t=[];if(a&&Array.isArray(a)&&a.length>0){const n=S(e,a);t=n.errorFields}else if(l&&e.length>1){const n=e.map(e=>A(e.field)).join("、")+"同时重复";e.forEach(e=>{t.push({name:e.field,errors:[n]})})}else e.forEach(e=>{const n=A(e.field);t.push({name:e.field,errors:[n+"重复"]})});t.length>0&&E.setFields(t)}}})(e,t).catch(()=>{})},e)},[N]),O=(e,t)=>{if("name"==t.name&&!(null==E?void 0:E.getFieldValue("pyCode"))){const t=(n=e.target.value,a.pinyin(n,{pattern:"first",type:"array",nonZh:"consecutive"}).join("").toUpperCase().normalize("NFD").replace(/[\u0300-\u036f]/g,""));E.setFieldsValue({pyCode:t})}var n},T=null==(s=f.getOrgInfo())?void 0:s.orgId,[L,I]=r.useState(T),R=r.useMemo(()=>h.some(e=>w&&e.children?e.children.some(e=>"deptSelect"===e.type):"deptSelect"===e.type),[h,w]),M=r.useMemo(()=>h.some(e=>w&&e.children?e.children.some(e=>"orgSelect"===e.type):"orgSelect"===e.type),[h,w]);r.useEffect(()=>{R&&U()},[L,R]),r.useEffect(()=>{M&&$()},[M]);const[B,D]=r.useState([]),[P,F]=r.useState([]),U=async()=>{const e=await C({orgId:L,pageNum:1,pageSize:0},"/common-service/common/queryDeptById");if(200===e.code){const t=[{name:"通用",id:-1},...e.data||[]];D(t||[])}},$=async()=>{const e=await C({loginOrgId:T,pageNum:1,pageSize:0},"/common-service/common/getOrgList");200===e.code&&F((null==e?void 0:e.data)||[])},z=e=>{if("view"!==u)return;const t=E.getFieldValue(e);if(null==t||""===t)return void i.message.warning("没有内容可复制");let n="";if("object"==typeof t)if(l.isDayjs(t))n=t.format("YYYY-MM-DD HH:mm:ss");else if(Array.isArray(t))n=t.map(e=>l.isDayjs(e)?e.format("YYYY-MM-DD HH:mm:ss"):String(e)).join(", ");else if(t.addProvince){const e=[t.addProvince,t.addCity,t.addCounty,t.addStreet,t.address].filter(Boolean);n=e.join("-")}else n=JSON.stringify(t);else n=String(t);navigator.clipboard.writeText(n).then(()=>{i.message.success("已复制到剪贴板")}).catch(()=>{const e=document.createElement("textarea");e.value=n,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select();try{document.execCommand("copy"),i.message.success("已复制到剪贴板")}catch(t){}document.body.removeChild(e)})},V=e=>{var t,r,s,o;const{type:l,name:a,placeholder:c,options:u,rules:h,...d}=e,f=k?"":c||`请输入${e.label}`,p=k?"":c||`请选择${e.label}`;switch(l){case"input":return n.jsx(i.Input,{placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a),onBlur:t=>O(t,e)});case"inputoption":return n.jsx(i.Input,{placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a),addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(r=null==(t=e.options)?void 0:t[0])?void 0:r.value,children:n.jsx(_,{disabled:k,options:e.options,allowClear:!k})})});case"inputnumberoption":return n.jsx(i.InputNumber,{className:oa,placeholder:f,addonAfter:n.jsx(i.Form.Item,{name:e.optionname,noStyle:!0,initialValue:null==(o=null==(s=e.options)?void 0:s[0])?void 0:o.value,children:n.jsx(_,{disabled:k,options:e.options,allowClear:!k})}),...d});case"password":return n.jsx(i.Input.Password,{placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a)});case"datePicker":return n.jsx(i.DatePicker,{style:{width:"100%"},placeholder:p,...d,disabled:k||d.disabled,allowClear:!k});case"InputNumber":return n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a)});case"Radio":return n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(i.Radio.Group,{style:{pointerEvents:k?"none":"auto",...d.style},disabled:k||d.disabled,options:u,...d})});case"treeSelect":{const t=!!e.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(_,{className:sa,allowClear:!k,style:{width:"100%"},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...d,disabled:k||d.disabled})})})}case"select":{const t=!!e.multiple||(null==d?void 0:d.multiple)||(null==d?void 0:d.treeCheckable),r=e=>{try{const t=(e||[]).map(e=>{var t,n;return"string"==typeof(null==e?void 0:e.label)?e.label:(null==(n=null==(t=null==e?void 0:e.label)?void 0:t.props)?void 0:n.children)??(null==e?void 0:e.value)}).filter(Boolean).join(",");return n.jsxs("span",{title:t,children:["+",e.length,"…"]})}catch(t){return n.jsxs("span",{children:["+",(null==e?void 0:e.length)||0,"…"]})}};return n.jsx("div",{onDoubleClick:()=>z(a),style:{display:"inline-block",width:"100%"},children:n.jsx(i.Form.Item,{name:a,style:{width:"100%",display:"inline-block"},children:n.jsx(_,{className:sa,allowClear:!k,style:{width:"100%"},placeholder:f,treeData:e.options,...t?{maxTagCount:1,maxTagPlaceholder:r}:{},...d,disabled:k||d.disabled})})})}case"upload":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ye,{value:e.value,...d},`upload_${e.name}`)})});case"file":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ia,{...d})})});case"textarea":return n.jsx(ua,{rows:4,placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a)});case"area":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(Ge,{...d})})});case"richText":const{style:l,...c}=d;return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},onDoubleClick:()=>z(a),children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(na,{style:l})})});case"doubleValue":return n.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[n.jsx(i.Form.Item,{name:e.firstLabel||"first",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:e.firstPlaceholder||`请输入${e.firstLabel||"最小值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:e.separator||"至"}),n.jsx(i.Form.Item,{name:e.secondLabel||"second",noStyle:!0,children:n.jsx(i.InputNumber,{style:{width:"100%"},placeholder:e.secondPlaceholder||`请输入${e.secondLabel||"最大值"}`,decimalSeparator:".",parser:e=>{if(!e)return"";const t=e.replace(/[^\d.,-]/g,"").replace(/,/g,"."),n=t.split(".");return n.length>2?n[0]+"."+n.slice(1).join(""):t},...d})}),n.jsx("span",{style:{margin:"0 10px"},children:e.lastUnit})]});case"deptSelect":return n.jsx(_,{allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:B,disabled:k||d.disabled,...d});case"orgSelect":return n.jsx(_,{onChange:e=>{I(e)},allowClear:!0,fieldNames:{label:"name",value:"id"},style:{width:"100%"},placeholder:p,options:P,disabled:k||d.disabled,...d});case"uploadByte":return n.jsx("div",{style:{pointerEvents:k?"none":"auto"},children:n.jsx(i.Form.Item,{name:a,noStyle:!0,children:n.jsx(ca,{disabled:k||d.disabled,...d})})});default:return n.jsx(i.Input,{placeholder:f,...d,readOnly:k||d.readOnly,onDoubleClick:()=>z(a)})}},H=g||("add"===u?"新增":"edit"===u?"编辑":"查看");return n.jsx(i.Modal,{title:H,open:c,onOk:async()=>{try{const e=await E.validateFields();N&&await(async e=>{var t,n,r,i,s,o;if(!N)return;const{validateApi:l,validateFields:a,validateMethod:c="POST",validateParams:u,validateMessage:h="验证失败",union:f=!1,group:p=[]}=N,m=(null==d?void 0:d.id)||(null==d?void 0:d.ID)||null;if(u){const r=u(e),i="GET"===c?await j(r,l):await C(r,l);if(200!==i.code){const e=i.msg||h;throw new Error(e)}if(Array.isArray(i.data)){const e=i.data.filter(e=>!0===e.value);if(e.length>0){const t=e.map(e=>({name:e.field,errors:[h]}));throw E.setFields(t),new Error(h)}}else if(!1===i.data||!1===(null==(t=i.data)?void 0:t.valid)){const e=(null==(n=i.data)?void 0:n.message)||i.msg||h;throw new Error(e)}return}if(p&&p.length>0){const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0,group:p},s="GET"===c?await j(n,l):await C(n,l);if(200!==s.code){const e=s.msg||h;throw new Error(e)}if(Array.isArray(s.data)){const e=s.data.filter(e=>!0===e.value);if(e.length>0){const{errorFields:t,errorMessage:n}=S(e,p);throw E.setFields(t),new Error(n)}}else if(!1===s.data||!1===(null==(r=s.data)?void 0:r.valid)){const e=(null==(i=s.data)?void 0:i.message)||s.msg||h;throw new Error(e)}}else{const t={};a.forEach(n=>{void 0!==e[n]&&null!==e[n]&&(t[n]=e[n])});const n={field:a,value:t,id:m,union:f?1:0},r="GET"===c?await j(n,l):await C(n,l);if(200!==r.code){const e=r.msg||h;throw new Error(e)}if(Array.isArray(r.data)){const e=r.data.filter(e=>!0===e.value);if(e.length>0){let t=[],n=h;if(p&&Array.isArray(p)&&p.length>0){const r=S(e,p);t=r.errorFields,n=r.errorMessage}else if(f&&e.length>1){const r=e.map(e=>A(e.field));n=r.join("、")+"同时重复",t=e.map(e=>({name:e.field,errors:[n]}))}else t=e.map(e=>{const t=A(e.field);return{name:e.field,errors:[t+"重复"]}}),1===e.length&&(n=A(e[0].field)+"重复");throw E.setFields(t),new Error(n)}}else if(!1===r.data||!1===(null==(s=r.data)?void 0:s.valid)){const e=(null==(o=r.data)?void 0:o.message)||r.msg||h;throw new Error(e)}}})(e);const t={...e},n=[];w?h.forEach(e=>{e.children&&n.push(...e.children)}):n.push(...h),n.forEach(e=>{var n,r;if(void 0===e.defaultValue||void 0!==t[e.name]&&null!==t[e.name]||(t[e.name]=e.defaultValue),"datePicker"===e.type&&t[e.name]?l.isDayjs(t[e.name])&&(t[e.name]=t[e.name].toISOString()):"rangePicker"===e.type&&t[e.name]&&Array.isArray(t[e.name])&&(t[e.name]=t[e.name].map(e=>l.isDayjs(e)?e.toISOString():e)),"select"===e.type&&e.labelName){const r=null==(n=e.options)?void 0:n.find(n=>n[e.fieldNames.value]===t[e.name]),i=e.fieldNames.label,s=r?r[i]:void 0;t[e.labelName]=s}if("treeSelect"===e.type&&e.multiple&&(t[e.name]=null==(r=t[e.name])?void 0:r.join(",")),"Radio"===e.type&&e.options&&void 0!==t[e.name]&&null!==t[e.name]){const n=e.options.find(n=>n.value==t[e.name]);n&&"number"==typeof n.value&&(t[e.name]=Number(t[e.name]))}}),await p(t)}catch(e){(null==e?void 0:e.message)&&(i.message.error(e.message),(null==e?void 0:e.errorFields)&&E.setFields(e.errorFields))}},onCancel:m,width:y.width||800,confirmLoading:b,destroyOnClose:!0,maskClosable:!1,footer:(e,{OkBtn:t,CancelBtn:r})=>n.jsxs(n.Fragment,{children:[x&&x(E.getFieldsValue()),n.jsx(r,{}),n.jsx(t,{})]}),...y,children:n.jsx(i.Form,{form:E,name:`modal_form_${u}`,layout:"vertical",onValuesChange:(e,t)=>{if(v&&v(e,t),null==N?void 0:N.realtime){const n=Object.keys(e)[0];q(t,n)}},children:w?n.jsx(i.Tabs,{children:h.map(e=>{var t;return n.jsx(i.Tabs.TabPane,{tab:e.label,children:n.jsx(i.Row,{gutter:24,justify:"start",children:null==(t=null==e?void 0:e.children)?void 0:t.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?la:"",children:V(e)},e.name)},e.name))})},e.label)})}):n.jsx(i.Row,{gutter:24,justify:"start",children:h.map(e=>n.jsx(i.Col,{span:e.colSpan||6,children:n.jsx(i.Form.Item,{label:e.label,name:e.name,rules:e.rules,initialValue:e.defaultValue,className:k||e.disabled?la:"",children:V(e)},e.name)},e.name))})})})}),da="_container_18q8s_1",fa="_searchForm_18q8s_9",pa="_tableContainer_18q8s_15",ma="_pagination_18q8s_44",ga="_selectedRow_18q8s_63",ba=r.forwardRef(({searchFormConfig:e,addFormConfig:t,tableColumns:s,URL:l,editText:a,viewText:c,delText:u,CustomOperations:h,classjson:d,postParams:f,proplist:p,topHeight:m,isnopage:g,PropOtherButton:b,CustomModalFooter:v,editdclickback:y,oneditFormChange:x,onSearchFormChange:w,addisdisabled:N={isdisabled:!1,message:""},tableHeight:E=150,limit:k={addLimit:!0,delLimit:!0,editLimit:!0,searchLimit:!0},actionWidth:A,onRowClick:S,onDelete:j,tableId:q,isaddtab:_=!1,validateConfig:O,tableConfig:L,...I},R)=>{r.useImperativeHandle(R,()=>({getList:async()=>le(),setFieldsValue:e=>{var t;null==(t=ee.current)||t.setFieldsValue(e)},getFieldsValue:()=>{var e;return null==(e=ee.current)?void 0:e.getFieldsValue()},reload:()=>{le()},setCurrentRecord:e=>{W(e)},getSearchFieldsValue:()=>{var e;return null==(e=oe.current)?void 0:e.getFieldsValue()},setSearchFieldsValue:e=>{var t;null==(t=oe.current)||t.setFieldsValue(e)}}));const[M,B]=r.useState(!1),[D,P]=r.useState([]),[F,U]=r.useState({current:1,pageSize:50,total:0,showSizeChanger:!0,showQuickJumper:!0,showTotal:e=>`共 ${e} 条`}),[$,z]=r.useState(!1),[V,H]=r.useState("add"),[K,W]=r.useState(null),[Z,G]=r.useState([]),[Y,J]=r.useState([]),[X,Q]=r.useState([]),ee=r.useRef(null),te=r.useRef(f),ne=r.useRef(F),re=r.useRef(null),[ie,se]=r.useState(0),oe=r.useRef(null);r.useEffect(()=>{te.current=f},[f]),r.useEffect(()=>{ne.current=F},[F]),r.useEffect(()=>{$||W(null)},[$]);const le=o.debounce(async e=>{var t,n;if(!(null==l?void 0:l.search))return;const r=oe.current.getFieldsValue();for(const o in r)if(o.includes("/")){const e=o.split("/")[0],t=o.split("/")[1],n=r[o];r[e]=n&&n.length>0?r[o][0].format("YYYY-MM-DD"):null,r[t]=n&&n.length>0?r[o][1].format("YYYY-MM-DD"):null}else r[o]=r[o];const i={...null==(t=te.current)?void 0:t.searchParams,...e,pageNum:ne.current.current,pageSize:ne.current.pageSize,...r};g&&delete i.pageNum,g&&delete i.pageSize,B(!0);try{const e=await C(i,l.search);if(200===e.code){const t=(null==(n=null==e?void 0:e.data)?void 0:n.list)||(null==e?void 0:e.data),r=t.map(e=>(e.hasOwnProperty("addCountyCode")&&(e.alladdress={...e}),e)).map(e=>(e.alladdress={...e},e));P(r||[]),U(t=>{var n,r;return{...t,current:null==(n=null==e?void 0:e.data)?void 0:n.pageNum,total:null==(r=null==e?void 0:e.data)?void 0:r.total}})}else P([]),U(e=>({...e,total:0,current:1}))}catch(s){P([]),U(e=>({...e,total:0,current:1}))}finally{B(!1)}},100);r.useEffect(()=>{(null==l?void 0:l.search)&&le()},[F.current,F.pageSize,JSON.stringify(null==f?void 0:f.searchParams)]),r.useEffect(()=>{if(re.current&&X.length>0){const e=re.current.offsetHeight;se(e)}},[X]);const ae=r.useRef(null);r.useEffect(()=>{const e={title:"操作",key:"action",align:"center",width:A||150,fixed:"right",render:(e,t)=>n.jsx(n.Fragment,{children:n.jsxs(i.Space,{size:"small",ref:ae,children:["function"==typeof h?h(t):h,l.edit&&k.editLimit&&n.jsx("a",{onClick:()=>ue(t),children:a||"编辑"}),(l.view||l.edit)&&k.addLimit&&n.jsx("a",{onClick:()=>he(t),children:c||"查看"}),l.delete&&k.delLimit&&n.jsx("a",{onClick:()=>de(t),style:{color:"#f5222d"},children:u||"删除"})]})})},t=l.edit||l.delete||l.view||h,r=[...s],o=t?[...r,e]:r;J(o)},[]),r.useEffect(()=>{e&&Q(e)},[e]),r.useEffect(()=>{t&&G(t)},[t]);const ce=()=>{W(null),H("add"),z(!0),y&&y()},ue=e=>{W(e),H("edit"),z(!0),y&&y(e)},he=e=>{W(e),H("view"),z(!0)},de=async e=>{l.delete&&i.Modal.confirm({title:`确认${u||"删除"}?`,content:`确定要${u||"删除"}这条记录吗?`,okText:"确认",cancelText:"取消",onOk:async()=>{try{B(!0);if(200===(await C({id:e.id,...null==f?void 0:f.delParams},l.delete)).code){j&&j(e),i.message.success(`${u||"删除"}成功`);const t=F.current,n=F.pageSize,r=F.total-1;r>0&&(t-1)*n>=r&&t>1?(U(e=>({...e,current:e.current-1})),setTimeout(()=>{le()},0)):le()}}catch(t){}finally{B(!1)}}})},fe=window.parent!==window.self,pe={"--table-height":fe?`calc(100vh - ${ie}px - ${E}px + 63px)`:`calc(100vh - ${ie}px - ${E}px)`,height:fe?"calc(100vh)":"calc(100vh - 63px)"};return n.jsxs("div",{className:da,style:pe,children:[X.length>0||!m?n.jsx("div",{className:fa,ref:re,children:n.jsx(T,{config:X,onSearch:()=>{U(e=>({...e,current:1})),le()},onReset:()=>{U(e=>({...e,current:1})),le()},submitButtonText:"查询",resetButtonText:"重置",OtherButton:b||(()=>l.add&&k.addLimit&&n.jsx("div",{style:{marginLeft:"15px"},children:n.jsx(i.Tooltip,{title:N.isdisabled?N.message:"",children:n.jsx(i.Button,{type:"primary",onClick:ce,disabled:N.isdisabled,children:"新建"})})})),ref:oe,onSearchFormChange:(e,t)=>{w&&w(e,t)}})}):n.jsx("div",{style:{height:m}}),n.jsxs("div",{className:pa,style:{height:`calc(100% - ${ie}px-35px)`},children:[n.jsx(Ze,{page:F,virtual:g,tableId:q,scroll:{x:"1200px",y:"calc(100vh - 300px)"},onRowClick:S&&S,rowClassName:e=>e.id===(null==K?void 0:K.id)?ga:"",columns:Y,dataSource:p||D,loading:M,pagination:!1,onChange:e=>{U(t=>({...t,current:e.current,pageSize:e.pageSize}))},rowKey:"id",...L,...I}),!g&&n.jsx("div",{className:ma,children:n.jsx(i.Pagination,{size:"small",onChange:(e,t)=>{U(n=>({...n,current:e,pageSize:t}))},...F,showQuickJumper:!1})})]}),n.jsx(ha,{validateConfig:O,CustomModalFooter:v,ref:ee,oneditFormChange:x,visible:$,mode:V,config:"view"===V?Z.map(e=>({...e,disabled:!0})):Z,initialValues:K,onOk:async e=>{if(e.alladdress&&(e={...e,...e.alladdress}),"view"!==V){B(!0);try{let t;t="add"==V?await C({...e,...null==f?void 0:f.addParams},l.add):await C({id:null==K?void 0:K.id,...e,...null==f?void 0:f.editParams},l.edit),200==t.code&&(i.message.success(("add"===V?"添加":"更新")+"成功"),z(!1),le())}catch(t){}finally{B(!1)}}else z(!1)},onCancel:()=>z(!1),title:(()=>{switch(V){case"add":return"新增";case"edit":return"编辑";case"view":return"查看";default:return"信息"}})(),loading:M,tab:_,modalProps:"view"===V?{footer:[n.jsx(i.Button,{onClick:()=>z(!1),children:"关闭"},"close")],maskClosable:!0}:void 0})]})}),va=r.memo(ba);exports.CommonPage=va,exports.CustomAdd=ha,exports.CustomForm=T,exports.CustomTable=Ze,exports.NomalSelect=_;
7
7
  //# sourceMappingURL=index.cjs.map